diff --git a/CHANGELOG.md b/CHANGELOG.md index 8608d3b..b35393a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/checkout-ui-custom/checkout6-custom.js b/checkout-ui-custom/checkout6-custom.js index e92fcaa..410b0e7 100644 --- a/checkout-ui-custom/checkout6-custom.js +++ b/checkout-ui-custom/checkout6-custom.js @@ -158,9 +158,8 @@ const MAX_TIME_EXPIRATION = 1000 * 60 * 5 // 5 minutes wrap.prepend(`

- +

@@ -189,7 +188,7 @@ const MAX_TIME_EXPIRATION = 1000 * 60 * 5 // 5 minutes app: 'b2b-quotes-graphql', field: 'quoteId', }) - .then(function () {}) + .then(function () { }) }) } } @@ -317,6 +316,7 @@ const MAX_TIME_EXPIRATION = 1000 * 60 * 5 // 5 minutes } const handleSettings = function () { + if (!settings) return if (settings.showPONumber === true) { @@ -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() } @@ -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') diff --git a/node/yarn.lock b/node/yarn.lock index 8a6f410..9cb8730 100644 --- a/node/yarn.lock +++ b/node/yarn.lock @@ -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: