diff --git a/CHANGELOG.md b/CHANGELOG.md index e396ee5..d3b044e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Fixed +- Fixed issue with unauthenticated B2C users in checkout shipping step + ## [1.10.1] - 2023-08-17 ### Fixed - Fix conditional chain causing issue when retrieving Cost Center data diff --git a/checkout-ui-custom/checkout6-custom.js b/checkout-ui-custom/checkout6-custom.js index e92fcaa..29875ee 100644 --- a/checkout-ui-custom/checkout6-custom.js +++ b/checkout-ui-custom/checkout6-custom.js @@ -443,8 +443,13 @@ const MAX_TIME_EXPIRATION = 1000 * 60 * 5 // 5 minutes url: `${rootPath}/_v/private/b2b-checkout-settings/${ isWorkspace() ? `?v=${ts}` : '' }`, + error: function(err) { + window.sessionStorage.removeItem('b2b-checkout-settings') + + return + } }).then(function (response) { - if (Object.keys(response).length === 0) { + if (Object.keys(response).length === 0 || response.error === 'User not authenticated') { window.sessionStorage.removeItem('b2b-checkout-settings') return diff --git a/node/resolvers/Routes/index.ts b/node/resolvers/Routes/index.ts index b3d2ada..638b719 100644 --- a/node/resolvers/Routes/index.ts +++ b/node/resolvers/Routes/index.ts @@ -19,7 +19,7 @@ export default { ctx.response.body = { error: 'User not authenticated', } - ctx.response.status = 200 + ctx.response.status = 400 ctx.set('cache-control', 'no-cache') } else { diff --git a/node/yarn.lock b/node/yarn.lock index 1b807e7..5c8689a 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: