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.
@@ -10,8 +10,9 @@ export interface IAddonContainterProps {
10
10
  onConfirmSelectionSuccess?: (res: any) => void;
11
11
  onConfirmSelectionError?: (error: any) => void;
12
12
  onCountdownFinish?: () => void;
13
+ samePageBilling?: boolean;
13
14
  }
14
15
  export interface ObjectLiteral {
15
16
  [key: string]: any;
16
17
  }
17
- export declare const AddonsContainter: ({ classNamePrefix, enableBillingInfoAutoCreate, enableTimer, onGetAddonsPageInfoSuccess, onGetAddonsPageInfoError, onPostCheckoutSuccess, onPostCheckoutError, onConfirmSelectionSuccess, onConfirmSelectionError, onCountdownFinish, }: IAddonContainterProps) => JSX.Element;
18
+ export declare const AddonsContainter: ({ classNamePrefix, enableBillingInfoAutoCreate, enableTimer, onGetAddonsPageInfoSuccess, onGetAddonsPageInfoError, onPostCheckoutSuccess, onPostCheckoutError, onConfirmSelectionSuccess, onConfirmSelectionError, onCountdownFinish, samePageBilling, }: IAddonContainterProps) => JSX.Element;
@@ -12,9 +12,6 @@ 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);
18
15
  }
19
16
  interface IOtherProps {
20
17
  [key: string]: any;
@@ -1,5 +1,5 @@
1
- import { ReactNode } from 'react';
2
1
  import './style.css';
2
+ import { ReactNode } from 'react';
3
3
  interface ITicketsSectionProps {
4
4
  ticketsList: any;
5
5
  selectedTickets: any;
@@ -25,8 +25,6 @@ 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'));
30
28
  var FormGroup = _interopDefault(require('@mui/material/FormGroup'));
31
29
  var FormControlLabel = _interopDefault(require('@mui/material/FormControlLabel'));
32
30
  var Checkbox = _interopDefault(require('@mui/material/Checkbox'));
@@ -67,6 +65,7 @@ var TablePagination = _interopDefault(require('@mui/material/TablePagination'));
67
65
  var TableRow = _interopDefault(require('@mui/material/TableRow'));
68
66
  var _has = _interopDefault(require('lodash/has'));
69
67
  var Radio = _interopDefault(require('@mui/material/Radio'));
68
+ var lodash = require('lodash');
70
69
  var _isNull = _interopDefault(require('lodash/isNull'));
71
70
  var _reverse = _interopDefault(require('lodash/reverse'));
72
71
 
@@ -1614,33 +1613,28 @@ var emailValidator = function emailValidator(email) {
1614
1613
  return !emailRegex.test(email) ? 'Please enter a valid email address' : '';
1615
1614
  };
1616
1615
 
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;
1616
+ var CustomField = function CustomField(_ref) {
1617
+ var label = _ref.label,
1618
+ _ref$type = _ref.type,
1619
+ type = _ref$type === void 0 ? 'text' : _ref$type,
1620
+ field = _ref.field,
1621
+ _ref$selectOptions = _ref.selectOptions,
1622
+ selectOptions = _ref$selectOptions === void 0 ? [] : _ref$selectOptions,
1623
+ _ref$form = _ref.form,
1624
+ touched = _ref$form.touched,
1625
+ errors = _ref$form.errors,
1626
+ submitCount = _ref$form.submitCount,
1627
+ theme = _ref.theme,
1628
+ _ref$inputProps = _ref.inputProps,
1629
+ pInputProps = _ref$inputProps === void 0 ? {} : _ref$inputProps,
1630
+ _ref$InputProps = _ref.InputProps,
1631
+ InputProps = _ref$InputProps === void 0 ? {} : _ref$InputProps,
1632
+ inputRef = _ref.inputRef;
1636
1633
 
1637
1634
  var _useState = React.useState(Boolean(field.value)),
1638
1635
  isShrinked = _useState[0],
1639
1636
  setIsShrinked = _useState[1];
1640
1637
 
1641
- var _ref = React.useRef(null);
1642
-
1643
- var isAutoFilled = (_ref$current = _ref.current) == null ? void 0 : _ref$current.matches(':-webkit-autofill');
1644
1638
  var isSelectField = type === 'select';
1645
1639
 
1646
1640
  var error = _get(errors, field.name);
@@ -1650,13 +1644,6 @@ var CustomField = function CustomField(_ref2) {
1650
1644
  var inputProps = {
1651
1645
  sx: customTheme == null ? void 0 : customTheme.input
1652
1646
  };
1653
- React.useEffect(function () {
1654
- if (_isFunction(inputRef)) {
1655
- inputRef(_ref.current);
1656
- } else if (_isObject(inputRef)) {
1657
- inputRef.current = _ref.current;
1658
- }
1659
- });
1660
1647
  return React__default.createElement(TextField, Object.assign({
1661
1648
  placeholder: "",
1662
1649
  id: field.name,
@@ -1678,11 +1665,11 @@ var CustomField = function CustomField(_ref2) {
1678
1665
  },
1679
1666
  InputLabelProps: {
1680
1667
  sx: customTheme == null ? void 0 : customTheme.input,
1681
- shrink: isShrinked || Boolean(field.value) || isAutoFilled
1668
+ shrink: isShrinked || Boolean(field.value)
1682
1669
  },
1683
1670
  InputProps: InputProps,
1684
1671
  inputProps: _extends({}, inputProps, pInputProps),
1685
- inputRef: _ref
1672
+ inputRef: inputRef
1686
1673
  }, field, {
1687
1674
  onBlur: function onBlur(e) {
1688
1675
  setIsShrinked(Boolean(field.value));
@@ -5457,7 +5444,7 @@ var TicketsSection = function TicketsSection(_ref) {
5457
5444
  }
5458
5445
 
5459
5446
  var ticketIsFree = +ticket.price === 0;
5460
- var ticketPrice = isSoldOut ? 'SOLD OUT' : ticketIsFree ? 'FREE' : "$ " + (+ticket.price).toFixed(2);
5447
+ var ticketPrice = isSoldOut ? 'SOLD OUT' : ticketIsFree ? 'FREE' : "\xA3 " + (+ticket.price).toFixed(2);
5461
5448
  return React__default.createElement("div", {
5462
5449
  key: ticket.id || ticket.name,
5463
5450
  className: "event-detail__tier " + (isSoldOut ? 'disabled' : '')
@@ -5469,7 +5456,7 @@ var TicketsSection = function TicketsSection(_ref) {
5469
5456
  className: "event-detail__tier-price"
5470
5457
  }, ticketIsDiscounted && React__default.createElement("p", {
5471
5458
  className: "old-price"
5472
- }, "$ ", (+ticket.oldPrice).toFixed(2)), React__default.createElement("p", {
5459
+ }, "\xA3 ", (+ticket.oldPrice).toFixed(2)), React__default.createElement("p", {
5473
5460
  className: isSoldOut ? 'sold-out' : ''
5474
5461
  }, ticketPrice), !isSoldOut && !ticketIsFree && React__default.createElement("p", {
5475
5462
  className: "fees"
@@ -7647,8 +7634,11 @@ var AddonsContainter = function AddonsContainter(_ref) {
7647
7634
  _ref$onConfirmSelecti2 = _ref.onConfirmSelectionError,
7648
7635
  onConfirmSelectionError = _ref$onConfirmSelecti2 === void 0 ? _identity : _ref$onConfirmSelecti2,
7649
7636
  _ref$onCountdownFinis = _ref.onCountdownFinish,
7650
- _onCountdownFinish = _ref$onCountdownFinis === void 0 ? _identity : _ref$onCountdownFinis;
7637
+ _onCountdownFinish = _ref$onCountdownFinis === void 0 ? _identity : _ref$onCountdownFinis,
7638
+ _ref$samePageBilling = _ref.samePageBilling,
7639
+ samePageBilling = _ref$samePageBilling === void 0 ? false : _ref$samePageBilling;
7651
7640
 
7641
+ var valuesRef = React.useRef(null);
7652
7642
  var eventId = getQueryVariable('event_id');
7653
7643
 
7654
7644
  var _useState = React.useState([]),
@@ -7825,7 +7815,7 @@ var AddonsContainter = function AddonsContainter(_ref) {
7825
7815
  collectOptionalWalletAddress = (_pageConfigsData$coll = pageConfigsData.collect_optional_wallet_address) != null ? _pageConfigsData$coll : false;
7826
7816
  collectMandatoryWalletAddress = (_pageConfigsData$coll2 = pageConfigsData.collect_mandatory_wallet_address) != null ? _pageConfigsData$coll2 : false;
7827
7817
 
7828
- if (!(skipBillingPage && enableBillingInfoAutoCreate)) {
7818
+ if (!(skipBillingPage && enableBillingInfoAutoCreate && !samePageBilling)) {
7829
7819
  _context2.next = 36;
7830
7820
  break;
7831
7821
  }
@@ -7929,6 +7919,7 @@ var AddonsContainter = function AddonsContainter(_ref) {
7929
7919
  }));
7930
7920
  }
7931
7921
 
7922
+ var flagHasAddOn = getQueryVariable('hasAddOn') === 'true';
7932
7923
  return React__default.createElement(React__default.Fragment, null, !!cartExpirationTime && enableTimer && React__default.createElement(TimerWidget$1, {
7933
7924
  expires_at: cartExpirationTime,
7934
7925
  onCountdownFinish: function onCountdownFinish() {
@@ -7936,7 +7927,7 @@ var AddonsContainter = function AddonsContainter(_ref) {
7936
7927
 
7937
7928
  _onCountdownFinish();
7938
7929
  }
7939
- }), React__default.createElement("div", {
7930
+ }), samePageBilling && !flagHasAddOn ? null : React__default.createElement("div", {
7940
7931
  className: classNamePrefix + "_container"
7941
7932
  }, React__default.createElement("div", {
7942
7933
  className: classNamePrefix + "_block"
@@ -7944,7 +7935,7 @@ var AddonsContainter = function AddonsContainter(_ref) {
7944
7935
  className: classNamePrefix + "_line_block"
7945
7936
  }, React__default.createElement("p", {
7946
7937
  className: classNamePrefix + "_info_title"
7947
- }, "Get Your Tickets"), React__default.createElement("button", {
7938
+ }, "Get Your Tickets"), samePageBilling ? null : React__default.createElement("button", {
7948
7939
  type: "button",
7949
7940
  className: classNamePrefix + "_skip",
7950
7941
  onClick: function onClick() {
@@ -7962,6 +7953,11 @@ var AddonsContainter = function AddonsContainter(_ref) {
7962
7953
  }
7963
7954
  }, function (_ref4) {
7964
7955
  var values = _ref4.values;
7956
+
7957
+ if (!lodash.isEqual(values, valuesRef.current)) {
7958
+ valuesRef.current = values;
7959
+ }
7960
+
7965
7961
  var isConfirmDisabled = !isAtLeastOneAddonSelected(values);
7966
7962
  return React__default.createElement(formik.Form, {
7967
7963
  autoComplete: "off",
@@ -8001,7 +7997,13 @@ var AddonsContainter = function AddonsContainter(_ref) {
8001
7997
  selectOptions: addonsOptions[variant.id],
8002
7998
  classNamePrefix: classNamePrefix,
8003
7999
  handleAddonChange: function handleAddonChange(id, value) {
8004
- return onFieldChange(id, value, addon);
8000
+ onFieldChange(id, value, addon);
8001
+
8002
+ if (samePageBilling) {
8003
+ setTimeout(function () {
8004
+ handleConfirm(valuesRef.current);
8005
+ }, 100);
8006
+ }
8005
8007
  }
8006
8008
  })
8007
8009
  );
@@ -8012,10 +8014,16 @@ var AddonsContainter = function AddonsContainter(_ref) {
8012
8014
  selectOptions: addonsOptions[addon.id],
8013
8015
  classNamePrefix: classNamePrefix,
8014
8016
  handleAddonChange: function handleAddonChange(id, value) {
8015
- return onFieldChange(id, value, addon);
8017
+ onFieldChange(id, value, addon);
8018
+
8019
+ if (samePageBilling) {
8020
+ setTimeout(function () {
8021
+ handleConfirm(valuesRef.current);
8022
+ }, 100);
8023
+ }
8016
8024
  }
8017
8025
  })));
8018
- }), React__default.createElement("button", {
8026
+ }), samePageBilling ? null : React__default.createElement("button", {
8019
8027
  type: "submit",
8020
8028
  className: (isConfirmDisabled ? classNamePrefix + "_is_disabled" : '') + " " + classNamePrefix + "_submit_button",
8021
8029
  disabled: isConfirmDisabled