@scopetickets/checkout 0.4.2 → 0.6.0
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 +13 -10
- package/dist/analytics.cjs +91 -0
- package/dist/analytics.cjs.map +1 -0
- package/dist/analytics.d.cts +291 -0
- package/dist/analytics.d.ts +291 -0
- package/dist/analytics.js +65 -0
- package/dist/analytics.js.map +1 -0
- package/dist/{chunk-WT7WSYIH.js → chunk-VS7ACUTQ.js} +1928 -1840
- package/dist/chunk-VS7ACUTQ.js.map +1 -0
- package/dist/index.cjs +11641 -8141
- package/dist/index.cjs.map +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +459 -84
- package/dist/index.d.ts +459 -84
- package/dist/index.js +11753 -8338
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +27 -14
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.css +82 -3
- package/dist/pickers.css.map +1 -1
- package/dist/pickers.d.cts +45 -15
- package/dist/pickers.d.ts +45 -15
- package/dist/pickers.js +1 -1
- package/dist/styles.css +218 -10
- package/package.json +7 -2
- package/dist/chunk-WT7WSYIH.js.map +0 -1
|
@@ -46,6 +46,8 @@ var INCOMING_FADE_MS = 175;
|
|
|
46
46
|
var DAY_SWAP_STRETCH = 1.6;
|
|
47
47
|
var DAY_SWAP_OUT_MS = Math.round(OUTGOING_FADE_MS * DAY_SWAP_STRETCH);
|
|
48
48
|
var DAY_SWAP_IN_MS = Math.round(INCOMING_FADE_MS * DAY_SWAP_STRETCH);
|
|
49
|
+
var ARC_LEAD_BEZIER = [0.61, 1, 0.88, 1];
|
|
50
|
+
var ARC_TRAIL_BEZIER = [0.12, 0, 0.39, 0];
|
|
49
51
|
var CARRY_MOVE_DELAY_MS = SURFACE_MORPH_DELAY_MS;
|
|
50
52
|
var CARRY_MOVE_MS = settleMs(CARRY_SPRING);
|
|
51
53
|
var POP_SCALE = 0.95;
|
|
@@ -172,43 +174,6 @@ function userTypeNames(rows) {
|
|
|
172
174
|
return Object.fromEntries(rows.map((row) => [row.AssignmentKey, row.Name]));
|
|
173
175
|
}
|
|
174
176
|
|
|
175
|
-
// ../checkout-core/src/domain/money.ts
|
|
176
|
-
var MONEY_LOCALE = "en-IE";
|
|
177
|
-
function formatterFor(currency) {
|
|
178
|
-
return new Intl.NumberFormat(MONEY_LOCALE, { style: "currency", currency });
|
|
179
|
-
}
|
|
180
|
-
function minorUnitDigits(formatter) {
|
|
181
|
-
return formatter.resolvedOptions().maximumFractionDigits ?? 2;
|
|
182
|
-
}
|
|
183
|
-
function formatMoney(minorUnits, currency) {
|
|
184
|
-
const formatter = formatterFor(currency);
|
|
185
|
-
return formatter.format(minorUnits / 10 ** minorUnitDigits(formatter));
|
|
186
|
-
}
|
|
187
|
-
function moneyParts(minorUnits, currency) {
|
|
188
|
-
const formatter = formatterFor(currency);
|
|
189
|
-
const digits = minorUnitDigits(formatter);
|
|
190
|
-
const plain = new Intl.NumberFormat(MONEY_LOCALE, {
|
|
191
|
-
minimumFractionDigits: digits,
|
|
192
|
-
maximumFractionDigits: digits
|
|
193
|
-
});
|
|
194
|
-
const value = minorUnits / 10 ** digits;
|
|
195
|
-
const magnitude = Math.abs(value);
|
|
196
|
-
const symbol = formatter.format(magnitude).replace(plain.format(magnitude), "").replace(/\s/gu, "");
|
|
197
|
-
return { symbol, amount: plain.format(value) };
|
|
198
|
-
}
|
|
199
|
-
function widestAmount(amounts) {
|
|
200
|
-
return amounts.reduce((widest, amount) => Math.max(widest, amount.length), 0);
|
|
201
|
-
}
|
|
202
|
-
function quoteLines(quote) {
|
|
203
|
-
if (quote.kind === "NONE") return null;
|
|
204
|
-
const headline = formatMoney(quote.minorUnits, quote.currency);
|
|
205
|
-
if (quote.kind === "FROM") return { qualifier: "From", headline };
|
|
206
|
-
if (quote.kind === "SAVING") {
|
|
207
|
-
return { qualifier: `Save ${formatMoney(quote.savedMinorUnits, quote.currency)}`, headline };
|
|
208
|
-
}
|
|
209
|
-
return { qualifier: null, headline };
|
|
210
|
-
}
|
|
211
|
-
|
|
212
177
|
// ../checkout-core/src/domain/island-timeslots.ts
|
|
213
178
|
function slotFullness(remaining, total) {
|
|
214
179
|
if (!Number.isFinite(remaining) || remaining < 0) return null;
|
|
@@ -317,12 +282,11 @@ function sameTimeslots(a, b) {
|
|
|
317
282
|
if (a.length !== b.length) return false;
|
|
318
283
|
return a.every((slot, index) => {
|
|
319
284
|
const other = b[index];
|
|
320
|
-
return slot.startTime === other.startTime && slot.endTime === other.endTime && slot.remaining === other.remaining;
|
|
285
|
+
return slot.startTime === other.startTime && slot.endTime === other.endTime && slot.remaining === other.remaining && slot.product === other.product;
|
|
321
286
|
});
|
|
322
287
|
}
|
|
323
288
|
function buildTimeslotGroups(slots, options) {
|
|
324
289
|
const groups = [];
|
|
325
|
-
const byPart = /* @__PURE__ */ new Map();
|
|
326
290
|
const chronological = [...slots].sort((a, b) => a.startTime.localeCompare(b.startTime));
|
|
327
291
|
const cellFor = (slot) => ({
|
|
328
292
|
slot,
|
|
@@ -330,15 +294,25 @@ function buildTimeslotGroups(slots, options) {
|
|
|
330
294
|
state: timeslotState(slot, options),
|
|
331
295
|
duration: formatSlotDuration(slot.startTime, slot.endTime)
|
|
332
296
|
});
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
297
|
+
const grouping = options.grouping ?? "PART_OF_DAY";
|
|
298
|
+
if (grouping === "NONE") {
|
|
299
|
+
return chronological.length === 0 ? [] : [{ key: "ALL", part: null, label: null, cells: chronological.map(cellFor) }];
|
|
300
|
+
}
|
|
301
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
302
|
+
const groupOf = (slot) => {
|
|
303
|
+
if (grouping === "PRODUCT") {
|
|
304
|
+
const product = slot.product?.trim() ?? "";
|
|
305
|
+
return product === "" ? { key: "PRODUCT:", part: null, label: null } : { key: `PRODUCT:${product}`, part: null, label: product };
|
|
306
|
+
}
|
|
337
307
|
const part = partOfDay(slot.startTime);
|
|
338
|
-
|
|
308
|
+
return { key: part, part, label: partOfDayLabel(part) };
|
|
309
|
+
};
|
|
310
|
+
for (const slot of chronological) {
|
|
311
|
+
const head = groupOf(slot);
|
|
312
|
+
let group = byKey.get(head.key);
|
|
339
313
|
if (!group) {
|
|
340
|
-
group = {
|
|
341
|
-
|
|
314
|
+
group = { ...head, cells: [] };
|
|
315
|
+
byKey.set(head.key, group);
|
|
342
316
|
groups.push(group);
|
|
343
317
|
}
|
|
344
318
|
group.cells.push(cellFor(slot));
|
|
@@ -661,6 +635,47 @@ function toggleSelectedDay(selected, day) {
|
|
|
661
635
|
return selected === day ? null : day;
|
|
662
636
|
}
|
|
663
637
|
|
|
638
|
+
// ../checkout-core/src/domain/money.ts
|
|
639
|
+
var MONEY_LOCALE = "en-IE";
|
|
640
|
+
function formatterFor(currency) {
|
|
641
|
+
return new Intl.NumberFormat(MONEY_LOCALE, { style: "currency", currency });
|
|
642
|
+
}
|
|
643
|
+
function minorUnitDigits(formatter) {
|
|
644
|
+
return formatter.resolvedOptions().maximumFractionDigits ?? 2;
|
|
645
|
+
}
|
|
646
|
+
function majorUnits(minorUnits, currency) {
|
|
647
|
+
const digits = minorUnitDigits(formatterFor(currency));
|
|
648
|
+
return Number((minorUnits / 10 ** digits).toFixed(digits));
|
|
649
|
+
}
|
|
650
|
+
function formatMoney(minorUnits, currency) {
|
|
651
|
+
const formatter = formatterFor(currency);
|
|
652
|
+
return formatter.format(minorUnits / 10 ** minorUnitDigits(formatter));
|
|
653
|
+
}
|
|
654
|
+
function moneyParts(minorUnits, currency) {
|
|
655
|
+
const formatter = formatterFor(currency);
|
|
656
|
+
const digits = minorUnitDigits(formatter);
|
|
657
|
+
const plain = new Intl.NumberFormat(MONEY_LOCALE, {
|
|
658
|
+
minimumFractionDigits: digits,
|
|
659
|
+
maximumFractionDigits: digits
|
|
660
|
+
});
|
|
661
|
+
const value = minorUnits / 10 ** digits;
|
|
662
|
+
const magnitude = Math.abs(value);
|
|
663
|
+
const symbol = formatter.format(magnitude).replace(plain.format(magnitude), "").replace(/\s/gu, "");
|
|
664
|
+
return { symbol, amount: plain.format(value) };
|
|
665
|
+
}
|
|
666
|
+
function widestAmount(amounts) {
|
|
667
|
+
return amounts.reduce((widest, amount) => Math.max(widest, amount.length), 0);
|
|
668
|
+
}
|
|
669
|
+
function quoteLines(quote) {
|
|
670
|
+
if (quote.kind === "NONE") return null;
|
|
671
|
+
const headline = formatMoney(quote.minorUnits, quote.currency);
|
|
672
|
+
if (quote.kind === "FROM") return { qualifier: "From", headline };
|
|
673
|
+
if (quote.kind === "SAVING") {
|
|
674
|
+
return { qualifier: `Save ${formatMoney(quote.savedMinorUnits, quote.currency)}`, headline };
|
|
675
|
+
}
|
|
676
|
+
return { qualifier: null, headline };
|
|
677
|
+
}
|
|
678
|
+
|
|
664
679
|
// src/island/PartyStepper.tsx
|
|
665
680
|
import { useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
|
|
666
681
|
import { MinusMarkIcon, PlusMarkIcon } from "@scopetickets/icons";
|
|
@@ -709,7 +724,8 @@ var DISMISS_COPY = {
|
|
|
709
724
|
};
|
|
710
725
|
var ISLAND_COPY = {
|
|
711
726
|
order: "Your order",
|
|
712
|
-
runWeeks: "Weeks of the run"
|
|
727
|
+
runWeeks: "Weeks of the run",
|
|
728
|
+
inventories: "Show sessions"
|
|
713
729
|
};
|
|
714
730
|
var TIMESLOT_COPY = {
|
|
715
731
|
/**
|
|
@@ -988,459 +1004,875 @@ function PartyStepper({
|
|
|
988
1004
|
)) });
|
|
989
1005
|
}
|
|
990
1006
|
|
|
991
|
-
// src/island/
|
|
992
|
-
import {
|
|
993
|
-
CheckInCircleFilledIcon,
|
|
994
|
-
ExclamationMarkInCircleFilledIcon,
|
|
995
|
-
XMarkInCircleFilledIcon
|
|
996
|
-
} from "@scopetickets/icons";
|
|
1007
|
+
// src/island/DayPicker.tsx
|
|
1008
|
+
import { useCallback as useCallback2, useEffect as useEffect4, useMemo as useMemo2, useState as useState4 } from "react";
|
|
997
1009
|
|
|
998
|
-
//
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
paymentHostUrl: "https://sandbox.pay.scopetickets.com",
|
|
1003
|
-
artworkUrl: "https://cdn.scopetickets.com",
|
|
1004
|
-
passkeyRpId: "testlink.scopetickets.com",
|
|
1005
|
-
passkeyHostUrl: "https://passkeys.testlink.scopetickets.com"
|
|
1006
|
-
},
|
|
1007
|
-
production: {
|
|
1008
|
-
apiUrl: "https://link.scopetickets.com",
|
|
1009
|
-
paymentHostUrl: "https://pay.scopetickets.com",
|
|
1010
|
-
artworkUrl: "https://cdn.scopetickets.com",
|
|
1011
|
-
passkeyRpId: "link.scopetickets.com",
|
|
1012
|
-
passkeyHostUrl: "https://passkeys.link.scopetickets.com"
|
|
1013
|
-
},
|
|
1014
|
-
internal: {
|
|
1015
|
-
apiUrl: "https://testlink.scopetickets.com",
|
|
1016
|
-
paymentHostUrl: "http://localhost:3001",
|
|
1017
|
-
artworkUrl: "https://cdn.scopetickets.com",
|
|
1018
|
-
/*
|
|
1019
|
-
* `localhost` IS ITS OWN RP ID, and the one origin a browser will do WebAuthn on
|
|
1020
|
-
* without TLS. A local host cannot borrow the staging id: `localhost` is not a
|
|
1021
|
-
* suffix of `testlink.scopetickets.com`, so a credential made here is a local one
|
|
1022
|
-
* and does not carry to staging.
|
|
1023
|
-
*/
|
|
1024
|
-
passkeyRpId: "localhost",
|
|
1025
|
-
passkeyHostUrl: "http://localhost:3002"
|
|
1026
|
-
}
|
|
1027
|
-
};
|
|
1028
|
-
var MAX_HOST_URL_LENGTH = 256;
|
|
1029
|
-
var HOST_PROTOCOLS = /* @__PURE__ */ new Set(["https:", "http:"]);
|
|
1030
|
-
function acceptableHostUrl(value) {
|
|
1031
|
-
if (typeof value !== "string") return null;
|
|
1032
|
-
const text = value.trim();
|
|
1033
|
-
if (text.length === 0 || text.length > MAX_HOST_URL_LENGTH) return null;
|
|
1034
|
-
let url;
|
|
1035
|
-
try {
|
|
1036
|
-
url = new URL(text);
|
|
1037
|
-
} catch {
|
|
1038
|
-
return null;
|
|
1039
|
-
}
|
|
1040
|
-
if (!HOST_PROTOCOLS.has(url.protocol)) return null;
|
|
1041
|
-
if (url.username !== "" || url.password !== "") return null;
|
|
1042
|
-
if (url.search !== "" || url.hash !== "") return null;
|
|
1043
|
-
return `${url.origin}${url.pathname.replace(/\/+$/, "")}`;
|
|
1044
|
-
}
|
|
1045
|
-
function resolveEnvironmentUrls(environment, overrides = {}) {
|
|
1046
|
-
const defaults = ENVIRONMENT_URLS[environment];
|
|
1047
|
-
return {
|
|
1048
|
-
apiUrl: acceptableHostUrl(overrides.apiUrl) ?? defaults.apiUrl,
|
|
1049
|
-
paymentHostUrl: acceptableHostUrl(overrides.paymentHostUrl) ?? defaults.paymentHostUrl,
|
|
1050
|
-
artworkUrl: acceptableHostUrl(overrides.artworkUrl) ?? defaults.artworkUrl,
|
|
1051
|
-
passkeyRpId: defaults.passkeyRpId,
|
|
1052
|
-
passkeyHostUrl: acceptableHostUrl(overrides.passkeyHostUrl) ?? defaults.passkeyHostUrl
|
|
1053
|
-
};
|
|
1010
|
+
// src/island/CalendarMonthHeading.tsx
|
|
1011
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
1012
|
+
function CalendarMonthHeading({ month }) {
|
|
1013
|
+
return /* @__PURE__ */ jsx2("h3", { className: "scopetickets-island-calendar__heading", children: formatMonthName(month) });
|
|
1054
1014
|
}
|
|
1055
1015
|
|
|
1056
|
-
//
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1016
|
+
// src/island/CalendarDayIndicator.tsx
|
|
1017
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1018
|
+
var SEGMENTS = 3;
|
|
1019
|
+
var FILLED_SEGMENTS = {
|
|
1020
|
+
LOW: 1,
|
|
1021
|
+
MEDIUM: 2,
|
|
1022
|
+
HIGH: 3
|
|
1063
1023
|
};
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
/** Whether a user session is in force, rather than the app key alone. */
|
|
1096
|
-
hasAuthorization() {
|
|
1097
|
-
return this.sessionAuthorization !== null;
|
|
1098
|
-
}
|
|
1099
|
-
getAuthHeaders() {
|
|
1100
|
-
if (this.sessionAuthorization !== null) {
|
|
1101
|
-
return { Authorization: this.sessionAuthorization };
|
|
1102
|
-
}
|
|
1103
|
-
if (this.config.apiKey) {
|
|
1104
|
-
return { Authorization: `Bearer ${this.config.apiKey}` };
|
|
1105
|
-
}
|
|
1106
|
-
return {};
|
|
1024
|
+
function CalendarDayIndicator({ level }) {
|
|
1025
|
+
const filled = FILLED_SEGMENTS[level];
|
|
1026
|
+
return (
|
|
1027
|
+
// DECORATIVE, and now correctly so.
|
|
1028
|
+
/* @__PURE__ */ jsxs2("span", { className: "scopetickets-island-day-indicator", "aria-hidden": "true", children: [
|
|
1029
|
+
/* @__PURE__ */ jsx3(
|
|
1030
|
+
"span",
|
|
1031
|
+
{
|
|
1032
|
+
className: `scopetickets-island-day-indicator__fill scopetickets-island-day-indicator__fill--${level.toLowerCase()}`,
|
|
1033
|
+
style: { flexGrow: filled }
|
|
1034
|
+
}
|
|
1035
|
+
),
|
|
1036
|
+
filled < SEGMENTS ? /* @__PURE__ */ jsx3("span", { style: { flexGrow: SEGMENTS - filled } }) : null
|
|
1037
|
+
] })
|
|
1038
|
+
);
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
// src/island/CalendarDay.tsx
|
|
1042
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1043
|
+
function CalendarDay({
|
|
1044
|
+
cell,
|
|
1045
|
+
accessory,
|
|
1046
|
+
remaining,
|
|
1047
|
+
label,
|
|
1048
|
+
outsideMonth = false,
|
|
1049
|
+
onSelect
|
|
1050
|
+
}) {
|
|
1051
|
+
const press = useIslandPress("element");
|
|
1052
|
+
const dimmed = outsideMonth ? { "data-outside-month": "" } : null;
|
|
1053
|
+
if (cell.kind === "EMPTY") {
|
|
1054
|
+
return /* @__PURE__ */ jsx4("span", { className: "scopetickets-island-day", "aria-hidden": "true" });
|
|
1107
1055
|
}
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1056
|
+
if (isSelectableCalendarCell(cell)) {
|
|
1057
|
+
return /* @__PURE__ */ jsx4(
|
|
1058
|
+
CalendarDayButton,
|
|
1059
|
+
{
|
|
1060
|
+
cell,
|
|
1061
|
+
accessory,
|
|
1062
|
+
remaining,
|
|
1063
|
+
label,
|
|
1064
|
+
onSelect,
|
|
1065
|
+
outsideMonth,
|
|
1066
|
+
press
|
|
1067
|
+
}
|
|
1068
|
+
);
|
|
1111
1069
|
}
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1070
|
+
if (cell.kind === "UNAVAILABLE") {
|
|
1071
|
+
return /* @__PURE__ */ jsx4(
|
|
1072
|
+
CalendarDayButton,
|
|
1073
|
+
{
|
|
1074
|
+
cell,
|
|
1075
|
+
accessory,
|
|
1076
|
+
remaining: null,
|
|
1077
|
+
label,
|
|
1078
|
+
outsideMonth,
|
|
1079
|
+
press
|
|
1119
1080
|
}
|
|
1120
|
-
});
|
|
1121
|
-
if (!response.ok) {
|
|
1122
|
-
this.reportIfRefused(response.status);
|
|
1123
|
-
let errorResponse;
|
|
1124
|
-
try {
|
|
1125
|
-
errorResponse = await response.json();
|
|
1126
|
-
} catch (e) {
|
|
1127
|
-
console.error("Failed to parse API error response:", e);
|
|
1128
|
-
throw new ApiError("UnknownError", `API error: ${response.status} ${response.statusText}`);
|
|
1129
|
-
}
|
|
1130
|
-
throw new ApiError(errorResponse.Reason, errorResponse.Message);
|
|
1131
|
-
}
|
|
1132
|
-
const text = await response.text();
|
|
1133
|
-
if (!text) {
|
|
1134
|
-
return void 0;
|
|
1135
|
-
}
|
|
1136
|
-
try {
|
|
1137
|
-
return JSON.parse(text);
|
|
1138
|
-
} catch {
|
|
1139
|
-
return text;
|
|
1140
|
-
}
|
|
1141
|
-
}
|
|
1142
|
-
async fetchVoid(endpoint, options) {
|
|
1143
|
-
const response = await fetch(`${this.config.apiUrl}${endpoint}`, {
|
|
1144
|
-
...options,
|
|
1145
|
-
headers: {
|
|
1146
|
-
"Content-Type": "application/json",
|
|
1147
|
-
...this.getAuthHeaders(),
|
|
1148
|
-
...options?.headers
|
|
1149
|
-
}
|
|
1150
|
-
});
|
|
1151
|
-
if (!response.ok) {
|
|
1152
|
-
this.reportIfRefused(response.status);
|
|
1153
|
-
let errorResponse;
|
|
1154
|
-
try {
|
|
1155
|
-
errorResponse = await response.json();
|
|
1156
|
-
} catch (e) {
|
|
1157
|
-
console.error("Failed to parse API error response:", e);
|
|
1158
|
-
throw new ApiError("UnknownError", `API error: ${response.status} ${response.statusText}`);
|
|
1159
|
-
}
|
|
1160
|
-
throw new ApiError(errorResponse.Reason, errorResponse.Message);
|
|
1161
|
-
}
|
|
1162
|
-
}
|
|
1163
|
-
// ===========================================================================
|
|
1164
|
-
// v2 Events
|
|
1165
|
-
// ===========================================================================
|
|
1166
|
-
async getDisplayEvents(signal) {
|
|
1167
|
-
const response = await this.fetch("/api/v2/EventSummaries", { signal });
|
|
1168
|
-
return response.Events;
|
|
1169
|
-
}
|
|
1170
|
-
async getEventInfo(eventKey, read) {
|
|
1171
|
-
return this.eventInformation("event", eventKey, read);
|
|
1172
|
-
}
|
|
1173
|
-
async getSeriesInfo(seriesKey, read) {
|
|
1174
|
-
return this.eventInformation("series", seriesKey, read);
|
|
1175
|
-
}
|
|
1176
|
-
/**
|
|
1177
|
-
* `EventInformation`, for a run or a single event.
|
|
1178
|
-
*
|
|
1179
|
-
* `inventories` NARROWS THE RUN ITSELF, and the platform does the narrowing: the events
|
|
1180
|
-
* that sell nothing from those inventories are gone from `Events`, and the user types are
|
|
1181
|
-
* the ones those inventories' products assign. Repeated on the wire, like
|
|
1182
|
-
* `TicketInformation`'s — see `TicketInformationQuery.inventories`, which is the same
|
|
1183
|
-
* parameter on the other endpoint and the reason both are ANDed rather than substituted.
|
|
1184
|
-
*/
|
|
1185
|
-
async eventInformation(type, key, read) {
|
|
1186
|
-
const params = new URLSearchParams({ type, key });
|
|
1187
|
-
for (const inventory of read?.inventories ?? []) params.append("inventories", inventory);
|
|
1188
|
-
return this.fetch(`/api/v2/EventInformation?${params}`, {
|
|
1189
|
-
signal: read?.signal
|
|
1190
|
-
});
|
|
1191
|
-
}
|
|
1192
|
-
/**
|
|
1193
|
-
* Tickets for any number of events or whole series in one request, each row naming the
|
|
1194
|
-
* events it sells for in `EventKeys`.
|
|
1195
|
-
*
|
|
1196
|
-
* THE ROUTE TO READ TICKETS FROM. `Events/{key}/Tickets` omits a timeslot at
|
|
1197
|
-
* `Remaining: 0` rather than reporting it sold out, so a sold-out session never reaches
|
|
1198
|
-
* the picker at all.
|
|
1199
|
-
*
|
|
1200
|
-
* A MISSPELT PARAMETER IS NOT REFUSED: the platform answers `200 {"Tickets":[]}`, which
|
|
1201
|
-
* reads exactly like an event that sells nothing.
|
|
1202
|
-
*/
|
|
1203
|
-
async getTicketInformation(query, signal) {
|
|
1204
|
-
const params = new URLSearchParams();
|
|
1205
|
-
for (const key of query.events ?? []) params.append("events", key);
|
|
1206
|
-
for (const key of query.series ?? []) params.append("series", key);
|
|
1207
|
-
for (const key of query.inventories ?? []) params.append("inventories", key);
|
|
1208
|
-
if (query.includeTimeslots) params.set("include_timeslots", "true");
|
|
1209
|
-
if (query.includeQuestions) params.set("include_questions", "true");
|
|
1210
|
-
const response = await this.fetch(
|
|
1211
|
-
`/api/v2/TicketInformation?${params}`,
|
|
1212
|
-
{ signal }
|
|
1213
1081
|
);
|
|
1214
|
-
return response.Tickets ?? [];
|
|
1215
1082
|
}
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1083
|
+
return /* @__PURE__ */ jsx4("span", { className: "scopetickets-island-day", ...dimmed, ...press, children: /* @__PURE__ */ jsx4("span", { className: "scopetickets-island-day__well", "data-state": cell.kind, children: /* @__PURE__ */ jsx4("span", { className: "scopetickets-island-day__number", children: cell.dayOfMonth }) }) });
|
|
1084
|
+
}
|
|
1085
|
+
function CalendarDayButton({
|
|
1086
|
+
cell,
|
|
1087
|
+
accessory,
|
|
1088
|
+
remaining,
|
|
1089
|
+
label,
|
|
1090
|
+
outsideMonth = false,
|
|
1091
|
+
press,
|
|
1092
|
+
onSelect
|
|
1093
|
+
}) {
|
|
1094
|
+
const selected = cell.kind === "SELECTED";
|
|
1095
|
+
const availability = readAvailability(remaining);
|
|
1096
|
+
return /* @__PURE__ */ jsx4(
|
|
1097
|
+
"button",
|
|
1098
|
+
{
|
|
1099
|
+
type: "button",
|
|
1100
|
+
className: "scopetickets-island-day",
|
|
1101
|
+
...outsideMonth ? { "data-outside-month": "" } : null,
|
|
1102
|
+
"aria-pressed": onSelect ? selected : void 0,
|
|
1103
|
+
"aria-disabled": onSelect ? void 0 : true,
|
|
1104
|
+
"aria-label": availability === null ? label : `${label}, ${availability.announcement}`,
|
|
1105
|
+
onClick: onSelect ? () => onSelect(cell.day) : void 0,
|
|
1106
|
+
...press,
|
|
1107
|
+
children: /* @__PURE__ */ jsxs3("span", { className: "scopetickets-island-day__well", "data-state": cell.kind, children: [
|
|
1108
|
+
/* @__PURE__ */ jsx4("span", { className: "scopetickets-island-day__number", children: cell.dayOfMonth }),
|
|
1109
|
+
cell.kind === "UNAVAILABLE" ? /* @__PURE__ */ jsx4("span", { className: "scopetickets-island-day__strike", "aria-hidden": "true" }) : null,
|
|
1110
|
+
accessory === "LINE" && availability !== null ? /* @__PURE__ */ jsx4("span", { className: "scopetickets-island-day__accessory", children: /* @__PURE__ */ jsx4(CalendarDayIndicator, { level: availability.level }) }) : null
|
|
1111
|
+
] })
|
|
1112
|
+
}
|
|
1113
|
+
);
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
// src/island/CalendarRunGrid.tsx
|
|
1117
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
1118
|
+
function CalendarRunGrid({
|
|
1119
|
+
series,
|
|
1120
|
+
weeks,
|
|
1121
|
+
currentMonth,
|
|
1122
|
+
accessory,
|
|
1123
|
+
remaining,
|
|
1124
|
+
today,
|
|
1125
|
+
selectedDay,
|
|
1126
|
+
onSelectDay
|
|
1127
|
+
}) {
|
|
1128
|
+
return /* @__PURE__ */ jsx5("div", { className: "scopetickets-island-calendar__grid", children: weeks.map((weekStart) => (
|
|
1129
|
+
// A presentational row: the seven columns are a layout, and announcing "row 3
|
|
1130
|
+
// of 9" describes the grid rather than the run.
|
|
1131
|
+
/* @__PURE__ */ jsx5("div", { className: "scopetickets-island-calendar__week", children: buildWeekRow(series, weekStart, { today, selectedDay }).map((cell, dayIndex) => /* @__PURE__ */ jsx5(
|
|
1132
|
+
CalendarDay,
|
|
1133
|
+
{
|
|
1134
|
+
cell,
|
|
1135
|
+
accessory,
|
|
1136
|
+
remaining: cell.kind === "EMPTY" ? null : remaining?.[cell.day] ?? null,
|
|
1137
|
+
label: cell.kind === "EMPTY" ? "" : formatDayDate(cell.day),
|
|
1138
|
+
outsideMonth: cell.kind !== "EMPTY" && monthOfDay(cell.day) !== currentMonth,
|
|
1139
|
+
onSelect: onSelectDay
|
|
1140
|
+
},
|
|
1141
|
+
cell.kind === "EMPTY" ? `empty-${dayIndex}` : cell.day
|
|
1142
|
+
)) }, weekStart)
|
|
1143
|
+
)) });
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
// src/island/CalendarScroller.tsx
|
|
1147
|
+
import {
|
|
1148
|
+
useCallback,
|
|
1149
|
+
useEffect as useEffect3,
|
|
1150
|
+
useRef as useRef3,
|
|
1151
|
+
useState as useState3
|
|
1152
|
+
} from "react";
|
|
1153
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1154
|
+
var WHEEL_IDLE_MS = 200;
|
|
1155
|
+
var CALENDAR_DRAG_SLOP = 4;
|
|
1156
|
+
function CalendarScroller({
|
|
1157
|
+
children,
|
|
1158
|
+
rowCount,
|
|
1159
|
+
row,
|
|
1160
|
+
onRowChange,
|
|
1161
|
+
onRowPreview,
|
|
1162
|
+
label
|
|
1163
|
+
}) {
|
|
1164
|
+
const viewportRef = useRef3(null);
|
|
1165
|
+
const trackRef = useRef3(null);
|
|
1166
|
+
const startY = useRef3(null);
|
|
1167
|
+
const [offset, setOffset] = useState3(0);
|
|
1168
|
+
const [dragging, setDragging] = useState3(false);
|
|
1169
|
+
const rowRef = useRef3(row);
|
|
1170
|
+
rowRef.current = row;
|
|
1171
|
+
const [rowStep, setRowStep] = useState3(0);
|
|
1172
|
+
const gapPx = (box) => {
|
|
1173
|
+
const gap = Number.parseFloat(
|
|
1174
|
+
getComputedStyle(box).getPropertyValue("--scopetickets-island-day-column-gap")
|
|
1221
1175
|
);
|
|
1222
|
-
return
|
|
1223
|
-
}
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
return this.fetch(`/api/Ticket/Event/${eventId}`);
|
|
1235
|
-
}
|
|
1236
|
-
// ===========================================================================
|
|
1237
|
-
// Cart
|
|
1238
|
-
// ===========================================================================
|
|
1239
|
-
async createCart(eventId) {
|
|
1240
|
-
const body = typeof eventId === "string" ? { EventKey: eventId } : { EventId: eventId };
|
|
1241
|
-
return this.fetch("/api/Cart", {
|
|
1242
|
-
method: "POST",
|
|
1243
|
-
body: JSON.stringify(body)
|
|
1244
|
-
});
|
|
1245
|
-
}
|
|
1246
|
-
async getCart(cartKey) {
|
|
1247
|
-
return this.fetch(`/api/Cart/${cartKey}`);
|
|
1248
|
-
}
|
|
1249
|
-
async addToCart(cartKey, ticketId, timeslot) {
|
|
1250
|
-
const body = timeslot ? { Type: "ticket", ItemId: ticketId, Timeslot: timeslot } : { Type: "ticket", ItemId: ticketId };
|
|
1251
|
-
return this.fetch(`/api/Cart/${cartKey}/Items`, {
|
|
1252
|
-
method: "POST",
|
|
1253
|
-
body: JSON.stringify(body)
|
|
1254
|
-
});
|
|
1255
|
-
}
|
|
1256
|
-
async removeFromCart(cartKey, itemKey) {
|
|
1257
|
-
return this.fetch(`/api/Cart/${cartKey}/Items/${itemKey}`, {
|
|
1258
|
-
method: "DELETE"
|
|
1259
|
-
});
|
|
1260
|
-
}
|
|
1261
|
-
/**
|
|
1262
|
-
* WHETHER A CODE MAY BE USED, AND WHY NOT — the one call that answers the second half.
|
|
1263
|
-
*
|
|
1264
|
-
* THE `PUT` BELOW ONLY APPLIES. It refuses with an `ApiError` whose message is a
|
|
1265
|
-
* transport failure's message, which is not a sentence about a promo code; `Reason` here
|
|
1266
|
-
* is the platform's own words for an expired, spent or wrong-event code, and it is what
|
|
1267
|
-
* the card shows the buyer.
|
|
1268
|
-
*
|
|
1269
|
-
* `event_id` IS WHAT THE WIDGET KNOWS. The endpoint also narrows by ticket, series and
|
|
1270
|
-
* organisation; the cart carries its event and nothing else, so that is what is asked.
|
|
1271
|
-
*/
|
|
1272
|
-
async checkPromoCode(promoCode, eventId) {
|
|
1273
|
-
const params = new URLSearchParams({ code: promoCode, event_id: String(eventId) });
|
|
1274
|
-
return this.fetch(`/api/PromoCode/Check?${params}`);
|
|
1275
|
-
}
|
|
1276
|
-
/**
|
|
1277
|
-
* PUT A PROMO CODE ON THE CART, and take back the cart it made — `TotalAmount` already
|
|
1278
|
-
* discounted, `DiscountAmount` saying by how much, `PromoCode` naming what did it.
|
|
1279
|
-
*
|
|
1280
|
-
* ONE PER CART, which is the wire's rule and not this client's: the field is a single
|
|
1281
|
-
* string, so a second code REPLACES the first rather than stacking on it.
|
|
1282
|
-
*
|
|
1283
|
-
* A REFUSED CODE IS AN `ApiError` like any other refusal — expired, spent, or for a
|
|
1284
|
-
* different event. The reason is the platform's own words; see `promoRefusal`, which is
|
|
1285
|
-
* the only thing allowed to put them in front of a buyer.
|
|
1286
|
-
*/
|
|
1287
|
-
async setCartPromoCode(cartKey, promoCode) {
|
|
1288
|
-
return this.fetch(`/api/Cart/${encodeURIComponent(cartKey)}/PromoCode`, {
|
|
1289
|
-
method: "PUT",
|
|
1290
|
-
body: JSON.stringify({ PromoCode: promoCode })
|
|
1291
|
-
});
|
|
1292
|
-
}
|
|
1293
|
-
/** Take it off again, and the cart comes back at its full price. */
|
|
1294
|
-
async clearCartPromoCode(cartKey) {
|
|
1295
|
-
return this.fetch(`/api/Cart/${encodeURIComponent(cartKey)}/PromoCode`, {
|
|
1296
|
-
method: "DELETE"
|
|
1297
|
-
});
|
|
1298
|
-
}
|
|
1299
|
-
/**
|
|
1300
|
-
* `allowPartial` asks the platform to reserve what it can — see
|
|
1301
|
-
* `BulkAddItemsRequest.AllowPartialFulfillment`. OMITTED rather than sent as `false`
|
|
1302
|
-
* when it is not asked for: a body without it is what every caller already sends.
|
|
1303
|
-
*/
|
|
1304
|
-
async addItemsBulk(cartKey, items, { allowPartial = false } = {}) {
|
|
1305
|
-
const body = {
|
|
1306
|
-
Items: items,
|
|
1307
|
-
...allowPartial ? { AllowPartialFulfillment: true } : {}
|
|
1176
|
+
return Number.isFinite(gap) ? gap : 0;
|
|
1177
|
+
};
|
|
1178
|
+
useEffect3(() => {
|
|
1179
|
+
const track = trackRef.current;
|
|
1180
|
+
if (!track) return void 0;
|
|
1181
|
+
const measure = () => {
|
|
1182
|
+
const row2 = track.querySelector(".scopetickets-island-calendar__week");
|
|
1183
|
+
if (!row2) return;
|
|
1184
|
+
const height = row2.getBoundingClientRect().height;
|
|
1185
|
+
if (height <= 0) return;
|
|
1186
|
+
const step = height + gapPx(track);
|
|
1187
|
+
setRowStep((was) => Math.abs(was - step) < 0.5 ? was : step);
|
|
1308
1188
|
};
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1189
|
+
measure();
|
|
1190
|
+
if (typeof ResizeObserver === "undefined") return void 0;
|
|
1191
|
+
const observer = new ResizeObserver(measure);
|
|
1192
|
+
observer.observe(track);
|
|
1193
|
+
return () => observer.disconnect();
|
|
1194
|
+
}, [rowCount]);
|
|
1195
|
+
const rowHeight = useCallback(() => {
|
|
1196
|
+
if (rowStep > 0) return rowStep;
|
|
1197
|
+
const box = viewportRef.current;
|
|
1198
|
+
if (!box) return 0;
|
|
1199
|
+
return (box.clientHeight + gapPx(box)) / CALENDAR_VIEWPORT_ROWS;
|
|
1200
|
+
}, [rowStep]);
|
|
1201
|
+
const drag = useCallback(
|
|
1202
|
+
(dy) => ({
|
|
1203
|
+
row: rowRef.current,
|
|
1204
|
+
rowCount,
|
|
1205
|
+
viewportRows: CALENDAR_VIEWPORT_ROWS,
|
|
1206
|
+
offset: dy,
|
|
1207
|
+
rowHeight: rowHeight()
|
|
1208
|
+
}),
|
|
1209
|
+
[rowCount, rowHeight]
|
|
1210
|
+
);
|
|
1211
|
+
const draw = useCallback(
|
|
1212
|
+
(dy) => {
|
|
1213
|
+
const moving = drag(dy);
|
|
1214
|
+
setOffset(rowDragOffset(moving));
|
|
1215
|
+
onRowPreview?.(rowAfterDrag(moving));
|
|
1216
|
+
},
|
|
1217
|
+
[drag, onRowPreview]
|
|
1218
|
+
);
|
|
1219
|
+
const settle = useCallback(
|
|
1220
|
+
(dy) => {
|
|
1221
|
+
setOffset(0);
|
|
1222
|
+
const landed = rowAfterDrag(drag(dy));
|
|
1223
|
+
if (landed !== rowRef.current) onRowChange(landed);
|
|
1224
|
+
},
|
|
1225
|
+
[drag, onRowChange]
|
|
1226
|
+
);
|
|
1227
|
+
const dragged = useRef3(false);
|
|
1228
|
+
const onPointerDown = (event) => {
|
|
1229
|
+
if ((event.buttons & 1) !== 1) return;
|
|
1230
|
+
startY.current = event.clientY;
|
|
1231
|
+
dragged.current = false;
|
|
1232
|
+
};
|
|
1233
|
+
const onPointerMove = (event) => {
|
|
1234
|
+
if (startY.current === null) return;
|
|
1235
|
+
const dy = event.clientY - startY.current;
|
|
1236
|
+
if (!dragged.current) {
|
|
1237
|
+
if (Math.abs(dy) < CALENDAR_DRAG_SLOP) return;
|
|
1238
|
+
dragged.current = true;
|
|
1239
|
+
setDragging(true);
|
|
1240
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
1241
|
+
}
|
|
1242
|
+
draw(dy);
|
|
1243
|
+
};
|
|
1244
|
+
const onPointerUp = (event) => {
|
|
1245
|
+
if (startY.current === null) return;
|
|
1246
|
+
const dy = event.clientY - startY.current;
|
|
1247
|
+
startY.current = null;
|
|
1248
|
+
if (!dragged.current) return;
|
|
1249
|
+
setDragging(false);
|
|
1250
|
+
settle(dy);
|
|
1251
|
+
};
|
|
1252
|
+
const onClickCapture = (event) => {
|
|
1253
|
+
if (!dragged.current) return;
|
|
1254
|
+
dragged.current = false;
|
|
1255
|
+
event.stopPropagation();
|
|
1256
|
+
event.preventDefault();
|
|
1257
|
+
};
|
|
1258
|
+
const onPointerCancel = () => {
|
|
1259
|
+
startY.current = null;
|
|
1260
|
+
dragged.current = false;
|
|
1261
|
+
setDragging(false);
|
|
1262
|
+
setOffset(0);
|
|
1263
|
+
};
|
|
1264
|
+
const wheel = useRef3(0);
|
|
1265
|
+
const settleTimer = useRef3(null);
|
|
1266
|
+
useEffect3(() => {
|
|
1267
|
+
const viewport = viewportRef.current;
|
|
1268
|
+
if (!viewport) return void 0;
|
|
1269
|
+
const onWheel = (event) => {
|
|
1270
|
+
event.preventDefault();
|
|
1271
|
+
wheel.current -= event.deltaY;
|
|
1272
|
+
wheel.current = rowDragOffset(drag(wheel.current));
|
|
1273
|
+
draw(wheel.current);
|
|
1274
|
+
if (settleTimer.current !== null) window.clearTimeout(settleTimer.current);
|
|
1275
|
+
settleTimer.current = window.setTimeout(() => {
|
|
1276
|
+
settleTimer.current = null;
|
|
1277
|
+
const travelled = wheel.current;
|
|
1278
|
+
wheel.current = 0;
|
|
1279
|
+
settle(travelled);
|
|
1280
|
+
}, WHEEL_IDLE_MS);
|
|
1281
|
+
};
|
|
1282
|
+
viewport.addEventListener("wheel", onWheel, { passive: false });
|
|
1283
|
+
return () => viewport.removeEventListener("wheel", onWheel);
|
|
1284
|
+
}, [drag, draw, settle]);
|
|
1285
|
+
useEffect3(
|
|
1286
|
+
() => () => {
|
|
1287
|
+
if (settleTimer.current !== null) window.clearTimeout(settleTimer.current);
|
|
1288
|
+
},
|
|
1289
|
+
[]
|
|
1290
|
+
);
|
|
1291
|
+
return /* @__PURE__ */ jsxs4(
|
|
1292
|
+
"div",
|
|
1293
|
+
{
|
|
1294
|
+
ref: viewportRef,
|
|
1295
|
+
className: "scopetickets-island-calendar-scroller",
|
|
1296
|
+
role: "group",
|
|
1297
|
+
"aria-label": label,
|
|
1298
|
+
style: {
|
|
1299
|
+
"--scopetickets-island-viewport-rows": CALENDAR_VIEWPORT_ROWS,
|
|
1300
|
+
...rowStep > 0 ? { "--scopetickets-island-calendar-row-step": `${rowStep}px` } : null
|
|
1301
|
+
},
|
|
1302
|
+
onPointerDown,
|
|
1303
|
+
onPointerMove,
|
|
1304
|
+
onPointerUp,
|
|
1305
|
+
onPointerCancel,
|
|
1306
|
+
onClickCapture,
|
|
1307
|
+
children: [
|
|
1308
|
+
/* @__PURE__ */ jsx6("div", { className: "scopetickets-island-calendar-scroller__window", "aria-hidden": "true" }),
|
|
1309
|
+
/* @__PURE__ */ jsx6(
|
|
1310
|
+
"div",
|
|
1311
|
+
{
|
|
1312
|
+
ref: trackRef,
|
|
1313
|
+
className: "scopetickets-island-calendar-scroller__track",
|
|
1314
|
+
"data-dragging": dragging || offset !== 0 ? "" : void 0,
|
|
1315
|
+
style: {
|
|
1316
|
+
translate: `0 calc(${-row} * var(--scopetickets-island-calendar-row-step) + ${offset}px)`
|
|
1317
|
+
},
|
|
1318
|
+
children
|
|
1319
|
+
}
|
|
1320
|
+
)
|
|
1321
|
+
]
|
|
1322
|
+
}
|
|
1323
|
+
);
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1326
|
+
// src/island/CalendarWeekdayNames.tsx
|
|
1327
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
1328
|
+
var WEEKDAY_NAMES = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
|
|
1329
|
+
function CalendarWeekdayNames() {
|
|
1330
|
+
return (
|
|
1331
|
+
// `aria-hidden`, and it is not a shortcut.
|
|
1332
|
+
/* @__PURE__ */ jsx7("div", { className: "scopetickets-island-calendar__weekdays", "aria-hidden": "true", children: WEEKDAY_NAMES.map((name) => /* @__PURE__ */ jsx7("span", { className: "scopetickets-island-calendar__weekday", children: name }, name)) })
|
|
1333
|
+
);
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
// src/island/DayPicker.tsx
|
|
1337
|
+
import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1338
|
+
function DayPicker({
|
|
1339
|
+
series,
|
|
1340
|
+
offered = series,
|
|
1341
|
+
today,
|
|
1342
|
+
selectedDay,
|
|
1343
|
+
onSelectDay,
|
|
1344
|
+
remaining,
|
|
1345
|
+
accessory = DATE_PICKER_ACCESSORY,
|
|
1346
|
+
onVisibleMonthChange
|
|
1347
|
+
}) {
|
|
1348
|
+
const weeks = useMemo2(() => weeksInCalendar(series), [series]);
|
|
1349
|
+
const starts = useMemo2(() => monthStartRows(weeks), [weeks]);
|
|
1350
|
+
const [row, setRow] = useState4(
|
|
1351
|
+
() => monthOpeningRow(weeks, starts, selectedDay ?? soonestRelevantDay(offered, today))
|
|
1352
|
+
);
|
|
1353
|
+
const [shownRow, setShownRow] = useState4(row);
|
|
1354
|
+
const currentMonth = monthAtRow(starts, shownRow);
|
|
1355
|
+
useEffect4(() => {
|
|
1356
|
+
if (currentMonth !== null) onVisibleMonthChange?.(currentMonth);
|
|
1357
|
+
}, [currentMonth, onVisibleMonthChange]);
|
|
1358
|
+
const selectDay = useCallback2(
|
|
1359
|
+
(day) => {
|
|
1360
|
+
const month = monthOfDay(day);
|
|
1361
|
+
const start = starts.find((candidate) => candidate.month === month);
|
|
1362
|
+
if (start !== void 0 && month !== currentMonth) {
|
|
1363
|
+
setRow(start.row);
|
|
1364
|
+
setShownRow(start.row);
|
|
1365
|
+
}
|
|
1366
|
+
onSelectDay(day);
|
|
1367
|
+
},
|
|
1368
|
+
[starts, currentMonth, onSelectDay]
|
|
1369
|
+
);
|
|
1370
|
+
if (weeks.length === 0) return null;
|
|
1371
|
+
return /* @__PURE__ */ jsxs5("div", { className: "scopetickets-island-calendar", "data-accessory": accessory, children: [
|
|
1372
|
+
currentMonth !== null && /* @__PURE__ */ jsx8(CalendarMonthHeading, { month: currentMonth }),
|
|
1373
|
+
/* @__PURE__ */ jsx8(CalendarWeekdayNames, {}),
|
|
1374
|
+
/* @__PURE__ */ jsx8(
|
|
1375
|
+
CalendarScroller,
|
|
1376
|
+
{
|
|
1377
|
+
rowCount: weeks.length,
|
|
1378
|
+
row,
|
|
1379
|
+
onRowChange: setRow,
|
|
1380
|
+
onRowPreview: setShownRow,
|
|
1381
|
+
label: ISLAND_COPY.runWeeks,
|
|
1382
|
+
children: /* @__PURE__ */ jsx8(
|
|
1383
|
+
CalendarRunGrid,
|
|
1384
|
+
{
|
|
1385
|
+
series: offered,
|
|
1386
|
+
weeks,
|
|
1387
|
+
currentMonth,
|
|
1388
|
+
accessory,
|
|
1389
|
+
remaining,
|
|
1390
|
+
today,
|
|
1391
|
+
selectedDay,
|
|
1392
|
+
onSelectDay: selectDay
|
|
1393
|
+
}
|
|
1394
|
+
)
|
|
1395
|
+
}
|
|
1396
|
+
)
|
|
1397
|
+
] });
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
// src/island/ContentFlag.tsx
|
|
1401
|
+
import {
|
|
1402
|
+
CheckInCircleFilledIcon,
|
|
1403
|
+
ExclamationMarkInCircleFilledIcon,
|
|
1404
|
+
XMarkInCircleFilledIcon
|
|
1405
|
+
} from "@scopetickets/icons";
|
|
1406
|
+
|
|
1407
|
+
// ../api/src/environment.ts
|
|
1408
|
+
var ENVIRONMENT_URLS = {
|
|
1409
|
+
sandbox: {
|
|
1410
|
+
apiUrl: "https://testlink.scopetickets.com",
|
|
1411
|
+
paymentHostUrl: "https://sandbox.pay.scopetickets.com",
|
|
1412
|
+
artworkUrl: "https://cdn.scopetickets.com",
|
|
1413
|
+
passkeyRpId: "testlink.scopetickets.com",
|
|
1414
|
+
passkeyHostUrl: "https://passkeys.testlink.scopetickets.com"
|
|
1415
|
+
},
|
|
1416
|
+
production: {
|
|
1417
|
+
apiUrl: "https://link.scopetickets.com",
|
|
1418
|
+
paymentHostUrl: "https://pay.scopetickets.com",
|
|
1419
|
+
artworkUrl: "https://cdn.scopetickets.com",
|
|
1420
|
+
passkeyRpId: "link.scopetickets.com",
|
|
1421
|
+
passkeyHostUrl: "https://passkeys.link.scopetickets.com"
|
|
1422
|
+
},
|
|
1423
|
+
internal: {
|
|
1424
|
+
apiUrl: "https://testlink.scopetickets.com",
|
|
1425
|
+
paymentHostUrl: "http://localhost:3001",
|
|
1426
|
+
artworkUrl: "https://cdn.scopetickets.com",
|
|
1427
|
+
/*
|
|
1428
|
+
* `localhost` IS ITS OWN RP ID, and the one origin a browser will do WebAuthn on
|
|
1429
|
+
* without TLS. A local host cannot borrow the staging id: `localhost` is not a
|
|
1430
|
+
* suffix of `testlink.scopetickets.com`, so a credential made here is a local one
|
|
1431
|
+
* and does not carry to staging.
|
|
1432
|
+
*/
|
|
1433
|
+
passkeyRpId: "localhost",
|
|
1434
|
+
passkeyHostUrl: "http://localhost:3002"
|
|
1313
1435
|
}
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1436
|
+
};
|
|
1437
|
+
var MAX_HOST_URL_LENGTH = 256;
|
|
1438
|
+
var HOST_PROTOCOLS = /* @__PURE__ */ new Set(["https:", "http:"]);
|
|
1439
|
+
function acceptableHostUrl(value) {
|
|
1440
|
+
if (typeof value !== "string") return null;
|
|
1441
|
+
const text = value.trim();
|
|
1442
|
+
if (text.length === 0 || text.length > MAX_HOST_URL_LENGTH) return null;
|
|
1443
|
+
let url;
|
|
1444
|
+
try {
|
|
1445
|
+
url = new URL(text);
|
|
1446
|
+
} catch {
|
|
1447
|
+
return null;
|
|
1321
1448
|
}
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1449
|
+
if (!HOST_PROTOCOLS.has(url.protocol)) return null;
|
|
1450
|
+
if (url.username !== "" || url.password !== "") return null;
|
|
1451
|
+
if (url.search !== "" || url.hash !== "") return null;
|
|
1452
|
+
return `${url.origin}${url.pathname.replace(/\/+$/, "")}`;
|
|
1453
|
+
}
|
|
1454
|
+
function resolveEnvironmentUrls(environment, overrides = {}) {
|
|
1455
|
+
const defaults = ENVIRONMENT_URLS[environment];
|
|
1456
|
+
return {
|
|
1457
|
+
apiUrl: acceptableHostUrl(overrides.apiUrl) ?? defaults.apiUrl,
|
|
1458
|
+
paymentHostUrl: acceptableHostUrl(overrides.paymentHostUrl) ?? defaults.paymentHostUrl,
|
|
1459
|
+
artworkUrl: acceptableHostUrl(overrides.artworkUrl) ?? defaults.artworkUrl,
|
|
1460
|
+
passkeyRpId: defaults.passkeyRpId,
|
|
1461
|
+
passkeyHostUrl: acceptableHostUrl(overrides.passkeyHostUrl) ?? defaults.passkeyHostUrl
|
|
1462
|
+
};
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
// ../api/src/client.ts
|
|
1466
|
+
var ApiError = class extends Error {
|
|
1467
|
+
constructor(reason, message) {
|
|
1468
|
+
super(message);
|
|
1469
|
+
this.reason = reason;
|
|
1470
|
+
this.name = "ApiError";
|
|
1333
1471
|
}
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1472
|
+
};
|
|
1473
|
+
var ScopeClient = class {
|
|
1474
|
+
constructor(config) {
|
|
1475
|
+
this.sessionAuthorization = null;
|
|
1476
|
+
this.onRefused = null;
|
|
1477
|
+
this.config = config;
|
|
1340
1478
|
}
|
|
1341
1479
|
/**
|
|
1342
|
-
*
|
|
1480
|
+
* WHO TO TELL WHEN A SESSION IS REFUSED — the one signal a session has that it is over.
|
|
1343
1481
|
*
|
|
1344
|
-
*
|
|
1345
|
-
*
|
|
1346
|
-
* this
|
|
1482
|
+
* `LoginResult` carries no expiry, so nothing can know a header has stopped working
|
|
1483
|
+
* until the platform says so. This is where that arrives, and it is a callback on the
|
|
1484
|
+
* INSTANCE rather than anything global: this library runs inside somebody else's page,
|
|
1485
|
+
* and a handler registered anywhere a host could also reach is a handler two things
|
|
1486
|
+
* fight over.
|
|
1487
|
+
*
|
|
1488
|
+
* IT FIRES ONLY WHERE A USER SESSION WAS ACTUALLY SENT. A 401 on the app key alone is
|
|
1489
|
+
* the app being wrong about itself, not a buyer being signed out, and waking the session
|
|
1490
|
+
* machinery for it would expire somebody who was never signed in.
|
|
1347
1491
|
*/
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
`/api/Passcodes/${encodeURIComponent(passcodeKey)}/Status`
|
|
1351
|
-
);
|
|
1492
|
+
setRefusedHandler(handler) {
|
|
1493
|
+
this.onRefused = handler;
|
|
1352
1494
|
}
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1495
|
+
/**
|
|
1496
|
+
* Holds the header a signed-in user's session gave us, or clears it on sign-out.
|
|
1497
|
+
*
|
|
1498
|
+
* Stored and sent VERBATIM, which is right: staging answers `POST /api/Auth/Login`
|
|
1499
|
+
* with the `Bearer ` already on it. Nothing here adds a scheme, and nothing should.
|
|
1500
|
+
*/
|
|
1501
|
+
setAuthorization(authorization) {
|
|
1502
|
+
this.sessionAuthorization = authorization;
|
|
1358
1503
|
}
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
body: JSON.stringify(buyer)
|
|
1363
|
-
});
|
|
1504
|
+
/** Whether a user session is in force, rather than the app key alone. */
|
|
1505
|
+
hasAuthorization() {
|
|
1506
|
+
return this.sessionAuthorization !== null;
|
|
1364
1507
|
}
|
|
1365
|
-
|
|
1366
|
-
|
|
1508
|
+
/**
|
|
1509
|
+
* WHICH IDENTITY A CALL CARRIES, and it is the CALL's, not the client's.
|
|
1510
|
+
*
|
|
1511
|
+
* THE APP KEY ON EVERY APP CALL, EVEN WITH A BUYER SIGNED IN. The platform's event and
|
|
1512
|
+
* ticket reads take whatever follows `Bearer ` as the APPLICATION's key and look it up;
|
|
1513
|
+
* a user session in its place finds no application and answers 401. It used to replace
|
|
1514
|
+
* the app key on every call, so the moment a buyer signed in every event read failed —
|
|
1515
|
+
* "We Could Not Load This Event" on every event, first seen on a device once the native
|
|
1516
|
+
* island could sign somebody in before an event loaded. A session carries no app
|
|
1517
|
+
* identity and there is no second header, so the two cannot travel together.
|
|
1518
|
+
*
|
|
1519
|
+
* THE SESSION ONLY WHERE THE CALL IS THE ACCOUNT'S — who the user is, their profile,
|
|
1520
|
+
* photo, password, follows, passkey registration, and logout — and the app key there
|
|
1521
|
+
* where nobody is signed in. No buyer-flow endpoint reads the caller at all (carts,
|
|
1522
|
+
* transactions, attendees, payments, questionnaires, feedback), so nothing they did is
|
|
1523
|
+
* lost by the app key.
|
|
1524
|
+
*/
|
|
1525
|
+
getAuthHeaders(as) {
|
|
1526
|
+
if (as === "USER" && this.sessionAuthorization !== null) {
|
|
1527
|
+
return { Authorization: this.sessionAuthorization };
|
|
1528
|
+
}
|
|
1529
|
+
if (this.config.apiKey) {
|
|
1530
|
+
return { Authorization: `Bearer ${this.config.apiKey}` };
|
|
1531
|
+
}
|
|
1532
|
+
return {};
|
|
1367
1533
|
}
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1534
|
+
/**
|
|
1535
|
+
* A 401 on a call that CARRIED the session, and nothing else — see `setRefusedHandler`.
|
|
1536
|
+
* An app call refused under the app key says nothing about the buyer; read as a session
|
|
1537
|
+
* refusal it spent the refresh pair and signed a buyer out over an event read.
|
|
1538
|
+
*/
|
|
1539
|
+
reportIfRefused(status, as) {
|
|
1540
|
+
if (status === 401 && as === "USER" && this.sessionAuthorization !== null) {
|
|
1541
|
+
this.onRefused?.();
|
|
1542
|
+
}
|
|
1372
1543
|
}
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1544
|
+
async fetch(endpoint, options, as = "APP") {
|
|
1545
|
+
const response = await fetch(`${this.config.apiUrl}${endpoint}`, {
|
|
1546
|
+
...options,
|
|
1547
|
+
headers: {
|
|
1548
|
+
"Content-Type": "application/json",
|
|
1549
|
+
...this.getAuthHeaders(as),
|
|
1550
|
+
...options?.headers
|
|
1551
|
+
}
|
|
1380
1552
|
});
|
|
1553
|
+
if (!response.ok) {
|
|
1554
|
+
this.reportIfRefused(response.status, as);
|
|
1555
|
+
let errorResponse;
|
|
1556
|
+
try {
|
|
1557
|
+
errorResponse = await response.json();
|
|
1558
|
+
} catch (e) {
|
|
1559
|
+
console.error("Failed to parse API error response:", e);
|
|
1560
|
+
throw new ApiError("UnknownError", `API error: ${response.status} ${response.statusText}`);
|
|
1561
|
+
}
|
|
1562
|
+
throw new ApiError(errorResponse.Reason, errorResponse.Message);
|
|
1563
|
+
}
|
|
1564
|
+
const text = await response.text();
|
|
1565
|
+
if (!text) {
|
|
1566
|
+
return void 0;
|
|
1567
|
+
}
|
|
1568
|
+
try {
|
|
1569
|
+
return JSON.parse(text);
|
|
1570
|
+
} catch {
|
|
1571
|
+
return text;
|
|
1572
|
+
}
|
|
1381
1573
|
}
|
|
1382
|
-
async
|
|
1383
|
-
|
|
1574
|
+
async fetchVoid(endpoint, options, as = "APP") {
|
|
1575
|
+
const response = await fetch(`${this.config.apiUrl}${endpoint}`, {
|
|
1576
|
+
...options,
|
|
1577
|
+
headers: {
|
|
1578
|
+
"Content-Type": "application/json",
|
|
1579
|
+
...this.getAuthHeaders(as),
|
|
1580
|
+
...options?.headers
|
|
1581
|
+
}
|
|
1582
|
+
});
|
|
1583
|
+
if (!response.ok) {
|
|
1584
|
+
this.reportIfRefused(response.status, as);
|
|
1585
|
+
let errorResponse;
|
|
1586
|
+
try {
|
|
1587
|
+
errorResponse = await response.json();
|
|
1588
|
+
} catch (e) {
|
|
1589
|
+
console.error("Failed to parse API error response:", e);
|
|
1590
|
+
throw new ApiError("UnknownError", `API error: ${response.status} ${response.statusText}`);
|
|
1591
|
+
}
|
|
1592
|
+
throw new ApiError(errorResponse.Reason, errorResponse.Message);
|
|
1593
|
+
}
|
|
1384
1594
|
}
|
|
1385
1595
|
// ===========================================================================
|
|
1386
|
-
//
|
|
1596
|
+
// v2 Events
|
|
1387
1597
|
// ===========================================================================
|
|
1388
|
-
async
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
body: JSON.stringify({ CartKey: cartKey })
|
|
1392
|
-
});
|
|
1598
|
+
async getDisplayEvents(signal) {
|
|
1599
|
+
const response = await this.fetch("/api/v2/EventSummaries", { signal });
|
|
1600
|
+
return response.Events;
|
|
1393
1601
|
}
|
|
1394
|
-
async
|
|
1395
|
-
return this.
|
|
1602
|
+
async getEventInfo(eventKey, read) {
|
|
1603
|
+
return this.eventInformation("event", eventKey, read);
|
|
1396
1604
|
}
|
|
1397
|
-
async
|
|
1398
|
-
return this.
|
|
1605
|
+
async getSeriesInfo(seriesKey, read) {
|
|
1606
|
+
return this.eventInformation("series", seriesKey, read);
|
|
1399
1607
|
}
|
|
1400
|
-
// ===========================================================================
|
|
1401
|
-
// Attendees
|
|
1402
|
-
// ===========================================================================
|
|
1403
1608
|
/**
|
|
1404
|
-
*
|
|
1405
|
-
* `AttendeesNotMatchingTransaction`. It cannot create one — the v2 `setItemAttendee`
|
|
1406
|
-
* below is what a first naming goes through.
|
|
1609
|
+
* `EventInformation`, for a run or a single event.
|
|
1407
1610
|
*
|
|
1408
|
-
* THE
|
|
1409
|
-
*
|
|
1410
|
-
*
|
|
1411
|
-
*
|
|
1611
|
+
* `inventories` NARROWS THE RUN ITSELF, and the platform does the narrowing: the events
|
|
1612
|
+
* that sell nothing from those inventories are gone from `Events`, and the user types are
|
|
1613
|
+
* the ones those inventories' products assign. Repeated on the wire, like
|
|
1614
|
+
* `TicketInformation`'s — see `TicketInformationQuery.inventories`, which is the same
|
|
1615
|
+
* parameter on the other endpoint and the reason both are ANDed rather than substituted.
|
|
1412
1616
|
*/
|
|
1413
|
-
async
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1617
|
+
async eventInformation(type, key, read) {
|
|
1618
|
+
const params = new URLSearchParams({ type, key });
|
|
1619
|
+
for (const inventory of read?.inventories ?? []) params.append("inventories", inventory);
|
|
1620
|
+
return this.fetch(`/api/v2/EventInformation?${params}`, {
|
|
1621
|
+
signal: read?.signal
|
|
1417
1622
|
});
|
|
1418
1623
|
}
|
|
1419
1624
|
/**
|
|
1420
|
-
*
|
|
1421
|
-
*
|
|
1625
|
+
* Tickets for any number of events or whole series in one request, each row naming the
|
|
1626
|
+
* events it sells for in `EventKeys`.
|
|
1422
1627
|
*
|
|
1423
|
-
*
|
|
1424
|
-
*
|
|
1425
|
-
*
|
|
1426
|
-
* scopes the item to the transaction and refuses a pair that does not match with
|
|
1427
|
-
* `ItemNotFound`.
|
|
1628
|
+
* THE ROUTE TO READ TICKETS FROM. `Events/{key}/Tickets` omits a timeslot at
|
|
1629
|
+
* `Remaining: 0` rather than reporting it sold out, so a sold-out session never reaches
|
|
1630
|
+
* the picker at all.
|
|
1428
1631
|
*
|
|
1429
|
-
*
|
|
1430
|
-
*
|
|
1632
|
+
* A MISSPELT PARAMETER IS NOT REFUSED: the platform answers `200 {"Tickets":[]}`, which
|
|
1633
|
+
* reads exactly like an event that sells nothing.
|
|
1431
1634
|
*/
|
|
1432
|
-
async
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1635
|
+
async getTicketInformation(query, signal) {
|
|
1636
|
+
const params = new URLSearchParams();
|
|
1637
|
+
for (const key of query.events ?? []) params.append("events", key);
|
|
1638
|
+
for (const key of query.series ?? []) params.append("series", key);
|
|
1639
|
+
for (const key of query.inventories ?? []) params.append("inventories", key);
|
|
1640
|
+
if (query.includeTimeslots) params.set("include_timeslots", "true");
|
|
1641
|
+
if (query.includeQuestions) params.set("include_questions", "true");
|
|
1642
|
+
const response = await this.fetch(
|
|
1643
|
+
`/api/v2/TicketInformation?${params}`,
|
|
1644
|
+
{ signal }
|
|
1645
|
+
);
|
|
1646
|
+
return response.Tickets ?? [];
|
|
1437
1647
|
}
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1648
|
+
/** @deprecated Use getTicketInformation(), which also reports sold-out timeslots */
|
|
1649
|
+
async getEventTickets(eventKey, signal) {
|
|
1650
|
+
const response = await this.fetch(
|
|
1651
|
+
`/api/v2/Events/${eventKey}/Tickets?include_timeslots=true`,
|
|
1652
|
+
{ signal }
|
|
1653
|
+
);
|
|
1654
|
+
return response.Tickets;
|
|
1655
|
+
}
|
|
1656
|
+
// ===========================================================================
|
|
1657
|
+
// v1 Events (deprecated — kept for cart/timeslot compat)
|
|
1658
|
+
// ===========================================================================
|
|
1659
|
+
/** @deprecated Use getDisplayEvents() or getEventInfo() instead */
|
|
1660
|
+
async getEvents(count) {
|
|
1661
|
+
const params = count ? `?count=${count}` : "";
|
|
1662
|
+
return this.fetch(`/api/Events/ByOrganisationKey/${this.config.orgKey}${params}`);
|
|
1663
|
+
}
|
|
1664
|
+
/** @deprecated Use getEventTickets() instead */
|
|
1665
|
+
async getTickets(eventId) {
|
|
1666
|
+
return this.fetch(`/api/Ticket/Event/${eventId}`);
|
|
1667
|
+
}
|
|
1668
|
+
// ===========================================================================
|
|
1669
|
+
// Cart
|
|
1670
|
+
// ===========================================================================
|
|
1671
|
+
async createCart(eventId) {
|
|
1672
|
+
const body = typeof eventId === "string" ? { EventKey: eventId } : { EventId: eventId };
|
|
1673
|
+
return this.fetch("/api/Cart", {
|
|
1674
|
+
method: "POST",
|
|
1675
|
+
body: JSON.stringify(body)
|
|
1676
|
+
});
|
|
1677
|
+
}
|
|
1678
|
+
async getCart(cartKey) {
|
|
1679
|
+
return this.fetch(`/api/Cart/${cartKey}`);
|
|
1680
|
+
}
|
|
1681
|
+
async addToCart(cartKey, ticketId, timeslot) {
|
|
1682
|
+
const body = timeslot ? { Type: "ticket", ItemId: ticketId, Timeslot: timeslot } : { Type: "ticket", ItemId: ticketId };
|
|
1683
|
+
return this.fetch(`/api/Cart/${cartKey}/Items`, {
|
|
1684
|
+
method: "POST",
|
|
1685
|
+
body: JSON.stringify(body)
|
|
1686
|
+
});
|
|
1687
|
+
}
|
|
1688
|
+
async removeFromCart(cartKey, itemKey) {
|
|
1689
|
+
return this.fetch(`/api/Cart/${cartKey}/Items/${itemKey}`, {
|
|
1690
|
+
method: "DELETE"
|
|
1691
|
+
});
|
|
1692
|
+
}
|
|
1693
|
+
/**
|
|
1694
|
+
* WHETHER A CODE MAY BE USED, AND WHY NOT — the one call that answers the second half.
|
|
1695
|
+
*
|
|
1696
|
+
* THE `PUT` BELOW ONLY APPLIES. It refuses with an `ApiError` whose message is a
|
|
1697
|
+
* transport failure's message, which is not a sentence about a promo code; `Reason` here
|
|
1698
|
+
* is the platform's own words for an expired, spent or wrong-event code, and it is what
|
|
1699
|
+
* the card shows the buyer.
|
|
1700
|
+
*
|
|
1701
|
+
* `event_id` IS WHAT THE WIDGET KNOWS. The endpoint also narrows by ticket, series and
|
|
1702
|
+
* organisation; the cart carries its event and nothing else, so that is what is asked.
|
|
1703
|
+
*/
|
|
1704
|
+
async checkPromoCode(promoCode, eventId) {
|
|
1705
|
+
const params = new URLSearchParams({ code: promoCode, event_id: String(eventId) });
|
|
1706
|
+
return this.fetch(`/api/PromoCode/Check?${params}`);
|
|
1707
|
+
}
|
|
1708
|
+
/**
|
|
1709
|
+
* PUT A PROMO CODE ON THE CART, and take back the cart it made — `TotalAmount` already
|
|
1710
|
+
* discounted, `DiscountAmount` saying by how much, `PromoCode` naming what did it.
|
|
1711
|
+
*
|
|
1712
|
+
* ONE PER CART, which is the wire's rule and not this client's: the field is a single
|
|
1713
|
+
* string, so a second code REPLACES the first rather than stacking on it.
|
|
1714
|
+
*
|
|
1715
|
+
* A REFUSED CODE IS AN `ApiError` like any other refusal — expired, spent, or for a
|
|
1716
|
+
* different event. The reason is the platform's own words; see `promoRefusal`, which is
|
|
1717
|
+
* the only thing allowed to put them in front of a buyer.
|
|
1718
|
+
*/
|
|
1719
|
+
async setCartPromoCode(cartKey, promoCode) {
|
|
1720
|
+
return this.fetch(`/api/Cart/${encodeURIComponent(cartKey)}/PromoCode`, {
|
|
1721
|
+
method: "PUT",
|
|
1722
|
+
body: JSON.stringify({ PromoCode: promoCode })
|
|
1723
|
+
});
|
|
1724
|
+
}
|
|
1725
|
+
/** Take it off again, and the cart comes back at its full price. */
|
|
1726
|
+
async clearCartPromoCode(cartKey) {
|
|
1727
|
+
return this.fetch(`/api/Cart/${encodeURIComponent(cartKey)}/PromoCode`, {
|
|
1728
|
+
method: "DELETE"
|
|
1729
|
+
});
|
|
1730
|
+
}
|
|
1731
|
+
/**
|
|
1732
|
+
* `allowPartial` asks the platform to reserve what it can — see
|
|
1733
|
+
* `BulkAddItemsRequest.AllowPartialFulfillment`. OMITTED rather than sent as `false`
|
|
1734
|
+
* when it is not asked for: a body without it is what every caller already sends.
|
|
1735
|
+
*/
|
|
1736
|
+
async addItemsBulk(cartKey, items, { allowPartial = false } = {}) {
|
|
1737
|
+
const body = {
|
|
1738
|
+
Items: items,
|
|
1739
|
+
...allowPartial ? { AllowPartialFulfillment: true } : {}
|
|
1740
|
+
};
|
|
1741
|
+
return this.fetch(`/api/v2/Carts/${cartKey}/Items`, {
|
|
1742
|
+
method: "POST",
|
|
1743
|
+
body: JSON.stringify(body)
|
|
1744
|
+
});
|
|
1745
|
+
}
|
|
1746
|
+
// ===========================================================================
|
|
1747
|
+
// Questionnaire
|
|
1748
|
+
// ===========================================================================
|
|
1749
|
+
async getQuestionnaireQuestions(eventId, signal) {
|
|
1750
|
+
return this.fetch(`/api/Questionnaires/Events/${eventId}/Questions`, {
|
|
1751
|
+
signal
|
|
1752
|
+
});
|
|
1753
|
+
}
|
|
1754
|
+
// ── Passcodes ──────────────────────────────────────────────────────────
|
|
1755
|
+
//
|
|
1756
|
+
// @Zsolt — AUTH SURFACE. Transport only: these three make the calls and return what
|
|
1757
|
+
// comes back. Which of them runs when, and what a failure means, is the account
|
|
1758
|
+
// flow's business — see `domain/passcode.ts` in @scopetickets/checkout.
|
|
1759
|
+
/** Sends a verification code to an address. */
|
|
1760
|
+
async sendEmailPasscode(body) {
|
|
1761
|
+
return this.fetch("/api/Passcodes/Email", {
|
|
1762
|
+
method: "POST",
|
|
1763
|
+
body: JSON.stringify(body)
|
|
1764
|
+
});
|
|
1765
|
+
}
|
|
1766
|
+
/** Submits the code the buyer typed. */
|
|
1767
|
+
async verifyPasscode(body) {
|
|
1768
|
+
await this.fetch("/api/Passcodes/Verification", {
|
|
1769
|
+
method: "POST",
|
|
1770
|
+
body: JSON.stringify(body)
|
|
1771
|
+
});
|
|
1772
|
+
}
|
|
1773
|
+
/**
|
|
1774
|
+
* Reads whether a passcode has been verified.
|
|
1775
|
+
*
|
|
1776
|
+
* The authoritative answer, and separate from `verifyPasscode` on purpose: a code
|
|
1777
|
+
* submitted in another tab, or on the phone the mail arrived on, is verified without
|
|
1778
|
+
* this browser ever having posted it.
|
|
1779
|
+
*/
|
|
1780
|
+
async getPasscodeStatus(passcodeKey) {
|
|
1781
|
+
return this.fetch(
|
|
1782
|
+
`/api/Passcodes/${encodeURIComponent(passcodeKey)}/Status`
|
|
1783
|
+
);
|
|
1784
|
+
}
|
|
1785
|
+
async submitQuestionnaireResponses(cartKey, body) {
|
|
1786
|
+
return this.fetch(`/api/Cart/${cartKey}/Questionnaires/Responses`, {
|
|
1787
|
+
method: "POST",
|
|
1788
|
+
body: JSON.stringify(body)
|
|
1789
|
+
});
|
|
1790
|
+
}
|
|
1791
|
+
async setBuyer(cartKey, buyer) {
|
|
1792
|
+
return this.fetch(`/api/Cart/${cartKey}/Buyer`, {
|
|
1793
|
+
method: "POST",
|
|
1794
|
+
body: JSON.stringify(buyer)
|
|
1795
|
+
});
|
|
1796
|
+
}
|
|
1797
|
+
async getBuyer(cartKey) {
|
|
1798
|
+
return this.fetch(`/api/Cart/${cartKey}/Buyer`);
|
|
1799
|
+
}
|
|
1800
|
+
async deleteCart(cartKey) {
|
|
1801
|
+
return this.fetchVoid(`/api/Cart/${cartKey}`, {
|
|
1802
|
+
method: "DELETE"
|
|
1803
|
+
});
|
|
1804
|
+
}
|
|
1805
|
+
// ===========================================================================
|
|
1806
|
+
// Payment
|
|
1807
|
+
// ===========================================================================
|
|
1808
|
+
async createPaymentIntent(cartKey, options) {
|
|
1809
|
+
const retryQuery = options?.retry ? "?retry=true" : "";
|
|
1810
|
+
return this.fetch(`/api/Cart/${cartKey}/Payment${retryQuery}`, {
|
|
1811
|
+
method: "POST"
|
|
1812
|
+
});
|
|
1813
|
+
}
|
|
1814
|
+
async getPaymentStatus(cartKey) {
|
|
1815
|
+
return this.fetch(`/api/Cart/${cartKey}/Payment/Status`);
|
|
1816
|
+
}
|
|
1817
|
+
// ===========================================================================
|
|
1818
|
+
// Transactions
|
|
1819
|
+
// ===========================================================================
|
|
1820
|
+
async convertCartToTransaction(cartKey) {
|
|
1821
|
+
return this.fetch("/api/Transactions/FromCart", {
|
|
1822
|
+
method: "POST",
|
|
1823
|
+
body: JSON.stringify({ CartKey: cartKey })
|
|
1824
|
+
});
|
|
1825
|
+
}
|
|
1826
|
+
async getTransactionItems(transactionKey) {
|
|
1827
|
+
return this.fetch(`/api/Transactions/${transactionKey}/Items`);
|
|
1828
|
+
}
|
|
1829
|
+
async getTransactionByCartKey(cartKey) {
|
|
1830
|
+
return this.fetch(`/api/Transactions/ByKey/${cartKey}`);
|
|
1831
|
+
}
|
|
1832
|
+
// ===========================================================================
|
|
1833
|
+
// Attendees
|
|
1834
|
+
// ===========================================================================
|
|
1835
|
+
/**
|
|
1836
|
+
* AMENDS ATTENDEES A TRANSACTION ALREADY OWNS, and refuses everything else with
|
|
1837
|
+
* `AttendeesNotMatchingTransaction`. It cannot create one — the v2 `setItemAttendee`
|
|
1838
|
+
* below is what a first naming goes through.
|
|
1839
|
+
*
|
|
1840
|
+
* THE TRANSACTION-WIDE CALL, and `packages/sdk`'s ticket-confirmation flow still wants
|
|
1841
|
+
* it: it amends an attendee that already exists (buyer-as-holder on a portal-style
|
|
1842
|
+
* purchase) and declines politely where none does. New code should prefer the
|
|
1843
|
+
* key-addressed call, which needs no id read first and cannot erase anybody by omission.
|
|
1844
|
+
*/
|
|
1845
|
+
async saveAttendees(transactionKey, attendees) {
|
|
1846
|
+
return this.fetch(`/api/Transactions/${transactionKey}/Attendees`, {
|
|
1847
|
+
method: "PUT",
|
|
1848
|
+
body: JSON.stringify(attendees)
|
|
1849
|
+
});
|
|
1850
|
+
}
|
|
1851
|
+
/**
|
|
1852
|
+
* WHO A TICKET IS FOR — creating the attendee where there is none and rebinding the
|
|
1853
|
+
* ticket where there is, addressed by keys on both counts.
|
|
1854
|
+
*
|
|
1855
|
+
* The route takes the TRANSACTION's key and the ITEM's — the same value the bulk add
|
|
1856
|
+
* returned as `item_key` and the booking reads as `AttendeeTicketKey` — so there is no
|
|
1857
|
+
* attendee id to have read first and nothing integer-shaped on the wire. The platform
|
|
1858
|
+
* scopes the item to the transaction and refuses a pair that does not match with
|
|
1859
|
+
* `ItemNotFound`.
|
|
1860
|
+
*
|
|
1861
|
+
* Answers `204`-shaped success with no body: the call either went or it did not, and the
|
|
1862
|
+
* name it saved is read back on the next booking read rather than off the response.
|
|
1863
|
+
*/
|
|
1864
|
+
async setItemAttendee(transactionKey, itemKey, body) {
|
|
1865
|
+
await this.fetchVoid(`/api/v2/Transactions/${transactionKey}/Items/${itemKey}/Attendee`, {
|
|
1866
|
+
method: "PUT",
|
|
1867
|
+
body: JSON.stringify(body)
|
|
1868
|
+
});
|
|
1869
|
+
}
|
|
1870
|
+
// ===========================================================================
|
|
1871
|
+
// Accounts
|
|
1872
|
+
// ===========================================================================
|
|
1873
|
+
//
|
|
1874
|
+
// Transport only: these make the calls and return what comes back. WHICH of them runs
|
|
1875
|
+
// when, and what a failure means, is the account flow's business — see `domain/auth.ts`
|
|
1444
1876
|
// and `domain/account-creation.ts` in @scopetickets/checkout.
|
|
1445
1877
|
/**
|
|
1446
1878
|
* Makes an account, and signs into it.
|
|
@@ -1464,7 +1896,7 @@ var ScopeClient = class {
|
|
|
1464
1896
|
}
|
|
1465
1897
|
/** Ends the session at the platform. The caller still has to forget its own copy. */
|
|
1466
1898
|
async signOut() {
|
|
1467
|
-
return this.fetch("/api/Auth/Logout");
|
|
1899
|
+
return this.fetch("/api/Auth/Logout", void 0, "USER");
|
|
1468
1900
|
}
|
|
1469
1901
|
/**
|
|
1470
1902
|
* A fresh `Authorization` for a session that still holds its refresh token.
|
|
@@ -1489,15 +1921,19 @@ var ScopeClient = class {
|
|
|
1489
1921
|
* read for which of the two happened.
|
|
1490
1922
|
*/
|
|
1491
1923
|
async getCurrentUser(signal) {
|
|
1492
|
-
return this.fetch("/api/Users/Me", { signal });
|
|
1924
|
+
return this.fetch("/api/Users/Me", { signal }, "USER");
|
|
1493
1925
|
}
|
|
1494
1926
|
/** The signed-in user's own details. */
|
|
1495
1927
|
async updateUser(body) {
|
|
1496
|
-
return this.fetchVoid("/api/Users", { method: "PUT", body: JSON.stringify(body) });
|
|
1928
|
+
return this.fetchVoid("/api/Users", { method: "PUT", body: JSON.stringify(body) }, "USER");
|
|
1497
1929
|
}
|
|
1498
1930
|
/** Changes the password of the signed-in user, who therefore knows the old one. */
|
|
1499
1931
|
async updatePassword(body) {
|
|
1500
|
-
return this.fetchVoid(
|
|
1932
|
+
return this.fetchVoid(
|
|
1933
|
+
"/api/Users/Password",
|
|
1934
|
+
{ method: "PUT", body: JSON.stringify(body) },
|
|
1935
|
+
"USER"
|
|
1936
|
+
);
|
|
1501
1937
|
}
|
|
1502
1938
|
/** Starts recovery for somebody who cannot sign in. Needs no session, by definition. */
|
|
1503
1939
|
async requestPasswordReset(body) {
|
|
@@ -1508,38 +1944,56 @@ var ScopeClient = class {
|
|
|
1508
1944
|
}
|
|
1509
1945
|
/** Sets the signed-in user's photo. Needs the session, so it runs after creation. */
|
|
1510
1946
|
async updatePhoto(body) {
|
|
1511
|
-
return this.fetchVoid(
|
|
1947
|
+
return this.fetchVoid(
|
|
1948
|
+
"/api/Users/Photo",
|
|
1949
|
+
{ method: "PUT", body: JSON.stringify(body) },
|
|
1950
|
+
"USER"
|
|
1951
|
+
);
|
|
1512
1952
|
}
|
|
1513
1953
|
// ===========================================================================
|
|
1514
1954
|
// Following
|
|
1515
1955
|
// ===========================================================================
|
|
1516
1956
|
async getFollowing(userKey, signal) {
|
|
1517
|
-
return this.fetch(
|
|
1518
|
-
|
|
1519
|
-
|
|
1957
|
+
return this.fetch(
|
|
1958
|
+
`/api/Users/${encodeURIComponent(userKey)}/Following`,
|
|
1959
|
+
{
|
|
1960
|
+
signal
|
|
1961
|
+
},
|
|
1962
|
+
"USER"
|
|
1963
|
+
);
|
|
1520
1964
|
}
|
|
1521
1965
|
async followOrganisation(userKey, body) {
|
|
1522
|
-
return this.fetchVoid(
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1966
|
+
return this.fetchVoid(
|
|
1967
|
+
`/api/Users/${encodeURIComponent(userKey)}/Following/Organisation`,
|
|
1968
|
+
{
|
|
1969
|
+
method: "POST",
|
|
1970
|
+
body: JSON.stringify(body)
|
|
1971
|
+
},
|
|
1972
|
+
"USER"
|
|
1973
|
+
);
|
|
1526
1974
|
}
|
|
1527
1975
|
async unfollowOrganisation(userKey, organisationKey) {
|
|
1528
1976
|
return this.fetchVoid(
|
|
1529
1977
|
`/api/Users/${encodeURIComponent(userKey)}/Following/Organisation/${encodeURIComponent(organisationKey)}`,
|
|
1530
|
-
{ method: "DELETE" }
|
|
1978
|
+
{ method: "DELETE" },
|
|
1979
|
+
"USER"
|
|
1531
1980
|
);
|
|
1532
1981
|
}
|
|
1533
1982
|
async followVenue(userKey, body) {
|
|
1534
|
-
return this.fetchVoid(
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1983
|
+
return this.fetchVoid(
|
|
1984
|
+
`/api/Users/${encodeURIComponent(userKey)}/Following/Venue`,
|
|
1985
|
+
{
|
|
1986
|
+
method: "POST",
|
|
1987
|
+
body: JSON.stringify(body)
|
|
1988
|
+
},
|
|
1989
|
+
"USER"
|
|
1990
|
+
);
|
|
1538
1991
|
}
|
|
1539
1992
|
async unfollowVenue(userKey, venueKey) {
|
|
1540
1993
|
return this.fetchVoid(
|
|
1541
1994
|
`/api/Users/${encodeURIComponent(userKey)}/Following/Venue/${encodeURIComponent(venueKey)}`,
|
|
1542
|
-
{ method: "DELETE" }
|
|
1995
|
+
{ method: "DELETE" },
|
|
1996
|
+
"USER"
|
|
1543
1997
|
);
|
|
1544
1998
|
}
|
|
1545
1999
|
// ===========================================================================
|
|
@@ -1551,1384 +2005,993 @@ var ScopeClient = class {
|
|
|
1551
2005
|
// and something on a Scope origin does the part in between.
|
|
1552
2006
|
/** Opens a registration. Names nobody: the user comes from the session. */
|
|
1553
2007
|
async createPasskeyRegistrationChallenge(body) {
|
|
1554
|
-
return this.fetch(
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
method: "POST",
|
|
1563
|
-
body: JSON.stringify(body)
|
|
1564
|
-
});
|
|
1565
|
-
}
|
|
1566
|
-
/** Opens a sign-in. Needs no session — proving who you are is the point of it. */
|
|
1567
|
-
async createPasskeyAuthenticationChallenge(body) {
|
|
1568
|
-
return this.fetch("/api/Passkeys/Authentications/Challenges", {
|
|
1569
|
-
method: "POST",
|
|
1570
|
-
body: JSON.stringify(body)
|
|
1571
|
-
});
|
|
1572
|
-
}
|
|
1573
|
-
/** Spends the assertion, and opens a session with it. */
|
|
1574
|
-
async authenticateWithPasskey(body) {
|
|
1575
|
-
return this.fetch("/api/Passkeys/Authentications", {
|
|
1576
|
-
method: "POST",
|
|
1577
|
-
body: JSON.stringify(body)
|
|
1578
|
-
});
|
|
1579
|
-
}
|
|
1580
|
-
// ===========================================================================
|
|
1581
|
-
// Feedback
|
|
1582
|
-
// ===========================================================================
|
|
1583
|
-
/**
|
|
1584
|
-
* How the buyer rated a ticket. Answers 200 and nothing else, so there is no receipt
|
|
1585
|
-
* to hold on to — the call either went or it did not.
|
|
1586
|
-
*/
|
|
1587
|
-
async submitFeedback(body) {
|
|
1588
|
-
return this.fetchVoid("/api/Feedback", { method: "POST", body: JSON.stringify(body) });
|
|
1589
|
-
}
|
|
1590
|
-
// ===========================================================================
|
|
1591
|
-
// Utilities
|
|
1592
|
-
// ===========================================================================
|
|
1593
|
-
/**
|
|
1594
|
-
* SEND ONE TICKET TO AN ADDRESS — the platform's own email, to whoever the buyer names.
|
|
1595
|
-
*
|
|
1596
|
-
* `template` IS OMITTED ON PURPOSE. The parameter takes a free string, the spec documents
|
|
1597
|
-
* no values for it and nothing else in the API names one; left off, the platform sends
|
|
1598
|
-
* its default. Conall, 2026-09-13.
|
|
1599
|
-
*
|
|
1600
|
-
* IT IS A `GET` THAT SENDS MAIL, which is the platform's shape and not a choice made
|
|
1601
|
-
* here. A `GET` is the one method browsers, proxies, prefetchers and generic retry layers
|
|
1602
|
-
* treat as free to repeat, so at-most-once cannot be delegated to any of them: every
|
|
1603
|
-
* caller has to fire this from one deliberate press and never from anything that can
|
|
1604
|
-
* re-run. See `sendTicket` in the booking gateway, which is the only caller.
|
|
1605
|
-
*/
|
|
1606
|
-
async sendTicketEmail(attendeeTicketId, email) {
|
|
1607
|
-
const params = new URLSearchParams({
|
|
1608
|
-
email,
|
|
1609
|
-
attendee_ticket_id: String(attendeeTicketId)
|
|
1610
|
-
});
|
|
1611
|
-
await this.fetch(`/api/AttendeeTicket/SendSingleEmail?${params}`);
|
|
1612
|
-
}
|
|
1613
|
-
async getQrCode(content, foreground = "000000", background = "FFFFFF") {
|
|
1614
|
-
const params = new URLSearchParams({
|
|
1615
|
-
content,
|
|
1616
|
-
foreground,
|
|
1617
|
-
background,
|
|
1618
|
-
drawQuietZone: "false"
|
|
1619
|
-
});
|
|
1620
|
-
return this.fetch(`/api/Utils/GetQrCodeAsSVG?${params}`);
|
|
1621
|
-
}
|
|
1622
|
-
};
|
|
1623
|
-
|
|
1624
|
-
// ../api/src/payment-protocol/parent.ts
|
|
1625
|
-
var CARRIED_CHECKOUT_PARAMS = ["event", "eventKey"];
|
|
1626
|
-
function buildFrameUrl(hostUrl, cartKey, identity, options) {
|
|
1627
|
-
const url = new URL(`/checkout/${cartKey}`, hostUrl);
|
|
1628
|
-
url.searchParams.set("method", identity.method);
|
|
1629
|
-
url.searchParams.set("instanceId", identity.instanceId);
|
|
1630
|
-
if (options.checkoutSessionId !== void 0)
|
|
1631
|
-
url.searchParams.set("checkoutSessionId", options.checkoutSessionId);
|
|
1632
|
-
url.searchParams.set("displayMode", "prewarm");
|
|
1633
|
-
url.searchParams.set("origin", options.parentOrigin);
|
|
1634
|
-
if (options.debug === true) url.searchParams.set("scopePaymentDebug", "1");
|
|
1635
|
-
if (options.retry === true) url.searchParams.set("paymentRetry", "1");
|
|
1636
|
-
for (const name of options.carriedParams ?? []) {
|
|
1637
|
-
const value = options.parentSearchParams?.get(name);
|
|
1638
|
-
if (value) url.searchParams.set(name, value);
|
|
1639
|
-
}
|
|
1640
|
-
return url.toString();
|
|
1641
|
-
}
|
|
1642
|
-
function allowedFrameOrigin(hostUrl) {
|
|
1643
|
-
try {
|
|
1644
|
-
return new URL(hostUrl).origin;
|
|
1645
|
-
} catch {
|
|
1646
|
-
return hostUrl;
|
|
1647
|
-
}
|
|
1648
|
-
}
|
|
1649
|
-
var PAYMENT_DIAGNOSTIC_EVENTS = /* @__PURE__ */ new Set([
|
|
1650
|
-
"revolut.provider_init_started",
|
|
1651
|
-
"revolut.provider_init_finished",
|
|
1652
|
-
"revolut.provider_init_failed",
|
|
1653
|
-
"revolut.button_pressed",
|
|
1654
|
-
"revolut.create_order_callback_started",
|
|
1655
|
-
"revolut.create_order_callback_returned",
|
|
1656
|
-
"revolut.inline_journey_detected",
|
|
1657
|
-
"revolut.external_handoff_detected",
|
|
1658
|
-
"revolut.detector_state"
|
|
1659
|
-
]);
|
|
1660
|
-
var isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1661
|
-
function parsePaymentDiagnostic(value) {
|
|
1662
|
-
if (!isPlainObject(value)) return null;
|
|
1663
|
-
const payload = value;
|
|
1664
|
-
if (typeof payload.event !== "string" || !PAYMENT_DIAGNOSTIC_EVENTS.has(payload.event))
|
|
1665
|
-
return null;
|
|
1666
|
-
const sourceData = isPlainObject(payload.data) ? payload.data : void 0;
|
|
1667
|
-
const data = {};
|
|
1668
|
-
if (sourceData?.paymentHostClass === "local_tunnel" || sourceData?.paymentHostClass === "other") {
|
|
1669
|
-
data.paymentHostClass = sourceData.paymentHostClass;
|
|
1670
|
-
}
|
|
1671
|
-
if (typeof sourceData?.active === "boolean") data.active = sourceData.active;
|
|
1672
|
-
if (typeof sourceData?.tokenPresent === "boolean") data.tokenPresent = sourceData.tokenPresent;
|
|
1673
|
-
if (typeof sourceData?.errorType === "string" && /^[A-Za-z][A-Za-z0-9]{0,63}$/.test(sourceData.errorType)) {
|
|
1674
|
-
data.errorType = sourceData.errorType;
|
|
1675
|
-
}
|
|
1676
|
-
if (sourceData?.evidence === "provider_frame_loaded" || sourceData?.evidence === "provider_frame_replaced" || sourceData?.evidence === "mobile_inline_provisional") {
|
|
1677
|
-
data.evidence = sourceData.evidence;
|
|
1678
|
-
}
|
|
1679
|
-
if (typeof sourceData?.generation === "number" && Number.isSafeInteger(sourceData.generation)) {
|
|
1680
|
-
data.generation = sourceData.generation;
|
|
1681
|
-
}
|
|
1682
|
-
if (typeof sourceData?.mobile === "boolean") data.mobile = sourceData.mobile;
|
|
1683
|
-
if (typeof sourceData?.visible === "boolean") data.visible = sourceData.visible;
|
|
1684
|
-
if (sourceData?.state === "initialized" || sourceData?.state === "attempt_started" || sourceData?.state === "order_returned" || sourceData?.state === "inline_provisional" || sourceData?.state === "external_handoff" || sourceData?.state === "disconnected") {
|
|
1685
|
-
data.state = sourceData.state;
|
|
1686
|
-
}
|
|
1687
|
-
if (sourceData?.reason === "not_mobile" || sourceData?.reason === "no_attempt" || sourceData?.reason === "terminal" || sourceData?.reason === "external_handoff" || sourceData?.reason === "hidden") {
|
|
1688
|
-
data.reason = sourceData.reason;
|
|
1689
|
-
}
|
|
1690
|
-
return { event: payload.event, ...Object.keys(data).length > 0 ? { data } : {} };
|
|
1691
|
-
}
|
|
1692
|
-
function parsePaymentPresentation(value, expectedInstanceId, latestGeneration) {
|
|
1693
|
-
if (!isPlainObject(value)) return null;
|
|
1694
|
-
const payload = value;
|
|
1695
|
-
if (payload.instanceId !== expectedInstanceId || payload.method !== "revolut_pay" || payload.mode !== "inline_provisional" && payload.mode !== "external_handoff" || typeof payload.attemptGeneration !== "number" || !Number.isSafeInteger(payload.attemptGeneration) || payload.attemptGeneration <= 0 || payload.attemptGeneration < latestGeneration) {
|
|
1696
|
-
return null;
|
|
1697
|
-
}
|
|
1698
|
-
return {
|
|
1699
|
-
instanceId: payload.instanceId,
|
|
1700
|
-
method: payload.method,
|
|
1701
|
-
mode: payload.mode,
|
|
1702
|
-
attemptGeneration: payload.attemptGeneration
|
|
1703
|
-
};
|
|
1704
|
-
}
|
|
1705
|
-
function parseFrameEvent(event, expected) {
|
|
1706
|
-
if (expected.source == null || event.origin !== expected.allowedOrigin || event.source !== expected.source || !isPlainObject(event.data))
|
|
1707
|
-
return null;
|
|
1708
|
-
const { type } = event.data;
|
|
1709
|
-
if (typeof type !== "string" || !type.startsWith("SCOPE_PAYMENT_")) return null;
|
|
1710
|
-
const payload = isPlainObject(event.data.payload) ? event.data.payload : {};
|
|
1711
|
-
if (payload.instanceId !== void 0 && payload.instanceId !== expected.identity.instanceId)
|
|
1712
|
-
return null;
|
|
1713
|
-
if (payload.method !== void 0 && payload.method !== expected.identity.method) return null;
|
|
1714
|
-
const frameMessage = { type, payload };
|
|
1715
|
-
switch (type) {
|
|
1716
|
-
case "SCOPE_PAYMENT_READY":
|
|
1717
|
-
case "SCOPE_PAYMENT_CONFIG_REQUESTED":
|
|
1718
|
-
case "SCOPE_PAYMENT_CANCELLED":
|
|
1719
|
-
case "SCOPE_PAYMENT_SUBMIT_REQUESTED":
|
|
1720
|
-
return frameMessage;
|
|
1721
|
-
case "SCOPE_PAYMENT_RESIZE":
|
|
1722
|
-
if (typeof payload.height !== "number" || !Number.isFinite(payload.height)) return null;
|
|
1723
|
-
return frameMessage;
|
|
1724
|
-
case "SCOPE_PAYMENT_SUCCESS":
|
|
1725
|
-
if (typeof payload.cartKey !== "string" || !payload.cartKey) return null;
|
|
1726
|
-
return frameMessage;
|
|
1727
|
-
case "SCOPE_PAYMENT_ERROR":
|
|
1728
|
-
if (typeof payload.code !== "string" || typeof payload.message !== "string") return null;
|
|
1729
|
-
return frameMessage;
|
|
1730
|
-
case "SCOPE_PAYMENT_METHOD_STATUS":
|
|
1731
|
-
if (typeof payload.ready !== "boolean") return null;
|
|
1732
|
-
if (payload.wallet !== void 0 && payload.wallet !== "applePay" && payload.wallet !== "googlePay")
|
|
1733
|
-
return null;
|
|
1734
|
-
return frameMessage;
|
|
1735
|
-
case "SCOPE_PAYMENT_DIAGNOSTIC": {
|
|
1736
|
-
const diagnostic = parsePaymentDiagnostic(payload);
|
|
1737
|
-
return diagnostic === null ? null : { type, payload: diagnostic };
|
|
1738
|
-
}
|
|
1739
|
-
case "SCOPE_PAYMENT_PRESENTATION": {
|
|
1740
|
-
const presentation = parsePaymentPresentation(payload, expected.identity.instanceId, 0);
|
|
1741
|
-
return presentation === null ? null : { type, payload: presentation };
|
|
1742
|
-
}
|
|
1743
|
-
default:
|
|
1744
|
-
return null;
|
|
1745
|
-
}
|
|
1746
|
-
}
|
|
1747
|
-
function buildConfigMessage(identity, config) {
|
|
1748
|
-
return {
|
|
1749
|
-
type: "SCOPE_PAYMENT_CONFIG",
|
|
1750
|
-
payload: {
|
|
1751
|
-
...config.apiKey === void 0 ? {} : { apiKey: config.apiKey },
|
|
1752
|
-
...config.selectedMethod === void 0 ? {} : { selectedMethod: config.selectedMethod },
|
|
1753
|
-
...config.theme === void 0 ? {} : { theme: config.theme },
|
|
1754
|
-
instanceId: identity.instanceId,
|
|
1755
|
-
method: identity.method
|
|
1756
|
-
}
|
|
1757
|
-
};
|
|
1758
|
-
}
|
|
1759
|
-
function buildSubmitConfirmedMessage(identity, buyer) {
|
|
1760
|
-
return {
|
|
1761
|
-
type: "SCOPE_PAYMENT_SUBMIT_CONFIRMED",
|
|
1762
|
-
payload: { ...buyer, instanceId: identity.instanceId, method: identity.method }
|
|
1763
|
-
};
|
|
1764
|
-
}
|
|
1765
|
-
function buildSubmitRejectedMessage(identity, reason) {
|
|
1766
|
-
return {
|
|
1767
|
-
type: "SCOPE_PAYMENT_SUBMIT_REJECTED",
|
|
1768
|
-
payload: { reason, instanceId: identity.instanceId, method: identity.method }
|
|
1769
|
-
};
|
|
1770
|
-
}
|
|
1771
|
-
function buildTriggerSubmitMessage(identity) {
|
|
1772
|
-
return {
|
|
1773
|
-
type: "SCOPE_PAYMENT_TRIGGER_SUBMIT",
|
|
1774
|
-
payload: { instanceId: identity.instanceId, method: identity.method }
|
|
1775
|
-
};
|
|
1776
|
-
}
|
|
1777
|
-
function buildCancelRequestedMessage(identity) {
|
|
1778
|
-
return {
|
|
1779
|
-
type: "SCOPE_PAYMENT_CANCEL_REQUESTED",
|
|
1780
|
-
payload: { instanceId: identity.instanceId, method: identity.method }
|
|
1781
|
-
};
|
|
1782
|
-
}
|
|
1783
|
-
|
|
1784
|
-
// ../api/src/buyer.ts
|
|
1785
|
-
var MAX_EMAIL_LENGTH = 254;
|
|
1786
|
-
var MAX_LOCAL_LENGTH = 64;
|
|
1787
|
-
var MAX_LABEL_LENGTH = 63;
|
|
1788
|
-
var MAX_DOMAIN_LENGTH = 255;
|
|
1789
|
-
var LOCAL_PART = /^[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+(\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*$/;
|
|
1790
|
-
var DOMAIN_LABEL = /^[A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])?$/;
|
|
1791
|
-
var TOP_LEVEL_LABEL = /^[A-Za-z]{2,}$/;
|
|
1792
|
-
function isAcceptableEmail(value) {
|
|
1793
|
-
const email = value.trim();
|
|
1794
|
-
if (email.length === 0 || email.length > MAX_EMAIL_LENGTH) return false;
|
|
1795
|
-
const at = email.lastIndexOf("@");
|
|
1796
|
-
if (at <= 0 || at === email.length - 1) return false;
|
|
1797
|
-
const local = email.slice(0, at);
|
|
1798
|
-
if (local.length > MAX_LOCAL_LENGTH || !LOCAL_PART.test(local)) return false;
|
|
1799
|
-
const domain = email.slice(at + 1);
|
|
1800
|
-
if (domain.length > MAX_DOMAIN_LENGTH) return false;
|
|
1801
|
-
const labels = domain.split(".");
|
|
1802
|
-
if (labels.length < 2) return false;
|
|
1803
|
-
if (labels.some((label) => label.length > MAX_LABEL_LENGTH || !DOMAIN_LABEL.test(label))) {
|
|
1804
|
-
return false;
|
|
2008
|
+
return this.fetch(
|
|
2009
|
+
"/api/Passkeys/Registrations/Challenges",
|
|
2010
|
+
{
|
|
2011
|
+
method: "POST",
|
|
2012
|
+
body: JSON.stringify(body)
|
|
2013
|
+
},
|
|
2014
|
+
"USER"
|
|
2015
|
+
);
|
|
1805
2016
|
}
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
}
|
|
1817
|
-
|
|
1818
|
-
// ../api/src/email-typos.ts
|
|
1819
|
-
var KNOWN_DOMAINS = [
|
|
1820
|
-
"gmail.com",
|
|
1821
|
-
"googlemail.com",
|
|
1822
|
-
"icloud.com",
|
|
1823
|
-
"me.com",
|
|
1824
|
-
"mac.com",
|
|
1825
|
-
"mail.com",
|
|
1826
|
-
"hotmail.com",
|
|
1827
|
-
"outlook.com",
|
|
1828
|
-
"live.com",
|
|
1829
|
-
"yahoo.com",
|
|
1830
|
-
"aol.com",
|
|
1831
|
-
"proton.me",
|
|
1832
|
-
"protonmail.com",
|
|
1833
|
-
"eircom.net"
|
|
1834
|
-
];
|
|
1835
|
-
var NEAR_MISS_TARGETS = [
|
|
1836
|
-
"gmail.com",
|
|
1837
|
-
"googlemail.com",
|
|
1838
|
-
"icloud.com",
|
|
1839
|
-
"hotmail.com",
|
|
1840
|
-
"outlook.com",
|
|
1841
|
-
"yahoo.com",
|
|
1842
|
-
"protonmail.com",
|
|
1843
|
-
"eircom.net"
|
|
1844
|
-
];
|
|
1845
|
-
var MIN_DISTINCTIVE_BODY = 4;
|
|
1846
|
-
var TOP_LEVEL_SLIPS = {
|
|
1847
|
-
co: "com",
|
|
1848
|
-
con: "com",
|
|
1849
|
-
cim: "com",
|
|
1850
|
-
cmo: "com",
|
|
1851
|
-
ocm: "com",
|
|
1852
|
-
comm: "com",
|
|
1853
|
-
coom: "com",
|
|
1854
|
-
cpm: "com",
|
|
1855
|
-
vom: "com",
|
|
1856
|
-
xom: "com",
|
|
1857
|
-
nte: "net",
|
|
1858
|
-
ner: "net",
|
|
1859
|
-
ogr: "org",
|
|
1860
|
-
orh: "org"
|
|
1861
|
-
};
|
|
1862
|
-
function editDistance(a, b) {
|
|
1863
|
-
const columns = b.length + 1;
|
|
1864
|
-
const d = new Uint16Array((a.length + 1) * columns);
|
|
1865
|
-
for (let j = 0; j < columns; j += 1) d[j] = j;
|
|
1866
|
-
for (let i = 1; i <= a.length; i += 1) {
|
|
1867
|
-
const row = i * columns;
|
|
1868
|
-
const previous = row - columns;
|
|
1869
|
-
d[row] = i;
|
|
1870
|
-
for (let j = 1; j <= b.length; j += 1) {
|
|
1871
|
-
const cost = a[i - 1] === b[j - 1] ? 0 : 1;
|
|
1872
|
-
let best = Math.min(
|
|
1873
|
-
(d[previous + j] ?? 0) + 1,
|
|
1874
|
-
(d[row + j - 1] ?? 0) + 1,
|
|
1875
|
-
(d[previous + j - 1] ?? 0) + cost
|
|
1876
|
-
);
|
|
1877
|
-
if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) {
|
|
1878
|
-
best = Math.min(best, (d[previous - columns + j - 2] ?? 0) + 1);
|
|
1879
|
-
}
|
|
1880
|
-
d[row + j] = best;
|
|
1881
|
-
}
|
|
1882
|
-
}
|
|
1883
|
-
return d[a.length * columns + b.length] ?? 0;
|
|
1884
|
-
}
|
|
1885
|
-
function splitDomain(domain) {
|
|
1886
|
-
const lastDot = domain.lastIndexOf(".");
|
|
1887
|
-
if (lastDot <= 0 || lastDot === domain.length - 1) return null;
|
|
1888
|
-
return { body: domain.slice(0, lastDot), top: domain.slice(lastDot + 1) };
|
|
1889
|
-
}
|
|
1890
|
-
function nearestKnownDomain(domain) {
|
|
1891
|
-
const typed = splitDomain(domain);
|
|
1892
|
-
if (typed === null || typed.body.length < MIN_DISTINCTIVE_BODY) return null;
|
|
1893
|
-
for (const candidate of NEAR_MISS_TARGETS) {
|
|
1894
|
-
const known = splitDomain(candidate);
|
|
1895
|
-
if (known === null || known.top !== typed.top) continue;
|
|
1896
|
-
if (known.body.length < MIN_DISTINCTIVE_BODY) continue;
|
|
1897
|
-
if (editDistance(typed.body, known.body) === 1) return candidate;
|
|
1898
|
-
}
|
|
1899
|
-
return null;
|
|
1900
|
-
}
|
|
1901
|
-
function repairTopLevel(domain) {
|
|
1902
|
-
const labels = domain.split(".");
|
|
1903
|
-
if (labels.length < 2) return null;
|
|
1904
|
-
const top = labels[labels.length - 1];
|
|
1905
|
-
const meant = TOP_LEVEL_SLIPS[top];
|
|
1906
|
-
if (meant === void 0) return null;
|
|
1907
|
-
return [...labels.slice(0, -1), meant].join(".");
|
|
1908
|
-
}
|
|
1909
|
-
function suspectedEmailTypo(email) {
|
|
1910
|
-
const trimmed = email.trim().toLowerCase();
|
|
1911
|
-
const at = trimmed.lastIndexOf("@");
|
|
1912
|
-
if (at <= 0 || at === trimmed.length - 1) return null;
|
|
1913
|
-
const local = trimmed.slice(0, at);
|
|
1914
|
-
const domain = trimmed.slice(at + 1);
|
|
1915
|
-
if (KNOWN_DOMAINS.includes(domain)) return null;
|
|
1916
|
-
const repaired = repairTopLevel(domain);
|
|
1917
|
-
const corrected = nearestKnownDomain(repaired ?? domain) ?? repaired;
|
|
1918
|
-
if (corrected === null || corrected === domain) return null;
|
|
1919
|
-
return `${local}@${corrected}`;
|
|
1920
|
-
}
|
|
1921
|
-
|
|
1922
|
-
// ../checkout-core/src/domain/contact.ts
|
|
1923
|
-
function isValidEmail(email) {
|
|
1924
|
-
return isAcceptableEmail(email);
|
|
1925
|
-
}
|
|
1926
|
-
function flagTone(flag) {
|
|
1927
|
-
return flag === "none" ? void 0 : flag;
|
|
1928
|
-
}
|
|
1929
|
-
function emailFlag(email) {
|
|
1930
|
-
if (email.length === 0) return "none";
|
|
1931
|
-
if (!isValidEmail(email)) return "error";
|
|
1932
|
-
return suspectedEmailTypo(email) === null ? "success" : "warning";
|
|
1933
|
-
}
|
|
1934
|
-
function emailFlagTitle(email) {
|
|
1935
|
-
const meant = emailFlag(email) === "warning" ? suspectedEmailTypo(email) : null;
|
|
1936
|
-
return meant === null ? void 0 : `Did you mean ${meant}?`;
|
|
1937
|
-
}
|
|
1938
|
-
var E164_MAX_DIGITS = 15;
|
|
1939
|
-
var GENERIC_NATIONAL_DIGITS = { min: 4, max: E164_MAX_DIGITS - 1 };
|
|
1940
|
-
var COUNTRIES = [
|
|
1941
|
-
// ── Ireland, the default, and the United Kingdom ────────────
|
|
1942
|
-
{
|
|
1943
|
-
code: "IE",
|
|
1944
|
-
name: "Ireland",
|
|
1945
|
-
dialCode: "+353",
|
|
1946
|
-
trunkPrefix: "0",
|
|
1947
|
-
nationalDigits: { min: 7, max: 9 },
|
|
1948
|
-
// `08X XXX XXXX`, which is what the design draws.
|
|
1949
|
-
grouping: [{ startsWith: ["8"], digits: 9, groups: [2, 3, 4] }]
|
|
1950
|
-
},
|
|
1951
|
-
{
|
|
1952
|
-
code: "GB",
|
|
1953
|
-
name: "United Kingdom",
|
|
1954
|
-
dialCode: "+44",
|
|
1955
|
-
trunkPrefix: "0",
|
|
1956
|
-
nationalDigits: { min: 9, max: 10 },
|
|
1957
|
-
// London is also ten digits and is grouped `020 7946 0958`, so nothing beyond the
|
|
1958
|
-
// `7` may be assumed.
|
|
1959
|
-
grouping: [{ startsWith: ["7"], digits: 10, groups: [4, 6] }]
|
|
1960
|
-
},
|
|
1961
|
-
// ── The rest of the EU, alphabetically ──────────────────────
|
|
1962
|
-
{
|
|
1963
|
-
code: "AT",
|
|
1964
|
-
name: "Austria",
|
|
1965
|
-
dialCode: "+43",
|
|
1966
|
-
trunkPrefix: "0",
|
|
1967
|
-
// Austria's plan is the widest in the EU — subscriber numbers run from four digits
|
|
1968
|
-
// to thirteen.
|
|
1969
|
-
nationalDigits: { min: 4, max: 13 },
|
|
1970
|
-
grouping: [{ startsWith: ["6"], digits: 10, groups: [3, 7] }]
|
|
1971
|
-
},
|
|
1972
|
-
{
|
|
1973
|
-
code: "BE",
|
|
1974
|
-
name: "Belgium",
|
|
1975
|
-
dialCode: "+32",
|
|
1976
|
-
trunkPrefix: "0",
|
|
1977
|
-
nationalDigits: { min: 8, max: 9 },
|
|
1978
|
-
grouping: [{ startsWith: ["4"], digits: 9, groups: [3, 2, 2, 2] }]
|
|
1979
|
-
},
|
|
1980
|
-
{
|
|
1981
|
-
code: "BG",
|
|
1982
|
-
name: "Bulgaria",
|
|
1983
|
-
dialCode: "+359",
|
|
1984
|
-
trunkPrefix: "0",
|
|
1985
|
-
nationalDigits: { min: 8, max: 9 },
|
|
1986
|
-
grouping: [{ startsWith: ["87", "88", "89"], digits: 9, groups: [2, 3, 4] }]
|
|
1987
|
-
},
|
|
1988
|
-
{
|
|
1989
|
-
code: "HR",
|
|
1990
|
-
name: "Croatia",
|
|
1991
|
-
dialCode: "+385",
|
|
1992
|
-
trunkPrefix: "0",
|
|
1993
|
-
nationalDigits: { min: 8, max: 9 },
|
|
1994
|
-
grouping: [{ startsWith: ["9"], digits: 9, groups: [2, 3, 4] }]
|
|
1995
|
-
},
|
|
1996
|
-
{
|
|
1997
|
-
code: "CY",
|
|
1998
|
-
name: "Cyprus",
|
|
1999
|
-
dialCode: "+357",
|
|
2000
|
-
nationalDigits: { min: 8, max: 8 },
|
|
2001
|
-
grouping: [{ startsWith: ["9"], digits: 8, groups: [2, 6] }]
|
|
2002
|
-
},
|
|
2003
|
-
{
|
|
2004
|
-
code: "CZ",
|
|
2005
|
-
name: "Czechia",
|
|
2006
|
-
dialCode: "+420",
|
|
2007
|
-
nationalDigits: { min: 9, max: 9 },
|
|
2008
|
-
// Threes throughout, and Czechia has no trunk prefix.
|
|
2009
|
-
grouping: [{ digits: 9, groups: [3, 3, 3] }]
|
|
2010
|
-
},
|
|
2011
|
-
{
|
|
2012
|
-
code: "DK",
|
|
2013
|
-
name: "Denmark",
|
|
2014
|
-
dialCode: "+45",
|
|
2015
|
-
nationalDigits: { min: 8, max: 8 },
|
|
2016
|
-
// Every Danish number is eight digits in pairs, mobile or not — so this needs no
|
|
2017
|
-
// prefix to disambiguate.
|
|
2018
|
-
grouping: [{ digits: 8, groups: [2, 2, 2, 2] }]
|
|
2019
|
-
},
|
|
2020
|
-
{
|
|
2021
|
-
code: "EE",
|
|
2022
|
-
name: "Estonia",
|
|
2023
|
-
dialCode: "+372",
|
|
2024
|
-
nationalDigits: { min: 7, max: 8 },
|
|
2025
|
-
grouping: [
|
|
2026
|
-
{ startsWith: ["5"], digits: 8, groups: [4, 4] },
|
|
2027
|
-
{ startsWith: ["5"], digits: 7, groups: [3, 4] }
|
|
2028
|
-
]
|
|
2029
|
-
},
|
|
2030
|
-
{
|
|
2031
|
-
code: "FI",
|
|
2032
|
-
name: "Finland",
|
|
2033
|
-
dialCode: "+358",
|
|
2034
|
-
trunkPrefix: "0",
|
|
2035
|
-
nationalDigits: { min: 6, max: 10 },
|
|
2036
|
-
grouping: [{ startsWith: ["4", "5"], digits: 9, groups: [2, 3, 4] }]
|
|
2037
|
-
},
|
|
2038
|
-
{
|
|
2039
|
-
code: "FR",
|
|
2040
|
-
name: "France",
|
|
2041
|
-
dialCode: "+33",
|
|
2042
|
-
trunkPrefix: "0",
|
|
2043
|
-
nationalDigits: { min: 9, max: 9 },
|
|
2044
|
-
// Pairs throughout — `06 12 34 56 78`.
|
|
2045
|
-
grouping: [{ startsWith: ["6", "7"], digits: 9, groups: [1, 2, 2, 2, 2] }]
|
|
2046
|
-
},
|
|
2047
|
-
{
|
|
2048
|
-
code: "DE",
|
|
2049
|
-
name: "Germany",
|
|
2050
|
-
dialCode: "+49",
|
|
2051
|
-
trunkPrefix: "0",
|
|
2052
|
-
nationalDigits: { min: 6, max: 11 }
|
|
2053
|
-
// NO GROUPING, deliberately, and the one EU country without it.
|
|
2054
|
-
},
|
|
2055
|
-
{
|
|
2056
|
-
code: "GR",
|
|
2057
|
-
name: "Greece",
|
|
2058
|
-
dialCode: "+30",
|
|
2059
|
-
nationalDigits: { min: 10, max: 10 },
|
|
2060
|
-
// Ten digits, no trunk prefix, and the leading digit is kept when dialling.
|
|
2061
|
-
grouping: [{ startsWith: ["69"], digits: 10, groups: [3, 3, 4] }]
|
|
2062
|
-
},
|
|
2063
|
-
{
|
|
2064
|
-
code: "HU",
|
|
2065
|
-
name: "Hungary",
|
|
2066
|
-
dialCode: "+36",
|
|
2067
|
-
// `06`, and written apart from the number — see `formatNational`.
|
|
2068
|
-
trunkPrefix: "06",
|
|
2069
|
-
nationalDigits: { min: 8, max: 9 },
|
|
2070
|
-
grouping: [{ startsWith: ["20", "30", "31", "50", "70"], digits: 9, groups: [2, 3, 4] }]
|
|
2071
|
-
},
|
|
2072
|
-
{
|
|
2073
|
-
code: "IT",
|
|
2074
|
-
name: "Italy",
|
|
2075
|
-
dialCode: "+39",
|
|
2076
|
-
// NO TRUNK PREFIX, and Italy is the exception worth knowing: the leading `0` of a
|
|
2077
|
-
// landline is part of the number and is dialled internationally too.
|
|
2078
|
-
nationalDigits: { min: 6, max: 11 },
|
|
2079
|
-
grouping: [{ startsWith: ["3"], digits: 10, groups: [3, 3, 4] }]
|
|
2080
|
-
},
|
|
2081
|
-
{
|
|
2082
|
-
code: "LV",
|
|
2083
|
-
name: "Latvia",
|
|
2084
|
-
dialCode: "+371",
|
|
2085
|
-
nationalDigits: { min: 8, max: 8 },
|
|
2086
|
-
grouping: [{ startsWith: ["2"], digits: 8, groups: [2, 3, 3] }]
|
|
2087
|
-
},
|
|
2088
|
-
{
|
|
2089
|
-
code: "LT",
|
|
2090
|
-
name: "Lithuania",
|
|
2091
|
-
dialCode: "+370",
|
|
2092
|
-
// `8`, and written apart from the number — see `formatNational`.
|
|
2093
|
-
trunkPrefix: "8",
|
|
2094
|
-
nationalDigits: { min: 8, max: 8 },
|
|
2095
|
-
grouping: [{ startsWith: ["6"], digits: 8, groups: [3, 5] }]
|
|
2096
|
-
},
|
|
2097
|
-
{
|
|
2098
|
-
code: "LU",
|
|
2099
|
-
name: "Luxembourg",
|
|
2100
|
-
dialCode: "+352",
|
|
2101
|
-
nationalDigits: { min: 4, max: 11 },
|
|
2102
|
-
grouping: [{ startsWith: ["6"], digits: 9, groups: [3, 3, 3] }]
|
|
2103
|
-
},
|
|
2104
|
-
{
|
|
2105
|
-
code: "MT",
|
|
2106
|
-
name: "Malta",
|
|
2107
|
-
dialCode: "+356",
|
|
2108
|
-
nationalDigits: { min: 8, max: 8 },
|
|
2109
|
-
grouping: [{ startsWith: ["7", "9"], digits: 8, groups: [4, 4] }]
|
|
2110
|
-
},
|
|
2111
|
-
{
|
|
2112
|
-
code: "NL",
|
|
2113
|
-
name: "Netherlands",
|
|
2114
|
-
dialCode: "+31",
|
|
2115
|
-
trunkPrefix: "0",
|
|
2116
|
-
nationalDigits: { min: 9, max: 9 },
|
|
2117
|
-
// `06 12345678` — the mobile prefix, then the number unbroken.
|
|
2118
|
-
grouping: [{ startsWith: ["6"], digits: 9, groups: [1, 8] }]
|
|
2119
|
-
},
|
|
2120
|
-
{
|
|
2121
|
-
code: "PL",
|
|
2122
|
-
name: "Poland",
|
|
2123
|
-
dialCode: "+48",
|
|
2124
|
-
// Poland dropped its trunk prefix; the nine digits are dialled as they are.
|
|
2125
|
-
nationalDigits: { min: 9, max: 9 },
|
|
2126
|
-
grouping: [{ digits: 9, groups: [3, 3, 3] }]
|
|
2127
|
-
},
|
|
2128
|
-
{
|
|
2129
|
-
code: "PT",
|
|
2130
|
-
name: "Portugal",
|
|
2131
|
-
dialCode: "+351",
|
|
2132
|
-
nationalDigits: { min: 9, max: 9 },
|
|
2133
|
-
grouping: [{ digits: 9, groups: [3, 3, 3] }]
|
|
2134
|
-
},
|
|
2135
|
-
{
|
|
2136
|
-
code: "RO",
|
|
2137
|
-
name: "Romania",
|
|
2138
|
-
dialCode: "+40",
|
|
2139
|
-
trunkPrefix: "0",
|
|
2140
|
-
nationalDigits: { min: 9, max: 9 },
|
|
2141
|
-
grouping: [{ startsWith: ["7"], digits: 9, groups: [3, 3, 3] }]
|
|
2142
|
-
},
|
|
2143
|
-
{
|
|
2144
|
-
code: "SK",
|
|
2145
|
-
name: "Slovakia",
|
|
2146
|
-
dialCode: "+421",
|
|
2147
|
-
trunkPrefix: "0",
|
|
2148
|
-
nationalDigits: { min: 9, max: 9 },
|
|
2149
|
-
grouping: [{ startsWith: ["9"], digits: 9, groups: [3, 3, 3] }]
|
|
2150
|
-
},
|
|
2151
|
-
{
|
|
2152
|
-
code: "SI",
|
|
2153
|
-
name: "Slovenia",
|
|
2154
|
-
dialCode: "+386",
|
|
2155
|
-
trunkPrefix: "0",
|
|
2156
|
-
nationalDigits: { min: 8, max: 8 },
|
|
2157
|
-
grouping: [{ startsWith: ["3", "4", "5", "6", "7"], digits: 8, groups: [2, 3, 3] }]
|
|
2158
|
-
},
|
|
2159
|
-
{
|
|
2160
|
-
code: "ES",
|
|
2161
|
-
name: "Spain",
|
|
2162
|
-
dialCode: "+34",
|
|
2163
|
-
// No trunk prefix; the nine digits are the whole number.
|
|
2164
|
-
nationalDigits: { min: 9, max: 9 },
|
|
2165
|
-
grouping: [{ digits: 9, groups: [3, 3, 3] }]
|
|
2166
|
-
},
|
|
2167
|
-
{
|
|
2168
|
-
code: "SE",
|
|
2169
|
-
name: "Sweden",
|
|
2170
|
-
dialCode: "+46",
|
|
2171
|
-
trunkPrefix: "0",
|
|
2172
|
-
nationalDigits: { min: 7, max: 9 },
|
|
2173
|
-
grouping: [{ startsWith: ["7"], digits: 9, groups: [2, 3, 4] }]
|
|
2174
|
-
},
|
|
2175
|
-
/*
|
|
2176
|
-
* Named and length-checked so a number from one of them is not read as nonsense, but
|
|
2177
|
-
* NOT formatted: the brief is the EU and the UK, and a grouping rule written for a
|
|
2178
|
-
* market nobody asked about is a rule nobody will check. The NANP is the exception — it
|
|
2179
|
-
* was already here, and it is one shape throughout.
|
|
2180
|
-
*/
|
|
2181
|
-
{
|
|
2182
|
-
code: "US",
|
|
2183
|
-
name: "United States",
|
|
2184
|
-
dialCode: "+1",
|
|
2185
|
-
nationalDigits: { min: 10, max: 10 },
|
|
2186
|
-
grouping: [{ digits: 10, groups: [3, 3, 4] }]
|
|
2187
|
-
},
|
|
2188
|
-
{ code: "CH", name: "Switzerland", dialCode: "+41", trunkPrefix: "0" },
|
|
2189
|
-
{ code: "NO", name: "Norway", dialCode: "+47" },
|
|
2190
|
-
{ code: "AU", name: "Australia", dialCode: "+61", trunkPrefix: "0" },
|
|
2191
|
-
{ code: "NZ", name: "New Zealand", dialCode: "+64", trunkPrefix: "0" },
|
|
2192
|
-
{ code: "ZA", name: "South Africa", dialCode: "+27", trunkPrefix: "0" },
|
|
2193
|
-
{ code: "AE", name: "United Arab Emirates", dialCode: "+971", trunkPrefix: "0" },
|
|
2194
|
-
{ code: "IN", name: "India", dialCode: "+91", trunkPrefix: "0" },
|
|
2195
|
-
{ code: "BR", name: "Brazil", dialCode: "+55", trunkPrefix: "0" }
|
|
2196
|
-
];
|
|
2197
|
-
var DEFAULT_COUNTRY_CODE = "IE";
|
|
2198
|
-
function countryByCode(code) {
|
|
2199
|
-
const found = COUNTRIES.find((country) => country.code === code);
|
|
2200
|
-
if (!found) throw new Error(`unknown country: ${code}`);
|
|
2201
|
-
return found;
|
|
2202
|
-
}
|
|
2203
|
-
var DEFAULT_DIAL_CODE = countryByCode(DEFAULT_COUNTRY_CODE).dialCode;
|
|
2204
|
-
var digitsOf = (value) => value.replace(/\D/g, "");
|
|
2205
|
-
function countryByDialCode(dialCode) {
|
|
2206
|
-
const raw = digitsOf(dialCode);
|
|
2207
|
-
const digits = raw.startsWith("00") && raw.length > 2 ? raw.slice(2) : raw;
|
|
2208
|
-
if (digits.length === 0) return null;
|
|
2209
|
-
return COUNTRIES.find((country) => country.dialCode.slice(1) === digits) ?? null;
|
|
2210
|
-
}
|
|
2211
|
-
function splitPhoneNumber(raw) {
|
|
2212
|
-
const trimmed = raw.trim();
|
|
2213
|
-
const digits = digitsOf(trimmed);
|
|
2214
|
-
const international = trimmed.startsWith("+") || digits.startsWith("00") && digits.length > 2;
|
|
2215
|
-
if (!international || digits.length === 0) return { dialCode: null, national: trimmed };
|
|
2216
|
-
const body = trimmed.startsWith("+") ? digits : digits.slice(2);
|
|
2217
|
-
const match = [...COUNTRIES].sort((a, b) => b.dialCode.length - a.dialCode.length).find((country) => body.startsWith(country.dialCode.slice(1)));
|
|
2218
|
-
if (!match) return { dialCode: null, national: trimmed };
|
|
2219
|
-
return { dialCode: match.dialCode, national: body.slice(match.dialCode.length - 1) };
|
|
2220
|
-
}
|
|
2221
|
-
var MAX_DIAL_DIGITS = Math.max(...COUNTRIES.map((country) => country.dialCode.length - 1));
|
|
2222
|
-
var NOT_PHONE = /[^\d+]/g;
|
|
2223
|
-
function routePhoneInput(typed, field, current) {
|
|
2224
|
-
const raw = typed.replace(NOT_PHONE, "");
|
|
2225
|
-
const parts = splitPhoneNumber(raw);
|
|
2226
|
-
if (field === "national") {
|
|
2227
|
-
if (parts.dialCode === null) return { ...current, national: raw };
|
|
2228
|
-
return { dialCode: parts.dialCode, national: parts.national };
|
|
2017
|
+
/** Lodges the credential the device made. */
|
|
2018
|
+
async registerPasskey(body) {
|
|
2019
|
+
return this.fetchVoid(
|
|
2020
|
+
"/api/Passkeys/Registrations",
|
|
2021
|
+
{
|
|
2022
|
+
method: "POST",
|
|
2023
|
+
body: JSON.stringify(body)
|
|
2024
|
+
},
|
|
2025
|
+
"USER"
|
|
2026
|
+
);
|
|
2229
2027
|
}
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
* letting its `1` overwrite an entered number is the same bug in the other direction —
|
|
2237
|
-
* so it is dropped, unless the row below is empty and there is nothing to lose.
|
|
2238
|
-
*/
|
|
2239
|
-
national: digitsOf(parts.national).length >= GENERIC_NATIONAL_DIGITS.min || current.national.length === 0 ? parts.national : current.national
|
|
2240
|
-
};
|
|
2028
|
+
/** Opens a sign-in. Needs no session — proving who you are is the point of it. */
|
|
2029
|
+
async createPasskeyAuthenticationChallenge(body) {
|
|
2030
|
+
return this.fetch("/api/Passkeys/Authentications/Challenges", {
|
|
2031
|
+
method: "POST",
|
|
2032
|
+
body: JSON.stringify(body)
|
|
2033
|
+
});
|
|
2241
2034
|
}
|
|
2242
|
-
|
|
2243
|
-
|
|
2035
|
+
/** Spends the assertion, and opens a session with it. */
|
|
2036
|
+
async authenticateWithPasskey(body) {
|
|
2037
|
+
return this.fetch("/api/Passkeys/Authentications", {
|
|
2038
|
+
method: "POST",
|
|
2039
|
+
body: JSON.stringify(body)
|
|
2040
|
+
});
|
|
2244
2041
|
}
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2042
|
+
// ===========================================================================
|
|
2043
|
+
// Feedback
|
|
2044
|
+
// ===========================================================================
|
|
2045
|
+
/**
|
|
2046
|
+
* How the buyer rated a ticket. Answers 200 and nothing else, so there is no receipt
|
|
2047
|
+
* to hold on to — the call either went or it did not.
|
|
2048
|
+
*/
|
|
2049
|
+
async submitFeedback(body) {
|
|
2050
|
+
return this.fetchVoid("/api/Feedback", { method: "POST", body: JSON.stringify(body) });
|
|
2051
|
+
}
|
|
2052
|
+
// ===========================================================================
|
|
2053
|
+
// Utilities
|
|
2054
|
+
// ===========================================================================
|
|
2055
|
+
/**
|
|
2056
|
+
* SEND ONE TICKET TO AN ADDRESS — the platform's own email, to whoever the buyer names.
|
|
2057
|
+
*
|
|
2058
|
+
* `template` IS OMITTED ON PURPOSE. The parameter takes a free string, the spec documents
|
|
2059
|
+
* no values for it and nothing else in the API names one; left off, the platform sends
|
|
2060
|
+
* its default. Conall, 2026-09-13.
|
|
2061
|
+
*
|
|
2062
|
+
* IT IS A `GET` THAT SENDS MAIL, which is the platform's shape and not a choice made
|
|
2063
|
+
* here. A `GET` is the one method browsers, proxies, prefetchers and generic retry layers
|
|
2064
|
+
* treat as free to repeat, so at-most-once cannot be delegated to any of them: every
|
|
2065
|
+
* caller has to fire this from one deliberate press and never from anything that can
|
|
2066
|
+
* re-run. See `sendTicket` in the booking gateway, which is the only caller.
|
|
2067
|
+
*/
|
|
2068
|
+
async sendTicketEmail(attendeeTicketId, email) {
|
|
2069
|
+
const params = new URLSearchParams({
|
|
2070
|
+
email,
|
|
2071
|
+
attendee_ticket_id: String(attendeeTicketId)
|
|
2072
|
+
});
|
|
2073
|
+
await this.fetch(`/api/AttendeeTicket/SendSingleEmail?${params}`);
|
|
2074
|
+
}
|
|
2075
|
+
/**
|
|
2076
|
+
* WHERE A TICKET'S APPLE WALLET PASS IS SERVED — a URL, not a fetch.
|
|
2077
|
+
*
|
|
2078
|
+
* THE BROWSER HAS TO NAVIGATE TO IT. Safari only offers a pass to Wallet when it arrives
|
|
2079
|
+
* as a download with Apple's media type, so there is nothing here to read and hand on: a
|
|
2080
|
+
* pass fetched into script and re-served from a `blob:` is not reliably offered on iOS.
|
|
2081
|
+
* It is the same link the platform's own ticket emails carry, and it needs no
|
|
2082
|
+
* authorization, which is why none is attached.
|
|
2083
|
+
*/
|
|
2084
|
+
applePassUrl(attendeeTicketKey) {
|
|
2085
|
+
const params = new URLSearchParams({ attendee_ticket_key: attendeeTicketKey });
|
|
2086
|
+
return `${this.config.apiUrl}/api/Wallet/ApplePass?${params}`;
|
|
2087
|
+
}
|
|
2088
|
+
async getQrCode(content, foreground = "000000", background = "FFFFFF") {
|
|
2089
|
+
const params = new URLSearchParams({
|
|
2090
|
+
content,
|
|
2091
|
+
foreground,
|
|
2092
|
+
background,
|
|
2093
|
+
drawQuietZone: "false"
|
|
2094
|
+
});
|
|
2095
|
+
return this.fetch(`/api/Utils/GetQrCodeAsSVG?${params}`);
|
|
2271
2096
|
}
|
|
2272
|
-
if (trunk === "") return parts.join(" ");
|
|
2273
|
-
return trunk === "0" ? [trunk + (parts[0] ?? ""), ...parts.slice(1)].join(" ") : [trunk, ...parts].join(" ");
|
|
2274
|
-
}
|
|
2275
|
-
function digitsAllowed(country) {
|
|
2276
|
-
return country.nationalDigits ?? GENERIC_NATIONAL_DIGITS;
|
|
2277
|
-
}
|
|
2278
|
-
function isValidPhone(phone, country) {
|
|
2279
|
-
const national = nationalDigits(phone, country);
|
|
2280
|
-
const { min, max } = digitsAllowed(country);
|
|
2281
|
-
return national.length >= min && national.length <= max;
|
|
2282
|
-
}
|
|
2283
|
-
function phoneFlag(phone, country) {
|
|
2284
|
-
if (phone.trim().length === 0) return "none";
|
|
2285
|
-
return isValidPhone(phone, country) ? "success" : "error";
|
|
2286
|
-
}
|
|
2287
|
-
function e164(dialCode, phone) {
|
|
2288
|
-
const country = countryByDialCode(dialCode);
|
|
2289
|
-
if (country === null) return null;
|
|
2290
|
-
const national = nationalDigits(phone, country);
|
|
2291
|
-
if (!isValidPhone(phone, country)) return null;
|
|
2292
|
-
const composed = `${country.dialCode}${national}`;
|
|
2293
|
-
return isE164(composed) ? composed : null;
|
|
2294
|
-
}
|
|
2295
|
-
function normalizeE164(value) {
|
|
2296
|
-
const { dialCode, national } = splitPhoneNumber(value);
|
|
2297
|
-
if (dialCode === null) return null;
|
|
2298
|
-
return e164(dialCode, national);
|
|
2299
|
-
}
|
|
2300
|
-
function isCompleteName(firstName, lastName) {
|
|
2301
|
-
return firstName.trim().length > 0 && lastName.trim().length > 0;
|
|
2302
|
-
}
|
|
2303
|
-
function splitFullName(full) {
|
|
2304
|
-
const parts = full.trim().split(/\s+/).filter(Boolean);
|
|
2305
|
-
if (parts.length < 2) return null;
|
|
2306
|
-
const [firstName, ...rest] = parts;
|
|
2307
|
-
return { firstName, lastName: rest.join(" ") };
|
|
2308
|
-
}
|
|
2309
|
-
|
|
2310
|
-
// src/island/ContentFlag.tsx
|
|
2311
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
2312
|
-
var GLYPH = {
|
|
2313
|
-
success: CheckInCircleFilledIcon,
|
|
2314
|
-
warning: ExclamationMarkInCircleFilledIcon,
|
|
2315
|
-
error: XMarkInCircleFilledIcon
|
|
2316
2097
|
};
|
|
2317
|
-
function ContentFlag({ tone, title }) {
|
|
2318
|
-
const Glyph = GLYPH[tone];
|
|
2319
|
-
return /* @__PURE__ */ jsx2("span", { className: `scopetickets-island-content-flag scopetickets-island-content-flag--${tone}`, children: /* @__PURE__ */ jsx2(Glyph, { fill: true, color: "currentColor", title }) });
|
|
2320
|
-
}
|
|
2321
2098
|
|
|
2322
|
-
// src/
|
|
2323
|
-
|
|
2324
|
-
function
|
|
2325
|
-
const
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
);
|
|
2099
|
+
// ../api/src/payment-protocol/parent.ts
|
|
2100
|
+
var CARRIED_CHECKOUT_PARAMS = ["event", "eventKey"];
|
|
2101
|
+
function buildFrameUrl(hostUrl, cartKey, identity, options) {
|
|
2102
|
+
const url = new URL(`/checkout/${cartKey}`, hostUrl);
|
|
2103
|
+
url.searchParams.set("method", identity.method);
|
|
2104
|
+
url.searchParams.set("instanceId", identity.instanceId);
|
|
2105
|
+
if (options.checkoutSessionId !== void 0)
|
|
2106
|
+
url.searchParams.set("checkoutSessionId", options.checkoutSessionId);
|
|
2107
|
+
url.searchParams.set("displayMode", "prewarm");
|
|
2108
|
+
url.searchParams.set("origin", options.parentOrigin);
|
|
2109
|
+
if (options.debug === true) url.searchParams.set("scopePaymentDebug", "1");
|
|
2110
|
+
if (options.retry === true) url.searchParams.set("paymentRetry", "1");
|
|
2111
|
+
for (const name of options.carriedParams ?? []) {
|
|
2112
|
+
const value = options.parentSearchParams?.get(name);
|
|
2113
|
+
if (value) url.searchParams.set(name, value);
|
|
2114
|
+
}
|
|
2115
|
+
return url.toString();
|
|
2340
2116
|
}
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
var TIMER_CENTRE = TIMER_GRID / 2;
|
|
2348
|
-
var RING_OUTER = 10;
|
|
2349
|
-
var RING_INNER = 8;
|
|
2350
|
-
var RING_RADIUS = (RING_OUTER + RING_INNER) / 2;
|
|
2351
|
-
var RING_WIDTH = RING_OUTER - RING_INNER;
|
|
2352
|
-
var TURN_DEGREES = 360;
|
|
2353
|
-
var SOURCE_GRID = 100;
|
|
2354
|
-
var SOURCE_OFFSET_X = 0.2;
|
|
2355
|
-
var SOURCE_SCALE = TIMER_GRID / SOURCE_GRID;
|
|
2356
|
-
var HAND_SOURCE = "M55.2,49.9l-.7-26c0-1-.4-2.1-1.2-2.9-1.7-1.7-4.4-1.7-6,0s-1.2,1.8-1.2,2.9l-.7,26c0,1.3.4,2.7,1.5,3.7,2,2,5.1,2,7.1,0s1.5-2.4,1.5-3.7Z";
|
|
2357
|
-
function n(value) {
|
|
2358
|
-
const rounded = Number(value.toFixed(3));
|
|
2359
|
-
return String(Object.is(rounded, -0) ? 0 : rounded);
|
|
2117
|
+
function allowedFrameOrigin(hostUrl) {
|
|
2118
|
+
try {
|
|
2119
|
+
return new URL(hostUrl).origin;
|
|
2120
|
+
} catch {
|
|
2121
|
+
return hostUrl;
|
|
2122
|
+
}
|
|
2360
2123
|
}
|
|
2361
|
-
|
|
2362
|
-
|
|
2124
|
+
var PAYMENT_DIAGNOSTIC_EVENTS = /* @__PURE__ */ new Set([
|
|
2125
|
+
"revolut.provider_init_started",
|
|
2126
|
+
"revolut.provider_init_finished",
|
|
2127
|
+
"revolut.provider_init_failed",
|
|
2128
|
+
"revolut.button_pressed",
|
|
2129
|
+
"revolut.create_order_callback_started",
|
|
2130
|
+
"revolut.create_order_callback_returned",
|
|
2131
|
+
"revolut.inline_journey_detected",
|
|
2132
|
+
"revolut.external_handoff_detected",
|
|
2133
|
+
"revolut.detector_state"
|
|
2134
|
+
]);
|
|
2135
|
+
var isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2136
|
+
function parsePaymentDiagnostic(value) {
|
|
2137
|
+
if (!isPlainObject(value)) return null;
|
|
2138
|
+
const payload = value;
|
|
2139
|
+
if (typeof payload.event !== "string" || !PAYMENT_DIAGNOSTIC_EVENTS.has(payload.event))
|
|
2140
|
+
return null;
|
|
2141
|
+
const sourceData = isPlainObject(payload.data) ? payload.data : void 0;
|
|
2142
|
+
const data = {};
|
|
2143
|
+
if (sourceData?.paymentHostClass === "local_tunnel" || sourceData?.paymentHostClass === "other") {
|
|
2144
|
+
data.paymentHostClass = sourceData.paymentHostClass;
|
|
2145
|
+
}
|
|
2146
|
+
if (typeof sourceData?.active === "boolean") data.active = sourceData.active;
|
|
2147
|
+
if (typeof sourceData?.tokenPresent === "boolean") data.tokenPresent = sourceData.tokenPresent;
|
|
2148
|
+
if (typeof sourceData?.errorType === "string" && /^[A-Za-z][A-Za-z0-9]{0,63}$/.test(sourceData.errorType)) {
|
|
2149
|
+
data.errorType = sourceData.errorType;
|
|
2150
|
+
}
|
|
2151
|
+
if (sourceData?.evidence === "provider_frame_loaded" || sourceData?.evidence === "provider_frame_replaced" || sourceData?.evidence === "mobile_inline_provisional") {
|
|
2152
|
+
data.evidence = sourceData.evidence;
|
|
2153
|
+
}
|
|
2154
|
+
if (typeof sourceData?.generation === "number" && Number.isSafeInteger(sourceData.generation)) {
|
|
2155
|
+
data.generation = sourceData.generation;
|
|
2156
|
+
}
|
|
2157
|
+
if (typeof sourceData?.mobile === "boolean") data.mobile = sourceData.mobile;
|
|
2158
|
+
if (typeof sourceData?.visible === "boolean") data.visible = sourceData.visible;
|
|
2159
|
+
if (sourceData?.state === "initialized" || sourceData?.state === "attempt_started" || sourceData?.state === "order_returned" || sourceData?.state === "inline_provisional" || sourceData?.state === "external_handoff" || sourceData?.state === "disconnected") {
|
|
2160
|
+
data.state = sourceData.state;
|
|
2161
|
+
}
|
|
2162
|
+
if (sourceData?.reason === "not_mobile" || sourceData?.reason === "no_attempt" || sourceData?.reason === "terminal" || sourceData?.reason === "external_handoff" || sourceData?.reason === "hidden") {
|
|
2163
|
+
data.reason = sourceData.reason;
|
|
2164
|
+
}
|
|
2165
|
+
return { event: payload.event, ...Object.keys(data).length > 0 ? { data } : {} };
|
|
2166
|
+
}
|
|
2167
|
+
function parsePaymentPresentation(value, expectedInstanceId, latestGeneration) {
|
|
2168
|
+
if (!isPlainObject(value)) return null;
|
|
2169
|
+
const payload = value;
|
|
2170
|
+
if (payload.instanceId !== expectedInstanceId || payload.method !== "revolut_pay" || payload.mode !== "inline_provisional" && payload.mode !== "external_handoff" || typeof payload.attemptGeneration !== "number" || !Number.isSafeInteger(payload.attemptGeneration) || payload.attemptGeneration <= 0 || payload.attemptGeneration < latestGeneration) {
|
|
2171
|
+
return null;
|
|
2172
|
+
}
|
|
2363
2173
|
return {
|
|
2364
|
-
|
|
2365
|
-
|
|
2174
|
+
instanceId: payload.instanceId,
|
|
2175
|
+
method: payload.method,
|
|
2176
|
+
mode: payload.mode,
|
|
2177
|
+
attemptGeneration: payload.attemptGeneration
|
|
2366
2178
|
};
|
|
2367
2179
|
}
|
|
2368
|
-
function
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
}
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2180
|
+
function parseFrameEvent(event, expected) {
|
|
2181
|
+
if (expected.source == null || event.origin !== expected.allowedOrigin || event.source !== expected.source || !isPlainObject(event.data))
|
|
2182
|
+
return null;
|
|
2183
|
+
const { type } = event.data;
|
|
2184
|
+
if (typeof type !== "string" || !type.startsWith("SCOPE_PAYMENT_")) return null;
|
|
2185
|
+
const payload = isPlainObject(event.data.payload) ? event.data.payload : {};
|
|
2186
|
+
if (payload.instanceId !== void 0 && payload.instanceId !== expected.identity.instanceId)
|
|
2187
|
+
return null;
|
|
2188
|
+
if (payload.method !== void 0 && payload.method !== expected.identity.method) return null;
|
|
2189
|
+
const frameMessage = { type, payload };
|
|
2190
|
+
switch (type) {
|
|
2191
|
+
case "SCOPE_PAYMENT_READY":
|
|
2192
|
+
case "SCOPE_PAYMENT_CONFIG_REQUESTED":
|
|
2193
|
+
case "SCOPE_PAYMENT_CANCELLED":
|
|
2194
|
+
case "SCOPE_PAYMENT_SUBMIT_REQUESTED":
|
|
2195
|
+
return frameMessage;
|
|
2196
|
+
case "SCOPE_PAYMENT_RESIZE":
|
|
2197
|
+
if (typeof payload.height !== "number" || !Number.isFinite(payload.height)) return null;
|
|
2198
|
+
return frameMessage;
|
|
2199
|
+
case "SCOPE_PAYMENT_SUCCESS":
|
|
2200
|
+
if (typeof payload.cartKey !== "string" || !payload.cartKey) return null;
|
|
2201
|
+
return frameMessage;
|
|
2202
|
+
case "SCOPE_PAYMENT_ERROR":
|
|
2203
|
+
if (typeof payload.code !== "string" || typeof payload.message !== "string") return null;
|
|
2204
|
+
return frameMessage;
|
|
2205
|
+
case "SCOPE_PAYMENT_METHOD_STATUS":
|
|
2206
|
+
if (typeof payload.ready !== "boolean") return null;
|
|
2207
|
+
if (payload.wallet !== void 0 && payload.wallet !== "applePay" && payload.wallet !== "googlePay")
|
|
2208
|
+
return null;
|
|
2209
|
+
return frameMessage;
|
|
2210
|
+
case "SCOPE_PAYMENT_DIAGNOSTIC": {
|
|
2211
|
+
const diagnostic = parsePaymentDiagnostic(payload);
|
|
2212
|
+
return diagnostic === null ? null : { type, payload: diagnostic };
|
|
2213
|
+
}
|
|
2214
|
+
case "SCOPE_PAYMENT_PRESENTATION": {
|
|
2215
|
+
const presentation = parsePaymentPresentation(payload, expected.identity.instanceId, 0);
|
|
2216
|
+
return presentation === null ? null : { type, payload: presentation };
|
|
2217
|
+
}
|
|
2218
|
+
default:
|
|
2219
|
+
return null;
|
|
2220
|
+
}
|
|
2375
2221
|
}
|
|
2376
|
-
function
|
|
2377
|
-
return
|
|
2222
|
+
function buildConfigMessage(identity, config) {
|
|
2223
|
+
return {
|
|
2224
|
+
type: "SCOPE_PAYMENT_CONFIG",
|
|
2225
|
+
payload: {
|
|
2226
|
+
...config.apiKey === void 0 ? {} : { apiKey: config.apiKey },
|
|
2227
|
+
...config.selectedMethod === void 0 ? {} : { selectedMethod: config.selectedMethod },
|
|
2228
|
+
...config.theme === void 0 ? {} : { theme: config.theme },
|
|
2229
|
+
instanceId: identity.instanceId,
|
|
2230
|
+
method: identity.method
|
|
2231
|
+
}
|
|
2232
|
+
};
|
|
2378
2233
|
}
|
|
2379
|
-
function
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
const linear = (x, y) => {
|
|
2384
|
-
const sx = x * SOURCE_SCALE;
|
|
2385
|
-
const sy = y * SOURCE_SCALE;
|
|
2386
|
-
return { x: sx * cos - sy * sin, y: sx * sin + sy * cos };
|
|
2234
|
+
function buildSubmitConfirmedMessage(identity, buyer) {
|
|
2235
|
+
return {
|
|
2236
|
+
type: "SCOPE_PAYMENT_SUBMIT_CONFIRMED",
|
|
2237
|
+
payload: { ...buyer, instanceId: identity.instanceId, method: identity.method }
|
|
2387
2238
|
};
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2239
|
+
}
|
|
2240
|
+
function buildSubmitRejectedMessage(identity, reason) {
|
|
2241
|
+
return {
|
|
2242
|
+
type: "SCOPE_PAYMENT_SUBMIT_REJECTED",
|
|
2243
|
+
payload: { reason, instanceId: identity.instanceId, method: identity.method }
|
|
2391
2244
|
};
|
|
2392
|
-
const pair = (p) => `${n(p.x)},${n(p.y)}`;
|
|
2393
|
-
const segments = source.match(/[a-zA-Z][^a-zA-Z]*/g) ?? [];
|
|
2394
|
-
return segments.map((segment) => {
|
|
2395
|
-
const command = segment[0];
|
|
2396
|
-
const numbers = (segment.slice(1).match(/-?(?:\d*\.\d+|\d+)/g) ?? []).map(Number);
|
|
2397
|
-
const deltas = (stride) => {
|
|
2398
|
-
if (numbers.length === 0 || numbers.length % stride !== 0) {
|
|
2399
|
-
throw new Error(`path: \`${command}\` wants multiples of ${stride}`);
|
|
2400
|
-
}
|
|
2401
|
-
const out = [];
|
|
2402
|
-
for (let i = 0; i < numbers.length; i += 2) {
|
|
2403
|
-
out.push(pair(linear(numbers[i], numbers[i + 1])));
|
|
2404
|
-
}
|
|
2405
|
-
return command + out.join(" ");
|
|
2406
|
-
};
|
|
2407
|
-
switch (command) {
|
|
2408
|
-
case "M": {
|
|
2409
|
-
if (numbers.length !== 2) throw new Error("path: `M` wants exactly one point");
|
|
2410
|
-
return `M${pair(absolute(numbers[0], numbers[1]))}`;
|
|
2411
|
-
}
|
|
2412
|
-
case "l":
|
|
2413
|
-
return deltas(2);
|
|
2414
|
-
case "c":
|
|
2415
|
-
return deltas(6);
|
|
2416
|
-
case "s":
|
|
2417
|
-
return deltas(4);
|
|
2418
|
-
case "Z":
|
|
2419
|
-
case "z":
|
|
2420
|
-
return "Z";
|
|
2421
|
-
default:
|
|
2422
|
-
throw new Error(`path: unsupported command \`${command}\``);
|
|
2423
|
-
}
|
|
2424
|
-
}).join("");
|
|
2425
2245
|
}
|
|
2426
|
-
function
|
|
2427
|
-
|
|
2428
|
-
|
|
2246
|
+
function buildTriggerSubmitMessage(identity) {
|
|
2247
|
+
return {
|
|
2248
|
+
type: "SCOPE_PAYMENT_TRIGGER_SUBMIT",
|
|
2249
|
+
payload: { instanceId: identity.instanceId, method: identity.method }
|
|
2250
|
+
};
|
|
2429
2251
|
}
|
|
2430
|
-
function
|
|
2431
|
-
const filled = clampRemaining(fraction);
|
|
2432
|
-
if (filled <= 0 || filled >= 1) return null;
|
|
2433
|
-
const mirrored = direction === "ccw";
|
|
2434
|
-
const sweep = filled * TURN_DEGREES * (mirrored ? -1 : 1);
|
|
2435
|
-
const capRadius = (outer - inner) / 2;
|
|
2436
|
-
const outerStart = pointAt(outer, 0);
|
|
2437
|
-
const outerEnd = pointAt(outer, sweep);
|
|
2438
|
-
const innerEnd = pointAt(inner, sweep);
|
|
2439
|
-
const innerStart = pointAt(inner, 0);
|
|
2440
|
-
const out = mirrored ? 0 : 1;
|
|
2441
|
-
const back = mirrored ? 1 : 0;
|
|
2442
|
-
const large = Math.abs(sweep) > 180 ? 1 : 0;
|
|
2443
|
-
const cap = `${n(capRadius)},${n(capRadius)}`;
|
|
2444
|
-
const at = (p) => `${n(p.x)},${n(p.y)}`;
|
|
2252
|
+
function buildCancelRequestedMessage(identity) {
|
|
2445
2253
|
return {
|
|
2446
|
-
|
|
2254
|
+
type: "SCOPE_PAYMENT_CANCEL_REQUESTED",
|
|
2255
|
+
payload: { instanceId: identity.instanceId, method: identity.method }
|
|
2447
2256
|
};
|
|
2448
2257
|
}
|
|
2449
|
-
|
|
2450
|
-
|
|
2258
|
+
|
|
2259
|
+
// ../api/src/buyer.ts
|
|
2260
|
+
var MAX_EMAIL_LENGTH = 254;
|
|
2261
|
+
var MAX_LOCAL_LENGTH = 64;
|
|
2262
|
+
var MAX_LABEL_LENGTH = 63;
|
|
2263
|
+
var MAX_DOMAIN_LENGTH = 255;
|
|
2264
|
+
var LOCAL_PART = /^[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+(\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*$/;
|
|
2265
|
+
var DOMAIN_LABEL = /^[A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])?$/;
|
|
2266
|
+
var TOP_LEVEL_LABEL = /^[A-Za-z]{2,}$/;
|
|
2267
|
+
function isAcceptableEmail(value) {
|
|
2268
|
+
const email = value.trim();
|
|
2269
|
+
if (email.length === 0 || email.length > MAX_EMAIL_LENGTH) return false;
|
|
2270
|
+
const at = email.lastIndexOf("@");
|
|
2271
|
+
if (at <= 0 || at === email.length - 1) return false;
|
|
2272
|
+
const local = email.slice(0, at);
|
|
2273
|
+
if (local.length > MAX_LOCAL_LENGTH || !LOCAL_PART.test(local)) return false;
|
|
2274
|
+
const domain = email.slice(at + 1);
|
|
2275
|
+
if (domain.length > MAX_DOMAIN_LENGTH) return false;
|
|
2276
|
+
const labels = domain.split(".");
|
|
2277
|
+
if (labels.length < 2) return false;
|
|
2278
|
+
if (labels.some((label) => label.length > MAX_LABEL_LENGTH || !DOMAIN_LABEL.test(label))) {
|
|
2279
|
+
return false;
|
|
2280
|
+
}
|
|
2281
|
+
return TOP_LEVEL_LABEL.test(labels[labels.length - 1]);
|
|
2451
2282
|
}
|
|
2452
|
-
|
|
2453
|
-
|
|
2283
|
+
var E164 = /^\+[1-9]\d{1,14}$/;
|
|
2284
|
+
function isE164(value) {
|
|
2285
|
+
return E164.test(value.trim());
|
|
2286
|
+
}
|
|
2287
|
+
var CONTROL_CHARACTERS = /[\x00-\x1F\x7F]/;
|
|
2288
|
+
function isAcceptableName(value) {
|
|
2289
|
+
const name = value.trim();
|
|
2290
|
+
return name.length > 0 && name.length <= 256 && !CONTROL_CHARACTERS.test(name);
|
|
2291
|
+
}
|
|
2292
|
+
|
|
2293
|
+
// ../api/src/email-typos.ts
|
|
2294
|
+
var KNOWN_DOMAINS = [
|
|
2295
|
+
"gmail.com",
|
|
2296
|
+
"googlemail.com",
|
|
2297
|
+
"icloud.com",
|
|
2298
|
+
"me.com",
|
|
2299
|
+
"mac.com",
|
|
2300
|
+
"mail.com",
|
|
2301
|
+
"hotmail.com",
|
|
2302
|
+
"outlook.com",
|
|
2303
|
+
"live.com",
|
|
2304
|
+
"yahoo.com",
|
|
2305
|
+
"aol.com",
|
|
2306
|
+
"proton.me",
|
|
2307
|
+
"protonmail.com",
|
|
2308
|
+
"eircom.net"
|
|
2309
|
+
];
|
|
2310
|
+
var NEAR_MISS_TARGETS = [
|
|
2311
|
+
"gmail.com",
|
|
2312
|
+
"googlemail.com",
|
|
2313
|
+
"icloud.com",
|
|
2314
|
+
"hotmail.com",
|
|
2315
|
+
"outlook.com",
|
|
2316
|
+
"yahoo.com",
|
|
2317
|
+
"protonmail.com",
|
|
2318
|
+
"eircom.net"
|
|
2319
|
+
];
|
|
2320
|
+
var MIN_DISTINCTIVE_BODY = 4;
|
|
2321
|
+
var TOP_LEVEL_SLIPS = {
|
|
2322
|
+
co: "com",
|
|
2323
|
+
con: "com",
|
|
2324
|
+
cim: "com",
|
|
2325
|
+
cmo: "com",
|
|
2326
|
+
ocm: "com",
|
|
2327
|
+
comm: "com",
|
|
2328
|
+
coom: "com",
|
|
2329
|
+
cpm: "com",
|
|
2330
|
+
vom: "com",
|
|
2331
|
+
xom: "com",
|
|
2332
|
+
nte: "net",
|
|
2333
|
+
ner: "net",
|
|
2334
|
+
ogr: "org",
|
|
2335
|
+
orh: "org"
|
|
2336
|
+
};
|
|
2337
|
+
function editDistance(a, b) {
|
|
2338
|
+
const columns = b.length + 1;
|
|
2339
|
+
const d = new Uint16Array((a.length + 1) * columns);
|
|
2340
|
+
for (let j = 0; j < columns; j += 1) d[j] = j;
|
|
2341
|
+
for (let i = 1; i <= a.length; i += 1) {
|
|
2342
|
+
const row = i * columns;
|
|
2343
|
+
const previous = row - columns;
|
|
2344
|
+
d[row] = i;
|
|
2345
|
+
for (let j = 1; j <= b.length; j += 1) {
|
|
2346
|
+
const cost = a[i - 1] === b[j - 1] ? 0 : 1;
|
|
2347
|
+
let best = Math.min(
|
|
2348
|
+
(d[previous + j] ?? 0) + 1,
|
|
2349
|
+
(d[row + j - 1] ?? 0) + 1,
|
|
2350
|
+
(d[previous + j - 1] ?? 0) + cost
|
|
2351
|
+
);
|
|
2352
|
+
if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) {
|
|
2353
|
+
best = Math.min(best, (d[previous - columns + j - 2] ?? 0) + 1);
|
|
2354
|
+
}
|
|
2355
|
+
d[row + j] = best;
|
|
2356
|
+
}
|
|
2357
|
+
}
|
|
2358
|
+
return d[a.length * columns + b.length] ?? 0;
|
|
2359
|
+
}
|
|
2360
|
+
function splitDomain(domain) {
|
|
2361
|
+
const lastDot = domain.lastIndexOf(".");
|
|
2362
|
+
if (lastDot <= 0 || lastDot === domain.length - 1) return null;
|
|
2363
|
+
return { body: domain.slice(0, lastDot), top: domain.slice(lastDot + 1) };
|
|
2454
2364
|
}
|
|
2455
|
-
function
|
|
2456
|
-
const
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
if (
|
|
2365
|
+
function nearestKnownDomain(domain) {
|
|
2366
|
+
const typed = splitDomain(domain);
|
|
2367
|
+
if (typed === null || typed.body.length < MIN_DISTINCTIVE_BODY) return null;
|
|
2368
|
+
for (const candidate of NEAR_MISS_TARGETS) {
|
|
2369
|
+
const known = splitDomain(candidate);
|
|
2370
|
+
if (known === null || known.top !== typed.top) continue;
|
|
2371
|
+
if (known.body.length < MIN_DISTINCTIVE_BODY) continue;
|
|
2372
|
+
if (editDistance(typed.body, known.body) === 1) return candidate;
|
|
2462
2373
|
}
|
|
2463
|
-
|
|
2464
|
-
return paths;
|
|
2374
|
+
return null;
|
|
2465
2375
|
}
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
return [
|
|
2376
|
+
function repairTopLevel(domain) {
|
|
2377
|
+
const labels = domain.split(".");
|
|
2378
|
+
if (labels.length < 2) return null;
|
|
2379
|
+
const top = labels[labels.length - 1];
|
|
2380
|
+
const meant = TOP_LEVEL_SLIPS[top];
|
|
2381
|
+
if (meant === void 0) return null;
|
|
2382
|
+
return [...labels.slice(0, -1), meant].join(".");
|
|
2473
2383
|
}
|
|
2474
|
-
function
|
|
2475
|
-
|
|
2476
|
-
const
|
|
2477
|
-
|
|
2384
|
+
function suspectedEmailTypo(email) {
|
|
2385
|
+
const trimmed = email.trim().toLowerCase();
|
|
2386
|
+
const at = trimmed.lastIndexOf("@");
|
|
2387
|
+
if (at <= 0 || at === trimmed.length - 1) return null;
|
|
2388
|
+
const local = trimmed.slice(0, at);
|
|
2389
|
+
const domain = trimmed.slice(at + 1);
|
|
2390
|
+
if (KNOWN_DOMAINS.includes(domain)) return null;
|
|
2391
|
+
const repaired = repairTopLevel(domain);
|
|
2392
|
+
const corrected = nearestKnownDomain(repaired ?? domain) ?? repaired;
|
|
2393
|
+
if (corrected === null || corrected === domain) return null;
|
|
2394
|
+
return `${local}@${corrected}`;
|
|
2478
2395
|
}
|
|
2479
2396
|
|
|
2480
|
-
// src/
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
{
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2397
|
+
// ../checkout-core/src/domain/contact.ts
|
|
2398
|
+
function isValidEmail(email) {
|
|
2399
|
+
return isAcceptableEmail(email);
|
|
2400
|
+
}
|
|
2401
|
+
function flagTone(flag) {
|
|
2402
|
+
return flag === "none" ? void 0 : flag;
|
|
2403
|
+
}
|
|
2404
|
+
function emailFlag(email) {
|
|
2405
|
+
if (email.length === 0) return "none";
|
|
2406
|
+
if (!isValidEmail(email)) return "error";
|
|
2407
|
+
return suspectedEmailTypo(email) === null ? "success" : "warning";
|
|
2408
|
+
}
|
|
2409
|
+
function emailFlagTitle(email) {
|
|
2410
|
+
const meant = emailFlag(email) === "warning" ? suspectedEmailTypo(email) : null;
|
|
2411
|
+
return meant === null ? void 0 : `Did you mean ${meant}?`;
|
|
2412
|
+
}
|
|
2413
|
+
var E164_MAX_DIGITS = 15;
|
|
2414
|
+
var GENERIC_NATIONAL_DIGITS = { min: 4, max: E164_MAX_DIGITS - 1 };
|
|
2415
|
+
var COUNTRIES = [
|
|
2416
|
+
// ── Ireland, the default, and the United Kingdom ────────────
|
|
2417
|
+
{
|
|
2418
|
+
code: "IE",
|
|
2419
|
+
name: "Ireland",
|
|
2420
|
+
dialCode: "+353",
|
|
2421
|
+
trunkPrefix: "0",
|
|
2422
|
+
nationalDigits: { min: 7, max: 9 },
|
|
2423
|
+
// `08X XXX XXXX`, which is what the design draws.
|
|
2424
|
+
grouping: [{ startsWith: ["8"], digits: 9, groups: [2, 3, 4] }]
|
|
2425
|
+
},
|
|
2426
|
+
{
|
|
2427
|
+
code: "GB",
|
|
2428
|
+
name: "United Kingdom",
|
|
2429
|
+
dialCode: "+44",
|
|
2430
|
+
trunkPrefix: "0",
|
|
2431
|
+
nationalDigits: { min: 9, max: 10 },
|
|
2432
|
+
// London is also ten digits and is grouped `020 7946 0958`, so nothing beyond the
|
|
2433
|
+
// `7` may be assumed.
|
|
2434
|
+
grouping: [{ startsWith: ["7"], digits: 10, groups: [4, 6] }]
|
|
2435
|
+
},
|
|
2436
|
+
// ── The rest of the EU, alphabetically ──────────────────────
|
|
2437
|
+
{
|
|
2438
|
+
code: "AT",
|
|
2439
|
+
name: "Austria",
|
|
2440
|
+
dialCode: "+43",
|
|
2441
|
+
trunkPrefix: "0",
|
|
2442
|
+
// Austria's plan is the widest in the EU — subscriber numbers run from four digits
|
|
2443
|
+
// to thirteen.
|
|
2444
|
+
nationalDigits: { min: 4, max: 13 },
|
|
2445
|
+
grouping: [{ startsWith: ["6"], digits: 10, groups: [3, 7] }]
|
|
2446
|
+
},
|
|
2447
|
+
{
|
|
2448
|
+
code: "BE",
|
|
2449
|
+
name: "Belgium",
|
|
2450
|
+
dialCode: "+32",
|
|
2451
|
+
trunkPrefix: "0",
|
|
2452
|
+
nationalDigits: { min: 8, max: 9 },
|
|
2453
|
+
grouping: [{ startsWith: ["4"], digits: 9, groups: [3, 2, 2, 2] }]
|
|
2454
|
+
},
|
|
2455
|
+
{
|
|
2456
|
+
code: "BG",
|
|
2457
|
+
name: "Bulgaria",
|
|
2458
|
+
dialCode: "+359",
|
|
2459
|
+
trunkPrefix: "0",
|
|
2460
|
+
nationalDigits: { min: 8, max: 9 },
|
|
2461
|
+
grouping: [{ startsWith: ["87", "88", "89"], digits: 9, groups: [2, 3, 4] }]
|
|
2462
|
+
},
|
|
2463
|
+
{
|
|
2464
|
+
code: "HR",
|
|
2465
|
+
name: "Croatia",
|
|
2466
|
+
dialCode: "+385",
|
|
2467
|
+
trunkPrefix: "0",
|
|
2468
|
+
nationalDigits: { min: 8, max: 9 },
|
|
2469
|
+
grouping: [{ startsWith: ["9"], digits: 9, groups: [2, 3, 4] }]
|
|
2470
|
+
},
|
|
2471
|
+
{
|
|
2472
|
+
code: "CY",
|
|
2473
|
+
name: "Cyprus",
|
|
2474
|
+
dialCode: "+357",
|
|
2475
|
+
nationalDigits: { min: 8, max: 8 },
|
|
2476
|
+
grouping: [{ startsWith: ["9"], digits: 8, groups: [2, 6] }]
|
|
2477
|
+
},
|
|
2478
|
+
{
|
|
2479
|
+
code: "CZ",
|
|
2480
|
+
name: "Czechia",
|
|
2481
|
+
dialCode: "+420",
|
|
2482
|
+
nationalDigits: { min: 9, max: 9 },
|
|
2483
|
+
// Threes throughout, and Czechia has no trunk prefix.
|
|
2484
|
+
grouping: [{ digits: 9, groups: [3, 3, 3] }]
|
|
2485
|
+
},
|
|
2486
|
+
{
|
|
2487
|
+
code: "DK",
|
|
2488
|
+
name: "Denmark",
|
|
2489
|
+
dialCode: "+45",
|
|
2490
|
+
nationalDigits: { min: 8, max: 8 },
|
|
2491
|
+
// Every Danish number is eight digits in pairs, mobile or not — so this needs no
|
|
2492
|
+
// prefix to disambiguate.
|
|
2493
|
+
grouping: [{ digits: 8, groups: [2, 2, 2, 2] }]
|
|
2494
|
+
},
|
|
2495
|
+
{
|
|
2496
|
+
code: "EE",
|
|
2497
|
+
name: "Estonia",
|
|
2498
|
+
dialCode: "+372",
|
|
2499
|
+
nationalDigits: { min: 7, max: 8 },
|
|
2500
|
+
grouping: [
|
|
2501
|
+
{ startsWith: ["5"], digits: 8, groups: [4, 4] },
|
|
2502
|
+
{ startsWith: ["5"], digits: 7, groups: [3, 4] }
|
|
2503
|
+
]
|
|
2504
|
+
},
|
|
2505
|
+
{
|
|
2506
|
+
code: "FI",
|
|
2507
|
+
name: "Finland",
|
|
2508
|
+
dialCode: "+358",
|
|
2509
|
+
trunkPrefix: "0",
|
|
2510
|
+
nationalDigits: { min: 6, max: 10 },
|
|
2511
|
+
grouping: [{ startsWith: ["4", "5"], digits: 9, groups: [2, 3, 4] }]
|
|
2512
|
+
},
|
|
2513
|
+
{
|
|
2514
|
+
code: "FR",
|
|
2515
|
+
name: "France",
|
|
2516
|
+
dialCode: "+33",
|
|
2517
|
+
trunkPrefix: "0",
|
|
2518
|
+
nationalDigits: { min: 9, max: 9 },
|
|
2519
|
+
// Pairs throughout — `06 12 34 56 78`.
|
|
2520
|
+
grouping: [{ startsWith: ["6", "7"], digits: 9, groups: [1, 2, 2, 2, 2] }]
|
|
2521
|
+
},
|
|
2522
|
+
{
|
|
2523
|
+
code: "DE",
|
|
2524
|
+
name: "Germany",
|
|
2525
|
+
dialCode: "+49",
|
|
2526
|
+
trunkPrefix: "0",
|
|
2527
|
+
nationalDigits: { min: 6, max: 11 }
|
|
2528
|
+
// NO GROUPING, deliberately, and the one EU country without it.
|
|
2529
|
+
},
|
|
2530
|
+
{
|
|
2531
|
+
code: "GR",
|
|
2532
|
+
name: "Greece",
|
|
2533
|
+
dialCode: "+30",
|
|
2534
|
+
nationalDigits: { min: 10, max: 10 },
|
|
2535
|
+
// Ten digits, no trunk prefix, and the leading digit is kept when dialling.
|
|
2536
|
+
grouping: [{ startsWith: ["69"], digits: 10, groups: [3, 3, 4] }]
|
|
2537
|
+
},
|
|
2538
|
+
{
|
|
2539
|
+
code: "HU",
|
|
2540
|
+
name: "Hungary",
|
|
2541
|
+
dialCode: "+36",
|
|
2542
|
+
// `06`, and written apart from the number — see `formatNational`.
|
|
2543
|
+
trunkPrefix: "06",
|
|
2544
|
+
nationalDigits: { min: 8, max: 9 },
|
|
2545
|
+
grouping: [{ startsWith: ["20", "30", "31", "50", "70"], digits: 9, groups: [2, 3, 4] }]
|
|
2546
|
+
},
|
|
2547
|
+
{
|
|
2548
|
+
code: "IT",
|
|
2549
|
+
name: "Italy",
|
|
2550
|
+
dialCode: "+39",
|
|
2551
|
+
// NO TRUNK PREFIX, and Italy is the exception worth knowing: the leading `0` of a
|
|
2552
|
+
// landline is part of the number and is dialled internationally too.
|
|
2553
|
+
nationalDigits: { min: 6, max: 11 },
|
|
2554
|
+
grouping: [{ startsWith: ["3"], digits: 10, groups: [3, 3, 4] }]
|
|
2555
|
+
},
|
|
2556
|
+
{
|
|
2557
|
+
code: "LV",
|
|
2558
|
+
name: "Latvia",
|
|
2559
|
+
dialCode: "+371",
|
|
2560
|
+
nationalDigits: { min: 8, max: 8 },
|
|
2561
|
+
grouping: [{ startsWith: ["2"], digits: 8, groups: [2, 3, 3] }]
|
|
2562
|
+
},
|
|
2563
|
+
{
|
|
2564
|
+
code: "LT",
|
|
2565
|
+
name: "Lithuania",
|
|
2566
|
+
dialCode: "+370",
|
|
2567
|
+
// `8`, and written apart from the number — see `formatNational`.
|
|
2568
|
+
trunkPrefix: "8",
|
|
2569
|
+
nationalDigits: { min: 8, max: 8 },
|
|
2570
|
+
grouping: [{ startsWith: ["6"], digits: 8, groups: [3, 5] }]
|
|
2571
|
+
},
|
|
2572
|
+
{
|
|
2573
|
+
code: "LU",
|
|
2574
|
+
name: "Luxembourg",
|
|
2575
|
+
dialCode: "+352",
|
|
2576
|
+
nationalDigits: { min: 4, max: 11 },
|
|
2577
|
+
grouping: [{ startsWith: ["6"], digits: 9, groups: [3, 3, 3] }]
|
|
2578
|
+
},
|
|
2579
|
+
{
|
|
2580
|
+
code: "MT",
|
|
2581
|
+
name: "Malta",
|
|
2582
|
+
dialCode: "+356",
|
|
2583
|
+
nationalDigits: { min: 8, max: 8 },
|
|
2584
|
+
grouping: [{ startsWith: ["7", "9"], digits: 8, groups: [4, 4] }]
|
|
2585
|
+
},
|
|
2586
|
+
{
|
|
2587
|
+
code: "NL",
|
|
2588
|
+
name: "Netherlands",
|
|
2589
|
+
dialCode: "+31",
|
|
2590
|
+
trunkPrefix: "0",
|
|
2591
|
+
nationalDigits: { min: 9, max: 9 },
|
|
2592
|
+
// `06 12345678` — the mobile prefix, then the number unbroken.
|
|
2593
|
+
grouping: [{ startsWith: ["6"], digits: 9, groups: [1, 8] }]
|
|
2594
|
+
},
|
|
2595
|
+
{
|
|
2596
|
+
code: "PL",
|
|
2597
|
+
name: "Poland",
|
|
2598
|
+
dialCode: "+48",
|
|
2599
|
+
// Poland dropped its trunk prefix; the nine digits are dialled as they are.
|
|
2600
|
+
nationalDigits: { min: 9, max: 9 },
|
|
2601
|
+
grouping: [{ digits: 9, groups: [3, 3, 3] }]
|
|
2602
|
+
},
|
|
2603
|
+
{
|
|
2604
|
+
code: "PT",
|
|
2605
|
+
name: "Portugal",
|
|
2606
|
+
dialCode: "+351",
|
|
2607
|
+
nationalDigits: { min: 9, max: 9 },
|
|
2608
|
+
grouping: [{ digits: 9, groups: [3, 3, 3] }]
|
|
2609
|
+
},
|
|
2610
|
+
{
|
|
2611
|
+
code: "RO",
|
|
2612
|
+
name: "Romania",
|
|
2613
|
+
dialCode: "+40",
|
|
2614
|
+
trunkPrefix: "0",
|
|
2615
|
+
nationalDigits: { min: 9, max: 9 },
|
|
2616
|
+
grouping: [{ startsWith: ["7"], digits: 9, groups: [3, 3, 3] }]
|
|
2617
|
+
},
|
|
2618
|
+
{
|
|
2619
|
+
code: "SK",
|
|
2620
|
+
name: "Slovakia",
|
|
2621
|
+
dialCode: "+421",
|
|
2622
|
+
trunkPrefix: "0",
|
|
2623
|
+
nationalDigits: { min: 9, max: 9 },
|
|
2624
|
+
grouping: [{ startsWith: ["9"], digits: 9, groups: [3, 3, 3] }]
|
|
2625
|
+
},
|
|
2626
|
+
{
|
|
2627
|
+
code: "SI",
|
|
2628
|
+
name: "Slovenia",
|
|
2629
|
+
dialCode: "+386",
|
|
2630
|
+
trunkPrefix: "0",
|
|
2631
|
+
nationalDigits: { min: 8, max: 8 },
|
|
2632
|
+
grouping: [{ startsWith: ["3", "4", "5", "6", "7"], digits: 8, groups: [2, 3, 3] }]
|
|
2633
|
+
},
|
|
2634
|
+
{
|
|
2635
|
+
code: "ES",
|
|
2636
|
+
name: "Spain",
|
|
2637
|
+
dialCode: "+34",
|
|
2638
|
+
// No trunk prefix; the nine digits are the whole number.
|
|
2639
|
+
nationalDigits: { min: 9, max: 9 },
|
|
2640
|
+
grouping: [{ digits: 9, groups: [3, 3, 3] }]
|
|
2641
|
+
},
|
|
2642
|
+
{
|
|
2643
|
+
code: "SE",
|
|
2644
|
+
name: "Sweden",
|
|
2645
|
+
dialCode: "+46",
|
|
2646
|
+
trunkPrefix: "0",
|
|
2647
|
+
nationalDigits: { min: 7, max: 9 },
|
|
2648
|
+
grouping: [{ startsWith: ["7"], digits: 9, groups: [2, 3, 4] }]
|
|
2649
|
+
},
|
|
2650
|
+
/*
|
|
2651
|
+
* Named and length-checked so a number from one of them is not read as nonsense, but
|
|
2652
|
+
* NOT formatted: the brief is the EU and the UK, and a grouping rule written for a
|
|
2653
|
+
* market nobody asked about is a rule nobody will check. The NANP is the exception — it
|
|
2654
|
+
* was already here, and it is one shape throughout.
|
|
2655
|
+
*/
|
|
2656
|
+
{
|
|
2657
|
+
code: "US",
|
|
2658
|
+
name: "United States",
|
|
2659
|
+
dialCode: "+1",
|
|
2660
|
+
nationalDigits: { min: 10, max: 10 },
|
|
2661
|
+
grouping: [{ digits: 10, groups: [3, 3, 4] }]
|
|
2662
|
+
},
|
|
2663
|
+
{ code: "CH", name: "Switzerland", dialCode: "+41", trunkPrefix: "0" },
|
|
2664
|
+
{ code: "NO", name: "Norway", dialCode: "+47" },
|
|
2665
|
+
{ code: "AU", name: "Australia", dialCode: "+61", trunkPrefix: "0" },
|
|
2666
|
+
{ code: "NZ", name: "New Zealand", dialCode: "+64", trunkPrefix: "0" },
|
|
2667
|
+
{ code: "ZA", name: "South Africa", dialCode: "+27", trunkPrefix: "0" },
|
|
2668
|
+
{ code: "AE", name: "United Arab Emirates", dialCode: "+971", trunkPrefix: "0" },
|
|
2669
|
+
{ code: "IN", name: "India", dialCode: "+91", trunkPrefix: "0" },
|
|
2670
|
+
{ code: "BR", name: "Brazil", dialCode: "+55", trunkPrefix: "0" }
|
|
2671
|
+
];
|
|
2672
|
+
var DEFAULT_COUNTRY_CODE = "IE";
|
|
2673
|
+
function countryByCode(code) {
|
|
2674
|
+
const found = COUNTRIES.find((country) => country.code === code);
|
|
2675
|
+
if (!found) throw new Error(`unknown country: ${code}`);
|
|
2676
|
+
return found;
|
|
2533
2677
|
}
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
return /* @__PURE__ */ jsx5("h3", { className: "scopetickets-island-calendar__heading", children: formatMonthName(month) });
|
|
2678
|
+
var DEFAULT_DIAL_CODE = countryByCode(DEFAULT_COUNTRY_CODE).dialCode;
|
|
2679
|
+
var digitsOf = (value) => value.replace(/\D/g, "");
|
|
2680
|
+
function countryByDialCode(dialCode) {
|
|
2681
|
+
const raw = digitsOf(dialCode);
|
|
2682
|
+
const digits = raw.startsWith("00") && raw.length > 2 ? raw.slice(2) : raw;
|
|
2683
|
+
if (digits.length === 0) return null;
|
|
2684
|
+
return COUNTRIES.find((country) => country.dialCode.slice(1) === digits) ?? null;
|
|
2542
2685
|
}
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
};
|
|
2552
|
-
function CalendarDayIndicator({ level }) {
|
|
2553
|
-
const filled = FILLED_SEGMENTS[level];
|
|
2554
|
-
return (
|
|
2555
|
-
// DECORATIVE, and now correctly so.
|
|
2556
|
-
/* @__PURE__ */ jsxs3("span", { className: "scopetickets-island-day-indicator", "aria-hidden": "true", children: [
|
|
2557
|
-
/* @__PURE__ */ jsx6(
|
|
2558
|
-
"span",
|
|
2559
|
-
{
|
|
2560
|
-
className: `scopetickets-island-day-indicator__fill scopetickets-island-day-indicator__fill--${level.toLowerCase()}`,
|
|
2561
|
-
style: { flexGrow: filled }
|
|
2562
|
-
}
|
|
2563
|
-
),
|
|
2564
|
-
filled < SEGMENTS ? /* @__PURE__ */ jsx6("span", { style: { flexGrow: SEGMENTS - filled } }) : null
|
|
2565
|
-
] })
|
|
2566
|
-
);
|
|
2686
|
+
function splitPhoneNumber(raw) {
|
|
2687
|
+
const trimmed = raw.trim();
|
|
2688
|
+
const digits = digitsOf(trimmed);
|
|
2689
|
+
const international = trimmed.startsWith("+") || digits.startsWith("00") && digits.length > 2;
|
|
2690
|
+
if (!international || digits.length === 0) return { dialCode: null, national: trimmed };
|
|
2691
|
+
const body = trimmed.startsWith("+") ? digits : digits.slice(2);
|
|
2692
|
+
const match = [...COUNTRIES].sort((a, b) => b.dialCode.length - a.dialCode.length).find((country) => body.startsWith(country.dialCode.slice(1)));
|
|
2693
|
+
if (!match) return { dialCode: null, national: trimmed };
|
|
2694
|
+
return { dialCode: match.dialCode, national: body.slice(match.dialCode.length - 1) };
|
|
2567
2695
|
}
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
outsideMonth = false,
|
|
2577
|
-
onSelect
|
|
2578
|
-
}) {
|
|
2579
|
-
const press = useIslandPress("element");
|
|
2580
|
-
const dimmed = outsideMonth ? { "data-outside-month": "" } : null;
|
|
2581
|
-
if (cell.kind === "EMPTY") {
|
|
2582
|
-
return /* @__PURE__ */ jsx7("span", { className: "scopetickets-island-day", "aria-hidden": "true" });
|
|
2696
|
+
var MAX_DIAL_DIGITS = Math.max(...COUNTRIES.map((country) => country.dialCode.length - 1));
|
|
2697
|
+
var NOT_PHONE = /[^\d+]/g;
|
|
2698
|
+
function routePhoneInput(typed, field, current) {
|
|
2699
|
+
const raw = typed.replace(NOT_PHONE, "");
|
|
2700
|
+
const parts = splitPhoneNumber(raw);
|
|
2701
|
+
if (field === "national") {
|
|
2702
|
+
if (parts.dialCode === null) return { ...current, national: raw };
|
|
2703
|
+
return { dialCode: parts.dialCode, national: parts.national };
|
|
2583
2704
|
}
|
|
2584
|
-
if (
|
|
2585
|
-
return
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
}
|
|
2596
|
-
);
|
|
2705
|
+
if (parts.dialCode !== null) {
|
|
2706
|
+
return {
|
|
2707
|
+
dialCode: parts.dialCode,
|
|
2708
|
+
/*
|
|
2709
|
+
* A remainder long enough to BE a number takes the row below; one too short to be
|
|
2710
|
+
* anything replaces nothing. `+3531` is a slipped keystroke after a complete code, and
|
|
2711
|
+
* letting its `1` overwrite an entered number is the same bug in the other direction —
|
|
2712
|
+
* so it is dropped, unless the row below is empty and there is nothing to lose.
|
|
2713
|
+
*/
|
|
2714
|
+
national: digitsOf(parts.national).length >= GENERIC_NATIONAL_DIGITS.min || current.national.length === 0 ? parts.national : current.national
|
|
2715
|
+
};
|
|
2597
2716
|
}
|
|
2598
|
-
if (
|
|
2599
|
-
return
|
|
2600
|
-
CalendarDayButton,
|
|
2601
|
-
{
|
|
2602
|
-
cell,
|
|
2603
|
-
accessory,
|
|
2604
|
-
remaining: null,
|
|
2605
|
-
label,
|
|
2606
|
-
outsideMonth,
|
|
2607
|
-
press
|
|
2608
|
-
}
|
|
2609
|
-
);
|
|
2717
|
+
if (digitsOf(raw).length > MAX_DIAL_DIGITS) {
|
|
2718
|
+
return { dialCode: current.dialCode, national: raw };
|
|
2610
2719
|
}
|
|
2611
|
-
|
|
2720
|
+
if (raw.trim().length === 0) return { ...current, dialCode: DEFAULT_DIAL_CODE };
|
|
2721
|
+
return { ...current, dialCode: raw };
|
|
2612
2722
|
}
|
|
2613
|
-
function
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
const
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
className: "scopetickets-island-day",
|
|
2629
|
-
...outsideMonth ? { "data-outside-month": "" } : null,
|
|
2630
|
-
"aria-pressed": onSelect ? selected : void 0,
|
|
2631
|
-
"aria-disabled": onSelect ? void 0 : true,
|
|
2632
|
-
"aria-label": availability === null ? label : `${label}, ${availability.announcement}`,
|
|
2633
|
-
onClick: onSelect ? () => onSelect(cell.day) : void 0,
|
|
2634
|
-
...press,
|
|
2635
|
-
children: /* @__PURE__ */ jsxs4("span", { className: "scopetickets-island-day__well", "data-state": cell.kind, children: [
|
|
2636
|
-
/* @__PURE__ */ jsx7("span", { className: "scopetickets-island-day__number", children: cell.dayOfMonth }),
|
|
2637
|
-
cell.kind === "UNAVAILABLE" ? /* @__PURE__ */ jsx7("span", { className: "scopetickets-island-day__strike", "aria-hidden": "true" }) : null,
|
|
2638
|
-
accessory === "LINE" && availability !== null ? /* @__PURE__ */ jsx7("span", { className: "scopetickets-island-day__accessory", children: /* @__PURE__ */ jsx7(CalendarDayIndicator, { level: availability.level }) }) : null
|
|
2639
|
-
] })
|
|
2640
|
-
}
|
|
2723
|
+
function nationalDigits(phone, country) {
|
|
2724
|
+
let digits = digitsOf(phone);
|
|
2725
|
+
const dial = country.dialCode.slice(1);
|
|
2726
|
+
if (digits.startsWith(dial) && digits.length > dial.length) digits = digits.slice(dial.length);
|
|
2727
|
+
const trunk = country.trunkPrefix;
|
|
2728
|
+
if (trunk !== void 0 && digits.startsWith(trunk)) digits = digits.slice(trunk.length);
|
|
2729
|
+
return digits;
|
|
2730
|
+
}
|
|
2731
|
+
function formatNational(value, country) {
|
|
2732
|
+
const digits = digitsOf(value);
|
|
2733
|
+
if (digits.length === 0) return value.trim() === "+" ? "+" : "";
|
|
2734
|
+
const trunk = country.trunkPrefix !== void 0 && digits.startsWith(country.trunkPrefix) ? country.trunkPrefix : "";
|
|
2735
|
+
const nsn = digits.slice(trunk.length);
|
|
2736
|
+
const pattern = country.grouping?.find(
|
|
2737
|
+
(candidate) => nsn.length <= candidate.digits && (candidate.startsWith === void 0 || candidate.startsWith.some((start) => nsn.startsWith(start)))
|
|
2641
2738
|
);
|
|
2739
|
+
if (pattern === void 0) return value;
|
|
2740
|
+
const parts = [];
|
|
2741
|
+
let at = 0;
|
|
2742
|
+
for (const size of pattern.groups) {
|
|
2743
|
+
if (at >= nsn.length) break;
|
|
2744
|
+
parts.push(nsn.slice(at, at + size));
|
|
2745
|
+
at += size;
|
|
2746
|
+
}
|
|
2747
|
+
if (trunk === "") return parts.join(" ");
|
|
2748
|
+
return trunk === "0" ? [trunk + (parts[0] ?? ""), ...parts.slice(1)].join(" ") : [trunk, ...parts].join(" ");
|
|
2749
|
+
}
|
|
2750
|
+
function digitsAllowed(country) {
|
|
2751
|
+
return country.nationalDigits ?? GENERIC_NATIONAL_DIGITS;
|
|
2752
|
+
}
|
|
2753
|
+
function isValidPhone(phone, country) {
|
|
2754
|
+
const national = nationalDigits(phone, country);
|
|
2755
|
+
const { min, max } = digitsAllowed(country);
|
|
2756
|
+
return national.length >= min && national.length <= max;
|
|
2757
|
+
}
|
|
2758
|
+
function phoneFlag(phone, country) {
|
|
2759
|
+
if (phone.trim().length === 0) return "none";
|
|
2760
|
+
return isValidPhone(phone, country) ? "success" : "error";
|
|
2761
|
+
}
|
|
2762
|
+
function e164(dialCode, phone) {
|
|
2763
|
+
const country = countryByDialCode(dialCode);
|
|
2764
|
+
if (country === null) return null;
|
|
2765
|
+
const national = nationalDigits(phone, country);
|
|
2766
|
+
if (!isValidPhone(phone, country)) return null;
|
|
2767
|
+
const composed = `${country.dialCode}${national}`;
|
|
2768
|
+
return isE164(composed) ? composed : null;
|
|
2769
|
+
}
|
|
2770
|
+
function normalizeE164(value) {
|
|
2771
|
+
const { dialCode, national } = splitPhoneNumber(value);
|
|
2772
|
+
if (dialCode === null) return null;
|
|
2773
|
+
return e164(dialCode, national);
|
|
2774
|
+
}
|
|
2775
|
+
function isCompleteName(firstName, lastName) {
|
|
2776
|
+
return firstName.trim().length > 0 && lastName.trim().length > 0;
|
|
2777
|
+
}
|
|
2778
|
+
function splitFullName(full) {
|
|
2779
|
+
const parts = full.trim().split(/\s+/).filter(Boolean);
|
|
2780
|
+
if (parts.length < 2) return null;
|
|
2781
|
+
const [firstName, ...rest] = parts;
|
|
2782
|
+
return { firstName, lastName: rest.join(" ") };
|
|
2642
2783
|
}
|
|
2643
2784
|
|
|
2644
|
-
// src/island/
|
|
2645
|
-
import { jsx as
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
onSelectDay
|
|
2655
|
-
}) {
|
|
2656
|
-
return /* @__PURE__ */ jsx8("div", { className: "scopetickets-island-calendar__grid", children: weeks.map((weekStart) => (
|
|
2657
|
-
// A presentational row: the seven columns are a layout, and announcing "row 3
|
|
2658
|
-
// of 9" describes the grid rather than the run.
|
|
2659
|
-
/* @__PURE__ */ jsx8("div", { className: "scopetickets-island-calendar__week", children: buildWeekRow(series, weekStart, { today, selectedDay }).map((cell, dayIndex) => /* @__PURE__ */ jsx8(
|
|
2660
|
-
CalendarDay,
|
|
2661
|
-
{
|
|
2662
|
-
cell,
|
|
2663
|
-
accessory,
|
|
2664
|
-
remaining: cell.kind === "EMPTY" ? null : remaining?.[cell.day] ?? null,
|
|
2665
|
-
label: cell.kind === "EMPTY" ? "" : formatDayDate(cell.day),
|
|
2666
|
-
outsideMonth: cell.kind !== "EMPTY" && monthOfDay(cell.day) !== currentMonth,
|
|
2667
|
-
onSelect: onSelectDay
|
|
2668
|
-
},
|
|
2669
|
-
cell.kind === "EMPTY" ? `empty-${dayIndex}` : cell.day
|
|
2670
|
-
)) }, weekStart)
|
|
2671
|
-
)) });
|
|
2785
|
+
// src/island/ContentFlag.tsx
|
|
2786
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
2787
|
+
var GLYPH = {
|
|
2788
|
+
success: CheckInCircleFilledIcon,
|
|
2789
|
+
warning: ExclamationMarkInCircleFilledIcon,
|
|
2790
|
+
error: XMarkInCircleFilledIcon
|
|
2791
|
+
};
|
|
2792
|
+
function ContentFlag({ tone, title }) {
|
|
2793
|
+
const Glyph = GLYPH[tone];
|
|
2794
|
+
return /* @__PURE__ */ jsx9("span", { className: `scopetickets-island-content-flag scopetickets-island-content-flag--${tone}`, children: /* @__PURE__ */ jsx9(Glyph, { fill: true, color: "currentColor", title }) });
|
|
2672
2795
|
}
|
|
2673
2796
|
|
|
2674
|
-
// src/island/
|
|
2675
|
-
import {
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
var
|
|
2683
|
-
var
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
const
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
rowRef.current = row;
|
|
2699
|
-
const [rowStep, setRowStep] = useState3(0);
|
|
2700
|
-
const gapPx = (box) => {
|
|
2701
|
-
const gap = Number.parseFloat(
|
|
2702
|
-
getComputedStyle(box).getPropertyValue("--scopetickets-island-day-column-gap")
|
|
2703
|
-
);
|
|
2704
|
-
return Number.isFinite(gap) ? gap : 0;
|
|
2705
|
-
};
|
|
2706
|
-
useEffect3(() => {
|
|
2707
|
-
const track = trackRef.current;
|
|
2708
|
-
if (!track) return void 0;
|
|
2709
|
-
const measure = () => {
|
|
2710
|
-
const row2 = track.querySelector(".scopetickets-island-calendar__week");
|
|
2711
|
-
if (!row2) return;
|
|
2712
|
-
const height = row2.getBoundingClientRect().height;
|
|
2713
|
-
if (height <= 0) return;
|
|
2714
|
-
const step = height + gapPx(track);
|
|
2715
|
-
setRowStep((was) => Math.abs(was - step) < 0.5 ? was : step);
|
|
2716
|
-
};
|
|
2717
|
-
measure();
|
|
2718
|
-
if (typeof ResizeObserver === "undefined") return void 0;
|
|
2719
|
-
const observer = new ResizeObserver(measure);
|
|
2720
|
-
observer.observe(track);
|
|
2721
|
-
return () => observer.disconnect();
|
|
2722
|
-
}, [rowCount]);
|
|
2723
|
-
const rowHeight = useCallback(() => {
|
|
2724
|
-
if (rowStep > 0) return rowStep;
|
|
2725
|
-
const box = viewportRef.current;
|
|
2726
|
-
if (!box) return 0;
|
|
2727
|
-
return (box.clientHeight + gapPx(box)) / CALENDAR_VIEWPORT_ROWS;
|
|
2728
|
-
}, [rowStep]);
|
|
2729
|
-
const drag = useCallback(
|
|
2730
|
-
(dy) => ({
|
|
2731
|
-
row: rowRef.current,
|
|
2732
|
-
rowCount,
|
|
2733
|
-
viewportRows: CALENDAR_VIEWPORT_ROWS,
|
|
2734
|
-
offset: dy,
|
|
2735
|
-
rowHeight: rowHeight()
|
|
2736
|
-
}),
|
|
2737
|
-
[rowCount, rowHeight]
|
|
2738
|
-
);
|
|
2739
|
-
const draw = useCallback(
|
|
2740
|
-
(dy) => {
|
|
2741
|
-
const moving = drag(dy);
|
|
2742
|
-
setOffset(rowDragOffset(moving));
|
|
2743
|
-
onRowPreview?.(rowAfterDrag(moving));
|
|
2744
|
-
},
|
|
2745
|
-
[drag, onRowPreview]
|
|
2746
|
-
);
|
|
2747
|
-
const settle = useCallback(
|
|
2748
|
-
(dy) => {
|
|
2749
|
-
setOffset(0);
|
|
2750
|
-
const landed = rowAfterDrag(drag(dy));
|
|
2751
|
-
if (landed !== rowRef.current) onRowChange(landed);
|
|
2752
|
-
},
|
|
2753
|
-
[drag, onRowChange]
|
|
2754
|
-
);
|
|
2755
|
-
const dragged = useRef3(false);
|
|
2756
|
-
const onPointerDown = (event) => {
|
|
2757
|
-
if ((event.buttons & 1) !== 1) return;
|
|
2758
|
-
startY.current = event.clientY;
|
|
2759
|
-
dragged.current = false;
|
|
2760
|
-
};
|
|
2761
|
-
const onPointerMove = (event) => {
|
|
2762
|
-
if (startY.current === null) return;
|
|
2763
|
-
const dy = event.clientY - startY.current;
|
|
2764
|
-
if (!dragged.current) {
|
|
2765
|
-
if (Math.abs(dy) < CALENDAR_DRAG_SLOP) return;
|
|
2766
|
-
dragged.current = true;
|
|
2767
|
-
setDragging(true);
|
|
2768
|
-
event.currentTarget.setPointerCapture(event.pointerId);
|
|
2769
|
-
}
|
|
2770
|
-
draw(dy);
|
|
2771
|
-
};
|
|
2772
|
-
const onPointerUp = (event) => {
|
|
2773
|
-
if (startY.current === null) return;
|
|
2774
|
-
const dy = event.clientY - startY.current;
|
|
2775
|
-
startY.current = null;
|
|
2776
|
-
if (!dragged.current) return;
|
|
2777
|
-
setDragging(false);
|
|
2778
|
-
settle(dy);
|
|
2779
|
-
};
|
|
2780
|
-
const onClickCapture = (event) => {
|
|
2781
|
-
if (!dragged.current) return;
|
|
2782
|
-
dragged.current = false;
|
|
2783
|
-
event.stopPropagation();
|
|
2784
|
-
event.preventDefault();
|
|
2785
|
-
};
|
|
2786
|
-
const onPointerCancel = () => {
|
|
2787
|
-
startY.current = null;
|
|
2788
|
-
dragged.current = false;
|
|
2789
|
-
setDragging(false);
|
|
2790
|
-
setOffset(0);
|
|
2797
|
+
// src/island/CounterRing.tsx
|
|
2798
|
+
import { IconGlyph } from "@scopetickets/icons";
|
|
2799
|
+
|
|
2800
|
+
// ../checkout-core/src/geometry/island-timer.ts
|
|
2801
|
+
var TIMER_GRID = 20;
|
|
2802
|
+
var TIMER_CENTRE = TIMER_GRID / 2;
|
|
2803
|
+
var RING_OUTER = 10;
|
|
2804
|
+
var RING_INNER = 8;
|
|
2805
|
+
var RING_RADIUS = (RING_OUTER + RING_INNER) / 2;
|
|
2806
|
+
var RING_WIDTH = RING_OUTER - RING_INNER;
|
|
2807
|
+
var TURN_DEGREES = 360;
|
|
2808
|
+
var SOURCE_GRID = 100;
|
|
2809
|
+
var SOURCE_OFFSET_X = 0.2;
|
|
2810
|
+
var SOURCE_SCALE = TIMER_GRID / SOURCE_GRID;
|
|
2811
|
+
var HAND_SOURCE = "M55.2,49.9l-.7-26c0-1-.4-2.1-1.2-2.9-1.7-1.7-4.4-1.7-6,0s-1.2,1.8-1.2,2.9l-.7,26c0,1.3.4,2.7,1.5,3.7,2,2,5.1,2,7.1,0s1.5-2.4,1.5-3.7Z";
|
|
2812
|
+
function n(value) {
|
|
2813
|
+
const rounded = Number(value.toFixed(3));
|
|
2814
|
+
return String(Object.is(rounded, -0) ? 0 : rounded);
|
|
2815
|
+
}
|
|
2816
|
+
function pointAt(radius, degrees) {
|
|
2817
|
+
const radians = degrees * Math.PI / 180;
|
|
2818
|
+
return {
|
|
2819
|
+
x: TIMER_CENTRE + radius * Math.sin(radians),
|
|
2820
|
+
y: TIMER_CENTRE - radius * Math.cos(radians)
|
|
2791
2821
|
};
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2822
|
+
}
|
|
2823
|
+
function circlePath(centre, radius) {
|
|
2824
|
+
const r = `${n(radius)},${n(radius)}`;
|
|
2825
|
+
return `M${n(centre.x - radius)},${n(centre.y)}A${r} 0 1 0 ${n(centre.x + radius)},${n(centre.y)}A${r} 0 1 0 ${n(centre.x - radius)},${n(centre.y)}Z`;
|
|
2826
|
+
}
|
|
2827
|
+
function clampRemaining(remaining) {
|
|
2828
|
+
if (!Number.isFinite(remaining)) return 0;
|
|
2829
|
+
return Math.min(1, Math.max(0, remaining));
|
|
2830
|
+
}
|
|
2831
|
+
function handRotation(remaining) {
|
|
2832
|
+
return (clampRemaining(remaining) - 1) * TURN_DEGREES;
|
|
2833
|
+
}
|
|
2834
|
+
function transformPath(source, degrees) {
|
|
2835
|
+
const radians = degrees * Math.PI / 180;
|
|
2836
|
+
const cos = Math.cos(radians);
|
|
2837
|
+
const sin = Math.sin(radians);
|
|
2838
|
+
const linear = (x, y) => {
|
|
2839
|
+
const sx = x * SOURCE_SCALE;
|
|
2840
|
+
const sy = y * SOURCE_SCALE;
|
|
2841
|
+
return { x: sx * cos - sy * sin, y: sx * sin + sy * cos };
|
|
2842
|
+
};
|
|
2843
|
+
const absolute = (x, y) => {
|
|
2844
|
+
const to = linear(x - SOURCE_OFFSET_X - SOURCE_GRID / 2, y - SOURCE_GRID / 2);
|
|
2845
|
+
return { x: TIMER_CENTRE + to.x, y: TIMER_CENTRE + to.y };
|
|
2846
|
+
};
|
|
2847
|
+
const pair = (p) => `${n(p.x)},${n(p.y)}`;
|
|
2848
|
+
const segments = source.match(/[a-zA-Z][^a-zA-Z]*/g) ?? [];
|
|
2849
|
+
return segments.map((segment) => {
|
|
2850
|
+
const command = segment[0];
|
|
2851
|
+
const numbers = (segment.slice(1).match(/-?(?:\d*\.\d+|\d+)/g) ?? []).map(Number);
|
|
2852
|
+
const deltas = (stride) => {
|
|
2853
|
+
if (numbers.length === 0 || numbers.length % stride !== 0) {
|
|
2854
|
+
throw new Error(`path: \`${command}\` wants multiples of ${stride}`);
|
|
2855
|
+
}
|
|
2856
|
+
const out = [];
|
|
2857
|
+
for (let i = 0; i < numbers.length; i += 2) {
|
|
2858
|
+
out.push(pair(linear(numbers[i], numbers[i + 1])));
|
|
2859
|
+
}
|
|
2860
|
+
return command + out.join(" ");
|
|
2809
2861
|
};
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
style: {
|
|
2827
|
-
"--scopetickets-island-viewport-rows": CALENDAR_VIEWPORT_ROWS,
|
|
2828
|
-
...rowStep > 0 ? { "--scopetickets-island-calendar-row-step": `${rowStep}px` } : null
|
|
2829
|
-
},
|
|
2830
|
-
onPointerDown,
|
|
2831
|
-
onPointerMove,
|
|
2832
|
-
onPointerUp,
|
|
2833
|
-
onPointerCancel,
|
|
2834
|
-
onClickCapture,
|
|
2835
|
-
children: [
|
|
2836
|
-
/* @__PURE__ */ jsx9("div", { className: "scopetickets-island-calendar-scroller__window", "aria-hidden": "true" }),
|
|
2837
|
-
/* @__PURE__ */ jsx9(
|
|
2838
|
-
"div",
|
|
2839
|
-
{
|
|
2840
|
-
ref: trackRef,
|
|
2841
|
-
className: "scopetickets-island-calendar-scroller__track",
|
|
2842
|
-
"data-dragging": dragging || offset !== 0 ? "" : void 0,
|
|
2843
|
-
style: {
|
|
2844
|
-
translate: `0 calc(${-row} * var(--scopetickets-island-calendar-row-step) + ${offset}px)`
|
|
2845
|
-
},
|
|
2846
|
-
children
|
|
2847
|
-
}
|
|
2848
|
-
)
|
|
2849
|
-
]
|
|
2862
|
+
switch (command) {
|
|
2863
|
+
case "M": {
|
|
2864
|
+
if (numbers.length !== 2) throw new Error("path: `M` wants exactly one point");
|
|
2865
|
+
return `M${pair(absolute(numbers[0], numbers[1]))}`;
|
|
2866
|
+
}
|
|
2867
|
+
case "l":
|
|
2868
|
+
return deltas(2);
|
|
2869
|
+
case "c":
|
|
2870
|
+
return deltas(6);
|
|
2871
|
+
case "s":
|
|
2872
|
+
return deltas(4);
|
|
2873
|
+
case "Z":
|
|
2874
|
+
case "z":
|
|
2875
|
+
return "Z";
|
|
2876
|
+
default:
|
|
2877
|
+
throw new Error(`path: unsupported command \`${command}\``);
|
|
2850
2878
|
}
|
|
2851
|
-
);
|
|
2879
|
+
}).join("");
|
|
2880
|
+
}
|
|
2881
|
+
function annulus(outer = RING_OUTER, inner = RING_INNER) {
|
|
2882
|
+
const centre = pointAt(0, 0);
|
|
2883
|
+
return circlePath(centre, outer) + circlePath(centre, inner);
|
|
2884
|
+
}
|
|
2885
|
+
function ringSector(fraction, outer, inner, direction = "cw") {
|
|
2886
|
+
const filled = clampRemaining(fraction);
|
|
2887
|
+
if (filled <= 0 || filled >= 1) return null;
|
|
2888
|
+
const mirrored = direction === "ccw";
|
|
2889
|
+
const sweep = filled * TURN_DEGREES * (mirrored ? -1 : 1);
|
|
2890
|
+
const capRadius = (outer - inner) / 2;
|
|
2891
|
+
const outerStart = pointAt(outer, 0);
|
|
2892
|
+
const outerEnd = pointAt(outer, sweep);
|
|
2893
|
+
const innerEnd = pointAt(inner, sweep);
|
|
2894
|
+
const innerStart = pointAt(inner, 0);
|
|
2895
|
+
const out = mirrored ? 0 : 1;
|
|
2896
|
+
const back = mirrored ? 1 : 0;
|
|
2897
|
+
const large = Math.abs(sweep) > 180 ? 1 : 0;
|
|
2898
|
+
const cap = `${n(capRadius)},${n(capRadius)}`;
|
|
2899
|
+
const at = (p) => `${n(p.x)},${n(p.y)}`;
|
|
2900
|
+
return {
|
|
2901
|
+
d: `M${at(outerStart)}A${n(outer)},${n(outer)} 0 ${large} ${out} ${at(outerEnd)}A${cap} 0 0 ${out} ${at(innerEnd)}A${n(inner)},${n(inner)} 0 ${large} ${back} ${at(innerStart)}A${cap} 0 0 ${out} ${at(outerStart)}Z`
|
|
2902
|
+
};
|
|
2903
|
+
}
|
|
2904
|
+
function ringAnnulus(outer, inner) {
|
|
2905
|
+
return { d: annulus(outer, inner), evenodd: true };
|
|
2906
|
+
}
|
|
2907
|
+
function trackPaths() {
|
|
2908
|
+
return [{ d: annulus(), evenodd: true }];
|
|
2909
|
+
}
|
|
2910
|
+
function timerPaths(remaining) {
|
|
2911
|
+
const left = clampRemaining(remaining);
|
|
2912
|
+
const paths = [];
|
|
2913
|
+
if (left >= 1) paths.push(ringAnnulus(RING_OUTER, RING_INNER));
|
|
2914
|
+
else {
|
|
2915
|
+
const sector = ringSector(left, RING_OUTER, RING_INNER);
|
|
2916
|
+
if (sector) paths.push(sector);
|
|
2917
|
+
}
|
|
2918
|
+
paths.push({ d: transformPath(HAND_SOURCE, handRotation(left)) });
|
|
2919
|
+
return paths;
|
|
2852
2920
|
}
|
|
2853
2921
|
|
|
2854
|
-
// src/island
|
|
2855
|
-
|
|
2856
|
-
var
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2922
|
+
// ../checkout-core/src/geometry/island-counter-ring.ts
|
|
2923
|
+
var RING_OUTER2 = 10;
|
|
2924
|
+
var RING_STROKE = 2.5;
|
|
2925
|
+
var RING_INNER2 = RING_OUTER2 - RING_STROKE;
|
|
2926
|
+
function counterTrackPaths() {
|
|
2927
|
+
return [ringAnnulus(RING_OUTER2, RING_INNER2)];
|
|
2928
|
+
}
|
|
2929
|
+
function counterRingPaths(progress, direction = "cw") {
|
|
2930
|
+
if (progress >= 1) return [ringAnnulus(RING_OUTER2, RING_INNER2)];
|
|
2931
|
+
const sector = ringSector(progress, RING_OUTER2, RING_INNER2, direction);
|
|
2932
|
+
return sector ? [sector] : [];
|
|
2862
2933
|
}
|
|
2863
2934
|
|
|
2864
|
-
// src/island/
|
|
2865
|
-
import { jsx as
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2935
|
+
// src/island/CounterRing.tsx
|
|
2936
|
+
import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2937
|
+
var LAYER = { position: "absolute", inset: 0 };
|
|
2938
|
+
var DEFAULT_FILL = "var(--scopetickets-island-counter-ring-fill)";
|
|
2939
|
+
var DEFAULT_TRACK = "var(--scopetickets-island-counter-ring-track)";
|
|
2940
|
+
function CounterRing({
|
|
2941
|
+
progress,
|
|
2942
|
+
complete,
|
|
2943
|
+
size = "1em",
|
|
2944
|
+
title,
|
|
2945
|
+
color = DEFAULT_FILL,
|
|
2946
|
+
trackColor = DEFAULT_TRACK,
|
|
2947
|
+
direction = "cw",
|
|
2948
|
+
track = true
|
|
2874
2949
|
}) {
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
() => monthOpeningRow(weeks, starts, selectedDay ?? soonestRelevantDay(series, today))
|
|
2879
|
-
);
|
|
2880
|
-
const [shownRow, setShownRow] = useState4(row);
|
|
2881
|
-
const currentMonth = monthAtRow(starts, shownRow);
|
|
2882
|
-
useEffect4(() => {
|
|
2883
|
-
if (currentMonth !== null) onVisibleMonthChange?.(currentMonth);
|
|
2884
|
-
}, [currentMonth, onVisibleMonthChange]);
|
|
2885
|
-
const selectDay = useCallback2(
|
|
2886
|
-
(day) => {
|
|
2887
|
-
const month = monthOfDay(day);
|
|
2888
|
-
const start = starts.find((candidate) => candidate.month === month);
|
|
2889
|
-
if (start !== void 0 && month !== currentMonth) {
|
|
2890
|
-
setRow(start.row);
|
|
2891
|
-
setShownRow(start.row);
|
|
2892
|
-
}
|
|
2893
|
-
onSelectDay(day);
|
|
2894
|
-
},
|
|
2895
|
-
[starts, currentMonth, onSelectDay]
|
|
2896
|
-
);
|
|
2897
|
-
if (weeks.length === 0) return null;
|
|
2898
|
-
return /* @__PURE__ */ jsxs6("div", { className: "scopetickets-island-calendar", "data-accessory": accessory, children: [
|
|
2899
|
-
currentMonth !== null && /* @__PURE__ */ jsx11(CalendarMonthHeading, { month: currentMonth }),
|
|
2900
|
-
/* @__PURE__ */ jsx11(CalendarWeekdayNames, {}),
|
|
2901
|
-
/* @__PURE__ */ jsx11(
|
|
2902
|
-
CalendarScroller,
|
|
2950
|
+
if (complete !== void 0) {
|
|
2951
|
+
return /* @__PURE__ */ jsx10(
|
|
2952
|
+
"span",
|
|
2903
2953
|
{
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2954
|
+
className: "scopetickets-island-counter-ring",
|
|
2955
|
+
style: { width: size, height: size, flex: "none" },
|
|
2956
|
+
children: /* @__PURE__ */ jsx10(ContentFlag, { tone: complete, title })
|
|
2957
|
+
}
|
|
2958
|
+
);
|
|
2959
|
+
}
|
|
2960
|
+
return /* @__PURE__ */ jsxs6(
|
|
2961
|
+
"span",
|
|
2962
|
+
{
|
|
2963
|
+
className: "scopetickets-island-counter-ring",
|
|
2964
|
+
style: { position: "relative", display: "block", width: size, height: size, flex: "none" },
|
|
2965
|
+
children: [
|
|
2966
|
+
track ? /* @__PURE__ */ jsx10("span", { style: LAYER, children: /* @__PURE__ */ jsx10(
|
|
2967
|
+
IconGlyph,
|
|
2911
2968
|
{
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
remaining,
|
|
2917
|
-
today,
|
|
2918
|
-
selectedDay,
|
|
2919
|
-
onSelectDay: selectDay
|
|
2969
|
+
glyph: "StepCompletionProgressRingTrack",
|
|
2970
|
+
paths: counterTrackPaths(),
|
|
2971
|
+
color: trackColor,
|
|
2972
|
+
fill: true
|
|
2920
2973
|
}
|
|
2921
|
-
)
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2974
|
+
) }) : null,
|
|
2975
|
+
/* @__PURE__ */ jsx10("span", { style: LAYER, children: /* @__PURE__ */ jsx10(
|
|
2976
|
+
IconGlyph,
|
|
2977
|
+
{
|
|
2978
|
+
glyph: "StepCompletionProgressRing",
|
|
2979
|
+
paths: counterRingPaths(progress, direction),
|
|
2980
|
+
color,
|
|
2981
|
+
title,
|
|
2982
|
+
fill: true
|
|
2983
|
+
}
|
|
2984
|
+
) })
|
|
2985
|
+
]
|
|
2986
|
+
}
|
|
2987
|
+
);
|
|
2925
2988
|
}
|
|
2926
2989
|
|
|
2927
2990
|
// src/island/TimeslotPicker.tsx
|
|
2928
2991
|
import { useMemo as useMemo3 } from "react";
|
|
2929
2992
|
|
|
2930
2993
|
// src/island/Timeslot.tsx
|
|
2931
|
-
import { Fragment, jsx as
|
|
2994
|
+
import { Fragment, jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2932
2995
|
var REMAINING_SIZE = "var(--scopetickets-island-space-4)";
|
|
2933
2996
|
var SELECTED_ARC = "var(--scopetickets-island-timeslot-ring-selected)";
|
|
2934
2997
|
var TRACK = "var(--scopetickets-island-timeslot-track)";
|
|
@@ -2936,20 +2999,20 @@ var SELECTED_TRACK = "var(--scopetickets-island-timeslot-track-selected)";
|
|
|
2936
2999
|
var { soldOut: SOLD_OUT, from: FROM } = TIMESLOT_COPY;
|
|
2937
3000
|
function Timeslot({ cell, accessory, onSelect }) {
|
|
2938
3001
|
if (isDatePickerCellSelectable(cell.state)) {
|
|
2939
|
-
return /* @__PURE__ */
|
|
3002
|
+
return /* @__PURE__ */ jsx11(TimeslotButton, { cell, accessory, onSelect });
|
|
2940
3003
|
}
|
|
2941
|
-
return /* @__PURE__ */
|
|
3004
|
+
return /* @__PURE__ */ jsx11(TimeslotFixed, { cell });
|
|
2942
3005
|
}
|
|
2943
3006
|
function TimeslotRow({ cell }) {
|
|
2944
3007
|
const price = slotPrice(cell);
|
|
2945
3008
|
return /* @__PURE__ */ jsxs7("span", { className: "scopetickets-island-timeslot__times", children: [
|
|
2946
|
-
/* @__PURE__ */
|
|
3009
|
+
/* @__PURE__ */ jsx11("span", { className: "scopetickets-island-timeslot__time", children: cell.slot.startTime }),
|
|
2947
3010
|
cell.slot.endTime === null ? null : /* @__PURE__ */ jsxs7(Fragment, { children: [
|
|
2948
|
-
/* @__PURE__ */
|
|
2949
|
-
/* @__PURE__ */
|
|
3011
|
+
/* @__PURE__ */ jsx11("span", { className: "scopetickets-island-timeslot__dash", "aria-hidden": "true", children: "-" }),
|
|
3012
|
+
/* @__PURE__ */ jsx11("span", { className: "scopetickets-island-timeslot__time", children: cell.slot.endTime })
|
|
2950
3013
|
] }),
|
|
2951
3014
|
/* @__PURE__ */ jsxs7("span", { className: "scopetickets-island-timeslot__trailing", children: [
|
|
2952
|
-
price === null ? null : /* @__PURE__ */
|
|
3015
|
+
price === null ? null : /* @__PURE__ */ jsx11("span", { className: "scopetickets-island-timeslot__price", children: price }),
|
|
2953
3016
|
cell.state === "UNAVAILABLE" ? (
|
|
2954
3017
|
/*
|
|
2955
3018
|
* THE WORDS INSTEAD OF THE MARK, AND ONLY WHERE THE MARK WOULD SAY NOTHING.
|
|
@@ -2959,8 +3022,8 @@ function TimeslotRow({ cell }) {
|
|
|
2959
3022
|
* merely BEGUN keeps its ring — it still has seats, and "Sold Out" over them
|
|
2960
3023
|
* would be false.
|
|
2961
3024
|
*/
|
|
2962
|
-
/* @__PURE__ */
|
|
2963
|
-
) : cell.slot.remaining === null ? null : /* @__PURE__ */
|
|
3025
|
+
/* @__PURE__ */ jsx11("span", { className: "scopetickets-island-timeslot__soldout", children: SOLD_OUT })
|
|
3026
|
+
) : cell.slot.remaining === null ? null : /* @__PURE__ */ jsx11("span", { className: "scopetickets-island-timeslot__remaining", children: /* @__PURE__ */ jsx11(
|
|
2964
3027
|
CounterRing,
|
|
2965
3028
|
{
|
|
2966
3029
|
progress: cell.slot.remaining,
|
|
@@ -2987,7 +3050,7 @@ function TimeslotButton({ cell, accessory, onSelect }) {
|
|
|
2987
3050
|
const press = useIslandPress("element");
|
|
2988
3051
|
const selected = cell.state === "SELECTED";
|
|
2989
3052
|
const availability = readAvailability(cell.slot.remaining);
|
|
2990
|
-
return /* @__PURE__ */
|
|
3053
|
+
return /* @__PURE__ */ jsx11(
|
|
2991
3054
|
"button",
|
|
2992
3055
|
{
|
|
2993
3056
|
type: "button",
|
|
@@ -2997,22 +3060,22 @@ function TimeslotButton({ cell, accessory, onSelect }) {
|
|
|
2997
3060
|
onClick: () => onSelect(cell.slot.startTime),
|
|
2998
3061
|
...press,
|
|
2999
3062
|
children: /* @__PURE__ */ jsxs7("span", { className: "scopetickets-island-timeslot__pill", "data-state": cell.state, children: [
|
|
3000
|
-
/* @__PURE__ */
|
|
3001
|
-
accessory === "LINE" && availability !== null ? /* @__PURE__ */
|
|
3063
|
+
/* @__PURE__ */ jsx11(TimeslotRow, { cell }),
|
|
3064
|
+
accessory === "LINE" && availability !== null ? /* @__PURE__ */ jsx11("span", { className: "scopetickets-island-timeslot__accessory", children: /* @__PURE__ */ jsx11(CalendarDayIndicator, { level: availability.level }) }) : null
|
|
3002
3065
|
] })
|
|
3003
3066
|
}
|
|
3004
3067
|
);
|
|
3005
3068
|
}
|
|
3006
3069
|
function TimeslotFixed({ cell }) {
|
|
3007
|
-
return /* @__PURE__ */
|
|
3070
|
+
return /* @__PURE__ */ jsx11("span", { className: "scopetickets-island-timeslot", children: /* @__PURE__ */ jsx11("span", { className: "scopetickets-island-timeslot__pill", "data-state": cell.state, children: /* @__PURE__ */ jsx11(TimeslotRow, { cell }) }) });
|
|
3008
3071
|
}
|
|
3009
3072
|
|
|
3010
3073
|
// src/island/TimeslotGroupSection.tsx
|
|
3011
|
-
import { jsx as
|
|
3074
|
+
import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3012
3075
|
function TimeslotGroupSection({ group, accessory, onSelect }) {
|
|
3013
3076
|
return /* @__PURE__ */ jsxs8("section", { className: "scopetickets-island-timeslots__group", children: [
|
|
3014
|
-
group.label === null ? null : /* @__PURE__ */
|
|
3015
|
-
/* @__PURE__ */
|
|
3077
|
+
group.label === null ? null : /* @__PURE__ */ jsx12("h4", { className: "scopetickets-island-timeslots__label", children: group.label }),
|
|
3078
|
+
/* @__PURE__ */ jsx12("div", { className: "scopetickets-island-timeslots__list", children: group.cells.map((cell, index) => /* @__PURE__ */ jsx12(
|
|
3016
3079
|
Timeslot,
|
|
3017
3080
|
{
|
|
3018
3081
|
cell,
|
|
@@ -3025,7 +3088,7 @@ function TimeslotGroupSection({ group, accessory, onSelect }) {
|
|
|
3025
3088
|
}
|
|
3026
3089
|
|
|
3027
3090
|
// src/island/TimeslotPicker.tsx
|
|
3028
|
-
import { jsx as
|
|
3091
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
3029
3092
|
function TimeslotPicker({
|
|
3030
3093
|
slots,
|
|
3031
3094
|
selection,
|
|
@@ -3039,14 +3102,14 @@ function TimeslotPicker({
|
|
|
3039
3102
|
() => buildTimeslotGroups(slots, { selection, today, nowTime, grouping }),
|
|
3040
3103
|
[slots, selection, today, nowTime, grouping]
|
|
3041
3104
|
);
|
|
3042
|
-
return /* @__PURE__ */
|
|
3105
|
+
return /* @__PURE__ */ jsx13("div", { className: "scopetickets-island-timeslots", children: groups.map((group) => /* @__PURE__ */ jsx13(
|
|
3043
3106
|
TimeslotGroupSection,
|
|
3044
3107
|
{
|
|
3045
3108
|
group,
|
|
3046
3109
|
accessory,
|
|
3047
3110
|
onSelect
|
|
3048
3111
|
},
|
|
3049
|
-
group.
|
|
3112
|
+
group.key
|
|
3050
3113
|
)) });
|
|
3051
3114
|
}
|
|
3052
3115
|
|
|
@@ -3055,7 +3118,7 @@ import { useEffect as useEffect6, useReducer } from "react";
|
|
|
3055
3118
|
|
|
3056
3119
|
// src/island/CalendarWeekSection.tsx
|
|
3057
3120
|
import { useCallback as useCallback3, useEffect as useEffect5, useLayoutEffect, useRef as useRef4, useState as useState5 } from "react";
|
|
3058
|
-
import { jsx as
|
|
3121
|
+
import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3059
3122
|
function CalendarWeekSection({
|
|
3060
3123
|
series,
|
|
3061
3124
|
today,
|
|
@@ -3111,15 +3174,15 @@ function CalendarWeekSection({
|
|
|
3111
3174
|
}, [weeks.length, visibleWeek, selectedWeek, selectedDay, onVisibleMonthChange]);
|
|
3112
3175
|
if (weeks.length === 0) return null;
|
|
3113
3176
|
return /* @__PURE__ */ jsxs9("div", { className: "scopetickets-island-week", children: [
|
|
3114
|
-
/* @__PURE__ */
|
|
3115
|
-
/* @__PURE__ */
|
|
3177
|
+
/* @__PURE__ */ jsx14(CalendarWeekdayNames, {}),
|
|
3178
|
+
/* @__PURE__ */ jsx14("div", { className: "scopetickets-island-week__pager", ref: pagerRef, onScroll: paint, children: weeks.map((weekStart, index) => /* @__PURE__ */ jsx14(
|
|
3116
3179
|
"div",
|
|
3117
3180
|
{
|
|
3118
3181
|
className: "scopetickets-island-week__page",
|
|
3119
3182
|
ref: (node) => {
|
|
3120
3183
|
pageRefs.current[index] = node;
|
|
3121
3184
|
},
|
|
3122
|
-
children: /* @__PURE__ */
|
|
3185
|
+
children: /* @__PURE__ */ jsx14("div", { className: "scopetickets-island-week__row", children: buildWeekRow(series, weekStart, { today, selectedDay }).map((cell, dayIndex) => /* @__PURE__ */ jsx14(
|
|
3123
3186
|
CalendarDay,
|
|
3124
3187
|
{
|
|
3125
3188
|
cell,
|
|
@@ -3137,14 +3200,14 @@ function CalendarWeekSection({
|
|
|
3137
3200
|
}
|
|
3138
3201
|
|
|
3139
3202
|
// src/island/SelectedDayHeading.tsx
|
|
3140
|
-
import { jsx as
|
|
3203
|
+
import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3141
3204
|
function SelectedDayHeading({ day }) {
|
|
3142
3205
|
return /* @__PURE__ */ jsxs10("h3", { className: "scopetickets-island-day-heading", children: [
|
|
3143
3206
|
/* @__PURE__ */ jsxs10("span", { className: "scopetickets-island-day-heading__weekday", children: [
|
|
3144
3207
|
formatDayWeekday(day),
|
|
3145
3208
|
","
|
|
3146
3209
|
] }),
|
|
3147
|
-
/* @__PURE__ */
|
|
3210
|
+
/* @__PURE__ */ jsx15("span", { className: "scopetickets-island-day-heading__date", children: formatDayDate(day) })
|
|
3148
3211
|
] });
|
|
3149
3212
|
}
|
|
3150
3213
|
|
|
@@ -3194,7 +3257,7 @@ var DAY_SWAP_OUT_ANIMATION = "scopetickets-island-day-swap-out";
|
|
|
3194
3257
|
var DAY_SWAP_IN_ANIMATION = "scopetickets-island-day-swap-in";
|
|
3195
3258
|
|
|
3196
3259
|
// src/island/TimePicker.tsx
|
|
3197
|
-
import { jsx as
|
|
3260
|
+
import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3198
3261
|
function TimePicker({
|
|
3199
3262
|
series,
|
|
3200
3263
|
today,
|
|
@@ -3205,7 +3268,8 @@ function TimePicker({
|
|
|
3205
3268
|
onSelectTime,
|
|
3206
3269
|
remaining,
|
|
3207
3270
|
accessory = DATE_PICKER_ACCESSORY,
|
|
3208
|
-
onVisibleMonthChange
|
|
3271
|
+
onVisibleMonthChange,
|
|
3272
|
+
grouping
|
|
3209
3273
|
}) {
|
|
3210
3274
|
const [swap, dispatch] = useReducer(reduceDaySwap, { day: selection.day, slots }, daySwapAtRest);
|
|
3211
3275
|
useEffect6(() => {
|
|
@@ -3220,7 +3284,7 @@ function TimePicker({
|
|
|
3220
3284
|
};
|
|
3221
3285
|
const shownSelection = swap.shown.day === selection.day ? selection : { day: swap.shown.day, startTime: null };
|
|
3222
3286
|
return /* @__PURE__ */ jsxs11("div", { className: "scopetickets-island-time", "data-accessory": accessory, children: [
|
|
3223
|
-
/* @__PURE__ */
|
|
3287
|
+
/* @__PURE__ */ jsx16(
|
|
3224
3288
|
CalendarWeekSection,
|
|
3225
3289
|
{
|
|
3226
3290
|
series,
|
|
@@ -3240,8 +3304,8 @@ function TimePicker({
|
|
|
3240
3304
|
style: swap.phase === "REST" ? void 0 : { "--scopetickets-island-swap-sign": swap.sign },
|
|
3241
3305
|
onAnimationEnd: onSwapAnimationEnd,
|
|
3242
3306
|
children: [
|
|
3243
|
-
/* @__PURE__ */
|
|
3244
|
-
/* @__PURE__ */
|
|
3307
|
+
/* @__PURE__ */ jsx16(SelectedDayHeading, { day: swap.shown.day }),
|
|
3308
|
+
/* @__PURE__ */ jsx16(
|
|
3245
3309
|
TimeslotPicker,
|
|
3246
3310
|
{
|
|
3247
3311
|
slots: swap.shown.slots,
|
|
@@ -3249,7 +3313,8 @@ function TimePicker({
|
|
|
3249
3313
|
today,
|
|
3250
3314
|
nowTime,
|
|
3251
3315
|
onSelect: onSelectTime,
|
|
3252
|
-
accessory
|
|
3316
|
+
accessory,
|
|
3317
|
+
grouping
|
|
3253
3318
|
}
|
|
3254
3319
|
)
|
|
3255
3320
|
]
|
|
@@ -3260,7 +3325,7 @@ function TimePicker({
|
|
|
3260
3325
|
|
|
3261
3326
|
// src/island/CalendarGrainButton.tsx
|
|
3262
3327
|
import { useCallback as useCallback4, useLayoutEffect as useLayoutEffect2, useRef as useRef5, useState as useState6 } from "react";
|
|
3263
|
-
import { jsx as
|
|
3328
|
+
import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3264
3329
|
function useShortenedMonth(long) {
|
|
3265
3330
|
const [short, setShort] = useState6(false);
|
|
3266
3331
|
const title = useRef5(null);
|
|
@@ -3311,7 +3376,7 @@ function CalendarGrainButton({ month, grain, onPress }) {
|
|
|
3311
3376
|
...grain === "MONTH" && short ? { "data-grain-short": "" } : null,
|
|
3312
3377
|
children: [
|
|
3313
3378
|
shown,
|
|
3314
|
-
grain === "MONTH" ? /* @__PURE__ */
|
|
3379
|
+
grain === "MONTH" ? /* @__PURE__ */ jsx17(
|
|
3315
3380
|
"span",
|
|
3316
3381
|
{
|
|
3317
3382
|
className: "scopetickets-island-header-button__probe",
|
|
@@ -3324,9 +3389,9 @@ function CalendarGrainButton({ month, grain, onPress }) {
|
|
|
3324
3389
|
}
|
|
3325
3390
|
);
|
|
3326
3391
|
if (onPress === void 0) {
|
|
3327
|
-
return /* @__PURE__ */
|
|
3392
|
+
return /* @__PURE__ */ jsx17("span", { className: "scopetickets-island-chrome-pill scopetickets-island-grain-pill", children: title });
|
|
3328
3393
|
}
|
|
3329
|
-
return /* @__PURE__ */
|
|
3394
|
+
return /* @__PURE__ */ jsx17(
|
|
3330
3395
|
"button",
|
|
3331
3396
|
{
|
|
3332
3397
|
type: "button",
|
|
@@ -3338,6 +3403,26 @@ function CalendarGrainButton({ month, grain, onPress }) {
|
|
|
3338
3403
|
);
|
|
3339
3404
|
}
|
|
3340
3405
|
|
|
3406
|
+
// src/island/Switch.tsx
|
|
3407
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
3408
|
+
function Switch({ checked, onChange, label, size = "wide", disabled = false }) {
|
|
3409
|
+
const press = useIslandPress("element");
|
|
3410
|
+
return /* @__PURE__ */ jsx18(
|
|
3411
|
+
"button",
|
|
3412
|
+
{
|
|
3413
|
+
type: "button",
|
|
3414
|
+
role: "switch",
|
|
3415
|
+
"aria-checked": checked,
|
|
3416
|
+
"aria-label": label,
|
|
3417
|
+
disabled,
|
|
3418
|
+
className: `scopetickets-island-switch scopetickets-island-switch--${size}`,
|
|
3419
|
+
onClick: () => onChange(!checked),
|
|
3420
|
+
...disabled ? {} : press,
|
|
3421
|
+
children: /* @__PURE__ */ jsx18("span", { className: "scopetickets-island-switch__thumb", "aria-hidden": "true" })
|
|
3422
|
+
}
|
|
3423
|
+
);
|
|
3424
|
+
}
|
|
3425
|
+
|
|
3341
3426
|
export {
|
|
3342
3427
|
SURFACE_MORPH_MS,
|
|
3343
3428
|
SURFACE_SPRING,
|
|
@@ -3349,6 +3434,8 @@ export {
|
|
|
3349
3434
|
SURFACE_MORPH_DELAY_MS,
|
|
3350
3435
|
INCOMING_FADE_DELAY_MS,
|
|
3351
3436
|
INCOMING_FADE_MS,
|
|
3437
|
+
ARC_LEAD_BEZIER,
|
|
3438
|
+
ARC_TRAIL_BEZIER,
|
|
3352
3439
|
CARRY_MOVE_DELAY_MS,
|
|
3353
3440
|
CARRY_MOVE_MS,
|
|
3354
3441
|
POP_SCALE,
|
|
@@ -3405,10 +3492,6 @@ export {
|
|
|
3405
3492
|
clampRemaining,
|
|
3406
3493
|
trackPaths,
|
|
3407
3494
|
timerPaths,
|
|
3408
|
-
formatMoney,
|
|
3409
|
-
moneyParts,
|
|
3410
|
-
widestAmount,
|
|
3411
|
-
quoteLines,
|
|
3412
3495
|
slotFullness,
|
|
3413
3496
|
parseWallClockTime,
|
|
3414
3497
|
timeOfDayInZone,
|
|
@@ -3456,13 +3539,18 @@ export {
|
|
|
3456
3539
|
monthAtRow,
|
|
3457
3540
|
monthOpeningRow,
|
|
3458
3541
|
toggleSelectedDay,
|
|
3542
|
+
majorUnits,
|
|
3543
|
+
formatMoney,
|
|
3544
|
+
moneyParts,
|
|
3545
|
+
widestAmount,
|
|
3546
|
+
quoteLines,
|
|
3459
3547
|
PartyStepper,
|
|
3548
|
+
DayPicker,
|
|
3460
3549
|
ContentFlag,
|
|
3461
|
-
Switch,
|
|
3462
3550
|
CounterRing,
|
|
3463
|
-
DayPicker,
|
|
3464
3551
|
TimeslotPicker,
|
|
3465
3552
|
TimePicker,
|
|
3466
|
-
CalendarGrainButton
|
|
3553
|
+
CalendarGrainButton,
|
|
3554
|
+
Switch
|
|
3467
3555
|
};
|
|
3468
|
-
//# sourceMappingURL=chunk-
|
|
3556
|
+
//# sourceMappingURL=chunk-VS7ACUTQ.js.map
|