@ticketboothapp/booking 1.2.89 → 1.2.91
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
|
@@ -880,10 +880,7 @@ export function AdminChangeBookingFlow({
|
|
|
880
880
|
}
|
|
881
881
|
}, [initialValues?.dateTime, companyTimezone]);
|
|
882
882
|
const isProviderDashboardChange = Boolean(onChangeBooking);
|
|
883
|
-
const useAdminFeAuthoritativeQuote =
|
|
884
|
-
isAdmin &&
|
|
885
|
-
isProviderDashboardChange &&
|
|
886
|
-
Boolean(flowUi?.adminFeAuthoritativeQuoteEnabled);
|
|
883
|
+
const useAdminFeAuthoritativeQuote = isAdmin && isProviderDashboardChange;
|
|
887
884
|
/** Any change from an existing booking (public or provider). */
|
|
888
885
|
const isChangeBookingContext = Boolean(initialValues?.bookingReference?.trim());
|
|
889
886
|
/**
|
|
@@ -3995,7 +3992,7 @@ export function AdminChangeBookingFlow({
|
|
|
3995
3992
|
<pre className="mt-2 max-h-64 overflow-auto whitespace-pre-wrap break-words font-mono text-[11px] leading-relaxed text-stone-800">
|
|
3996
3993
|
{[
|
|
3997
3994
|
`Amount-due path: ${path}`,
|
|
3998
|
-
`
|
|
3995
|
+
`adminFeAuthoritativeQuote: ${String(useAdminFeAuthoritativeQuote)}`,
|
|
3999
3996
|
`displayLayerUsesExternalPricing: ${String(displayLayerUsesExternalPricing)} (server/provider totals omit FE admin lines until overlaid)`,
|
|
4000
3997
|
`selfServePricingConfirmed: ${String(selfServePricingConfirmed)} · changeQuoteLoading: ${String(changeQuoteLoading)}`,
|
|
4001
3998
|
`Cart subtotal (excl. admin custom lines): ${fmt(effectiveSubtotal)}`,
|
|
@@ -4930,6 +4927,7 @@ export function AdminChangeBookingFlow({
|
|
|
4930
4927
|
let quotedPriceDiff: number | null = null;
|
|
4931
4928
|
let changeIntentIdForCheckout: string | undefined;
|
|
4932
4929
|
let changeBookingReferenceForPaidFlow: string | undefined;
|
|
4930
|
+
let confirmedChangeAmountDueForCheckout: number | null = null;
|
|
4933
4931
|
|
|
4934
4932
|
if (isCustomerSelfServeChange) {
|
|
4935
4933
|
const changeBookingReference = initialValues?.bookingReference?.trim();
|
|
@@ -4961,15 +4959,18 @@ export function AdminChangeBookingFlow({
|
|
|
4961
4959
|
previousReturnAvailabilityId: initialValues?.returnAvailabilityId ?? null,
|
|
4962
4960
|
},
|
|
4963
4961
|
};
|
|
4962
|
+
const adminFeAmountDueMajorUnits = normalizeNearZeroOwed(
|
|
4963
|
+
roundMoney(
|
|
4964
|
+
originalReceipt
|
|
4965
|
+
? adminFeAuthoritativeReceipt.total - originalReceipt.total
|
|
4966
|
+
: changeFlowClientEstimateDue
|
|
4967
|
+
)
|
|
4968
|
+
);
|
|
4964
4969
|
const quote = useAdminFeAuthoritativeQuote
|
|
4965
4970
|
? await quoteChangeBookingAdminFeReceipt({
|
|
4966
4971
|
...quoteRequestBase,
|
|
4967
4972
|
feReceipt: adminFeAuthoritativeReceipt,
|
|
4968
|
-
feAmountDueMajorUnits:
|
|
4969
|
-
originalReceipt
|
|
4970
|
-
? adminFeAuthoritativeReceipt.total - originalReceipt.total
|
|
4971
|
-
: changeFlowClientEstimateDue
|
|
4972
|
-
),
|
|
4973
|
+
feAmountDueMajorUnits: adminFeAmountDueMajorUnits,
|
|
4973
4974
|
})
|
|
4974
4975
|
: await quoteChangeBooking(quoteRequestBase);
|
|
4975
4976
|
const quoteSlice = sliceChangeQuoteForUi(
|
|
@@ -5004,19 +5005,23 @@ export function AdminChangeBookingFlow({
|
|
|
5004
5005
|
quote.previousTotalCents != null && quote.newTotalCents != null
|
|
5005
5006
|
? (quote.newTotalCents - quote.previousTotalCents) / 100
|
|
5006
5007
|
: quote.balanceDeltaMajorUnits ?? null;
|
|
5007
|
-
const chargeDue =
|
|
5008
|
-
|
|
5008
|
+
const chargeDue = useAdminFeAuthoritativeQuote
|
|
5009
|
+
? Math.max(0, adminFeAmountDueMajorUnits)
|
|
5010
|
+
: signedBalanceMajor != null
|
|
5009
5011
|
? Math.max(0, signedBalanceMajor)
|
|
5010
5012
|
: quote.amountDueCents != null
|
|
5011
5013
|
? quote.amountDueCents / 100
|
|
5012
5014
|
: Math.max(0, quote.priceDiff ?? 0);
|
|
5013
5015
|
const feChangeDue =
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5016
|
+
useAdminFeAuthoritativeQuote
|
|
5017
|
+
? adminFeAmountDueMajorUnits
|
|
5018
|
+
: signedBalanceMajor ??
|
|
5019
|
+
changeFlowBalanceVsOriginal({
|
|
5020
|
+
newTotal: serverNewTotalForGuard,
|
|
5021
|
+
originalReceiptTotal: originalReceipt?.total ?? 0,
|
|
5022
|
+
audience: 'admin',
|
|
5023
|
+
});
|
|
5024
|
+
confirmedChangeAmountDueForCheckout = normalizeNearZeroOwed(roundMoney(chargeDue));
|
|
5020
5025
|
if (feChangeDue > 0.02 && chargeDue <= 0.009) {
|
|
5021
5026
|
throw new Error(
|
|
5022
5027
|
'This change requires payment, but the price could not be confirmed. Please refresh and try again.'
|
|
@@ -5030,6 +5035,7 @@ export function AdminChangeBookingFlow({
|
|
|
5030
5035
|
);
|
|
5031
5036
|
}
|
|
5032
5037
|
const upgradeWithoutCharge =
|
|
5038
|
+
!useAdminFeAuthoritativeQuote &&
|
|
5033
5039
|
quote.newTotalCents != null &&
|
|
5034
5040
|
quote.previousTotalCents != null &&
|
|
5035
5041
|
quote.newTotalCents > quote.previousTotalCents + 1;
|
|
@@ -5085,10 +5091,11 @@ export function AdminChangeBookingFlow({
|
|
|
5085
5091
|
// Backend will charge totalAmount and store this as the receipt so /manage matches.
|
|
5086
5092
|
const taxForBreakdown = effectivePromoDiscountAmount > 0 ? effectiveTax : tax;
|
|
5087
5093
|
const amountDueForCheckout = isCustomerSelfServeChange
|
|
5088
|
-
?
|
|
5094
|
+
? confirmedChangeAmountDueForCheckout ??
|
|
5095
|
+
Math.max(
|
|
5089
5096
|
0,
|
|
5090
5097
|
changeFlowBalanceVsOriginal({
|
|
5091
|
-
newTotal:
|
|
5098
|
+
newTotal: displayChangeFlowProposedTotalWithEditableLines,
|
|
5092
5099
|
originalReceiptTotal: originalReceipt?.total ?? 0,
|
|
5093
5100
|
audience: 'admin',
|
|
5094
5101
|
}),
|
|
@@ -65,11 +65,6 @@ export interface BookingFlowUiOptions {
|
|
|
65
65
|
itineraryStickyTopOffsetPx?: number;
|
|
66
66
|
/** Provider dashboard change flow: quote/override panel shown immediately before confirm CTA. */
|
|
67
67
|
providerDashboardChangePricingUi?: ProviderDashboardChangePricingUi;
|
|
68
|
-
/**
|
|
69
|
-
* Admin/provider-dashboard change flow: when true, use the admin FE-authoritative quote API.
|
|
70
|
-
* This is a rollout flag; public self-serve must stay on the existing public quote endpoint.
|
|
71
|
-
*/
|
|
72
|
-
adminFeAuthoritativeQuoteEnabled?: boolean;
|
|
73
68
|
}
|
|
74
69
|
|
|
75
70
|
/**
|