tf-checkout-react 1.0.72 → 1.0.76

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 (39) hide show
  1. package/dist/api/index.d.ts +1 -0
  2. package/dist/components/billing-info-container/index.d.ts +10 -3
  3. package/dist/components/billing-info-container/utils.d.ts +1 -0
  4. package/dist/components/confirmationContainer/index.d.ts +2 -1
  5. package/dist/components/paymentContainer/index.d.ts +8 -3
  6. package/dist/components/stripePayment/index.d.ts +2 -1
  7. package/dist/components/ticketsContainer/PromoCodeSection.d.ts +12 -0
  8. package/dist/components/ticketsContainer/index.d.ts +3 -1
  9. package/dist/components/waitingList/index.d.ts +2 -1
  10. package/dist/images/done.svg +3 -0
  11. package/dist/tf-checkout-react.cjs.development.js +303 -174
  12. package/dist/tf-checkout-react.cjs.development.js.map +1 -1
  13. package/dist/tf-checkout-react.cjs.production.min.js +1 -1
  14. package/dist/tf-checkout-react.cjs.production.min.js.map +1 -1
  15. package/dist/tf-checkout-react.esm.js +302 -173
  16. package/dist/tf-checkout-react.esm.js.map +1 -1
  17. package/dist/tf-checkout-styles.css +1 -1
  18. package/dist/utils/createCheckoutDataBodyWithDefaultHolder.d.ts +7 -0
  19. package/dist/utils/index.d.ts +1 -0
  20. package/dist/utils/setConfigs.d.ts +2 -1
  21. package/package.json +2 -2
  22. package/src/api/index.ts +6 -20
  23. package/src/assets/images/done.svg +3 -0
  24. package/src/components/billing-info-container/index.tsx +58 -45
  25. package/src/components/billing-info-container/utils.ts +2 -1
  26. package/src/components/common/CheckboxField.tsx +15 -8
  27. package/src/components/common/CustomField.tsx +7 -0
  28. package/src/components/common/FormikPhoneNumberField.tsx +9 -0
  29. package/src/components/common/SelectField.tsx +5 -1
  30. package/src/components/confirmationContainer/index.tsx +59 -43
  31. package/src/components/paymentContainer/index.tsx +28 -20
  32. package/src/components/stripePayment/index.tsx +24 -16
  33. package/src/components/ticketsContainer/PromoCodeSection.tsx +82 -0
  34. package/src/components/ticketsContainer/index.tsx +100 -83
  35. package/src/components/ticketsContainer/style.css +6 -4
  36. package/src/components/waitingList/index.tsx +7 -4
  37. package/src/utils/createCheckoutDataBodyWithDefaultHolder.ts +51 -0
  38. package/src/utils/index.ts +1 -0
  39. package/src/utils/setConfigs.ts +7 -2
@@ -7,7 +7,7 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
7
7
  var React = require('react');
8
8
  var React__default = _interopDefault(React);
9
9
  var formik = require('formik');
10
- var LoadingButton = _interopDefault(require('@mui/lab/LoadingButton'));
10
+ var Button = _interopDefault(require('@mui/material/Button'));
11
11
  var _identity = _interopDefault(require('lodash/identity'));
12
12
  var _map = _interopDefault(require('lodash/map'));
13
13
  var _get = _interopDefault(require('lodash/get'));
@@ -21,12 +21,13 @@ var _flatMapDeep = _interopDefault(require('lodash/flatMapDeep'));
21
21
  var _isArray = _interopDefault(require('lodash/isArray'));
22
22
  var nanoid = require('nanoid');
23
23
  var TextField = _interopDefault(require('@mui/material/TextField'));
24
+ var styles = require('@mui/styles');
24
25
  var FormGroup = _interopDefault(require('@mui/material/FormGroup'));
25
26
  var FormControlLabel = _interopDefault(require('@mui/material/FormControlLabel'));
26
27
  var Checkbox = _interopDefault(require('@mui/material/Checkbox'));
27
28
  var Select = _interopDefault(require('@mui/material/Select'));
28
29
  var MuiPhoneNumber = _interopDefault(require('material-ui-phone-number'));
29
- var styles = require('@mui/material/styles');
30
+ var styles$1 = require('@mui/material/styles');
30
31
  var Container = _interopDefault(require('@mui/material/Container'));
31
32
  var CircularProgress = _interopDefault(require('@mui/material/CircularProgress'));
32
33
  var Alert = _interopDefault(require('@mui/material/Alert'));
@@ -36,13 +37,13 @@ var reactShare = require('react-share');
36
37
  var _some = _interopDefault(require('lodash/some'));
37
38
  var _find = _interopDefault(require('lodash/find'));
38
39
  var _isEmpty = _interopDefault(require('lodash/isEmpty'));
39
- var Button = _interopDefault(require('react-bootstrap/Button'));
40
+ var Button$1 = _interopDefault(require('react-bootstrap/Button'));
40
41
  var jwt_decode = _interopDefault(require('jwt-decode'));
41
42
  var _sortBy = _interopDefault(require('lodash/sortBy'));
42
43
  var _has = _interopDefault(require('lodash/has'));
43
44
  var FormControl = _interopDefault(require('@mui/material/FormControl'));
44
45
  var MenuItem = _interopDefault(require('@mui/material/MenuItem'));
45
- var Button$1 = _interopDefault(require('@mui/material/Button'));
46
+ var SVG = _interopDefault(require('react-inlinesvg'));
46
47
  var Table = _interopDefault(require('@mui/material/Table'));
47
48
  var TableBody = _interopDefault(require('@mui/material/TableBody'));
48
49
  var TableCell = _interopDefault(require('@mui/material/TableCell'));
@@ -931,6 +932,10 @@ var setConfigs = function setConfigs(configs) {
931
932
  });
932
933
 
933
934
  publicRequest.setBaseUrl(CONFIGS.BASE_URL);
935
+
936
+ if (CONFIGS.X_SOURCE_ORIGIN) {
937
+ setXSourceOrigin(CONFIGS.X_SOURCE_ORIGIN);
938
+ }
934
939
  };
935
940
 
936
941
  var getQueryVariable = function getQueryVariable(variable) {
@@ -989,9 +994,43 @@ var ErrorFocusInternal = /*#__PURE__*/function (_Component) {
989
994
 
990
995
  var ErrorFocus = /*#__PURE__*/formik.connect(ErrorFocusInternal);
991
996
 
997
+ var createCheckoutDataBodyWithDefaultHolder = function createCheckoutDataBodyWithDefaultHolder(ticketsQuantity, logedInValues) {
998
+ var ticket_holders = [];
999
+ var first_name = _get(logedInValues, 'firstName') || _get(logedInValues, 'first_name') || '';
1000
+ var last_name = _get(logedInValues, 'lastName', '') || _get(logedInValues, 'last_name') || '';
1001
+
1002
+ var phone = _get(logedInValues, 'phone', '');
1003
+
1004
+ var email = _get(logedInValues, 'email', '');
1005
+
1006
+ for (var i = 0; i <= ticketsQuantity - 1; i++) {
1007
+ var individualHolder = i ? {
1008
+ first_name: '',
1009
+ last_name: '',
1010
+ phone: '',
1011
+ email: ''
1012
+ } : {
1013
+ first_name: first_name,
1014
+ last_name: last_name,
1015
+ phone: phone,
1016
+ email: email
1017
+ };
1018
+ ticket_holders.push(individualHolder);
1019
+ }
1020
+
1021
+ var body = {
1022
+ attributes: _extends({}, logedInValues, {
1023
+ email: email,
1024
+ confirm_email: email,
1025
+ first_name: first_name,
1026
+ last_name: last_name,
1027
+ ticket_holders: ticket_holders
1028
+ })
1029
+ };
1030
+ return body;
1031
+ };
1032
+
992
1033
  var isWindowDefined = typeof window !== 'undefined';
993
- var discardedOrigins = ['http://localhost', 'gtsb.io', 'gatsbyjs.io', 'https://www.houseofx.nyc', 'https://tickets-staging.houseofx.nyc'];
994
- var origin = isWindowDefined && window.location.origin;
995
1034
  var ttfHeaders = {
996
1035
  Accept: 'application/vnd.api+json',
997
1036
  'Content-Type': 'application/vnd.api+json'
@@ -1001,12 +1040,6 @@ if (isWindowDefined && localStorage.getItem('auth_guest_token')) {
1001
1040
  ttfHeaders['Authorization-Guest'] = /*#__PURE__*/localStorage.getItem('auth_guest_token');
1002
1041
  }
1003
1042
 
1004
- if (isWindowDefined && !discardedOrigins.some(function (el) {
1005
- return origin && origin.includes(el);
1006
- })) {
1007
- ttfHeaders['X-Source-Origin'] = 'houseofx.nyc';
1008
- }
1009
-
1010
1043
  var publicRequest = /*#__PURE__*/axios.create({
1011
1044
  baseURL: CONFIGS.BASE_URL || "https://www.ticketfairy.com/api",
1012
1045
  headers: ttfHeaders
@@ -1049,11 +1082,9 @@ publicRequest.interceptors.request.use(function (config) {
1049
1082
  config.headers = _updatedHeaders;
1050
1083
  }
1051
1084
 
1052
- if (isWindowDefined && !discardedOrigins.some(function (el) {
1053
- return origin && origin.includes(el);
1054
- })) {
1085
+ if (CONFIGS.X_SOURCE_ORIGIN) {
1055
1086
  var _updatedHeaders2 = _extends({}, config.headers, {
1056
- 'X-Source-Origin': 'houseofx.nyc'
1087
+ 'X-Source-Origin': CONFIGS.X_SOURCE_ORIGIN
1057
1088
  });
1058
1089
 
1059
1090
  config.headers = _updatedHeaders2;
@@ -1078,6 +1109,9 @@ publicRequest.setAccessToken = function (token) {
1078
1109
  return publicRequest.defaults.headers.common.Authorization = token;
1079
1110
  };
1080
1111
 
1112
+ var setXSourceOrigin = function setXSourceOrigin(sourceOrigin) {
1113
+ ttfHeaders['X-Source-Origin'] = sourceOrigin;
1114
+ };
1081
1115
  var setCustomHeader = function setCustomHeader(response) {
1082
1116
  var guestHeaderResponseValue = _get(response, 'headers.authorization-guest');
1083
1117
 
@@ -1660,7 +1694,7 @@ var setLoggedUserData = function setLoggedUserData(data) {
1660
1694
  country: (data == null ? void 0 : data.country) || '',
1661
1695
  phone: (data == null ? void 0 : data.phone) || '',
1662
1696
  street_address: (data == null ? void 0 : data.streetAddress) || '',
1663
- state: (data == null ? void 0 : data.state) || '',
1697
+ state: (data == null ? void 0 : data.stateId) || '',
1664
1698
  zip: (data == null ? void 0 : data.zip) || (data == null ? void 0 : data.zipCode) || ''
1665
1699
  };
1666
1700
  };
@@ -1786,6 +1820,7 @@ var CustomField = function CustomField(_ref) {
1786
1820
  var error = _get(errors, field.name);
1787
1821
 
1788
1822
  var isTouched = Boolean(_get(touched, field.name)) || _includes(field.name, 'holder') && !!error && !!submitCount;
1823
+ var customTheme = styles.useTheme();
1789
1824
  return React__default.createElement(TextField, Object.assign({
1790
1825
  id: field.name,
1791
1826
  label: label,
@@ -1800,6 +1835,12 @@ var CustomField = function CustomField(_ref) {
1800
1835
  MenuProps: {
1801
1836
  className: theme
1802
1837
  }
1838
+ },
1839
+ InputLabelProps: {
1840
+ sx: customTheme.input
1841
+ },
1842
+ inputProps: {
1843
+ sx: customTheme.input
1803
1844
  }
1804
1845
  }, field), isSelectField ? _map(selectOptions, function (option) {
1805
1846
  return React__default.createElement("option", {
@@ -1816,9 +1857,13 @@ var CheckboxField = function CheckboxField(_ref) {
1816
1857
  field = _ref.field,
1817
1858
  rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
1818
1859
 
1860
+ var customTheme = styles.useTheme();
1819
1861
  return React__default.createElement(FormGroup, null, React__default.createElement(FormControlLabel, {
1820
1862
  control: React__default.createElement(Checkbox, Object.assign({}, field, rest)),
1821
- label: label
1863
+ label: label,
1864
+ componentsProps: {
1865
+ typography: customTheme.checkbox
1866
+ }
1822
1867
  }));
1823
1868
  };
1824
1869
 
@@ -1837,9 +1882,11 @@ var SelectField = function SelectField(_ref) {
1837
1882
 
1838
1883
  var error = _get(errors, field.name);
1839
1884
 
1885
+ var customTheme = styles.useTheme();
1840
1886
  return React__default.createElement(material.FormControl, {
1841
1887
  fullWidth: true
1842
1888
  }, React__default.createElement(material.InputLabel, {
1889
+ style: customTheme.input,
1843
1890
  htmlFor: field.name,
1844
1891
  error: !!error && isTouched,
1845
1892
  shrink: true
@@ -1857,7 +1904,9 @@ var SelectField = function SelectField(_ref) {
1857
1904
  MenuProps: {
1858
1905
  className: theme
1859
1906
  }
1860
- }, field), _map(selectOptions, function (option) {
1907
+ }, field, {
1908
+ style: customTheme.input
1909
+ }), _map(selectOptions, function (option) {
1861
1910
  return React__default.createElement("option", {
1862
1911
  key: option.value,
1863
1912
  value: option.value,
@@ -1955,6 +2004,7 @@ var FormikPhoneNumberField = function FormikPhoneNumberField(_ref) {
1955
2004
  var error = _get(errors, field.name);
1956
2005
 
1957
2006
  var isTouched = Boolean(_get(touched, field.name));
2007
+ var customTheme = styles.useTheme();
1958
2008
  return React__default.createElement(MuiPhoneNumber, Object.assign({
1959
2009
  name: 'phone',
1960
2010
  onChange: function onChange(e) {
@@ -1967,26 +2017,16 @@ var FormikPhoneNumberField = function FormikPhoneNumberField(_ref) {
1967
2017
  error: !!error && isTouched,
1968
2018
  helperText: isTouched && error,
1969
2019
  fullWidth: true,
2020
+ InputLabelProps: {
2021
+ sx: customTheme.input
2022
+ },
2023
+ InputProps: {
2024
+ sx: customTheme.input
2025
+ },
1970
2026
  autoFormat: false
1971
2027
  }, rest));
1972
2028
  };
1973
2029
 
1974
- var getImage = function getImage(name) {
1975
- if (name === void 0) {
1976
- name = '';
1977
- }
1978
-
1979
- var image = '';
1980
-
1981
- if (!name.trim().length) {
1982
- return image;
1983
- }
1984
-
1985
- return image;
1986
- };
1987
-
1988
- var TTFLOGO = /*#__PURE__*/getImage('logo-ttf.png');
1989
-
1990
2030
  var LogicRunner = function LogicRunner(_ref) {
1991
2031
  var values = _ref.values,
1992
2032
  setStates = _ref.setStates,
@@ -1995,10 +2035,11 @@ var LogicRunner = function LogicRunner(_ref) {
1995
2035
  setUserValues = _ref.setUserValues,
1996
2036
  onGetStatesSuccess = _ref.onGetStatesSuccess,
1997
2037
  onGetStatesError = _ref.onGetStatesError;
2038
+ var prevCountry = React.useRef(values.country);
1998
2039
  React.useEffect(function () {
1999
2040
  var fetchStates = /*#__PURE__*/function () {
2000
2041
  var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
2001
- var _mappedStates$0$value, _mappedStates$, res, mappedStates;
2042
+ var res, mappedStates, _mappedStates$0$value, _mappedStates$;
2002
2043
 
2003
2044
  return runtime_1.wrap(function _callee$(_context) {
2004
2045
  while (1) {
@@ -2017,7 +2058,12 @@ var LogicRunner = function LogicRunner(_ref) {
2017
2058
  };
2018
2059
  });
2019
2060
  setStates(mappedStates);
2020
- setFieldValue('state', (_mappedStates$0$value = (_mappedStates$ = mappedStates[0]) == null ? void 0 : _mappedStates$.value) != null ? _mappedStates$0$value : '');
2061
+
2062
+ if (prevCountry.current !== values.country) {
2063
+ setFieldValue('state', (_mappedStates$0$value = (_mappedStates$ = mappedStates[0]) == null ? void 0 : _mappedStates$.value) != null ? _mappedStates$0$value : '');
2064
+ prevCountry.current = values.country;
2065
+ }
2066
+
2021
2067
  onGetStatesSuccess(res.data);
2022
2068
  _context.next = 13;
2023
2069
  break;
@@ -2055,13 +2101,13 @@ var LogicRunner = function LogicRunner(_ref) {
2055
2101
  var parsedData = JSON.parse(userDataEncoded);
2056
2102
  var mappedValues = {
2057
2103
  firstName: (parsedData == null ? void 0 : parsedData.first_name) || '',
2058
- lastName: parsedData == null ? void 0 : parsedData.last_name,
2104
+ lastName: (parsedData == null ? void 0 : parsedData.last_name) || '',
2059
2105
  email: (parsedData == null ? void 0 : parsedData.email) || '',
2060
2106
  phone: (parsedData == null ? void 0 : parsedData.phone) || '',
2061
2107
  confirmEmail: (parsedData == null ? void 0 : parsedData.email) || '',
2062
2108
  state: (parsedData == null ? void 0 : parsedData.state) || '',
2063
2109
  street_address: (parsedData == null ? void 0 : parsedData.street_address) || '',
2064
- country: (parsedData == null ? void 0 : parsedData.country) || 1,
2110
+ country: (parsedData == null ? void 0 : parsedData.country) || "1",
2065
2111
  zip: (parsedData == null ? void 0 : parsedData.zip) || '',
2066
2112
  brand_opt_in: (parsedData == null ? void 0 : parsedData.brand_opt_in) || '',
2067
2113
  city: (parsedData == null ? void 0 : parsedData.city) || '',
@@ -2125,20 +2171,16 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2125
2171
  onAuthorizeSuccess = _ref3$onAuthorizeSucc === void 0 ? function () {} : _ref3$onAuthorizeSucc,
2126
2172
  _ref3$onAuthorizeErro = _ref3.onAuthorizeError,
2127
2173
  onAuthorizeError = _ref3$onAuthorizeErro === void 0 ? function () {} : _ref3$onAuthorizeErro,
2128
- _ref3$onLogin = _ref3.onLogin,
2129
- onLogin = _ref3$onLogin === void 0 ? function () {} : _ref3$onLogin,
2174
+ onLogin = _ref3.onLogin,
2130
2175
  _ref3$onLoginSuccess = _ref3.onLoginSuccess,
2131
2176
  onLoginSuccess = _ref3$onLoginSuccess === void 0 ? function () {} : _ref3$onLoginSuccess,
2132
2177
  _ref3$isLoggedIn = _ref3.isLoggedIn,
2133
2178
  pIsLoggedIn = _ref3$isLoggedIn === void 0 ? false : _ref3$isLoggedIn,
2134
- fontFamily = _ref3.fontFamily;
2135
- var themeMui = styles.createTheme({
2136
- typography: {
2137
- allVariants: {
2138
- fontFamily: fontFamily
2139
- }
2140
- }
2141
- });
2179
+ _ref3$accountInfoTitl = _ref3.accountInfoTitle,
2180
+ accountInfoTitle = _ref3$accountInfoTitl === void 0 ? '' : _ref3$accountInfoTitl,
2181
+ hideLogo = _ref3.hideLogo,
2182
+ themeOptions = _ref3.themeOptions;
2183
+ var themeMui = styles$1.createTheme(themeOptions);
2142
2184
  var isWindowDefined = typeof window !== 'undefined';
2143
2185
  var userData = isWindowDefined && window.localStorage.getItem('user_data') ? JSON.parse(window.localStorage.getItem('user_data') || '') : {};
2144
2186
  var access_token = isWindowDefined && window.localStorage.getItem('access_token') ? window.localStorage.getItem('access_token') || '' : '';
@@ -2234,9 +2276,9 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2234
2276
  setIsLoggedIn(false);
2235
2277
  }, []);
2236
2278
  React.useEffect(function () {
2237
- isWindowDefined && window.document.addEventListener("auth_error", handleAuthErrors);
2279
+ isWindowDefined && window.document.addEventListener('auth_error', handleAuthErrors);
2238
2280
  return function () {
2239
- isWindowDefined && window.document.removeEventListener("auth_error", handleAuthErrors);
2281
+ isWindowDefined && window.document.removeEventListener('auth_error', handleAuthErrors);
2240
2282
  };
2241
2283
  }, [handleAuthErrors]);
2242
2284
  React.useEffect(function () {
@@ -2264,7 +2306,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2264
2306
  setCountries(_map(_get(res, 'data.data'), function (item, key) {
2265
2307
  return {
2266
2308
  label: item,
2267
- value: Number(key)
2309
+ value: key
2268
2310
  };
2269
2311
  }));
2270
2312
  onGetCountriesSuccess(res.data);
@@ -2364,7 +2406,10 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2364
2406
  userDataResponse = _context4.sent;
2365
2407
  profileSpecifiedData = _get(userDataResponse, 'data.data');
2366
2408
  profileDataObj = setLoggedUserData(profileSpecifiedData);
2367
- setUserValues(profileDataObj);
2409
+ setUserValues(_extends({}, profileDataObj, {
2410
+ firstName: profileDataObj.first_name,
2411
+ lastName: profileDataObj.last_name
2412
+ }));
2368
2413
  window.localStorage.setItem('user_data', JSON.stringify(profileDataObj));
2369
2414
  onGetProfileDataSuccess(userDataResponse.data);
2370
2415
 
@@ -2396,13 +2441,12 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2396
2441
  React.useEffect(function () {
2397
2442
  fetchUserData(access_token);
2398
2443
  }, [access_token]);
2399
- return React__default.createElement(styles.ThemeProvider, {
2444
+ return React__default.createElement(styles$1.ThemeProvider, {
2400
2445
  theme: themeMui
2401
2446
  }, React__default.createElement(formik.Formik, {
2402
2447
  initialValues: getInitialValues(dataWithUniqueIds, _extends({}, initialValues, {
2403
- firstName: firstNameLogged,
2404
- lastName: lastNameLogged,
2405
- country: 1,
2448
+ country: _get(userData, 'country', '') || "1",
2449
+ state: _get(userData, 'state', '') || "1",
2406
2450
  brand_opt_in: optedInFieldValue
2407
2451
  }), userValues),
2408
2452
  enableReinitialize: true,
@@ -2493,12 +2537,13 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2493
2537
  formikHelpers.setFieldError('confirmPassword', error.password);
2494
2538
  }
2495
2539
 
2496
- if (error != null && error.email) {
2540
+ if (error != null && error.email && !onLogin) {
2541
+ // False will stand for outside controll
2497
2542
  setAlreadyHasUser(true);
2498
2543
  setShowModalLogin(true);
2499
2544
  }
2500
2545
 
2501
- onRegisterError(_context5.t0);
2546
+ onRegisterError(_context5.t0, values.email);
2502
2547
  }
2503
2548
 
2504
2549
  return _context5.abrupt("return");
@@ -2576,19 +2621,23 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2576
2621
  className: "billing-info-container " + theme
2577
2622
  }, !isLoggedIn && React__default.createElement("div", {
2578
2623
  className: "account-actions-block"
2579
- }, React__default.createElement("div", null, "Got a ", React__default.createElement("strong", null, "TICKET"), "FAIRY account?"), React__default.createElement("div", null, "Login & skip ahead:"), React__default.createElement("div", {
2624
+ }, React__default.createElement("div", null, accountInfoTitle), React__default.createElement("div", null, "Login & skip ahead:"), React__default.createElement("div", {
2580
2625
  className: "login-block"
2581
2626
  }, React__default.createElement("button", {
2582
2627
  className: "login-register-button",
2583
2628
  type: "button",
2584
2629
  onClick: function onClick() {
2585
- onLogin();
2586
- setShowModalLogin(true);
2630
+ // If outside login needed to skip package login functionallity
2631
+ if (onLogin) {
2632
+ onLogin();
2633
+ } else {
2634
+ setShowModalLogin(true);
2635
+ }
2587
2636
  }
2588
- }, "Login"), React__default.createElement("div", {
2637
+ }, "Login"), !hideLogo && React__default.createElement("div", {
2589
2638
  className: "logo-image-container"
2590
2639
  }, React__default.createElement("img", {
2591
- src: TTFLOGO,
2640
+ src: theme === 'dark' ? 'https://www.ticketfairy.com/resources/images/logo-ttf.svg' : 'https://www.ticketfairy.com/resources/images/logo-ttf-black.svg',
2592
2641
  alt: "nodata"
2593
2642
  })))), _map(dataWithUniqueIds, function (item) {
2594
2643
  var label = item.label,
@@ -2661,17 +2710,14 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2661
2710
  }));
2662
2711
  })), React__default.createElement("div", {
2663
2712
  className: "button-container"
2664
- }, React__default.createElement(LoadingButton, {
2713
+ }, React__default.createElement(Button, {
2665
2714
  type: "submit",
2666
2715
  variant: "contained",
2667
2716
  className: "login-register-button",
2668
- loadingIndicator: React__default.createElement(material.CircularProgress, {
2669
- color: "inherit",
2670
- size: 26
2671
- }),
2672
- loading: props.isSubmitting,
2673
2717
  disabled: props.isSubmitting
2674
- }, buttonName))));
2718
+ }, props.isSubmitting ? React__default.createElement(material.CircularProgress, {
2719
+ size: 26
2720
+ }) : buttonName))));
2675
2721
  }), showModalLogin && React__default.createElement(LoginModal, {
2676
2722
  onClose: function onClose() {
2677
2723
  setShowModalLogin(false);
@@ -2735,7 +2781,8 @@ var CheckoutForm = function CheckoutForm(_ref) {
2735
2781
  _ref$handleSetLoading = _ref.handleSetLoading,
2736
2782
  handleSetLoading = _ref$handleSetLoading === void 0 ? function () {} : _ref$handleSetLoading,
2737
2783
  _ref$conditions = _ref.conditions,
2738
- conditions = _ref$conditions === void 0 ? [] : _ref$conditions;
2784
+ conditions = _ref$conditions === void 0 ? [] : _ref$conditions,
2785
+ disableZipSection = _ref.disableZipSection;
2739
2786
  var stripe = reactStripeJs.useStripe();
2740
2787
  var elements = reactStripeJs.useElements();
2741
2788
 
@@ -2767,7 +2814,7 @@ var CheckoutForm = function CheckoutForm(_ref) {
2767
2814
  _context.prev = 1;
2768
2815
  event.preventDefault();
2769
2816
 
2770
- if (postalCode) {
2817
+ if (!(!postalCode && !disableZipSection)) {
2771
2818
  _context.next = 7;
2772
2819
  break;
2773
2820
  }
@@ -2792,10 +2839,14 @@ var CheckoutForm = function CheckoutForm(_ref) {
2792
2839
  address = {
2793
2840
  city: billing_info.city,
2794
2841
  line1: billing_info.street_address,
2795
- state: billing_info.state,
2796
- postal_code: postalCode
2842
+ state: billing_info.state
2797
2843
  };
2798
- _context.next = 14;
2844
+
2845
+ if (!disableZipSection) {
2846
+ address.postal_code = postalCode;
2847
+ }
2848
+
2849
+ _context.next = 15;
2799
2850
  return stripe.createPaymentMethod({
2800
2851
  type: 'card',
2801
2852
  card: card || {
@@ -2806,11 +2857,11 @@ var CheckoutForm = function CheckoutForm(_ref) {
2806
2857
  }
2807
2858
  });
2808
2859
 
2809
- case 14:
2860
+ case 15:
2810
2861
  paymentMethodReq = _context.sent;
2811
2862
 
2812
2863
  if (!paymentMethodReq.error) {
2813
- _context.next = 19;
2864
+ _context.next = 20;
2814
2865
  break;
2815
2866
  }
2816
2867
 
@@ -2818,18 +2869,18 @@ var CheckoutForm = function CheckoutForm(_ref) {
2818
2869
  handleSetLoading(false);
2819
2870
  return _context.abrupt("return");
2820
2871
 
2821
- case 19:
2822
- _context.next = 21;
2872
+ case 20:
2873
+ _context.next = 22;
2823
2874
  return stripe.confirmCardPayment(stripe_client_secret, {
2824
2875
  payment_method: paymentMethodReq.paymentMethod.id
2825
2876
  });
2826
2877
 
2827
- case 21:
2878
+ case 22:
2828
2879
  _yield$stripe$confirm = _context.sent;
2829
2880
  _error = _yield$stripe$confirm.error;
2830
2881
 
2831
2882
  if (!_error) {
2832
- _context.next = 27;
2883
+ _context.next = 28;
2833
2884
  break;
2834
2885
  }
2835
2886
 
@@ -2837,22 +2888,22 @@ var CheckoutForm = function CheckoutForm(_ref) {
2837
2888
  handleSetLoading(false);
2838
2889
  return _context.abrupt("return");
2839
2890
 
2840
- case 27:
2891
+ case 28:
2841
2892
  onSubmit(null);
2842
- _context.next = 33;
2893
+ _context.next = 34;
2843
2894
  break;
2844
2895
 
2845
- case 30:
2846
- _context.prev = 30;
2896
+ case 31:
2897
+ _context.prev = 31;
2847
2898
  _context.t0 = _context["catch"](1);
2848
2899
  onSubmit(_context.t0);
2849
2900
 
2850
- case 33:
2901
+ case 34:
2851
2902
  case "end":
2852
2903
  return _context.stop();
2853
2904
  }
2854
2905
  }
2855
- }, _callee, null, [[1, 30]]);
2906
+ }, _callee, null, [[1, 31]]);
2856
2907
  }));
2857
2908
 
2858
2909
  return function handleSubmit(_x) {
@@ -2913,7 +2964,7 @@ var CheckoutForm = function CheckoutForm(_ref) {
2913
2964
  }, React__default.createElement("span", {
2914
2965
  className: "card_label_text"
2915
2966
  }, "Card number"), React__default.createElement(reactStripeJs.CardNumberElement, {
2916
- options: _extends({}, options, stripeCardOptions),
2967
+ options: _extends({}, options.style, stripeCardOptions),
2917
2968
  onReady: _identity,
2918
2969
  onChange: _identity,
2919
2970
  onBlur: _identity,
@@ -2923,14 +2974,14 @@ var CheckoutForm = function CheckoutForm(_ref) {
2923
2974
  }, React__default.createElement("span", {
2924
2975
  className: "card_label_text"
2925
2976
  }, "Expiration date"), React__default.createElement(reactStripeJs.CardExpiryElement, {
2926
- options: _extends({}, options, stripeCardOptions)
2977
+ options: _extends({}, options.style, stripeCardOptions)
2927
2978
  })), React__default.createElement("label", {
2928
2979
  className: "cvc_element"
2929
2980
  }, React__default.createElement("span", {
2930
2981
  className: "card_label_text"
2931
2982
  }, "CVC"), React__default.createElement(reactStripeJs.CardCvcElement, {
2932
- options: _extends({}, options, stripeCardOptions)
2933
- })), React__default.createElement("label", {
2983
+ options: _extends({}, options.style, stripeCardOptions)
2984
+ })), !disableZipSection && React__default.createElement("label", {
2934
2985
  className: "zip_element"
2935
2986
  }, React__default.createElement("p", {
2936
2987
  className: "card_label_text"
@@ -2957,17 +3008,25 @@ var CheckoutForm = function CheckoutForm(_ref) {
2957
3008
  }, React__default.createElement("button", {
2958
3009
  disabled: buttonIsDiabled,
2959
3010
  type: "submit"
2960
- }, isLoading ? React__default.createElement(CircularProgress, null) : "Pay " + getCurrencySymbolByCurrency(currency) + total))));
3011
+ }, isLoading ? React__default.createElement(CircularProgress, {
3012
+ size: 26
3013
+ }) : "Pay " + getCurrencySymbolByCurrency(currency) + total))));
2961
3014
  };
2962
3015
 
2963
3016
  var publishableKey = CONFIGS.STRIPE_PUBLISHABLE_KEY || '';
2964
3017
 
2965
- var getStripePromise = function getStripePromise(stripePublishableKey) {
2966
- if (stripePublishableKey === void 0) {
2967
- stripePublishableKey = publishableKey;
3018
+ var getStripePromise = function getStripePromise(reviewData) {
3019
+ var stripePublishableKey = _get(reviewData, 'payment_method.stripe_publishable_key') || publishableKey;
3020
+
3021
+ var stripeAccount = _get(reviewData, 'payment_method.stripe_connected_account');
3022
+
3023
+ var options = {};
3024
+
3025
+ if (stripeAccount) {
3026
+ options.stripeAccount = stripeAccount;
2968
3027
  }
2969
3028
 
2970
- return stripeJs.loadStripe(stripePublishableKey);
3029
+ return stripeJs.loadStripe(stripePublishableKey, options);
2971
3030
  };
2972
3031
 
2973
3032
  function Loader() {
@@ -3011,7 +3070,9 @@ var PaymentContainer = function PaymentContainer(_ref) {
3011
3070
  onPaymentError = _ref$onPaymentError === void 0 ? function () {} : _ref$onPaymentError,
3012
3071
  _ref$stripeCardOption = _ref.stripeCardOptions,
3013
3072
  stripeCardOptions = _ref$stripeCardOption === void 0 ? {} : _ref$stripeCardOption,
3014
- fontFamily = _ref.fontFamily;
3073
+ _ref$disableZipSectio = _ref.disableZipSection,
3074
+ disableZipSection = _ref$disableZipSectio === void 0 ? false : _ref$disableZipSectio,
3075
+ themeOptions = _ref.themeOptions;
3015
3076
 
3016
3077
  var _useState = React.useState(initialReviewValues),
3017
3078
  reviewData = _useState[0],
@@ -3195,14 +3256,8 @@ var PaymentContainer = function PaymentContainer(_ref) {
3195
3256
  };
3196
3257
  }();
3197
3258
 
3198
- var themeMui = styles.createTheme({
3199
- typography: {
3200
- allVariants: {
3201
- fontFamily: fontFamily
3202
- }
3203
- }
3204
- });
3205
- return React__default.createElement(styles.ThemeProvider, {
3259
+ var themeMui = styles$1.createTheme(themeOptions);
3260
+ return React__default.createElement(styles$1.ThemeProvider, {
3206
3261
  theme: themeMui
3207
3262
  }, React__default.createElement("div", {
3208
3263
  className: "payment_page"
@@ -3238,7 +3293,7 @@ var PaymentContainer = function PaymentContainer(_ref) {
3238
3293
  }, "Please provide your payment information"), showErrorText && React__default.createElement("p", {
3239
3294
  className: "payment_info__error"
3240
3295
  }, errorText), React__default.createElement("div", null, React__default.createElement(reactStripeJs.Elements, {
3241
- stripe: getStripePromise(_get(reviewData, 'payment_method.stripe_publishable_key'))
3296
+ stripe: getStripePromise(reviewData)
3242
3297
  }, React__default.createElement(CheckoutForm, {
3243
3298
  stripe_client_secret: _get(reviewData, 'payment_method.stripe_client_secret'),
3244
3299
  total: orderData.total,
@@ -3251,7 +3306,8 @@ var PaymentContainer = function PaymentContainer(_ref) {
3251
3306
  return setPaymentIsLoading(value);
3252
3307
  },
3253
3308
  conditions: conditions,
3254
- stripeCardOptions: stripeCardOptions
3309
+ stripeCardOptions: stripeCardOptions,
3310
+ disableZipSection: disableZipSection
3255
3311
  })))))));
3256
3312
  };
3257
3313
 
@@ -3425,7 +3481,8 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
3425
3481
  _ref$onGetConfirmatio = _ref.onGetConfirmationDataSuccess,
3426
3482
  onGetConfirmationDataSuccess = _ref$onGetConfirmatio === void 0 ? function () {} : _ref$onGetConfirmatio,
3427
3483
  _ref$onGetConfirmatio2 = _ref.onGetConfirmationDataError,
3428
- onGetConfirmationDataError = _ref$onGetConfirmatio2 === void 0 ? function () {} : _ref$onGetConfirmatio2;
3484
+ onGetConfirmationDataError = _ref$onGetConfirmatio2 === void 0 ? function () {} : _ref$onGetConfirmatio2,
3485
+ orderHash = _ref.orderHash;
3429
3486
  var inputRef = React.useRef(null);
3430
3487
 
3431
3488
  var _useState = React.useState(null),
@@ -3441,15 +3498,17 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
3441
3498
  while (1) {
3442
3499
  switch (_context.prev = _context.next) {
3443
3500
  case 0:
3444
- dataEncoded = typeof window !== 'undefined' && window.localStorage.getItem('checkoutData');
3501
+ dataEncoded = typeof window !== 'undefined' && window.localStorage.getItem('checkoutData') || '';
3502
+ dataDecoded = dataEncoded ? JSON.parse(dataEncoded) : {
3503
+ hash: orderHash
3504
+ };
3505
+ hash = dataDecoded.hash;
3445
3506
 
3446
- if (!dataEncoded) {
3507
+ if (!hash) {
3447
3508
  _context.next = 18;
3448
3509
  break;
3449
3510
  }
3450
3511
 
3451
- dataDecoded = JSON.parse(dataEncoded);
3452
- hash = dataDecoded.hash;
3453
3512
  _context.prev = 4;
3454
3513
  _context.next = 7;
3455
3514
  return getConfirmationData(hash);
@@ -3559,13 +3618,13 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
3559
3618
  value: data.personal_share_link,
3560
3619
  onChange: onChangeShareLink
3561
3620
  }), React__default.createElement("div", {
3562
- className: 'share-by-link-copy-icon',
3621
+ className: "share-by-link-copy-icon",
3563
3622
  onClick: function onClick() {
3564
3623
  return navigator.clipboard.writeText(_get(inputRef, 'current.value'));
3565
3624
  }
3566
3625
  }, React__default.createElement("img", {
3567
3626
  src: "https://img.icons8.com/office/50/000000/copy.png",
3568
- alt: 'copy'
3627
+ alt: "copy"
3569
3628
  })))), (showDefaultShareButtons || !!shareButtons.length) && React__default.createElement(SocialButtons, {
3570
3629
  showDefaultShareButtons: showDefaultShareButtons,
3571
3630
  name: data.product_name,
@@ -3579,7 +3638,7 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
3579
3638
  }, "How much cheaper?"), _map(data.personal_share_sales, function (pricing, index) {
3580
3639
  return React__default.createElement("div", {
3581
3640
  key: index,
3582
- className: 'pricing-section_wrapper'
3641
+ className: "pricing-section_wrapper"
3583
3642
  }, React__default.createElement("div", {
3584
3643
  className: "pricing-section_label"
3585
3644
  }, pricing.label, pricing.subLabel && React__default.createElement("div", {
@@ -3742,7 +3801,8 @@ var generateQuantity = function generateQuantity(n) {
3742
3801
  var WaitingList = function WaitingList(_ref) {
3743
3802
  var _ref$tickets = _ref.tickets,
3744
3803
  tickets = _ref$tickets === void 0 ? {} : _ref$tickets,
3745
- eventId = _ref.eventId;
3804
+ eventId = _ref.eventId,
3805
+ isPromotionsEnabled = _ref.isPromotionsEnabled;
3746
3806
 
3747
3807
  var _useState = React.useState(false),
3748
3808
  showSuccessMessage = _useState[0],
@@ -3817,7 +3877,7 @@ var WaitingList = function WaitingList(_ref) {
3817
3877
  className: "success-message"
3818
3878
  }, React__default.createElement("p", {
3819
3879
  className: "added-success-message"
3820
- }, "You've been added to the waiting list!"), React__default.createElement("p", null, "You'll be notified if tickets become available.")) : React__default.createElement(React__default.Fragment, null, React__default.createElement("p", {
3880
+ }, "You've been added to the waiting list!"), React__default.createElement("p", null, "You'll be notified if tickets become available.")) : React__default.createElement(React__default.Fragment, null, !isPromotionsEnabled && React__default.createElement("p", {
3821
3881
  className: "no-tickets-text"
3822
3882
  }, "No tickets are currently available for this event."), React__default.createElement("h2", null, "WAITING LIST"), React__default.createElement(formik.Formik, {
3823
3883
  initialValues: {
@@ -3881,7 +3941,7 @@ var WaitingList = function WaitingList(_ref) {
3881
3941
  return emailValidator(value);
3882
3942
  }),
3883
3943
  component: CustomField
3884
- })), React__default.createElement(Button$1, {
3944
+ })), React__default.createElement(Button, {
3885
3945
  type: "submit",
3886
3946
  variant: "contained",
3887
3947
  className: "waiting-list-button"
@@ -3890,6 +3950,65 @@ var WaitingList = function WaitingList(_ref) {
3890
3950
  }) : 'ADD TO WAITING LIST')))));
3891
3951
  };
3892
3952
 
3953
+ var getImage = function getImage(name) {
3954
+ if (name === void 0) {
3955
+ name = '';
3956
+ }
3957
+
3958
+ var image = '';
3959
+
3960
+ if (!name.trim().length) {
3961
+ return image;
3962
+ }
3963
+
3964
+ return image;
3965
+ };
3966
+
3967
+ var PromoCodeSection = function PromoCodeSection(_ref) {
3968
+ var promoCode = _ref.promoCode,
3969
+ promoCodeIsApplied = _ref.promoCodeIsApplied,
3970
+ showPromoInput = _ref.showPromoInput,
3971
+ isPromotionsEnabled = _ref.isPromotionsEnabled,
3972
+ isAllTicketsSoldOut = _ref.isAllTicketsSoldOut,
3973
+ setPromoCode = _ref.setPromoCode,
3974
+ setPromoCodeUpdated = _ref.setPromoCodeUpdated,
3975
+ setShowPromoInput = _ref.setShowPromoInput;
3976
+ return React__default.createElement("div", null, promoCodeIsApplied ? React__default.createElement("div", {
3977
+ className: "alert-info"
3978
+ }, React__default.createElement(SVG, {
3979
+ src: getImage('done.svg'),
3980
+ preProcessor: function preProcessor(code) {
3981
+ return code.replace(/fill=".*?"/g, 'fill="currentColor"');
3982
+ }
3983
+ }), React__default.createElement("p", null, "PROMO CODE APPLIED SUCCESSFULLY")) : null, showPromoInput && React__default.createElement("div", {
3984
+ className: "promo-code-block"
3985
+ }, React__default.createElement("input", {
3986
+ placeholder: "Promo Code",
3987
+ onChange: function onChange(e) {
3988
+ setPromoCode(e.target.value);
3989
+ },
3990
+ onKeyPress: function onKeyPress(event) {
3991
+ if (event.key === 'Enter') {
3992
+ setPromoCodeUpdated(promoCode);
3993
+ }
3994
+ }
3995
+ }), React__default.createElement(Button$1, {
3996
+ className: "promo-apply-button",
3997
+ placeholder: "Promo Code",
3998
+ onClick: function onClick() {
3999
+ setPromoCodeUpdated(promoCode);
4000
+ }
4001
+ }, "Apply")), isPromotionsEnabled && !showPromoInput && isAllTicketsSoldOut && React__default.createElement("p", {
4002
+ className: "promo-code-text"
4003
+ }, "Access code needed"), isPromotionsEnabled && !showPromoInput ? React__default.createElement(Button$1, {
4004
+ className: "promo-code-button",
4005
+ placeholder: "Promo Codes",
4006
+ onClick: function onClick() {
4007
+ setShowPromoInput(true);
4008
+ }
4009
+ }, "Got a promo code? Click here") : null);
4010
+ };
4011
+
3893
4012
  function Loader$1() {
3894
4013
  return React__default.createElement("div", {
3895
4014
  className: "loader-container"
@@ -3911,7 +4030,9 @@ var TicketsContainer = function TicketsContainer(_ref) {
3911
4030
  _ref$theme = _ref.theme,
3912
4031
  theme = _ref$theme === void 0 ? 'light' : _ref$theme,
3913
4032
  _ref$queryPromoCode = _ref.queryPromoCode,
3914
- queryPromoCode = _ref$queryPromoCode === void 0 ? '' : _ref$queryPromoCode;
4033
+ queryPromoCode = _ref$queryPromoCode === void 0 ? '' : _ref$queryPromoCode,
4034
+ _ref$isPromotionsEnab = _ref.isPromotionsEnabled,
4035
+ isPromotionsEnabled = _ref$isPromotionsEnab === void 0 ? true : _ref$isPromotionsEnab;
3915
4036
 
3916
4037
  var _useState = React.useState({}),
3917
4038
  selectedTickets = _useState[0],
@@ -4037,7 +4158,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
4037
4158
  var _ref3 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
4038
4159
  var _product_options, _product_options2, _ticket_types;
4039
4160
 
4040
- var ticket, optionName, ticketId, ticketQuantity, data, result, _result$data$data$att, _result$data, _result$data$data, _result$data$data$att2, _result$data$data$att3, _result$data2, _result$data2$data, _result$data2$data$at, _result$data$data$att4, _result$data3, _result$data3$data, _result$data3$data$at;
4161
+ var ticket, optionName, ticketId, ticketQuantity, data, result, _result$data$data$att, _result$data, _result$data$data, _result$data$data$att2, _result$data$data$att3, _result$data2, _result$data2$data, _result$data2$data$at, _result$data$data$att4, _result$data3, _result$data3$data, _result$data3$data$at, skipBillingPage, nameIsRequired, ageIsRequired, hash, isWindowDefined, userData, access_token, ticketsQuantity, checkoutBody, checkoutResult;
4041
4162
 
4042
4163
  return runtime_1.wrap(function _callee2$(_context2) {
4043
4164
  while (1) {
@@ -4069,38 +4190,67 @@ var TicketsContainer = function TicketsContainer(_ref) {
4069
4190
  case 9:
4070
4191
  result = _context2.sent;
4071
4192
 
4072
- if (result.status === 200) {
4073
- setCustomHeader(result);
4074
- onAddToCartSuccess({
4075
- skip_billing_page: (_result$data$data$att = result == null ? void 0 : (_result$data = result.data) == null ? void 0 : (_result$data$data = _result$data.data) == null ? void 0 : (_result$data$data$att2 = _result$data$data.attributes) == null ? void 0 : _result$data$data$att2.skip_billing_page) != null ? _result$data$data$att : false,
4076
- names_required: (_result$data$data$att3 = result == null ? void 0 : (_result$data2 = result.data) == null ? void 0 : (_result$data2$data = _result$data2.data) == null ? void 0 : (_result$data2$data$at = _result$data2$data.attributes) == null ? void 0 : _result$data2$data$at.names_required) != null ? _result$data$data$att3 : false,
4077
- age_required: (_result$data$data$att4 = result == null ? void 0 : (_result$data3 = result.data) == null ? void 0 : (_result$data3$data = _result$data3.data) == null ? void 0 : (_result$data3$data$at = _result$data3$data.attributes) == null ? void 0 : _result$data3$data$at.age_required) != null ? _result$data$data$att4 : false,
4078
- event_id: String(eventId)
4079
- });
4193
+ if (!(result.status === 200)) {
4194
+ _context2.next = 27;
4195
+ break;
4080
4196
  }
4081
4197
 
4082
- _context2.next = 16;
4198
+ setCustomHeader(result);
4199
+ skipBillingPage = (_result$data$data$att = result == null ? void 0 : (_result$data = result.data) == null ? void 0 : (_result$data$data = _result$data.data) == null ? void 0 : (_result$data$data$att2 = _result$data$data.attributes) == null ? void 0 : _result$data$data$att2.skip_billing_page) != null ? _result$data$data$att : false;
4200
+ nameIsRequired = (_result$data$data$att3 = result == null ? void 0 : (_result$data2 = result.data) == null ? void 0 : (_result$data2$data = _result$data2.data) == null ? void 0 : (_result$data2$data$at = _result$data2$data.attributes) == null ? void 0 : _result$data2$data$at.names_required) != null ? _result$data$data$att3 : false;
4201
+ ageIsRequired = (_result$data$data$att4 = result == null ? void 0 : (_result$data3 = result.data) == null ? void 0 : (_result$data3$data = _result$data3.data) == null ? void 0 : (_result$data3$data$at = _result$data3$data.attributes) == null ? void 0 : _result$data3$data$at.age_required) != null ? _result$data$data$att4 : false;
4202
+ hash = '';
4203
+
4204
+ if (!skipBillingPage) {
4205
+ _context2.next = 26;
4206
+ break;
4207
+ }
4208
+
4209
+ // Get user data for checkout data
4210
+ isWindowDefined = typeof window !== 'undefined';
4211
+ userData = isWindowDefined && window.localStorage.getItem('user_data') ? JSON.parse(window.localStorage.getItem('user_data') || '') : {};
4212
+ access_token = isWindowDefined && window.localStorage.getItem('access_token') ? window.localStorage.getItem('access_token') || '' : '';
4213
+ ticketsQuantity = Object.keys(selectedTickets).length;
4214
+ checkoutBody = createCheckoutDataBodyWithDefaultHolder(ticketsQuantity, userData);
4215
+ _context2.next = 24;
4216
+ return postOnCheckout(checkoutBody, access_token);
4217
+
4218
+ case 24:
4219
+ checkoutResult = _context2.sent;
4220
+ hash = _get(checkoutResult, 'data.data.attributes.hash');
4221
+
4222
+ case 26:
4223
+ onAddToCartSuccess({
4224
+ skip_billing_page: skipBillingPage,
4225
+ names_required: nameIsRequired,
4226
+ age_required: ageIsRequired,
4227
+ event_id: String(eventId),
4228
+ hash: hash
4229
+ });
4230
+
4231
+ case 27:
4232
+ _context2.next = 32;
4083
4233
  break;
4084
4234
 
4085
- case 13:
4086
- _context2.prev = 13;
4235
+ case 29:
4236
+ _context2.prev = 29;
4087
4237
  _context2.t0 = _context2["catch"](6);
4088
4238
 
4089
4239
  if (axios.isAxiosError(_context2.t0)) {
4090
4240
  onAddToCartError(_context2.t0);
4091
4241
  }
4092
4242
 
4093
- case 16:
4094
- _context2.prev = 16;
4243
+ case 32:
4244
+ _context2.prev = 32;
4095
4245
  setHandleBookIsLoading(false);
4096
- return _context2.finish(16);
4246
+ return _context2.finish(32);
4097
4247
 
4098
- case 19:
4248
+ case 35:
4099
4249
  case "end":
4100
4250
  return _context2.stop();
4101
4251
  }
4102
4252
  }
4103
- }, _callee2, null, [[6, 13, 16, 19]]);
4253
+ }, _callee2, null, [[6, 29, 32, 35]]);
4104
4254
  }));
4105
4255
 
4106
4256
  return function handleBook() {
@@ -4114,50 +4264,29 @@ var TicketsContainer = function TicketsContainer(_ref) {
4114
4264
  return React__default.createElement("div", {
4115
4265
  className: "get-tickets-page " + theme,
4116
4266
  style: contentStyle
4117
- }, isLoading ? React__default.createElement(Loader$1, null) : React__default.createElement(React__default.Fragment, null, showWaitingList ? React__default.createElement(WaitingList, {
4118
- tickets: tickets,
4119
- eventId: eventId
4120
- }) : React__default.createElement("div", null, React__default.createElement(TicketsSection, {
4267
+ }, isLoading ? React__default.createElement(Loader$1, null) : React__default.createElement("div", null, React__default.createElement(TicketsSection, {
4121
4268
  ticketsList: tickets,
4122
4269
  selectedTickets: selectedTickets,
4123
4270
  handleTicketSelect: handleTicketSelect,
4124
4271
  promoCodeIsApplied: promoCodeIsApplied
4125
- }), promoCodeIsApplied ? React__default.createElement("div", {
4126
- className: "alert-info"
4127
- }, "Your promo code was applied successfully.") : null, showPromoInput && React__default.createElement("div", {
4128
- className: "promo-code-block"
4129
- }, React__default.createElement("input", {
4130
- placeholder: "Promo Code",
4131
- onChange: function onChange(e) {
4132
- setPromoCode(e.target.value);
4133
- },
4134
- onKeyPress: function onKeyPress(event) {
4135
- if (event.key === 'Enter') {
4136
- setPromoCodeUpdated(promoCode);
4137
- }
4138
- }
4139
- }), React__default.createElement(Button, {
4140
- className: "promo-apply-button",
4141
- placeholder: "Promo Code",
4142
- onClick: function onClick() {
4143
- setPromoCodeUpdated(promoCode);
4144
- }
4145
- }, "Apply")), !showPromoInput && !isAllTicketsSoldOut ? React__default.createElement(Button, {
4146
- className: "promo-code-button",
4147
- placeholder: "Promo Codes",
4148
- onClick: function onClick() {
4149
- setShowPromoInput(true);
4150
- }
4151
- }, "Got a promo code? Click here") : null, React__default.createElement("div", {
4152
- className: "test v1.0.19",
4153
- style: {
4154
- display: 'none'
4155
- }
4156
- }), !isAllTicketsSoldOut && React__default.createElement(Button, {
4272
+ }), showWaitingList && React__default.createElement(WaitingList, {
4273
+ tickets: tickets,
4274
+ eventId: eventId,
4275
+ isPromotionsEnabled: isPromotionsEnabled
4276
+ }), React__default.createElement(PromoCodeSection, {
4277
+ promoCode: promoCode,
4278
+ promoCodeIsApplied: promoCodeIsApplied,
4279
+ showPromoInput: showPromoInput,
4280
+ setPromoCode: setPromoCode,
4281
+ setPromoCodeUpdated: setPromoCodeUpdated,
4282
+ setShowPromoInput: setShowPromoInput,
4283
+ isPromotionsEnabled: isPromotionsEnabled,
4284
+ isAllTicketsSoldOut: isAllTicketsSoldOut
4285
+ }), !isAllTicketsSoldOut && React__default.createElement(Button$1, {
4157
4286
  "aria-hidden": true,
4158
4287
  className: "book-button " + (handleBookIsLoading || _isEmpty(selectedTickets) || Object.values(selectedTickets)[0] === 0 ? 'disabled' : ''),
4159
4288
  onClick: !handleBookIsLoading && !_isEmpty(selectedTickets) && Object.values(selectedTickets)[0] > 0 ? handleBook : function () {}
4160
- }, getTicketsLabel || 'GET TICKETS'))));
4289
+ }, getTicketsLabel || 'GET TICKETS')));
4161
4290
  };
4162
4291
 
4163
4292
  var EventInfoItem = function EventInfoItem(_ref) {