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.
- package/dist/components/billing-info-container/index.d.ts +1 -1
- package/dist/components/billing-info-container/utils.d.ts +6 -0
- package/dist/components/common/CheckboxField.d.ts +2 -2
- package/dist/components/common/CustomField.d.ts +2 -1
- package/dist/components/common/SelectField.d.ts +20 -0
- package/dist/components/paymentContainer/index.d.ts +1 -1
- package/dist/components/stripePayment/index.d.ts +2 -1
- package/dist/tf-checkout-react.cjs.development.css +2 -2
- package/dist/tf-checkout-react.cjs.development.js +427 -264
- 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 +434 -271
- 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/dist/utils/getQueryVariable.d.ts +1 -0
- package/package.json +1 -1
- package/src/.DS_Store +0 -0
- package/src/components/.DS_Store +0 -0
- package/src/components/billing-info-container/index.tsx +124 -133
- package/src/components/billing-info-container/style.css +4 -0
- package/src/components/billing-info-container/utils.ts +44 -0
- package/src/components/common/CheckboxField.tsx +7 -2
- package/src/components/common/CustomField.tsx +21 -8
- package/src/components/common/SelectField.tsx +89 -0
- package/src/components/paymentContainer/index.tsx +31 -3
- package/src/components/stripePayment/index.tsx +48 -19
- package/src/components/stripePayment/style.css +10 -0
- package/src/components/waitingList/index.tsx +36 -25
- package/src/types/billing-info-data.ts +3 -0
- package/src/utils/formikErrorFocus.ts +24 -0
- package/src/utils/getQueryVariable.ts +13 -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 = {};
|
|
@@ -1530,6 +1547,7 @@ var setLoggedUserData = function setLoggedUserData(data) {
|
|
|
1530
1547
|
first_name: data.firstName,
|
|
1531
1548
|
last_name: data.lastName,
|
|
1532
1549
|
email: data.email,
|
|
1550
|
+
confirmEmail: data.email,
|
|
1533
1551
|
city: (data == null ? void 0 : data.city) || '',
|
|
1534
1552
|
country: (data == null ? void 0 : data.country) || '',
|
|
1535
1553
|
phone: (data == null ? void 0 : data.phone) || '',
|
|
@@ -1610,11 +1628,43 @@ var createCheckoutDataBody = function createCheckoutDataBody(ticketsQuantity, va
|
|
|
1610
1628
|
|
|
1611
1629
|
return body;
|
|
1612
1630
|
};
|
|
1631
|
+
var getValidateFunctions = function getValidateFunctions(element, states) {
|
|
1632
|
+
var validationFunctions = [];
|
|
1633
|
+
|
|
1634
|
+
if (element.required) {
|
|
1635
|
+
if (element.name !== 'state' || element.name === 'state' && states.length) {
|
|
1636
|
+
validationFunctions.push(requiredValidator);
|
|
1637
|
+
}
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1640
|
+
if (element.onValidate) {
|
|
1641
|
+
validationFunctions.push(element.onValidate);
|
|
1642
|
+
}
|
|
1643
|
+
|
|
1644
|
+
return combineValidators.apply(void 0, validationFunctions);
|
|
1645
|
+
};
|
|
1646
|
+
var assingUniqueIds = function assingUniqueIds(data) {
|
|
1647
|
+
if (_get(data[0], 'uniqueId')) {
|
|
1648
|
+
return data;
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
return _map(data, function (item) {
|
|
1652
|
+
_forEach(item, function (itemValue, key) {
|
|
1653
|
+
if (_isArray(itemValue)) {
|
|
1654
|
+
item[key] = assingUniqueIds(itemValue);
|
|
1655
|
+
}
|
|
1656
|
+
});
|
|
1657
|
+
|
|
1658
|
+
return _extends({}, item, {
|
|
1659
|
+
uniqueId: nanoid.nanoid()
|
|
1660
|
+
});
|
|
1661
|
+
});
|
|
1662
|
+
};
|
|
1613
1663
|
|
|
1614
1664
|
var useStyles = /*#__PURE__*/styles.makeStyles({
|
|
1615
1665
|
input: {
|
|
1616
|
-
|
|
1617
|
-
color:
|
|
1666
|
+
'&::placeholder': {
|
|
1667
|
+
color: 'gray'
|
|
1618
1668
|
}
|
|
1619
1669
|
}
|
|
1620
1670
|
});
|
|
@@ -1627,13 +1677,14 @@ var CustomField = function CustomField(_ref) {
|
|
|
1627
1677
|
selectOptions = _ref$selectOptions === void 0 ? [] : _ref$selectOptions,
|
|
1628
1678
|
_ref$form = _ref.form,
|
|
1629
1679
|
touched = _ref$form.touched,
|
|
1630
|
-
errors = _ref$form.errors
|
|
1680
|
+
errors = _ref$form.errors,
|
|
1681
|
+
theme = _ref.theme;
|
|
1631
1682
|
var isSelectField = type === 'select';
|
|
1632
1683
|
var isShrink = Boolean(field.value) || type === 'date' || type === 'select';
|
|
1633
|
-
var isTouched = Boolean(_get(touched, field.name));
|
|
1634
1684
|
|
|
1635
1685
|
var error = _get(errors, field.name);
|
|
1636
1686
|
|
|
1687
|
+
var isTouched = Boolean(_get(touched, field.name)) || _includes(field.name, 'holder') && !!error;
|
|
1637
1688
|
var classes = useStyles();
|
|
1638
1689
|
return React__default.createElement(TextField, Object.assign({
|
|
1639
1690
|
id: field.name,
|
|
@@ -1652,7 +1703,11 @@ var CustomField = function CustomField(_ref) {
|
|
|
1652
1703
|
}
|
|
1653
1704
|
},
|
|
1654
1705
|
SelectProps: {
|
|
1655
|
-
"native": true
|
|
1706
|
+
"native": true,
|
|
1707
|
+
className: theme,
|
|
1708
|
+
MenuProps: {
|
|
1709
|
+
className: theme
|
|
1710
|
+
}
|
|
1656
1711
|
}
|
|
1657
1712
|
}, field), isSelectField ? _map(selectOptions, function (option) {
|
|
1658
1713
|
return React__default.createElement("option", {
|
|
@@ -1663,7 +1718,7 @@ var CustomField = function CustomField(_ref) {
|
|
|
1663
1718
|
}) : null);
|
|
1664
1719
|
};
|
|
1665
1720
|
|
|
1666
|
-
var _excluded$1 = ["label", "field"];
|
|
1721
|
+
var _excluded$1 = ["label", "field", "selectOptions", "theme"];
|
|
1667
1722
|
var CheckboxField = function CheckboxField(_ref) {
|
|
1668
1723
|
var label = _ref.label,
|
|
1669
1724
|
field = _ref.field,
|
|
@@ -1692,6 +1747,101 @@ var getQueryVariable = function getQueryVariable(variable) {
|
|
|
1692
1747
|
return false;
|
|
1693
1748
|
};
|
|
1694
1749
|
|
|
1750
|
+
var useStyles$1 = /*#__PURE__*/styles.makeStyles({
|
|
1751
|
+
input: {
|
|
1752
|
+
'&::placeholder': {
|
|
1753
|
+
color: 'gray'
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
});
|
|
1757
|
+
var SelectField = function SelectField(_ref) {
|
|
1758
|
+
var label = _ref.label,
|
|
1759
|
+
_ref$type = _ref.type,
|
|
1760
|
+
type = _ref$type === void 0 ? 'text' : _ref$type,
|
|
1761
|
+
field = _ref.field,
|
|
1762
|
+
_ref$selectOptions = _ref.selectOptions,
|
|
1763
|
+
selectOptions = _ref$selectOptions === void 0 ? [] : _ref$selectOptions,
|
|
1764
|
+
_ref$form = _ref.form,
|
|
1765
|
+
touched = _ref$form.touched,
|
|
1766
|
+
errors = _ref$form.errors,
|
|
1767
|
+
theme = _ref.theme;
|
|
1768
|
+
var isTouched = Boolean(_get(touched, field.name));
|
|
1769
|
+
|
|
1770
|
+
var error = _get(errors, field.name);
|
|
1771
|
+
|
|
1772
|
+
var classes = useStyles$1();
|
|
1773
|
+
return React__default.createElement(material.FormControl, {
|
|
1774
|
+
fullWidth: true
|
|
1775
|
+
}, React__default.createElement(material.InputLabel, {
|
|
1776
|
+
htmlFor: field.name,
|
|
1777
|
+
error: !!error && isTouched
|
|
1778
|
+
}, label), React__default.createElement(Select, Object.assign({
|
|
1779
|
+
id: field.name,
|
|
1780
|
+
label: label,
|
|
1781
|
+
type: type,
|
|
1782
|
+
fullWidth: true,
|
|
1783
|
+
error: !!error && isTouched,
|
|
1784
|
+
inputProps: {
|
|
1785
|
+
id: field.name,
|
|
1786
|
+
classes: {
|
|
1787
|
+
input: classes.input
|
|
1788
|
+
}
|
|
1789
|
+
},
|
|
1790
|
+
"native": true,
|
|
1791
|
+
className: theme,
|
|
1792
|
+
MenuProps: {
|
|
1793
|
+
className: theme
|
|
1794
|
+
}
|
|
1795
|
+
}, field), _map(selectOptions, function (option) {
|
|
1796
|
+
return React__default.createElement("option", {
|
|
1797
|
+
key: option.value,
|
|
1798
|
+
value: option.value,
|
|
1799
|
+
disabled: option.disabled
|
|
1800
|
+
}, option.label);
|
|
1801
|
+
})), isTouched && error ? React__default.createElement(material.FormHelperText, {
|
|
1802
|
+
error: !!error && isTouched
|
|
1803
|
+
}, error) : null);
|
|
1804
|
+
};
|
|
1805
|
+
|
|
1806
|
+
var ErrorFocusInternal = /*#__PURE__*/function (_Component) {
|
|
1807
|
+
_inheritsLoose(ErrorFocusInternal, _Component);
|
|
1808
|
+
|
|
1809
|
+
function ErrorFocusInternal() {
|
|
1810
|
+
var _this;
|
|
1811
|
+
|
|
1812
|
+
_this = _Component.apply(this, arguments) || this;
|
|
1813
|
+
|
|
1814
|
+
_this.render = function () {
|
|
1815
|
+
return null;
|
|
1816
|
+
};
|
|
1817
|
+
|
|
1818
|
+
return _this;
|
|
1819
|
+
}
|
|
1820
|
+
|
|
1821
|
+
var _proto = ErrorFocusInternal.prototype;
|
|
1822
|
+
|
|
1823
|
+
_proto.componentDidUpdate = function componentDidUpdate(prevProps) {
|
|
1824
|
+
var _prevProps$formik = prevProps.formik,
|
|
1825
|
+
isSubmitting = _prevProps$formik.isSubmitting,
|
|
1826
|
+
isValidating = _prevProps$formik.isValidating,
|
|
1827
|
+
errors = _prevProps$formik.errors;
|
|
1828
|
+
var keys = Object.keys(errors);
|
|
1829
|
+
|
|
1830
|
+
if (keys.length > 0 && isSubmitting && !isValidating) {
|
|
1831
|
+
var selector = "[name=\"" + keys[0] + "\"]";
|
|
1832
|
+
var errorElement = document.querySelector(selector);
|
|
1833
|
+
|
|
1834
|
+
if (errorElement) {
|
|
1835
|
+
errorElement.focus();
|
|
1836
|
+
}
|
|
1837
|
+
}
|
|
1838
|
+
};
|
|
1839
|
+
|
|
1840
|
+
return ErrorFocusInternal;
|
|
1841
|
+
}(React.Component);
|
|
1842
|
+
|
|
1843
|
+
var ErrorFocus = /*#__PURE__*/formik.connect(ErrorFocusInternal);
|
|
1844
|
+
|
|
1695
1845
|
var LogicRunner = function LogicRunner(_ref) {
|
|
1696
1846
|
var values = _ref.values,
|
|
1697
1847
|
setStates = _ref.setStates,
|
|
@@ -1763,7 +1913,7 @@ var LogicRunner = function LogicRunner(_ref) {
|
|
|
1763
1913
|
lastName: parsedData == null ? void 0 : parsedData.last_name,
|
|
1764
1914
|
email: (parsedData == null ? void 0 : parsedData.email) || '',
|
|
1765
1915
|
phone: (parsedData == null ? void 0 : parsedData.phone) || '',
|
|
1766
|
-
confirmEmail: '',
|
|
1916
|
+
confirmEmail: (parsedData == null ? void 0 : parsedData.email) || '',
|
|
1767
1917
|
state: (parsedData == null ? void 0 : parsedData.state) || '',
|
|
1768
1918
|
street_address: (parsedData == null ? void 0 : parsedData.street_address) || '',
|
|
1769
1919
|
country: (parsedData == null ? void 0 : parsedData.country) || 1,
|
|
@@ -1785,93 +1935,88 @@ var LogicRunner = function LogicRunner(_ref) {
|
|
|
1785
1935
|
return null;
|
|
1786
1936
|
};
|
|
1787
1937
|
|
|
1788
|
-
var
|
|
1789
|
-
var
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
1794
|
-
var _ref4$data = _ref4.data,
|
|
1795
|
-
data = _ref4$data === void 0 ? [] : _ref4$data,
|
|
1796
|
-
_ref4$ticketHoldersFi = _ref4.ticketHoldersFields,
|
|
1797
|
-
ticketHoldersFields = _ref4$ticketHoldersFi === void 0 ? {
|
|
1938
|
+
var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
1939
|
+
var _ref3$data = _ref3.data,
|
|
1940
|
+
data = _ref3$data === void 0 ? [] : _ref3$data,
|
|
1941
|
+
_ref3$ticketHoldersFi = _ref3.ticketHoldersFields,
|
|
1942
|
+
ticketHoldersFields = _ref3$ticketHoldersFi === void 0 ? {
|
|
1798
1943
|
id: 1,
|
|
1799
1944
|
fields: []
|
|
1800
|
-
} :
|
|
1801
|
-
|
|
1802
|
-
initialValues =
|
|
1803
|
-
|
|
1804
|
-
buttonName =
|
|
1805
|
-
|
|
1806
|
-
handleSubmit =
|
|
1807
|
-
|
|
1808
|
-
theme =
|
|
1809
|
-
|
|
1810
|
-
onRegisterSuccess =
|
|
1811
|
-
|
|
1812
|
-
onRegisterError =
|
|
1813
|
-
|
|
1814
|
-
onSubmitError =
|
|
1815
|
-
|
|
1816
|
-
onGetCartSuccess =
|
|
1817
|
-
|
|
1818
|
-
onGetCartError =
|
|
1819
|
-
|
|
1820
|
-
onGetCountriesSuccess =
|
|
1821
|
-
|
|
1822
|
-
onGetCountriesError =
|
|
1823
|
-
|
|
1824
|
-
onGetStatesSuccess =
|
|
1825
|
-
|
|
1826
|
-
onGetStatesError =
|
|
1827
|
-
|
|
1828
|
-
onGetProfileDataSuccess =
|
|
1829
|
-
|
|
1830
|
-
onGetProfileDataError =
|
|
1831
|
-
|
|
1832
|
-
onAuthorizeSuccess =
|
|
1833
|
-
|
|
1834
|
-
onAuthorizeError =
|
|
1835
|
-
|
|
1836
|
-
onLogin =
|
|
1945
|
+
} : _ref3$ticketHoldersFi,
|
|
1946
|
+
_ref3$initialValues = _ref3.initialValues,
|
|
1947
|
+
initialValues = _ref3$initialValues === void 0 ? {} : _ref3$initialValues,
|
|
1948
|
+
_ref3$buttonName = _ref3.buttonName,
|
|
1949
|
+
buttonName = _ref3$buttonName === void 0 ? 'Submit' : _ref3$buttonName,
|
|
1950
|
+
_ref3$handleSubmit = _ref3.handleSubmit,
|
|
1951
|
+
handleSubmit = _ref3$handleSubmit === void 0 ? _identity : _ref3$handleSubmit,
|
|
1952
|
+
_ref3$theme = _ref3.theme,
|
|
1953
|
+
theme = _ref3$theme === void 0 ? 'light' : _ref3$theme,
|
|
1954
|
+
_ref3$onRegisterSucce = _ref3.onRegisterSuccess,
|
|
1955
|
+
onRegisterSuccess = _ref3$onRegisterSucce === void 0 ? function () {} : _ref3$onRegisterSucce,
|
|
1956
|
+
_ref3$onRegisterError = _ref3.onRegisterError,
|
|
1957
|
+
onRegisterError = _ref3$onRegisterError === void 0 ? function () {} : _ref3$onRegisterError,
|
|
1958
|
+
_ref3$onSubmitError = _ref3.onSubmitError,
|
|
1959
|
+
onSubmitError = _ref3$onSubmitError === void 0 ? function () {} : _ref3$onSubmitError,
|
|
1960
|
+
_ref3$onGetCartSucces = _ref3.onGetCartSuccess,
|
|
1961
|
+
onGetCartSuccess = _ref3$onGetCartSucces === void 0 ? function () {} : _ref3$onGetCartSucces,
|
|
1962
|
+
_ref3$onGetCartError = _ref3.onGetCartError,
|
|
1963
|
+
onGetCartError = _ref3$onGetCartError === void 0 ? function () {} : _ref3$onGetCartError,
|
|
1964
|
+
_ref3$onGetCountriesS = _ref3.onGetCountriesSuccess,
|
|
1965
|
+
onGetCountriesSuccess = _ref3$onGetCountriesS === void 0 ? function () {} : _ref3$onGetCountriesS,
|
|
1966
|
+
_ref3$onGetCountriesE = _ref3.onGetCountriesError,
|
|
1967
|
+
onGetCountriesError = _ref3$onGetCountriesE === void 0 ? function () {} : _ref3$onGetCountriesE,
|
|
1968
|
+
_ref3$onGetStatesSucc = _ref3.onGetStatesSuccess,
|
|
1969
|
+
onGetStatesSuccess = _ref3$onGetStatesSucc === void 0 ? function () {} : _ref3$onGetStatesSucc,
|
|
1970
|
+
_ref3$onGetStatesErro = _ref3.onGetStatesError,
|
|
1971
|
+
onGetStatesError = _ref3$onGetStatesErro === void 0 ? function () {} : _ref3$onGetStatesErro,
|
|
1972
|
+
_ref3$onGetProfileDat = _ref3.onGetProfileDataSuccess,
|
|
1973
|
+
onGetProfileDataSuccess = _ref3$onGetProfileDat === void 0 ? function () {} : _ref3$onGetProfileDat,
|
|
1974
|
+
_ref3$onGetProfileDat2 = _ref3.onGetProfileDataError,
|
|
1975
|
+
onGetProfileDataError = _ref3$onGetProfileDat2 === void 0 ? function () {} : _ref3$onGetProfileDat2,
|
|
1976
|
+
_ref3$onAuthorizeSucc = _ref3.onAuthorizeSuccess,
|
|
1977
|
+
onAuthorizeSuccess = _ref3$onAuthorizeSucc === void 0 ? function () {} : _ref3$onAuthorizeSucc,
|
|
1978
|
+
_ref3$onAuthorizeErro = _ref3.onAuthorizeError,
|
|
1979
|
+
onAuthorizeError = _ref3$onAuthorizeErro === void 0 ? function () {} : _ref3$onAuthorizeErro,
|
|
1980
|
+
_ref3$onLogin = _ref3.onLogin,
|
|
1981
|
+
onLogin = _ref3$onLogin === void 0 ? function () {} : _ref3$onLogin;
|
|
1837
1982
|
var userData = typeof window !== 'undefined' && window.localStorage.getItem('user_data') ? JSON.parse(window.localStorage.getItem('user_data') || '') : {};
|
|
1838
1983
|
var access_token = typeof window !== 'undefined' && window.localStorage.getItem('access_token') ? window.localStorage.getItem('access_token') || '' : '';
|
|
1839
1984
|
|
|
1840
|
-
var _useState = React.useState(
|
|
1841
|
-
|
|
1842
|
-
|
|
1985
|
+
var _useState = React.useState(data),
|
|
1986
|
+
dataWithUniqueIds = _useState[0],
|
|
1987
|
+
setDataWithUniqueIds = _useState[1];
|
|
1843
1988
|
|
|
1844
|
-
var _useState2 = React.useState(
|
|
1845
|
-
|
|
1846
|
-
|
|
1989
|
+
var _useState2 = React.useState({}),
|
|
1990
|
+
cartInfoData = _useState2[0],
|
|
1991
|
+
setCartInfo = _useState2[1];
|
|
1847
1992
|
|
|
1848
1993
|
var _useState3 = React.useState([]),
|
|
1849
|
-
|
|
1850
|
-
|
|
1994
|
+
countries = _useState3[0],
|
|
1995
|
+
setCountries = _useState3[1];
|
|
1851
1996
|
|
|
1852
|
-
var _useState4 = React.useState(
|
|
1853
|
-
|
|
1854
|
-
|
|
1997
|
+
var _useState4 = React.useState([]),
|
|
1998
|
+
states = _useState4[0],
|
|
1999
|
+
setStates = _useState4[1];
|
|
1855
2000
|
|
|
1856
2001
|
var _useState5 = React.useState(false),
|
|
1857
|
-
|
|
1858
|
-
|
|
2002
|
+
showModalLogin = _useState5[0],
|
|
2003
|
+
setShowModalLogin = _useState5[1];
|
|
1859
2004
|
|
|
1860
2005
|
var _useState6 = React.useState(false),
|
|
1861
|
-
|
|
1862
|
-
|
|
2006
|
+
alreadyHasUser = _useState6[0],
|
|
2007
|
+
setAlreadyHasUser = _useState6[1];
|
|
1863
2008
|
|
|
1864
2009
|
var _useState7 = React.useState(false),
|
|
1865
|
-
|
|
1866
|
-
|
|
2010
|
+
userExpired = _useState7[0],
|
|
2011
|
+
setUserExpired = _useState7[1];
|
|
1867
2012
|
|
|
1868
|
-
var _useState8 = React.useState(
|
|
1869
|
-
|
|
1870
|
-
|
|
2013
|
+
var _useState8 = React.useState(false),
|
|
2014
|
+
showModalRegister = _useState8[0],
|
|
2015
|
+
setShowModalRegister = _useState8[1];
|
|
1871
2016
|
|
|
1872
2017
|
var _useState9 = React.useState([]),
|
|
1873
|
-
|
|
1874
|
-
|
|
2018
|
+
ticketsQuantity = _useState9[0],
|
|
2019
|
+
setTicketsQuantity = _useState9[1];
|
|
1875
2020
|
|
|
1876
2021
|
var _useState10 = React.useState({
|
|
1877
2022
|
firstName: '',
|
|
@@ -1905,7 +2050,11 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
1905
2050
|
|
|
1906
2051
|
var optedInFieldValue = _get(cartInfoData, 'optedIn', false);
|
|
1907
2052
|
|
|
1908
|
-
var
|
|
2053
|
+
var hideTtfOptIn = _get(cartInfoData, 'hide_ttf_opt_in', true);
|
|
2054
|
+
|
|
2055
|
+
if (!_get(dataWithUniqueIds, '[0].uniqueId')) {
|
|
2056
|
+
setDataWithUniqueIds(assingUniqueIds(data));
|
|
2057
|
+
}
|
|
1909
2058
|
|
|
1910
2059
|
var getQuantity = function getQuantity(cart) {
|
|
1911
2060
|
if (cart === void 0) {
|
|
@@ -1921,60 +2070,20 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
1921
2070
|
|
|
1922
2071
|
|
|
1923
2072
|
React.useEffect(function () {
|
|
1924
|
-
// fetch
|
|
1925
|
-
var
|
|
1926
|
-
var
|
|
1927
|
-
var res
|
|
2073
|
+
// fetch countries data
|
|
2074
|
+
var fetchCountries = /*#__PURE__*/function () {
|
|
2075
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
|
|
2076
|
+
var res;
|
|
1928
2077
|
return runtime_1.wrap(function _callee2$(_context2) {
|
|
1929
2078
|
while (1) {
|
|
1930
2079
|
switch (_context2.prev = _context2.next) {
|
|
1931
2080
|
case 0:
|
|
1932
|
-
|
|
1933
|
-
_context2.next = 6;
|
|
1934
|
-
break;
|
|
1935
|
-
}
|
|
1936
|
-
|
|
2081
|
+
_context2.prev = 0;
|
|
1937
2082
|
_context2.next = 3;
|
|
1938
|
-
return getConditions(eventId);
|
|
1939
|
-
|
|
1940
|
-
case 3:
|
|
1941
|
-
res = _context2.sent;
|
|
1942
|
-
conditionsInfo = _get(res, 'data.data.attributes');
|
|
1943
|
-
setConditions(conditionsInfo ? conditionsInfo.map(function (item) {
|
|
1944
|
-
return {
|
|
1945
|
-
id: nanoid.nanoid(),
|
|
1946
|
-
text: item
|
|
1947
|
-
};
|
|
1948
|
-
}) : []);
|
|
1949
|
-
|
|
1950
|
-
case 6:
|
|
1951
|
-
case "end":
|
|
1952
|
-
return _context2.stop();
|
|
1953
|
-
}
|
|
1954
|
-
}
|
|
1955
|
-
}, _callee2);
|
|
1956
|
-
}));
|
|
1957
|
-
|
|
1958
|
-
return function fetchConditions() {
|
|
1959
|
-
return _ref5.apply(this, arguments);
|
|
1960
|
-
};
|
|
1961
|
-
}();
|
|
1962
|
-
|
|
1963
|
-
fetchConditions(); // fetch countries data
|
|
1964
|
-
|
|
1965
|
-
var fetchCountries = /*#__PURE__*/function () {
|
|
1966
|
-
var _ref6 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
|
|
1967
|
-
var res;
|
|
1968
|
-
return runtime_1.wrap(function _callee3$(_context3) {
|
|
1969
|
-
while (1) {
|
|
1970
|
-
switch (_context3.prev = _context3.next) {
|
|
1971
|
-
case 0:
|
|
1972
|
-
_context3.prev = 0;
|
|
1973
|
-
_context3.next = 3;
|
|
1974
2083
|
return getCountries();
|
|
1975
2084
|
|
|
1976
2085
|
case 3:
|
|
1977
|
-
res =
|
|
2086
|
+
res = _context2.sent;
|
|
1978
2087
|
setCustomHeader(res);
|
|
1979
2088
|
setCountries(_map(_get(res, 'data.data'), function (item, key) {
|
|
1980
2089
|
return {
|
|
@@ -1983,27 +2092,27 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
1983
2092
|
};
|
|
1984
2093
|
}));
|
|
1985
2094
|
onGetCountriesSuccess(res.data);
|
|
1986
|
-
|
|
2095
|
+
_context2.next = 12;
|
|
1987
2096
|
break;
|
|
1988
2097
|
|
|
1989
2098
|
case 9:
|
|
1990
|
-
|
|
1991
|
-
|
|
2099
|
+
_context2.prev = 9;
|
|
2100
|
+
_context2.t0 = _context2["catch"](0);
|
|
1992
2101
|
|
|
1993
|
-
if (axios.isAxiosError(
|
|
1994
|
-
onGetCountriesError(
|
|
2102
|
+
if (axios.isAxiosError(_context2.t0)) {
|
|
2103
|
+
onGetCountriesError(_context2.t0);
|
|
1995
2104
|
}
|
|
1996
2105
|
|
|
1997
2106
|
case 12:
|
|
1998
2107
|
case "end":
|
|
1999
|
-
return
|
|
2108
|
+
return _context2.stop();
|
|
2000
2109
|
}
|
|
2001
2110
|
}
|
|
2002
|
-
},
|
|
2111
|
+
}, _callee2, null, [[0, 9]]);
|
|
2003
2112
|
}));
|
|
2004
2113
|
|
|
2005
2114
|
return function fetchCountries() {
|
|
2006
|
-
return
|
|
2115
|
+
return _ref4.apply(this, arguments);
|
|
2007
2116
|
};
|
|
2008
2117
|
}();
|
|
2009
2118
|
|
|
@@ -2012,19 +2121,19 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
2012
2121
|
}, []); // fetch cart data
|
|
2013
2122
|
|
|
2014
2123
|
var fetchCart = /*#__PURE__*/function () {
|
|
2015
|
-
var
|
|
2124
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
|
|
2016
2125
|
var res, cartInfo, _cartInfo$cart, cart;
|
|
2017
2126
|
|
|
2018
|
-
return runtime_1.wrap(function
|
|
2127
|
+
return runtime_1.wrap(function _callee3$(_context3) {
|
|
2019
2128
|
while (1) {
|
|
2020
|
-
switch (
|
|
2129
|
+
switch (_context3.prev = _context3.next) {
|
|
2021
2130
|
case 0:
|
|
2022
|
-
|
|
2023
|
-
|
|
2131
|
+
_context3.prev = 0;
|
|
2132
|
+
_context3.next = 3;
|
|
2024
2133
|
return getCart();
|
|
2025
2134
|
|
|
2026
2135
|
case 3:
|
|
2027
|
-
res =
|
|
2136
|
+
res = _context3.sent;
|
|
2028
2137
|
setCustomHeader(res);
|
|
2029
2138
|
cartInfo = _get(res, 'data.data.attributes');
|
|
2030
2139
|
setCartInfo(cartInfo);
|
|
@@ -2033,50 +2142,50 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
2033
2142
|
return nanoid.nanoid();
|
|
2034
2143
|
}));
|
|
2035
2144
|
onGetCartSuccess(res.data);
|
|
2036
|
-
|
|
2145
|
+
_context3.next = 15;
|
|
2037
2146
|
break;
|
|
2038
2147
|
|
|
2039
2148
|
case 12:
|
|
2040
|
-
|
|
2041
|
-
|
|
2149
|
+
_context3.prev = 12;
|
|
2150
|
+
_context3.t0 = _context3["catch"](0);
|
|
2042
2151
|
|
|
2043
|
-
if (axios.isAxiosError(
|
|
2044
|
-
onGetCartError(
|
|
2152
|
+
if (axios.isAxiosError(_context3.t0)) {
|
|
2153
|
+
onGetCartError(_context3.t0);
|
|
2045
2154
|
}
|
|
2046
2155
|
|
|
2047
2156
|
case 15:
|
|
2048
2157
|
case "end":
|
|
2049
|
-
return
|
|
2158
|
+
return _context3.stop();
|
|
2050
2159
|
}
|
|
2051
2160
|
}
|
|
2052
|
-
},
|
|
2161
|
+
}, _callee3, null, [[0, 12]]);
|
|
2053
2162
|
}));
|
|
2054
2163
|
|
|
2055
2164
|
return function fetchCart() {
|
|
2056
|
-
return
|
|
2165
|
+
return _ref5.apply(this, arguments);
|
|
2057
2166
|
};
|
|
2058
2167
|
}(); // fetch user data
|
|
2059
2168
|
|
|
2060
2169
|
|
|
2061
2170
|
var fetchUserData = /*#__PURE__*/function () {
|
|
2062
|
-
var
|
|
2171
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(token) {
|
|
2063
2172
|
var userDataResponse, profileSpecifiedData, profileDataObj;
|
|
2064
|
-
return runtime_1.wrap(function
|
|
2173
|
+
return runtime_1.wrap(function _callee4$(_context4) {
|
|
2065
2174
|
while (1) {
|
|
2066
|
-
switch (
|
|
2175
|
+
switch (_context4.prev = _context4.next) {
|
|
2067
2176
|
case 0:
|
|
2068
|
-
|
|
2177
|
+
_context4.prev = 0;
|
|
2069
2178
|
|
|
2070
2179
|
if (!(typeof window !== 'undefined' && token)) {
|
|
2071
|
-
|
|
2180
|
+
_context4.next = 10;
|
|
2072
2181
|
break;
|
|
2073
2182
|
}
|
|
2074
2183
|
|
|
2075
|
-
|
|
2184
|
+
_context4.next = 4;
|
|
2076
2185
|
return getProfileData(token);
|
|
2077
2186
|
|
|
2078
2187
|
case 4:
|
|
2079
|
-
userDataResponse =
|
|
2188
|
+
userDataResponse = _context4.sent;
|
|
2080
2189
|
profileSpecifiedData = _get(userDataResponse, 'data.data');
|
|
2081
2190
|
profileDataObj = setLoggedUserData(profileSpecifiedData);
|
|
2082
2191
|
setUserValues(profileDataObj);
|
|
@@ -2084,27 +2193,27 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
2084
2193
|
onGetProfileDataSuccess(userDataResponse.data);
|
|
2085
2194
|
|
|
2086
2195
|
case 10:
|
|
2087
|
-
|
|
2196
|
+
_context4.next = 15;
|
|
2088
2197
|
break;
|
|
2089
2198
|
|
|
2090
2199
|
case 12:
|
|
2091
|
-
|
|
2092
|
-
|
|
2200
|
+
_context4.prev = 12;
|
|
2201
|
+
_context4.t0 = _context4["catch"](0);
|
|
2093
2202
|
|
|
2094
|
-
if (axios.isAxiosError(
|
|
2095
|
-
onGetProfileDataError(
|
|
2203
|
+
if (axios.isAxiosError(_context4.t0)) {
|
|
2204
|
+
onGetProfileDataError(_context4.t0);
|
|
2096
2205
|
}
|
|
2097
2206
|
|
|
2098
2207
|
case 15:
|
|
2099
2208
|
case "end":
|
|
2100
|
-
return
|
|
2209
|
+
return _context4.stop();
|
|
2101
2210
|
}
|
|
2102
2211
|
}
|
|
2103
|
-
},
|
|
2212
|
+
}, _callee4, null, [[0, 12]]);
|
|
2104
2213
|
}));
|
|
2105
2214
|
|
|
2106
2215
|
return function fetchUserData(_x) {
|
|
2107
|
-
return
|
|
2216
|
+
return _ref6.apply(this, arguments);
|
|
2108
2217
|
};
|
|
2109
2218
|
}();
|
|
2110
2219
|
|
|
@@ -2112,7 +2221,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
2112
2221
|
fetchUserData(access_token);
|
|
2113
2222
|
}, [access_token]);
|
|
2114
2223
|
return React__default.createElement(React__default.Fragment, null, React__default.createElement(formik.Formik, {
|
|
2115
|
-
initialValues: getInitialValues(
|
|
2224
|
+
initialValues: getInitialValues(dataWithUniqueIds, _extends({}, initialValues, {
|
|
2116
2225
|
email: emailLogged,
|
|
2117
2226
|
firstName: firstNameLogged,
|
|
2118
2227
|
lastName: lastNameLogged,
|
|
@@ -2121,30 +2230,30 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
2121
2230
|
}), userValues),
|
|
2122
2231
|
enableReinitialize: true,
|
|
2123
2232
|
onSubmit: function () {
|
|
2124
|
-
var _onSubmit = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
2233
|
+
var _onSubmit = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(values, formikHelpers) {
|
|
2125
2234
|
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;
|
|
2126
2235
|
|
|
2127
|
-
return runtime_1.wrap(function
|
|
2236
|
+
return runtime_1.wrap(function _callee5$(_context5) {
|
|
2128
2237
|
while (1) {
|
|
2129
|
-
switch (
|
|
2238
|
+
switch (_context5.prev = _context5.next) {
|
|
2130
2239
|
case 0:
|
|
2131
|
-
|
|
2240
|
+
_context5.prev = 0;
|
|
2132
2241
|
|
|
2133
2242
|
if (!isLoggedIn) {
|
|
2134
|
-
|
|
2243
|
+
_context5.next = 15;
|
|
2135
2244
|
break;
|
|
2136
2245
|
}
|
|
2137
2246
|
|
|
2138
2247
|
if (!access_token) {
|
|
2139
|
-
|
|
2248
|
+
_context5.next = 9;
|
|
2140
2249
|
break;
|
|
2141
2250
|
}
|
|
2142
2251
|
|
|
2143
|
-
|
|
2252
|
+
_context5.next = 5;
|
|
2144
2253
|
return getProfileData(access_token);
|
|
2145
2254
|
|
|
2146
2255
|
case 5:
|
|
2147
|
-
updatedUserData =
|
|
2256
|
+
updatedUserData = _context5.sent;
|
|
2148
2257
|
_profileSpecifiedData = _get(updatedUserData, 'data.data');
|
|
2149
2258
|
_profileDataObj = setLoggedUserData(_profileSpecifiedData);
|
|
2150
2259
|
|
|
@@ -2158,23 +2267,23 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
2158
2267
|
firstNameLogged: firstNameLogged,
|
|
2159
2268
|
lastNameLogged: lastNameLogged
|
|
2160
2269
|
}, showDOB);
|
|
2161
|
-
|
|
2270
|
+
_context5.next = 12;
|
|
2162
2271
|
return postOnCheckout(_checkoutBody, access_token);
|
|
2163
2272
|
|
|
2164
2273
|
case 12:
|
|
2165
|
-
_res =
|
|
2166
|
-
handleSubmit(values, formikHelpers, _res);
|
|
2167
|
-
return
|
|
2274
|
+
_res = _context5.sent;
|
|
2275
|
+
handleSubmit(values, formikHelpers, eventId, _res);
|
|
2276
|
+
return _context5.abrupt("return");
|
|
2168
2277
|
|
|
2169
2278
|
case 15:
|
|
2170
2279
|
bodyFormData = createRegisterFormData(values);
|
|
2171
2280
|
access_token_register = null;
|
|
2172
|
-
|
|
2173
|
-
|
|
2281
|
+
_context5.prev = 17;
|
|
2282
|
+
_context5.next = 20;
|
|
2174
2283
|
return register(bodyFormData);
|
|
2175
2284
|
|
|
2176
2285
|
case 20:
|
|
2177
|
-
resRegister =
|
|
2286
|
+
resRegister = _context5.sent;
|
|
2178
2287
|
access_token_register = _get(resRegister, 'data.data.attributes.access_token');
|
|
2179
2288
|
refreshToken = _get(resRegister, 'data.data.attributes.refresh_token');
|
|
2180
2289
|
handleSetAccessToken(access_token_register);
|
|
@@ -2183,15 +2292,15 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
2183
2292
|
refreshToken: refreshToken
|
|
2184
2293
|
};
|
|
2185
2294
|
onRegisterSuccess(tokens);
|
|
2186
|
-
|
|
2295
|
+
_context5.next = 32;
|
|
2187
2296
|
break;
|
|
2188
2297
|
|
|
2189
2298
|
case 28:
|
|
2190
|
-
|
|
2191
|
-
|
|
2299
|
+
_context5.prev = 28;
|
|
2300
|
+
_context5.t0 = _context5["catch"](17);
|
|
2192
2301
|
|
|
2193
|
-
if (axios.isAxiosError(
|
|
2194
|
-
error =
|
|
2302
|
+
if (axios.isAxiosError(_context5.t0)) {
|
|
2303
|
+
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;
|
|
2195
2304
|
|
|
2196
2305
|
if (_includes(error, 'You must be aged')) {
|
|
2197
2306
|
formikHelpers.setFieldError('holderAge', error);
|
|
@@ -2207,17 +2316,17 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
2207
2316
|
setShowModalLogin(true);
|
|
2208
2317
|
}
|
|
2209
2318
|
|
|
2210
|
-
onRegisterError(
|
|
2319
|
+
onRegisterError(_context5.t0);
|
|
2211
2320
|
}
|
|
2212
2321
|
|
|
2213
|
-
return
|
|
2322
|
+
return _context5.abrupt("return");
|
|
2214
2323
|
|
|
2215
2324
|
case 32:
|
|
2216
|
-
|
|
2325
|
+
_context5.next = 34;
|
|
2217
2326
|
return getProfileData(access_token_register);
|
|
2218
2327
|
|
|
2219
2328
|
case 34:
|
|
2220
|
-
profileData =
|
|
2329
|
+
profileData = _context5.sent;
|
|
2221
2330
|
profileSpecifiedData = _get(profileData, 'data.data');
|
|
2222
2331
|
profileDataObj = setLoggedUserData(profileSpecifiedData);
|
|
2223
2332
|
|
|
@@ -2230,21 +2339,21 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
2230
2339
|
firstNameLogged: firstNameLogged,
|
|
2231
2340
|
lastNameLogged: lastNameLogged
|
|
2232
2341
|
}, showDOB);
|
|
2233
|
-
|
|
2342
|
+
_context5.next = 41;
|
|
2234
2343
|
return postOnCheckout(checkoutBody, access_token_register);
|
|
2235
2344
|
|
|
2236
2345
|
case 41:
|
|
2237
|
-
res =
|
|
2238
|
-
handleSubmit(values, formikHelpers, res);
|
|
2239
|
-
|
|
2346
|
+
res = _context5.sent;
|
|
2347
|
+
handleSubmit(values, formikHelpers, eventId, res);
|
|
2348
|
+
_context5.next = 48;
|
|
2240
2349
|
break;
|
|
2241
2350
|
|
|
2242
2351
|
case 45:
|
|
2243
|
-
|
|
2244
|
-
|
|
2352
|
+
_context5.prev = 45;
|
|
2353
|
+
_context5.t1 = _context5["catch"](0);
|
|
2245
2354
|
|
|
2246
|
-
if (axios.isAxiosError(
|
|
2247
|
-
if (((_e$response2 =
|
|
2355
|
+
if (axios.isAxiosError(_context5.t1)) {
|
|
2356
|
+
if (((_e$response2 = _context5.t1.response) == null ? void 0 : _e$response2.data.error) === 'invalid_token') {
|
|
2248
2357
|
if (typeof window !== 'undefined') {
|
|
2249
2358
|
window.localStorage.removeItem('user_data');
|
|
2250
2359
|
window.localStorage.removeItem('access_token');
|
|
@@ -2253,15 +2362,15 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
2253
2362
|
}
|
|
2254
2363
|
}
|
|
2255
2364
|
|
|
2256
|
-
onSubmitError(
|
|
2365
|
+
onSubmitError(_context5.t1);
|
|
2257
2366
|
}
|
|
2258
2367
|
|
|
2259
2368
|
case 48:
|
|
2260
2369
|
case "end":
|
|
2261
|
-
return
|
|
2370
|
+
return _context5.stop();
|
|
2262
2371
|
}
|
|
2263
2372
|
}
|
|
2264
|
-
},
|
|
2373
|
+
}, _callee5, null, [[0, 45], [17, 28]]);
|
|
2265
2374
|
}));
|
|
2266
2375
|
|
|
2267
2376
|
function onSubmit(_x2, _x3) {
|
|
@@ -2273,7 +2382,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
2273
2382
|
}, function (props) {
|
|
2274
2383
|
return React__default.createElement(formik.Form, {
|
|
2275
2384
|
onSubmit: props.handleSubmit
|
|
2276
|
-
}, React__default.createElement(LogicRunner, {
|
|
2385
|
+
}, React__default.createElement(ErrorFocus, null), React__default.createElement(LogicRunner, {
|
|
2277
2386
|
values: props.values,
|
|
2278
2387
|
setStates: setStates,
|
|
2279
2388
|
setFieldValue: props.setFieldValue,
|
|
@@ -2294,9 +2403,8 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
2294
2403
|
onLogin();
|
|
2295
2404
|
setShowModalLogin(true);
|
|
2296
2405
|
}
|
|
2297
|
-
}, "Login"))), _map(
|
|
2298
|
-
var
|
|
2299
|
-
label = item.label,
|
|
2406
|
+
}, "Login"))), _map(dataWithUniqueIds, function (item) {
|
|
2407
|
+
var label = item.label,
|
|
2300
2408
|
labelClassName = item.labelClassName,
|
|
2301
2409
|
fields = item.fields;
|
|
2302
2410
|
|
|
@@ -2304,8 +2412,8 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
2304
2412
|
return null;
|
|
2305
2413
|
}
|
|
2306
2414
|
|
|
2307
|
-
return React__default.createElement(
|
|
2308
|
-
key:
|
|
2415
|
+
return React__default.createElement(React__default.Fragment, {
|
|
2416
|
+
key: item.uniqueId
|
|
2309
2417
|
}, React__default.createElement("p", {
|
|
2310
2418
|
className: labelClassName
|
|
2311
2419
|
}, label), _map(fields, function (group) {
|
|
@@ -2313,8 +2421,8 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
2313
2421
|
groupItems = group.groupItems,
|
|
2314
2422
|
groupLabel = group.groupLabel,
|
|
2315
2423
|
groupLabelClassName = group.groupLabelClassName;
|
|
2316
|
-
return React__default.createElement(
|
|
2317
|
-
key: group.
|
|
2424
|
+
return React__default.createElement(React__default.Fragment, {
|
|
2425
|
+
key: group.uniqueId
|
|
2318
2426
|
}, !isLoggedIn && React__default.createElement("div", {
|
|
2319
2427
|
className: groupLabelClassName
|
|
2320
2428
|
}, groupLabel), React__default.createElement("div", {
|
|
@@ -2332,42 +2440,47 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
2332
2440
|
return false;
|
|
2333
2441
|
}
|
|
2334
2442
|
|
|
2335
|
-
if (el.name === '
|
|
2443
|
+
if (el.name === 'ttf_opt_in' && hideTtfOptIn) {
|
|
2336
2444
|
return false;
|
|
2337
2445
|
}
|
|
2338
2446
|
|
|
2339
2447
|
return true;
|
|
2340
2448
|
}), function (element) {
|
|
2341
|
-
return ['password', 'confirmPassword'].includes(element.name) && isLoggedIn ? null : React__default.createElement(
|
|
2342
|
-
|
|
2343
|
-
|
|
2449
|
+
return ['password', 'confirmPassword'].includes(element.name) && isLoggedIn ? null : React__default.createElement(React__default.Fragment, {
|
|
2450
|
+
key: element.uniqueId
|
|
2451
|
+
}, element.name === 'email' ? React__default.createElement("div", {
|
|
2452
|
+
className: "email-checking"
|
|
2453
|
+
}, "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", {
|
|
2454
|
+
className: element.className
|
|
2344
2455
|
}, element.component ? element.component : React__default.createElement(formik.Field, {
|
|
2345
2456
|
name: element.name,
|
|
2346
2457
|
label: element.label,
|
|
2347
2458
|
type: element.type,
|
|
2348
|
-
validate:
|
|
2349
|
-
component: element.type === 'checkbox' ? CheckboxField : CustomField,
|
|
2350
|
-
selectOptions: element.name === 'country' ? countries : element.name === 'state' ? states : []
|
|
2351
|
-
|
|
2459
|
+
validate: getValidateFunctions(element, states),
|
|
2460
|
+
component: element.type === 'checkbox' ? CheckboxField : element.type === 'select' ? SelectField : CustomField,
|
|
2461
|
+
selectOptions: element.name === 'country' ? countries : element.name === 'state' ? states : [],
|
|
2462
|
+
theme: theme
|
|
2463
|
+
})));
|
|
2352
2464
|
})));
|
|
2353
2465
|
}));
|
|
2354
|
-
}), showTicketHolderName && React__default.createElement(React__default.Fragment, null, React__default.createElement("
|
|
2466
|
+
}), showTicketHolderName && React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
|
|
2467
|
+
className: "ticket-holders-fields"
|
|
2468
|
+
}, React__default.createElement("p", null, ticketHoldersFields.label), _map(ticketsQuantity, function (_item, index) {
|
|
2355
2469
|
return React__default.createElement("div", {
|
|
2356
2470
|
key: _item
|
|
2357
2471
|
}, React__default.createElement("h5", null, "Ticket ", index + 1), _map(ticketHoldersFields.fields, function (group) {
|
|
2358
2472
|
var groupClassname = group.groupClassname,
|
|
2359
2473
|
groupItems = group.groupItems;
|
|
2360
2474
|
return React__default.createElement("div", {
|
|
2361
|
-
key: group.
|
|
2475
|
+
key: group.uniqueId
|
|
2362
2476
|
}, React__default.createElement("div", {
|
|
2363
2477
|
className: groupClassname
|
|
2364
2478
|
}, _map(groupItems, function (element) {
|
|
2365
2479
|
return React__default.createElement("div", {
|
|
2366
2480
|
className: element.className,
|
|
2367
|
-
key: element.
|
|
2481
|
+
key: element.uniqueId
|
|
2368
2482
|
}, React__default.createElement(formik.Field, {
|
|
2369
2483
|
name: element.name + "-" + index,
|
|
2370
|
-
key: element.name + "-" + index,
|
|
2371
2484
|
label: element.label,
|
|
2372
2485
|
type: element.type,
|
|
2373
2486
|
required: true,
|
|
@@ -2376,21 +2489,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
2376
2489
|
}));
|
|
2377
2490
|
})));
|
|
2378
2491
|
}));
|
|
2379
|
-
})),
|
|
2380
|
-
return React__default.createElement("div", {
|
|
2381
|
-
className: 'billing-info-container__singleField',
|
|
2382
|
-
key: checkbox.id
|
|
2383
|
-
}, React__default.createElement("div", {
|
|
2384
|
-
className: "width-fc"
|
|
2385
|
-
}, React__default.createElement(formik.Field, {
|
|
2386
|
-
name: checkbox.id,
|
|
2387
|
-
label: checkbox.text,
|
|
2388
|
-
type: 'checkbox',
|
|
2389
|
-
required: true,
|
|
2390
|
-
component: CheckboxField,
|
|
2391
|
-
validate: combineValidators(requiredValidator)
|
|
2392
|
-
})));
|
|
2393
|
-
}), React__default.createElement("div", {
|
|
2492
|
+
}))), React__default.createElement("div", {
|
|
2394
2493
|
className: "button-container"
|
|
2395
2494
|
}, React__default.createElement(LoadingButton, {
|
|
2396
2495
|
type: "submit",
|
|
@@ -2499,6 +2598,7 @@ var getCurrencySymbolByCurrency = function getCurrencySymbolByCurrency(currency)
|
|
|
2499
2598
|
var options = {
|
|
2500
2599
|
style: {
|
|
2501
2600
|
base: {
|
|
2601
|
+
backgroundColor: '#232323',
|
|
2502
2602
|
fontSize: '18px',
|
|
2503
2603
|
color: '#ffffff',
|
|
2504
2604
|
letterSpacing: '1px',
|
|
@@ -2526,7 +2626,9 @@ var CheckoutForm = function CheckoutForm(_ref) {
|
|
|
2526
2626
|
_ref$isLoading = _ref.isLoading,
|
|
2527
2627
|
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
|
|
2528
2628
|
_ref$handleSetLoading = _ref.handleSetLoading,
|
|
2529
|
-
handleSetLoading = _ref$handleSetLoading === void 0 ? function () {} : _ref$handleSetLoading
|
|
2629
|
+
handleSetLoading = _ref$handleSetLoading === void 0 ? function () {} : _ref$handleSetLoading,
|
|
2630
|
+
_ref$conditions = _ref.conditions,
|
|
2631
|
+
conditions = _ref$conditions === void 0 ? [] : _ref$conditions;
|
|
2530
2632
|
var stripe = reactStripeJs.useStripe();
|
|
2531
2633
|
var elements = reactStripeJs.useElements();
|
|
2532
2634
|
|
|
@@ -2555,7 +2657,7 @@ var CheckoutForm = function CheckoutForm(_ref) {
|
|
|
2555
2657
|
break;
|
|
2556
2658
|
}
|
|
2557
2659
|
|
|
2558
|
-
setStripeError(
|
|
2660
|
+
setStripeError('Please enter your zip code.');
|
|
2559
2661
|
handleSetLoading(false);
|
|
2560
2662
|
return _context.abrupt("return");
|
|
2561
2663
|
|
|
@@ -2656,6 +2758,7 @@ var CheckoutForm = function CheckoutForm(_ref) {
|
|
|
2656
2758
|
zipCode && setPostalCode(zipCode);
|
|
2657
2759
|
}
|
|
2658
2760
|
}, []);
|
|
2761
|
+
var buttonIsDiabled = !stripe || !!error || isLoading;
|
|
2659
2762
|
return React__default.createElement("div", {
|
|
2660
2763
|
className: "stripe_payment_container"
|
|
2661
2764
|
}, !!stripeError && React__default.createElement("div", {
|
|
@@ -2695,10 +2798,21 @@ var CheckoutForm = function CheckoutForm(_ref) {
|
|
|
2695
2798
|
value: postalCode,
|
|
2696
2799
|
onChange: onChangePostalCode,
|
|
2697
2800
|
placeholder: "ZIP"
|
|
2698
|
-
}))),
|
|
2699
|
-
|
|
2801
|
+
}))), conditions == null ? void 0 : conditions.map(function (checkbox) {
|
|
2802
|
+
return React__default.createElement("div", {
|
|
2803
|
+
className: 'billing-info-container__singleField',
|
|
2804
|
+
key: checkbox.id
|
|
2805
|
+
}, React__default.createElement("div", {
|
|
2806
|
+
className: "conditions-block"
|
|
2807
|
+
}, React__default.createElement(CheckboxField, {
|
|
2808
|
+
name: checkbox.id,
|
|
2809
|
+
label: checkbox.text,
|
|
2810
|
+
required: true
|
|
2811
|
+
})));
|
|
2812
|
+
}), React__default.createElement("div", {
|
|
2813
|
+
className: "payment_button " + (buttonIsDiabled ? 'disabled-payment-button' : '')
|
|
2700
2814
|
}, React__default.createElement("button", {
|
|
2701
|
-
disabled:
|
|
2815
|
+
disabled: buttonIsDiabled,
|
|
2702
2816
|
type: "submit"
|
|
2703
2817
|
}, isLoading ? React__default.createElement(CircularProgress, null) : "Pay " + getCurrencySymbolByCurrency(currency) + total))));
|
|
2704
2818
|
};
|
|
@@ -2756,8 +2870,13 @@ var PaymentContainer = function PaymentContainer(_ref) {
|
|
|
2756
2870
|
paymentIsLoading = _useState4[0],
|
|
2757
2871
|
setPaymentIsLoading = _useState4[1];
|
|
2758
2872
|
|
|
2873
|
+
var _useState5 = React.useState([]),
|
|
2874
|
+
conditions = _useState5[0],
|
|
2875
|
+
setConditions = _useState5[1];
|
|
2876
|
+
|
|
2759
2877
|
var showFormTitle = Boolean(formTitle);
|
|
2760
2878
|
var showErrorText = Boolean(errorText);
|
|
2879
|
+
var eventId = getQueryVariable('event_id');
|
|
2761
2880
|
React.useEffect(function () {
|
|
2762
2881
|
var hash = checkoutData.hash;
|
|
2763
2882
|
|
|
@@ -2808,21 +2927,64 @@ var PaymentContainer = function PaymentContainer(_ref) {
|
|
|
2808
2927
|
}
|
|
2809
2928
|
}, _callee, null, [[0, 7]]);
|
|
2810
2929
|
}))();
|
|
2811
|
-
}, [checkoutData]); //
|
|
2930
|
+
}, [checkoutData]); //just once
|
|
2931
|
+
|
|
2932
|
+
React.useEffect(function () {
|
|
2933
|
+
// fetch conditions data
|
|
2934
|
+
var fetchConditions = /*#__PURE__*/function () {
|
|
2935
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
|
|
2936
|
+
var res, conditionsInfo;
|
|
2937
|
+
return runtime_1.wrap(function _callee2$(_context2) {
|
|
2938
|
+
while (1) {
|
|
2939
|
+
switch (_context2.prev = _context2.next) {
|
|
2940
|
+
case 0:
|
|
2941
|
+
if (!eventId) {
|
|
2942
|
+
_context2.next = 6;
|
|
2943
|
+
break;
|
|
2944
|
+
}
|
|
2945
|
+
|
|
2946
|
+
_context2.next = 3;
|
|
2947
|
+
return getConditions(eventId);
|
|
2948
|
+
|
|
2949
|
+
case 3:
|
|
2950
|
+
res = _context2.sent;
|
|
2951
|
+
conditionsInfo = _get(res, 'data.data.attributes');
|
|
2952
|
+
setConditions(conditionsInfo ? conditionsInfo.map(function (item) {
|
|
2953
|
+
return {
|
|
2954
|
+
id: nanoid.nanoid(),
|
|
2955
|
+
text: item
|
|
2956
|
+
};
|
|
2957
|
+
}) : []);
|
|
2958
|
+
|
|
2959
|
+
case 6:
|
|
2960
|
+
case "end":
|
|
2961
|
+
return _context2.stop();
|
|
2962
|
+
}
|
|
2963
|
+
}
|
|
2964
|
+
}, _callee2);
|
|
2965
|
+
}));
|
|
2966
|
+
|
|
2967
|
+
return function fetchConditions() {
|
|
2968
|
+
return _ref3.apply(this, arguments);
|
|
2969
|
+
};
|
|
2970
|
+
}();
|
|
2971
|
+
|
|
2972
|
+
fetchConditions();
|
|
2973
|
+
}, []); // 1. get payment data ---> v1/order/${hash}/review/ done
|
|
2812
2974
|
// 2. handle payment ---> v1/order/${orderHash}/pay/
|
|
2813
2975
|
// 3. redirect to confirmation page
|
|
2814
2976
|
|
|
2815
2977
|
var handlePaymentMiddleWare = /*#__PURE__*/function () {
|
|
2816
|
-
var
|
|
2978
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(error) {
|
|
2817
2979
|
var order_hash, paymentSuccessResponse;
|
|
2818
|
-
return runtime_1.wrap(function
|
|
2980
|
+
return runtime_1.wrap(function _callee3$(_context3) {
|
|
2819
2981
|
while (1) {
|
|
2820
|
-
switch (
|
|
2982
|
+
switch (_context3.prev = _context3.next) {
|
|
2821
2983
|
case 0:
|
|
2822
|
-
|
|
2984
|
+
_context3.prev = 0;
|
|
2823
2985
|
|
|
2824
2986
|
if (!error) {
|
|
2825
|
-
|
|
2987
|
+
_context3.next = 4;
|
|
2826
2988
|
break;
|
|
2827
2989
|
}
|
|
2828
2990
|
|
|
@@ -2831,36 +2993,36 @@ var PaymentContainer = function PaymentContainer(_ref) {
|
|
|
2831
2993
|
|
|
2832
2994
|
case 4:
|
|
2833
2995
|
order_hash = reviewData.order_details.order_hash;
|
|
2834
|
-
|
|
2996
|
+
_context3.next = 7;
|
|
2835
2997
|
return handlePaymentSuccess(order_hash);
|
|
2836
2998
|
|
|
2837
2999
|
case 7:
|
|
2838
|
-
paymentSuccessResponse =
|
|
3000
|
+
paymentSuccessResponse = _context3.sent;
|
|
2839
3001
|
|
|
2840
3002
|
if (paymentSuccessResponse.status === 200) {
|
|
2841
3003
|
handlePayment(paymentSuccessResponse);
|
|
2842
3004
|
setPaymentIsLoading(false);
|
|
2843
3005
|
}
|
|
2844
3006
|
|
|
2845
|
-
|
|
3007
|
+
_context3.next = 15;
|
|
2846
3008
|
break;
|
|
2847
3009
|
|
|
2848
3010
|
case 11:
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
setError(_get(
|
|
2852
|
-
onPaymentError(
|
|
3011
|
+
_context3.prev = 11;
|
|
3012
|
+
_context3.t0 = _context3["catch"](0);
|
|
3013
|
+
setError(_get(_context3.t0, 'response.data.message'));
|
|
3014
|
+
onPaymentError(_context3.t0.response);
|
|
2853
3015
|
|
|
2854
3016
|
case 15:
|
|
2855
3017
|
case "end":
|
|
2856
|
-
return
|
|
3018
|
+
return _context3.stop();
|
|
2857
3019
|
}
|
|
2858
3020
|
}
|
|
2859
|
-
},
|
|
3021
|
+
}, _callee3, null, [[0, 11]]);
|
|
2860
3022
|
}));
|
|
2861
3023
|
|
|
2862
3024
|
return function handlePaymentMiddleWare(_x) {
|
|
2863
|
-
return
|
|
3025
|
+
return _ref4.apply(this, arguments);
|
|
2864
3026
|
};
|
|
2865
3027
|
}();
|
|
2866
3028
|
|
|
@@ -2909,7 +3071,8 @@ var PaymentContainer = function PaymentContainer(_ref) {
|
|
|
2909
3071
|
isLoading: paymentIsLoading,
|
|
2910
3072
|
handleSetLoading: function handleSetLoading(value) {
|
|
2911
3073
|
return setPaymentIsLoading(value);
|
|
2912
|
-
}
|
|
3074
|
+
},
|
|
3075
|
+
conditions: conditions
|
|
2913
3076
|
}))))));
|
|
2914
3077
|
};
|
|
2915
3078
|
|
|
@@ -3241,6 +3404,7 @@ var WaitingList = function WaitingList(_ref) {
|
|
|
3241
3404
|
value: d.id
|
|
3242
3405
|
};
|
|
3243
3406
|
});
|
|
3407
|
+
var showTicketsField = Boolean(ticketTypesList.length);
|
|
3244
3408
|
|
|
3245
3409
|
var handleSubmit = /*#__PURE__*/function () {
|
|
3246
3410
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(values) {
|
|
@@ -3269,25 +3433,24 @@ var WaitingList = function WaitingList(_ref) {
|
|
|
3269
3433
|
setShowSuccessMessage(true);
|
|
3270
3434
|
}
|
|
3271
3435
|
|
|
3272
|
-
_context.next =
|
|
3436
|
+
_context.next = 13;
|
|
3273
3437
|
break;
|
|
3274
3438
|
|
|
3275
3439
|
case 11:
|
|
3276
3440
|
_context.prev = 11;
|
|
3277
3441
|
_context.t0 = _context["catch"](0);
|
|
3278
|
-
console.log(_context.t0);
|
|
3279
3442
|
|
|
3280
|
-
case
|
|
3281
|
-
_context.prev =
|
|
3443
|
+
case 13:
|
|
3444
|
+
_context.prev = 13;
|
|
3282
3445
|
setLoading(false);
|
|
3283
|
-
return _context.finish(
|
|
3446
|
+
return _context.finish(13);
|
|
3284
3447
|
|
|
3285
|
-
case
|
|
3448
|
+
case 16:
|
|
3286
3449
|
case "end":
|
|
3287
3450
|
return _context.stop();
|
|
3288
3451
|
}
|
|
3289
3452
|
}
|
|
3290
|
-
}, _callee, null, [[0, 11,
|
|
3453
|
+
}, _callee, null, [[0, 11, 13, 16]]);
|
|
3291
3454
|
}));
|
|
3292
3455
|
|
|
3293
3456
|
return function handleSubmit(_x) {
|
|
@@ -3308,7 +3471,7 @@ var WaitingList = function WaitingList(_ref) {
|
|
|
3308
3471
|
email: ''
|
|
3309
3472
|
},
|
|
3310
3473
|
onSubmit: handleSubmit
|
|
3311
|
-
}, React__default.createElement(formik.Form, null, React__default.createElement("div", {
|
|
3474
|
+
}, React__default.createElement(formik.Form, null, React__default.createElement(ErrorFocus, null), showTicketsField && React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
|
|
3312
3475
|
className: "field-item"
|
|
3313
3476
|
}, React__default.createElement(formik.Field, {
|
|
3314
3477
|
name: "ticketTypeId",
|
|
@@ -3332,7 +3495,7 @@ var WaitingList = function WaitingList(_ref) {
|
|
|
3332
3495
|
value: '',
|
|
3333
3496
|
disabled: true
|
|
3334
3497
|
}].concat(generateQuantity(10))
|
|
3335
|
-
})), React__default.createElement("div", {
|
|
3498
|
+
}))), React__default.createElement("div", {
|
|
3336
3499
|
className: "field-item"
|
|
3337
3500
|
}, React__default.createElement(formik.Field, {
|
|
3338
3501
|
name: "firstName",
|