tf-checkout-react 1.0.47 → 1.0.51

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 (33) hide show
  1. package/dist/components/billing-info-container/index.d.ts +1 -1
  2. package/dist/components/billing-info-container/utils.d.ts +6 -0
  3. package/dist/components/common/CheckboxField.d.ts +2 -2
  4. package/dist/components/common/CustomField.d.ts +2 -1
  5. package/dist/components/common/SelectField.d.ts +20 -0
  6. package/dist/components/paymentContainer/index.d.ts +1 -1
  7. package/dist/components/stripePayment/index.d.ts +2 -1
  8. package/dist/tf-checkout-react.cjs.development.css +2 -2
  9. package/dist/tf-checkout-react.cjs.development.js +427 -264
  10. package/dist/tf-checkout-react.cjs.development.js.map +1 -1
  11. package/dist/tf-checkout-react.cjs.production.min.js +1 -1
  12. package/dist/tf-checkout-react.cjs.production.min.js.map +1 -1
  13. package/dist/tf-checkout-react.esm.js +434 -271
  14. package/dist/tf-checkout-react.esm.js.map +1 -1
  15. package/dist/types/billing-info-data.d.ts +3 -0
  16. package/dist/utils/formikErrorFocus.d.ts +2 -0
  17. package/dist/utils/getQueryVariable.d.ts +1 -0
  18. package/package.json +1 -1
  19. package/src/.DS_Store +0 -0
  20. package/src/components/.DS_Store +0 -0
  21. package/src/components/billing-info-container/index.tsx +124 -133
  22. package/src/components/billing-info-container/style.css +4 -0
  23. package/src/components/billing-info-container/utils.ts +44 -0
  24. package/src/components/common/CheckboxField.tsx +7 -2
  25. package/src/components/common/CustomField.tsx +21 -8
  26. package/src/components/common/SelectField.tsx +89 -0
  27. package/src/components/paymentContainer/index.tsx +31 -3
  28. package/src/components/stripePayment/index.tsx +48 -19
  29. package/src/components/stripePayment/style.css +10 -0
  30. package/src/components/waitingList/index.tsx +36 -25
  31. package/src/types/billing-info-data.ts +3 -0
  32. package/src/utils/formikErrorFocus.ts +24 -0
  33. package/src/utils/getQueryVariable.ts +13 -0
@@ -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,}))$/;
@@ -1559,6 +1576,7 @@ var setLoggedUserData = function setLoggedUserData(data) {
1559
1576
  first_name: data.firstName,
1560
1577
  last_name: data.lastName,
1561
1578
  email: data.email,
1579
+ confirmEmail: data.email,
1562
1580
  city: (data == null ? void 0 : data.city) || '',
1563
1581
  country: (data == null ? void 0 : data.country) || '',
1564
1582
  phone: (data == null ? void 0 : data.phone) || '',
@@ -1639,11 +1657,43 @@ var createCheckoutDataBody = function createCheckoutDataBody(ticketsQuantity, va
1639
1657
 
1640
1658
  return body;
1641
1659
  };
1660
+ var getValidateFunctions = function getValidateFunctions(element, states) {
1661
+ var validationFunctions = [];
1662
+
1663
+ if (element.required) {
1664
+ if (element.name !== 'state' || element.name === 'state' && states.length) {
1665
+ validationFunctions.push(requiredValidator);
1666
+ }
1667
+ }
1668
+
1669
+ if (element.onValidate) {
1670
+ validationFunctions.push(element.onValidate);
1671
+ }
1672
+
1673
+ return combineValidators.apply(void 0, validationFunctions);
1674
+ };
1675
+ var assingUniqueIds = function assingUniqueIds(data) {
1676
+ if (_get(data[0], 'uniqueId')) {
1677
+ return data;
1678
+ }
1679
+
1680
+ return _map(data, function (item) {
1681
+ _forEach(item, function (itemValue, key) {
1682
+ if (_isArray(itemValue)) {
1683
+ item[key] = assingUniqueIds(itemValue);
1684
+ }
1685
+ });
1686
+
1687
+ return _extends({}, item, {
1688
+ uniqueId: nanoid()
1689
+ });
1690
+ });
1691
+ };
1642
1692
 
1643
1693
  var useStyles = /*#__PURE__*/makeStyles({
1644
1694
  input: {
1645
- "&::placeholder": {
1646
- color: "gray"
1695
+ '&::placeholder': {
1696
+ color: 'gray'
1647
1697
  }
1648
1698
  }
1649
1699
  });
@@ -1656,13 +1706,14 @@ var CustomField = function CustomField(_ref) {
1656
1706
  selectOptions = _ref$selectOptions === void 0 ? [] : _ref$selectOptions,
1657
1707
  _ref$form = _ref.form,
1658
1708
  touched = _ref$form.touched,
1659
- errors = _ref$form.errors;
1709
+ errors = _ref$form.errors,
1710
+ theme = _ref.theme;
1660
1711
  var isSelectField = type === 'select';
1661
1712
  var isShrink = Boolean(field.value) || type === 'date' || type === 'select';
1662
- var isTouched = Boolean(_get(touched, field.name));
1663
1713
 
1664
1714
  var error = _get(errors, field.name);
1665
1715
 
1716
+ var isTouched = Boolean(_get(touched, field.name)) || _includes(field.name, 'holder') && !!error;
1666
1717
  var classes = useStyles();
1667
1718
  return React.createElement(TextField$1, Object.assign({
1668
1719
  id: field.name,
@@ -1681,7 +1732,11 @@ var CustomField = function CustomField(_ref) {
1681
1732
  }
1682
1733
  },
1683
1734
  SelectProps: {
1684
- "native": true
1735
+ "native": true,
1736
+ className: theme,
1737
+ MenuProps: {
1738
+ className: theme
1739
+ }
1685
1740
  }
1686
1741
  }, field), isSelectField ? _map(selectOptions, function (option) {
1687
1742
  return React.createElement("option", {
@@ -1692,7 +1747,7 @@ var CustomField = function CustomField(_ref) {
1692
1747
  }) : null);
1693
1748
  };
1694
1749
 
1695
- var _excluded$1 = ["label", "field"];
1750
+ var _excluded$1 = ["label", "field", "selectOptions", "theme"];
1696
1751
  var CheckboxField = function CheckboxField(_ref) {
1697
1752
  var label = _ref.label,
1698
1753
  field = _ref.field,
@@ -1721,6 +1776,101 @@ var getQueryVariable = function getQueryVariable(variable) {
1721
1776
  return false;
1722
1777
  };
1723
1778
 
1779
+ var useStyles$1 = /*#__PURE__*/makeStyles({
1780
+ input: {
1781
+ '&::placeholder': {
1782
+ color: 'gray'
1783
+ }
1784
+ }
1785
+ });
1786
+ var SelectField = function SelectField(_ref) {
1787
+ var label = _ref.label,
1788
+ _ref$type = _ref.type,
1789
+ type = _ref$type === void 0 ? 'text' : _ref$type,
1790
+ field = _ref.field,
1791
+ _ref$selectOptions = _ref.selectOptions,
1792
+ selectOptions = _ref$selectOptions === void 0 ? [] : _ref$selectOptions,
1793
+ _ref$form = _ref.form,
1794
+ touched = _ref$form.touched,
1795
+ errors = _ref$form.errors,
1796
+ theme = _ref.theme;
1797
+ var isTouched = Boolean(_get(touched, field.name));
1798
+
1799
+ var error = _get(errors, field.name);
1800
+
1801
+ var classes = useStyles$1();
1802
+ return React.createElement(FormControl, {
1803
+ fullWidth: true
1804
+ }, React.createElement(InputLabel, {
1805
+ htmlFor: field.name,
1806
+ error: !!error && isTouched
1807
+ }, label), React.createElement(Select, Object.assign({
1808
+ id: field.name,
1809
+ label: label,
1810
+ type: type,
1811
+ fullWidth: true,
1812
+ error: !!error && isTouched,
1813
+ inputProps: {
1814
+ id: field.name,
1815
+ classes: {
1816
+ input: classes.input
1817
+ }
1818
+ },
1819
+ "native": true,
1820
+ className: theme,
1821
+ MenuProps: {
1822
+ className: theme
1823
+ }
1824
+ }, field), _map(selectOptions, function (option) {
1825
+ return React.createElement("option", {
1826
+ key: option.value,
1827
+ value: option.value,
1828
+ disabled: option.disabled
1829
+ }, option.label);
1830
+ })), isTouched && error ? React.createElement(FormHelperText, {
1831
+ error: !!error && isTouched
1832
+ }, error) : null);
1833
+ };
1834
+
1835
+ var ErrorFocusInternal = /*#__PURE__*/function (_Component) {
1836
+ _inheritsLoose(ErrorFocusInternal, _Component);
1837
+
1838
+ function ErrorFocusInternal() {
1839
+ var _this;
1840
+
1841
+ _this = _Component.apply(this, arguments) || this;
1842
+
1843
+ _this.render = function () {
1844
+ return null;
1845
+ };
1846
+
1847
+ return _this;
1848
+ }
1849
+
1850
+ var _proto = ErrorFocusInternal.prototype;
1851
+
1852
+ _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
1853
+ var _prevProps$formik = prevProps.formik,
1854
+ isSubmitting = _prevProps$formik.isSubmitting,
1855
+ isValidating = _prevProps$formik.isValidating,
1856
+ errors = _prevProps$formik.errors;
1857
+ var keys = Object.keys(errors);
1858
+
1859
+ if (keys.length > 0 && isSubmitting && !isValidating) {
1860
+ var selector = "[name=\"" + keys[0] + "\"]";
1861
+ var errorElement = document.querySelector(selector);
1862
+
1863
+ if (errorElement) {
1864
+ errorElement.focus();
1865
+ }
1866
+ }
1867
+ };
1868
+
1869
+ return ErrorFocusInternal;
1870
+ }(Component);
1871
+
1872
+ var ErrorFocus = /*#__PURE__*/connect(ErrorFocusInternal);
1873
+
1724
1874
  var LogicRunner = function LogicRunner(_ref) {
1725
1875
  var values = _ref.values,
1726
1876
  setStates = _ref.setStates,
@@ -1792,7 +1942,7 @@ var LogicRunner = function LogicRunner(_ref) {
1792
1942
  lastName: parsedData == null ? void 0 : parsedData.last_name,
1793
1943
  email: (parsedData == null ? void 0 : parsedData.email) || '',
1794
1944
  phone: (parsedData == null ? void 0 : parsedData.phone) || '',
1795
- confirmEmail: '',
1945
+ confirmEmail: (parsedData == null ? void 0 : parsedData.email) || '',
1796
1946
  state: (parsedData == null ? void 0 : parsedData.state) || '',
1797
1947
  street_address: (parsedData == null ? void 0 : parsedData.street_address) || '',
1798
1948
  country: (parsedData == null ? void 0 : parsedData.country) || 1,
@@ -1814,93 +1964,88 @@ var LogicRunner = function LogicRunner(_ref) {
1814
1964
  return null;
1815
1965
  };
1816
1966
 
1817
- var SectionContainer = function SectionContainer(_ref3) {
1818
- var children = _ref3.children;
1819
- return React.createElement(React.Fragment, null, children);
1820
- };
1821
-
1822
- var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1823
- var _ref4$data = _ref4.data,
1824
- data = _ref4$data === void 0 ? [] : _ref4$data,
1825
- _ref4$ticketHoldersFi = _ref4.ticketHoldersFields,
1826
- ticketHoldersFields = _ref4$ticketHoldersFi === void 0 ? {
1967
+ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
1968
+ var _ref3$data = _ref3.data,
1969
+ data = _ref3$data === void 0 ? [] : _ref3$data,
1970
+ _ref3$ticketHoldersFi = _ref3.ticketHoldersFields,
1971
+ ticketHoldersFields = _ref3$ticketHoldersFi === void 0 ? {
1827
1972
  id: 1,
1828
1973
  fields: []
1829
- } : _ref4$ticketHoldersFi,
1830
- _ref4$initialValues = _ref4.initialValues,
1831
- initialValues = _ref4$initialValues === void 0 ? {} : _ref4$initialValues,
1832
- _ref4$buttonName = _ref4.buttonName,
1833
- buttonName = _ref4$buttonName === void 0 ? 'Submit' : _ref4$buttonName,
1834
- _ref4$handleSubmit = _ref4.handleSubmit,
1835
- handleSubmit = _ref4$handleSubmit === void 0 ? _identity : _ref4$handleSubmit,
1836
- _ref4$theme = _ref4.theme,
1837
- theme = _ref4$theme === void 0 ? 'light' : _ref4$theme,
1838
- _ref4$onRegisterSucce = _ref4.onRegisterSuccess,
1839
- onRegisterSuccess = _ref4$onRegisterSucce === void 0 ? function () {} : _ref4$onRegisterSucce,
1840
- _ref4$onRegisterError = _ref4.onRegisterError,
1841
- onRegisterError = _ref4$onRegisterError === void 0 ? function () {} : _ref4$onRegisterError,
1842
- _ref4$onSubmitError = _ref4.onSubmitError,
1843
- onSubmitError = _ref4$onSubmitError === void 0 ? function () {} : _ref4$onSubmitError,
1844
- _ref4$onGetCartSucces = _ref4.onGetCartSuccess,
1845
- onGetCartSuccess = _ref4$onGetCartSucces === void 0 ? function () {} : _ref4$onGetCartSucces,
1846
- _ref4$onGetCartError = _ref4.onGetCartError,
1847
- onGetCartError = _ref4$onGetCartError === void 0 ? function () {} : _ref4$onGetCartError,
1848
- _ref4$onGetCountriesS = _ref4.onGetCountriesSuccess,
1849
- onGetCountriesSuccess = _ref4$onGetCountriesS === void 0 ? function () {} : _ref4$onGetCountriesS,
1850
- _ref4$onGetCountriesE = _ref4.onGetCountriesError,
1851
- onGetCountriesError = _ref4$onGetCountriesE === void 0 ? function () {} : _ref4$onGetCountriesE,
1852
- _ref4$onGetStatesSucc = _ref4.onGetStatesSuccess,
1853
- onGetStatesSuccess = _ref4$onGetStatesSucc === void 0 ? function () {} : _ref4$onGetStatesSucc,
1854
- _ref4$onGetStatesErro = _ref4.onGetStatesError,
1855
- onGetStatesError = _ref4$onGetStatesErro === void 0 ? function () {} : _ref4$onGetStatesErro,
1856
- _ref4$onGetProfileDat = _ref4.onGetProfileDataSuccess,
1857
- onGetProfileDataSuccess = _ref4$onGetProfileDat === void 0 ? function () {} : _ref4$onGetProfileDat,
1858
- _ref4$onGetProfileDat2 = _ref4.onGetProfileDataError,
1859
- onGetProfileDataError = _ref4$onGetProfileDat2 === void 0 ? function () {} : _ref4$onGetProfileDat2,
1860
- _ref4$onAuthorizeSucc = _ref4.onAuthorizeSuccess,
1861
- onAuthorizeSuccess = _ref4$onAuthorizeSucc === void 0 ? function () {} : _ref4$onAuthorizeSucc,
1862
- _ref4$onAuthorizeErro = _ref4.onAuthorizeError,
1863
- onAuthorizeError = _ref4$onAuthorizeErro === void 0 ? function () {} : _ref4$onAuthorizeErro,
1864
- _ref4$onLogin = _ref4.onLogin,
1865
- onLogin = _ref4$onLogin === void 0 ? function () {} : _ref4$onLogin;
1974
+ } : _ref3$ticketHoldersFi,
1975
+ _ref3$initialValues = _ref3.initialValues,
1976
+ initialValues = _ref3$initialValues === void 0 ? {} : _ref3$initialValues,
1977
+ _ref3$buttonName = _ref3.buttonName,
1978
+ buttonName = _ref3$buttonName === void 0 ? 'Submit' : _ref3$buttonName,
1979
+ _ref3$handleSubmit = _ref3.handleSubmit,
1980
+ handleSubmit = _ref3$handleSubmit === void 0 ? _identity : _ref3$handleSubmit,
1981
+ _ref3$theme = _ref3.theme,
1982
+ theme = _ref3$theme === void 0 ? 'light' : _ref3$theme,
1983
+ _ref3$onRegisterSucce = _ref3.onRegisterSuccess,
1984
+ onRegisterSuccess = _ref3$onRegisterSucce === void 0 ? function () {} : _ref3$onRegisterSucce,
1985
+ _ref3$onRegisterError = _ref3.onRegisterError,
1986
+ onRegisterError = _ref3$onRegisterError === void 0 ? function () {} : _ref3$onRegisterError,
1987
+ _ref3$onSubmitError = _ref3.onSubmitError,
1988
+ onSubmitError = _ref3$onSubmitError === void 0 ? function () {} : _ref3$onSubmitError,
1989
+ _ref3$onGetCartSucces = _ref3.onGetCartSuccess,
1990
+ onGetCartSuccess = _ref3$onGetCartSucces === void 0 ? function () {} : _ref3$onGetCartSucces,
1991
+ _ref3$onGetCartError = _ref3.onGetCartError,
1992
+ onGetCartError = _ref3$onGetCartError === void 0 ? function () {} : _ref3$onGetCartError,
1993
+ _ref3$onGetCountriesS = _ref3.onGetCountriesSuccess,
1994
+ onGetCountriesSuccess = _ref3$onGetCountriesS === void 0 ? function () {} : _ref3$onGetCountriesS,
1995
+ _ref3$onGetCountriesE = _ref3.onGetCountriesError,
1996
+ onGetCountriesError = _ref3$onGetCountriesE === void 0 ? function () {} : _ref3$onGetCountriesE,
1997
+ _ref3$onGetStatesSucc = _ref3.onGetStatesSuccess,
1998
+ onGetStatesSuccess = _ref3$onGetStatesSucc === void 0 ? function () {} : _ref3$onGetStatesSucc,
1999
+ _ref3$onGetStatesErro = _ref3.onGetStatesError,
2000
+ onGetStatesError = _ref3$onGetStatesErro === void 0 ? function () {} : _ref3$onGetStatesErro,
2001
+ _ref3$onGetProfileDat = _ref3.onGetProfileDataSuccess,
2002
+ onGetProfileDataSuccess = _ref3$onGetProfileDat === void 0 ? function () {} : _ref3$onGetProfileDat,
2003
+ _ref3$onGetProfileDat2 = _ref3.onGetProfileDataError,
2004
+ onGetProfileDataError = _ref3$onGetProfileDat2 === void 0 ? function () {} : _ref3$onGetProfileDat2,
2005
+ _ref3$onAuthorizeSucc = _ref3.onAuthorizeSuccess,
2006
+ onAuthorizeSuccess = _ref3$onAuthorizeSucc === void 0 ? function () {} : _ref3$onAuthorizeSucc,
2007
+ _ref3$onAuthorizeErro = _ref3.onAuthorizeError,
2008
+ onAuthorizeError = _ref3$onAuthorizeErro === void 0 ? function () {} : _ref3$onAuthorizeErro,
2009
+ _ref3$onLogin = _ref3.onLogin,
2010
+ onLogin = _ref3$onLogin === void 0 ? function () {} : _ref3$onLogin;
1866
2011
  var userData = typeof window !== 'undefined' && window.localStorage.getItem('user_data') ? JSON.parse(window.localStorage.getItem('user_data') || '') : {};
1867
2012
  var access_token = typeof window !== 'undefined' && window.localStorage.getItem('access_token') ? window.localStorage.getItem('access_token') || '' : '';
1868
2013
 
1869
- var _useState = useState({}),
1870
- cartInfoData = _useState[0],
1871
- setCartInfo = _useState[1];
2014
+ var _useState = useState(data),
2015
+ dataWithUniqueIds = _useState[0],
2016
+ setDataWithUniqueIds = _useState[1];
1872
2017
 
1873
- var _useState2 = useState([]),
1874
- countries = _useState2[0],
1875
- setCountries = _useState2[1];
2018
+ var _useState2 = useState({}),
2019
+ cartInfoData = _useState2[0],
2020
+ setCartInfo = _useState2[1];
1876
2021
 
1877
2022
  var _useState3 = useState([]),
1878
- states = _useState3[0],
1879
- setStates = _useState3[1];
2023
+ countries = _useState3[0],
2024
+ setCountries = _useState3[1];
1880
2025
 
1881
- var _useState4 = useState(false),
1882
- showModalLogin = _useState4[0],
1883
- setShowModalLogin = _useState4[1];
2026
+ var _useState4 = useState([]),
2027
+ states = _useState4[0],
2028
+ setStates = _useState4[1];
1884
2029
 
1885
2030
  var _useState5 = useState(false),
1886
- alreadyHasUser = _useState5[0],
1887
- setAlreadyHasUser = _useState5[1];
2031
+ showModalLogin = _useState5[0],
2032
+ setShowModalLogin = _useState5[1];
1888
2033
 
1889
2034
  var _useState6 = useState(false),
1890
- userExpired = _useState6[0],
1891
- setUserExpired = _useState6[1];
2035
+ alreadyHasUser = _useState6[0],
2036
+ setAlreadyHasUser = _useState6[1];
1892
2037
 
1893
2038
  var _useState7 = useState(false),
1894
- showModalRegister = _useState7[0],
1895
- setShowModalRegister = _useState7[1];
2039
+ userExpired = _useState7[0],
2040
+ setUserExpired = _useState7[1];
1896
2041
 
1897
- var _useState8 = useState([]),
1898
- ticketsQuantity = _useState8[0],
1899
- setTicketsQuantity = _useState8[1];
2042
+ var _useState8 = useState(false),
2043
+ showModalRegister = _useState8[0],
2044
+ setShowModalRegister = _useState8[1];
1900
2045
 
1901
2046
  var _useState9 = useState([]),
1902
- conditions = _useState9[0],
1903
- setConditions = _useState9[1];
2047
+ ticketsQuantity = _useState9[0],
2048
+ setTicketsQuantity = _useState9[1];
1904
2049
 
1905
2050
  var _useState10 = useState({
1906
2051
  firstName: '',
@@ -1934,7 +2079,11 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1934
2079
 
1935
2080
  var optedInFieldValue = _get(cartInfoData, 'optedIn', false);
1936
2081
 
1937
- var hideOptIn = _get(cartInfoData, 'hide_ttf_opt_in', false);
2082
+ var hideTtfOptIn = _get(cartInfoData, 'hide_ttf_opt_in', true);
2083
+
2084
+ if (!_get(dataWithUniqueIds, '[0].uniqueId')) {
2085
+ setDataWithUniqueIds(assingUniqueIds(data));
2086
+ }
1938
2087
 
1939
2088
  var getQuantity = function getQuantity(cart) {
1940
2089
  if (cart === void 0) {
@@ -1950,60 +2099,20 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
1950
2099
 
1951
2100
 
1952
2101
  useEffect(function () {
1953
- // fetch conditions data
1954
- var fetchConditions = /*#__PURE__*/function () {
1955
- var _ref5 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
1956
- var res, conditionsInfo;
2102
+ // fetch countries data
2103
+ var fetchCountries = /*#__PURE__*/function () {
2104
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
2105
+ var res;
1957
2106
  return runtime_1.wrap(function _callee2$(_context2) {
1958
2107
  while (1) {
1959
2108
  switch (_context2.prev = _context2.next) {
1960
2109
  case 0:
1961
- if (!eventId) {
1962
- _context2.next = 6;
1963
- break;
1964
- }
1965
-
2110
+ _context2.prev = 0;
1966
2111
  _context2.next = 3;
1967
- return getConditions(eventId);
1968
-
1969
- case 3:
1970
- res = _context2.sent;
1971
- conditionsInfo = _get(res, 'data.data.attributes');
1972
- setConditions(conditionsInfo ? conditionsInfo.map(function (item) {
1973
- return {
1974
- id: nanoid(),
1975
- text: item
1976
- };
1977
- }) : []);
1978
-
1979
- case 6:
1980
- case "end":
1981
- return _context2.stop();
1982
- }
1983
- }
1984
- }, _callee2);
1985
- }));
1986
-
1987
- return function fetchConditions() {
1988
- return _ref5.apply(this, arguments);
1989
- };
1990
- }();
1991
-
1992
- fetchConditions(); // fetch countries data
1993
-
1994
- var fetchCountries = /*#__PURE__*/function () {
1995
- var _ref6 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
1996
- var res;
1997
- return runtime_1.wrap(function _callee3$(_context3) {
1998
- while (1) {
1999
- switch (_context3.prev = _context3.next) {
2000
- case 0:
2001
- _context3.prev = 0;
2002
- _context3.next = 3;
2003
2112
  return getCountries();
2004
2113
 
2005
2114
  case 3:
2006
- res = _context3.sent;
2115
+ res = _context2.sent;
2007
2116
  setCustomHeader(res);
2008
2117
  setCountries(_map(_get(res, 'data.data'), function (item, key) {
2009
2118
  return {
@@ -2012,27 +2121,27 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2012
2121
  };
2013
2122
  }));
2014
2123
  onGetCountriesSuccess(res.data);
2015
- _context3.next = 12;
2124
+ _context2.next = 12;
2016
2125
  break;
2017
2126
 
2018
2127
  case 9:
2019
- _context3.prev = 9;
2020
- _context3.t0 = _context3["catch"](0);
2128
+ _context2.prev = 9;
2129
+ _context2.t0 = _context2["catch"](0);
2021
2130
 
2022
- if (axios.isAxiosError(_context3.t0)) {
2023
- onGetCountriesError(_context3.t0);
2131
+ if (axios.isAxiosError(_context2.t0)) {
2132
+ onGetCountriesError(_context2.t0);
2024
2133
  }
2025
2134
 
2026
2135
  case 12:
2027
2136
  case "end":
2028
- return _context3.stop();
2137
+ return _context2.stop();
2029
2138
  }
2030
2139
  }
2031
- }, _callee3, null, [[0, 9]]);
2140
+ }, _callee2, null, [[0, 9]]);
2032
2141
  }));
2033
2142
 
2034
2143
  return function fetchCountries() {
2035
- return _ref6.apply(this, arguments);
2144
+ return _ref4.apply(this, arguments);
2036
2145
  };
2037
2146
  }();
2038
2147
 
@@ -2041,19 +2150,19 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2041
2150
  }, []); // fetch cart data
2042
2151
 
2043
2152
  var fetchCart = /*#__PURE__*/function () {
2044
- var _ref7 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4() {
2153
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
2045
2154
  var res, cartInfo, _cartInfo$cart, cart;
2046
2155
 
2047
- return runtime_1.wrap(function _callee4$(_context4) {
2156
+ return runtime_1.wrap(function _callee3$(_context3) {
2048
2157
  while (1) {
2049
- switch (_context4.prev = _context4.next) {
2158
+ switch (_context3.prev = _context3.next) {
2050
2159
  case 0:
2051
- _context4.prev = 0;
2052
- _context4.next = 3;
2160
+ _context3.prev = 0;
2161
+ _context3.next = 3;
2053
2162
  return getCart();
2054
2163
 
2055
2164
  case 3:
2056
- res = _context4.sent;
2165
+ res = _context3.sent;
2057
2166
  setCustomHeader(res);
2058
2167
  cartInfo = _get(res, 'data.data.attributes');
2059
2168
  setCartInfo(cartInfo);
@@ -2062,50 +2171,50 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2062
2171
  return nanoid();
2063
2172
  }));
2064
2173
  onGetCartSuccess(res.data);
2065
- _context4.next = 15;
2174
+ _context3.next = 15;
2066
2175
  break;
2067
2176
 
2068
2177
  case 12:
2069
- _context4.prev = 12;
2070
- _context4.t0 = _context4["catch"](0);
2178
+ _context3.prev = 12;
2179
+ _context3.t0 = _context3["catch"](0);
2071
2180
 
2072
- if (axios.isAxiosError(_context4.t0)) {
2073
- onGetCartError(_context4.t0);
2181
+ if (axios.isAxiosError(_context3.t0)) {
2182
+ onGetCartError(_context3.t0);
2074
2183
  }
2075
2184
 
2076
2185
  case 15:
2077
2186
  case "end":
2078
- return _context4.stop();
2187
+ return _context3.stop();
2079
2188
  }
2080
2189
  }
2081
- }, _callee4, null, [[0, 12]]);
2190
+ }, _callee3, null, [[0, 12]]);
2082
2191
  }));
2083
2192
 
2084
2193
  return function fetchCart() {
2085
- return _ref7.apply(this, arguments);
2194
+ return _ref5.apply(this, arguments);
2086
2195
  };
2087
2196
  }(); // fetch user data
2088
2197
 
2089
2198
 
2090
2199
  var fetchUserData = /*#__PURE__*/function () {
2091
- var _ref8 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(token) {
2200
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(token) {
2092
2201
  var userDataResponse, profileSpecifiedData, profileDataObj;
2093
- return runtime_1.wrap(function _callee5$(_context5) {
2202
+ return runtime_1.wrap(function _callee4$(_context4) {
2094
2203
  while (1) {
2095
- switch (_context5.prev = _context5.next) {
2204
+ switch (_context4.prev = _context4.next) {
2096
2205
  case 0:
2097
- _context5.prev = 0;
2206
+ _context4.prev = 0;
2098
2207
 
2099
2208
  if (!(typeof window !== 'undefined' && token)) {
2100
- _context5.next = 10;
2209
+ _context4.next = 10;
2101
2210
  break;
2102
2211
  }
2103
2212
 
2104
- _context5.next = 4;
2213
+ _context4.next = 4;
2105
2214
  return getProfileData(token);
2106
2215
 
2107
2216
  case 4:
2108
- userDataResponse = _context5.sent;
2217
+ userDataResponse = _context4.sent;
2109
2218
  profileSpecifiedData = _get(userDataResponse, 'data.data');
2110
2219
  profileDataObj = setLoggedUserData(profileSpecifiedData);
2111
2220
  setUserValues(profileDataObj);
@@ -2113,27 +2222,27 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2113
2222
  onGetProfileDataSuccess(userDataResponse.data);
2114
2223
 
2115
2224
  case 10:
2116
- _context5.next = 15;
2225
+ _context4.next = 15;
2117
2226
  break;
2118
2227
 
2119
2228
  case 12:
2120
- _context5.prev = 12;
2121
- _context5.t0 = _context5["catch"](0);
2229
+ _context4.prev = 12;
2230
+ _context4.t0 = _context4["catch"](0);
2122
2231
 
2123
- if (axios.isAxiosError(_context5.t0)) {
2124
- onGetProfileDataError(_context5.t0);
2232
+ if (axios.isAxiosError(_context4.t0)) {
2233
+ onGetProfileDataError(_context4.t0);
2125
2234
  }
2126
2235
 
2127
2236
  case 15:
2128
2237
  case "end":
2129
- return _context5.stop();
2238
+ return _context4.stop();
2130
2239
  }
2131
2240
  }
2132
- }, _callee5, null, [[0, 12]]);
2241
+ }, _callee4, null, [[0, 12]]);
2133
2242
  }));
2134
2243
 
2135
2244
  return function fetchUserData(_x) {
2136
- return _ref8.apply(this, arguments);
2245
+ return _ref6.apply(this, arguments);
2137
2246
  };
2138
2247
  }();
2139
2248
 
@@ -2141,7 +2250,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2141
2250
  fetchUserData(access_token);
2142
2251
  }, [access_token]);
2143
2252
  return React.createElement(React.Fragment, null, React.createElement(Formik, {
2144
- initialValues: getInitialValues(data, _extends({}, initialValues, {
2253
+ initialValues: getInitialValues(dataWithUniqueIds, _extends({}, initialValues, {
2145
2254
  email: emailLogged,
2146
2255
  firstName: firstNameLogged,
2147
2256
  lastName: lastNameLogged,
@@ -2150,30 +2259,30 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2150
2259
  }), userValues),
2151
2260
  enableReinitialize: true,
2152
2261
  onSubmit: function () {
2153
- var _onSubmit = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(values, formikHelpers) {
2262
+ var _onSubmit = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(values, formikHelpers) {
2154
2263
  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;
2155
2264
 
2156
- return runtime_1.wrap(function _callee6$(_context6) {
2265
+ return runtime_1.wrap(function _callee5$(_context5) {
2157
2266
  while (1) {
2158
- switch (_context6.prev = _context6.next) {
2267
+ switch (_context5.prev = _context5.next) {
2159
2268
  case 0:
2160
- _context6.prev = 0;
2269
+ _context5.prev = 0;
2161
2270
 
2162
2271
  if (!isLoggedIn) {
2163
- _context6.next = 15;
2272
+ _context5.next = 15;
2164
2273
  break;
2165
2274
  }
2166
2275
 
2167
2276
  if (!access_token) {
2168
- _context6.next = 9;
2277
+ _context5.next = 9;
2169
2278
  break;
2170
2279
  }
2171
2280
 
2172
- _context6.next = 5;
2281
+ _context5.next = 5;
2173
2282
  return getProfileData(access_token);
2174
2283
 
2175
2284
  case 5:
2176
- updatedUserData = _context6.sent;
2285
+ updatedUserData = _context5.sent;
2177
2286
  _profileSpecifiedData = _get(updatedUserData, 'data.data');
2178
2287
  _profileDataObj = setLoggedUserData(_profileSpecifiedData);
2179
2288
 
@@ -2187,23 +2296,23 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2187
2296
  firstNameLogged: firstNameLogged,
2188
2297
  lastNameLogged: lastNameLogged
2189
2298
  }, showDOB);
2190
- _context6.next = 12;
2299
+ _context5.next = 12;
2191
2300
  return postOnCheckout(_checkoutBody, access_token);
2192
2301
 
2193
2302
  case 12:
2194
- _res = _context6.sent;
2195
- handleSubmit(values, formikHelpers, _res);
2196
- return _context6.abrupt("return");
2303
+ _res = _context5.sent;
2304
+ handleSubmit(values, formikHelpers, eventId, _res);
2305
+ return _context5.abrupt("return");
2197
2306
 
2198
2307
  case 15:
2199
2308
  bodyFormData = createRegisterFormData(values);
2200
2309
  access_token_register = null;
2201
- _context6.prev = 17;
2202
- _context6.next = 20;
2310
+ _context5.prev = 17;
2311
+ _context5.next = 20;
2203
2312
  return register(bodyFormData);
2204
2313
 
2205
2314
  case 20:
2206
- resRegister = _context6.sent;
2315
+ resRegister = _context5.sent;
2207
2316
  access_token_register = _get(resRegister, 'data.data.attributes.access_token');
2208
2317
  refreshToken = _get(resRegister, 'data.data.attributes.refresh_token');
2209
2318
  handleSetAccessToken(access_token_register);
@@ -2212,15 +2321,15 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2212
2321
  refreshToken: refreshToken
2213
2322
  };
2214
2323
  onRegisterSuccess(tokens);
2215
- _context6.next = 32;
2324
+ _context5.next = 32;
2216
2325
  break;
2217
2326
 
2218
2327
  case 28:
2219
- _context6.prev = 28;
2220
- _context6.t0 = _context6["catch"](17);
2328
+ _context5.prev = 28;
2329
+ _context5.t0 = _context5["catch"](17);
2221
2330
 
2222
- if (axios.isAxiosError(_context6.t0)) {
2223
- error = _context6.t0 == null ? void 0 : (_e$response = _context6.t0.response) == null ? void 0 : (_e$response$data = _e$response.data) == null ? void 0 : _e$response$data.message;
2331
+ if (axios.isAxiosError(_context5.t0)) {
2332
+ 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;
2224
2333
 
2225
2334
  if (_includes(error, 'You must be aged')) {
2226
2335
  formikHelpers.setFieldError('holderAge', error);
@@ -2236,17 +2345,17 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2236
2345
  setShowModalLogin(true);
2237
2346
  }
2238
2347
 
2239
- onRegisterError(_context6.t0);
2348
+ onRegisterError(_context5.t0);
2240
2349
  }
2241
2350
 
2242
- return _context6.abrupt("return");
2351
+ return _context5.abrupt("return");
2243
2352
 
2244
2353
  case 32:
2245
- _context6.next = 34;
2354
+ _context5.next = 34;
2246
2355
  return getProfileData(access_token_register);
2247
2356
 
2248
2357
  case 34:
2249
- profileData = _context6.sent;
2358
+ profileData = _context5.sent;
2250
2359
  profileSpecifiedData = _get(profileData, 'data.data');
2251
2360
  profileDataObj = setLoggedUserData(profileSpecifiedData);
2252
2361
 
@@ -2259,21 +2368,21 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2259
2368
  firstNameLogged: firstNameLogged,
2260
2369
  lastNameLogged: lastNameLogged
2261
2370
  }, showDOB);
2262
- _context6.next = 41;
2371
+ _context5.next = 41;
2263
2372
  return postOnCheckout(checkoutBody, access_token_register);
2264
2373
 
2265
2374
  case 41:
2266
- res = _context6.sent;
2267
- handleSubmit(values, formikHelpers, res);
2268
- _context6.next = 48;
2375
+ res = _context5.sent;
2376
+ handleSubmit(values, formikHelpers, eventId, res);
2377
+ _context5.next = 48;
2269
2378
  break;
2270
2379
 
2271
2380
  case 45:
2272
- _context6.prev = 45;
2273
- _context6.t1 = _context6["catch"](0);
2381
+ _context5.prev = 45;
2382
+ _context5.t1 = _context5["catch"](0);
2274
2383
 
2275
- if (axios.isAxiosError(_context6.t1)) {
2276
- if (((_e$response2 = _context6.t1.response) == null ? void 0 : _e$response2.data.error) === 'invalid_token') {
2384
+ if (axios.isAxiosError(_context5.t1)) {
2385
+ if (((_e$response2 = _context5.t1.response) == null ? void 0 : _e$response2.data.error) === 'invalid_token') {
2277
2386
  if (typeof window !== 'undefined') {
2278
2387
  window.localStorage.removeItem('user_data');
2279
2388
  window.localStorage.removeItem('access_token');
@@ -2282,15 +2391,15 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2282
2391
  }
2283
2392
  }
2284
2393
 
2285
- onSubmitError(_context6.t1);
2394
+ onSubmitError(_context5.t1);
2286
2395
  }
2287
2396
 
2288
2397
  case 48:
2289
2398
  case "end":
2290
- return _context6.stop();
2399
+ return _context5.stop();
2291
2400
  }
2292
2401
  }
2293
- }, _callee6, null, [[0, 45], [17, 28]]);
2402
+ }, _callee5, null, [[0, 45], [17, 28]]);
2294
2403
  }));
2295
2404
 
2296
2405
  function onSubmit(_x2, _x3) {
@@ -2302,7 +2411,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2302
2411
  }, function (props) {
2303
2412
  return React.createElement(Form, {
2304
2413
  onSubmit: props.handleSubmit
2305
- }, React.createElement(LogicRunner, {
2414
+ }, React.createElement(ErrorFocus, null), React.createElement(LogicRunner, {
2306
2415
  values: props.values,
2307
2416
  setStates: setStates,
2308
2417
  setFieldValue: props.setFieldValue,
@@ -2323,9 +2432,8 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2323
2432
  onLogin();
2324
2433
  setShowModalLogin(true);
2325
2434
  }
2326
- }, "Login"))), _map(data, function (item) {
2327
- var id = item.id,
2328
- label = item.label,
2435
+ }, "Login"))), _map(dataWithUniqueIds, function (item) {
2436
+ var label = item.label,
2329
2437
  labelClassName = item.labelClassName,
2330
2438
  fields = item.fields;
2331
2439
 
@@ -2333,8 +2441,8 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2333
2441
  return null;
2334
2442
  }
2335
2443
 
2336
- return React.createElement(SectionContainer, {
2337
- key: id
2444
+ return React.createElement(React.Fragment, {
2445
+ key: item.uniqueId
2338
2446
  }, React.createElement("p", {
2339
2447
  className: labelClassName
2340
2448
  }, label), _map(fields, function (group) {
@@ -2342,8 +2450,8 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2342
2450
  groupItems = group.groupItems,
2343
2451
  groupLabel = group.groupLabel,
2344
2452
  groupLabelClassName = group.groupLabelClassName;
2345
- return React.createElement(SectionContainer, {
2346
- key: group.id
2453
+ return React.createElement(React.Fragment, {
2454
+ key: group.uniqueId
2347
2455
  }, !isLoggedIn && React.createElement("div", {
2348
2456
  className: groupLabelClassName
2349
2457
  }, groupLabel), React.createElement("div", {
@@ -2361,42 +2469,47 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2361
2469
  return false;
2362
2470
  }
2363
2471
 
2364
- if (el.name === 'brand_opt_in' && hideOptIn) {
2472
+ if (el.name === 'ttf_opt_in' && hideTtfOptIn) {
2365
2473
  return false;
2366
2474
  }
2367
2475
 
2368
2476
  return true;
2369
2477
  }), function (element) {
2370
- return ['password', 'confirmPassword'].includes(element.name) && isLoggedIn ? null : React.createElement("div", {
2371
- className: element.className,
2372
- key: element.name
2478
+ return ['password', 'confirmPassword'].includes(element.name) && isLoggedIn ? null : React.createElement(React.Fragment, {
2479
+ key: element.uniqueId
2480
+ }, element.name === 'email' ? React.createElement("div", {
2481
+ className: "email-checking"
2482
+ }, "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", {
2483
+ className: element.className
2373
2484
  }, element.component ? element.component : React.createElement(Field, {
2374
2485
  name: element.name,
2375
2486
  label: element.label,
2376
2487
  type: element.type,
2377
- validate: combineValidators(element.required ? requiredValidator : function () {}, element.onValidate ? element.onValidate : function () {}),
2378
- component: element.type === 'checkbox' ? CheckboxField : CustomField,
2379
- selectOptions: element.name === 'country' ? countries : element.name === 'state' ? states : []
2380
- }));
2488
+ validate: getValidateFunctions(element, states),
2489
+ component: element.type === 'checkbox' ? CheckboxField : element.type === 'select' ? SelectField : CustomField,
2490
+ selectOptions: element.name === 'country' ? countries : element.name === 'state' ? states : [],
2491
+ theme: theme
2492
+ })));
2381
2493
  })));
2382
2494
  }));
2383
- }), showTicketHolderName && React.createElement(React.Fragment, null, React.createElement("p", null, ticketHoldersFields.label), _map(ticketsQuantity, function (_item, index) {
2495
+ }), showTicketHolderName && React.createElement(React.Fragment, null, React.createElement("div", {
2496
+ className: "ticket-holders-fields"
2497
+ }, React.createElement("p", null, ticketHoldersFields.label), _map(ticketsQuantity, function (_item, index) {
2384
2498
  return React.createElement("div", {
2385
2499
  key: _item
2386
2500
  }, React.createElement("h5", null, "Ticket ", index + 1), _map(ticketHoldersFields.fields, function (group) {
2387
2501
  var groupClassname = group.groupClassname,
2388
2502
  groupItems = group.groupItems;
2389
2503
  return React.createElement("div", {
2390
- key: group.id
2504
+ key: group.uniqueId
2391
2505
  }, React.createElement("div", {
2392
2506
  className: groupClassname
2393
2507
  }, _map(groupItems, function (element) {
2394
2508
  return React.createElement("div", {
2395
2509
  className: element.className,
2396
- key: element.name + "-" + index
2510
+ key: element.uniqueId
2397
2511
  }, React.createElement(Field, {
2398
2512
  name: element.name + "-" + index,
2399
- key: element.name + "-" + index,
2400
2513
  label: element.label,
2401
2514
  type: element.type,
2402
2515
  required: true,
@@ -2405,21 +2518,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2405
2518
  }));
2406
2519
  })));
2407
2520
  }));
2408
- })), conditions == null ? void 0 : conditions.map(function (checkbox) {
2409
- return React.createElement("div", {
2410
- className: 'billing-info-container__singleField',
2411
- key: checkbox.id
2412
- }, React.createElement("div", {
2413
- className: "width-fc"
2414
- }, React.createElement(Field, {
2415
- name: checkbox.id,
2416
- label: checkbox.text,
2417
- type: 'checkbox',
2418
- required: true,
2419
- component: CheckboxField,
2420
- validate: combineValidators(requiredValidator)
2421
- })));
2422
- }), React.createElement("div", {
2521
+ }))), React.createElement("div", {
2423
2522
  className: "button-container"
2424
2523
  }, React.createElement(LoadingButton, {
2425
2524
  type: "submit",
@@ -2461,7 +2560,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
2461
2560
  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}";
2462
2561
  styleInject(css_248z$3);
2463
2562
 
2464
- 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_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%}";
2563
+ 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%}";
2465
2564
  styleInject(css_248z$4);
2466
2565
 
2467
2566
  var currencyNormalizerCreator = function currencyNormalizerCreator(value, currency) {
@@ -2534,6 +2633,7 @@ var getCurrencySymbolByCurrency = function getCurrencySymbolByCurrency(currency)
2534
2633
  var options = {
2535
2634
  style: {
2536
2635
  base: {
2636
+ backgroundColor: '#232323',
2537
2637
  fontSize: '18px',
2538
2638
  color: '#ffffff',
2539
2639
  letterSpacing: '1px',
@@ -2561,7 +2661,9 @@ var CheckoutForm = function CheckoutForm(_ref) {
2561
2661
  _ref$isLoading = _ref.isLoading,
2562
2662
  isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
2563
2663
  _ref$handleSetLoading = _ref.handleSetLoading,
2564
- handleSetLoading = _ref$handleSetLoading === void 0 ? function () {} : _ref$handleSetLoading;
2664
+ handleSetLoading = _ref$handleSetLoading === void 0 ? function () {} : _ref$handleSetLoading,
2665
+ _ref$conditions = _ref.conditions,
2666
+ conditions = _ref$conditions === void 0 ? [] : _ref$conditions;
2565
2667
  var stripe = useStripe();
2566
2668
  var elements = useElements();
2567
2669
 
@@ -2590,7 +2692,7 @@ var CheckoutForm = function CheckoutForm(_ref) {
2590
2692
  break;
2591
2693
  }
2592
2694
 
2593
- setStripeError("Please enter your zip code.");
2695
+ setStripeError('Please enter your zip code.');
2594
2696
  handleSetLoading(false);
2595
2697
  return _context.abrupt("return");
2596
2698
 
@@ -2691,6 +2793,7 @@ var CheckoutForm = function CheckoutForm(_ref) {
2691
2793
  zipCode && setPostalCode(zipCode);
2692
2794
  }
2693
2795
  }, []);
2796
+ var buttonIsDiabled = !stripe || !!error || isLoading;
2694
2797
  return React.createElement("div", {
2695
2798
  className: "stripe_payment_container"
2696
2799
  }, !!stripeError && React.createElement("div", {
@@ -2730,10 +2833,21 @@ var CheckoutForm = function CheckoutForm(_ref) {
2730
2833
  value: postalCode,
2731
2834
  onChange: onChangePostalCode,
2732
2835
  placeholder: "ZIP"
2733
- }))), React.createElement("div", {
2734
- className: "payment_button"
2836
+ }))), conditions == null ? void 0 : conditions.map(function (checkbox) {
2837
+ return React.createElement("div", {
2838
+ className: 'billing-info-container__singleField',
2839
+ key: checkbox.id
2840
+ }, React.createElement("div", {
2841
+ className: "conditions-block"
2842
+ }, React.createElement(CheckboxField, {
2843
+ name: checkbox.id,
2844
+ label: checkbox.text,
2845
+ required: true
2846
+ })));
2847
+ }), React.createElement("div", {
2848
+ className: "payment_button " + (buttonIsDiabled ? 'disabled-payment-button' : '')
2735
2849
  }, React.createElement("button", {
2736
- disabled: !stripe || !!error || isLoading,
2850
+ disabled: buttonIsDiabled,
2737
2851
  type: "submit"
2738
2852
  }, isLoading ? React.createElement(CircularProgress$1, null) : "Pay " + getCurrencySymbolByCurrency(currency) + total))));
2739
2853
  };
@@ -2791,8 +2905,13 @@ var PaymentContainer = function PaymentContainer(_ref) {
2791
2905
  paymentIsLoading = _useState4[0],
2792
2906
  setPaymentIsLoading = _useState4[1];
2793
2907
 
2908
+ var _useState5 = useState([]),
2909
+ conditions = _useState5[0],
2910
+ setConditions = _useState5[1];
2911
+
2794
2912
  var showFormTitle = Boolean(formTitle);
2795
2913
  var showErrorText = Boolean(errorText);
2914
+ var eventId = getQueryVariable('event_id');
2796
2915
  useEffect(function () {
2797
2916
  var hash = checkoutData.hash;
2798
2917
 
@@ -2843,21 +2962,64 @@ var PaymentContainer = function PaymentContainer(_ref) {
2843
2962
  }
2844
2963
  }, _callee, null, [[0, 7]]);
2845
2964
  }))();
2846
- }, [checkoutData]); // 1. get payment data ---> v1/order/${hash}/review/ done
2965
+ }, [checkoutData]); //just once
2966
+
2967
+ useEffect(function () {
2968
+ // fetch conditions data
2969
+ var fetchConditions = /*#__PURE__*/function () {
2970
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
2971
+ var res, conditionsInfo;
2972
+ return runtime_1.wrap(function _callee2$(_context2) {
2973
+ while (1) {
2974
+ switch (_context2.prev = _context2.next) {
2975
+ case 0:
2976
+ if (!eventId) {
2977
+ _context2.next = 6;
2978
+ break;
2979
+ }
2980
+
2981
+ _context2.next = 3;
2982
+ return getConditions(eventId);
2983
+
2984
+ case 3:
2985
+ res = _context2.sent;
2986
+ conditionsInfo = _get(res, 'data.data.attributes');
2987
+ setConditions(conditionsInfo ? conditionsInfo.map(function (item) {
2988
+ return {
2989
+ id: nanoid(),
2990
+ text: item
2991
+ };
2992
+ }) : []);
2993
+
2994
+ case 6:
2995
+ case "end":
2996
+ return _context2.stop();
2997
+ }
2998
+ }
2999
+ }, _callee2);
3000
+ }));
3001
+
3002
+ return function fetchConditions() {
3003
+ return _ref3.apply(this, arguments);
3004
+ };
3005
+ }();
3006
+
3007
+ fetchConditions();
3008
+ }, []); // 1. get payment data ---> v1/order/${hash}/review/ done
2847
3009
  // 2. handle payment ---> v1/order/${orderHash}/pay/
2848
3010
  // 3. redirect to confirmation page
2849
3011
 
2850
3012
  var handlePaymentMiddleWare = /*#__PURE__*/function () {
2851
- var _ref3 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(error) {
3013
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(error) {
2852
3014
  var order_hash, paymentSuccessResponse;
2853
- return runtime_1.wrap(function _callee2$(_context2) {
3015
+ return runtime_1.wrap(function _callee3$(_context3) {
2854
3016
  while (1) {
2855
- switch (_context2.prev = _context2.next) {
3017
+ switch (_context3.prev = _context3.next) {
2856
3018
  case 0:
2857
- _context2.prev = 0;
3019
+ _context3.prev = 0;
2858
3020
 
2859
3021
  if (!error) {
2860
- _context2.next = 4;
3022
+ _context3.next = 4;
2861
3023
  break;
2862
3024
  }
2863
3025
 
@@ -2866,36 +3028,36 @@ var PaymentContainer = function PaymentContainer(_ref) {
2866
3028
 
2867
3029
  case 4:
2868
3030
  order_hash = reviewData.order_details.order_hash;
2869
- _context2.next = 7;
3031
+ _context3.next = 7;
2870
3032
  return handlePaymentSuccess(order_hash);
2871
3033
 
2872
3034
  case 7:
2873
- paymentSuccessResponse = _context2.sent;
3035
+ paymentSuccessResponse = _context3.sent;
2874
3036
 
2875
3037
  if (paymentSuccessResponse.status === 200) {
2876
3038
  handlePayment(paymentSuccessResponse);
2877
3039
  setPaymentIsLoading(false);
2878
3040
  }
2879
3041
 
2880
- _context2.next = 15;
3042
+ _context3.next = 15;
2881
3043
  break;
2882
3044
 
2883
3045
  case 11:
2884
- _context2.prev = 11;
2885
- _context2.t0 = _context2["catch"](0);
2886
- setError(_get(_context2.t0, 'response.data.message'));
2887
- onPaymentError(_context2.t0.response);
3046
+ _context3.prev = 11;
3047
+ _context3.t0 = _context3["catch"](0);
3048
+ setError(_get(_context3.t0, 'response.data.message'));
3049
+ onPaymentError(_context3.t0.response);
2888
3050
 
2889
3051
  case 15:
2890
3052
  case "end":
2891
- return _context2.stop();
3053
+ return _context3.stop();
2892
3054
  }
2893
3055
  }
2894
- }, _callee2, null, [[0, 11]]);
3056
+ }, _callee3, null, [[0, 11]]);
2895
3057
  }));
2896
3058
 
2897
3059
  return function handlePaymentMiddleWare(_x) {
2898
- return _ref3.apply(this, arguments);
3060
+ return _ref4.apply(this, arguments);
2899
3061
  };
2900
3062
  }();
2901
3063
 
@@ -2944,7 +3106,8 @@ var PaymentContainer = function PaymentContainer(_ref) {
2944
3106
  isLoading: paymentIsLoading,
2945
3107
  handleSetLoading: function handleSetLoading(value) {
2946
3108
  return setPaymentIsLoading(value);
2947
- }
3109
+ },
3110
+ conditions: conditions
2948
3111
  }))))));
2949
3112
  };
2950
3113
 
@@ -3158,7 +3321,7 @@ var TicketRow = function TicketRow(_ref) {
3158
3321
  className: "get-tickets"
3159
3322
  }, React.createElement(Box, {
3160
3323
  className: "get-tickets__selectbox"
3161
- }, React.createElement(FormControl, {
3324
+ }, React.createElement(FormControl$1, {
3162
3325
  fullWidth: true
3163
3326
  }, React.createElement(Select, {
3164
3327
  value: selectedTickets[ticketTier.id] ? selectedTickets[ticketTier.id] : 0,
@@ -3285,6 +3448,7 @@ var WaitingList = function WaitingList(_ref) {
3285
3448
  value: d.id
3286
3449
  };
3287
3450
  });
3451
+ var showTicketsField = Boolean(ticketTypesList.length);
3288
3452
 
3289
3453
  var handleSubmit = /*#__PURE__*/function () {
3290
3454
  var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(values) {
@@ -3313,25 +3477,24 @@ var WaitingList = function WaitingList(_ref) {
3313
3477
  setShowSuccessMessage(true);
3314
3478
  }
3315
3479
 
3316
- _context.next = 14;
3480
+ _context.next = 13;
3317
3481
  break;
3318
3482
 
3319
3483
  case 11:
3320
3484
  _context.prev = 11;
3321
3485
  _context.t0 = _context["catch"](0);
3322
- console.log(_context.t0);
3323
3486
 
3324
- case 14:
3325
- _context.prev = 14;
3487
+ case 13:
3488
+ _context.prev = 13;
3326
3489
  setLoading(false);
3327
- return _context.finish(14);
3490
+ return _context.finish(13);
3328
3491
 
3329
- case 17:
3492
+ case 16:
3330
3493
  case "end":
3331
3494
  return _context.stop();
3332
3495
  }
3333
3496
  }
3334
- }, _callee, null, [[0, 11, 14, 17]]);
3497
+ }, _callee, null, [[0, 11, 13, 16]]);
3335
3498
  }));
3336
3499
 
3337
3500
  return function handleSubmit(_x) {
@@ -3352,7 +3515,7 @@ var WaitingList = function WaitingList(_ref) {
3352
3515
  email: ''
3353
3516
  },
3354
3517
  onSubmit: handleSubmit
3355
- }, React.createElement(Form, null, React.createElement("div", {
3518
+ }, React.createElement(Form, null, React.createElement(ErrorFocus, null), showTicketsField && React.createElement(React.Fragment, null, React.createElement("div", {
3356
3519
  className: "field-item"
3357
3520
  }, React.createElement(Field, {
3358
3521
  name: "ticketTypeId",
@@ -3376,7 +3539,7 @@ var WaitingList = function WaitingList(_ref) {
3376
3539
  value: '',
3377
3540
  disabled: true
3378
3541
  }].concat(generateQuantity(10))
3379
- })), React.createElement("div", {
3542
+ }))), React.createElement("div", {
3380
3543
  className: "field-item"
3381
3544
  }, React.createElement(Field, {
3382
3545
  name: "firstName",