tf-checkout-react 1.3.24 → 1.3.25
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/addonsContainer/index.d.ts +2 -1
- package/dist/components/common/CustomField.d.ts +0 -3
- package/dist/components/ticketsContainer/TicketsSection.d.ts +1 -1
- package/dist/tf-checkout-react.cjs.development.js +50 -42
- 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 +51 -43
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/addonsContainer/index.tsx +31 -12
- package/src/components/common/CustomField.tsx +4 -25
- package/src/components/ticketsContainer/TicketsSection.tsx +4 -3
- package/src/.DS_Store +0 -0
- package/src/components/.DS_Store +0 -0
- package/src/components/common/dist/PhoneNumberField.js +0 -96
|
@@ -11,15 +11,13 @@ import _isEmpty from 'lodash-es/isEmpty';
|
|
|
11
11
|
import _isEqual from 'lodash-es/isEqual';
|
|
12
12
|
import _map from 'lodash-es/map';
|
|
13
13
|
import { nanoid } from 'nanoid';
|
|
14
|
-
import React, { Component, useState,
|
|
14
|
+
import React, { Component, useState, useCallback, useEffect, memo, useRef, Fragment } from 'react';
|
|
15
15
|
import _forEach from 'lodash-es/forEach';
|
|
16
16
|
import { DatePicker } from '@mui/x-date-pickers';
|
|
17
17
|
import { AdapterMoment } from '@mui/x-date-pickers/AdapterMoment';
|
|
18
18
|
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
|
|
19
19
|
import TextField from '@mui/material/TextField';
|
|
20
20
|
import { useTheme } from '@mui/styles';
|
|
21
|
-
import _isFunction from 'lodash-es/isFunction';
|
|
22
|
-
import _isObject from 'lodash-es/isObject';
|
|
23
21
|
import FormGroup from '@mui/material/FormGroup';
|
|
24
22
|
import FormControlLabel from '@mui/material/FormControlLabel';
|
|
25
23
|
import Checkbox from '@mui/material/Checkbox';
|
|
@@ -60,6 +58,7 @@ import TablePagination from '@mui/material/TablePagination';
|
|
|
60
58
|
import TableRow from '@mui/material/TableRow';
|
|
61
59
|
import _has from 'lodash-es/has';
|
|
62
60
|
import Radio from '@mui/material/Radio';
|
|
61
|
+
import { isEqual } from 'lodash-es';
|
|
63
62
|
import _isNull from 'lodash-es/isNull';
|
|
64
63
|
import _reverse from 'lodash-es/reverse';
|
|
65
64
|
|
|
@@ -1607,33 +1606,28 @@ var emailValidator = function emailValidator(email) {
|
|
|
1607
1606
|
return !emailRegex.test(email) ? 'Please enter a valid email address' : '';
|
|
1608
1607
|
};
|
|
1609
1608
|
|
|
1610
|
-
var CustomField = function CustomField(
|
|
1611
|
-
var _ref
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
InputProps = _ref2$InputProps === void 0 ? {} : _ref2$InputProps,
|
|
1628
|
-
inputRef = _ref2.inputRef;
|
|
1609
|
+
var CustomField = function CustomField(_ref) {
|
|
1610
|
+
var label = _ref.label,
|
|
1611
|
+
_ref$type = _ref.type,
|
|
1612
|
+
type = _ref$type === void 0 ? 'text' : _ref$type,
|
|
1613
|
+
field = _ref.field,
|
|
1614
|
+
_ref$selectOptions = _ref.selectOptions,
|
|
1615
|
+
selectOptions = _ref$selectOptions === void 0 ? [] : _ref$selectOptions,
|
|
1616
|
+
_ref$form = _ref.form,
|
|
1617
|
+
touched = _ref$form.touched,
|
|
1618
|
+
errors = _ref$form.errors,
|
|
1619
|
+
submitCount = _ref$form.submitCount,
|
|
1620
|
+
theme = _ref.theme,
|
|
1621
|
+
_ref$inputProps = _ref.inputProps,
|
|
1622
|
+
pInputProps = _ref$inputProps === void 0 ? {} : _ref$inputProps,
|
|
1623
|
+
_ref$InputProps = _ref.InputProps,
|
|
1624
|
+
InputProps = _ref$InputProps === void 0 ? {} : _ref$InputProps,
|
|
1625
|
+
inputRef = _ref.inputRef;
|
|
1629
1626
|
|
|
1630
1627
|
var _useState = useState(Boolean(field.value)),
|
|
1631
1628
|
isShrinked = _useState[0],
|
|
1632
1629
|
setIsShrinked = _useState[1];
|
|
1633
1630
|
|
|
1634
|
-
var _ref = useRef(null);
|
|
1635
|
-
|
|
1636
|
-
var isAutoFilled = (_ref$current = _ref.current) == null ? void 0 : _ref$current.matches(':-webkit-autofill');
|
|
1637
1631
|
var isSelectField = type === 'select';
|
|
1638
1632
|
|
|
1639
1633
|
var error = _get(errors, field.name);
|
|
@@ -1643,13 +1637,6 @@ var CustomField = function CustomField(_ref2) {
|
|
|
1643
1637
|
var inputProps = {
|
|
1644
1638
|
sx: customTheme == null ? void 0 : customTheme.input
|
|
1645
1639
|
};
|
|
1646
|
-
useEffect(function () {
|
|
1647
|
-
if (_isFunction(inputRef)) {
|
|
1648
|
-
inputRef(_ref.current);
|
|
1649
|
-
} else if (_isObject(inputRef)) {
|
|
1650
|
-
inputRef.current = _ref.current;
|
|
1651
|
-
}
|
|
1652
|
-
});
|
|
1653
1640
|
return React.createElement(TextField, Object.assign({
|
|
1654
1641
|
placeholder: "",
|
|
1655
1642
|
id: field.name,
|
|
@@ -1671,11 +1658,11 @@ var CustomField = function CustomField(_ref2) {
|
|
|
1671
1658
|
},
|
|
1672
1659
|
InputLabelProps: {
|
|
1673
1660
|
sx: customTheme == null ? void 0 : customTheme.input,
|
|
1674
|
-
shrink: isShrinked || Boolean(field.value)
|
|
1661
|
+
shrink: isShrinked || Boolean(field.value)
|
|
1675
1662
|
},
|
|
1676
1663
|
InputProps: InputProps,
|
|
1677
1664
|
inputProps: _extends({}, inputProps, pInputProps),
|
|
1678
|
-
inputRef:
|
|
1665
|
+
inputRef: inputRef
|
|
1679
1666
|
}, field, {
|
|
1680
1667
|
onBlur: function onBlur(e) {
|
|
1681
1668
|
setIsShrinked(Boolean(field.value));
|
|
@@ -5455,7 +5442,7 @@ var TicketsSection = function TicketsSection(_ref) {
|
|
|
5455
5442
|
}
|
|
5456
5443
|
|
|
5457
5444
|
var ticketIsFree = +ticket.price === 0;
|
|
5458
|
-
var ticketPrice = isSoldOut ? 'SOLD OUT' : ticketIsFree ? 'FREE' : "
|
|
5445
|
+
var ticketPrice = isSoldOut ? 'SOLD OUT' : ticketIsFree ? 'FREE' : "\xA3 " + (+ticket.price).toFixed(2);
|
|
5459
5446
|
return React.createElement("div", {
|
|
5460
5447
|
key: ticket.id || ticket.name,
|
|
5461
5448
|
className: "event-detail__tier " + (isSoldOut ? 'disabled' : '')
|
|
@@ -5467,7 +5454,7 @@ var TicketsSection = function TicketsSection(_ref) {
|
|
|
5467
5454
|
className: "event-detail__tier-price"
|
|
5468
5455
|
}, ticketIsDiscounted && React.createElement("p", {
|
|
5469
5456
|
className: "old-price"
|
|
5470
|
-
}, "
|
|
5457
|
+
}, "\xA3 ", (+ticket.oldPrice).toFixed(2)), React.createElement("p", {
|
|
5471
5458
|
className: isSoldOut ? 'sold-out' : ''
|
|
5472
5459
|
}, ticketPrice), !isSoldOut && !ticketIsFree && React.createElement("p", {
|
|
5473
5460
|
className: "fees"
|
|
@@ -7645,8 +7632,11 @@ var AddonsContainter = function AddonsContainter(_ref) {
|
|
|
7645
7632
|
_ref$onConfirmSelecti2 = _ref.onConfirmSelectionError,
|
|
7646
7633
|
onConfirmSelectionError = _ref$onConfirmSelecti2 === void 0 ? _identity : _ref$onConfirmSelecti2,
|
|
7647
7634
|
_ref$onCountdownFinis = _ref.onCountdownFinish,
|
|
7648
|
-
_onCountdownFinish = _ref$onCountdownFinis === void 0 ? _identity : _ref$onCountdownFinis
|
|
7635
|
+
_onCountdownFinish = _ref$onCountdownFinis === void 0 ? _identity : _ref$onCountdownFinis,
|
|
7636
|
+
_ref$samePageBilling = _ref.samePageBilling,
|
|
7637
|
+
samePageBilling = _ref$samePageBilling === void 0 ? false : _ref$samePageBilling;
|
|
7649
7638
|
|
|
7639
|
+
var valuesRef = useRef(null);
|
|
7650
7640
|
var eventId = getQueryVariable('event_id');
|
|
7651
7641
|
|
|
7652
7642
|
var _useState = useState([]),
|
|
@@ -7823,7 +7813,7 @@ var AddonsContainter = function AddonsContainter(_ref) {
|
|
|
7823
7813
|
collectOptionalWalletAddress = (_pageConfigsData$coll = pageConfigsData.collect_optional_wallet_address) != null ? _pageConfigsData$coll : false;
|
|
7824
7814
|
collectMandatoryWalletAddress = (_pageConfigsData$coll2 = pageConfigsData.collect_mandatory_wallet_address) != null ? _pageConfigsData$coll2 : false;
|
|
7825
7815
|
|
|
7826
|
-
if (!(skipBillingPage && enableBillingInfoAutoCreate)) {
|
|
7816
|
+
if (!(skipBillingPage && enableBillingInfoAutoCreate && !samePageBilling)) {
|
|
7827
7817
|
_context2.next = 36;
|
|
7828
7818
|
break;
|
|
7829
7819
|
}
|
|
@@ -7927,6 +7917,7 @@ var AddonsContainter = function AddonsContainter(_ref) {
|
|
|
7927
7917
|
}));
|
|
7928
7918
|
}
|
|
7929
7919
|
|
|
7920
|
+
var flagHasAddOn = getQueryVariable('hasAddOn') === 'true';
|
|
7930
7921
|
return React.createElement(React.Fragment, null, !!cartExpirationTime && enableTimer && React.createElement(TimerWidget$1, {
|
|
7931
7922
|
expires_at: cartExpirationTime,
|
|
7932
7923
|
onCountdownFinish: function onCountdownFinish() {
|
|
@@ -7934,7 +7925,7 @@ var AddonsContainter = function AddonsContainter(_ref) {
|
|
|
7934
7925
|
|
|
7935
7926
|
_onCountdownFinish();
|
|
7936
7927
|
}
|
|
7937
|
-
}), React.createElement("div", {
|
|
7928
|
+
}), samePageBilling && !flagHasAddOn ? null : React.createElement("div", {
|
|
7938
7929
|
className: classNamePrefix + "_container"
|
|
7939
7930
|
}, React.createElement("div", {
|
|
7940
7931
|
className: classNamePrefix + "_block"
|
|
@@ -7942,7 +7933,7 @@ var AddonsContainter = function AddonsContainter(_ref) {
|
|
|
7942
7933
|
className: classNamePrefix + "_line_block"
|
|
7943
7934
|
}, React.createElement("p", {
|
|
7944
7935
|
className: classNamePrefix + "_info_title"
|
|
7945
|
-
}, "Get Your Tickets"), React.createElement("button", {
|
|
7936
|
+
}, "Get Your Tickets"), samePageBilling ? null : React.createElement("button", {
|
|
7946
7937
|
type: "button",
|
|
7947
7938
|
className: classNamePrefix + "_skip",
|
|
7948
7939
|
onClick: function onClick() {
|
|
@@ -7960,6 +7951,11 @@ var AddonsContainter = function AddonsContainter(_ref) {
|
|
|
7960
7951
|
}
|
|
7961
7952
|
}, function (_ref4) {
|
|
7962
7953
|
var values = _ref4.values;
|
|
7954
|
+
|
|
7955
|
+
if (!isEqual(values, valuesRef.current)) {
|
|
7956
|
+
valuesRef.current = values;
|
|
7957
|
+
}
|
|
7958
|
+
|
|
7963
7959
|
var isConfirmDisabled = !isAtLeastOneAddonSelected(values);
|
|
7964
7960
|
return React.createElement(Form, {
|
|
7965
7961
|
autoComplete: "off",
|
|
@@ -7999,7 +7995,13 @@ var AddonsContainter = function AddonsContainter(_ref) {
|
|
|
7999
7995
|
selectOptions: addonsOptions[variant.id],
|
|
8000
7996
|
classNamePrefix: classNamePrefix,
|
|
8001
7997
|
handleAddonChange: function handleAddonChange(id, value) {
|
|
8002
|
-
|
|
7998
|
+
onFieldChange(id, value, addon);
|
|
7999
|
+
|
|
8000
|
+
if (samePageBilling) {
|
|
8001
|
+
setTimeout(function () {
|
|
8002
|
+
handleConfirm(valuesRef.current);
|
|
8003
|
+
}, 100);
|
|
8004
|
+
}
|
|
8003
8005
|
}
|
|
8004
8006
|
})
|
|
8005
8007
|
);
|
|
@@ -8010,10 +8012,16 @@ var AddonsContainter = function AddonsContainter(_ref) {
|
|
|
8010
8012
|
selectOptions: addonsOptions[addon.id],
|
|
8011
8013
|
classNamePrefix: classNamePrefix,
|
|
8012
8014
|
handleAddonChange: function handleAddonChange(id, value) {
|
|
8013
|
-
|
|
8015
|
+
onFieldChange(id, value, addon);
|
|
8016
|
+
|
|
8017
|
+
if (samePageBilling) {
|
|
8018
|
+
setTimeout(function () {
|
|
8019
|
+
handleConfirm(valuesRef.current);
|
|
8020
|
+
}, 100);
|
|
8021
|
+
}
|
|
8014
8022
|
}
|
|
8015
8023
|
})));
|
|
8016
|
-
}), React.createElement("button", {
|
|
8024
|
+
}), samePageBilling ? null : React.createElement("button", {
|
|
8017
8025
|
type: "submit",
|
|
8018
8026
|
className: (isConfirmDisabled ? classNamePrefix + "_is_disabled" : '') + " " + classNamePrefix + "_submit_button",
|
|
8019
8027
|
disabled: isConfirmDisabled
|