@resira/ui 0.4.9 → 0.4.11
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/README.md +238 -238
- package/dist/index.cjs +17 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -15
- package/dist/index.js.map +1 -1
- package/dist/styles.css +2972 -2972
- package/package.json +59 -59
package/dist/index.js
CHANGED
|
@@ -379,7 +379,7 @@ function useReservation() {
|
|
|
379
379
|
const [error, setError] = useState(null);
|
|
380
380
|
const submit = useCallback(
|
|
381
381
|
async (data) => {
|
|
382
|
-
if (!data.resourceId) {
|
|
382
|
+
if (!data.resourceId && !data.checkoutSessionToken) {
|
|
383
383
|
setError("No resource selected");
|
|
384
384
|
return null;
|
|
385
385
|
}
|
|
@@ -3097,9 +3097,10 @@ function ResiraBookingWidget() {
|
|
|
3097
3097
|
guestPhone: guest.guestPhone.trim() || void 0,
|
|
3098
3098
|
notes: guest.notes.trim() || void 0,
|
|
3099
3099
|
promoCode: discountCode.trim() || void 0,
|
|
3100
|
-
termsAccepted: termsAccepted || void 0
|
|
3100
|
+
termsAccepted: termsAccepted || void 0,
|
|
3101
|
+
waiverAccepted: waiverAccepted || void 0
|
|
3101
3102
|
};
|
|
3102
|
-
}, [activeResourceId, selectedProduct, selection, guest, discountCode, termsAccepted, isCheckoutMode, checkoutSession, checkoutSessionToken]);
|
|
3103
|
+
}, [activeResourceId, selectedProduct, selection, guest, discountCode, termsAccepted, waiverAccepted, isCheckoutMode, checkoutSession, checkoutSessionToken]);
|
|
3103
3104
|
const blockedDates = useMemo(() => {
|
|
3104
3105
|
const dates = calendarData?.dates?.blockedDates ?? availability?.dates?.blockedDates ?? [];
|
|
3105
3106
|
return new Set(dates);
|
|
@@ -3330,7 +3331,9 @@ function ResiraBookingWidget() {
|
|
|
3330
3331
|
startTime: selection.startTime,
|
|
3331
3332
|
endTime: selection.endTime,
|
|
3332
3333
|
partySize: selection.partySize,
|
|
3333
|
-
notes: guest.notes.trim() || void 0
|
|
3334
|
+
notes: guest.notes.trim() || void 0,
|
|
3335
|
+
termsAccepted: termsAccepted || void 0,
|
|
3336
|
+
waiverAccepted: waiverAccepted || void 0
|
|
3334
3337
|
};
|
|
3335
3338
|
const result = await submit(payload);
|
|
3336
3339
|
if (result) {
|
|
@@ -3354,13 +3357,9 @@ function ResiraBookingWidget() {
|
|
|
3354
3357
|
const result = await createPayment(paymentPayload);
|
|
3355
3358
|
if (!result) return;
|
|
3356
3359
|
if (result.amountNow === 0) {
|
|
3357
|
-
if (result.reservationId) {
|
|
3358
|
-
const confirmed = await confirmPayment(result.paymentIntentId, result.reservationId);
|
|
3359
|
-
if (!confirmed) return;
|
|
3360
|
-
}
|
|
3361
3360
|
setStep("confirmation");
|
|
3362
3361
|
}
|
|
3363
|
-
}, [createPayment, paymentPayload
|
|
3362
|
+
}, [createPayment, paymentPayload]);
|
|
3364
3363
|
const handlePaymentError = useCallback((msg) => {
|
|
3365
3364
|
onError?.("payment_error", msg);
|
|
3366
3365
|
}, [onError]);
|
|
@@ -3380,14 +3379,14 @@ function ResiraBookingWidget() {
|
|
|
3380
3379
|
setTermsError(locale.termsRequired);
|
|
3381
3380
|
return;
|
|
3382
3381
|
}
|
|
3382
|
+
if (showWaiver && !waiverAccepted) {
|
|
3383
|
+
setTermsError(locale.termsRequired);
|
|
3384
|
+
return;
|
|
3385
|
+
}
|
|
3383
3386
|
setTermsError(null);
|
|
3384
3387
|
const result = await createPayment(paymentPayload);
|
|
3385
3388
|
if (!result) return;
|
|
3386
3389
|
if (result.amountNow === 0) {
|
|
3387
|
-
if (result.reservationId) {
|
|
3388
|
-
const confirmed = await confirmPayment(result.paymentIntentId, result.reservationId);
|
|
3389
|
-
if (!confirmed) return;
|
|
3390
|
-
}
|
|
3391
3390
|
setStep("confirmation");
|
|
3392
3391
|
} else {
|
|
3393
3392
|
setStep("payment");
|
|
@@ -3404,7 +3403,8 @@ function ResiraBookingWidget() {
|
|
|
3404
3403
|
}
|
|
3405
3404
|
const resourceId = activeResourceId ?? selectedProduct?.equipmentIds?.[0] ?? "";
|
|
3406
3405
|
const payload = {
|
|
3407
|
-
resourceId,
|
|
3406
|
+
resourceId: isCheckoutMode ? void 0 : resourceId,
|
|
3407
|
+
checkoutSessionToken: isCheckoutMode ? checkoutSessionToken : void 0,
|
|
3408
3408
|
guestName: guest.guestName.trim(),
|
|
3409
3409
|
guestEmail: guest.guestEmail.trim() || void 0,
|
|
3410
3410
|
guestPhone: guest.guestPhone.trim() || void 0,
|
|
@@ -3413,7 +3413,9 @@ function ResiraBookingWidget() {
|
|
|
3413
3413
|
startTime: selection.startTime,
|
|
3414
3414
|
endTime: selection.endTime,
|
|
3415
3415
|
partySize: selection.partySize,
|
|
3416
|
-
notes: guest.notes.trim() || void 0
|
|
3416
|
+
notes: guest.notes.trim() || void 0,
|
|
3417
|
+
termsAccepted: termsAccepted || void 0,
|
|
3418
|
+
waiverAccepted: waiverAccepted || void 0
|
|
3417
3419
|
};
|
|
3418
3420
|
const result = await submit(payload);
|
|
3419
3421
|
if (result) {
|