tf-checkout-react-native 2.0.0-beta.19 → 2.0.0-beta.21
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/README.md +28 -9
- package/dist/index.d.mts +10 -3
- package/dist/index.d.ts +10 -3
- package/dist/index.js +171 -77
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +213 -112
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/sections/Tickets.tsx +5 -3
package/dist/index.js
CHANGED
|
@@ -500,6 +500,7 @@ __export(index_exports, {
|
|
|
500
500
|
ticketConfirmerKey: () => ticketConfirmerKey,
|
|
501
501
|
ticketFieldsFor: () => ticketFieldsFor,
|
|
502
502
|
ticketPaymentKeys: () => ticketPaymentKeys,
|
|
503
|
+
ticketPriceContext: () => ticketPriceContext,
|
|
503
504
|
ticketQuantityRange: () => ticketQuantityRange,
|
|
504
505
|
ticketRefundConsequences: () => ticketRefundConsequences,
|
|
505
506
|
ticketTypesForTier: () => ticketTypesForTier,
|
|
@@ -6307,7 +6308,7 @@ var tripStatus = (status, locale) => {
|
|
|
6307
6308
|
};
|
|
6308
6309
|
var isEventTrip = (data) => "event" in data;
|
|
6309
6310
|
var brandingLines = (identities = []) => identities.map(
|
|
6310
|
-
(
|
|
6311
|
+
(identity2) => [...new Set([identity2.brand_name, identity2.platform_name].filter(Boolean))].join(
|
|
6311
6312
|
" \xB7 "
|
|
6312
6313
|
)
|
|
6313
6314
|
).filter(Boolean);
|
|
@@ -7344,16 +7345,20 @@ var mapOption = (o) => {
|
|
|
7344
7345
|
requiresSignIn: o.requiresSignIn === true || o.requires_sign_in === true
|
|
7345
7346
|
};
|
|
7346
7347
|
};
|
|
7348
|
+
var waitlistId = (value6) => typeof value6 === "string" && /^[1-9]\d*$/.test(value6) ? value6 : typeof value6 === "number" && Number.isSafeInteger(value6) && value6 > 0 ? String(value6) : null;
|
|
7347
7349
|
var mapWaitlist = (w) => {
|
|
7348
|
-
|
|
7350
|
+
const ticketTypeId = waitlistId(w.ticketTypeId);
|
|
7351
|
+
if (!ticketTypeId || typeof w.name !== "string" || !w.name.trim()) return null;
|
|
7352
|
+
if (w.entry === null) return { ticketTypeId, name: w.name, entry: null };
|
|
7353
|
+
if (!w.entry || typeof w.entry !== "object" || Array.isArray(w.entry)) return null;
|
|
7354
|
+
const id2 = waitlistId(w.entry.id);
|
|
7355
|
+
const { status, offerExpiresAt } = w.entry;
|
|
7356
|
+
if (!id2 || !["waiting", "offered"].includes(status) || offerExpiresAt !== void 0 && offerExpiresAt !== null && typeof offerExpiresAt !== "string")
|
|
7357
|
+
return null;
|
|
7349
7358
|
return {
|
|
7350
|
-
ticketTypeId
|
|
7351
|
-
name:
|
|
7352
|
-
entry:
|
|
7353
|
-
id: String((_c = w.entry.id) != null ? _c : ""),
|
|
7354
|
-
status: String((_d = w.entry.status) != null ? _d : ""),
|
|
7355
|
-
offerExpiresAt: text3(w.entry.offerExpiresAt)
|
|
7356
|
-
} : null
|
|
7359
|
+
ticketTypeId,
|
|
7360
|
+
name: w.name,
|
|
7361
|
+
entry: { id: id2, status, offerExpiresAt: text3(offerExpiresAt) }
|
|
7357
7362
|
};
|
|
7358
7363
|
};
|
|
7359
7364
|
var list = (value6) => Array.isArray(value6) ? value6.filter((v) => v && typeof v === "object") : [];
|
|
@@ -7373,7 +7378,7 @@ var ticketChangeOptionsFromResponse = (body3) => {
|
|
|
7373
7378
|
closesAt: text3((_d = a.cutoff) == null ? void 0 : _d.closesAt)
|
|
7374
7379
|
},
|
|
7375
7380
|
options,
|
|
7376
|
-
waitlistOptions: list(a.waitlistOptions).map(mapWaitlist),
|
|
7381
|
+
waitlistOptions: list(a.waitlistOptions).map(mapWaitlist).filter((option) => option !== null),
|
|
7377
7382
|
sellInstead: {
|
|
7378
7383
|
available: Boolean((_e = a.sellInstead) == null ? void 0 : _e.available) && Boolean((_f = a.sellInstead) == null ? void 0 : _f.url),
|
|
7379
7384
|
url: text3((_g = a.sellInstead) == null ? void 0 : _g.url)
|
|
@@ -9045,21 +9050,43 @@ var waitingListEntryFrom = (definition, draft) => {
|
|
|
9045
9050
|
quantity
|
|
9046
9051
|
};
|
|
9047
9052
|
};
|
|
9053
|
+
var identity = (ticket) => {
|
|
9054
|
+
var _a2;
|
|
9055
|
+
return (_a2 = ticket.selectionKey) != null ? _a2 : ticket.id;
|
|
9056
|
+
};
|
|
9057
|
+
var ticketPriceContext = (scope, ticket) => {
|
|
9058
|
+
var _a2, _b;
|
|
9059
|
+
return JSON.stringify([
|
|
9060
|
+
scope,
|
|
9061
|
+
ticket.currency,
|
|
9062
|
+
(_a2 = ticket.timeSlot) == null ? void 0 : _a2.date,
|
|
9063
|
+
(_b = ticket.timeSlot) == null ? void 0 : _b.time,
|
|
9064
|
+
identity(ticket)
|
|
9065
|
+
]);
|
|
9066
|
+
};
|
|
9048
9067
|
var calendarTicketRows = (base, dated) => {
|
|
9049
|
-
const ids = new Set(dated.map(
|
|
9068
|
+
const ids = new Set(dated.map(identity));
|
|
9050
9069
|
return [
|
|
9051
9070
|
...dated,
|
|
9052
|
-
...base.filter(
|
|
9071
|
+
...base.filter(
|
|
9072
|
+
(ticket) => ticket.isRegularTicket === true && !ids.has(identity(ticket))
|
|
9073
|
+
)
|
|
9053
9074
|
];
|
|
9054
9075
|
};
|
|
9055
9076
|
var catalogDate = (selected, dates) => {
|
|
9056
9077
|
var _a2;
|
|
9057
9078
|
return dates.includes(selected) ? selected : (_a2 = dates[0]) != null ? _a2 : "";
|
|
9058
9079
|
};
|
|
9059
|
-
var catalogQuantities = (previous, tickets) => {
|
|
9080
|
+
var catalogQuantities = (previous, tickets, previousTickets = tickets, dateChanged = false) => {
|
|
9081
|
+
var _a2;
|
|
9082
|
+
const retained = /* @__PURE__ */ new Map();
|
|
9083
|
+
for (const ticket of previousTickets) {
|
|
9084
|
+
if (dateChanged && ticket.timeSlot) continue;
|
|
9085
|
+
if (previous[ticket.id] > 0) retained.set(identity(ticket), previous[ticket.id]);
|
|
9086
|
+
}
|
|
9060
9087
|
const next = {};
|
|
9061
9088
|
for (const ticket of tickets) {
|
|
9062
|
-
const quantity =
|
|
9089
|
+
const quantity = (_a2 = retained.get(identity(ticket))) != null ? _a2 : 0;
|
|
9063
9090
|
const range = ticketQuantityRange(ticket);
|
|
9064
9091
|
if (quantity > 0 && !ticket.soldOut && ticket.salesStarted && !ticket.salesEnded && quantity >= range.min && quantity <= range.max && quantity % range.step === 0)
|
|
9065
9092
|
next[ticket.id] = quantity;
|
|
@@ -10499,10 +10526,21 @@ var badgeOf = (raw) => {
|
|
|
10499
10526
|
const text6 = typeof raw === "string" ? raw.trim() : "";
|
|
10500
10527
|
return text6 || null;
|
|
10501
10528
|
};
|
|
10502
|
-
var
|
|
10529
|
+
var eventCurrency = (raw) => {
|
|
10530
|
+
if (typeof raw === "string") return { currency: raw };
|
|
10531
|
+
if (!raw || typeof raw !== "object") return {};
|
|
10532
|
+
const value6 = raw;
|
|
10533
|
+
return {
|
|
10534
|
+
...typeof value6.currency === "string" ? { currency: value6.currency } : {},
|
|
10535
|
+
...typeof value6.symbol === "string" ? { priceSymbol: value6.symbol } : {}
|
|
10536
|
+
};
|
|
10537
|
+
};
|
|
10538
|
+
var selectionKey = (raw, eventId) => typeof raw === "string" && raw.trim() === raw && /^event:[1-9]\d*:ticket:[1-9]\d*$/.test(raw) && raw.startsWith(`event:${eventId}:ticket:`) ? raw : void 0;
|
|
10539
|
+
var mapTicket = (t, eventId) => {
|
|
10503
10540
|
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
10504
10541
|
return {
|
|
10505
10542
|
id: String(t.id),
|
|
10543
|
+
...selectionKey(t.selectionKey, eventId) ? { selectionKey: selectionKey(t.selectionKey, eventId) } : {},
|
|
10506
10544
|
isRegularTicket: typeof t.isRegularTicket === "boolean" ? t.isRegularTicket : void 0,
|
|
10507
10545
|
name: (_a2 = t.displayName) != null ? _a2 : "",
|
|
10508
10546
|
groupName: (_c = (_b = t.groupName) != null ? _b : t.group_name) != null ? _c : null,
|
|
@@ -10562,7 +10600,7 @@ var getEventDetails = async (eventId, language = "en") => {
|
|
|
10562
10600
|
endDate: hideDate ? null : text6(a.endDate),
|
|
10563
10601
|
formattedDate: hideDate ? "Date TBC" : String((_q = a.formattedDate) != null ? _q : ""),
|
|
10564
10602
|
timezone: text6(a.timezone),
|
|
10565
|
-
currency:
|
|
10603
|
+
currency: (_r = eventCurrency(a.currency).currency) != null ? _r : "",
|
|
10566
10604
|
salesStart: text6(a.salesStart),
|
|
10567
10605
|
salesEnd: text6(a.salesEnd),
|
|
10568
10606
|
salesStarted: Boolean(a.salesStarted),
|
|
@@ -10587,7 +10625,7 @@ var getEventTickets = async (eventId) => {
|
|
|
10587
10625
|
tfCatalogContext: true
|
|
10588
10626
|
});
|
|
10589
10627
|
const ticketsObj = (_c = (_b = (_a2 = body3 == null ? void 0 : body3.data) == null ? void 0 : _a2.attributes) == null ? void 0 : _b.tickets) != null ? _c : {};
|
|
10590
|
-
return Object.values(ticketsObj).map(mapTicket);
|
|
10628
|
+
return Object.values(ticketsObj).map((ticket) => mapTicket(ticket, eventId));
|
|
10591
10629
|
};
|
|
10592
10630
|
var getEventInfo = async (eventId, pk) => {
|
|
10593
10631
|
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
@@ -10603,6 +10641,7 @@ var getEventInfo = async (eventId, pk) => {
|
|
|
10603
10641
|
const rawCountry = a.country;
|
|
10604
10642
|
const countryCode = (_j = (_i = (_h = typeof rawCountry === "string" ? rawCountry : rawCountry == null ? void 0 : rawCountry.code) != null ? _h : a.countryCode) != null ? _i : a.country_code) != null ? _j : null;
|
|
10605
10643
|
return {
|
|
10644
|
+
...eventCurrency(a.currency),
|
|
10606
10645
|
isSeatedEvent: isSeatedEvent(attributes6),
|
|
10607
10646
|
tableMapEnabled: Boolean((_k = a.tableMapEnabled) != null ? _k : a.table_map_enabled),
|
|
10608
10647
|
isTimeSlotEvent: Boolean(
|
|
@@ -10636,7 +10675,7 @@ var getEventConditions = async (eventId) => {
|
|
|
10636
10675
|
}).filter((c) => c.content || c.name);
|
|
10637
10676
|
};
|
|
10638
10677
|
var getEventTimeSlotTickets = async (eventId, date, options) => {
|
|
10639
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
|
|
10678
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
|
|
10640
10679
|
await sdkSeatSessionHeaders(eventId);
|
|
10641
10680
|
const body3 = await get(ENDPOINTS.events.timeSlotByDate(eventId), {
|
|
10642
10681
|
tfCatalogContext: true,
|
|
@@ -10657,25 +10696,28 @@ var getEventTimeSlotTickets = async (eventId, date, options) => {
|
|
|
10657
10696
|
const stock = Number((_h = (_g = s9.in_stock) != null ? _g : s9.real_stock) != null ? _h : 0);
|
|
10658
10697
|
out.push({
|
|
10659
10698
|
id: String(s9.matrix_record_id),
|
|
10699
|
+
...selectionKey(s9.selectionKey, eventId) ? { selectionKey: selectionKey(s9.selectionKey, eventId) } : {},
|
|
10660
10700
|
name: s9.display_name || s9.option_value || "Ticket",
|
|
10661
10701
|
groupName: (_j = (_i = s9.group_name) != null ? _i : s9.groupName) != null ? _j : null,
|
|
10662
|
-
optionName: String((_k = s9.
|
|
10663
|
-
price: Number((
|
|
10664
|
-
priceWithFees: Number((
|
|
10665
|
-
priceSymbol: (
|
|
10666
|
-
currency: "",
|
|
10667
|
-
feeIncluded:
|
|
10702
|
+
optionName: String((_l = (_k = s9.product_option_key) != null ? _k : s9.option_key) != null ? _l : ""),
|
|
10703
|
+
price: Number((_n = (_m = s9.display_price) != null ? _m : s9.base_price) != null ? _n : 0),
|
|
10704
|
+
priceWithFees: Number((_p = (_o = s9.price_with_fees) != null ? _o : s9.base_price) != null ? _p : 0),
|
|
10705
|
+
priceSymbol: (_r = (_q = s9.price_symbol) != null ? _q : s9.priceSymbol) != null ? _r : "",
|
|
10706
|
+
currency: (_s = s9.price_currency) != null ? _s : "",
|
|
10707
|
+
feeIncluded: s9.fee_included === true,
|
|
10668
10708
|
depositPercent: s9.deposit_percent != null ? Number(s9.deposit_percent) : null,
|
|
10669
10709
|
soldOut: Boolean(s9.sold_out) || stock <= 0,
|
|
10670
10710
|
salesStarted: s9.sales_started != null ? Boolean(s9.sales_started) : true,
|
|
10671
10711
|
salesEnded: Boolean(s9.sales_ended),
|
|
10672
|
-
minQuantity: Number((
|
|
10673
|
-
maxQuantity: Number((
|
|
10674
|
-
multiplier: Number((
|
|
10675
|
-
isTable: Boolean(s9.is_table),
|
|
10676
|
-
|
|
10677
|
-
|
|
10678
|
-
|
|
10712
|
+
minQuantity: Number((_t = s9.min_quantity) != null ? _t : 1) || 1,
|
|
10713
|
+
maxQuantity: Number((_u = s9.max_quantity) != null ? _u : 10),
|
|
10714
|
+
multiplier: Number((_v = s9.multiplier) != null ? _v : 1) || 1,
|
|
10715
|
+
isTable: s9.x_is_table !== void 0 && s9.x_is_table !== null ? Number(s9.x_is_table) === 1 : Boolean(s9.is_table),
|
|
10716
|
+
minGuests: s9.min_guests === void 0 || s9.min_guests === null ? void 0 : Number(s9.min_guests),
|
|
10717
|
+
maxGuests: s9.max_guests === void 0 || s9.max_guests === null ? void 0 : Number(s9.max_guests),
|
|
10718
|
+
allowDirectPurchase: Number((_w = s9.allow_direct_purchase_for_seat_map) != null ? _w : 1) === 1,
|
|
10719
|
+
descriptionRich: (_y = (_x = s9.x_description_rich) != null ? _x : s9.description) != null ? _y : null,
|
|
10720
|
+
badgeText: badgeOf((_z = s9.badge_text) != null ? _z : s9.badgeText),
|
|
10679
10721
|
timeSlot: { date: slotDate, time: timeKey }
|
|
10680
10722
|
});
|
|
10681
10723
|
}
|
|
@@ -10812,7 +10854,7 @@ var getEventTicketsWithMeta = async (eventId) => {
|
|
|
10812
10854
|
const attrs = (_b = (_a2 = body3 == null ? void 0 : body3.data) == null ? void 0 : _a2.attributes) != null ? _b : {};
|
|
10813
10855
|
const ticketsObj = (_c = attrs.tickets) != null ? _c : {};
|
|
10814
10856
|
return {
|
|
10815
|
-
tickets: Object.values(ticketsObj).map(mapTicket),
|
|
10857
|
+
tickets: Object.values(ticketsObj).map((ticket) => mapTicket(ticket, eventId)),
|
|
10816
10858
|
promo: {
|
|
10817
10859
|
isPromotionsEnabled: attrs.isPromotionsEnabled === true,
|
|
10818
10860
|
isAccessCodeEnabled: attrs.is_access_code === true,
|
|
@@ -20596,15 +20638,15 @@ var useCheckoutImageField = ({
|
|
|
20596
20638
|
value: value6,
|
|
20597
20639
|
onChange,
|
|
20598
20640
|
pick: pick3,
|
|
20599
|
-
identity,
|
|
20641
|
+
identity: identity2,
|
|
20600
20642
|
disabled = false
|
|
20601
20643
|
}) => {
|
|
20602
20644
|
const assertOwner = useSessionAction();
|
|
20603
20645
|
const [busy, setBusy] = (0, import_react35.useState)(false);
|
|
20604
20646
|
const [error, setError] = (0, import_react35.useState)(null);
|
|
20605
|
-
const owner = (0, import_react35.useRef)({ identity, value: value6, disabled });
|
|
20606
|
-
if (owner.current.identity !==
|
|
20607
|
-
owner.current = { identity, value: value6, disabled };
|
|
20647
|
+
const owner = (0, import_react35.useRef)({ identity: identity2, value: value6, disabled });
|
|
20648
|
+
if (owner.current.identity !== identity2 || owner.current.value !== value6 || owner.current.disabled !== disabled)
|
|
20649
|
+
owner.current = { identity: identity2, value: value6, disabled };
|
|
20608
20650
|
const renderOwner = owner.current;
|
|
20609
20651
|
const operation = (0, import_react35.useRef)(0);
|
|
20610
20652
|
const inFlight = (0, import_react35.useRef)(false);
|
|
@@ -20622,7 +20664,7 @@ var useCheckoutImageField = ({
|
|
|
20622
20664
|
inFlight.current = false;
|
|
20623
20665
|
setBusy(false);
|
|
20624
20666
|
setError(null);
|
|
20625
|
-
}, [
|
|
20667
|
+
}, [identity2, value6, disabled]);
|
|
20626
20668
|
const select = async (picker = pick3) => {
|
|
20627
20669
|
if (!mounted.current || owner.current !== renderOwner || !picker || disabled || inFlight.current)
|
|
20628
20670
|
return;
|
|
@@ -21997,7 +22039,7 @@ var useTicketCatalog = (eventId, explicitDates) => {
|
|
|
21997
22039
|
}
|
|
21998
22040
|
};
|
|
21999
22041
|
};
|
|
22000
|
-
const [
|
|
22042
|
+
const [selection, updateSelection] = useScopedState(subject, { rows: EMPTY_TICKETS, date: "", quantities: {} });
|
|
22001
22043
|
const [slotDate, updateDate] = useScopedState(subject, "");
|
|
22002
22044
|
const [refreshing, setRefreshing] = useScopedState(subject, false);
|
|
22003
22045
|
const eventQuery = useEvent(eventId);
|
|
@@ -22017,25 +22059,76 @@ var useTicketCatalog = (eventId, explicitDates) => {
|
|
|
22017
22059
|
const base = (_b2 = (_a3 = ticketsQuery.data) == null ? void 0 : _a3.tickets) != null ? _b2 : EMPTY_TICKETS;
|
|
22018
22060
|
if (!isTimeSlot)
|
|
22019
22061
|
return { tickets: base, datedTickets: EMPTY_TICKETS, regularTickets: EMPTY_TICKETS };
|
|
22020
|
-
const
|
|
22062
|
+
const currencies = [...new Set(base.map((ticket) => ticket.currency).filter(Boolean))];
|
|
22063
|
+
const currency = (eventInfo == null ? void 0 : eventInfo.currency) || (currencies.length === 1 ? currencies[0] : "");
|
|
22064
|
+
const symbols = [
|
|
22065
|
+
...new Set(
|
|
22066
|
+
base.filter((ticket) => ticket.currency === currency).map((ticket) => ticket.priceSymbol).filter(Boolean)
|
|
22067
|
+
)
|
|
22068
|
+
];
|
|
22069
|
+
const symbol = (eventInfo == null ? void 0 : eventInfo.priceSymbol) || (symbols.length === 1 ? symbols[0] : "");
|
|
22070
|
+
const dated = (slotQuery.isPlaceholderData ? EMPTY_TICKETS : (_c2 = slotQuery.data) != null ? _c2 : EMPTY_TICKETS).map((ticket) => ({
|
|
22071
|
+
...ticket,
|
|
22072
|
+
currency: ticket.currency || currency,
|
|
22073
|
+
priceSymbol: ticket.priceSymbol || symbol
|
|
22074
|
+
}));
|
|
22021
22075
|
const rows2 = calendarTicketRows(base, dated);
|
|
22022
22076
|
return {
|
|
22023
22077
|
tickets: rows2,
|
|
22024
22078
|
datedTickets: dated,
|
|
22025
22079
|
regularTickets: rows2.slice(dated.length)
|
|
22026
22080
|
};
|
|
22027
|
-
}, [
|
|
22081
|
+
}, [
|
|
22082
|
+
eventInfo,
|
|
22083
|
+
explicitDates,
|
|
22084
|
+
isTimeSlot,
|
|
22085
|
+
(_b = ticketsQuery.data) == null ? void 0 : _b.tickets,
|
|
22086
|
+
slotQuery.data,
|
|
22087
|
+
slotQuery.isPlaceholderData
|
|
22088
|
+
]);
|
|
22089
|
+
const liveCatalog = (0, import_react42.useRef)({ tickets, date: slotDate });
|
|
22090
|
+
(0, import_react42.useLayoutEffect)(() => {
|
|
22091
|
+
liveCatalog.current = { tickets, date: slotDate };
|
|
22092
|
+
}, [tickets, slotDate]);
|
|
22093
|
+
const qty = (0, import_react42.useMemo)(
|
|
22094
|
+
() => catalogQuantities(
|
|
22095
|
+
selection.quantities,
|
|
22096
|
+
tickets,
|
|
22097
|
+
selection.rows,
|
|
22098
|
+
selection.date !== slotDate
|
|
22099
|
+
),
|
|
22100
|
+
[selection, tickets, slotDate]
|
|
22101
|
+
);
|
|
22028
22102
|
(0, import_react42.useEffect)(() => {
|
|
22029
22103
|
if (!current5()) return;
|
|
22030
22104
|
const next = isTimeSlot ? catalogDate(slotDate, dates) : "";
|
|
22031
22105
|
if (next !== slotDate) updateDate(next);
|
|
22032
|
-
|
|
22033
|
-
|
|
22106
|
+
updateSelection((previous) => {
|
|
22107
|
+
const quantities = catalogQuantities(
|
|
22108
|
+
previous.quantities,
|
|
22109
|
+
tickets,
|
|
22110
|
+
previous.rows,
|
|
22111
|
+
previous.date !== slotDate
|
|
22112
|
+
);
|
|
22113
|
+
return previous.rows === tickets && previous.date === slotDate && quantities === previous.quantities ? previous : { rows: tickets, date: slotDate, quantities };
|
|
22114
|
+
});
|
|
22115
|
+
}, [current5, isTimeSlot, slotDate, dates, tickets, updateDate, updateSelection]);
|
|
22034
22116
|
const setQty = (0, import_react42.useCallback)(
|
|
22035
22117
|
(update) => {
|
|
22036
|
-
if (current5())
|
|
22118
|
+
if (current5())
|
|
22119
|
+
updateSelection((previous) => {
|
|
22120
|
+
const { tickets: rows2, date } = liveCatalog.current;
|
|
22121
|
+
const quantities = catalogQuantities(
|
|
22122
|
+
previous.quantities,
|
|
22123
|
+
rows2,
|
|
22124
|
+
previous.rows,
|
|
22125
|
+
previous.date !== date
|
|
22126
|
+
);
|
|
22127
|
+
const requested = typeof update === "function" ? update(quantities) : update;
|
|
22128
|
+
return { rows: rows2, date, quantities: catalogQuantities(requested, rows2) };
|
|
22129
|
+
});
|
|
22037
22130
|
},
|
|
22038
|
-
[current5,
|
|
22131
|
+
[current5, updateSelection]
|
|
22039
22132
|
);
|
|
22040
22133
|
const setSlotDate = (0, import_react42.useCallback)(
|
|
22041
22134
|
(date) => {
|
|
@@ -26763,8 +26856,9 @@ var Tickets = ({
|
|
|
26763
26856
|
const originals = (0, import_react57.useRef)({});
|
|
26764
26857
|
(0, import_react57.useEffect)(() => {
|
|
26765
26858
|
for (const t of tickets)
|
|
26766
|
-
if (originals.current[t
|
|
26767
|
-
|
|
26859
|
+
if (originals.current[ticketPriceContext(catalog.scope, t)] == null)
|
|
26860
|
+
originals.current[ticketPriceContext(catalog.scope, t)] = t.price;
|
|
26861
|
+
}, [tickets, catalog.scope]);
|
|
26768
26862
|
const selected = tickets.filter((t) => {
|
|
26769
26863
|
var _a3;
|
|
26770
26864
|
return ((_a3 = qty[t.id]) != null ? _a3 : 0) > 0;
|
|
@@ -26826,7 +26920,7 @@ var Tickets = ({
|
|
|
26826
26920
|
var _a3, _b2;
|
|
26827
26921
|
const notStarted = !t.salesStarted;
|
|
26828
26922
|
const unavailable = t.soldOut || t.salesEnded || notStarted;
|
|
26829
|
-
const original = originals.current[t
|
|
26923
|
+
const original = originals.current[ticketPriceContext(catalog.scope, t)];
|
|
26830
26924
|
const discounted = original != null && original > t.price;
|
|
26831
26925
|
const isFree = Number(t.price) === 0;
|
|
26832
26926
|
const sym = t.priceSymbol || t.currency;
|
|
@@ -28266,35 +28360,35 @@ var PhoneIdentity = ({
|
|
|
28266
28360
|
...options
|
|
28267
28361
|
}) => {
|
|
28268
28362
|
var _a2;
|
|
28269
|
-
const
|
|
28363
|
+
const identity2 = hooks_exports.useCheckoutPhoneIdentity(options);
|
|
28270
28364
|
const [code, setCode] = (0, import_react63.useState)("");
|
|
28271
28365
|
const [emailInstead, setEmailInstead] = (0, import_react63.useState)(false);
|
|
28272
28366
|
if (emailInstead) return null;
|
|
28273
|
-
if (
|
|
28367
|
+
if (identity2.challenge)
|
|
28274
28368
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
28275
28369
|
TwoFactorForm,
|
|
28276
28370
|
{
|
|
28277
|
-
loading:
|
|
28278
|
-
error:
|
|
28371
|
+
loading: identity2.busy,
|
|
28372
|
+
error: identity2.error,
|
|
28279
28373
|
successMessage: "",
|
|
28280
|
-
smsAvailable:
|
|
28281
|
-
smsRetryAfter:
|
|
28282
|
-
onSubmit:
|
|
28283
|
-
onSendSms:
|
|
28284
|
-
onCancel:
|
|
28374
|
+
smsAvailable: identity2.challenge.smsAvailable,
|
|
28375
|
+
smsRetryAfter: identity2.retryAfter,
|
|
28376
|
+
onSubmit: identity2.verifyTwoFactor,
|
|
28377
|
+
onSendSms: identity2.sendTwoFactorSms,
|
|
28378
|
+
onCancel: identity2.cancel
|
|
28285
28379
|
}
|
|
28286
28380
|
);
|
|
28287
28381
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react_native22.View, { style: { gap: 12, paddingVertical: 12 }, children: [
|
|
28288
28382
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_native22.Text, { children: "Verify your phone to complete your details faster" }),
|
|
28289
|
-
|
|
28290
|
-
|
|
28383
|
+
identity2.error ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ErrorText, { children: identity2.error }) : null,
|
|
28384
|
+
identity2.verified ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
28291
28385
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(MutedText, { children: "Your phone is verified." }),
|
|
28292
|
-
((_a2 =
|
|
28386
|
+
((_a2 = identity2.result) == null ? void 0 : _a2.prefill.has_known_email) === true && typeof identity2.result.prefill.email_masked === "string" ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
28293
28387
|
Checkbox,
|
|
28294
28388
|
{
|
|
28295
28389
|
checked: Boolean(knownEmailSelected),
|
|
28296
28390
|
onChange: onUseKnownEmail,
|
|
28297
|
-
label: `Send my tickets to ${
|
|
28391
|
+
label: `Send my tickets to ${identity2.result.prefill.email_masked}`
|
|
28298
28392
|
}
|
|
28299
28393
|
) : null
|
|
28300
28394
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
@@ -28302,14 +28396,14 @@ var PhoneIdentity = ({
|
|
|
28302
28396
|
Input,
|
|
28303
28397
|
{
|
|
28304
28398
|
accessibilityLabel: "Mobile number",
|
|
28305
|
-
value:
|
|
28306
|
-
onChangeText:
|
|
28399
|
+
value: identity2.phone,
|
|
28400
|
+
onChangeText: identity2.setPhone,
|
|
28307
28401
|
keyboardType: "phone-pad",
|
|
28308
28402
|
autoComplete: "tel",
|
|
28309
|
-
editable: !
|
|
28403
|
+
editable: !identity2.busy && !identity2.sent
|
|
28310
28404
|
}
|
|
28311
28405
|
) }),
|
|
28312
|
-
|
|
28406
|
+
identity2.sent ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
28313
28407
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Field, { label: "Verification code", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
28314
28408
|
Input,
|
|
28315
28409
|
{
|
|
@@ -28320,15 +28414,15 @@ var PhoneIdentity = ({
|
|
|
28320
28414
|
autoComplete: "one-time-code",
|
|
28321
28415
|
maxLength: 6,
|
|
28322
28416
|
accessibilityLabel: "Verification code",
|
|
28323
|
-
editable: !
|
|
28417
|
+
editable: !identity2.busy
|
|
28324
28418
|
}
|
|
28325
28419
|
) }),
|
|
28326
28420
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
28327
28421
|
Button,
|
|
28328
28422
|
{
|
|
28329
|
-
loading:
|
|
28423
|
+
loading: identity2.busy,
|
|
28330
28424
|
disabled: !/^\d{6}$/.test(code),
|
|
28331
|
-
onPress: () => void
|
|
28425
|
+
onPress: () => void identity2.verify(code),
|
|
28332
28426
|
children: "Verify phone"
|
|
28333
28427
|
}
|
|
28334
28428
|
)
|
|
@@ -28336,30 +28430,30 @@ var PhoneIdentity = ({
|
|
|
28336
28430
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
28337
28431
|
Button,
|
|
28338
28432
|
{
|
|
28339
|
-
disabled:
|
|
28340
|
-
onPress: () => void
|
|
28341
|
-
children:
|
|
28433
|
+
disabled: identity2.busy || identity2.retryAfter > 0 || !identity2.phone.trim(),
|
|
28434
|
+
onPress: () => void identity2.request("sms"),
|
|
28435
|
+
children: identity2.retryAfter > 0 ? `Send another code in ${identity2.retryAfter}s` : "Send code by SMS"
|
|
28342
28436
|
}
|
|
28343
28437
|
),
|
|
28344
28438
|
options.whatsappAvailable ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
28345
28439
|
Button,
|
|
28346
28440
|
{
|
|
28347
28441
|
variant: "ghost",
|
|
28348
|
-
disabled:
|
|
28349
|
-
onPress: () => void
|
|
28442
|
+
disabled: identity2.busy || identity2.retryAfter > 0 || !identity2.phone.trim(),
|
|
28443
|
+
onPress: () => void identity2.request("whatsapp"),
|
|
28350
28444
|
children: "Send code by WhatsApp"
|
|
28351
28445
|
}
|
|
28352
28446
|
) : null
|
|
28353
28447
|
] }),
|
|
28354
|
-
(
|
|
28448
|
+
(identity2.sent || identity2.verified) && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
28355
28449
|
Button,
|
|
28356
28450
|
{
|
|
28357
28451
|
variant: "ghost",
|
|
28358
|
-
disabled:
|
|
28452
|
+
disabled: identity2.busy,
|
|
28359
28453
|
onPress: () => {
|
|
28360
28454
|
setCode("");
|
|
28361
28455
|
onReset();
|
|
28362
|
-
void
|
|
28456
|
+
void identity2.cancel();
|
|
28363
28457
|
},
|
|
28364
28458
|
children: "Change phone number"
|
|
28365
28459
|
}
|
|
@@ -28368,9 +28462,9 @@ var PhoneIdentity = ({
|
|
|
28368
28462
|
Button,
|
|
28369
28463
|
{
|
|
28370
28464
|
variant: "ghost",
|
|
28371
|
-
disabled:
|
|
28465
|
+
disabled: identity2.busy,
|
|
28372
28466
|
onPress: () => {
|
|
28373
|
-
void
|
|
28467
|
+
void identity2.cancel().then(() => setEmailInstead(true));
|
|
28374
28468
|
},
|
|
28375
28469
|
children: "Use email instead"
|
|
28376
28470
|
}
|