tf-checkout-react 1.7.31 → 1.7.32-beta.2
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/adapters/customFields.d.ts +1 -0
- package/dist/components/billing-info-container/index.d.ts +2 -0
- package/dist/tf-checkout-react.cjs.development.js +178 -50
- 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 +178 -50
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/dist/types/billing-info-data.d.ts +4 -0
- package/dist/utils/customFields.d.ts +20 -0
- package/dist/utils/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/adapters/customFields.test.ts +69 -0
- package/src/adapters/customFields.ts +10 -0
- package/src/components/billing-info-container/hooks/useStripePayment.ts +63 -28
- package/src/components/billing-info-container/index.tsx +79 -35
- package/src/hoc/CustomFields/index.tsx +17 -2
- package/src/types/billing-info-data.ts +4 -0
- package/src/utils/customFields.test.ts +41 -0
- package/src/utils/customFields.ts +39 -0
- package/src/utils/index.ts +6 -1
|
@@ -4,6 +4,7 @@ export declare const optionsAdapter: (options: any) => {
|
|
|
4
4
|
label: any;
|
|
5
5
|
value: any;
|
|
6
6
|
}[];
|
|
7
|
+
export declare const ticketTypeIdsAdapter: (ticketTypes: unknown) => string[] | null;
|
|
7
8
|
export declare const fieldDataAdapter: (field: IGroupItem) => IGroupItem;
|
|
8
9
|
export declare const customFieldsDataAdapter: (data: any) => {
|
|
9
10
|
ticketsFields: IGroupItem[];
|
|
@@ -57,6 +57,8 @@ export interface IBillingInfoPage {
|
|
|
57
57
|
isCountryCodeEditable?: boolean;
|
|
58
58
|
customFieldsOrderKeys?: string[];
|
|
59
59
|
customFieldsTicketHolderKeys?: string[];
|
|
60
|
+
/** Event to load custom fields for. Defaults to `?event_id`, then the cart's event. */
|
|
61
|
+
customFieldsEventId?: string | number;
|
|
60
62
|
onPendingVerification?: () => void;
|
|
61
63
|
includeAddons?: boolean;
|
|
62
64
|
addonsProps?: IAddonContainterProps;
|
|
@@ -17,6 +17,7 @@ var _identity = _interopDefault(require('lodash/identity'));
|
|
|
17
17
|
var _isEmpty = _interopDefault(require('lodash/isEmpty'));
|
|
18
18
|
var _isEqual = _interopDefault(require('lodash/isEqual'));
|
|
19
19
|
var _map = _interopDefault(require('lodash/map'));
|
|
20
|
+
var _omit = _interopDefault(require('lodash/omit'));
|
|
20
21
|
var nanoid = require('nanoid');
|
|
21
22
|
var React = require('react');
|
|
22
23
|
var React__default = _interopDefault(React);
|
|
@@ -931,6 +932,25 @@ var getFieldsKeys = function getFieldsKeys(customFields) {
|
|
|
931
932
|
return field.name;
|
|
932
933
|
});
|
|
933
934
|
};
|
|
935
|
+
var getHolderTicketTypeIds = function getHolderTicketTypeIds(ticketsPriceBreakdown, holdersCount) {
|
|
936
|
+
if (!Array.isArray(ticketsPriceBreakdown)) return [];
|
|
937
|
+
var slots = [];
|
|
938
|
+
_forEach(ticketsPriceBreakdown, function (line) {
|
|
939
|
+
for (var i = 0; i < Number((line == null ? void 0 : line.quantity) || 0); i++) {
|
|
940
|
+
var _line$ticket_type_id;
|
|
941
|
+
slots.push(String((_line$ticket_type_id = line == null ? void 0 : line.ticket_type_id) != null ? _line$ticket_type_id : ''));
|
|
942
|
+
}
|
|
943
|
+
});
|
|
944
|
+
return slots.length === holdersCount ? slots : [];
|
|
945
|
+
};
|
|
946
|
+
/**
|
|
947
|
+
* Whether a ticket-holder custom field applies to a ticket of `ticketTypeId`.
|
|
948
|
+
* Unscoped fields apply to every ticket; an unknown ticket type fails open so a
|
|
949
|
+
* required field is never silently dropped.
|
|
950
|
+
*/
|
|
951
|
+
var customFieldAppliesToTicketType = function customFieldAppliesToTicketType(field, ticketTypeId) {
|
|
952
|
+
return !ticketTypeId || _isEmpty(field.ticketTypeIds) || (field.ticketTypeIds || []).includes(String(ticketTypeId));
|
|
953
|
+
};
|
|
934
954
|
|
|
935
955
|
var isJson = function isJson(value) {
|
|
936
956
|
try {
|
|
@@ -1006,6 +1026,11 @@ var optionsAdapter = function optionsAdapter(options) {
|
|
|
1006
1026
|
});
|
|
1007
1027
|
return adaptedOptions;
|
|
1008
1028
|
};
|
|
1029
|
+
// `settings.ticketTypes` scopes a ticket field to those ticket types; absent or
|
|
1030
|
+
// empty means it applies to every ticket. Ids arrive as numbers, compare as strings.
|
|
1031
|
+
var ticketTypeIdsAdapter = function ticketTypeIdsAdapter(ticketTypes) {
|
|
1032
|
+
return Array.isArray(ticketTypes) && ticketTypes.length ? ticketTypes.map(String) : null;
|
|
1033
|
+
};
|
|
1009
1034
|
var fieldDataAdapter = function fieldDataAdapter(field) {
|
|
1010
1035
|
var name = field.name,
|
|
1011
1036
|
label = field.label,
|
|
@@ -1023,6 +1048,10 @@ var fieldDataAdapter = function fieldDataAdapter(field) {
|
|
|
1023
1048
|
className: _get(restValues, 'settings.className', ''),
|
|
1024
1049
|
value: _get(restValues, 'defaultValue')
|
|
1025
1050
|
};
|
|
1051
|
+
var ticketTypeIds = ticketTypeIdsAdapter(_get(restValues, 'settings.ticketTypes'));
|
|
1052
|
+
if (ticketTypeIds) {
|
|
1053
|
+
adaptedField.ticketTypeIds = ticketTypeIds;
|
|
1054
|
+
}
|
|
1026
1055
|
switch (type) {
|
|
1027
1056
|
case 'textarea':
|
|
1028
1057
|
adaptedField.type = 'text';
|
|
@@ -2237,7 +2266,7 @@ var checkCustomerOrder = /*#__PURE__*/function () {
|
|
|
2237
2266
|
};
|
|
2238
2267
|
}();
|
|
2239
2268
|
|
|
2240
|
-
var _excluded$1 = ["data", "ticketHoldersFields", "skipCustomFields", "onGetCustomFieldsError", "onGetCustomFieldsSuccess"];
|
|
2269
|
+
var _excluded$1 = ["data", "ticketHoldersFields", "skipCustomFields", "customFieldsEventId", "onGetCustomFieldsError", "onGetCustomFieldsSuccess"];
|
|
2241
2270
|
var withCustomFields = function withCustomFields(Children) {
|
|
2242
2271
|
return function (props) {
|
|
2243
2272
|
var _props$data = props.data,
|
|
@@ -2249,6 +2278,7 @@ var withCustomFields = function withCustomFields(Children) {
|
|
|
2249
2278
|
} : _props$ticketHoldersF,
|
|
2250
2279
|
_props$skipCustomFiel = props.skipCustomFields,
|
|
2251
2280
|
skipCustomFields = _props$skipCustomFiel === void 0 ? true : _props$skipCustomFiel,
|
|
2281
|
+
eventIdProp = props.customFieldsEventId,
|
|
2252
2282
|
_props$onGetCustomFie = props.onGetCustomFieldsError,
|
|
2253
2283
|
onGetCustomFieldsError = _props$onGetCustomFie === void 0 ? _identity : _props$onGetCustomFie,
|
|
2254
2284
|
_props$onGetCustomFie2 = props.onGetCustomFieldsSuccess,
|
|
@@ -2269,18 +2299,59 @@ var withCustomFields = function withCustomFields(Children) {
|
|
|
2269
2299
|
var _useState5 = React.useState([]),
|
|
2270
2300
|
customFieldsAddOnKeys = _useState5[0],
|
|
2271
2301
|
setCustomFieldsAddOnKeys = _useState5[1];
|
|
2272
|
-
|
|
2302
|
+
// The billing page URL often carries no event id (path routes, single-page
|
|
2303
|
+
// checkouts), so fall back to the event the cart session belongs to. Without
|
|
2304
|
+
// any id, the request would hit `/v1/event//custom_fields` and fail.
|
|
2305
|
+
var resolveEventId = /*#__PURE__*/function () {
|
|
2273
2306
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
2274
|
-
var
|
|
2307
|
+
var fromUrl, configs, fromCart;
|
|
2275
2308
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
2276
2309
|
while (1) switch (_context.prev = _context.next) {
|
|
2277
2310
|
case 0:
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2311
|
+
fromUrl = getQueryVariable('event_id') || getQueryVariable('eventId');
|
|
2312
|
+
if (!(eventIdProp || fromUrl)) {
|
|
2313
|
+
_context.next = 3;
|
|
2314
|
+
break;
|
|
2315
|
+
}
|
|
2316
|
+
return _context.abrupt("return", String(eventIdProp || fromUrl));
|
|
2317
|
+
case 3:
|
|
2318
|
+
_context.next = 5;
|
|
2319
|
+
return getCheckoutPageConfigs();
|
|
2320
|
+
case 5:
|
|
2321
|
+
configs = _context.sent;
|
|
2322
|
+
fromCart = _get(configs, 'data.attributes.event_id');
|
|
2323
|
+
return _context.abrupt("return", fromCart ? String(fromCart) : '');
|
|
2324
|
+
case 8:
|
|
2325
|
+
case "end":
|
|
2326
|
+
return _context.stop();
|
|
2327
|
+
}
|
|
2328
|
+
}, _callee);
|
|
2329
|
+
}));
|
|
2330
|
+
return function resolveEventId() {
|
|
2331
|
+
return _ref.apply(this, arguments);
|
|
2332
|
+
};
|
|
2333
|
+
}();
|
|
2334
|
+
var getFields = /*#__PURE__*/function () {
|
|
2335
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
2336
|
+
var eventId, customFields, orderFieldsKeys, ticketHoldersFieldsKeys, addOnFieldsKeys;
|
|
2337
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
2338
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
2339
|
+
case 0:
|
|
2340
|
+
_context2.prev = 0;
|
|
2341
|
+
_context2.next = 3;
|
|
2342
|
+
return resolveEventId();
|
|
2343
|
+
case 3:
|
|
2344
|
+
eventId = _context2.sent;
|
|
2345
|
+
if (eventId) {
|
|
2346
|
+
_context2.next = 6;
|
|
2347
|
+
break;
|
|
2348
|
+
}
|
|
2349
|
+
return _context2.abrupt("return");
|
|
2350
|
+
case 6:
|
|
2351
|
+
_context2.next = 8;
|
|
2281
2352
|
return getCustomFields(eventId);
|
|
2282
|
-
case
|
|
2283
|
-
customFields =
|
|
2353
|
+
case 8:
|
|
2354
|
+
customFields = _context2.sent;
|
|
2284
2355
|
orderFieldsKeys = getFieldsKeys(_get(customFields, 'orderFields', []));
|
|
2285
2356
|
ticketHoldersFieldsKeys = getFieldsKeys(_get(customFields, 'ticketsFields', []));
|
|
2286
2357
|
addOnFieldsKeys = getFieldsKeys(_get(customFields, 'addOnFields', []));
|
|
@@ -2289,24 +2360,24 @@ var withCustomFields = function withCustomFields(Children) {
|
|
|
2289
2360
|
setCustomFieldsData(customFields);
|
|
2290
2361
|
setCustomFieldsAddOnKeys(addOnFieldsKeys);
|
|
2291
2362
|
onGetCustomFieldsSuccess(customFields);
|
|
2292
|
-
|
|
2363
|
+
_context2.next = 22;
|
|
2293
2364
|
break;
|
|
2294
|
-
case
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
onGetCustomFieldsError(
|
|
2298
|
-
case
|
|
2299
|
-
|
|
2365
|
+
case 19:
|
|
2366
|
+
_context2.prev = 19;
|
|
2367
|
+
_context2.t0 = _context2["catch"](0);
|
|
2368
|
+
onGetCustomFieldsError(_context2.t0);
|
|
2369
|
+
case 22:
|
|
2370
|
+
_context2.prev = 22;
|
|
2300
2371
|
setLoading(false);
|
|
2301
|
-
return
|
|
2302
|
-
case
|
|
2372
|
+
return _context2.finish(22);
|
|
2373
|
+
case 25:
|
|
2303
2374
|
case "end":
|
|
2304
|
-
return
|
|
2375
|
+
return _context2.stop();
|
|
2305
2376
|
}
|
|
2306
|
-
},
|
|
2377
|
+
}, _callee2, null, [[0, 19, 22, 25]]);
|
|
2307
2378
|
}));
|
|
2308
2379
|
return function getFields() {
|
|
2309
|
-
return
|
|
2380
|
+
return _ref2.apply(this, arguments);
|
|
2310
2381
|
};
|
|
2311
2382
|
}();
|
|
2312
2383
|
React.useEffect(function () {
|
|
@@ -6535,27 +6606,30 @@ var usePaymentRedirect = function usePaymentRedirect(_ref) {
|
|
|
6535
6606
|
}, [stripeRef.current, setError, setLoading, removeReferralKey, removeAdditionalConfigs, handleSubmit, isBrowser]);
|
|
6536
6607
|
};
|
|
6537
6608
|
|
|
6609
|
+
var SUCCESSFUL_INTENT_STATUSES = ['succeeded', 'processing', 'requires_capture'];
|
|
6610
|
+
var PAYMENT_FAILED_MESSAGE = 'Your payment was not completed. Please try again or use another payment method.';
|
|
6611
|
+
var PAYMENT_RECEIVED_MESSAGE = 'Your payment was received and we are confirming your order. ' + 'Please check your email for your tickets before trying again.';
|
|
6538
6612
|
var useStripePayment = function useStripePayment(_ref) {
|
|
6539
6613
|
var stripeRef = _ref.stripeRef,
|
|
6540
6614
|
elementsRef = _ref.elementsRef,
|
|
6541
|
-
|
|
6615
|
+
_setError = _ref.setError,
|
|
6542
6616
|
isBrowser = _ref.isBrowser;
|
|
6543
6617
|
var processPayment = /*#__PURE__*/function () {
|
|
6544
6618
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(paymentDataResponse, values, formikHelpers, checkoutResponse, checkoutUpdateResponse, paymentData) {
|
|
6545
|
-
var attributes, isFreeTickets, updatedOrderData, eventId, _yield$elementsRef$cu, submitError, paymentContext, confirmParams, rawPhone, e164Phone,
|
|
6619
|
+
var attributes, isFreeTickets, updatedOrderData, eventId, _yield$elementsRef$cu, submitError, paymentContext, confirmParams, rawPhone, e164Phone, confirmResult, _confirmResult, confirmError, paymentIntent, paymentResponse;
|
|
6546
6620
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
6547
6621
|
while (1) switch (_context.prev = _context.next) {
|
|
6548
6622
|
case 0:
|
|
6549
6623
|
attributes = paymentData.attributes, isFreeTickets = paymentData.isFreeTickets, updatedOrderData = paymentData.updatedOrderData, eventId = paymentData.eventId;
|
|
6550
6624
|
if (isFreeTickets) {
|
|
6551
|
-
_context.next =
|
|
6625
|
+
_context.next = 33;
|
|
6552
6626
|
break;
|
|
6553
6627
|
}
|
|
6554
6628
|
if (stripeRef.current) {
|
|
6555
6629
|
_context.next = 5;
|
|
6556
6630
|
break;
|
|
6557
6631
|
}
|
|
6558
|
-
|
|
6632
|
+
_setError('Stripe is not ready');
|
|
6559
6633
|
return _context.abrupt("return", null);
|
|
6560
6634
|
case 5:
|
|
6561
6635
|
_context.next = 7;
|
|
@@ -6567,7 +6641,7 @@ var useStripePayment = function useStripePayment(_ref) {
|
|
|
6567
6641
|
_context.next = 12;
|
|
6568
6642
|
break;
|
|
6569
6643
|
}
|
|
6570
|
-
|
|
6644
|
+
_setError('' + (submitError == null ? void 0 : submitError.message));
|
|
6571
6645
|
return _context.abrupt("return", null);
|
|
6572
6646
|
case 12:
|
|
6573
6647
|
// Step 2: Store payment context before potential redirect
|
|
@@ -6596,26 +6670,44 @@ var useStripePayment = function useStripePayment(_ref) {
|
|
|
6596
6670
|
}
|
|
6597
6671
|
};
|
|
6598
6672
|
}
|
|
6599
|
-
_context.
|
|
6673
|
+
_context.prev = 16;
|
|
6674
|
+
_context.next = 19;
|
|
6600
6675
|
return stripeRef.current.confirmPayment({
|
|
6601
6676
|
clientSecret: paymentDataResponse.data.attributes.payment_method.stripe_client_secret,
|
|
6602
6677
|
elements: elementsRef.current,
|
|
6603
6678
|
confirmParams: confirmParams,
|
|
6604
6679
|
redirect: 'if_required'
|
|
6605
6680
|
});
|
|
6606
|
-
case
|
|
6607
|
-
|
|
6608
|
-
|
|
6681
|
+
case 19:
|
|
6682
|
+
confirmResult = _context.sent;
|
|
6683
|
+
_context.next = 26;
|
|
6684
|
+
break;
|
|
6685
|
+
case 22:
|
|
6686
|
+
_context.prev = 22;
|
|
6687
|
+
_context.t0 = _context["catch"](16);
|
|
6688
|
+
// Stripe.js throws (instead of returning { error }) on integration errors
|
|
6689
|
+
_setError(_get(_context.t0, 'message') || PAYMENT_FAILED_MESSAGE);
|
|
6690
|
+
return _context.abrupt("return", null);
|
|
6691
|
+
case 26:
|
|
6692
|
+
_confirmResult = confirmResult, confirmError = _confirmResult.error, paymentIntent = _confirmResult.paymentIntent;
|
|
6609
6693
|
if (!confirmError) {
|
|
6610
|
-
_context.next =
|
|
6694
|
+
_context.next = 30;
|
|
6611
6695
|
break;
|
|
6612
6696
|
}
|
|
6613
|
-
|
|
6697
|
+
_setError('' + (confirmError == null ? void 0 : confirmError.message));
|
|
6614
6698
|
return _context.abrupt("return", null);
|
|
6615
|
-
case
|
|
6699
|
+
case 30:
|
|
6700
|
+
if (!(paymentIntent && !SUCCESSFUL_INTENT_STATUSES.includes(paymentIntent.status))) {
|
|
6701
|
+
_context.next = 33;
|
|
6702
|
+
break;
|
|
6703
|
+
}
|
|
6704
|
+
_setError(_get(paymentIntent, 'last_payment_error.message') || PAYMENT_FAILED_MESSAGE);
|
|
6705
|
+
return _context.abrupt("return", null);
|
|
6706
|
+
case 33:
|
|
6616
6707
|
// Handle payment middleware for non-redirect payments
|
|
6617
6708
|
paymentResponse = null;
|
|
6618
|
-
_context.
|
|
6709
|
+
_context.prev = 34;
|
|
6710
|
+
_context.next = 37;
|
|
6619
6711
|
return handlePaymentMiddleWare(null, {}, {
|
|
6620
6712
|
reviewData: attributes,
|
|
6621
6713
|
isFreeTickets: isFreeTickets,
|
|
@@ -6625,7 +6717,9 @@ var useStripePayment = function useStripePayment(_ref) {
|
|
|
6625
6717
|
paymentResponse = data;
|
|
6626
6718
|
},
|
|
6627
6719
|
setPaymentIsLoading: _identity,
|
|
6628
|
-
setError:
|
|
6720
|
+
setError: function setError(message) {
|
|
6721
|
+
if (message && isFreeTickets) _setError(message);
|
|
6722
|
+
},
|
|
6629
6723
|
orderData: updatedOrderData,
|
|
6630
6724
|
eventId: eventId,
|
|
6631
6725
|
isBrowser: isBrowser,
|
|
@@ -6633,13 +6727,29 @@ var useStripePayment = function useStripePayment(_ref) {
|
|
|
6633
6727
|
throw error;
|
|
6634
6728
|
}
|
|
6635
6729
|
});
|
|
6636
|
-
case
|
|
6730
|
+
case 37:
|
|
6731
|
+
_context.next = 45;
|
|
6732
|
+
break;
|
|
6733
|
+
case 39:
|
|
6734
|
+
_context.prev = 39;
|
|
6735
|
+
_context.t1 = _context["catch"](34);
|
|
6736
|
+
if (!isFreeTickets) {
|
|
6737
|
+
_context.next = 43;
|
|
6738
|
+
break;
|
|
6739
|
+
}
|
|
6740
|
+
throw _context.t1;
|
|
6741
|
+
case 43:
|
|
6742
|
+
// Stripe has already taken the payment and the webhook will still settle the order,
|
|
6743
|
+
// so never invite a retry (double charge) whatever the backend error looks like
|
|
6744
|
+
_setError(PAYMENT_RECEIVED_MESSAGE);
|
|
6745
|
+
return _context.abrupt("return", null);
|
|
6746
|
+
case 45:
|
|
6637
6747
|
return _context.abrupt("return", paymentResponse);
|
|
6638
|
-
case
|
|
6748
|
+
case 46:
|
|
6639
6749
|
case "end":
|
|
6640
6750
|
return _context.stop();
|
|
6641
6751
|
}
|
|
6642
|
-
}, _callee);
|
|
6752
|
+
}, _callee, null, [[16, 22], [34, 39]]);
|
|
6643
6753
|
}));
|
|
6644
6754
|
return function processPayment(_x, _x2, _x3, _x4, _x5, _x6) {
|
|
6645
6755
|
return _ref2.apply(this, arguments);
|
|
@@ -7112,6 +7222,11 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref6) {
|
|
|
7112
7222
|
checkoutUpdateData = _useState24[0],
|
|
7113
7223
|
setCheckoutUpdateData = _useState24[1];
|
|
7114
7224
|
var prevData = React.useRef(data);
|
|
7225
|
+
// Ticket type of each holder slot — scopes ticket custom fields that list
|
|
7226
|
+
// `ticketTypes` in their settings to the holders of those ticket types.
|
|
7227
|
+
var holderTicketTypeIds = React.useMemo(function () {
|
|
7228
|
+
return getHolderTicketTypeIds(_get(checkoutUpdateData, 'cart_price_breakdown.tickets_price_breakdown'), ticketsQuantity.length);
|
|
7229
|
+
}, [checkoutUpdateData, ticketsQuantity.length]);
|
|
7115
7230
|
var addAddOnsInAttributes = React.useCallback(function (checkoutBody) {
|
|
7116
7231
|
var selectedAddOns = window.localStorage.getItem('add_ons') || '{}';
|
|
7117
7232
|
var addOnDataCapture = window.localStorage.getItem('add_on_data_capture') || '{}';
|
|
@@ -7427,12 +7542,20 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref6) {
|
|
|
7427
7542
|
(_checkoutBody$attribu = checkoutBody.attributes) == null ? true : delete _checkoutBody$attribu[attributeKey];
|
|
7428
7543
|
});
|
|
7429
7544
|
// Collect data_capture for Ticket Holders Fields
|
|
7545
|
+
var ticketCustomGroup = _find(ticketHoldersFields.fields, 'customFields');
|
|
7546
|
+
var ticketCustomFields = (ticketCustomGroup == null ? void 0 : ticketCustomGroup.groupItems) || [];
|
|
7430
7547
|
_forEach(checkoutBody.attributes.ticket_holders, function (holder, holderIndex) {
|
|
7431
7548
|
var holderDataCapture = {};
|
|
7432
7549
|
_forEach(customFieldsTicketHolderKeys, function (customFieldKey) {
|
|
7433
7550
|
var customFieldHolderName = customFieldKey + "-" + holderIndex;
|
|
7434
|
-
var
|
|
7435
|
-
|
|
7551
|
+
var field = _find(ticketCustomFields, function (_ref12) {
|
|
7552
|
+
var name = _ref12.name;
|
|
7553
|
+
return name === customFieldKey;
|
|
7554
|
+
});
|
|
7555
|
+
// Fields scoped to other ticket types were never shown to this holder.
|
|
7556
|
+
if (!field || customFieldAppliesToTicketType(field, holderTicketTypeIds[+holderIndex])) {
|
|
7557
|
+
holderDataCapture[customFieldKey] = values[customFieldHolderName] || '';
|
|
7558
|
+
}
|
|
7436
7559
|
// Delete holder specific value from values list
|
|
7437
7560
|
delete checkoutBody.attributes[customFieldHolderName];
|
|
7438
7561
|
});
|
|
@@ -7482,7 +7605,7 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref6) {
|
|
|
7482
7605
|
return {
|
|
7483
7606
|
attributes: mergedAttributes
|
|
7484
7607
|
};
|
|
7485
|
-
}, [showDOB, showTicketHolders, canSkipHolderNames, customFieldsOrderKeys, ticketsQuantity.length, emailLogged, firstNameLogged, lastNameLogged, phoneLogged, customFieldsTicketHolderKeys]);
|
|
7608
|
+
}, [showDOB, showTicketHolders, canSkipHolderNames, customFieldsOrderKeys, ticketsQuantity.length, emailLogged, firstNameLogged, lastNameLogged, phoneLogged, customFieldsTicketHolderKeys, ticketHoldersFields, holderTicketTypeIds]);
|
|
7486
7609
|
var removeReferralKey = React.useCallback(function () {
|
|
7487
7610
|
localStorage.removeItem('referral_key');
|
|
7488
7611
|
}, []);
|
|
@@ -7512,7 +7635,7 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref6) {
|
|
|
7512
7635
|
}),
|
|
7513
7636
|
processPayment = _useStripePayment.processPayment;
|
|
7514
7637
|
var updateCheckoutWithAddOns = React.useCallback( /*#__PURE__*/function () {
|
|
7515
|
-
var
|
|
7638
|
+
var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(addOns) {
|
|
7516
7639
|
var mergedAddOns, _checkoutUpdateData, checkoutResponse, checkoutDataObj, updatedAttributes, errorMessage;
|
|
7517
7640
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
7518
7641
|
while (1) switch (_context8.prev = _context8.next) {
|
|
@@ -7527,9 +7650,9 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref6) {
|
|
|
7527
7650
|
return _context8.abrupt("return");
|
|
7528
7651
|
case 3:
|
|
7529
7652
|
mergedAddOns = _extends({}, singleCheckoutAddons); // Update existing entries and add new ones
|
|
7530
|
-
Object.entries(addOns).forEach(function (
|
|
7531
|
-
var key =
|
|
7532
|
-
value =
|
|
7653
|
+
Object.entries(addOns).forEach(function (_ref14) {
|
|
7654
|
+
var key = _ref14[0],
|
|
7655
|
+
value = _ref14[1];
|
|
7533
7656
|
var amount = Number(value);
|
|
7534
7657
|
if (amount) {
|
|
7535
7658
|
mergedAddOns[key] = amount;
|
|
@@ -7573,11 +7696,11 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref6) {
|
|
|
7573
7696
|
}, _callee8, null, [[5, 13]]);
|
|
7574
7697
|
}));
|
|
7575
7698
|
return function (_x) {
|
|
7576
|
-
return
|
|
7699
|
+
return _ref13.apply(this, arguments);
|
|
7577
7700
|
};
|
|
7578
7701
|
}(), [eventId, isSinglePageCheckout, onCheckoutUpdateError, onCheckoutUpdateSuccess]);
|
|
7579
7702
|
var handleAddOnSelect = React.useCallback( /*#__PURE__*/function () {
|
|
7580
|
-
var
|
|
7703
|
+
var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(selectedAddOns) {
|
|
7581
7704
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
7582
7705
|
while (1) switch (_context9.prev = _context9.next) {
|
|
7583
7706
|
case 0:
|
|
@@ -7590,7 +7713,7 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref6) {
|
|
|
7590
7713
|
}, _callee9);
|
|
7591
7714
|
}));
|
|
7592
7715
|
return function (_x2) {
|
|
7593
|
-
return
|
|
7716
|
+
return _ref15.apply(this, arguments);
|
|
7594
7717
|
};
|
|
7595
7718
|
}(), [updateCheckoutWithAddOns]);
|
|
7596
7719
|
var onAddOnSelect = React.useCallback(function (id, value, _addon, fieldUpdates) {
|
|
@@ -8045,13 +8168,18 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref6) {
|
|
|
8045
8168
|
key: _item
|
|
8046
8169
|
}, React__default.createElement("h5", null, "Ticket ", index + 1), _map(ticketHoldersFields.fields, function (group) {
|
|
8047
8170
|
var id = group.id,
|
|
8048
|
-
groupClassname = group.groupClassname
|
|
8049
|
-
|
|
8171
|
+
groupClassname = group.groupClassname;
|
|
8172
|
+
var groupItems = group.customFields ? group.groupItems.filter(function (item) {
|
|
8173
|
+
return customFieldAppliesToTicketType(item, holderTicketTypeIds[index]);
|
|
8174
|
+
}) : group.groupItems;
|
|
8175
|
+
if (_isEmpty(groupItems)) return null;
|
|
8050
8176
|
return React__default.createElement("div", {
|
|
8051
8177
|
key: id
|
|
8052
8178
|
}, React__default.createElement("div", {
|
|
8053
8179
|
className: groupClassname
|
|
8054
|
-
}, _map(groupItems, function (
|
|
8180
|
+
}, _map(groupItems, function (item) {
|
|
8181
|
+
// Scoping metadata, not a Field prop.
|
|
8182
|
+
var element = _omit(item, 'ticketTypeIds');
|
|
8055
8183
|
return React__default.createElement("div", {
|
|
8056
8184
|
className: element.className,
|
|
8057
8185
|
key: element.name
|