tf-checkout-react 1.3.23 → 1.3.24
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/common/CustomField.d.ts +3 -0
- package/dist/components/ticketsContainer/TicketsSection.d.ts +1 -1
- package/dist/tf-checkout-react.cjs.development.js +35 -21
- 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 +36 -22
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/.DS_Store +0 -0
- package/src/components/.DS_Store +0 -0
- package/src/components/common/CustomField.tsx +25 -4
- package/src/components/common/dist/PhoneNumberField.js +96 -0
- package/src/components/ticketsContainer/TicketsSection.tsx +3 -4
|
@@ -11,13 +11,15 @@ 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, useRef, useEffect, useCallback, memo, 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';
|
|
21
23
|
import FormGroup from '@mui/material/FormGroup';
|
|
22
24
|
import FormControlLabel from '@mui/material/FormControlLabel';
|
|
23
25
|
import Checkbox from '@mui/material/Checkbox';
|
|
@@ -1605,28 +1607,33 @@ var emailValidator = function emailValidator(email) {
|
|
|
1605
1607
|
return !emailRegex.test(email) ? 'Please enter a valid email address' : '';
|
|
1606
1608
|
};
|
|
1607
1609
|
|
|
1608
|
-
var CustomField = function CustomField(
|
|
1609
|
-
var
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1610
|
+
var CustomField = function CustomField(_ref2) {
|
|
1611
|
+
var _ref$current;
|
|
1612
|
+
|
|
1613
|
+
var label = _ref2.label,
|
|
1614
|
+
_ref2$type = _ref2.type,
|
|
1615
|
+
type = _ref2$type === void 0 ? 'text' : _ref2$type,
|
|
1616
|
+
field = _ref2.field,
|
|
1617
|
+
_ref2$selectOptions = _ref2.selectOptions,
|
|
1618
|
+
selectOptions = _ref2$selectOptions === void 0 ? [] : _ref2$selectOptions,
|
|
1619
|
+
_ref2$form = _ref2.form,
|
|
1620
|
+
touched = _ref2$form.touched,
|
|
1621
|
+
errors = _ref2$form.errors,
|
|
1622
|
+
submitCount = _ref2$form.submitCount,
|
|
1623
|
+
theme = _ref2.theme,
|
|
1624
|
+
_ref2$inputProps = _ref2.inputProps,
|
|
1625
|
+
pInputProps = _ref2$inputProps === void 0 ? {} : _ref2$inputProps,
|
|
1626
|
+
_ref2$InputProps = _ref2.InputProps,
|
|
1627
|
+
InputProps = _ref2$InputProps === void 0 ? {} : _ref2$InputProps,
|
|
1628
|
+
inputRef = _ref2.inputRef;
|
|
1625
1629
|
|
|
1626
1630
|
var _useState = useState(Boolean(field.value)),
|
|
1627
1631
|
isShrinked = _useState[0],
|
|
1628
1632
|
setIsShrinked = _useState[1];
|
|
1629
1633
|
|
|
1634
|
+
var _ref = useRef(null);
|
|
1635
|
+
|
|
1636
|
+
var isAutoFilled = (_ref$current = _ref.current) == null ? void 0 : _ref$current.matches(':-webkit-autofill');
|
|
1630
1637
|
var isSelectField = type === 'select';
|
|
1631
1638
|
|
|
1632
1639
|
var error = _get(errors, field.name);
|
|
@@ -1636,6 +1643,13 @@ var CustomField = function CustomField(_ref) {
|
|
|
1636
1643
|
var inputProps = {
|
|
1637
1644
|
sx: customTheme == null ? void 0 : customTheme.input
|
|
1638
1645
|
};
|
|
1646
|
+
useEffect(function () {
|
|
1647
|
+
if (_isFunction(inputRef)) {
|
|
1648
|
+
inputRef(_ref.current);
|
|
1649
|
+
} else if (_isObject(inputRef)) {
|
|
1650
|
+
inputRef.current = _ref.current;
|
|
1651
|
+
}
|
|
1652
|
+
});
|
|
1639
1653
|
return React.createElement(TextField, Object.assign({
|
|
1640
1654
|
placeholder: "",
|
|
1641
1655
|
id: field.name,
|
|
@@ -1657,11 +1671,11 @@ var CustomField = function CustomField(_ref) {
|
|
|
1657
1671
|
},
|
|
1658
1672
|
InputLabelProps: {
|
|
1659
1673
|
sx: customTheme == null ? void 0 : customTheme.input,
|
|
1660
|
-
shrink: isShrinked || Boolean(field.value)
|
|
1674
|
+
shrink: isShrinked || Boolean(field.value) || isAutoFilled
|
|
1661
1675
|
},
|
|
1662
1676
|
InputProps: InputProps,
|
|
1663
1677
|
inputProps: _extends({}, inputProps, pInputProps),
|
|
1664
|
-
inputRef:
|
|
1678
|
+
inputRef: _ref
|
|
1665
1679
|
}, field, {
|
|
1666
1680
|
onBlur: function onBlur(e) {
|
|
1667
1681
|
setIsShrinked(Boolean(field.value));
|
|
@@ -5441,7 +5455,7 @@ var TicketsSection = function TicketsSection(_ref) {
|
|
|
5441
5455
|
}
|
|
5442
5456
|
|
|
5443
5457
|
var ticketIsFree = +ticket.price === 0;
|
|
5444
|
-
var ticketPrice = isSoldOut ? 'SOLD OUT' : ticketIsFree ? 'FREE' : "
|
|
5458
|
+
var ticketPrice = isSoldOut ? 'SOLD OUT' : ticketIsFree ? 'FREE' : "$ " + (+ticket.price).toFixed(2);
|
|
5445
5459
|
return React.createElement("div", {
|
|
5446
5460
|
key: ticket.id || ticket.name,
|
|
5447
5461
|
className: "event-detail__tier " + (isSoldOut ? 'disabled' : '')
|
|
@@ -5453,7 +5467,7 @@ var TicketsSection = function TicketsSection(_ref) {
|
|
|
5453
5467
|
className: "event-detail__tier-price"
|
|
5454
5468
|
}, ticketIsDiscounted && React.createElement("p", {
|
|
5455
5469
|
className: "old-price"
|
|
5456
|
-
}, "
|
|
5470
|
+
}, "$ ", (+ticket.oldPrice).toFixed(2)), React.createElement("p", {
|
|
5457
5471
|
className: isSoldOut ? 'sold-out' : ''
|
|
5458
5472
|
}, ticketPrice), !isSoldOut && !ticketIsFree && React.createElement("p", {
|
|
5459
5473
|
className: "fees"
|