@ticketboothapp/booking 1.2.70 → 1.2.71

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ticketboothapp/booking",
3
- "version": "1.2.70",
3
+ "version": "1.2.71",
4
4
  "private": false,
5
5
  "sideEffects": [
6
6
  "**/*.css",
@@ -826,17 +826,12 @@ export function AdminChangeBookingFlow({
826
826
  /** Any change from an existing booking (public or provider). */
827
827
  const isChangeBookingContext = Boolean(initialValues?.bookingReference?.trim());
828
828
  /**
829
- * When the provider passes `onChangeBooking` we normally apply the change immediately on checkout.
830
- * In provider-dashboard + admin + change mode we need the "Pay now / confirm without payment" step
831
- * first, so we run the public change-intent quote + PI, then call `onChangeBooking` from
832
- * `handleConfirmWithoutPayment` (or after paying in the checkout modal).
829
+ * Public `POST .../change/quote` path whenever we are editing an existing booking including when the host passes
830
+ * `onChangeBooking`. Provider apply (`onChangeBooking`) runs only after Pay now / Confirm without payment, never from
831
+ * Continue alone.
833
832
  */
834
- const deferProviderApplyToAdminPaymentChoice =
835
- isAdmin &&
836
- isChangeBookingContext &&
837
- bookingAppMode === 'provider-dashboard' &&
838
- isProviderDashboardChange;
839
- const isCustomerSelfServeChange = !isProviderDashboardChange || deferProviderApplyToAdminPaymentChoice;
833
+ const isCustomerSelfServeChange =
834
+ !isProviderDashboardChange || isChangeBookingContext;
840
835
  /** Do not render catalog-/FE-derived dollar amounts in UI until `quoteChangeBooking` returns `serverDisplay`. */
841
836
  const suppressSelfServeCurrencyUi = isCustomerSelfServeChange;
842
837
 
@@ -1722,14 +1717,14 @@ export function AdminChangeBookingFlow({
1722
1717
  }, [initialValues?.productId, product.productId]);
1723
1718
 
1724
1719
  /**
1725
- * Receipt pricing on protected seats/fees — **customer self-serve only**: Rule A (exact receipt unit when same calendar day
1726
- * + same product option) vs Rule B (`max(receipt, live)` when date or option changes). Provider dashboard uses live catalog.
1720
+ * Receipt pricing on protected seats/fees: Rule A / B per `change-flow-pricing.ts`, same as public self-serve whenever
1721
+ * `POST .../change/quote` runs (`isCustomerSelfServeChange`, including provider dashboard with `onChangeBooking`).
1727
1722
  */
1728
1723
  const changeFlowApplyReceiptPaidFloors = useMemo(
1729
1724
  () =>
1730
- !isProviderDashboardChange &&
1725
+ isCustomerSelfServeChange &&
1731
1726
  changeFlowBookingParentProductIdForFloors === product.productId.trim(),
1732
- [isProviderDashboardChange, changeFlowBookingParentProductIdForFloors, product.productId],
1727
+ [isCustomerSelfServeChange, changeFlowBookingParentProductIdForFloors, product.productId],
1733
1728
  );
1734
1729
 
1735
1730
  useEffect(() => {
@@ -2585,7 +2580,7 @@ export function AdminChangeBookingFlow({
2585
2580
  latestChangeQuote?.serverPreview?.returnOptionPriceByReturnAvailabilityId,
2586
2581
  ]);
2587
2582
 
2588
- /** Order-summary return row uses self-serve floors via [selectedReturnOptionWithFloor]; provider stays catalog-only. */
2583
+ /** Order-summary return row uses self-serve floors via [selectedReturnOptionWithFloor] when `isCustomerSelfServeChange`. */
2589
2584
  const returnOptionForOrderSummary = useMemo(
2590
2585
  () => selectedReturnOptionWithFloor,
2591
2586
  [selectedReturnOptionWithFloor],
@@ -2839,7 +2834,7 @@ export function AdminChangeBookingFlow({
2839
2834
  */
2840
2835
  const changeFlowProtectedReturnAdjustment = useMemo(() => {
2841
2836
  if (totalQuantity <= 0) return returnPriceAdjustment;
2842
- if (isProviderDashboardChange) return returnPriceAdjustment;
2837
+ if (!isCustomerSelfServeChange) return returnPriceAdjustment;
2843
2838
  if (effectiveChangeFlowReturnUnitFloorPerPerson == null) return returnPriceAdjustment;
2844
2839
  const livePerPerson =
2845
2840
  returnOptionCatalogPerPerson ?? (selectedReturnOption?.priceAdjustmentByCurrency?.[currency] ?? 0);
@@ -2853,13 +2848,13 @@ export function AdminChangeBookingFlow({
2853
2848
  }, [
2854
2849
  totalQuantity,
2855
2850
  returnPriceAdjustment,
2856
- isProviderDashboardChange,
2857
2851
  effectiveChangeFlowReturnUnitFloorPerPerson,
2858
2852
  selectedReturnOption,
2859
2853
  returnOptionCatalogPerPerson,
2860
2854
  currency,
2861
2855
  changeFlowInitialTicketCount,
2862
2856
  changeFlowReturnPricingRuleA,
2857
+ isCustomerSelfServeChange,
2863
2858
  ]);
2864
2859
 
2865
2860
  /** Return row amount for PriceSummary, Stripe breakdown, and CheckoutModal (catalog vs protected same-product-option). */
@@ -4476,49 +4471,6 @@ export function AdminChangeBookingFlow({
4476
4471
  return;
4477
4472
  }
4478
4473
 
4479
- if (onChangeBooking && !deferProviderApplyToAdminPaymentChoice) {
4480
- const pickupForChange = pickupLocationId
4481
- ? product.pickupLocations?.find((loc) => loc.id === pickupLocationId)
4482
- : null;
4483
- await onChangeBooking({
4484
- productId: availabilityProductOptionId,
4485
- dateTime: selectedAvailability.dateTime,
4486
- bookingItems,
4487
- returnAvailabilityId: selectedReturnOption?.returnAvailabilityId ?? null,
4488
- pickupLocationId: pickupLocationId ?? null,
4489
- travelerHotel: pickupForChange?.name ?? null,
4490
- startTime: selectedAvailability.dateTime ?? null,
4491
- passengerCount: null,
4492
- childSafetySeatsCount: null,
4493
- foodRestrictions: null,
4494
- addOnSelections: addOnSelections.length > 0 ? addOnSelections : null,
4495
- cancellationPolicyId: cancellationPolicyId ?? initialValues?.cancellationPolicyId ?? null,
4496
- promoCode: appliedPromoCode ?? null,
4497
- newTotalAmount: displayChangeFlowProposedTotal,
4498
- additionalHoursCount: null,
4499
- pricingAdjustment:
4500
- providerPricingOverrides.length > 0 || providerAdditionalAdjustments.length > 0
4501
- ? {
4502
- mode: 'MANUAL_LINES',
4503
- lineOverrides: providerPricingOverrides,
4504
- additionalAdjustments: providerAdditionalAdjustments,
4505
- }
4506
- : undefined,
4507
- capacitySeatCredit: {
4508
- enabled: true,
4509
- previousPassengerCount: changeFlowInitialTicketCount,
4510
- previousAvailabilityId: initialValues?.availabilityId ?? null,
4511
- previousReturnAvailabilityId: initialValues?.returnAvailabilityId ?? null,
4512
- },
4513
- });
4514
- const refAfterChange = initialValues?.bookingReference?.trim();
4515
- if (refAfterChange) {
4516
- onSuccess?.({ reservationReference: refAfterChange });
4517
- }
4518
- setLoading(false);
4519
- return;
4520
- }
4521
-
4522
4474
  const bookingSourceContext = buildBookingSourceContext(bookingSourceAttribution, {
4523
4475
  clientChannelSource: inferClientBookingSourceFromProductIds(
4524
4476
  product.productId,
@@ -5,9 +5,9 @@
5
5
  * channel) on top of these formulas.
6
6
  *
7
7
  * ### 1. When receipt “paid floors” apply
8
- * Only **customer self-serve** change flow, when the booking’s **parent catalog product** matches the **loaded product**
9
- * (`changeFlowApplyReceiptPaidFloors` in BookingFlow). **Provider dashboard** change flow uses **live catalog only** (no
10
- * floors) so a cheaper date/return yields a lower total / refund via signed balance.
8
+ * When the booking’s **parent catalog product** matches the **loaded product** and the flow uses the public
9
+ * `POST .../change/quote` path (`isCustomerSelfServeChange` in AdminChangeBookingFlow, including provider dashboard with
10
+ * `onChangeBooking`).
11
11
  *
12
12
  * ### 2. Tickets (per category)
13
13
  * **Unchanged itinerary** (same calendar departure date **and** same product option as the booking): among seats up to the
@@ -26,12 +26,12 @@
26
26
  * BE `PublicChangeBookingQuotePricing`: **baseline party** (originally booked headcount) vs **incremental** seats. **Rule A**
27
27
  * (same `returnAvailabilityId` as the booking **and** unchanged outbound itinerary): protected pay exact locked per person;
28
28
  * incremental pay **live catalog** return only ($0 when free). **Else Rule B:** protected pay **`max(floor, live)`**;
29
- * incremental pay **live** only. Provider dashboard: **live catalog return only** (no floor).
29
+ * incremental pay **live** only.
30
30
  *
31
31
  * ### 5. Return option — **picker UI only** (BookingFlow)
32
32
  * **Self-serve:** return cards use the floored per-person price when a floor exists (aligned with §4), for every return
33
33
  * slot, regardless of date/option change.
34
- * **Provider dashboard:** cards show **catalog** prices only (no floor).
34
+ * With `POST .../change/quote`, return cards follow the same floor behavior as self-serve.
35
35
  *
36
36
  * ### 6. Quote “new booking” total & balance
37
37
  * **FE proposed total** = full cart math (subtotal + tax − promo), cent-rounded; optional **1¢ reconcile** to old receipt