@ticketboothapp/booking 1.2.171 → 1.2.173
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
|
@@ -188,38 +188,17 @@ export function useAdminChangeQuotePreview({
|
|
|
188
188
|
latestChangeQuote?.canProceed === false &&
|
|
189
189
|
(latestChangeQuote.refundDecisionOperations?.length ?? 0) === 0;
|
|
190
190
|
const refundDecisionRequired = (latestChangeQuote?.refundDecisionOperations?.length ?? 0) > 0;
|
|
191
|
-
const
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
*/
|
|
198
|
-
const quoteAvailability = useMemo<Availability | null>(() => {
|
|
199
|
-
if (selectedAvailability) return selectedAvailability;
|
|
200
|
-
if (!needsAdjustmentDiscovery || !initialValues?.dateTime?.trim()) return null;
|
|
201
|
-
const optionId = initialValues.productOptionId?.trim() || initialValues.productId?.trim();
|
|
202
|
-
if (!optionId) return null;
|
|
203
|
-
return {
|
|
204
|
-
dateTime: initialValues.dateTime.trim(),
|
|
205
|
-
availabilityId: initialValues.availabilityId?.trim() || undefined,
|
|
206
|
-
productOptionId: optionId,
|
|
207
|
-
vacancies: Math.max(totalQuantity, 1),
|
|
208
|
-
currency,
|
|
209
|
-
};
|
|
210
|
-
}, [
|
|
211
|
-
selectedAvailability,
|
|
212
|
-
needsAdjustmentDiscovery,
|
|
213
|
-
initialValues?.dateTime,
|
|
214
|
-
initialValues?.availabilityId,
|
|
215
|
-
initialValues?.productOptionId,
|
|
216
|
-
initialValues?.productId,
|
|
217
|
-
totalQuantity,
|
|
218
|
-
currency,
|
|
219
|
-
]);
|
|
191
|
+
const hasPublishedChangeQuoteRef = useRef(latestChangeQuote !== null);
|
|
192
|
+
hasPublishedChangeQuoteRef.current = latestChangeQuote !== null;
|
|
193
|
+
// Quote only against a live availability. Existing-adjustment discovery is
|
|
194
|
+
// bundled into the first real change quote; it must not issue a quote merely
|
|
195
|
+
// because the modal is hydrating.
|
|
196
|
+
const quoteAvailability = selectedAvailability;
|
|
220
197
|
const quoteReturnAvailabilityId =
|
|
221
198
|
selectedReturnOption?.returnAvailabilityId ??
|
|
222
|
-
(
|
|
199
|
+
(quoteAvailability && needsAdjustmentDiscovery
|
|
200
|
+
? initialValues?.returnAvailabilityId?.trim() || null
|
|
201
|
+
: null);
|
|
223
202
|
const changeQuoteInputsKey = useMemo(() => buildAdminChangeQuoteRequestKey({
|
|
224
203
|
bookingReference: initialValues?.bookingReference,
|
|
225
204
|
lastName,
|
|
@@ -257,11 +236,13 @@ export function useAdminChangeQuotePreview({
|
|
|
257
236
|
]);
|
|
258
237
|
const destinationRequiresReturnSelection = Boolean(selectedAvailability?.returnOptions?.length);
|
|
259
238
|
const missingRequiredReturnSelection = destinationRequiresReturnSelection && !selectedReturnOption;
|
|
260
|
-
const quoteMissingRequiredReturnSelection =
|
|
261
|
-
missingRequiredReturnSelection && !needsAdjustmentDiscovery;
|
|
239
|
+
const quoteMissingRequiredReturnSelection = missingRequiredReturnSelection;
|
|
262
240
|
const canRequestChangeQuote = canRequestAdminChangeQuote({
|
|
263
241
|
isCustomerSelfServeChange,
|
|
264
|
-
|
|
242
|
+
// Opening the change flow is not itself a change. Existing adjustment
|
|
243
|
+
// discovery can be included with the first real quote instead of issuing a
|
|
244
|
+
// quote during modal hydration.
|
|
245
|
+
hasEffectiveChangeSelection,
|
|
265
246
|
hasSelectedAvailability: quoteAvailability != null,
|
|
266
247
|
bookingReference: initialValues?.bookingReference,
|
|
267
248
|
lastName,
|
|
@@ -480,7 +461,7 @@ export function useAdminChangeQuotePreview({
|
|
|
480
461
|
if (canReuseCompletedAdminChangeQuote(
|
|
481
462
|
changeQuoteInputsKey,
|
|
482
463
|
lastCompletedQuoteInputsKeyRef.current,
|
|
483
|
-
|
|
464
|
+
hasPublishedChangeQuoteRef.current,
|
|
484
465
|
)) {
|
|
485
466
|
setChangeQuoteLoading(false);
|
|
486
467
|
return;
|
|
@@ -581,7 +562,6 @@ export function useAdminChangeQuotePreview({
|
|
|
581
562
|
canRequestChangeQuote,
|
|
582
563
|
missingRequiredReturnSelection,
|
|
583
564
|
changeQuoteInputsKey,
|
|
584
|
-
hasPublishedChangeQuote,
|
|
585
565
|
]);
|
|
586
566
|
|
|
587
567
|
return {
|
|
@@ -612,7 +612,7 @@ test('admin quote dedupe refetches unchanged inputs after the published quote is
|
|
|
612
612
|
assert.equal(canReuseCompletedAdminChangeQuote(inputKey, 'different-inputs', true), false);
|
|
613
613
|
});
|
|
614
614
|
|
|
615
|
-
test('admin quote gate
|
|
615
|
+
test('admin quote gate requires a real change while allowing adjustment-only changes', () => {
|
|
616
616
|
assert.equal(canRequestAdminChangeQuote({
|
|
617
617
|
isCustomerSelfServeChange: true,
|
|
618
618
|
hasEffectiveChangeSelection: true,
|
|
@@ -624,6 +624,7 @@ test('admin quote gate allows adjustment-only changes', () => {
|
|
|
624
624
|
|
|
625
625
|
assert.equal(canRequestAdminChangeQuote({
|
|
626
626
|
isCustomerSelfServeChange: true,
|
|
627
|
+
// A fully hydrated modal is still not quoteable until something changes.
|
|
627
628
|
hasEffectiveChangeSelection: false,
|
|
628
629
|
hasSelectedAvailability: true,
|
|
629
630
|
bookingReference: 'DIFG66OF',
|