tf-checkout-react 1.3.31 → 1.3.33

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.
@@ -4,6 +4,7 @@ import Button from '@mui/material/Button';
4
4
  import { ThemeProvider, createTheme } from '@mui/material/styles';
5
5
  import axios from 'axios';
6
6
  import { connect, Formik, Form, Field } from 'formik';
7
+ import _find from 'lodash-es/find';
7
8
  import _get from 'lodash-es/get';
8
9
  import _identity from 'lodash-es/identity';
9
10
  import _includes from 'lodash-es/includes';
@@ -20,13 +21,18 @@ import TextField from '@mui/material/TextField';
20
21
  import { useTheme } from '@mui/styles';
21
22
  import _isFunction from 'lodash-es/isFunction';
22
23
  import _isObject from 'lodash-es/isObject';
23
- import FormGroup from '@mui/material/FormGroup';
24
- import FormControlLabel from '@mui/material/FormControlLabel';
25
24
  import Checkbox from '@mui/material/Checkbox';
25
+ import FormControlLabel from '@mui/material/FormControlLabel';
26
+ import FormGroup from '@mui/material/FormGroup';
26
27
  import MuiPhoneNumber from 'material-ui-phone-number';
27
28
  import _debounce from 'lodash-es/debounce';
28
29
  import CircularProgress from '@mui/material/CircularProgress';
29
30
  import Select from '@mui/material/Select';
31
+ import FormControl$1 from '@mui/material/FormControl';
32
+ import FormHelperText$1 from '@mui/material/FormHelperText';
33
+ import FormLabel from '@mui/material/FormLabel';
34
+ import Radio from '@mui/material/Radio';
35
+ import RadioGroup from '@mui/material/RadioGroup';
30
36
  import { object, string, ref, boolean } from 'yup';
31
37
  import Box$1 from '@mui/material/Box';
32
38
  import Modal$1 from '@mui/material/Modal';
@@ -42,12 +48,10 @@ import { loadStripe } from '@stripe/stripe-js';
42
48
  import { FacebookShareButton, FacebookIcon, FacebookMessengerShareButton, FacebookMessengerIcon, TwitterShareButton, TwitterIcon, LinkedinShareButton, LinkedinIcon, PinterestShareButton, PinterestIcon, VKShareButton, VKIcon, OKShareButton, OKIcon, TelegramShareButton, TelegramIcon, WhatsappShareButton, WhatsappIcon, RedditShareButton, RedditIcon, TumblrShareButton, TumblrIcon, MailruShareButton, MailruIcon, EmailShareButton, EmailIcon, LivejournalShareButton, LivejournalIcon, ViberShareButton, ViberIcon, WorkplaceShareButton, WorkplaceIcon, LineShareButton, LineIcon, PocketShareButton, PocketIcon, InstapaperShareButton, InstapaperIcon, WeiboShareButton, WeiboIcon, HatenaShareButton, HatenaIcon } from 'react-share';
43
49
  import { ThemeProvider as ThemeProvider$1 } from '@mui/private-theming';
44
50
  import jwt_decode from 'jwt-decode';
45
- import _find from 'lodash-es/find';
46
51
  import _some from 'lodash-es/some';
47
52
  import Button$1 from 'react-bootstrap/Button';
48
53
  import moment from 'moment-timezone';
49
54
  import _sortBy from 'lodash-es/sortBy';
50
- import FormControl$1 from '@mui/material/FormControl';
51
55
  import MenuItem from '@mui/material/MenuItem';
52
56
  import Autocomplete from '@mui/material/Autocomplete';
53
57
  import Paper from '@mui/material/Paper';
@@ -59,7 +63,6 @@ import TableHead from '@mui/material/TableHead';
59
63
  import TablePagination from '@mui/material/TablePagination';
60
64
  import TableRow from '@mui/material/TableRow';
61
65
  import _has from 'lodash-es/has';
62
- import Radio from '@mui/material/Radio';
63
66
  import _isNull from 'lodash-es/isNull';
64
67
  import _reverse from 'lodash-es/reverse';
65
68
 
@@ -1180,6 +1183,22 @@ var createMarkup = function createMarkup(data) {
1180
1183
  };
1181
1184
  };
1182
1185
 
1186
+ var setLoggedUserData = function setLoggedUserData(data) {
1187
+ return {
1188
+ id: data.id,
1189
+ first_name: data.firstName,
1190
+ last_name: data.lastName,
1191
+ email: data.email,
1192
+ confirmEmail: data.email,
1193
+ city: (data == null ? void 0 : data.city) || '',
1194
+ country: (data == null ? void 0 : data.countryId) || (data == null ? void 0 : data.country) || '',
1195
+ phone: (data == null ? void 0 : data.phone) || '',
1196
+ street_address: (data == null ? void 0 : data.streetAddress) || '',
1197
+ state: (data == null ? void 0 : data.stateId) || '',
1198
+ zip: (data == null ? void 0 : data.zip) || (data == null ? void 0 : data.zipCode) || ''
1199
+ };
1200
+ };
1201
+
1183
1202
  var isWindowDefined = typeof window !== 'undefined';
1184
1203
  var isDocumentDefined = typeof document !== 'undefined';
1185
1204
 
@@ -1459,7 +1478,7 @@ var getProfileData = function getProfileData(accessToken) {
1459
1478
  });
1460
1479
  };
1461
1480
  var getCountries = function getCountries() {
1462
- return publicRequest.get('/countries/');
1481
+ return publicRequest.get('/countries/list');
1463
1482
  };
1464
1483
  var getConfirmationData = function getConfirmationData(orderHash) {
1465
1484
  return publicRequest.get("v1/order/" + orderHash + "/payment/complete");
@@ -1794,7 +1813,7 @@ var DatePickerField = function DatePickerField(_ref) {
1794
1813
  })));
1795
1814
  };
1796
1815
 
1797
- var _excluded = ["label", "field", "selectOptions", "theme", "setFieldValue", "disableDropdown", "setPhoneValidationIsLoading"];
1816
+ var _excluded = ["label", "field", "selectOptions", "theme", "setFieldValue", "disableDropdown", "setPhoneValidationIsLoading", "defaultCountry", "dateFormat", "datePlaceholder"];
1798
1817
  var CheckboxField = function CheckboxField(_ref) {
1799
1818
  var _rest$form, _field$name, _rest$form2, _field$name2;
1800
1819
 
@@ -1804,14 +1823,14 @@ var CheckboxField = function CheckboxField(_ref) {
1804
1823
 
1805
1824
  var customTheme = useTheme();
1806
1825
  return React.createElement(FormControl, {
1807
- error: !!(rest != null && (_rest$form = rest.form) != null && _rest$form.errors && rest.form.errors[(_field$name = field == null ? void 0 : field.name) != null ? _field$name : ""])
1826
+ error: !!(rest != null && (_rest$form = rest.form) != null && _rest$form.errors && rest.form.errors[(_field$name = field == null ? void 0 : field.name) != null ? _field$name : ''])
1808
1827
  }, React.createElement(FormGroup, null, React.createElement(FormControlLabel, {
1809
1828
  control: React.createElement(Checkbox, Object.assign({}, field, rest)),
1810
1829
  label: label,
1811
1830
  componentsProps: {
1812
1831
  typography: customTheme == null ? void 0 : customTheme.checkbox
1813
1832
  }
1814
- })), !!(rest != null && (_rest$form2 = rest.form) != null && _rest$form2.errors && rest.form.errors[(_field$name2 = field == null ? void 0 : field.name) != null ? _field$name2 : ""]) ? React.createElement(FormHelperText, null, "Required") : null);
1833
+ })), !!(rest != null && (_rest$form2 = rest.form) != null && _rest$form2.errors && rest.form.errors[(_field$name2 = field == null ? void 0 : field.name) != null ? _field$name2 : '']) ? React.createElement(FormHelperText, null, "Required") : null);
1815
1834
  };
1816
1835
 
1817
1836
  var PhoneNumberField = function PhoneNumberField(_ref) {
@@ -1996,6 +2015,48 @@ var SelectField = function SelectField(_ref) {
1996
2015
  }, error) : null);
1997
2016
  };
1998
2017
 
2018
+ var RadioGroupField = function RadioGroupField(_ref) {
2019
+ var label = _ref.label,
2020
+ field = _ref.field,
2021
+ radios = _ref.radios,
2022
+ _ref$form = _ref.form,
2023
+ errors = _ref$form.errors,
2024
+ setFieldValue = _ref$form.setFieldValue,
2025
+ _ref$onChange = _ref.onChange,
2026
+ onChange = _ref$onChange === void 0 ? _identity : _ref$onChange;
2027
+ var radioId = "radio-" + field.name;
2028
+
2029
+ var error = _get(errors, field.name);
2030
+
2031
+ var handleChange = function handleChange(e) {
2032
+ var value = e.target.value;
2033
+ setFieldValue(field.name, value);
2034
+ onChange(e);
2035
+ };
2036
+
2037
+ return React.createElement(FormControl$1, null, error ? React.createElement(FormHelperText$1, {
2038
+ className: "radio-error",
2039
+ error: true
2040
+ }, error) : null, label && React.createElement(FormLabel, {
2041
+ id: radioId
2042
+ }, label), React.createElement(RadioGroup, {
2043
+ "aria-labelledby": radioId,
2044
+ name: field.name,
2045
+ value: field.value,
2046
+ onChange: handleChange
2047
+ }, radios.map(function (radio) {
2048
+ var id = radio.id,
2049
+ name = radio.name,
2050
+ value = radio.value;
2051
+ return React.createElement(FormControlLabel, {
2052
+ key: id,
2053
+ label: name,
2054
+ value: value,
2055
+ control: React.createElement(Radio, null)
2056
+ });
2057
+ })));
2058
+ };
2059
+
1999
2060
  var SnackbarAlert = function SnackbarAlert(_ref) {
2000
2061
  var isOpen = _ref.isOpen,
2001
2062
  message = _ref.message,
@@ -2181,7 +2242,7 @@ var style$1 = {
2181
2242
  border: '1px solid white',
2182
2243
  outline: 'none'
2183
2244
  };
2184
- var setLoggedUserData = function setLoggedUserData(data) {
2245
+ var setLoggedUserData$1 = function setLoggedUserData(data) {
2185
2246
  return {
2186
2247
  id: data.id,
2187
2248
  first_name: data.firstName,
@@ -2279,7 +2340,7 @@ var LoginModal = function LoginModal(_ref) {
2279
2340
 
2280
2341
  case 17:
2281
2342
  profileSpecifiedData = _get(profileResponse, 'data.data');
2282
- profileDataObj = setLoggedUserData(profileSpecifiedData);
2343
+ profileDataObj = setLoggedUserData$1(profileSpecifiedData);
2283
2344
 
2284
2345
  if (typeof window !== 'undefined') {
2285
2346
  window.localStorage.setItem('user_data', JSON.stringify(profileDataObj));
@@ -2718,7 +2779,7 @@ var createRegisterFormData = function createRegisterFormData(values, checkoutBod
2718
2779
 
2719
2780
  return bodyFormData;
2720
2781
  };
2721
- var setLoggedUserData$1 = function setLoggedUserData(data) {
2782
+ var setLoggedUserData$2 = function setLoggedUserData(data) {
2722
2783
  return {
2723
2784
  id: data.id,
2724
2785
  first_name: data.firstName,
@@ -3056,6 +3117,7 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
3056
3117
 
3057
3118
  var themeMui = createTheme(themeOptions);
3058
3119
  var isWindowDefined = typeof window !== 'undefined';
3120
+ var defaultCountry = isWindowDefined ? window.localStorage.getItem('eventCountry') : '';
3059
3121
  var userData = isWindowDefined && window.localStorage.getItem('user_data') ? JSON.parse(window.localStorage.getItem('user_data') || '') : {};
3060
3122
  var access_token = isWindowDefined && window.localStorage.getItem('access_token') ? window.localStorage.getItem('access_token') || '' : '';
3061
3123
 
@@ -3127,13 +3189,17 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
3127
3189
  loading = _useState14[0],
3128
3190
  setLoading = _useState14[1];
3129
3191
 
3130
- var _useState15 = useState(null),
3131
- error = _useState15[0],
3132
- setError = _useState15[1];
3192
+ var _useState15 = useState(true),
3193
+ isCountriesLoading = _useState15[0],
3194
+ setIsCountriesLoading = _useState15[1];
3195
+
3196
+ var _useState16 = useState(null),
3197
+ error = _useState16[0],
3198
+ setError = _useState16[1];
3133
3199
 
3134
- var _useState16 = useState(false),
3135
- phoneValidationIsLoading = _useState16[0],
3136
- setPhoneValidationIsLoading = _useState16[1];
3200
+ var _useState17 = useState(false),
3201
+ phoneValidationIsLoading = _useState17[0],
3202
+ setPhoneValidationIsLoading = _useState17[1];
3137
3203
 
3138
3204
  var emailLogged = _get(userData, 'email', '') || _get(userValues, 'email', '');
3139
3205
 
@@ -3213,30 +3279,34 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
3213
3279
  case 3:
3214
3280
  res = _context2.sent;
3215
3281
  setCustomHeader(res);
3216
- setCountries(_map(_get(res, 'data.data'), function (item, key) {
3282
+ setCountries(_map(_get(res, 'data.data'), function (item) {
3217
3283
  return {
3218
- label: item,
3219
- value: key
3284
+ label: item.name,
3285
+ value: item.id,
3286
+ code: item.code
3220
3287
  };
3221
3288
  }));
3289
+ setIsCountriesLoading(false);
3222
3290
  onGetCountriesSuccess(res.data);
3223
- _context2.next = 12;
3291
+ _context2.next = 14;
3224
3292
  break;
3225
3293
 
3226
- case 9:
3227
- _context2.prev = 9;
3294
+ case 10:
3295
+ _context2.prev = 10;
3228
3296
  _context2.t0 = _context2["catch"](0);
3229
3297
 
3230
3298
  if (axios.isAxiosError(_context2.t0)) {
3231
3299
  onGetCountriesError(_context2.t0);
3232
3300
  }
3233
3301
 
3234
- case 12:
3302
+ setIsCountriesLoading(false);
3303
+
3304
+ case 14:
3235
3305
  case "end":
3236
3306
  return _context2.stop();
3237
3307
  }
3238
3308
  }
3239
- }, _callee2, null, [[0, 9]]);
3309
+ }, _callee2, null, [[0, 10]]);
3240
3310
  }));
3241
3311
 
3242
3312
  return function fetchCountries() {
@@ -3315,7 +3385,7 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
3315
3385
  case 4:
3316
3386
  userDataResponse = _context4.sent;
3317
3387
  profileSpecifiedData = _get(userDataResponse, 'data.data');
3318
- profileDataObj = setLoggedUserData$1(profileSpecifiedData);
3388
+ profileDataObj = setLoggedUserData$2(profileSpecifiedData);
3319
3389
  setUserValues(_extends({}, profileDataObj, {
3320
3390
  firstName: profileDataObj.first_name,
3321
3391
  lastName: profileDataObj.last_name
@@ -3446,7 +3516,7 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
3446
3516
 
3447
3517
  return React.createElement(ThemeProvider, {
3448
3518
  theme: themeMui
3449
- }, loading && React.createElement(Backdrop, {
3519
+ }, (loading || isCountriesLoading) && React.createElement(Backdrop, {
3450
3520
  sx: {
3451
3521
  color: '#fff',
3452
3522
  backgroundColor: '#000000bd',
@@ -3458,9 +3528,11 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
3458
3528
  })), !!expirationTime && enableTimer && React.createElement(TimerWidget$1, {
3459
3529
  expires_at: expirationTime,
3460
3530
  onCountdownFinish: onCountdownFinish
3461
- }), React.createElement(Formik, {
3531
+ }), !isCountriesLoading && React.createElement(Formik, {
3462
3532
  initialValues: getInitialValues(dataWithUniqueIds, _extends({
3463
- country: _get(userData, 'country', '') || '1',
3533
+ country: (_find(countries, function (item) {
3534
+ return item.code.toLowerCase() === defaultCountry;
3535
+ }) || {}).value || _get(userData, 'country', '') || '1',
3464
3536
  state: _get(userData, 'state', '') || '1',
3465
3537
  brand_opt_in: optedInFieldValue,
3466
3538
  ttf_opt_in: ttfOptIn
@@ -3505,7 +3577,7 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
3505
3577
  case 11:
3506
3578
  updatedUserData = _context6.sent;
3507
3579
  _profileSpecifiedData = _get(updatedUserData, 'data.data');
3508
- _profileDataObj = setLoggedUserData$1(_profileSpecifiedData);
3580
+ _profileDataObj = setLoggedUserData$2(_profileSpecifiedData);
3509
3581
  window.localStorage.setItem('user_data', JSON.stringify(_profileDataObj));
3510
3582
 
3511
3583
  case 15:
@@ -3579,7 +3651,7 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
3579
3651
  case 39:
3580
3652
  profileData = _context6.sent;
3581
3653
  profileSpecifiedData = _get(profileData, 'data.data');
3582
- profileDataObj = setLoggedUserData$1(profileSpecifiedData);
3654
+ profileDataObj = setLoggedUserData$2(profileSpecifiedData);
3583
3655
 
3584
3656
  if (isWindowDefined) {
3585
3657
  window.localStorage.setItem('user_data', JSON.stringify(profileDataObj));
@@ -3747,7 +3819,7 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
3747
3819
  return ['password', 'confirmPassword', 'password-info'].includes(element.name) && isLoggedIn ? null : ['data_capture[wallet_address]'].includes(element.name) && hideWalletAddressField ? null : React.createElement(React.Fragment, {
3748
3820
  key: element.uniqueId
3749
3821
  }, React.createElement("div", {
3750
- className: element.className + " " + (props == null ? void 0 : props.errors[element.name])
3822
+ className: element.className + " " + ((props == null ? void 0 : props.errors[element.name]) || '')
3751
3823
  }, element.component ? element.component : React.createElement(Field, {
3752
3824
  setPhoneValidationIsLoading: element.type === 'phone' ? setPhoneValidationIsLoading : undefined,
3753
3825
  name: element.name,
@@ -3757,11 +3829,12 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
3757
3829
  validate: getValidateFunctions(element, states, props.values, props.errors),
3758
3830
  setFieldValue: props.setFieldValue,
3759
3831
  onBlur: props.handleBlur,
3760
- component: element.type === 'checkbox' ? CheckboxField : element.type === 'select' ? SelectField : element.type === 'phone' ? PhoneNumberField : element.type === 'date' ? DatePickerField : CustomField,
3832
+ component: element.type === 'checkbox' ? CheckboxField : element.type === 'select' ? SelectField : element.type === 'phone' ? PhoneNumberField : element.type === 'date' ? DatePickerField : element.type === 'radio' ? RadioGroupField : CustomField,
3761
3833
  selectOptions: element.name === 'country' ? countries : element.name === 'state' ? states : [],
3834
+ radios: element.radios,
3762
3835
  theme: theme,
3763
3836
  disableDropdown: element.disableDropdown,
3764
- defaultCountry: element.defaultCountry,
3837
+ defaultCountry: defaultCountry || element.defaultCountry,
3765
3838
  dateFormat: element.format,
3766
3839
  datePlaceholder: element.placeholder
3767
3840
  })));
@@ -3799,7 +3872,7 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
3799
3872
  }),
3800
3873
  disableDropdown: element.disableDropdown,
3801
3874
  setPhoneValidationIsLoading: setPhoneValidationIsLoading,
3802
- defaultCountry: element.defaultCountry
3875
+ defaultCountry: defaultCountry || element.defaultCountry
3803
3876
  }));
3804
3877
  })));
3805
3878
  }));
@@ -4956,6 +5029,38 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
4956
5029
  }))))));
4957
5030
  };
4958
5031
 
5032
+ var X_TF_ECOMMERCE = 'X-TF-ECOMMERCE';
5033
+
5034
+ var useCookieListener = function useCookieListener(key, handler) {
5035
+ var getCookie = function getCookie() {
5036
+ return getCookieByName(key);
5037
+ };
5038
+
5039
+ var _useState = useState(),
5040
+ intervalValue = _useState[0],
5041
+ setIntervalValue = _useState[1];
5042
+
5043
+ var cookieRef = useRef(getCookie());
5044
+
5045
+ var handleCookieChange = function handleCookieChange() {
5046
+ var currentCookie = getCookie();
5047
+ var prevCookie = cookieRef.current;
5048
+
5049
+ if (currentCookie !== prevCookie) {
5050
+ cookieRef.current = getCookie();
5051
+ handler(cookieRef.current);
5052
+ }
5053
+ };
5054
+
5055
+ useEffect(function () {
5056
+ var interval = setInterval(handleCookieChange, 500);
5057
+ setIntervalValue(interval);
5058
+ return function () {
5059
+ intervalValue && clearInterval(intervalValue);
5060
+ }; // eslint-disable-next-line react-hooks/exhaustive-deps
5061
+ }, []);
5062
+ };
5063
+
4959
5064
  var style$3 = {
4960
5065
  position: 'absolute',
4961
5066
  top: '50%',
@@ -5558,6 +5663,10 @@ var TicketsContainer = function TicketsContainer(_ref) {
5558
5663
  onLogoutSuccess = _ref$onLogoutSuccess === void 0 ? _identity : _ref$onLogoutSuccess,
5559
5664
  _ref$onLogoutError = _ref.onLogoutError,
5560
5665
  onLogoutError = _ref$onLogoutError === void 0 ? _identity : _ref$onLogoutError,
5666
+ _ref$onGetProfileData = _ref.onGetProfileDataSuccess,
5667
+ onGetProfileDataSuccess = _ref$onGetProfileData === void 0 ? _identity : _ref$onGetProfileData,
5668
+ _ref$onGetProfileData2 = _ref.onGetProfileDataError,
5669
+ onGetProfileDataError = _ref$onGetProfileData2 === void 0 ? _identity : _ref$onGetProfileData2,
5561
5670
  _ref$theme = _ref.theme,
5562
5671
  theme = _ref$theme === void 0 ? 'light' : _ref$theme,
5563
5672
  _ref$queryPromoCode = _ref.queryPromoCode,
@@ -5600,9 +5709,8 @@ var TicketsContainer = function TicketsContainer(_ref) {
5600
5709
  setSelectedTickets = _useState[1];
5601
5710
 
5602
5711
  var isWindowDefined = typeof window !== 'undefined';
5603
- var xtfCookie = getCookieByName('X-TF-ECOMMERCE');
5604
5712
 
5605
- var _useState2 = useState((isWindowDefined ? !!window.localStorage.getItem('access_token') : false) || !!xtfCookie),
5713
+ var _useState2 = useState(Boolean(getCookieByName(X_TF_ECOMMERCE))),
5606
5714
  isLogged = _useState2[0],
5607
5715
  setIsLogged = _useState2[1];
5608
5716
 
@@ -5671,6 +5779,9 @@ var TicketsContainer = function TicketsContainer(_ref) {
5671
5779
  setIsInvalidLinkError = _useState18[1];
5672
5780
 
5673
5781
  var ticketsContainerRef = useRef(null);
5782
+ useCookieListener(X_TF_ECOMMERCE, function (value) {
5783
+ return setIsLogged(Boolean(value));
5784
+ });
5674
5785
  useEffect(function () {
5675
5786
  if (typeof window !== 'undefined') {
5676
5787
  var access_token = window.localStorage.getItem('access_token');
@@ -5688,6 +5799,18 @@ var TicketsContainer = function TicketsContainer(_ref) {
5688
5799
  useEffect(function () {
5689
5800
  !!eventId && getTicketsApi();
5690
5801
  }, [eventId]);
5802
+ useEffect(function () {
5803
+ if (isLogged) {
5804
+ fetchUserData().then(function (res) {
5805
+ window.localStorage.setItem('user_data', JSON.stringify(res));
5806
+ onGetProfileDataSuccess(res);
5807
+ })["catch"](function (e) {
5808
+ if (axios.isAxiosError(e)) {
5809
+ onGetProfileDataError(e);
5810
+ }
5811
+ });
5812
+ }
5813
+ }, [isLogged]);
5691
5814
 
5692
5815
  var handleLogout = /*#__PURE__*/function () {
5693
5816
  var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
@@ -5756,26 +5879,26 @@ var TicketsContainer = function TicketsContainer(_ref) {
5756
5879
  }
5757
5880
 
5758
5881
  function _getTicketsApi() {
5759
- _getTicketsApi = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(isUpdateingCode, type) {
5882
+ _getTicketsApi = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(isUpdateingCode, type) {
5760
5883
  var _previewKey, response, eventResponse, attributes, _event2;
5761
5884
 
5762
- return runtime_1.wrap(function _callee3$(_context3) {
5885
+ return runtime_1.wrap(function _callee4$(_context4) {
5763
5886
  while (1) {
5764
- switch (_context3.prev = _context3.next) {
5887
+ switch (_context4.prev = _context4.next) {
5765
5888
  case 0:
5766
- _context3.prev = 0;
5889
+ _context4.prev = 0;
5767
5890
  isUpdateingCode ? setCodeIsLoading(true) : setIsLoading(true);
5768
5891
  _previewKey = getQueryVariable('pk') || undefined;
5769
- _context3.next = 5;
5892
+ _context4.next = 5;
5770
5893
  return getTickets(eventId, code, _previewKey);
5771
5894
 
5772
5895
  case 5:
5773
- response = _context3.sent;
5774
- _context3.next = 8;
5896
+ response = _context4.sent;
5897
+ _context4.next = 8;
5775
5898
  return getEvent(eventId, _previewKey);
5776
5899
 
5777
5900
  case 8:
5778
- eventResponse = _context3.sent;
5901
+ eventResponse = _context4.sent;
5779
5902
 
5780
5903
  if (response.data.success) {
5781
5904
  attributes = _get(response, 'data.data.attributes');
@@ -5792,32 +5915,36 @@ var TicketsContainer = function TicketsContainer(_ref) {
5792
5915
  if (eventResponse.data.success) {
5793
5916
  _event2 = _get(eventResponse, 'data.data.attributes');
5794
5917
  setEvent(_event2);
5918
+
5919
+ if (_event2.country && isWindowDefined) {
5920
+ window.localStorage.setItem('eventCountry', _event2.country);
5921
+ }
5795
5922
  }
5796
5923
 
5797
- _context3.next = 16;
5924
+ _context4.next = 16;
5798
5925
  break;
5799
5926
 
5800
5927
  case 13:
5801
- _context3.prev = 13;
5802
- _context3.t0 = _context3["catch"](0);
5928
+ _context4.prev = 13;
5929
+ _context4.t0 = _context4["catch"](0);
5803
5930
 
5804
- if (axios.isAxiosError(_context3.t0)) {
5805
- onGetTicketsError(_context3.t0);
5806
- setError(_get(_context3.t0, 'response.data.message'));
5931
+ if (axios.isAxiosError(_context4.t0)) {
5932
+ onGetTicketsError(_context4.t0);
5933
+ setError(_get(_context4.t0, 'response.data.message'));
5807
5934
  }
5808
5935
 
5809
5936
  case 16:
5810
- _context3.prev = 16;
5937
+ _context4.prev = 16;
5811
5938
  setIsLoading(false);
5812
5939
  setCodeIsLoading(false);
5813
- return _context3.finish(16);
5940
+ return _context4.finish(16);
5814
5941
 
5815
5942
  case 20:
5816
5943
  case "end":
5817
- return _context3.stop();
5944
+ return _context4.stop();
5818
5945
  }
5819
5946
  }
5820
- }, _callee3, null, [[0, 13, 16, 20]]);
5947
+ }, _callee4, null, [[0, 13, 16, 20]]);
5821
5948
  }));
5822
5949
  return _getTicketsApi.apply(this, arguments);
5823
5950
  }
@@ -6016,6 +6143,41 @@ var TicketsContainer = function TicketsContainer(_ref) {
6016
6143
  getTicketsApi(isUpdateingCode, type);
6017
6144
  };
6018
6145
 
6146
+ var fetchUserData = /*#__PURE__*/function () {
6147
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
6148
+ var userDataResponse, profileData, profileDataObj;
6149
+ return runtime_1.wrap(function _callee3$(_context3) {
6150
+ while (1) {
6151
+ switch (_context3.prev = _context3.next) {
6152
+ case 0:
6153
+ _context3.prev = 0;
6154
+ _context3.next = 3;
6155
+ return getProfileData();
6156
+
6157
+ case 3:
6158
+ userDataResponse = _context3.sent;
6159
+ profileData = _get(userDataResponse, 'data.data');
6160
+ profileDataObj = setLoggedUserData(profileData);
6161
+ return _context3.abrupt("return", profileDataObj);
6162
+
6163
+ case 9:
6164
+ _context3.prev = 9;
6165
+ _context3.t0 = _context3["catch"](0);
6166
+ throw new Error(_context3.t0);
6167
+
6168
+ case 12:
6169
+ case "end":
6170
+ return _context3.stop();
6171
+ }
6172
+ }
6173
+ }, _callee3, null, [[0, 9]]);
6174
+ }));
6175
+
6176
+ return function fetchUserData() {
6177
+ return _ref5.apply(this, arguments);
6178
+ };
6179
+ }();
6180
+
6019
6181
  var isTicketOnSale = _some(tickets, function (item) {
6020
6182
  return item.salesStarted && !item.salesEnded && !item.soldOut;
6021
6183
  });