tf-checkout-react 1.0.50 → 1.0.54

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.
@@ -1,22 +1,24 @@
1
- import React, { useState, useEffect, useRef } from 'react';
2
- import { Formik, Form, Field } from 'formik';
1
+ import React, { useState, Component, useEffect, useRef } from 'react';
2
+ import { Formik, Form, Field, connect } from 'formik';
3
3
  import LoadingButton from '@mui/lab/LoadingButton';
4
4
  import _identity from 'lodash-es/identity';
5
5
  import _map from 'lodash-es/map';
6
6
  import _get from 'lodash-es/get';
7
7
  import _includes from 'lodash-es/includes';
8
8
  import axios from 'axios';
9
- import { TextField, CircularProgress } from '@mui/material';
9
+ import { TextField, FormControl, InputLabel, FormHelperText, CircularProgress } from '@mui/material';
10
10
  import Modal from '@mui/material/Modal';
11
11
  import Box from '@mui/material/Box';
12
12
  import _forEach from 'lodash-es/forEach';
13
13
  import _flatMapDeep from 'lodash-es/flatMapDeep';
14
+ import _isArray from 'lodash-es/isArray';
15
+ import { nanoid } from 'nanoid';
14
16
  import TextField$1 from '@mui/material/TextField';
15
17
  import { makeStyles } from '@mui/styles';
16
18
  import FormGroup from '@mui/material/FormGroup';
17
19
  import FormControlLabel from '@mui/material/FormControlLabel';
18
20
  import Checkbox from '@mui/material/Checkbox';
19
- import { nanoid } from 'nanoid';
21
+ import Select from '@mui/material/Select';
20
22
  import Container from '@mui/material/Container';
21
23
  import Alert from '@mui/material/Alert';
22
24
  import { useStripe, useElements, CardNumberElement, CardExpiryElement, CardCvcElement, Elements } from '@stripe/react-stripe-js';
@@ -30,9 +32,8 @@ import Button$1 from 'react-bootstrap/Button';
30
32
  import jwt_decode from 'jwt-decode';
31
33
  import _sortBy from 'lodash-es/sortBy';
32
34
  import _has from 'lodash-es/has';
33
- import FormControl from '@mui/material/FormControl';
35
+ import FormControl$1 from '@mui/material/FormControl';
34
36
  import MenuItem from '@mui/material/MenuItem';
35
- import Select from '@mui/material/Select';
36
37
  import Button from '@mui/material/Button';
37
38
 
38
39
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
@@ -89,6 +90,22 @@ function _extends() {
89
90
  return _extends.apply(this, arguments);
90
91
  }
91
92
 
93
+ function _inheritsLoose(subClass, superClass) {
94
+ subClass.prototype = Object.create(superClass.prototype);
95
+ subClass.prototype.constructor = subClass;
96
+
97
+ _setPrototypeOf(subClass, superClass);
98
+ }
99
+
100
+ function _setPrototypeOf(o, p) {
101
+ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
102
+ o.__proto__ = p;
103
+ return o;
104
+ };
105
+
106
+ return _setPrototypeOf(o, p);
107
+ }
108
+
92
109
  function _objectWithoutPropertiesLoose(source, excluded) {
93
110
  if (source == null) return {};
94
111
  var target = {};
@@ -891,7 +908,7 @@ function styleInject(css, ref) {
891
908
  }
892
909
  }
893
910
 
894
- var css_248z = ".style_button-container__2bhts{display:flex;justify-content:center;padding:20px}.style_billing-info-container__3ZE3J{margin:0 auto;max-width:800px}.style_billing-info-container__3ZE3J .style_is-half__1W_rP{width:49%}.style_billing-info-container__3ZE3J p{color:#000}.style_billing-info-container__3ZE3J .style_main-header__2OFWa{font-size:2rem;font-weight:600}.style_billing-info-container__twoFields__2tDqt{display:flex;justify-content:space-between;margin-top:15px}.style_billing-info-container__singleField__2bcsf{margin-top:15px}button{margin-top:10px}.style_account-actions-block__16OH-{color:#182026;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,Icons16,sans-serif;margin-top:10px}.style_login-register-button__fGgZf,.style_MuiButtonBase-root__1UBk9.style_MuiButton-root__3NzEO,.style_MuiButtonBase-root__1UBk9.style_MuiButton-root__3NzEO:hover{background-color:#212529;border:#f28051;border-radius:5px;color:#fff;cursor:pointer;display:block;font-family:Inter-Bold;font-size:26px;font-weight:700;line-height:1.15;margin-top:10px;min-height:46px;outline:none;overflow:hidden;padding:14px 12px 12px;position:relative;text-align:center;text-overflow:ellipsis;text-transform:uppercase;width:49%}.style_logo-image-container__2A2uH{margin-top:5px;text-align:center;width:49%}.style_logo-image-container__2A2uH img{height:30px}.style_login-block__22kcN{align-items:center;display:flex;flex-direction:column}.style_login-register-button__fGgZf:hover{background-color:#505050!important;border-color:#505050!important}.style_login-register-block__36tu5{display:flex;justify-content:space-between}@media only screen and (max-width:820px){.style_billing-info-container__3ZE3J{width:90%}.style_billing-info-container__3ZE3J .style_main-header__2OFWa{font-size:1.5rem}}";
911
+ var css_248z = ".style_button-container__2bhts{display:flex;justify-content:center;padding:20px}.style_billing-info-container__3ZE3J{margin:0 auto;max-width:800px}.style_billing-info-container__3ZE3J .style_is-half__1W_rP{width:49%}.style_billing-info-container__3ZE3J p{color:#000}.style_billing-info-container__3ZE3J .style_main-header__2OFWa{font-size:2rem;font-weight:600}.style_billing-info-container__twoFields__2tDqt{display:flex;justify-content:space-between;margin-top:15px}.style_billing-info-container__singleField__2bcsf{margin-top:15px}button{margin-top:10px}.style_account-actions-block__16OH-{color:#182026;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,Icons16,sans-serif;margin-top:10px}.style_login-register-button__fGgZf,.style_MuiButtonBase-root__1UBk9.style_MuiButton-root__3NzEO,.style_MuiButtonBase-root__1UBk9.style_MuiButton-root__3NzEO:hover{background-color:#212529;border:#f28051;border-radius:5px;color:#fff;cursor:pointer;display:block;font-family:Inter-Bold;font-size:26px;font-weight:700;line-height:1.15;margin-top:10px;min-height:46px;outline:none;overflow:hidden;padding:14px 12px 12px;position:relative;text-align:center;text-overflow:ellipsis;text-transform:uppercase;width:49%}.style_logo-image-container__2A2uH{margin-top:5px;text-align:center;width:49%}.style_logo-image-container__2A2uH img{height:30px}.style_login-block__22kcN{align-items:center;display:flex;flex-direction:column}.style_login-register-button__fGgZf:hover{background-color:#505050!important;border-color:#505050!important}.style_login-register-block__36tu5{display:flex;justify-content:space-between}@media only screen and (max-width:820px){.style_billing-info-container__3ZE3J{width:90%}.style_billing-info-container__3ZE3J .style_main-header__2OFWa{font-size:1.5rem}}.style_email-checking__yKzPA{margin-bottom:15px}";
895
912
  styleInject(css_248z);
896
913
 
897
914
  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,}))$/;
@@ -1538,7 +1555,7 @@ var getInitialValues = function getInitialValues(data, propsInitialValues, userV
1538
1555
 
1539
1556
  return initialValues;
1540
1557
  };
1541
- var createRegisterFormData = function createRegisterFormData(values) {
1558
+ var createRegisterFormData = function createRegisterFormData(values, checkoutBody) {
1542
1559
  if (values === void 0) {
1543
1560
  values = {};
1544
1561
  }
@@ -1551,6 +1568,11 @@ var createRegisterFormData = function createRegisterFormData(values) {
1551
1568
  bodyFormData.append('password_confirmation', values.confirmPassword);
1552
1569
  bodyFormData.append('client_id', ENV.CLIENT_ID );
1553
1570
  bodyFormData.append('client_secret', ENV.CLIENT_SECRET );
1571
+
1572
+ _forEach(checkoutBody.attributes, function (item, key) {
1573
+ bodyFormData.append(key, item);
1574
+ });
1575
+
1554
1576
  return bodyFormData;
1555
1577
  };
1556
1578
  var setLoggedUserData = function setLoggedUserData(data) {
@@ -1559,6 +1581,7 @@ var setLoggedUserData = function setLoggedUserData(data) {
1559
1581
  first_name: data.firstName,
1560
1582
  last_name: data.lastName,
1561
1583
  email: data.email,
1584
+ confirmEmail: data.email,
1562
1585
  city: (data == null ? void 0 : data.city) || '',
1563
1586
  country: (data == null ? void 0 : data.country) || '',
1564
1587
  phone: (data == null ? void 0 : data.phone) || '',
@@ -1639,6 +1662,38 @@ var createCheckoutDataBody = function createCheckoutDataBody(ticketsQuantity, va
1639
1662
 
1640
1663
  return body;
1641
1664
  };
1665
+ var getValidateFunctions = function getValidateFunctions(element, states) {
1666
+ var validationFunctions = [];
1667
+
1668
+ if (element.required) {
1669
+ if (element.name !== 'state' || element.name === 'state' && states.length) {
1670
+ validationFunctions.push(requiredValidator);
1671
+ }
1672
+ }
1673
+
1674
+ if (element.onValidate) {
1675
+ validationFunctions.push(element.onValidate);
1676
+ }
1677
+
1678
+ return combineValidators.apply(void 0, validationFunctions);
1679
+ };
1680
+ var assingUniqueIds = function assingUniqueIds(data) {
1681
+ if (_get(data[0], 'uniqueId')) {
1682
+ return data;
1683
+ }
1684
+
1685
+ return _map(data, function (item) {
1686
+ _forEach(item, function (itemValue, key) {
1687
+ if (_isArray(itemValue)) {
1688
+ item[key] = assingUniqueIds(itemValue);
1689
+ }
1690
+ });
1691
+
1692
+ return _extends({}, item, {
1693
+ uniqueId: nanoid()
1694
+ });
1695
+ });
1696
+ };
1642
1697
 
1643
1698
  var useStyles = /*#__PURE__*/makeStyles({
1644
1699
  input: {
@@ -1657,13 +1712,13 @@ var CustomField = function CustomField(_ref) {
1657
1712
  _ref$form = _ref.form,
1658
1713
  touched = _ref$form.touched,
1659
1714
  errors = _ref$form.errors,
1715
+ submitCount = _ref$form.submitCount,
1660
1716
  theme = _ref.theme;
1661
1717
  var isSelectField = type === 'select';
1662
- var isShrink = Boolean(field.value) || type === 'date' || type === 'select';
1663
- var isTouched = Boolean(_get(touched, field.name));
1664
1718
 
1665
1719
  var error = _get(errors, field.name);
1666
1720
 
1721
+ var isTouched = Boolean(_get(touched, field.name)) || _includes(field.name, 'holder') && !!error && !!submitCount;
1667
1722
  var classes = useStyles();
1668
1723
  return React.createElement(TextField$1, Object.assign({
1669
1724
  id: field.name,
@@ -1673,9 +1728,6 @@ var CustomField = function CustomField(_ref) {
1673
1728
  fullWidth: true,
1674
1729
  error: !!error && isTouched,
1675
1730
  helperText: isTouched && error,
1676
- InputLabelProps: {
1677
- shrink: isShrink
1678
- },
1679
1731
  InputProps: {
1680
1732
  classes: {
1681
1733
  input: classes.input
@@ -1726,6 +1778,102 @@ var getQueryVariable = function getQueryVariable(variable) {
1726
1778
  return false;
1727
1779
  };
1728
1780
 
1781
+ var useStyles$1 = /*#__PURE__*/makeStyles({
1782
+ input: {
1783
+ '&::placeholder': {
1784
+ color: 'gray'
1785
+ }
1786
+ }
1787
+ });
1788
+ var SelectField = function SelectField(_ref) {
1789
+ var label = _ref.label,
1790
+ _ref$type = _ref.type,
1791
+ type = _ref$type === void 0 ? 'text' : _ref$type,
1792
+ field = _ref.field,
1793
+ _ref$selectOptions = _ref.selectOptions,
1794
+ selectOptions = _ref$selectOptions === void 0 ? [] : _ref$selectOptions,
1795
+ _ref$form = _ref.form,
1796
+ touched = _ref$form.touched,
1797
+ errors = _ref$form.errors,
1798
+ theme = _ref.theme;
1799
+ var isTouched = Boolean(_get(touched, field.name));
1800
+
1801
+ var error = _get(errors, field.name);
1802
+
1803
+ var classes = useStyles$1();
1804
+ return React.createElement(FormControl, {
1805
+ fullWidth: true
1806
+ }, React.createElement(InputLabel, {
1807
+ htmlFor: field.name,
1808
+ error: !!error && isTouched,
1809
+ shrink: true
1810
+ }, label), React.createElement(Select, Object.assign({
1811
+ id: field.name,
1812
+ label: label,
1813
+ type: type,
1814
+ fullWidth: true,
1815
+ error: !!error && isTouched,
1816
+ inputProps: {
1817
+ id: field.name,
1818
+ classes: {
1819
+ input: classes.input
1820
+ }
1821
+ },
1822
+ "native": true,
1823
+ className: theme,
1824
+ MenuProps: {
1825
+ className: theme
1826
+ }
1827
+ }, field), _map(selectOptions, function (option) {
1828
+ return React.createElement("option", {
1829
+ key: option.value,
1830
+ value: option.value,
1831
+ disabled: option.disabled
1832
+ }, option.label);
1833
+ })), isTouched && error ? React.createElement(FormHelperText, {
1834
+ error: !!error && isTouched
1835
+ }, error) : null);
1836
+ };
1837
+
1838
+ var ErrorFocusInternal = /*#__PURE__*/function (_Component) {
1839
+ _inheritsLoose(ErrorFocusInternal, _Component);
1840
+
1841
+ function ErrorFocusInternal() {
1842
+ var _this;
1843
+
1844
+ _this = _Component.apply(this, arguments) || this;
1845
+
1846
+ _this.render = function () {
1847
+ return null;
1848
+ };
1849
+
1850
+ return _this;
1851
+ }
1852
+
1853
+ var _proto = ErrorFocusInternal.prototype;
1854
+
1855
+ _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
1856
+ var _prevProps$formik = prevProps.formik,
1857
+ isSubmitting = _prevProps$formik.isSubmitting,
1858
+ isValidating = _prevProps$formik.isValidating,
1859
+ errors = _prevProps$formik.errors;
1860
+ var keys = Object.keys(errors);
1861
+
1862
+ if (keys.length > 0 && isSubmitting && !isValidating) {
1863
+ var selector = "[name=\"" + keys[0] + "\"]";
1864
+ var errorElement = document.querySelector(selector);
1865
+
1866
+ if (errorElement) {
1867
+ errorElement.focus();
1868
+ }
1869
+ }
1870
+ };
1871
+
1872
+ return ErrorFocusInternal;
1873
+ }(Component);
1874
+
1875
+ var ErrorFocus = /*#__PURE__*/connect(ErrorFocusInternal);
1876
+
1729
1877
  var LogicRunner = function LogicRunner(_ref) {
1730
1878
  var values = _ref.values,
1731
1879
  setStates = _ref.setStates,
@@ -1797,7 +1945,7 @@ var LogicRunner = function LogicRunner(_ref) {
1797
1945
  lastName: parsedData == null ? void 0 : parsedData.last_name,
1798
1946
  email: (parsedData == null ? void 0 : parsedData.email) || '',
1799
1947
  phone: (parsedData == null ? void 0 : parsedData.phone) || '',
1800
- confirmEmail: '',
1948
+ confirmEmail: (parsedData == null ? void 0 : parsedData.email) || '',
1801
1949
  state: (parsedData == null ? void 0 : parsedData.state) || '',
1802
1950
  street_address: (parsedData == null ? void 0 : parsedData.street_address) || '',
1803
1951
  country: (parsedData == null ? void 0 : parsedData.country) || 1,
@@ -1866,39 +2014,43 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
1866
2014
  var userData = typeof window !== 'undefined' && window.localStorage.getItem('user_data') ? JSON.parse(window.localStorage.getItem('user_data') || '') : {};
1867
2015
  var access_token = typeof window !== 'undefined' && window.localStorage.getItem('access_token') ? window.localStorage.getItem('access_token') || '' : '';
1868
2016
 
1869
- var _useState = useState({}),
1870
- cartInfoData = _useState[0],
1871
- setCartInfo = _useState[1];
2017
+ var _useState = useState(data),
2018
+ dataWithUniqueIds = _useState[0],
2019
+ setDataWithUniqueIds = _useState[1];
1872
2020
 
1873
- var _useState2 = useState([]),
1874
- countries = _useState2[0],
1875
- setCountries = _useState2[1];
2021
+ var _useState2 = useState({}),
2022
+ cartInfoData = _useState2[0],
2023
+ setCartInfo = _useState2[1];
1876
2024
 
1877
2025
  var _useState3 = useState([]),
1878
- states = _useState3[0],
1879
- setStates = _useState3[1];
2026
+ countries = _useState3[0],
2027
+ setCountries = _useState3[1];
1880
2028
 
1881
- var _useState4 = useState(false),
1882
- showModalLogin = _useState4[0],
1883
- setShowModalLogin = _useState4[1];
2029
+ var _useState4 = useState([]),
2030
+ states = _useState4[0],
2031
+ setStates = _useState4[1];
1884
2032
 
1885
2033
  var _useState5 = useState(false),
1886
- alreadyHasUser = _useState5[0],
1887
- setAlreadyHasUser = _useState5[1];
2034
+ showModalLogin = _useState5[0],
2035
+ setShowModalLogin = _useState5[1];
1888
2036
 
1889
2037
  var _useState6 = useState(false),
1890
- userExpired = _useState6[0],
1891
- setUserExpired = _useState6[1];
2038
+ alreadyHasUser = _useState6[0],
2039
+ setAlreadyHasUser = _useState6[1];
1892
2040
 
1893
2041
  var _useState7 = useState(false),
1894
- showModalRegister = _useState7[0],
1895
- setShowModalRegister = _useState7[1];
2042
+ userExpired = _useState7[0],
2043
+ setUserExpired = _useState7[1];
1896
2044
 
1897
- var _useState8 = useState([]),
1898
- ticketsQuantity = _useState8[0],
1899
- setTicketsQuantity = _useState8[1];
2045
+ var _useState8 = useState(false),
2046
+ showModalRegister = _useState8[0],
2047
+ setShowModalRegister = _useState8[1];
1900
2048
 
1901
- var _useState9 = useState({
2049
+ var _useState9 = useState([]),
2050
+ ticketsQuantity = _useState9[0],
2051
+ setTicketsQuantity = _useState9[1];
2052
+
2053
+ var _useState10 = useState({
1902
2054
  firstName: '',
1903
2055
  lastName: '',
1904
2056
  email: '',
@@ -1913,8 +2065,8 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
1913
2065
  state: '',
1914
2066
  zip: ''
1915
2067
  }),
1916
- userValues = _useState9[0],
1917
- setUserValues = _useState9[1];
2068
+ userValues = _useState10[0],
2069
+ setUserValues = _useState10[1];
1918
2070
 
1919
2071
  var isLoggedIn = !!access_token;
1920
2072
 
@@ -1930,7 +2082,11 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
1930
2082
 
1931
2083
  var optedInFieldValue = _get(cartInfoData, 'optedIn', false);
1932
2084
 
1933
- var hideOptIn = _get(cartInfoData, 'hide_ttf_opt_in', false);
2085
+ var hideTtfOptIn = _get(cartInfoData, 'hide_ttf_opt_in', true);
2086
+
2087
+ if (!_get(dataWithUniqueIds, '[0].uniqueId')) {
2088
+ setDataWithUniqueIds(assingUniqueIds(data));
2089
+ }
1934
2090
 
1935
2091
  var getQuantity = function getQuantity(cart) {
1936
2092
  if (cart === void 0) {
@@ -2097,7 +2253,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2097
2253
  fetchUserData(access_token);
2098
2254
  }, [access_token]);
2099
2255
  return React.createElement(React.Fragment, null, React.createElement(Formik, {
2100
- initialValues: getInitialValues(data, _extends({}, initialValues, {
2256
+ initialValues: getInitialValues(dataWithUniqueIds, _extends({}, initialValues, {
2101
2257
  email: emailLogged,
2102
2258
  firstName: firstNameLogged,
2103
2259
  lastName: lastNameLogged,
@@ -2107,7 +2263,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2107
2263
  enableReinitialize: true,
2108
2264
  onSubmit: function () {
2109
2265
  var _onSubmit = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(values, formikHelpers) {
2110
- var updatedUserData, _profileSpecifiedData, _profileDataObj, _checkoutBody, _res, bodyFormData, access_token_register, resRegister, refreshToken, tokens, _e$response, _e$response$data, error, profileData, profileSpecifiedData, profileDataObj, checkoutBody, res, _e$response2;
2266
+ var updatedUserData, _profileSpecifiedData, _profileDataObj, _checkoutBody, _res, checkoutBodyForRegistration, bodyFormData, access_token_register, resRegister, refreshToken, tokens, _e$response, _e$response$data, error, profileData, profileSpecifiedData, profileDataObj, checkoutBody, res, _e$response2;
2111
2267
 
2112
2268
  return runtime_1.wrap(function _callee5$(_context5) {
2113
2269
  while (1) {
@@ -2152,13 +2308,18 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2152
2308
  return _context5.abrupt("return");
2153
2309
 
2154
2310
  case 15:
2155
- bodyFormData = createRegisterFormData(values);
2311
+ checkoutBodyForRegistration = createCheckoutDataBody(ticketsQuantity.length, values, {
2312
+ emailLogged: emailLogged,
2313
+ firstNameLogged: firstNameLogged,
2314
+ lastNameLogged: lastNameLogged
2315
+ }, showDOB);
2316
+ bodyFormData = createRegisterFormData(values, checkoutBodyForRegistration);
2156
2317
  access_token_register = null;
2157
- _context5.prev = 17;
2158
- _context5.next = 20;
2318
+ _context5.prev = 18;
2319
+ _context5.next = 21;
2159
2320
  return register(bodyFormData);
2160
2321
 
2161
- case 20:
2322
+ case 21:
2162
2323
  resRegister = _context5.sent;
2163
2324
  access_token_register = _get(resRegister, 'data.data.attributes.access_token');
2164
2325
  refreshToken = _get(resRegister, 'data.data.attributes.refresh_token');
@@ -2168,12 +2329,12 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2168
2329
  refreshToken: refreshToken
2169
2330
  };
2170
2331
  onRegisterSuccess(tokens);
2171
- _context5.next = 32;
2332
+ _context5.next = 33;
2172
2333
  break;
2173
2334
 
2174
- case 28:
2175
- _context5.prev = 28;
2176
- _context5.t0 = _context5["catch"](17);
2335
+ case 29:
2336
+ _context5.prev = 29;
2337
+ _context5.t0 = _context5["catch"](18);
2177
2338
 
2178
2339
  if (axios.isAxiosError(_context5.t0)) {
2179
2340
  error = _context5.t0 == null ? void 0 : (_e$response = _context5.t0.response) == null ? void 0 : (_e$response$data = _e$response.data) == null ? void 0 : _e$response$data.message;
@@ -2197,11 +2358,11 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2197
2358
 
2198
2359
  return _context5.abrupt("return");
2199
2360
 
2200
- case 32:
2201
- _context5.next = 34;
2361
+ case 33:
2362
+ _context5.next = 35;
2202
2363
  return getProfileData(access_token_register);
2203
2364
 
2204
- case 34:
2365
+ case 35:
2205
2366
  profileData = _context5.sent;
2206
2367
  profileSpecifiedData = _get(profileData, 'data.data');
2207
2368
  profileDataObj = setLoggedUserData(profileSpecifiedData);
@@ -2215,17 +2376,17 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2215
2376
  firstNameLogged: firstNameLogged,
2216
2377
  lastNameLogged: lastNameLogged
2217
2378
  }, showDOB);
2218
- _context5.next = 41;
2379
+ _context5.next = 42;
2219
2380
  return postOnCheckout(checkoutBody, access_token_register);
2220
2381
 
2221
- case 41:
2382
+ case 42:
2222
2383
  res = _context5.sent;
2223
2384
  handleSubmit(values, formikHelpers, eventId, res);
2224
- _context5.next = 48;
2385
+ _context5.next = 49;
2225
2386
  break;
2226
2387
 
2227
- case 45:
2228
- _context5.prev = 45;
2388
+ case 46:
2389
+ _context5.prev = 46;
2229
2390
  _context5.t1 = _context5["catch"](0);
2230
2391
 
2231
2392
  if (axios.isAxiosError(_context5.t1)) {
@@ -2241,12 +2402,12 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2241
2402
  onSubmitError(_context5.t1);
2242
2403
  }
2243
2404
 
2244
- case 48:
2405
+ case 49:
2245
2406
  case "end":
2246
2407
  return _context5.stop();
2247
2408
  }
2248
2409
  }
2249
- }, _callee5, null, [[0, 45], [17, 28]]);
2410
+ }, _callee5, null, [[0, 46], [18, 29]]);
2250
2411
  }));
2251
2412
 
2252
2413
  function onSubmit(_x2, _x3) {
@@ -2258,7 +2419,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2258
2419
  }, function (props) {
2259
2420
  return React.createElement(Form, {
2260
2421
  onSubmit: props.handleSubmit
2261
- }, React.createElement(LogicRunner, {
2422
+ }, React.createElement(ErrorFocus, null), React.createElement(LogicRunner, {
2262
2423
  values: props.values,
2263
2424
  setStates: setStates,
2264
2425
  setFieldValue: props.setFieldValue,
@@ -2279,7 +2440,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2279
2440
  onLogin();
2280
2441
  setShowModalLogin(true);
2281
2442
  }
2282
- }, "Login"))), _map(data, function (item) {
2443
+ }, "Login"))), _map(dataWithUniqueIds, function (item) {
2283
2444
  var label = item.label,
2284
2445
  labelClassName = item.labelClassName,
2285
2446
  fields = item.fields;
@@ -2289,7 +2450,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2289
2450
  }
2290
2451
 
2291
2452
  return React.createElement(React.Fragment, {
2292
- key: nanoid()
2453
+ key: item.uniqueId
2293
2454
  }, React.createElement("p", {
2294
2455
  className: labelClassName
2295
2456
  }, label), _map(fields, function (group) {
@@ -2298,7 +2459,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2298
2459
  groupLabel = group.groupLabel,
2299
2460
  groupLabelClassName = group.groupLabelClassName;
2300
2461
  return React.createElement(React.Fragment, {
2301
- key: nanoid()
2462
+ key: group.uniqueId
2302
2463
  }, !isLoggedIn && React.createElement("div", {
2303
2464
  className: groupLabelClassName
2304
2465
  }, groupLabel), React.createElement("div", {
@@ -2316,47 +2477,45 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2316
2477
  return false;
2317
2478
  }
2318
2479
 
2319
- if (el.name === 'brand_opt_in' && hideOptIn) {
2480
+ if (el.name === 'ttf_opt_in' && hideTtfOptIn) {
2320
2481
  return false;
2321
2482
  }
2322
2483
 
2323
2484
  return true;
2324
2485
  }), function (element) {
2325
2486
  return ['password', 'confirmPassword'].includes(element.name) && isLoggedIn ? null : React.createElement(React.Fragment, {
2326
- key: nanoid()
2487
+ key: element.uniqueId
2327
2488
  }, element.name === 'email' ? React.createElement("div", {
2328
2489
  className: "email-checking"
2329
- }, "IMPORTANT: Please double check that your email address is correct. It's where we send your confirmation and e-tickets to!") : null, React.createElement("div", {
2490
+ }, "IMPORTANT: Please double check that your\n email address is correct. It's where we\n send your confirmation and e-tickets to!") : null, React.createElement("div", {
2330
2491
  className: element.className
2331
2492
  }, element.component ? element.component : React.createElement(Field, {
2332
2493
  name: element.name,
2333
2494
  label: element.label,
2334
2495
  type: element.type,
2335
- validate: combineValidators(element.required ? requiredValidator : function () {}, element.onValidate ? element.onValidate : function () {}),
2336
- component: element.type === 'checkbox' ? CheckboxField : CustomField,
2496
+ validate: getValidateFunctions(element, states),
2497
+ component: element.type === 'checkbox' ? CheckboxField : element.type === 'select' ? SelectField : CustomField,
2337
2498
  selectOptions: element.name === 'country' ? countries : element.name === 'state' ? states : [],
2338
2499
  theme: theme
2339
2500
  })));
2340
2501
  })));
2341
2502
  }));
2342
- }), showTicketHolderName && React.createElement(React.Fragment, {
2343
- key: nanoid()
2344
- }, React.createElement("div", {
2503
+ }), showTicketHolderName && React.createElement(React.Fragment, null, React.createElement("div", {
2345
2504
  className: "ticket-holders-fields"
2346
2505
  }, React.createElement("p", null, ticketHoldersFields.label), _map(ticketsQuantity, function (_item, index) {
2347
2506
  return React.createElement("div", {
2348
- key: nanoid()
2507
+ key: _item
2349
2508
  }, React.createElement("h5", null, "Ticket ", index + 1), _map(ticketHoldersFields.fields, function (group) {
2350
2509
  var groupClassname = group.groupClassname,
2351
2510
  groupItems = group.groupItems;
2352
2511
  return React.createElement("div", {
2353
- key: nanoid()
2512
+ key: group.uniqueId
2354
2513
  }, React.createElement("div", {
2355
2514
  className: groupClassname
2356
2515
  }, _map(groupItems, function (element) {
2357
2516
  return React.createElement("div", {
2358
2517
  className: element.className,
2359
- key: nanoid()
2518
+ key: element.uniqueId
2360
2519
  }, React.createElement(Field, {
2361
2520
  name: element.name + "-" + index,
2362
2521
  label: element.label,
@@ -2368,8 +2527,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2368
2527
  })));
2369
2528
  }));
2370
2529
  }))), React.createElement("div", {
2371
- className: "button-container",
2372
- key: nanoid()
2530
+ className: "button-container"
2373
2531
  }, React.createElement(LoadingButton, {
2374
2532
  type: "submit",
2375
2533
  variant: "contained",
@@ -2407,10 +2565,10 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2407
2565
  }));
2408
2566
  };
2409
2567
 
2410
- var css_248z$3 = ".style_payment_page__1PUd8{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,Icons16,sans-serif}.style_payment_page__1PUd8 .style_order_info_section__J1olw{padding:15px 0}.style_payment_page__1PUd8 .style_order_info_section__J1olw .style_order_info_block__3kZN4{padding-bottom:15px;padding-top:15px}.style_payment_page__1PUd8 .style_order_info_section__J1olw .style_order_info_block__3kZN4 .style_field-underline__2M8Bd{border-bottom:1px solid #000;padding-bottom:15px}.style_payment_page__1PUd8 .style_order_info_section__J1olw .style_order_info_block__3kZN4 .style_order_info_title__1MBgS{font-size:14px;font-weight:700;padding-bottom:3px}.style_payment_page__1PUd8 .style_order_info_section__J1olw .style_order_info_block__3kZN4 .style_order_info_text__3gSEK{font-size:16px;line-height:1.15;outline:none}.style_payment_page__1PUd8 .style_MuiBox-root__2LeaA{margin-left:auto;margin-right:auto;padding:20px;text-align:center}.style_payment_page__1PUd8 .style_payment_info_label__3Zmjp{padding:20px 0;text-align:center}.style_payment_page__1PUd8 .style_payment_form__2arf4{color:#fff;padding:20px}.style_payment_page__1PUd8 .style_payment_form__2arf4 input,.style_payment_page__1PUd8 .style_payment_form__2arf4 label{color:#fff}.style_payment_page__1PUd8 .style_payment_button__3WzAn{padding-top:20px;text-align:center}.style_conditions-block__3XPwW{background-color:#f5f5f5;border:1px solid #e3e3e3;border-radius:4px;box-shadow:inset 0 1px 1px rgba(0,0,0,.05);padding:19px}";
2568
+ var css_248z$3 = ".style_payment_page__1PUd8{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,Icons16,sans-serif}.style_payment_page__1PUd8 .style_order_info_section__J1olw{padding:15px 0}.style_payment_page__1PUd8 .style_order_info_section__J1olw .style_order_info_block__3kZN4{padding-bottom:15px;padding-top:15px}.style_payment_page__1PUd8 .style_order_info_section__J1olw .style_order_info_block__3kZN4 .style_field-underline__2M8Bd{border-bottom:1px solid #000;padding-bottom:15px}.style_payment_page__1PUd8 .style_order_info_section__J1olw .style_order_info_block__3kZN4 .style_order_info_title__1MBgS{font-size:14px;font-weight:700;padding-bottom:3px}.style_payment_page__1PUd8 .style_order_info_section__J1olw .style_order_info_block__3kZN4 .style_order_info_text__3gSEK{font-size:16px;line-height:1.15;outline:none}.style_payment_page__1PUd8 .style_MuiBox-root__2LeaA{margin-left:auto;margin-right:auto;padding:20px;text-align:center}.style_payment_page__1PUd8 .style_payment_info_label__3Zmjp{padding:20px 0;text-align:center}.style_payment_page__1PUd8 .style_payment_form__2arf4{color:#fff;padding:20px}.style_payment_page__1PUd8 .style_payment_form__2arf4 input,.style_payment_page__1PUd8 .style_payment_form__2arf4 label{color:#fff}.style_payment_page__1PUd8 .style_payment_button__3WzAn{padding-top:20px;text-align:center}";
2411
2569
  styleInject(css_248z$3);
2412
2570
 
2413
- var css_248z$4 = ".style_card_form_inner__7vzGq{background:#232323;border-radius:8px;padding:15px}.style_card_form_inner__7vzGq .style_card_label_text__F7GFa{color:#fff}.style_card_form_inner__7vzGq .style_StripeElement__jS5TJ{margin:5px 0 10px}.style_card_label_text__F7GFa{color:#fff}.style_payment_button__2rkp8{padding-top:15px;text-align:center}.style_payment_button__2rkp8 button{background-color:#212529;border-radius:8px;color:#fff;cursor:pointer;font-size:26px;padding:15px 30px;transition:opacity .5s;width:200px}.style_payment_button__2rkp8 button:hover{opacity:.7}.style_disabled-payment-button__3MiUR button{opacity:.3;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.style_checkout_error_block__3LUN5{color:#e53935;font-weight:600;padding:15px 0}.style_zip_element__31oFa p{margin-bottom:0}.style_zip_element__31oFa input{background-color:#232323;border:none;color:#fff;font-size:18px;margin-top:5px;outline:none;width:100%}";
2571
+ var css_248z$4 = ".style_card_form_inner__7vzGq{background:#232323;border-radius:8px;margin:0 auto 20px;min-width:325px;padding:15px;width:50%}.style_card_form_inner__7vzGq .style_card_label_text__F7GFa{color:#fff}.style_card_form_inner__7vzGq .style_StripeElement__jS5TJ{margin:5px 0 10px}.style_card_label_text__F7GFa{color:#fff}.style_payment_button__2rkp8{padding-top:15px;text-align:center}.style_payment_button__2rkp8 button{background-color:#212529;border-radius:8px;color:#fff;cursor:pointer;font-size:26px;padding:15px 30px;transition:opacity .5s;width:200px}.style_payment_button__2rkp8 button:hover{opacity:.7}.style_disabled-payment-button__3MiUR button{opacity:.3;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.style_checkout_error_block__3LUN5{color:#e53935;font-weight:600;padding:15px 0}.style_zip_element__31oFa p{margin-bottom:0}.style_zip_element__31oFa input{background-color:#232323;border:none;color:#fff;font-size:18px;margin-top:5px;outline:none;width:100%}";
2414
2572
  styleInject(css_248z$4);
2415
2573
 
2416
2574
  var currencyNormalizerCreator = function currencyNormalizerCreator(value, currency) {
@@ -2525,6 +2683,14 @@ var CheckoutForm = function CheckoutForm(_ref) {
2525
2683
  stripeError = _useState2[0],
2526
2684
  setStripeError = _useState2[1];
2527
2685
 
2686
+ var _useState3 = useState([]),
2687
+ checkboxes = _useState3[0],
2688
+ setCheckboxes = _useState3[1];
2689
+
2690
+ var _useState4 = useState(false),
2691
+ allowSubmit = _useState4[0],
2692
+ setAllowSubmit = _useState4[1];
2693
+
2528
2694
  var handleSubmit = /*#__PURE__*/function () {
2529
2695
  var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(event) {
2530
2696
  var card, address, paymentMethodReq, _yield$stripe$confirm, _error;
@@ -2630,6 +2796,17 @@ var CheckoutForm = function CheckoutForm(_ref) {
2630
2796
  };
2631
2797
  }();
2632
2798
 
2799
+ var handleCheckboxes = function handleCheckboxes(e) {
2800
+ var checkbox = e.target;
2801
+ var updatedCheckedState = checkboxes.map(function (item) {
2802
+ var value = item.id === checkbox.name ? !item.checked : item.checked;
2803
+ return _extends({}, item, {
2804
+ checked: value
2805
+ });
2806
+ });
2807
+ setCheckboxes(updatedCheckedState);
2808
+ };
2809
+
2633
2810
  var onChangePostalCode = function onChangePostalCode(e) {
2634
2811
  setPostalCode(e.target.value);
2635
2812
  };
@@ -2643,6 +2820,19 @@ var CheckoutForm = function CheckoutForm(_ref) {
2643
2820
  zipCode && setPostalCode(zipCode);
2644
2821
  }
2645
2822
  }, []);
2823
+ useEffect(function () {
2824
+ if (conditions.length) {
2825
+ setCheckboxes(conditions);
2826
+ }
2827
+ }, [conditions]);
2828
+ useEffect(function () {
2829
+ if (checkboxes.length) {
2830
+ var allChecked = checkboxes.every(function (item) {
2831
+ return (item == null ? void 0 : item.checked) === true;
2832
+ });
2833
+ setAllowSubmit(allChecked);
2834
+ }
2835
+ }, [checkboxes]);
2646
2836
  var buttonIsDiabled = !stripe || !!error || isLoading;
2647
2837
  return React.createElement("div", {
2648
2838
  className: "stripe_payment_container"
@@ -2683,7 +2873,7 @@ var CheckoutForm = function CheckoutForm(_ref) {
2683
2873
  value: postalCode,
2684
2874
  onChange: onChangePostalCode,
2685
2875
  placeholder: "ZIP"
2686
- }))), conditions == null ? void 0 : conditions.map(function (checkbox) {
2876
+ }))), checkboxes == null ? void 0 : checkboxes.map(function (checkbox) {
2687
2877
  return React.createElement("div", {
2688
2878
  className: 'billing-info-container__singleField',
2689
2879
  key: checkbox.id
@@ -2692,10 +2882,12 @@ var CheckoutForm = function CheckoutForm(_ref) {
2692
2882
  }, React.createElement(CheckboxField, {
2693
2883
  name: checkbox.id,
2694
2884
  label: checkbox.text,
2695
- required: true
2885
+ required: true,
2886
+ onChange: handleCheckboxes,
2887
+ checked: checkbox.checked
2696
2888
  })));
2697
2889
  }), React.createElement("div", {
2698
- className: "payment_button " + (buttonIsDiabled ? 'disabled-payment-button' : '')
2890
+ className: "payment_button " + (buttonIsDiabled || !allowSubmit ? 'disabled-payment-button' : '')
2699
2891
  }, React.createElement("button", {
2700
2892
  disabled: buttonIsDiabled,
2701
2893
  type: "submit"
@@ -2837,7 +3029,8 @@ var PaymentContainer = function PaymentContainer(_ref) {
2837
3029
  setConditions(conditionsInfo ? conditionsInfo.map(function (item) {
2838
3030
  return {
2839
3031
  id: nanoid(),
2840
- text: item
3032
+ text: item,
3033
+ checked: false
2841
3034
  };
2842
3035
  }) : []);
2843
3036
 
@@ -3171,7 +3364,7 @@ var TicketRow = function TicketRow(_ref) {
3171
3364
  className: "get-tickets"
3172
3365
  }, React.createElement(Box, {
3173
3366
  className: "get-tickets__selectbox"
3174
- }, React.createElement(FormControl, {
3367
+ }, React.createElement(FormControl$1, {
3175
3368
  fullWidth: true
3176
3369
  }, React.createElement(Select, {
3177
3370
  value: selectedTickets[ticketTier.id] ? selectedTickets[ticketTier.id] : 0,
@@ -3327,25 +3520,24 @@ var WaitingList = function WaitingList(_ref) {
3327
3520
  setShowSuccessMessage(true);
3328
3521
  }
3329
3522
 
3330
- _context.next = 14;
3523
+ _context.next = 13;
3331
3524
  break;
3332
3525
 
3333
3526
  case 11:
3334
3527
  _context.prev = 11;
3335
3528
  _context.t0 = _context["catch"](0);
3336
- console.log(_context.t0);
3337
3529
 
3338
- case 14:
3339
- _context.prev = 14;
3530
+ case 13:
3531
+ _context.prev = 13;
3340
3532
  setLoading(false);
3341
- return _context.finish(14);
3533
+ return _context.finish(13);
3342
3534
 
3343
- case 17:
3535
+ case 16:
3344
3536
  case "end":
3345
3537
  return _context.stop();
3346
3538
  }
3347
3539
  }
3348
- }, _callee, null, [[0, 11, 14, 17]]);
3540
+ }, _callee, null, [[0, 11, 13, 16]]);
3349
3541
  }));
3350
3542
 
3351
3543
  return function handleSubmit(_x) {
@@ -3366,7 +3558,7 @@ var WaitingList = function WaitingList(_ref) {
3366
3558
  email: ''
3367
3559
  },
3368
3560
  onSubmit: handleSubmit
3369
- }, React.createElement(Form, null, showTicketsField && React.createElement(React.Fragment, null, React.createElement("div", {
3561
+ }, React.createElement(Form, null, React.createElement(ErrorFocus, null), showTicketsField && React.createElement(React.Fragment, null, React.createElement("div", {
3370
3562
  className: "field-item"
3371
3563
  }, React.createElement(Field, {
3372
3564
  name: "ticketTypeId",