tf-checkout-react 1.0.83 → 1.0.84

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1258,8 +1258,14 @@ var getProfileData = function getProfileData(accessToken) {
1258
1258
  Authorization: "Bearer " + accessToken
1259
1259
  })
1260
1260
  })["catch"](function (e) {
1261
+ var _e$response, _e$response$data;
1262
+
1263
+ var errorType = e == null ? void 0 : (_e$response = e.response) == null ? void 0 : (_e$response$data = _e$response.data) == null ? void 0 : _e$response$data.error;
1264
+
1261
1265
  if (isWindowDefined) {
1262
- var event = new window.CustomEvent('auth_error', e);
1266
+ var event = new window.CustomEvent('auth_error', {
1267
+ detail: errorType
1268
+ });
1263
1269
  window.document.dispatchEvent(event);
1264
1270
  }
1265
1271
 
@@ -2367,8 +2373,12 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2367
2373
  return qty;
2368
2374
  };
2369
2375
 
2370
- var handleAuthErrors = React.useCallback(function () {
2376
+ var handleAuthErrors = React.useCallback(function (e) {
2371
2377
  setIsLoggedIn(false);
2378
+
2379
+ if (isWindowDefined && (e == null ? void 0 : e.detail) === 'invalid_token') {
2380
+ window.location.href = '/';
2381
+ }
2372
2382
  }, []);
2373
2383
  React.useEffect(function () {
2374
2384
  isWindowDefined && window.document.addEventListener('auth_error', handleAuthErrors);