@scopetickets/checkout 0.1.3 → 0.4.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.
@@ -8,7 +8,7 @@ import {
8
8
  useState
9
9
  } from "react";
10
10
 
11
- // src/island/island-motion.ts
11
+ // ../checkout-core/src/motion/island-motion.ts
12
12
  var SURFACE_MORPH_MS = 250;
13
13
  var SURFACE_DAMPING = 0.82;
14
14
  var SURFACE_SPRING = {
@@ -39,18 +39,6 @@ function springAt(spring, t) {
39
39
  const value = 1 - Math.exp(-z * wn * t) * (Math.cos(wd * t) + z / Math.sqrt(1 - z * z) * Math.sin(wd * t));
40
40
  return spring.clampOvershoot ? Math.min(value, 1) : value;
41
41
  }
42
- function springEasing(spring, samples = 40) {
43
- const duration = settleMs(spring) / 1e3;
44
- const arrival = Math.min(springAt(spring, duration), 1);
45
- const points = [];
46
- for (let i = 0; i <= samples; i += 1) {
47
- const raw = springAt(spring, i / samples * duration);
48
- const scaled = arrival <= 0 ? raw : raw / arrival;
49
- const value = i === samples ? 1 : spring.clampOvershoot ? Math.min(1, scaled) : scaled;
50
- points.push(Number(value.toFixed(4)).toString());
51
- }
52
- return `linear(${points.join(", ")})`;
53
- }
54
42
  var OUTGOING_FADE_MS = 125;
55
43
  var SURFACE_MORPH_DELAY_MS = OUTGOING_FADE_MS;
56
44
  var INCOMING_FADE_DELAY_MS = SURFACE_MORPH_DELAY_MS + SURFACE_MORPH_MS;
@@ -60,8 +48,6 @@ var DAY_SWAP_OUT_MS = Math.round(OUTGOING_FADE_MS * DAY_SWAP_STRETCH);
60
48
  var DAY_SWAP_IN_MS = Math.round(INCOMING_FADE_MS * DAY_SWAP_STRETCH);
61
49
  var CARRY_MOVE_DELAY_MS = SURFACE_MORPH_DELAY_MS;
62
50
  var CARRY_MOVE_MS = settleMs(CARRY_SPRING);
63
- var ARC_LEAD_EASING = "cubic-bezier(0.61, 1, 0.88, 1)";
64
- var ARC_TRAIL_EASING = "cubic-bezier(0.12, 0, 0.39, 0)";
65
51
  var POP_SCALE = 0.95;
66
52
  var SHIELD_POP_SCALE = 1 - (1 - POP_SCALE) / 2;
67
53
  var POP_CONTRACT_MS = OUTGOING_FADE_MS;
@@ -149,7 +135,225 @@ function useIslandPress(scope = "island") {
149
135
  return whole || !pressedHere ? handlers : { ...handlers, "data-pressed": "" };
150
136
  }
151
137
 
152
- // src/island/island-calendar.ts
138
+ // ../checkout-core/src/domain/user-types.ts
139
+ var SOLO_KEY = "default";
140
+ function agreed(values) {
141
+ const first = values[0];
142
+ if (first === void 0) return null;
143
+ return values.every((value) => value === first) ? first : null;
144
+ }
145
+ function groupUserTypes(rows) {
146
+ const byName = /* @__PURE__ */ new Map();
147
+ for (const row of rows) {
148
+ if (row.Name === "") continue;
149
+ const group = byName.get(row.Name);
150
+ if (group === void 0) byName.set(row.Name, [row]);
151
+ else group.push(row);
152
+ }
153
+ return [...byName.entries()].map(([name, group]) => ({
154
+ key: name,
155
+ name,
156
+ note: agreed(group.map((row) => row.Note ?? null))
157
+ }));
158
+ }
159
+ function partyTypes(host, fetched, asking) {
160
+ if (host.length > 0) return { status: "KNOWN", types: host };
161
+ if (fetched !== void 0) return { status: "KNOWN", types: fetched };
162
+ return asking ? { status: "ASKING" } : { status: "KNOWN", types: [] };
163
+ }
164
+ function assignmentFor(product, key) {
165
+ if (product.UserTypes === void 0) return key;
166
+ const offered = product.UserTypes ?? [];
167
+ const byName = offered.find((type) => type.Name === key);
168
+ if (byName !== void 0) return byName.AssignmentKey;
169
+ return offered.some((type) => type.AssignmentKey === key) ? key : void 0;
170
+ }
171
+ function userTypeNames(rows) {
172
+ return Object.fromEntries(rows.map((row) => [row.AssignmentKey, row.Name]));
173
+ }
174
+
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
+ // ../checkout-core/src/domain/island-timeslots.ts
213
+ function slotFullness(remaining, total) {
214
+ if (!Number.isFinite(remaining) || remaining < 0) return null;
215
+ if (remaining <= 1) return remaining;
216
+ if (!Number.isFinite(total) || total <= 0) return null;
217
+ return Math.min(1, remaining / total);
218
+ }
219
+ var MAX_TIME_INPUT = 40;
220
+ var WALL_CLOCK = /^(?:\d{4}-\d{2}-\d{2}[T ])?(\d{2}):(\d{2})(?::\d{2})?/;
221
+ function parseWallClockTime(value) {
222
+ if (typeof value !== "string" || value.length > MAX_TIME_INPUT) return null;
223
+ const match = WALL_CLOCK.exec(value.trim());
224
+ if (!match) return null;
225
+ if (Number(match[1]) > 23 || Number(match[2]) > 59) return null;
226
+ return `${match[1]}:${match[2]}`;
227
+ }
228
+ function timeOfDayInZone(now, timeZone) {
229
+ const read = (zone) => {
230
+ const parts = new Intl.DateTimeFormat("en-GB", {
231
+ timeZone: zone,
232
+ hour: "2-digit",
233
+ minute: "2-digit",
234
+ hourCycle: "h23"
235
+ }).formatToParts(now);
236
+ const hour = parts.find((part) => part.type === "hour")?.value ?? "00";
237
+ const minute = parts.find((part) => part.type === "minute")?.value ?? "00";
238
+ return `${String(Number(hour) % 24).padStart(2, "0")}:${minute}`;
239
+ };
240
+ try {
241
+ return read(timeZone ?? "UTC");
242
+ } catch {
243
+ return read("UTC");
244
+ }
245
+ }
246
+ function dayInZone(now, timeZone) {
247
+ const read = (zone) => new Intl.DateTimeFormat("en-CA", {
248
+ timeZone: zone,
249
+ year: "numeric",
250
+ month: "2-digit",
251
+ day: "2-digit"
252
+ }).format(now);
253
+ try {
254
+ return read(timeZone ?? "UTC");
255
+ } catch {
256
+ return read("UTC");
257
+ }
258
+ }
259
+ var PART_OF_DAY_LABELS = {
260
+ OVERNIGHT: "OVERNIGHT",
261
+ PRE_DAWN: "PRE-DAWN",
262
+ EARLY_MORNING: "EARLY MORNING",
263
+ LATE_MORNING: "LATE MORNING",
264
+ EARLY_AFTERNOON: "EARLY AFTERNOON",
265
+ LATE_AFTERNOON: "LATE AFTERNOON",
266
+ EARLY_EVENING: "EARLY EVENING",
267
+ LATE_EVENING: "LATE EVENING"
268
+ };
269
+ function partOfDayLabel(part) {
270
+ return PART_OF_DAY_LABELS[part];
271
+ }
272
+ function partOfDay(time) {
273
+ const hour = Number(time.slice(0, 2));
274
+ if (hour < 3) return "OVERNIGHT";
275
+ if (hour < 6) return "PRE_DAWN";
276
+ if (hour < 9) return "EARLY_MORNING";
277
+ if (hour < 12) return "LATE_MORNING";
278
+ if (hour < 15) return "EARLY_AFTERNOON";
279
+ if (hour < 18) return "LATE_AFTERNOON";
280
+ if (hour < 21) return "EARLY_EVENING";
281
+ return "LATE_EVENING";
282
+ }
283
+ var MINUTES_IN_DAY = 24 * 60;
284
+ function minutesOfDay(time) {
285
+ return Number(time.slice(0, 2)) * 60 + Number(time.slice(3, 5));
286
+ }
287
+ function formatSlotRange(startTime, endTime) {
288
+ return endTime === null ? startTime : `${startTime} - ${endTime}`;
289
+ }
290
+ function formatSlotDuration(startTime, endTime) {
291
+ if (endTime === null) return null;
292
+ const minutes = (minutesOfDay(endTime) - minutesOfDay(startTime) + MINUTES_IN_DAY) % MINUTES_IN_DAY;
293
+ if (!Number.isFinite(minutes) || minutes <= 0) return null;
294
+ const hours = Math.floor(minutes / 60);
295
+ const rest = minutes % 60;
296
+ if (hours === 0) return `${rest}m`;
297
+ return rest === 0 ? `${hours}h` : `${hours}h ${rest}m`;
298
+ }
299
+ function withSelectedDay(selection, day) {
300
+ return selection.day === day ? selection : { day, startTime: null };
301
+ }
302
+ function withSelectedTime(selection, startTime) {
303
+ return { day: selection.day, startTime };
304
+ }
305
+ function hasStarted(slot, options) {
306
+ if (options.selection.day < options.today) return true;
307
+ if (options.selection.day > options.today) return false;
308
+ return slot.startTime <= options.nowTime;
309
+ }
310
+ function timeslotState(slot, options) {
311
+ if (hasStarted(slot, options)) return "PAST_BUT_RELEVANT";
312
+ if (slot.remaining !== null && slot.remaining <= 0) return "UNAVAILABLE";
313
+ return slot.startTime === options.selection.startTime ? "SELECTED" : "AVAILABLE";
314
+ }
315
+ function sameTimeslots(a, b) {
316
+ if (a === b) return true;
317
+ if (a.length !== b.length) return false;
318
+ return a.every((slot, index) => {
319
+ const other = b[index];
320
+ return slot.startTime === other.startTime && slot.endTime === other.endTime && slot.remaining === other.remaining;
321
+ });
322
+ }
323
+ function buildTimeslotGroups(slots, options) {
324
+ const groups = [];
325
+ const byPart = /* @__PURE__ */ new Map();
326
+ const chronological = [...slots].sort((a, b) => a.startTime.localeCompare(b.startTime));
327
+ const cellFor = (slot) => ({
328
+ slot,
329
+ part: partOfDay(slot.startTime),
330
+ state: timeslotState(slot, options),
331
+ duration: formatSlotDuration(slot.startTime, slot.endTime)
332
+ });
333
+ if ((options.grouping ?? "PART_OF_DAY") === "NONE") {
334
+ return chronological.length === 0 ? [] : [{ part: null, label: null, cells: chronological.map(cellFor) }];
335
+ }
336
+ for (const slot of chronological) {
337
+ const part = partOfDay(slot.startTime);
338
+ let group = byPart.get(part);
339
+ if (!group) {
340
+ group = { part, label: partOfDayLabel(part), cells: [] };
341
+ byPart.set(part, group);
342
+ groups.push(group);
343
+ }
344
+ group.cells.push(cellFor(slot));
345
+ }
346
+ return groups;
347
+ }
348
+ function timeslotRequest(day, startTime, schedule) {
349
+ if (day === void 0 || startTime === void 0 || startTime === "") return void 0;
350
+ const slot = schedule?.slotsByDay?.[day]?.find((candidate) => candidate.startTime === startTime);
351
+ if (slot === void 0) return void 0;
352
+ const ends = slot.endTime ?? slot.startTime;
353
+ return { LocalStartTime: `${slot.startTime}:00`, LocalEndTime: `${ends}:00` };
354
+ }
355
+
356
+ // ../checkout-core/src/domain/island-calendar.ts
153
357
  var HIGH_FROM = 2 / 3;
154
358
  var MEDIUM_FROM = 1 / 3;
155
359
  function toAvailabilityLevel(remaining) {
@@ -171,15 +375,28 @@ var RAMP = [
171
375
  [HIGH_FROM, 67],
172
376
  [1, 100]
173
377
  ];
174
- function availabilityColor(remaining) {
175
- const stop = (suffix) => `var(--scopetickets-island-availability-${suffix})`;
176
- if (remaining === null || !Number.isFinite(remaining) || remaining <= 0) return stop(0);
177
- if (remaining >= 1) return stop(100);
378
+ function availabilityMix(remaining) {
379
+ const flat = (stop) => ({
380
+ from: stop,
381
+ to: stop,
382
+ towards: 100
383
+ });
384
+ if (remaining === null || !Number.isFinite(remaining) || remaining <= 0) return flat(0);
385
+ if (remaining >= 1) return flat(100);
178
386
  const top = RAMP.findIndex(([at]) => remaining <= at);
179
387
  const [lowAt, lowStop] = RAMP[top - 1];
180
388
  const [highAt, highStop] = RAMP[top];
181
- const towards = Math.round((remaining - lowAt) / (highAt - lowAt) * 100);
182
- return `color-mix(in srgb, ${stop(highStop)} ${towards}%, ${stop(lowStop)})`;
389
+ return {
390
+ from: lowStop,
391
+ to: highStop,
392
+ towards: Math.round((remaining - lowAt) / (highAt - lowAt) * 100)
393
+ };
394
+ }
395
+ function availabilityColor(remaining) {
396
+ const stop = (suffix) => `var(--scopetickets-island-availability-${suffix})`;
397
+ const { from, to, towards } = availabilityMix(remaining);
398
+ if (from === to) return stop(from);
399
+ return `color-mix(in srgb, ${stop(to)} ${towards}%, ${stop(from)})`;
183
400
  }
184
401
  function isDatePickerCellSelectable(state) {
185
402
  return state === "AVAILABLE" || state === "SELECTED";
@@ -364,9 +581,14 @@ function formatDayChip(day) {
364
581
  const at = /* @__PURE__ */ new Date(`${day}T12:00:00.000Z`);
365
582
  return {
366
583
  date: at.toLocaleDateString(CALENDAR_LOCALE, { day: "numeric", timeZone: "UTC" }),
367
- month: at.toLocaleDateString(CALENDAR_LOCALE, { month: "short", timeZone: "UTC" }).replace(/\.$/, "").toUpperCase()
584
+ month: shortMonthLabel(
585
+ at.toLocaleDateString(CALENDAR_LOCALE, { month: "short", timeZone: "UTC" })
586
+ )
368
587
  };
369
588
  }
589
+ function shortMonthLabel(abbreviation) {
590
+ return abbreviation.replace(/\.$/, "").slice(0, 3).toUpperCase();
591
+ }
370
592
  function formatDayWeekday(day) {
371
593
  return (/* @__PURE__ */ new Date(`${day}T12:00:00.000Z`)).toLocaleDateString(CALENDAR_LOCALE, {
372
594
  weekday: "long",
@@ -439,176 +661,74 @@ function toggleSelectedDay(selected, day) {
439
661
  return selected === day ? null : day;
440
662
  }
441
663
 
442
- // src/island/island-timeslots.ts
443
- function slotFullness(remaining, total) {
444
- if (!Number.isFinite(remaining) || remaining < 0) return null;
445
- if (remaining <= 1) return remaining;
446
- if (!Number.isFinite(total) || total <= 0) return null;
447
- return Math.min(1, remaining / total);
448
- }
449
- var MAX_TIME_INPUT = 40;
450
- var WALL_CLOCK = /^(?:\d{4}-\d{2}-\d{2}[T ])?(\d{2}):(\d{2})(?::\d{2})?/;
451
- function parseWallClockTime(value) {
452
- if (typeof value !== "string" || value.length > MAX_TIME_INPUT) return null;
453
- const match = WALL_CLOCK.exec(value.trim());
454
- if (!match) return null;
455
- if (Number(match[1]) > 23 || Number(match[2]) > 59) return null;
456
- return `${match[1]}:${match[2]}`;
457
- }
458
- function timeOfDayInZone(now, timeZone) {
459
- const read = (zone) => {
460
- const parts = new Intl.DateTimeFormat("en-GB", {
461
- timeZone: zone,
462
- hour: "2-digit",
463
- minute: "2-digit",
464
- hourCycle: "h23"
465
- }).formatToParts(now);
466
- const hour = parts.find((part) => part.type === "hour")?.value ?? "00";
467
- const minute = parts.find((part) => part.type === "minute")?.value ?? "00";
468
- return `${String(Number(hour) % 24).padStart(2, "0")}:${minute}`;
469
- };
470
- try {
471
- return read(timeZone ?? "UTC");
472
- } catch {
473
- return read("UTC");
474
- }
475
- }
476
- var PART_OF_DAY_LABELS = {
477
- OVERNIGHT: "OVERNIGHT",
478
- PRE_DAWN: "PRE-DAWN",
479
- EARLY_MORNING: "EARLY MORNING",
480
- LATE_MORNING: "LATE MORNING",
481
- EARLY_AFTERNOON: "EARLY AFTERNOON",
482
- LATE_AFTERNOON: "LATE AFTERNOON",
483
- EARLY_EVENING: "EARLY EVENING",
484
- LATE_EVENING: "LATE EVENING"
485
- };
486
- function partOfDayLabel(part) {
487
- return PART_OF_DAY_LABELS[part];
488
- }
489
- function partOfDay(time) {
490
- const hour = Number(time.slice(0, 2));
491
- if (hour < 3) return "OVERNIGHT";
492
- if (hour < 6) return "PRE_DAWN";
493
- if (hour < 9) return "EARLY_MORNING";
494
- if (hour < 12) return "LATE_MORNING";
495
- if (hour < 15) return "EARLY_AFTERNOON";
496
- if (hour < 18) return "LATE_AFTERNOON";
497
- if (hour < 21) return "EARLY_EVENING";
498
- return "LATE_EVENING";
499
- }
500
- var MINUTES_IN_DAY = 24 * 60;
501
- function minutesOfDay(time) {
502
- return Number(time.slice(0, 2)) * 60 + Number(time.slice(3, 5));
503
- }
504
- function formatSlotRange(startTime, endTime) {
505
- return endTime === null ? startTime : `${startTime} - ${endTime}`;
506
- }
507
- function formatSlotDuration(startTime, endTime) {
508
- if (endTime === null) return null;
509
- const minutes = (minutesOfDay(endTime) - minutesOfDay(startTime) + MINUTES_IN_DAY) % MINUTES_IN_DAY;
510
- if (!Number.isFinite(minutes) || minutes <= 0) return null;
511
- const hours = Math.floor(minutes / 60);
512
- const rest = minutes % 60;
513
- if (hours === 0) return `${rest}m`;
514
- return rest === 0 ? `${hours}h` : `${hours}h ${rest}m`;
515
- }
516
- function withSelectedDay(selection, day) {
517
- return selection.day === day ? selection : { day, startTime: null };
518
- }
519
- function withSelectedTime(selection, startTime) {
520
- return { day: selection.day, startTime };
521
- }
522
- function hasStarted(slot, options) {
523
- if (options.selection.day < options.today) return true;
524
- if (options.selection.day > options.today) return false;
525
- return slot.startTime <= options.nowTime;
526
- }
527
- function timeslotState(slot, options) {
528
- if (hasStarted(slot, options)) return "PAST_BUT_RELEVANT";
529
- if (slot.remaining !== null && slot.remaining <= 0) return "UNAVAILABLE";
530
- return slot.startTime === options.selection.startTime ? "SELECTED" : "AVAILABLE";
531
- }
532
- function sameTimeslots(a, b) {
533
- if (a === b) return true;
534
- if (a.length !== b.length) return false;
535
- return a.every((slot, index) => {
536
- const other = b[index];
537
- return slot.startTime === other.startTime && slot.endTime === other.endTime && slot.remaining === other.remaining;
538
- });
539
- }
540
- function buildTimeslotGroups(slots, options) {
541
- const groups = [];
542
- const byPart = /* @__PURE__ */ new Map();
543
- const chronological = [...slots].sort((a, b) => a.startTime.localeCompare(b.startTime));
544
- const cellFor = (slot) => ({
545
- slot,
546
- part: partOfDay(slot.startTime),
547
- state: timeslotState(slot, options),
548
- duration: formatSlotDuration(slot.startTime, slot.endTime)
549
- });
550
- if ((options.grouping ?? "PART_OF_DAY") === "NONE") {
551
- return chronological.length === 0 ? [] : [{ part: null, label: null, cells: chronological.map(cellFor) }];
552
- }
553
- for (const slot of chronological) {
554
- const part = partOfDay(slot.startTime);
555
- let group = byPart.get(part);
556
- if (!group) {
557
- group = { part, label: partOfDayLabel(part), cells: [] };
558
- byPart.set(part, group);
559
- groups.push(group);
560
- }
561
- group.cells.push(cellFor(slot));
562
- }
563
- return groups;
564
- }
565
- function timeslotRequest(day, startTime, schedule) {
566
- if (day === void 0 || startTime === void 0 || startTime === "") return void 0;
567
- const slot = schedule?.slotsByDay?.[day]?.find((candidate) => candidate.startTime === startTime);
568
- if (slot === void 0) return void 0;
569
- const ends = slot.endTime ?? slot.startTime;
570
- return { LocalStartTime: `${slot.startTime}:00`, LocalEndTime: `${ends}:00` };
571
- }
664
+ // src/island/PartyStepper.tsx
665
+ import { useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
666
+ import { MinusMarkIcon, PlusMarkIcon } from "@scopetickets/icons";
572
667
 
573
- // src/domain/user-types.ts
574
- function agreed(values) {
575
- const first = values[0];
576
- if (first === void 0) return null;
577
- return values.every((value) => value === first) ? first : null;
578
- }
579
- function groupUserTypes(rows) {
580
- const byName = /* @__PURE__ */ new Map();
581
- for (const row of rows) {
582
- if (row.Name === "") continue;
583
- const group = byName.get(row.Name);
584
- if (group === void 0) byName.set(row.Name, [row]);
585
- else group.push(row);
586
- }
587
- return [...byName.entries()].map(([name, group]) => ({
588
- key: name,
589
- name,
590
- note: agreed(group.map((row) => row.Note ?? null))
591
- }));
592
- }
593
- function partyTypes(host, fetched, asking) {
594
- if (host.length > 0) return { status: "KNOWN", types: host };
595
- if (fetched !== void 0) return { status: "KNOWN", types: fetched };
596
- return asking ? { status: "ASKING" } : { status: "KNOWN", types: [] };
597
- }
598
- function assignmentFor(product, key) {
599
- if (product.UserTypes === void 0) return key;
600
- const offered = product.UserTypes ?? [];
601
- const byName = offered.find((type) => type.Name === key);
602
- if (byName !== void 0) return byName.AssignmentKey;
603
- return offered.some((type) => type.AssignmentKey === key) ? key : void 0;
604
- }
605
- function userTypeNames(rows) {
606
- return Object.fromEntries(rows.map((row) => [row.AssignmentKey, row.Name]));
607
- }
668
+ // ../checkout-core/src/view/component-copy.ts
669
+ var FIELD_COPY = {
670
+ firstName: "First Name",
671
+ lastName: "Last Name",
672
+ email: "Email",
673
+ countryCode: "Country Code",
674
+ phoneNumber: "Phone Number",
675
+ confirmPassword: "Confirm Password",
676
+ verificationCode: "Verification code"
677
+ };
678
+ var PARTY_COPY = {
679
+ remove: (name) => `Remove one ${name}`,
680
+ add: (name) => `Add one ${name}`,
681
+ count: (count, name) => `${count} ${name}. Change the number`,
682
+ field: (name) => `Number of ${name}`,
683
+ /**
684
+ * AND WHAT AN UNDIFFERENTIATED PARTY IS CALLED — a run selling a single UserType has no
685
+ * name worth showing per row, so the one line it draws names the whole party.
686
+ *
687
+ * A PROP DEFAULT ON THE WEB IS INVISIBLE TO THE OTHER RENDERER, which is why this is
688
+ * here: `PartyStepper`'s own `soloName = 'Guests'` could not be read from native, so
689
+ * native re-typed it.
690
+ */
691
+ soloName: "Guests"
692
+ };
693
+ var ACTION_COPY = {
694
+ cancel: "Cancel",
695
+ confirm: "Confirm",
696
+ returnToOrder: "Return to Order",
697
+ payNow: "Pay Now",
698
+ tryAgain: "Try Again"
699
+ };
700
+ var DISMISS_COPY = {
701
+ back: "Back",
702
+ close: "Close",
703
+ /*
704
+ * ASKING ABOUT LEAVING IS STILL LEAVING, as far as the button's NAME is concerned: what
705
+ * a buyer presses it for is the same thing, and "Close, but we will check first" is a
706
+ * sentence nobody needs read to them.
707
+ */
708
+ abandon: "Close"
709
+ };
710
+ var ISLAND_COPY = {
711
+ order: "Your order",
712
+ runWeeks: "Weeks of the run"
713
+ };
714
+ var TIMESLOT_COPY = {
715
+ /**
716
+ * WHAT A SLOT WITH NOTHING LEFT SAYS, IN WORDS. The ring is a reading of how full a
717
+ * slot is, and at zero it draws nothing — an arc of no length is an absence, not a
718
+ * statement, and a buyer scanning a column for a time cannot be asked to notice an
719
+ * opacity.
720
+ */
721
+ soldOut: "Sold Out",
722
+ /**
723
+ * AND WHAT QUALIFIES THE PRICE — IN THE ROW'S NAME ONLY, not on its face. A column of
724
+ * forty rows each repeating the word says it forty times and the figure once. A screen
725
+ * reader gets one row at a time and no column, so a bare "€17.90" beside a time is a
726
+ * price with no qualifier at all.
727
+ */
728
+ from: "From"
729
+ };
608
730
 
609
731
  // src/island/PartyStepper.tsx
610
- import { useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
611
- import { MinusMarkIcon, PlusMarkIcon } from "@scopetickets/icons";
612
732
  import { jsx, jsxs } from "react/jsx-runtime";
613
733
  function UserTypeRow({
614
734
  option,
@@ -661,7 +781,7 @@ function UserTypeStepper({
661
781
  /* @__PURE__ */ jsx(
662
782
  StepperButton,
663
783
  {
664
- label: `Remove one ${name}`,
784
+ label: PARTY_COPY.remove(name),
665
785
  onPress: onRemove,
666
786
  kind: "remove",
667
787
  state: chosen ? "LIVE" : "CLOSED"
@@ -686,7 +806,7 @@ function UserTypeStepper({
686
806
  /* @__PURE__ */ jsx(
687
807
  StepperButton,
688
808
  {
689
- label: `Add one ${name}`,
809
+ label: PARTY_COPY.add(name),
690
810
  onPress: onAdd,
691
811
  kind: "add",
692
812
  state: atLimit ? "REFUSING" : "LIVE"
@@ -721,7 +841,7 @@ function SoloPartyStepper({ max, name, count, onSet, onRemove, onRefuse }) {
721
841
  /* @__PURE__ */ jsx(
722
842
  StepperButton,
723
843
  {
724
- label: `Remove one ${name}`,
844
+ label: PARTY_COPY.remove(name),
725
845
  onPress: onRemove,
726
846
  kind: "remove",
727
847
  state: count === 0 ? "REFUSING" : "LIVE"
@@ -742,7 +862,7 @@ function SoloPartyStepper({ max, name, count, onSet, onRemove, onRefuse }) {
742
862
  /* @__PURE__ */ jsx(
743
863
  StepperButton,
744
864
  {
745
- label: `Add one ${name}`,
865
+ label: PARTY_COPY.add(name),
746
866
  onPress: () => onSet(count + 1),
747
867
  kind: "add",
748
868
  state: count >= max ? "REFUSING" : "LIVE"
@@ -785,7 +905,7 @@ function TypedCount({
785
905
  {
786
906
  type: "button",
787
907
  className: valueClassName,
788
- "aria-label": `${count} ${name}. Change the number`,
908
+ "aria-label": PARTY_COPY.count(count, name),
789
909
  onClick: () => setTyping(String(count)),
790
910
  disabled: closed,
791
911
  children: count
@@ -801,7 +921,7 @@ function TypedCount({
801
921
  pattern: "[0-9]*",
802
922
  size: 1,
803
923
  ref: field,
804
- "aria-label": `Number of ${name}`,
924
+ "aria-label": PARTY_COPY.field(name),
805
925
  value: typing,
806
926
  onChange: (event) => setTyping(event.target.value.replace(/\D/g, "")),
807
927
  onBlur: commit,
@@ -820,7 +940,7 @@ function PartyStepper({
820
940
  counts,
821
941
  onChange,
822
942
  max,
823
- soloName = "Guests",
943
+ soloName = PARTY_COPY.soloName,
824
944
  onRefuse,
825
945
  refused = null
826
946
  }) {
@@ -867,7 +987,6 @@ function PartyStepper({
867
987
  option.key
868
988
  )) });
869
989
  }
870
- var SOLO_KEY = "default";
871
990
 
872
991
  // src/island/ContentFlag.tsx
873
992
  import {
@@ -875,10 +994,1321 @@ import {
875
994
  ExclamationMarkInCircleFilledIcon,
876
995
  XMarkInCircleFilledIcon
877
996
  } from "@scopetickets/icons";
878
- import { jsx as jsx2 } from "react/jsx-runtime";
997
+
998
+ // ../api/src/environment.ts
999
+ var ENVIRONMENT_URLS = {
1000
+ sandbox: {
1001
+ apiUrl: "https://testlink.scopetickets.com",
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
+ };
1054
+ }
1055
+
1056
+ // ../api/src/client.ts
1057
+ var ApiError = class extends Error {
1058
+ constructor(reason, message) {
1059
+ super(message);
1060
+ this.reason = reason;
1061
+ this.name = "ApiError";
1062
+ }
1063
+ };
1064
+ var ScopeClient = class {
1065
+ constructor(config) {
1066
+ this.sessionAuthorization = null;
1067
+ this.onRefused = null;
1068
+ this.config = config;
1069
+ }
1070
+ /**
1071
+ * WHO TO TELL WHEN A SESSION IS REFUSED — the one signal a session has that it is over.
1072
+ *
1073
+ * `LoginResult` carries no expiry, so nothing can know a header has stopped working
1074
+ * until the platform says so. This is where that arrives, and it is a callback on the
1075
+ * INSTANCE rather than anything global: this library runs inside somebody else's page,
1076
+ * and a handler registered anywhere a host could also reach is a handler two things
1077
+ * fight over.
1078
+ *
1079
+ * IT FIRES ONLY WHERE A USER SESSION WAS ACTUALLY SENT. A 401 on the app key alone is
1080
+ * the app being wrong about itself, not a buyer being signed out, and waking the session
1081
+ * machinery for it would expire somebody who was never signed in.
1082
+ */
1083
+ setRefusedHandler(handler) {
1084
+ this.onRefused = handler;
1085
+ }
1086
+ /**
1087
+ * Holds the header a signed-in user's session gave us, or clears it on sign-out.
1088
+ *
1089
+ * Stored and sent VERBATIM, which is right: staging answers `POST /api/Auth/Login`
1090
+ * with the `Bearer ` already on it. Nothing here adds a scheme, and nothing should.
1091
+ */
1092
+ setAuthorization(authorization) {
1093
+ this.sessionAuthorization = authorization;
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 {};
1107
+ }
1108
+ /** A 401 on a call that carried a session, and nothing else. See `setRefusedHandler`. */
1109
+ reportIfRefused(status) {
1110
+ if (status === 401 && this.sessionAuthorization !== null) this.onRefused?.();
1111
+ }
1112
+ async fetch(endpoint, options) {
1113
+ const response = await fetch(`${this.config.apiUrl}${endpoint}`, {
1114
+ ...options,
1115
+ headers: {
1116
+ "Content-Type": "application/json",
1117
+ ...this.getAuthHeaders(),
1118
+ ...options?.headers
1119
+ }
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
+ );
1214
+ return response.Tickets ?? [];
1215
+ }
1216
+ /** @deprecated Use getTicketInformation(), which also reports sold-out timeslots */
1217
+ async getEventTickets(eventKey, signal) {
1218
+ const response = await this.fetch(
1219
+ `/api/v2/Events/${eventKey}/Tickets?include_timeslots=true`,
1220
+ { signal }
1221
+ );
1222
+ return response.Tickets;
1223
+ }
1224
+ // ===========================================================================
1225
+ // v1 Events (deprecated — kept for cart/timeslot compat)
1226
+ // ===========================================================================
1227
+ /** @deprecated Use getDisplayEvents() or getEventInfo() instead */
1228
+ async getEvents(count) {
1229
+ const params = count ? `?count=${count}` : "";
1230
+ return this.fetch(`/api/Events/ByOrganisationKey/${this.config.orgKey}${params}`);
1231
+ }
1232
+ /** @deprecated Use getEventTickets() instead */
1233
+ async getTickets(eventId) {
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 } : {}
1308
+ };
1309
+ return this.fetch(`/api/v2/Carts/${cartKey}/Items`, {
1310
+ method: "POST",
1311
+ body: JSON.stringify(body)
1312
+ });
1313
+ }
1314
+ // ===========================================================================
1315
+ // Questionnaire
1316
+ // ===========================================================================
1317
+ async getQuestionnaireQuestions(eventId, signal) {
1318
+ return this.fetch(`/api/Questionnaires/Events/${eventId}/Questions`, {
1319
+ signal
1320
+ });
1321
+ }
1322
+ // ── Passcodes ──────────────────────────────────────────────────────────
1323
+ //
1324
+ // @Zsolt — AUTH SURFACE. Transport only: these three make the calls and return what
1325
+ // comes back. Which of them runs when, and what a failure means, is the account
1326
+ // flow's business — see `domain/passcode.ts` in @scopetickets/checkout.
1327
+ /** Sends a verification code to an address. */
1328
+ async sendEmailPasscode(body) {
1329
+ return this.fetch("/api/Passcodes/Email", {
1330
+ method: "POST",
1331
+ body: JSON.stringify(body)
1332
+ });
1333
+ }
1334
+ /** Submits the code the buyer typed. */
1335
+ async verifyPasscode(body) {
1336
+ await this.fetch("/api/Passcodes/Verification", {
1337
+ method: "POST",
1338
+ body: JSON.stringify(body)
1339
+ });
1340
+ }
1341
+ /**
1342
+ * Reads whether a passcode has been verified.
1343
+ *
1344
+ * The authoritative answer, and separate from `verifyPasscode` on purpose: a code
1345
+ * submitted in another tab, or on the phone the mail arrived on, is verified without
1346
+ * this browser ever having posted it.
1347
+ */
1348
+ async getPasscodeStatus(passcodeKey) {
1349
+ return this.fetch(
1350
+ `/api/Passcodes/${encodeURIComponent(passcodeKey)}/Status`
1351
+ );
1352
+ }
1353
+ async submitQuestionnaireResponses(cartKey, body) {
1354
+ return this.fetch(`/api/Cart/${cartKey}/Questionnaires/Responses`, {
1355
+ method: "POST",
1356
+ body: JSON.stringify(body)
1357
+ });
1358
+ }
1359
+ async setBuyer(cartKey, buyer) {
1360
+ return this.fetch(`/api/Cart/${cartKey}/Buyer`, {
1361
+ method: "POST",
1362
+ body: JSON.stringify(buyer)
1363
+ });
1364
+ }
1365
+ async getBuyer(cartKey) {
1366
+ return this.fetch(`/api/Cart/${cartKey}/Buyer`);
1367
+ }
1368
+ async deleteCart(cartKey) {
1369
+ return this.fetchVoid(`/api/Cart/${cartKey}`, {
1370
+ method: "DELETE"
1371
+ });
1372
+ }
1373
+ // ===========================================================================
1374
+ // Payment
1375
+ // ===========================================================================
1376
+ async createPaymentIntent(cartKey, options) {
1377
+ const retryQuery = options?.retry ? "?retry=true" : "";
1378
+ return this.fetch(`/api/Cart/${cartKey}/Payment${retryQuery}`, {
1379
+ method: "POST"
1380
+ });
1381
+ }
1382
+ async getPaymentStatus(cartKey) {
1383
+ return this.fetch(`/api/Cart/${cartKey}/Payment/Status`);
1384
+ }
1385
+ // ===========================================================================
1386
+ // Transactions
1387
+ // ===========================================================================
1388
+ async convertCartToTransaction(cartKey) {
1389
+ return this.fetch("/api/Transactions/FromCart", {
1390
+ method: "POST",
1391
+ body: JSON.stringify({ CartKey: cartKey })
1392
+ });
1393
+ }
1394
+ async getTransactionItems(transactionKey) {
1395
+ return this.fetch(`/api/Transactions/${transactionKey}/Items`);
1396
+ }
1397
+ async getTransactionByCartKey(cartKey) {
1398
+ return this.fetch(`/api/Transactions/ByKey/${cartKey}`);
1399
+ }
1400
+ // ===========================================================================
1401
+ // Attendees
1402
+ // ===========================================================================
1403
+ /**
1404
+ * AMENDS ATTENDEES A TRANSACTION ALREADY OWNS, and refuses everything else with
1405
+ * `AttendeesNotMatchingTransaction`. It cannot create one — the v2 `setItemAttendee`
1406
+ * below is what a first naming goes through.
1407
+ *
1408
+ * THE TRANSACTION-WIDE CALL, and `packages/sdk`'s ticket-confirmation flow still wants
1409
+ * it: it amends an attendee that already exists (buyer-as-holder on a portal-style
1410
+ * purchase) and declines politely where none does. New code should prefer the
1411
+ * key-addressed call, which needs no id read first and cannot erase anybody by omission.
1412
+ */
1413
+ async saveAttendees(transactionKey, attendees) {
1414
+ return this.fetch(`/api/Transactions/${transactionKey}/Attendees`, {
1415
+ method: "PUT",
1416
+ body: JSON.stringify(attendees)
1417
+ });
1418
+ }
1419
+ /**
1420
+ * WHO A TICKET IS FOR — creating the attendee where there is none and rebinding the
1421
+ * ticket where there is, addressed by keys on both counts.
1422
+ *
1423
+ * The route takes the TRANSACTION's key and the ITEM's — the same value the bulk add
1424
+ * returned as `item_key` and the booking reads as `AttendeeTicketKey` — so there is no
1425
+ * attendee id to have read first and nothing integer-shaped on the wire. The platform
1426
+ * scopes the item to the transaction and refuses a pair that does not match with
1427
+ * `ItemNotFound`.
1428
+ *
1429
+ * Answers `204`-shaped success with no body: the call either went or it did not, and the
1430
+ * name it saved is read back on the next booking read rather than off the response.
1431
+ */
1432
+ async setItemAttendee(transactionKey, itemKey, body) {
1433
+ await this.fetchVoid(`/api/v2/Transactions/${transactionKey}/Items/${itemKey}/Attendee`, {
1434
+ method: "PUT",
1435
+ body: JSON.stringify(body)
1436
+ });
1437
+ }
1438
+ // ===========================================================================
1439
+ // Accounts
1440
+ // ===========================================================================
1441
+ //
1442
+ // Transport only: these make the calls and return what comes back. WHICH of them runs
1443
+ // when, and what a failure means, is the account flow's business — see `domain/auth.ts`
1444
+ // and `domain/account-creation.ts` in @scopetickets/checkout.
1445
+ /**
1446
+ * Makes an account, and signs into it.
1447
+ *
1448
+ * `LoginUser` defaults to `true` here and is omitted from the type's own default,
1449
+ * because every caller in this workspace wants the session: an account created without
1450
+ * one leaves the buyer holding credentials they would then have to spend immediately.
1451
+ */
1452
+ async createAccount(body) {
1453
+ return this.fetch("/api/Users", {
1454
+ method: "POST",
1455
+ body: JSON.stringify({ LoginUser: true, ...body })
1456
+ });
1457
+ }
1458
+ /** An address and a password. */
1459
+ async signIn(body) {
1460
+ return this.fetch("/api/Auth/Login", {
1461
+ method: "POST",
1462
+ body: JSON.stringify(body)
1463
+ });
1464
+ }
1465
+ /** Ends the session at the platform. The caller still has to forget its own copy. */
1466
+ async signOut() {
1467
+ return this.fetch("/api/Auth/Logout");
1468
+ }
1469
+ /**
1470
+ * A fresh `Authorization` for a session that still holds its refresh token.
1471
+ *
1472
+ * The answer carries no new refresh token, so the one held is spent again rather than
1473
+ * rotated.
1474
+ */
1475
+ async refreshAuthorization(body) {
1476
+ return this.fetch("/api/Auth/Tokens", {
1477
+ method: "POST",
1478
+ body: JSON.stringify(body)
1479
+ });
1480
+ }
1481
+ /**
1482
+ * WHO THE SESSION BELONGS TO. The one call that turns a header into a person: every
1483
+ * door into an account answers with a `LoginResult` carrying no name, no address and no
1484
+ * key, so this is what the flow asks immediately after one opens.
1485
+ *
1486
+ * IT NEEDS A USER SESSION, not merely the app key. Measured against staging: with no
1487
+ * `Authorization` at all it answers `401 NotAuthorized`, and with the app key alone it
1488
+ * answers `500` — so `hasAuthorization` gates the call rather than the answer being
1489
+ * read for which of the two happened.
1490
+ */
1491
+ async getCurrentUser(signal) {
1492
+ return this.fetch("/api/Users/Me", { signal });
1493
+ }
1494
+ /** The signed-in user's own details. */
1495
+ async updateUser(body) {
1496
+ return this.fetchVoid("/api/Users", { method: "PUT", body: JSON.stringify(body) });
1497
+ }
1498
+ /** Changes the password of the signed-in user, who therefore knows the old one. */
1499
+ async updatePassword(body) {
1500
+ return this.fetchVoid("/api/Users/Password", { method: "PUT", body: JSON.stringify(body) });
1501
+ }
1502
+ /** Starts recovery for somebody who cannot sign in. Needs no session, by definition. */
1503
+ async requestPasswordReset(body) {
1504
+ return this.fetchVoid("/api/Users/PasswordReset", {
1505
+ method: "POST",
1506
+ body: JSON.stringify(body)
1507
+ });
1508
+ }
1509
+ /** Sets the signed-in user's photo. Needs the session, so it runs after creation. */
1510
+ async updatePhoto(body) {
1511
+ return this.fetchVoid("/api/Users/Photo", { method: "PUT", body: JSON.stringify(body) });
1512
+ }
1513
+ // ===========================================================================
1514
+ // Following
1515
+ // ===========================================================================
1516
+ async getFollowing(userKey, signal) {
1517
+ return this.fetch(`/api/Users/${encodeURIComponent(userKey)}/Following`, {
1518
+ signal
1519
+ });
1520
+ }
1521
+ async followOrganisation(userKey, body) {
1522
+ return this.fetchVoid(`/api/Users/${encodeURIComponent(userKey)}/Following/Organisation`, {
1523
+ method: "POST",
1524
+ body: JSON.stringify(body)
1525
+ });
1526
+ }
1527
+ async unfollowOrganisation(userKey, organisationKey) {
1528
+ return this.fetchVoid(
1529
+ `/api/Users/${encodeURIComponent(userKey)}/Following/Organisation/${encodeURIComponent(organisationKey)}`,
1530
+ { method: "DELETE" }
1531
+ );
1532
+ }
1533
+ async followVenue(userKey, body) {
1534
+ return this.fetchVoid(`/api/Users/${encodeURIComponent(userKey)}/Following/Venue`, {
1535
+ method: "POST",
1536
+ body: JSON.stringify(body)
1537
+ });
1538
+ }
1539
+ async unfollowVenue(userKey, venueKey) {
1540
+ return this.fetchVoid(
1541
+ `/api/Users/${encodeURIComponent(userKey)}/Following/Venue/${encodeURIComponent(venueKey)}`,
1542
+ { method: "DELETE" }
1543
+ );
1544
+ }
1545
+ // ===========================================================================
1546
+ // Passkeys
1547
+ // ===========================================================================
1548
+ //
1549
+ // Four calls and no ceremony. The browser half cannot run in a page a customer serves —
1550
+ // see `packages/passkey-host` — so these hand challenges out and take credentials back,
1551
+ // and something on a Scope origin does the part in between.
1552
+ /** Opens a registration. Names nobody: the user comes from the session. */
1553
+ async createPasskeyRegistrationChallenge(body) {
1554
+ return this.fetch("/api/Passkeys/Registrations/Challenges", {
1555
+ method: "POST",
1556
+ body: JSON.stringify(body)
1557
+ });
1558
+ }
1559
+ /** Lodges the credential the device made. */
1560
+ async registerPasskey(body) {
1561
+ return this.fetchVoid("/api/Passkeys/Registrations", {
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;
1805
+ }
1806
+ return TOP_LEVEL_LABEL.test(labels[labels.length - 1]);
1807
+ }
1808
+ var E164 = /^\+[1-9]\d{1,14}$/;
1809
+ function isE164(value) {
1810
+ return E164.test(value.trim());
1811
+ }
1812
+ var CONTROL_CHARACTERS = /[\x00-\x1F\x7F]/;
1813
+ function isAcceptableName(value) {
1814
+ const name = value.trim();
1815
+ return name.length > 0 && name.length <= 256 && !CONTROL_CHARACTERS.test(name);
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
+ }
879
1926
  function flagTone(flag) {
880
1927
  return flag === "none" ? void 0 : flag;
881
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 };
2229
+ }
2230
+ if (parts.dialCode !== null) {
2231
+ return {
2232
+ dialCode: parts.dialCode,
2233
+ /*
2234
+ * A remainder long enough to BE a number takes the row below; one too short to be
2235
+ * anything replaces nothing. `+3531` is a slipped keystroke after a complete code, and
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
+ };
2241
+ }
2242
+ if (digitsOf(raw).length > MAX_DIAL_DIGITS) {
2243
+ return { dialCode: current.dialCode, national: raw };
2244
+ }
2245
+ if (raw.trim().length === 0) return { ...current, dialCode: DEFAULT_DIAL_CODE };
2246
+ return { ...current, dialCode: raw };
2247
+ }
2248
+ function nationalDigits(phone, country) {
2249
+ let digits = digitsOf(phone);
2250
+ const dial = country.dialCode.slice(1);
2251
+ if (digits.startsWith(dial) && digits.length > dial.length) digits = digits.slice(dial.length);
2252
+ const trunk = country.trunkPrefix;
2253
+ if (trunk !== void 0 && digits.startsWith(trunk)) digits = digits.slice(trunk.length);
2254
+ return digits;
2255
+ }
2256
+ function formatNational(value, country) {
2257
+ const digits = digitsOf(value);
2258
+ if (digits.length === 0) return value.trim() === "+" ? "+" : "";
2259
+ const trunk = country.trunkPrefix !== void 0 && digits.startsWith(country.trunkPrefix) ? country.trunkPrefix : "";
2260
+ const nsn = digits.slice(trunk.length);
2261
+ const pattern = country.grouping?.find(
2262
+ (candidate) => nsn.length <= candidate.digits && (candidate.startsWith === void 0 || candidate.startsWith.some((start) => nsn.startsWith(start)))
2263
+ );
2264
+ if (pattern === void 0) return value;
2265
+ const parts = [];
2266
+ let at = 0;
2267
+ for (const size of pattern.groups) {
2268
+ if (at >= nsn.length) break;
2269
+ parts.push(nsn.slice(at, at + size));
2270
+ at += size;
2271
+ }
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";
882
2312
  var GLYPH = {
883
2313
  success: CheckInCircleFilledIcon,
884
2314
  warning: ExclamationMarkInCircleFilledIcon,
@@ -912,7 +2342,7 @@ function Switch({ checked, onChange, label, size = "wide", disabled = false }) {
912
2342
  // src/island/CounterRing.tsx
913
2343
  import { IconGlyph } from "@scopetickets/icons";
914
2344
 
915
- // src/island/island-timer.ts
2345
+ // ../checkout-core/src/geometry/island-timer.ts
916
2346
  var TIMER_GRID = 20;
917
2347
  var TIMER_CENTRE = TIMER_GRID / 2;
918
2348
  var RING_OUTER = 10;
@@ -1034,7 +2464,7 @@ function timerPaths(remaining) {
1034
2464
  return paths;
1035
2465
  }
1036
2466
 
1037
- // src/island/island-counter-ring.ts
2467
+ // ../checkout-core/src/geometry/island-counter-ring.ts
1038
2468
  var RING_OUTER2 = 10;
1039
2469
  var RING_STROKE = 2.5;
1040
2470
  var RING_INNER2 = RING_OUTER2 - RING_STROKE;
@@ -1475,7 +2905,7 @@ function DayPicker({
1475
2905
  row,
1476
2906
  onRowChange: setRow,
1477
2907
  onRowPreview: setShownRow,
1478
- label: "Weeks of the run",
2908
+ label: ISLAND_COPY.runWeeks,
1479
2909
  children: /* @__PURE__ */ jsx11(
1480
2910
  CalendarRunGrid,
1481
2911
  {
@@ -1503,7 +2933,7 @@ var REMAINING_SIZE = "var(--scopetickets-island-space-4)";
1503
2933
  var SELECTED_ARC = "var(--scopetickets-island-timeslot-ring-selected)";
1504
2934
  var TRACK = "var(--scopetickets-island-timeslot-track)";
1505
2935
  var SELECTED_TRACK = "var(--scopetickets-island-timeslot-track-selected)";
1506
- var SOLD_OUT = "Sold Out";
2936
+ var { soldOut: SOLD_OUT, from: FROM } = TIMESLOT_COPY;
1507
2937
  function Timeslot({ cell, accessory, onSelect }) {
1508
2938
  if (isDatePickerCellSelectable(cell.state)) {
1509
2939
  return /* @__PURE__ */ jsx12(TimeslotButton, { cell, accessory, onSelect });
@@ -1511,36 +2941,47 @@ function Timeslot({ cell, accessory, onSelect }) {
1511
2941
  return /* @__PURE__ */ jsx12(TimeslotFixed, { cell });
1512
2942
  }
1513
2943
  function TimeslotRow({ cell }) {
2944
+ const price = slotPrice(cell);
1514
2945
  return /* @__PURE__ */ jsxs7("span", { className: "scopetickets-island-timeslot__times", children: [
1515
2946
  /* @__PURE__ */ jsx12("span", { className: "scopetickets-island-timeslot__time", children: cell.slot.startTime }),
1516
2947
  cell.slot.endTime === null ? null : /* @__PURE__ */ jsxs7(Fragment, { children: [
1517
2948
  /* @__PURE__ */ jsx12("span", { className: "scopetickets-island-timeslot__dash", "aria-hidden": "true", children: "-" }),
1518
2949
  /* @__PURE__ */ jsx12("span", { className: "scopetickets-island-timeslot__time", children: cell.slot.endTime })
1519
2950
  ] }),
1520
- cell.state === "UNAVAILABLE" ? (
1521
- /*
1522
- * THE WORDS INSTEAD OF THE MARK, AND ONLY WHERE THE MARK WOULD SAY NOTHING.
1523
- *
1524
- * `UNAVAILABLE` is the one state the ring cannot draw: `timeslotState` reaches it
1525
- * only for `remaining <= 0`, which is an arc of zero length. A slot that has
1526
- * merely BEGUN keeps its ring — it still has seats, and "Sold Out" over them
1527
- * would be false.
1528
- */
1529
- /* @__PURE__ */ jsx12("span", { className: "scopetickets-island-timeslot__soldout", children: SOLD_OUT })
1530
- ) : cell.slot.remaining === null ? null : /* @__PURE__ */ jsx12("span", { className: "scopetickets-island-timeslot__remaining", children: /* @__PURE__ */ jsx12(
1531
- CounterRing,
1532
- {
1533
- progress: cell.slot.remaining,
1534
- color: cell.state === "SELECTED" ? SELECTED_ARC : availabilityColor(cell.slot.remaining),
1535
- trackColor: cell.state === "SELECTED" ? SELECTED_TRACK : TRACK,
1536
- size: REMAINING_SIZE
1537
- }
1538
- ) })
2951
+ /* @__PURE__ */ jsxs7("span", { className: "scopetickets-island-timeslot__trailing", children: [
2952
+ price === null ? null : /* @__PURE__ */ jsx12("span", { className: "scopetickets-island-timeslot__price", children: price }),
2953
+ cell.state === "UNAVAILABLE" ? (
2954
+ /*
2955
+ * THE WORDS INSTEAD OF THE MARK, AND ONLY WHERE THE MARK WOULD SAY NOTHING.
2956
+ *
2957
+ * `UNAVAILABLE` is the one state the ring cannot draw: `timeslotState` reaches it
2958
+ * only for `remaining <= 0`, which is an arc of zero length. A slot that has
2959
+ * merely BEGUN keeps its ring — it still has seats, and "Sold Out" over them
2960
+ * would be false.
2961
+ */
2962
+ /* @__PURE__ */ jsx12("span", { className: "scopetickets-island-timeslot__soldout", children: SOLD_OUT })
2963
+ ) : cell.slot.remaining === null ? null : /* @__PURE__ */ jsx12("span", { className: "scopetickets-island-timeslot__remaining", children: /* @__PURE__ */ jsx12(
2964
+ CounterRing,
2965
+ {
2966
+ progress: cell.slot.remaining,
2967
+ color: cell.state === "SELECTED" ? SELECTED_ARC : availabilityColor(cell.slot.remaining),
2968
+ trackColor: cell.state === "SELECTED" ? SELECTED_TRACK : TRACK,
2969
+ size: REMAINING_SIZE
2970
+ }
2971
+ ) })
2972
+ ] })
1539
2973
  ] });
1540
2974
  }
2975
+ function slotPrice(cell, spoken = false) {
2976
+ if (!isDatePickerCellSelectable(cell.state)) return null;
2977
+ const price = cell.slot.fromPrice;
2978
+ if (price === void 0 || price === null) return null;
2979
+ const money = formatMoney(price.minorUnits, price.currency);
2980
+ return spoken ? `${FROM} ${money}` : money;
2981
+ }
1541
2982
  function timeslotLabel(cell, announcement) {
1542
2983
  const range = cell.slot.endTime === null ? cell.slot.startTime : `${cell.slot.startTime} - ${cell.slot.endTime}`;
1543
- return [range, cell.duration, announcement].filter((part) => part !== null).join(", ");
2984
+ return [range, cell.duration, slotPrice(cell, true), announcement].filter((part) => part !== null).join(", ");
1544
2985
  }
1545
2986
  function TimeslotButton({ cell, accessory, onSelect }) {
1546
2987
  const press = useIslandPress("element");
@@ -1707,7 +3148,7 @@ function SelectedDayHeading({ day }) {
1707
3148
  ] });
1708
3149
  }
1709
3150
 
1710
- // src/island/island-step-order.ts
3151
+ // ../checkout-core/src/motion/island-step-order.ts
1711
3152
  function dayDirection(from, to) {
1712
3153
  if (from === to) return "NONE";
1713
3154
  return to > from ? "FORWARD" : "BACKWARD";
@@ -1718,9 +3159,7 @@ function stepDirectionSign(direction) {
1718
3159
  return 0;
1719
3160
  }
1720
3161
 
1721
- // src/island/island-day-swap.ts
1722
- var DAY_SWAP_OUT_ANIMATION = "scopetickets-island-day-swap-out";
1723
- var DAY_SWAP_IN_ANIMATION = "scopetickets-island-day-swap-in";
3162
+ // ../checkout-core/src/motion/island-day-swap.ts
1724
3163
  function daySwapAtRest(content) {
1725
3164
  return { phase: "REST", shown: content };
1726
3165
  }
@@ -1750,6 +3189,10 @@ function reduceDaySwap(state, event) {
1750
3189
  }
1751
3190
  }
1752
3191
 
3192
+ // src/island/island-day-swap-css.ts
3193
+ var DAY_SWAP_OUT_ANIMATION = "scopetickets-island-day-swap-out";
3194
+ var DAY_SWAP_IN_ANIMATION = "scopetickets-island-day-swap-in";
3195
+
1753
3196
  // src/island/TimePicker.tsx
1754
3197
  import { jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
1755
3198
  function TimePicker({
@@ -1900,15 +3343,14 @@ export {
1900
3343
  SURFACE_SPRING,
1901
3344
  CARRY_SPRING,
1902
3345
  POP_RETURN_SPRING,
1903
- springEasing,
3346
+ settleMs,
3347
+ springAt,
1904
3348
  OUTGOING_FADE_MS,
1905
3349
  SURFACE_MORPH_DELAY_MS,
1906
3350
  INCOMING_FADE_DELAY_MS,
1907
3351
  INCOMING_FADE_MS,
1908
3352
  CARRY_MOVE_DELAY_MS,
1909
3353
  CARRY_MOVE_MS,
1910
- ARC_LEAD_EASING,
1911
- ARC_TRAIL_EASING,
1912
3354
  POP_SCALE,
1913
3355
  SHIELD_POP_SCALE,
1914
3356
  POP_RETURN_MS,
@@ -1922,6 +3364,64 @@ export {
1922
3364
  HOLD_TICK_MS,
1923
3365
  PressContext,
1924
3366
  useIslandPress,
3367
+ FIELD_COPY,
3368
+ ACTION_COPY,
3369
+ DISMISS_COPY,
3370
+ ISLAND_COPY,
3371
+ resolveEnvironmentUrls,
3372
+ ApiError,
3373
+ ScopeClient,
3374
+ CARRIED_CHECKOUT_PARAMS,
3375
+ buildFrameUrl,
3376
+ allowedFrameOrigin,
3377
+ parseFrameEvent,
3378
+ buildConfigMessage,
3379
+ buildSubmitConfirmedMessage,
3380
+ buildSubmitRejectedMessage,
3381
+ buildTriggerSubmitMessage,
3382
+ buildCancelRequestedMessage,
3383
+ isAcceptableName,
3384
+ isValidEmail,
3385
+ flagTone,
3386
+ emailFlag,
3387
+ emailFlagTitle,
3388
+ DEFAULT_COUNTRY_CODE,
3389
+ countryByCode,
3390
+ DEFAULT_DIAL_CODE,
3391
+ countryByDialCode,
3392
+ routePhoneInput,
3393
+ formatNational,
3394
+ isValidPhone,
3395
+ phoneFlag,
3396
+ e164,
3397
+ normalizeE164,
3398
+ isCompleteName,
3399
+ splitFullName,
3400
+ SOLO_KEY,
3401
+ groupUserTypes,
3402
+ partyTypes,
3403
+ assignmentFor,
3404
+ userTypeNames,
3405
+ clampRemaining,
3406
+ trackPaths,
3407
+ timerPaths,
3408
+ formatMoney,
3409
+ moneyParts,
3410
+ widestAmount,
3411
+ quoteLines,
3412
+ slotFullness,
3413
+ parseWallClockTime,
3414
+ timeOfDayInZone,
3415
+ dayInZone,
3416
+ partOfDayLabel,
3417
+ partOfDay,
3418
+ formatSlotRange,
3419
+ formatSlotDuration,
3420
+ withSelectedDay,
3421
+ withSelectedTime,
3422
+ sameTimeslots,
3423
+ buildTimeslotGroups,
3424
+ timeslotRequest,
1925
3425
  toAvailabilityLevel,
1926
3426
  readAvailability,
1927
3427
  availabilityColor,
@@ -1956,34 +3456,13 @@ export {
1956
3456
  monthAtRow,
1957
3457
  monthOpeningRow,
1958
3458
  toggleSelectedDay,
1959
- slotFullness,
1960
- parseWallClockTime,
1961
- timeOfDayInZone,
1962
- partOfDayLabel,
1963
- partOfDay,
1964
- formatSlotRange,
1965
- formatSlotDuration,
1966
- withSelectedDay,
1967
- withSelectedTime,
1968
- sameTimeslots,
1969
- buildTimeslotGroups,
1970
- timeslotRequest,
1971
- groupUserTypes,
1972
- partyTypes,
1973
- assignmentFor,
1974
- userTypeNames,
1975
3459
  PartyStepper,
1976
- SOLO_KEY,
1977
- flagTone,
1978
3460
  ContentFlag,
1979
3461
  Switch,
1980
- clampRemaining,
1981
- trackPaths,
1982
- timerPaths,
1983
3462
  CounterRing,
1984
3463
  DayPicker,
1985
3464
  TimeslotPicker,
1986
3465
  TimePicker,
1987
3466
  CalendarGrainButton
1988
3467
  };
1989
- //# sourceMappingURL=chunk-GJZKPJB5.js.map
3468
+ //# sourceMappingURL=chunk-WT7WSYIH.js.map