@loczer/storefront-sdk 0.183.0 → 0.185.0
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/dist/chunks/booking-engine/dist/schemas/{cart-inputs-9vM8GCrc.js → cart-inputs-j1yWfJxO.js} +8 -5
- package/dist/chunks/booking-engine/dist/schemas-DftrSnTE.js +13 -0
- package/dist/components/BookingPeriodSelector/useBookingPeriodController.d.ts.map +1 -1
- package/dist/components/BookingPeriodSelector/useBookingPeriodController.js +152 -148
- package/dist/i18n/en.js +1 -1
- package/dist/i18n/fr.js +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.js +63 -63
- package/dist/lib/booking.d.ts +3 -0
- package/dist/lib/booking.d.ts.map +1 -1
- package/dist/lib/booking.js +76 -74
- package/dist/lib/checkoutSubmit.d.ts.map +1 -1
- package/dist/lib/checkoutSubmit.js +35 -35
- package/dist/storefrontSchemas.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/booking-engine/dist/schemas-34QQv0EH.js +0 -13
package/dist/chunks/booking-engine/dist/schemas/{cart-inputs-9vM8GCrc.js → cart-inputs-j1yWfJxO.js}
RENAMED
|
@@ -31,15 +31,18 @@ var s = o.object({
|
|
|
31
31
|
productId: e,
|
|
32
32
|
productVariantId: e.optional(),
|
|
33
33
|
qty: o.number().int().positive()
|
|
34
|
-
}), u = a;
|
|
35
|
-
function
|
|
34
|
+
}), u = a, d = "pickup";
|
|
35
|
+
function f(e) {
|
|
36
|
+
return e === "delivery" ? "delivery" : d;
|
|
37
|
+
}
|
|
38
|
+
function p(e, t) {
|
|
36
39
|
e.deliveryOption === "delivery" && (e.startAddress?.trim() || t.addIssue({
|
|
37
40
|
code: o.ZodIssueCode.custom,
|
|
38
41
|
message: "Delivery start address is required.",
|
|
39
42
|
path: ["startAddress"]
|
|
40
43
|
}));
|
|
41
44
|
}
|
|
42
|
-
var
|
|
45
|
+
var m = o.object({
|
|
43
46
|
customer: c,
|
|
44
47
|
items: o.array(l),
|
|
45
48
|
schedule: s,
|
|
@@ -53,6 +56,6 @@ var f = o.object({
|
|
|
53
56
|
deliveryOption: u.optional(),
|
|
54
57
|
startAddress: o.string().trim().max(500).optional(),
|
|
55
58
|
endAddress: o.string().trim().max(500).optional()
|
|
56
|
-
}),
|
|
59
|
+
}), h = m.superRefine(p);
|
|
57
60
|
//#endregion
|
|
58
|
-
export { c as bookingCustomerInputSchema, u as bookingDeliveryOptionSchema, s as bookingScheduleInputSchema, l as cartItemInputSchema,
|
|
61
|
+
export { d as DEFAULT_BOOKING_DELIVERY_OPTION, c as bookingCustomerInputSchema, u as bookingDeliveryOptionSchema, s as bookingScheduleInputSchema, l as cartItemInputSchema, m as createBookingInputBaseSchema, h as createBookingInputSchema, f as resolveBookingDeliveryOption, p as validateBookingDeliveryAddress };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createLocalizedStringEntry as e, getLocalizedStringValue as t, localizedStringArraySchema as n, localizedStringEntrySchema as r, localizedStringSchema as i } from "./models/LocalizedString-D_TRgAdr.js";
|
|
2
|
+
import { currencyCodeSchema as a, currencyMinorUnitDigits as o, majorToMinor as s, minorToMajor as c, moneyMinorSchema as l, signedMoneyMinorSchema as u } from "./schemas/money-CVoCY4of.js";
|
|
3
|
+
import { priceSchema as d, priceUnitSchema as f } from "./models/Price-DCAgqkKh.js";
|
|
4
|
+
import { PRODUCT_VARIANT_CODE_IDENTIFIER_KIND as p, PRODUCT_VARIANT_CODE_MAX_LENGTH as m, accessoryProductSchema as h, bikeProductSchema as g, eBikeProductSchema as _, isProductVariantCodeIdentifierKind as v, productKindSchema as y, productSchema as b, productStorefrontDisplayModeSchema as x, productVariantAttributeSchema as S, productVariantCodeSchema as C, productVariantIdentifierSchema as w, productVariantSchema as T } from "./models/Product.shared-CTuk4fiR.js";
|
|
5
|
+
import { richTextJsonDocSchema as E, richTextSchema as D, richTextVersionSchema as O } from "./schemas/rich-text-DTRh7U3z.js";
|
|
6
|
+
import { isoDateSchema as k, shopConfigurationSchema as A, shopExtraTimeSlotRuleSchema as j, shopOpeningDayIndexSchema as M, shopOpeningDaySchema as N, shopOpeningHoursOverrideSchema as P, shopOpeningHoursPeriodSchema as F, shopOpeningSlotSchema as I, timeOfDaySchema as L } from "./schemas/shop-opening-hours-BlLD1gfz.js";
|
|
7
|
+
import { DEFAULT_CANCELLATION_POLICY as R, DEFAULT_PAYMENT_POLICIES as z, cancellationPolicySchema as B, cancellationPolicyTierSchema as V, paymentPoliciesSchema as H } from "./schemas/booking-engine-configuration-D02MRF9U.js";
|
|
8
|
+
import { fulfillmentModeSchema as U, publicBookingEngineConfigurationSchema as W, publicCheckoutConfigurationSchema as G, publicCheckoutDynamicOptionsSchema as K } from "./schemas/public-booking-engine-configuration-BnJ_H-p1.js";
|
|
9
|
+
import { DEFAULT_BOOKING_DELIVERY_OPTION as q, bookingCustomerInputSchema as J, bookingDeliveryOptionSchema as Y, bookingScheduleInputSchema as X, cartItemInputSchema as Z, createBookingInputBaseSchema as Q, createBookingInputSchema as $, resolveBookingDeliveryOption as ee, validateBookingDeliveryAddress as te } from "./schemas/cart-inputs-j1yWfJxO.js";
|
|
10
|
+
import "./schemas/base-product-1H8l2aUv.js";
|
|
11
|
+
import { baseAssetSchema as ne, baseAssetStatusSchema as re } from "./schemas/base-asset-B_Dm8_Vk.js";
|
|
12
|
+
import { baseBookingItemSchema as ie, baseBookingSchema as ae, baseBookingStateSchema as oe } from "./schemas/base-booking-DW8AEPKo.js";
|
|
13
|
+
export { q as DEFAULT_BOOKING_DELIVERY_OPTION, R as DEFAULT_CANCELLATION_POLICY, z as DEFAULT_PAYMENT_POLICIES, p as PRODUCT_VARIANT_CODE_IDENTIFIER_KIND, m as PRODUCT_VARIANT_CODE_MAX_LENGTH, h as accessoryProductSchema, ne as baseAssetSchema, re as baseAssetStatusSchema, ie as baseBookingItemSchema, ae as baseBookingSchema, oe as baseBookingStateSchema, g as bikeProductSchema, J as bookingCustomerInputSchema, Y as bookingDeliveryOptionSchema, X as bookingScheduleInputSchema, B as cancellationPolicySchema, V as cancellationPolicyTierSchema, Z as cartItemInputSchema, Q as createBookingInputBaseSchema, $ as createBookingInputSchema, e as createLocalizedStringEntry, a as currencyCodeSchema, o as currencyMinorUnitDigits, _ as eBikeProductSchema, U as fulfillmentModeSchema, t as getLocalizedStringValue, v as isProductVariantCodeIdentifierKind, k as isoDateSchema, n as localizedStringArraySchema, r as localizedStringEntrySchema, i as localizedStringSchema, s as majorToMinor, c as minorToMajor, l as moneyMinorSchema, H as paymentPoliciesSchema, d as priceSchema, f as priceUnitSchema, y as productKindSchema, b as productSchema, x as productStorefrontDisplayModeSchema, S as productVariantAttributeSchema, C as productVariantCodeSchema, w as productVariantIdentifierSchema, T as productVariantSchema, W as publicBookingEngineConfigurationSchema, G as publicCheckoutConfigurationSchema, K as publicCheckoutDynamicOptionsSchema, ee as resolveBookingDeliveryOption, E as richTextJsonDocSchema, D as richTextSchema, O as richTextVersionSchema, A as shopConfigurationSchema, j as shopExtraTimeSlotRuleSchema, M as shopOpeningDayIndexSchema, N as shopOpeningDaySchema, P as shopOpeningHoursOverrideSchema, F as shopOpeningHoursPeriodSchema, I as shopOpeningSlotSchema, u as signedMoneyMinorSchema, L as timeOfDaySchema, te as validateBookingDeliveryAddress };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBookingPeriodController.d.ts","sourceRoot":"","sources":["../../../src/components/BookingPeriodSelector/useBookingPeriodController.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEtC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAEnD,OAAO,EAQL,KAAK,mBAAmB,EACzB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAiC,KAAK,WAAW,EAAE,KAAK,QAAQ,EAAE,MAAM,qCAAqC,CAAA;AAGpH,MAAM,MAAM,uBAAuB,GAAG;IACpC,MAAM,EAAE,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E,MAAM,IAAI,CAAA;IAC/B,cAAc,EAAE,QAAQ,EAAE,CAAA;IAC1B,qBAAqB,EAAE,QAAQ,EAAE,CAAA;IACjC,YAAY,EAAE,OAAO,CAAA;IACrB,UAAU,EAAE,OAAO,CAAA;IACnB,iBAAiB,EAAE,IAAI,CAAA;IACvB,uBAAuB,EAAE,MAAM,GAAG,IAAI,CAAA;IACtC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAA;IAChC,kBAAkB,EAAE,OAAO,CAAA;IAC3B;;;OAGG;IACH,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACxC,eAAe,EAAE,CACf,IAAI,EAAE,IAAI,GAAG,SAAS,EACtB,OAAO,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE,OAAO,CAAC;QAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,KACjF,IAAI,CAAA;IACT,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACxC,aAAa,EAAE,CACb,IAAI,EAAE,IAAI,GAAG,SAAS,EACtB,OAAO,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,KACtE,IAAI,CAAA;IACT;;;OAGG;IACH,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACtC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CACvC;AAwGD,eAAO,MAAM,0BAA0B,GACrC,SAAS,8BAA8B,KACtC,
|
|
1
|
+
{"version":3,"file":"useBookingPeriodController.d.ts","sourceRoot":"","sources":["../../../src/components/BookingPeriodSelector/useBookingPeriodController.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEtC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AI,CAAA;CACvC;AAwGD,eAAO,MAAM,0BAA0B,GACrC,SAAS,8BAA8B,KACtC,4BA6yBF,CAAA"}
|
|
@@ -3,33 +3,33 @@ import { getBookingPeriodTimeSlotsSync as s } from "../../lib/booking-period-tim
|
|
|
3
3
|
import { differenceInCalendarDays as c } from "date-fns";
|
|
4
4
|
import { useCallback as l, useEffect as u, useMemo as d, useRef as f, useState as p } from "react";
|
|
5
5
|
import { useMediaQuery as ee } from "@rpcbase/client";
|
|
6
|
-
import { de as te, enUS as m, es as
|
|
6
|
+
import { de as te, enUS as m, es as ne, fr as h, it as re } from "date-fns/locale";
|
|
7
7
|
//#region src/components/BookingPeriodSelector/useBookingPeriodController.ts
|
|
8
|
-
var
|
|
8
|
+
var ie = (e) => e, ae = {
|
|
9
9
|
startDate: "Start date",
|
|
10
10
|
pickStartDate: "Pick a date",
|
|
11
11
|
startTime: "Start time",
|
|
12
12
|
endDate: "End date",
|
|
13
13
|
pickEndDate: "Pick a date",
|
|
14
14
|
endTime: "End time"
|
|
15
|
-
},
|
|
15
|
+
}, oe = ({ locale: e, localeCode: t }) => {
|
|
16
16
|
if (e) return e;
|
|
17
17
|
let n = t?.toLowerCase() ?? "";
|
|
18
|
-
return n.startsWith("fr") ?
|
|
19
|
-
},
|
|
18
|
+
return n.startsWith("fr") ? h : n.startsWith("de") ? te : n.startsWith("es") ? ne : n.startsWith("it") ? re : m;
|
|
19
|
+
}, se = (e) => {
|
|
20
20
|
if (!e?.length) return null;
|
|
21
21
|
let t = e.map((e) => o(e.value)).filter((e) => typeof e == "number").sort((e, t) => e - t);
|
|
22
22
|
if (t.length < 2) return null;
|
|
23
23
|
let n = t[1] - t[0];
|
|
24
24
|
return !Number.isFinite(n) || n <= 0 ? null : n;
|
|
25
|
-
},
|
|
25
|
+
}, g = (e) => {
|
|
26
26
|
if (typeof e != "string") return null;
|
|
27
27
|
let t = e.match(/(\d{1,2}:\d{2})\s*-\s*(\d{1,2}:\d{2})/);
|
|
28
28
|
return t ? o(t[2]) : null;
|
|
29
|
-
},
|
|
29
|
+
}, ce = (e, t) => e.map((e) => {
|
|
30
30
|
let n = o(e.value);
|
|
31
31
|
if (n == null) return null;
|
|
32
|
-
let r =
|
|
32
|
+
let r = g(e.label) ?? n + t, i = typeof e.label == "string" ? e.label : e.value;
|
|
33
33
|
return {
|
|
34
34
|
value: e.value,
|
|
35
35
|
label: i,
|
|
@@ -38,135 +38,139 @@ var re = (e) => e, ie = {
|
|
|
38
38
|
isExtra: !1,
|
|
39
39
|
isDisabled: !!e.disabled
|
|
40
40
|
};
|
|
41
|
-
}).filter((e) => !!e),
|
|
42
|
-
for (let t = e.length - 1; t >= 0; --t) if (
|
|
41
|
+
}).filter((e) => !!e), _ = (e) => !e.isDisabled && !e.isExtra, le = (e) => {
|
|
42
|
+
for (let t = e.length - 1; t >= 0; --t) if (_(e[t])) return e[t];
|
|
43
43
|
return null;
|
|
44
|
-
}, ue = (e, t) => e.find((e) =>
|
|
45
|
-
let { startDate: m, onStartDateChange:
|
|
44
|
+
}, ue = (e, t) => e.find((e) => _(e) && e.startMinutes >= t) ?? null, v = (te) => {
|
|
45
|
+
let { startDate: m, onStartDateChange: ne, startTime: h, onStartTimeChange: re, endDate: g, onEndDateChange: v, endTime: y, onEndTimeChange: de, onEndDateCommit: b, onEndTimeCommit: x, errors: fe = {}, labels: pe, t: me = ie, language: he, labelClassName: ge, inputClassName: _e, buttonClassName: ve, bookingPeriodConfig: S, fetchTimeSlots: C, selectionFlow: w = "chained-times", withMobileDateDrawer: ye = !1, currencyCode: be = "EUR", disableAutomaticTimeCorrection: T = !1, openDatePickerOnFocus: xe = !0, startTimeOptions: E = [], endTimeOptions: Se, locale: Ce, localeCode: we } = te, D = ee("(max-width: 767px)"), O = we ?? he ?? "en-US", Te = d(() => oe({
|
|
46
46
|
locale: Ce,
|
|
47
47
|
localeCode: O
|
|
48
|
-
}), [Ce, O]), k = d(() => S ? t(S) : null, [S]), A = d(() => S?.timing.slotIntervalMinutes ? S.timing.slotIntervalMinutes :
|
|
49
|
-
|
|
50
|
-
}, []),
|
|
48
|
+
}), [Ce, O]), k = d(() => S ? t(S) : null, [S]), A = d(() => S?.timing.slotIntervalMinutes ? S.timing.slotIntervalMinutes : se(E) ?? 30, [S?.timing.slotIntervalMinutes, E]), [j, M] = p(!1), [N, Ee] = p(!1), [De, P] = p(!1), [F, Oe] = p(!1), [ke, Ae] = p(void 0), [je, Me] = p(!1), [Ne, Pe] = p(!1), [Fe, Ie] = p([]), [Le, I] = p([]), [L, R] = p(void 0), z = f(null), Re = f(0), ze = f(0), Be = f(0), Ve = f(void 0), B = f(void 0), He = l(() => {
|
|
49
|
+
Ae(void 0);
|
|
50
|
+
}, []), Ue = d(() => !m || !g ? !1 : c(g, m) === 0, [m, g]), We = d(() => o(h), [h]), V = l((e) => {
|
|
51
51
|
let t = (e instanceof Date ? e : e ? new Date(e) : void 0) ?? /* @__PURE__ */ new Date();
|
|
52
52
|
return k ? n(t, k.timeZone) ?? void 0 : `${t.getFullYear()}-${String(t.getMonth() + 1).padStart(2, "0")}-${String(t.getDate()).padStart(2, "0")}`;
|
|
53
|
-
}, [k]),
|
|
54
|
-
|
|
53
|
+
}, [k]), H = d(() => V(m), [m, V]), U = d(() => V(g ?? m), [
|
|
54
|
+
g,
|
|
55
55
|
m,
|
|
56
|
-
|
|
57
|
-
]),
|
|
56
|
+
V
|
|
57
|
+
]), Ge = k ? i(/* @__PURE__ */ new Date(), k.timeZone) : null, W = Ge?.dateString, Ke = Ge?.minutesFromMidnight, G = d(() => W ? !!(m && H && H === W) : !!m && c(m, /* @__PURE__ */ new Date()) === 0, [
|
|
58
58
|
m,
|
|
59
|
-
V,
|
|
60
|
-
U
|
|
61
|
-
]), G = d(() => U ? !!(_ && H && H === U) : !!_ && c(_, /* @__PURE__ */ new Date()) === 0, [
|
|
62
|
-
_,
|
|
63
59
|
H,
|
|
64
|
-
|
|
65
|
-
]),
|
|
66
|
-
|
|
60
|
+
W
|
|
61
|
+
]), K = d(() => W ? !!(g && U && U === W) : !!g && c(g, /* @__PURE__ */ new Date()) === 0, [
|
|
62
|
+
g,
|
|
63
|
+
U,
|
|
64
|
+
W
|
|
65
|
+
]), qe = d(() => {
|
|
66
|
+
if (W) return e(W);
|
|
67
67
|
let t = /* @__PURE__ */ new Date();
|
|
68
68
|
return t.setHours(0, 0, 0, 0), t;
|
|
69
|
-
}, [
|
|
70
|
-
if (!
|
|
71
|
-
if (
|
|
69
|
+
}, [W]), Je = S?.timing.minBufferMinutes ?? 10, q = d(() => {
|
|
70
|
+
if (!G && !K) return null;
|
|
71
|
+
if (Ke != null) return Ke + Je;
|
|
72
72
|
let e = /* @__PURE__ */ new Date();
|
|
73
|
-
return e.setMinutes(e.getMinutes() +
|
|
73
|
+
return e.setMinutes(e.getMinutes() + Je), e.getHours() * 60 + e.getMinutes();
|
|
74
74
|
}, [
|
|
75
|
-
|
|
75
|
+
Ke,
|
|
76
|
+
K,
|
|
76
77
|
G,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
]), Ye = d(() => W ? q : null, [q, W]), Xe = l((e) => {
|
|
78
|
+
Je
|
|
79
|
+
]), J = d(() => G ? q : null, [q, G]), Ye = l((e) => {
|
|
80
80
|
if (!k) return;
|
|
81
|
-
let t =
|
|
81
|
+
let t = V(e);
|
|
82
82
|
if (!t) return k.defaultEndTime;
|
|
83
83
|
let n = r(t), i = k.getLastStartMinutesForWeekday(n, { dateString: t });
|
|
84
84
|
return typeof i == "number" ? a(i) : k.defaultEndTime;
|
|
85
|
-
}, [k,
|
|
85
|
+
}, [k, V]);
|
|
86
86
|
u(() => {
|
|
87
|
-
if (!C || !
|
|
87
|
+
if (!C || !H) return;
|
|
88
88
|
let e = !0;
|
|
89
|
-
return C(
|
|
90
|
-
e && t &&
|
|
89
|
+
return C(H, "start").then((t) => {
|
|
90
|
+
e && t && Ie(t);
|
|
91
91
|
}).catch((e) => {
|
|
92
92
|
console.error("Failed to fetch availability time slots", e);
|
|
93
93
|
}), () => {
|
|
94
94
|
e = !1;
|
|
95
95
|
};
|
|
96
|
-
}, [C,
|
|
96
|
+
}, [C, H]), u(() => {
|
|
97
97
|
if (!C) return;
|
|
98
|
-
let e =
|
|
99
|
-
|
|
100
|
-
}, [
|
|
98
|
+
let e = Ve.current, t = e !== void 0 && e !== U;
|
|
99
|
+
Ve.current = U, t && U && (B.current = U);
|
|
100
|
+
}, [U, C]), u(() => {
|
|
101
101
|
if (!C) return;
|
|
102
|
-
if (!
|
|
103
|
-
|
|
102
|
+
if (!U) {
|
|
103
|
+
I([]), R(void 0);
|
|
104
104
|
return;
|
|
105
105
|
}
|
|
106
106
|
let e = !0;
|
|
107
|
-
return
|
|
108
|
-
e && (t ? (
|
|
107
|
+
return R(void 0), C(U, "end").then((t) => {
|
|
108
|
+
e && (t ? (I(t), R(U)) : (I([]), R(void 0)));
|
|
109
109
|
}).catch((t) => {
|
|
110
|
-
console.error("Failed to fetch availability time slots", t), e && (
|
|
110
|
+
console.error("Failed to fetch availability time slots", t), e && (I([]), R(void 0));
|
|
111
111
|
}), () => {
|
|
112
112
|
e = !1;
|
|
113
113
|
};
|
|
114
|
-
}, [
|
|
115
|
-
let
|
|
114
|
+
}, [U, C]);
|
|
115
|
+
let Xe = d(() => C || !S ? null : s(S, { date: H }).startTimeSlots, [
|
|
116
116
|
S,
|
|
117
117
|
C,
|
|
118
|
-
|
|
119
|
-
]), Ze = d(() =>
|
|
118
|
+
H
|
|
119
|
+
]), Ze = d(() => C || !S ? null : s(S, { date: U }).endTimeSlots, [
|
|
120
|
+
S,
|
|
121
|
+
U,
|
|
122
|
+
C
|
|
123
|
+
]), Qe = d(() => !C || !S ? null : s(S, { date: H }).startTimeSlots, [
|
|
120
124
|
S,
|
|
121
125
|
C,
|
|
122
|
-
|
|
123
|
-
]),
|
|
126
|
+
H
|
|
127
|
+
]), $e = d(() => !C || !S ? null : s(S, { date: U }).endTimeSlots, [
|
|
124
128
|
S,
|
|
125
|
-
|
|
129
|
+
U,
|
|
126
130
|
C
|
|
127
|
-
]), Y = d(() => C ?
|
|
131
|
+
]), Y = d(() => C ? Fe.length ? Fe : Qe ?? [] : S ? Xe ?? [] : ce(E, A), [
|
|
128
132
|
S,
|
|
129
|
-
|
|
130
|
-
|
|
133
|
+
Xe,
|
|
134
|
+
Qe,
|
|
131
135
|
C,
|
|
132
|
-
|
|
136
|
+
Fe,
|
|
133
137
|
A,
|
|
134
138
|
E
|
|
135
|
-
]), X = d(() => C ?
|
|
139
|
+
]), X = d(() => C ? L === U ? Le : $e ?? [] : S ? Ze ?? [] : ce(Se ?? E, A), [
|
|
136
140
|
S,
|
|
137
|
-
|
|
138
|
-
|
|
141
|
+
Ze,
|
|
142
|
+
U,
|
|
139
143
|
Se,
|
|
140
|
-
|
|
144
|
+
$e,
|
|
141
145
|
C,
|
|
142
|
-
|
|
143
|
-
|
|
146
|
+
Le,
|
|
147
|
+
L,
|
|
144
148
|
A,
|
|
145
149
|
E
|
|
146
150
|
]), Z = l((e, t) => {
|
|
147
|
-
e !==
|
|
148
|
-
}, [
|
|
151
|
+
e !== h && (Pe(t === "user"), re(e, { source: t }));
|
|
152
|
+
}, [re, h]), Q = l((e, t = "auto") => {
|
|
149
153
|
e !== y && (t !== "user" && e && X.find((t) => t.value === e)?.isExtra || de(e, { source: t }));
|
|
150
154
|
}, [
|
|
151
155
|
X,
|
|
152
156
|
y,
|
|
153
157
|
de
|
|
154
|
-
]), $ = d(() => Y.length ? Y.find((e) => !(e.isDisabled ||
|
|
158
|
+
]), $ = d(() => Y.length ? Y.find((e) => !(e.isDisabled || J != null && e.startMinutes < J)) ?? null : null, [J, Y]);
|
|
155
159
|
u(() => {
|
|
156
|
-
T ||
|
|
160
|
+
T || Ne || $ && h !== $.value && Z($.value, "auto");
|
|
157
161
|
}, [
|
|
158
162
|
T,
|
|
159
163
|
$,
|
|
160
|
-
|
|
161
|
-
|
|
164
|
+
Ne,
|
|
165
|
+
h,
|
|
162
166
|
Z
|
|
163
167
|
]), u(() => {
|
|
164
168
|
if (T || !Y.length) return;
|
|
165
|
-
let e =
|
|
169
|
+
let e = h ? Y.find((e) => e.value === h) : void 0, t = q ?? void 0, n = G ? t : null, r = (e) => {
|
|
166
170
|
let t = typeof e == "number" ? e : null, n = Y.find((e) => !(e.isDisabled || t != null && e.startMinutes < t));
|
|
167
|
-
n && n.value !==
|
|
171
|
+
n && n.value !== h ? Z(n.value, "auto") : !n && h && Z("", "auto");
|
|
168
172
|
};
|
|
169
|
-
if (
|
|
173
|
+
if (h && !e) {
|
|
170
174
|
r(n);
|
|
171
175
|
return;
|
|
172
176
|
}
|
|
@@ -174,32 +178,32 @@ var re = (e) => e, ie = {
|
|
|
174
178
|
r(n);
|
|
175
179
|
return;
|
|
176
180
|
}
|
|
177
|
-
if (!
|
|
178
|
-
let i = o(
|
|
181
|
+
if (!G || t == null) return;
|
|
182
|
+
let i = o(h);
|
|
179
183
|
if (i != null && i >= t && !e?.isDisabled) return;
|
|
180
184
|
let a = Y.find((e) => !e.isDisabled && e.startMinutes >= t);
|
|
181
|
-
a && a.value !==
|
|
185
|
+
a && a.value !== h && Z(a.value, "auto");
|
|
182
186
|
}, [
|
|
183
187
|
T,
|
|
184
188
|
q,
|
|
185
|
-
|
|
186
|
-
|
|
189
|
+
G,
|
|
190
|
+
h,
|
|
187
191
|
Y,
|
|
188
192
|
Z
|
|
189
193
|
]), u(() => {
|
|
190
194
|
if (T || !X.length) return;
|
|
191
|
-
if (C &&
|
|
192
|
-
|
|
195
|
+
if (C && B.current === U && L === U) {
|
|
196
|
+
B.current = void 0;
|
|
193
197
|
let e = le(X);
|
|
194
198
|
if (e && e.value !== y) {
|
|
195
199
|
Q(e.value);
|
|
196
200
|
return;
|
|
197
201
|
}
|
|
198
202
|
}
|
|
199
|
-
let e = o(
|
|
200
|
-
|
|
203
|
+
let e = o(h), t = o(y), n = y ? X.find((e) => e.value === y) : void 0, r = [];
|
|
204
|
+
K && q != null && r.push(q), Ue && e != null && r.push(e + A);
|
|
201
205
|
let i = r.length ? Math.max(...r) : null, a = (e) => {
|
|
202
|
-
let t = typeof e == "number" ? e : null, n = X.find((e) => !(!
|
|
206
|
+
let t = typeof e == "number" ? e : null, n = X.find((e) => !(!_(e) || t != null && e.startMinutes < t));
|
|
203
207
|
n && n.value !== y ? Q(n.value) : !n && y && Q("");
|
|
204
208
|
};
|
|
205
209
|
if (C && y && !n) {
|
|
@@ -217,88 +221,88 @@ var re = (e) => e, ie = {
|
|
|
217
221
|
X,
|
|
218
222
|
T,
|
|
219
223
|
q,
|
|
220
|
-
|
|
224
|
+
U,
|
|
221
225
|
y,
|
|
222
226
|
C,
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
227
|
+
L,
|
|
228
|
+
K,
|
|
229
|
+
Ue,
|
|
226
230
|
A,
|
|
227
|
-
|
|
231
|
+
h,
|
|
228
232
|
Q
|
|
229
|
-
]), u(() => (
|
|
230
|
-
|
|
233
|
+
]), u(() => (Me(!0), () => {
|
|
234
|
+
z.current != null && clearTimeout(z.current);
|
|
231
235
|
}), []), u(() => {
|
|
232
|
-
|
|
233
|
-
}, [
|
|
234
|
-
|
|
235
|
-
}, [
|
|
236
|
-
let
|
|
237
|
-
e &&
|
|
238
|
-
}, []), et = l((e) => {
|
|
239
|
-
e && Be.current && Date.now() < Be.current || M(e);
|
|
236
|
+
N && j && M(!1);
|
|
237
|
+
}, [j, N]), u(() => {
|
|
238
|
+
F && De && P(!1);
|
|
239
|
+
}, [De, F]);
|
|
240
|
+
let et = l((e) => {
|
|
241
|
+
e && Re.current && Date.now() < Re.current || M(e);
|
|
240
242
|
}, []), tt = l((e) => {
|
|
241
|
-
e &&
|
|
242
|
-
}, []), nt = l((e
|
|
243
|
+
e && ze.current && Date.now() < ze.current || P(e);
|
|
244
|
+
}, []), nt = l((e) => {
|
|
245
|
+
e && Be.current && Date.now() < Be.current || Oe(e);
|
|
246
|
+
}, []), rt = l((e, { openTimePicker: t, openEndDatePicker: n, close: r = !0 } = {}) => {
|
|
243
247
|
let i = t ?? w === "chained-times", a = n ?? w === "dates-first";
|
|
244
248
|
if (!e) {
|
|
245
|
-
r &&
|
|
249
|
+
r && M(!1);
|
|
246
250
|
return;
|
|
247
251
|
}
|
|
248
|
-
|
|
249
|
-
|
|
252
|
+
ne(e), (r || a) && (Re.current = Date.now() + 250, M(!1)), g && e > g && v(e), i && Ee(!0), a && (z.current != null && clearTimeout(z.current), D ? (P(!0), z.current = null) : z.current = setTimeout(() => {
|
|
253
|
+
P(!0);
|
|
250
254
|
}, 100));
|
|
251
255
|
}, [
|
|
252
|
-
|
|
256
|
+
g,
|
|
253
257
|
D,
|
|
254
258
|
v,
|
|
255
|
-
|
|
259
|
+
ne,
|
|
256
260
|
w
|
|
257
|
-
]),
|
|
258
|
-
Z(e, "user"),
|
|
259
|
-
|
|
260
|
-
}, 100) :
|
|
261
|
+
]), it = l((e) => {
|
|
262
|
+
Z(e, "user"), Ee(!1), z.current != null && clearTimeout(z.current), w === "chained-times" && e && m ? z.current = setTimeout(() => {
|
|
263
|
+
P(!0);
|
|
264
|
+
}, 100) : z.current = null;
|
|
261
265
|
}, [
|
|
262
266
|
w,
|
|
263
267
|
m,
|
|
264
268
|
Z
|
|
265
|
-
]),
|
|
266
|
-
e && e !==
|
|
267
|
-
}, [
|
|
269
|
+
]), at = l((e) => {
|
|
270
|
+
e && e !== h && Z(e, "user");
|
|
271
|
+
}, [h, Z]), ot = l((e, { openTimePicker: t, close: n = !0, commit: r = w === "dates-first" && D } = {}) => {
|
|
268
272
|
let i = t ?? w === "chained-times", a = y;
|
|
269
273
|
if (e && w === "dates-first") {
|
|
270
274
|
if (C) {
|
|
271
|
-
let t =
|
|
272
|
-
t && (
|
|
275
|
+
let t = V(e);
|
|
276
|
+
t && (B.current = t);
|
|
273
277
|
}
|
|
274
|
-
let t =
|
|
278
|
+
let t = Ye(e);
|
|
275
279
|
t && (a = t, Q(t));
|
|
276
280
|
}
|
|
277
|
-
v(e),
|
|
281
|
+
v(e), Ae(void 0), n && (ze.current = Date.now() + 250, P(!1)), e && i && Oe(!0), e && r && b && (typeof window > "u" ? b(e, a) : requestAnimationFrame(() => b(e, a)));
|
|
278
282
|
}, [
|
|
279
283
|
y,
|
|
280
284
|
C,
|
|
281
|
-
|
|
285
|
+
Ye,
|
|
282
286
|
D,
|
|
283
287
|
v,
|
|
284
288
|
b,
|
|
285
289
|
w,
|
|
286
|
-
|
|
290
|
+
V,
|
|
287
291
|
Q
|
|
288
|
-
]),
|
|
292
|
+
]), st = l((e) => {
|
|
289
293
|
Q(e, "user");
|
|
290
|
-
}, [Q]),
|
|
291
|
-
|
|
294
|
+
}, [Q]), ct = l((e) => {
|
|
295
|
+
B.current = void 0, Q(e, "user"), Be.current = Date.now() + 250, Oe(!1), x && (typeof window > "u" ? x() : requestAnimationFrame(() => {
|
|
292
296
|
requestAnimationFrame(x);
|
|
293
297
|
}));
|
|
294
298
|
}, [x, Q]);
|
|
295
299
|
return {
|
|
296
300
|
startDate: m,
|
|
297
|
-
startTime:
|
|
298
|
-
endDate:
|
|
301
|
+
startTime: h,
|
|
302
|
+
endDate: g,
|
|
299
303
|
endTime: y,
|
|
300
304
|
errors: fe,
|
|
301
|
-
labels: pe ??
|
|
305
|
+
labels: pe ?? ae,
|
|
302
306
|
t: me,
|
|
303
307
|
language: he ?? O,
|
|
304
308
|
labelClassName: ge,
|
|
@@ -310,35 +314,35 @@ var re = (e) => e, ie = {
|
|
|
310
314
|
dateLocale: Te,
|
|
311
315
|
numberOfMonths: D ? 1 : 2,
|
|
312
316
|
isMobile: D,
|
|
313
|
-
isHydrated:
|
|
317
|
+
isHydrated: je,
|
|
314
318
|
openDatePickerOnFocus: xe,
|
|
315
319
|
withMobileDateDrawer: ye,
|
|
316
320
|
selectionFlow: w,
|
|
317
|
-
isStartDatePopoverOpen:
|
|
318
|
-
setIsStartDatePopoverOpen:
|
|
319
|
-
isStartTimeSelectOpen:
|
|
320
|
-
setIsStartTimeSelectOpen:
|
|
321
|
-
isEndDatePopoverOpen:
|
|
322
|
-
setIsEndDatePopoverOpen:
|
|
323
|
-
isEndTimeSelectOpen:
|
|
324
|
-
setIsEndTimeSelectOpen:
|
|
325
|
-
hoveredEndDate:
|
|
326
|
-
setHoveredEndDate:
|
|
327
|
-
resetHoveredEndDate:
|
|
321
|
+
isStartDatePopoverOpen: j,
|
|
322
|
+
setIsStartDatePopoverOpen: et,
|
|
323
|
+
isStartTimeSelectOpen: N,
|
|
324
|
+
setIsStartTimeSelectOpen: Ee,
|
|
325
|
+
isEndDatePopoverOpen: De,
|
|
326
|
+
setIsEndDatePopoverOpen: tt,
|
|
327
|
+
isEndTimeSelectOpen: F,
|
|
328
|
+
setIsEndTimeSelectOpen: nt,
|
|
329
|
+
hoveredEndDate: ke,
|
|
330
|
+
setHoveredEndDate: Ae,
|
|
331
|
+
resetHoveredEndDate: He,
|
|
328
332
|
startTimeSlots: Y,
|
|
329
333
|
availableEndTimeSlots: X,
|
|
330
|
-
isStartToday:
|
|
331
|
-
isEndToday:
|
|
332
|
-
minSelectableDate:
|
|
334
|
+
isStartToday: G,
|
|
335
|
+
isEndToday: K,
|
|
336
|
+
minSelectableDate: qe,
|
|
333
337
|
earliestMinutesForToday: q,
|
|
334
|
-
startMinutesValue:
|
|
335
|
-
isSameDaySelection:
|
|
336
|
-
updateStartTime:
|
|
337
|
-
selectStartDate:
|
|
338
|
-
selectStartTime:
|
|
339
|
-
selectEndDate:
|
|
340
|
-
updateEndTime:
|
|
341
|
-
selectEndTime:
|
|
338
|
+
startMinutesValue: We,
|
|
339
|
+
isSameDaySelection: Ue,
|
|
340
|
+
updateStartTime: at,
|
|
341
|
+
selectStartDate: rt,
|
|
342
|
+
selectStartTime: it,
|
|
343
|
+
selectEndDate: ot,
|
|
344
|
+
updateEndTime: st,
|
|
345
|
+
selectEndTime: ct
|
|
342
346
|
};
|
|
343
347
|
};
|
|
344
348
|
//#endregion
|
package/dist/i18n/en.js
CHANGED
|
@@ -178,7 +178,7 @@ var e = {
|
|
|
178
178
|
checkout_payment_due_now_helper_none: "No payment required now.",
|
|
179
179
|
checkout_payment_provider: "Provider",
|
|
180
180
|
checkout_payment_loading: "Checking payment options…",
|
|
181
|
-
checkout_payment_error: "Unable to check payment options.",
|
|
181
|
+
checkout_payment_error: "Unable to check payment options. Please contact the shop directly.",
|
|
182
182
|
checkout_payment_enable_hint: "Enter your full name to enable the payment method.",
|
|
183
183
|
checkout_submit: "Request booking",
|
|
184
184
|
checkout_success_toast: "Request sent.",
|
package/dist/i18n/fr.js
CHANGED
|
@@ -178,7 +178,7 @@ var e = {
|
|
|
178
178
|
checkout_payment_due_now_helper_none: "Aucun paiement n’est requis maintenant.",
|
|
179
179
|
checkout_payment_provider: "Prestataire",
|
|
180
180
|
checkout_payment_loading: "Vérification des options de paiement…",
|
|
181
|
-
checkout_payment_error: "Impossible de vérifier les options de paiement.",
|
|
181
|
+
checkout_payment_error: "Impossible de vérifier les options de paiement. Veuillez contacter directement la boutique.",
|
|
182
182
|
checkout_payment_enable_hint: "Renseignez votre nom complet pour activer le moyen de paiement.",
|
|
183
183
|
checkout_submit: "Envoyer la demande",
|
|
184
184
|
checkout_success_toast: "Demande envoyée.",
|
package/dist/index.d.ts
CHANGED
|
@@ -1367,6 +1367,10 @@ export declare const createBookingPeriodConfigFromBookingEngineConfiguration: (b
|
|
|
1367
1367
|
sameDayCutoff?: string;
|
|
1368
1368
|
}) => BookingPeriodConfig;
|
|
1369
1369
|
|
|
1370
|
+
export declare const createBookingPeriodConfigFromShopConfiguration: (shop: StorefrontConfiguration["bookingEngine"]["shop"], options?: {
|
|
1371
|
+
sameDayCutoff?: string;
|
|
1372
|
+
}) => BookingPeriodConfig;
|
|
1373
|
+
|
|
1370
1374
|
export declare const createBookingPeriodConfigFromStorefrontConfiguration: (storefrontConfiguration: StorefrontConfiguration) => BookingPeriodConfig;
|
|
1371
1375
|
|
|
1372
1376
|
export declare function createLocalizedStringEntry(value: string, updatedAt?: Date): {
|
|
@@ -1391,6 +1395,8 @@ export declare type DailyPriceRow = {
|
|
|
1391
1395
|
perDayPriceLabel: string;
|
|
1392
1396
|
};
|
|
1393
1397
|
|
|
1398
|
+
export declare const DEFAULT_BOOKING_DELIVERY_OPTION: "pickup";
|
|
1399
|
+
|
|
1394
1400
|
export declare const DEFAULT_CANCELLATION_POLICY: CancellationPolicy;
|
|
1395
1401
|
|
|
1396
1402
|
export declare const DEFAULT_PAYMENT_POLICIES: PaymentPolicies;
|
|
@@ -2537,6 +2543,8 @@ export declare const requestSchema: z.ZodObject<{
|
|
|
2537
2543
|
message: z.ZodString;
|
|
2538
2544
|
}, z.core.$strip>;
|
|
2539
2545
|
|
|
2546
|
+
export declare function resolveBookingDeliveryOption(value: unknown): BookingDeliveryOption;
|
|
2547
|
+
|
|
2540
2548
|
export declare const resolveBookingSearchParams: (searchParams: URLSearchParams, options?: {
|
|
2541
2549
|
storage?: BookingSearchStorage;
|
|
2542
2550
|
storeSlug?: string;
|
package/dist/index.js
CHANGED
|
@@ -7,74 +7,74 @@ import { richTextJsonDocSchema as E, richTextSchema as D, richTextVersionSchema
|
|
|
7
7
|
import { isoDateSchema as k, shopConfigurationSchema as A, shopExtraTimeSlotRuleSchema as j, shopOpeningDayIndexSchema as M, shopOpeningDaySchema as N, shopOpeningHoursOverrideSchema as P, shopOpeningHoursPeriodSchema as F, shopOpeningSlotSchema as I, timeOfDaySchema as L } from "./chunks/booking-engine/dist/schemas/shop-opening-hours-BlLD1gfz.js";
|
|
8
8
|
import { DEFAULT_CANCELLATION_POLICY as R, DEFAULT_PAYMENT_POLICIES as z, cancellationPolicySchema as B, cancellationPolicyTierSchema as V, paymentPoliciesSchema as H } from "./chunks/booking-engine/dist/schemas/booking-engine-configuration-D02MRF9U.js";
|
|
9
9
|
import { fulfillmentModeSchema as U, publicBookingEngineConfigurationSchema as W, publicCheckoutConfigurationSchema as G, publicCheckoutDynamicOptionsSchema as K } from "./chunks/booking-engine/dist/schemas/public-booking-engine-configuration-BnJ_H-p1.js";
|
|
10
|
-
import {
|
|
11
|
-
import { baseAssetSchema as
|
|
12
|
-
import { baseBookingItemSchema as
|
|
13
|
-
import "./chunks/booking-engine/dist/schemas-
|
|
14
|
-
import { storefrontCheckoutModeSchema as
|
|
15
|
-
import { BOOKING_SEARCH_KEYS as
|
|
16
|
-
import { CATALOG_PRODUCT_BASE_RATE_UNSET as
|
|
17
|
-
import { StorefrontCartProvider as
|
|
18
|
-
import { cn as
|
|
19
|
-
import { buildDailyPriceRows as
|
|
20
|
-
import { getLocalizedEntry as
|
|
21
|
-
import { buildStorefrontCartSummary as
|
|
22
|
-
import { ROUTE as
|
|
23
|
-
import { formatStorefrontPhoneDisplay as
|
|
24
|
-
import { buildWhatsAppHref as
|
|
25
|
-
import { ROUTE as
|
|
26
|
-
import { ROUTE as
|
|
27
|
-
import { ROUTE as
|
|
28
|
-
import { ROUTE as
|
|
29
|
-
import { ROUTE as
|
|
30
|
-
import { Footer as
|
|
31
|
-
import { Badge as
|
|
32
|
-
import { Button as
|
|
33
|
-
import { Header as
|
|
34
|
-
import { storefront as
|
|
35
|
-
import { storefront as
|
|
36
|
-
import { PoweredByLoczerBadge as
|
|
37
|
-
import { PlatformFooter as
|
|
38
|
-
import { useWhatsAppFloatingButton as
|
|
39
|
-
import { WhatsAppFloatingButton as
|
|
10
|
+
import { DEFAULT_BOOKING_DELIVERY_OPTION as q, bookingCustomerInputSchema as J, bookingDeliveryOptionSchema as Y, bookingScheduleInputSchema as X, cartItemInputSchema as Z, createBookingInputBaseSchema as Q, createBookingInputSchema as $, resolveBookingDeliveryOption as ee, validateBookingDeliveryAddress as te } from "./chunks/booking-engine/dist/schemas/cart-inputs-j1yWfJxO.js";
|
|
11
|
+
import { baseAssetSchema as ne, baseAssetStatusSchema as re } from "./chunks/booking-engine/dist/schemas/base-asset-B_Dm8_Vk.js";
|
|
12
|
+
import { baseBookingItemSchema as ie, baseBookingSchema as ae, baseBookingStateSchema as oe } from "./chunks/booking-engine/dist/schemas/base-booking-DW8AEPKo.js";
|
|
13
|
+
import "./chunks/booking-engine/dist/schemas-DftrSnTE.js";
|
|
14
|
+
import { storefrontCheckoutModeSchema as se, storefrontConfigurationSchema as ce, storefrontContentSchema as le, storefrontFaqItemSchema as ue, storefrontFaqSchema as de, storefrontFulfillmentModeSchema as fe, storefrontLocalizedRichTextSchema as pe, storefrontModalMessageSchema as me, storefrontModulesSchema as he, storefrontReviewsModuleSchema as ge, storefrontRichTextSchema as _e, storefrontSettingsSchema as ve, storefrontShopSchema as ye, storefrontStatusSchema as be, storefrontWorkspaceSchema as xe } from "./storefrontSchemas.js";
|
|
15
|
+
import { BOOKING_SEARCH_KEYS as Se, TIME_OPTIONS as Ce, applyBookingParamsToSearch as we, createBookingPeriodConfigFromBookingEngineConfiguration as Te, createBookingPeriodConfigFromShopConfiguration as Ee, createBookingPeriodConfigFromStorefrontConfiguration as De, getBookingDurationLabel as Oe, getBookingDurationMinutes as ke, getBookingParamsFromSearch as Ae, getBookingSessionStorageKey as je, getDefaultBookingParams as Me, getDefaultBookingParamsForStorefrontConfiguration as Ne, pickBookingSearchParams as Pe, readBookingSearchParamsFromSessionStorage as Fe, readBookingSearchParamsFromStorage as Ie, resolveBookingSearchParams as Le, resolveBookingSearchParamsFromSessionStorage as Re, writeBookingSearchParamsToSessionStorage as ze, writeBookingSearchParamsToStorage as Be } from "./lib/booking.js";
|
|
16
|
+
import { CATALOG_PRODUCT_BASE_RATE_UNSET as Ve, buildStorefrontProductSlug as He, buildVariantStorefrontProductId as Ue, compareCatalogProducts as We, compareStorefrontAccessoryProducts as Ge, compareStorefrontBikeProducts as Ke, findStorefrontProduct as qe, findStorefrontProductBySlug as Je, getCatalogProductBaseRateMinor as Ye, getCatalogProductPaginationSort as Xe, getCatalogProductSortFieldForPriceUnit as Ze, getStorefrontBaseDailyRateMinor as Qe, getStorefrontCheckoutProductId as $e, getStorefrontRepresentedVariantId as et, toStorefrontAccessoryProducts as tt, toStorefrontBikeProducts as nt, toStorefrontBookingProducts as rt, toStorefrontBookingProductsCollections as it } from "./lib/products.js";
|
|
17
|
+
import { StorefrontCartProvider as at, resolveStorefrontCartItemProduct as ot, useStorefrontCart as st } from "./lib/cart.js";
|
|
18
|
+
import { cn as ct, formatPriceMinor as lt, getAvailabilityVariant as ut, getMinDayPriceMinor as dt } from "./lib/utils.js";
|
|
19
|
+
import { buildDailyPriceRows as ft, buildPriceTierLabels as pt, calculateDailyPriceForQuantity as mt, formatStorefrontPriceMinor as ht } from "./lib/pricing.js";
|
|
20
|
+
import { getLocalizedEntry as gt, getLocalizedValue as _t } from "./localization.js";
|
|
21
|
+
import { buildStorefrontCartSummary as vt } from "./lib/cartSummary.js";
|
|
22
|
+
import { ROUTE as yt, requestSchema as bt, responseSchema as xt } from "./lib/contactForm.js";
|
|
23
|
+
import { formatStorefrontPhoneDisplay as St, resolveStorefrontMapsHref as Ct, resolveStorefrontPhoneContact as wt } from "./lib/storefrontContact.js";
|
|
24
|
+
import { buildWhatsAppHref as Tt, resolveStorefrontWhatsAppContact as Et, resolveStorefrontWhatsAppHref as Dt } from "./lib/whatsapp.js";
|
|
25
|
+
import { ROUTE as Ot, requestBaseSchema as kt, requestCheckoutItemSchema as At, requestDeliveryRefinement as jt, requestSchema as Mt, responseSchema as Nt } from "./lib/checkoutSubmit.js";
|
|
26
|
+
import { ROUTE as Pt, requestSchema as Ft, responseSchema as It, storefrontPublicAccessoryProductSchema as Lt, storefrontPublicBikeAvailabilityStatusSchema as Rt, storefrontPublicBikeProductSchema as zt, storefrontPublicProductDisplayModeSchema as Bt, storefrontPublicProductPriceSchema as Vt, storefrontPublicProductVariantAttributeSchema as Ht, storefrontPublicProductVariantIdentifierSchema as Ut, storefrontPublicProductVariantSchema as Wt } from "./lib/storefrontProducts.js";
|
|
27
|
+
import { ROUTE as Gt, buildStorefrontAvailabilityKey as Kt, doesStorefrontAvailabilityDisplaySoldOut as qt, getStorefrontAvailabilityIssue as Jt, getStorefrontAvailabilityStatus as Yt, isStorefrontAvailabilityInsufficient as Xt, publicAvailabilityDisplayModeSchema as Zt, requestSchema as Qt, responseSchema as $t, shouldBlockStorefrontUnavailableItem as en, storefrontAvailabilityProductSchema as tn, storefrontAvailabilityScheduleSchema as nn, storefrontPublicAvailabilityRecordSchema as rn } from "./lib/storefrontAvailability.js";
|
|
28
|
+
import { ROUTE as an, buildStorefrontImageUrl as on, requestSchema as sn } from "./lib/storefrontImage.js";
|
|
29
|
+
import { ROUTE as cn, requestSchema as ln, responseSchema as un, storefrontTimeSlotSchema as dn, timeSlotJourneySchema as fn } from "./lib/storefrontTimeSlots.js";
|
|
30
|
+
import { Footer as pn } from "./components/Footer/index.js";
|
|
31
|
+
import { Badge as mn, badgeVariants as hn } from "./ui/badge.js";
|
|
32
|
+
import { Button as gn, buttonVariants as _n } from "./ui/button.js";
|
|
33
|
+
import { Header as vn } from "./components/Header/index.js";
|
|
34
|
+
import { storefront as yn } from "./i18n/en.js";
|
|
35
|
+
import { storefront as bn } from "./i18n/fr.js";
|
|
36
|
+
import { PoweredByLoczerBadge as xn } from "./components/PoweredByLoczerBadge/index.js";
|
|
37
|
+
import { PlatformFooter as Sn } from "./components/PlatformFooter/index.js";
|
|
38
|
+
import { useWhatsAppFloatingButton as Cn } from "./components/WhatsAppFloatingButton/useWhatsAppFloatingButton.js";
|
|
39
|
+
import { WhatsAppFloatingButton as wn } from "./components/WhatsAppFloatingButton/WhatsAppFloatingButton.js";
|
|
40
40
|
import "./components/WhatsAppFloatingButton/index.js";
|
|
41
|
-
import { Layout as
|
|
42
|
-
import { DelayedPlaceholder as
|
|
43
|
-
import { BookingPeriodProvider as
|
|
44
|
-
import { Label as
|
|
45
|
-
import { BookingStartDateField as
|
|
46
|
-
import { BookingStartTimeField as
|
|
47
|
-
import { BookingEndDateField as
|
|
48
|
-
import { BookingEndTimeField as
|
|
49
|
-
import { BookingMobileDateDrawer as
|
|
50
|
-
import { BookingPeriodSelector as
|
|
51
|
-
import { BookingFlowSteps as
|
|
52
|
-
import { Input as
|
|
53
|
-
import { DeliveryAddressSelector as
|
|
54
|
-
import { loader as
|
|
55
|
-
import { Form as
|
|
56
|
-
import { Textarea as
|
|
57
|
-
import { ContactSection as
|
|
58
|
-
import { TestimonialsSection as
|
|
59
|
-
import { AboutSection as
|
|
60
|
-
import { StepSectionTitle as
|
|
61
|
-
import { Card as
|
|
62
|
-
import { ProductWarningNotice as
|
|
63
|
-
import { StorefrontCartPanel as
|
|
64
|
-
import { ProductPriceBadge as
|
|
65
|
-
import { ContractSaleDocument as
|
|
41
|
+
import { Layout as Tn } from "./components/Layout/index.js";
|
|
42
|
+
import { DelayedPlaceholder as En, DelayedReveal as Dn } from "./components/DelayedReveal/index.js";
|
|
43
|
+
import { BookingPeriodProvider as On, useBookingPeriod as kn } from "./components/BookingPeriodSelector/BookingPeriodContext.js";
|
|
44
|
+
import { Label as An } from "./ui/label.js";
|
|
45
|
+
import { BookingStartDateField as jn } from "./components/BookingPeriodSelector/components/BookingStartDateField.js";
|
|
46
|
+
import { BookingStartTimeField as Mn } from "./components/BookingPeriodSelector/components/BookingStartTimeField.js";
|
|
47
|
+
import { BookingEndDateField as Nn } from "./components/BookingPeriodSelector/components/BookingEndDateField.js";
|
|
48
|
+
import { BookingEndTimeField as Pn } from "./components/BookingPeriodSelector/components/BookingEndTimeField.js";
|
|
49
|
+
import { BookingMobileDateDrawer as Fn } from "./components/BookingPeriodSelector/components/BookingMobileDateDrawer.js";
|
|
50
|
+
import { BookingPeriodSelector as In } from "./components/BookingPeriodSelector/index.js";
|
|
51
|
+
import { BookingFlowSteps as Ln } from "./components/BookingFlowSteps/index.js";
|
|
52
|
+
import { Input as Rn } from "./ui/input.js";
|
|
53
|
+
import { DeliveryAddressSelector as zn } from "./components/DeliveryAddressSelector/index.js";
|
|
54
|
+
import { loader as Bn, useOptionalStorefront as Vn, useStorefront as Hn, useStorefrontBookingProducts as Un, useStorefrontConfig as Wn, useStorefrontProducts as Gn, useStorefrontWorkspaceLanguage as Kn } from "./StorefrontProvider.js";
|
|
55
|
+
import { Form as qn, FormControl as Jn, FormDescription as Yn, FormField as Xn, FormItem as Zn, FormLabel as Qn, FormMessage as $n, useFormField as er } from "./ui/form.js";
|
|
56
|
+
import { Textarea as tr } from "./ui/textarea.js";
|
|
57
|
+
import { ContactSection as nr } from "./components/ContactSection/index.js";
|
|
58
|
+
import { TestimonialsSection as rr } from "./components/TestimonialsSection/index.js";
|
|
59
|
+
import { AboutSection as ir } from "./components/AboutSection/index.js";
|
|
60
|
+
import { StepSectionTitle as ar } from "./components/StepSectionTitle/index.js";
|
|
61
|
+
import { Card as or, CardAction as sr, CardContent as cr, CardDescription as lr, CardFooter as ur, CardHeader as dr, CardTitle as fr } from "./ui/card.js";
|
|
62
|
+
import { ProductWarningNotice as pr } from "./components/ProductWarningNotice/index.js";
|
|
63
|
+
import { StorefrontCartPanel as mr } from "./components/StorefrontCartPanel/index.js";
|
|
64
|
+
import { ProductPriceBadge as hr } from "./components/ProductPriceBadge/index.js";
|
|
65
|
+
import { ContractSaleDocument as gr } from "./components/ContractSaleDocument/Invoice.js";
|
|
66
66
|
import "./components/ContractSaleDocument/index.js";
|
|
67
|
-
import { RadioGroup as
|
|
67
|
+
import { RadioGroup as _r, RadioGroupItem as vr } from "./ui/radio-group.js";
|
|
68
68
|
import "./pages/HomePage.js";
|
|
69
69
|
import "./pages/BookingPage.js";
|
|
70
70
|
import "./pages/ProductPage.js";
|
|
71
71
|
import "./pages/CheckoutPage.js";
|
|
72
72
|
import "./pages/CheckoutSuccessPage.js";
|
|
73
73
|
import "./pages/NotFoundPage.js";
|
|
74
|
-
import { accessories as
|
|
75
|
-
import
|
|
76
|
-
import { contractSaleDocumentAcceptanceLevelSchema as
|
|
77
|
-
import { ACCEPT_CONTRACT_SALE_DOCUMENT_ROUTE as
|
|
78
|
-
import
|
|
79
|
-
import { Select as
|
|
80
|
-
export {
|
|
74
|
+
import { accessories as yr } from "./data/accessories.js";
|
|
75
|
+
import br from "./data/bikes.js";
|
|
76
|
+
import { contractSaleDocumentAcceptanceLevelSchema as xr, contractSaleDocumentAcceptanceRecordSchema as Sr, contractSaleDocumentAcceptanceSchema as Cr, contractSaleDocumentAddressSchema as wr, contractSaleDocumentContactSchema as Tr, contractSaleDocumentKindSchema as Er, contractSaleDocumentLanguageCodeSchema as Dr, contractSaleDocumentLanguageSchema as Or, contractSaleDocumentLineItemSchema as kr, contractSaleDocumentSchema as Ar, contractSaleDocumentSignatureSchema as jr } from "./lib/contractSaleDocument.js";
|
|
77
|
+
import { ACCEPT_CONTRACT_SALE_DOCUMENT_ROUTE as Mr, DOWNLOAD_CONTRACT_SALE_DOCUMENT_PDF_ROUTE as Nr, GET_CONTRACT_SALE_DOCUMENT_ROUTE as Pr, acceptContractSaleDocumentRequestSchema as Fr, acceptContractSaleDocumentResponseSchema as Ir, contractSaleDocumentAcceptanceInputSchema as Lr, contractSaleDocumentAcceptanceRecordInputSchema as Rr, contractSaleDocumentApiAcceptanceRecordSchema as zr, contractSaleDocumentApiAcceptanceSchema as Br, contractSaleDocumentApiSchema as Vr, contractSaleDocumentApiSignatureSchema as Hr, contractSaleDocumentReferenceSchema as Ur, contractSaleDocumentReferenceTypeSchema as Wr, contractSaleDocumentSignatureInputSchema as Gr, downloadContractSaleDocumentPdfRequestSchema as Kr, getContractSaleDocumentRequestSchema as qr, getContractSaleDocumentResponseSchema as Jr } from "./lib/contractSaleDocumentApi.js";
|
|
78
|
+
import Yr from "./routes.js";
|
|
79
|
+
import { Select as Xr, SelectContent as Zr, SelectGroup as Qr, SelectIcon as $r, SelectItem as ei, SelectItemIndicator as ti, SelectItemText as ni, SelectLabel as ri, SelectScrollDownButton as ii, SelectScrollUpButton as ai, SelectSeparator as oi, SelectTrigger as si, SelectValue as ci } from "./ui/select.js";
|
|
80
|
+
export { Mr as ACCEPT_CONTRACT_SALE_DOCUMENT_ROUTE, ir as AboutSection, Se as BOOKING_SEARCH_KEYS, mn as Badge, Nn as BookingEndDateField, Pn as BookingEndTimeField, Ln as BookingFlowSteps, Fn as BookingMobileDateDrawer, On as BookingPeriodProvider, In as BookingPeriodSelector, jn as BookingStartDateField, Mn as BookingStartTimeField, gn as Button, Ve as CATALOG_PRODUCT_BASE_RATE_UNSET, or as Card, sr as CardAction, cr as CardContent, lr as CardDescription, ur as CardFooter, dr as CardHeader, fr as CardTitle, nr as ContactSection, gr as ContractSaleDocument, q as DEFAULT_BOOKING_DELIVERY_OPTION, R as DEFAULT_CANCELLATION_POLICY, z as DEFAULT_PAYMENT_POLICIES, Nr as DOWNLOAD_CONTRACT_SALE_DOCUMENT_PDF_ROUTE, En as DelayedPlaceholder, Dn as DelayedReveal, zn as DeliveryAddressSelector, pn as Footer, qn as Form, Jn as FormControl, Yn as FormDescription, Xn as FormField, Zn as FormItem, Qn as FormLabel, $n as FormMessage, Pr as GET_CONTRACT_SALE_DOCUMENT_ROUTE, vn as Header, Rn as Input, An as Label, Tn as Layout, p as PRODUCT_VARIANT_CODE_IDENTIFIER_KIND, m as PRODUCT_VARIANT_CODE_MAX_LENGTH, Sn as PlatformFooter, xn as PoweredByLoczerBadge, hr as ProductPriceBadge, pr as ProductWarningNotice, yt as ROUTE, _r as RadioGroup, vr as RadioGroupItem, Gt as STOREFRONT_AVAILABILITY_ROUTE, Ot as STOREFRONT_CHECKOUT_SUBMIT_ROUTE, an as STOREFRONT_IMAGE_ROUTE, Pt as STOREFRONT_PRODUCTS_ROUTE, cn as STOREFRONT_TIME_SLOTS_ROUTE, Xr as Select, Zr as SelectContent, Qr as SelectGroup, $r as SelectIcon, ei as SelectItem, ti as SelectItemIndicator, ni as SelectItemText, ri as SelectLabel, ii as SelectScrollDownButton, ai as SelectScrollUpButton, oi as SelectSeparator, si as SelectTrigger, ci as SelectValue, ar as StepSectionTitle, mr as StorefrontCartPanel, at as StorefrontCartProvider, Ce as TIME_OPTIONS, rr as TestimonialsSection, tr as Textarea, wn as WhatsAppFloatingButton, Fr as acceptContractSaleDocumentRequestSchema, Ir as acceptContractSaleDocumentResponseSchema, yr as accessories, h as accessoryProductSchema, we as applyBookingParamsToSearch, hn as badgeVariants, ne as baseAssetSchema, re as baseAssetStatusSchema, ie as baseBookingItemSchema, ae as baseBookingSchema, oe as baseBookingStateSchema, g as bikeProductSchema, br as bikes, J as bookingCustomerInputSchema, Y as bookingDeliveryOptionSchema, X as bookingScheduleInputSchema, ft as buildDailyPriceRows, pt as buildPriceTierLabels, Kt as buildStorefrontAvailabilityKey, vt as buildStorefrontCartSummary, on as buildStorefrontImageUrl, He as buildStorefrontProductSlug, Ue as buildVariantStorefrontProductId, Tt as buildWhatsAppHref, _n as buttonVariants, mt as calculateDailyPriceForQuantity, B as cancellationPolicySchema, V as cancellationPolicyTierSchema, Z as cartItemInputSchema, ct as cn, We as compareCatalogProducts, Ge as compareStorefrontAccessoryProducts, Ke as compareStorefrontBikeProducts, Lr as contractSaleDocumentAcceptanceInputSchema, xr as contractSaleDocumentAcceptanceLevelSchema, Rr as contractSaleDocumentAcceptanceRecordInputSchema, Sr as contractSaleDocumentAcceptanceRecordSchema, Cr as contractSaleDocumentAcceptanceSchema, wr as contractSaleDocumentAddressSchema, zr as contractSaleDocumentApiAcceptanceRecordSchema, Br as contractSaleDocumentApiAcceptanceSchema, Vr as contractSaleDocumentApiSchema, Hr as contractSaleDocumentApiSignatureSchema, Tr as contractSaleDocumentContactSchema, Er as contractSaleDocumentKindSchema, Dr as contractSaleDocumentLanguageCodeSchema, Or as contractSaleDocumentLanguageSchema, kr as contractSaleDocumentLineItemSchema, Ur as contractSaleDocumentReferenceSchema, Wr as contractSaleDocumentReferenceTypeSchema, Ar as contractSaleDocumentSchema, Gr as contractSaleDocumentSignatureInputSchema, jr as contractSaleDocumentSignatureSchema, Q as createBookingInputBaseSchema, $ as createBookingInputSchema, Te as createBookingPeriodConfigFromBookingEngineConfiguration, Ee as createBookingPeriodConfigFromShopConfiguration, De as createBookingPeriodConfigFromStorefrontConfiguration, e as createLocalizedStringEntry, a as currencyCodeSchema, o as currencyMinorUnitDigits, qt as doesStorefrontAvailabilityDisplaySoldOut, Kr as downloadContractSaleDocumentPdfRequestSchema, _ as eBikeProductSchema, qe as findStorefrontProduct, Je as findStorefrontProductBySlug, lt as formatPriceMinor, St as formatStorefrontPhoneDisplay, ht as formatStorefrontPriceMinor, U as fulfillmentModeSchema, ut as getAvailabilityVariant, Oe as getBookingDurationLabel, ke as getBookingDurationMinutes, Ae as getBookingParamsFromSearch, je as getBookingSessionStorageKey, Ye as getCatalogProductBaseRateMinor, Xe as getCatalogProductPaginationSort, Ze as getCatalogProductSortFieldForPriceUnit, qr as getContractSaleDocumentRequestSchema, Jr as getContractSaleDocumentResponseSchema, Me as getDefaultBookingParams, Ne as getDefaultBookingParamsForStorefrontConfiguration, gt as getLocalizedEntry, t as getLocalizedStringValue, _t as getLocalizedValue, dt as getMinDayPriceMinor, Jt as getStorefrontAvailabilityIssue, Yt as getStorefrontAvailabilityStatus, Qe as getStorefrontBaseDailyRateMinor, $e as getStorefrontCheckoutProductId, et as getStorefrontRepresentedVariantId, v as isProductVariantCodeIdentifierKind, Xt as isStorefrontAvailabilityInsufficient, k as isoDateSchema, Bn as loader, n as localizedStringArraySchema, r as localizedStringEntrySchema, i as localizedStringSchema, s as majorToMinor, c as minorToMajor, l as moneyMinorSchema, H as paymentPoliciesSchema, Pe as pickBookingSearchParams, d as priceSchema, f as priceUnitSchema, y as productKindSchema, b as productSchema, x as productStorefrontDisplayModeSchema, S as productVariantAttributeSchema, C as productVariantCodeSchema, w as productVariantIdentifierSchema, T as productVariantSchema, Zt as publicAvailabilityDisplayModeSchema, W as publicBookingEngineConfigurationSchema, G as publicCheckoutConfigurationSchema, K as publicCheckoutDynamicOptionsSchema, Fe as readBookingSearchParamsFromSessionStorage, Ie as readBookingSearchParamsFromStorage, bt as requestSchema, ee as resolveBookingDeliveryOption, Le as resolveBookingSearchParams, Re as resolveBookingSearchParamsFromSessionStorage, ot as resolveStorefrontCartItemProduct, Ct as resolveStorefrontMapsHref, wt as resolveStorefrontPhoneContact, Et as resolveStorefrontWhatsAppContact, Dt as resolveStorefrontWhatsAppHref, xt as responseSchema, E as richTextJsonDocSchema, D as richTextSchema, O as richTextVersionSchema, A as shopConfigurationSchema, j as shopExtraTimeSlotRuleSchema, M as shopOpeningDayIndexSchema, N as shopOpeningDaySchema, P as shopOpeningHoursOverrideSchema, F as shopOpeningHoursPeriodSchema, I as shopOpeningSlotSchema, en as shouldBlockStorefrontUnavailableItem, u as signedMoneyMinorSchema, tn as storefrontAvailabilityProductSchema, Qt as storefrontAvailabilityRequestSchema, $t as storefrontAvailabilityResponseSchema, nn as storefrontAvailabilityScheduleSchema, se as storefrontCheckoutModeSchema, jt as storefrontCheckoutSubmitDeliveryRefinement, At as storefrontCheckoutSubmitItemSchema, kt as storefrontCheckoutSubmitRequestBaseSchema, Mt as storefrontCheckoutSubmitRequestSchema, Nt as storefrontCheckoutSubmitResponseSchema, ce as storefrontConfigurationSchema, le as storefrontContentSchema, yn as storefrontEn, ue as storefrontFaqItemSchema, de as storefrontFaqSchema, bn as storefrontFr, fe as storefrontFulfillmentModeSchema, sn as storefrontImageRequestSchema, pe as storefrontLocalizedRichTextSchema, me as storefrontModalMessageSchema, he as storefrontModulesSchema, Ft as storefrontProductsRequestSchema, It as storefrontProductsResponseSchema, Lt as storefrontPublicAccessoryProductSchema, rn as storefrontPublicAvailabilityRecordSchema, Rt as storefrontPublicBikeAvailabilityStatusSchema, zt as storefrontPublicBikeProductSchema, Bt as storefrontPublicProductDisplayModeSchema, Vt as storefrontPublicProductPriceSchema, Ht as storefrontPublicProductVariantAttributeSchema, Ut as storefrontPublicProductVariantIdentifierSchema, Wt as storefrontPublicProductVariantSchema, ge as storefrontReviewsModuleSchema, _e as storefrontRichTextSchema, Yr as storefrontRoutes, ve as storefrontSettingsSchema, ye as storefrontShopSchema, be as storefrontStatusSchema, fn as storefrontTimeSlotJourneySchema, dn as storefrontTimeSlotSchema, ln as storefrontTimeSlotsRequestSchema, un as storefrontTimeSlotsResponseSchema, xe as storefrontWorkspaceSchema, L as timeOfDaySchema, tt as toStorefrontAccessoryProducts, nt as toStorefrontBikeProducts, rt as toStorefrontBookingProducts, it as toStorefrontBookingProductsCollections, kn as useBookingPeriod, er as useFormField, Vn as useOptionalStorefront, Hn as useStorefront, Un as useStorefrontBookingProducts, st as useStorefrontCart, Wn as useStorefrontConfig, Gn as useStorefrontProducts, Kn as useStorefrontWorkspaceLanguage, Cn as useWhatsAppFloatingButton, te as validateBookingDeliveryAddress, ze as writeBookingSearchParamsToSessionStorage, Be as writeBookingSearchParamsToStorage };
|
package/dist/lib/booking.d.ts
CHANGED
|
@@ -14,6 +14,9 @@ export type StorefrontBookingParams = {
|
|
|
14
14
|
type BookingSearchStorage = Pick<Storage, "getItem" | "removeItem" | "setItem"> | null | undefined;
|
|
15
15
|
export declare const TIME_OPTIONS: string[];
|
|
16
16
|
export declare const getDefaultBookingParams: (now?: Date) => StorefrontBookingParams;
|
|
17
|
+
export declare const createBookingPeriodConfigFromShopConfiguration: (shop: StorefrontConfiguration["bookingEngine"]["shop"], options?: {
|
|
18
|
+
sameDayCutoff?: string;
|
|
19
|
+
}) => BookingPeriodConfig;
|
|
17
20
|
export declare const createBookingPeriodConfigFromBookingEngineConfiguration: (bookingEngine: StorefrontConfiguration["bookingEngine"], options?: {
|
|
18
21
|
sameDayCutoff?: string;
|
|
19
22
|
}) => BookingPeriodConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"booking.d.ts","sourceRoot":"","sources":["../../src/lib/booking.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"booking.d.ts","sourceRoot":"","sources":["../../src/lib/booking.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AACnE,OAAO,EAGL,KAAK,mBAAmB,EAGzB,MAAM,kBAAkB,CAAA;AAGzB,eAAO,MAAM,mBAAmB,8GAQtB,CAAA;AAEV,MAAM,MAAM,kBAAkB,G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CAAA;AAuBD,eAAO,MAAM,2BAA2B,GAAI,YAAY,MAAM,KAAG,MAOhE,CAAA;AAED,eAAO,MAAM,kCAAkC,GAC7C,SAAS,oBAAoB,EAC7B,YAAY,MAAM,KACjB,eAiBF,CAAA;AAED,eAAO,MAAM,iCAAiC,GAC5C,SAAS,oBAAoB,EAC7B,WAAW,MAAM,GAAG,SAAS,EAC7B,SAAS,OAAO,CAAC,uBAAuB,CAAC,GAAG,eAAe,KAC1D,IAkBF,CAAA;AAED,eAAO,MAAM,yCAAyC,GAAI,YAAY,MAAM,KAAG,eAE9E,CAAA;AAED,eAAO,MAAM,wCAAwC,GACnD,WAAW,MAAM,GAAG,SAAS,EAC7B,SAAS,OAAO,CAAC,uBAAuB,CAAC,GAAG,eAAe,KAC1D,IAEF,CAAA;AAED,eAAO,MAAM,0BAA0B,GACrC,cAAc,eAAe,EAC7B,UAAU;IACR,OAAO,CAAC,EAAE,oBAAoB,CAAA;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,KACA,eAOF,CAAA;AAED,eAAO,MAAM,4CAA4C,GACvD,cAAc,eAAe,EAC7B,YAAY,MAAM,KACjB,eAKF,CAAA;AAED,eAAO,MAAM,yBAAyB,GAAI,SAAS,uBAAuB,KAAG,MAK5E,CAAA;AAED,eAAO,MAAM,uBAAuB,GAAI,SAAS,uBAAuB,KAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAQzH,CAAA"}
|
package/dist/lib/booking.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { DEFAULT_BOOKING_DELIVERY_OPTION as e } from "../chunks/booking-engine/dist/schemas/cart-inputs-j1yWfJxO.js";
|
|
2
|
+
import "../chunks/booking-engine/dist/schemas-DftrSnTE.js";
|
|
3
|
+
import { getDefaultBookingPeriod as t, parseTimeToMinutes as n } from "./booking-period.js";
|
|
4
|
+
import { differenceInMinutes as r, format as i } from "date-fns";
|
|
3
5
|
//#region src/lib/booking.ts
|
|
4
|
-
var
|
|
6
|
+
var a = [
|
|
5
7
|
"fulfillment",
|
|
6
8
|
"start_date",
|
|
7
9
|
"start_time",
|
|
@@ -9,78 +11,78 @@ var i = [
|
|
|
9
11
|
"end_time",
|
|
10
12
|
"start_address",
|
|
11
13
|
"end_address"
|
|
12
|
-
],
|
|
14
|
+
], o = "loczer_storefront_booking:", s = (e) => i(e, "yyyy-MM-dd"), c = (() => {
|
|
13
15
|
let e = [];
|
|
14
16
|
for (let t = 8; t <= 18; t += 1) for (let n of [0, 30]) t === 18 && n > 0 || e.push(`${String(t).padStart(2, "0")}:${String(n).padStart(2, "0")}`);
|
|
15
17
|
return e;
|
|
16
|
-
})(),
|
|
17
|
-
let
|
|
18
|
+
})(), l = (t = /* @__PURE__ */ new Date()) => {
|
|
19
|
+
let n = s(t);
|
|
18
20
|
return {
|
|
19
|
-
fulfillment:
|
|
20
|
-
start_date:
|
|
21
|
-
start_time:
|
|
22
|
-
end_date:
|
|
23
|
-
end_time:
|
|
21
|
+
fulfillment: e,
|
|
22
|
+
start_date: n,
|
|
23
|
+
start_time: c[3] ?? "09:30",
|
|
24
|
+
end_date: n,
|
|
25
|
+
end_time: c.at(-1) ?? "18:00",
|
|
24
26
|
start_address: "",
|
|
25
27
|
end_address: ""
|
|
26
28
|
};
|
|
27
|
-
},
|
|
29
|
+
}, u = 30, d = 15, f = 10, p = 960, m = (e) => n(e) ?? p, h = (e) => (Math.trunc(e) % 7 + 7) % 7, g = (e) => {
|
|
28
30
|
if (e?.length) return e.map((e) => ({
|
|
29
31
|
minutesAfterClose: e.minutesAfterClose,
|
|
30
32
|
extraAmount: e.extraAmount
|
|
31
33
|
}));
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
openingHours: e.
|
|
34
|
+
}, _ = (e, t = {}) => ({
|
|
35
|
+
timing: {
|
|
36
|
+
slotIntervalMinutes: u,
|
|
37
|
+
autoFillCutoffMinutes: m(t.sameDayCutoff),
|
|
38
|
+
pastToleranceMinutes: d,
|
|
39
|
+
minBufferMinutes: f
|
|
40
|
+
},
|
|
41
|
+
openingHours: e.openingHours.map((e) => ({
|
|
42
|
+
...e,
|
|
43
|
+
openingHours: e.openingHours.map((e) => ({
|
|
42
44
|
...e,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
};
|
|
52
|
-
},
|
|
53
|
-
let
|
|
54
|
-
config:
|
|
55
|
-
referenceDate:
|
|
45
|
+
day: h(e.day)
|
|
46
|
+
}))
|
|
47
|
+
})),
|
|
48
|
+
openingHoursOverrides: e.openingHoursOverrides ?? [],
|
|
49
|
+
timeZone: e.timeZone,
|
|
50
|
+
extraTimeSlots: g(e.extraTimeSlots)
|
|
51
|
+
}), v = (e, t = {}) => {
|
|
52
|
+
let n = e.checkout.dynamicOptions?.sameDayCutoff;
|
|
53
|
+
return _(e.shop, { sameDayCutoff: t.sameDayCutoff ?? n });
|
|
54
|
+
}, y = (e) => v(e.bookingEngine, { sameDayCutoff: e.settings.sameDayCutoff }), b = (n, r = /* @__PURE__ */ new Date()) => {
|
|
55
|
+
let i = t({
|
|
56
|
+
config: y(n),
|
|
57
|
+
referenceDate: r
|
|
56
58
|
});
|
|
57
59
|
return {
|
|
58
|
-
fulfillment:
|
|
59
|
-
start_date:
|
|
60
|
-
start_time:
|
|
61
|
-
end_date:
|
|
62
|
-
end_time:
|
|
60
|
+
fulfillment: e,
|
|
61
|
+
start_date: s(i.startDate),
|
|
62
|
+
start_time: i.startTime,
|
|
63
|
+
end_date: s(i.endDate),
|
|
64
|
+
end_time: i.endTime,
|
|
63
65
|
start_address: "",
|
|
64
66
|
end_address: ""
|
|
65
67
|
};
|
|
66
|
-
},
|
|
68
|
+
}, x = (e, t, n) => {
|
|
67
69
|
let r = e.get(t);
|
|
68
70
|
return r == null || r.trim() === "" ? n : r;
|
|
69
|
-
},
|
|
71
|
+
}, S = (e, t) => {
|
|
70
72
|
let n = {
|
|
71
|
-
...
|
|
73
|
+
...l(),
|
|
72
74
|
...t
|
|
73
75
|
};
|
|
74
76
|
return {
|
|
75
77
|
fulfillment: e.get("fulfillment") === "delivery" ? "delivery" : e.get("fulfillment") === "pickup" ? "pickup" : n.fulfillment,
|
|
76
|
-
start_date:
|
|
77
|
-
start_time:
|
|
78
|
-
end_date:
|
|
79
|
-
end_time:
|
|
80
|
-
start_address:
|
|
81
|
-
end_address:
|
|
78
|
+
start_date: x(e, "start_date", n.start_date),
|
|
79
|
+
start_time: x(e, "start_time", n.start_time),
|
|
80
|
+
end_date: x(e, "end_date", n.end_date),
|
|
81
|
+
end_time: x(e, "end_time", n.end_time),
|
|
82
|
+
start_address: x(e, "start_address", n.start_address),
|
|
83
|
+
end_address: x(e, "end_address", n.end_address)
|
|
82
84
|
};
|
|
83
|
-
},
|
|
85
|
+
}, C = (e, t) => {
|
|
84
86
|
let n = new URLSearchParams(e), r = (e, t) => {
|
|
85
87
|
if (t != null) {
|
|
86
88
|
if (t.trim() === "") {
|
|
@@ -91,38 +93,38 @@ var i = [
|
|
|
91
93
|
}
|
|
92
94
|
};
|
|
93
95
|
return r("fulfillment", t.fulfillment), r("start_date", t.start_date), r("start_time", t.start_time), r("end_date", t.end_date), r("end_time", t.end_time), r("start_address", t.start_address), r("end_address", t.end_address), n;
|
|
94
|
-
},
|
|
96
|
+
}, w = (e) => {
|
|
95
97
|
let t = new URLSearchParams();
|
|
96
|
-
for (let n of
|
|
98
|
+
for (let n of a) {
|
|
97
99
|
let r = e.get(n);
|
|
98
100
|
if (r == null) continue;
|
|
99
101
|
let i = r.trim();
|
|
100
102
|
i.length !== 0 && t.set(n, i);
|
|
101
103
|
}
|
|
102
104
|
return t;
|
|
103
|
-
},
|
|
105
|
+
}, T = () => {
|
|
104
106
|
if (typeof window > "u") return null;
|
|
105
107
|
try {
|
|
106
108
|
return window.sessionStorage;
|
|
107
109
|
} catch {
|
|
108
110
|
return null;
|
|
109
111
|
}
|
|
110
|
-
},
|
|
112
|
+
}, E = (e) => e instanceof URLSearchParams ? w(e) : C(new URLSearchParams(), e), D = (e) => {
|
|
111
113
|
let t = e?.trim() ?? "";
|
|
112
|
-
return t ? `${
|
|
113
|
-
},
|
|
114
|
-
let n =
|
|
114
|
+
return t ? `${o}${t}` : "";
|
|
115
|
+
}, O = (e, t) => {
|
|
116
|
+
let n = D(t);
|
|
115
117
|
if (!n || !e) return new URLSearchParams();
|
|
116
118
|
try {
|
|
117
119
|
let t = e.getItem(n);
|
|
118
|
-
return t ?
|
|
120
|
+
return t ? w(new URLSearchParams(t)) : new URLSearchParams();
|
|
119
121
|
} catch {
|
|
120
122
|
return new URLSearchParams();
|
|
121
123
|
}
|
|
122
|
-
},
|
|
123
|
-
let r =
|
|
124
|
+
}, k = (e, t, n) => {
|
|
125
|
+
let r = D(t);
|
|
124
126
|
if (!r || !e) return;
|
|
125
|
-
let i =
|
|
127
|
+
let i = E(n).toString();
|
|
126
128
|
try {
|
|
127
129
|
if (!i) {
|
|
128
130
|
e.removeItem(r);
|
|
@@ -130,19 +132,19 @@ var i = [
|
|
|
130
132
|
}
|
|
131
133
|
e.setItem(r, i);
|
|
132
134
|
} catch {}
|
|
133
|
-
},
|
|
134
|
-
|
|
135
|
-
},
|
|
136
|
-
let n =
|
|
137
|
-
return n.toString() ? n :
|
|
138
|
-
},
|
|
139
|
-
storage:
|
|
135
|
+
}, A = (e) => O(T(), e), j = (e, t) => {
|
|
136
|
+
k(T(), e, t);
|
|
137
|
+
}, M = (e, t) => {
|
|
138
|
+
let n = w(e);
|
|
139
|
+
return n.toString() ? n : O(t?.storage, t?.storeSlug);
|
|
140
|
+
}, N = (e, t) => M(e, {
|
|
141
|
+
storage: T(),
|
|
140
142
|
storeSlug: t
|
|
141
|
-
}),
|
|
142
|
-
let t = /* @__PURE__ */ new Date(`${e.start_date}T${e.start_time}:00`),
|
|
143
|
-
return Number.isNaN(t.getTime()) || Number.isNaN(
|
|
144
|
-
},
|
|
145
|
-
let t =
|
|
143
|
+
}), P = (e) => {
|
|
144
|
+
let t = /* @__PURE__ */ new Date(`${e.start_date}T${e.start_time}:00`), n = /* @__PURE__ */ new Date(`${e.end_date}T${e.end_time}:00`);
|
|
145
|
+
return Number.isNaN(t.getTime()) || Number.isNaN(n.getTime()) ? 0 : Math.max(0, r(n, t));
|
|
146
|
+
}, F = (e) => {
|
|
147
|
+
let t = P(e), n = Math.floor(t / 60), r = t % 60;
|
|
146
148
|
return r === 0 ? {
|
|
147
149
|
hours: n,
|
|
148
150
|
minutes: r,
|
|
@@ -154,4 +156,4 @@ var i = [
|
|
|
154
156
|
};
|
|
155
157
|
};
|
|
156
158
|
//#endregion
|
|
157
|
-
export {
|
|
159
|
+
export { a as BOOKING_SEARCH_KEYS, c as TIME_OPTIONS, C as applyBookingParamsToSearch, v as createBookingPeriodConfigFromBookingEngineConfiguration, _ as createBookingPeriodConfigFromShopConfiguration, y as createBookingPeriodConfigFromStorefrontConfiguration, F as getBookingDurationLabel, P as getBookingDurationMinutes, S as getBookingParamsFromSearch, D as getBookingSessionStorageKey, l as getDefaultBookingParams, b as getDefaultBookingParamsForStorefrontConfiguration, w as pickBookingSearchParams, A as readBookingSearchParamsFromSessionStorage, O as readBookingSearchParamsFromStorage, M as resolveBookingSearchParams, N as resolveBookingSearchParamsFromSessionStorage, j as writeBookingSearchParamsToSessionStorage, k as writeBookingSearchParamsToStorage };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkoutSubmit.d.ts","sourceRoot":"","sources":["../../src/lib/checkoutSubmit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"checkoutSubmit.d.ts","sourceRoot":"","sources":["../../src/lib/checkoutSubmit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAUvB,eAAO,MAAM,KAAK,2CAA2C,CAAA;AAE7D,eAAO,MAAM,yBAAyB;;;;;iBAKpC,CAAA;AACF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAI3E,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkB5B,CAAA;AAEF,eAAO,MAAM,yBAAyB,GACpC,SAAS;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,EACxD,KAAK,CAAC,CAAC,aAAa,SAWrB,CAAA;AAED,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAA2D,CAAA;AACrF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AAE1D,eAAO,MAAM,cAAc;;;;;;;;;;iBAYzB,CAAA;AACF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA"}
|
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
import { productKindSchema as e } from "../chunks/booking-engine/dist/models/Product.shared-CTuk4fiR.js";
|
|
2
|
-
import {
|
|
3
|
-
import "../chunks/booking-engine/dist/schemas-
|
|
4
|
-
import { storefrontFulfillmentModeSchema as
|
|
5
|
-
import { z as
|
|
2
|
+
import { DEFAULT_BOOKING_DELIVERY_OPTION as t, bookingScheduleInputSchema as n } from "../chunks/booking-engine/dist/schemas/cart-inputs-j1yWfJxO.js";
|
|
3
|
+
import "../chunks/booking-engine/dist/schemas-DftrSnTE.js";
|
|
4
|
+
import { storefrontFulfillmentModeSchema as r } from "../storefrontSchemas.js";
|
|
5
|
+
import { z as i } from "zod";
|
|
6
6
|
//#region src/lib/checkoutSubmit.ts
|
|
7
|
-
var
|
|
7
|
+
var a = "/api/public/storefront/checkout/submit", o = i.object({
|
|
8
8
|
kind: e,
|
|
9
|
-
productId:
|
|
10
|
-
productVariantId:
|
|
11
|
-
quantity:
|
|
12
|
-
}),
|
|
13
|
-
storeSlug:
|
|
14
|
-
schedule:
|
|
15
|
-
fulfillment:
|
|
16
|
-
startAddress:
|
|
17
|
-
endAddress:
|
|
18
|
-
couponCode:
|
|
19
|
-
couponAutoApplied:
|
|
20
|
-
customer:
|
|
21
|
-
fullName:
|
|
22
|
-
email:
|
|
23
|
-
phone:
|
|
24
|
-
notes:
|
|
9
|
+
productId: i.string().trim().min(1),
|
|
10
|
+
productVariantId: i.string().trim().min(1).optional(),
|
|
11
|
+
quantity: i.number().int().positive()
|
|
12
|
+
}), s = i.object({
|
|
13
|
+
storeSlug: i.string().trim().min(1).toLowerCase(),
|
|
14
|
+
schedule: n,
|
|
15
|
+
fulfillment: r.default(t),
|
|
16
|
+
startAddress: i.string().trim().max(500).optional(),
|
|
17
|
+
endAddress: i.string().trim().max(500).optional(),
|
|
18
|
+
couponCode: i.string().trim().max(64).optional().or(i.literal("")),
|
|
19
|
+
couponAutoApplied: i.boolean().optional(),
|
|
20
|
+
customer: i.object({
|
|
21
|
+
fullName: i.string().trim().min(2),
|
|
22
|
+
email: i.string().trim().email(),
|
|
23
|
+
phone: i.string().trim().min(6),
|
|
24
|
+
notes: i.string().trim().max(2e3).optional().or(i.literal(""))
|
|
25
25
|
}),
|
|
26
|
-
items:
|
|
27
|
-
nowIso:
|
|
28
|
-
}),
|
|
26
|
+
items: i.array(o).min(1),
|
|
27
|
+
nowIso: i.string().datetime({ offset: !0 }).optional()
|
|
28
|
+
}), c = (e, t) => {
|
|
29
29
|
e.fulfillment === "delivery" && (e.startAddress?.trim() || t.addIssue({
|
|
30
|
-
code:
|
|
30
|
+
code: i.ZodIssueCode.custom,
|
|
31
31
|
message: "Delivery start address is required.",
|
|
32
32
|
path: ["startAddress"]
|
|
33
33
|
}));
|
|
34
|
-
},
|
|
35
|
-
success:
|
|
36
|
-
message:
|
|
37
|
-
checkout:
|
|
38
|
-
bookingExternalId:
|
|
39
|
-
saleId:
|
|
40
|
-
nextPath:
|
|
41
|
-
successPath:
|
|
42
|
-
requiresPayment:
|
|
34
|
+
}, l = s.superRefine(c), u = i.object({
|
|
35
|
+
success: i.boolean(),
|
|
36
|
+
message: i.string().optional(),
|
|
37
|
+
checkout: i.object({
|
|
38
|
+
bookingExternalId: i.string().trim().min(1),
|
|
39
|
+
saleId: i.string().trim().min(1),
|
|
40
|
+
nextPath: i.string().trim().min(1),
|
|
41
|
+
successPath: i.string().trim().min(1),
|
|
42
|
+
requiresPayment: i.boolean()
|
|
43
43
|
}).optional()
|
|
44
44
|
});
|
|
45
45
|
//#endregion
|
|
46
|
-
export {
|
|
46
|
+
export { a as ROUTE, s as requestBaseSchema, o as requestCheckoutItemSchema, c as requestDeliveryRefinement, l as requestSchema, u as responseSchema };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { timeOfDaySchema as e } from "./chunks/booking-engine/dist/schemas/shop-opening-hours-BlLD1gfz.js";
|
|
2
2
|
import { publicBookingEngineConfigurationSchema as t } from "./chunks/booking-engine/dist/schemas/public-booking-engine-configuration-BnJ_H-p1.js";
|
|
3
|
-
import "./chunks/booking-engine/dist/schemas-
|
|
3
|
+
import "./chunks/booking-engine/dist/schemas-DftrSnTE.js";
|
|
4
4
|
import { z as n } from "zod";
|
|
5
5
|
//#region src/storefrontSchemas.ts
|
|
6
6
|
var r = n.string().trim().regex(/^\+[1-9]\d{1,14}$/, { message: "Invalid phone number format (expected E.164, e.g. +14155552671)." }), i = n.object({
|
package/package.json
CHANGED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { createLocalizedStringEntry as e, getLocalizedStringValue as t, localizedStringArraySchema as n, localizedStringEntrySchema as r, localizedStringSchema as i } from "./models/LocalizedString-D_TRgAdr.js";
|
|
2
|
-
import { currencyCodeSchema as a, currencyMinorUnitDigits as o, majorToMinor as s, minorToMajor as c, moneyMinorSchema as l, signedMoneyMinorSchema as u } from "./schemas/money-CVoCY4of.js";
|
|
3
|
-
import { priceSchema as d, priceUnitSchema as f } from "./models/Price-DCAgqkKh.js";
|
|
4
|
-
import { PRODUCT_VARIANT_CODE_IDENTIFIER_KIND as p, PRODUCT_VARIANT_CODE_MAX_LENGTH as m, accessoryProductSchema as h, bikeProductSchema as g, eBikeProductSchema as _, isProductVariantCodeIdentifierKind as v, productKindSchema as y, productSchema as b, productStorefrontDisplayModeSchema as x, productVariantAttributeSchema as S, productVariantCodeSchema as C, productVariantIdentifierSchema as w, productVariantSchema as T } from "./models/Product.shared-CTuk4fiR.js";
|
|
5
|
-
import { richTextJsonDocSchema as E, richTextSchema as D, richTextVersionSchema as O } from "./schemas/rich-text-DTRh7U3z.js";
|
|
6
|
-
import { isoDateSchema as k, shopConfigurationSchema as A, shopExtraTimeSlotRuleSchema as j, shopOpeningDayIndexSchema as M, shopOpeningDaySchema as N, shopOpeningHoursOverrideSchema as P, shopOpeningHoursPeriodSchema as F, shopOpeningSlotSchema as I, timeOfDaySchema as L } from "./schemas/shop-opening-hours-BlLD1gfz.js";
|
|
7
|
-
import { DEFAULT_CANCELLATION_POLICY as R, DEFAULT_PAYMENT_POLICIES as z, cancellationPolicySchema as B, cancellationPolicyTierSchema as V, paymentPoliciesSchema as H } from "./schemas/booking-engine-configuration-D02MRF9U.js";
|
|
8
|
-
import { fulfillmentModeSchema as U, publicBookingEngineConfigurationSchema as W, publicCheckoutConfigurationSchema as G, publicCheckoutDynamicOptionsSchema as K } from "./schemas/public-booking-engine-configuration-BnJ_H-p1.js";
|
|
9
|
-
import { bookingCustomerInputSchema as q, bookingDeliveryOptionSchema as J, bookingScheduleInputSchema as Y, cartItemInputSchema as X, createBookingInputBaseSchema as Z, createBookingInputSchema as Q, validateBookingDeliveryAddress as $ } from "./schemas/cart-inputs-9vM8GCrc.js";
|
|
10
|
-
import "./schemas/base-product-1H8l2aUv.js";
|
|
11
|
-
import { baseAssetSchema as ee, baseAssetStatusSchema as te } from "./schemas/base-asset-B_Dm8_Vk.js";
|
|
12
|
-
import { baseBookingItemSchema as ne, baseBookingSchema as re, baseBookingStateSchema as ie } from "./schemas/base-booking-DW8AEPKo.js";
|
|
13
|
-
export { R as DEFAULT_CANCELLATION_POLICY, z as DEFAULT_PAYMENT_POLICIES, p as PRODUCT_VARIANT_CODE_IDENTIFIER_KIND, m as PRODUCT_VARIANT_CODE_MAX_LENGTH, h as accessoryProductSchema, ee as baseAssetSchema, te as baseAssetStatusSchema, ne as baseBookingItemSchema, re as baseBookingSchema, ie as baseBookingStateSchema, g as bikeProductSchema, q as bookingCustomerInputSchema, J as bookingDeliveryOptionSchema, Y as bookingScheduleInputSchema, B as cancellationPolicySchema, V as cancellationPolicyTierSchema, X as cartItemInputSchema, Z as createBookingInputBaseSchema, Q as createBookingInputSchema, e as createLocalizedStringEntry, a as currencyCodeSchema, o as currencyMinorUnitDigits, _ as eBikeProductSchema, U as fulfillmentModeSchema, t as getLocalizedStringValue, v as isProductVariantCodeIdentifierKind, k as isoDateSchema, n as localizedStringArraySchema, r as localizedStringEntrySchema, i as localizedStringSchema, s as majorToMinor, c as minorToMajor, l as moneyMinorSchema, H as paymentPoliciesSchema, d as priceSchema, f as priceUnitSchema, y as productKindSchema, b as productSchema, x as productStorefrontDisplayModeSchema, S as productVariantAttributeSchema, C as productVariantCodeSchema, w as productVariantIdentifierSchema, T as productVariantSchema, W as publicBookingEngineConfigurationSchema, G as publicCheckoutConfigurationSchema, K as publicCheckoutDynamicOptionsSchema, E as richTextJsonDocSchema, D as richTextSchema, O as richTextVersionSchema, A as shopConfigurationSchema, j as shopExtraTimeSlotRuleSchema, M as shopOpeningDayIndexSchema, N as shopOpeningDaySchema, P as shopOpeningHoursOverrideSchema, F as shopOpeningHoursPeriodSchema, I as shopOpeningSlotSchema, u as signedMoneyMinorSchema, L as timeOfDaySchema, $ as validateBookingDeliveryAddress };
|