Skip to content

Commit

Permalink
Merge pull request #73 from Josmar-jr/feat/checks-if-create-quote-per…
Browse files Browse the repository at this point in the history
…mission-is-true

Feat/checks if create quote permission is true
  • Loading branch information
ataideverton authored Oct 10, 2024
2 parents 2469e8a + 8a7475e commit 55941e7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Added

- Displays the create quota button according to the value of the create quota permission

## [1.12.1] - 2024-09-05

### Fixed

- Provide app token on calls to b2b-organizations-graphql app

## [1.12.0] - 2024-09-04
Expand Down
19 changes: 11 additions & 8 deletions checkout-ui-custom/checkout6-custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,8 @@ const MAX_TIME_EXPIRATION = 1000 * 60 * 5 // 5 minutes
wrap.prepend(`
<div class="b2b-purchase-order-number">
<p class="b2b-purchase-order-number-label">
<label for="cart-b2b-purchase-order-number">${
getTranslation().cartPurchaseOrderLabel
}</label>
<label for="cart-b2b-purchase-order-number">${getTranslation().cartPurchaseOrderLabel
}</label>
</p>
<input class="input-small b2b-purchase-order-number-input" type="text" id="cart-b2b-purchase-order-number" value="${currValue}">
</div>
Expand Down Expand Up @@ -189,7 +188,7 @@ const MAX_TIME_EXPIRATION = 1000 * 60 * 5 // 5 minutes
app: 'b2b-quotes-graphql',
field: 'quoteId',
})
.then(function () {})
.then(function () { })
})
}
}
Expand Down Expand Up @@ -317,6 +316,7 @@ const MAX_TIME_EXPIRATION = 1000 * 60 * 5 // 5 minutes
}

const handleSettings = function () {

if (!settings) return

if (settings.showPONumber === true) {
Expand All @@ -327,7 +327,11 @@ const MAX_TIME_EXPIRATION = 1000 * 60 * 5 // 5 minutes
applyPermissions(settings.permissions)
}

if (settings.showQuoteButton) {
const createQuotePermission = JSON.parse(
window.sessionStorage.getItem('checkout.createQuote')
)

if (settings.showQuoteButton && createQuotePermission) {
buildCreateQuoteButton()
}

Expand Down Expand Up @@ -440,9 +444,8 @@ const MAX_TIME_EXPIRATION = 1000 * 60 * 5 // 5 minutes
const ts = new Date().getTime()

$.ajax({
url: `${rootPath}/_v/private/b2b-checkout-settings/${
isWorkspace() ? `?v=${ts}` : ''
}`,
url: `${rootPath}/_v/private/b2b-checkout-settings/${isWorkspace() ? `?v=${ts}` : ''
}`,
}).then(function (response) {
if (Object.keys(response).length === 0) {
window.sessionStorage.removeItem('b2b-checkout-settings')
Expand Down
2 changes: 1 addition & 1 deletion node/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3615,7 +3615,7 @@ stack-utils@^2.0.3:
dependencies:
escape-string-regexp "^2.0.0"

"stats-lite@github:vtex/node-stats-lite#dist":
stats-lite@vtex/node-stats-lite#dist:
version "2.2.0"
resolved "https://codeload.github.com/vtex/node-stats-lite/tar.gz/1b0d39cc41ef7aaecfd541191f877887a2044797"
dependencies:
Expand Down

0 comments on commit 55941e7

Please sign in to comment.