tf-checkout-react 1.7.1 → 1.7.3

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.
Files changed (40) hide show
  1. package/dist/api/auth.d.ts +22 -0
  2. package/dist/api/index.d.ts +1 -1
  3. package/dist/components/billing-info-container/utils.d.ts +1 -0
  4. package/dist/components/common/PhoneNumberField.d.ts +1 -1
  5. package/dist/components/loginForm/index.d.ts +1 -0
  6. package/dist/components/loginModal/index.d.ts +1 -0
  7. package/dist/components/preRegistration/PreRegistrationComplete.d.ts +2 -0
  8. package/dist/tf-checkout-react.cjs.development.js +2166 -1864
  9. package/dist/tf-checkout-react.cjs.development.js.map +1 -1
  10. package/dist/tf-checkout-react.cjs.production.min.js +1 -1
  11. package/dist/tf-checkout-react.cjs.production.min.js.map +1 -1
  12. package/dist/tf-checkout-react.esm.js +2166 -1864
  13. package/dist/tf-checkout-react.esm.js.map +1 -1
  14. package/dist/tf-checkout-styles.css +1 -1
  15. package/dist/utils/createCheckoutDataBodyWithDefaultHolder.d.ts +1 -0
  16. package/dist/validators/index.d.ts +4 -0
  17. package/package.json +2 -2
  18. package/src/api/auth.ts +49 -0
  19. package/src/api/index.ts +1 -1
  20. package/src/components/billing-info-container/index.tsx +228 -112
  21. package/src/components/billing-info-container/style.css +46 -2
  22. package/src/components/billing-info-container/utils.tsx +5 -1
  23. package/src/components/common/CustomField.tsx +1 -1
  24. package/src/components/common/PhoneNumberField.tsx +4 -2
  25. package/src/components/confirmationContainer/index.tsx +4 -0
  26. package/src/components/loginForm/index.tsx +19 -3
  27. package/src/components/loginModal/index.tsx +19 -3
  28. package/src/components/loginModal/style.css +6 -2
  29. package/src/components/preRegistration/PreRegistrationComplete.tsx +12 -2
  30. package/src/components/preRegistration/constants.tsx +6 -4
  31. package/src/components/preRegistration/index.tsx +144 -110
  32. package/src/components/preRegistration/style.css +3 -0
  33. package/src/components/preRegistration/utils.ts +9 -1
  34. package/src/components/ticketsContainer/index.tsx +79 -21
  35. package/src/components/timerWidget/style.css +2 -1
  36. package/src/types/api/common.d.ts +1 -0
  37. package/src/types/api/payment.d.ts +2 -0
  38. package/src/types/formFields.d.ts +1 -1
  39. package/src/utils/createCheckoutDataBodyWithDefaultHolder.ts +3 -1
  40. package/src/validators/index.ts +22 -1
@@ -8,7 +8,6 @@ import _find from 'lodash-es/find';
8
8
  import _forEach from 'lodash-es/forEach';
9
9
  import _get from 'lodash-es/get';
10
10
  import _identity from 'lodash-es/identity';
11
- import _includes from 'lodash-es/includes';
12
11
  import _isEmpty from 'lodash-es/isEmpty';
13
12
  import _isEqual from 'lodash-es/isEqual';
14
13
  import _map from 'lodash-es/map';
@@ -33,6 +32,7 @@ import VisibilityOff from '@mui/icons-material/VisibilityOff';
33
32
  import IconButton from '@mui/material/IconButton';
34
33
  import InputAdornment from '@mui/material/InputAdornment';
35
34
  import TextField from '@mui/material/TextField';
35
+ import _includes from 'lodash-es/includes';
36
36
  import _isFunction from 'lodash-es/isFunction';
37
37
  import _isObject from 'lodash-es/isObject';
38
38
  import MuiPhoneNumber from 'material-ui-phone-number';
@@ -724,7 +724,7 @@ var createCheckoutDataBodyWithDefaultHolder = function createCheckoutDataBodyWit
724
724
  var ticket_holders = [];
725
725
  var first_name = _get(logedInValues, 'firstName') || _get(logedInValues, 'first_name') || _get(userCredentials, 'firstNameLogged') || '';
726
726
  var last_name = _get(logedInValues, 'lastName') || _get(logedInValues, 'last_name') || _get(userCredentials, 'lastNameLogged') || '';
727
- var phone = _get(logedInValues, 'phone', '');
727
+ var phone = _get(logedInValues, 'phone') || _get(userCredentials, 'phoneLogged') || '';
728
728
  var email = _get(logedInValues, 'email') || _get(userCredentials, 'emailLogged') || '';
729
729
  for (var i = 0; i <= ticketsQuantity - 1; i++) {
730
730
  var individualHolder = i ? {
@@ -1140,6 +1140,66 @@ var logout = /*#__PURE__*/function () {
1140
1140
  return _ref5.apply(this, arguments);
1141
1141
  };
1142
1142
  }();
1143
+ /**
1144
+ * Checks whether a given email address already exists via the `/ajax/contact-email` endpoint.
1145
+ *
1146
+ * The underlying API is expected to return a JSON object containing:
1147
+ * - `exists`: `1` if the email exists, `0` otherwise
1148
+ * - `error`: `1` if an error occurred, `0` otherwise
1149
+ * - `message`: an optional error message when `error === 1`
1150
+ *
1151
+ * This function normalizes that response to an object with:
1152
+ * - `exists`: a boolean indicating whether the email exists
1153
+ * - `error`: an optional string containing an error message, if any
1154
+ *
1155
+ * On network or unexpected errors, it returns `{ exists: false, error: 'Failed to check email' }`.
1156
+ *
1157
+ * @param {string} email - The email address to check for existence.
1158
+ * @returns {Promise<{ exists: boolean; error?: string }>} A promise that resolves to the normalized
1159
+ * result of the email existence check.
1160
+ */
1161
+ var checkEmailExists = /*#__PURE__*/function () {
1162
+ var _ref6 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(email) {
1163
+ var _publicRequest$defaul, formData, baseUrl, url, response;
1164
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
1165
+ while (1) switch (_context6.prev = _context6.next) {
1166
+ case 0:
1167
+ _context6.prev = 0;
1168
+ formData = new FormData();
1169
+ formData.append('email', email);
1170
+ formData.append('is_checkout_flow', 'true');
1171
+ baseUrl = ((_publicRequest$defaul = publicRequest.defaults.baseURL) == null ? void 0 : _publicRequest$defaul.replace('/api', '')) || '';
1172
+ url = baseUrl + "/ajax/contact-email";
1173
+ _context6.next = 8;
1174
+ return publicRequest.post(url, formData, {
1175
+ headers: {
1176
+ 'Content-Type': 'multipart/form-data'
1177
+ }
1178
+ });
1179
+ case 8:
1180
+ response = _context6.sent;
1181
+ return _context6.abrupt("return", {
1182
+ exists: response.data.exists === 1,
1183
+ error: response.data.error === 1 ? response.data.message : undefined
1184
+ });
1185
+ case 12:
1186
+ _context6.prev = 12;
1187
+ _context6.t0 = _context6["catch"](0);
1188
+ console.error('Error checking email:', _context6.t0);
1189
+ return _context6.abrupt("return", {
1190
+ exists: false,
1191
+ error: 'Failed to check email'
1192
+ });
1193
+ case 16:
1194
+ case "end":
1195
+ return _context6.stop();
1196
+ }
1197
+ }, _callee6, null, [[0, 12]]);
1198
+ }));
1199
+ return function checkEmailExists(_x4) {
1200
+ return _ref6.apply(this, arguments);
1201
+ };
1202
+ }();
1143
1203
 
1144
1204
  var getOrders = /*#__PURE__*/function () {
1145
1205
  var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(page, limit, eventSlug) {
@@ -2403,6 +2463,50 @@ var usePixel = /*#__PURE__*/function () {
2403
2463
  };
2404
2464
  }();
2405
2465
 
2466
+ var emailRegex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
2467
+ var combineValidators = function combineValidators() {
2468
+ for (var _len = arguments.length, validators = new Array(_len), _key = 0; _key < _len; _key++) {
2469
+ validators[_key] = arguments[_key];
2470
+ }
2471
+ return function () {
2472
+ for (var i = 0; i < validators.length; ++i) {
2473
+ var error_message = validators[i].apply(validators, arguments);
2474
+ if (error_message) return error_message;
2475
+ }
2476
+ };
2477
+ };
2478
+ function isFalsy(item) {
2479
+ try {
2480
+ if (!item ||
2481
+ // handles most, like false, 0, null, etc
2482
+ typeof item === 'object' && Object.keys(item).length === 0 &&
2483
+ // for empty objects, like {}, []
2484
+ !(typeof item.addEventListener === 'function') // omit webpage elements
2485
+ ) {
2486
+ return true;
2487
+ }
2488
+ } catch (err) {
2489
+ return true;
2490
+ }
2491
+ return false;
2492
+ }
2493
+ var requiredValidator = function requiredValidator(value, message) {
2494
+ var errorMessage = '';
2495
+ if (isFalsy(typeof value === 'string' ? value.trim() : value)) {
2496
+ errorMessage = message || 'Required';
2497
+ }
2498
+ return errorMessage;
2499
+ };
2500
+ var emailValidator = function emailValidator(email) {
2501
+ return !emailRegex.test(email) ? 'Please enter a valid email address' : '';
2502
+ };
2503
+ var passwordValidator = function passwordValidator(password) {
2504
+ if (!password || password.length < 6) {
2505
+ return 'The password must be at least 6 characters.';
2506
+ }
2507
+ return '';
2508
+ };
2509
+
2406
2510
  var currencyNormalizerCreator = function currencyNormalizerCreator(value, currency) {
2407
2511
  return !value ? '' : getCurrencySymbolByCurrency(currency) + " " + value;
2408
2512
  };
@@ -2678,44 +2782,6 @@ var cartAdapter = function cartAdapter(cart) {
2678
2782
  };
2679
2783
  };
2680
2784
 
2681
- var emailRegex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
2682
- var combineValidators = function combineValidators() {
2683
- for (var _len = arguments.length, validators = new Array(_len), _key = 0; _key < _len; _key++) {
2684
- validators[_key] = arguments[_key];
2685
- }
2686
- return function () {
2687
- for (var i = 0; i < validators.length; ++i) {
2688
- var error_message = validators[i].apply(validators, arguments);
2689
- if (error_message) return error_message;
2690
- }
2691
- };
2692
- };
2693
- function isFalsy(item) {
2694
- try {
2695
- if (!item ||
2696
- // handles most, like false, 0, null, etc
2697
- typeof item === 'object' && Object.keys(item).length === 0 &&
2698
- // for empty objects, like {}, []
2699
- !(typeof item.addEventListener === 'function') // omit webpage elements
2700
- ) {
2701
- return true;
2702
- }
2703
- } catch (err) {
2704
- return true;
2705
- }
2706
- return false;
2707
- }
2708
- var requiredValidator = function requiredValidator(value, message) {
2709
- var errorMessage = '';
2710
- if (isFalsy(typeof value === 'string' ? value.trim() : value)) {
2711
- errorMessage = message || 'Required';
2712
- }
2713
- return errorMessage;
2714
- };
2715
- var emailValidator = function emailValidator(email) {
2716
- return !emailRegex.test(email) ? 'Please enter a valid email address' : '';
2717
- };
2718
-
2719
2785
  var CheckboxField = function CheckboxField(_ref) {
2720
2786
  var label = _ref.label,
2721
2787
  field = _ref.field,
@@ -2848,7 +2914,7 @@ var CustomField = function CustomField(_ref2) {
2848
2914
  },
2849
2915
  InputLabelProps: {
2850
2916
  sx: customTheme == null ? void 0 : customTheme.input,
2851
- shrink: isShrinked || Boolean(field.value) || isAutoFilled
2917
+ shrink: isSelectField || isShrinked || Boolean(field.value) || isAutoFilled
2852
2918
  },
2853
2919
  InputProps: finalInputProps,
2854
2920
  inputProps: _extends({}, inputProps, pInputProps),
@@ -2885,6 +2951,7 @@ var PhoneNumberField = function PhoneNumberField(_ref) {
2885
2951
  setFieldValue = _ref$form.setFieldValue,
2886
2952
  setFieldTouched = _ref$form.setFieldTouched,
2887
2953
  setErrors = _ref$form.setErrors,
2954
+ submitCount = _ref$form.submitCount,
2888
2955
  _ref$disableDropdown = _ref.disableDropdown,
2889
2956
  disableDropdown = _ref$disableDropdown === void 0 ? true : _ref$disableDropdown,
2890
2957
  _ref$defaultCountry = _ref.defaultCountry,
@@ -2895,6 +2962,7 @@ var PhoneNumberField = function PhoneNumberField(_ref) {
2895
2962
  isCountryCodeEditable = _ref.isCountryCodeEditable;
2896
2963
  var error = _get(errors, field.name);
2897
2964
  var isTouched = Boolean(_get(touched, field.name));
2965
+ var isSubmitAttempted = Boolean(submitCount && submitCount > 0);
2898
2966
  // eslint-disable-next-line react-hooks/exhaustive-deps
2899
2967
  var debounceCb = useCallback(_debounce(function (cb) {
2900
2968
  return void cb();
@@ -2967,8 +3035,8 @@ var PhoneNumberField = function PhoneNumberField(_ref) {
2967
3035
  defaultCountry: defaultCountry,
2968
3036
  disableDropdown: disableDropdown,
2969
3037
  label: label,
2970
- error: !!error && (isTouched || fill),
2971
- helperText: (isTouched || fill) && error,
3038
+ error: !!error && (isTouched || fill || isSubmitAttempted),
3039
+ helperText: (isTouched || fill || isSubmitAttempted) && error,
2972
3040
  fullWidth: true,
2973
3041
  autoFormat: false,
2974
3042
  disableAreaCodes: true,
@@ -3333,31 +3401,9 @@ var getInitialValues = function getInitialValues(data, propsInitialValues, userV
3333
3401
  initialValues['holderFirstName-0'] = propsInitialValues.firstName || userValues.firstName || '';
3334
3402
  initialValues['holderLastName-0'] = propsInitialValues.lastName || userValues.lastName || '';
3335
3403
  initialValues['holderEmail-0'] = propsInitialValues.email || userValues.email || '';
3404
+ initialValues['holderPhone-0'] = propsInitialValues.phone || userValues.phone || '';
3336
3405
  return _extends({}, initialValues, ticketHoldersCustomFieldsInitValues);
3337
3406
  };
3338
- var createRegisterFormData = function createRegisterFormData(values, checkoutBody, flagFreeTicket) {
3339
- if (values === void 0) {
3340
- values = {};
3341
- }
3342
- if (flagFreeTicket === void 0) {
3343
- flagFreeTicket = false;
3344
- }
3345
- var bodyFormData = new FormData();
3346
- bodyFormData.append('first_name', values.firstName);
3347
- bodyFormData.append('last_name', values.lastName);
3348
- bodyFormData.append('email', values.email);
3349
- bodyFormData.append('password', values.password);
3350
- bodyFormData.append('password_confirmation', values.confirmPassword);
3351
- bodyFormData.append('client_id', CONFIGS.CLIENT_ID || 'e9d8f8922797b4621e562255afe90dbf');
3352
- bodyFormData.append('client_secret', CONFIGS.CLIENT_SECRET || 'b89c191eff22fdcf84ac9bfd88d005355a151ec2c83b26b9');
3353
- bodyFormData.append('check_cart_expiration', 'true');
3354
- _forEach(checkoutBody.attributes, function (item, key) {
3355
- if (!(flagFreeTicket && ['country', 'state', 'city', 'street_address'].includes(key))) {
3356
- bodyFormData.append(key, item);
3357
- }
3358
- });
3359
- return bodyFormData;
3360
- };
3361
3407
  var createCheckoutDataBody = function createCheckoutDataBody(ticketsQuantity, values, logedInValues, includeDob) {
3362
3408
  if (values === void 0) {
3363
3409
  values = {};
@@ -3392,7 +3438,7 @@ var createCheckoutDataBody = function createCheckoutDataBody(ticketsQuantity, va
3392
3438
  return {
3393
3439
  first_name: !index ? item["holderFirstName-" + index] || logedInValues.firstNameLogged || '' : item["holderFirstName-" + index] || '',
3394
3440
  last_name: !index ? item["holderLastName-" + index] || logedInValues.lastNameLogged || '' : item["holderLastName-" + index] || '',
3395
- phone: item["holderPhone-" + index] || '',
3441
+ phone: !index ? item["holderPhone-" + index] || logedInValues.phoneLogged || '' : item["holderPhone-" + index] || '',
3396
3442
  email: !index ? item["holderEmail-" + index] || logedInValues.emailLogged || '' : item["holderEmail-" + index] || ''
3397
3443
  };
3398
3444
  });
@@ -4814,7 +4860,9 @@ var LoginModal = function LoginModal(_ref) {
4814
4860
  _ref$showSignUpButton = _ref.showSignUpButton,
4815
4861
  showSignUpButton = _ref$showSignUpButton === void 0 ? false : _ref$showSignUpButton,
4816
4862
  _ref$showPoweredByIma = _ref.showPoweredByImage,
4817
- showPoweredByImage = _ref$showPoweredByIma === void 0 ? false : _ref$showPoweredByIma;
4863
+ showPoweredByImage = _ref$showPoweredByIma === void 0 ? false : _ref$showPoweredByIma,
4864
+ _ref$registerUrl = _ref.registerUrl,
4865
+ registerUrl = _ref$registerUrl === void 0 ? 'https://www.ticketfairy.com/register' : _ref$registerUrl;
4818
4866
  var _useState = useState(''),
4819
4867
  error = _useState[0],
4820
4868
  setError = _useState[1];
@@ -4942,9 +4990,16 @@ var LoginModal = function LoginModal(_ref) {
4942
4990
  onClick: onForgotPassword
4943
4991
  }, "Forgot password?")), showSignUpButton && React.createElement("div", {
4944
4992
  className: "forgot-password"
4945
- }, React.createElement("span", {
4993
+ }, onSignup !== _identity ? React.createElement("span", {
4946
4994
  "aria-hidden": "true",
4947
- onClick: onSignup
4995
+ onClick: onSignup,
4996
+ style: {
4997
+ cursor: 'pointer'
4998
+ }
4999
+ }, "Sign up") : React.createElement("a", {
5000
+ href: registerUrl,
5001
+ target: "_blank",
5002
+ rel: "noopener noreferrer"
4948
5003
  }, "Sign up")), showPoweredByImage ? React.createElement(PoweredBy, null) : null));
4949
5004
  }))));
4950
5005
  };
@@ -6000,6 +6055,13 @@ var LogicRunner = function LogicRunner(_ref) {
6000
6055
  shouldFetchCountries = _ref.shouldFetchCountries,
6001
6056
  brandOptIn = _ref.brandOptIn;
6002
6057
  var prevCountry = useRef(values.country);
6058
+ var prevBuyerData = useRef({
6059
+ firstName: '',
6060
+ lastName: '',
6061
+ email: '',
6062
+ phone: ''
6063
+ });
6064
+ var hasLoadedUserData = useRef(false);
6003
6065
  useEffect(function () {
6004
6066
  var fetchStates = /*#__PURE__*/function () {
6005
6067
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
@@ -6047,146 +6109,253 @@ var LogicRunner = function LogicRunner(_ref) {
6047
6109
  }();
6048
6110
  shouldFetchCountries && fetchStates();
6049
6111
  }, [values.country, setStates, setFieldValue]);
6112
+ // Auto-fill first holder with buyer data
6113
+ useEffect(function () {
6114
+ var buyerFirstName = values.firstName || '';
6115
+ var buyerLastName = values.lastName || '';
6116
+ var buyerEmail = values.email || '';
6117
+ var buyerPhone = values.phone || '';
6118
+ // Check if any buyer data has changed
6119
+ var firstNameChanged = prevBuyerData.current.firstName !== buyerFirstName;
6120
+ var lastNameChanged = prevBuyerData.current.lastName !== buyerLastName;
6121
+ var emailChanged = prevBuyerData.current.email !== buyerEmail;
6122
+ var phoneChanged = prevBuyerData.current.phone !== buyerPhone;
6123
+ // Update holder fields individually based on what changed
6124
+ if (firstNameChanged) {
6125
+ setFieldValue('holderFirstName-0', buyerFirstName, false);
6126
+ prevBuyerData.current.firstName = buyerFirstName;
6127
+ }
6128
+ if (lastNameChanged) {
6129
+ setFieldValue('holderLastName-0', buyerLastName, false);
6130
+ prevBuyerData.current.lastName = buyerLastName;
6131
+ }
6132
+ if (emailChanged) {
6133
+ setFieldValue('holderEmail-0', buyerEmail, false);
6134
+ prevBuyerData.current.email = buyerEmail;
6135
+ }
6136
+ if (phoneChanged) {
6137
+ setFieldValue('holderPhone-0', buyerPhone, false);
6138
+ prevBuyerData.current.phone = buyerPhone;
6139
+ }
6140
+ }, [values.firstName, values.lastName, values.email, values.phone, setFieldValue]);
6050
6141
  var userDataEncoded = isBrowser ? window.localStorage.getItem('user_data') : '';
6051
6142
  useEffect(function () {
6052
- // set user data from local storage
6143
+ // set user data from local storage only on initial load
6053
6144
  var getStoredUserData = function getStoredUserData() {
6054
- if (isBrowser) {
6055
- if (userDataEncoded) {
6056
- try {
6057
- var parsedData = JSON.parse(userDataEncoded);
6058
- var mappedValues = {
6059
- firstName: (parsedData == null ? void 0 : parsedData.first_name) || (parsedData == null ? void 0 : parsedData.firstName) || '',
6060
- lastName: (parsedData == null ? void 0 : parsedData.last_name) || (parsedData == null ? void 0 : parsedData.lastName) || '',
6061
- email: (parsedData == null ? void 0 : parsedData.email) || '',
6062
- phone: (parsedData == null ? void 0 : parsedData.phone) || '',
6063
- confirmEmail: (parsedData == null ? void 0 : parsedData.email) || '',
6064
- state: (parsedData == null ? void 0 : parsedData.state) || '',
6065
- street_address: (parsedData == null ? void 0 : parsedData.street_address) || '',
6066
- country: (parsedData == null ? void 0 : parsedData.country) || '1',
6067
- zip: (parsedData == null ? void 0 : parsedData.zip) || '',
6068
- brand_opt_in: brandOptIn ? brandOptIn : (parsedData == null ? void 0 : parsedData.brand_opt_in) || false,
6069
- city: (parsedData == null ? void 0 : parsedData.city) || '',
6070
- confirmPassword: '',
6071
- password: '',
6072
- 'holderFirstName-0': (parsedData == null ? void 0 : parsedData.first_name) || (parsedData == null ? void 0 : parsedData.firstName) || '',
6073
- 'holderLastName-0': (parsedData == null ? void 0 : parsedData.last_name) || (parsedData == null ? void 0 : parsedData.lastName) || '',
6074
- 'holderEmail-0': (parsedData == null ? void 0 : parsedData.email) || ''
6075
- };
6076
- var extraDataJSON = window.localStorage.getItem('extraData');
6077
- var extraData = extraDataJSON ? JSON.parse(extraDataJSON) : null;
6078
- setValues(_extends({}, values, mappedValues, extraData != null ? extraData : {}));
6079
- setUserValues(mappedValues);
6080
- } catch (e) {}
6081
- }
6145
+ if (isBrowser && userDataEncoded && !hasLoadedUserData.current) {
6146
+ try {
6147
+ var parsedData = JSON.parse(userDataEncoded);
6148
+ var mappedValues = {
6149
+ firstName: (parsedData == null ? void 0 : parsedData.first_name) || (parsedData == null ? void 0 : parsedData.firstName) || '',
6150
+ lastName: (parsedData == null ? void 0 : parsedData.last_name) || (parsedData == null ? void 0 : parsedData.lastName) || '',
6151
+ email: (parsedData == null ? void 0 : parsedData.email) || '',
6152
+ phone: (parsedData == null ? void 0 : parsedData.phone) || '',
6153
+ confirmEmail: (parsedData == null ? void 0 : parsedData.email) || '',
6154
+ state: (parsedData == null ? void 0 : parsedData.state) || '',
6155
+ street_address: (parsedData == null ? void 0 : parsedData.street_address) || '',
6156
+ country: (parsedData == null ? void 0 : parsedData.country) || '1',
6157
+ zip: (parsedData == null ? void 0 : parsedData.zip) || '',
6158
+ brand_opt_in: brandOptIn ? brandOptIn : (parsedData == null ? void 0 : parsedData.brand_opt_in) || false,
6159
+ city: (parsedData == null ? void 0 : parsedData.city) || '',
6160
+ confirmPassword: '',
6161
+ password: '',
6162
+ 'holderFirstName-0': (parsedData == null ? void 0 : parsedData.first_name) || (parsedData == null ? void 0 : parsedData.firstName) || '',
6163
+ 'holderLastName-0': (parsedData == null ? void 0 : parsedData.last_name) || (parsedData == null ? void 0 : parsedData.lastName) || '',
6164
+ 'holderEmail-0': (parsedData == null ? void 0 : parsedData.email) || '',
6165
+ 'holderPhone-0': (parsedData == null ? void 0 : parsedData.phone) || ''
6166
+ };
6167
+ var extraDataJSON = window.localStorage.getItem('extraData');
6168
+ var extraData = extraDataJSON ? JSON.parse(extraDataJSON) : null;
6169
+ setValues(_extends({}, values, mappedValues, extraData != null ? extraData : {}));
6170
+ setUserValues(mappedValues);
6171
+ hasLoadedUserData.current = true;
6172
+ } catch (e) {}
6082
6173
  }
6083
6174
  };
6084
6175
  getStoredUserData();
6085
- }, [userDataEncoded, setValues, setUserValues, brandOptIn]);
6176
+ // Only run on mount or when userDataEncoded first becomes available
6177
+ // eslint-disable-next-line react-hooks/exhaustive-deps
6178
+ }, []);
6179
+ return null;
6180
+ };
6181
+ // Component to check if email exists
6182
+ /**
6183
+ * A utility component that checks if an email address already exists in the system.
6184
+ *
6185
+ * Performs debounced validation and existence checking for user email addresses.
6186
+ * Only checks when both email and confirmEmail match, are valid, and user is not logged in.
6187
+ *
6188
+ * @param email - The primary email address to check
6189
+ * @param confirmEmail - The confirmation email address (must match email)
6190
+ * @param isLoggedIn - Whether the user is currently logged in
6191
+ * @param setEmailExists - Callback function to update the email existence state
6192
+ *
6193
+ * @remarks
6194
+ * - Uses a 500ms debounce to avoid excessive API calls
6195
+ * - Validates email format using regex before checking existence
6196
+ * - Automatically returns false if user is logged in
6197
+ * - Returns null as it's a logic-only component with no UI
6198
+ */
6199
+ var EmailExistenceChecker = function EmailExistenceChecker(_ref4) {
6200
+ var email = _ref4.email,
6201
+ confirmEmail = _ref4.confirmEmail,
6202
+ isLoggedIn = _ref4.isLoggedIn,
6203
+ setEmailExists = _ref4.setEmailExists;
6204
+ useEffect(function () {
6205
+ var checkEmail = /*#__PURE__*/function () {
6206
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
6207
+ var result;
6208
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
6209
+ while (1) switch (_context2.prev = _context2.next) {
6210
+ case 0:
6211
+ if (!isLoggedIn) {
6212
+ _context2.next = 3;
6213
+ break;
6214
+ }
6215
+ setEmailExists(false);
6216
+ return _context2.abrupt("return");
6217
+ case 3:
6218
+ if (!(!email || !confirmEmail || email !== confirmEmail || !emailRegex.test(email))) {
6219
+ _context2.next = 6;
6220
+ break;
6221
+ }
6222
+ setEmailExists(false);
6223
+ return _context2.abrupt("return");
6224
+ case 6:
6225
+ _context2.prev = 6;
6226
+ _context2.next = 9;
6227
+ return checkEmailExists(email);
6228
+ case 9:
6229
+ result = _context2.sent;
6230
+ setEmailExists(result.exists);
6231
+ _context2.next = 16;
6232
+ break;
6233
+ case 13:
6234
+ _context2.prev = 13;
6235
+ _context2.t0 = _context2["catch"](6);
6236
+ setEmailExists(false);
6237
+ case 16:
6238
+ case "end":
6239
+ return _context2.stop();
6240
+ }
6241
+ }, _callee2, null, [[6, 13]]);
6242
+ }));
6243
+ return function checkEmail() {
6244
+ return _ref5.apply(this, arguments);
6245
+ };
6246
+ }();
6247
+ // Debounce the check
6248
+ var timeoutId = setTimeout(function () {
6249
+ checkEmail();
6250
+ }, 800);
6251
+ return function () {
6252
+ return clearTimeout(timeoutId);
6253
+ };
6254
+ }, [email, confirmEmail, isLoggedIn, setEmailExists]);
6086
6255
  return null;
6087
6256
  };
6088
- var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
6257
+ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref6) {
6089
6258
  var _reviewData$payment_m, _checkoutUpdateData$a, _checkoutUpdateData$a2, _reviewData$payment_m2, _checkoutUpdateData$a3, _checkoutUpdateData$a4, _checkoutUpdateData$a5;
6090
- var _ref4$data = _ref4.data,
6091
- data = _ref4$data === void 0 ? [] : _ref4$data,
6092
- _ref4$ticketHoldersFi = _ref4.ticketHoldersFields,
6093
- ticketHoldersFields = _ref4$ticketHoldersFi === void 0 ? {
6259
+ var _ref6$data = _ref6.data,
6260
+ data = _ref6$data === void 0 ? [] : _ref6$data,
6261
+ _ref6$ticketHoldersFi = _ref6.ticketHoldersFields,
6262
+ ticketHoldersFields = _ref6$ticketHoldersFi === void 0 ? {
6094
6263
  id: 1,
6095
6264
  fields: []
6096
- } : _ref4$ticketHoldersFi,
6097
- _ref4$initialValues = _ref4.initialValues,
6098
- initialValues = _ref4$initialValues === void 0 ? {} : _ref4$initialValues,
6099
- _ref4$buttonName = _ref4.buttonName,
6100
- buttonName = _ref4$buttonName === void 0 ? 'Submit' : _ref4$buttonName,
6101
- _ref4$freeOrderButton = _ref4.freeOrderButtonName,
6102
- freeOrderButtonName = _ref4$freeOrderButton === void 0 ? 'Complete Registration' : _ref4$freeOrderButton,
6103
- _ref4$handleSubmit = _ref4.handleSubmit,
6104
- handleSubmit = _ref4$handleSubmit === void 0 ? _identity : _ref4$handleSubmit,
6105
- _ref4$theme = _ref4.theme,
6106
- theme = _ref4$theme === void 0 ? 'light' : _ref4$theme,
6107
- _ref4$onRegisterSucce = _ref4.onRegisterSuccess,
6108
- onRegisterSuccess = _ref4$onRegisterSucce === void 0 ? _identity : _ref4$onRegisterSucce,
6109
- _ref4$onRegisterError = _ref4.onRegisterError,
6110
- onRegisterError = _ref4$onRegisterError === void 0 ? _identity : _ref4$onRegisterError,
6111
- _ref4$onSubmitError = _ref4.onSubmitError,
6112
- onSubmitError = _ref4$onSubmitError === void 0 ? _identity : _ref4$onSubmitError,
6113
- _ref4$onGetCartSucces = _ref4.onGetCartSuccess,
6114
- onGetCartSuccess = _ref4$onGetCartSucces === void 0 ? _identity : _ref4$onGetCartSucces,
6115
- _ref4$onGetCartError = _ref4.onGetCartError,
6116
- onGetCartError = _ref4$onGetCartError === void 0 ? _identity : _ref4$onGetCartError,
6117
- _ref4$onGetCountriesS = _ref4.onGetCountriesSuccess,
6118
- onGetCountriesSuccess = _ref4$onGetCountriesS === void 0 ? _identity : _ref4$onGetCountriesS,
6119
- _ref4$onGetCountriesE = _ref4.onGetCountriesError,
6120
- onGetCountriesError = _ref4$onGetCountriesE === void 0 ? _identity : _ref4$onGetCountriesE,
6121
- _ref4$onGetStatesSucc = _ref4.onGetStatesSuccess,
6122
- onGetStatesSuccess = _ref4$onGetStatesSucc === void 0 ? _identity : _ref4$onGetStatesSucc,
6123
- _ref4$onGetStatesErro = _ref4.onGetStatesError,
6124
- onGetStatesError = _ref4$onGetStatesErro === void 0 ? _identity : _ref4$onGetStatesErro,
6125
- _ref4$onGetProfileDat = _ref4.onGetProfileDataSuccess,
6126
- _onGetProfileDataSuccess = _ref4$onGetProfileDat === void 0 ? _identity : _ref4$onGetProfileDat,
6127
- _ref4$onGetProfileDat2 = _ref4.onGetProfileDataError,
6128
- onGetProfileDataError = _ref4$onGetProfileDat2 === void 0 ? _identity : _ref4$onGetProfileDat2,
6129
- onLogin = _ref4.onLogin,
6130
- _ref4$onLoginSuccess = _ref4.onLoginSuccess,
6131
- onLoginSuccess = _ref4$onLoginSuccess === void 0 ? _identity : _ref4$onLoginSuccess,
6132
- _ref4$onCheckoutUpdat = _ref4.onCheckoutUpdateSuccess,
6133
- onCheckoutUpdateSuccess = _ref4$onCheckoutUpdat === void 0 ? _identity : _ref4$onCheckoutUpdat,
6134
- _ref4$onCheckoutUpdat2 = _ref4.onCheckoutUpdateError,
6135
- onCheckoutUpdateError = _ref4$onCheckoutUpdat2 === void 0 ? _identity : _ref4$onCheckoutUpdat2,
6136
- _ref4$isLoggedIn = _ref4.isLoggedIn,
6137
- pIsLoggedIn = _ref4$isLoggedIn === void 0 ? false : _ref4$isLoggedIn,
6138
- _ref4$accountInfoTitl = _ref4.accountInfoTitle,
6139
- accountInfoTitle = _ref4$accountInfoTitl === void 0 ? '' : _ref4$accountInfoTitl,
6140
- hideLogo = _ref4.hideLogo,
6141
- themeOptions = _ref4.themeOptions,
6142
- _ref4$onErrorClose = _ref4.onErrorClose,
6143
- onErrorClose = _ref4$onErrorClose === void 0 ? _identity : _ref4$onErrorClose,
6144
- _ref4$hideErrorsAlert = _ref4.hideErrorsAlertSection,
6145
- hideErrorsAlertSection = _ref4$hideErrorsAlert === void 0 ? false : _ref4$hideErrorsAlert,
6146
- _ref4$onSkipBillingPa = _ref4.onSkipBillingPage,
6147
- onSkipBillingPage = _ref4$onSkipBillingPa === void 0 ? _identity : _ref4$onSkipBillingPa,
6148
- _ref4$skipPage = _ref4.skipPage,
6149
- skipPage = _ref4$skipPage === void 0 ? false : _ref4$skipPage,
6150
- _ref4$canSkipHolderNa = _ref4.canSkipHolderNames,
6151
- canSkipHolderNames = _ref4$canSkipHolderNa === void 0 ? false : _ref4$canSkipHolderNa,
6152
- _ref4$onForgotPasswor = _ref4.onForgotPasswordSuccess,
6153
- onForgotPasswordSuccess = _ref4$onForgotPasswor === void 0 ? _identity : _ref4$onForgotPasswor,
6154
- _ref4$onForgotPasswor2 = _ref4.onForgotPasswordError,
6155
- onForgotPasswordError = _ref4$onForgotPasswor2 === void 0 ? _identity : _ref4$onForgotPasswor2,
6156
- _ref4$shouldFetchCoun = _ref4.shouldFetchCountries,
6157
- shouldFetchCountries = _ref4$shouldFetchCoun === void 0 ? true : _ref4$shouldFetchCoun,
6158
- _ref4$onCountdownFini = _ref4.onCountdownFinish,
6159
- onCountdownFinish = _ref4$onCountdownFini === void 0 ? _identity : _ref4$onCountdownFini,
6160
- _ref4$enableTimer = _ref4.enableTimer,
6161
- enableTimer = _ref4$enableTimer === void 0 ? false : _ref4$enableTimer,
6162
- logo = _ref4.logo,
6163
- _ref4$showForgotPassw = _ref4.showForgotPasswordButton,
6164
- showForgotPasswordButton = _ref4$showForgotPassw === void 0 ? false : _ref4$showForgotPassw,
6165
- _ref4$showSignUpButto = _ref4.showSignUpButton,
6166
- showSignUpButton = _ref4$showSignUpButto === void 0 ? false : _ref4$showSignUpButto,
6167
- _ref4$brandOptIn = _ref4.brandOptIn,
6168
- brandOptIn = _ref4$brandOptIn === void 0 ? false : _ref4$brandOptIn,
6169
- _ref4$showPoweredByIm = _ref4.showPoweredByImage,
6170
- showPoweredByImage = _ref4$showPoweredByIm === void 0 ? false : _ref4$showPoweredByIm,
6171
- customFieldsOrderKeys = _ref4.customFieldsOrderKeys,
6172
- customFieldsTicketHolderKeys = _ref4.customFieldsTicketHolderKeys,
6173
- _ref4$isCountryCodeEd = _ref4.isCountryCodeEditable,
6174
- isCountryCodeEditable = _ref4$isCountryCodeEd === void 0 ? true : _ref4$isCountryCodeEd,
6175
- _ref4$onPendingVerifi = _ref4.onPendingVerification,
6176
- onPendingVerification = _ref4$onPendingVerifi === void 0 ? _identity : _ref4$onPendingVerifi,
6177
- _ref4$onGetCheckoutCo = _ref4.onGetCheckoutConfigsSuccess,
6178
- onGetCheckoutConfigsSuccess = _ref4$onGetCheckoutCo === void 0 ? _identity : _ref4$onGetCheckoutCo,
6179
- _ref4$onGetCheckoutCo2 = _ref4.onGetCheckoutConfigsError,
6180
- onGetCheckoutConfigsError = _ref4$onGetCheckoutCo2 === void 0 ? _identity : _ref4$onGetCheckoutCo2,
6181
- _ref4$includeAddons = _ref4.includeAddons,
6182
- includeAddons = _ref4$includeAddons === void 0 ? false : _ref4$includeAddons,
6183
- addonsProps = _ref4.addonsProps,
6184
- addOnDataWithCustomFields = _ref4.addOnDataWithCustomFields,
6185
- _ref4$isSinglePageChe = _ref4.isSinglePageCheckout,
6186
- isSinglePageCheckout = _ref4$isSinglePageChe === void 0 ? false : _ref4$isSinglePageChe,
6187
- _ref4$paymentProps = _ref4.paymentProps,
6188
- paymentProps = _ref4$paymentProps === void 0 ? {} : _ref4$paymentProps,
6189
- paymentSectionAddon = _ref4.paymentSectionAddon;
6265
+ } : _ref6$ticketHoldersFi,
6266
+ _ref6$initialValues = _ref6.initialValues,
6267
+ initialValues = _ref6$initialValues === void 0 ? {} : _ref6$initialValues,
6268
+ _ref6$buttonName = _ref6.buttonName,
6269
+ buttonName = _ref6$buttonName === void 0 ? 'Submit' : _ref6$buttonName,
6270
+ _ref6$freeOrderButton = _ref6.freeOrderButtonName,
6271
+ freeOrderButtonName = _ref6$freeOrderButton === void 0 ? 'Complete Registration' : _ref6$freeOrderButton,
6272
+ _ref6$handleSubmit = _ref6.handleSubmit,
6273
+ handleSubmit = _ref6$handleSubmit === void 0 ? _identity : _ref6$handleSubmit,
6274
+ _ref6$theme = _ref6.theme,
6275
+ theme = _ref6$theme === void 0 ? 'light' : _ref6$theme,
6276
+ _ref6$onRegisterSucce = _ref6.onRegisterSuccess,
6277
+ onRegisterSuccess = _ref6$onRegisterSucce === void 0 ? _identity : _ref6$onRegisterSucce,
6278
+ _ref6$onRegisterError = _ref6.onRegisterError,
6279
+ onRegisterError = _ref6$onRegisterError === void 0 ? _identity : _ref6$onRegisterError,
6280
+ _ref6$onSubmitError = _ref6.onSubmitError,
6281
+ onSubmitError = _ref6$onSubmitError === void 0 ? _identity : _ref6$onSubmitError,
6282
+ _ref6$onGetCartSucces = _ref6.onGetCartSuccess,
6283
+ onGetCartSuccess = _ref6$onGetCartSucces === void 0 ? _identity : _ref6$onGetCartSucces,
6284
+ _ref6$onGetCartError = _ref6.onGetCartError,
6285
+ onGetCartError = _ref6$onGetCartError === void 0 ? _identity : _ref6$onGetCartError,
6286
+ _ref6$onGetCountriesS = _ref6.onGetCountriesSuccess,
6287
+ onGetCountriesSuccess = _ref6$onGetCountriesS === void 0 ? _identity : _ref6$onGetCountriesS,
6288
+ _ref6$onGetCountriesE = _ref6.onGetCountriesError,
6289
+ onGetCountriesError = _ref6$onGetCountriesE === void 0 ? _identity : _ref6$onGetCountriesE,
6290
+ _ref6$onGetStatesSucc = _ref6.onGetStatesSuccess,
6291
+ onGetStatesSuccess = _ref6$onGetStatesSucc === void 0 ? _identity : _ref6$onGetStatesSucc,
6292
+ _ref6$onGetStatesErro = _ref6.onGetStatesError,
6293
+ onGetStatesError = _ref6$onGetStatesErro === void 0 ? _identity : _ref6$onGetStatesErro,
6294
+ _ref6$onGetProfileDat = _ref6.onGetProfileDataSuccess,
6295
+ _onGetProfileDataSuccess = _ref6$onGetProfileDat === void 0 ? _identity : _ref6$onGetProfileDat,
6296
+ _ref6$onGetProfileDat2 = _ref6.onGetProfileDataError,
6297
+ onGetProfileDataError = _ref6$onGetProfileDat2 === void 0 ? _identity : _ref6$onGetProfileDat2,
6298
+ onLogin = _ref6.onLogin,
6299
+ _ref6$onLoginSuccess = _ref6.onLoginSuccess,
6300
+ onLoginSuccess = _ref6$onLoginSuccess === void 0 ? _identity : _ref6$onLoginSuccess,
6301
+ _ref6$onCheckoutUpdat = _ref6.onCheckoutUpdateSuccess,
6302
+ onCheckoutUpdateSuccess = _ref6$onCheckoutUpdat === void 0 ? _identity : _ref6$onCheckoutUpdat,
6303
+ _ref6$onCheckoutUpdat2 = _ref6.onCheckoutUpdateError,
6304
+ onCheckoutUpdateError = _ref6$onCheckoutUpdat2 === void 0 ? _identity : _ref6$onCheckoutUpdat2,
6305
+ _ref6$isLoggedIn = _ref6.isLoggedIn,
6306
+ pIsLoggedIn = _ref6$isLoggedIn === void 0 ? false : _ref6$isLoggedIn,
6307
+ _ref6$accountInfoTitl = _ref6.accountInfoTitle,
6308
+ accountInfoTitle = _ref6$accountInfoTitl === void 0 ? '' : _ref6$accountInfoTitl,
6309
+ hideLogo = _ref6.hideLogo,
6310
+ themeOptions = _ref6.themeOptions,
6311
+ _ref6$onErrorClose = _ref6.onErrorClose,
6312
+ onErrorClose = _ref6$onErrorClose === void 0 ? _identity : _ref6$onErrorClose,
6313
+ _ref6$hideErrorsAlert = _ref6.hideErrorsAlertSection,
6314
+ hideErrorsAlertSection = _ref6$hideErrorsAlert === void 0 ? false : _ref6$hideErrorsAlert,
6315
+ _ref6$onSkipBillingPa = _ref6.onSkipBillingPage,
6316
+ onSkipBillingPage = _ref6$onSkipBillingPa === void 0 ? _identity : _ref6$onSkipBillingPa,
6317
+ _ref6$skipPage = _ref6.skipPage,
6318
+ skipPage = _ref6$skipPage === void 0 ? false : _ref6$skipPage,
6319
+ _ref6$canSkipHolderNa = _ref6.canSkipHolderNames,
6320
+ canSkipHolderNames = _ref6$canSkipHolderNa === void 0 ? false : _ref6$canSkipHolderNa,
6321
+ _ref6$onForgotPasswor = _ref6.onForgotPasswordSuccess,
6322
+ onForgotPasswordSuccess = _ref6$onForgotPasswor === void 0 ? _identity : _ref6$onForgotPasswor,
6323
+ _ref6$onForgotPasswor2 = _ref6.onForgotPasswordError,
6324
+ onForgotPasswordError = _ref6$onForgotPasswor2 === void 0 ? _identity : _ref6$onForgotPasswor2,
6325
+ _ref6$shouldFetchCoun = _ref6.shouldFetchCountries,
6326
+ shouldFetchCountries = _ref6$shouldFetchCoun === void 0 ? true : _ref6$shouldFetchCoun,
6327
+ _ref6$onCountdownFini = _ref6.onCountdownFinish,
6328
+ onCountdownFinish = _ref6$onCountdownFini === void 0 ? _identity : _ref6$onCountdownFini,
6329
+ _ref6$enableTimer = _ref6.enableTimer,
6330
+ enableTimer = _ref6$enableTimer === void 0 ? false : _ref6$enableTimer,
6331
+ logo = _ref6.logo,
6332
+ _ref6$showForgotPassw = _ref6.showForgotPasswordButton,
6333
+ showForgotPasswordButton = _ref6$showForgotPassw === void 0 ? false : _ref6$showForgotPassw,
6334
+ _ref6$showSignUpButto = _ref6.showSignUpButton,
6335
+ showSignUpButton = _ref6$showSignUpButto === void 0 ? false : _ref6$showSignUpButto,
6336
+ _ref6$brandOptIn = _ref6.brandOptIn,
6337
+ brandOptIn = _ref6$brandOptIn === void 0 ? false : _ref6$brandOptIn,
6338
+ _ref6$showPoweredByIm = _ref6.showPoweredByImage,
6339
+ showPoweredByImage = _ref6$showPoweredByIm === void 0 ? false : _ref6$showPoweredByIm,
6340
+ customFieldsOrderKeys = _ref6.customFieldsOrderKeys,
6341
+ customFieldsTicketHolderKeys = _ref6.customFieldsTicketHolderKeys,
6342
+ _ref6$isCountryCodeEd = _ref6.isCountryCodeEditable,
6343
+ isCountryCodeEditable = _ref6$isCountryCodeEd === void 0 ? true : _ref6$isCountryCodeEd,
6344
+ _ref6$onPendingVerifi = _ref6.onPendingVerification,
6345
+ onPendingVerification = _ref6$onPendingVerifi === void 0 ? _identity : _ref6$onPendingVerifi,
6346
+ _ref6$onGetCheckoutCo = _ref6.onGetCheckoutConfigsSuccess,
6347
+ onGetCheckoutConfigsSuccess = _ref6$onGetCheckoutCo === void 0 ? _identity : _ref6$onGetCheckoutCo,
6348
+ _ref6$onGetCheckoutCo2 = _ref6.onGetCheckoutConfigsError,
6349
+ onGetCheckoutConfigsError = _ref6$onGetCheckoutCo2 === void 0 ? _identity : _ref6$onGetCheckoutCo2,
6350
+ _ref6$includeAddons = _ref6.includeAddons,
6351
+ includeAddons = _ref6$includeAddons === void 0 ? false : _ref6$includeAddons,
6352
+ addonsProps = _ref6.addonsProps,
6353
+ addOnDataWithCustomFields = _ref6.addOnDataWithCustomFields,
6354
+ _ref6$isSinglePageChe = _ref6.isSinglePageCheckout,
6355
+ isSinglePageCheckout = _ref6$isSinglePageChe === void 0 ? false : _ref6$isSinglePageChe,
6356
+ _ref6$paymentProps = _ref6.paymentProps,
6357
+ paymentProps = _ref6$paymentProps === void 0 ? {} : _ref6$paymentProps,
6358
+ paymentSectionAddon = _ref6.paymentSectionAddon;
6190
6359
  var _useState = useState(null),
6191
6360
  extraData = _useState[0],
6192
6361
  setExtraData = _useState[1];
@@ -6196,9 +6365,7 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
6196
6365
  var _useState3 = useState(null),
6197
6366
  configs = _useState3[0],
6198
6367
  setConfigs = _useState3[1];
6199
- var _useState4 = useState(false),
6200
- isNewUser = _useState4[0],
6201
- setIsNewUser = _useState4[1];
6368
+ var isNewUser = false;
6202
6369
  var themeMui = createTheme(themeOptions);
6203
6370
  var elementsRef = useRef(null);
6204
6371
  var stripeRef = useRef(null);
@@ -6227,41 +6394,39 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
6227
6394
  resale: false,
6228
6395
  resaleWithAddons: false
6229
6396
  };
6230
- var _useState5 = useState(assingUniqueIds(data)),
6231
- dataWithUniqueIds = _useState5[0],
6232
- setDataWithUniqueIds = _useState5[1];
6397
+ var _useState4 = useState(assingUniqueIds(data)),
6398
+ dataWithUniqueIds = _useState4[0],
6399
+ setDataWithUniqueIds = _useState4[1];
6233
6400
  var xtfCookie = getCookieByName('X-TF-ECOMMERCE');
6234
- var _useState6 = useState(!!(pIsLoggedIn || xtfCookie)),
6235
- isLoggedIn = _useState6[0],
6236
- setIsLoggedIn = _useState6[1];
6237
- var _useState7 = useState({}),
6238
- cartInfoData = _useState7[0],
6239
- setCartInfo = _useState7[1];
6401
+ var _useState5 = useState(!!(pIsLoggedIn || xtfCookie)),
6402
+ isLoggedIn = _useState5[0],
6403
+ setIsLoggedIn = _useState5[1];
6404
+ var _useState6 = useState({}),
6405
+ cartInfoData = _useState6[0],
6406
+ setCartInfo = _useState6[1];
6407
+ var _useState7 = useState([]),
6408
+ countries = _useState7[0],
6409
+ setCountries = _useState7[1];
6240
6410
  var _useState8 = useState([]),
6241
- countries = _useState8[0],
6242
- setCountries = _useState8[1];
6243
- var _useState9 = useState([]),
6244
- states = _useState9[0],
6245
- setStates = _useState9[1];
6411
+ states = _useState8[0],
6412
+ setStates = _useState8[1];
6413
+ var _useState9 = useState(false),
6414
+ showModalLogin = _useState9[0],
6415
+ setShowModalLogin = _useState9[1];
6416
+ var alreadyHasUser = false;
6246
6417
  var _useState10 = useState(false),
6247
- showModalLogin = _useState10[0],
6248
- setShowModalLogin = _useState10[1];
6418
+ userExpired = _useState10[0],
6419
+ setUserExpired = _useState10[1];
6249
6420
  var _useState11 = useState(false),
6250
- alreadyHasUser = _useState11[0],
6251
- setAlreadyHasUser = _useState11[1];
6421
+ showModalSignup = _useState11[0],
6422
+ setShowModalSignup = _useState11[1];
6252
6423
  var _useState12 = useState(false),
6253
- userExpired = _useState12[0],
6254
- setUserExpired = _useState12[1];
6255
- var _useState13 = useState(false),
6256
- showModalSignup = _useState13[0],
6257
- setShowModalSignup = _useState13[1];
6258
- var _useState14 = useState(false),
6259
- showModalForgotPassword = _useState14[0],
6260
- setShowModalForgotPassword = _useState14[1];
6261
- var _useState15 = useState([]),
6262
- ticketsQuantity = _useState15[0],
6263
- setTicketsQuantity = _useState15[1];
6264
- var _useState16 = useState({
6424
+ showModalForgotPassword = _useState12[0],
6425
+ setShowModalForgotPassword = _useState12[1];
6426
+ var _useState13 = useState([]),
6427
+ ticketsQuantity = _useState13[0],
6428
+ setTicketsQuantity = _useState13[1];
6429
+ var _useState14 = useState({
6265
6430
  firstName: '',
6266
6431
  lastName: '',
6267
6432
  email: '',
@@ -6276,26 +6441,30 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
6276
6441
  state: '',
6277
6442
  zip: ''
6278
6443
  }),
6279
- userValues = _useState16[0],
6280
- setUserValues = _useState16[1];
6444
+ userValues = _useState14[0],
6445
+ setUserValues = _useState14[1];
6446
+ var _useState15 = useState(true),
6447
+ loading = _useState15[0],
6448
+ setLoading = _useState15[1];
6449
+ var _useState16 = useState(false),
6450
+ cardLoading = _useState16[0],
6451
+ setCardLoading = _useState16[1];
6281
6452
  var _useState17 = useState(true),
6282
- loading = _useState17[0],
6283
- setLoading = _useState17[1];
6284
- var _useState18 = useState(false),
6285
- cardLoading = _useState18[0],
6286
- setCardLoading = _useState18[1];
6287
- var _useState19 = useState(true),
6288
- isCountriesLoading = _useState19[0],
6289
- setIsCountriesLoading = _useState19[1];
6290
- var _useState20 = useState(null),
6291
- error = _useState20[0],
6292
- setError = _useState20[1];
6293
- var _useState21 = useState(false),
6294
- phoneValidationIsLoading = _useState21[0],
6295
- setPhoneValidationIsLoading = _useState21[1];
6453
+ isCountriesLoading = _useState17[0],
6454
+ setIsCountriesLoading = _useState17[1];
6455
+ var _useState18 = useState(null),
6456
+ error = _useState18[0],
6457
+ setError = _useState18[1];
6458
+ var _useState19 = useState(false),
6459
+ phoneValidationIsLoading = _useState19[0],
6460
+ setPhoneValidationIsLoading = _useState19[1];
6461
+ var _useState20 = useState(false),
6462
+ emailExists = _useState20[0],
6463
+ setEmailExists = _useState20[1];
6296
6464
  var emailLogged = _get(userData, 'email', '') || _get(userValues, 'email', '');
6297
6465
  var firstNameLogged = _get(userData, 'first_name', '') || _get(userValues, 'first_name', '');
6298
6466
  var lastNameLogged = _get(userData, 'last_name', '') || _get(userValues, 'last_name', '');
6467
+ var phoneLogged = _get(userData, 'phone', '') || _get(userValues, 'phone', '');
6299
6468
  var showDOB = configs == null ? void 0 : configs.age_required;
6300
6469
  var showTicketHolders = configs == null ? void 0 : configs.names_required;
6301
6470
  var eventId = configs == null ? void 0 : configs.event_id;
@@ -6323,18 +6492,18 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
6323
6492
  var collectOptionalBusinessCategory = configs == null ? void 0 : configs.collect_optional_business_category;
6324
6493
  var eventHasAddons = configs == null ? void 0 : configs.has_add_on;
6325
6494
  var hideBusinessCategoryField = !collectMandatoryBusinessCategory && !collectOptionalBusinessCategory;
6326
- var _useState22 = useState(),
6327
- pendingVerificationMessage = _useState22[0],
6328
- setPendingVerificationMessage = _useState22[1];
6495
+ var _useState21 = useState(),
6496
+ pendingVerificationMessage = _useState21[0],
6497
+ setPendingVerificationMessage = _useState21[1];
6498
+ var _useState22 = useState({}),
6499
+ reviewData = _useState22[0],
6500
+ setReviewData = _useState22[1];
6329
6501
  var _useState23 = useState({}),
6330
- reviewData = _useState23[0],
6331
- setReviewData = _useState23[1];
6332
- var _useState24 = useState({}),
6333
- checkoutData = _useState24[0],
6334
- setCheckoutData = _useState24[1];
6335
- var _useState25 = useState(null),
6336
- checkoutUpdateData = _useState25[0],
6337
- setCheckoutUpdateData = _useState25[1];
6502
+ checkoutData = _useState23[0],
6503
+ setCheckoutData = _useState23[1];
6504
+ var _useState24 = useState(null),
6505
+ checkoutUpdateData = _useState24[0],
6506
+ setCheckoutUpdateData = _useState24[1];
6338
6507
  var prevData = useRef(data);
6339
6508
  var addAddOnsInAttributes = useCallback(function (checkoutBody) {
6340
6509
  var selectedAddOns = window.localStorage.getItem('add_ons') || '{}';
@@ -6342,9 +6511,9 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
6342
6511
  checkoutBody.attributes.add_ons = JSON.parse(selectedAddOns);
6343
6512
  checkoutBody.attributes.add_on_data_capture = JSON.parse(addOnDataCapture);
6344
6513
  }, []);
6345
- var _useState26 = useState({}),
6346
- singleCheckoutAddons = _useState26[0],
6347
- setSingleCheckoutAddOns = _useState26[1];
6514
+ var _useState25 = useState({}),
6515
+ singleCheckoutAddons = _useState25[0],
6516
+ setSingleCheckoutAddOns = _useState25[1];
6348
6517
  var orderIsFree = !Number(checkoutData == null ? void 0 : checkoutData.total);
6349
6518
  useEffect(function () {
6350
6519
  var hasUniqueId = _get(dataWithUniqueIds, '[0].uniqueId');
@@ -6375,37 +6544,37 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
6375
6544
  useEffect(function () {
6376
6545
  // fetch countries data
6377
6546
  var fetchCountries = /*#__PURE__*/function () {
6378
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
6547
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
6379
6548
  var res;
6380
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
6381
- while (1) switch (_context2.prev = _context2.next) {
6549
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
6550
+ while (1) switch (_context3.prev = _context3.next) {
6382
6551
  case 0:
6383
- _context2.prev = 0;
6384
- _context2.next = 3;
6552
+ _context3.prev = 0;
6553
+ _context3.next = 3;
6385
6554
  return getCountries();
6386
6555
  case 3:
6387
- res = _context2.sent;
6556
+ res = _context3.sent;
6388
6557
  setCustomHeader(res);
6389
6558
  setCountries(res.data);
6390
6559
  setIsCountriesLoading(false);
6391
6560
  onGetCountriesSuccess(res.data);
6392
- _context2.next = 14;
6561
+ _context3.next = 14;
6393
6562
  break;
6394
6563
  case 10:
6395
- _context2.prev = 10;
6396
- _context2.t0 = _context2["catch"](0);
6397
- if (axios.isAxiosError(_context2.t0)) {
6398
- onGetCountriesError(_context2.t0);
6564
+ _context3.prev = 10;
6565
+ _context3.t0 = _context3["catch"](0);
6566
+ if (axios.isAxiosError(_context3.t0)) {
6567
+ onGetCountriesError(_context3.t0);
6399
6568
  }
6400
6569
  setIsCountriesLoading(false);
6401
6570
  case 14:
6402
6571
  case "end":
6403
- return _context2.stop();
6572
+ return _context3.stop();
6404
6573
  }
6405
- }, _callee2, null, [[0, 10]]);
6574
+ }, _callee3, null, [[0, 10]]);
6406
6575
  }));
6407
6576
  return function fetchCountries() {
6408
- return _ref5.apply(this, arguments);
6577
+ return _ref7.apply(this, arguments);
6409
6578
  };
6410
6579
  }();
6411
6580
  shouldFetchCountries && fetchCountries();
@@ -6421,17 +6590,17 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
6421
6590
  }, [eventId, isSinglePageCheckout, shouldFetchCountries, onGetCountriesSuccess, onGetCountriesError]);
6422
6591
  // fetch cart data
6423
6592
  var fetchCart = /*#__PURE__*/function () {
6424
- var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
6593
+ var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
6425
6594
  var res, cartInfo, _cartInfo$cart, cart;
6426
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
6427
- while (1) switch (_context3.prev = _context3.next) {
6595
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
6596
+ while (1) switch (_context4.prev = _context4.next) {
6428
6597
  case 0:
6429
- _context3.prev = 0;
6598
+ _context4.prev = 0;
6430
6599
  setCardLoading(true);
6431
- _context3.next = 4;
6600
+ _context4.next = 4;
6432
6601
  return getCart();
6433
6602
  case 4:
6434
- res = _context3.sent;
6603
+ res = _context4.sent;
6435
6604
  setCustomHeader(res);
6436
6605
  cartInfo = res.data.attributes;
6437
6606
  setCartInfo(cartInfo);
@@ -6440,44 +6609,44 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
6440
6609
  return nanoid();
6441
6610
  }));
6442
6611
  onGetCartSuccess(res.data);
6443
- _context3.next = 16;
6612
+ _context4.next = 16;
6444
6613
  break;
6445
6614
  case 13:
6446
- _context3.prev = 13;
6447
- _context3.t0 = _context3["catch"](0);
6448
- if (axios.isAxiosError(_context3.t0)) {
6449
- onGetCartError(_context3.t0);
6615
+ _context4.prev = 13;
6616
+ _context4.t0 = _context4["catch"](0);
6617
+ if (axios.isAxiosError(_context4.t0)) {
6618
+ onGetCartError(_context4.t0);
6450
6619
  }
6451
6620
  case 16:
6452
- _context3.prev = 16;
6621
+ _context4.prev = 16;
6453
6622
  setCardLoading(false);
6454
- return _context3.finish(16);
6623
+ return _context4.finish(16);
6455
6624
  case 19:
6456
6625
  case "end":
6457
- return _context3.stop();
6626
+ return _context4.stop();
6458
6627
  }
6459
- }, _callee3, null, [[0, 13, 16, 19]]);
6628
+ }, _callee4, null, [[0, 13, 16, 19]]);
6460
6629
  }));
6461
6630
  return function fetchCart() {
6462
- return _ref6.apply(this, arguments);
6631
+ return _ref8.apply(this, arguments);
6463
6632
  };
6464
6633
  }();
6465
6634
  // fetch user data
6466
6635
  var fetchUserData = /*#__PURE__*/function () {
6467
- var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
6636
+ var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
6468
6637
  var userDataResponse, profileSpecifiedData, profileDataObj;
6469
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
6470
- while (1) switch (_context4.prev = _context4.next) {
6638
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
6639
+ while (1) switch (_context5.prev = _context5.next) {
6471
6640
  case 0:
6472
- _context4.prev = 0;
6641
+ _context5.prev = 0;
6473
6642
  if (!isLoggedIn) {
6474
- _context4.next = 10;
6643
+ _context5.next = 10;
6475
6644
  break;
6476
6645
  }
6477
- _context4.next = 4;
6646
+ _context5.next = 4;
6478
6647
  return getProfileData();
6479
6648
  case 4:
6480
- userDataResponse = _context4.sent;
6649
+ userDataResponse = _context5.sent;
6481
6650
  profileSpecifiedData = _get(userDataResponse, 'data');
6482
6651
  profileDataObj = setLoggedUserData(profileSpecifiedData);
6483
6652
  setUserValues(_extends({}, profileDataObj, {
@@ -6487,22 +6656,22 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
6487
6656
  window.localStorage.setItem('user_data', JSON.stringify(profileDataObj));
6488
6657
  _onGetProfileDataSuccess(userDataResponse.data);
6489
6658
  case 10:
6490
- _context4.next = 15;
6659
+ _context5.next = 15;
6491
6660
  break;
6492
6661
  case 12:
6493
- _context4.prev = 12;
6494
- _context4.t0 = _context4["catch"](0);
6495
- if (axios.isAxiosError(_context4.t0)) {
6496
- onGetProfileDataError(_context4.t0);
6662
+ _context5.prev = 12;
6663
+ _context5.t0 = _context5["catch"](0);
6664
+ if (axios.isAxiosError(_context5.t0)) {
6665
+ onGetProfileDataError(_context5.t0);
6497
6666
  }
6498
6667
  case 15:
6499
6668
  case "end":
6500
- return _context4.stop();
6669
+ return _context5.stop();
6501
6670
  }
6502
- }, _callee4, null, [[0, 12]]);
6671
+ }, _callee5, null, [[0, 12]]);
6503
6672
  }));
6504
6673
  return function fetchUserData() {
6505
- return _ref7.apply(this, arguments);
6674
+ return _ref9.apply(this, arguments);
6506
6675
  };
6507
6676
  }();
6508
6677
  useEffect(function () {
@@ -6511,19 +6680,19 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
6511
6680
  }, [isLoggedIn]);
6512
6681
  useEffect(function () {
6513
6682
  var fetchCheckoutUpdate = /*#__PURE__*/function () {
6514
- var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
6683
+ var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
6515
6684
  var checkoutUpdateResponse, checkoutAttributes, cartPriceBreakdown;
6516
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
6517
- while (1) switch (_context5.prev = _context5.next) {
6685
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
6686
+ while (1) switch (_context6.prev = _context6.next) {
6518
6687
  case 0:
6519
6688
  if (eventId) {
6520
- _context5.next = 2;
6689
+ _context6.next = 2;
6521
6690
  break;
6522
6691
  }
6523
- return _context5.abrupt("return");
6692
+ return _context6.abrupt("return");
6524
6693
  case 2:
6525
- _context5.prev = 2;
6526
- _context5.next = 5;
6694
+ _context6.prev = 2;
6695
+ _context6.next = 5;
6527
6696
  return updateCheckout({
6528
6697
  attributes: {
6529
6698
  event_id: eventId,
@@ -6531,7 +6700,7 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
6531
6700
  }
6532
6701
  });
6533
6702
  case 5:
6534
- checkoutUpdateResponse = _context5.sent;
6703
+ checkoutUpdateResponse = _context6.sent;
6535
6704
  console.log('Stripe in [useEffect] fetchCheckoutUpdate', checkoutUpdateResponse);
6536
6705
  if (checkoutUpdateResponse.success) {
6537
6706
  checkoutAttributes = checkoutUpdateResponse.data.attributes;
@@ -6546,71 +6715,71 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
6546
6715
  expires_at: expirationTime
6547
6716
  }, cartPriceBreakdown));
6548
6717
  }
6549
- _context5.next = 13;
6718
+ _context6.next = 13;
6550
6719
  break;
6551
6720
  case 10:
6552
- _context5.prev = 10;
6553
- _context5.t0 = _context5["catch"](2);
6554
- console.error('Failed to fetch checkout update:', _context5.t0);
6721
+ _context6.prev = 10;
6722
+ _context6.t0 = _context6["catch"](2);
6723
+ console.error('Failed to fetch checkout update:', _context6.t0);
6555
6724
  case 13:
6556
6725
  case "end":
6557
- return _context5.stop();
6726
+ return _context6.stop();
6558
6727
  }
6559
- }, _callee5, null, [[2, 10]]);
6728
+ }, _callee6, null, [[2, 10]]);
6560
6729
  }));
6561
6730
  return function fetchCheckoutUpdate() {
6562
- return _ref8.apply(this, arguments);
6731
+ return _ref10.apply(this, arguments);
6563
6732
  };
6564
6733
  }();
6565
6734
  fetchCheckoutUpdate();
6566
6735
  }, [eventId, additionalConfigs == null ? void 0 : additionalConfigs.resale]);
6567
6736
  useEffect(function () {
6568
6737
  var collectPaymentData = /*#__PURE__*/function () {
6569
- var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
6738
+ var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
6570
6739
  var checkoutBody, checkoutResponse;
6571
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
6572
- while (1) switch (_context6.prev = _context6.next) {
6740
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
6741
+ while (1) switch (_context7.prev = _context7.next) {
6573
6742
  case 0:
6574
6743
  if (!(skipPage && !_isEmpty(ticketsQuantity) && !showDOB && !loading && !isNewUser)) {
6575
- _context6.next = 20;
6744
+ _context7.next = 20;
6576
6745
  break;
6577
6746
  }
6578
6747
  setLoading(true);
6579
6748
  checkoutBody = createCheckoutDataBodyWithDefaultHolder(ticketsQuantity.length, userData);
6580
- _context6.prev = 3;
6749
+ _context7.prev = 3;
6581
6750
  if (isBrowser) {
6582
6751
  addAddOnsInAttributes(checkoutBody);
6583
6752
  }
6584
- _context6.next = 7;
6753
+ _context7.next = 7;
6585
6754
  return postOnCheckout(checkoutBody, flagFreeTicket);
6586
6755
  case 7:
6587
- checkoutResponse = _context6.sent;
6756
+ checkoutResponse = _context7.sent;
6588
6757
  removeReferralKey();
6589
6758
  removeAdditionalConfigs();
6590
6759
  onSkipBillingPage(checkoutResponse.data.attributes);
6591
6760
  setLoading(false);
6592
- _context6.next = 18;
6761
+ _context7.next = 18;
6593
6762
  break;
6594
6763
  case 14:
6595
- _context6.prev = 14;
6596
- _context6.t0 = _context6["catch"](3);
6597
- onSubmitError(_context6.t0);
6598
- if (_get(_context6.t0, 'response.data.data.hasUnverifiedOrder')) {
6599
- setPendingVerificationMessage(_get(_context6.t0, 'response.data.message'));
6764
+ _context7.prev = 14;
6765
+ _context7.t0 = _context7["catch"](3);
6766
+ onSubmitError(_context7.t0);
6767
+ if (_get(_context7.t0, 'response.data.data.hasUnverifiedOrder')) {
6768
+ setPendingVerificationMessage(_get(_context7.t0, 'response.data.message'));
6600
6769
  }
6601
6770
  case 18:
6602
- _context6.next = 21;
6771
+ _context7.next = 21;
6603
6772
  break;
6604
6773
  case 20:
6605
6774
  setLoading(false);
6606
6775
  case 21:
6607
6776
  case "end":
6608
- return _context6.stop();
6777
+ return _context7.stop();
6609
6778
  }
6610
- }, _callee6, null, [[3, 14]]);
6779
+ }, _callee7, null, [[3, 14]]);
6611
6780
  }));
6612
6781
  return function collectPaymentData() {
6613
- return _ref9.apply(this, arguments);
6782
+ return _ref11.apply(this, arguments);
6614
6783
  };
6615
6784
  }();
6616
6785
  collectPaymentData();
@@ -6622,13 +6791,15 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
6622
6791
  checkoutBody = createCheckoutDataBodyWithDefaultHolder(ticketsQuantity.length, values, true, {
6623
6792
  emailLogged: emailLogged,
6624
6793
  firstNameLogged: firstNameLogged,
6625
- lastNameLogged: lastNameLogged
6794
+ lastNameLogged: lastNameLogged,
6795
+ phoneLogged: phoneLogged
6626
6796
  });
6627
6797
  } else {
6628
6798
  checkoutBody = createCheckoutDataBody(ticketsQuantity.length, values, {
6629
6799
  emailLogged: emailLogged || profileData.email,
6630
6800
  firstNameLogged: firstNameLogged || profileData.first_name || profileData.firstName,
6631
- lastNameLogged: lastNameLogged || profileData.last_name || profileData.lastName
6801
+ lastNameLogged: lastNameLogged || profileData.last_name || profileData.lastName,
6802
+ phoneLogged: phoneLogged || profileData.phone
6632
6803
  }, showDOB);
6633
6804
  }
6634
6805
  // Collect data_capture for Order Custom Fields
@@ -6706,7 +6877,7 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
6706
6877
  return {
6707
6878
  attributes: mergedAttributes
6708
6879
  };
6709
- }, [showDOB, showTicketHolders, canSkipHolderNames, customFieldsOrderKeys, ticketsQuantity.length, emailLogged, firstNameLogged, lastNameLogged, customFieldsTicketHolderKeys]);
6880
+ }, [showDOB, showTicketHolders, canSkipHolderNames, customFieldsOrderKeys, ticketsQuantity.length, emailLogged, firstNameLogged, lastNameLogged, phoneLogged, customFieldsTicketHolderKeys]);
6710
6881
  var removeReferralKey = useCallback(function () {
6711
6882
  localStorage.removeItem('referral_key');
6712
6883
  }, []);
@@ -6736,24 +6907,24 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
6736
6907
  }),
6737
6908
  processPayment = _useStripePayment.processPayment;
6738
6909
  var updateCheckoutWithAddOns = useCallback( /*#__PURE__*/function () {
6739
- var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(addOns) {
6910
+ var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(addOns) {
6740
6911
  var mergedAddOns, _checkoutUpdateData, checkoutResponse, checkoutDataObj, errorMessage;
6741
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
6742
- while (1) switch (_context7.prev = _context7.next) {
6912
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
6913
+ while (1) switch (_context8.prev = _context8.next) {
6743
6914
  case 0:
6744
6915
  if (addOns === void 0) {
6745
6916
  addOns = {};
6746
6917
  }
6747
6918
  if (isSinglePageCheckout) {
6748
- _context7.next = 3;
6919
+ _context8.next = 3;
6749
6920
  break;
6750
6921
  }
6751
- return _context7.abrupt("return");
6922
+ return _context8.abrupt("return");
6752
6923
  case 3:
6753
6924
  mergedAddOns = _extends({}, singleCheckoutAddons); // Update existing entries and add new ones
6754
- Object.entries(addOns).forEach(function (_ref11) {
6755
- var key = _ref11[0],
6756
- value = _ref11[1];
6925
+ Object.entries(addOns).forEach(function (_ref13) {
6926
+ var key = _ref13[0],
6927
+ value = _ref13[1];
6757
6928
  var amount = Number(value);
6758
6929
  if (amount) {
6759
6930
  mergedAddOns[key] = amount;
@@ -6761,7 +6932,7 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
6761
6932
  delete mergedAddOns[key];
6762
6933
  }
6763
6934
  });
6764
- _context7.prev = 5;
6935
+ _context8.prev = 5;
6765
6936
  _checkoutUpdateData = {
6766
6937
  attributes: {
6767
6938
  event_id: eventId,
@@ -6769,51 +6940,51 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
6769
6940
  is_from_resale: additionalConfigs == null ? void 0 : additionalConfigs.resale
6770
6941
  }
6771
6942
  };
6772
- _context7.next = 9;
6943
+ _context8.next = 9;
6773
6944
  return updateCheckout(_checkoutUpdateData);
6774
6945
  case 9:
6775
- checkoutResponse = _context7.sent;
6946
+ checkoutResponse = _context8.sent;
6776
6947
  if (checkoutResponse.success) {
6777
6948
  checkoutDataObj = _get(checkoutResponse, 'data.attributes.cart_price_breakdown', {});
6778
6949
  setCheckoutData(checkoutDataObj);
6779
6950
  setSingleCheckoutAddOns(mergedAddOns);
6780
6951
  }
6781
- _context7.next = 18;
6952
+ _context8.next = 18;
6782
6953
  break;
6783
6954
  case 13:
6784
- _context7.prev = 13;
6785
- _context7.t0 = _context7["catch"](5);
6786
- errorMessage = _get(_context7.t0, 'response.data.message', 'Failed to update add-ons');
6955
+ _context8.prev = 13;
6956
+ _context8.t0 = _context8["catch"](5);
6957
+ errorMessage = _get(_context8.t0, 'response.data.message', 'Failed to update add-ons');
6787
6958
  setError(errorMessage);
6788
- onCheckoutUpdateError(_context7.t0);
6959
+ onCheckoutUpdateError(_context8.t0);
6789
6960
  case 18:
6790
6961
  case "end":
6791
- return _context7.stop();
6962
+ return _context8.stop();
6792
6963
  }
6793
- }, _callee7, null, [[5, 13]]);
6964
+ }, _callee8, null, [[5, 13]]);
6794
6965
  }));
6795
6966
  return function (_x) {
6796
- return _ref10.apply(this, arguments);
6967
+ return _ref12.apply(this, arguments);
6797
6968
  };
6798
6969
  }(), [eventId, isSinglePageCheckout, onCheckoutUpdateError, onCheckoutUpdateSuccess]);
6799
6970
  console.log({
6800
6971
  checkoutData: checkoutData
6801
6972
  });
6802
6973
  var handleAddOnSelect = useCallback( /*#__PURE__*/function () {
6803
- var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(selectedAddOns) {
6804
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
6805
- while (1) switch (_context8.prev = _context8.next) {
6974
+ var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(selectedAddOns) {
6975
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
6976
+ while (1) switch (_context9.prev = _context9.next) {
6806
6977
  case 0:
6807
- _context8.next = 2;
6978
+ _context9.next = 2;
6808
6979
  return updateCheckoutWithAddOns(selectedAddOns);
6809
6980
  case 2:
6810
6981
  case "end":
6811
- return _context8.stop();
6982
+ return _context9.stop();
6812
6983
  }
6813
- }, _callee8);
6984
+ }, _callee9);
6814
6985
  }));
6815
6986
  return function (_x2) {
6816
- return _ref12.apply(this, arguments);
6987
+ return _ref14.apply(this, arguments);
6817
6988
  };
6818
6989
  }(), [updateCheckoutWithAddOns]);
6819
6990
  var onAddOnSelect = useCallback(function (id, value, addon, fieldUpdates) {
@@ -6897,19 +7068,42 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
6897
7068
  }, initialValues), userValues, ticketHoldersFields, ticketsQuantity),
6898
7069
  enableReinitialize: false,
6899
7070
  onSubmit: function () {
6900
- var _onSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(values, formikHelpers) {
6901
- var _checkoutBody$attribu2, _checkoutBody$attribu3, checkoutBodyForRegistration, bodyFormData, resRegister, _xtfCookie, refreshToken, userProfile, hasUnverifiedOrder, message, profileData, profileSpecifiedData, profileDataObj, userDataObj, checkoutBody, storedAddOnDataCapture, checkoutResponse, checkoutUpdateResponse, paymentResponse, _checkoutResponse$dat, hash, total, paymentDataResponse, _cart$, attributes, order_details, cart, _order_details$ticket, ticket, updatedOrderData, isFreeTickets, paymentMethod, paymentPlanAvailable, _hasUnverifiedOrder, _message, _e$response, event;
6902
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
6903
- while (1) switch (_context9.prev = _context9.next) {
7071
+ var _onSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(values, formikHelpers) {
7072
+ var _checkoutBody$attribu2, _checkoutBody$attribu3, flagRequirePhoneLocal, holdersCount, hasHolderPhoneError, i, fieldName, value, userDataObj, profileData, profileSpecifiedData, checkoutBody, storedAddOnDataCapture, checkoutResponse, checkoutUpdateResponse, paymentResponse, _checkoutResponse$dat, hash, total, paymentDataResponse, _cart$, attributes, order_details, cart, _order_details$ticket, ticket, updatedOrderData, isFreeTickets, paymentMethod, paymentPlanAvailable, hasUnverifiedOrder, message, _e$response, event;
7073
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
7074
+ while (1) switch (_context10.prev = _context10.next) {
6904
7075
  case 0:
6905
- _context9.prev = 0;
7076
+ _context10.prev = 0;
7077
+ // Validation: if phone is required for ticket holders, mark errors and stop submit
7078
+ flagRequirePhoneLocal = Boolean(configs == null ? void 0 : configs.phone_required);
7079
+ if (!flagRequirePhoneLocal) {
7080
+ _context10.next = 8;
7081
+ break;
7082
+ }
7083
+ holdersCount = ticketsQuantity.length;
7084
+ hasHolderPhoneError = false;
7085
+ for (i = 0; i < holdersCount; i++) {
7086
+ fieldName = "holderPhone-" + i;
7087
+ value = _get(values, fieldName, '');
7088
+ if (!value) {
7089
+ hasHolderPhoneError = true;
7090
+ formikHelpers.setFieldTouched(fieldName, true, false);
7091
+ formikHelpers.setFieldError(fieldName, 'This field is required');
7092
+ }
7093
+ }
7094
+ if (!hasHolderPhoneError) {
7095
+ _context10.next = 8;
7096
+ break;
7097
+ }
7098
+ return _context10.abrupt("return");
7099
+ case 8:
6906
7100
  if (!((!elementsRef.current || !stripeRef.current) && !orderIsFree)) {
6907
- _context9.next = 4;
7101
+ _context10.next = 11;
6908
7102
  break;
6909
7103
  }
6910
7104
  setError('Fill in the payment details');
6911
- return _context9.abrupt("return");
6912
- case 4:
7105
+ return _context10.abrupt("return");
7106
+ case 11:
6913
7107
  if (isBrowser) {
6914
7108
  window.localStorage.setItem('extraData', JSON.stringify({
6915
7109
  data_capture: {
@@ -6920,68 +7114,43 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
6920
7114
  }
6921
7115
  }));
6922
7116
  }
6923
- if (isLoggedIn) {
6924
- _context9.next = 28;
7117
+ // Guest checkout: no need to register, just get profile if logged in
7118
+ userDataObj = userData;
7119
+ if (!isLoggedIn) {
7120
+ _context10.next = 28;
6925
7121
  break;
6926
7122
  }
6927
- checkoutBodyForRegistration = createCheckoutDataBody(ticketsQuantity.length, values, {
6928
- emailLogged: emailLogged,
6929
- firstNameLogged: firstNameLogged,
6930
- lastNameLogged: lastNameLogged
6931
- }, showDOB);
6932
- bodyFormData = createRegisterFormData(values, checkoutBodyForRegistration, flagFreeTicket);
6933
- _context9.prev = 9;
6934
- setLoading(true);
6935
- _context9.next = 13;
6936
- return register(bodyFormData);
6937
- case 13:
6938
- resRegister = _context9.sent;
6939
- _xtfCookie = _get(resRegister, 'headers.x-tf-ecommerce');
6940
- refreshToken = _get(resRegister, 'data.attributes.refresh_token');
6941
- userProfile = _get(resRegister, 'data.attributes.user_profile');
6942
- setIsNewUser(true);
6943
- onRegisterSuccess({
6944
- xtfCookie: _xtfCookie,
6945
- refreshToken: refreshToken,
6946
- userProfile: userProfile
6947
- });
6948
- _context9.next = 28;
6949
- break;
6950
- case 21:
6951
- _context9.prev = 21;
6952
- _context9.t0 = _context9["catch"](9);
6953
- setLoading(false);
6954
- hasUnverifiedOrder = _get(_context9.t0, 'response.data.data.hasUnverifiedOrder');
6955
- message = _get(_context9.t0, 'response.data.message', {});
6956
- if (hasUnverifiedOrder && typeof message === 'string') {
6957
- setPendingVerificationMessage(message);
6958
- } else if (axios.isAxiosError(_context9.t0)) {
6959
- if (_includes(message, 'You must be aged') && typeof message === 'string') {
6960
- formikHelpers.setFieldError('holderAge', message);
6961
- }
6962
- if (typeof message !== 'string' && message != null && message.password) {
6963
- formikHelpers.setFieldError('password', message.password);
6964
- formikHelpers.setFieldError('confirmPassword', message.password);
6965
- }
6966
- if (typeof message !== 'string' && message != null && message.email && !onLogin) {
6967
- // False will stand for outside controll
6968
- setAlreadyHasUser(true);
6969
- setShowModalLogin(true);
6970
- }
6971
- if (_includes(error, 'The cart is expired') && !hideErrorsAlertSection) {
6972
- setError(error);
6973
- }
6974
- onRegisterError(_context9.t0, values.email);
6975
- }
6976
- return _context9.abrupt("return");
6977
- case 28:
6978
- _context9.next = 30;
7123
+ _context10.prev = 15;
7124
+ _context10.next = 18;
6979
7125
  return getProfileData();
6980
- case 30:
6981
- profileData = _context9.sent;
7126
+ case 18:
7127
+ profileData = _context10.sent;
6982
7128
  profileSpecifiedData = _get(profileData, 'data');
6983
- profileDataObj = setLoggedUserData(profileSpecifiedData);
6984
- userDataObj = isLoggedIn ? userData : profileDataObj;
7129
+ userDataObj = setLoggedUserData(profileSpecifiedData);
7130
+ _context10.next = 26;
7131
+ break;
7132
+ case 23:
7133
+ _context10.prev = 23;
7134
+ _context10.t0 = _context10["catch"](15);
7135
+ // If profile fetch fails, use values from form
7136
+ userDataObj = {
7137
+ email: values.email,
7138
+ first_name: values.firstName,
7139
+ last_name: values.lastName,
7140
+ phone: values.phone
7141
+ };
7142
+ case 26:
7143
+ _context10.next = 29;
7144
+ break;
7145
+ case 28:
7146
+ // For guest checkout, use form values
7147
+ userDataObj = {
7148
+ email: values.email,
7149
+ first_name: values.firstName,
7150
+ last_name: values.lastName,
7151
+ phone: values.phone
7152
+ };
7153
+ case 29:
6985
7154
  if (isBrowser) {
6986
7155
  window.localStorage.setItem('user_data', JSON.stringify(userDataObj));
6987
7156
  }
@@ -6997,11 +7166,11 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
6997
7166
  checkoutBody.attributes.add_on_data_capture = JSON.parse(storedAddOnDataCapture);
6998
7167
  }
6999
7168
  }
7000
- _context9.next = 40;
7169
+ _context10.next = 35;
7001
7170
  return postOnCheckout(checkoutBody, flagFreeTicket);
7002
- case 40:
7003
- checkoutResponse = _context9.sent;
7004
- _context9.next = 43;
7171
+ case 35:
7172
+ checkoutResponse = _context10.sent;
7173
+ _context10.next = 38;
7005
7174
  return updateCheckout({
7006
7175
  attributes: {
7007
7176
  event_id: eventId,
@@ -7009,13 +7178,13 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
7009
7178
  is_from_resale: additionalConfigs == null ? void 0 : additionalConfigs.resale
7010
7179
  }
7011
7180
  });
7012
- case 43:
7013
- checkoutUpdateResponse = _context9.sent;
7181
+ case 38:
7182
+ checkoutUpdateResponse = _context10.sent;
7014
7183
  console.log('Stripe checkoutUpdateResponse in billing-info-container', checkoutUpdateResponse);
7015
7184
  setCheckoutUpdateData(checkoutUpdateResponse.data.attributes);
7016
7185
  paymentResponse = null;
7017
7186
  if (!isSinglePageCheckout) {
7018
- _context9.next = 69;
7187
+ _context10.next = 64;
7019
7188
  break;
7020
7189
  }
7021
7190
  _checkoutResponse$dat = checkoutResponse.data.attributes, hash = _checkoutResponse$dat.hash, total = _checkoutResponse$dat.total;
@@ -7023,12 +7192,12 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
7023
7192
  hash: hash,
7024
7193
  total: total
7025
7194
  }));
7026
- _context9.next = 52;
7195
+ _context10.next = 47;
7027
7196
  return getPaymentData(String(hash));
7028
- case 52:
7029
- paymentDataResponse = _context9.sent;
7197
+ case 47:
7198
+ paymentDataResponse = _context10.sent;
7030
7199
  if (!paymentDataResponse.success) {
7031
- _context9.next = 69;
7200
+ _context10.next = 64;
7032
7201
  break;
7033
7202
  }
7034
7203
  attributes = paymentDataResponse.data.attributes;
@@ -7059,37 +7228,37 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
7059
7228
  paymentPlanAvailable: paymentPlanAvailable
7060
7229
  });
7061
7230
  // Process payment using the hook
7062
- _context9.next = 66;
7231
+ _context10.next = 61;
7063
7232
  return processPayment(paymentDataResponse, values, formikHelpers, checkoutResponse, checkoutUpdateResponse, {
7064
7233
  attributes: attributes,
7065
7234
  isFreeTickets: isFreeTickets,
7066
7235
  updatedOrderData: updatedOrderData,
7067
7236
  eventId: eventId
7068
7237
  });
7069
- case 66:
7070
- paymentResponse = _context9.sent;
7238
+ case 61:
7239
+ paymentResponse = _context10.sent;
7071
7240
  if (!(!paymentResponse && !isFreeTickets)) {
7072
- _context9.next = 69;
7241
+ _context10.next = 64;
7073
7242
  break;
7074
7243
  }
7075
- return _context9.abrupt("return");
7076
- case 69:
7244
+ return _context10.abrupt("return");
7245
+ case 64:
7077
7246
  removeReferralKey();
7078
7247
  removeAdditionalConfigs();
7079
7248
  handleSubmit(values, formikHelpers, eventId, checkoutResponse, checkoutUpdateResponse, paymentResponse);
7080
- _context9.next = 81;
7249
+ _context10.next = 77;
7081
7250
  break;
7082
- case 74:
7083
- _context9.prev = 74;
7084
- _context9.t1 = _context9["catch"](0);
7251
+ case 69:
7252
+ _context10.prev = 69;
7253
+ _context10.t1 = _context10["catch"](0);
7085
7254
  setLoading(false);
7086
- onSubmitError(_context9.t1);
7087
- _hasUnverifiedOrder = _get(_context9.t1, 'response.data.data.hasUnverifiedOrder');
7088
- _message = _get(_context9.t1, 'response.data.message', {});
7089
- if (_hasUnverifiedOrder && typeof _message === 'string') {
7090
- setPendingVerificationMessage(_message);
7091
- } else if (axios.isAxiosError(_context9.t1)) {
7092
- if (((_e$response = _context9.t1.response) == null ? void 0 : _e$response.status) === 401 || _get(_context9.t1, 'response.data.error') === 'invalid_token') {
7255
+ onSubmitError(_context10.t1);
7256
+ hasUnverifiedOrder = _get(_context10.t1, 'response.data.data.hasUnverifiedOrder');
7257
+ message = _get(_context10.t1, 'response.data.message', {});
7258
+ if (hasUnverifiedOrder && typeof message === 'string') {
7259
+ setPendingVerificationMessage(message);
7260
+ } else if (axios.isAxiosError(_context10.t1)) {
7261
+ if (((_e$response = _context10.t1.response) == null ? void 0 : _e$response.status) === 401 || _get(_context10.t1, 'response.data.error') === 'invalid_token') {
7093
7262
  if (isBrowser) {
7094
7263
  window.localStorage.removeItem('user_data');
7095
7264
  setUserExpired(true);
@@ -7102,20 +7271,22 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
7102
7271
  window.document.dispatchEvent(event);
7103
7272
  }
7104
7273
  }
7105
- if (_message && !hideErrorsAlertSection && typeof _message === 'string') {
7106
- setError(_message);
7274
+ if (message && !hideErrorsAlertSection && typeof message === 'string') {
7275
+ setError(message);
7107
7276
  }
7108
- onSubmitError(_context9.t1);
7277
+ onSubmitError(_context10.t1);
7109
7278
  }
7110
- case 81:
7111
- _context9.prev = 81;
7279
+ // Keep form values intact - don't reset
7280
+ formikHelpers.setSubmitting(false);
7281
+ case 77:
7282
+ _context10.prev = 77;
7112
7283
  setLoading(false);
7113
- return _context9.finish(81);
7114
- case 84:
7284
+ return _context10.finish(77);
7285
+ case 80:
7115
7286
  case "end":
7116
- return _context9.stop();
7287
+ return _context10.stop();
7117
7288
  }
7118
- }, _callee9, null, [[0, 74, 81, 84], [9, 21]]);
7289
+ }, _callee10, null, [[0, 69, 77, 80], [15, 23]]);
7119
7290
  }));
7120
7291
  function onSubmit(_x3, _x4) {
7121
7292
  return _onSubmit.apply(this, arguments);
@@ -7137,6 +7308,11 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
7137
7308
  onGetStatesSuccess: onGetStatesSuccess,
7138
7309
  onGetStatesError: onGetStatesError,
7139
7310
  shouldFetchCountries: shouldFetchCountries
7311
+ }), React.createElement(EmailExistenceChecker, {
7312
+ email: props.values.email || '',
7313
+ confirmEmail: props.values.confirmEmail || '',
7314
+ isLoggedIn: isLoggedIn,
7315
+ setEmailExists: setEmailExists
7140
7316
  }), React.createElement("div", {
7141
7317
  className: "billing-info-container " + theme
7142
7318
  }, !!error && React.createElement(SnackbarAlert, {
@@ -7212,7 +7388,9 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
7212
7388
  }, React.createElement("div", {
7213
7389
  className: groupClassname
7214
7390
  }, _map(filteredGroupItems, function (element) {
7215
- return ['password', 'confirmPassword', 'password-info'].includes(element.name) && isLoggedIn ? null : React.createElement(React.Fragment, {
7391
+ // Hide password fields in single-page checkout or when user is logged in
7392
+ var shouldHidePasswordFields = ['password', 'confirmPassword', 'password-info'].includes(element.name) && (isLoggedIn || isSinglePageCheckout);
7393
+ return shouldHidePasswordFields ? null : React.createElement(React.Fragment, {
7216
7394
  key: element.uniqueId
7217
7395
  }, React.createElement("div", {
7218
7396
  className: element.className + " " + ((props == null ? void 0 : props.errors[element.name]) || '')
@@ -7221,6 +7399,7 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
7221
7399
  } : {}) : element.component : React.createElement(Field, Object.assign({}, element, {
7222
7400
  type: element.type === 'radio' || element.type === 'checkbox' ? undefined : element.type,
7223
7401
  setPhoneValidationIsLoading: element.type === 'phone' ? setPhoneValidationIsLoading : undefined,
7402
+ fill: element.type === 'phone' ? true : undefined,
7224
7403
  label: getFieldLabel(element, configs),
7225
7404
  validate: getValidateFunctions(element, states, props.values, props.errors),
7226
7405
  setFieldValue: props.setFieldValue,
@@ -7241,7 +7420,24 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
7241
7420
  dateFormat: element.format,
7242
7421
  isCountryCodeEditable: isCountryCodeEditable
7243
7422
  }))));
7244
- })));
7423
+ })), group.groupItems.some(function (el) {
7424
+ return el.name === 'confirmEmail';
7425
+ }) && emailExists && !isLoggedIn && React.createElement("div", {
7426
+ className: "email-registered-message"
7427
+ }, React.createElement("p", {
7428
+ className: "email-registered-text"
7429
+ }, "\u2713 This email is already registered. Log in to auto-fill your information"), React.createElement(Button, {
7430
+ type: "button",
7431
+ variant: "contained",
7432
+ className: "email-login-button",
7433
+ onClick: function onClick() {
7434
+ if (onLogin) {
7435
+ onLogin();
7436
+ } else {
7437
+ setShowModalLogin(true);
7438
+ }
7439
+ }
7440
+ }, "Log in")));
7245
7441
  }));
7246
7442
  }), !_isEmpty(ticketHoldersFields.fields) && React.createElement("div", {
7247
7443
  className: "ticket-holders-fields"
@@ -7267,6 +7463,7 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref4) {
7267
7463
  component: getFieldComponent(element),
7268
7464
  validate: getValidateFunctions(element, states, props.values, props.errors),
7269
7465
  setPhoneValidationIsLoading: setPhoneValidationIsLoading,
7466
+ fill: element.type === 'phone' ? true : undefined,
7270
7467
  defaultCountry: defaultCountry || element.defaultCountry,
7271
7468
  isCountryCodeEditable: isCountryCodeEditable
7272
7469
  })));
@@ -7667,7 +7864,7 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
7667
7864
  while (1) switch (_context.prev = _context.next) {
7668
7865
  case 0:
7669
7866
  if (!hash) {
7670
- _context.next = 15;
7867
+ _context.next = 16;
7671
7868
  break;
7672
7869
  }
7673
7870
  _context.prev = 1;
@@ -7694,19 +7891,23 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
7694
7891
  label: 'Your ticket is currently',
7695
7892
  price: _data.currency.symbol + ((_data$product_price = _data.product_price) == null ? void 0 : _data$product_price.toFixed(2))
7696
7893
  });
7894
+ // Ensure order_hash is included in the data
7895
+ if (!_data.order_hash) {
7896
+ _data.order_hash = hash;
7897
+ }
7697
7898
  setData(_data);
7698
7899
  onGetConfirmationDataSuccess(confirmationDataResponse.data.attributes);
7699
- _context.next = 15;
7900
+ _context.next = 16;
7700
7901
  break;
7701
- case 12:
7702
- _context.prev = 12;
7902
+ case 13:
7903
+ _context.prev = 13;
7703
7904
  _context.t0 = _context["catch"](1);
7704
7905
  if (axios.isAxiosError(_context.t0)) onGetConfirmationDataError(_context.t0);
7705
- case 15:
7906
+ case 16:
7706
7907
  case "end":
7707
7908
  return _context.stop();
7708
7909
  }
7709
- }, _callee, null, [[1, 12]]);
7910
+ }, _callee, null, [[1, 13]]);
7710
7911
  }))();
7711
7912
  }, [hash]);
7712
7913
  var _useState2 = useState(false),
@@ -8107,160 +8308,6 @@ function Countdown(_ref) {
8107
8308
  }, message)));
8108
8309
  }
8109
8310
 
8110
- var generateQuantity = function generateQuantity(n) {
8111
- var quantityList = [];
8112
- for (var i = 1; i <= n; i++) {
8113
- quantityList.push({
8114
- label: i,
8115
- value: i
8116
- });
8117
- }
8118
- return quantityList;
8119
- };
8120
- var WaitingList = function WaitingList(_ref) {
8121
- var _ref$tickets = _ref.tickets,
8122
- tickets = _ref$tickets === void 0 ? {} : _ref$tickets,
8123
- eventId = _ref.eventId,
8124
- _ref$defaultMaxQuanti = _ref.defaultMaxQuantity,
8125
- defaultMaxQuantity = _ref$defaultMaxQuanti === void 0 ? 10 : _ref$defaultMaxQuanti;
8126
- var userData = isBrowser && window.localStorage.getItem('user_data') ? JSON.parse(window.localStorage.getItem('user_data') || '') : {};
8127
- var _useState = useState(false),
8128
- showSuccessMessage = _useState[0],
8129
- setShowSuccessMessage = _useState[1];
8130
- var _useState2 = useState(false),
8131
- loading = _useState2[0],
8132
- setLoading = _useState2[1];
8133
- var ticketTypesList = Object.values(tickets).map(function (d) {
8134
- return {
8135
- label: d.displayName,
8136
- value: d.id
8137
- };
8138
- });
8139
- var showTicketsField = Boolean(ticketTypesList.length);
8140
- var handleSubmit = /*#__PURE__*/function () {
8141
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(values) {
8142
- var response;
8143
- return _regeneratorRuntime().wrap(function _callee$(_context) {
8144
- while (1) switch (_context.prev = _context.next) {
8145
- case 0:
8146
- _context.prev = 0;
8147
- setLoading(true);
8148
- _context.next = 4;
8149
- return addToWaitingList(eventId, {
8150
- attributes: values
8151
- });
8152
- case 4:
8153
- response = _context.sent;
8154
- if (response.success) {
8155
- setShowSuccessMessage(true);
8156
- }
8157
- _context.next = 10;
8158
- break;
8159
- case 8:
8160
- _context.prev = 8;
8161
- _context.t0 = _context["catch"](0);
8162
- case 10:
8163
- _context.prev = 10;
8164
- setLoading(false);
8165
- return _context.finish(10);
8166
- case 13:
8167
- case "end":
8168
- return _context.stop();
8169
- }
8170
- }, _callee, null, [[0, 8, 10, 13]]);
8171
- }));
8172
- return function handleSubmit(_x) {
8173
- return _ref2.apply(this, arguments);
8174
- };
8175
- }();
8176
- return React.createElement("div", {
8177
- className: "waiting-list"
8178
- }, showSuccessMessage ? React.createElement("div", {
8179
- className: "success-message"
8180
- }, React.createElement("p", {
8181
- className: "added-success-message"
8182
- }, "You've been added to the waiting list!"), React.createElement("p", null, "You'll be notified if tickets become available.")) : React.createElement(React.Fragment, null, React.createElement("h2", null, "WAITING LIST"), React.createElement(Formik, {
8183
- initialValues: {
8184
- ticketTypeId: '',
8185
- quantity: '',
8186
- firstName: userData.first_name || '',
8187
- lastName: userData.last_name || '',
8188
- email: userData.email || ''
8189
- },
8190
- onSubmit: handleSubmit
8191
- }, function (_ref3) {
8192
- var values = _ref3.values,
8193
- setFieldValue = _ref3.setFieldValue;
8194
- var selectedTicket = _find(tickets, function (n) {
8195
- return n.id === values.ticketTypeId;
8196
- });
8197
- return React.createElement(Form, null, React.createElement(ErrorFocus, null), showTicketsField && React.createElement(React.Fragment, null, React.createElement("div", {
8198
- className: "field-item"
8199
- }, React.createElement(Field, {
8200
- name: "ticketTypeId",
8201
- label: "Type of Ticket",
8202
- type: "select",
8203
- component: CustomField,
8204
- onChange: function onChange(e) {
8205
- setFieldValue('ticketTypeId', e.target.value);
8206
- setFieldValue('quantity', '');
8207
- },
8208
- selectOptions: [{
8209
- label: 'Type of Ticket',
8210
- value: '',
8211
- disabled: true
8212
- }].concat(ticketTypesList)
8213
- })), React.createElement("div", {
8214
- className: "field-item"
8215
- }, React.createElement(Field, {
8216
- name: "quantity",
8217
- label: "Quantity Requested",
8218
- type: "select",
8219
- component: CustomField,
8220
- selectOptions: [{
8221
- label: 'Quantity Requested',
8222
- value: '',
8223
- disabled: true
8224
- }].concat(generateQuantity((selectedTicket == null ? void 0 : selectedTicket.waitingListMaxQuantity) || (defaultMaxQuantity != null ? defaultMaxQuantity : 10)))
8225
- }))), React.createElement("div", {
8226
- className: "field-item"
8227
- }, React.createElement(Field, {
8228
- name: "firstName",
8229
- label: "First name",
8230
- validate: function validate(value) {
8231
- return requiredValidator(value, 'Please enter your First name');
8232
- },
8233
- component: CustomField
8234
- })), React.createElement("div", {
8235
- className: "field-item"
8236
- }, React.createElement(Field, {
8237
- name: "lastName",
8238
- label: "Last name",
8239
- validate: function validate(value) {
8240
- return requiredValidator(value, 'Please enter your Last name');
8241
- },
8242
- component: CustomField
8243
- })), React.createElement("div", {
8244
- className: "field-item"
8245
- }, React.createElement(Field, {
8246
- name: "email",
8247
- label: "Email",
8248
- validate: combineValidators(function (value) {
8249
- return requiredValidator(value, 'Please enter your Email');
8250
- }, function (value) {
8251
- return emailValidator(value);
8252
- }),
8253
- component: CustomField
8254
- })), React.createElement(Button, {
8255
- type: "submit",
8256
- variant: "contained",
8257
- className: "waiting-list-button"
8258
- }, loading ? React.createElement(CircularProgress$1, {
8259
- size: "22px"
8260
- }) : 'ADD TO WAITING LIST'));
8261
- })));
8262
- };
8263
-
8264
8311
  var getFormFieldsNotLoggedIn = function getFormFieldsNotLoggedIn(clientName) {
8265
8312
  return [{
8266
8313
  name: 'basic-info',
@@ -8286,13 +8333,13 @@ var getFormFieldsNotLoggedIn = function getFormFieldsNotLoggedIn(clientName) {
8286
8333
  label: 'Email',
8287
8334
  type: 'email',
8288
8335
  required: true,
8289
- onValidate: null
8336
+ onValidate: emailValidator
8290
8337
  }, {
8291
8338
  name: 'confirmEmail',
8292
8339
  label: 'Confirm Email',
8293
8340
  type: 'email',
8294
8341
  required: true,
8295
- onValidate: null
8342
+ onValidate: emailValidator
8296
8343
  }]
8297
8344
  }, {
8298
8345
  name: 'billing-info',
@@ -8349,13 +8396,13 @@ var getFormFieldsLoggedIn = function getFormFieldsLoggedIn(clientName) {
8349
8396
  label: 'Email',
8350
8397
  type: 'email',
8351
8398
  required: true,
8352
- onValidate: null
8399
+ onValidate: emailValidator
8353
8400
  }, {
8354
8401
  name: 'confirmEmail',
8355
8402
  label: 'Confirm Email',
8356
8403
  type: 'email',
8357
8404
  required: true,
8358
- onValidate: null
8405
+ onValidate: emailValidator
8359
8406
  }]
8360
8407
  }, {
8361
8408
  name: 'billing-info-logged-in',
@@ -8399,6 +8446,9 @@ var getValidateFunctions$1 = function getValidateFunctions(_ref) {
8399
8446
  if (element.onValidate) {
8400
8447
  validationFunctions.push(element.onValidate);
8401
8448
  }
8449
+ if (element.name === 'password') {
8450
+ validationFunctions.push(passwordValidator);
8451
+ }
8402
8452
  if (element.name === 'confirmEmail') {
8403
8453
  var isSameEmail = function isSameEmail(confirmEmail) {
8404
8454
  return values.email !== confirmEmail ? 'Please confirm your email address correctly' : null;
@@ -8595,94 +8645,448 @@ var FieldsSection = function FieldsSection(_ref2) {
8595
8645
  }));
8596
8646
  };
8597
8647
 
8598
- var X_TF_ECOMMERCE$1 = 'X-TF-ECOMMERCE';
8599
- var isWindowDefined$1 = typeof window !== 'undefined';
8600
- var PreRegistration = function PreRegistration(_ref) {
8601
- var eventId = _ref.eventId,
8602
- pFormFields = _ref.formFields,
8603
- additionalFieldAttribute = _ref.additionalFieldAttribute,
8604
- isPreregistrationStarted = _ref.isPreregistrationStarted,
8605
- logo = _ref.logo,
8606
- showForgotPasswordButton = _ref.showForgotPasswordButton,
8607
- _ref$onLoginSuccess = _ref.onLoginSuccess,
8608
- onLoginSuccess = _ref$onLoginSuccess === void 0 ? _identity : _ref$onLoginSuccess,
8609
- _ref$onForgotPassword = _ref.onForgotPasswordSuccess,
8610
- onForgotPasswordSuccess = _ref$onForgotPassword === void 0 ? _identity : _ref$onForgotPassword,
8611
- _ref$onForgotPassword2 = _ref.onForgotPasswordError,
8612
- onForgotPasswordError = _ref$onForgotPassword2 === void 0 ? _identity : _ref$onForgotPassword2,
8613
- _ref$onGetCountriesSu = _ref.onGetCountriesSuccess,
8614
- onGetCountriesSuccess = _ref$onGetCountriesSu === void 0 ? _identity : _ref$onGetCountriesSu,
8615
- _ref$onGetCountriesEr = _ref.onGetCountriesError,
8616
- onGetCountriesError = _ref$onGetCountriesEr === void 0 ? _identity : _ref$onGetCountriesEr,
8617
- _ref$onConfirmationSu = _ref.onConfirmationSuccess,
8618
- onConfirmationSuccess = _ref$onConfirmationSu === void 0 ? _identity : _ref$onConfirmationSu,
8619
- _ref$onConfirmationEr = _ref.onConfirmationError,
8620
- onConfirmationError = _ref$onConfirmationEr === void 0 ? _identity : _ref$onConfirmationEr,
8621
- themeOptions = _ref.themeOptions;
8622
- var _useState = useState(''),
8623
- error = _useState[0],
8624
- setError = _useState[1];
8625
- var _useState2 = useState(false),
8626
- showModalLogin = _useState2[0],
8627
- setShowModalLogin = _useState2[1];
8628
- var _useState3 = useState(false),
8629
- alreadyHasUser = _useState3[0],
8630
- setAlreadyHasUser = _useState3[1];
8631
- var _useState4 = useState(false),
8632
- showModalForgotPassword = _useState4[0],
8633
- setShowModalForgotPassword = _useState4[1];
8634
- var _useState5 = useState([]),
8635
- countries = _useState5[0],
8636
- setCountries = _useState5[1];
8637
- var _useState6 = useState(Boolean(getCookieByName(X_TF_ECOMMERCE$1))),
8638
- isLoggedIn = _useState6[0],
8639
- setIsLoggedIn = _useState6[1];
8640
- var _useState7 = useState({
8641
- show: false,
8642
- message: ''
8643
- }),
8644
- confirmModalState = _useState7[0],
8645
- setConfirmModalState = _useState7[1];
8646
- var _useState8 = useState({}),
8647
- setUserData = _useState8[1];
8648
- useCookieListener(X_TF_ECOMMERCE$1, function (value) {
8649
- return setIsLoggedIn(Boolean(value));
8650
- });
8651
- var themeMui = createTheme(themeOptions);
8652
- var formFieldsLoggedIn = getFormFieldsLoggedIn(CONFIGS.CLIENT_NAME);
8653
- var formFieldsNotLoggedIn = getFormFieldsNotLoggedIn(CONFIGS.CLIENT_NAME);
8654
- var formFields = updateFormFieldsAttributes(pFormFields || isLoggedIn ? formFieldsLoggedIn : formFieldsNotLoggedIn, additionalFieldAttribute);
8655
- useEffect(function () {
8656
- // fetch countries data
8657
- var fetchCountries = /*#__PURE__*/function () {
8658
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
8659
- var res, _error;
8660
- return _regeneratorRuntime().wrap(function _callee$(_context) {
8661
- while (1) switch (_context.prev = _context.next) {
8662
- case 0:
8663
- _context.prev = 0;
8664
- _context.next = 3;
8665
- return getCountries();
8648
+ var Prewards = function Prewards(props) {
8649
+ var data = props.data,
8650
+ _props$classNamePrefi = props.classNamePrefix,
8651
+ classNamePrefix = _props$classNamePrefi === void 0 ? '' : _props$classNamePrefi,
8652
+ _props$headerNode = props.headerNode,
8653
+ headerNode = _props$headerNode === void 0 ? React.createElement(React.Fragment, null, "PRE", React.createElement("span", null, "WARDS\u2122")) : _props$headerNode;
8654
+ return React.createElement("div", {
8655
+ className: classNamePrefix + "_prewards"
8656
+ }, !_isEmpty(data) && React.createElement("div", {
8657
+ className: classNamePrefix + "_prewards_heder"
8658
+ }, headerNode), React.createElement("div", {
8659
+ className: classNamePrefix + "_prizes"
8660
+ }, _map(data, function (prize) {
8661
+ var description = prize.description,
8662
+ name = prize.name,
8663
+ image = prize.image,
8664
+ id = prize.id;
8665
+ return React.createElement("div", {
8666
+ className: classNamePrefix + "_prize",
8667
+ key: id
8668
+ }, image && React.createElement("img", {
8669
+ className: classNamePrefix + "_image",
8670
+ alt: "",
8671
+ src: image
8672
+ }), React.createElement("div", {
8673
+ className: classNamePrefix + "_info"
8674
+ }, React.createElement("h4", {
8675
+ className: classNamePrefix + "_name"
8676
+ }, name), description && React.createElement("article", {
8677
+ className: classNamePrefix + "_description"
8678
+ }, description)));
8679
+ })));
8680
+ };
8681
+
8682
+ var CopyField = function CopyField(props) {
8683
+ var copyValue = props.copyValue,
8684
+ _props$copyIconSrc = props.copyIconSrc,
8685
+ copyIconSrc = _props$copyIconSrc === void 0 ? 'https://img.icons8.com/office/50/000000/copy.png' : _props$copyIconSrc,
8686
+ _props$copyTitle = props.copyTitle,
8687
+ copyTitle = _props$copyTitle === void 0 ? 'Copy' : _props$copyTitle,
8688
+ _props$hasCopyIcon = props.hasCopyIcon,
8689
+ hasCopyIcon = _props$hasCopyIcon === void 0 ? false : _props$hasCopyIcon,
8690
+ _props$onLinkCopied = props.onLinkCopied,
8691
+ onLinkCopied = _props$onLinkCopied === void 0 ? _identity : _props$onLinkCopied,
8692
+ _props$classNamePrefi = props.classNamePrefix,
8693
+ classNamePrefix = _props$classNamePrefi === void 0 ? '' : _props$classNamePrefi,
8694
+ _props$messageText = props.messageText,
8695
+ messageText = _props$messageText === void 0 ? '' : _props$messageText;
8696
+ var inputRef = useRef(null);
8697
+ return React.createElement(React.Fragment, null, messageText && React.createElement("span", {
8698
+ className: "message-text"
8699
+ }, messageText), React.createElement("input", {
8700
+ ref: inputRef,
8701
+ className: classNamePrefix + "_share-input",
8702
+ defaultValue: copyValue,
8703
+ readOnly: true
8704
+ }), React.createElement("div", {
8705
+ className: classNamePrefix + "_share-by-link-copy-icon",
8706
+ "aria-hidden": true,
8707
+ onClick: function onClick() {
8708
+ navigator.clipboard.writeText(_get(inputRef, 'current.value'));
8709
+ onLinkCopied();
8710
+ }
8711
+ }, hasCopyIcon ? React.createElement("img", {
8712
+ src: copyIconSrc,
8713
+ alt: "copy"
8714
+ }) : React.createElement("span", {
8715
+ className: classNamePrefix + "_copy-icon"
8716
+ }, copyTitle)));
8717
+ };
8718
+
8719
+ var ShareOptions = function ShareOptions(props) {
8720
+ var classNamePrefix = props.classNamePrefix,
8721
+ data = props.data,
8722
+ _props$hasCopyIcon = props.hasCopyIcon,
8723
+ hasCopyIcon = _props$hasCopyIcon === void 0 ? true : _props$hasCopyIcon,
8724
+ _props$onLinkCopied = props.onLinkCopied,
8725
+ onLinkCopied = _props$onLinkCopied === void 0 ? _identity : _props$onLinkCopied,
8726
+ _props$headerText = props.headerText,
8727
+ headerText = _props$headerText === void 0 ? 'Share with your friends here ...' : _props$headerText,
8728
+ hash = props.hash,
8729
+ updateShareActionData = props.updateShareActionData,
8730
+ shareActionData = props.shareActionData;
8731
+ var _data$attributes = data.attributes,
8732
+ actions = _data$attributes.actions,
8733
+ shareUrl = _data$attributes.shareUrl;
8734
+ var shareButtons = shareOptionsAdapter(actions, shareUrl);
8735
+ var isShareLinkEnabled = _some(actions, function (item) {
8736
+ return item.action === 'shared_url';
8737
+ });
8738
+ var _onAfterShare = /*#__PURE__*/function () {
8739
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(eventActionId) {
8740
+ var shareActionToken, tokenShuffleMethod, accessToken;
8741
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
8742
+ while (1) switch (_context.prev = _context.next) {
8743
+ case 0:
8744
+ shareActionToken = shareActionData.shareActionToken, tokenShuffleMethod = shareActionData.tokenShuffleMethod;
8745
+ accessToken = getShuffleMethodByName(tokenShuffleMethod)(shareActionToken);
8746
+ if (!(typeof eventActionId === 'string')) {
8747
+ _context.next = 6;
8748
+ break;
8749
+ }
8750
+ _context.next = 5;
8751
+ return submitShareAction({
8752
+ eventActionId: eventActionId,
8753
+ accessToken: accessToken,
8754
+ hash: hash
8755
+ });
8756
+ case 5:
8757
+ updateShareActionData();
8758
+ case 6:
8759
+ case "end":
8760
+ return _context.stop();
8761
+ }
8762
+ }, _callee);
8763
+ }));
8764
+ return function onAfterShare(_x) {
8765
+ return _ref.apply(this, arguments);
8766
+ };
8767
+ }();
8768
+ return React.createElement("div", {
8769
+ className: classNamePrefix + "_share_options"
8770
+ }, !_isEmpty(actions) && React.createElement(React.Fragment, null, React.createElement("div", {
8771
+ className: classNamePrefix + "_share_header"
8772
+ }, headerText), React.createElement(SocialButtons, {
8773
+ shareLink: data.attributes.shareUrl,
8774
+ name: "",
8775
+ appId: "",
8776
+ showDefaultShareButtons: false,
8777
+ shareButtons: shareButtons,
8778
+ titleText: "",
8779
+ footerText: "",
8780
+ onAfterShare: function onAfterShare(eventActionId) {
8781
+ return _onAfterShare(eventActionId);
8782
+ }
8783
+ }), isShareLinkEnabled && React.createElement("div", {
8784
+ className: classNamePrefix + "_share_btn_inner"
8785
+ }, React.createElement(CopyField, {
8786
+ copyValue: shareUrl,
8787
+ onLinkCopied: onLinkCopied,
8788
+ hasCopyIcon: hasCopyIcon,
8789
+ classNamePrefix: classNamePrefix,
8790
+ messageText: "Share your link"
8791
+ }))));
8792
+ };
8793
+
8794
+ var isWindowDefined$1 = typeof window !== 'undefined';
8795
+ var PreRegistrationComplete = function PreRegistrationComplete(_ref) {
8796
+ var pEventId = _ref.eventId,
8797
+ _ref$classNamePrefix = _ref.classNamePrefix,
8798
+ classNamePrefix = _ref$classNamePrefix === void 0 ? '' : _ref$classNamePrefix,
8799
+ _ref$onLinkCopied = _ref.onLinkCopied,
8800
+ _onLinkCopied = _ref$onLinkCopied === void 0 ? _identity : _ref$onLinkCopied,
8801
+ _ref$hasCopyIcon = _ref.hasCopyIcon,
8802
+ hasCopyIcon = _ref$hasCopyIcon === void 0 ? false : _ref$hasCopyIcon,
8803
+ _ref$pageHeader = _ref.pageHeader,
8804
+ pageHeader = _ref$pageHeader === void 0 ? 'Pre-Registration Confirmation' : _ref$pageHeader,
8805
+ _ref$onGetConfirmatio = _ref.onGetConfirmationDataError,
8806
+ onGetConfirmationDataError = _ref$onGetConfirmatio === void 0 ? _identity : _ref$onGetConfirmatio,
8807
+ _ref$onGetConfirmatio2 = _ref.onGetConfirmationDataSuccess,
8808
+ onGetConfirmationDataSuccess = _ref$onGetConfirmatio2 === void 0 ? _identity : _ref$onGetConfirmatio2,
8809
+ _ref$pageMessage = _ref.pageMessage,
8810
+ pageMessage = _ref$pageMessage === void 0 ? 'Pre registration was successful!' : _ref$pageMessage,
8811
+ _ref$onLoginSuccess = _ref.onLoginSuccess,
8812
+ onLoginSuccess = _ref$onLoginSuccess === void 0 ? _identity : _ref$onLoginSuccess,
8813
+ logo = _ref.logo,
8814
+ themeOptions = _ref.themeOptions,
8815
+ _ref$skipInitialValid = _ref.skipInitialValidation,
8816
+ skipInitialValidation = _ref$skipInitialValid === void 0 ? false : _ref$skipInitialValid;
8817
+ var themeMui = createTheme(themeOptions);
8818
+ var localStorageHash = isWindowDefined$1 ? localStorage.getItem('pre-registration-hash') : '';
8819
+ var queryHash = getQueryVariable('hash') || '';
8820
+ queryHash && isWindowDefined$1 && window.localStorage.setItem('pre-registration-hash', queryHash);
8821
+ var hash = queryHash || localStorageHash;
8822
+ var _useState = useState(Boolean(getCookieByName(X_TF_ECOMMERCE))),
8823
+ isLoggedIn = _useState[0],
8824
+ setIsLoggedIn = _useState[1];
8825
+ var _useState2 = useState(!isLoggedIn),
8826
+ showModalLogin = _useState2[0],
8827
+ setShowModalLogin = _useState2[1];
8828
+ var _useState3 = useState(false),
8829
+ showCopyModal = _useState3[0],
8830
+ setShowCopyModal = _useState3[1];
8831
+ var _useState4 = useState([]),
8832
+ prizes = _useState4[0],
8833
+ setPrizes = _useState4[1];
8834
+ var _useState5 = useState({}),
8835
+ shareOptions = _useState5[0],
8836
+ setShareOptions = _useState5[1];
8837
+ var _useState6 = useState({}),
8838
+ shareActionData = _useState6[0],
8839
+ setShareActionData = _useState6[1];
8840
+ var _useState7 = useState({}),
8841
+ error = _useState7[0],
8842
+ setError = _useState7[1];
8843
+ useCookieListener(X_TF_ECOMMERCE, function (value) {
8844
+ return setIsLoggedIn(Boolean(value));
8845
+ });
8846
+ useEffect(function () {
8847
+ var fetchConfirmationData = /*#__PURE__*/function () {
8848
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
8849
+ var shareOptionsData, attributes, eventId, influencersData, _error$response;
8850
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
8851
+ while (1) switch (_context.prev = _context.next) {
8852
+ case 0:
8853
+ if (!skipInitialValidation) {
8854
+ _context.next = 3;
8855
+ break;
8856
+ }
8857
+ onGetConfirmationDataSuccess();
8858
+ return _context.abrupt("return");
8666
8859
  case 3:
8667
- res = _context.sent;
8668
- setCountries(_map(_get(res, 'data'), function (item) {
8669
- return {
8670
- label: item.name,
8671
- value: Number(item.id)
8672
- };
8673
- }));
8674
- onGetCountriesSuccess(res.data);
8675
- _context.next = 11;
8860
+ _context.prev = 3;
8861
+ if (!(hash && isLoggedIn)) {
8862
+ _context.next = 18;
8863
+ break;
8864
+ }
8865
+ _context.next = 7;
8866
+ return getPreRegistrationShareOptions({
8867
+ hash: hash
8868
+ });
8869
+ case 7:
8870
+ shareOptionsData = _context.sent;
8871
+ attributes = shareOptionsData.data.attributes;
8872
+ setShareOptions(shareOptionsData.data);
8873
+ setShareActionData({
8874
+ shareActionToken: attributes.shareActionToken,
8875
+ tokenShuffleMethod: attributes.tokenShuffleMethod
8876
+ });
8877
+ eventId = _get(shareOptionsData, 'data.attributes.eventId');
8878
+ if (!(eventId || pEventId)) {
8879
+ _context.next = 17;
8880
+ break;
8881
+ }
8882
+ _context.next = 15;
8883
+ return getPreRegistrationInfluencers({
8884
+ eventId: eventId || pEventId
8885
+ });
8886
+ case 15:
8887
+ influencersData = _context.sent;
8888
+ setPrizes(influencersData.data.attributes.prizes);
8889
+ case 17:
8890
+ onGetConfirmationDataSuccess();
8891
+ case 18:
8892
+ _context.next = 23;
8676
8893
  break;
8677
- case 8:
8678
- _context.prev = 8;
8679
- _context.t0 = _context["catch"](0);
8894
+ case 20:
8895
+ _context.prev = 20;
8896
+ _context.t0 = _context["catch"](3);
8680
8897
  if (axios.isAxiosError(_context.t0)) {
8681
- _error = 'Error';
8682
- setError(_error);
8683
- onGetCountriesError(_context.t0);
8898
+ setError((_error$response = _context.t0.response) == null ? void 0 : _error$response.data);
8684
8899
  }
8685
- case 11:
8900
+ case 23:
8901
+ case "end":
8902
+ return _context.stop();
8903
+ }
8904
+ }, _callee, null, [[3, 20]]);
8905
+ }));
8906
+ return function fetchConfirmationData() {
8907
+ return _ref2.apply(this, arguments);
8908
+ };
8909
+ }();
8910
+ fetchConfirmationData();
8911
+ }, [pEventId, hash, onGetConfirmationDataError, onGetConfirmationDataSuccess, isLoggedIn, skipInitialValidation]);
8912
+ var onClose = function onClose() {
8913
+ setShowCopyModal(false);
8914
+ };
8915
+ var updateShareActionData = /*#__PURE__*/function () {
8916
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
8917
+ var shareOptionsData;
8918
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
8919
+ while (1) switch (_context2.prev = _context2.next) {
8920
+ case 0:
8921
+ if (!hash) {
8922
+ _context2.next = 6;
8923
+ break;
8924
+ }
8925
+ _context2.next = 3;
8926
+ return getPreRegistrationShareOptions({
8927
+ hash: hash
8928
+ });
8929
+ case 3:
8930
+ shareOptionsData = _context2.sent;
8931
+ setShareOptions(shareOptionsData.data);
8932
+ setShareActionData({
8933
+ shareActionToken: shareOptionsData.data.attributes.shareActionToken,
8934
+ tokenShuffleMethod: shareOptionsData.data.attributes.tokenShuffleMethod
8935
+ });
8936
+ case 6:
8937
+ case "end":
8938
+ return _context2.stop();
8939
+ }
8940
+ }, _callee2);
8941
+ }));
8942
+ return function updateShareActionData() {
8943
+ return _ref3.apply(this, arguments);
8944
+ };
8945
+ }();
8946
+ return React.createElement(ThemeProvider, {
8947
+ theme: themeMui
8948
+ }, isLoggedIn && _isEmpty(error) ? React.createElement("div", {
8949
+ className: classNamePrefix + "_pre_registration_complete_container"
8950
+ }, React.createElement(CopyMessageModal, {
8951
+ showCopyModal: showCopyModal,
8952
+ onClose: onClose
8953
+ }), React.createElement("h2", {
8954
+ className: classNamePrefix + "_pre_registration_complete_header preregistration_confirmation_header"
8955
+ }, pageHeader), React.createElement("div", {
8956
+ className: classNamePrefix + "_pre_registration_complete_message"
8957
+ }, pageMessage), React.createElement("div", {
8958
+ className: classNamePrefix + "_pre_registration_complete_body"
8959
+ }, !_isEmpty(prizes) && React.createElement(Prewards, {
8960
+ classNamePrefix: classNamePrefix,
8961
+ data: prizes
8962
+ }), !_isEmpty(shareOptions) && React.createElement(ShareOptions, {
8963
+ classNamePrefix: classNamePrefix,
8964
+ data: shareOptions,
8965
+ onLinkCopied: function onLinkCopied() {
8966
+ setShowCopyModal(true);
8967
+ _onLinkCopied();
8968
+ },
8969
+ shareActionData: shareActionData,
8970
+ updateShareActionData: updateShareActionData,
8971
+ hasCopyIcon: hasCopyIcon,
8972
+ hash: hash
8973
+ }))) : showModalLogin && React.createElement(LoginModal, {
8974
+ logo: logo,
8975
+ onClose: function onClose() {
8976
+ setShowModalLogin(false);
8977
+ },
8978
+ onLogin: function onLogin(res) {
8979
+ setShowModalLogin(false);
8980
+ onLoginSuccess(res);
8981
+ }
8982
+ }), !_isEmpty(error) && React.createElement(ConfirmModal, {
8983
+ hideCancelBtn: true,
8984
+ message: error.message,
8985
+ onConfirm: function onConfirm() {
8986
+ return onGetConfirmationDataError(error);
8987
+ }
8988
+ }));
8989
+ };
8990
+
8991
+ var X_TF_ECOMMERCE$1 = 'X-TF-ECOMMERCE';
8992
+ var isWindowDefined$2 = typeof window !== 'undefined';
8993
+ var PreRegistration = function PreRegistration(_ref) {
8994
+ var eventId = _ref.eventId,
8995
+ pFormFields = _ref.formFields,
8996
+ additionalFieldAttribute = _ref.additionalFieldAttribute,
8997
+ isPreregistrationStarted = _ref.isPreregistrationStarted,
8998
+ logo = _ref.logo,
8999
+ showForgotPasswordButton = _ref.showForgotPasswordButton,
9000
+ _ref$onLoginSuccess = _ref.onLoginSuccess,
9001
+ onLoginSuccess = _ref$onLoginSuccess === void 0 ? _identity : _ref$onLoginSuccess,
9002
+ _ref$onForgotPassword = _ref.onForgotPasswordSuccess,
9003
+ onForgotPasswordSuccess = _ref$onForgotPassword === void 0 ? _identity : _ref$onForgotPassword,
9004
+ _ref$onForgotPassword2 = _ref.onForgotPasswordError,
9005
+ onForgotPasswordError = _ref$onForgotPassword2 === void 0 ? _identity : _ref$onForgotPassword2,
9006
+ _ref$onGetCountriesSu = _ref.onGetCountriesSuccess,
9007
+ onGetCountriesSuccess = _ref$onGetCountriesSu === void 0 ? _identity : _ref$onGetCountriesSu,
9008
+ _ref$onGetCountriesEr = _ref.onGetCountriesError,
9009
+ onGetCountriesError = _ref$onGetCountriesEr === void 0 ? _identity : _ref$onGetCountriesEr,
9010
+ _ref$onConfirmationSu = _ref.onConfirmationSuccess,
9011
+ onConfirmationSuccess = _ref$onConfirmationSu === void 0 ? _identity : _ref$onConfirmationSu,
9012
+ _ref$onConfirmationEr = _ref.onConfirmationError,
9013
+ onConfirmationError = _ref$onConfirmationEr === void 0 ? _identity : _ref$onConfirmationEr,
9014
+ themeOptions = _ref.themeOptions;
9015
+ var _useState = useState(''),
9016
+ error = _useState[0],
9017
+ setError = _useState[1];
9018
+ var _useState2 = useState(false),
9019
+ showModalLogin = _useState2[0],
9020
+ setShowModalLogin = _useState2[1];
9021
+ var _useState3 = useState(false),
9022
+ alreadyHasUser = _useState3[0],
9023
+ setAlreadyHasUser = _useState3[1];
9024
+ var _useState4 = useState(false),
9025
+ showModalForgotPassword = _useState4[0],
9026
+ setShowModalForgotPassword = _useState4[1];
9027
+ var _useState5 = useState([]),
9028
+ countries = _useState5[0],
9029
+ setCountries = _useState5[1];
9030
+ var _useState6 = useState(Boolean(getCookieByName(X_TF_ECOMMERCE$1))),
9031
+ isLoggedIn = _useState6[0],
9032
+ setIsLoggedIn = _useState6[1];
9033
+ var _useState7 = useState({
9034
+ show: false,
9035
+ message: ''
9036
+ }),
9037
+ confirmModalState = _useState7[0],
9038
+ setConfirmModalState = _useState7[1];
9039
+ var _useState8 = useState({}),
9040
+ setUserData = _useState8[1];
9041
+ var _useState9 = useState(false),
9042
+ isPreRegistrationComplete = _useState9[0],
9043
+ setIsPreRegistrationComplete = _useState9[1];
9044
+ useCookieListener(X_TF_ECOMMERCE$1, function (value) {
9045
+ return setIsLoggedIn(Boolean(value));
9046
+ });
9047
+ // Check if user already has a pre-registration when logged in
9048
+ useEffect(function () {
9049
+ if (!isLoggedIn || !isWindowDefined$2) return;
9050
+ var savedHash = window.localStorage.getItem("pre-registration-hash-" + eventId);
9051
+ if (savedHash) {
9052
+ setIsPreRegistrationComplete(true);
9053
+ }
9054
+ }, [isLoggedIn, eventId]);
9055
+ var themeMui = createTheme(themeOptions);
9056
+ var formFieldsLoggedIn = getFormFieldsLoggedIn(CONFIGS.CLIENT_NAME);
9057
+ var formFieldsNotLoggedIn = getFormFieldsNotLoggedIn(CONFIGS.CLIENT_NAME);
9058
+ var formFields = updateFormFieldsAttributes(pFormFields || isLoggedIn ? formFieldsLoggedIn : formFieldsNotLoggedIn, additionalFieldAttribute);
9059
+ useEffect(function () {
9060
+ // fetch countries data
9061
+ var fetchCountries = /*#__PURE__*/function () {
9062
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
9063
+ var res, _error;
9064
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
9065
+ while (1) switch (_context.prev = _context.next) {
9066
+ case 0:
9067
+ _context.prev = 0;
9068
+ _context.next = 3;
9069
+ return getCountries();
9070
+ case 3:
9071
+ res = _context.sent;
9072
+ setCountries(_map(_get(res, 'data'), function (item) {
9073
+ return {
9074
+ label: item.name,
9075
+ value: Number(item.id)
9076
+ };
9077
+ }));
9078
+ onGetCountriesSuccess(res.data);
9079
+ _context.next = 11;
9080
+ break;
9081
+ case 8:
9082
+ _context.prev = 8;
9083
+ _context.t0 = _context["catch"](0);
9084
+ if (axios.isAxiosError(_context.t0)) {
9085
+ _error = 'Error';
9086
+ setError(_error);
9087
+ onGetCountriesError(_context.t0);
9088
+ }
9089
+ case 11:
8686
9090
  case "end":
8687
9091
  return _context.stop();
8688
9092
  }
@@ -8694,7 +9098,8 @@ var PreRegistration = function PreRegistration(_ref) {
8694
9098
  }();
8695
9099
  fetchCountries();
8696
9100
  }, []);
8697
- var hash = getQueryVariable('hash') || '';
9101
+ var localStorageHash = isWindowDefined$2 ? window.localStorage.getItem('pre-registration-hash') || '' : '';
9102
+ var hash = getQueryVariable('hash') || localStorageHash;
8698
9103
  var referrerId = getQueryVariable('referrer_id') || '';
8699
9104
  return React.createElement(ThemeProvider, {
8700
9105
  theme: themeMui
@@ -8754,7 +9159,19 @@ var PreRegistration = function PreRegistration(_ref) {
8754
9159
  onForgotPasswordSuccess: onForgotPasswordSuccess,
8755
9160
  onForgotPasswordError: onForgotPasswordError,
8756
9161
  displaySuccessMessage: true
8757
- }), React.createElement("h2", null, "Pre-Registration"), React.createElement(Formik, {
9162
+ }), isPreRegistrationComplete ? React.createElement(PreRegistrationComplete, {
9163
+ eventId: eventId,
9164
+ logo: logo,
9165
+ themeOptions: themeOptions,
9166
+ onLoginSuccess: onLoginSuccess,
9167
+ data: {},
9168
+ classNamePrefix: "",
9169
+ onLinkCopied: _identity,
9170
+ updateShareActionData: _identity,
9171
+ hash: hash,
9172
+ shareActionData: {},
9173
+ skipInitialValidation: true
9174
+ }) : React.createElement(React.Fragment, null, React.createElement("h2", null, "Pre-Registration"), React.createElement(Formik, {
8758
9175
  initialValues: getFormInitialValues$1(formFields),
8759
9176
  enableReinitialize: true,
8760
9177
  onSubmit: function () {
@@ -8765,11 +9182,11 @@ var PreRegistration = function PreRegistration(_ref) {
8765
9182
  case 0:
8766
9183
  _context2.prev = 0;
8767
9184
  if (!isLoggedIn) {
8768
- _context2.next = 21;
9185
+ _context2.next = 22;
8769
9186
  break;
8770
9187
  }
8771
9188
  if (!isPreregistrationStarted) {
8772
- _context2.next = 18;
9189
+ _context2.next = 19;
8773
9190
  break;
8774
9191
  }
8775
9192
  updatedValues = _extends({}, values);
@@ -8785,21 +9202,22 @@ var PreRegistration = function PreRegistration(_ref) {
8785
9202
  return confirmPreRegistration(eventId, updatedValues);
8786
9203
  case 13:
8787
9204
  confirmationData = _context2.sent;
8788
- if (isWindowDefined$1) {
8789
- window.localStorage.setItem('pre-registration-hash', _get(confirmationData, 'attributes.hash'));
9205
+ if (isWindowDefined$2) {
9206
+ window.localStorage.setItem("pre-registration-hash-" + eventId, _get(confirmationData, 'attributes.hash'));
8790
9207
  }
9208
+ setIsPreRegistrationComplete(true);
8791
9209
  onConfirmationSuccess(confirmationData);
8792
- _context2.next = 19;
9210
+ _context2.next = 20;
8793
9211
  break;
8794
- case 18:
9212
+ case 19:
8795
9213
  setConfirmModalState({
8796
9214
  show: true,
8797
9215
  message: 'The preregistration has not started'
8798
9216
  });
8799
- case 19:
8800
- _context2.next = 41;
9217
+ case 20:
9218
+ _context2.next = 42;
8801
9219
  break;
8802
- case 21:
9220
+ case 22:
8803
9221
  bodyFormData = new FormData();
8804
9222
  bodyFormData.append('first_name', values.firstName);
8805
9223
  bodyFormData.append('last_name', values.lastName);
@@ -8812,24 +9230,24 @@ var PreRegistration = function PreRegistration(_ref) {
8812
9230
  bodyFormData.append('client_id', CONFIGS.CLIENT_ID);
8813
9231
  bodyFormData.append('client_secret', CONFIGS.CLIENT_SECRET);
8814
9232
  bodyFormData.append('register_for', 'prereg');
8815
- _context2.next = 35;
9233
+ _context2.next = 36;
8816
9234
  return register(bodyFormData);
8817
- case 35:
9235
+ case 36:
8818
9236
  res = _context2.sent;
8819
- _context2.next = 38;
9237
+ _context2.next = 39;
8820
9238
  return getProfileData();
8821
- case 38:
9239
+ case 39:
8822
9240
  profileRes = _context2.sent;
8823
9241
  onLoginSuccess(res.data);
8824
- if (isWindowDefined$1) {
9242
+ if (isWindowDefined$2) {
8825
9243
  window.localStorage.setItem('user_data', JSON.stringify(_get(profileRes, 'data')));
8826
9244
  setUserData(_get(profileRes, 'data'));
8827
9245
  }
8828
- case 41:
8829
- _context2.next = 52;
9246
+ case 42:
9247
+ _context2.next = 53;
8830
9248
  break;
8831
- case 43:
8832
- _context2.prev = 43;
9249
+ case 44:
9250
+ _context2.prev = 44;
8833
9251
  _context2.t0 = _context2["catch"](0);
8834
9252
  _error2 = _context2.t0;
8835
9253
  errorMessage = (_error2 == null ? void 0 : _error2.message) || 'Error';
@@ -8847,11 +9265,11 @@ var PreRegistration = function PreRegistration(_ref) {
8847
9265
  setError(errorMessage);
8848
9266
  }
8849
9267
  onConfirmationError(_error2);
8850
- case 52:
9268
+ case 53:
8851
9269
  case "end":
8852
9270
  return _context2.stop();
8853
9271
  }
8854
- }, _callee2, null, [[0, 43]]);
9272
+ }, _callee2, null, [[0, 44]]);
8855
9273
  }));
8856
9274
  function onSubmit(_x) {
8857
9275
  return _onSubmit.apply(this, arguments);
@@ -8878,65 +9296,219 @@ var PreRegistration = function PreRegistration(_ref) {
8878
9296
  }, props.isSubmitting ? React.createElement(CircularProgress, {
8879
9297
  size: 26
8880
9298
  }) : isLoggedIn ? 'Confirm Pre-Registration' : 'Create Account')));
8881
- })));
9299
+ }))));
8882
9300
  };
8883
9301
 
8884
- // This section is seperate because additional changes layter may be applied to Access Code
8885
- var AccessCodeSection = function AccessCodeSection(_ref) {
8886
- var code = _ref.code,
8887
- setCode = _ref.setCode,
8888
- updateTickets = _ref.updateTickets;
8889
- var isAccessCodeHasValue = !!code.trim();
8890
- return React.createElement("div", {
8891
- className: "access-code-block"
8892
- }, React.createElement("div", {
8893
- className: "access-code-block"
8894
- }, React.createElement("p", {
8895
- className: "access-code-text"
8896
- }, "Access code required")), React.createElement("input", {
8897
- className: "access-code-input",
8898
- placeholder: "",
8899
- onChange: function onChange(e) {
8900
- setCode(e.target.value);
8901
- },
8902
- onKeyPress: function onKeyPress(event) {
8903
- if (event.key === 'Enter' && isAccessCodeHasValue) {
8904
- updateTickets(true);
8905
- }
8906
- }
8907
- }), React.createElement(Button$2, {
8908
- className: "access-submit-button",
8909
- onClick: function onClick() {
8910
- if (isAccessCodeHasValue) {
8911
- updateTickets(true);
8912
- }
8913
- }
8914
- }, "ENTER"));
9302
+ var generateQuantity = function generateQuantity(n) {
9303
+ var quantityList = [];
9304
+ for (var i = 1; i <= n; i++) {
9305
+ quantityList.push({
9306
+ label: i,
9307
+ value: i
9308
+ });
9309
+ }
9310
+ return quantityList;
8915
9311
  };
8916
-
8917
- var DoneSvg = "<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M10 20C15.5228 20 20 15.5228 20 10C20 4.47717 15.5228 0 10 0C4.47717 0 0 4.47717 0 10C0 15.5228 4.47717 20 10 20ZM8.14661 15.8678L16.8782 6.39722C16.9561 6.31335 17 6.19922 17 6.08008C17 5.96094 16.9561 5.8468 16.8782 5.76282L16.3016 5.12854C16.1386 4.95715 15.8796 4.95715 15.7167 5.12854L7.85004 13.661L4.28326 9.79236C4.20593 9.70776 4.10071 9.66016 3.99084 9.66016C3.9353 9.66016 3.88086 9.67236 3.83069 9.69531C3.78168 9.71777 3.73663 9.75061 3.69843 9.79236L3.12183 10.4177C3.07635 10.4667 3.04248 10.5259 3.02216 10.5905C3.00763 10.6365 3 10.6853 3 10.735C3 10.8541 3.04388 10.9683 3.12183 11.0521L7.56177 15.8678C7.6391 15.9524 7.74438 16 7.85419 16C7.96399 16 8.06927 15.9524 8.14661 15.8678Z\" fill=\"#569F44\"/>\n</svg>";
8918
-
8919
- var XmarkSvg = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<svg\n xmlns:osb=\"http://www.openswatchbook.org/uri/2009/osb\"\n xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n xmlns:cc=\"http://creativecommons.org/ns#\"\n xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n xmlns:svg=\"http://www.w3.org/2000/svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:sodipodi=\"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd\"\n xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\"\n viewBox=\"0 0 48 48\"\n version=\"1.1\"\n id=\"svg15\"\n sodipodi:docname=\"cross red circle.svg\"\n inkscape:version=\"0.92.3 (2405546, 2018-03-11)\">\n <metadata\n id=\"metadata19\">\n <rdf:RDF>\n <cc:Work\n rdf:about=\"\">\n <dc:format>image/svg+xml</dc:format>\n <dc:type\n rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\" />\n <dc:title />\n </cc:Work>\n </rdf:RDF>\n </metadata>\n <sodipodi:namedview\n pagecolor=\"#ffffff\"\n bordercolor=\"#666666\"\n borderopacity=\"1\"\n objecttolerance=\"10\"\n gridtolerance=\"10\"\n guidetolerance=\"10\"\n inkscape:pageopacity=\"0\"\n inkscape:pageshadow=\"2\"\n inkscape:window-width=\"1920\"\n inkscape:window-height=\"1027\"\n id=\"namedview17\"\n showgrid=\"false\"\n inkscape:zoom=\"4.9166667\"\n inkscape:cx=\"-11.694915\"\n inkscape:cy=\"40.271186\"\n inkscape:window-x=\"-8\"\n inkscape:window-y=\"-8\"\n inkscape:window-maximized=\"1\"\n inkscape:current-layer=\"g13\" />\n <defs\n id=\"defs7\">\n <linearGradient\n id=\"linearGradient828\"\n osb:paint=\"solid\">\n <stop\n style=\"stop-color:#ff0000;stop-opacity:1;\"\n offset=\"0\"\n id=\"stop826\" />\n </linearGradient>\n <linearGradient\n id=\"0\"\n gradientUnits=\"userSpaceOnUse\"\n y1=\"47.37\"\n x2=\"0\"\n y2=\"-1.429\">\n <stop\n stop-color=\"#c52828\"\n id=\"stop2\" />\n <stop\n offset=\"1\"\n stop-color=\"#ff5454\"\n id=\"stop4\" />\n </linearGradient>\n </defs>\n <g\n transform=\"matrix(.99999 0 0 .99999-58.37.882)\"\n enable-background=\"new\"\n id=\"g13\"\n style=\"fill-opacity:1\">\n <circle\n cx=\"82.37\"\n cy=\"23.12\"\n r=\"24\"\n fill=\"url(#0)\"\n id=\"circle9\"\n style=\"fill-opacity:1;fill:#dd3333\" />\n <path\n d=\"m87.77 23.725l5.939-5.939c.377-.372.566-.835.566-1.373 0-.54-.189-.997-.566-1.374l-2.747-2.747c-.377-.372-.835-.564-1.373-.564-.539 0-.997.186-1.374.564l-5.939 5.939-5.939-5.939c-.377-.372-.835-.564-1.374-.564-.539 0-.997.186-1.374.564l-2.748 2.747c-.377.378-.566.835-.566 1.374 0 .54.188.997.566 1.373l5.939 5.939-5.939 5.94c-.377.372-.566.835-.566 1.373 0 .54.188.997.566 1.373l2.748 2.747c.377.378.835.564 1.374.564.539 0 .997-.186 1.374-.564l5.939-5.939 5.94 5.939c.377.378.835.564 1.374.564.539 0 .997-.186 1.373-.564l2.747-2.747c.377-.372.566-.835.566-1.373 0-.54-.188-.997-.566-1.373l-5.939-5.94\"\n fill=\"#fff\"\n fill-opacity=\".842\"\n id=\"path11\"\n style=\"fill-opacity:1;fill:#ffffff\" />\n </g>\n</svg>";
8920
-
8921
- var PromoCodeSection = function PromoCodeSection(_ref) {
8922
- var _window, _window$localStorage;
8923
- var code = _ref.code,
8924
- codeIsApplied = _ref.codeIsApplied,
8925
- showPromoInput = _ref.showPromoInput,
8926
- setCode = _ref.setCode,
8927
- setShowPromoInput = _ref.setShowPromoInput,
8928
- updateTickets = _ref.updateTickets,
8929
- setCodeIsApplied = _ref.setCodeIsApplied,
8930
- codeIsInvalid = _ref.codeIsInvalid,
8931
- setCodeIsInvalid = _ref.setCodeIsInvalid,
8932
- promoText = _ref.promoText,
8933
- showAlertIcons = _ref.showAlertIcons;
8934
- var isPromoCodeHasValue = !!code.trim();
8935
- var appliedPromoCode = (_window = window) == null ? void 0 : (_window$localStorage = _window.localStorage) == null ? void 0 : _window$localStorage.getItem('appliedPromoCode');
8936
- var renderInputField = function renderInputField() {
8937
- return React.createElement("div", {
8938
- className: "promo-code-block"
8939
- }, React.createElement("div", {
9312
+ var WaitingList = function WaitingList(_ref) {
9313
+ var _ref$tickets = _ref.tickets,
9314
+ tickets = _ref$tickets === void 0 ? {} : _ref$tickets,
9315
+ eventId = _ref.eventId,
9316
+ _ref$defaultMaxQuanti = _ref.defaultMaxQuantity,
9317
+ defaultMaxQuantity = _ref$defaultMaxQuanti === void 0 ? 10 : _ref$defaultMaxQuanti;
9318
+ var userData = isBrowser && window.localStorage.getItem('user_data') ? JSON.parse(window.localStorage.getItem('user_data') || '') : {};
9319
+ var _useState = useState(false),
9320
+ showSuccessMessage = _useState[0],
9321
+ setShowSuccessMessage = _useState[1];
9322
+ var _useState2 = useState(false),
9323
+ loading = _useState2[0],
9324
+ setLoading = _useState2[1];
9325
+ var ticketTypesList = Object.values(tickets).map(function (d) {
9326
+ return {
9327
+ label: d.displayName,
9328
+ value: d.id
9329
+ };
9330
+ });
9331
+ var showTicketsField = Boolean(ticketTypesList.length);
9332
+ var handleSubmit = /*#__PURE__*/function () {
9333
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(values) {
9334
+ var response;
9335
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
9336
+ while (1) switch (_context.prev = _context.next) {
9337
+ case 0:
9338
+ _context.prev = 0;
9339
+ setLoading(true);
9340
+ _context.next = 4;
9341
+ return addToWaitingList(eventId, {
9342
+ attributes: values
9343
+ });
9344
+ case 4:
9345
+ response = _context.sent;
9346
+ if (response.success) {
9347
+ setShowSuccessMessage(true);
9348
+ }
9349
+ _context.next = 10;
9350
+ break;
9351
+ case 8:
9352
+ _context.prev = 8;
9353
+ _context.t0 = _context["catch"](0);
9354
+ case 10:
9355
+ _context.prev = 10;
9356
+ setLoading(false);
9357
+ return _context.finish(10);
9358
+ case 13:
9359
+ case "end":
9360
+ return _context.stop();
9361
+ }
9362
+ }, _callee, null, [[0, 8, 10, 13]]);
9363
+ }));
9364
+ return function handleSubmit(_x) {
9365
+ return _ref2.apply(this, arguments);
9366
+ };
9367
+ }();
9368
+ return React.createElement("div", {
9369
+ className: "waiting-list"
9370
+ }, showSuccessMessage ? React.createElement("div", {
9371
+ className: "success-message"
9372
+ }, React.createElement("p", {
9373
+ className: "added-success-message"
9374
+ }, "You've been added to the waiting list!"), React.createElement("p", null, "You'll be notified if tickets become available.")) : React.createElement(React.Fragment, null, React.createElement("h2", null, "WAITING LIST"), React.createElement(Formik, {
9375
+ initialValues: {
9376
+ ticketTypeId: '',
9377
+ quantity: '',
9378
+ firstName: userData.first_name || '',
9379
+ lastName: userData.last_name || '',
9380
+ email: userData.email || ''
9381
+ },
9382
+ onSubmit: handleSubmit
9383
+ }, function (_ref3) {
9384
+ var values = _ref3.values,
9385
+ setFieldValue = _ref3.setFieldValue;
9386
+ var selectedTicket = _find(tickets, function (n) {
9387
+ return n.id === values.ticketTypeId;
9388
+ });
9389
+ return React.createElement(Form, null, React.createElement(ErrorFocus, null), showTicketsField && React.createElement(React.Fragment, null, React.createElement("div", {
9390
+ className: "field-item"
9391
+ }, React.createElement(Field, {
9392
+ name: "ticketTypeId",
9393
+ label: "Type of Ticket",
9394
+ type: "select",
9395
+ component: CustomField,
9396
+ onChange: function onChange(e) {
9397
+ setFieldValue('ticketTypeId', e.target.value);
9398
+ setFieldValue('quantity', '');
9399
+ },
9400
+ selectOptions: [{
9401
+ label: 'Type of Ticket',
9402
+ value: '',
9403
+ disabled: true
9404
+ }].concat(ticketTypesList)
9405
+ })), React.createElement("div", {
9406
+ className: "field-item"
9407
+ }, React.createElement(Field, {
9408
+ name: "quantity",
9409
+ label: "Quantity Requested",
9410
+ type: "select",
9411
+ component: CustomField,
9412
+ selectOptions: [{
9413
+ label: 'Quantity Requested',
9414
+ value: '',
9415
+ disabled: true
9416
+ }].concat(generateQuantity((selectedTicket == null ? void 0 : selectedTicket.waitingListMaxQuantity) || (defaultMaxQuantity != null ? defaultMaxQuantity : 10)))
9417
+ }))), React.createElement("div", {
9418
+ className: "field-item"
9419
+ }, React.createElement(Field, {
9420
+ name: "firstName",
9421
+ label: "First name",
9422
+ validate: function validate(value) {
9423
+ return requiredValidator(value, 'Please enter your First name');
9424
+ },
9425
+ component: CustomField
9426
+ })), React.createElement("div", {
9427
+ className: "field-item"
9428
+ }, React.createElement(Field, {
9429
+ name: "lastName",
9430
+ label: "Last name",
9431
+ validate: function validate(value) {
9432
+ return requiredValidator(value, 'Please enter your Last name');
9433
+ },
9434
+ component: CustomField
9435
+ })), React.createElement("div", {
9436
+ className: "field-item"
9437
+ }, React.createElement(Field, {
9438
+ name: "email",
9439
+ label: "Email",
9440
+ validate: combineValidators(function (value) {
9441
+ return requiredValidator(value, 'Please enter your Email');
9442
+ }, function (value) {
9443
+ return emailValidator(value);
9444
+ }),
9445
+ component: CustomField
9446
+ })), React.createElement(Button, {
9447
+ type: "submit",
9448
+ variant: "contained",
9449
+ className: "waiting-list-button"
9450
+ }, loading ? React.createElement(CircularProgress$1, {
9451
+ size: "22px"
9452
+ }) : 'ADD TO WAITING LIST'));
9453
+ })));
9454
+ };
9455
+
9456
+ // This section is seperate because additional changes layter may be applied to Access Code
9457
+ var AccessCodeSection = function AccessCodeSection(_ref) {
9458
+ var code = _ref.code,
9459
+ setCode = _ref.setCode,
9460
+ updateTickets = _ref.updateTickets;
9461
+ var isAccessCodeHasValue = !!code.trim();
9462
+ return React.createElement("div", {
9463
+ className: "access-code-block"
9464
+ }, React.createElement("div", {
9465
+ className: "access-code-block"
9466
+ }, React.createElement("p", {
9467
+ className: "access-code-text"
9468
+ }, "Access code required")), React.createElement("input", {
9469
+ className: "access-code-input",
9470
+ placeholder: "",
9471
+ onChange: function onChange(e) {
9472
+ setCode(e.target.value);
9473
+ },
9474
+ onKeyPress: function onKeyPress(event) {
9475
+ if (event.key === 'Enter' && isAccessCodeHasValue) {
9476
+ updateTickets(true);
9477
+ }
9478
+ }
9479
+ }), React.createElement(Button$2, {
9480
+ className: "access-submit-button",
9481
+ onClick: function onClick() {
9482
+ if (isAccessCodeHasValue) {
9483
+ updateTickets(true);
9484
+ }
9485
+ }
9486
+ }, "ENTER"));
9487
+ };
9488
+
9489
+ var DoneSvg = "<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M10 20C15.5228 20 20 15.5228 20 10C20 4.47717 15.5228 0 10 0C4.47717 0 0 4.47717 0 10C0 15.5228 4.47717 20 10 20ZM8.14661 15.8678L16.8782 6.39722C16.9561 6.31335 17 6.19922 17 6.08008C17 5.96094 16.9561 5.8468 16.8782 5.76282L16.3016 5.12854C16.1386 4.95715 15.8796 4.95715 15.7167 5.12854L7.85004 13.661L4.28326 9.79236C4.20593 9.70776 4.10071 9.66016 3.99084 9.66016C3.9353 9.66016 3.88086 9.67236 3.83069 9.69531C3.78168 9.71777 3.73663 9.75061 3.69843 9.79236L3.12183 10.4177C3.07635 10.4667 3.04248 10.5259 3.02216 10.5905C3.00763 10.6365 3 10.6853 3 10.735C3 10.8541 3.04388 10.9683 3.12183 11.0521L7.56177 15.8678C7.6391 15.9524 7.74438 16 7.85419 16C7.96399 16 8.06927 15.9524 8.14661 15.8678Z\" fill=\"#569F44\"/>\n</svg>";
9490
+
9491
+ var XmarkSvg = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<svg\n xmlns:osb=\"http://www.openswatchbook.org/uri/2009/osb\"\n xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n xmlns:cc=\"http://creativecommons.org/ns#\"\n xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n xmlns:svg=\"http://www.w3.org/2000/svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:sodipodi=\"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd\"\n xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\"\n viewBox=\"0 0 48 48\"\n version=\"1.1\"\n id=\"svg15\"\n sodipodi:docname=\"cross red circle.svg\"\n inkscape:version=\"0.92.3 (2405546, 2018-03-11)\">\n <metadata\n id=\"metadata19\">\n <rdf:RDF>\n <cc:Work\n rdf:about=\"\">\n <dc:format>image/svg+xml</dc:format>\n <dc:type\n rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\" />\n <dc:title />\n </cc:Work>\n </rdf:RDF>\n </metadata>\n <sodipodi:namedview\n pagecolor=\"#ffffff\"\n bordercolor=\"#666666\"\n borderopacity=\"1\"\n objecttolerance=\"10\"\n gridtolerance=\"10\"\n guidetolerance=\"10\"\n inkscape:pageopacity=\"0\"\n inkscape:pageshadow=\"2\"\n inkscape:window-width=\"1920\"\n inkscape:window-height=\"1027\"\n id=\"namedview17\"\n showgrid=\"false\"\n inkscape:zoom=\"4.9166667\"\n inkscape:cx=\"-11.694915\"\n inkscape:cy=\"40.271186\"\n inkscape:window-x=\"-8\"\n inkscape:window-y=\"-8\"\n inkscape:window-maximized=\"1\"\n inkscape:current-layer=\"g13\" />\n <defs\n id=\"defs7\">\n <linearGradient\n id=\"linearGradient828\"\n osb:paint=\"solid\">\n <stop\n style=\"stop-color:#ff0000;stop-opacity:1;\"\n offset=\"0\"\n id=\"stop826\" />\n </linearGradient>\n <linearGradient\n id=\"0\"\n gradientUnits=\"userSpaceOnUse\"\n y1=\"47.37\"\n x2=\"0\"\n y2=\"-1.429\">\n <stop\n stop-color=\"#c52828\"\n id=\"stop2\" />\n <stop\n offset=\"1\"\n stop-color=\"#ff5454\"\n id=\"stop4\" />\n </linearGradient>\n </defs>\n <g\n transform=\"matrix(.99999 0 0 .99999-58.37.882)\"\n enable-background=\"new\"\n id=\"g13\"\n style=\"fill-opacity:1\">\n <circle\n cx=\"82.37\"\n cy=\"23.12\"\n r=\"24\"\n fill=\"url(#0)\"\n id=\"circle9\"\n style=\"fill-opacity:1;fill:#dd3333\" />\n <path\n d=\"m87.77 23.725l5.939-5.939c.377-.372.566-.835.566-1.373 0-.54-.189-.997-.566-1.374l-2.747-2.747c-.377-.372-.835-.564-1.373-.564-.539 0-.997.186-1.374.564l-5.939 5.939-5.939-5.939c-.377-.372-.835-.564-1.374-.564-.539 0-.997.186-1.374.564l-2.748 2.747c-.377.378-.566.835-.566 1.374 0 .54.188.997.566 1.373l5.939 5.939-5.939 5.94c-.377.372-.566.835-.566 1.373 0 .54.188.997.566 1.373l2.748 2.747c.377.378.835.564 1.374.564.539 0 .997-.186 1.374-.564l5.939-5.939 5.94 5.939c.377.378.835.564 1.374.564.539 0 .997-.186 1.373-.564l2.747-2.747c.377-.372.566-.835.566-1.373 0-.54-.188-.997-.566-1.373l-5.939-5.94\"\n fill=\"#fff\"\n fill-opacity=\".842\"\n id=\"path11\"\n style=\"fill-opacity:1;fill:#ffffff\" />\n </g>\n</svg>";
9492
+
9493
+ var PromoCodeSection = function PromoCodeSection(_ref) {
9494
+ var _window, _window$localStorage;
9495
+ var code = _ref.code,
9496
+ codeIsApplied = _ref.codeIsApplied,
9497
+ showPromoInput = _ref.showPromoInput,
9498
+ setCode = _ref.setCode,
9499
+ setShowPromoInput = _ref.setShowPromoInput,
9500
+ updateTickets = _ref.updateTickets,
9501
+ setCodeIsApplied = _ref.setCodeIsApplied,
9502
+ codeIsInvalid = _ref.codeIsInvalid,
9503
+ setCodeIsInvalid = _ref.setCodeIsInvalid,
9504
+ promoText = _ref.promoText,
9505
+ showAlertIcons = _ref.showAlertIcons;
9506
+ var isPromoCodeHasValue = !!code.trim();
9507
+ var appliedPromoCode = (_window = window) == null ? void 0 : (_window$localStorage = _window.localStorage) == null ? void 0 : _window$localStorage.getItem('appliedPromoCode');
9508
+ var renderInputField = function renderInputField() {
9509
+ return React.createElement("div", {
9510
+ className: "promo-code-block"
9511
+ }, React.createElement("div", {
8940
9512
  className: "promo-code-block"
8941
9513
  }, React.createElement("p", {
8942
9514
  className: "promo-code-text"
@@ -9873,11 +10445,45 @@ var TicketsContainer = function TicketsContainer(_ref) {
9873
10445
  }
9874
10446
  localStorage.setItem('selectedTicketsQuantity', value.toString());
9875
10447
  setSelectedTickets(function (prevState) {
9876
- var _ref3;
10448
+ var _ref4;
10449
+ // Allow multiple ticket types to be selected simultaneously when flag is enabled
10450
+ if ((event == null ? void 0 : event.allowMultipleTicketTypePurchases) === true) {
10451
+ var _extends2;
10452
+ // Check if we're switching between tables and regular tickets
10453
+ var hasExistingSelection = Object.keys(prevState).some(function (k) {
10454
+ return k !== 'isTable';
10455
+ });
10456
+ var switchingTicketType = hasExistingSelection && prevState.isTable !== isTable;
10457
+ // If switching from tables to regular tickets or vice versa, clear all selections
10458
+ if (switchingTicketType && Number(value) > 0) {
10459
+ var _ref3;
10460
+ return _ref3 = {}, _ref3[key] = value, _ref3.isTable = isTable, _ref3;
10461
+ }
10462
+ // If value is 0, remove this ticket from selection
10463
+ if (!value || Number(value) === 0) {
10464
+ var newState = _extends({}, prevState);
10465
+ delete newState[key];
10466
+ // If no ticket keys remain (only isTable left), return empty state
10467
+ var ticketKeys = Object.keys(newState).filter(function (k) {
10468
+ return k !== 'isTable';
10469
+ });
10470
+ if (ticketKeys.length === 0) {
10471
+ return {
10472
+ isTable: false
10473
+ };
10474
+ }
10475
+ return _extends({}, newState, {
10476
+ isTable: prevState.isTable
10477
+ });
10478
+ }
10479
+ // If value > 0, add or update this ticket while keeping others of the same type selected
10480
+ return _extends({}, prevState, (_extends2 = {}, _extends2[key] = value, _extends2.isTable = isTable, _extends2));
10481
+ }
10482
+ // Default behavior: only one ticket type at a time
9877
10483
  if (Object.keys(prevState)[0] !== key && !value) {
9878
10484
  return prevState;
9879
10485
  }
9880
- return _ref3 = {}, _ref3[key] = value, _ref3.isTable = isTable, _ref3;
10486
+ return _ref4 = {}, _ref4[key] = value, _ref4.isTable = isTable, _ref4;
9881
10487
  });
9882
10488
  };
9883
10489
  var handleOrdersClick = function handleOrdersClick() {
@@ -9889,9 +10495,9 @@ var TicketsContainer = function TicketsContainer(_ref) {
9889
10495
  setError(null);
9890
10496
  };
9891
10497
  var handleBook = /*#__PURE__*/function () {
9892
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
9893
- var _product_options, _product_options2, _ticket_types;
9894
- var timeSlotTickets, ticket, optionName, ticketId, productCartQuantity, ticketQuantity, data, result, pageConfigsDataResponse, _pageConfigsData$skip, _pageConfigsData$has_, _pageConfigsData$free, pageConfigsData, skipBillingPage, hasAddOn, freeTicket, hash, total, _checkoutResponse$dat, _checkoutResponse$dat2, _checkoutResponse$dat3, _checkoutResponse$dat4, userData, checkoutBody, checkoutResponse, _errorResponse$data, _errorResponse$data$d, errorResponse, _errorResponse$data2, message, _isInvalidLinkError, _isNotInvitedError;
10498
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
10499
+ var _product_options2;
10500
+ var timeSlotTickets, ticketsList, selectedTicketIds, ticketTypesData, totalProductCartQuantity, firstTicket, firstOptionName, firstTicketId, data, result, pageConfigsDataResponse, _pageConfigsData$skip, _pageConfigsData$has_, _pageConfigsData$free, pageConfigsData, skipBillingPage, hasAddOn, freeTicket, hash, total, _checkoutResponse$dat, _checkoutResponse$dat2, _checkoutResponse$dat3, _checkoutResponse$dat4, userData, checkoutBody, checkoutResponse, _errorResponse$data, _errorResponse$data$d, errorResponse, _errorResponse$data2, message, _isInvalidLinkError, _isNotInvitedError;
9895
10501
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
9896
10502
  while (1) switch (_context2.prev = _context2.next) {
9897
10503
  case 0:
@@ -9899,54 +10505,75 @@ var TicketsContainer = function TicketsContainer(_ref) {
9899
10505
  return slots;
9900
10506
  }));
9901
10507
  setHandleBookIsLoading(true);
9902
- ticket = event != null && event.isTimeSlotEvent ? _find(timeSlotTickets || [], function (item) {
9903
- return Number(selectedTickets[item.id]) > 0;
9904
- }) || {} : _find(tickets, function (item) {
9905
- return Number(selectedTickets[item.id]) > 0;
9906
- }) || {};
9907
- optionName = _get(ticket, 'optionName');
9908
- ticketId = _get(ticket, 'id');
9909
- productCartQuantity = +selectedTickets[ticket.id];
9910
- ticketQuantity = +selectedTickets[ticket.id];
10508
+ // Unified flow: works for both single and multiple ticket types
10509
+ ticketsList = event != null && event.isTimeSlotEvent ? timeSlotTickets : tickets; // Get all selected ticket IDs with quantity > 0 (excluding 'isTable' key)
10510
+ selectedTicketIds = Object.keys(selectedTickets).filter(function (key) {
10511
+ return key !== 'isTable' && Number(selectedTickets[key]) > 0;
10512
+ }); // Build ticket_types object with all selected tickets (works for 1 or N tickets)
10513
+ ticketTypesData = {};
10514
+ totalProductCartQuantity = 0;
10515
+ firstTicket = null;
10516
+ selectedTicketIds.forEach(function (ticketId) {
10517
+ var ticket = _find(ticketsList || [], function (item) {
10518
+ return String(item.id) === ticketId;
10519
+ });
10520
+ if (ticket) {
10521
+ var _product_options;
10522
+ if (!firstTicket) firstTicket = ticket;
10523
+ var optionName = _get(ticket, 'optionName');
10524
+ var quantity = +selectedTickets[ticketId];
10525
+ totalProductCartQuantity += quantity;
10526
+ ticketTypesData[ticketId] = {
10527
+ product_options: (_product_options = {}, _product_options[optionName] = ticketId, _product_options.ticket_price = ticket.price, _product_options),
10528
+ quantity: quantity
10529
+ };
10530
+ }
10531
+ });
10532
+ if (firstTicket) {
10533
+ _context2.next = 11;
10534
+ break;
10535
+ }
10536
+ setHandleBookIsLoading(false);
10537
+ return _context2.abrupt("return");
10538
+ case 11:
10539
+ firstOptionName = _get(firstTicket, 'optionName');
10540
+ firstTicketId = _get(firstTicket, 'id');
9911
10541
  data = {
9912
10542
  attributes: {
9913
10543
  alternative_view_id: null,
9914
- product_cart_quantity: productCartQuantity,
9915
- product_options: (_product_options = {}, _product_options[optionName] = ticketId, _product_options),
10544
+ product_cart_quantity: totalProductCartQuantity,
10545
+ product_options: (_product_options2 = {}, _product_options2[firstOptionName] = firstTicketId, _product_options2),
9916
10546
  product_id: eventId,
9917
- ticket_types: (_ticket_types = {}, _ticket_types[ticketId] = {
9918
- product_options: (_product_options2 = {}, _product_options2[optionName] = ticketId, _product_options2.ticket_price = ticket.price, _product_options2),
9919
- quantity: ticketQuantity
9920
- }, _ticket_types)
10547
+ ticket_types: ticketTypesData
9921
10548
  }
9922
10549
  };
9923
- _context2.prev = 8;
10550
+ _context2.prev = 14;
9924
10551
  onGetTicketsPress();
9925
- _context2.next = 12;
10552
+ _context2.next = 18;
9926
10553
  return addToCart(eventId, data);
9927
- case 12:
10554
+ case 18:
9928
10555
  result = _context2.sent;
9929
10556
  if (!enableAddOns) {
9930
- _context2.next = 19;
10557
+ _context2.next = 25;
9931
10558
  break;
9932
10559
  }
9933
- _context2.next = 16;
10560
+ _context2.next = 22;
9934
10561
  return getCheckoutPageConfigs();
9935
- case 16:
10562
+ case 22:
9936
10563
  _context2.t0 = _context2.sent;
9937
- _context2.next = 20;
10564
+ _context2.next = 26;
9938
10565
  break;
9939
- case 19:
10566
+ case 25:
9940
10567
  _context2.t0 = {
9941
10568
  status: 200,
9942
10569
  data: {
9943
10570
  attributes: _get(result, 'data.attributes')
9944
10571
  }
9945
10572
  };
9946
- case 20:
10573
+ case 26:
9947
10574
  pageConfigsDataResponse = _context2.t0;
9948
10575
  if (!(pageConfigsDataResponse.status === 200)) {
9949
- _context2.next = 44;
10576
+ _context2.next = 50;
9950
10577
  break;
9951
10578
  }
9952
10579
  pageConfigsData = _get(pageConfigsDataResponse, 'data.attributes') || {};
@@ -9958,29 +10585,29 @@ var TicketsContainer = function TicketsContainer(_ref) {
9958
10585
  isBrowser && window.localStorage.removeItem('add_ons');
9959
10586
  isBrowser && window.localStorage.removeItem('checkoutAdditionalConfigs');
9960
10587
  if (!(skipBillingPage && !hasAddOn)) {
9961
- _context2.next = 43;
10588
+ _context2.next = 49;
9962
10589
  break;
9963
10590
  }
9964
10591
  // Get user data for checkout data
9965
10592
  userData = isBrowser && window.localStorage.getItem('user_data') ? JSON.parse(window.localStorage.getItem('user_data') || '{}') : {};
9966
- checkoutBody = createCheckoutDataBodyWithDefaultHolder(ticketQuantity, userData);
10593
+ checkoutBody = createCheckoutDataBodyWithDefaultHolder(totalProductCartQuantity, userData);
9967
10594
  if (!enableBillingInfoAutoCreate) {
9968
- _context2.next = 39;
10595
+ _context2.next = 45;
9969
10596
  break;
9970
10597
  }
9971
- _context2.next = 36;
10598
+ _context2.next = 42;
9972
10599
  return postOnCheckout(checkoutBody, freeTicket);
9973
- case 36:
10600
+ case 42:
9974
10601
  _context2.t1 = _context2.sent;
9975
- _context2.next = 40;
10602
+ _context2.next = 46;
9976
10603
  break;
9977
- case 39:
10604
+ case 45:
9978
10605
  _context2.t1 = null;
9979
- case 40:
10606
+ case 46:
9980
10607
  checkoutResponse = _context2.t1;
9981
10608
  hash = (checkoutResponse == null ? void 0 : (_checkoutResponse$dat = checkoutResponse.data) == null ? void 0 : (_checkoutResponse$dat2 = _checkoutResponse$dat.attributes) == null ? void 0 : _checkoutResponse$dat2.hash) || '';
9982
10609
  total = (checkoutResponse == null ? void 0 : (_checkoutResponse$dat3 = checkoutResponse.data) == null ? void 0 : (_checkoutResponse$dat4 = _checkoutResponse$dat3.attributes) == null ? void 0 : _checkoutResponse$dat4.total) || '';
9983
- case 43:
10610
+ case 49:
9984
10611
  onAddToCartSuccess({
9985
10612
  skip_billing_page: skipBillingPage,
9986
10613
  event_id: String(eventId),
@@ -9991,12 +10618,12 @@ var TicketsContainer = function TicketsContainer(_ref) {
9991
10618
  cart: pageConfigsDataResponse.data.attributes.cart,
9992
10619
  currencySymbol: event == null ? void 0 : event.currency.symbol
9993
10620
  });
9994
- case 44:
9995
- _context2.next = 50;
10621
+ case 50:
10622
+ _context2.next = 56;
9996
10623
  break;
9997
- case 46:
9998
- _context2.prev = 46;
9999
- _context2.t2 = _context2["catch"](8);
10624
+ case 52:
10625
+ _context2.prev = 52;
10626
+ _context2.t2 = _context2["catch"](14);
10000
10627
  errorResponse = _get(_context2.t2, 'response', {});
10001
10628
  if (errorResponse != null && (_errorResponse$data = errorResponse.data) != null && (_errorResponse$data$d = _errorResponse$data.data) != null && _errorResponse$data$d.hasUnverifiedOrder) {
10002
10629
  setPendingVerificationMessage(errorResponse == null ? void 0 : (_errorResponse$data2 = errorResponse.data) == null ? void 0 : _errorResponse$data2.message);
@@ -10013,25 +10640,25 @@ var TicketsContainer = function TicketsContainer(_ref) {
10013
10640
  setError(message);
10014
10641
  }
10015
10642
  }
10016
- case 50:
10017
- _context2.prev = 50;
10643
+ case 56:
10644
+ _context2.prev = 56;
10018
10645
  setHandleBookIsLoading(false);
10019
- return _context2.finish(50);
10020
- case 53:
10646
+ return _context2.finish(56);
10647
+ case 59:
10021
10648
  case "end":
10022
10649
  return _context2.stop();
10023
10650
  }
10024
- }, _callee2, null, [[8, 46, 50, 53]]);
10651
+ }, _callee2, null, [[14, 52, 56, 59]]);
10025
10652
  }));
10026
10653
  return function handleBook() {
10027
- return _ref4.apply(this, arguments);
10654
+ return _ref5.apply(this, arguments);
10028
10655
  };
10029
10656
  }();
10030
10657
  var updateTickets = function updateTickets(isUpdatingCode, type) {
10031
10658
  getTicketsApi(isUpdatingCode, type);
10032
10659
  };
10033
10660
  var fetchUserData = /*#__PURE__*/function () {
10034
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
10661
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
10035
10662
  var userDataResponse, profileData, profileDataObj;
10036
10663
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
10037
10664
  while (1) switch (_context3.prev = _context3.next) {
@@ -10050,7 +10677,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
10050
10677
  }, _callee3);
10051
10678
  }));
10052
10679
  return function fetchUserData() {
10053
- return _ref5.apply(this, arguments);
10680
+ return _ref6.apply(this, arguments);
10054
10681
  };
10055
10682
  }();
10056
10683
  var isTicketOnSale = event != null && event.isTimeSlotEvent ? true : _some(tickets, function (item) {
@@ -11885,7 +12512,9 @@ var LoginForm = function LoginForm(_ref) {
11885
12512
  _ref$showSignUpButton = _ref.showSignUpButton,
11886
12513
  showSignUpButton = _ref$showSignUpButton === void 0 ? false : _ref$showSignUpButton,
11887
12514
  _ref$showPoweredByIma = _ref.showPoweredByImage,
11888
- showPoweredByImage = _ref$showPoweredByIma === void 0 ? false : _ref$showPoweredByIma;
12515
+ showPoweredByImage = _ref$showPoweredByIma === void 0 ? false : _ref$showPoweredByIma,
12516
+ _ref$registerUrl = _ref.registerUrl,
12517
+ registerUrl = _ref$registerUrl === void 0 ? 'https://www.ticketfairy.com/register' : _ref$registerUrl;
11889
12518
  var _useState = useState(''),
11890
12519
  error = _useState[0],
11891
12520
  setError = _useState[1];
@@ -12006,9 +12635,16 @@ var LoginForm = function LoginForm(_ref) {
12006
12635
  onClick: onForgotPasswordButtonClick
12007
12636
  }, "Forgot password?")), showSignUpButton && React.createElement("div", {
12008
12637
  className: "forgot-password"
12009
- }, React.createElement("span", {
12638
+ }, onSignupButtonClick !== _identity ? React.createElement("span", {
12010
12639
  "aria-hidden": "true",
12011
- onClick: onSignupButtonClick
12640
+ onClick: onSignupButtonClick,
12641
+ style: {
12642
+ cursor: 'pointer'
12643
+ }
12644
+ }, "Sign up") : React.createElement("a", {
12645
+ href: registerUrl,
12646
+ target: "_blank",
12647
+ rel: "noopener noreferrer"
12012
12648
  }, "Sign up")), showPoweredByImage ? React.createElement(PoweredBy, null) : null));
12013
12649
  }));
12014
12650
  };
@@ -13636,1059 +14272,725 @@ var SeatMapContainer = function SeatMapContainer(props) {
13636
14272
  reservationData = JSON.parse(localStorage.getItem('reservationData') || '[]');
13637
14273
  if (!(status === 'B' || status === 'R' || status === 'BLOCKED' || status === 'RE')) {
13638
14274
  _context5.next = 4;
13639
- break;
13640
- }
13641
- return _context5.abrupt("return");
13642
- case 4:
13643
- if (_find(reservationData, function (data) {
13644
- return data.seatId === seatId;
13645
- })) {
13646
- handleCancelSeatReservtion(eventId, tierId, seatId);
13647
- } else if (reservationData.length >= 10) {
13648
- setError('Limit exceeded');
13649
- } else {
13650
- handleSeatReservation(eventId, tierId, seatId);
13651
- }
13652
- case 5:
13653
- case "end":
13654
- return _context5.stop();
13655
- }
13656
- }, _callee5);
13657
- }));
13658
- return function onSeatClick(_x7) {
13659
- return _ref5.apply(this, arguments);
13660
- };
13661
- }();
13662
- var handleTicketSelect = function handleTicketSelect(ticketId, seatId) {
13663
- var currentSelectedTickets = _extends({}, selectedTickets);
13664
- currentSelectedTickets[seatId] = ticketId;
13665
- setSelectedTickets(currentSelectedTickets);
13666
- };
13667
- var handleGetTicketBtnClick = /*#__PURE__*/function () {
13668
- var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
13669
- var ticketsDropdownsData, selectedSeats, addToCartData, _addToCartData$attrib, response, message;
13670
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
13671
- while (1) switch (_context6.prev = _context6.next) {
13672
- case 0:
13673
- setIsAddingToCart(true);
13674
- ticketsDropdownsData = getTicketDropdownData(reservedSeats, ticketTypeTierRelationsRef.current);
13675
- selectedSeats = {};
13676
- _forEach(ticketsDropdownsData, function (ticketData) {
13677
- var _extends4;
13678
- selectedSeats = _extends({}, selectedSeats, (_extends4 = {}, _extends4[ticketData.seatId] = ticketData.ticketsData, _extends4));
13679
- });
13680
- addToCartData = getAddToCartRequestData({
13681
- eventId: eventId,
13682
- reservations: _map(reservedSeats, function (seat) {
13683
- return seat.seatId;
13684
- }),
13685
- selectedSeats: selectedSeats,
13686
- selectedTickets: selectedTickets,
13687
- guestCounts: guestCounts
13688
- });
13689
- _context6.prev = 5;
13690
- _context6.next = 8;
13691
- return addToCartFunc({
13692
- eventId: eventId,
13693
- data: addToCartData,
13694
- ticketQuantity: addToCartData == null ? void 0 : (_addToCartData$attrib = addToCartData.attributes) == null ? void 0 : _addToCartData$attrib.product_cart_quantity
13695
- });
13696
- case 8:
13697
- response = _context6.sent;
13698
- localStorage.removeItem('reservationData');
13699
- onAddToCartSuccess(response);
13700
- _context6.next = 16;
13701
- break;
13702
- case 13:
13703
- _context6.prev = 13;
13704
- _context6.t0 = _context6["catch"](5);
13705
- if (axios.isAxiosError(_context6.t0)) {
13706
- message = _get(_context6.t0, 'response.data.message', '');
13707
- setError(message);
13708
- }
13709
- case 16:
13710
- _context6.prev = 16;
13711
- setIsAddingToCart(false);
13712
- return _context6.finish(16);
13713
- case 19:
13714
- case "end":
13715
- return _context6.stop();
13716
- }
13717
- }, _callee6, null, [[5, 13, 16, 19]]);
13718
- }));
13719
- return function handleGetTicketBtnClick() {
13720
- return _ref6.apply(this, arguments);
13721
- };
13722
- }();
13723
- useEffect(function () {
13724
- if (Date.now() > Number(localStorage.getItem("reservationStart-" + eventId))) {
13725
- setSelectedTickets({});
13726
- setReservedSeats([]);
13727
- }
13728
- var makeRequests = /*#__PURE__*/function () {
13729
- var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
13730
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
13731
- while (1) switch (_context7.prev = _context7.next) {
13732
- case 0:
13733
- _context7.prev = 0;
13734
- setIsLoadingStatuses(true);
13735
- _context7.next = 4;
13736
- return fetchSeatMapData();
13737
- case 4:
13738
- _context7.next = 6;
13739
- return fetchSeatMapReservations();
13740
- case 6:
13741
- _context7.next = 11;
13742
- break;
13743
- case 8:
13744
- _context7.prev = 8;
13745
- _context7.t0 = _context7["catch"](0);
13746
- setError('Something went wrong');
13747
- case 11:
13748
- _context7.prev = 11;
13749
- setIsLoadingStatuses(false);
13750
- return _context7.finish(11);
13751
- case 14:
13752
- case "end":
13753
- return _context7.stop();
13754
- }
13755
- }, _callee7, null, [[0, 8, 11, 14]]);
13756
- }));
13757
- return function makeRequests() {
13758
- return _ref7.apply(this, arguments);
13759
- };
13760
- }();
13761
- makeRequests();
13762
- if (country) {
13763
- localStorage.setItem('eventCountry', country);
13764
- }
13765
- }, [country, eventId, fetchSeatMapData]);
13766
- useEffect(function () {
13767
- var intervalId = setInterval(function () {
13768
- fetchSeatMapReservations();
13769
- }, 3000);
13770
- return function () {
13771
- clearInterval(intervalId);
13772
- };
13773
- }, [fetchSeatMapReservations]);
13774
- useEffect(function () {
13775
- if (!isOnline) {
13776
- setError(OFFLINE_MESSAGE);
13777
- } else if (isOnline && error === OFFLINE_MESSAGE) {
13778
- setError(null);
13779
- }
13780
- }, [error, isOnline]);
13781
- return React.createElement(React.Fragment, null, error && React.createElement(Alert, {
13782
- severity: "error",
13783
- onClose: function onClose() {
13784
- setError(null);
13785
- },
13786
- variant: "filled",
13787
- style: {
13788
- width: '350px'
13789
- }
13790
- }, error), showTimer && React.createElement(Countdown$1, {
13791
- date: moment$1(Number(localStorage.getItem("reservationStart-" + eventId))).valueOf(),
13792
- renderer: function renderer(props) {
13793
- return React.createElement("div", {
13794
- className: "reservation-countdown"
13795
- }, React.createElement("span", {
13796
- className: "reservation-message"
13797
- }, timerMessage), React.createElement("span", {
13798
- className: "reservation-timer"
13799
- }, showZero(props.minutes), ":", showZero(props.seconds)));
13800
- },
13801
- onComplete: function onComplete() {
13802
- endTimer();
13803
- setSelectedTickets({});
13804
- setReservedSeats([]);
13805
- if (onCountdownFinish) {
13806
- onCountdownFinish();
13807
- }
13808
- }
13809
- }), !isLoadingSeatMapData && !isLoadingStatuses && React.createElement(ReferralLogic, {
13810
- eventId: eventId
13811
- }), React.createElement(TicketsSection$1, {
13812
- selectedTickets: selectedTickets,
13813
- handleTicketSelect: handleTicketSelect,
13814
- handleCancelReservation: function handleCancelReservation(seatId, tireId) {
13815
- return handleCancelSeatReservtion(eventId, tireId, seatId);
13816
- },
13817
- handleGetTicketClick: handleGetTicketBtnClick,
13818
- isAddingToCart: isAddingToCart,
13819
- reservedSeats: reservedSeats,
13820
- ticketDeleteButtonContent: ticketDeleteButtonContent,
13821
- ticketInfoContent: ticketInfoContent,
13822
- ticketTypeTierRelations: ticketTypeTierRelationsRef.current,
13823
- currencySymbol: symbol,
13824
- tableMapEnabled: Boolean(tableMapEnabled),
13825
- guestCounts: guestCounts,
13826
- setGuestCounts: setGuestCounts
13827
- }), React.createElement(SeatMapComponent, {
13828
- seatMapProps: {
13829
- seatData: seatMapData.seatMap,
13830
- statuses: seatMapStatuses,
13831
- tierPrices: seatMapData.tierPrices,
13832
- seatMapType: seatMapData.seatMapType,
13833
- ticketTypeTierRelations: ticketTypeTierRelationsRef.current,
13834
- seatMapEvents: {
13835
- onSeatClick: onSeatClick
13836
- },
13837
- isReserving: isReserving,
13838
- predefinedSeats: seatMapData.predefinedSeats,
13839
- isLoadingSeatMapData: isLoadingSeatMapData
13840
- },
13841
- mapContainerId: mapContainerId
13842
- }));
13843
- };
13844
-
13845
- var IDVerification = function IDVerification(props) {
13846
- var _props$onGetVerifyUrl = props.onGetVerifyUrlSuccess,
13847
- onGetVerifyUrlSuccess = _props$onGetVerifyUrl === void 0 ? _identity : _props$onGetVerifyUrl,
13848
- _props$onGetVerifyUrl2 = props.onGetVerifyUrlError,
13849
- onGetVerifyUrlError = _props$onGetVerifyUrl2 === void 0 ? _identity : _props$onGetVerifyUrl2,
13850
- _props$onGetVerificat = props.onGetVerificationStatusSuccess,
13851
- onGetVerificationStatusSuccess = _props$onGetVerificat === void 0 ? _identity : _props$onGetVerificat,
13852
- _props$onGetVerificat2 = props.onGetVerificationStatusError,
13853
- onGetVerificationStatusError = _props$onGetVerificat2 === void 0 ? _identity : _props$onGetVerificat2,
13854
- _props$onVerification = props.onVerificationMessageModalClose,
13855
- onVerificationMessageModalClose = _props$onVerification === void 0 ? _identity : _props$onVerification,
13856
- _props$onPassVerifica = props.onPassVerificationStepsSuccess,
13857
- onPassVerificationStepsSuccess = _props$onPassVerifica === void 0 ? _identity : _props$onPassVerifica,
13858
- _props$onPassVerifica2 = props.onPassVerificationStepsError,
13859
- onPassVerificationStepsError = _props$onPassVerifica2 === void 0 ? _identity : _props$onPassVerifica2;
13860
- var _useState = useState(true),
13861
- loadingStatus = _useState[0],
13862
- setLoadingStatus = _useState[1];
13863
- var _useState2 = useState(null),
13864
- verificationStatus = _useState2[0],
13865
- setVerificationStatus = _useState2[1];
13866
- var _useState3 = useState(false),
13867
- showModal = _useState3[0],
13868
- setShowModal = _useState3[1];
13869
- var _useState4 = useState(null),
13870
- netverifyUrl = _useState4[0],
13871
- setNetverifyUrl = _useState4[1];
13872
- var _useState5 = useState(null),
13873
- provider = _useState5[0],
13874
- setProvider = _useState5[1];
13875
- var _useState6 = useState(false),
13876
- hasError = _useState6[0],
13877
- setHasError = _useState6[1];
13878
- var _useState7 = useState(null),
13879
- lastError = _useState7[0],
13880
- setLastError = _useState7[1];
13881
- var _useState8 = useState({
13882
- message: '',
13883
- hideCancelBtn: true,
13884
- displaModal: false
13885
- }),
13886
- modalData = _useState8[0],
13887
- setModalData = _useState8[1];
13888
- var isAccountVerifiedOrPending = (verificationStatus === VERIFICATION_STATUSES.APPROVED || verificationStatus === VERIFICATION_STATUSES.PENDING) && verificationStatus !== VERIFICATION_STATUSES.WRONG_CUSTOMER;
13889
- var handleClose = function handleClose() {
13890
- setModalData({
13891
- message: '',
13892
- displaModal: false,
13893
- hideCancelBtn: true
13894
- });
13895
- onVerificationMessageModalClose(verificationStatus);
13896
- };
13897
- useEffect(function () {
13898
- var callbackNetVerify = /*#__PURE__*/function () {
13899
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(e) {
13900
- var data, result;
13901
- return _regeneratorRuntime().wrap(function _callee$(_context) {
13902
- while (1) switch (_context.prev = _context.next) {
13903
- case 0:
13904
- if (!(e.data && e.origin === 'https://verify.stripe.com')) {
13905
- _context.next = 10;
13906
- break;
13907
- }
13908
- data = e.data;
13909
- if (!(data.type === 'STRIPE_IDENTITY_CLOSE')) {
13910
- _context.next = 9;
13911
- break;
13912
- }
13913
- _context.next = 5;
13914
- return getUrl();
13915
- case 5:
13916
- setShowModal(false);
13917
- if (hasError) {
13918
- setHasError(false);
13919
- onPassVerificationStepsError(lastError);
13920
- } else {
13921
- setHasError(false);
13922
- onPassVerificationStepsSuccess();
13923
- }
13924
- _context.next = 10;
13925
- break;
13926
- case 9:
13927
- if (data.type === 'STRIPE_IDENTITY_ERROR') {
13928
- setHasError(true);
13929
- setLastError(data);
13930
- }
13931
- case 10:
13932
- if (!(e.data && isJson(e.data))) {
13933
- _context.next = 25;
13934
- break;
13935
- }
13936
- _context.prev = 11;
13937
- result = JSON.parse(e.data);
13938
- if (!(result.payload && (result.payload.value === 'success' || result.payload.transactionStatus === 'SUCCESS'))) {
13939
- _context.next = 19;
13940
- break;
13941
- }
13942
- _context.next = 16;
13943
- return updateVerificationStatus();
13944
- case 16:
13945
- onPassVerificationStepsSuccess();
13946
- _context.next = 20;
13947
- break;
13948
- case 19:
13949
- if (result.payload && (result.payload.value === 'error' || result.payload.transactionStatus === 'ERROR')) {
13950
- setShowModal(false);
13951
- onPassVerificationStepsError(result.payload);
13952
- }
13953
- case 20:
13954
- _context.next = 25;
13955
- break;
13956
- case 22:
13957
- _context.prev = 22;
13958
- _context.t0 = _context["catch"](11);
13959
- onPassVerificationStepsError(_context.t0);
13960
- case 25:
13961
- case "end":
13962
- return _context.stop();
13963
- }
13964
- }, _callee, null, [[11, 22]]);
13965
- }));
13966
- return function callbackNetVerify(_x) {
13967
- return _ref.apply(this, arguments);
13968
- };
13969
- }();
13970
- window.addEventListener('message', callbackNetVerify);
13971
- return function () {
13972
- window.removeEventListener('message', callbackNetVerify);
13973
- };
13974
- }, []);
13975
- var getUrl = /*#__PURE__*/function () {
13976
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
13977
- var urlResponse;
13978
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
13979
- while (1) switch (_context2.prev = _context2.next) {
13980
- case 0:
13981
- _context2.prev = 0;
13982
- _context2.next = 3;
13983
- return getNetverifyUrl();
13984
- case 3:
13985
- urlResponse = _context2.sent;
13986
- setNetverifyUrl(urlResponse.netverifyUrl);
13987
- setProvider(urlResponse.provider);
13988
- onGetVerifyUrlSuccess(urlResponse);
13989
- _context2.next = 12;
13990
- break;
13991
- case 9:
13992
- _context2.prev = 9;
13993
- _context2.t0 = _context2["catch"](0);
13994
- onGetVerifyUrlError(_context2.t0);
13995
- case 12:
13996
- case "end":
13997
- return _context2.stop();
13998
- }
13999
- }, _callee2, null, [[0, 9]]);
14000
- }));
14001
- return function getUrl() {
14002
- return _ref2.apply(this, arguments);
14003
- };
14004
- }();
14005
- useEffect(function () {
14006
- var intervalId = null;
14007
- var orderHash = getQueryVariable('order_hash') || '';
14008
- var getVerificationStatus = /*#__PURE__*/function () {
14009
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
14010
- var _verificationStatus, _provider, verifyUrl, statusResponse, status, isApproved;
14011
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
14012
- while (1) switch (_context3.prev = _context3.next) {
14013
- case 0:
14014
- _context3.prev = 0;
14015
- _verificationStatus = null; // Gets te current status of the variable without modifying it
14016
- setVerificationStatus(function (status) {
14017
- _verificationStatus = status;
14018
- return status;
14019
- });
14020
- _provider = null; // Gets te current status of the variable without modifying it
14021
- setProvider(function (state) {
14022
- _provider = state;
14023
- return _provider;
14024
- });
14025
- verifyUrl = null; // Gets te current status of the variable without modifying it
14026
- setNetverifyUrl(function (state) {
14027
- verifyUrl = state;
14028
- return state;
14029
- });
14030
- _context3.next = 9;
14031
- return checkVerificationStatus();
14032
- case 9:
14033
- statusResponse = _context3.sent;
14034
- status = statusResponse.data.attributes.status;
14035
- isApproved = status === VERIFICATION_STATUSES.APPROVED;
14036
- if (_verificationStatus !== status) {
14037
- setVerificationStatus(status);
14038
- setModalData({
14039
- displaModal: isApproved || status === VERIFICATION_STATUSES.FAILED,
14040
- hideCancelBtn: true,
14041
- message: isApproved ? VERIFICATION_MESSAGES.APPROVED : status === VERIFICATION_STATUSES.FAILED ? VERIFICATION_MESSAGES.FAILED : status
14042
- });
14043
- }
14044
- if (_provider === VERIFICATION_PROVIDERS.STRIPE && verifyUrl === null && !isApproved) {
14045
- getUrl();
14046
- }
14047
- onGetVerificationStatusSuccess(statusResponse);
14048
- _context3.next = 20;
14049
- break;
14050
- case 17:
14051
- _context3.prev = 17;
14052
- _context3.t0 = _context3["catch"](0);
14053
- onGetVerificationStatusError(_context3.t0);
14054
- case 20:
14055
- _context3.prev = 20;
14056
- setLoadingStatus(false);
14057
- return _context3.finish(20);
14058
- case 23:
14059
- case "end":
14060
- return _context3.stop();
14061
- }
14062
- }, _callee3, null, [[0, 17, 20, 23]]);
14063
- }));
14064
- return function getVerificationStatus() {
14065
- return _ref3.apply(this, arguments);
14066
- };
14067
- }();
14068
- var getCustomerOrderStatus = /*#__PURE__*/function () {
14069
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
14070
- var customerOrderResponse;
14071
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
14072
- while (1) switch (_context4.prev = _context4.next) {
14073
- case 0:
14074
- _context4.next = 2;
14075
- return checkCustomerOrder(orderHash);
14076
- case 2:
14077
- customerOrderResponse = _context4.sent;
14078
- return _context4.abrupt("return", customerOrderResponse);
14079
- case 4:
14080
- case "end":
14081
- return _context4.stop();
14082
- }
14083
- }, _callee4);
14084
- }));
14085
- return function getCustomerOrderStatus() {
14086
- return _ref4.apply(this, arguments);
14087
- };
14088
- }();
14089
- var makeRequests = /*#__PURE__*/function () {
14090
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
14091
- var _error$response, _error$response$data;
14092
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
14093
- while (1) switch (_context5.prev = _context5.next) {
14094
- case 0:
14095
- _context5.prev = 0;
14096
- if (!orderHash) {
14097
- _context5.next = 4;
14098
- break;
14099
- }
14100
- _context5.next = 4;
14101
- return getCustomerOrderStatus();
14102
- case 4:
14103
- getUrl();
14104
- getVerificationStatus();
14105
- // Check the verification status every 30 seconds
14106
- intervalId = setInterval(function () {
14107
- getVerificationStatus();
14108
- }, 10000);
14109
- _context5.next = 12;
14110
- break;
14111
- case 9:
14112
- _context5.prev = 9;
14113
- _context5.t0 = _context5["catch"](0);
14114
- if (((_error$response = _context5.t0.response) == null ? void 0 : (_error$response$data = _error$response.data) == null ? void 0 : _error$response$data.message) === VERIFICATION_MESSAGES.WRONG_CUSTOMER) {
14115
- setVerificationStatus(VERIFICATION_STATUSES.WRONG_CUSTOMER);
14116
- setModalData({
14117
- displaModal: true,
14118
- hideCancelBtn: true,
14119
- message: VERIFICATION_MESSAGES.WRONG_CUSTOMER
14120
- });
14121
- }
14122
- case 12:
14123
- case "end":
14124
- return _context5.stop();
14125
- }
14126
- }, _callee5, null, [[0, 9]]);
14127
- }));
14128
- return function makeRequests() {
14129
- return _ref5.apply(this, arguments);
14130
- };
14131
- }();
14132
- makeRequests();
14133
- // Clear the interval when the component unmounts
14134
- return function () {
14135
- return clearInterval(intervalId);
14136
- };
14137
- }, []);
14138
- var iframe = function iframe(netverifyUrl) {
14139
- // eslint-disable-next-line max-len
14140
- var iframe = "<iframe allowFullScreen id=\"verificationIframe\" frameBorder=\"0\" width=\"100%\" height=\"570px\" allow=\"camera;fullscreen;accelerometer;gyroscope;magnetometer\" src=\"" + netverifyUrl + "\"></iframe>";
14141
- return {
14142
- __html: iframe
14143
- };
14144
- };
14145
- useEffect(function () {
14146
- var orderHash = getQueryVariable('order_hash');
14147
- if (isBrowser) {
14148
- var checkoutData = JSON.parse(window.localStorage.getItem('checkoutData') || '{}');
14149
- if (_isEmpty(checkoutData) && orderHash) {
14150
- window.localStorage.setItem('checkoutData', JSON.stringify({
14151
- hash: orderHash
14152
- }));
14153
- }
14154
- }
14155
- }, []);
14156
- return React.createElement("div", null, React.createElement("h2", {
14157
- className: "page-header"
14158
- }, "Account Verification"), loadingStatus ? null : React.createElement(React.Fragment, null, !isAccountVerifiedOrPending && React.createElement("div", {
14159
- className: "verify-message"
14160
- }, "To complete the purchase, please verify your identity."), verificationStatus === VERIFICATION_STATUSES.APPROVED && React.createElement("div", {
14161
- className: "verify-message"
14162
- }, VERIFICATION_MESSAGES.APPROVED), (verificationStatus === VERIFICATION_STATUSES.PENDING || provider === VERIFICATION_PROVIDERS.STRIPE && netverifyUrl === null && verificationStatus !== VERIFICATION_STATUSES.APPROVED) && React.createElement("div", {
14163
- className: "verify-message"
14164
- }, VERIFICATION_MESSAGES.PENDING), !isAccountVerifiedOrPending && netverifyUrl !== null && React.createElement(Button, {
14165
- type: "button",
14166
- variant: "contained",
14167
- className: "verify-button",
14168
- onClick: function onClick() {
14169
- setShowModal(true);
14170
- }
14171
- }, "Verify")), modalData.displaModal && React.createElement(Modal, {
14172
- modalClassName: "verification-message-modal",
14173
- actions: [{
14174
- id: 'ok',
14175
- label: 'Ok',
14176
- variant: 'contained',
14177
- onClick: handleClose
14178
- }]
14179
- }, React.createElement("div", {
14180
- className: "verify-message"
14181
- }, modalData.message)), showModal && React.createElement(Modal, {
14182
- modalClassName: "id-verification-modal",
14183
- actions: [{
14184
- id: 'close',
14185
- label: 'Close',
14186
- variant: 'contained',
14187
- onClick: function onClick() {
14188
- setShowModal(false);
14189
- }
14190
- }]
14191
- }, React.createElement("div", {
14192
- dangerouslySetInnerHTML: iframe(netverifyUrl || '')
14193
- })));
14194
- };
14195
-
14196
- var style$6 = {
14197
- position: 'absolute',
14198
- top: '10%',
14199
- left: '50%',
14200
- transform: 'translate(-50%, -50%)',
14201
- minWidth: 480,
14202
- backgroundColor: '#e3e3e3',
14203
- border: '1px solid white',
14204
- outline: 'none',
14205
- padding: '14px',
14206
- maxHeight: '85vh',
14207
- overflow: 'auto'
14208
- };
14209
- var RedirectModal = function RedirectModal(_ref) {
14210
- var _ref$message = _ref.message,
14211
- message = _ref$message === void 0 ? 'Your cart has expired. Please click on "OK" to return to the ticket selection page.' : _ref$message,
14212
- _ref$onClickOk = _ref.onClickOk,
14213
- onClickOk = _ref$onClickOk === void 0 ? function () {} : _ref$onClickOk;
14214
- return React.createElement(Modal$2, {
14215
- open: true,
14216
- "aria-labelledby": "modal-modal-title",
14217
- "aria-describedby": "modal-modal-description",
14218
- className: "redirect-modal"
14219
- }, React.createElement(Box, {
14220
- style: style$6
14221
- }, React.createElement("p", null, message), React.createElement("div", {
14222
- className: "footer"
14223
- }, React.createElement("button", {
14224
- onClick: onClickOk
14225
- }, "OK"))));
14226
- };
14227
-
14228
- var style$7 = {
14229
- position: 'absolute',
14230
- top: '50%',
14231
- left: '50%',
14232
- transform: 'translate(-50%, -50%)',
14233
- minWidth: 480,
14234
- backgroundColor: '#e3e3e3',
14235
- border: '1px solid white',
14236
- outline: 'none',
14237
- padding: '14px',
14238
- maxHeight: '85vh',
14239
- overflow: 'auto'
14240
- };
14241
- var RsvpContainer = function RsvpContainer(_ref) {
14242
- var _ref$showSection = _ref.showSection,
14243
- showSection = _ref$showSection === void 0 ? false : _ref$showSection,
14244
- eventId = _ref.eventId;
14245
- var userDataEncoded = isBrowser ? window.localStorage.getItem('user_data') : '';
14246
- var parsedData = JSON.parse(userDataEncoded || '{}');
14247
- var _useState = useState(false),
14248
- loading = _useState[0],
14249
- setLoading = _useState[1];
14250
- var _useState2 = useState({
14251
- isOpen: false,
14252
- text: ''
14253
- }),
14254
- modal = _useState2[0],
14255
- setModal = _useState2[1];
14256
- var handleModalClose = function handleModalClose() {
14257
- setModal({
14258
- isOpen: false,
14259
- text: ''
14260
- });
14261
- };
14262
- var handleSubmit = /*#__PURE__*/function () {
14263
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(values) {
14264
- var requestData, response, _error$response$data;
14265
- return _regeneratorRuntime().wrap(function _callee$(_context) {
14266
- while (1) switch (_context.prev = _context.next) {
14267
- case 0:
14268
- _context.prev = 0;
14269
- setLoading(true);
14270
- requestData = {
14271
- data: {
14272
- email: values.email
14273
- }
14274
- };
14275
- _context.next = 5;
14276
- return sendRSVPInfo(eventId, requestData);
14277
- case 5:
14278
- response = _context.sent;
14279
- setModal({
14280
- isOpen: true,
14281
- text: response.message
14282
- });
14283
- _context.next = 12;
14284
- break;
14285
- case 9:
14286
- _context.prev = 9;
14287
- _context.t0 = _context["catch"](0);
14288
- if (_context.t0.response.status === 403) {
14289
- setModal({
14290
- isOpen: true,
14291
- text: (_error$response$data = _context.t0.response.data) == null ? void 0 : _error$response$data.message
14292
- });
14275
+ break;
14293
14276
  }
14294
- case 12:
14295
- _context.prev = 12;
14296
- setLoading(false);
14297
- return _context.finish(12);
14298
- case 15:
14277
+ return _context5.abrupt("return");
14278
+ case 4:
14279
+ if (_find(reservationData, function (data) {
14280
+ return data.seatId === seatId;
14281
+ })) {
14282
+ handleCancelSeatReservtion(eventId, tierId, seatId);
14283
+ } else if (reservationData.length >= 10) {
14284
+ setError('Limit exceeded');
14285
+ } else {
14286
+ handleSeatReservation(eventId, tierId, seatId);
14287
+ }
14288
+ case 5:
14299
14289
  case "end":
14300
- return _context.stop();
14290
+ return _context5.stop();
14301
14291
  }
14302
- }, _callee, null, [[0, 9, 12, 15]]);
14292
+ }, _callee5);
14303
14293
  }));
14304
- return function handleSubmit(_x) {
14305
- return _ref2.apply(this, arguments);
14294
+ return function onSeatClick(_x7) {
14295
+ return _ref5.apply(this, arguments);
14306
14296
  };
14307
14297
  }();
14308
- if (!showSection) {
14309
- return null;
14310
- }
14311
- return React.createElement(React.Fragment, null, React.createElement(Modal$2, {
14312
- open: modal.isOpen,
14313
- onClose: handleModalClose,
14314
- "aria-labelledby": "modal-modal-title",
14315
- "aria-describedby": "modal-modal-description",
14316
- className: "rsvp-modal"
14317
- }, React.createElement(Box, {
14318
- style: style$7,
14319
- className: "rsvp-modal-box"
14320
- }, React.createElement("div", {
14321
- className: "rsvp-modal-container"
14322
- }, React.createElement("div", {
14323
- className: "rsvp-modal-header"
14324
- }, modal.text), React.createElement("div", {
14325
- className: "rsvp-modal-button"
14326
- }, React.createElement("button", {
14327
- type: "button",
14328
- onClick: handleModalClose
14329
- }, "OK"))))), React.createElement("div", {
14330
- className: "rsvp-container"
14331
- }, loading ? React.createElement(Loader, null) : React.createElement(React.Fragment, null, React.createElement("div", {
14332
- className: "rsvp-header"
14333
- }, "RSVP"), React.createElement("div", {
14334
- className: "rsvp-email-container"
14335
- }, React.createElement(Formik, {
14336
- initialValues: {
14337
- email: (parsedData == null ? void 0 : parsedData.email) || ''
14338
- },
14339
- onSubmit: handleSubmit,
14340
- enableReinitialize: true
14341
- }, React.createElement(Form, null, React.createElement("div", {
14342
- className: "rsvp-email-input-container"
14343
- }, React.createElement(Field, {
14344
- name: "email",
14345
- label: "EMAIL ADDRESS",
14346
- type: "email",
14347
- validate: combineValidators(function (value) {
14348
- return requiredValidator(value, 'Please enter your Email');
14349
- }, function (value) {
14350
- return emailValidator(value);
14351
- }),
14352
- component: CustomField
14353
- })), React.createElement("div", {
14354
- className: "rsvp-button-container"
14355
- }, React.createElement(Button, {
14356
- type: "submit"
14357
- }, "RSVP"))))))));
14358
- };
14359
-
14360
- var Prewards = function Prewards(props) {
14361
- var data = props.data,
14362
- _props$classNamePrefi = props.classNamePrefix,
14363
- classNamePrefix = _props$classNamePrefi === void 0 ? '' : _props$classNamePrefi,
14364
- _props$headerNode = props.headerNode,
14365
- headerNode = _props$headerNode === void 0 ? React.createElement(React.Fragment, null, "PRE", React.createElement("span", null, "WARDS\u2122")) : _props$headerNode;
14366
- return React.createElement("div", {
14367
- className: classNamePrefix + "_prewards"
14368
- }, !_isEmpty(data) && React.createElement("div", {
14369
- className: classNamePrefix + "_prewards_heder"
14370
- }, headerNode), React.createElement("div", {
14371
- className: classNamePrefix + "_prizes"
14372
- }, _map(data, function (prize) {
14373
- var description = prize.description,
14374
- name = prize.name,
14375
- image = prize.image,
14376
- id = prize.id;
14377
- return React.createElement("div", {
14378
- className: classNamePrefix + "_prize",
14379
- key: id
14380
- }, image && React.createElement("img", {
14381
- className: classNamePrefix + "_image",
14382
- alt: "",
14383
- src: image
14384
- }), React.createElement("div", {
14385
- className: classNamePrefix + "_info"
14386
- }, React.createElement("h4", {
14387
- className: classNamePrefix + "_name"
14388
- }, name), description && React.createElement("article", {
14389
- className: classNamePrefix + "_description"
14390
- }, description)));
14391
- })));
14392
- };
14393
-
14394
- var CopyField = function CopyField(props) {
14395
- var copyValue = props.copyValue,
14396
- _props$copyIconSrc = props.copyIconSrc,
14397
- copyIconSrc = _props$copyIconSrc === void 0 ? 'https://img.icons8.com/office/50/000000/copy.png' : _props$copyIconSrc,
14398
- _props$copyTitle = props.copyTitle,
14399
- copyTitle = _props$copyTitle === void 0 ? 'Copy' : _props$copyTitle,
14400
- _props$hasCopyIcon = props.hasCopyIcon,
14401
- hasCopyIcon = _props$hasCopyIcon === void 0 ? false : _props$hasCopyIcon,
14402
- _props$onLinkCopied = props.onLinkCopied,
14403
- onLinkCopied = _props$onLinkCopied === void 0 ? _identity : _props$onLinkCopied,
14404
- _props$classNamePrefi = props.classNamePrefix,
14405
- classNamePrefix = _props$classNamePrefi === void 0 ? '' : _props$classNamePrefi,
14406
- _props$messageText = props.messageText,
14407
- messageText = _props$messageText === void 0 ? '' : _props$messageText;
14408
- var inputRef = useRef(null);
14409
- return React.createElement(React.Fragment, null, messageText && React.createElement("span", {
14410
- className: "message-text"
14411
- }, messageText), React.createElement("input", {
14412
- ref: inputRef,
14413
- className: classNamePrefix + "_share-input",
14414
- defaultValue: copyValue,
14415
- readOnly: true
14416
- }), React.createElement("div", {
14417
- className: classNamePrefix + "_share-by-link-copy-icon",
14418
- "aria-hidden": true,
14419
- onClick: function onClick() {
14420
- navigator.clipboard.writeText(_get(inputRef, 'current.value'));
14421
- onLinkCopied();
14422
- }
14423
- }, hasCopyIcon ? React.createElement("img", {
14424
- src: copyIconSrc,
14425
- alt: "copy"
14426
- }) : React.createElement("span", {
14427
- className: classNamePrefix + "_copy-icon"
14428
- }, copyTitle)));
14429
- };
14430
-
14431
- var ShareOptions = function ShareOptions(props) {
14432
- var classNamePrefix = props.classNamePrefix,
14433
- data = props.data,
14434
- _props$hasCopyIcon = props.hasCopyIcon,
14435
- hasCopyIcon = _props$hasCopyIcon === void 0 ? true : _props$hasCopyIcon,
14436
- _props$onLinkCopied = props.onLinkCopied,
14437
- onLinkCopied = _props$onLinkCopied === void 0 ? _identity : _props$onLinkCopied,
14438
- _props$headerText = props.headerText,
14439
- headerText = _props$headerText === void 0 ? 'Share with your friends here ...' : _props$headerText,
14440
- hash = props.hash,
14441
- updateShareActionData = props.updateShareActionData,
14442
- shareActionData = props.shareActionData;
14443
- var _data$attributes = data.attributes,
14444
- actions = _data$attributes.actions,
14445
- shareUrl = _data$attributes.shareUrl;
14446
- var shareButtons = shareOptionsAdapter(actions, shareUrl);
14447
- var isShareLinkEnabled = _some(actions, function (item) {
14448
- return item.action === 'shared_url';
14449
- });
14450
- var _onAfterShare = /*#__PURE__*/function () {
14451
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(eventActionId) {
14452
- var shareActionToken, tokenShuffleMethod, accessToken;
14453
- return _regeneratorRuntime().wrap(function _callee$(_context) {
14454
- while (1) switch (_context.prev = _context.next) {
14298
+ var handleTicketSelect = function handleTicketSelect(ticketId, seatId) {
14299
+ var currentSelectedTickets = _extends({}, selectedTickets);
14300
+ currentSelectedTickets[seatId] = ticketId;
14301
+ setSelectedTickets(currentSelectedTickets);
14302
+ };
14303
+ var handleGetTicketBtnClick = /*#__PURE__*/function () {
14304
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
14305
+ var ticketsDropdownsData, selectedSeats, addToCartData, _addToCartData$attrib, response, message;
14306
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
14307
+ while (1) switch (_context6.prev = _context6.next) {
14455
14308
  case 0:
14456
- shareActionToken = shareActionData.shareActionToken, tokenShuffleMethod = shareActionData.tokenShuffleMethod;
14457
- accessToken = getShuffleMethodByName(tokenShuffleMethod)(shareActionToken);
14458
- if (!(typeof eventActionId === 'string')) {
14459
- _context.next = 6;
14460
- break;
14461
- }
14462
- _context.next = 5;
14463
- return submitShareAction({
14464
- eventActionId: eventActionId,
14465
- accessToken: accessToken,
14466
- hash: hash
14309
+ setIsAddingToCart(true);
14310
+ ticketsDropdownsData = getTicketDropdownData(reservedSeats, ticketTypeTierRelationsRef.current);
14311
+ selectedSeats = {};
14312
+ _forEach(ticketsDropdownsData, function (ticketData) {
14313
+ var _extends4;
14314
+ selectedSeats = _extends({}, selectedSeats, (_extends4 = {}, _extends4[ticketData.seatId] = ticketData.ticketsData, _extends4));
14467
14315
  });
14468
- case 5:
14469
- updateShareActionData();
14470
- case 6:
14316
+ addToCartData = getAddToCartRequestData({
14317
+ eventId: eventId,
14318
+ reservations: _map(reservedSeats, function (seat) {
14319
+ return seat.seatId;
14320
+ }),
14321
+ selectedSeats: selectedSeats,
14322
+ selectedTickets: selectedTickets,
14323
+ guestCounts: guestCounts
14324
+ });
14325
+ _context6.prev = 5;
14326
+ _context6.next = 8;
14327
+ return addToCartFunc({
14328
+ eventId: eventId,
14329
+ data: addToCartData,
14330
+ ticketQuantity: addToCartData == null ? void 0 : (_addToCartData$attrib = addToCartData.attributes) == null ? void 0 : _addToCartData$attrib.product_cart_quantity
14331
+ });
14332
+ case 8:
14333
+ response = _context6.sent;
14334
+ localStorage.removeItem('reservationData');
14335
+ onAddToCartSuccess(response);
14336
+ _context6.next = 16;
14337
+ break;
14338
+ case 13:
14339
+ _context6.prev = 13;
14340
+ _context6.t0 = _context6["catch"](5);
14341
+ if (axios.isAxiosError(_context6.t0)) {
14342
+ message = _get(_context6.t0, 'response.data.message', '');
14343
+ setError(message);
14344
+ }
14345
+ case 16:
14346
+ _context6.prev = 16;
14347
+ setIsAddingToCart(false);
14348
+ return _context6.finish(16);
14349
+ case 19:
14471
14350
  case "end":
14472
- return _context.stop();
14351
+ return _context6.stop();
14473
14352
  }
14474
- }, _callee);
14353
+ }, _callee6, null, [[5, 13, 16, 19]]);
14475
14354
  }));
14476
- return function onAfterShare(_x) {
14477
- return _ref.apply(this, arguments);
14355
+ return function handleGetTicketBtnClick() {
14356
+ return _ref6.apply(this, arguments);
14357
+ };
14358
+ }();
14359
+ useEffect(function () {
14360
+ if (Date.now() > Number(localStorage.getItem("reservationStart-" + eventId))) {
14361
+ setSelectedTickets({});
14362
+ setReservedSeats([]);
14363
+ }
14364
+ var makeRequests = /*#__PURE__*/function () {
14365
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
14366
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
14367
+ while (1) switch (_context7.prev = _context7.next) {
14368
+ case 0:
14369
+ _context7.prev = 0;
14370
+ setIsLoadingStatuses(true);
14371
+ _context7.next = 4;
14372
+ return fetchSeatMapData();
14373
+ case 4:
14374
+ _context7.next = 6;
14375
+ return fetchSeatMapReservations();
14376
+ case 6:
14377
+ _context7.next = 11;
14378
+ break;
14379
+ case 8:
14380
+ _context7.prev = 8;
14381
+ _context7.t0 = _context7["catch"](0);
14382
+ setError('Something went wrong');
14383
+ case 11:
14384
+ _context7.prev = 11;
14385
+ setIsLoadingStatuses(false);
14386
+ return _context7.finish(11);
14387
+ case 14:
14388
+ case "end":
14389
+ return _context7.stop();
14390
+ }
14391
+ }, _callee7, null, [[0, 8, 11, 14]]);
14392
+ }));
14393
+ return function makeRequests() {
14394
+ return _ref7.apply(this, arguments);
14395
+ };
14396
+ }();
14397
+ makeRequests();
14398
+ if (country) {
14399
+ localStorage.setItem('eventCountry', country);
14400
+ }
14401
+ }, [country, eventId, fetchSeatMapData]);
14402
+ useEffect(function () {
14403
+ var intervalId = setInterval(function () {
14404
+ fetchSeatMapReservations();
14405
+ }, 3000);
14406
+ return function () {
14407
+ clearInterval(intervalId);
14478
14408
  };
14479
- }();
14480
- return React.createElement("div", {
14481
- className: classNamePrefix + "_share_options"
14482
- }, !_isEmpty(actions) && React.createElement(React.Fragment, null, React.createElement("div", {
14483
- className: classNamePrefix + "_share_header"
14484
- }, headerText), React.createElement(SocialButtons, {
14485
- shareLink: data.attributes.shareUrl,
14486
- name: "",
14487
- appId: "",
14488
- showDefaultShareButtons: false,
14489
- shareButtons: shareButtons,
14490
- titleText: "",
14491
- footerText: "",
14492
- onAfterShare: function onAfterShare(eventActionId) {
14493
- return _onAfterShare(eventActionId);
14409
+ }, [fetchSeatMapReservations]);
14410
+ useEffect(function () {
14411
+ if (!isOnline) {
14412
+ setError(OFFLINE_MESSAGE);
14413
+ } else if (isOnline && error === OFFLINE_MESSAGE) {
14414
+ setError(null);
14494
14415
  }
14495
- }), isShareLinkEnabled && React.createElement("div", {
14496
- className: classNamePrefix + "_share_btn_inner"
14497
- }, React.createElement(CopyField, {
14498
- copyValue: shareUrl,
14499
- onLinkCopied: onLinkCopied,
14500
- hasCopyIcon: hasCopyIcon,
14501
- classNamePrefix: classNamePrefix,
14502
- messageText: "Share your link"
14503
- }))));
14416
+ }, [error, isOnline]);
14417
+ return React.createElement(React.Fragment, null, error && React.createElement(Alert, {
14418
+ severity: "error",
14419
+ onClose: function onClose() {
14420
+ setError(null);
14421
+ },
14422
+ variant: "filled",
14423
+ style: {
14424
+ width: '350px'
14425
+ }
14426
+ }, error), showTimer && React.createElement(Countdown$1, {
14427
+ date: moment$1(Number(localStorage.getItem("reservationStart-" + eventId))).valueOf(),
14428
+ renderer: function renderer(props) {
14429
+ return React.createElement("div", {
14430
+ className: "reservation-countdown"
14431
+ }, React.createElement("span", {
14432
+ className: "reservation-message"
14433
+ }, timerMessage), React.createElement("span", {
14434
+ className: "reservation-timer"
14435
+ }, showZero(props.minutes), ":", showZero(props.seconds)));
14436
+ },
14437
+ onComplete: function onComplete() {
14438
+ endTimer();
14439
+ setSelectedTickets({});
14440
+ setReservedSeats([]);
14441
+ if (onCountdownFinish) {
14442
+ onCountdownFinish();
14443
+ }
14444
+ }
14445
+ }), !isLoadingSeatMapData && !isLoadingStatuses && React.createElement(ReferralLogic, {
14446
+ eventId: eventId
14447
+ }), React.createElement(TicketsSection$1, {
14448
+ selectedTickets: selectedTickets,
14449
+ handleTicketSelect: handleTicketSelect,
14450
+ handleCancelReservation: function handleCancelReservation(seatId, tireId) {
14451
+ return handleCancelSeatReservtion(eventId, tireId, seatId);
14452
+ },
14453
+ handleGetTicketClick: handleGetTicketBtnClick,
14454
+ isAddingToCart: isAddingToCart,
14455
+ reservedSeats: reservedSeats,
14456
+ ticketDeleteButtonContent: ticketDeleteButtonContent,
14457
+ ticketInfoContent: ticketInfoContent,
14458
+ ticketTypeTierRelations: ticketTypeTierRelationsRef.current,
14459
+ currencySymbol: symbol,
14460
+ tableMapEnabled: Boolean(tableMapEnabled),
14461
+ guestCounts: guestCounts,
14462
+ setGuestCounts: setGuestCounts
14463
+ }), React.createElement(SeatMapComponent, {
14464
+ seatMapProps: {
14465
+ seatData: seatMapData.seatMap,
14466
+ statuses: seatMapStatuses,
14467
+ tierPrices: seatMapData.tierPrices,
14468
+ seatMapType: seatMapData.seatMapType,
14469
+ ticketTypeTierRelations: ticketTypeTierRelationsRef.current,
14470
+ seatMapEvents: {
14471
+ onSeatClick: onSeatClick
14472
+ },
14473
+ isReserving: isReserving,
14474
+ predefinedSeats: seatMapData.predefinedSeats,
14475
+ isLoadingSeatMapData: isLoadingSeatMapData
14476
+ },
14477
+ mapContainerId: mapContainerId
14478
+ }));
14504
14479
  };
14505
14480
 
14506
- var isWindowDefined$2 = typeof window !== 'undefined';
14507
- var PreRegistrationComplete = function PreRegistrationComplete(_ref) {
14508
- var pEventId = _ref.eventId,
14509
- _ref$classNamePrefix = _ref.classNamePrefix,
14510
- classNamePrefix = _ref$classNamePrefix === void 0 ? '' : _ref$classNamePrefix,
14511
- _ref$onLinkCopied = _ref.onLinkCopied,
14512
- _onLinkCopied = _ref$onLinkCopied === void 0 ? _identity : _ref$onLinkCopied,
14513
- _ref$hasCopyIcon = _ref.hasCopyIcon,
14514
- hasCopyIcon = _ref$hasCopyIcon === void 0 ? false : _ref$hasCopyIcon,
14515
- _ref$pageHeader = _ref.pageHeader,
14516
- pageHeader = _ref$pageHeader === void 0 ? 'Pre-Registration Confirmation' : _ref$pageHeader,
14517
- _ref$onGetConfirmatio = _ref.onGetConfirmationDataError,
14518
- onGetConfirmationDataError = _ref$onGetConfirmatio === void 0 ? _identity : _ref$onGetConfirmatio,
14519
- _ref$onGetConfirmatio2 = _ref.onGetConfirmationDataSuccess,
14520
- onGetConfirmationDataSuccess = _ref$onGetConfirmatio2 === void 0 ? _identity : _ref$onGetConfirmatio2,
14521
- _ref$pageMessage = _ref.pageMessage,
14522
- pageMessage = _ref$pageMessage === void 0 ? 'Pre registration was successful!' : _ref$pageMessage,
14523
- _ref$onLoginSuccess = _ref.onLoginSuccess,
14524
- onLoginSuccess = _ref$onLoginSuccess === void 0 ? _identity : _ref$onLoginSuccess,
14525
- logo = _ref.logo,
14526
- themeOptions = _ref.themeOptions;
14527
- var themeMui = createTheme(themeOptions);
14528
- var localStorageHash = isWindowDefined$2 ? localStorage.getItem('pre-registration-hash') : '';
14529
- var queryHash = getQueryVariable('hash') || '';
14530
- queryHash && isWindowDefined$2 && window.localStorage.setItem('pre-registration-hash', queryHash);
14531
- var hash = queryHash || localStorageHash;
14532
- var _useState = useState(Boolean(getCookieByName(X_TF_ECOMMERCE))),
14533
- isLoggedIn = _useState[0],
14534
- setIsLoggedIn = _useState[1];
14535
- var _useState2 = useState(!isLoggedIn),
14536
- showModalLogin = _useState2[0],
14537
- setShowModalLogin = _useState2[1];
14481
+ var IDVerification = function IDVerification(props) {
14482
+ var _props$onGetVerifyUrl = props.onGetVerifyUrlSuccess,
14483
+ onGetVerifyUrlSuccess = _props$onGetVerifyUrl === void 0 ? _identity : _props$onGetVerifyUrl,
14484
+ _props$onGetVerifyUrl2 = props.onGetVerifyUrlError,
14485
+ onGetVerifyUrlError = _props$onGetVerifyUrl2 === void 0 ? _identity : _props$onGetVerifyUrl2,
14486
+ _props$onGetVerificat = props.onGetVerificationStatusSuccess,
14487
+ onGetVerificationStatusSuccess = _props$onGetVerificat === void 0 ? _identity : _props$onGetVerificat,
14488
+ _props$onGetVerificat2 = props.onGetVerificationStatusError,
14489
+ onGetVerificationStatusError = _props$onGetVerificat2 === void 0 ? _identity : _props$onGetVerificat2,
14490
+ _props$onVerification = props.onVerificationMessageModalClose,
14491
+ onVerificationMessageModalClose = _props$onVerification === void 0 ? _identity : _props$onVerification,
14492
+ _props$onPassVerifica = props.onPassVerificationStepsSuccess,
14493
+ onPassVerificationStepsSuccess = _props$onPassVerifica === void 0 ? _identity : _props$onPassVerifica,
14494
+ _props$onPassVerifica2 = props.onPassVerificationStepsError,
14495
+ onPassVerificationStepsError = _props$onPassVerifica2 === void 0 ? _identity : _props$onPassVerifica2;
14496
+ var _useState = useState(true),
14497
+ loadingStatus = _useState[0],
14498
+ setLoadingStatus = _useState[1];
14499
+ var _useState2 = useState(null),
14500
+ verificationStatus = _useState2[0],
14501
+ setVerificationStatus = _useState2[1];
14538
14502
  var _useState3 = useState(false),
14539
- showCopyModal = _useState3[0],
14540
- setShowCopyModal = _useState3[1];
14541
- var _useState4 = useState([]),
14542
- prizes = _useState4[0],
14543
- setPrizes = _useState4[1];
14544
- var _useState5 = useState({}),
14545
- shareOptions = _useState5[0],
14546
- setShareOptions = _useState5[1];
14547
- var _useState6 = useState({}),
14548
- shareActionData = _useState6[0],
14549
- setShareActionData = _useState6[1];
14550
- var _useState7 = useState({}),
14551
- error = _useState7[0],
14552
- setError = _useState7[1];
14553
- useCookieListener(X_TF_ECOMMERCE, function (value) {
14554
- return setIsLoggedIn(Boolean(value));
14555
- });
14503
+ showModal = _useState3[0],
14504
+ setShowModal = _useState3[1];
14505
+ var _useState4 = useState(null),
14506
+ netverifyUrl = _useState4[0],
14507
+ setNetverifyUrl = _useState4[1];
14508
+ var _useState5 = useState(null),
14509
+ provider = _useState5[0],
14510
+ setProvider = _useState5[1];
14511
+ var _useState6 = useState(false),
14512
+ hasError = _useState6[0],
14513
+ setHasError = _useState6[1];
14514
+ var _useState7 = useState(null),
14515
+ lastError = _useState7[0],
14516
+ setLastError = _useState7[1];
14517
+ var _useState8 = useState({
14518
+ message: '',
14519
+ hideCancelBtn: true,
14520
+ displaModal: false
14521
+ }),
14522
+ modalData = _useState8[0],
14523
+ setModalData = _useState8[1];
14524
+ var isAccountVerifiedOrPending = (verificationStatus === VERIFICATION_STATUSES.APPROVED || verificationStatus === VERIFICATION_STATUSES.PENDING) && verificationStatus !== VERIFICATION_STATUSES.WRONG_CUSTOMER;
14525
+ var handleClose = function handleClose() {
14526
+ setModalData({
14527
+ message: '',
14528
+ displaModal: false,
14529
+ hideCancelBtn: true
14530
+ });
14531
+ onVerificationMessageModalClose(verificationStatus);
14532
+ };
14556
14533
  useEffect(function () {
14557
- var fetchConfirmationData = /*#__PURE__*/function () {
14558
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
14559
- var shareOptionsData, attributes, eventId, influencersData, _error$response;
14534
+ var callbackNetVerify = /*#__PURE__*/function () {
14535
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(e) {
14536
+ var data, result;
14560
14537
  return _regeneratorRuntime().wrap(function _callee$(_context) {
14561
14538
  while (1) switch (_context.prev = _context.next) {
14562
14539
  case 0:
14563
- _context.prev = 0;
14564
- if (!(hash && isLoggedIn)) {
14565
- _context.next = 15;
14540
+ if (!(e.data && e.origin === 'https://verify.stripe.com')) {
14541
+ _context.next = 10;
14542
+ break;
14543
+ }
14544
+ data = e.data;
14545
+ if (!(data.type === 'STRIPE_IDENTITY_CLOSE')) {
14546
+ _context.next = 9;
14547
+ break;
14548
+ }
14549
+ _context.next = 5;
14550
+ return getUrl();
14551
+ case 5:
14552
+ setShowModal(false);
14553
+ if (hasError) {
14554
+ setHasError(false);
14555
+ onPassVerificationStepsError(lastError);
14556
+ } else {
14557
+ setHasError(false);
14558
+ onPassVerificationStepsSuccess();
14559
+ }
14560
+ _context.next = 10;
14561
+ break;
14562
+ case 9:
14563
+ if (data.type === 'STRIPE_IDENTITY_ERROR') {
14564
+ setHasError(true);
14565
+ setLastError(data);
14566
+ }
14567
+ case 10:
14568
+ if (!(e.data && isJson(e.data))) {
14569
+ _context.next = 25;
14566
14570
  break;
14567
14571
  }
14568
- _context.next = 4;
14569
- return getPreRegistrationShareOptions({
14570
- hash: hash
14571
- });
14572
- case 4:
14573
- shareOptionsData = _context.sent;
14574
- attributes = shareOptionsData.data.attributes;
14575
- setShareOptions(shareOptionsData.data);
14576
- setShareActionData({
14577
- shareActionToken: attributes.shareActionToken,
14578
- tokenShuffleMethod: attributes.tokenShuffleMethod
14579
- });
14580
- eventId = _get(shareOptionsData, 'data.attributes.eventId');
14581
- if (!(eventId || pEventId)) {
14582
- _context.next = 14;
14572
+ _context.prev = 11;
14573
+ result = JSON.parse(e.data);
14574
+ if (!(result.payload && (result.payload.value === 'success' || result.payload.transactionStatus === 'SUCCESS'))) {
14575
+ _context.next = 19;
14583
14576
  break;
14584
14577
  }
14585
- _context.next = 12;
14586
- return getPreRegistrationInfluencers({
14587
- eventId: eventId || pEventId
14588
- });
14589
- case 12:
14590
- influencersData = _context.sent;
14591
- setPrizes(influencersData.data.attributes.prizes);
14592
- case 14:
14593
- onGetConfirmationDataSuccess();
14594
- case 15:
14578
+ _context.next = 16;
14579
+ return updateVerificationStatus();
14580
+ case 16:
14581
+ onPassVerificationStepsSuccess();
14595
14582
  _context.next = 20;
14596
14583
  break;
14597
- case 17:
14598
- _context.prev = 17;
14599
- _context.t0 = _context["catch"](0);
14600
- if (axios.isAxiosError(_context.t0)) {
14601
- setError((_error$response = _context.t0.response) == null ? void 0 : _error$response.data);
14584
+ case 19:
14585
+ if (result.payload && (result.payload.value === 'error' || result.payload.transactionStatus === 'ERROR')) {
14586
+ setShowModal(false);
14587
+ onPassVerificationStepsError(result.payload);
14602
14588
  }
14603
14589
  case 20:
14590
+ _context.next = 25;
14591
+ break;
14592
+ case 22:
14593
+ _context.prev = 22;
14594
+ _context.t0 = _context["catch"](11);
14595
+ onPassVerificationStepsError(_context.t0);
14596
+ case 25:
14604
14597
  case "end":
14605
14598
  return _context.stop();
14606
14599
  }
14607
- }, _callee, null, [[0, 17]]);
14600
+ }, _callee, null, [[11, 22]]);
14608
14601
  }));
14609
- return function fetchConfirmationData() {
14610
- return _ref2.apply(this, arguments);
14602
+ return function callbackNetVerify(_x) {
14603
+ return _ref.apply(this, arguments);
14611
14604
  };
14612
14605
  }();
14613
- fetchConfirmationData();
14614
- }, [pEventId, hash, onGetConfirmationDataError, onGetConfirmationDataSuccess, isLoggedIn]);
14615
- var onClose = function onClose() {
14616
- setShowCopyModal(false);
14606
+ window.addEventListener('message', callbackNetVerify);
14607
+ return function () {
14608
+ window.removeEventListener('message', callbackNetVerify);
14609
+ };
14610
+ }, []);
14611
+ var getUrl = /*#__PURE__*/function () {
14612
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
14613
+ var urlResponse;
14614
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
14615
+ while (1) switch (_context2.prev = _context2.next) {
14616
+ case 0:
14617
+ _context2.prev = 0;
14618
+ _context2.next = 3;
14619
+ return getNetverifyUrl();
14620
+ case 3:
14621
+ urlResponse = _context2.sent;
14622
+ setNetverifyUrl(urlResponse.netverifyUrl);
14623
+ setProvider(urlResponse.provider);
14624
+ onGetVerifyUrlSuccess(urlResponse);
14625
+ _context2.next = 12;
14626
+ break;
14627
+ case 9:
14628
+ _context2.prev = 9;
14629
+ _context2.t0 = _context2["catch"](0);
14630
+ onGetVerifyUrlError(_context2.t0);
14631
+ case 12:
14632
+ case "end":
14633
+ return _context2.stop();
14634
+ }
14635
+ }, _callee2, null, [[0, 9]]);
14636
+ }));
14637
+ return function getUrl() {
14638
+ return _ref2.apply(this, arguments);
14639
+ };
14640
+ }();
14641
+ useEffect(function () {
14642
+ var intervalId = null;
14643
+ var orderHash = getQueryVariable('order_hash') || '';
14644
+ var getVerificationStatus = /*#__PURE__*/function () {
14645
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
14646
+ var _verificationStatus, _provider, verifyUrl, statusResponse, status, isApproved;
14647
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
14648
+ while (1) switch (_context3.prev = _context3.next) {
14649
+ case 0:
14650
+ _context3.prev = 0;
14651
+ _verificationStatus = null; // Gets te current status of the variable without modifying it
14652
+ setVerificationStatus(function (status) {
14653
+ _verificationStatus = status;
14654
+ return status;
14655
+ });
14656
+ _provider = null; // Gets te current status of the variable without modifying it
14657
+ setProvider(function (state) {
14658
+ _provider = state;
14659
+ return _provider;
14660
+ });
14661
+ verifyUrl = null; // Gets te current status of the variable without modifying it
14662
+ setNetverifyUrl(function (state) {
14663
+ verifyUrl = state;
14664
+ return state;
14665
+ });
14666
+ _context3.next = 9;
14667
+ return checkVerificationStatus();
14668
+ case 9:
14669
+ statusResponse = _context3.sent;
14670
+ status = statusResponse.data.attributes.status;
14671
+ isApproved = status === VERIFICATION_STATUSES.APPROVED;
14672
+ if (_verificationStatus !== status) {
14673
+ setVerificationStatus(status);
14674
+ setModalData({
14675
+ displaModal: isApproved || status === VERIFICATION_STATUSES.FAILED,
14676
+ hideCancelBtn: true,
14677
+ message: isApproved ? VERIFICATION_MESSAGES.APPROVED : status === VERIFICATION_STATUSES.FAILED ? VERIFICATION_MESSAGES.FAILED : status
14678
+ });
14679
+ }
14680
+ if (_provider === VERIFICATION_PROVIDERS.STRIPE && verifyUrl === null && !isApproved) {
14681
+ getUrl();
14682
+ }
14683
+ onGetVerificationStatusSuccess(statusResponse);
14684
+ _context3.next = 20;
14685
+ break;
14686
+ case 17:
14687
+ _context3.prev = 17;
14688
+ _context3.t0 = _context3["catch"](0);
14689
+ onGetVerificationStatusError(_context3.t0);
14690
+ case 20:
14691
+ _context3.prev = 20;
14692
+ setLoadingStatus(false);
14693
+ return _context3.finish(20);
14694
+ case 23:
14695
+ case "end":
14696
+ return _context3.stop();
14697
+ }
14698
+ }, _callee3, null, [[0, 17, 20, 23]]);
14699
+ }));
14700
+ return function getVerificationStatus() {
14701
+ return _ref3.apply(this, arguments);
14702
+ };
14703
+ }();
14704
+ var getCustomerOrderStatus = /*#__PURE__*/function () {
14705
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
14706
+ var customerOrderResponse;
14707
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
14708
+ while (1) switch (_context4.prev = _context4.next) {
14709
+ case 0:
14710
+ _context4.next = 2;
14711
+ return checkCustomerOrder(orderHash);
14712
+ case 2:
14713
+ customerOrderResponse = _context4.sent;
14714
+ return _context4.abrupt("return", customerOrderResponse);
14715
+ case 4:
14716
+ case "end":
14717
+ return _context4.stop();
14718
+ }
14719
+ }, _callee4);
14720
+ }));
14721
+ return function getCustomerOrderStatus() {
14722
+ return _ref4.apply(this, arguments);
14723
+ };
14724
+ }();
14725
+ var makeRequests = /*#__PURE__*/function () {
14726
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
14727
+ var _error$response, _error$response$data;
14728
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
14729
+ while (1) switch (_context5.prev = _context5.next) {
14730
+ case 0:
14731
+ _context5.prev = 0;
14732
+ if (!orderHash) {
14733
+ _context5.next = 4;
14734
+ break;
14735
+ }
14736
+ _context5.next = 4;
14737
+ return getCustomerOrderStatus();
14738
+ case 4:
14739
+ getUrl();
14740
+ getVerificationStatus();
14741
+ // Check the verification status every 30 seconds
14742
+ intervalId = setInterval(function () {
14743
+ getVerificationStatus();
14744
+ }, 10000);
14745
+ _context5.next = 12;
14746
+ break;
14747
+ case 9:
14748
+ _context5.prev = 9;
14749
+ _context5.t0 = _context5["catch"](0);
14750
+ if (((_error$response = _context5.t0.response) == null ? void 0 : (_error$response$data = _error$response.data) == null ? void 0 : _error$response$data.message) === VERIFICATION_MESSAGES.WRONG_CUSTOMER) {
14751
+ setVerificationStatus(VERIFICATION_STATUSES.WRONG_CUSTOMER);
14752
+ setModalData({
14753
+ displaModal: true,
14754
+ hideCancelBtn: true,
14755
+ message: VERIFICATION_MESSAGES.WRONG_CUSTOMER
14756
+ });
14757
+ }
14758
+ case 12:
14759
+ case "end":
14760
+ return _context5.stop();
14761
+ }
14762
+ }, _callee5, null, [[0, 9]]);
14763
+ }));
14764
+ return function makeRequests() {
14765
+ return _ref5.apply(this, arguments);
14766
+ };
14767
+ }();
14768
+ makeRequests();
14769
+ // Clear the interval when the component unmounts
14770
+ return function () {
14771
+ return clearInterval(intervalId);
14772
+ };
14773
+ }, []);
14774
+ var iframe = function iframe(netverifyUrl) {
14775
+ // eslint-disable-next-line max-len
14776
+ var iframe = "<iframe allowFullScreen id=\"verificationIframe\" frameBorder=\"0\" width=\"100%\" height=\"570px\" allow=\"camera;fullscreen;accelerometer;gyroscope;magnetometer\" src=\"" + netverifyUrl + "\"></iframe>";
14777
+ return {
14778
+ __html: iframe
14779
+ };
14780
+ };
14781
+ useEffect(function () {
14782
+ var orderHash = getQueryVariable('order_hash');
14783
+ if (isBrowser) {
14784
+ var checkoutData = JSON.parse(window.localStorage.getItem('checkoutData') || '{}');
14785
+ if (_isEmpty(checkoutData) && orderHash) {
14786
+ window.localStorage.setItem('checkoutData', JSON.stringify({
14787
+ hash: orderHash
14788
+ }));
14789
+ }
14790
+ }
14791
+ }, []);
14792
+ return React.createElement("div", null, React.createElement("h2", {
14793
+ className: "page-header"
14794
+ }, "Account Verification"), loadingStatus ? null : React.createElement(React.Fragment, null, !isAccountVerifiedOrPending && React.createElement("div", {
14795
+ className: "verify-message"
14796
+ }, "To complete the purchase, please verify your identity."), verificationStatus === VERIFICATION_STATUSES.APPROVED && React.createElement("div", {
14797
+ className: "verify-message"
14798
+ }, VERIFICATION_MESSAGES.APPROVED), (verificationStatus === VERIFICATION_STATUSES.PENDING || provider === VERIFICATION_PROVIDERS.STRIPE && netverifyUrl === null && verificationStatus !== VERIFICATION_STATUSES.APPROVED) && React.createElement("div", {
14799
+ className: "verify-message"
14800
+ }, VERIFICATION_MESSAGES.PENDING), !isAccountVerifiedOrPending && netverifyUrl !== null && React.createElement(Button, {
14801
+ type: "button",
14802
+ variant: "contained",
14803
+ className: "verify-button",
14804
+ onClick: function onClick() {
14805
+ setShowModal(true);
14806
+ }
14807
+ }, "Verify")), modalData.displaModal && React.createElement(Modal, {
14808
+ modalClassName: "verification-message-modal",
14809
+ actions: [{
14810
+ id: 'ok',
14811
+ label: 'Ok',
14812
+ variant: 'contained',
14813
+ onClick: handleClose
14814
+ }]
14815
+ }, React.createElement("div", {
14816
+ className: "verify-message"
14817
+ }, modalData.message)), showModal && React.createElement(Modal, {
14818
+ modalClassName: "id-verification-modal",
14819
+ actions: [{
14820
+ id: 'close',
14821
+ label: 'Close',
14822
+ variant: 'contained',
14823
+ onClick: function onClick() {
14824
+ setShowModal(false);
14825
+ }
14826
+ }]
14827
+ }, React.createElement("div", {
14828
+ dangerouslySetInnerHTML: iframe(netverifyUrl || '')
14829
+ })));
14830
+ };
14831
+
14832
+ var style$6 = {
14833
+ position: 'absolute',
14834
+ top: '10%',
14835
+ left: '50%',
14836
+ transform: 'translate(-50%, -50%)',
14837
+ minWidth: 480,
14838
+ backgroundColor: '#e3e3e3',
14839
+ border: '1px solid white',
14840
+ outline: 'none',
14841
+ padding: '14px',
14842
+ maxHeight: '85vh',
14843
+ overflow: 'auto'
14844
+ };
14845
+ var RedirectModal = function RedirectModal(_ref) {
14846
+ var _ref$message = _ref.message,
14847
+ message = _ref$message === void 0 ? 'Your cart has expired. Please click on "OK" to return to the ticket selection page.' : _ref$message,
14848
+ _ref$onClickOk = _ref.onClickOk,
14849
+ onClickOk = _ref$onClickOk === void 0 ? function () {} : _ref$onClickOk;
14850
+ return React.createElement(Modal$2, {
14851
+ open: true,
14852
+ "aria-labelledby": "modal-modal-title",
14853
+ "aria-describedby": "modal-modal-description",
14854
+ className: "redirect-modal"
14855
+ }, React.createElement(Box, {
14856
+ style: style$6
14857
+ }, React.createElement("p", null, message), React.createElement("div", {
14858
+ className: "footer"
14859
+ }, React.createElement("button", {
14860
+ onClick: onClickOk
14861
+ }, "OK"))));
14862
+ };
14863
+
14864
+ var style$7 = {
14865
+ position: 'absolute',
14866
+ top: '50%',
14867
+ left: '50%',
14868
+ transform: 'translate(-50%, -50%)',
14869
+ minWidth: 480,
14870
+ backgroundColor: '#e3e3e3',
14871
+ border: '1px solid white',
14872
+ outline: 'none',
14873
+ padding: '14px',
14874
+ maxHeight: '85vh',
14875
+ overflow: 'auto'
14876
+ };
14877
+ var RsvpContainer = function RsvpContainer(_ref) {
14878
+ var _ref$showSection = _ref.showSection,
14879
+ showSection = _ref$showSection === void 0 ? false : _ref$showSection,
14880
+ eventId = _ref.eventId;
14881
+ var userDataEncoded = isBrowser ? window.localStorage.getItem('user_data') : '';
14882
+ var parsedData = JSON.parse(userDataEncoded || '{}');
14883
+ var _useState = useState(false),
14884
+ loading = _useState[0],
14885
+ setLoading = _useState[1];
14886
+ var _useState2 = useState({
14887
+ isOpen: false,
14888
+ text: ''
14889
+ }),
14890
+ modal = _useState2[0],
14891
+ setModal = _useState2[1];
14892
+ var handleModalClose = function handleModalClose() {
14893
+ setModal({
14894
+ isOpen: false,
14895
+ text: ''
14896
+ });
14617
14897
  };
14618
- var updateShareActionData = /*#__PURE__*/function () {
14619
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
14620
- var shareOptionsData;
14621
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
14622
- while (1) switch (_context2.prev = _context2.next) {
14898
+ var handleSubmit = /*#__PURE__*/function () {
14899
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(values) {
14900
+ var requestData, response, _error$response$data;
14901
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
14902
+ while (1) switch (_context.prev = _context.next) {
14623
14903
  case 0:
14624
- if (!hash) {
14625
- _context2.next = 6;
14626
- break;
14627
- }
14628
- _context2.next = 3;
14629
- return getPreRegistrationShareOptions({
14630
- hash: hash
14631
- });
14632
- case 3:
14633
- shareOptionsData = _context2.sent;
14634
- setShareOptions(shareOptionsData.data);
14635
- setShareActionData({
14636
- shareActionToken: shareOptionsData.data.attributes.shareActionToken,
14637
- tokenShuffleMethod: shareOptionsData.data.attributes.tokenShuffleMethod
14904
+ _context.prev = 0;
14905
+ setLoading(true);
14906
+ requestData = {
14907
+ data: {
14908
+ email: values.email
14909
+ }
14910
+ };
14911
+ _context.next = 5;
14912
+ return sendRSVPInfo(eventId, requestData);
14913
+ case 5:
14914
+ response = _context.sent;
14915
+ setModal({
14916
+ isOpen: true,
14917
+ text: response.message
14638
14918
  });
14639
- case 6:
14919
+ _context.next = 12;
14920
+ break;
14921
+ case 9:
14922
+ _context.prev = 9;
14923
+ _context.t0 = _context["catch"](0);
14924
+ if (_context.t0.response.status === 403) {
14925
+ setModal({
14926
+ isOpen: true,
14927
+ text: (_error$response$data = _context.t0.response.data) == null ? void 0 : _error$response$data.message
14928
+ });
14929
+ }
14930
+ case 12:
14931
+ _context.prev = 12;
14932
+ setLoading(false);
14933
+ return _context.finish(12);
14934
+ case 15:
14640
14935
  case "end":
14641
- return _context2.stop();
14936
+ return _context.stop();
14642
14937
  }
14643
- }, _callee2);
14938
+ }, _callee, null, [[0, 9, 12, 15]]);
14644
14939
  }));
14645
- return function updateShareActionData() {
14646
- return _ref3.apply(this, arguments);
14940
+ return function handleSubmit(_x) {
14941
+ return _ref2.apply(this, arguments);
14647
14942
  };
14648
14943
  }();
14649
- return React.createElement(ThemeProvider, {
14650
- theme: themeMui
14651
- }, isLoggedIn && _isEmpty(error) ? React.createElement("div", {
14652
- className: classNamePrefix + "_pre_registration_complete_container"
14653
- }, React.createElement(CopyMessageModal, {
14654
- showCopyModal: showCopyModal,
14655
- onClose: onClose
14656
- }), React.createElement("p", {
14657
- className: classNamePrefix + "_pre_registration_complete_header"
14658
- }, pageHeader), React.createElement("div", {
14659
- className: classNamePrefix + "_pre_registration_complete_message"
14660
- }, pageMessage), React.createElement("div", {
14661
- className: classNamePrefix + "_pre_registration_complete_body"
14662
- }, !_isEmpty(prizes) && React.createElement(Prewards, {
14663
- classNamePrefix: classNamePrefix,
14664
- data: prizes
14665
- }), !_isEmpty(shareOptions) && React.createElement(ShareOptions, {
14666
- classNamePrefix: classNamePrefix,
14667
- data: shareOptions,
14668
- onLinkCopied: function onLinkCopied() {
14669
- setShowCopyModal(true);
14670
- _onLinkCopied();
14671
- },
14672
- shareActionData: shareActionData,
14673
- updateShareActionData: updateShareActionData,
14674
- hasCopyIcon: hasCopyIcon,
14675
- hash: hash
14676
- }))) : showModalLogin && React.createElement(LoginModal, {
14677
- logo: logo,
14678
- onClose: function onClose() {
14679
- setShowModalLogin(false);
14944
+ if (!showSection) {
14945
+ return null;
14946
+ }
14947
+ return React.createElement(React.Fragment, null, React.createElement(Modal$2, {
14948
+ open: modal.isOpen,
14949
+ onClose: handleModalClose,
14950
+ "aria-labelledby": "modal-modal-title",
14951
+ "aria-describedby": "modal-modal-description",
14952
+ className: "rsvp-modal"
14953
+ }, React.createElement(Box, {
14954
+ style: style$7,
14955
+ className: "rsvp-modal-box"
14956
+ }, React.createElement("div", {
14957
+ className: "rsvp-modal-container"
14958
+ }, React.createElement("div", {
14959
+ className: "rsvp-modal-header"
14960
+ }, modal.text), React.createElement("div", {
14961
+ className: "rsvp-modal-button"
14962
+ }, React.createElement("button", {
14963
+ type: "button",
14964
+ onClick: handleModalClose
14965
+ }, "OK"))))), React.createElement("div", {
14966
+ className: "rsvp-container"
14967
+ }, loading ? React.createElement(Loader, null) : React.createElement(React.Fragment, null, React.createElement("div", {
14968
+ className: "rsvp-header"
14969
+ }, "RSVP"), React.createElement("div", {
14970
+ className: "rsvp-email-container"
14971
+ }, React.createElement(Formik, {
14972
+ initialValues: {
14973
+ email: (parsedData == null ? void 0 : parsedData.email) || ''
14680
14974
  },
14681
- onLogin: function onLogin(res) {
14682
- setShowModalLogin(false);
14683
- onLoginSuccess(res);
14684
- }
14685
- }), !_isEmpty(error) && React.createElement(ConfirmModal, {
14686
- hideCancelBtn: true,
14687
- message: error.message,
14688
- onConfirm: function onConfirm() {
14689
- return onGetConfirmationDataError(error);
14690
- }
14691
- }));
14975
+ onSubmit: handleSubmit,
14976
+ enableReinitialize: true
14977
+ }, React.createElement(Form, null, React.createElement("div", {
14978
+ className: "rsvp-email-input-container"
14979
+ }, React.createElement(Field, {
14980
+ name: "email",
14981
+ label: "EMAIL ADDRESS",
14982
+ type: "email",
14983
+ validate: combineValidators(function (value) {
14984
+ return requiredValidator(value, 'Please enter your Email');
14985
+ }, function (value) {
14986
+ return emailValidator(value);
14987
+ }),
14988
+ component: CustomField
14989
+ })), React.createElement("div", {
14990
+ className: "rsvp-button-container"
14991
+ }, React.createElement(Button, {
14992
+ type: "submit"
14993
+ }, "RSVP"))))))));
14692
14994
  };
14693
14995
 
14694
14996
  var Influancers = function Influancers(props) {