@ticketboothapp/booking 1.2.169 → 1.2.170

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.169",
3
+ "version": "1.2.170",
4
4
  "private": false,
5
5
  "sideEffects": [
6
6
  "**/*.css",
@@ -16,7 +16,10 @@ import {
16
16
  type AdminReleaseRefundDisposition,
17
17
  } from './admin-refund-disposition';
18
18
  import { friendlyChangeBookingError } from './change-booking-error-message';
19
- import { isProductFamilyReceiptConversion } from './change-booking-flow-helpers';
19
+ import {
20
+ isProductFamilyReceiptConversion,
21
+ omitLegacyBookingChangeComparisonLines,
22
+ } from './change-booking-flow-helpers';
20
23
 
21
24
  type TranslationFn = (key: string, params?: Record<string, string>) => string;
22
25
  type OriginalReceipt = NonNullable<ChangeBookingFlowProps['originalReceipt']>;
@@ -68,7 +71,9 @@ function normalizeLocale(locale: string): Locale {
68
71
 
69
72
  function originalLines(receipt: OriginalReceipt): PriceSummaryLine[] {
70
73
  return receipt.lineItems?.length
71
- ? mapQuoteLineItemsToPriceSummaryLines(receipt.lineItems)
74
+ ? mapQuoteLineItemsToPriceSummaryLines(
75
+ omitLegacyBookingChangeComparisonLines(receipt.lineItems),
76
+ )
72
77
  : [];
73
78
  }
74
79
 
@@ -21,6 +21,19 @@ const ZERO_PRICE_SUMMARY_LINE = 0.005;
21
21
 
22
22
  export type AddOnSelection = { addOnId: string; variantId?: string; quantity?: number };
23
23
 
24
+ /**
25
+ * Older receipts may contain comparison-only BOOKING_CHANGE rows such as
26
+ * "New Total" and "Previous Total". They are not economic purchase lines and
27
+ * must not be shown in the existing-purchase breakdown.
28
+ */
29
+ export function omitLegacyBookingChangeComparisonLines<T extends { type?: string | null }>(
30
+ lines: T[],
31
+ ): T[] {
32
+ return lines.filter(
33
+ (line) => String(line.type ?? '').trim().toUpperCase() !== 'BOOKING_CHANGE',
34
+ );
35
+ }
36
+
24
37
  /** Change-quote receipt lines may include a $0 promo/discount row; omit from sidebar summary only. */
25
38
  export function omitZeroAmountPromoDiscountSummaryLines(lines: PriceSummaryLine[]): PriceSummaryLine[] {
26
39
  return lines.filter((line) => {
@@ -78,6 +78,7 @@ import {
78
78
  buildPublicChangeAmountDueSummary,
79
79
  deriveCompatibleInitialBookingQuantities,
80
80
  isProductFamilyReceiptConversion,
81
+ omitLegacyBookingChangeComparisonLines,
81
82
  resolveChangeBookingCancellationPolicyId,
82
83
  resolveInitialAvailabilityFromBooking,
83
84
  } from '../src/components/booking/change-booking-flow-helpers';
@@ -268,6 +269,21 @@ test('resource and passenger receipts are recognized as a product-family convers
268
269
  );
269
270
  });
270
271
 
272
+ test('legacy booking-change comparison rows are omitted from the purchase breakdown', () => {
273
+ const lines = [
274
+ { type: 'TICKET', label: 'ADULT', amount: 179.32 },
275
+ { type: 'BOOKING_CHANGE', label: 'New Total', amount: 254.41 },
276
+ { type: 'booking_change', label: 'Previous Total', amount: 212.1 },
277
+ { type: ' BOOKING_CHANGE ', label: 'New Booking Difference', amount: 42.31 },
278
+ { type: 'FEE', label: 'Moraine Lake Road Access Fee', amount: 15.99 },
279
+ ];
280
+
281
+ assert.deepEqual(
282
+ omitLegacyBookingChangeComparisonLines(lines).map((line) => line.label),
283
+ ['ADULT', 'Moraine Lake Road Access Fee'],
284
+ );
285
+ });
286
+
271
287
  test('server preview exposes the resulting receipt separately from ledger allocation lines', () => {
272
288
  const preview = buildChangeBookingServerPreview(
273
289
  quote({