@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.cjs CHANGED
@@ -299,13 +299,14 @@ function CardAction({ action, tapped = false }) {
299
299
  type: "button",
300
300
  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" : ""}`,
301
301
  "aria-disabled": action.disabled === true ? true : void 0,
302
- "aria-label": alone && typeof action.label === "string" ? action.label : void 0,
303
- onClick: action.disabled === true ? void 0 : action.onPress,
302
+ "aria-busy": action.busy === true ? "true" : void 0,
303
+ "aria-label": (alone || action.busy === true) && typeof action.label === "string" ? action.label : void 0,
304
+ onClick: action.disabled === true || action.busy === true ? void 0 : action.onPress,
304
305
  ...press,
305
306
  "data-pressed": held ? "" : void 0,
306
307
  children: [
307
308
  action.mark?.side === "leading" ? mark : null,
308
- alone ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "scopetickets-island-button__mark--alone", "aria-hidden": "true", children: action.mark?.node }) : action.label,
309
+ action.busy === true ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "scopetickets-island-spinner", "aria-hidden": "true" }) : alone ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "scopetickets-island-button__mark--alone", "aria-hidden": "true", children: action.mark?.node }) : action.label,
309
310
  action.mark?.side === "trailing" ? mark : null
310
311
  ]
311
312
  }
@@ -3290,6 +3291,9 @@ var FUNNEL_COPY = {
3290
3291
  refused: "That email and password did not match. Please try again.",
3291
3292
  working: "Checking your details\u2026"
3292
3293
  };
3294
+ var FREE_ORDER_COPY = {
3295
+ processing: { title: "Booking", subtitle: "This may take a moment." }
3296
+ };
3293
3297
  var PROMO_COPY = {
3294
3298
  /** The trailing half of the commit pill. */
3295
3299
  open: "Promo Code",
@@ -3298,6 +3302,10 @@ var PROMO_COPY = {
3298
3302
  field: "Promo Code",
3299
3303
  apply: "Apply",
3300
3304
  remove: "Remove",
3305
+ /** Once a code is on the order: back to Review, where the price it took off is paid. */
3306
+ continue: "Continue",
3307
+ /** The card's own way out — the header draws none on this card. */
3308
+ back: "Back",
3301
3309
  /** What the card says once a code is on the order. `saved` is already written money. */
3302
3310
  saved: (saved) => `${saved} Saved`,
3303
3311
  /** The mark on an accepted field, for anyone who cannot see it. */
@@ -3366,6 +3374,7 @@ var JOURNEY_COPY = {
3366
3374
  };
3367
3375
  var PASSKEY_BUTTON_LABEL = "Add Passkey";
3368
3376
  var COMPOSE_FUNNEL_LABEL = "Your ticket selection";
3377
+ var HOLDING_TICKETS = "Holding your tickets\u2026";
3369
3378
  var POWERED_BY = [
3370
3379
  { kind: "TEXT", text: "Powered by" },
3371
3380
  { kind: "MARK", mark: "SCOPE_TICKETS_WORDMARK" }
@@ -5014,17 +5023,19 @@ function IslandCommitPill({
5014
5023
  children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "scopetickets-island-glyph-slot", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_icons3.ShoppingCartIcon, { fill: true, color: "currentColor" }) })
5015
5024
  }
5016
5025
  ),
5017
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "scopetickets-island-commit__rule", "aria-hidden": "true" }),
5018
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
5019
- "button",
5020
- {
5021
- type: "button",
5022
- className: "scopetickets-island-commit__target scopetickets-island-commit__promo",
5023
- onClick: onOpenPromo,
5024
- ...promoPress,
5025
- children: promoLabel
5026
- }
5027
- )
5026
+ promoLabel === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
5027
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "scopetickets-island-commit__rule", "aria-hidden": "true" }),
5028
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
5029
+ "button",
5030
+ {
5031
+ type: "button",
5032
+ className: "scopetickets-island-commit__target scopetickets-island-commit__promo",
5033
+ onClick: onOpenPromo,
5034
+ ...promoPress,
5035
+ children: promoLabel
5036
+ }
5037
+ )
5038
+ ] })
5028
5039
  ] });
5029
5040
  }
5030
5041
 
@@ -5080,6 +5091,9 @@ function toQuote(cart, currency) {
5080
5091
  if (currency === void 0) return void 0;
5081
5092
  return { kind: "TOTAL", minorUnits: cart.TotalAmount, currency };
5082
5093
  }
5094
+ function nothingToPay(cart, itemCount) {
5095
+ return cart !== null && itemCount > 0 && cart.TotalAmount <= 0;
5096
+ }
5083
5097
  var ESCROW_WINDOW_SECONDS = 5 * 60;
5084
5098
  function withExpiry(cart, heldFrom) {
5085
5099
  return {
@@ -5345,7 +5359,8 @@ var IDLE_ORDER = {
5345
5359
  answers: { status: "IDLE" },
5346
5360
  answersLanded: null,
5347
5361
  eventQuestions: { status: "IDLE" },
5348
- promo: { status: "IDLE" }
5362
+ promo: { status: "IDLE" },
5363
+ acceptedPromo: null
5349
5364
  };
5350
5365
  var NOTHING = [];
5351
5366
  var UNEXPLAINED_FAILURE = "Your payment could not be completed.";
@@ -5413,6 +5428,7 @@ var EMPTIED = {
5413
5428
  eventQuestions: { status: "IDLE" },
5414
5429
  answers: { status: "IDLE" },
5415
5430
  promo: { status: "IDLE" },
5431
+ acceptedPromo: null,
5416
5432
  sheet: { status: "IDLE" },
5417
5433
  completedPreviously: false
5418
5434
  };
@@ -5480,7 +5496,9 @@ function reduceOrder(state, event) {
5480
5496
  reservation,
5481
5497
  /* The old cart is gone from here the moment we ask for another. */
5482
5498
  ...giveBack ? EMPTIED : {},
5483
- opening: { kind: "ASKING", mark: event.mark, ask: event.ask }
5499
+ opening: { kind: "ASKING", mark: event.mark, ask: event.ask },
5500
+ /* Unknown from this press, so nothing reads the wait as a run that asks nothing. */
5501
+ ...event.adopt ? {} : { eventQuestions: { status: "LOADING" } }
5484
5502
  },
5485
5503
  effects: [
5486
5504
  ...giveBack && state.cart !== null ? [
@@ -5544,6 +5562,8 @@ function reduceOrder(state, event) {
5544
5562
  state: {
5545
5563
  ...state,
5546
5564
  opening: state.opening === null ? null : { ...state.opening, kind: "REFUSED" },
5565
+ /* No cart, so no questions to wait on: the refusal is the whole of the card. */
5566
+ eventQuestions: { status: "IDLE" },
5547
5567
  fill: event.fill
5548
5568
  },
5549
5569
  effects: NOTHING
@@ -5564,6 +5584,18 @@ function reduceOrder(state, event) {
5564
5584
  effects: [{ kind: "READ_QUESTIONS", reservation: state.reservation, cart: state.cart }]
5565
5585
  };
5566
5586
  }
5587
+ /*
5588
+ * ONLY WHILE THE CART IS STILL COMING — once it lands, it carried this same read. A failure
5589
+ * waits for it too: Try Again reads against the cart, so a notice raised before there was
5590
+ * one would offer a button that could do nothing.
5591
+ */
5592
+ case "QUESTIONS_AHEAD_OF_CART": {
5593
+ if (!isCurrent(state.reservation, event.reservation)) return { state, effects: NOTHING };
5594
+ if (state.opening?.kind !== "ASKING" || event.load.status === "FAILED") {
5595
+ return { state, effects: NOTHING };
5596
+ }
5597
+ return { state: { ...state, eventQuestions: event.load }, effects: NOTHING };
5598
+ }
5567
5599
  case "QUESTIONS_READ": {
5568
5600
  if (!isCurrent(state.reservation, event.reservation)) return { state, effects: NOTHING };
5569
5601
  if (state.cart?.Key !== event.cartKey) return { state, effects: NOTHING };
@@ -5615,6 +5647,22 @@ function reduceOrder(state, event) {
5615
5647
  }
5616
5648
  case "CHARGE_ATTEMPTED":
5617
5649
  return arm(state, "CHARGED", event.finalizes === true, void 0, event.method);
5650
+ /*
5651
+ * A FREE ORDER IS CONVERTED, NOT WATCHED. There is no payment for a status poll to
5652
+ * follow — the platform answers `409 InvalidPayment` for the status of a zero cart — so
5653
+ * this goes straight to `landed`, whose `FINALIZE` is the same `FromCart` a paid order
5654
+ * ends on, with the same retry and the same `PROVIDER_SETTLED` at the end.
5655
+ *
5656
+ * THE GUARD IS THE REDUCER'S, NOT THE CALLER'S: a cart with money on it must never be
5657
+ * converted by this road, whatever pressed it. Nor twice — a second press while one is
5658
+ * finalizing, or after the order is placed, is nothing.
5659
+ */
5660
+ case "NOTHING_TO_PAY":
5661
+ if (!nothingToPay(state.cart, state.items.length)) return { state, effects: NOTHING };
5662
+ if (state.watch.kind === "FINALIZING" || moneyMoved(state.payment)) {
5663
+ return { state, effects: NOTHING };
5664
+ }
5665
+ return landed(state, true);
5618
5666
  case "SHEET_OPENING":
5619
5667
  return {
5620
5668
  state: {
@@ -5726,7 +5774,8 @@ function reduceOrder(state, event) {
5726
5774
  ...event.cart,
5727
5775
  ExpirationTime: state.cart?.ExpirationTime ?? event.cart.ExpirationTime
5728
5776
  },
5729
- promo: { status: "IDLE" }
5777
+ promo: { status: "IDLE" },
5778
+ acceptedPromo: event.code === void 0 ? state.acceptedPromo : event.code
5730
5779
  },
5731
5780
  effects: NOTHING
5732
5781
  };
@@ -5907,9 +5956,9 @@ function mergeQuestions(eventQuestions, ticketQuestions) {
5907
5956
  return merged;
5908
5957
  }
5909
5958
  function questionsInHand(ticketQuestions, load, hasCart) {
5910
- if (!hasCart) return { status: "READY", questions: guardQuestions(ticketQuestions) };
5911
5959
  switch (load.status) {
5912
5960
  case "IDLE":
5961
+ return hasCart ? { status: "PENDING" } : { status: "READY", questions: guardQuestions(ticketQuestions) };
5913
5962
  case "LOADING":
5914
5963
  return { status: "PENDING" };
5915
5964
  case "LOADED":
@@ -5942,8 +5991,24 @@ function questionPages(questions, host) {
5942
5991
  (question) => !questionAnswered(questionKind(question), host[String(question.QuestionId)])
5943
5992
  );
5944
5993
  }
5945
- function questionOnPage(pages, at) {
5946
- return pages.find((question) => question.QuestionId === at) ?? pages[0] ?? null;
5994
+ function questionCards(questions, host, grouping = "question") {
5995
+ const pages = questionPages(questions, host);
5996
+ switch (grouping) {
5997
+ case "question":
5998
+ return pages.map((question) => [question]);
5999
+ case "all":
6000
+ return pages.length === 0 ? [] : [pages];
6001
+ default: {
6002
+ const exhaustive = grouping;
6003
+ return exhaustive;
6004
+ }
6005
+ }
6006
+ }
6007
+ function questionCardIds(cards) {
6008
+ return cards.flatMap((card2) => card2.slice(0, 1).map((question) => question.QuestionId));
6009
+ }
6010
+ function questionCardOnPage(cards, at) {
6011
+ return cards.find((card2) => card2[0]?.QuestionId === at) ?? cards[0] ?? [];
5947
6012
  }
5948
6013
 
5949
6014
  // ../checkout-core/src/machine/save-for-charge.ts
@@ -8524,7 +8589,7 @@ function param(value) {
8524
8589
  }
8525
8590
 
8526
8591
  // src/version.ts
8527
- var CHECKOUT_VERSION = "0.6.1";
8592
+ var CHECKOUT_VERSION = "0.6.3";
8528
8593
 
8529
8594
  // src/data/useCheckoutEvents.ts
8530
8595
  function useCheckoutEvents(observed, { applicationKey, inventories, onEvent, logger = browserLogger }) {
@@ -9696,7 +9761,15 @@ function createOrderStore(parts, seed = IDLE_ORDER) {
9696
9761
  case "OPEN_CART": {
9697
9762
  const { reservation, mark, ask } = effect;
9698
9763
  const asked = intentHeadcount(ask.composition);
9699
- loading(parts.gateway.open(mark, ask), reservation, asked);
9764
+ loading(
9765
+ parts.gateway.open(
9766
+ mark,
9767
+ ask,
9768
+ (load) => dispatch({ kind: "QUESTIONS_AHEAD_OF_CART", reservation, load })
9769
+ ),
9770
+ reservation,
9771
+ asked
9772
+ );
9700
9773
  return;
9701
9774
  }
9702
9775
  case "READ_CART": {
@@ -9837,7 +9910,7 @@ function createOrderStore(parts, seed = IDLE_ORDER) {
9837
9910
  });
9838
9911
  return refusal === null;
9839
9912
  };
9840
- const writePromo = async (write) => {
9913
+ const writePromo = async (write, code) => {
9841
9914
  const taken = state.reservation;
9842
9915
  const cartKey = state.cart?.Key;
9843
9916
  if (cartKey === void 0) return false;
@@ -9848,12 +9921,34 @@ function createOrderStore(parts, seed = IDLE_ORDER) {
9848
9921
  return false;
9849
9922
  }
9850
9923
  if (!written.ok) {
9924
+ const reread = await rereadAfterRefusal(cartKey);
9925
+ if (!stillOurs(taken)) {
9926
+ dispatch({ kind: "PROMO_SETTLED" });
9927
+ return false;
9928
+ }
9929
+ if (reread !== null) {
9930
+ dispatch({ kind: "PROMO_WRITTEN", cart: reread, code });
9931
+ return true;
9932
+ }
9851
9933
  dispatch({ kind: "PROMO_REFUSED", reason: written.reason });
9852
9934
  return false;
9853
9935
  }
9854
- dispatch({ kind: "PROMO_WRITTEN", cart: written.cart });
9936
+ dispatch({ kind: "PROMO_WRITTEN", cart: written.cart, code });
9855
9937
  return true;
9856
9938
  };
9939
+ const rereadAfterRefusal = async (cartKey) => {
9940
+ const before = state.cart;
9941
+ if (before === null) return null;
9942
+ try {
9943
+ const load = await parts.gateway.adopt(cartKey);
9944
+ if (!load.ok) return null;
9945
+ const after2 = load.opening.cart;
9946
+ const moved = after2.TotalAmount !== before.TotalAmount || (after2.PromoCode ?? null) !== (before.PromoCode ?? null);
9947
+ return moved ? after2 : null;
9948
+ } catch {
9949
+ return null;
9950
+ }
9951
+ };
9857
9952
  const charge = async (method, email) => {
9858
9953
  const taken = state.reservation;
9859
9954
  const cartKey = state.cart?.Key;
@@ -9975,34 +10070,26 @@ function createOrderStore(parts, seed = IDLE_ORDER) {
9975
10070
  saveAnswers,
9976
10071
  charge,
9977
10072
  /*
9978
- * CHECKED FIRST, THEN APPLIED — two calls, and the first one is the only thing that
9979
- * can say WHY. A check that could not be MADE is not a code that was refused: the card
9980
- * goes quiet and the fault travels, which is where `notices` takes it.
10073
+ * APPLIED STRAIGHT TO THE CART — one call, no `checkPromo` first. The cart's write is
10074
+ * the authority: it applies the code or refuses it with the platform's reason
10075
+ * ("The promo code does not apply to any of the items"), which `writePromo` puts on
10076
+ * the card. The check asked the same question of the whole platform instead of this
10077
+ * cart, and on production it cost ~8 s per row of the code: 25 s for a code with a row
10078
+ * on each of three days, a 500 at 30 s past that — measured 2026-11-10, while the cart
10079
+ * write answered in 0.03 s. A write that could not be MADE is not a code that was
10080
+ * refused: the card goes quiet and the fault travels, which is where `notices` takes it.
9981
10081
  */
9982
10082
  applyPromo: async (code) => {
9983
- const taken = state.reservation;
9984
- const cart = state.cart;
9985
- if (cart === null) return false;
10083
+ if (state.cart === null) return false;
9986
10084
  const typed = code.trim();
9987
- dispatch({ kind: "PROMO_WRITING" });
9988
- let checked;
9989
10085
  try {
9990
- checked = await parts.gateway.checkPromo(typed, cart.EventId);
10086
+ return await writePromo((cartKey) => parts.gateway.writePromo(cartKey, typed), typed);
9991
10087
  } catch (cause) {
9992
10088
  dispatch({ kind: "PROMO_SETTLED" });
9993
10089
  throw cause;
9994
10090
  }
9995
- if (!stillOurs(taken)) {
9996
- dispatch({ kind: "PROMO_SETTLED" });
9997
- return false;
9998
- }
9999
- if (!checked.ok) {
10000
- dispatch({ kind: "PROMO_REFUSED", reason: checked.reason });
10001
- return false;
10002
- }
10003
- return writePromo((cartKey) => parts.gateway.writePromo(cartKey, typed));
10004
10091
  },
10005
- removePromo: () => writePromo((cartKey) => parts.gateway.clearPromo(cartKey)),
10092
+ removePromo: () => writePromo((cartKey) => parts.gateway.clearPromo(cartKey), null),
10006
10093
  /*
10007
10094
  * Not a kill switch: a host in StrictMode mounts, unmounts and mounts again over the
10008
10095
  * same store, and a permanently dead one would never open a cart. Answers still in
@@ -10548,8 +10635,13 @@ function promoSaved(cart, currency) {
10548
10635
  if (typeof saved !== "number" || !Number.isFinite(saved) || saved <= 0) return null;
10549
10636
  return formatMoney(saved, currency);
10550
10637
  }
10551
- function promoApplied(cart) {
10552
- return cart === null ? null : bounded(cart.PromoCode, WIRE_LIMITS.promoCode);
10638
+ function promoApplied(cart, accepted = null) {
10639
+ if (cart === null) return null;
10640
+ const named = bounded(cart.PromoCode, WIRE_LIMITS.promoCode);
10641
+ if (named !== null) return named;
10642
+ const saved = cart.PromoSavingAmount;
10643
+ if (typeof saved !== "number" || !Number.isFinite(saved) || saved <= 0) return null;
10644
+ return bounded(accepted, WIRE_LIMITS.promoCode);
10553
10645
  }
10554
10646
  var PROMO_REFUSED = "That code cannot be used on this order.";
10555
10647
  function promoRefusal(reason, fallback) {
@@ -10587,11 +10679,13 @@ async function writtenAnyway(client, cartKey) {
10587
10679
  }
10588
10680
  function orderGateway(client, clock) {
10589
10681
  return {
10590
- async open(mark, ask) {
10682
+ async open(mark, ask, questionsAhead) {
10591
10683
  let asking = `opening a cart on '${mark}'`;
10592
10684
  try {
10593
10685
  const at = clock.now();
10594
10686
  const cart = withExpiry(await client.createCart(mark), at);
10687
+ const questions = readQuestions(client, cart);
10688
+ if (questionsAhead !== void 0) void questions.then(questionsAhead);
10595
10689
  asking = `reading the tickets on '${mark}'`;
10596
10690
  const tickets = await readDayTickets(client, mark, ask.inventories, {
10597
10691
  timeslots: true,
@@ -10604,11 +10698,11 @@ function orderGateway(client, clock) {
10604
10698
  throw new Error(
10605
10699
  `no product on '${mark}' sells the ${session.LocalStartTime}\u2013${session.LocalEndTime} session the buyer was offered`
10606
10700
  );
10607
- return empty(client, cart, at, void 0, void 0);
10701
+ return empty(cart, at, void 0, void 0, questions);
10608
10702
  }
10609
10703
  const money = product.Currency ?? void 0;
10610
10704
  const requested = itemsFor({ composition: ask.composition, timeslot: session }, product);
10611
- if (requested.length === 0) return empty(client, cart, at, money, product.Name);
10705
+ if (requested.length === 0) return empty(cart, at, money, product.Name, questions);
10612
10706
  const sold = sessionOn(product, session);
10613
10707
  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})`);
10614
10708
  const filled = await client.addItemsBulk(cart.Key, requested, { allowPartial: true });
@@ -10629,7 +10723,7 @@ function orderGateway(client, clock) {
10629
10723
  /* The product it was filled WITH — the cart's items do not reliably name it. */
10630
10724
  productName: product.Name,
10631
10725
  heldFrom: at,
10632
- eventQuestions: await readQuestions(client, filled.Cart)
10726
+ eventQuestions: await questions
10633
10727
  }
10634
10728
  };
10635
10729
  } catch (cause) {
@@ -10756,7 +10850,7 @@ async function promoWrite(write) {
10756
10850
  function said4(cause) {
10757
10851
  return cause instanceof Error ? cause.message : String(cause);
10758
10852
  }
10759
- async function empty(client, cart, heldFrom, currency, productName) {
10853
+ async function empty(cart, heldFrom, currency, productName, questions) {
10760
10854
  return {
10761
10855
  ok: true,
10762
10856
  opening: {
@@ -10766,7 +10860,7 @@ async function empty(client, cart, heldFrom, currency, productName) {
10766
10860
  currency,
10767
10861
  productName,
10768
10862
  heldFrom,
10769
- eventQuestions: await readQuestions(client, cart)
10863
+ eventQuestions: await questions
10770
10864
  }
10771
10865
  };
10772
10866
  }
@@ -11345,13 +11439,11 @@ function commitBlocks(id, facts) {
11345
11439
  }
11346
11440
  /*
11347
11441
  * THE EVENT'S OWN QUESTIONS, which come from the tickets and the event's questionnaire
11348
- * and arrive with the cart — so they are in hand by the time this card is asked. One
11349
- * per card: the card is the question the flow stands on.
11442
+ * and arrive with the cart — so they are in hand by the time this card is asked. As
11443
+ * many per card as `questionGrouping` deals it, and the card is the one the flow stands on.
11350
11444
  */
11351
- case "DETAILS": {
11352
- const page = pageOf(facts);
11353
- return page === null ? [] : chainFields([questionBlock(page, facts)]);
11354
- }
11445
+ case "DETAILS":
11446
+ return chainFields(cardOf(facts).map((question) => questionBlock(question, facts)));
11355
11447
  case "PROMO":
11356
11448
  return [promoBlock(facts.collected.promoCode, facts.promo)];
11357
11449
  default:
@@ -11408,15 +11500,14 @@ function commitAnswered(id, facts) {
11408
11500
  case "PHONE":
11409
11501
  return e164(collected.phone.dialCode, collected.phone.national) !== null;
11410
11502
  /*
11411
- * THE QUESTION ON THIS CARD, and not the rest: each has a card of its own, and a gate
11503
+ * THE QUESTIONS ON THIS CARD, and not the rest: where each has a card of its own, a gate
11412
11504
  * over all of them would hold the first card shut until the last was answered. Not
11413
11505
  * answered while the questions are still on their way — see `questions`.
11414
11506
  */
11415
- case "DETAILS": {
11416
- if (facts.questions.status !== "READY") return false;
11417
- const page = pageOf(facts);
11418
- return page === null || questionAnswered(questionKind(page), collected.answers[String(page.QuestionId)]);
11419
- }
11507
+ case "DETAILS":
11508
+ return facts.questions.status === "READY" && cardOf(facts).every(
11509
+ (question) => questionAnswered(questionKind(question), collected.answers[String(question.QuestionId)])
11510
+ );
11420
11511
  /*
11421
11512
  * THE CARD FORM OPENS ON NO METHOD, so its Confirm waits for the tap that picks one: a
11422
11513
  * row mounts the form beneath it, and a step confirmed without one would be a buyer
@@ -11440,8 +11531,11 @@ function commitAnswered(id, facts) {
11440
11531
  return true;
11441
11532
  }
11442
11533
  }
11443
- function pageOf(facts) {
11444
- return questionOnPage(questionPages(facts.questions, facts.hostAnswers), facts.question);
11534
+ function cardOf(facts) {
11535
+ return questionCardOnPage(
11536
+ questionCards(facts.questions, facts.hostAnswers, facts.questionGrouping),
11537
+ facts.question
11538
+ );
11445
11539
  }
11446
11540
  function questionBlock(question, facts) {
11447
11541
  const id = String(question.QuestionId);
@@ -11775,6 +11869,7 @@ function useCheckoutOrder(store, request, currency, open, adopt, userTypeNames2
11775
11869
  (method) => store?.dispatch({ kind: "CHARGE_ATTEMPTED", method }),
11776
11870
  [store]
11777
11871
  );
11872
+ const bookFree = (0, import_react22.useCallback)(() => store?.dispatch({ kind: "NOTHING_TO_PAY" }), [store]);
11778
11873
  const restart = (0, import_react22.useCallback)(() => store?.dispatch({ kind: "RESTARTED" }), [store]);
11779
11874
  const retryEventQuestions = (0, import_react22.useCallback)(
11780
11875
  () => store?.dispatch({ kind: "QUESTIONS_WANTED_AGAIN" }),
@@ -11794,6 +11889,7 @@ function useCheckoutOrder(store, request, currency, open, adopt, userTypeNames2
11794
11889
  answers: state.answers,
11795
11890
  saveAnswers,
11796
11891
  promo: state.promo,
11892
+ acceptedPromo: state.acceptedPromo,
11797
11893
  applyPromo,
11798
11894
  removePromo,
11799
11895
  settledFromFrame,
@@ -11801,6 +11897,7 @@ function useCheckoutOrder(store, request, currency, open, adopt, userTypeNames2
11801
11897
  paidWithoutFinalizing,
11802
11898
  retryPayment,
11803
11899
  chargeAttempted,
11900
+ bookFree,
11804
11901
  restart,
11805
11902
  eventQuestions: state.eventQuestions,
11806
11903
  retryEventQuestions
@@ -14795,6 +14892,12 @@ var STEP_ACCESSORY = Object.fromEntries(
14795
14892
  Object.entries(STEP_BADGES).map(([step2, badge]) => [step2, { ...badge, id: `step:${step2}` }])
14796
14893
  );
14797
14894
  var UNCLOSABLE_STEPS = /* @__PURE__ */ new Set([
14895
+ /*
14896
+ * NOT FOR THE MONEY, unlike the rest: the promo card's way out is its own Back button
14897
+ * (or Continue, once a code is on), so the header's would be a second one. Conall,
14898
+ * 2026-11-12.
14899
+ */
14900
+ "PROMO",
14798
14901
  "PROCESSING",
14799
14902
  "PAYMENT_SUCCESS",
14800
14903
  "FEEDBACK",
@@ -15406,10 +15509,13 @@ var SHEET_PRESS = {
15406
15509
  },
15407
15510
  card: { role: payButtonRole("CARD"), pays: true, picks: "card", label: "Pay with Card" }
15408
15511
  };
15512
+ var FREE_PRESS = { role: "primary", pays: true, label: "Book Now" };
15409
15513
  function reviewActions(reach) {
15410
15514
  switch (reach.entry) {
15411
15515
  case "BAY":
15412
15516
  return STEP_CARD_ACTIONS.REVIEW;
15517
+ case "FREE":
15518
+ return [FREE_PRESS];
15413
15519
  case "SHEET":
15414
15520
  return reach.methods.map((method) => SHEET_PRESS[method]);
15415
15521
  default: {
@@ -15834,7 +15940,12 @@ function trailingSlot(id, facts) {
15834
15940
  return {
15835
15941
  kind: "ORDER",
15836
15942
  cartLabel: CART_VIEW.label(facts.summary.total),
15837
- ...facts.can.redeemPromo ? { promoLabel: PROMO_COPY.open } : {}
15943
+ /*
15944
+ * THE PROMO HALF ON THE PAY SCREEN ONLY — Conall, 2026-11-12. A code is a question
15945
+ * about the price, and Review is where the price is paid; offered earlier, it opened
15946
+ * over steps that had nothing to do with it.
15947
+ */
15948
+ ...facts.can.redeemPromo && id === "REVIEW" ? { promoLabel: PROMO_COPY.open } : {}
15838
15949
  };
15839
15950
  }
15840
15951
  const stops = composeFunnel(facts.stops ?? [], facts.answers, id);
@@ -15988,6 +16099,7 @@ function stepSubtitle(facts) {
15988
16099
  if (facts.stepId === "PAYMENT_FAILED" && facts.failureReason !== null) return facts.failureReason;
15989
16100
  if (facts.stepId === "PAYMENT_SUCCESS") return paymentSuccessSubtitle(facts.buyerFirstName);
15990
16101
  if (facts.stepId === "REVIEW" || facts.stepId === "PAYMENT") {
16102
+ if (facts.orderComing === true) return HOLDING_TICKETS;
15991
16103
  return facts.holdRemaining === null ? POWERED_BY : holdSentence(facts.holdRemaining);
15992
16104
  }
15993
16105
  if (facts.stepId === "DETAILS" && facts.answersSaved) return DETAILS_SAVED_SUBTITLE;
@@ -16002,12 +16114,13 @@ function stepCardOf(facts) {
16002
16114
  const names = greeted(facts);
16003
16115
  const heading = {
16004
16116
  stepId,
16005
- copy: card2?.copy ?? STEP_CARD_COPY[stepId],
16117
+ copy: card2?.copy ?? (stepId === "PROCESSING" && facts.payment.entry === "FREE" ? FREE_ORDER_COPY.processing : STEP_CARD_COPY[stepId]),
16006
16118
  outcome: facts.outcome,
16007
16119
  failureReason: facts.failureReason,
16008
16120
  buyerFirstName: names.thanks,
16009
16121
  accountFirstName: names.welcome,
16010
16122
  holdRemaining: facts.summary.kind === "HELD" ? facts.summary.hold : null,
16123
+ orderComing: facts.orderComing === true,
16011
16124
  quoteHeadline: facts.quoteHeadline,
16012
16125
  promoSaving: facts.promoSaving,
16013
16126
  answersSaved: facts.answersSaved
@@ -16064,7 +16177,10 @@ function cardActions(facts, checkpoint) {
16064
16177
  if (stepId === "PROCESSING" && journey?.kind === "PROCESSING") {
16065
16178
  return [{ role: "secondary", label: ACTION_COPY.cancel, cancels: true }];
16066
16179
  }
16067
- const base = checkpoint ?? (stepId === "REVIEW" ? shutUnlessChargeable(reviewActions(facts.payment), facts.chargeReady !== false) : STEP_CARD_ACTIONS[stepId]);
16180
+ const base = checkpoint ?? (stepId === "REVIEW" ? shutUnlessChargeable(
16181
+ reviewActions(facts.payment),
16182
+ facts.chargeReady !== false && facts.orderComing !== true
16183
+ ) : STEP_CARD_ACTIONS[stepId]);
16068
16184
  if (pressCreatesOrder(stepId, facts.next)) {
16069
16185
  return base.map(
16070
16186
  (action) => action.role === "primary" ? { ...action, label: CREATE_ORDER_LABEL } : action
@@ -16072,7 +16188,7 @@ function cardActions(facts, checkpoint) {
16072
16188
  }
16073
16189
  switch (stepId) {
16074
16190
  case "PROMO":
16075
- return facts.promo === void 0 ? base : [promoAction(facts.promo)];
16191
+ return facts.promo === void 0 ? base : promoActions(facts.promo);
16076
16192
  /*
16077
16193
  * THE PASSKEY CARD KEEPS ONLY ITS SKIP. Its primary is the ceremony document drawn as
16078
16194
  * the card's own content — a credential can only be made by a page under the RP id —
@@ -16139,13 +16255,23 @@ function shutUnlessChargeable(actions, chargeable) {
16139
16255
  (action) => action.pays === true || action.picks !== void 0 ? { ...action, disabled: true } : action
16140
16256
  );
16141
16257
  }
16142
- function promoAction(promo) {
16143
- return promoSendable(promo.typed, promo.applied) ? { role: "primary", label: PROMO_COPY.apply, disabled: promo.saving, promo: "APPLY" } : {
16144
- role: "primary",
16145
- label: PROMO_COPY.remove,
16146
- disabled: promo.saving || promo.applied === null,
16147
- promo: "REMOVE"
16148
- };
16258
+ function promoActions(promo) {
16259
+ const applied = promo.applied;
16260
+ if (applied !== null && !promoSendable(promo.typed, applied)) {
16261
+ return [
16262
+ { role: "primary", label: PROMO_COPY.continue, disabled: promo.saving, promo: "CONTINUE" },
16263
+ { role: "secondary", label: PROMO_COPY.remove, disabled: promo.saving, promo: "REMOVE" }
16264
+ ];
16265
+ }
16266
+ return [
16267
+ {
16268
+ role: "primary",
16269
+ label: PROMO_COPY.apply,
16270
+ disabled: promo.saving || !promoSendable(promo.typed, applied),
16271
+ promo: "APPLY"
16272
+ },
16273
+ { role: "secondary", label: PROMO_COPY.back }
16274
+ ];
16149
16275
  }
16150
16276
  function pillView(facts) {
16151
16277
  const lines = facts.quote === void 0 ? null : quoteLines(facts.quote);
@@ -16320,6 +16446,12 @@ function islandStep(state, facts, stepId) {
16320
16446
  answersSaved: answersLocked(state.order.answers),
16321
16447
  payment: facts.payment,
16322
16448
  ...facts.chargeReady === void 0 ? {} : { chargeReady: facts.chargeReady },
16449
+ /*
16450
+ * READ OFF THE ORDER, SO NO RENDERER HAS TO REMEMBER IT. Review can be reached before the
16451
+ * fill lands, and a press there went on to Pay with no cart behind it and stayed there
16452
+ * when the event's questions arrived (measured 2026-11-05).
16453
+ */
16454
+ orderComing: state.order.cart === null && state.order.opening?.kind === "ASKING",
16323
16455
  detour: facts.detour,
16324
16456
  first: facts.first,
16325
16457
  next: facts.next,
@@ -16389,6 +16521,11 @@ function restingEffect(card2, id) {
16389
16521
  }
16390
16522
 
16391
16523
  // ../checkout-core/src/view/island-flow.ts
16524
+ var PROMO_EFFECT = {
16525
+ APPLY: "PROMO_APPLIED",
16526
+ REMOVE: "PROMO_REMOVED",
16527
+ CONTINUE: "PROMO_CONTINUED"
16528
+ };
16392
16529
  function openingFlow(expanded) {
16393
16530
  return {
16394
16531
  at: null,
@@ -16475,7 +16612,7 @@ function pressed(state, action, facts) {
16475
16612
  return forward(state, facts, [{ kind: "GUEST_CHOSEN" }]);
16476
16613
  }
16477
16614
  if (action.promo !== void 0) {
16478
- return still6(state, [{ kind: action.promo === "APPLY" ? "PROMO_APPLIED" : "PROMO_REMOVED" }]);
16615
+ return still6(state, [{ kind: PROMO_EFFECT[action.promo] }]);
16479
16616
  }
16480
16617
  if (action.reveals === true) {
16481
16618
  return still6({ ...state, passwordRevealed: !state.passwordRevealed });
@@ -18753,6 +18890,8 @@ var WEB_CAN = {
18753
18890
  redeemPromo: true
18754
18891
  };
18755
18892
  var WEB_PAYMENT = { entry: "BAY" };
18893
+ var CONTINUE_WAIT_MS = 3e3;
18894
+ var FREE_ORDER = { entry: "FREE" };
18756
18895
  var sendEnvelope = (url, body) => {
18757
18896
  if (typeof fetch !== "function") return;
18758
18897
  void fetch(url, { method: "POST", body, keepalive: true }).catch(() => void 0);
@@ -18838,6 +18977,7 @@ function PurchaseIsland({
18838
18977
  inventories,
18839
18978
  inventoryFilter = "checkbox",
18840
18979
  timeslotGrouping,
18980
+ questionGrouping,
18841
18981
  mode = "system",
18842
18982
  align = "bottom",
18843
18983
  placement = "page",
@@ -19098,8 +19238,8 @@ function PurchaseIsland({
19098
19238
  );
19099
19239
  const answeredByHost = (0, import_react43.useMemo)(() => hostAnswers(intent.answers), [intent.answers]);
19100
19240
  const questionIds = (0, import_react43.useMemo)(
19101
- () => questionPages(questionnaire, answeredByHost).map((question) => question.QuestionId),
19102
- [questionnaire, answeredByHost]
19241
+ () => questionCardIds(questionCards(questionnaire, answeredByHost, questionGrouping)),
19242
+ [questionnaire, answeredByHost, questionGrouping]
19103
19243
  );
19104
19244
  const answersReady = questionnaire.status === "READY" && questionsAnswered(questionnaire.questions, answersInHand);
19105
19245
  const answersSaved = answersLocked(order.answers);
@@ -19317,7 +19457,7 @@ function PurchaseIsland({
19317
19457
  () => dispatch({ kind: "DETOUR_OPENED", step: "PROMO" }),
19318
19458
  [dispatch]
19319
19459
  );
19320
- const appliedPromo = promoApplied(order.cart);
19460
+ const appliedPromo = promoApplied(order.cart, order.acceptedPromo);
19321
19461
  (0, import_react43.useEffect)(() => {
19322
19462
  setCollected((was) => ({ ...was, promoCode: appliedPromo ?? "" }));
19323
19463
  }, [appliedPromo]);
@@ -19392,6 +19532,8 @@ function PurchaseIsland({
19392
19532
  });
19393
19533
  const [reviewCartKey, setReviewCartKey] = (0, import_react43.useState)(null);
19394
19534
  const [frameHeight, setFrameHeight] = (0, import_react43.useState)(null);
19535
+ const [revolutReadyAt, setRevolutReadyAt] = (0, import_react43.useState)(null);
19536
+ const [continuing, setContinuing] = (0, import_react43.useState)(false);
19395
19537
  (0, import_react43.useEffect)(() => {
19396
19538
  if (expanded && order.cart !== null) {
19397
19539
  setReviewCartKey(order.cart.Key);
@@ -19462,7 +19604,28 @@ function PurchaseIsland({
19462
19604
  }
19463
19605
  };
19464
19606
  const cardChosen = collected.paymentMethodKey === "card";
19465
- const frameMounted = order.cart !== null && reviewCartKey === order.cart.Key;
19607
+ const free = nothingToPay(order.cart, order.items.length);
19608
+ const frameMounted = !free && order.cart !== null && reviewCartKey === order.cart.Key;
19609
+ const price2 = order.cart?.TotalAmount ?? null;
19610
+ (0, import_react43.useEffect)(() => {
19611
+ setFrameHeight(null);
19612
+ }, [price2]);
19613
+ const revolutStanding = revolutCart !== order.cart?.Key || revolutReadyAt === price2;
19614
+ const cardStanding = !cardChosen || frameHeight !== null;
19615
+ const entriesStanding = !frameMounted || cardStanding && revolutStanding;
19616
+ (0, import_react43.useEffect)(() => {
19617
+ if (!continuing) return;
19618
+ const finish = () => {
19619
+ setContinuing(false);
19620
+ dispatch({ kind: "DETOUR_CLOSED" });
19621
+ };
19622
+ if (entriesStanding) {
19623
+ finish();
19624
+ return;
19625
+ }
19626
+ const timer = window.setTimeout(finish, CONTINUE_WAIT_MS);
19627
+ return () => window.clearTimeout(timer);
19628
+ }, [continuing, entriesStanding, dispatch]);
19466
19629
  const terminalPayment = moneyMoved(reported);
19467
19630
  const {
19468
19631
  revolutActive,
@@ -19529,6 +19692,7 @@ function PurchaseIsland({
19529
19692
  (0, import_react43.useEffect)(() => {
19530
19693
  const key = order.cart?.Key;
19531
19694
  if (stepId !== "REVIEW" || key === void 0 || revolutCart === key || !answersReady) return;
19695
+ if (free) return;
19532
19696
  setRevolutCart(key);
19533
19697
  setWalletCart(key);
19534
19698
  const request = ++selectionRequest.current;
@@ -19537,7 +19701,7 @@ function PurchaseIsland({
19537
19701
  setSavedRevolutCart(key);
19538
19702
  setSavedWalletCart(key);
19539
19703
  });
19540
- }, [stepId, order.cart?.Key, revolutCart, answersReady]);
19704
+ }, [stepId, order.cart?.Key, revolutCart, answersReady, free]);
19541
19705
  const [cardStatus, setCardStatus] = (0, import_react43.useState)(null);
19542
19706
  const checkoutSessionId = (0, import_react43.useMemo)(() => crypto.randomUUID(), [order.cart?.Key]);
19543
19707
  const payEntries = frameMounted ? /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
@@ -19568,7 +19732,7 @@ function PurchaseIsland({
19568
19732
  },
19569
19733
  theme: frameTheme
19570
19734
  },
19571
- order.cart.Key
19735
+ `${order.cart.Key}:${order.cart.TotalAmount}`
19572
19736
  ) }),
19573
19737
  walletCart === order.cart.Key && /*
19574
19738
  * THE WALLET STANDS ABOVE REVOLUT PAY, which is the order the design draws and the
@@ -19611,7 +19775,7 @@ function PurchaseIsland({
19611
19775
  onSuccess: order.settledFromFrame,
19612
19776
  onError: providerFailed
19613
19777
  },
19614
- `wallet:${order.cart.Key}`
19778
+ `wallet:${order.cart.Key}:${order.cart.TotalAmount}`
19615
19779
  ) }),
19616
19780
  revolutCart === order.cart.Key && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
19617
19781
  "div",
@@ -19631,7 +19795,10 @@ function PurchaseIsland({
19631
19795
  retry: revolutFrameEpoch > 0,
19632
19796
  heightOverride: journeyInline && journeyFullscreen ? "100%" : journeyRoom?.height ?? PROVIDER_BUTTON_HEIGHT,
19633
19797
  onSubmitRequested: chargingWith("revolut_pay"),
19634
- onReady: recoveryReady,
19798
+ onReady: () => {
19799
+ recoveryReady();
19800
+ setRevolutReadyAt(order.cart?.TotalAmount ?? null);
19801
+ },
19635
19802
  onHeight: recoveryReady,
19636
19803
  theme: frameTheme,
19637
19804
  onStatusChange: (status) => {
@@ -19642,7 +19809,7 @@ function PurchaseIsland({
19642
19809
  onSuccess: order.settledFromFrame,
19643
19810
  onError: providerFailed
19644
19811
  },
19645
- `revolut:${revolutFrameEpoch}:${order.cart.Key}`
19812
+ `revolut:${revolutFrameEpoch}:${order.cart.Key}:${order.cart.TotalAmount}`
19646
19813
  )
19647
19814
  }
19648
19815
  )
@@ -19681,7 +19848,7 @@ function PurchaseIsland({
19681
19848
  collected,
19682
19849
  lines: cartLines2
19683
19850
  }) : null,
19684
- payment: WEB_PAYMENT,
19851
+ payment: free ? FREE_ORDER : WEB_PAYMENT,
19685
19852
  orderFirstName: orderedBuyer.firstName ?? null,
19686
19853
  next: walk.stops[index + 1]?.step,
19687
19854
  quote: drawnQuote,
@@ -19774,6 +19941,15 @@ function PurchaseIsland({
19774
19941
  * accepting it is what moves the flow on, not this press.
19775
19942
  */
19776
19943
  case "PAY_PRESSED":
19944
+ if (free) {
19945
+ void saveForCharge().then((saved) => {
19946
+ if (!saved) return;
19947
+ order.bookFree();
19948
+ dispatch({ kind: "DETOUR_CLOSED" });
19949
+ forward2();
19950
+ });
19951
+ return;
19952
+ }
19777
19953
  void saveForCharge().then((saved) => {
19778
19954
  if (!saved) return;
19779
19955
  setSubmitSignal((was) => was + 1);
@@ -19813,6 +19989,9 @@ function PurchaseIsland({
19813
19989
  case "PROMO_REMOVED":
19814
19990
  void order.removePromo();
19815
19991
  return;
19992
+ case "PROMO_CONTINUED":
19993
+ setContinuing(true);
19994
+ return;
19816
19995
  case "PAYMENT_CANCELLED":
19817
19996
  setCancelSignal((value) => value + 1);
19818
19997
  return;
@@ -19987,6 +20166,7 @@ function PurchaseIsland({
19987
20166
  answersLocked: answersSaved,
19988
20167
  hostAnswers: answeredByHost,
19989
20168
  question: flow.question,
20169
+ ...questionGrouping === void 0 ? {} : { questionGrouping },
19990
20170
  promo: {
19991
20171
  applied: appliedPromo,
19992
20172
  refusal: order.promo.status === "REFUSED" ? order.promo.reason : null
@@ -20049,6 +20229,7 @@ function PurchaseIsland({
20049
20229
  mark: action.mark === void 0 ? void 0 : buttonMark(action.mark),
20050
20230
  label: action.label,
20051
20231
  disabled: action.state !== "ENABLED",
20232
+ busy: continuing && pressed2?.promo === "CONTINUE",
20052
20233
  onPress: pressed2 === null ? () => void 0 : pressFor(pressed2)
20053
20234
  };
20054
20235
  });
@@ -20113,7 +20294,7 @@ function PurchaseIsland({
20113
20294
  onOpenCart: openCart,
20114
20295
  cartLabel: view.trailing.cartLabel,
20115
20296
  onOpenPromo: openPromo,
20116
- promoLabel: view.trailing.promoLabel ?? PROMO_COPY.open
20297
+ promoLabel: view.trailing.promoLabel
20117
20298
  }
20118
20299
  )
20119
20300
  ),