tf-checkout-react 1.3.11 → 1.3.12

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.
@@ -3366,7 +3366,7 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref3) {
3366
3366
  enableReinitialize: false,
3367
3367
  onSubmit: function () {
3368
3368
  var _onSubmit = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(values, formikHelpers) {
3369
- var _checkoutBody, _res, updatedUserData, _profileSpecifiedData, _profileDataObj, checkoutBodyForRegistration, bodyFormData, resRegister, _xtfCookie, accessToken, refreshToken, userProfile, _e$response, _e$response$data, _error, profileData, profileSpecifiedData, profileDataObj, checkoutBody, res, _e$response2, _e$response3;
3369
+ var _checkoutBody, _res, updatedUserData, _profileSpecifiedData, _profileDataObj, checkoutBodyForRegistration, bodyFormData, resRegister, _xtfCookie, accessToken, refreshToken, userProfile, _e$response, _e$response$data, _error, profileData, profileSpecifiedData, profileDataObj, checkoutBody, res, _e$response2, _e$response3, _e$response3$data, _e$response4, event;
3370
3370
 
3371
3371
  return runtime_1.wrap(function _callee6$(_context6) {
3372
3372
  while (1) {
@@ -3504,16 +3504,22 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref3) {
3504
3504
  setLoading(false);
3505
3505
 
3506
3506
  if (axios.isAxiosError(_context6.t1)) {
3507
- if (((_e$response2 = _context6.t1.response) == null ? void 0 : _e$response2.data.error) === 'invalid_token') {
3507
+ if (((_e$response2 = _context6.t1.response) == null ? void 0 : _e$response2.status) === 401 || ((_e$response3 = _context6.t1.response) == null ? void 0 : (_e$response3$data = _e$response3.data) == null ? void 0 : _e$response3$data.error) === 'invalid_token') {
3508
3508
  if (isWindowDefined) {
3509
3509
  window.localStorage.removeItem('user_data');
3510
3510
  window.localStorage.removeItem('access_token');
3511
3511
  setUserExpired(true);
3512
3512
  setShowModalLogin(true);
3513
+ setIsLoggedIn(false);
3514
+ setShowModalSignup(false);
3515
+ setShowModalForgotPassword(false);
3516
+ event = new window.CustomEvent('tf-logout');
3517
+ deleteCookieByName('X-TF-ECOMMERCE');
3518
+ window.document.dispatchEvent(event);
3513
3519
  }
3514
3520
  }
3515
3521
 
3516
- if ((_e$response3 = _context6.t1.response) != null && _e$response3.data.message && !hideErrorsAlertSection) {
3522
+ if ((_e$response4 = _context6.t1.response) != null && _e$response4.data.message && !hideErrorsAlertSection) {
3517
3523
  setError(_get(_context6.t1, 'response.data.message'));
3518
3524
  }
3519
3525