@ticketboothapp/booking 1.2.115 → 1.2.116

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.115",
3
+ "version": "1.2.116",
4
4
  "private": false,
5
5
  "sideEffects": [
6
6
  "**/*.css",
@@ -3194,6 +3194,33 @@ export function AdminChangeBookingFlow({
3194
3194
  [quantities]
3195
3195
  );
3196
3196
 
3197
+ /** Fee rows shown in the editor must use the same receipt-floor math as the subtotal. */
3198
+ const feeLineItemsForChangeFlowDisplay = useMemo(() => {
3199
+ if (!changeFlowApplyReceiptPaidFloors || totalQuantity <= 0) return feeLineItems;
3200
+ const initialParty = changeFlowInitialTicketCount;
3201
+ return feeLineItems.map((line) => {
3202
+ const key = normalizeLineLabelForCompare(line.name || '');
3203
+ const bookedFeePerPerson = key ? changeFlowBookedFeeUnitByNormalizedLabel.get(key) : undefined;
3204
+ return {
3205
+ ...line,
3206
+ totalAmount: changeFlowFeeLineTotalWithReceiptFloor({
3207
+ totalQuantity,
3208
+ initialTicketCount: initialParty,
3209
+ bookedFeePerPerson,
3210
+ liveFeeLineTotal: Number(line.totalAmount) || 0,
3211
+ protectedReceiptPricing: changeFlowProtectedReceiptPricing,
3212
+ }),
3213
+ };
3214
+ });
3215
+ }, [
3216
+ changeFlowApplyReceiptPaidFloors,
3217
+ totalQuantity,
3218
+ feeLineItems,
3219
+ changeFlowInitialTicketCount,
3220
+ changeFlowBookedFeeUnitByNormalizedLabel,
3221
+ changeFlowProtectedReceiptPricing,
3222
+ ]);
3223
+
3197
3224
  // Fee line items including add-ons (for PriceSummary and CheckoutModal)
3198
3225
  const feeLineItemsWithAddOns = useMemo(() => {
3199
3226
  const addOnLines = addOnSelections
@@ -3210,8 +3237,8 @@ export function AdminChangeBookingFlow({
3210
3237
  return { name, totalAmount: amt, description: addOn.description ?? undefined };
3211
3238
  })
3212
3239
  .filter((x): x is NonNullable<typeof x> => x != null);
3213
- return [...feeLineItems, ...addOnLines];
3214
- }, [feeLineItems, addOnSelections, addOns]);
3240
+ return [...feeLineItemsForChangeFlowDisplay, ...addOnLines];
3241
+ }, [feeLineItemsForChangeFlowDisplay, addOnSelections, addOns]);
3215
3242
 
3216
3243
  const providerPricingUi = flowUi?.providerDashboardChangePricingUi;
3217
3244
  const providerQuotedLines = providerPricingUi?.quotedLines ?? [];
@@ -3298,7 +3325,7 @@ export function AdminChangeBookingFlow({
3298
3325
  showProviderPricingInlineEditor
3299
3326
  ? providerEditableLineByNormalizedLabel.get(
3300
3327
  normalizeReceiptLabel(
3301
- feeLineItems.some((f) => f.name === fee.name)
3328
+ feeLineItemsForChangeFlowDisplay.some((f) => f.name === fee.name)
3302
3329
  ? `${fee.name} (${totalQuantity} ${totalQuantity === 1 ? 'person' : 'people'})`
3303
3330
  : fee.name
3304
3331
  )
@@ -3308,12 +3335,12 @@ export function AdminChangeBookingFlow({
3308
3335
  showProviderPricingInlineEditor &&
3309
3336
  providerEditableLineByNormalizedLabel.has(
3310
3337
  normalizeReceiptLabel(
3311
- feeLineItems.some((f) => f.name === fee.name)
3338
+ feeLineItemsForChangeFlowDisplay.some((f) => f.name === fee.name)
3312
3339
  ? `${fee.name} (${totalQuantity} ${totalQuantity === 1 ? 'person' : 'people'})`
3313
3340
  : fee.name
3314
3341
  )
3315
3342
  ),
3316
- label: feeLineItems.some((f) => f.name === fee.name)
3343
+ label: feeLineItemsForChangeFlowDisplay.some((f) => f.name === fee.name)
3317
3344
  ? `${fee.name} (${totalQuantity} ${totalQuantity === 1 ? 'person' : 'people'})`
3318
3345
  : fee.name,
3319
3346
  amount: fee.totalAmount,
@@ -3337,7 +3364,7 @@ export function AdminChangeBookingFlow({
3337
3364
  selectedCancellationPolicy,
3338
3365
  effectiveCancellationPolicyLabel,
3339
3366
  feeLineItemsWithAddOns,
3340
- feeLineItems,
3367
+ feeLineItemsForChangeFlowDisplay,
3341
3368
  showProviderPricingInlineEditor,
3342
3369
  providerEditableLineByNormalizedLabel,
3343
3370
  ]);
@@ -4045,6 +4072,14 @@ export function AdminChangeBookingFlow({
4045
4072
  providerHasAdditionalAdjustments ||
4046
4073
  providerHasEditableSummaryLineOverrides ||
4047
4074
  Math.abs(adminCustomAdjustmentTotal) >= 0.005;
4075
+ const unchangedReceiptAnchor =
4076
+ originalReceipt && !hasEffectiveChangeSelection
4077
+ ? {
4078
+ subtotal: roundMoney(originalReceipt.subtotal),
4079
+ tax: roundMoney(originalReceipt.tax),
4080
+ total: roundMoney(originalReceipt.total),
4081
+ }
4082
+ : null;
4048
4083
 
4049
4084
  /**
4050
4085
  * True until `quoteChangeBooking` returns a confirmed `serverDisplay` for the current selection.
@@ -4088,14 +4123,22 @@ export function AdminChangeBookingFlow({
4088
4123
  ? roundMoney(adminCustomAdjustmentTotal * (pricingConfig?.taxRate ?? 0))
4089
4124
  : 0;
4090
4125
  const displayChangeFlowSubtotal = roundMoney(
4091
- displayedChangeAmountsRaw.subtotal +
4092
- (displayLayerUsesExternalPricing ? adminCustomAdjustmentTotal : 0)
4126
+ unchangedReceiptAnchor
4127
+ ? unchangedReceiptAnchor.subtotal
4128
+ : displayedChangeAmountsRaw.subtotal +
4129
+ (displayLayerUsesExternalPricing ? adminCustomAdjustmentTotal : 0)
4130
+ );
4131
+ const displayChangeFlowTax = roundMoney(
4132
+ unchangedReceiptAnchor
4133
+ ? unchangedReceiptAnchor.tax
4134
+ : displayedChangeAmountsRaw.tax + adminTaxDeltaForExternalDisplay
4093
4135
  );
4094
- const displayChangeFlowTax = roundMoney(displayedChangeAmountsRaw.tax + adminTaxDeltaForExternalDisplay);
4095
4136
  const displayChangeFlowProposedTotal = roundMoney(
4096
- displayLayerUsesExternalPricing
4097
- ? displayedChangeAmountsRaw.total + adminCustomAdjustmentTotal + adminTaxDeltaForExternalDisplay
4098
- : displayedChangeAmountsRaw.total
4137
+ unchangedReceiptAnchor
4138
+ ? unchangedReceiptAnchor.total
4139
+ : displayLayerUsesExternalPricing
4140
+ ? displayedChangeAmountsRaw.total + adminCustomAdjustmentTotal + adminTaxDeltaForExternalDisplay
4141
+ : displayedChangeAmountsRaw.total
4099
4142
  );
4100
4143
  const displayChangeFlowProposedTotalWithEditableLines = roundMoney(
4101
4144
  displayChangeFlowProposedTotal + editableSummaryPreSubtotalDelta
@@ -4191,6 +4234,7 @@ export function AdminChangeBookingFlow({
4191
4234
 
4192
4235
  const changeFlowClientEstimateDueBase = (() => {
4193
4236
  if (!originalReceipt) return totalPrice;
4237
+ if (unchangedReceiptAnchor) return 0;
4194
4238
  // Self-serve quote: match BE receipt / intent: (newTotalCents − previousTotalCents) / 100.
4195
4239
  if (isCustomerSelfServeChange && latestChangeQuote != null && !changeQuoteFetchError) {
4196
4240
  const pq = latestChangeQuote.quotePreviousTotalCents;
@@ -4306,6 +4350,7 @@ export function AdminChangeBookingFlow({
4306
4350
  displayedChangeAmountsRaw.tax,
4307
4351
  displayedChangeAmountsRaw.total,
4308
4352
  editableSummaryPreSubtotalDelta,
4353
+ unchangedReceiptAnchor,
4309
4354
  displayChangeFlowProposedTotal,
4310
4355
  displayChangeFlowProposedTotalWithEditableLines,
4311
4356
  adminFeAuthoritativeReceipt,