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.
@@ -12,6 +12,9 @@ export interface ICustomField {
12
12
  theme: 'dark' | 'light';
13
13
  type?: string;
14
14
  selectOptions?: ISelectOption[];
15
+ inputRef?: {
16
+ current: HTMLInputElement | null;
17
+ } | ((node: HTMLInputElement | null) => void);
15
18
  }
16
19
  interface IOtherProps {
17
20
  [key: string]: any;
@@ -1,5 +1,5 @@
1
- import './style.css';
2
1
  import { ReactNode } from 'react';
2
+ import './style.css';
3
3
  interface ITicketsSectionProps {
4
4
  ticketsList: any;
5
5
  selectedTickets: any;
@@ -25,6 +25,8 @@ var AdapterMoment = require('@mui/x-date-pickers/AdapterMoment');
25
25
  var LocalizationProvider = require('@mui/x-date-pickers/LocalizationProvider');
26
26
  var TextField = _interopDefault(require('@mui/material/TextField'));
27
27
  var styles$1 = require('@mui/styles');
28
+ var _isFunction = _interopDefault(require('lodash/isFunction'));
29
+ var _isObject = _interopDefault(require('lodash/isObject'));
28
30
  var FormGroup = _interopDefault(require('@mui/material/FormGroup'));
29
31
  var FormControlLabel = _interopDefault(require('@mui/material/FormControlLabel'));
30
32
  var Checkbox = _interopDefault(require('@mui/material/Checkbox'));
@@ -1612,28 +1614,33 @@ var emailValidator = function emailValidator(email) {
1612
1614
  return !emailRegex.test(email) ? 'Please enter a valid email address' : '';
1613
1615
  };
1614
1616
 
1615
- var CustomField = function CustomField(_ref) {
1616
- var label = _ref.label,
1617
- _ref$type = _ref.type,
1618
- type = _ref$type === void 0 ? 'text' : _ref$type,
1619
- field = _ref.field,
1620
- _ref$selectOptions = _ref.selectOptions,
1621
- selectOptions = _ref$selectOptions === void 0 ? [] : _ref$selectOptions,
1622
- _ref$form = _ref.form,
1623
- touched = _ref$form.touched,
1624
- errors = _ref$form.errors,
1625
- submitCount = _ref$form.submitCount,
1626
- theme = _ref.theme,
1627
- _ref$inputProps = _ref.inputProps,
1628
- pInputProps = _ref$inputProps === void 0 ? {} : _ref$inputProps,
1629
- _ref$InputProps = _ref.InputProps,
1630
- InputProps = _ref$InputProps === void 0 ? {} : _ref$InputProps,
1631
- inputRef = _ref.inputRef;
1617
+ var CustomField = function CustomField(_ref2) {
1618
+ var _ref$current;
1619
+
1620
+ var label = _ref2.label,
1621
+ _ref2$type = _ref2.type,
1622
+ type = _ref2$type === void 0 ? 'text' : _ref2$type,
1623
+ field = _ref2.field,
1624
+ _ref2$selectOptions = _ref2.selectOptions,
1625
+ selectOptions = _ref2$selectOptions === void 0 ? [] : _ref2$selectOptions,
1626
+ _ref2$form = _ref2.form,
1627
+ touched = _ref2$form.touched,
1628
+ errors = _ref2$form.errors,
1629
+ submitCount = _ref2$form.submitCount,
1630
+ theme = _ref2.theme,
1631
+ _ref2$inputProps = _ref2.inputProps,
1632
+ pInputProps = _ref2$inputProps === void 0 ? {} : _ref2$inputProps,
1633
+ _ref2$InputProps = _ref2.InputProps,
1634
+ InputProps = _ref2$InputProps === void 0 ? {} : _ref2$InputProps,
1635
+ inputRef = _ref2.inputRef;
1632
1636
 
1633
1637
  var _useState = React.useState(Boolean(field.value)),
1634
1638
  isShrinked = _useState[0],
1635
1639
  setIsShrinked = _useState[1];
1636
1640
 
1641
+ var _ref = React.useRef(null);
1642
+
1643
+ var isAutoFilled = (_ref$current = _ref.current) == null ? void 0 : _ref$current.matches(':-webkit-autofill');
1637
1644
  var isSelectField = type === 'select';
1638
1645
 
1639
1646
  var error = _get(errors, field.name);
@@ -1643,6 +1650,13 @@ var CustomField = function CustomField(_ref) {
1643
1650
  var inputProps = {
1644
1651
  sx: customTheme == null ? void 0 : customTheme.input
1645
1652
  };
1653
+ React.useEffect(function () {
1654
+ if (_isFunction(inputRef)) {
1655
+ inputRef(_ref.current);
1656
+ } else if (_isObject(inputRef)) {
1657
+ inputRef.current = _ref.current;
1658
+ }
1659
+ });
1646
1660
  return React__default.createElement(TextField, Object.assign({
1647
1661
  placeholder: "",
1648
1662
  id: field.name,
@@ -1664,11 +1678,11 @@ var CustomField = function CustomField(_ref) {
1664
1678
  },
1665
1679
  InputLabelProps: {
1666
1680
  sx: customTheme == null ? void 0 : customTheme.input,
1667
- shrink: isShrinked || Boolean(field.value)
1681
+ shrink: isShrinked || Boolean(field.value) || isAutoFilled
1668
1682
  },
1669
1683
  InputProps: InputProps,
1670
1684
  inputProps: _extends({}, inputProps, pInputProps),
1671
- inputRef: inputRef
1685
+ inputRef: _ref
1672
1686
  }, field, {
1673
1687
  onBlur: function onBlur(e) {
1674
1688
  setIsShrinked(Boolean(field.value));
@@ -5443,7 +5457,7 @@ var TicketsSection = function TicketsSection(_ref) {
5443
5457
  }
5444
5458
 
5445
5459
  var ticketIsFree = +ticket.price === 0;
5446
- var ticketPrice = isSoldOut ? 'SOLD OUT' : ticketIsFree ? 'FREE' : "\xA3 " + (+ticket.price).toFixed(2);
5460
+ var ticketPrice = isSoldOut ? 'SOLD OUT' : ticketIsFree ? 'FREE' : "$ " + (+ticket.price).toFixed(2);
5447
5461
  return React__default.createElement("div", {
5448
5462
  key: ticket.id || ticket.name,
5449
5463
  className: "event-detail__tier " + (isSoldOut ? 'disabled' : '')
@@ -5455,7 +5469,7 @@ var TicketsSection = function TicketsSection(_ref) {
5455
5469
  className: "event-detail__tier-price"
5456
5470
  }, ticketIsDiscounted && React__default.createElement("p", {
5457
5471
  className: "old-price"
5458
- }, "\xA3 ", (+ticket.oldPrice).toFixed(2)), React__default.createElement("p", {
5472
+ }, "$ ", (+ticket.oldPrice).toFixed(2)), React__default.createElement("p", {
5459
5473
  className: isSoldOut ? 'sold-out' : ''
5460
5474
  }, ticketPrice), !isSoldOut && !ticketIsFree && React__default.createElement("p", {
5461
5475
  className: "fees"