tf-checkout-react 1.3.10 → 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.
@@ -2782,7 +2782,7 @@ var LogicRunner = function LogicRunner(_ref) {
2782
2782
  useEffect(function () {
2783
2783
  var fetchStates = /*#__PURE__*/function () {
2784
2784
  var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
2785
- var res, mappedStates, _mappedStates$0$value, _mappedStates$;
2785
+ var res, mappedStates, _mappedStates$find, _mappedStates$0$value, _mappedStates$, stateExists;
2786
2786
 
2787
2787
  return runtime_1.wrap(function _callee$(_context) {
2788
2788
  while (1) {
@@ -2803,7 +2803,10 @@ var LogicRunner = function LogicRunner(_ref) {
2803
2803
  setStates(mappedStates);
2804
2804
 
2805
2805
  if (prevCountry.current !== values.country) {
2806
- setFieldValue('state', (_mappedStates$0$value = (_mappedStates$ = mappedStates[0]) == null ? void 0 : _mappedStates$.value) != null ? _mappedStates$0$value : '');
2806
+ stateExists = (_mappedStates$find = mappedStates.find(function (state) {
2807
+ return state.value === values.state;
2808
+ })) == null ? void 0 : _mappedStates$find.value;
2809
+ setFieldValue('state', stateExists != null ? stateExists : (_mappedStates$0$value = (_mappedStates$ = mappedStates[0]) == null ? void 0 : _mappedStates$.value) != null ? _mappedStates$0$value : '');
2807
2810
  prevCountry.current = values.country;
2808
2811
  }
2809
2812
 
@@ -3361,7 +3364,7 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref3) {
3361
3364
  enableReinitialize: false,
3362
3365
  onSubmit: function () {
3363
3366
  var _onSubmit = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(values, formikHelpers) {
3364
- 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;
3367
+ 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;
3365
3368
 
3366
3369
  return runtime_1.wrap(function _callee6$(_context6) {
3367
3370
  while (1) {
@@ -3499,16 +3502,22 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref3) {
3499
3502
  setLoading(false);
3500
3503
 
3501
3504
  if (axios.isAxiosError(_context6.t1)) {
3502
- if (((_e$response2 = _context6.t1.response) == null ? void 0 : _e$response2.data.error) === 'invalid_token') {
3505
+ 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') {
3503
3506
  if (isWindowDefined) {
3504
3507
  window.localStorage.removeItem('user_data');
3505
3508
  window.localStorage.removeItem('access_token');
3506
3509
  setUserExpired(true);
3507
3510
  setShowModalLogin(true);
3511
+ setIsLoggedIn(false);
3512
+ setShowModalSignup(false);
3513
+ setShowModalForgotPassword(false);
3514
+ event = new window.CustomEvent('tf-logout');
3515
+ deleteCookieByName('X-TF-ECOMMERCE');
3516
+ window.document.dispatchEvent(event);
3508
3517
  }
3509
3518
  }
3510
3519
 
3511
- if ((_e$response3 = _context6.t1.response) != null && _e$response3.data.message && !hideErrorsAlertSection) {
3520
+ if ((_e$response4 = _context6.t1.response) != null && _e$response4.data.message && !hideErrorsAlertSection) {
3512
3521
  setError(_get(_context6.t1, 'response.data.message'));
3513
3522
  }
3514
3523
 
@@ -5956,7 +5965,7 @@ var tableConfig = function tableConfig(key) {
5956
5965
  body: [function (row) {
5957
5966
  return row.id;
5958
5967
  }, function (row) {
5959
- return row.date;
5968
+ return row.timezone ? moment.tz(row.date, row.timezone).format('DD MMMM YYYY') : row.date;
5960
5969
  }, function (row) {
5961
5970
  return React.createElement(EventInfoItem, {
5962
5971
  image: row.image,