@ticketboothapp/booking 1.2.168 → 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.168",
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']>;
@@ -39,6 +42,8 @@ export interface AdminChangeReceiptComparisonProps {
39
42
  selectionChanged: boolean;
40
43
  quoteError?: string | null;
41
44
  amountDueLabel: string;
45
+ /** Whether to show the detailed post-change settlement summary above the amount-due bar. */
46
+ showAfterChangeSummary?: boolean;
42
47
  currency: Currency;
43
48
  locale: string;
44
49
  t: TranslationFn;
@@ -66,7 +71,9 @@ function normalizeLocale(locale: string): Locale {
66
71
 
67
72
  function originalLines(receipt: OriginalReceipt): PriceSummaryLine[] {
68
73
  return receipt.lineItems?.length
69
- ? mapQuoteLineItemsToPriceSummaryLines(receipt.lineItems)
74
+ ? mapQuoteLineItemsToPriceSummaryLines(
75
+ omitLegacyBookingChangeComparisonLines(receipt.lineItems),
76
+ )
70
77
  : [];
71
78
  }
72
79
 
@@ -98,6 +105,7 @@ export function AdminChangeReceiptComparison({
98
105
  selectionChanged,
99
106
  quoteError,
100
107
  amountDueLabel,
108
+ showAfterChangeSummary = true,
101
109
  currency,
102
110
  locale,
103
111
  t,
@@ -317,7 +325,7 @@ export function AdminChangeReceiptComparison({
317
325
  </section>
318
326
  ) : null}
319
327
 
320
- {quoteReady ? (
328
+ {quoteReady && showAfterChangeSummary ? (
321
329
  <section className="rounded-lg border border-stone-300 bg-white px-3 py-3 shadow-sm">
322
330
  <h3 className="text-sm font-semibold text-stone-900">After this change</h3>
323
331
  {settlementReady ? (
@@ -612,6 +612,7 @@ export function ChangeBookingFlow({
612
612
  selectionChanged={hasEffectiveChangeSelection}
613
613
  quoteError={changeQuoteFetchError}
614
614
  amountDueLabel="Amount due now"
615
+ showAfterChangeSummary={false}
615
616
  currency={currency}
616
617
  locale={locale}
617
618
  t={t}
@@ -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({