@scopetickets/checkout 0.6.1 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -145,13 +145,14 @@ function CardAction({ action, tapped = false }) {
145
145
  type: "button",
146
146
  className: `scopetickets-island-button scopetickets-island-button--${action.role} scopetickets-island-button--block${action.mark === void 0 ? "" : ` scopetickets-island-button--marked-${action.mark.spacing ?? "separate"}`}${action.disabled ? " scopetickets-island-button--disabled" : ""}`,
147
147
  "aria-disabled": action.disabled === true ? true : void 0,
148
- "aria-label": alone && typeof action.label === "string" ? action.label : void 0,
149
- onClick: action.disabled === true ? void 0 : action.onPress,
148
+ "aria-busy": action.busy === true ? "true" : void 0,
149
+ "aria-label": (alone || action.busy === true) && typeof action.label === "string" ? action.label : void 0,
150
+ onClick: action.disabled === true || action.busy === true ? void 0 : action.onPress,
150
151
  ...press,
151
152
  "data-pressed": held ? "" : void 0,
152
153
  children: [
153
154
  action.mark?.side === "leading" ? mark : null,
154
- alone ? /* @__PURE__ */ jsx2("span", { className: "scopetickets-island-button__mark--alone", "aria-hidden": "true", children: action.mark?.node }) : action.label,
155
+ action.busy === true ? /* @__PURE__ */ jsx2("span", { className: "scopetickets-island-spinner", "aria-hidden": "true" }) : alone ? /* @__PURE__ */ jsx2("span", { className: "scopetickets-island-button__mark--alone", "aria-hidden": "true", children: action.mark?.node }) : action.label,
155
156
  action.mark?.side === "trailing" ? mark : null
156
157
  ]
157
158
  }
@@ -1700,6 +1701,9 @@ var FUNNEL_COPY = {
1700
1701
  refused: "That email and password did not match. Please try again.",
1701
1702
  working: "Checking your details\u2026"
1702
1703
  };
1704
+ var FREE_ORDER_COPY = {
1705
+ processing: { title: "Booking", subtitle: "This may take a moment." }
1706
+ };
1703
1707
  var PROMO_COPY = {
1704
1708
  /** The trailing half of the commit pill. */
1705
1709
  open: "Promo Code",
@@ -1708,6 +1712,10 @@ var PROMO_COPY = {
1708
1712
  field: "Promo Code",
1709
1713
  apply: "Apply",
1710
1714
  remove: "Remove",
1715
+ /** Once a code is on the order: back to Review, where the price it took off is paid. */
1716
+ continue: "Continue",
1717
+ /** The card's own way out — the header draws none on this card. */
1718
+ back: "Back",
1711
1719
  /** What the card says once a code is on the order. `saved` is already written money. */
1712
1720
  saved: (saved) => `${saved} Saved`,
1713
1721
  /** The mark on an accepted field, for anyone who cannot see it. */
@@ -1776,6 +1784,7 @@ var JOURNEY_COPY = {
1776
1784
  };
1777
1785
  var PASSKEY_BUTTON_LABEL = "Add Passkey";
1778
1786
  var COMPOSE_FUNNEL_LABEL = "Your ticket selection";
1787
+ var HOLDING_TICKETS = "Holding your tickets\u2026";
1779
1788
  var POWERED_BY = [
1780
1789
  { kind: "TEXT", text: "Powered by" },
1781
1790
  { kind: "MARK", mark: "SCOPE_TICKETS_WORDMARK" }
@@ -3403,7 +3412,7 @@ function FunnelStep({
3403
3412
 
3404
3413
  // src/island/IslandCommitPill.tsx
3405
3414
  import { ShoppingCartIcon } from "@scopetickets/icons";
3406
- import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
3415
+ import { Fragment as Fragment2, jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
3407
3416
  function IslandCommitPill({
3408
3417
  onOpenCart,
3409
3418
  cartLabel,
@@ -3424,17 +3433,19 @@ function IslandCommitPill({
3424
3433
  children: /* @__PURE__ */ jsx11("span", { className: "scopetickets-island-glyph-slot", "aria-hidden": "true", children: /* @__PURE__ */ jsx11(ShoppingCartIcon, { fill: true, color: "currentColor" }) })
3425
3434
  }
3426
3435
  ),
3427
- /* @__PURE__ */ jsx11("span", { className: "scopetickets-island-commit__rule", "aria-hidden": "true" }),
3428
- /* @__PURE__ */ jsx11(
3429
- "button",
3430
- {
3431
- type: "button",
3432
- className: "scopetickets-island-commit__target scopetickets-island-commit__promo",
3433
- onClick: onOpenPromo,
3434
- ...promoPress,
3435
- children: promoLabel
3436
- }
3437
- )
3436
+ promoLabel === void 0 ? null : /* @__PURE__ */ jsxs7(Fragment2, { children: [
3437
+ /* @__PURE__ */ jsx11("span", { className: "scopetickets-island-commit__rule", "aria-hidden": "true" }),
3438
+ /* @__PURE__ */ jsx11(
3439
+ "button",
3440
+ {
3441
+ type: "button",
3442
+ className: "scopetickets-island-commit__target scopetickets-island-commit__promo",
3443
+ onClick: onOpenPromo,
3444
+ ...promoPress,
3445
+ children: promoLabel
3446
+ }
3447
+ )
3448
+ ] })
3438
3449
  ] });
3439
3450
  }
3440
3451
 
@@ -3453,6 +3464,9 @@ function toQuote(cart, currency) {
3453
3464
  if (currency === void 0) return void 0;
3454
3465
  return { kind: "TOTAL", minorUnits: cart.TotalAmount, currency };
3455
3466
  }
3467
+ function nothingToPay(cart, itemCount) {
3468
+ return cart !== null && itemCount > 0 && cart.TotalAmount <= 0;
3469
+ }
3456
3470
  var ESCROW_WINDOW_SECONDS = 5 * 60;
3457
3471
  function withExpiry(cart, heldFrom) {
3458
3472
  return {
@@ -3596,7 +3610,8 @@ var IDLE_ORDER = {
3596
3610
  answers: { status: "IDLE" },
3597
3611
  answersLanded: null,
3598
3612
  eventQuestions: { status: "IDLE" },
3599
- promo: { status: "IDLE" }
3613
+ promo: { status: "IDLE" },
3614
+ acceptedPromo: null
3600
3615
  };
3601
3616
  var NOTHING = [];
3602
3617
  var UNEXPLAINED_FAILURE = "Your payment could not be completed.";
@@ -3664,6 +3679,7 @@ var EMPTIED = {
3664
3679
  eventQuestions: { status: "IDLE" },
3665
3680
  answers: { status: "IDLE" },
3666
3681
  promo: { status: "IDLE" },
3682
+ acceptedPromo: null,
3667
3683
  sheet: { status: "IDLE" },
3668
3684
  completedPreviously: false
3669
3685
  };
@@ -3731,7 +3747,9 @@ function reduceOrder(state, event) {
3731
3747
  reservation,
3732
3748
  /* The old cart is gone from here the moment we ask for another. */
3733
3749
  ...giveBack ? EMPTIED : {},
3734
- opening: { kind: "ASKING", mark: event.mark, ask: event.ask }
3750
+ opening: { kind: "ASKING", mark: event.mark, ask: event.ask },
3751
+ /* Unknown from this press, so nothing reads the wait as a run that asks nothing. */
3752
+ ...event.adopt ? {} : { eventQuestions: { status: "LOADING" } }
3735
3753
  },
3736
3754
  effects: [
3737
3755
  ...giveBack && state.cart !== null ? [
@@ -3795,6 +3813,8 @@ function reduceOrder(state, event) {
3795
3813
  state: {
3796
3814
  ...state,
3797
3815
  opening: state.opening === null ? null : { ...state.opening, kind: "REFUSED" },
3816
+ /* No cart, so no questions to wait on: the refusal is the whole of the card. */
3817
+ eventQuestions: { status: "IDLE" },
3798
3818
  fill: event.fill
3799
3819
  },
3800
3820
  effects: NOTHING
@@ -3815,6 +3835,18 @@ function reduceOrder(state, event) {
3815
3835
  effects: [{ kind: "READ_QUESTIONS", reservation: state.reservation, cart: state.cart }]
3816
3836
  };
3817
3837
  }
3838
+ /*
3839
+ * ONLY WHILE THE CART IS STILL COMING — once it lands, it carried this same read. A failure
3840
+ * waits for it too: Try Again reads against the cart, so a notice raised before there was
3841
+ * one would offer a button that could do nothing.
3842
+ */
3843
+ case "QUESTIONS_AHEAD_OF_CART": {
3844
+ if (!isCurrent(state.reservation, event.reservation)) return { state, effects: NOTHING };
3845
+ if (state.opening?.kind !== "ASKING" || event.load.status === "FAILED") {
3846
+ return { state, effects: NOTHING };
3847
+ }
3848
+ return { state: { ...state, eventQuestions: event.load }, effects: NOTHING };
3849
+ }
3818
3850
  case "QUESTIONS_READ": {
3819
3851
  if (!isCurrent(state.reservation, event.reservation)) return { state, effects: NOTHING };
3820
3852
  if (state.cart?.Key !== event.cartKey) return { state, effects: NOTHING };
@@ -3866,6 +3898,22 @@ function reduceOrder(state, event) {
3866
3898
  }
3867
3899
  case "CHARGE_ATTEMPTED":
3868
3900
  return arm(state, "CHARGED", event.finalizes === true, void 0, event.method);
3901
+ /*
3902
+ * A FREE ORDER IS CONVERTED, NOT WATCHED. There is no payment for a status poll to
3903
+ * follow — the platform answers `409 InvalidPayment` for the status of a zero cart — so
3904
+ * this goes straight to `landed`, whose `FINALIZE` is the same `FromCart` a paid order
3905
+ * ends on, with the same retry and the same `PROVIDER_SETTLED` at the end.
3906
+ *
3907
+ * THE GUARD IS THE REDUCER'S, NOT THE CALLER'S: a cart with money on it must never be
3908
+ * converted by this road, whatever pressed it. Nor twice — a second press while one is
3909
+ * finalizing, or after the order is placed, is nothing.
3910
+ */
3911
+ case "NOTHING_TO_PAY":
3912
+ if (!nothingToPay(state.cart, state.items.length)) return { state, effects: NOTHING };
3913
+ if (state.watch.kind === "FINALIZING" || moneyMoved(state.payment)) {
3914
+ return { state, effects: NOTHING };
3915
+ }
3916
+ return landed(state, true);
3869
3917
  case "SHEET_OPENING":
3870
3918
  return {
3871
3919
  state: {
@@ -3977,7 +4025,8 @@ function reduceOrder(state, event) {
3977
4025
  ...event.cart,
3978
4026
  ExpirationTime: state.cart?.ExpirationTime ?? event.cart.ExpirationTime
3979
4027
  },
3980
- promo: { status: "IDLE" }
4028
+ promo: { status: "IDLE" },
4029
+ acceptedPromo: event.code === void 0 ? state.acceptedPromo : event.code
3981
4030
  },
3982
4031
  effects: NOTHING
3983
4032
  };
@@ -4158,9 +4207,9 @@ function mergeQuestions(eventQuestions, ticketQuestions) {
4158
4207
  return merged;
4159
4208
  }
4160
4209
  function questionsInHand(ticketQuestions, load, hasCart) {
4161
- if (!hasCart) return { status: "READY", questions: guardQuestions(ticketQuestions) };
4162
4210
  switch (load.status) {
4163
4211
  case "IDLE":
4212
+ return hasCart ? { status: "PENDING" } : { status: "READY", questions: guardQuestions(ticketQuestions) };
4164
4213
  case "LOADING":
4165
4214
  return { status: "PENDING" };
4166
4215
  case "LOADED":
@@ -4193,8 +4242,24 @@ function questionPages(questions, host) {
4193
4242
  (question) => !questionAnswered(questionKind(question), host[String(question.QuestionId)])
4194
4243
  );
4195
4244
  }
4196
- function questionOnPage(pages, at) {
4197
- return pages.find((question) => question.QuestionId === at) ?? pages[0] ?? null;
4245
+ function questionCards(questions, host, grouping = "question") {
4246
+ const pages = questionPages(questions, host);
4247
+ switch (grouping) {
4248
+ case "question":
4249
+ return pages.map((question) => [question]);
4250
+ case "all":
4251
+ return pages.length === 0 ? [] : [pages];
4252
+ default: {
4253
+ const exhaustive = grouping;
4254
+ return exhaustive;
4255
+ }
4256
+ }
4257
+ }
4258
+ function questionCardIds(cards) {
4259
+ return cards.flatMap((card2) => card2.slice(0, 1).map((question) => question.QuestionId));
4260
+ }
4261
+ function questionCardOnPage(cards, at) {
4262
+ return cards.find((card2) => card2[0]?.QuestionId === at) ?? cards[0] ?? [];
4198
4263
  }
4199
4264
 
4200
4265
  // ../checkout-core/src/machine/save-for-charge.ts
@@ -6320,7 +6385,7 @@ function param(value) {
6320
6385
  }
6321
6386
 
6322
6387
  // src/version.ts
6323
- var CHECKOUT_VERSION = "0.6.1";
6388
+ var CHECKOUT_VERSION = "0.6.3";
6324
6389
 
6325
6390
  // src/data/useCheckoutEvents.ts
6326
6391
  function useCheckoutEvents(observed, { applicationKey, inventories, onEvent, logger = browserLogger }) {
@@ -7492,7 +7557,15 @@ function createOrderStore(parts, seed = IDLE_ORDER) {
7492
7557
  case "OPEN_CART": {
7493
7558
  const { reservation, mark, ask } = effect;
7494
7559
  const asked = intentHeadcount(ask.composition);
7495
- loading(parts.gateway.open(mark, ask), reservation, asked);
7560
+ loading(
7561
+ parts.gateway.open(
7562
+ mark,
7563
+ ask,
7564
+ (load) => dispatch({ kind: "QUESTIONS_AHEAD_OF_CART", reservation, load })
7565
+ ),
7566
+ reservation,
7567
+ asked
7568
+ );
7496
7569
  return;
7497
7570
  }
7498
7571
  case "READ_CART": {
@@ -7633,7 +7706,7 @@ function createOrderStore(parts, seed = IDLE_ORDER) {
7633
7706
  });
7634
7707
  return refusal === null;
7635
7708
  };
7636
- const writePromo = async (write) => {
7709
+ const writePromo = async (write, code) => {
7637
7710
  const taken = state.reservation;
7638
7711
  const cartKey = state.cart?.Key;
7639
7712
  if (cartKey === void 0) return false;
@@ -7644,12 +7717,34 @@ function createOrderStore(parts, seed = IDLE_ORDER) {
7644
7717
  return false;
7645
7718
  }
7646
7719
  if (!written.ok) {
7720
+ const reread = await rereadAfterRefusal(cartKey);
7721
+ if (!stillOurs(taken)) {
7722
+ dispatch({ kind: "PROMO_SETTLED" });
7723
+ return false;
7724
+ }
7725
+ if (reread !== null) {
7726
+ dispatch({ kind: "PROMO_WRITTEN", cart: reread, code });
7727
+ return true;
7728
+ }
7647
7729
  dispatch({ kind: "PROMO_REFUSED", reason: written.reason });
7648
7730
  return false;
7649
7731
  }
7650
- dispatch({ kind: "PROMO_WRITTEN", cart: written.cart });
7732
+ dispatch({ kind: "PROMO_WRITTEN", cart: written.cart, code });
7651
7733
  return true;
7652
7734
  };
7735
+ const rereadAfterRefusal = async (cartKey) => {
7736
+ const before = state.cart;
7737
+ if (before === null) return null;
7738
+ try {
7739
+ const load = await parts.gateway.adopt(cartKey);
7740
+ if (!load.ok) return null;
7741
+ const after2 = load.opening.cart;
7742
+ const moved = after2.TotalAmount !== before.TotalAmount || (after2.PromoCode ?? null) !== (before.PromoCode ?? null);
7743
+ return moved ? after2 : null;
7744
+ } catch {
7745
+ return null;
7746
+ }
7747
+ };
7653
7748
  const charge = async (method, email) => {
7654
7749
  const taken = state.reservation;
7655
7750
  const cartKey = state.cart?.Key;
@@ -7771,34 +7866,26 @@ function createOrderStore(parts, seed = IDLE_ORDER) {
7771
7866
  saveAnswers,
7772
7867
  charge,
7773
7868
  /*
7774
- * CHECKED FIRST, THEN APPLIED — two calls, and the first one is the only thing that
7775
- * can say WHY. A check that could not be MADE is not a code that was refused: the card
7776
- * goes quiet and the fault travels, which is where `notices` takes it.
7869
+ * APPLIED STRAIGHT TO THE CART — one call, no `checkPromo` first. The cart's write is
7870
+ * the authority: it applies the code or refuses it with the platform's reason
7871
+ * ("The promo code does not apply to any of the items"), which `writePromo` puts on
7872
+ * the card. The check asked the same question of the whole platform instead of this
7873
+ * cart, and on production it cost ~8 s per row of the code: 25 s for a code with a row
7874
+ * on each of three days, a 500 at 30 s past that — measured 2026-11-10, while the cart
7875
+ * write answered in 0.03 s. A write that could not be MADE is not a code that was
7876
+ * refused: the card goes quiet and the fault travels, which is where `notices` takes it.
7777
7877
  */
7778
7878
  applyPromo: async (code) => {
7779
- const taken = state.reservation;
7780
- const cart = state.cart;
7781
- if (cart === null) return false;
7879
+ if (state.cart === null) return false;
7782
7880
  const typed = code.trim();
7783
- dispatch({ kind: "PROMO_WRITING" });
7784
- let checked;
7785
7881
  try {
7786
- checked = await parts.gateway.checkPromo(typed, cart.EventId);
7882
+ return await writePromo((cartKey) => parts.gateway.writePromo(cartKey, typed), typed);
7787
7883
  } catch (cause) {
7788
7884
  dispatch({ kind: "PROMO_SETTLED" });
7789
7885
  throw cause;
7790
7886
  }
7791
- if (!stillOurs(taken)) {
7792
- dispatch({ kind: "PROMO_SETTLED" });
7793
- return false;
7794
- }
7795
- if (!checked.ok) {
7796
- dispatch({ kind: "PROMO_REFUSED", reason: checked.reason });
7797
- return false;
7798
- }
7799
- return writePromo((cartKey) => parts.gateway.writePromo(cartKey, typed));
7800
7887
  },
7801
- removePromo: () => writePromo((cartKey) => parts.gateway.clearPromo(cartKey)),
7888
+ removePromo: () => writePromo((cartKey) => parts.gateway.clearPromo(cartKey), null),
7802
7889
  /*
7803
7890
  * Not a kill switch: a host in StrictMode mounts, unmounts and mounts again over the
7804
7891
  * same store, and a permanently dead one would never open a cart. Answers still in
@@ -8344,8 +8431,13 @@ function promoSaved(cart, currency) {
8344
8431
  if (typeof saved !== "number" || !Number.isFinite(saved) || saved <= 0) return null;
8345
8432
  return formatMoney(saved, currency);
8346
8433
  }
8347
- function promoApplied(cart) {
8348
- return cart === null ? null : bounded(cart.PromoCode, WIRE_LIMITS.promoCode);
8434
+ function promoApplied(cart, accepted = null) {
8435
+ if (cart === null) return null;
8436
+ const named = bounded(cart.PromoCode, WIRE_LIMITS.promoCode);
8437
+ if (named !== null) return named;
8438
+ const saved = cart.PromoSavingAmount;
8439
+ if (typeof saved !== "number" || !Number.isFinite(saved) || saved <= 0) return null;
8440
+ return bounded(accepted, WIRE_LIMITS.promoCode);
8349
8441
  }
8350
8442
  var PROMO_REFUSED = "That code cannot be used on this order.";
8351
8443
  function promoRefusal(reason, fallback) {
@@ -8383,11 +8475,13 @@ async function writtenAnyway(client, cartKey) {
8383
8475
  }
8384
8476
  function orderGateway(client, clock) {
8385
8477
  return {
8386
- async open(mark, ask) {
8478
+ async open(mark, ask, questionsAhead) {
8387
8479
  let asking = `opening a cart on '${mark}'`;
8388
8480
  try {
8389
8481
  const at = clock.now();
8390
8482
  const cart = withExpiry(await client.createCart(mark), at);
8483
+ const questions = readQuestions(client, cart);
8484
+ if (questionsAhead !== void 0) void questions.then(questionsAhead);
8391
8485
  asking = `reading the tickets on '${mark}'`;
8392
8486
  const tickets = await readDayTickets(client, mark, ask.inventories, {
8393
8487
  timeslots: true,
@@ -8400,11 +8494,11 @@ function orderGateway(client, clock) {
8400
8494
  throw new Error(
8401
8495
  `no product on '${mark}' sells the ${session.LocalStartTime}\u2013${session.LocalEndTime} session the buyer was offered`
8402
8496
  );
8403
- return empty(client, cart, at, void 0, void 0);
8497
+ return empty(cart, at, void 0, void 0, questions);
8404
8498
  }
8405
8499
  const money = product.Currency ?? void 0;
8406
8500
  const requested = itemsFor({ composition: ask.composition, timeslot: session }, product);
8407
- if (requested.length === 0) return empty(client, cart, at, money, product.Name);
8501
+ if (requested.length === 0) return empty(cart, at, money, product.Name, questions);
8408
8502
  const sold = sessionOn(product, session);
8409
8503
  asking = `filling cart '${cart.Key}' on '${mark}' with ${requested.length} \xD7 '${product.Key}' (Available: ${product.Available})` + (session === void 0 ? "" : ` at ${session.LocalStartTime}\u2013${session.LocalEndTime}`) + (sold === void 0 ? "" : ` (session Total: ${sold.Total}, Remaining: ${sold.Remaining})`);
8410
8504
  const filled = await client.addItemsBulk(cart.Key, requested, { allowPartial: true });
@@ -8425,7 +8519,7 @@ function orderGateway(client, clock) {
8425
8519
  /* The product it was filled WITH — the cart's items do not reliably name it. */
8426
8520
  productName: product.Name,
8427
8521
  heldFrom: at,
8428
- eventQuestions: await readQuestions(client, filled.Cart)
8522
+ eventQuestions: await questions
8429
8523
  }
8430
8524
  };
8431
8525
  } catch (cause) {
@@ -8552,7 +8646,7 @@ async function promoWrite(write) {
8552
8646
  function said4(cause) {
8553
8647
  return cause instanceof Error ? cause.message : String(cause);
8554
8648
  }
8555
- async function empty(client, cart, heldFrom, currency, productName) {
8649
+ async function empty(cart, heldFrom, currency, productName, questions) {
8556
8650
  return {
8557
8651
  ok: true,
8558
8652
  opening: {
@@ -8562,7 +8656,7 @@ async function empty(client, cart, heldFrom, currency, productName) {
8562
8656
  currency,
8563
8657
  productName,
8564
8658
  heldFrom,
8565
- eventQuestions: await readQuestions(client, cart)
8659
+ eventQuestions: await questions
8566
8660
  }
8567
8661
  };
8568
8662
  }
@@ -9141,13 +9235,11 @@ function commitBlocks(id, facts) {
9141
9235
  }
9142
9236
  /*
9143
9237
  * THE EVENT'S OWN QUESTIONS, which come from the tickets and the event's questionnaire
9144
- * and arrive with the cart — so they are in hand by the time this card is asked. One
9145
- * per card: the card is the question the flow stands on.
9238
+ * and arrive with the cart — so they are in hand by the time this card is asked. As
9239
+ * many per card as `questionGrouping` deals it, and the card is the one the flow stands on.
9146
9240
  */
9147
- case "DETAILS": {
9148
- const page = pageOf(facts);
9149
- return page === null ? [] : chainFields([questionBlock(page, facts)]);
9150
- }
9241
+ case "DETAILS":
9242
+ return chainFields(cardOf(facts).map((question) => questionBlock(question, facts)));
9151
9243
  case "PROMO":
9152
9244
  return [promoBlock(facts.collected.promoCode, facts.promo)];
9153
9245
  default:
@@ -9204,15 +9296,14 @@ function commitAnswered(id, facts) {
9204
9296
  case "PHONE":
9205
9297
  return e164(collected.phone.dialCode, collected.phone.national) !== null;
9206
9298
  /*
9207
- * THE QUESTION ON THIS CARD, and not the rest: each has a card of its own, and a gate
9299
+ * THE QUESTIONS ON THIS CARD, and not the rest: where each has a card of its own, a gate
9208
9300
  * over all of them would hold the first card shut until the last was answered. Not
9209
9301
  * answered while the questions are still on their way — see `questions`.
9210
9302
  */
9211
- case "DETAILS": {
9212
- if (facts.questions.status !== "READY") return false;
9213
- const page = pageOf(facts);
9214
- return page === null || questionAnswered(questionKind(page), collected.answers[String(page.QuestionId)]);
9215
- }
9303
+ case "DETAILS":
9304
+ return facts.questions.status === "READY" && cardOf(facts).every(
9305
+ (question) => questionAnswered(questionKind(question), collected.answers[String(question.QuestionId)])
9306
+ );
9216
9307
  /*
9217
9308
  * THE CARD FORM OPENS ON NO METHOD, so its Confirm waits for the tap that picks one: a
9218
9309
  * row mounts the form beneath it, and a step confirmed without one would be a buyer
@@ -9236,8 +9327,11 @@ function commitAnswered(id, facts) {
9236
9327
  return true;
9237
9328
  }
9238
9329
  }
9239
- function pageOf(facts) {
9240
- return questionOnPage(questionPages(facts.questions, facts.hostAnswers), facts.question);
9330
+ function cardOf(facts) {
9331
+ return questionCardOnPage(
9332
+ questionCards(facts.questions, facts.hostAnswers, facts.questionGrouping),
9333
+ facts.question
9334
+ );
9241
9335
  }
9242
9336
  function questionBlock(question, facts) {
9243
9337
  const id = String(question.QuestionId);
@@ -9571,6 +9665,7 @@ function useCheckoutOrder(store, request, currency, open, adopt, userTypeNames2
9571
9665
  (method) => store?.dispatch({ kind: "CHARGE_ATTEMPTED", method }),
9572
9666
  [store]
9573
9667
  );
9668
+ const bookFree = useCallback11(() => store?.dispatch({ kind: "NOTHING_TO_PAY" }), [store]);
9574
9669
  const restart = useCallback11(() => store?.dispatch({ kind: "RESTARTED" }), [store]);
9575
9670
  const retryEventQuestions = useCallback11(
9576
9671
  () => store?.dispatch({ kind: "QUESTIONS_WANTED_AGAIN" }),
@@ -9590,6 +9685,7 @@ function useCheckoutOrder(store, request, currency, open, adopt, userTypeNames2
9590
9685
  answers: state.answers,
9591
9686
  saveAnswers,
9592
9687
  promo: state.promo,
9688
+ acceptedPromo: state.acceptedPromo,
9593
9689
  applyPromo,
9594
9690
  removePromo,
9595
9691
  settledFromFrame,
@@ -9597,6 +9693,7 @@ function useCheckoutOrder(store, request, currency, open, adopt, userTypeNames2
9597
9693
  paidWithoutFinalizing,
9598
9694
  retryPayment,
9599
9695
  chargeAttempted,
9696
+ bookFree,
9600
9697
  restart,
9601
9698
  eventQuestions: state.eventQuestions,
9602
9699
  retryEventQuestions
@@ -9671,11 +9768,11 @@ function Amount({ parts }) {
9671
9768
  }
9672
9769
 
9673
9770
  // src/island/IslandBlocks.tsx
9674
- import { Fragment as Fragment7, useCallback as useCallback13 } from "react";
9771
+ import { Fragment as Fragment8, useCallback as useCallback13 } from "react";
9675
9772
 
9676
9773
  // src/island/TextField.tsx
9677
9774
  import { useEffect as useEffect14, useId, useLayoutEffect as useLayoutEffect3, useRef as useRef9, useState as useState4 } from "react";
9678
- import { Fragment as Fragment2, jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
9775
+ import { Fragment as Fragment3, jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
9679
9776
  function TextField({
9680
9777
  label,
9681
9778
  value,
@@ -9731,7 +9828,7 @@ function TextField({
9731
9828
  }
9732
9829
  node.setSelectionRange(at, at);
9733
9830
  });
9734
- const body = /* @__PURE__ */ jsxs9(Fragment2, { children: [
9831
+ const body = /* @__PURE__ */ jsxs9(Fragment3, { children: [
9735
9832
  /* @__PURE__ */ jsx13("span", { className: "scopetickets-island-field__label", children: label }),
9736
9833
  /* @__PURE__ */ jsx13("span", { className: "scopetickets-island-field__clip", children: /* @__PURE__ */ jsxs9("span", { className: "scopetickets-island-field__row", children: [
9737
9834
  icon === void 0 ? null : /* @__PURE__ */ jsx13("span", { className: "scopetickets-island-field__icon", children: icon }),
@@ -10452,7 +10549,7 @@ function passkeyButtonTheme(read2) {
10452
10549
 
10453
10550
  // src/island/PasskeyFrame.tsx
10454
10551
  import { useCallback as useCallback12, useEffect as useEffect17, useMemo as useMemo11, useRef as useRef11, useState as useState7 } from "react";
10455
- import { Fragment as Fragment3, jsx as jsx22, jsxs as jsxs16 } from "react/jsx-runtime";
10552
+ import { Fragment as Fragment4, jsx as jsx22, jsxs as jsxs16 } from "react/jsx-runtime";
10456
10553
  var POPUP_FEATURES = "popup,width=480,height=340";
10457
10554
  var CLOSED_POLL_MS = 400;
10458
10555
  var BLOCKED_NOTE = "Allow pop-ups for this site to finish setting up your passkey.";
@@ -10566,7 +10663,7 @@ function PasskeyFrame({
10566
10663
  [stopPolling]
10567
10664
  );
10568
10665
  if (windowMode) {
10569
- return /* @__PURE__ */ jsxs16(Fragment3, { children: [
10666
+ return /* @__PURE__ */ jsxs16(Fragment4, { children: [
10570
10667
  ceremony === null ? null : /* @__PURE__ */ jsx22(
10571
10668
  "button",
10572
10669
  {
@@ -10935,7 +11032,7 @@ function CountdownTimer({
10935
11032
  }
10936
11033
 
10937
11034
  // src/island/hold-clock.tsx
10938
- import { Fragment as Fragment4, jsx as jsx27 } from "react/jsx-runtime";
11035
+ import { Fragment as Fragment5, jsx as jsx27 } from "react/jsx-runtime";
10939
11036
  function useNow() {
10940
11037
  const [now, setNow] = useState9(browserClock.now);
10941
11038
  useEffect18(() => browserClock.every(HOLD_TICK_MS, () => setNow(browserClock.now())), []);
@@ -10954,7 +11051,7 @@ function HoldRing({ hold: hold2, label }) {
10954
11051
  );
10955
11052
  }
10956
11053
  function HoldClockText({ hold: hold2 }) {
10957
- return /* @__PURE__ */ jsx27(Fragment4, { children: holdClockText(hold2, useNow()) });
11054
+ return /* @__PURE__ */ jsx27(Fragment5, { children: holdClockText(hold2, useNow()) });
10958
11055
  }
10959
11056
  function useAssertedHold(hold2) {
10960
11057
  const [stamp, setStamp] = useState9(null);
@@ -10980,7 +11077,7 @@ function useAssertedHold(hold2) {
10980
11077
  }
10981
11078
 
10982
11079
  // src/island/marks.tsx
10983
- import { Fragment as Fragment5, jsx as jsx28 } from "react/jsx-runtime";
11080
+ import { Fragment as Fragment6, jsx as jsx28 } from "react/jsx-runtime";
10984
11081
  var GLYPHS = {
10985
11082
  ASTERISK: AsteriskIcon,
10986
11083
  BELL: BellIcon,
@@ -11057,11 +11154,11 @@ function creditNode(text) {
11057
11154
  }
11058
11155
  }
11059
11156
  });
11060
- return text.some((part) => part.kind === "MARK") ? /* @__PURE__ */ jsx28("span", { className: "scopetickets-island-credit", children: parts }) : /* @__PURE__ */ jsx28(Fragment5, { children: parts });
11157
+ return text.some((part) => part.kind === "MARK") ? /* @__PURE__ */ jsx28("span", { className: "scopetickets-island-credit", children: parts }) : /* @__PURE__ */ jsx28(Fragment6, { children: parts });
11061
11158
  }
11062
11159
 
11063
11160
  // src/island/Prose.tsx
11064
- import { Fragment as Fragment6, jsx as jsx29 } from "react/jsx-runtime";
11161
+ import { Fragment as Fragment7, jsx as jsx29 } from "react/jsx-runtime";
11065
11162
  function Prose({ blocks, className }) {
11066
11163
  return /* @__PURE__ */ jsx29("span", { className: ["scopetickets-island-prose", className].filter(Boolean).join(" "), children: blocks.map((block, index) => {
11067
11164
  switch (block.kind) {
@@ -11079,7 +11176,7 @@ function Prose({ blocks, className }) {
11079
11176
  }) });
11080
11177
  }
11081
11178
  function Inlines({ inlines }) {
11082
- return /* @__PURE__ */ jsx29(Fragment6, { children: inlines.map((inline, index) => {
11179
+ return /* @__PURE__ */ jsx29(Fragment7, { children: inlines.map((inline, index) => {
11083
11180
  switch (inline.kind) {
11084
11181
  case "LINK":
11085
11182
  return /* @__PURE__ */ jsx29("a", { href: inline.href, target: "_blank", rel: "noopener noreferrer", children: inline.text }, index);
@@ -11096,7 +11193,7 @@ function Inlines({ inlines }) {
11096
11193
  }
11097
11194
 
11098
11195
  // src/island/IslandBlocks.tsx
11099
- import { Fragment as Fragment8, jsx as jsx30, jsxs as jsxs19 } from "react/jsx-runtime";
11196
+ import { Fragment as Fragment9, jsx as jsx30, jsxs as jsxs19 } from "react/jsx-runtime";
11100
11197
  function IslandBlocks({ blocks, onIntent, passkey, upload }) {
11101
11198
  const drawn = [];
11102
11199
  let fields = [];
@@ -11104,7 +11201,7 @@ function IslandBlocks({ blocks, onIntent, passkey, upload }) {
11104
11201
  const close = () => {
11105
11202
  if (fields.length === 0) return;
11106
11203
  drawn.push(
11107
- /* @__PURE__ */ jsxs19(Fragment7, { children: [
11204
+ /* @__PURE__ */ jsxs19(Fragment8, { children: [
11108
11205
  /* @__PURE__ */ jsx30(StepForm, { children: fields }),
11109
11206
  after2
11110
11207
  ] }, `fields-${drawn.length}`)
@@ -11122,11 +11219,11 @@ function IslandBlocks({ blocks, onIntent, passkey, upload }) {
11122
11219
  }
11123
11220
  close();
11124
11221
  drawn.push(
11125
- /* @__PURE__ */ jsx30(Fragment7, { children: drawBlock(block, { onIntent, passkey, upload }) }, blockKey(block, index))
11222
+ /* @__PURE__ */ jsx30(Fragment8, { children: drawBlock(block, { onIntent, passkey, upload }) }, blockKey(block, index))
11126
11223
  );
11127
11224
  });
11128
11225
  close();
11129
- return /* @__PURE__ */ jsx30(Fragment8, { children: drawn });
11226
+ return /* @__PURE__ */ jsx30(Fragment9, { children: drawn });
11130
11227
  }
11131
11228
  function drawBlock(block, { onIntent, passkey, upload }) {
11132
11229
  switch (block.kind) {
@@ -11355,7 +11452,7 @@ function FieldBlock({ block, onIntent }) {
11355
11452
  ...enterProps(block.enter)
11356
11453
  }
11357
11454
  );
11358
- return block.prose === void 0 ? field : /* @__PURE__ */ jsxs19(Fragment8, { children: [
11455
+ return block.prose === void 0 ? field : /* @__PURE__ */ jsxs19(Fragment9, { children: [
11359
11456
  /* @__PURE__ */ jsx30(Prose, { blocks: block.prose, className: "scopetickets-island-card__question" }),
11360
11457
  field
11361
11458
  ] });
@@ -11551,6 +11648,12 @@ var STEP_ACCESSORY = Object.fromEntries(
11551
11648
  Object.entries(STEP_BADGES).map(([step2, badge]) => [step2, { ...badge, id: `step:${step2}` }])
11552
11649
  );
11553
11650
  var UNCLOSABLE_STEPS = /* @__PURE__ */ new Set([
11651
+ /*
11652
+ * NOT FOR THE MONEY, unlike the rest: the promo card's way out is its own Back button
11653
+ * (or Continue, once a code is on), so the header's would be a second one. Conall,
11654
+ * 2026-11-12.
11655
+ */
11656
+ "PROMO",
11554
11657
  "PROCESSING",
11555
11658
  "PAYMENT_SUCCESS",
11556
11659
  "FEEDBACK",
@@ -11613,7 +11716,7 @@ function stepBadge(stepId, facts) {
11613
11716
  }
11614
11717
 
11615
11718
  // src/island/step-cards.tsx
11616
- import { Fragment as Fragment9, jsx as jsx31 } from "react/jsx-runtime";
11719
+ import { Fragment as Fragment10, jsx as jsx31 } from "react/jsx-runtime";
11617
11720
  var STEP_STATUS_GLYPH = {};
11618
11721
  function toneColours(tone) {
11619
11722
  const vars = statusToneVars(tone);
@@ -11698,7 +11801,7 @@ function funnelViewProps(view, onIntent) {
11698
11801
  title: typeof view.title === "string" ? view.title : creditNode(view.title),
11699
11802
  subtitle: typeof view.subtitle === "string" ? view.subtitle : creditNode(view.subtitle),
11700
11803
  actionLabel: AUTH_COPY.SIGN_IN,
11701
- input: /* @__PURE__ */ jsx31(Fragment9, { children: view.blocks.map(
11804
+ input: /* @__PURE__ */ jsx31(Fragment10, { children: view.blocks.map(
11702
11805
  (block) => block.kind === "CREDENTIALS" ? /* @__PURE__ */ jsx31(CredentialsBlock, { block, onIntent }, "credentials") : null
11703
11806
  ) }),
11704
11807
  actions: view.actions.map((action) => ({
@@ -12162,10 +12265,13 @@ var SHEET_PRESS = {
12162
12265
  },
12163
12266
  card: { role: payButtonRole("CARD"), pays: true, picks: "card", label: "Pay with Card" }
12164
12267
  };
12268
+ var FREE_PRESS = { role: "primary", pays: true, label: "Book Now" };
12165
12269
  function reviewActions(reach) {
12166
12270
  switch (reach.entry) {
12167
12271
  case "BAY":
12168
12272
  return STEP_CARD_ACTIONS.REVIEW;
12273
+ case "FREE":
12274
+ return [FREE_PRESS];
12169
12275
  case "SHEET":
12170
12276
  return reach.methods.map((method) => SHEET_PRESS[method]);
12171
12277
  default: {
@@ -12590,7 +12696,12 @@ function trailingSlot(id, facts) {
12590
12696
  return {
12591
12697
  kind: "ORDER",
12592
12698
  cartLabel: CART_VIEW.label(facts.summary.total),
12593
- ...facts.can.redeemPromo ? { promoLabel: PROMO_COPY.open } : {}
12699
+ /*
12700
+ * THE PROMO HALF ON THE PAY SCREEN ONLY — Conall, 2026-11-12. A code is a question
12701
+ * about the price, and Review is where the price is paid; offered earlier, it opened
12702
+ * over steps that had nothing to do with it.
12703
+ */
12704
+ ...facts.can.redeemPromo && id === "REVIEW" ? { promoLabel: PROMO_COPY.open } : {}
12594
12705
  };
12595
12706
  }
12596
12707
  const stops = composeFunnel(facts.stops ?? [], facts.answers, id);
@@ -12744,6 +12855,7 @@ function stepSubtitle(facts) {
12744
12855
  if (facts.stepId === "PAYMENT_FAILED" && facts.failureReason !== null) return facts.failureReason;
12745
12856
  if (facts.stepId === "PAYMENT_SUCCESS") return paymentSuccessSubtitle(facts.buyerFirstName);
12746
12857
  if (facts.stepId === "REVIEW" || facts.stepId === "PAYMENT") {
12858
+ if (facts.orderComing === true) return HOLDING_TICKETS;
12747
12859
  return facts.holdRemaining === null ? POWERED_BY : holdSentence(facts.holdRemaining);
12748
12860
  }
12749
12861
  if (facts.stepId === "DETAILS" && facts.answersSaved) return DETAILS_SAVED_SUBTITLE;
@@ -12758,12 +12870,13 @@ function stepCardOf(facts) {
12758
12870
  const names = greeted(facts);
12759
12871
  const heading = {
12760
12872
  stepId,
12761
- copy: card2?.copy ?? STEP_CARD_COPY[stepId],
12873
+ copy: card2?.copy ?? (stepId === "PROCESSING" && facts.payment.entry === "FREE" ? FREE_ORDER_COPY.processing : STEP_CARD_COPY[stepId]),
12762
12874
  outcome: facts.outcome,
12763
12875
  failureReason: facts.failureReason,
12764
12876
  buyerFirstName: names.thanks,
12765
12877
  accountFirstName: names.welcome,
12766
12878
  holdRemaining: facts.summary.kind === "HELD" ? facts.summary.hold : null,
12879
+ orderComing: facts.orderComing === true,
12767
12880
  quoteHeadline: facts.quoteHeadline,
12768
12881
  promoSaving: facts.promoSaving,
12769
12882
  answersSaved: facts.answersSaved
@@ -12820,7 +12933,10 @@ function cardActions(facts, checkpoint) {
12820
12933
  if (stepId === "PROCESSING" && journey?.kind === "PROCESSING") {
12821
12934
  return [{ role: "secondary", label: ACTION_COPY.cancel, cancels: true }];
12822
12935
  }
12823
- const base = checkpoint ?? (stepId === "REVIEW" ? shutUnlessChargeable(reviewActions(facts.payment), facts.chargeReady !== false) : STEP_CARD_ACTIONS[stepId]);
12936
+ const base = checkpoint ?? (stepId === "REVIEW" ? shutUnlessChargeable(
12937
+ reviewActions(facts.payment),
12938
+ facts.chargeReady !== false && facts.orderComing !== true
12939
+ ) : STEP_CARD_ACTIONS[stepId]);
12824
12940
  if (pressCreatesOrder(stepId, facts.next)) {
12825
12941
  return base.map(
12826
12942
  (action) => action.role === "primary" ? { ...action, label: CREATE_ORDER_LABEL } : action
@@ -12828,7 +12944,7 @@ function cardActions(facts, checkpoint) {
12828
12944
  }
12829
12945
  switch (stepId) {
12830
12946
  case "PROMO":
12831
- return facts.promo === void 0 ? base : [promoAction(facts.promo)];
12947
+ return facts.promo === void 0 ? base : promoActions(facts.promo);
12832
12948
  /*
12833
12949
  * THE PASSKEY CARD KEEPS ONLY ITS SKIP. Its primary is the ceremony document drawn as
12834
12950
  * the card's own content — a credential can only be made by a page under the RP id —
@@ -12895,13 +13011,23 @@ function shutUnlessChargeable(actions, chargeable) {
12895
13011
  (action) => action.pays === true || action.picks !== void 0 ? { ...action, disabled: true } : action
12896
13012
  );
12897
13013
  }
12898
- function promoAction(promo) {
12899
- return promoSendable(promo.typed, promo.applied) ? { role: "primary", label: PROMO_COPY.apply, disabled: promo.saving, promo: "APPLY" } : {
12900
- role: "primary",
12901
- label: PROMO_COPY.remove,
12902
- disabled: promo.saving || promo.applied === null,
12903
- promo: "REMOVE"
12904
- };
13014
+ function promoActions(promo) {
13015
+ const applied = promo.applied;
13016
+ if (applied !== null && !promoSendable(promo.typed, applied)) {
13017
+ return [
13018
+ { role: "primary", label: PROMO_COPY.continue, disabled: promo.saving, promo: "CONTINUE" },
13019
+ { role: "secondary", label: PROMO_COPY.remove, disabled: promo.saving, promo: "REMOVE" }
13020
+ ];
13021
+ }
13022
+ return [
13023
+ {
13024
+ role: "primary",
13025
+ label: PROMO_COPY.apply,
13026
+ disabled: promo.saving || !promoSendable(promo.typed, applied),
13027
+ promo: "APPLY"
13028
+ },
13029
+ { role: "secondary", label: PROMO_COPY.back }
13030
+ ];
12905
13031
  }
12906
13032
  function pillView(facts) {
12907
13033
  const lines = facts.quote === void 0 ? null : quoteLines(facts.quote);
@@ -13076,6 +13202,12 @@ function islandStep(state, facts, stepId) {
13076
13202
  answersSaved: answersLocked(state.order.answers),
13077
13203
  payment: facts.payment,
13078
13204
  ...facts.chargeReady === void 0 ? {} : { chargeReady: facts.chargeReady },
13205
+ /*
13206
+ * READ OFF THE ORDER, SO NO RENDERER HAS TO REMEMBER IT. Review can be reached before the
13207
+ * fill lands, and a press there went on to Pay with no cart behind it and stayed there
13208
+ * when the event's questions arrived (measured 2026-11-05).
13209
+ */
13210
+ orderComing: state.order.cart === null && state.order.opening?.kind === "ASKING",
13079
13211
  detour: facts.detour,
13080
13212
  first: facts.first,
13081
13213
  next: facts.next,
@@ -13145,6 +13277,11 @@ function restingEffect(card2, id) {
13145
13277
  }
13146
13278
 
13147
13279
  // ../checkout-core/src/view/island-flow.ts
13280
+ var PROMO_EFFECT = {
13281
+ APPLY: "PROMO_APPLIED",
13282
+ REMOVE: "PROMO_REMOVED",
13283
+ CONTINUE: "PROMO_CONTINUED"
13284
+ };
13148
13285
  function openingFlow(expanded) {
13149
13286
  return {
13150
13287
  at: null,
@@ -13231,7 +13368,7 @@ function pressed(state, action, facts) {
13231
13368
  return forward(state, facts, [{ kind: "GUEST_CHOSEN" }]);
13232
13369
  }
13233
13370
  if (action.promo !== void 0) {
13234
- return still6(state, [{ kind: action.promo === "APPLY" ? "PROMO_APPLIED" : "PROMO_REMOVED" }]);
13371
+ return still6(state, [{ kind: PROMO_EFFECT[action.promo] }]);
13235
13372
  }
13236
13373
  if (action.reveals === true) {
13237
13374
  return still6({ ...state, passwordRevealed: !state.passwordRevealed });
@@ -15510,7 +15647,7 @@ function useIslandFaces(fonts = pageFonts(), families = familiesOnPage) {
15510
15647
  }
15511
15648
 
15512
15649
  // src/island/ScopeTicketsCheckout.tsx
15513
- import { Fragment as Fragment10, jsx as jsx41, jsxs as jsxs26 } from "react/jsx-runtime";
15650
+ import { Fragment as Fragment11, jsx as jsx41, jsxs as jsxs26 } from "react/jsx-runtime";
15514
15651
  var PROVIDER_BUTTON_HEIGHT = 52;
15515
15652
  var WEB_CAN = {
15516
15653
  takePayment: true,
@@ -15519,6 +15656,8 @@ var WEB_CAN = {
15519
15656
  redeemPromo: true
15520
15657
  };
15521
15658
  var WEB_PAYMENT = { entry: "BAY" };
15659
+ var CONTINUE_WAIT_MS = 3e3;
15660
+ var FREE_ORDER = { entry: "FREE" };
15522
15661
  var sendEnvelope = (url, body) => {
15523
15662
  if (typeof fetch !== "function") return;
15524
15663
  void fetch(url, { method: "POST", body, keepalive: true }).catch(() => void 0);
@@ -15604,6 +15743,7 @@ function PurchaseIsland({
15604
15743
  inventories,
15605
15744
  inventoryFilter = "checkbox",
15606
15745
  timeslotGrouping,
15746
+ questionGrouping,
15607
15747
  mode = "system",
15608
15748
  align = "bottom",
15609
15749
  placement = "page",
@@ -15864,8 +16004,8 @@ function PurchaseIsland({
15864
16004
  );
15865
16005
  const answeredByHost = useMemo16(() => hostAnswers(intent.answers), [intent.answers]);
15866
16006
  const questionIds = useMemo16(
15867
- () => questionPages(questionnaire, answeredByHost).map((question) => question.QuestionId),
15868
- [questionnaire, answeredByHost]
16007
+ () => questionCardIds(questionCards(questionnaire, answeredByHost, questionGrouping)),
16008
+ [questionnaire, answeredByHost, questionGrouping]
15869
16009
  );
15870
16010
  const answersReady = questionnaire.status === "READY" && questionsAnswered(questionnaire.questions, answersInHand);
15871
16011
  const answersSaved = answersLocked(order.answers);
@@ -16083,7 +16223,7 @@ function PurchaseIsland({
16083
16223
  () => dispatch({ kind: "DETOUR_OPENED", step: "PROMO" }),
16084
16224
  [dispatch]
16085
16225
  );
16086
- const appliedPromo = promoApplied(order.cart);
16226
+ const appliedPromo = promoApplied(order.cart, order.acceptedPromo);
16087
16227
  useEffect22(() => {
16088
16228
  setCollected((was) => ({ ...was, promoCode: appliedPromo ?? "" }));
16089
16229
  }, [appliedPromo]);
@@ -16158,6 +16298,8 @@ function PurchaseIsland({
16158
16298
  });
16159
16299
  const [reviewCartKey, setReviewCartKey] = useState15(null);
16160
16300
  const [frameHeight, setFrameHeight] = useState15(null);
16301
+ const [revolutReadyAt, setRevolutReadyAt] = useState15(null);
16302
+ const [continuing, setContinuing] = useState15(false);
16161
16303
  useEffect22(() => {
16162
16304
  if (expanded && order.cart !== null) {
16163
16305
  setReviewCartKey(order.cart.Key);
@@ -16228,7 +16370,28 @@ function PurchaseIsland({
16228
16370
  }
16229
16371
  };
16230
16372
  const cardChosen = collected.paymentMethodKey === "card";
16231
- const frameMounted = order.cart !== null && reviewCartKey === order.cart.Key;
16373
+ const free = nothingToPay(order.cart, order.items.length);
16374
+ const frameMounted = !free && order.cart !== null && reviewCartKey === order.cart.Key;
16375
+ const price2 = order.cart?.TotalAmount ?? null;
16376
+ useEffect22(() => {
16377
+ setFrameHeight(null);
16378
+ }, [price2]);
16379
+ const revolutStanding = revolutCart !== order.cart?.Key || revolutReadyAt === price2;
16380
+ const cardStanding = !cardChosen || frameHeight !== null;
16381
+ const entriesStanding = !frameMounted || cardStanding && revolutStanding;
16382
+ useEffect22(() => {
16383
+ if (!continuing) return;
16384
+ const finish = () => {
16385
+ setContinuing(false);
16386
+ dispatch({ kind: "DETOUR_CLOSED" });
16387
+ };
16388
+ if (entriesStanding) {
16389
+ finish();
16390
+ return;
16391
+ }
16392
+ const timer = window.setTimeout(finish, CONTINUE_WAIT_MS);
16393
+ return () => window.clearTimeout(timer);
16394
+ }, [continuing, entriesStanding, dispatch]);
16232
16395
  const terminalPayment = moneyMoved(reported);
16233
16396
  const {
16234
16397
  revolutActive,
@@ -16295,6 +16458,7 @@ function PurchaseIsland({
16295
16458
  useEffect22(() => {
16296
16459
  const key = order.cart?.Key;
16297
16460
  if (stepId !== "REVIEW" || key === void 0 || revolutCart === key || !answersReady) return;
16461
+ if (free) return;
16298
16462
  setRevolutCart(key);
16299
16463
  setWalletCart(key);
16300
16464
  const request = ++selectionRequest.current;
@@ -16303,10 +16467,10 @@ function PurchaseIsland({
16303
16467
  setSavedRevolutCart(key);
16304
16468
  setSavedWalletCart(key);
16305
16469
  });
16306
- }, [stepId, order.cart?.Key, revolutCart, answersReady]);
16470
+ }, [stepId, order.cart?.Key, revolutCart, answersReady, free]);
16307
16471
  const [cardStatus, setCardStatus] = useState15(null);
16308
16472
  const checkoutSessionId = useMemo16(() => crypto.randomUUID(), [order.cart?.Key]);
16309
- const payEntries = frameMounted ? /* @__PURE__ */ jsxs26(Fragment10, { children: [
16473
+ const payEntries = frameMounted ? /* @__PURE__ */ jsxs26(Fragment11, { children: [
16310
16474
  /* @__PURE__ */ jsx41("div", { className: "scopetickets-island-bay__field", hidden: !cardChosen || frameHeight === null, children: /* @__PURE__ */ jsx41(
16311
16475
  IslandPaymentFrame,
16312
16476
  {
@@ -16334,7 +16498,7 @@ function PurchaseIsland({
16334
16498
  },
16335
16499
  theme: frameTheme
16336
16500
  },
16337
- order.cart.Key
16501
+ `${order.cart.Key}:${order.cart.TotalAmount}`
16338
16502
  ) }),
16339
16503
  walletCart === order.cart.Key && /*
16340
16504
  * THE WALLET STANDS ABOVE REVOLUT PAY, which is the order the design draws and the
@@ -16377,7 +16541,7 @@ function PurchaseIsland({
16377
16541
  onSuccess: order.settledFromFrame,
16378
16542
  onError: providerFailed
16379
16543
  },
16380
- `wallet:${order.cart.Key}`
16544
+ `wallet:${order.cart.Key}:${order.cart.TotalAmount}`
16381
16545
  ) }),
16382
16546
  revolutCart === order.cart.Key && /* @__PURE__ */ jsx41(
16383
16547
  "div",
@@ -16397,7 +16561,10 @@ function PurchaseIsland({
16397
16561
  retry: revolutFrameEpoch > 0,
16398
16562
  heightOverride: journeyInline && journeyFullscreen ? "100%" : journeyRoom?.height ?? PROVIDER_BUTTON_HEIGHT,
16399
16563
  onSubmitRequested: chargingWith("revolut_pay"),
16400
- onReady: recoveryReady,
16564
+ onReady: () => {
16565
+ recoveryReady();
16566
+ setRevolutReadyAt(order.cart?.TotalAmount ?? null);
16567
+ },
16401
16568
  onHeight: recoveryReady,
16402
16569
  theme: frameTheme,
16403
16570
  onStatusChange: (status) => {
@@ -16408,7 +16575,7 @@ function PurchaseIsland({
16408
16575
  onSuccess: order.settledFromFrame,
16409
16576
  onError: providerFailed
16410
16577
  },
16411
- `revolut:${revolutFrameEpoch}:${order.cart.Key}`
16578
+ `revolut:${revolutFrameEpoch}:${order.cart.Key}:${order.cart.TotalAmount}`
16412
16579
  )
16413
16580
  }
16414
16581
  )
@@ -16447,7 +16614,7 @@ function PurchaseIsland({
16447
16614
  collected,
16448
16615
  lines: cartLines2
16449
16616
  }) : null,
16450
- payment: WEB_PAYMENT,
16617
+ payment: free ? FREE_ORDER : WEB_PAYMENT,
16451
16618
  orderFirstName: orderedBuyer.firstName ?? null,
16452
16619
  next: walk.stops[index + 1]?.step,
16453
16620
  quote: drawnQuote,
@@ -16540,6 +16707,15 @@ function PurchaseIsland({
16540
16707
  * accepting it is what moves the flow on, not this press.
16541
16708
  */
16542
16709
  case "PAY_PRESSED":
16710
+ if (free) {
16711
+ void saveForCharge().then((saved) => {
16712
+ if (!saved) return;
16713
+ order.bookFree();
16714
+ dispatch({ kind: "DETOUR_CLOSED" });
16715
+ forward2();
16716
+ });
16717
+ return;
16718
+ }
16543
16719
  void saveForCharge().then((saved) => {
16544
16720
  if (!saved) return;
16545
16721
  setSubmitSignal((was) => was + 1);
@@ -16579,6 +16755,9 @@ function PurchaseIsland({
16579
16755
  case "PROMO_REMOVED":
16580
16756
  void order.removePromo();
16581
16757
  return;
16758
+ case "PROMO_CONTINUED":
16759
+ setContinuing(true);
16760
+ return;
16582
16761
  case "PAYMENT_CANCELLED":
16583
16762
  setCancelSignal((value) => value + 1);
16584
16763
  return;
@@ -16753,6 +16932,7 @@ function PurchaseIsland({
16753
16932
  answersLocked: answersSaved,
16754
16933
  hostAnswers: answeredByHost,
16755
16934
  question: flow.question,
16935
+ ...questionGrouping === void 0 ? {} : { questionGrouping },
16756
16936
  promo: {
16757
16937
  applied: appliedPromo,
16758
16938
  refusal: order.promo.status === "REFUSED" ? order.promo.reason : null
@@ -16815,6 +16995,7 @@ function PurchaseIsland({
16815
16995
  mark: action.mark === void 0 ? void 0 : buttonMark(action.mark),
16816
16996
  label: action.label,
16817
16997
  disabled: action.state !== "ENABLED",
16998
+ busy: continuing && pressed2?.promo === "CONTINUE",
16818
16999
  onPress: pressed2 === null ? () => void 0 : pressFor(pressed2)
16819
17000
  };
16820
17001
  });
@@ -16879,7 +17060,7 @@ function PurchaseIsland({
16879
17060
  onOpenCart: openCart,
16880
17061
  cartLabel: view.trailing.cartLabel,
16881
17062
  onOpenPromo: openPromo,
16882
- promoLabel: view.trailing.promoLabel ?? PROMO_COPY.open
17063
+ promoLabel: view.trailing.promoLabel
16883
17064
  }
16884
17065
  )
16885
17066
  ),