@scopetickets/checkout 0.2.0 → 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.
@@ -135,43 +135,6 @@ function useIslandPress(scope = "island") {
135
135
  return whole || !pressedHere ? handlers : { ...handlers, "data-pressed": "" };
136
136
  }
137
137
 
138
- // ../checkout-core/src/domain/money.ts
139
- var MONEY_LOCALE = "en-IE";
140
- function formatterFor(currency) {
141
- return new Intl.NumberFormat(MONEY_LOCALE, { style: "currency", currency });
142
- }
143
- function minorUnitDigits(formatter) {
144
- return formatter.resolvedOptions().maximumFractionDigits ?? 2;
145
- }
146
- function formatMoney(minorUnits, currency) {
147
- const formatter = formatterFor(currency);
148
- return formatter.format(minorUnits / 10 ** minorUnitDigits(formatter));
149
- }
150
- function moneyParts(minorUnits, currency) {
151
- const formatter = formatterFor(currency);
152
- const digits = minorUnitDigits(formatter);
153
- const plain = new Intl.NumberFormat(MONEY_LOCALE, {
154
- minimumFractionDigits: digits,
155
- maximumFractionDigits: digits
156
- });
157
- const value = minorUnits / 10 ** digits;
158
- const magnitude = Math.abs(value);
159
- const symbol = formatter.format(magnitude).replace(plain.format(magnitude), "").replace(/\s/gu, "");
160
- return { symbol, amount: plain.format(value) };
161
- }
162
- function widestAmount(amounts) {
163
- return amounts.reduce((widest, amount) => Math.max(widest, amount.length), 0);
164
- }
165
- function quoteLines(quote) {
166
- if (quote.kind === "NONE") return null;
167
- const headline = formatMoney(quote.minorUnits, quote.currency);
168
- if (quote.kind === "FROM") return { qualifier: "From", headline };
169
- if (quote.kind === "SAVING") {
170
- return { qualifier: `Save ${formatMoney(quote.savedMinorUnits, quote.currency)}`, headline };
171
- }
172
- return { qualifier: null, headline };
173
- }
174
-
175
138
  // ../checkout-core/src/domain/user-types.ts
176
139
  var SOLO_KEY = "default";
177
140
  function agreed(values) {
@@ -209,6 +172,43 @@ function userTypeNames(rows) {
209
172
  return Object.fromEntries(rows.map((row) => [row.AssignmentKey, row.Name]));
210
173
  }
211
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
212
  // ../checkout-core/src/domain/island-timeslots.ts
213
213
  function slotFullness(remaining, total) {
214
214
  if (!Number.isFinite(remaining) || remaining < 0) return null;
@@ -375,15 +375,28 @@ var RAMP = [
375
375
  [HIGH_FROM, 67],
376
376
  [1, 100]
377
377
  ];
378
- function availabilityColor(remaining) {
379
- const stop = (suffix) => `var(--scopetickets-island-availability-${suffix})`;
380
- if (remaining === null || !Number.isFinite(remaining) || remaining <= 0) return stop(0);
381
- 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);
382
386
  const top = RAMP.findIndex(([at]) => remaining <= at);
383
387
  const [lowAt, lowStop] = RAMP[top - 1];
384
388
  const [highAt, highStop] = RAMP[top];
385
- const towards = Math.round((remaining - lowAt) / (highAt - lowAt) * 100);
386
- 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)})`;
387
400
  }
388
401
  function isDatePickerCellSelectable(state) {
389
402
  return state === "AVAILABLE" || state === "SELECTED";
@@ -666,7 +679,16 @@ var PARTY_COPY = {
666
679
  remove: (name) => `Remove one ${name}`,
667
680
  add: (name) => `Add one ${name}`,
668
681
  count: (count, name) => `${count} ${name}. Change the number`,
669
- field: (name) => `Number of ${name}`
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"
670
692
  };
671
693
  var ACTION_COPY = {
672
694
  cancel: "Cancel",
@@ -675,10 +697,36 @@ var ACTION_COPY = {
675
697
  payNow: "Pay Now",
676
698
  tryAgain: "Try Again"
677
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
+ };
678
710
  var ISLAND_COPY = {
679
711
  order: "Your order",
680
712
  runWeeks: "Weeks of the run"
681
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
+ };
682
730
 
683
731
  // src/island/PartyStepper.tsx
684
732
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -892,7 +940,7 @@ function PartyStepper({
892
940
  counts,
893
941
  onChange,
894
942
  max,
895
- soloName = "Guests",
943
+ soloName = PARTY_COPY.soloName,
896
944
  onRefuse,
897
945
  refused = null
898
946
  }) {
@@ -946,10 +994,1321 @@ import {
946
994
  ExclamationMarkInCircleFilledIcon,
947
995
  XMarkInCircleFilledIcon
948
996
  } from "@scopetickets/icons";
949
- 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
+ }
950
1926
  function flagTone(flag) {
951
1927
  return flag === "none" ? void 0 : flag;
952
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";
953
2312
  var GLYPH = {
954
2313
  success: CheckInCircleFilledIcon,
955
2314
  warning: ExclamationMarkInCircleFilledIcon,
@@ -1574,8 +2933,7 @@ var REMAINING_SIZE = "var(--scopetickets-island-space-4)";
1574
2933
  var SELECTED_ARC = "var(--scopetickets-island-timeslot-ring-selected)";
1575
2934
  var TRACK = "var(--scopetickets-island-timeslot-track)";
1576
2935
  var SELECTED_TRACK = "var(--scopetickets-island-timeslot-track-selected)";
1577
- var SOLD_OUT = "Sold Out";
1578
- var FROM = "From";
2936
+ var { soldOut: SOLD_OUT, from: FROM } = TIMESLOT_COPY;
1579
2937
  function Timeslot({ cell, accessory, onSelect }) {
1580
2938
  if (isDatePickerCellSelectable(cell.state)) {
1581
2939
  return /* @__PURE__ */ jsx12(TimeslotButton, { cell, accessory, onSelect });
@@ -2008,16 +3366,49 @@ export {
2008
3366
  useIslandPress,
2009
3367
  FIELD_COPY,
2010
3368
  ACTION_COPY,
3369
+ DISMISS_COPY,
2011
3370
  ISLAND_COPY,
2012
- formatMoney,
2013
- moneyParts,
2014
- widestAmount,
2015
- quoteLines,
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,
2016
3400
  SOLO_KEY,
2017
3401
  groupUserTypes,
2018
3402
  partyTypes,
2019
3403
  assignmentFor,
2020
3404
  userTypeNames,
3405
+ clampRemaining,
3406
+ trackPaths,
3407
+ timerPaths,
3408
+ formatMoney,
3409
+ moneyParts,
3410
+ widestAmount,
3411
+ quoteLines,
2021
3412
  slotFullness,
2022
3413
  parseWallClockTime,
2023
3414
  timeOfDayInZone,
@@ -2065,11 +3456,7 @@ export {
2065
3456
  monthAtRow,
2066
3457
  monthOpeningRow,
2067
3458
  toggleSelectedDay,
2068
- clampRemaining,
2069
- trackPaths,
2070
- timerPaths,
2071
3459
  PartyStepper,
2072
- flagTone,
2073
3460
  ContentFlag,
2074
3461
  Switch,
2075
3462
  CounterRing,
@@ -2078,4 +3465,4 @@ export {
2078
3465
  TimePicker,
2079
3466
  CalendarGrainButton
2080
3467
  };
2081
- //# sourceMappingURL=chunk-B7AHG2OO.js.map
3468
+ //# sourceMappingURL=chunk-WT7WSYIH.js.map