tf-checkout-react 1.7.20 → 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.
- package/dist/api/index.d.ts +1 -0
- package/dist/components/addonsContainer/AddonComponent.d.ts +3 -1
- package/dist/components/addonsContainer/SimpleAddonsContainer.d.ts +3 -1
- package/dist/components/addonsContainer/index.d.ts +1 -0
- package/dist/tf-checkout-react.cjs.development.js +133 -174
- 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 +133 -174
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/dist/types/checkoutPageConfigs.d.ts +1 -0
- package/package.json +1 -1
- package/src/api/index.ts +1 -0
- package/src/components/addonsContainer/AddonComponent.tsx +20 -4
- package/src/components/addonsContainer/SimpleAddonsContainer.tsx +39 -5
- package/src/components/addonsContainer/index.tsx +1 -0
- package/src/components/billing-info-container/hooks/usePaymentRedirect.ts +0 -2
- package/src/components/billing-info-container/index.tsx +2 -16
- package/src/components/paymentContainer/index.tsx +1 -29
- package/src/components/registerForm/index.tsx +0 -1
- package/src/types/checkoutPageConfigs.ts +1 -0
package/dist/api/index.d.ts
CHANGED
|
@@ -10,7 +10,9 @@ interface IAddonComponentProps {
|
|
|
10
10
|
errors: any;
|
|
11
11
|
useStepperQty?: boolean;
|
|
12
12
|
siblingIds?: string[];
|
|
13
|
+
allAddonIds?: string[];
|
|
14
|
+
maxTotalQuantity?: number;
|
|
13
15
|
onCustomFieldChange?: (addon: any, groupId: string | number, fieldName: string, value: any) => void;
|
|
14
16
|
}
|
|
15
|
-
declare const AddonComponent: ({ classNamePrefix, data, selectOptions, handleAddonChange, addOnDataWithCustomFields, configs, values, errors, useStepperQty, siblingIds, onCustomFieldChange, }: IAddonComponentProps) => JSX.Element;
|
|
17
|
+
declare const AddonComponent: ({ classNamePrefix, data, selectOptions, handleAddonChange, addOnDataWithCustomFields, configs, values, errors, useStepperQty, siblingIds, allAddonIds, maxTotalQuantity, onCustomFieldChange, }: IAddonComponentProps) => JSX.Element;
|
|
16
18
|
export default AddonComponent;
|
|
@@ -8,11 +8,13 @@ export interface ISimpleAddonContainerProps {
|
|
|
8
8
|
configs: any;
|
|
9
9
|
eventId: string;
|
|
10
10
|
useStepperQty?: boolean;
|
|
11
|
+
maxTotalQuantity?: number;
|
|
12
|
+
addonMaxQuantityGroups?: number;
|
|
11
13
|
onAddOnSelect?: (id: string, value: string, addon: any, fieldUpdates: any) => void;
|
|
12
14
|
handleConfirm?: (values: any) => void;
|
|
13
15
|
}
|
|
14
16
|
export interface ObjectLiteral {
|
|
15
17
|
[key: string]: any;
|
|
16
18
|
}
|
|
17
|
-
export declare const SimpleAddonsContainer: ({ classNamePrefix, onGetAddonsPageInfoSuccess, onGetAddonsPageInfoError, descriptionTrigger, addOnDataWithCustomFields, configs, eventId, useStepperQty, onAddOnSelect, handleConfirm, }: ISimpleAddonContainerProps) => JSX.Element;
|
|
19
|
+
export declare const SimpleAddonsContainer: ({ classNamePrefix, onGetAddonsPageInfoSuccess, onGetAddonsPageInfoError, descriptionTrigger, addOnDataWithCustomFields, configs, eventId, useStepperQty, addonMaxQuantityGroups, onAddOnSelect, handleConfirm, }: ISimpleAddonContainerProps) => JSX.Element;
|
|
18
20
|
export default SimpleAddonsContainer;
|
|
@@ -17,5 +17,6 @@ export interface IAddonContainterProps {
|
|
|
17
17
|
configs: any;
|
|
18
18
|
onAddOnSelect?: (id: string, value: string, addon: any) => void;
|
|
19
19
|
useStepperQty?: boolean;
|
|
20
|
+
addonMaxQuantityGroups?: number;
|
|
20
21
|
}
|
|
21
22
|
export declare const AddonsContainter: ({ classNamePrefix, enableBillingInfoAutoCreate, enableTimer, onGetAddonsPageInfoSuccess, onGetAddonsPageInfoError, onPostCheckoutSuccess, onPostCheckoutError, onConfirmSelectionSuccess, onConfirmSelectionError, onCountdownFinish, onPendingVerification, samePage, descriptionTrigger, addOnDataWithCustomFields, configs, onAddOnSelect, useStepperQty, }: IAddonContainterProps) => JSX.Element | null;
|
|
@@ -1737,41 +1737,6 @@ var getConfirmationData = /*#__PURE__*/function () {
|
|
|
1737
1737
|
return _ref4.apply(this, arguments);
|
|
1738
1738
|
};
|
|
1739
1739
|
}();
|
|
1740
|
-
var getConditions = /*#__PURE__*/function () {
|
|
1741
|
-
var _ref5 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(eventId) {
|
|
1742
|
-
var response, adaptedData, returnData;
|
|
1743
|
-
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
1744
|
-
while (1) switch (_context5.prev = _context5.next) {
|
|
1745
|
-
case 0:
|
|
1746
|
-
_context5.next = 2;
|
|
1747
|
-
return publicRequest.get("v1/event/" + eventId + "/conditions");
|
|
1748
|
-
case 2:
|
|
1749
|
-
response = _context5.sent;
|
|
1750
|
-
adaptedData = _map(response.data.data.attributes, function (item) {
|
|
1751
|
-
return {
|
|
1752
|
-
id: nanoid.nanoid(),
|
|
1753
|
-
text: item,
|
|
1754
|
-
checked: false
|
|
1755
|
-
};
|
|
1756
|
-
});
|
|
1757
|
-
returnData = _extends({}, response, {
|
|
1758
|
-
data: _extends({}, response.data, {
|
|
1759
|
-
data: _extends({}, response.data.data, {
|
|
1760
|
-
attributes: adaptedData
|
|
1761
|
-
})
|
|
1762
|
-
})
|
|
1763
|
-
});
|
|
1764
|
-
return _context5.abrupt("return", returnData.data);
|
|
1765
|
-
case 6:
|
|
1766
|
-
case "end":
|
|
1767
|
-
return _context5.stop();
|
|
1768
|
-
}
|
|
1769
|
-
}, _callee5);
|
|
1770
|
-
}));
|
|
1771
|
-
return function getConditions(_x5) {
|
|
1772
|
-
return _ref5.apply(this, arguments);
|
|
1773
|
-
};
|
|
1774
|
-
}();
|
|
1775
1740
|
|
|
1776
1741
|
var resaleTicket = /*#__PURE__*/function () {
|
|
1777
1742
|
var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data, hash) {
|
|
@@ -3612,21 +3577,35 @@ var AddonStepper = function AddonStepper(_ref) {
|
|
|
3612
3577
|
handleAddonChange = _ref.handleAddonChange,
|
|
3613
3578
|
classNamePrefix = _ref.classNamePrefix,
|
|
3614
3579
|
_ref$siblingIds = _ref.siblingIds,
|
|
3615
|
-
siblingIds = _ref$siblingIds === void 0 ? [] : _ref$siblingIds
|
|
3580
|
+
siblingIds = _ref$siblingIds === void 0 ? [] : _ref$siblingIds,
|
|
3581
|
+
_ref$allAddonIds = _ref.allAddonIds,
|
|
3582
|
+
allAddonIds = _ref$allAddonIds === void 0 ? [] : _ref$allAddonIds,
|
|
3583
|
+
maxTotalQuantity = _ref.maxTotalQuantity;
|
|
3616
3584
|
var _useFormikContext = formik.useFormikContext(),
|
|
3617
3585
|
values = _useFormikContext.values,
|
|
3618
3586
|
setFieldValue = _useFormikContext.setFieldValue;
|
|
3619
3587
|
var qty = Number((_values$id = values[id]) != null ? _values$id : 0);
|
|
3620
3588
|
var max = (selectOptions == null ? void 0 : selectOptions.length) > 0 ? selectOptions[selectOptions.length - 1].value : 0;
|
|
3589
|
+
var totalSelected = allAddonIds.length > 0 ? allAddonIds.reduce(function (sum, aid) {
|
|
3590
|
+
var _values$aid;
|
|
3591
|
+
return sum + Number((_values$aid = values[aid]) != null ? _values$aid : 0);
|
|
3592
|
+
}, 0) : 0;
|
|
3621
3593
|
var change = function change(next) {
|
|
3622
|
-
if (next >
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3594
|
+
if (next > qty) {
|
|
3595
|
+
if (maxTotalQuantity != null) {
|
|
3596
|
+
allAddonIds.forEach(function (aid) {
|
|
3597
|
+
if (aid !== id) setFieldValue(aid, 0);
|
|
3598
|
+
});
|
|
3599
|
+
} else {
|
|
3600
|
+
siblingIds.forEach(function (siblingId) {
|
|
3601
|
+
return setFieldValue(siblingId, 0);
|
|
3602
|
+
});
|
|
3603
|
+
}
|
|
3626
3604
|
}
|
|
3627
3605
|
setFieldValue(id, next);
|
|
3628
3606
|
handleAddonChange(id, next);
|
|
3629
3607
|
};
|
|
3608
|
+
var incrementDisabled = qty >= max || maxTotalQuantity != null && totalSelected >= maxTotalQuantity && qty === 0;
|
|
3630
3609
|
return React__default.createElement("div", {
|
|
3631
3610
|
className: classNamePrefix + "_stepper"
|
|
3632
3611
|
}, React__default.createElement("button", {
|
|
@@ -3645,7 +3624,7 @@ var AddonStepper = function AddonStepper(_ref) {
|
|
|
3645
3624
|
onClick: function onClick() {
|
|
3646
3625
|
return change(qty + 1);
|
|
3647
3626
|
},
|
|
3648
|
-
disabled:
|
|
3627
|
+
disabled: incrementDisabled,
|
|
3649
3628
|
"aria-label": "Increase quantity"
|
|
3650
3629
|
}, "+"));
|
|
3651
3630
|
};
|
|
@@ -3664,6 +3643,9 @@ var AddonComponent = function AddonComponent(_ref2) {
|
|
|
3664
3643
|
useStepperQty = _ref2$useStepperQty === void 0 ? false : _ref2$useStepperQty,
|
|
3665
3644
|
_ref2$siblingIds = _ref2.siblingIds,
|
|
3666
3645
|
siblingIds = _ref2$siblingIds === void 0 ? [] : _ref2$siblingIds,
|
|
3646
|
+
_ref2$allAddonIds = _ref2.allAddonIds,
|
|
3647
|
+
allAddonIds = _ref2$allAddonIds === void 0 ? [] : _ref2$allAddonIds,
|
|
3648
|
+
maxTotalQuantity = _ref2.maxTotalQuantity,
|
|
3667
3649
|
_ref2$onCustomFieldCh = _ref2.onCustomFieldChange,
|
|
3668
3650
|
onCustomFieldChange = _ref2$onCustomFieldCh === void 0 ? _identity : _ref2$onCustomFieldCh;
|
|
3669
3651
|
var id = data.id,
|
|
@@ -3697,7 +3679,9 @@ var AddonComponent = function AddonComponent(_ref2) {
|
|
|
3697
3679
|
selectOptions: selectOptions,
|
|
3698
3680
|
handleAddonChange: handleAddonChange,
|
|
3699
3681
|
classNamePrefix: classNamePrefix,
|
|
3700
|
-
siblingIds: siblingIds
|
|
3682
|
+
siblingIds: siblingIds,
|
|
3683
|
+
allAddonIds: allAddonIds,
|
|
3684
|
+
maxTotalQuantity: maxTotalQuantity
|
|
3701
3685
|
})) : React__default.createElement(formik.Field, {
|
|
3702
3686
|
name: id,
|
|
3703
3687
|
selectOptions: selectOptions,
|
|
@@ -4485,6 +4469,7 @@ var SimpleAddonsContainer = function SimpleAddonsContainer(_ref) {
|
|
|
4485
4469
|
eventId = _ref.eventId,
|
|
4486
4470
|
_ref$useStepperQty = _ref.useStepperQty,
|
|
4487
4471
|
useStepperQty = _ref$useStepperQty === void 0 ? false : _ref$useStepperQty,
|
|
4472
|
+
addonMaxQuantityGroups = _ref.addonMaxQuantityGroups,
|
|
4488
4473
|
_ref$onAddOnSelect = _ref.onAddOnSelect,
|
|
4489
4474
|
onAddOnSelect = _ref$onAddOnSelect === void 0 ? _identity : _ref$onAddOnSelect,
|
|
4490
4475
|
_ref$handleConfirm = _ref.handleConfirm,
|
|
@@ -4501,12 +4486,15 @@ var SimpleAddonsContainer = function SimpleAddonsContainer(_ref) {
|
|
|
4501
4486
|
var _useState4 = React.useState({}),
|
|
4502
4487
|
groupsWithInitialVariantsValues = _useState4[0],
|
|
4503
4488
|
setGroupsWithInitialVariantsValues = _useState4[1];
|
|
4504
|
-
var _useState5 = React.useState(
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
var _useState6 = React.useState(
|
|
4508
|
-
|
|
4509
|
-
|
|
4489
|
+
var _useState5 = React.useState({}),
|
|
4490
|
+
crossGroupSelections = _useState5[0],
|
|
4491
|
+
setCrossGroupSelections = _useState5[1];
|
|
4492
|
+
var _useState6 = React.useState(true),
|
|
4493
|
+
loading = _useState6[0],
|
|
4494
|
+
setLoading = _useState6[1];
|
|
4495
|
+
var _useState7 = React.useState(null),
|
|
4496
|
+
visibleDescription = _useState7[0],
|
|
4497
|
+
setVisibleDescription = _useState7[1];
|
|
4510
4498
|
var handleDescriptionToggle = function handleDescriptionToggle(ticketId) {
|
|
4511
4499
|
setVisibleDescription(function (current) {
|
|
4512
4500
|
return current === ticketId ? null : ticketId;
|
|
@@ -4635,6 +4623,37 @@ var SimpleAddonsContainer = function SimpleAddonsContainer(_ref) {
|
|
|
4635
4623
|
recreateGroupVariantsSelectOptions(currGroupId, updatedGroupsWithSelectedVariants[currGroupId]);
|
|
4636
4624
|
}
|
|
4637
4625
|
};
|
|
4626
|
+
// Cross-group cap: when addonMaxQuantityGroups is set, limits total selections
|
|
4627
|
+
// across ALL addon groups to that number by capping each stepper's max.
|
|
4628
|
+
var effectiveAddonsOptions = React.useMemo(function () {
|
|
4629
|
+
if (!addonMaxQuantityGroups) return addonsOptions;
|
|
4630
|
+
var totalSelected = Object.values(crossGroupSelections).reduce(function (sum, v) {
|
|
4631
|
+
return sum + Number(v);
|
|
4632
|
+
}, 0);
|
|
4633
|
+
var globalRemaining = addonMaxQuantityGroups - totalSelected;
|
|
4634
|
+
var result = {};
|
|
4635
|
+
var _loop = function _loop() {
|
|
4636
|
+
var opts = addonsOptions[id] || [];
|
|
4637
|
+
var sdkMax = opts.length ? opts[opts.length - 1].value : 0;
|
|
4638
|
+
var currSelected = Number(crossGroupSelections[id] || 0);
|
|
4639
|
+
var allowedMax = Math.max(0, Math.min(sdkMax, globalRemaining + currSelected));
|
|
4640
|
+
result[id] = opts.filter(function (opt) {
|
|
4641
|
+
return opt.value <= allowedMax;
|
|
4642
|
+
});
|
|
4643
|
+
};
|
|
4644
|
+
for (var id in addonsOptions) {
|
|
4645
|
+
_loop();
|
|
4646
|
+
}
|
|
4647
|
+
return result;
|
|
4648
|
+
}, [addonsOptions, crossGroupSelections, addonMaxQuantityGroups]);
|
|
4649
|
+
var handleCrossGroupChange = function handleCrossGroupChange(id, value) {
|
|
4650
|
+
if (addonMaxQuantityGroups) {
|
|
4651
|
+
setCrossGroupSelections(function (prev) {
|
|
4652
|
+
var _extends6;
|
|
4653
|
+
return _extends({}, prev, (_extends6 = {}, _extends6[id] = Number(value), _extends6));
|
|
4654
|
+
});
|
|
4655
|
+
}
|
|
4656
|
+
};
|
|
4638
4657
|
var initialValues = React.useMemo(function () {
|
|
4639
4658
|
var _addOnDataWithCustomF2;
|
|
4640
4659
|
var addOnsData = {};
|
|
@@ -4744,7 +4763,7 @@ var SimpleAddonsContainer = function SimpleAddonsContainer(_ref) {
|
|
|
4744
4763
|
React__default.createElement(AddonComponent, {
|
|
4745
4764
|
key: variant.id,
|
|
4746
4765
|
data: variant,
|
|
4747
|
-
selectOptions:
|
|
4766
|
+
selectOptions: effectiveAddonsOptions[variant.id],
|
|
4748
4767
|
classNamePrefix: classNamePrefix,
|
|
4749
4768
|
siblingIds: addon.variants.filter(function (v) {
|
|
4750
4769
|
return v.id !== variant.id;
|
|
@@ -4752,7 +4771,7 @@ var SimpleAddonsContainer = function SimpleAddonsContainer(_ref) {
|
|
|
4752
4771
|
return v.id;
|
|
4753
4772
|
}),
|
|
4754
4773
|
handleAddonChange: function handleAddonChange(id, value) {
|
|
4755
|
-
|
|
4774
|
+
handleCrossGroupChange(id, value);
|
|
4756
4775
|
onFieldChange(id, value, addon);
|
|
4757
4776
|
var fieldUpdates = collectAddonFieldUpdates(addon, values);
|
|
4758
4777
|
onAddOnSelect(id, value, addon, fieldUpdates);
|
|
@@ -4770,9 +4789,10 @@ var SimpleAddonsContainer = function SimpleAddonsContainer(_ref) {
|
|
|
4770
4789
|
React__default.createElement(AddonComponent, {
|
|
4771
4790
|
key: addon.id,
|
|
4772
4791
|
data: addon,
|
|
4773
|
-
selectOptions:
|
|
4792
|
+
selectOptions: effectiveAddonsOptions[addon.id],
|
|
4774
4793
|
classNamePrefix: classNamePrefix,
|
|
4775
4794
|
handleAddonChange: function handleAddonChange(id, value) {
|
|
4795
|
+
handleCrossGroupChange(id, value);
|
|
4776
4796
|
onFieldChange(id, value, addon);
|
|
4777
4797
|
var fieldUpdates = collectAddonFieldUpdates(addon, values);
|
|
4778
4798
|
onAddOnSelect(id, value, addon, fieldUpdates);
|
|
@@ -5887,24 +5907,21 @@ var PaymentContainer = function PaymentContainer(_ref2) {
|
|
|
5887
5907
|
var _useState5 = React.useState(true),
|
|
5888
5908
|
paymentDataIsLoading = _useState5[0],
|
|
5889
5909
|
setPaymentDataIsLoading = _useState5[1];
|
|
5890
|
-
var _useState6 = React.useState(
|
|
5891
|
-
|
|
5892
|
-
|
|
5893
|
-
var _useState7 = React.useState(
|
|
5894
|
-
|
|
5895
|
-
|
|
5910
|
+
var _useState6 = React.useState(''),
|
|
5911
|
+
currency = _useState6[0],
|
|
5912
|
+
setCurrency = _useState6[1];
|
|
5913
|
+
var _useState7 = React.useState(false),
|
|
5914
|
+
showPaymentPlanSection = _useState7[0],
|
|
5915
|
+
setShowPaymentPlanSection = _useState7[1];
|
|
5896
5916
|
var _useState8 = React.useState(false),
|
|
5897
|
-
|
|
5898
|
-
|
|
5899
|
-
var _useState9 = React.useState(
|
|
5900
|
-
|
|
5901
|
-
|
|
5902
|
-
var _useState10 = React.useState(
|
|
5903
|
-
|
|
5904
|
-
|
|
5905
|
-
var _useState11 = React.useState(true),
|
|
5906
|
-
paymentPlanUseSavedCard = _useState11[0],
|
|
5907
|
-
setPaymentPlanUseSavedCard = _useState11[1];
|
|
5917
|
+
paymentPlanIsAvailable = _useState8[0],
|
|
5918
|
+
setPaymentPlanIsAvailable = _useState8[1];
|
|
5919
|
+
var _useState9 = React.useState(initialPaymentPlanConfiguration),
|
|
5920
|
+
paymentPlanConfig = _useState9[0],
|
|
5921
|
+
setPaymentPlanConfig = _useState9[1];
|
|
5922
|
+
var _useState10 = React.useState(true),
|
|
5923
|
+
paymentPlanUseSavedCard = _useState10[0],
|
|
5924
|
+
setPaymentPlanUseSavedCard = _useState10[1];
|
|
5908
5925
|
var showFormTitle = Boolean(formTitle);
|
|
5909
5926
|
var showErrorText = Boolean(errorText);
|
|
5910
5927
|
var eventId = getQueryVariable('event_id') || _get(reviewData, 'cart[0].product_id') || '';
|
|
@@ -5918,9 +5935,6 @@ var PaymentContainer = function PaymentContainer(_ref2) {
|
|
|
5918
5935
|
page: 'review',
|
|
5919
5936
|
pageUrl: pageUrl
|
|
5920
5937
|
});
|
|
5921
|
-
console.log({
|
|
5922
|
-
conditions: conditions
|
|
5923
|
-
});
|
|
5924
5938
|
React.useEffect(function () {
|
|
5925
5939
|
var fetchPaymentData = /*#__PURE__*/function () {
|
|
5926
5940
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
@@ -6006,43 +6020,6 @@ var PaymentContainer = function PaymentContainer(_ref2) {
|
|
|
6006
6020
|
fetchPaymentData();
|
|
6007
6021
|
}
|
|
6008
6022
|
}, [orderData, hash, isSinglePageCheckout, onGetPaymentDataError, onGetPaymentDataSuccess]);
|
|
6009
|
-
//just once
|
|
6010
|
-
React.useEffect(function () {
|
|
6011
|
-
// fetch conditions data
|
|
6012
|
-
var fetchConditions = /*#__PURE__*/function () {
|
|
6013
|
-
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
6014
|
-
var conditionsResponse, conditionsInfo;
|
|
6015
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
6016
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
6017
|
-
case 0:
|
|
6018
|
-
if (!eventId) {
|
|
6019
|
-
_context2.next = 6;
|
|
6020
|
-
break;
|
|
6021
|
-
}
|
|
6022
|
-
_context2.next = 3;
|
|
6023
|
-
return getConditions(eventId);
|
|
6024
|
-
case 3:
|
|
6025
|
-
conditionsResponse = _context2.sent;
|
|
6026
|
-
conditionsInfo = conditionsResponse.data.attributes;
|
|
6027
|
-
setConditions(conditionsInfo ? conditionsInfo.map(function (item) {
|
|
6028
|
-
return {
|
|
6029
|
-
id: nanoid.nanoid(),
|
|
6030
|
-
text: item.text,
|
|
6031
|
-
checked: false
|
|
6032
|
-
};
|
|
6033
|
-
}) : []);
|
|
6034
|
-
case 6:
|
|
6035
|
-
case "end":
|
|
6036
|
-
return _context2.stop();
|
|
6037
|
-
}
|
|
6038
|
-
}, _callee2);
|
|
6039
|
-
}));
|
|
6040
|
-
return function fetchConditions() {
|
|
6041
|
-
return _ref4.apply(this, arguments);
|
|
6042
|
-
};
|
|
6043
|
-
}();
|
|
6044
|
-
fetchConditions();
|
|
6045
|
-
}, [eventId]);
|
|
6046
6023
|
var showPaymentForm = function showPaymentForm() {
|
|
6047
6024
|
var _paymentPlanConfig$sa;
|
|
6048
6025
|
if (hidePaymentForm) {
|
|
@@ -6099,10 +6076,6 @@ var PaymentContainer = function PaymentContainer(_ref2) {
|
|
|
6099
6076
|
var isTable = orderData == null ? void 0 : orderData.guest_count;
|
|
6100
6077
|
React.useEffect(function () {
|
|
6101
6078
|
var paymentMethod = reviewData.payment_method || {};
|
|
6102
|
-
console.log({
|
|
6103
|
-
paymentMethod: paymentMethod,
|
|
6104
|
-
enablePaymentPlan: enablePaymentPlan
|
|
6105
|
-
});
|
|
6106
6079
|
var paymentPlanAvailable = paymentMethod.stripe_payment_plan_enabled && enablePaymentPlan;
|
|
6107
6080
|
setPaymentPlanIsAvailable(paymentPlanAvailable);
|
|
6108
6081
|
if (paymentPlanAvailable) {
|
|
@@ -6465,38 +6438,36 @@ var usePaymentRedirect = function usePaymentRedirect(_ref) {
|
|
|
6465
6438
|
isPaymentReturn = urlParams.get('payment_return');
|
|
6466
6439
|
clientSecret = urlParams.get('payment_intent_client_secret');
|
|
6467
6440
|
if (!(isPaymentReturn && clientSecret && stripeRef.current)) {
|
|
6468
|
-
_context.next =
|
|
6441
|
+
_context.next = 39;
|
|
6469
6442
|
break;
|
|
6470
6443
|
}
|
|
6471
|
-
console.log('Detected payment redirect return, checking status');
|
|
6472
6444
|
setLoading(true);
|
|
6473
|
-
_context.prev =
|
|
6445
|
+
_context.prev = 5;
|
|
6474
6446
|
// Get stored payment context
|
|
6475
6447
|
storedContext = localStorage.getItem('stripe_payment_context');
|
|
6476
6448
|
if (storedContext) {
|
|
6477
|
-
_context.next =
|
|
6449
|
+
_context.next = 11;
|
|
6478
6450
|
break;
|
|
6479
6451
|
}
|
|
6480
6452
|
setError('Payment context not found');
|
|
6481
6453
|
setLoading(false);
|
|
6482
6454
|
return _context.abrupt("return");
|
|
6483
|
-
case
|
|
6455
|
+
case 11:
|
|
6484
6456
|
paymentContext = JSON.parse(storedContext);
|
|
6485
|
-
_context.next =
|
|
6457
|
+
_context.next = 14;
|
|
6486
6458
|
return stripeRef.current.retrievePaymentIntent(clientSecret);
|
|
6487
|
-
case
|
|
6459
|
+
case 14:
|
|
6488
6460
|
_yield$stripeRef$curr = _context.sent;
|
|
6489
6461
|
paymentIntent = _yield$stripeRef$curr.paymentIntent;
|
|
6490
6462
|
if (!((paymentIntent == null ? void 0 : paymentIntent.status) === 'succeeded')) {
|
|
6491
|
-
_context.next =
|
|
6463
|
+
_context.next = 27;
|
|
6492
6464
|
break;
|
|
6493
6465
|
}
|
|
6494
|
-
console.log('Payment succeeded after redirect, continuing flow');
|
|
6495
6466
|
// Clean up stored context
|
|
6496
6467
|
localStorage.removeItem('stripe_payment_context');
|
|
6497
6468
|
// Continue with the success flow using stored context
|
|
6498
6469
|
paymentResponse = null;
|
|
6499
|
-
_context.next =
|
|
6470
|
+
_context.next = 21;
|
|
6500
6471
|
return handlePaymentMiddleWare(null, {}, {
|
|
6501
6472
|
reviewData: paymentContext.attributes,
|
|
6502
6473
|
isFreeTickets: paymentContext.isFreeTickets,
|
|
@@ -6514,16 +6485,16 @@ var usePaymentRedirect = function usePaymentRedirect(_ref) {
|
|
|
6514
6485
|
throw error;
|
|
6515
6486
|
}
|
|
6516
6487
|
});
|
|
6517
|
-
case
|
|
6488
|
+
case 21:
|
|
6518
6489
|
// Complete the flow with cleanup and handleSubmit
|
|
6519
6490
|
removeReferralKey();
|
|
6520
6491
|
removeAdditionalConfigs();
|
|
6521
6492
|
handleSubmit(paymentContext.values, paymentContext.formikHelpers, paymentContext.eventId, paymentContext.checkoutResponse, paymentContext.checkoutUpdateResponse, paymentResponse);
|
|
6522
6493
|
// Clean URL parameters
|
|
6523
6494
|
window.history.replaceState({}, document.title, window.location.pathname);
|
|
6524
|
-
_context.next =
|
|
6495
|
+
_context.next = 28;
|
|
6525
6496
|
break;
|
|
6526
|
-
case
|
|
6497
|
+
case 27:
|
|
6527
6498
|
if ((paymentIntent == null ? void 0 : paymentIntent.status) === 'requires_action') {
|
|
6528
6499
|
setError('Payment requires additional action');
|
|
6529
6500
|
// Clean up stored context and URL to prevent infinite loop
|
|
@@ -6535,26 +6506,26 @@ var usePaymentRedirect = function usePaymentRedirect(_ref) {
|
|
|
6535
6506
|
localStorage.removeItem('stripe_payment_context');
|
|
6536
6507
|
window.history.replaceState({}, document.title, window.location.pathname);
|
|
6537
6508
|
}
|
|
6538
|
-
case
|
|
6539
|
-
_context.next =
|
|
6509
|
+
case 28:
|
|
6510
|
+
_context.next = 36;
|
|
6540
6511
|
break;
|
|
6541
|
-
case
|
|
6542
|
-
_context.prev =
|
|
6543
|
-
_context.t0 = _context["catch"](
|
|
6512
|
+
case 30:
|
|
6513
|
+
_context.prev = 30;
|
|
6514
|
+
_context.t0 = _context["catch"](5);
|
|
6544
6515
|
console.error('Error handling payment return:', _context.t0);
|
|
6545
6516
|
setError('Error processing payment return');
|
|
6546
6517
|
// Clean up stored context and URL to prevent infinite loop
|
|
6547
6518
|
localStorage.removeItem('stripe_payment_context');
|
|
6548
6519
|
window.history.replaceState({}, document.title, window.location.pathname);
|
|
6549
|
-
case
|
|
6550
|
-
_context.prev =
|
|
6520
|
+
case 36:
|
|
6521
|
+
_context.prev = 36;
|
|
6551
6522
|
setLoading(false);
|
|
6552
|
-
return _context.finish(
|
|
6553
|
-
case
|
|
6523
|
+
return _context.finish(36);
|
|
6524
|
+
case 39:
|
|
6554
6525
|
case "end":
|
|
6555
6526
|
return _context.stop();
|
|
6556
6527
|
}
|
|
6557
|
-
}, _callee, null, [[
|
|
6528
|
+
}, _callee, null, [[5, 30, 36, 39]]);
|
|
6558
6529
|
}));
|
|
6559
6530
|
return function handlePaymentReturn() {
|
|
6560
6531
|
return _ref2.apply(this, arguments);
|
|
@@ -6890,7 +6861,7 @@ var EmailExistenceChecker = function EmailExistenceChecker(_ref4) {
|
|
|
6890
6861
|
return null;
|
|
6891
6862
|
};
|
|
6892
6863
|
var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref6) {
|
|
6893
|
-
var _reviewData$payment_m, _checkoutUpdateData$a, _checkoutUpdateData$a2, _reviewData$payment_m2, _checkoutUpdateData$a3, _checkoutUpdateData$a4, _checkoutUpdateData$a5;
|
|
6864
|
+
var _configs$addon_max_qu, _reviewData$payment_m, _checkoutUpdateData$a, _checkoutUpdateData$a2, _reviewData$payment_m2, _checkoutUpdateData$a3, _checkoutUpdateData$a4, _checkoutUpdateData$a5;
|
|
6894
6865
|
var _ref6$data = _ref6.data,
|
|
6895
6866
|
data = _ref6$data === void 0 ? [] : _ref6$data,
|
|
6896
6867
|
_ref6$ticketHoldersFi = _ref6.ticketHoldersFields,
|
|
@@ -7126,6 +7097,7 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref6) {
|
|
|
7126
7097
|
var collectMandatoryBusinessCategory = configs == null ? void 0 : configs.collect_mandatory_business_category;
|
|
7127
7098
|
var collectOptionalBusinessCategory = configs == null ? void 0 : configs.collect_optional_business_category;
|
|
7128
7099
|
var eventHasAddons = configs == null ? void 0 : configs.has_add_on;
|
|
7100
|
+
var addonMaxQuantityGroups = (_configs$addon_max_qu = configs == null ? void 0 : configs.addon_max_quantity_groups) != null ? _configs$addon_max_qu : undefined;
|
|
7129
7101
|
var hideBusinessCategoryField = !collectMandatoryBusinessCategory && !collectOptionalBusinessCategory;
|
|
7130
7102
|
var _useState21 = React.useState(),
|
|
7131
7103
|
pendingVerificationMessage = _useState21[0],
|
|
@@ -7336,7 +7308,6 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref6) {
|
|
|
7336
7308
|
});
|
|
7337
7309
|
case 5:
|
|
7338
7310
|
checkoutUpdateResponse = _context6.sent;
|
|
7339
|
-
console.log('Stripe in [useEffect] fetchCheckoutUpdate', checkoutUpdateResponse);
|
|
7340
7311
|
if (checkoutUpdateResponse.success) {
|
|
7341
7312
|
checkoutAttributes = checkoutUpdateResponse.data.attributes;
|
|
7342
7313
|
cartPriceBreakdown = _get(checkoutAttributes, 'cart_price_breakdown', {});
|
|
@@ -7344,23 +7315,22 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref6) {
|
|
|
7344
7315
|
hash: '',
|
|
7345
7316
|
total: _get(cartPriceBreakdown, 'total', 0)
|
|
7346
7317
|
}));
|
|
7347
|
-
console.log('Stripe in [useEffect] fetchCheckoutUpdate | checkoutAttributes', checkoutAttributes);
|
|
7348
7318
|
setCheckoutUpdateData(checkoutAttributes);
|
|
7349
7319
|
onCheckoutUpdateSuccess(_extends({
|
|
7350
7320
|
expires_at: expirationTime
|
|
7351
7321
|
}, cartPriceBreakdown));
|
|
7352
7322
|
}
|
|
7353
|
-
_context6.next =
|
|
7323
|
+
_context6.next = 12;
|
|
7354
7324
|
break;
|
|
7355
|
-
case
|
|
7356
|
-
_context6.prev =
|
|
7325
|
+
case 9:
|
|
7326
|
+
_context6.prev = 9;
|
|
7357
7327
|
_context6.t0 = _context6["catch"](2);
|
|
7358
7328
|
console.error('Failed to fetch checkout update:', _context6.t0);
|
|
7359
|
-
case
|
|
7329
|
+
case 12:
|
|
7360
7330
|
case "end":
|
|
7361
7331
|
return _context6.stop();
|
|
7362
7332
|
}
|
|
7363
|
-
}, _callee6, null, [[2,
|
|
7333
|
+
}, _callee6, null, [[2, 9]]);
|
|
7364
7334
|
}));
|
|
7365
7335
|
return function fetchCheckoutUpdate() {
|
|
7366
7336
|
return _ref10.apply(this, arguments);
|
|
@@ -7606,9 +7576,6 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref6) {
|
|
|
7606
7576
|
return _ref12.apply(this, arguments);
|
|
7607
7577
|
};
|
|
7608
7578
|
}(), [eventId, isSinglePageCheckout, onCheckoutUpdateError, onCheckoutUpdateSuccess]);
|
|
7609
|
-
console.log({
|
|
7610
|
-
checkoutData: checkoutData
|
|
7611
|
-
});
|
|
7612
7579
|
var handleAddOnSelect = React.useCallback( /*#__PURE__*/function () {
|
|
7613
7580
|
var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(selectedAddOns) {
|
|
7614
7581
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
@@ -7708,7 +7675,7 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref6) {
|
|
|
7708
7675
|
enableReinitialize: false,
|
|
7709
7676
|
onSubmit: function () {
|
|
7710
7677
|
var _onSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(values, formikHelpers) {
|
|
7711
|
-
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,
|
|
7678
|
+
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;
|
|
7712
7679
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
7713
7680
|
while (1) switch (_context10.prev = _context10.next) {
|
|
7714
7681
|
case 0:
|
|
@@ -7819,11 +7786,10 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref6) {
|
|
|
7819
7786
|
});
|
|
7820
7787
|
case 38:
|
|
7821
7788
|
checkoutUpdateResponse = _context10.sent;
|
|
7822
|
-
console.log('Stripe checkoutUpdateResponse in billing-info-container', checkoutUpdateResponse);
|
|
7823
7789
|
setCheckoutUpdateData(checkoutUpdateResponse.data.attributes);
|
|
7824
7790
|
paymentResponse = null;
|
|
7825
7791
|
if (!isSinglePageCheckout) {
|
|
7826
|
-
_context10.next =
|
|
7792
|
+
_context10.next = 59;
|
|
7827
7793
|
break;
|
|
7828
7794
|
}
|
|
7829
7795
|
_checkoutResponse$dat = checkoutResponse.data.attributes, hash = _checkoutResponse$dat.hash, total = _checkoutResponse$dat.total;
|
|
@@ -7831,16 +7797,15 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref6) {
|
|
|
7831
7797
|
hash: hash,
|
|
7832
7798
|
total: total
|
|
7833
7799
|
}));
|
|
7834
|
-
_context10.next =
|
|
7800
|
+
_context10.next = 46;
|
|
7835
7801
|
return getPaymentData(String(hash));
|
|
7836
|
-
case
|
|
7802
|
+
case 46:
|
|
7837
7803
|
paymentDataResponse = _context10.sent;
|
|
7838
7804
|
if (!paymentDataResponse.success) {
|
|
7839
|
-
_context10.next =
|
|
7805
|
+
_context10.next = 59;
|
|
7840
7806
|
break;
|
|
7841
7807
|
}
|
|
7842
7808
|
attributes = paymentDataResponse.data.attributes;
|
|
7843
|
-
console.log('Stripe confirmPayment success in billing-info-container');
|
|
7844
7809
|
setReviewData(attributes);
|
|
7845
7810
|
order_details = attributes.order_details, cart = attributes.cart;
|
|
7846
7811
|
_order_details$ticket = order_details.tickets, ticket = _order_details$ticket[0];
|
|
@@ -7860,35 +7825,29 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref6) {
|
|
|
7860
7825
|
debt: (order_details == null ? void 0 : order_details.debt) || null,
|
|
7861
7826
|
cost: ticket == null ? void 0 : ticket.cost
|
|
7862
7827
|
};
|
|
7863
|
-
isFreeTickets = !Number(total) && !Number(updatedOrderData.total) || !Number((updatedOrderData == null ? void 0 : updatedOrderData.pay_now) || 0);
|
|
7864
|
-
|
|
7865
|
-
paymentPlanAvailable = paymentMethod.stripe_payment_plan_enabled;
|
|
7866
|
-
console.log({
|
|
7867
|
-
paymentPlanAvailable: paymentPlanAvailable
|
|
7868
|
-
});
|
|
7869
|
-
// Process payment using the hook
|
|
7870
|
-
_context10.next = 61;
|
|
7828
|
+
isFreeTickets = !Number(total) && !Number(updatedOrderData.total) || !Number((updatedOrderData == null ? void 0 : updatedOrderData.pay_now) || 0); // Process payment using the hook
|
|
7829
|
+
_context10.next = 56;
|
|
7871
7830
|
return processPayment(paymentDataResponse, values, formikHelpers, checkoutResponse, checkoutUpdateResponse, {
|
|
7872
7831
|
attributes: attributes,
|
|
7873
7832
|
isFreeTickets: isFreeTickets,
|
|
7874
7833
|
updatedOrderData: updatedOrderData,
|
|
7875
7834
|
eventId: eventId
|
|
7876
7835
|
});
|
|
7877
|
-
case
|
|
7836
|
+
case 56:
|
|
7878
7837
|
paymentResponse = _context10.sent;
|
|
7879
7838
|
if (!(!paymentResponse && !isFreeTickets)) {
|
|
7880
|
-
_context10.next =
|
|
7839
|
+
_context10.next = 59;
|
|
7881
7840
|
break;
|
|
7882
7841
|
}
|
|
7883
7842
|
return _context10.abrupt("return");
|
|
7884
|
-
case
|
|
7843
|
+
case 59:
|
|
7885
7844
|
removeReferralKey();
|
|
7886
7845
|
removeAdditionalConfigs();
|
|
7887
7846
|
handleSubmit(values, formikHelpers, eventId, checkoutResponse, checkoutUpdateResponse, paymentResponse);
|
|
7888
|
-
_context10.next =
|
|
7847
|
+
_context10.next = 72;
|
|
7889
7848
|
break;
|
|
7890
|
-
case
|
|
7891
|
-
_context10.prev =
|
|
7849
|
+
case 64:
|
|
7850
|
+
_context10.prev = 64;
|
|
7892
7851
|
_context10.t1 = _context10["catch"](0);
|
|
7893
7852
|
setLoading(false);
|
|
7894
7853
|
onSubmitError(_context10.t1);
|
|
@@ -7917,15 +7876,15 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref6) {
|
|
|
7917
7876
|
}
|
|
7918
7877
|
// Keep form values intact - don't reset
|
|
7919
7878
|
formikHelpers.setSubmitting(false);
|
|
7920
|
-
case
|
|
7921
|
-
_context10.prev =
|
|
7879
|
+
case 72:
|
|
7880
|
+
_context10.prev = 72;
|
|
7922
7881
|
setLoading(false);
|
|
7923
|
-
return _context10.finish(
|
|
7924
|
-
case
|
|
7882
|
+
return _context10.finish(72);
|
|
7883
|
+
case 75:
|
|
7925
7884
|
case "end":
|
|
7926
7885
|
return _context10.stop();
|
|
7927
7886
|
}
|
|
7928
|
-
}, _callee10, null, [[0,
|
|
7887
|
+
}, _callee10, null, [[0, 64, 72, 75], [15, 23]]);
|
|
7929
7888
|
}));
|
|
7930
7889
|
function onSubmit(_x3, _x4) {
|
|
7931
7890
|
return _onSubmit.apply(this, arguments);
|
|
@@ -7988,7 +7947,8 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref6) {
|
|
|
7988
7947
|
eventId: eventId,
|
|
7989
7948
|
addOnDataWithCustomFields: addOnDataWithCustomFields,
|
|
7990
7949
|
configs: configs,
|
|
7991
|
-
onAddOnSelect: onAddOnSelect
|
|
7950
|
+
onAddOnSelect: onAddOnSelect,
|
|
7951
|
+
addonMaxQuantityGroups: addonMaxQuantityGroups
|
|
7992
7952
|
})) : !addOnsIncludedOnInvitation && includeAddons && !isSinglePageCheckout ? React__default.createElement(AddonsContainter, Object.assign({}, addonsProps != null ? addonsProps : {}, {
|
|
7993
7953
|
addOnDataWithCustomFields: addOnDataWithCustomFields,
|
|
7994
7954
|
configs: configs,
|
|
@@ -13934,7 +13894,6 @@ var RegistrationForm = function RegistrationForm(_ref) {
|
|
|
13934
13894
|
_context3.prev = 25;
|
|
13935
13895
|
_context3.t0 = _context3["catch"](1);
|
|
13936
13896
|
if (axios.isAxiosError(_context3.t0)) {
|
|
13937
|
-
console.log(_context3.t0);
|
|
13938
13897
|
_errorMessage3 = _get(_context3.t0, 'response.data.message') || 'Error';
|
|
13939
13898
|
onRegisterAccountError(_context3.t0);
|
|
13940
13899
|
setshowErrorModal(true);
|