@ticketboothapp/booking 1.2.117 → 1.2.119

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.117",
3
+ "version": "1.2.119",
4
4
  "private": false,
5
5
  "sideEffects": [
6
6
  "**/*.css",
@@ -2765,7 +2765,9 @@ export function AdminChangeBookingFlow({
2765
2765
  */
2766
2766
  const returnOptionsWithFloor = useMemo(() => {
2767
2767
  const options = selectedAvailability?.returnOptions ?? [];
2768
- const serverReturnMap = latestChangeQuote?.serverPreview?.returnOptionPriceByReturnAvailabilityId;
2768
+ const serverReturnMap = useAdminFeAuthoritativeQuote
2769
+ ? undefined
2770
+ : latestChangeQuote?.serverPreview?.returnOptionPriceByReturnAvailabilityId;
2769
2771
  const floor = effectiveChangeFlowReturnUnitFloorPerPerson;
2770
2772
  const applyReturnFloor = floor != null && isCustomerSelfServeChange;
2771
2773
  return options.map((opt) => {
@@ -2800,6 +2802,7 @@ export function AdminChangeBookingFlow({
2800
2802
  isCustomerSelfServeChange,
2801
2803
  currency,
2802
2804
  changeFlowSeatCreditForReturnAvailabilityId,
2805
+ useAdminFeAuthoritativeQuote,
2803
2806
  latestChangeQuote?.serverPreview?.returnOptionPriceByReturnAvailabilityId,
2804
2807
  ]);
2805
2808
 
@@ -2809,7 +2812,9 @@ export function AdminChangeBookingFlow({
2809
2812
  const applyReturnFloor = floor != null && isCustomerSelfServeChange;
2810
2813
  const rawPerPerson = selectedReturnOption.priceAdjustmentByCurrency?.[currency] ?? 0;
2811
2814
  let perPerson = rawPerPerson;
2812
- const serverReturnMap = latestChangeQuote?.serverPreview?.returnOptionPriceByReturnAvailabilityId;
2815
+ const serverReturnMap = useAdminFeAuthoritativeQuote
2816
+ ? undefined
2817
+ : latestChangeQuote?.serverPreview?.returnOptionPriceByReturnAvailabilityId;
2813
2818
  if (isCustomerSelfServeChange && serverReturnMap && selectedReturnOption.returnAvailabilityId) {
2814
2819
  const sid = selectedReturnOption.returnAvailabilityId.trim();
2815
2820
  const sp = serverReturnMap[sid];
@@ -2833,6 +2838,7 @@ export function AdminChangeBookingFlow({
2833
2838
  effectiveChangeFlowReturnUnitFloorPerPerson,
2834
2839
  isCustomerSelfServeChange,
2835
2840
  currency,
2841
+ useAdminFeAuthoritativeQuote,
2836
2842
  latestChangeQuote?.serverPreview?.returnOptionPriceByReturnAvailabilityId,
2837
2843
  ]);
2838
2844
 
@@ -2872,7 +2878,7 @@ export function AdminChangeBookingFlow({
2872
2878
  /** Quote `ticketUnitPriceByCategory` overrides catalog units for ticket rows (customer self-serve only). */
2873
2879
  const pricingForTicketSelector = useMemo(() => {
2874
2880
  const m = latestChangeQuote?.serverPreview?.ticketUnitPriceByCategory;
2875
- if (!isCustomerSelfServeChange || !m) return pricing;
2881
+ if (useAdminFeAuthoritativeQuote || !isCustomerSelfServeChange || !m) return pricing;
2876
2882
  return pricing.map((r) => {
2877
2883
  const u = m[r.category.toUpperCase()];
2878
2884
  if (u == null || !Number.isFinite(u)) return r;
@@ -2883,7 +2889,7 @@ export function AdminChangeBookingFlow({
2883
2889
  baseInDisplayCurrency: u,
2884
2890
  };
2885
2891
  });
2886
- }, [pricing, latestChangeQuote?.serverPreview?.ticketUnitPriceByCategory, isCustomerSelfServeChange]);
2892
+ }, [pricing, latestChangeQuote?.serverPreview?.ticketUnitPriceByCategory, isCustomerSelfServeChange, useAdminFeAuthoritativeQuote]);
2887
2893
 
2888
2894
  // Price breakdown: mid-layer returns line items (base + one per rule/deal). UI renders each line; rate in brackets when used.
2889
2895
  const getPriceBreakdown = useCallback((category: string, priceCAD: number, baseInDisplayCurrency: number | undefined, appliedAdjustments: Array<{ type: string; id: string; name: string; changeByCurrency?: Record<string, number> }> = []): PriceBreakdownData | null => {
@@ -3183,18 +3189,7 @@ export function AdminChangeBookingFlow({
3183
3189
  );
3184
3190
  const effectiveSubtotalForCheckout = roundMoney(effectiveSubtotal + adminCustomAdjustmentTotal);
3185
3191
 
3186
- /** Stable signature for promo discount API (avoid effect re-fire on object identity churn). */
3187
- const quantitiesSignature = useMemo(
3188
- () =>
3189
- Object.entries(quantities)
3190
- .filter(([, n]) => (n ?? 0) > 0)
3191
- .sort(([a], [b]) => a.localeCompare(b))
3192
- .map(([c, n]) => `${c}:${n}`)
3193
- .join('|'),
3194
- [quantities]
3195
- );
3196
-
3197
- /** Fee rows shown in the editor must use the same receipt-floor math as the subtotal. */
3192
+ /** Fee rows shown in change flow must use the same receipt-floor rules as the protected subtotal. */
3198
3193
  const feeLineItemsForChangeFlowDisplay = useMemo(() => {
3199
3194
  if (!changeFlowApplyReceiptPaidFloors || totalQuantity <= 0) return feeLineItems;
3200
3195
  const initialParty = changeFlowInitialTicketCount;
@@ -3221,6 +3216,17 @@ export function AdminChangeBookingFlow({
3221
3216
  changeFlowProtectedReceiptPricing,
3222
3217
  ]);
3223
3218
 
3219
+ /** Stable signature for promo discount API (avoid effect re-fire on object identity churn). */
3220
+ const quantitiesSignature = useMemo(
3221
+ () =>
3222
+ Object.entries(quantities)
3223
+ .filter(([, n]) => (n ?? 0) > 0)
3224
+ .sort(([a], [b]) => a.localeCompare(b))
3225
+ .map(([c, n]) => `${c}:${n}`)
3226
+ .join('|'),
3227
+ [quantities]
3228
+ );
3229
+
3224
3230
  // Fee line items including add-ons (for PriceSummary and CheckoutModal)
3225
3231
  const feeLineItemsWithAddOns = useMemo(() => {
3226
3232
  const addOnLines = addOnSelections
@@ -3409,7 +3415,7 @@ export function AdminChangeBookingFlow({
3409
3415
  .map((line) => `${line.category}:${line.qty}:${Math.round(line.itemTotal * 100)}`)
3410
3416
  .sort()
3411
3417
  .join('|'),
3412
- String(Math.round(feeLineItems.reduce((sum, fee) => sum + fee.totalAmount, 0) * 100)),
3418
+ String(Math.round(feeLineItemsWithAddOns.reduce((sum, fee) => sum + fee.totalAmount, 0) * 100)),
3413
3419
  String(Math.round(effectiveSubtotalForCheckout * 100)),
3414
3420
  lockedPromoCode ? String(Math.round(originalReceiptPromoAdjustment.amount * 100)) : '',
3415
3421
  ].join('::');
@@ -3424,7 +3430,7 @@ export function AdminChangeBookingFlow({
3424
3430
  currency,
3425
3431
  quantitiesSignature,
3426
3432
  ticketLineItemsForChangeFlowDisplay,
3427
- feeLineItems,
3433
+ feeLineItemsWithAddOns,
3428
3434
  effectiveSubtotalForCheckout,
3429
3435
  lockedPromoCode,
3430
3436
  originalReceiptPromoAdjustment.amount,
@@ -3434,7 +3440,7 @@ export function AdminChangeBookingFlow({
3434
3440
  selectedAvailability,
3435
3441
  ticketLineItems: ticketLineItemsForChangeFlowDisplay.map((l) => ({ category: l.category, qty: l.qty, itemTotal: l.itemTotal })),
3436
3442
  effectiveSubtotal: effectiveSubtotalForCheckout,
3437
- displayedProductFeeTotal: feeLineItems.reduce((sum, fee) => sum + fee.totalAmount, 0),
3443
+ displayedProductFeeTotal: feeLineItemsWithAddOns.reduce((sum, fee) => sum + fee.totalAmount, 0),
3438
3444
  appliedPromoCode,
3439
3445
  changeBookingPromo: lockedPromoCode
3440
3446
  ? { priorAmount: originalReceiptPromoAdjustment.amount }
@@ -3533,7 +3539,7 @@ export function AdminChangeBookingFlow({
3533
3539
 
3534
3540
  const checkoutPriceSummaryLinesForCheckout = useMemo(() => {
3535
3541
  let raw: PriceSummaryLine[];
3536
- if (suppressSelfServeCurrencyUi && selfServePricingConfirmed) {
3542
+ if (!useAdminFeAuthoritativeQuote && suppressSelfServeCurrencyUi && selfServePricingConfirmed) {
3537
3543
  const serverLines = latestChangeQuote?.serverPreview?.priceSummaryLines;
3538
3544
  raw = serverLines && serverLines.length > 0 ? serverLines : checkoutPriceSummaryLines;
3539
3545
  } else {
@@ -3561,6 +3567,7 @@ export function AdminChangeBookingFlow({
3561
3567
  }, [
3562
3568
  suppressSelfServeCurrencyUi,
3563
3569
  selfServePricingConfirmed,
3570
+ useAdminFeAuthoritativeQuote,
3564
3571
  checkoutPriceSummaryLines,
3565
3572
  latestChangeQuote?.serverPreview?.priceSummaryLines,
3566
3573
  effectivePromoDiscountAmount,
@@ -4080,7 +4087,6 @@ export function AdminChangeBookingFlow({
4080
4087
  total: roundMoney(originalReceipt.total),
4081
4088
  }
4082
4089
  : null;
4083
-
4084
4090
  /**
4085
4091
  * True until `quoteChangeBooking` returns a confirmed `serverDisplay` for the current selection.
4086
4092
  * Named so manual price-line UI can align with “still settling final price” without touching ticket/receipt math.
@@ -4105,7 +4111,7 @@ export function AdminChangeBookingFlow({
4105
4111
  const displayedChangeAmountsRaw = resolveChangeFlowDisplayedAmounts({
4106
4112
  providerPreview: providerTotalsPreview,
4107
4113
  serverQuotePreview:
4108
- isCustomerSelfServeChange && latestChangeQuote?.serverDisplay
4114
+ !useAdminFeAuthoritativeQuote && isCustomerSelfServeChange && latestChangeQuote?.serverDisplay
4109
4115
  ? latestChangeQuote.serverDisplay
4110
4116
  : null,
4111
4117
  fromCart: {
@@ -4117,7 +4123,7 @@ export function AdminChangeBookingFlow({
4117
4123
  /** When cart drives display, {@link effectiveSubtotalForCheckout} already includes admin adjustments — do not add twice. */
4118
4124
  const displayLayerUsesExternalPricing =
4119
4125
  Boolean(providerTotalsPreview) ||
4120
- (isCustomerSelfServeChange && Boolean(latestChangeQuote?.serverDisplay));
4126
+ (!useAdminFeAuthoritativeQuote && isCustomerSelfServeChange && Boolean(latestChangeQuote?.serverDisplay));
4121
4127
  const adminTaxDeltaForExternalDisplay =
4122
4128
  displayLayerUsesExternalPricing && !isTaxIncludedInPrice && Math.abs(adminCustomAdjustmentTotal) >= 0.0005
4123
4129
  ? roundMoney(adminCustomAdjustmentTotal * (pricingConfig?.taxRate ?? 0))
@@ -6196,15 +6202,13 @@ export function AdminChangeBookingFlow({
6196
6202
  ? t('booking.totalOwedForBookingChange')
6197
6203
  : 'Total owed for booking difference'
6198
6204
  }
6199
- subtotal={unchangedReceiptAnchor ? undefined : adminFeAuthoritativeReceipt.subtotal}
6205
+ subtotal={adminFeAuthoritativeReceipt.subtotal}
6200
6206
  taxAmount={
6201
- unchangedReceiptAnchor
6202
- ? 0
6203
- : !isTaxIncludedInPrice &&
6204
- adminFeAuthoritativeReceipt.tax > 0 &&
6205
- !priceSummaryLinesIncludeTaxRow
6206
- ? adminFeAuthoritativeReceipt.tax
6207
- : 0
6207
+ !isTaxIncludedInPrice &&
6208
+ adminFeAuthoritativeReceipt.tax > 0 &&
6209
+ !priceSummaryLinesIncludeTaxRow
6210
+ ? adminFeAuthoritativeReceipt.tax
6211
+ : 0
6208
6212
  }
6209
6213
  taxRate={pricingConfig?.taxRate}
6210
6214
  currency={currency}