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
|
@@ -11,6 +11,7 @@ import _identity from 'lodash-es/identity';
|
|
|
11
11
|
import _isEmpty from 'lodash-es/isEmpty';
|
|
12
12
|
import _isEqual from 'lodash-es/isEqual';
|
|
13
13
|
import _map from 'lodash-es/map';
|
|
14
|
+
import _omit from 'lodash-es/omit';
|
|
14
15
|
import { nanoid } from 'nanoid';
|
|
15
16
|
import React, { Component, useState, useEffect, memo, useRef, useCallback, useMemo, Fragment } from 'react';
|
|
16
17
|
import { Tooltip } from 'react-tooltip';
|
|
@@ -924,6 +925,25 @@ var getFieldsKeys = function getFieldsKeys(customFields) {
|
|
|
924
925
|
return field.name;
|
|
925
926
|
});
|
|
926
927
|
};
|
|
928
|
+
var getHolderTicketTypeIds = function getHolderTicketTypeIds(ticketsPriceBreakdown, holdersCount) {
|
|
929
|
+
if (!Array.isArray(ticketsPriceBreakdown)) return [];
|
|
930
|
+
var slots = [];
|
|
931
|
+
_forEach(ticketsPriceBreakdown, function (line) {
|
|
932
|
+
for (var i = 0; i < Number((line == null ? void 0 : line.quantity) || 0); i++) {
|
|
933
|
+
var _line$ticket_type_id;
|
|
934
|
+
slots.push(String((_line$ticket_type_id = line == null ? void 0 : line.ticket_type_id) != null ? _line$ticket_type_id : ''));
|
|
935
|
+
}
|
|
936
|
+
});
|
|
937
|
+
return slots.length === holdersCount ? slots : [];
|
|
938
|
+
};
|
|
939
|
+
/**
|
|
940
|
+
* Whether a ticket-holder custom field applies to a ticket of `ticketTypeId`.
|
|
941
|
+
* Unscoped fields apply to every ticket; an unknown ticket type fails open so a
|
|
942
|
+
* required field is never silently dropped.
|
|
943
|
+
*/
|
|
944
|
+
var customFieldAppliesToTicketType = function customFieldAppliesToTicketType(field, ticketTypeId) {
|
|
945
|
+
return !ticketTypeId || _isEmpty(field.ticketTypeIds) || (field.ticketTypeIds || []).includes(String(ticketTypeId));
|
|
946
|
+
};
|
|
927
947
|
|
|
928
948
|
var isJson = function isJson(value) {
|
|
929
949
|
try {
|
|
@@ -999,6 +1019,11 @@ var optionsAdapter = function optionsAdapter(options) {
|
|
|
999
1019
|
});
|
|
1000
1020
|
return adaptedOptions;
|
|
1001
1021
|
};
|
|
1022
|
+
// `settings.ticketTypes` scopes a ticket field to those ticket types; absent or
|
|
1023
|
+
// empty means it applies to every ticket. Ids arrive as numbers, compare as strings.
|
|
1024
|
+
var ticketTypeIdsAdapter = function ticketTypeIdsAdapter(ticketTypes) {
|
|
1025
|
+
return Array.isArray(ticketTypes) && ticketTypes.length ? ticketTypes.map(String) : null;
|
|
1026
|
+
};
|
|
1002
1027
|
var fieldDataAdapter = function fieldDataAdapter(field) {
|
|
1003
1028
|
var name = field.name,
|
|
1004
1029
|
label = field.label,
|
|
@@ -1016,6 +1041,10 @@ var fieldDataAdapter = function fieldDataAdapter(field) {
|
|
|
1016
1041
|
className: _get(restValues, 'settings.className', ''),
|
|
1017
1042
|
value: _get(restValues, 'defaultValue')
|
|
1018
1043
|
};
|
|
1044
|
+
var ticketTypeIds = ticketTypeIdsAdapter(_get(restValues, 'settings.ticketTypes'));
|
|
1045
|
+
if (ticketTypeIds) {
|
|
1046
|
+
adaptedField.ticketTypeIds = ticketTypeIds;
|
|
1047
|
+
}
|
|
1019
1048
|
switch (type) {
|
|
1020
1049
|
case 'textarea':
|
|
1021
1050
|
adaptedField.type = 'text';
|
|
@@ -2230,7 +2259,7 @@ var checkCustomerOrder = /*#__PURE__*/function () {
|
|
|
2230
2259
|
};
|
|
2231
2260
|
}();
|
|
2232
2261
|
|
|
2233
|
-
var _excluded$1 = ["data", "ticketHoldersFields", "skipCustomFields", "onGetCustomFieldsError", "onGetCustomFieldsSuccess"];
|
|
2262
|
+
var _excluded$1 = ["data", "ticketHoldersFields", "skipCustomFields", "customFieldsEventId", "onGetCustomFieldsError", "onGetCustomFieldsSuccess"];
|
|
2234
2263
|
var withCustomFields = function withCustomFields(Children) {
|
|
2235
2264
|
return function (props) {
|
|
2236
2265
|
var _props$data = props.data,
|
|
@@ -2242,6 +2271,7 @@ var withCustomFields = function withCustomFields(Children) {
|
|
|
2242
2271
|
} : _props$ticketHoldersF,
|
|
2243
2272
|
_props$skipCustomFiel = props.skipCustomFields,
|
|
2244
2273
|
skipCustomFields = _props$skipCustomFiel === void 0 ? true : _props$skipCustomFiel,
|
|
2274
|
+
eventIdProp = props.customFieldsEventId,
|
|
2245
2275
|
_props$onGetCustomFie = props.onGetCustomFieldsError,
|
|
2246
2276
|
onGetCustomFieldsError = _props$onGetCustomFie === void 0 ? _identity : _props$onGetCustomFie,
|
|
2247
2277
|
_props$onGetCustomFie2 = props.onGetCustomFieldsSuccess,
|
|
@@ -2262,18 +2292,59 @@ var withCustomFields = function withCustomFields(Children) {
|
|
|
2262
2292
|
var _useState5 = useState([]),
|
|
2263
2293
|
customFieldsAddOnKeys = _useState5[0],
|
|
2264
2294
|
setCustomFieldsAddOnKeys = _useState5[1];
|
|
2265
|
-
|
|
2295
|
+
// The billing page URL often carries no event id (path routes, single-page
|
|
2296
|
+
// checkouts), so fall back to the event the cart session belongs to. Without
|
|
2297
|
+
// any id, the request would hit `/v1/event//custom_fields` and fail.
|
|
2298
|
+
var resolveEventId = /*#__PURE__*/function () {
|
|
2266
2299
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
2267
|
-
var
|
|
2300
|
+
var fromUrl, configs, fromCart;
|
|
2268
2301
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
2269
2302
|
while (1) switch (_context.prev = _context.next) {
|
|
2270
2303
|
case 0:
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2304
|
+
fromUrl = getQueryVariable('event_id') || getQueryVariable('eventId');
|
|
2305
|
+
if (!(eventIdProp || fromUrl)) {
|
|
2306
|
+
_context.next = 3;
|
|
2307
|
+
break;
|
|
2308
|
+
}
|
|
2309
|
+
return _context.abrupt("return", String(eventIdProp || fromUrl));
|
|
2310
|
+
case 3:
|
|
2311
|
+
_context.next = 5;
|
|
2312
|
+
return getCheckoutPageConfigs();
|
|
2313
|
+
case 5:
|
|
2314
|
+
configs = _context.sent;
|
|
2315
|
+
fromCart = _get(configs, 'data.attributes.event_id');
|
|
2316
|
+
return _context.abrupt("return", fromCart ? String(fromCart) : '');
|
|
2317
|
+
case 8:
|
|
2318
|
+
case "end":
|
|
2319
|
+
return _context.stop();
|
|
2320
|
+
}
|
|
2321
|
+
}, _callee);
|
|
2322
|
+
}));
|
|
2323
|
+
return function resolveEventId() {
|
|
2324
|
+
return _ref.apply(this, arguments);
|
|
2325
|
+
};
|
|
2326
|
+
}();
|
|
2327
|
+
var getFields = /*#__PURE__*/function () {
|
|
2328
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
2329
|
+
var eventId, customFields, orderFieldsKeys, ticketHoldersFieldsKeys, addOnFieldsKeys;
|
|
2330
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
2331
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
2332
|
+
case 0:
|
|
2333
|
+
_context2.prev = 0;
|
|
2334
|
+
_context2.next = 3;
|
|
2335
|
+
return resolveEventId();
|
|
2336
|
+
case 3:
|
|
2337
|
+
eventId = _context2.sent;
|
|
2338
|
+
if (eventId) {
|
|
2339
|
+
_context2.next = 6;
|
|
2340
|
+
break;
|
|
2341
|
+
}
|
|
2342
|
+
return _context2.abrupt("return");
|
|
2343
|
+
case 6:
|
|
2344
|
+
_context2.next = 8;
|
|
2274
2345
|
return getCustomFields(eventId);
|
|
2275
|
-
case
|
|
2276
|
-
customFields =
|
|
2346
|
+
case 8:
|
|
2347
|
+
customFields = _context2.sent;
|
|
2277
2348
|
orderFieldsKeys = getFieldsKeys(_get(customFields, 'orderFields', []));
|
|
2278
2349
|
ticketHoldersFieldsKeys = getFieldsKeys(_get(customFields, 'ticketsFields', []));
|
|
2279
2350
|
addOnFieldsKeys = getFieldsKeys(_get(customFields, 'addOnFields', []));
|
|
@@ -2282,24 +2353,24 @@ var withCustomFields = function withCustomFields(Children) {
|
|
|
2282
2353
|
setCustomFieldsData(customFields);
|
|
2283
2354
|
setCustomFieldsAddOnKeys(addOnFieldsKeys);
|
|
2284
2355
|
onGetCustomFieldsSuccess(customFields);
|
|
2285
|
-
|
|
2356
|
+
_context2.next = 22;
|
|
2286
2357
|
break;
|
|
2287
|
-
case
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
onGetCustomFieldsError(
|
|
2291
|
-
case
|
|
2292
|
-
|
|
2358
|
+
case 19:
|
|
2359
|
+
_context2.prev = 19;
|
|
2360
|
+
_context2.t0 = _context2["catch"](0);
|
|
2361
|
+
onGetCustomFieldsError(_context2.t0);
|
|
2362
|
+
case 22:
|
|
2363
|
+
_context2.prev = 22;
|
|
2293
2364
|
setLoading(false);
|
|
2294
|
-
return
|
|
2295
|
-
case
|
|
2365
|
+
return _context2.finish(22);
|
|
2366
|
+
case 25:
|
|
2296
2367
|
case "end":
|
|
2297
|
-
return
|
|
2368
|
+
return _context2.stop();
|
|
2298
2369
|
}
|
|
2299
|
-
},
|
|
2370
|
+
}, _callee2, null, [[0, 19, 22, 25]]);
|
|
2300
2371
|
}));
|
|
2301
2372
|
return function getFields() {
|
|
2302
|
-
return
|
|
2373
|
+
return _ref2.apply(this, arguments);
|
|
2303
2374
|
};
|
|
2304
2375
|
}();
|
|
2305
2376
|
useEffect(function () {
|
|
@@ -6528,27 +6599,30 @@ var usePaymentRedirect = function usePaymentRedirect(_ref) {
|
|
|
6528
6599
|
}, [stripeRef.current, setError, setLoading, removeReferralKey, removeAdditionalConfigs, handleSubmit, isBrowser]);
|
|
6529
6600
|
};
|
|
6530
6601
|
|
|
6602
|
+
var SUCCESSFUL_INTENT_STATUSES = ['succeeded', 'processing', 'requires_capture'];
|
|
6603
|
+
var PAYMENT_FAILED_MESSAGE = 'Your payment was not completed. Please try again or use another payment method.';
|
|
6604
|
+
var PAYMENT_RECEIVED_MESSAGE = 'Your payment was received and we are confirming your order. ' + 'Please check your email for your tickets before trying again.';
|
|
6531
6605
|
var useStripePayment = function useStripePayment(_ref) {
|
|
6532
6606
|
var stripeRef = _ref.stripeRef,
|
|
6533
6607
|
elementsRef = _ref.elementsRef,
|
|
6534
|
-
|
|
6608
|
+
_setError = _ref.setError,
|
|
6535
6609
|
isBrowser = _ref.isBrowser;
|
|
6536
6610
|
var processPayment = /*#__PURE__*/function () {
|
|
6537
6611
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(paymentDataResponse, values, formikHelpers, checkoutResponse, checkoutUpdateResponse, paymentData) {
|
|
6538
|
-
var attributes, isFreeTickets, updatedOrderData, eventId, _yield$elementsRef$cu, submitError, paymentContext, confirmParams, rawPhone, e164Phone,
|
|
6612
|
+
var attributes, isFreeTickets, updatedOrderData, eventId, _yield$elementsRef$cu, submitError, paymentContext, confirmParams, rawPhone, e164Phone, confirmResult, _confirmResult, confirmError, paymentIntent, paymentResponse;
|
|
6539
6613
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
6540
6614
|
while (1) switch (_context.prev = _context.next) {
|
|
6541
6615
|
case 0:
|
|
6542
6616
|
attributes = paymentData.attributes, isFreeTickets = paymentData.isFreeTickets, updatedOrderData = paymentData.updatedOrderData, eventId = paymentData.eventId;
|
|
6543
6617
|
if (isFreeTickets) {
|
|
6544
|
-
_context.next =
|
|
6618
|
+
_context.next = 33;
|
|
6545
6619
|
break;
|
|
6546
6620
|
}
|
|
6547
6621
|
if (stripeRef.current) {
|
|
6548
6622
|
_context.next = 5;
|
|
6549
6623
|
break;
|
|
6550
6624
|
}
|
|
6551
|
-
|
|
6625
|
+
_setError('Stripe is not ready');
|
|
6552
6626
|
return _context.abrupt("return", null);
|
|
6553
6627
|
case 5:
|
|
6554
6628
|
_context.next = 7;
|
|
@@ -6560,7 +6634,7 @@ var useStripePayment = function useStripePayment(_ref) {
|
|
|
6560
6634
|
_context.next = 12;
|
|
6561
6635
|
break;
|
|
6562
6636
|
}
|
|
6563
|
-
|
|
6637
|
+
_setError('' + (submitError == null ? void 0 : submitError.message));
|
|
6564
6638
|
return _context.abrupt("return", null);
|
|
6565
6639
|
case 12:
|
|
6566
6640
|
// Step 2: Store payment context before potential redirect
|
|
@@ -6589,26 +6663,44 @@ var useStripePayment = function useStripePayment(_ref) {
|
|
|
6589
6663
|
}
|
|
6590
6664
|
};
|
|
6591
6665
|
}
|
|
6592
|
-
_context.
|
|
6666
|
+
_context.prev = 16;
|
|
6667
|
+
_context.next = 19;
|
|
6593
6668
|
return stripeRef.current.confirmPayment({
|
|
6594
6669
|
clientSecret: paymentDataResponse.data.attributes.payment_method.stripe_client_secret,
|
|
6595
6670
|
elements: elementsRef.current,
|
|
6596
6671
|
confirmParams: confirmParams,
|
|
6597
6672
|
redirect: 'if_required'
|
|
6598
6673
|
});
|
|
6599
|
-
case
|
|
6600
|
-
|
|
6601
|
-
|
|
6674
|
+
case 19:
|
|
6675
|
+
confirmResult = _context.sent;
|
|
6676
|
+
_context.next = 26;
|
|
6677
|
+
break;
|
|
6678
|
+
case 22:
|
|
6679
|
+
_context.prev = 22;
|
|
6680
|
+
_context.t0 = _context["catch"](16);
|
|
6681
|
+
// Stripe.js throws (instead of returning { error }) on integration errors
|
|
6682
|
+
_setError(_get(_context.t0, 'message') || PAYMENT_FAILED_MESSAGE);
|
|
6683
|
+
return _context.abrupt("return", null);
|
|
6684
|
+
case 26:
|
|
6685
|
+
_confirmResult = confirmResult, confirmError = _confirmResult.error, paymentIntent = _confirmResult.paymentIntent;
|
|
6602
6686
|
if (!confirmError) {
|
|
6603
|
-
_context.next =
|
|
6687
|
+
_context.next = 30;
|
|
6604
6688
|
break;
|
|
6605
6689
|
}
|
|
6606
|
-
|
|
6690
|
+
_setError('' + (confirmError == null ? void 0 : confirmError.message));
|
|
6607
6691
|
return _context.abrupt("return", null);
|
|
6608
|
-
case
|
|
6692
|
+
case 30:
|
|
6693
|
+
if (!(paymentIntent && !SUCCESSFUL_INTENT_STATUSES.includes(paymentIntent.status))) {
|
|
6694
|
+
_context.next = 33;
|
|
6695
|
+
break;
|
|
6696
|
+
}
|
|
6697
|
+
_setError(_get(paymentIntent, 'last_payment_error.message') || PAYMENT_FAILED_MESSAGE);
|
|
6698
|
+
return _context.abrupt("return", null);
|
|
6699
|
+
case 33:
|
|
6609
6700
|
// Handle payment middleware for non-redirect payments
|
|
6610
6701
|
paymentResponse = null;
|
|
6611
|
-
_context.
|
|
6702
|
+
_context.prev = 34;
|
|
6703
|
+
_context.next = 37;
|
|
6612
6704
|
return handlePaymentMiddleWare(null, {}, {
|
|
6613
6705
|
reviewData: attributes,
|
|
6614
6706
|
isFreeTickets: isFreeTickets,
|
|
@@ -6618,7 +6710,9 @@ var useStripePayment = function useStripePayment(_ref) {
|
|
|
6618
6710
|
paymentResponse = data;
|
|
6619
6711
|
},
|
|
6620
6712
|
setPaymentIsLoading: _identity,
|
|
6621
|
-
setError:
|
|
6713
|
+
setError: function setError(message) {
|
|
6714
|
+
if (message && isFreeTickets) _setError(message);
|
|
6715
|
+
},
|
|
6622
6716
|
orderData: updatedOrderData,
|
|
6623
6717
|
eventId: eventId,
|
|
6624
6718
|
isBrowser: isBrowser,
|
|
@@ -6626,13 +6720,29 @@ var useStripePayment = function useStripePayment(_ref) {
|
|
|
6626
6720
|
throw error;
|
|
6627
6721
|
}
|
|
6628
6722
|
});
|
|
6629
|
-
case
|
|
6723
|
+
case 37:
|
|
6724
|
+
_context.next = 45;
|
|
6725
|
+
break;
|
|
6726
|
+
case 39:
|
|
6727
|
+
_context.prev = 39;
|
|
6728
|
+
_context.t1 = _context["catch"](34);
|
|
6729
|
+
if (!isFreeTickets) {
|
|
6730
|
+
_context.next = 43;
|
|
6731
|
+
break;
|
|
6732
|
+
}
|
|
6733
|
+
throw _context.t1;
|
|
6734
|
+
case 43:
|
|
6735
|
+
// Stripe has already taken the payment and the webhook will still settle the order,
|
|
6736
|
+
// so never invite a retry (double charge) whatever the backend error looks like
|
|
6737
|
+
_setError(PAYMENT_RECEIVED_MESSAGE);
|
|
6738
|
+
return _context.abrupt("return", null);
|
|
6739
|
+
case 45:
|
|
6630
6740
|
return _context.abrupt("return", paymentResponse);
|
|
6631
|
-
case
|
|
6741
|
+
case 46:
|
|
6632
6742
|
case "end":
|
|
6633
6743
|
return _context.stop();
|
|
6634
6744
|
}
|
|
6635
|
-
}, _callee);
|
|
6745
|
+
}, _callee, null, [[16, 22], [34, 39]]);
|
|
6636
6746
|
}));
|
|
6637
6747
|
return function processPayment(_x, _x2, _x3, _x4, _x5, _x6) {
|
|
6638
6748
|
return _ref2.apply(this, arguments);
|
|
@@ -7105,6 +7215,11 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref6) {
|
|
|
7105
7215
|
checkoutUpdateData = _useState24[0],
|
|
7106
7216
|
setCheckoutUpdateData = _useState24[1];
|
|
7107
7217
|
var prevData = useRef(data);
|
|
7218
|
+
// Ticket type of each holder slot — scopes ticket custom fields that list
|
|
7219
|
+
// `ticketTypes` in their settings to the holders of those ticket types.
|
|
7220
|
+
var holderTicketTypeIds = useMemo(function () {
|
|
7221
|
+
return getHolderTicketTypeIds(_get(checkoutUpdateData, 'cart_price_breakdown.tickets_price_breakdown'), ticketsQuantity.length);
|
|
7222
|
+
}, [checkoutUpdateData, ticketsQuantity.length]);
|
|
7108
7223
|
var addAddOnsInAttributes = useCallback(function (checkoutBody) {
|
|
7109
7224
|
var selectedAddOns = window.localStorage.getItem('add_ons') || '{}';
|
|
7110
7225
|
var addOnDataCapture = window.localStorage.getItem('add_on_data_capture') || '{}';
|
|
@@ -7420,12 +7535,20 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref6) {
|
|
|
7420
7535
|
(_checkoutBody$attribu = checkoutBody.attributes) == null ? true : delete _checkoutBody$attribu[attributeKey];
|
|
7421
7536
|
});
|
|
7422
7537
|
// Collect data_capture for Ticket Holders Fields
|
|
7538
|
+
var ticketCustomGroup = _find(ticketHoldersFields.fields, 'customFields');
|
|
7539
|
+
var ticketCustomFields = (ticketCustomGroup == null ? void 0 : ticketCustomGroup.groupItems) || [];
|
|
7423
7540
|
_forEach(checkoutBody.attributes.ticket_holders, function (holder, holderIndex) {
|
|
7424
7541
|
var holderDataCapture = {};
|
|
7425
7542
|
_forEach(customFieldsTicketHolderKeys, function (customFieldKey) {
|
|
7426
7543
|
var customFieldHolderName = customFieldKey + "-" + holderIndex;
|
|
7427
|
-
var
|
|
7428
|
-
|
|
7544
|
+
var field = _find(ticketCustomFields, function (_ref12) {
|
|
7545
|
+
var name = _ref12.name;
|
|
7546
|
+
return name === customFieldKey;
|
|
7547
|
+
});
|
|
7548
|
+
// Fields scoped to other ticket types were never shown to this holder.
|
|
7549
|
+
if (!field || customFieldAppliesToTicketType(field, holderTicketTypeIds[+holderIndex])) {
|
|
7550
|
+
holderDataCapture[customFieldKey] = values[customFieldHolderName] || '';
|
|
7551
|
+
}
|
|
7429
7552
|
// Delete holder specific value from values list
|
|
7430
7553
|
delete checkoutBody.attributes[customFieldHolderName];
|
|
7431
7554
|
});
|
|
@@ -7475,7 +7598,7 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref6) {
|
|
|
7475
7598
|
return {
|
|
7476
7599
|
attributes: mergedAttributes
|
|
7477
7600
|
};
|
|
7478
|
-
}, [showDOB, showTicketHolders, canSkipHolderNames, customFieldsOrderKeys, ticketsQuantity.length, emailLogged, firstNameLogged, lastNameLogged, phoneLogged, customFieldsTicketHolderKeys]);
|
|
7601
|
+
}, [showDOB, showTicketHolders, canSkipHolderNames, customFieldsOrderKeys, ticketsQuantity.length, emailLogged, firstNameLogged, lastNameLogged, phoneLogged, customFieldsTicketHolderKeys, ticketHoldersFields, holderTicketTypeIds]);
|
|
7479
7602
|
var removeReferralKey = useCallback(function () {
|
|
7480
7603
|
localStorage.removeItem('referral_key');
|
|
7481
7604
|
}, []);
|
|
@@ -7505,7 +7628,7 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref6) {
|
|
|
7505
7628
|
}),
|
|
7506
7629
|
processPayment = _useStripePayment.processPayment;
|
|
7507
7630
|
var updateCheckoutWithAddOns = useCallback( /*#__PURE__*/function () {
|
|
7508
|
-
var
|
|
7631
|
+
var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(addOns) {
|
|
7509
7632
|
var mergedAddOns, _checkoutUpdateData, checkoutResponse, checkoutDataObj, updatedAttributes, errorMessage;
|
|
7510
7633
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
7511
7634
|
while (1) switch (_context8.prev = _context8.next) {
|
|
@@ -7520,9 +7643,9 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref6) {
|
|
|
7520
7643
|
return _context8.abrupt("return");
|
|
7521
7644
|
case 3:
|
|
7522
7645
|
mergedAddOns = _extends({}, singleCheckoutAddons); // Update existing entries and add new ones
|
|
7523
|
-
Object.entries(addOns).forEach(function (
|
|
7524
|
-
var key =
|
|
7525
|
-
value =
|
|
7646
|
+
Object.entries(addOns).forEach(function (_ref14) {
|
|
7647
|
+
var key = _ref14[0],
|
|
7648
|
+
value = _ref14[1];
|
|
7526
7649
|
var amount = Number(value);
|
|
7527
7650
|
if (amount) {
|
|
7528
7651
|
mergedAddOns[key] = amount;
|
|
@@ -7566,11 +7689,11 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref6) {
|
|
|
7566
7689
|
}, _callee8, null, [[5, 13]]);
|
|
7567
7690
|
}));
|
|
7568
7691
|
return function (_x) {
|
|
7569
|
-
return
|
|
7692
|
+
return _ref13.apply(this, arguments);
|
|
7570
7693
|
};
|
|
7571
7694
|
}(), [eventId, isSinglePageCheckout, onCheckoutUpdateError, onCheckoutUpdateSuccess]);
|
|
7572
7695
|
var handleAddOnSelect = useCallback( /*#__PURE__*/function () {
|
|
7573
|
-
var
|
|
7696
|
+
var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(selectedAddOns) {
|
|
7574
7697
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
7575
7698
|
while (1) switch (_context9.prev = _context9.next) {
|
|
7576
7699
|
case 0:
|
|
@@ -7583,7 +7706,7 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref6) {
|
|
|
7583
7706
|
}, _callee9);
|
|
7584
7707
|
}));
|
|
7585
7708
|
return function (_x2) {
|
|
7586
|
-
return
|
|
7709
|
+
return _ref15.apply(this, arguments);
|
|
7587
7710
|
};
|
|
7588
7711
|
}(), [updateCheckoutWithAddOns]);
|
|
7589
7712
|
var onAddOnSelect = useCallback(function (id, value, _addon, fieldUpdates) {
|
|
@@ -8038,13 +8161,18 @@ var BillingInfoContainer = /*#__PURE__*/React.memo(function (_ref6) {
|
|
|
8038
8161
|
key: _item
|
|
8039
8162
|
}, React.createElement("h5", null, "Ticket ", index + 1), _map(ticketHoldersFields.fields, function (group) {
|
|
8040
8163
|
var id = group.id,
|
|
8041
|
-
groupClassname = group.groupClassname
|
|
8042
|
-
|
|
8164
|
+
groupClassname = group.groupClassname;
|
|
8165
|
+
var groupItems = group.customFields ? group.groupItems.filter(function (item) {
|
|
8166
|
+
return customFieldAppliesToTicketType(item, holderTicketTypeIds[index]);
|
|
8167
|
+
}) : group.groupItems;
|
|
8168
|
+
if (_isEmpty(groupItems)) return null;
|
|
8043
8169
|
return React.createElement("div", {
|
|
8044
8170
|
key: id
|
|
8045
8171
|
}, React.createElement("div", {
|
|
8046
8172
|
className: groupClassname
|
|
8047
|
-
}, _map(groupItems, function (
|
|
8173
|
+
}, _map(groupItems, function (item) {
|
|
8174
|
+
// Scoping metadata, not a Field prop.
|
|
8175
|
+
var element = _omit(item, 'ticketTypeIds');
|
|
8048
8176
|
return React.createElement("div", {
|
|
8049
8177
|
className: element.className,
|
|
8050
8178
|
key: element.name
|