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.
@@ -2784,7 +2784,7 @@ var LogicRunner = function LogicRunner(_ref) {
2784
2784
  React.useEffect(function () {
2785
2785
  var fetchStates = /*#__PURE__*/function () {
2786
2786
  var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
2787
- var res, mappedStates, _mappedStates$0$value, _mappedStates$;
2787
+ var res, mappedStates, _mappedStates$find, _mappedStates$0$value, _mappedStates$, stateExists;
2788
2788
 
2789
2789
  return runtime_1.wrap(function _callee$(_context) {
2790
2790
  while (1) {
@@ -2805,7 +2805,10 @@ var LogicRunner = function LogicRunner(_ref) {
2805
2805
  setStates(mappedStates);
2806
2806
 
2807
2807
  if (prevCountry.current !== values.country) {
2808
- setFieldValue('state', (_mappedStates$0$value = (_mappedStates$ = mappedStates[0]) == null ? void 0 : _mappedStates$.value) != null ? _mappedStates$0$value : '');
2808
+ stateExists = (_mappedStates$find = mappedStates.find(function (state) {
2809
+ return state.value === values.state;
2810
+ })) == null ? void 0 : _mappedStates$find.value;
2811
+ setFieldValue('state', stateExists != null ? stateExists : (_mappedStates$0$value = (_mappedStates$ = mappedStates[0]) == null ? void 0 : _mappedStates$.value) != null ? _mappedStates$0$value : '');
2809
2812
  prevCountry.current = values.country;
2810
2813
  }
2811
2814
 
@@ -3363,7 +3366,7 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref3) {
3363
3366
  enableReinitialize: false,
3364
3367
  onSubmit: function () {
3365
3368
  var _onSubmit = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(values, formikHelpers) {
3366
- 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;
3367
3370
 
3368
3371
  return runtime_1.wrap(function _callee6$(_context6) {
3369
3372
  while (1) {
@@ -3501,16 +3504,22 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref3) {
3501
3504
  setLoading(false);
3502
3505
 
3503
3506
  if (axios.isAxiosError(_context6.t1)) {
3504
- 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') {
3505
3508
  if (isWindowDefined) {
3506
3509
  window.localStorage.removeItem('user_data');
3507
3510
  window.localStorage.removeItem('access_token');
3508
3511
  setUserExpired(true);
3509
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);
3510
3519
  }
3511
3520
  }
3512
3521
 
3513
- 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) {
3514
3523
  setError(_get(_context6.t1, 'response.data.message'));
3515
3524
  }
3516
3525
 
@@ -5958,7 +5967,7 @@ var tableConfig = function tableConfig(key) {
5958
5967
  body: [function (row) {
5959
5968
  return row.id;
5960
5969
  }, function (row) {
5961
- return row.date;
5970
+ return row.timezone ? moment.tz(row.date, row.timezone).format('DD MMMM YYYY') : row.date;
5962
5971
  }, function (row) {
5963
5972
  return React__default.createElement(EventInfoItem, {
5964
5973
  image: row.image,