@ticketboothapp/booking 1.2.122 → 1.2.123

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.122",
3
+ "version": "1.2.123",
4
4
  "private": false,
5
5
  "sideEffects": [
6
6
  "**/*.css",
@@ -209,6 +209,48 @@ function resolveTicketQtyFromQuantities(
209
209
  return undefined;
210
210
  }
211
211
 
212
+ function normalizeFeReceiptLineItemType(type: string | null | undefined): string | undefined {
213
+ const normalized = String(type ?? '').trim().toUpperCase();
214
+ if (!normalized) return undefined;
215
+ switch (normalized) {
216
+ case 'TICKET':
217
+ case 'ADULT':
218
+ case 'CHILD':
219
+ case 'INFANT':
220
+ case 'SENIOR':
221
+ case 'STUDENT':
222
+ return 'TICKET';
223
+ case 'RETURN':
224
+ case 'RETURN_OPTION':
225
+ case 'RETURNOPTION':
226
+ return 'RETURN_OPTION';
227
+ case 'CANCELLATION':
228
+ case 'CANCELLATION_UPGRADE':
229
+ case 'CANCELLATION_POLICY_UPGRADE':
230
+ return 'CANCELLATION_UPGRADE';
231
+ case 'PROMO':
232
+ case 'PROMO_CODE':
233
+ return 'PROMO_CODE';
234
+ case 'VOUCHER':
235
+ case 'DISCOUNT':
236
+ return 'DISCOUNT';
237
+ case 'GIFT_CARD':
238
+ return 'GIFT_CARD';
239
+ case 'DEAL':
240
+ return 'DEAL';
241
+ case 'TAX':
242
+ return 'TAX';
243
+ case 'ROUNDING':
244
+ return 'ROUNDING';
245
+ case 'BOOKING_CHANGE':
246
+ return 'BOOKING_CHANGE';
247
+ case 'FEE':
248
+ return 'FEE';
249
+ default:
250
+ return 'FEE';
251
+ }
252
+ }
253
+
212
254
  /** Receipt TICKET rows sent on admin quote must follow picker {@link quantities}: BE apply uses these lines for headcount when feReceipt is authoritative — server `priceSummaryLines` can lag counts. */
213
255
  function mapSummaryLinesToFeReceiptLineItems(
214
256
  lines: PriceSummaryLine[],
@@ -231,11 +273,10 @@ function mapSummaryLinesToFeReceiptLineItems(
231
273
  quantity: Math.max(0, effectiveQty),
232
274
  };
233
275
  }
234
- const normalizedType = String(line.type ?? '').trim().toUpperCase();
235
276
  return {
236
277
  label: line.label,
237
278
  amount: roundMoney(line.amount),
238
- type: normalizedType || undefined,
279
+ type: normalizeFeReceiptLineItemType(line.type),
239
280
  quantity: line.quantity ?? undefined,
240
281
  };
241
282
  });
@@ -4238,7 +4279,7 @@ export function AdminChangeBookingFlow({
4238
4279
  totalAmount: adminFeAuthoritativeReceipt.total,
4239
4280
  currency: adminFeAuthoritativeReceipt.currency ?? currency,
4240
4281
  lineItems: adminFeAuthoritativeReceipt.lineItems.map((line) => ({
4241
- type: String(line.type || 'FEE'),
4282
+ type: normalizeFeReceiptLineItemType(line.type) || 'FEE',
4242
4283
  label: String(line.label || 'Adjustment'),
4243
4284
  amount: Number(line.amount) || 0,
4244
4285
  ...(line.quantity != null ? { quantity: Number(line.quantity) || 0 } : {}),