tf-checkout-react 1.5.7 → 1.5.9-beta.0

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.
@@ -20,6 +20,8 @@ export interface IBillingInfoPage {
20
20
  onGetStatesError?: (e: AxiosError) => void;
21
21
  onGetProfileDataSuccess?: (res: any) => void;
22
22
  onGetProfileDataError?: (e: AxiosError) => void;
23
+ onGetCheckoutConfigsSuccess?: (res: any) => void;
24
+ onGetCheckoutConfigsError?: (e: AxiosError) => void;
23
25
  onLogin?: () => void;
24
26
  onLoginSuccess?: () => void;
25
27
  onErrorClose?: () => void;
@@ -50,4 +52,4 @@ export interface IBillingInfoPage {
50
52
  isCountryCodeEditable?: boolean;
51
53
  onPendingVerification?: () => void;
52
54
  }
53
- export declare const BillingInfoContainer: React.MemoExoticComponent<({ data, ticketHoldersFields, initialValues, buttonName, handleSubmit, theme, onRegisterSuccess, onRegisterError, onSubmitError, onGetCartSuccess, onGetCartError, onGetCountriesSuccess, onGetCountriesError, onGetStatesSuccess, onGetStatesError, onGetProfileDataSuccess, onGetProfileDataError, onLogin, onLoginSuccess, isLoggedIn: pIsLoggedIn, accountInfoTitle, hideLogo, themeOptions, onErrorClose, hideErrorsAlertSection, onSkipBillingPage, skipPage, canSkipHolderNames, onForgotPasswordSuccess, onForgotPasswordError, shouldFetchCountries, onCountdownFinish, enableTimer, logo, showForgotPasswordButton, showSignUpButton, brandOptIn, showPoweredByImage, isCountryCodeEditable, onPendingVerification, }: IBillingInfoPage) => JSX.Element>;
55
+ export declare const BillingInfoContainer: React.MemoExoticComponent<({ data, ticketHoldersFields, initialValues, buttonName, handleSubmit, theme, onRegisterSuccess, onRegisterError, onSubmitError, onGetCartSuccess, onGetCartError, onGetCountriesSuccess, onGetCountriesError, onGetStatesSuccess, onGetStatesError, onGetProfileDataSuccess, onGetProfileDataError, onLogin, onLoginSuccess, isLoggedIn: pIsLoggedIn, accountInfoTitle, hideLogo, themeOptions, onErrorClose, hideErrorsAlertSection, onSkipBillingPage, skipPage, canSkipHolderNames, onForgotPasswordSuccess, onForgotPasswordError, shouldFetchCountries, onCountdownFinish, enableTimer, logo, showForgotPasswordButton, showSignUpButton, brandOptIn, showPoweredByImage, isCountryCodeEditable, onPendingVerification, onGetCheckoutConfigsSuccess, onGetCheckoutConfigsError, }: IBillingInfoPage) => JSX.Element>;
@@ -18,6 +18,7 @@ export interface ICheckoutForm {
18
18
  paymentButtonText?: string;
19
19
  forPaymentPlan?: boolean;
20
20
  orderId?: string;
21
+ hasSeatMapActions: boolean;
21
22
  }
22
- declare const CheckoutForm: ({ total, orderId, onSubmit, stripeCardOptions, error, stripe_client_secret, currency, billing_info, isLoading, handleSetLoading, conditions, disableZipSection, paymentButtonText, forPaymentPlan, }: ICheckoutForm) => JSX.Element;
23
+ declare const CheckoutForm: ({ total, orderId, onSubmit, stripeCardOptions, error, stripe_client_secret, currency, billing_info, isLoading, handleSetLoading, conditions, disableZipSection, paymentButtonText, forPaymentPlan, hasSeatMapActions, }: ICheckoutForm) => JSX.Element;
23
24
  export default CheckoutForm;
@@ -3480,7 +3480,11 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
3480
3480
  _ref4$isCountryCodeEd = _ref4.isCountryCodeEditable,
3481
3481
  isCountryCodeEditable = _ref4$isCountryCodeEd === void 0 ? true : _ref4$isCountryCodeEd,
3482
3482
  _ref4$onPendingVerifi = _ref4.onPendingVerification,
3483
- onPendingVerification = _ref4$onPendingVerifi === void 0 ? _identity : _ref4$onPendingVerifi;
3483
+ onPendingVerification = _ref4$onPendingVerifi === void 0 ? _identity : _ref4$onPendingVerifi,
3484
+ _ref4$onGetCheckoutCo = _ref4.onGetCheckoutConfigsSuccess,
3485
+ onGetCheckoutConfigsSuccess = _ref4$onGetCheckoutCo === void 0 ? _identity : _ref4$onGetCheckoutCo,
3486
+ _ref4$onGetCheckoutCo2 = _ref4.onGetCheckoutConfigsError,
3487
+ onGetCheckoutConfigsError = _ref4$onGetCheckoutCo2 === void 0 ? _identity : _ref4$onGetCheckoutCo2;
3484
3488
  var _useState = React.useState(null),
3485
3489
  extraData = _useState[0],
3486
3490
  setExtraData = _useState[1];
@@ -3507,8 +3511,10 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
3507
3511
  setConfigs(data.data.attributes);
3508
3512
  setIsConfigLoading(false);
3509
3513
  }
3510
- })["catch"](function () {
3514
+ onGetCheckoutConfigsSuccess(data);
3515
+ })["catch"](function (e) {
3511
3516
  setIsConfigLoading(false);
3517
+ onGetCheckoutConfigsError(e);
3512
3518
  });
3513
3519
  }, [isBrowser]);
3514
3520
  var defaultCountry = isBrowser ? window.localStorage.getItem('eventCountry') : '';
@@ -4350,6 +4356,68 @@ var getCurrencySymbolByCurrency = function getCurrencySymbolByCurrency(currency)
4350
4356
  }
4351
4357
  };
4352
4358
 
4359
+ var adaptStripeError = function adaptStripeError(error) {
4360
+ var _error$payment_intent;
4361
+ var adaptedError = _extends({}, error, {
4362
+ isStripeError: true
4363
+ });
4364
+ switch (error.code) {
4365
+ case 'payment_intent_unexpected_state':
4366
+ if ((error == null ? void 0 : (_error$payment_intent = error.payment_intent) == null ? void 0 : _error$payment_intent.status) === 'succeeded') {
4367
+ return _extends({}, adaptedError, {
4368
+ message: 'You cannot confirm this PaymentIntent because it has already succeeded after being previously confirmed.'
4369
+ });
4370
+ }
4371
+ return _extends({}, adaptedError);
4372
+ default:
4373
+ return adaptedError;
4374
+ }
4375
+ };
4376
+
4377
+ var style$4 = {
4378
+ position: 'absolute',
4379
+ top: '50%',
4380
+ left: '50%',
4381
+ transform: 'translate(-50%, -50%)',
4382
+ minWidth: 480,
4383
+ backgroundColor: '#e3e3e3',
4384
+ border: '1px solid white',
4385
+ outline: 'none',
4386
+ padding: '14px',
4387
+ maxHeight: '85vh',
4388
+ overflow: 'auto'
4389
+ };
4390
+ var ConfirmModal = function ConfirmModal(_ref) {
4391
+ var _ref$message = _ref.message,
4392
+ message = _ref$message === void 0 ? '' : _ref$message,
4393
+ _ref$loading = _ref.loading,
4394
+ loading = _ref$loading === void 0 ? false : _ref$loading,
4395
+ _ref$hideCancelBtn = _ref.hideCancelBtn,
4396
+ hideCancelBtn = _ref$hideCancelBtn === void 0 ? false : _ref$hideCancelBtn,
4397
+ _ref$onClose = _ref.onClose,
4398
+ onClose = _ref$onClose === void 0 ? _identity : _ref$onClose,
4399
+ _ref$onConfirm = _ref.onConfirm,
4400
+ onConfirm = _ref$onConfirm === void 0 ? _identity : _ref$onConfirm;
4401
+ return React__default.createElement(Modal$1, {
4402
+ open: true,
4403
+ onClose: onClose,
4404
+ "aria-labelledby": "modal-modal-title",
4405
+ "aria-describedby": "modal-modal-description",
4406
+ className: "confirm-modal"
4407
+ }, React__default.createElement(Box, {
4408
+ style: style$4
4409
+ }, React__default.createElement("p", null, message), React__default.createElement("div", {
4410
+ className: "footer"
4411
+ }, !hideCancelBtn && React__default.createElement(Button, {
4412
+ onClick: onClose,
4413
+ disabled: loading
4414
+ }, "Cancel"), React__default.createElement(Button, {
4415
+ onClick: onConfirm
4416
+ }, loading ? React__default.createElement(CircularProgress, {
4417
+ size: "22px"
4418
+ }) : 'OK'))));
4419
+ };
4420
+
4353
4421
  var options = {
4354
4422
  style: {
4355
4423
  base: {
@@ -4390,7 +4458,9 @@ var CheckoutForm = function CheckoutForm(_ref) {
4390
4458
  disableZipSection = _ref.disableZipSection,
4391
4459
  paymentButtonText = _ref.paymentButtonText,
4392
4460
  _ref$forPaymentPlan = _ref.forPaymentPlan,
4393
- forPaymentPlan = _ref$forPaymentPlan === void 0 ? false : _ref$forPaymentPlan;
4461
+ forPaymentPlan = _ref$forPaymentPlan === void 0 ? false : _ref$forPaymentPlan,
4462
+ _ref$hasSeatMapAction = _ref.hasSeatMapActions,
4463
+ hasSeatMapActions = _ref$hasSeatMapAction === void 0 ? false : _ref$hasSeatMapAction;
4394
4464
  var stripe = reactStripeJs.useStripe();
4395
4465
  var elements = reactStripeJs.useElements();
4396
4466
  var _useState = React.useState(''),
@@ -4489,28 +4559,33 @@ var CheckoutForm = function CheckoutForm(_ref) {
4489
4559
  _yield$stripe$confirm = _context.sent;
4490
4560
  _error = _yield$stripe$confirm.error;
4491
4561
  if (!_error) {
4562
+ _context.next = 39;
4563
+ break;
4564
+ }
4565
+ setStripeError(adaptStripeError(_error));
4566
+ _context.t0 = hasSeatMapActions;
4567
+ if (!_context.t0) {
4492
4568
  _context.next = 37;
4493
4569
  break;
4494
4570
  }
4495
- _context.next = 34;
4571
+ _context.next = 37;
4496
4572
  return refreshSeatReservation(eventId, orderId || '');
4497
- case 34:
4498
- setStripeError(_error.message);
4573
+ case 37:
4499
4574
  handleSetLoading(false);
4500
4575
  return _context.abrupt("return");
4501
- case 37:
4576
+ case 39:
4502
4577
  onSubmit(null);
4503
- _context.next = 43;
4578
+ _context.next = 45;
4504
4579
  break;
4505
- case 40:
4506
- _context.prev = 40;
4507
- _context.t0 = _context["catch"](1);
4508
- onSubmit(_context.t0);
4509
- case 43:
4580
+ case 42:
4581
+ _context.prev = 42;
4582
+ _context.t1 = _context["catch"](1);
4583
+ onSubmit(_context.t1);
4584
+ case 45:
4510
4585
  case "end":
4511
4586
  return _context.stop();
4512
4587
  }
4513
- }, _callee, null, [[1, 40]]);
4588
+ }, _callee, null, [[1, 42]]);
4514
4589
  }));
4515
4590
  return function handleSubmit(_x) {
4516
4591
  return _ref2.apply(this, arguments);
@@ -4554,9 +4629,13 @@ var CheckoutForm = function CheckoutForm(_ref) {
4554
4629
  var buttonIsDiabled = !stripe || !!error || isLoading || !allowSubmit;
4555
4630
  return React__default.createElement("div", {
4556
4631
  className: "stripe_payment_container"
4557
- }, !!stripeError && React__default.createElement("div", {
4558
- className: "checkout_error_block"
4559
- }, stripeError), React__default.createElement("form", {
4632
+ }, !!stripeError && React__default.createElement(ConfirmModal, {
4633
+ hideCancelBtn: true,
4634
+ onConfirm: function onConfirm() {
4635
+ return onSubmit(stripeError);
4636
+ },
4637
+ message: stripeError == null ? void 0 : stripeError.message
4638
+ }), React__default.createElement("form", {
4560
4639
  onSubmit: handleSubmit
4561
4640
  }, React__default.createElement("div", {
4562
4641
  className: "card_form_inner"
@@ -4721,7 +4800,8 @@ var initialReviewValues = {
4721
4800
  stripe_payment_plan_enabled: false,
4722
4801
  stripe_payment_plan_configuration: {}
4723
4802
  },
4724
- billing_info: {}
4803
+ billing_info: {},
4804
+ flagSeatMapAllowed: false
4725
4805
  };
4726
4806
  var PaymentContainer = function PaymentContainer(_ref) {
4727
4807
  var _ref$paymentFields = _ref.paymentFields,
@@ -4930,7 +5010,7 @@ var PaymentContainer = function PaymentContainer(_ref) {
4930
5010
  // 3. redirect to confirmation page
4931
5011
  var handlePaymentMiddleWare = /*#__PURE__*/function () {
4932
5012
  var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(error, data) {
4933
- var order_hash, paymentSuccessResponse, _window;
5013
+ var order_hash, paymentSuccessResponse, _window, _window$dataLayer;
4934
5014
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
4935
5015
  while (1) switch (_context3.prev = _context3.next) {
4936
5016
  case 0:
@@ -4978,7 +5058,7 @@ var PaymentContainer = function PaymentContainer(_ref) {
4978
5058
  localStorage.removeItem('ownReservations');
4979
5059
  localStorage.removeItem('tierId');
4980
5060
  if (isBrowser) {
4981
- (_window = window) == null ? void 0 : _window.dataLayer.push({
5061
+ (_window = window) == null ? void 0 : (_window$dataLayer = _window.dataLayer) == null ? void 0 : _window$dataLayer.push({
4982
5062
  event: 'Purchase',
4983
5063
  orderValue: orderData.total,
4984
5064
  orderCurrency: orderData.currency,
@@ -4993,7 +5073,7 @@ var PaymentContainer = function PaymentContainer(_ref) {
4993
5073
  _context3.t0 = _context3["catch"](0);
4994
5074
  setError(_get(_context3.t0, 'response.data.message'));
4995
5075
  setPaymentIsLoading(false);
4996
- onPaymentError(_context3.t0.response);
5076
+ onPaymentError(_context3.t0.response || _context3.t0);
4997
5077
  case 27:
4998
5078
  case "end":
4999
5079
  return _context3.stop();
@@ -5167,6 +5247,7 @@ var PaymentContainer = function PaymentContainer(_ref) {
5167
5247
  options: elementsOptions
5168
5248
  }, React__default.createElement(CheckoutForm, {
5169
5249
  stripe_client_secret: paymentPlanIsAvailable && showPaymentPlanSection ? paymentPlanConfig.stripe_setup_intent_secret : _get(reviewData, 'payment_method.stripe_client_secret'),
5250
+ hasSeatMapActions: reviewData.flagSeatMapAllowed,
5170
5251
  total: orderData.guest_count ? orderData.pay_now : orderData.total,
5171
5252
  onSubmit: handlePaymentMiddleWare,
5172
5253
  error: error,
@@ -5793,50 +5874,6 @@ function useLocalStorageListener(key, callback) {
5793
5874
  return value;
5794
5875
  }
5795
5876
 
5796
- var style$4 = {
5797
- position: 'absolute',
5798
- top: '50%',
5799
- left: '50%',
5800
- transform: 'translate(-50%, -50%)',
5801
- minWidth: 480,
5802
- backgroundColor: '#e3e3e3',
5803
- border: '1px solid white',
5804
- outline: 'none',
5805
- padding: '14px',
5806
- maxHeight: '85vh',
5807
- overflow: 'auto'
5808
- };
5809
- var ConfirmModal = function ConfirmModal(_ref) {
5810
- var _ref$message = _ref.message,
5811
- message = _ref$message === void 0 ? '' : _ref$message,
5812
- _ref$loading = _ref.loading,
5813
- loading = _ref$loading === void 0 ? false : _ref$loading,
5814
- _ref$hideCancelBtn = _ref.hideCancelBtn,
5815
- hideCancelBtn = _ref$hideCancelBtn === void 0 ? false : _ref$hideCancelBtn,
5816
- _ref$onClose = _ref.onClose,
5817
- onClose = _ref$onClose === void 0 ? _identity : _ref$onClose,
5818
- _ref$onConfirm = _ref.onConfirm,
5819
- onConfirm = _ref$onConfirm === void 0 ? _identity : _ref$onConfirm;
5820
- return React__default.createElement(Modal$1, {
5821
- open: true,
5822
- onClose: onClose,
5823
- "aria-labelledby": "modal-modal-title",
5824
- "aria-describedby": "modal-modal-description",
5825
- className: "confirm-modal"
5826
- }, React__default.createElement(Box, {
5827
- style: style$4
5828
- }, React__default.createElement("p", null, message), React__default.createElement("div", {
5829
- className: "footer"
5830
- }, !hideCancelBtn && React__default.createElement(Button, {
5831
- onClick: onClose,
5832
- disabled: loading
5833
- }, "Cancel"), React__default.createElement(Button, {
5834
- onClick: onConfirm
5835
- }, loading ? React__default.createElement(CircularProgress, {
5836
- size: "22px"
5837
- }) : 'OK'))));
5838
- };
5839
-
5840
5877
  var isTimeExpired = function isTimeExpired(startDate, timezone) {
5841
5878
  return !moment(startDate).isAfter(moment.tz(moment(), timezone).format('YYYY-MM-DD HH:mm:ss'));
5842
5879
  };