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.
- package/dist/components/billing-info-container/utils.d.ts +11 -1
- package/dist/components/common/CustomField.d.ts +1 -1
- package/dist/components/common/SelectField.d.ts +20 -0
- package/dist/tf-checkout-react.cjs.development.css +3 -3
- package/dist/tf-checkout-react.cjs.development.js +274 -82
- package/dist/tf-checkout-react.cjs.development.js.map +1 -1
- package/dist/tf-checkout-react.cjs.production.min.js +1 -1
- package/dist/tf-checkout-react.cjs.production.min.js.map +1 -1
- package/dist/tf-checkout-react.esm.js +282 -90
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/dist/types/billing-info-data.d.ts +3 -0
- package/dist/utils/formikErrorFocus.d.ts +2 -0
- package/package.json +1 -1
- package/src/components/billing-info-container/index.tsx +61 -29
- package/src/components/billing-info-container/style.css +4 -0
- package/src/components/billing-info-container/utils.ts +53 -1
- package/src/components/common/CustomField.tsx +5 -4
- package/src/components/common/SelectField.tsx +89 -0
- package/src/components/paymentContainer/index.tsx +1 -0
- package/src/components/paymentContainer/style.css +0 -8
- package/src/components/stripePayment/index.tsx +31 -3
- package/src/components/stripePayment/style.css +4 -0
- package/src/components/waitingList/index.tsx +2 -1
- package/src/types/billing-info-data.ts +3 -0
- package/src/utils/formikErrorFocus.ts +24 -0
|
@@ -18,12 +18,14 @@ var Modal = _interopDefault(require('@mui/material/Modal'));
|
|
|
18
18
|
var Box = _interopDefault(require('@mui/material/Box'));
|
|
19
19
|
var _forEach = _interopDefault(require('lodash/forEach'));
|
|
20
20
|
var _flatMapDeep = _interopDefault(require('lodash/flatMapDeep'));
|
|
21
|
+
var _isArray = _interopDefault(require('lodash/isArray'));
|
|
22
|
+
var nanoid = require('nanoid');
|
|
21
23
|
var TextField = _interopDefault(require('@mui/material/TextField'));
|
|
22
24
|
var styles = require('@mui/styles');
|
|
23
25
|
var FormGroup = _interopDefault(require('@mui/material/FormGroup'));
|
|
24
26
|
var FormControlLabel = _interopDefault(require('@mui/material/FormControlLabel'));
|
|
25
27
|
var Checkbox = _interopDefault(require('@mui/material/Checkbox'));
|
|
26
|
-
var
|
|
28
|
+
var Select = _interopDefault(require('@mui/material/Select'));
|
|
27
29
|
var Container = _interopDefault(require('@mui/material/Container'));
|
|
28
30
|
var Alert = _interopDefault(require('@mui/material/Alert'));
|
|
29
31
|
var reactStripeJs = require('@stripe/react-stripe-js');
|
|
@@ -39,7 +41,6 @@ var _sortBy = _interopDefault(require('lodash/sortBy'));
|
|
|
39
41
|
var _has = _interopDefault(require('lodash/has'));
|
|
40
42
|
var FormControl = _interopDefault(require('@mui/material/FormControl'));
|
|
41
43
|
var MenuItem = _interopDefault(require('@mui/material/MenuItem'));
|
|
42
|
-
var Select = _interopDefault(require('@mui/material/Select'));
|
|
43
44
|
var Button$1 = _interopDefault(require('@mui/material/Button'));
|
|
44
45
|
|
|
45
46
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -96,6 +97,22 @@ function _extends() {
|
|
|
96
97
|
return _extends.apply(this, arguments);
|
|
97
98
|
}
|
|
98
99
|
|
|
100
|
+
function _inheritsLoose(subClass, superClass) {
|
|
101
|
+
subClass.prototype = Object.create(superClass.prototype);
|
|
102
|
+
subClass.prototype.constructor = subClass;
|
|
103
|
+
|
|
104
|
+
_setPrototypeOf(subClass, superClass);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function _setPrototypeOf(o, p) {
|
|
108
|
+
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
109
|
+
o.__proto__ = p;
|
|
110
|
+
return o;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
return _setPrototypeOf(o, p);
|
|
114
|
+
}
|
|
115
|
+
|
|
99
116
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
100
117
|
if (source == null) return {};
|
|
101
118
|
var target = {};
|
|
@@ -1509,7 +1526,7 @@ var getInitialValues = function getInitialValues(data, propsInitialValues, userV
|
|
|
1509
1526
|
|
|
1510
1527
|
return initialValues;
|
|
1511
1528
|
};
|
|
1512
|
-
var createRegisterFormData = function createRegisterFormData(values) {
|
|
1529
|
+
var createRegisterFormData = function createRegisterFormData(values, checkoutBody) {
|
|
1513
1530
|
if (values === void 0) {
|
|
1514
1531
|
values = {};
|
|
1515
1532
|
}
|
|
@@ -1522,6 +1539,11 @@ var createRegisterFormData = function createRegisterFormData(values) {
|
|
|
1522
1539
|
bodyFormData.append('password_confirmation', values.confirmPassword);
|
|
1523
1540
|
bodyFormData.append('client_id', ENV.CLIENT_ID );
|
|
1524
1541
|
bodyFormData.append('client_secret', ENV.CLIENT_SECRET );
|
|
1542
|
+
|
|
1543
|
+
_forEach(checkoutBody.attributes, function (item, key) {
|
|
1544
|
+
bodyFormData.append(key, item);
|
|
1545
|
+
});
|
|
1546
|
+
|
|
1525
1547
|
return bodyFormData;
|
|
1526
1548
|
};
|
|
1527
1549
|
var setLoggedUserData = function setLoggedUserData(data) {
|
|
@@ -1530,6 +1552,7 @@ var setLoggedUserData = function setLoggedUserData(data) {
|
|
|
1530
1552
|
first_name: data.firstName,
|
|
1531
1553
|
last_name: data.lastName,
|
|
1532
1554
|
email: data.email,
|
|
1555
|
+
confirmEmail: data.email,
|
|
1533
1556
|
city: (data == null ? void 0 : data.city) || '',
|
|
1534
1557
|
country: (data == null ? void 0 : data.country) || '',
|
|
1535
1558
|
phone: (data == null ? void 0 : data.phone) || '',
|
|
@@ -1610,6 +1633,38 @@ var createCheckoutDataBody = function createCheckoutDataBody(ticketsQuantity, va
|
|
|
1610
1633
|
|
|
1611
1634
|
return body;
|
|
1612
1635
|
};
|
|
1636
|
+
var getValidateFunctions = function getValidateFunctions(element, states) {
|
|
1637
|
+
var validationFunctions = [];
|
|
1638
|
+
|
|
1639
|
+
if (element.required) {
|
|
1640
|
+
if (element.name !== 'state' || element.name === 'state' && states.length) {
|
|
1641
|
+
validationFunctions.push(requiredValidator);
|
|
1642
|
+
}
|
|
1643
|
+
}
|
|
1644
|
+
|
|
1645
|
+
if (element.onValidate) {
|
|
1646
|
+
validationFunctions.push(element.onValidate);
|
|
1647
|
+
}
|
|
1648
|
+
|
|
1649
|
+
return combineValidators.apply(void 0, validationFunctions);
|
|
1650
|
+
};
|
|
1651
|
+
var assingUniqueIds = function assingUniqueIds(data) {
|
|
1652
|
+
if (_get(data[0], 'uniqueId')) {
|
|
1653
|
+
return data;
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
return _map(data, function (item) {
|
|
1657
|
+
_forEach(item, function (itemValue, key) {
|
|
1658
|
+
if (_isArray(itemValue)) {
|
|
1659
|
+
item[key] = assingUniqueIds(itemValue);
|
|
1660
|
+
}
|
|
1661
|
+
});
|
|
1662
|
+
|
|
1663
|
+
return _extends({}, item, {
|
|
1664
|
+
uniqueId: nanoid.nanoid()
|
|
1665
|
+
});
|
|
1666
|
+
});
|
|
1667
|
+
};
|
|
1613
1668
|
|
|
1614
1669
|
var useStyles = /*#__PURE__*/styles.makeStyles({
|
|
1615
1670
|
input: {
|
|
@@ -1628,13 +1683,13 @@ var CustomField = function CustomField(_ref) {
|
|
|
1628
1683
|
_ref$form = _ref.form,
|
|
1629
1684
|
touched = _ref$form.touched,
|
|
1630
1685
|
errors = _ref$form.errors,
|
|
1686
|
+
submitCount = _ref$form.submitCount,
|
|
1631
1687
|
theme = _ref.theme;
|
|
1632
1688
|
var isSelectField = type === 'select';
|
|
1633
|
-
var isShrink = Boolean(field.value) || type === 'date' || type === 'select';
|
|
1634
|
-
var isTouched = Boolean(_get(touched, field.name));
|
|
1635
1689
|
|
|
1636
1690
|
var error = _get(errors, field.name);
|
|
1637
1691
|
|
|
1692
|
+
var isTouched = Boolean(_get(touched, field.name)) || _includes(field.name, 'holder') && !!error && !!submitCount;
|
|
1638
1693
|
var classes = useStyles();
|
|
1639
1694
|
return React__default.createElement(TextField, Object.assign({
|
|
1640
1695
|
id: field.name,
|
|
@@ -1644,9 +1699,6 @@ var CustomField = function CustomField(_ref) {
|
|
|
1644
1699
|
fullWidth: true,
|
|
1645
1700
|
error: !!error && isTouched,
|
|
1646
1701
|
helperText: isTouched && error,
|
|
1647
|
-
InputLabelProps: {
|
|
1648
|
-
shrink: isShrink
|
|
1649
|
-
},
|
|
1650
1702
|
InputProps: {
|
|
1651
1703
|
classes: {
|
|
1652
1704
|
input: classes.input
|
|
@@ -1697,6 +1749,102 @@ var getQueryVariable = function getQueryVariable(variable) {
|
|
|
1697
1749
|
return false;
|
|
1698
1750
|
};
|
|
1699
1751
|
|
|
1752
|
+
var useStyles$1 = /*#__PURE__*/styles.makeStyles({
|
|
1753
|
+
input: {
|
|
1754
|
+
'&::placeholder': {
|
|
1755
|
+
color: 'gray'
|
|
1756
|
+
}
|
|
1757
|
+
}
|
|
1758
|
+
});
|
|
1759
|
+
var SelectField = function SelectField(_ref) {
|
|
1760
|
+
var label = _ref.label,
|
|
1761
|
+
_ref$type = _ref.type,
|
|
1762
|
+
type = _ref$type === void 0 ? 'text' : _ref$type,
|
|
1763
|
+
field = _ref.field,
|
|
1764
|
+
_ref$selectOptions = _ref.selectOptions,
|
|
1765
|
+
selectOptions = _ref$selectOptions === void 0 ? [] : _ref$selectOptions,
|
|
1766
|
+
_ref$form = _ref.form,
|
|
1767
|
+
touched = _ref$form.touched,
|
|
1768
|
+
errors = _ref$form.errors,
|
|
1769
|
+
theme = _ref.theme;
|
|
1770
|
+
var isTouched = Boolean(_get(touched, field.name));
|
|
1771
|
+
|
|
1772
|
+
var error = _get(errors, field.name);
|
|
1773
|
+
|
|
1774
|
+
var classes = useStyles$1();
|
|
1775
|
+
return React__default.createElement(material.FormControl, {
|
|
1776
|
+
fullWidth: true
|
|
1777
|
+
}, React__default.createElement(material.InputLabel, {
|
|
1778
|
+
htmlFor: field.name,
|
|
1779
|
+
error: !!error && isTouched,
|
|
1780
|
+
shrink: true
|
|
1781
|
+
}, label), React__default.createElement(Select, Object.assign({
|
|
1782
|
+
id: field.name,
|
|
1783
|
+
label: label,
|
|
1784
|
+
type: type,
|
|
1785
|
+
fullWidth: true,
|
|
1786
|
+
error: !!error && isTouched,
|
|
1787
|
+
inputProps: {
|
|
1788
|
+
id: field.name,
|
|
1789
|
+
classes: {
|
|
1790
|
+
input: classes.input
|
|
1791
|
+
}
|
|
1792
|
+
},
|
|
1793
|
+
"native": true,
|
|
1794
|
+
className: theme,
|
|
1795
|
+
MenuProps: {
|
|
1796
|
+
className: theme
|
|
1797
|
+
}
|
|
1798
|
+
}, field), _map(selectOptions, function (option) {
|
|
1799
|
+
return React__default.createElement("option", {
|
|
1800
|
+
key: option.value,
|
|
1801
|
+
value: option.value,
|
|
1802
|
+
disabled: option.disabled
|
|
1803
|
+
}, option.label);
|
|
1804
|
+
})), isTouched && error ? React__default.createElement(material.FormHelperText, {
|
|
1805
|
+
error: !!error && isTouched
|
|
1806
|
+
}, error) : null);
|
|
1807
|
+
};
|
|
1808
|
+
|
|
1809
|
+
var ErrorFocusInternal = /*#__PURE__*/function (_Component) {
|
|
1810
|
+
_inheritsLoose(ErrorFocusInternal, _Component);
|
|
1811
|
+
|
|
1812
|
+
function ErrorFocusInternal() {
|
|
1813
|
+
var _this;
|
|
1814
|
+
|
|
1815
|
+
_this = _Component.apply(this, arguments) || this;
|
|
1816
|
+
|
|
1817
|
+
_this.render = function () {
|
|
1818
|
+
return null;
|
|
1819
|
+
};
|
|
1820
|
+
|
|
1821
|
+
return _this;
|
|
1822
|
+
}
|
|
1823
|
+
|
|
1824
|
+
var _proto = ErrorFocusInternal.prototype;
|
|
1825
|
+
|
|
1826
|
+
_proto.componentDidUpdate = function componentDidUpdate(prevProps) {
|
|
1827
|
+
var _prevProps$formik = prevProps.formik,
|
|
1828
|
+
isSubmitting = _prevProps$formik.isSubmitting,
|
|
1829
|
+
isValidating = _prevProps$formik.isValidating,
|
|
1830
|
+
errors = _prevProps$formik.errors;
|
|
1831
|
+
var keys = Object.keys(errors);
|
|
1832
|
+
|
|
1833
|
+
if (keys.length > 0 && isSubmitting && !isValidating) {
|
|
1834
|
+
var selector = "[name=\"" + keys[0] + "\"]";
|
|
1835
|
+
var errorElement = document.querySelector(selector);
|
|
1836
|
+
|
|
1837
|
+
if (errorElement) {
|
|
1838
|
+
errorElement.focus();
|
|
1839
|
+
}
|
|
1840
|
+
}
|
|
1841
|
+
};
|
|
1842
|
+
|
|
1843
|
+
return ErrorFocusInternal;
|
|
1844
|
+
}(React.Component);
|
|
1845
|
+
|
|
1846
|
+
var ErrorFocus = /*#__PURE__*/formik.connect(ErrorFocusInternal);
|
|
1847
|
+
|
|
1700
1848
|
var LogicRunner = function LogicRunner(_ref) {
|
|
1701
1849
|
var values = _ref.values,
|
|
1702
1850
|
setStates = _ref.setStates,
|
|
@@ -1768,7 +1916,7 @@ var LogicRunner = function LogicRunner(_ref) {
|
|
|
1768
1916
|
lastName: parsedData == null ? void 0 : parsedData.last_name,
|
|
1769
1917
|
email: (parsedData == null ? void 0 : parsedData.email) || '',
|
|
1770
1918
|
phone: (parsedData == null ? void 0 : parsedData.phone) || '',
|
|
1771
|
-
confirmEmail: '',
|
|
1919
|
+
confirmEmail: (parsedData == null ? void 0 : parsedData.email) || '',
|
|
1772
1920
|
state: (parsedData == null ? void 0 : parsedData.state) || '',
|
|
1773
1921
|
street_address: (parsedData == null ? void 0 : parsedData.street_address) || '',
|
|
1774
1922
|
country: (parsedData == null ? void 0 : parsedData.country) || 1,
|
|
@@ -1837,39 +1985,43 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
1837
1985
|
var userData = typeof window !== 'undefined' && window.localStorage.getItem('user_data') ? JSON.parse(window.localStorage.getItem('user_data') || '') : {};
|
|
1838
1986
|
var access_token = typeof window !== 'undefined' && window.localStorage.getItem('access_token') ? window.localStorage.getItem('access_token') || '' : '';
|
|
1839
1987
|
|
|
1840
|
-
var _useState = React.useState(
|
|
1841
|
-
|
|
1842
|
-
|
|
1988
|
+
var _useState = React.useState(data),
|
|
1989
|
+
dataWithUniqueIds = _useState[0],
|
|
1990
|
+
setDataWithUniqueIds = _useState[1];
|
|
1843
1991
|
|
|
1844
|
-
var _useState2 = React.useState(
|
|
1845
|
-
|
|
1846
|
-
|
|
1992
|
+
var _useState2 = React.useState({}),
|
|
1993
|
+
cartInfoData = _useState2[0],
|
|
1994
|
+
setCartInfo = _useState2[1];
|
|
1847
1995
|
|
|
1848
1996
|
var _useState3 = React.useState([]),
|
|
1849
|
-
|
|
1850
|
-
|
|
1997
|
+
countries = _useState3[0],
|
|
1998
|
+
setCountries = _useState3[1];
|
|
1851
1999
|
|
|
1852
|
-
var _useState4 = React.useState(
|
|
1853
|
-
|
|
1854
|
-
|
|
2000
|
+
var _useState4 = React.useState([]),
|
|
2001
|
+
states = _useState4[0],
|
|
2002
|
+
setStates = _useState4[1];
|
|
1855
2003
|
|
|
1856
2004
|
var _useState5 = React.useState(false),
|
|
1857
|
-
|
|
1858
|
-
|
|
2005
|
+
showModalLogin = _useState5[0],
|
|
2006
|
+
setShowModalLogin = _useState5[1];
|
|
1859
2007
|
|
|
1860
2008
|
var _useState6 = React.useState(false),
|
|
1861
|
-
|
|
1862
|
-
|
|
2009
|
+
alreadyHasUser = _useState6[0],
|
|
2010
|
+
setAlreadyHasUser = _useState6[1];
|
|
1863
2011
|
|
|
1864
2012
|
var _useState7 = React.useState(false),
|
|
1865
|
-
|
|
1866
|
-
|
|
2013
|
+
userExpired = _useState7[0],
|
|
2014
|
+
setUserExpired = _useState7[1];
|
|
1867
2015
|
|
|
1868
|
-
var _useState8 = React.useState(
|
|
1869
|
-
|
|
1870
|
-
|
|
2016
|
+
var _useState8 = React.useState(false),
|
|
2017
|
+
showModalRegister = _useState8[0],
|
|
2018
|
+
setShowModalRegister = _useState8[1];
|
|
1871
2019
|
|
|
1872
|
-
var _useState9 = React.useState(
|
|
2020
|
+
var _useState9 = React.useState([]),
|
|
2021
|
+
ticketsQuantity = _useState9[0],
|
|
2022
|
+
setTicketsQuantity = _useState9[1];
|
|
2023
|
+
|
|
2024
|
+
var _useState10 = React.useState({
|
|
1873
2025
|
firstName: '',
|
|
1874
2026
|
lastName: '',
|
|
1875
2027
|
email: '',
|
|
@@ -1884,8 +2036,8 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
1884
2036
|
state: '',
|
|
1885
2037
|
zip: ''
|
|
1886
2038
|
}),
|
|
1887
|
-
userValues =
|
|
1888
|
-
setUserValues =
|
|
2039
|
+
userValues = _useState10[0],
|
|
2040
|
+
setUserValues = _useState10[1];
|
|
1889
2041
|
|
|
1890
2042
|
var isLoggedIn = !!access_token;
|
|
1891
2043
|
|
|
@@ -1901,7 +2053,11 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
1901
2053
|
|
|
1902
2054
|
var optedInFieldValue = _get(cartInfoData, 'optedIn', false);
|
|
1903
2055
|
|
|
1904
|
-
var
|
|
2056
|
+
var hideTtfOptIn = _get(cartInfoData, 'hide_ttf_opt_in', true);
|
|
2057
|
+
|
|
2058
|
+
if (!_get(dataWithUniqueIds, '[0].uniqueId')) {
|
|
2059
|
+
setDataWithUniqueIds(assingUniqueIds(data));
|
|
2060
|
+
}
|
|
1905
2061
|
|
|
1906
2062
|
var getQuantity = function getQuantity(cart) {
|
|
1907
2063
|
if (cart === void 0) {
|
|
@@ -2068,7 +2224,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2068
2224
|
fetchUserData(access_token);
|
|
2069
2225
|
}, [access_token]);
|
|
2070
2226
|
return React__default.createElement(React__default.Fragment, null, React__default.createElement(formik.Formik, {
|
|
2071
|
-
initialValues: getInitialValues(
|
|
2227
|
+
initialValues: getInitialValues(dataWithUniqueIds, _extends({}, initialValues, {
|
|
2072
2228
|
email: emailLogged,
|
|
2073
2229
|
firstName: firstNameLogged,
|
|
2074
2230
|
lastName: lastNameLogged,
|
|
@@ -2078,7 +2234,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2078
2234
|
enableReinitialize: true,
|
|
2079
2235
|
onSubmit: function () {
|
|
2080
2236
|
var _onSubmit = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(values, formikHelpers) {
|
|
2081
|
-
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;
|
|
2237
|
+
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;
|
|
2082
2238
|
|
|
2083
2239
|
return runtime_1.wrap(function _callee5$(_context5) {
|
|
2084
2240
|
while (1) {
|
|
@@ -2123,13 +2279,18 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2123
2279
|
return _context5.abrupt("return");
|
|
2124
2280
|
|
|
2125
2281
|
case 15:
|
|
2126
|
-
|
|
2282
|
+
checkoutBodyForRegistration = createCheckoutDataBody(ticketsQuantity.length, values, {
|
|
2283
|
+
emailLogged: emailLogged,
|
|
2284
|
+
firstNameLogged: firstNameLogged,
|
|
2285
|
+
lastNameLogged: lastNameLogged
|
|
2286
|
+
}, showDOB);
|
|
2287
|
+
bodyFormData = createRegisterFormData(values, checkoutBodyForRegistration);
|
|
2127
2288
|
access_token_register = null;
|
|
2128
|
-
_context5.prev =
|
|
2129
|
-
_context5.next =
|
|
2289
|
+
_context5.prev = 18;
|
|
2290
|
+
_context5.next = 21;
|
|
2130
2291
|
return register(bodyFormData);
|
|
2131
2292
|
|
|
2132
|
-
case
|
|
2293
|
+
case 21:
|
|
2133
2294
|
resRegister = _context5.sent;
|
|
2134
2295
|
access_token_register = _get(resRegister, 'data.data.attributes.access_token');
|
|
2135
2296
|
refreshToken = _get(resRegister, 'data.data.attributes.refresh_token');
|
|
@@ -2139,12 +2300,12 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2139
2300
|
refreshToken: refreshToken
|
|
2140
2301
|
};
|
|
2141
2302
|
onRegisterSuccess(tokens);
|
|
2142
|
-
_context5.next =
|
|
2303
|
+
_context5.next = 33;
|
|
2143
2304
|
break;
|
|
2144
2305
|
|
|
2145
|
-
case
|
|
2146
|
-
_context5.prev =
|
|
2147
|
-
_context5.t0 = _context5["catch"](
|
|
2306
|
+
case 29:
|
|
2307
|
+
_context5.prev = 29;
|
|
2308
|
+
_context5.t0 = _context5["catch"](18);
|
|
2148
2309
|
|
|
2149
2310
|
if (axios.isAxiosError(_context5.t0)) {
|
|
2150
2311
|
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;
|
|
@@ -2168,11 +2329,11 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2168
2329
|
|
|
2169
2330
|
return _context5.abrupt("return");
|
|
2170
2331
|
|
|
2171
|
-
case
|
|
2172
|
-
_context5.next =
|
|
2332
|
+
case 33:
|
|
2333
|
+
_context5.next = 35;
|
|
2173
2334
|
return getProfileData(access_token_register);
|
|
2174
2335
|
|
|
2175
|
-
case
|
|
2336
|
+
case 35:
|
|
2176
2337
|
profileData = _context5.sent;
|
|
2177
2338
|
profileSpecifiedData = _get(profileData, 'data.data');
|
|
2178
2339
|
profileDataObj = setLoggedUserData(profileSpecifiedData);
|
|
@@ -2186,17 +2347,17 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2186
2347
|
firstNameLogged: firstNameLogged,
|
|
2187
2348
|
lastNameLogged: lastNameLogged
|
|
2188
2349
|
}, showDOB);
|
|
2189
|
-
_context5.next =
|
|
2350
|
+
_context5.next = 42;
|
|
2190
2351
|
return postOnCheckout(checkoutBody, access_token_register);
|
|
2191
2352
|
|
|
2192
|
-
case
|
|
2353
|
+
case 42:
|
|
2193
2354
|
res = _context5.sent;
|
|
2194
2355
|
handleSubmit(values, formikHelpers, eventId, res);
|
|
2195
|
-
_context5.next =
|
|
2356
|
+
_context5.next = 49;
|
|
2196
2357
|
break;
|
|
2197
2358
|
|
|
2198
|
-
case
|
|
2199
|
-
_context5.prev =
|
|
2359
|
+
case 46:
|
|
2360
|
+
_context5.prev = 46;
|
|
2200
2361
|
_context5.t1 = _context5["catch"](0);
|
|
2201
2362
|
|
|
2202
2363
|
if (axios.isAxiosError(_context5.t1)) {
|
|
@@ -2212,12 +2373,12 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2212
2373
|
onSubmitError(_context5.t1);
|
|
2213
2374
|
}
|
|
2214
2375
|
|
|
2215
|
-
case
|
|
2376
|
+
case 49:
|
|
2216
2377
|
case "end":
|
|
2217
2378
|
return _context5.stop();
|
|
2218
2379
|
}
|
|
2219
2380
|
}
|
|
2220
|
-
}, _callee5, null, [[0,
|
|
2381
|
+
}, _callee5, null, [[0, 46], [18, 29]]);
|
|
2221
2382
|
}));
|
|
2222
2383
|
|
|
2223
2384
|
function onSubmit(_x2, _x3) {
|
|
@@ -2229,7 +2390,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2229
2390
|
}, function (props) {
|
|
2230
2391
|
return React__default.createElement(formik.Form, {
|
|
2231
2392
|
onSubmit: props.handleSubmit
|
|
2232
|
-
}, React__default.createElement(LogicRunner, {
|
|
2393
|
+
}, React__default.createElement(ErrorFocus, null), React__default.createElement(LogicRunner, {
|
|
2233
2394
|
values: props.values,
|
|
2234
2395
|
setStates: setStates,
|
|
2235
2396
|
setFieldValue: props.setFieldValue,
|
|
@@ -2250,7 +2411,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2250
2411
|
onLogin();
|
|
2251
2412
|
setShowModalLogin(true);
|
|
2252
2413
|
}
|
|
2253
|
-
}, "Login"))), _map(
|
|
2414
|
+
}, "Login"))), _map(dataWithUniqueIds, function (item) {
|
|
2254
2415
|
var label = item.label,
|
|
2255
2416
|
labelClassName = item.labelClassName,
|
|
2256
2417
|
fields = item.fields;
|
|
@@ -2260,7 +2421,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2260
2421
|
}
|
|
2261
2422
|
|
|
2262
2423
|
return React__default.createElement(React__default.Fragment, {
|
|
2263
|
-
key:
|
|
2424
|
+
key: item.uniqueId
|
|
2264
2425
|
}, React__default.createElement("p", {
|
|
2265
2426
|
className: labelClassName
|
|
2266
2427
|
}, label), _map(fields, function (group) {
|
|
@@ -2269,7 +2430,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2269
2430
|
groupLabel = group.groupLabel,
|
|
2270
2431
|
groupLabelClassName = group.groupLabelClassName;
|
|
2271
2432
|
return React__default.createElement(React__default.Fragment, {
|
|
2272
|
-
key:
|
|
2433
|
+
key: group.uniqueId
|
|
2273
2434
|
}, !isLoggedIn && React__default.createElement("div", {
|
|
2274
2435
|
className: groupLabelClassName
|
|
2275
2436
|
}, groupLabel), React__default.createElement("div", {
|
|
@@ -2287,47 +2448,45 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2287
2448
|
return false;
|
|
2288
2449
|
}
|
|
2289
2450
|
|
|
2290
|
-
if (el.name === '
|
|
2451
|
+
if (el.name === 'ttf_opt_in' && hideTtfOptIn) {
|
|
2291
2452
|
return false;
|
|
2292
2453
|
}
|
|
2293
2454
|
|
|
2294
2455
|
return true;
|
|
2295
2456
|
}), function (element) {
|
|
2296
2457
|
return ['password', 'confirmPassword'].includes(element.name) && isLoggedIn ? null : React__default.createElement(React__default.Fragment, {
|
|
2297
|
-
key:
|
|
2458
|
+
key: element.uniqueId
|
|
2298
2459
|
}, element.name === 'email' ? React__default.createElement("div", {
|
|
2299
2460
|
className: "email-checking"
|
|
2300
|
-
}, "IMPORTANT: Please double check that your
|
|
2461
|
+
}, "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__default.createElement("div", {
|
|
2301
2462
|
className: element.className
|
|
2302
2463
|
}, element.component ? element.component : React__default.createElement(formik.Field, {
|
|
2303
2464
|
name: element.name,
|
|
2304
2465
|
label: element.label,
|
|
2305
2466
|
type: element.type,
|
|
2306
|
-
validate:
|
|
2307
|
-
component: element.type === 'checkbox' ? CheckboxField : CustomField,
|
|
2467
|
+
validate: getValidateFunctions(element, states),
|
|
2468
|
+
component: element.type === 'checkbox' ? CheckboxField : element.type === 'select' ? SelectField : CustomField,
|
|
2308
2469
|
selectOptions: element.name === 'country' ? countries : element.name === 'state' ? states : [],
|
|
2309
2470
|
theme: theme
|
|
2310
2471
|
})));
|
|
2311
2472
|
})));
|
|
2312
2473
|
}));
|
|
2313
|
-
}), showTicketHolderName && React__default.createElement(React__default.Fragment, {
|
|
2314
|
-
key: nanoid.nanoid()
|
|
2315
|
-
}, React__default.createElement("div", {
|
|
2474
|
+
}), showTicketHolderName && React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
|
|
2316
2475
|
className: "ticket-holders-fields"
|
|
2317
2476
|
}, React__default.createElement("p", null, ticketHoldersFields.label), _map(ticketsQuantity, function (_item, index) {
|
|
2318
2477
|
return React__default.createElement("div", {
|
|
2319
|
-
key:
|
|
2478
|
+
key: _item
|
|
2320
2479
|
}, React__default.createElement("h5", null, "Ticket ", index + 1), _map(ticketHoldersFields.fields, function (group) {
|
|
2321
2480
|
var groupClassname = group.groupClassname,
|
|
2322
2481
|
groupItems = group.groupItems;
|
|
2323
2482
|
return React__default.createElement("div", {
|
|
2324
|
-
key:
|
|
2483
|
+
key: group.uniqueId
|
|
2325
2484
|
}, React__default.createElement("div", {
|
|
2326
2485
|
className: groupClassname
|
|
2327
2486
|
}, _map(groupItems, function (element) {
|
|
2328
2487
|
return React__default.createElement("div", {
|
|
2329
2488
|
className: element.className,
|
|
2330
|
-
key:
|
|
2489
|
+
key: element.uniqueId
|
|
2331
2490
|
}, React__default.createElement(formik.Field, {
|
|
2332
2491
|
name: element.name + "-" + index,
|
|
2333
2492
|
label: element.label,
|
|
@@ -2339,8 +2498,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2339
2498
|
})));
|
|
2340
2499
|
}));
|
|
2341
2500
|
}))), React__default.createElement("div", {
|
|
2342
|
-
className: "button-container"
|
|
2343
|
-
key: nanoid.nanoid()
|
|
2501
|
+
className: "button-container"
|
|
2344
2502
|
}, React__default.createElement(LoadingButton, {
|
|
2345
2503
|
type: "submit",
|
|
2346
2504
|
variant: "contained",
|
|
@@ -2490,6 +2648,14 @@ var CheckoutForm = function CheckoutForm(_ref) {
|
|
|
2490
2648
|
stripeError = _useState2[0],
|
|
2491
2649
|
setStripeError = _useState2[1];
|
|
2492
2650
|
|
|
2651
|
+
var _useState3 = React.useState([]),
|
|
2652
|
+
checkboxes = _useState3[0],
|
|
2653
|
+
setCheckboxes = _useState3[1];
|
|
2654
|
+
|
|
2655
|
+
var _useState4 = React.useState(false),
|
|
2656
|
+
allowSubmit = _useState4[0],
|
|
2657
|
+
setAllowSubmit = _useState4[1];
|
|
2658
|
+
|
|
2493
2659
|
var handleSubmit = /*#__PURE__*/function () {
|
|
2494
2660
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(event) {
|
|
2495
2661
|
var card, address, paymentMethodReq, _yield$stripe$confirm, _error;
|
|
@@ -2595,6 +2761,17 @@ var CheckoutForm = function CheckoutForm(_ref) {
|
|
|
2595
2761
|
};
|
|
2596
2762
|
}();
|
|
2597
2763
|
|
|
2764
|
+
var handleCheckboxes = function handleCheckboxes(e) {
|
|
2765
|
+
var checkbox = e.target;
|
|
2766
|
+
var updatedCheckedState = checkboxes.map(function (item) {
|
|
2767
|
+
var value = item.id === checkbox.name ? !item.checked : item.checked;
|
|
2768
|
+
return _extends({}, item, {
|
|
2769
|
+
checked: value
|
|
2770
|
+
});
|
|
2771
|
+
});
|
|
2772
|
+
setCheckboxes(updatedCheckedState);
|
|
2773
|
+
};
|
|
2774
|
+
|
|
2598
2775
|
var onChangePostalCode = function onChangePostalCode(e) {
|
|
2599
2776
|
setPostalCode(e.target.value);
|
|
2600
2777
|
};
|
|
@@ -2608,6 +2785,19 @@ var CheckoutForm = function CheckoutForm(_ref) {
|
|
|
2608
2785
|
zipCode && setPostalCode(zipCode);
|
|
2609
2786
|
}
|
|
2610
2787
|
}, []);
|
|
2788
|
+
React.useEffect(function () {
|
|
2789
|
+
if (conditions.length) {
|
|
2790
|
+
setCheckboxes(conditions);
|
|
2791
|
+
}
|
|
2792
|
+
}, [conditions]);
|
|
2793
|
+
React.useEffect(function () {
|
|
2794
|
+
if (checkboxes.length) {
|
|
2795
|
+
var allChecked = checkboxes.every(function (item) {
|
|
2796
|
+
return (item == null ? void 0 : item.checked) === true;
|
|
2797
|
+
});
|
|
2798
|
+
setAllowSubmit(allChecked);
|
|
2799
|
+
}
|
|
2800
|
+
}, [checkboxes]);
|
|
2611
2801
|
var buttonIsDiabled = !stripe || !!error || isLoading;
|
|
2612
2802
|
return React__default.createElement("div", {
|
|
2613
2803
|
className: "stripe_payment_container"
|
|
@@ -2648,7 +2838,7 @@ var CheckoutForm = function CheckoutForm(_ref) {
|
|
|
2648
2838
|
value: postalCode,
|
|
2649
2839
|
onChange: onChangePostalCode,
|
|
2650
2840
|
placeholder: "ZIP"
|
|
2651
|
-
}))),
|
|
2841
|
+
}))), checkboxes == null ? void 0 : checkboxes.map(function (checkbox) {
|
|
2652
2842
|
return React__default.createElement("div", {
|
|
2653
2843
|
className: 'billing-info-container__singleField',
|
|
2654
2844
|
key: checkbox.id
|
|
@@ -2657,10 +2847,12 @@ var CheckoutForm = function CheckoutForm(_ref) {
|
|
|
2657
2847
|
}, React__default.createElement(CheckboxField, {
|
|
2658
2848
|
name: checkbox.id,
|
|
2659
2849
|
label: checkbox.text,
|
|
2660
|
-
required: true
|
|
2850
|
+
required: true,
|
|
2851
|
+
onChange: handleCheckboxes,
|
|
2852
|
+
checked: checkbox.checked
|
|
2661
2853
|
})));
|
|
2662
2854
|
}), React__default.createElement("div", {
|
|
2663
|
-
className: "payment_button " + (buttonIsDiabled ? 'disabled-payment-button' : '')
|
|
2855
|
+
className: "payment_button " + (buttonIsDiabled || !allowSubmit ? 'disabled-payment-button' : '')
|
|
2664
2856
|
}, React__default.createElement("button", {
|
|
2665
2857
|
disabled: buttonIsDiabled,
|
|
2666
2858
|
type: "submit"
|
|
@@ -2802,7 +2994,8 @@ var PaymentContainer = function PaymentContainer(_ref) {
|
|
|
2802
2994
|
setConditions(conditionsInfo ? conditionsInfo.map(function (item) {
|
|
2803
2995
|
return {
|
|
2804
2996
|
id: nanoid.nanoid(),
|
|
2805
|
-
text: item
|
|
2997
|
+
text: item,
|
|
2998
|
+
checked: false
|
|
2806
2999
|
};
|
|
2807
3000
|
}) : []);
|
|
2808
3001
|
|
|
@@ -3283,25 +3476,24 @@ var WaitingList = function WaitingList(_ref) {
|
|
|
3283
3476
|
setShowSuccessMessage(true);
|
|
3284
3477
|
}
|
|
3285
3478
|
|
|
3286
|
-
_context.next =
|
|
3479
|
+
_context.next = 13;
|
|
3287
3480
|
break;
|
|
3288
3481
|
|
|
3289
3482
|
case 11:
|
|
3290
3483
|
_context.prev = 11;
|
|
3291
3484
|
_context.t0 = _context["catch"](0);
|
|
3292
|
-
console.log(_context.t0);
|
|
3293
3485
|
|
|
3294
|
-
case
|
|
3295
|
-
_context.prev =
|
|
3486
|
+
case 13:
|
|
3487
|
+
_context.prev = 13;
|
|
3296
3488
|
setLoading(false);
|
|
3297
|
-
return _context.finish(
|
|
3489
|
+
return _context.finish(13);
|
|
3298
3490
|
|
|
3299
|
-
case
|
|
3491
|
+
case 16:
|
|
3300
3492
|
case "end":
|
|
3301
3493
|
return _context.stop();
|
|
3302
3494
|
}
|
|
3303
3495
|
}
|
|
3304
|
-
}, _callee, null, [[0, 11,
|
|
3496
|
+
}, _callee, null, [[0, 11, 13, 16]]);
|
|
3305
3497
|
}));
|
|
3306
3498
|
|
|
3307
3499
|
return function handleSubmit(_x) {
|
|
@@ -3322,7 +3514,7 @@ var WaitingList = function WaitingList(_ref) {
|
|
|
3322
3514
|
email: ''
|
|
3323
3515
|
},
|
|
3324
3516
|
onSubmit: handleSubmit
|
|
3325
|
-
}, React__default.createElement(formik.Form, null, showTicketsField && React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
|
|
3517
|
+
}, React__default.createElement(formik.Form, null, React__default.createElement(ErrorFocus, null), showTicketsField && React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
|
|
3326
3518
|
className: "field-item"
|
|
3327
3519
|
}, React__default.createElement(formik.Field, {
|
|
3328
3520
|
name: "ticketTypeId",
|