@ticketboothapp/booking 1.2.163 → 1.2.164

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.163",
3
+ "version": "1.2.164",
4
4
  "private": false,
5
5
  "sideEffects": [
6
6
  "**/*.css",
@@ -16,10 +16,13 @@ import type { ChangeBookingPaidCheckoutModalData } from './change-booking-paymen
16
16
 
17
17
  export type AdminChangeCheckoutModalData = ChangeBookingPaidCheckoutModalData & {
18
18
  finalizeExistingChangeInline?: boolean;
19
+ pricingQuoteId?: string;
19
20
  };
20
21
 
21
22
  export interface AdminChangePaymentChoiceData {
22
23
  reservationReference: string;
24
+ /** Immutable quote snapshot used by both payment preparation and final apply. */
25
+ pricingQuoteId?: string;
23
26
  reservationExpiration?: string;
24
27
  checkoutBreakdown: CheckoutBreakdown;
25
28
  totalAmount: number;
@@ -51,6 +54,7 @@ export interface AdminChangePaymentChoiceData {
51
54
 
52
55
  export interface BuildAdminChangePaymentChoiceDataParams {
53
56
  reservationReference: string;
57
+ pricingQuoteId?: string;
54
58
  checkoutBreakdown: CheckoutBreakdown;
55
59
  totalAmount: number;
56
60
  datePart: string;
@@ -94,6 +98,7 @@ export function buildAdminChangePayNowCheckoutModalData(
94
98
  ): AdminChangeCheckoutModalData {
95
99
  return {
96
100
  reservationReference: adminChoiceData.reservationReference,
101
+ pricingQuoteId: adminChoiceData.pricingQuoteId,
97
102
  reservationExpiration: adminChoiceData.reservationExpiration,
98
103
  customerLastName: lastName.trim(),
99
104
  ticketLines: adminChoiceData.ticketLinesForModal,
@@ -563,6 +563,7 @@ export function useAdminChangeCheckoutController({
563
563
  }
564
564
  setAdminChoiceData(buildAdminChangePaymentChoiceData({
565
565
  reservationReference: bookingReference,
566
+ pricingQuoteId: quoteId,
566
567
  checkoutBreakdown,
567
568
  totalAmount: amountDueForCheckout,
568
569
  datePart,
@@ -589,7 +590,7 @@ export function useAdminChangeCheckoutController({
589
590
  'Pay later to apply the change and add the amount to the booking balance, or collect a new card payment before applying it.',
590
591
  confirmWithoutPaymentLabel: 'Pay later',
591
592
  previousTotal: originalReceipt?.total,
592
- newTotal: latestChangeQuote?.quotedTotal ?? latestChangeQuote?.serverDisplay?.total,
593
+ newTotal: latestChangeQuote?.serverDisplay?.total ?? latestChangeQuote?.quotedTotal,
593
594
  finalizeExistingChangeInline: true,
594
595
  preferConfirmWithoutPayment: true,
595
596
  }));
@@ -859,8 +860,8 @@ export function useAdminChangeCheckoutController({
859
860
  return;
860
861
  }
861
862
  if (isProviderDashboardChange && isChangeBookingContext) {
862
- const bookingReference = initialValues?.bookingReference?.trim();
863
- const quoteId = latestChangeQuote?.quoteId?.trim();
863
+ const bookingReference = adminChoiceData.reservationReference.trim();
864
+ const quoteId = adminChoiceData.pricingQuoteId?.trim();
864
865
  if (!bookingReference || !quoteId) {
865
866
  setError('The authoritative change quote is no longer available.');
866
867
  return;
@@ -893,8 +894,8 @@ export function useAdminChangeCheckoutController({
893
894
 
894
895
  const handlePaymentConfirmed = useCallback(async (paymentIntentId: string) => {
895
896
  if (!isProviderDashboardChange || !isChangeBookingContext) return;
896
- const bookingReference = initialValues?.bookingReference?.trim();
897
- const quoteId = latestChangeQuote?.quoteId?.trim();
897
+ const bookingReference = checkoutModalData?.reservationReference?.trim();
898
+ const quoteId = checkoutModalData?.pricingQuoteId?.trim();
898
899
  if (!bookingReference || !quoteId) {
899
900
  throw new Error('Payment was authorized, but the booking quote is no longer available.');
900
901
  }
@@ -910,10 +911,10 @@ export function useAdminChangeCheckoutController({
910
911
  onSuccess?.({ reservationReference: bookingReference });
911
912
  finishManageFlow(bookingReference);
912
913
  }, [
913
- initialValues?.bookingReference,
914
+ checkoutModalData?.pricingQuoteId,
915
+ checkoutModalData?.reservationReference,
914
916
  isChangeBookingContext,
915
917
  isProviderDashboardChange,
916
- latestChangeQuote?.quoteId,
917
918
  onSuccess,
918
919
  ]);
919
920
 
@@ -284,8 +284,11 @@ export function useAdminChangeQuotePreview({
284
284
  hasChangesFromInitial: hasEffectiveChangeSelection,
285
285
  selectionTotal:
286
286
  originalReceipt
287
- ? selfServePricingConfirmed && latestChangeQuote?.serverPreview?.totalNewBooking != null
288
- ? latestChangeQuote.serverPreview.totalNewBooking
287
+ ? selfServePricingConfirmed && latestChangeQuote != null
288
+ ? latestChangeQuote.quotedTotal ??
289
+ latestChangeQuote.serverDisplay?.total ??
290
+ latestChangeQuote.serverPreview?.totalNewBooking ??
291
+ null
289
292
  : suppressSelfServeCurrencyUi
290
293
  ? null
291
294
  : displayChangeFlowProposedTotalWithEditableLines
@@ -306,6 +309,8 @@ export function useAdminChangeQuotePreview({
306
309
  displayChangeFlowProposedTotalWithEditableLines,
307
310
  suppressSelfServeCurrencyUi,
308
311
  selfServePricingConfirmed,
312
+ latestChangeQuote?.quotedTotal,
313
+ latestChangeQuote?.serverDisplay?.total,
309
314
  latestChangeQuote?.serverPreview?.totalNewBooking,
310
315
  ]);
311
316
 
@@ -80,6 +80,7 @@ test('admin payment choice countdown expires exactly at the reservation deadline
80
80
  test('admin existing-booking pay-now review keeps previous, updated, and exact difference totals', () => {
81
81
  const choice = buildAdminChangePaymentChoiceData({
82
82
  reservationReference: 'KBRCIGCO',
83
+ pricingQuoteId: 'quote_exact_admin_change',
83
84
  checkoutBreakdown: { lineItems: [] },
84
85
  totalAmount: 256.58,
85
86
  datePart: '2026-07-31',
@@ -112,6 +113,7 @@ test('admin existing-booking pay-now review keeps previous, updated, and exact d
112
113
  differenceTotal: 256.58,
113
114
  });
114
115
  assert.equal(checkout.total, 256.58);
116
+ assert.equal(checkout.pricingQuoteId, 'quote_exact_admin_change');
115
117
  assert.equal(checkout.finalizeExistingChangeInline, true);
116
118
  assert.equal(choice.confirmWithoutPaymentLabel, 'Pay later');
117
119
  assert.equal(choice.preferConfirmWithoutPayment, true);