tf-checkout-react 1.0.49 → 1.0.53
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 +284 -131
- 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 +292 -139
- 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 +63 -34
- 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/style.css +0 -8
- 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,
|
|
@@ -1790,91 +1938,90 @@ var LogicRunner = function LogicRunner(_ref) {
|
|
|
1790
1938
|
return null;
|
|
1791
1939
|
};
|
|
1792
1940
|
|
|
1793
|
-
var
|
|
1794
|
-
var
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
1799
|
-
var _ref4$data = _ref4.data,
|
|
1800
|
-
data = _ref4$data === void 0 ? [] : _ref4$data,
|
|
1801
|
-
_ref4$ticketHoldersFi = _ref4.ticketHoldersFields,
|
|
1802
|
-
ticketHoldersFields = _ref4$ticketHoldersFi === void 0 ? {
|
|
1941
|
+
var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
1942
|
+
var _ref3$data = _ref3.data,
|
|
1943
|
+
data = _ref3$data === void 0 ? [] : _ref3$data,
|
|
1944
|
+
_ref3$ticketHoldersFi = _ref3.ticketHoldersFields,
|
|
1945
|
+
ticketHoldersFields = _ref3$ticketHoldersFi === void 0 ? {
|
|
1803
1946
|
id: 1,
|
|
1804
1947
|
fields: []
|
|
1805
|
-
} :
|
|
1806
|
-
|
|
1807
|
-
initialValues =
|
|
1808
|
-
|
|
1809
|
-
buttonName =
|
|
1810
|
-
|
|
1811
|
-
handleSubmit =
|
|
1812
|
-
|
|
1813
|
-
theme =
|
|
1814
|
-
|
|
1815
|
-
onRegisterSuccess =
|
|
1816
|
-
|
|
1817
|
-
onRegisterError =
|
|
1818
|
-
|
|
1819
|
-
onSubmitError =
|
|
1820
|
-
|
|
1821
|
-
onGetCartSuccess =
|
|
1822
|
-
|
|
1823
|
-
onGetCartError =
|
|
1824
|
-
|
|
1825
|
-
onGetCountriesSuccess =
|
|
1826
|
-
|
|
1827
|
-
onGetCountriesError =
|
|
1828
|
-
|
|
1829
|
-
onGetStatesSuccess =
|
|
1830
|
-
|
|
1831
|
-
onGetStatesError =
|
|
1832
|
-
|
|
1833
|
-
onGetProfileDataSuccess =
|
|
1834
|
-
|
|
1835
|
-
onGetProfileDataError =
|
|
1836
|
-
|
|
1837
|
-
onAuthorizeSuccess =
|
|
1838
|
-
|
|
1839
|
-
onAuthorizeError =
|
|
1840
|
-
|
|
1841
|
-
onLogin =
|
|
1948
|
+
} : _ref3$ticketHoldersFi,
|
|
1949
|
+
_ref3$initialValues = _ref3.initialValues,
|
|
1950
|
+
initialValues = _ref3$initialValues === void 0 ? {} : _ref3$initialValues,
|
|
1951
|
+
_ref3$buttonName = _ref3.buttonName,
|
|
1952
|
+
buttonName = _ref3$buttonName === void 0 ? 'Submit' : _ref3$buttonName,
|
|
1953
|
+
_ref3$handleSubmit = _ref3.handleSubmit,
|
|
1954
|
+
handleSubmit = _ref3$handleSubmit === void 0 ? _identity : _ref3$handleSubmit,
|
|
1955
|
+
_ref3$theme = _ref3.theme,
|
|
1956
|
+
theme = _ref3$theme === void 0 ? 'light' : _ref3$theme,
|
|
1957
|
+
_ref3$onRegisterSucce = _ref3.onRegisterSuccess,
|
|
1958
|
+
onRegisterSuccess = _ref3$onRegisterSucce === void 0 ? function () {} : _ref3$onRegisterSucce,
|
|
1959
|
+
_ref3$onRegisterError = _ref3.onRegisterError,
|
|
1960
|
+
onRegisterError = _ref3$onRegisterError === void 0 ? function () {} : _ref3$onRegisterError,
|
|
1961
|
+
_ref3$onSubmitError = _ref3.onSubmitError,
|
|
1962
|
+
onSubmitError = _ref3$onSubmitError === void 0 ? function () {} : _ref3$onSubmitError,
|
|
1963
|
+
_ref3$onGetCartSucces = _ref3.onGetCartSuccess,
|
|
1964
|
+
onGetCartSuccess = _ref3$onGetCartSucces === void 0 ? function () {} : _ref3$onGetCartSucces,
|
|
1965
|
+
_ref3$onGetCartError = _ref3.onGetCartError,
|
|
1966
|
+
onGetCartError = _ref3$onGetCartError === void 0 ? function () {} : _ref3$onGetCartError,
|
|
1967
|
+
_ref3$onGetCountriesS = _ref3.onGetCountriesSuccess,
|
|
1968
|
+
onGetCountriesSuccess = _ref3$onGetCountriesS === void 0 ? function () {} : _ref3$onGetCountriesS,
|
|
1969
|
+
_ref3$onGetCountriesE = _ref3.onGetCountriesError,
|
|
1970
|
+
onGetCountriesError = _ref3$onGetCountriesE === void 0 ? function () {} : _ref3$onGetCountriesE,
|
|
1971
|
+
_ref3$onGetStatesSucc = _ref3.onGetStatesSuccess,
|
|
1972
|
+
onGetStatesSuccess = _ref3$onGetStatesSucc === void 0 ? function () {} : _ref3$onGetStatesSucc,
|
|
1973
|
+
_ref3$onGetStatesErro = _ref3.onGetStatesError,
|
|
1974
|
+
onGetStatesError = _ref3$onGetStatesErro === void 0 ? function () {} : _ref3$onGetStatesErro,
|
|
1975
|
+
_ref3$onGetProfileDat = _ref3.onGetProfileDataSuccess,
|
|
1976
|
+
onGetProfileDataSuccess = _ref3$onGetProfileDat === void 0 ? function () {} : _ref3$onGetProfileDat,
|
|
1977
|
+
_ref3$onGetProfileDat2 = _ref3.onGetProfileDataError,
|
|
1978
|
+
onGetProfileDataError = _ref3$onGetProfileDat2 === void 0 ? function () {} : _ref3$onGetProfileDat2,
|
|
1979
|
+
_ref3$onAuthorizeSucc = _ref3.onAuthorizeSuccess,
|
|
1980
|
+
onAuthorizeSuccess = _ref3$onAuthorizeSucc === void 0 ? function () {} : _ref3$onAuthorizeSucc,
|
|
1981
|
+
_ref3$onAuthorizeErro = _ref3.onAuthorizeError,
|
|
1982
|
+
onAuthorizeError = _ref3$onAuthorizeErro === void 0 ? function () {} : _ref3$onAuthorizeErro,
|
|
1983
|
+
_ref3$onLogin = _ref3.onLogin,
|
|
1984
|
+
onLogin = _ref3$onLogin === void 0 ? function () {} : _ref3$onLogin;
|
|
1842
1985
|
var userData = typeof window !== 'undefined' && window.localStorage.getItem('user_data') ? JSON.parse(window.localStorage.getItem('user_data') || '') : {};
|
|
1843
1986
|
var access_token = typeof window !== 'undefined' && window.localStorage.getItem('access_token') ? window.localStorage.getItem('access_token') || '' : '';
|
|
1844
1987
|
|
|
1845
|
-
var _useState = React.useState(
|
|
1846
|
-
|
|
1847
|
-
|
|
1988
|
+
var _useState = React.useState(data),
|
|
1989
|
+
dataWithUniqueIds = _useState[0],
|
|
1990
|
+
setDataWithUniqueIds = _useState[1];
|
|
1848
1991
|
|
|
1849
|
-
var _useState2 = React.useState(
|
|
1850
|
-
|
|
1851
|
-
|
|
1992
|
+
var _useState2 = React.useState({}),
|
|
1993
|
+
cartInfoData = _useState2[0],
|
|
1994
|
+
setCartInfo = _useState2[1];
|
|
1852
1995
|
|
|
1853
1996
|
var _useState3 = React.useState([]),
|
|
1854
|
-
|
|
1855
|
-
|
|
1997
|
+
countries = _useState3[0],
|
|
1998
|
+
setCountries = _useState3[1];
|
|
1856
1999
|
|
|
1857
|
-
var _useState4 = React.useState(
|
|
1858
|
-
|
|
1859
|
-
|
|
2000
|
+
var _useState4 = React.useState([]),
|
|
2001
|
+
states = _useState4[0],
|
|
2002
|
+
setStates = _useState4[1];
|
|
1860
2003
|
|
|
1861
2004
|
var _useState5 = React.useState(false),
|
|
1862
|
-
|
|
1863
|
-
|
|
2005
|
+
showModalLogin = _useState5[0],
|
|
2006
|
+
setShowModalLogin = _useState5[1];
|
|
1864
2007
|
|
|
1865
2008
|
var _useState6 = React.useState(false),
|
|
1866
|
-
|
|
1867
|
-
|
|
2009
|
+
alreadyHasUser = _useState6[0],
|
|
2010
|
+
setAlreadyHasUser = _useState6[1];
|
|
1868
2011
|
|
|
1869
2012
|
var _useState7 = React.useState(false),
|
|
1870
|
-
|
|
1871
|
-
|
|
2013
|
+
userExpired = _useState7[0],
|
|
2014
|
+
setUserExpired = _useState7[1];
|
|
2015
|
+
|
|
2016
|
+
var _useState8 = React.useState(false),
|
|
2017
|
+
showModalRegister = _useState8[0],
|
|
2018
|
+
setShowModalRegister = _useState8[1];
|
|
1872
2019
|
|
|
1873
|
-
var
|
|
1874
|
-
ticketsQuantity =
|
|
1875
|
-
setTicketsQuantity =
|
|
2020
|
+
var _useState9 = React.useState([]),
|
|
2021
|
+
ticketsQuantity = _useState9[0],
|
|
2022
|
+
setTicketsQuantity = _useState9[1];
|
|
1876
2023
|
|
|
1877
|
-
var
|
|
2024
|
+
var _useState10 = React.useState({
|
|
1878
2025
|
firstName: '',
|
|
1879
2026
|
lastName: '',
|
|
1880
2027
|
email: '',
|
|
@@ -1889,8 +2036,8 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
1889
2036
|
state: '',
|
|
1890
2037
|
zip: ''
|
|
1891
2038
|
}),
|
|
1892
|
-
userValues =
|
|
1893
|
-
setUserValues =
|
|
2039
|
+
userValues = _useState10[0],
|
|
2040
|
+
setUserValues = _useState10[1];
|
|
1894
2041
|
|
|
1895
2042
|
var isLoggedIn = !!access_token;
|
|
1896
2043
|
|
|
@@ -1906,7 +2053,11 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
1906
2053
|
|
|
1907
2054
|
var optedInFieldValue = _get(cartInfoData, 'optedIn', false);
|
|
1908
2055
|
|
|
1909
|
-
var
|
|
2056
|
+
var hideTtfOptIn = _get(cartInfoData, 'hide_ttf_opt_in', true);
|
|
2057
|
+
|
|
2058
|
+
if (!_get(dataWithUniqueIds, '[0].uniqueId')) {
|
|
2059
|
+
setDataWithUniqueIds(assingUniqueIds(data));
|
|
2060
|
+
}
|
|
1910
2061
|
|
|
1911
2062
|
var getQuantity = function getQuantity(cart) {
|
|
1912
2063
|
if (cart === void 0) {
|
|
@@ -1924,7 +2075,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
1924
2075
|
React.useEffect(function () {
|
|
1925
2076
|
// fetch countries data
|
|
1926
2077
|
var fetchCountries = /*#__PURE__*/function () {
|
|
1927
|
-
var
|
|
2078
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
|
|
1928
2079
|
var res;
|
|
1929
2080
|
return runtime_1.wrap(function _callee2$(_context2) {
|
|
1930
2081
|
while (1) {
|
|
@@ -1964,7 +2115,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
1964
2115
|
}));
|
|
1965
2116
|
|
|
1966
2117
|
return function fetchCountries() {
|
|
1967
|
-
return
|
|
2118
|
+
return _ref4.apply(this, arguments);
|
|
1968
2119
|
};
|
|
1969
2120
|
}();
|
|
1970
2121
|
|
|
@@ -1973,7 +2124,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
1973
2124
|
}, []); // fetch cart data
|
|
1974
2125
|
|
|
1975
2126
|
var fetchCart = /*#__PURE__*/function () {
|
|
1976
|
-
var
|
|
2127
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
|
|
1977
2128
|
var res, cartInfo, _cartInfo$cart, cart;
|
|
1978
2129
|
|
|
1979
2130
|
return runtime_1.wrap(function _callee3$(_context3) {
|
|
@@ -2014,13 +2165,13 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
2014
2165
|
}));
|
|
2015
2166
|
|
|
2016
2167
|
return function fetchCart() {
|
|
2017
|
-
return
|
|
2168
|
+
return _ref5.apply(this, arguments);
|
|
2018
2169
|
};
|
|
2019
2170
|
}(); // fetch user data
|
|
2020
2171
|
|
|
2021
2172
|
|
|
2022
2173
|
var fetchUserData = /*#__PURE__*/function () {
|
|
2023
|
-
var
|
|
2174
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(token) {
|
|
2024
2175
|
var userDataResponse, profileSpecifiedData, profileDataObj;
|
|
2025
2176
|
return runtime_1.wrap(function _callee4$(_context4) {
|
|
2026
2177
|
while (1) {
|
|
@@ -2065,7 +2216,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
2065
2216
|
}));
|
|
2066
2217
|
|
|
2067
2218
|
return function fetchUserData(_x) {
|
|
2068
|
-
return
|
|
2219
|
+
return _ref6.apply(this, arguments);
|
|
2069
2220
|
};
|
|
2070
2221
|
}();
|
|
2071
2222
|
|
|
@@ -2073,7 +2224,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
2073
2224
|
fetchUserData(access_token);
|
|
2074
2225
|
}, [access_token]);
|
|
2075
2226
|
return React__default.createElement(React__default.Fragment, null, React__default.createElement(formik.Formik, {
|
|
2076
|
-
initialValues: getInitialValues(
|
|
2227
|
+
initialValues: getInitialValues(dataWithUniqueIds, _extends({}, initialValues, {
|
|
2077
2228
|
email: emailLogged,
|
|
2078
2229
|
firstName: firstNameLogged,
|
|
2079
2230
|
lastName: lastNameLogged,
|
|
@@ -2083,7 +2234,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
2083
2234
|
enableReinitialize: true,
|
|
2084
2235
|
onSubmit: function () {
|
|
2085
2236
|
var _onSubmit = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(values, formikHelpers) {
|
|
2086
|
-
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;
|
|
2087
2238
|
|
|
2088
2239
|
return runtime_1.wrap(function _callee5$(_context5) {
|
|
2089
2240
|
while (1) {
|
|
@@ -2128,13 +2279,18 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
2128
2279
|
return _context5.abrupt("return");
|
|
2129
2280
|
|
|
2130
2281
|
case 15:
|
|
2131
|
-
|
|
2282
|
+
checkoutBodyForRegistration = createCheckoutDataBody(ticketsQuantity.length, values, {
|
|
2283
|
+
emailLogged: emailLogged,
|
|
2284
|
+
firstNameLogged: firstNameLogged,
|
|
2285
|
+
lastNameLogged: lastNameLogged
|
|
2286
|
+
}, showDOB);
|
|
2287
|
+
bodyFormData = createRegisterFormData(values, checkoutBodyForRegistration);
|
|
2132
2288
|
access_token_register = null;
|
|
2133
|
-
_context5.prev =
|
|
2134
|
-
_context5.next =
|
|
2289
|
+
_context5.prev = 18;
|
|
2290
|
+
_context5.next = 21;
|
|
2135
2291
|
return register(bodyFormData);
|
|
2136
2292
|
|
|
2137
|
-
case
|
|
2293
|
+
case 21:
|
|
2138
2294
|
resRegister = _context5.sent;
|
|
2139
2295
|
access_token_register = _get(resRegister, 'data.data.attributes.access_token');
|
|
2140
2296
|
refreshToken = _get(resRegister, 'data.data.attributes.refresh_token');
|
|
@@ -2144,12 +2300,12 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
2144
2300
|
refreshToken: refreshToken
|
|
2145
2301
|
};
|
|
2146
2302
|
onRegisterSuccess(tokens);
|
|
2147
|
-
_context5.next =
|
|
2303
|
+
_context5.next = 33;
|
|
2148
2304
|
break;
|
|
2149
2305
|
|
|
2150
|
-
case
|
|
2151
|
-
_context5.prev =
|
|
2152
|
-
_context5.t0 = _context5["catch"](
|
|
2306
|
+
case 29:
|
|
2307
|
+
_context5.prev = 29;
|
|
2308
|
+
_context5.t0 = _context5["catch"](18);
|
|
2153
2309
|
|
|
2154
2310
|
if (axios.isAxiosError(_context5.t0)) {
|
|
2155
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;
|
|
@@ -2173,11 +2329,11 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
2173
2329
|
|
|
2174
2330
|
return _context5.abrupt("return");
|
|
2175
2331
|
|
|
2176
|
-
case
|
|
2177
|
-
_context5.next =
|
|
2332
|
+
case 33:
|
|
2333
|
+
_context5.next = 35;
|
|
2178
2334
|
return getProfileData(access_token_register);
|
|
2179
2335
|
|
|
2180
|
-
case
|
|
2336
|
+
case 35:
|
|
2181
2337
|
profileData = _context5.sent;
|
|
2182
2338
|
profileSpecifiedData = _get(profileData, 'data.data');
|
|
2183
2339
|
profileDataObj = setLoggedUserData(profileSpecifiedData);
|
|
@@ -2191,17 +2347,17 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
2191
2347
|
firstNameLogged: firstNameLogged,
|
|
2192
2348
|
lastNameLogged: lastNameLogged
|
|
2193
2349
|
}, showDOB);
|
|
2194
|
-
_context5.next =
|
|
2350
|
+
_context5.next = 42;
|
|
2195
2351
|
return postOnCheckout(checkoutBody, access_token_register);
|
|
2196
2352
|
|
|
2197
|
-
case
|
|
2353
|
+
case 42:
|
|
2198
2354
|
res = _context5.sent;
|
|
2199
2355
|
handleSubmit(values, formikHelpers, eventId, res);
|
|
2200
|
-
_context5.next =
|
|
2356
|
+
_context5.next = 49;
|
|
2201
2357
|
break;
|
|
2202
2358
|
|
|
2203
|
-
case
|
|
2204
|
-
_context5.prev =
|
|
2359
|
+
case 46:
|
|
2360
|
+
_context5.prev = 46;
|
|
2205
2361
|
_context5.t1 = _context5["catch"](0);
|
|
2206
2362
|
|
|
2207
2363
|
if (axios.isAxiosError(_context5.t1)) {
|
|
@@ -2217,12 +2373,12 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
2217
2373
|
onSubmitError(_context5.t1);
|
|
2218
2374
|
}
|
|
2219
2375
|
|
|
2220
|
-
case
|
|
2376
|
+
case 49:
|
|
2221
2377
|
case "end":
|
|
2222
2378
|
return _context5.stop();
|
|
2223
2379
|
}
|
|
2224
2380
|
}
|
|
2225
|
-
}, _callee5, null, [[0,
|
|
2381
|
+
}, _callee5, null, [[0, 46], [18, 29]]);
|
|
2226
2382
|
}));
|
|
2227
2383
|
|
|
2228
2384
|
function onSubmit(_x2, _x3) {
|
|
@@ -2234,7 +2390,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
2234
2390
|
}, function (props) {
|
|
2235
2391
|
return React__default.createElement(formik.Form, {
|
|
2236
2392
|
onSubmit: props.handleSubmit
|
|
2237
|
-
}, React__default.createElement(LogicRunner, {
|
|
2393
|
+
}, React__default.createElement(ErrorFocus, null), React__default.createElement(LogicRunner, {
|
|
2238
2394
|
values: props.values,
|
|
2239
2395
|
setStates: setStates,
|
|
2240
2396
|
setFieldValue: props.setFieldValue,
|
|
@@ -2255,9 +2411,8 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
2255
2411
|
onLogin();
|
|
2256
2412
|
setShowModalLogin(true);
|
|
2257
2413
|
}
|
|
2258
|
-
}, "Login"))), _map(
|
|
2259
|
-
var
|
|
2260
|
-
label = item.label,
|
|
2414
|
+
}, "Login"))), _map(dataWithUniqueIds, function (item) {
|
|
2415
|
+
var label = item.label,
|
|
2261
2416
|
labelClassName = item.labelClassName,
|
|
2262
2417
|
fields = item.fields;
|
|
2263
2418
|
|
|
@@ -2265,8 +2420,8 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
2265
2420
|
return null;
|
|
2266
2421
|
}
|
|
2267
2422
|
|
|
2268
|
-
return React__default.createElement(
|
|
2269
|
-
key:
|
|
2423
|
+
return React__default.createElement(React__default.Fragment, {
|
|
2424
|
+
key: item.uniqueId
|
|
2270
2425
|
}, React__default.createElement("p", {
|
|
2271
2426
|
className: labelClassName
|
|
2272
2427
|
}, label), _map(fields, function (group) {
|
|
@@ -2274,8 +2429,8 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
2274
2429
|
groupItems = group.groupItems,
|
|
2275
2430
|
groupLabel = group.groupLabel,
|
|
2276
2431
|
groupLabelClassName = group.groupLabelClassName;
|
|
2277
|
-
return React__default.createElement(
|
|
2278
|
-
key: group.
|
|
2432
|
+
return React__default.createElement(React__default.Fragment, {
|
|
2433
|
+
key: group.uniqueId
|
|
2279
2434
|
}, !isLoggedIn && React__default.createElement("div", {
|
|
2280
2435
|
className: groupLabelClassName
|
|
2281
2436
|
}, groupLabel), React__default.createElement("div", {
|
|
@@ -2293,30 +2448,30 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
2293
2448
|
return false;
|
|
2294
2449
|
}
|
|
2295
2450
|
|
|
2296
|
-
if (el.name === '
|
|
2451
|
+
if (el.name === 'ttf_opt_in' && hideTtfOptIn) {
|
|
2297
2452
|
return false;
|
|
2298
2453
|
}
|
|
2299
2454
|
|
|
2300
2455
|
return true;
|
|
2301
2456
|
}), function (element) {
|
|
2302
2457
|
return ['password', 'confirmPassword'].includes(element.name) && isLoggedIn ? null : React__default.createElement(React__default.Fragment, {
|
|
2303
|
-
key: element.
|
|
2458
|
+
key: element.uniqueId
|
|
2304
2459
|
}, element.name === 'email' ? React__default.createElement("div", {
|
|
2305
2460
|
className: "email-checking"
|
|
2306
|
-
}, "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", {
|
|
2307
2462
|
className: element.className
|
|
2308
2463
|
}, element.component ? element.component : React__default.createElement(formik.Field, {
|
|
2309
2464
|
name: element.name,
|
|
2310
2465
|
label: element.label,
|
|
2311
2466
|
type: element.type,
|
|
2312
|
-
validate:
|
|
2313
|
-
component: element.type === 'checkbox' ? CheckboxField : CustomField,
|
|
2467
|
+
validate: getValidateFunctions(element, states),
|
|
2468
|
+
component: element.type === 'checkbox' ? CheckboxField : element.type === 'select' ? SelectField : CustomField,
|
|
2314
2469
|
selectOptions: element.name === 'country' ? countries : element.name === 'state' ? states : [],
|
|
2315
2470
|
theme: theme
|
|
2316
2471
|
})));
|
|
2317
2472
|
})));
|
|
2318
2473
|
}));
|
|
2319
|
-
}), showTicketHolderName && React__default.createElement(
|
|
2474
|
+
}), showTicketHolderName && React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
|
|
2320
2475
|
className: "ticket-holders-fields"
|
|
2321
2476
|
}, React__default.createElement("p", null, ticketHoldersFields.label), _map(ticketsQuantity, function (_item, index) {
|
|
2322
2477
|
return React__default.createElement("div", {
|
|
@@ -2325,16 +2480,15 @@ var BillingInfoContainer = function BillingInfoContainer(_ref4) {
|
|
|
2325
2480
|
var groupClassname = group.groupClassname,
|
|
2326
2481
|
groupItems = group.groupItems;
|
|
2327
2482
|
return React__default.createElement("div", {
|
|
2328
|
-
key: group.
|
|
2483
|
+
key: group.uniqueId
|
|
2329
2484
|
}, React__default.createElement("div", {
|
|
2330
2485
|
className: groupClassname
|
|
2331
2486
|
}, _map(groupItems, function (element) {
|
|
2332
2487
|
return React__default.createElement("div", {
|
|
2333
2488
|
className: element.className,
|
|
2334
|
-
key: element.
|
|
2489
|
+
key: element.uniqueId
|
|
2335
2490
|
}, React__default.createElement(formik.Field, {
|
|
2336
2491
|
name: element.name + "-" + index,
|
|
2337
|
-
key: element.name + "-" + index,
|
|
2338
2492
|
label: element.label,
|
|
2339
2493
|
type: element.type,
|
|
2340
2494
|
required: true,
|
|
@@ -3287,25 +3441,24 @@ var WaitingList = function WaitingList(_ref) {
|
|
|
3287
3441
|
setShowSuccessMessage(true);
|
|
3288
3442
|
}
|
|
3289
3443
|
|
|
3290
|
-
_context.next =
|
|
3444
|
+
_context.next = 13;
|
|
3291
3445
|
break;
|
|
3292
3446
|
|
|
3293
3447
|
case 11:
|
|
3294
3448
|
_context.prev = 11;
|
|
3295
3449
|
_context.t0 = _context["catch"](0);
|
|
3296
|
-
console.log(_context.t0);
|
|
3297
3450
|
|
|
3298
|
-
case
|
|
3299
|
-
_context.prev =
|
|
3451
|
+
case 13:
|
|
3452
|
+
_context.prev = 13;
|
|
3300
3453
|
setLoading(false);
|
|
3301
|
-
return _context.finish(
|
|
3454
|
+
return _context.finish(13);
|
|
3302
3455
|
|
|
3303
|
-
case
|
|
3456
|
+
case 16:
|
|
3304
3457
|
case "end":
|
|
3305
3458
|
return _context.stop();
|
|
3306
3459
|
}
|
|
3307
3460
|
}
|
|
3308
|
-
}, _callee, null, [[0, 11,
|
|
3461
|
+
}, _callee, null, [[0, 11, 13, 16]]);
|
|
3309
3462
|
}));
|
|
3310
3463
|
|
|
3311
3464
|
return function handleSubmit(_x) {
|
|
@@ -3326,7 +3479,7 @@ var WaitingList = function WaitingList(_ref) {
|
|
|
3326
3479
|
email: ''
|
|
3327
3480
|
},
|
|
3328
3481
|
onSubmit: handleSubmit
|
|
3329
|
-
}, React__default.createElement(formik.Form, null, showTicketsField && React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
|
|
3482
|
+
}, React__default.createElement(formik.Form, null, React__default.createElement(ErrorFocus, null), showTicketsField && React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
|
|
3330
3483
|
className: "field-item"
|
|
3331
3484
|
}, React__default.createElement(formik.Field, {
|
|
3332
3485
|
name: "ticketTypeId",
|