tf-checkout-react 1.7.23 → 1.7.30

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.
@@ -1730,41 +1730,6 @@ var getConfirmationData = /*#__PURE__*/function () {
1730
1730
  return _ref4.apply(this, arguments);
1731
1731
  };
1732
1732
  }();
1733
- var getConditions = /*#__PURE__*/function () {
1734
- var _ref5 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(eventId) {
1735
- var response, adaptedData, returnData;
1736
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
1737
- while (1) switch (_context5.prev = _context5.next) {
1738
- case 0:
1739
- _context5.next = 2;
1740
- return publicRequest.get("v1/event/" + eventId + "/conditions");
1741
- case 2:
1742
- response = _context5.sent;
1743
- adaptedData = _map(response.data.data.attributes, function (item) {
1744
- return {
1745
- id: nanoid(),
1746
- text: item,
1747
- checked: false
1748
- };
1749
- });
1750
- returnData = _extends({}, response, {
1751
- data: _extends({}, response.data, {
1752
- data: _extends({}, response.data.data, {
1753
- attributes: adaptedData
1754
- })
1755
- })
1756
- });
1757
- return _context5.abrupt("return", returnData.data);
1758
- case 6:
1759
- case "end":
1760
- return _context5.stop();
1761
- }
1762
- }, _callee5);
1763
- }));
1764
- return function getConditions(_x5) {
1765
- return _ref5.apply(this, arguments);
1766
- };
1767
- }();
1768
1733
 
1769
1734
  var resaleTicket = /*#__PURE__*/function () {
1770
1735
  var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data, hash) {
@@ -5935,24 +5900,21 @@ var PaymentContainer = function PaymentContainer(_ref2) {
5935
5900
  var _useState5 = useState(true),
5936
5901
  paymentDataIsLoading = _useState5[0],
5937
5902
  setPaymentDataIsLoading = _useState5[1];
5938
- var _useState6 = useState([]),
5939
- conditions = _useState6[0],
5940
- setConditions = _useState6[1];
5941
- var _useState7 = useState(''),
5942
- currency = _useState7[0],
5943
- setCurrency = _useState7[1];
5903
+ var _useState6 = useState(''),
5904
+ currency = _useState6[0],
5905
+ setCurrency = _useState6[1];
5906
+ var _useState7 = useState(false),
5907
+ showPaymentPlanSection = _useState7[0],
5908
+ setShowPaymentPlanSection = _useState7[1];
5944
5909
  var _useState8 = useState(false),
5945
- showPaymentPlanSection = _useState8[0],
5946
- setShowPaymentPlanSection = _useState8[1];
5947
- var _useState9 = useState(false),
5948
- paymentPlanIsAvailable = _useState9[0],
5949
- setPaymentPlanIsAvailable = _useState9[1];
5950
- var _useState10 = useState(initialPaymentPlanConfiguration),
5951
- paymentPlanConfig = _useState10[0],
5952
- setPaymentPlanConfig = _useState10[1];
5953
- var _useState11 = useState(true),
5954
- paymentPlanUseSavedCard = _useState11[0],
5955
- setPaymentPlanUseSavedCard = _useState11[1];
5910
+ paymentPlanIsAvailable = _useState8[0],
5911
+ setPaymentPlanIsAvailable = _useState8[1];
5912
+ var _useState9 = useState(initialPaymentPlanConfiguration),
5913
+ paymentPlanConfig = _useState9[0],
5914
+ setPaymentPlanConfig = _useState9[1];
5915
+ var _useState10 = useState(true),
5916
+ paymentPlanUseSavedCard = _useState10[0],
5917
+ setPaymentPlanUseSavedCard = _useState10[1];
5956
5918
  var showFormTitle = Boolean(formTitle);
5957
5919
  var showErrorText = Boolean(errorText);
5958
5920
  var eventId = getQueryVariable('event_id') || _get(reviewData, 'cart[0].product_id') || '';
@@ -5966,9 +5928,6 @@ var PaymentContainer = function PaymentContainer(_ref2) {
5966
5928
  page: 'review',
5967
5929
  pageUrl: pageUrl
5968
5930
  });
5969
- console.log({
5970
- conditions: conditions
5971
- });
5972
5931
  useEffect(function () {
5973
5932
  var fetchPaymentData = /*#__PURE__*/function () {
5974
5933
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
@@ -6054,43 +6013,6 @@ var PaymentContainer = function PaymentContainer(_ref2) {
6054
6013
  fetchPaymentData();
6055
6014
  }
6056
6015
  }, [orderData, hash, isSinglePageCheckout, onGetPaymentDataError, onGetPaymentDataSuccess]);
6057
- //just once
6058
- useEffect(function () {
6059
- // fetch conditions data
6060
- var fetchConditions = /*#__PURE__*/function () {
6061
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
6062
- var conditionsResponse, conditionsInfo;
6063
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
6064
- while (1) switch (_context2.prev = _context2.next) {
6065
- case 0:
6066
- if (!eventId) {
6067
- _context2.next = 6;
6068
- break;
6069
- }
6070
- _context2.next = 3;
6071
- return getConditions(eventId);
6072
- case 3:
6073
- conditionsResponse = _context2.sent;
6074
- conditionsInfo = conditionsResponse.data.attributes;
6075
- setConditions(conditionsInfo ? conditionsInfo.map(function (item) {
6076
- return {
6077
- id: nanoid(),
6078
- text: item.text,
6079
- checked: false
6080
- };
6081
- }) : []);
6082
- case 6:
6083
- case "end":
6084
- return _context2.stop();
6085
- }
6086
- }, _callee2);
6087
- }));
6088
- return function fetchConditions() {
6089
- return _ref4.apply(this, arguments);
6090
- };
6091
- }();
6092
- fetchConditions();
6093
- }, [eventId]);
6094
6016
  var showPaymentForm = function showPaymentForm() {
6095
6017
  var _paymentPlanConfig$sa;
6096
6018
  if (hidePaymentForm) {
@@ -6147,10 +6069,6 @@ var PaymentContainer = function PaymentContainer(_ref2) {
6147
6069
  var isTable = orderData == null ? void 0 : orderData.guest_count;
6148
6070
  useEffect(function () {
6149
6071
  var paymentMethod = reviewData.payment_method || {};
6150
- console.log({
6151
- paymentMethod: paymentMethod,
6152
- enablePaymentPlan: enablePaymentPlan
6153
- });
6154
6072
  var paymentPlanAvailable = paymentMethod.stripe_payment_plan_enabled && enablePaymentPlan;
6155
6073
  setPaymentPlanIsAvailable(paymentPlanAvailable);
6156
6074
  if (paymentPlanAvailable) {
@@ -6513,38 +6431,36 @@ var usePaymentRedirect = function usePaymentRedirect(_ref) {
6513
6431
  isPaymentReturn = urlParams.get('payment_return');
6514
6432
  clientSecret = urlParams.get('payment_intent_client_secret');
6515
6433
  if (!(isPaymentReturn && clientSecret && stripeRef.current)) {
6516
- _context.next = 41;
6434
+ _context.next = 39;
6517
6435
  break;
6518
6436
  }
6519
- console.log('Detected payment redirect return, checking status');
6520
6437
  setLoading(true);
6521
- _context.prev = 6;
6438
+ _context.prev = 5;
6522
6439
  // Get stored payment context
6523
6440
  storedContext = localStorage.getItem('stripe_payment_context');
6524
6441
  if (storedContext) {
6525
- _context.next = 12;
6442
+ _context.next = 11;
6526
6443
  break;
6527
6444
  }
6528
6445
  setError('Payment context not found');
6529
6446
  setLoading(false);
6530
6447
  return _context.abrupt("return");
6531
- case 12:
6448
+ case 11:
6532
6449
  paymentContext = JSON.parse(storedContext);
6533
- _context.next = 15;
6450
+ _context.next = 14;
6534
6451
  return stripeRef.current.retrievePaymentIntent(clientSecret);
6535
- case 15:
6452
+ case 14:
6536
6453
  _yield$stripeRef$curr = _context.sent;
6537
6454
  paymentIntent = _yield$stripeRef$curr.paymentIntent;
6538
6455
  if (!((paymentIntent == null ? void 0 : paymentIntent.status) === 'succeeded')) {
6539
- _context.next = 29;
6456
+ _context.next = 27;
6540
6457
  break;
6541
6458
  }
6542
- console.log('Payment succeeded after redirect, continuing flow');
6543
6459
  // Clean up stored context
6544
6460
  localStorage.removeItem('stripe_payment_context');
6545
6461
  // Continue with the success flow using stored context
6546
6462
  paymentResponse = null;
6547
- _context.next = 23;
6463
+ _context.next = 21;
6548
6464
  return handlePaymentMiddleWare(null, {}, {
6549
6465
  reviewData: paymentContext.attributes,
6550
6466
  isFreeTickets: paymentContext.isFreeTickets,
@@ -6562,16 +6478,16 @@ var usePaymentRedirect = function usePaymentRedirect(_ref) {
6562
6478
  throw error;
6563
6479
  }
6564
6480
  });
6565
- case 23:
6481
+ case 21:
6566
6482
  // Complete the flow with cleanup and handleSubmit
6567
6483
  removeReferralKey();
6568
6484
  removeAdditionalConfigs();
6569
6485
  handleSubmit(paymentContext.values, paymentContext.formikHelpers, paymentContext.eventId, paymentContext.checkoutResponse, paymentContext.checkoutUpdateResponse, paymentResponse);
6570
6486
  // Clean URL parameters
6571
6487
  window.history.replaceState({}, document.title, window.location.pathname);
6572
- _context.next = 30;
6488
+ _context.next = 28;
6573
6489
  break;
6574
- case 29:
6490
+ case 27:
6575
6491
  if ((paymentIntent == null ? void 0 : paymentIntent.status) === 'requires_action') {
6576
6492
  setError('Payment requires additional action');
6577
6493
  // Clean up stored context and URL to prevent infinite loop
@@ -6583,26 +6499,26 @@ var usePaymentRedirect = function usePaymentRedirect(_ref) {
6583
6499
  localStorage.removeItem('stripe_payment_context');
6584
6500
  window.history.replaceState({}, document.title, window.location.pathname);
6585
6501
  }
6586
- case 30:
6587
- _context.next = 38;
6502
+ case 28:
6503
+ _context.next = 36;
6588
6504
  break;
6589
- case 32:
6590
- _context.prev = 32;
6591
- _context.t0 = _context["catch"](6);
6505
+ case 30:
6506
+ _context.prev = 30;
6507
+ _context.t0 = _context["catch"](5);
6592
6508
  console.error('Error handling payment return:', _context.t0);
6593
6509
  setError('Error processing payment return');
6594
6510
  // Clean up stored context and URL to prevent infinite loop
6595
6511
  localStorage.removeItem('stripe_payment_context');
6596
6512
  window.history.replaceState({}, document.title, window.location.pathname);
6597
- case 38:
6598
- _context.prev = 38;
6513
+ case 36:
6514
+ _context.prev = 36;
6599
6515
  setLoading(false);
6600
- return _context.finish(38);
6601
- case 41:
6516
+ return _context.finish(36);
6517
+ case 39:
6602
6518
  case "end":
6603
6519
  return _context.stop();
6604
6520
  }
6605
- }, _callee, null, [[6, 32, 38, 41]]);
6521
+ }, _callee, null, [[5, 30, 36, 39]]);
6606
6522
  }));
6607
6523
  return function handlePaymentReturn() {
6608
6524
  return _ref2.apply(this, arguments);
@@ -6938,7 +6854,7 @@ var EmailExistenceChecker = function EmailExistenceChecker(_ref4) {
6938
6854
  return null;
6939
6855
  };
6940
6856
  var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref6) {
6941
- var _reviewData$payment_m, _checkoutUpdateData$a, _checkoutUpdateData$a2, _reviewData$payment_m2, _checkoutUpdateData$a3, _checkoutUpdateData$a4, _checkoutUpdateData$a5;
6857
+ var _configs$addon_max_qu, _reviewData$payment_m, _checkoutUpdateData$a, _checkoutUpdateData$a2, _reviewData$payment_m2, _checkoutUpdateData$a3, _checkoutUpdateData$a4, _checkoutUpdateData$a5;
6942
6858
  var _ref6$data = _ref6.data,
6943
6859
  data = _ref6$data === void 0 ? [] : _ref6$data,
6944
6860
  _ref6$ticketHoldersFi = _ref6.ticketHoldersFields,
@@ -7174,6 +7090,7 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref6) {
7174
7090
  var collectMandatoryBusinessCategory = configs == null ? void 0 : configs.collect_mandatory_business_category;
7175
7091
  var collectOptionalBusinessCategory = configs == null ? void 0 : configs.collect_optional_business_category;
7176
7092
  var eventHasAddons = configs == null ? void 0 : configs.has_add_on;
7093
+ var addonMaxQuantityGroups = (_configs$addon_max_qu = configs == null ? void 0 : configs.addon_max_quantity_groups) != null ? _configs$addon_max_qu : undefined;
7177
7094
  var hideBusinessCategoryField = !collectMandatoryBusinessCategory && !collectOptionalBusinessCategory;
7178
7095
  var _useState21 = useState(),
7179
7096
  pendingVerificationMessage = _useState21[0],
@@ -7384,7 +7301,6 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref6) {
7384
7301
  });
7385
7302
  case 5:
7386
7303
  checkoutUpdateResponse = _context6.sent;
7387
- console.log('Stripe in [useEffect] fetchCheckoutUpdate', checkoutUpdateResponse);
7388
7304
  if (checkoutUpdateResponse.success) {
7389
7305
  checkoutAttributes = checkoutUpdateResponse.data.attributes;
7390
7306
  cartPriceBreakdown = _get(checkoutAttributes, 'cart_price_breakdown', {});
@@ -7392,23 +7308,22 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref6) {
7392
7308
  hash: '',
7393
7309
  total: _get(cartPriceBreakdown, 'total', 0)
7394
7310
  }));
7395
- console.log('Stripe in [useEffect] fetchCheckoutUpdate | checkoutAttributes', checkoutAttributes);
7396
7311
  setCheckoutUpdateData(checkoutAttributes);
7397
7312
  onCheckoutUpdateSuccess(_extends({
7398
7313
  expires_at: expirationTime
7399
7314
  }, cartPriceBreakdown));
7400
7315
  }
7401
- _context6.next = 13;
7316
+ _context6.next = 12;
7402
7317
  break;
7403
- case 10:
7404
- _context6.prev = 10;
7318
+ case 9:
7319
+ _context6.prev = 9;
7405
7320
  _context6.t0 = _context6["catch"](2);
7406
7321
  console.error('Failed to fetch checkout update:', _context6.t0);
7407
- case 13:
7322
+ case 12:
7408
7323
  case "end":
7409
7324
  return _context6.stop();
7410
7325
  }
7411
- }, _callee6, null, [[2, 10]]);
7326
+ }, _callee6, null, [[2, 9]]);
7412
7327
  }));
7413
7328
  return function fetchCheckoutUpdate() {
7414
7329
  return _ref10.apply(this, arguments);
@@ -7654,9 +7569,6 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref6) {
7654
7569
  return _ref12.apply(this, arguments);
7655
7570
  };
7656
7571
  }(), [eventId, isSinglePageCheckout, onCheckoutUpdateError, onCheckoutUpdateSuccess]);
7657
- console.log({
7658
- checkoutData: checkoutData
7659
- });
7660
7572
  var handleAddOnSelect = useCallback( /*#__PURE__*/function () {
7661
7573
  var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(selectedAddOns) {
7662
7574
  return _regeneratorRuntime().wrap(function _callee9$(_context9) {
@@ -7756,7 +7668,7 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref6) {
7756
7668
  enableReinitialize: false,
7757
7669
  onSubmit: function () {
7758
7670
  var _onSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(values, formikHelpers) {
7759
- var _checkoutBody$attribu2, _checkoutBody$attribu3, flagRequirePhoneLocal, holdersCount, hasHolderPhoneError, i, fieldName, value, userDataObj, profileData, profileSpecifiedData, checkoutBody, storedAddOnDataCapture, checkoutResponse, checkoutUpdateResponse, paymentResponse, _checkoutResponse$dat, hash, total, paymentDataResponse, _cart$, attributes, order_details, cart, _order_details$ticket, ticket, updatedOrderData, isFreeTickets, paymentMethod, paymentPlanAvailable, hasUnverifiedOrder, message, _e$response, event;
7671
+ var _checkoutBody$attribu2, _checkoutBody$attribu3, flagRequirePhoneLocal, holdersCount, hasHolderPhoneError, i, fieldName, value, userDataObj, profileData, profileSpecifiedData, checkoutBody, storedAddOnDataCapture, checkoutResponse, checkoutUpdateResponse, paymentResponse, _checkoutResponse$dat, hash, total, paymentDataResponse, _cart$, attributes, order_details, cart, _order_details$ticket, ticket, updatedOrderData, isFreeTickets, hasUnverifiedOrder, message, _e$response, event;
7760
7672
  return _regeneratorRuntime().wrap(function _callee10$(_context10) {
7761
7673
  while (1) switch (_context10.prev = _context10.next) {
7762
7674
  case 0:
@@ -7867,11 +7779,10 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref6) {
7867
7779
  });
7868
7780
  case 38:
7869
7781
  checkoutUpdateResponse = _context10.sent;
7870
- console.log('Stripe checkoutUpdateResponse in billing-info-container', checkoutUpdateResponse);
7871
7782
  setCheckoutUpdateData(checkoutUpdateResponse.data.attributes);
7872
7783
  paymentResponse = null;
7873
7784
  if (!isSinglePageCheckout) {
7874
- _context10.next = 64;
7785
+ _context10.next = 59;
7875
7786
  break;
7876
7787
  }
7877
7788
  _checkoutResponse$dat = checkoutResponse.data.attributes, hash = _checkoutResponse$dat.hash, total = _checkoutResponse$dat.total;
@@ -7879,16 +7790,15 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref6) {
7879
7790
  hash: hash,
7880
7791
  total: total
7881
7792
  }));
7882
- _context10.next = 47;
7793
+ _context10.next = 46;
7883
7794
  return getPaymentData(String(hash));
7884
- case 47:
7795
+ case 46:
7885
7796
  paymentDataResponse = _context10.sent;
7886
7797
  if (!paymentDataResponse.success) {
7887
- _context10.next = 64;
7798
+ _context10.next = 59;
7888
7799
  break;
7889
7800
  }
7890
7801
  attributes = paymentDataResponse.data.attributes;
7891
- console.log('Stripe confirmPayment success in billing-info-container');
7892
7802
  setReviewData(attributes);
7893
7803
  order_details = attributes.order_details, cart = attributes.cart;
7894
7804
  _order_details$ticket = order_details.tickets, ticket = _order_details$ticket[0];
@@ -7908,35 +7818,29 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref6) {
7908
7818
  debt: (order_details == null ? void 0 : order_details.debt) || null,
7909
7819
  cost: ticket == null ? void 0 : ticket.cost
7910
7820
  };
7911
- isFreeTickets = !Number(total) && !Number(updatedOrderData.total) || !Number((updatedOrderData == null ? void 0 : updatedOrderData.pay_now) || 0);
7912
- paymentMethod = attributes.payment_method || {};
7913
- paymentPlanAvailable = paymentMethod.stripe_payment_plan_enabled;
7914
- console.log({
7915
- paymentPlanAvailable: paymentPlanAvailable
7916
- });
7917
- // Process payment using the hook
7918
- _context10.next = 61;
7821
+ isFreeTickets = !Number(total) && !Number(updatedOrderData.total) || !Number((updatedOrderData == null ? void 0 : updatedOrderData.pay_now) || 0); // Process payment using the hook
7822
+ _context10.next = 56;
7919
7823
  return processPayment(paymentDataResponse, values, formikHelpers, checkoutResponse, checkoutUpdateResponse, {
7920
7824
  attributes: attributes,
7921
7825
  isFreeTickets: isFreeTickets,
7922
7826
  updatedOrderData: updatedOrderData,
7923
7827
  eventId: eventId
7924
7828
  });
7925
- case 61:
7829
+ case 56:
7926
7830
  paymentResponse = _context10.sent;
7927
7831
  if (!(!paymentResponse && !isFreeTickets)) {
7928
- _context10.next = 64;
7832
+ _context10.next = 59;
7929
7833
  break;
7930
7834
  }
7931
7835
  return _context10.abrupt("return");
7932
- case 64:
7836
+ case 59:
7933
7837
  removeReferralKey();
7934
7838
  removeAdditionalConfigs();
7935
7839
  handleSubmit(values, formikHelpers, eventId, checkoutResponse, checkoutUpdateResponse, paymentResponse);
7936
- _context10.next = 77;
7840
+ _context10.next = 72;
7937
7841
  break;
7938
- case 69:
7939
- _context10.prev = 69;
7842
+ case 64:
7843
+ _context10.prev = 64;
7940
7844
  _context10.t1 = _context10["catch"](0);
7941
7845
  setLoading(false);
7942
7846
  onSubmitError(_context10.t1);
@@ -7965,15 +7869,15 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref6) {
7965
7869
  }
7966
7870
  // Keep form values intact - don't reset
7967
7871
  formikHelpers.setSubmitting(false);
7968
- case 77:
7969
- _context10.prev = 77;
7872
+ case 72:
7873
+ _context10.prev = 72;
7970
7874
  setLoading(false);
7971
- return _context10.finish(77);
7972
- case 80:
7875
+ return _context10.finish(72);
7876
+ case 75:
7973
7877
  case "end":
7974
7878
  return _context10.stop();
7975
7879
  }
7976
- }, _callee10, null, [[0, 69, 77, 80], [15, 23]]);
7880
+ }, _callee10, null, [[0, 64, 72, 75], [15, 23]]);
7977
7881
  }));
7978
7882
  function onSubmit(_x3, _x4) {
7979
7883
  return _onSubmit.apply(this, arguments);
@@ -8036,7 +7940,8 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref6) {
8036
7940
  eventId: eventId,
8037
7941
  addOnDataWithCustomFields: addOnDataWithCustomFields,
8038
7942
  configs: configs,
8039
- onAddOnSelect: onAddOnSelect
7943
+ onAddOnSelect: onAddOnSelect,
7944
+ addonMaxQuantityGroups: addonMaxQuantityGroups
8040
7945
  })) : !addOnsIncludedOnInvitation && includeAddons && !isSinglePageCheckout ? React.createElement(AddonsContainter, Object.assign({}, addonsProps != null ? addonsProps : {}, {
8041
7946
  addOnDataWithCustomFields: addOnDataWithCustomFields,
8042
7947
  configs: configs,
@@ -13986,7 +13891,6 @@ var RegistrationForm = function RegistrationForm(_ref) {
13986
13891
  _context3.prev = 25;
13987
13892
  _context3.t0 = _context3["catch"](1);
13988
13893
  if (axios.isAxiosError(_context3.t0)) {
13989
- console.log(_context3.t0);
13990
13894
  _errorMessage3 = _get(_context3.t0, 'response.data.message') || 'Error';
13991
13895
  onRegisterAccountError(_context3.t0);
13992
13896
  setshowErrorModal(true);