@loczer/storefront-sdk 0.150.0 → 0.152.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/StorefrontProvider.d.ts +20 -0
- package/dist/booking-period-time-slots.d.ts +23 -38
- package/dist/booking-period.d.ts +20 -0
- package/dist/booking.d.ts +18 -0
- package/dist/checkoutSubmit.d.ts +36 -0
- package/dist/chunks/pkg/booking-engine/dist/schemas/{booking-engine-configuration-CnBdp3jk.js → booking-engine-configuration-BKlzwJJX.js} +20 -19
- package/dist/chunks/pkg/booking-engine/dist/schemas/{cart-inputs-DYgEGJ5M.js → cart-inputs-ByBK0IVJ.js} +2 -2
- package/dist/chunks/pkg/booking-engine/dist/schemas/{public-booking-engine-configuration-C9VB-WhU.js → public-booking-engine-configuration-DKoak4s5.js} +2 -2
- package/dist/chunks/pkg/booking-engine/dist/schemas/shop-opening-hours-DqNWstqT.js +51 -0
- package/dist/components/BookingPeriodSelector/useBookingPeriodController.js +76 -80
- package/dist/index.js +308 -298
- package/dist/lib/booking-period-time-slots.d.ts +0 -31
- package/dist/lib/booking-period-time-slots.js +122 -221
- package/dist/lib/booking-period.d.ts +14 -0
- package/dist/lib/booking-period.js +168 -150
- package/dist/lib/booking.d.ts +3 -0
- package/dist/lib/booking.js +102 -89
- package/dist/lib/checkoutSubmit.d.ts +34 -0
- package/dist/lib/checkoutSubmit.js +17 -15
- package/dist/lib/storefrontTimeSlots.d.ts +43 -0
- package/dist/lib/storefrontTimeSlots.js +26 -0
- package/dist/storefront.css +1 -1
- package/dist/storefrontSchemas.d.ts +8 -0
- package/dist/storefrontSchemas.js +4 -4
- package/dist/storefrontTimeSlots.d.ts +53 -0
- package/dist/whatsapp.d.ts +8 -0
- package/package.json +1 -1
- package/dist/chunks/pkg/booking-engine/dist/schemas/shop-opening-hours-B47MMaoD.js +0 -45
package/dist/lib/booking.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { differenceInMinutes as p, format as
|
|
2
|
-
import { getDefaultBookingPeriod as
|
|
3
|
-
const
|
|
1
|
+
import { differenceInMinutes as p, format as h } from "date-fns";
|
|
2
|
+
import { getDefaultBookingPeriod as T, parseTimeToMinutes as B } from "./booking-period.js";
|
|
3
|
+
const y = [
|
|
4
4
|
"fulfillment",
|
|
5
5
|
"start_date",
|
|
6
6
|
"start_time",
|
|
@@ -8,88 +8,100 @@ const E = [
|
|
|
8
8
|
"end_time",
|
|
9
9
|
"start_address",
|
|
10
10
|
"end_address"
|
|
11
|
-
],
|
|
11
|
+
], D = "loczer_storefront_booking:", i = (t) => h(t, "yyyy-MM-dd"), P = () => {
|
|
12
12
|
const t = [];
|
|
13
13
|
for (let e = 8; e <= 18; e += 1)
|
|
14
|
-
for (const
|
|
15
|
-
e === 18 &&
|
|
14
|
+
for (const r of [0, 30])
|
|
15
|
+
e === 18 && r > 0 || t.push(`${String(e).padStart(2, "0")}:${String(r).padStart(2, "0")}`);
|
|
16
16
|
return t;
|
|
17
|
-
},
|
|
17
|
+
}, c = P(), I = (t = /* @__PURE__ */ new Date()) => {
|
|
18
18
|
const e = i(t);
|
|
19
19
|
return {
|
|
20
20
|
fulfillment: "pickup",
|
|
21
21
|
start_date: e,
|
|
22
|
-
start_time:
|
|
22
|
+
start_time: c[3] ?? "09:30",
|
|
23
23
|
end_date: e,
|
|
24
|
-
end_time:
|
|
24
|
+
end_time: c.at(-1) ?? "18:00",
|
|
25
25
|
start_address: "",
|
|
26
26
|
end_address: ""
|
|
27
27
|
};
|
|
28
|
-
}, M = 30, U = 15,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
28
|
+
}, M = 30, U = 15, w = 10, F = 960, L = (t) => B(t) ?? F, E = (t) => (Math.trunc(t) % 7 + 7) % 7, N = (t) => {
|
|
29
|
+
if (t?.length)
|
|
30
|
+
return t.map((e) => ({
|
|
31
|
+
minutesAfterClose: e.minutesAfterClose,
|
|
32
|
+
extraAmount: e.extraAmount
|
|
33
|
+
}));
|
|
34
|
+
}, O = (t, e = {}) => {
|
|
35
|
+
const r = t.checkout.dynamicOptions?.sameDayCutoff;
|
|
36
|
+
return {
|
|
37
|
+
timing: {
|
|
38
|
+
slotIntervalMinutes: M,
|
|
39
|
+
autoFillCutoffMinutes: L(e.sameDayCutoff ?? r),
|
|
40
|
+
pastToleranceMinutes: U,
|
|
41
|
+
minBufferMinutes: w
|
|
42
|
+
},
|
|
43
|
+
openingHours: t.shop.openingHours.map((n) => ({
|
|
38
44
|
...n,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
openingHours: n.openingHours.map((s) => ({
|
|
46
|
+
...s,
|
|
47
|
+
day: E(s.day)
|
|
48
|
+
}))
|
|
49
|
+
})),
|
|
50
|
+
openingHoursOverrides: t.shop.openingHoursOverrides ?? [],
|
|
51
|
+
timeZone: t.shop.timeZone,
|
|
52
|
+
extraTimeSlots: N(t.shop.extraTimeSlots)
|
|
53
|
+
};
|
|
54
|
+
}, C = (t) => O(t.bookingEngine, {
|
|
55
|
+
sameDayCutoff: t.settings.sameDayCutoff
|
|
56
|
+
}), K = (t, e = /* @__PURE__ */ new Date()) => {
|
|
57
|
+
const r = C(t), n = T({
|
|
58
|
+
config: r,
|
|
47
59
|
referenceDate: e
|
|
48
60
|
});
|
|
49
61
|
return {
|
|
50
62
|
fulfillment: "pickup",
|
|
51
|
-
start_date: i(
|
|
52
|
-
start_time:
|
|
53
|
-
end_date: i(
|
|
54
|
-
end_time:
|
|
63
|
+
start_date: i(n.startDate),
|
|
64
|
+
start_time: n.startTime,
|
|
65
|
+
end_date: i(n.endDate),
|
|
66
|
+
end_time: n.endTime,
|
|
55
67
|
start_address: "",
|
|
56
68
|
end_address: ""
|
|
57
69
|
};
|
|
58
|
-
},
|
|
59
|
-
const
|
|
60
|
-
return
|
|
61
|
-
},
|
|
62
|
-
const
|
|
70
|
+
}, o = (t, e, r) => {
|
|
71
|
+
const n = t.get(e);
|
|
72
|
+
return n == null || n.trim() === "" ? r : n;
|
|
73
|
+
}, z = (t, e) => {
|
|
74
|
+
const r = { ...I(), ...e }, n = t.get("fulfillment") === "delivery" ? "delivery" : t.get("fulfillment") === "pickup" ? "pickup" : r.fulfillment, s = o(t, "start_date", r.start_date), a = o(t, "start_time", r.start_time), f = o(t, "end_date", r.end_date), _ = o(t, "end_time", r.end_time), S = o(t, "start_address", r.start_address), g = o(t, "end_address", r.end_address);
|
|
63
75
|
return {
|
|
64
|
-
fulfillment:
|
|
76
|
+
fulfillment: n,
|
|
65
77
|
start_date: s,
|
|
66
|
-
start_time:
|
|
67
|
-
end_date:
|
|
68
|
-
end_time:
|
|
78
|
+
start_time: a,
|
|
79
|
+
end_date: f,
|
|
80
|
+
end_time: _,
|
|
69
81
|
start_address: S,
|
|
70
82
|
end_address: g
|
|
71
83
|
};
|
|
72
|
-
},
|
|
73
|
-
const
|
|
74
|
-
if (
|
|
75
|
-
if (
|
|
76
|
-
|
|
84
|
+
}, k = (t, e) => {
|
|
85
|
+
const r = new URLSearchParams(t), n = (s, a) => {
|
|
86
|
+
if (a != null) {
|
|
87
|
+
if (a.trim() === "") {
|
|
88
|
+
r.delete(s);
|
|
77
89
|
return;
|
|
78
90
|
}
|
|
79
|
-
|
|
91
|
+
r.set(s, a);
|
|
80
92
|
}
|
|
81
93
|
};
|
|
82
|
-
return
|
|
94
|
+
return n("fulfillment", e.fulfillment), n("start_date", e.start_date), n("start_time", e.start_time), n("end_date", e.end_date), n("end_time", e.end_time), n("start_address", e.start_address), n("end_address", e.end_address), r;
|
|
83
95
|
}, d = (t) => {
|
|
84
96
|
const e = new URLSearchParams();
|
|
85
|
-
for (const
|
|
86
|
-
const
|
|
87
|
-
if (
|
|
88
|
-
const s =
|
|
89
|
-
s.length !== 0 && e.set(
|
|
97
|
+
for (const r of y) {
|
|
98
|
+
const n = t.get(r);
|
|
99
|
+
if (n == null) continue;
|
|
100
|
+
const s = n.trim();
|
|
101
|
+
s.length !== 0 && e.set(r, s);
|
|
90
102
|
}
|
|
91
103
|
return e;
|
|
92
|
-
},
|
|
104
|
+
}, u = () => {
|
|
93
105
|
if (typeof window > "u")
|
|
94
106
|
return null;
|
|
95
107
|
try {
|
|
@@ -97,63 +109,64 @@ const E = [
|
|
|
97
109
|
} catch {
|
|
98
110
|
return null;
|
|
99
111
|
}
|
|
100
|
-
},
|
|
112
|
+
}, R = (t) => t instanceof URLSearchParams ? d(t) : k(new URLSearchParams(), t), m = (t) => {
|
|
101
113
|
const e = t?.trim() ?? "";
|
|
102
|
-
return e ? `${
|
|
114
|
+
return e ? `${D}${e}` : "";
|
|
103
115
|
}, l = (t, e) => {
|
|
104
|
-
const
|
|
105
|
-
if (!
|
|
116
|
+
const r = m(e);
|
|
117
|
+
if (!r || !t)
|
|
106
118
|
return new URLSearchParams();
|
|
107
119
|
try {
|
|
108
|
-
const
|
|
109
|
-
return
|
|
120
|
+
const n = t.getItem(r);
|
|
121
|
+
return n ? d(new URLSearchParams(n)) : new URLSearchParams();
|
|
110
122
|
} catch {
|
|
111
123
|
return new URLSearchParams();
|
|
112
124
|
}
|
|
113
|
-
},
|
|
114
|
-
const
|
|
115
|
-
if (!
|
|
125
|
+
}, A = (t, e, r) => {
|
|
126
|
+
const n = m(e);
|
|
127
|
+
if (!n || !t)
|
|
116
128
|
return;
|
|
117
|
-
const s =
|
|
129
|
+
const s = R(r).toString();
|
|
118
130
|
try {
|
|
119
131
|
if (!s) {
|
|
120
|
-
t.removeItem(
|
|
132
|
+
t.removeItem(n);
|
|
121
133
|
return;
|
|
122
134
|
}
|
|
123
|
-
t.setItem(
|
|
135
|
+
t.setItem(n, s);
|
|
124
136
|
} catch {
|
|
125
137
|
}
|
|
126
|
-
},
|
|
127
|
-
|
|
138
|
+
}, G = (t) => l(u(), t), V = (t, e) => {
|
|
139
|
+
A(u(), t, e);
|
|
128
140
|
}, $ = (t, e) => {
|
|
129
|
-
const
|
|
130
|
-
return
|
|
131
|
-
},
|
|
132
|
-
storage:
|
|
141
|
+
const r = d(t);
|
|
142
|
+
return r.toString() ? r : l(e?.storage, e?.storeSlug);
|
|
143
|
+
}, Z = (t, e) => $(t, {
|
|
144
|
+
storage: u(),
|
|
133
145
|
storeSlug: e
|
|
134
|
-
}),
|
|
135
|
-
const e = /* @__PURE__ */ new Date(`${t.start_date}T${t.start_time}:00`),
|
|
136
|
-
return Number.isNaN(e.getTime()) || Number.isNaN(
|
|
137
|
-
},
|
|
138
|
-
const e =
|
|
139
|
-
return
|
|
146
|
+
}), v = (t) => {
|
|
147
|
+
const e = /* @__PURE__ */ new Date(`${t.start_date}T${t.start_time}:00`), r = /* @__PURE__ */ new Date(`${t.end_date}T${t.end_time}:00`);
|
|
148
|
+
return Number.isNaN(e.getTime()) || Number.isNaN(r.getTime()) ? 0 : Math.max(0, p(r, e));
|
|
149
|
+
}, W = (t) => {
|
|
150
|
+
const e = v(t), r = Math.floor(e / 60), n = e % 60;
|
|
151
|
+
return n === 0 ? { hours: r, minutes: n, label: `${r}h` } : { hours: r, minutes: n, label: `${r}h${String(n).padStart(2, "0")}` };
|
|
140
152
|
};
|
|
141
153
|
export {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
154
|
+
y as BOOKING_SEARCH_KEYS,
|
|
155
|
+
c as TIME_OPTIONS,
|
|
156
|
+
k as applyBookingParamsToSearch,
|
|
157
|
+
O as createBookingPeriodConfigFromBookingEngineConfiguration,
|
|
158
|
+
C as createBookingPeriodConfigFromStorefrontConfiguration,
|
|
159
|
+
W as getBookingDurationLabel,
|
|
160
|
+
v as getBookingDurationMinutes,
|
|
161
|
+
z as getBookingParamsFromSearch,
|
|
149
162
|
m as getBookingSessionStorageKey,
|
|
150
163
|
I as getDefaultBookingParams,
|
|
151
|
-
|
|
164
|
+
K as getDefaultBookingParamsForStorefrontConfiguration,
|
|
152
165
|
d as pickBookingSearchParams,
|
|
153
|
-
|
|
166
|
+
G as readBookingSearchParamsFromSessionStorage,
|
|
154
167
|
l as readBookingSearchParamsFromStorage,
|
|
155
168
|
$ as resolveBookingSearchParams,
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
169
|
+
Z as resolveBookingSearchParamsFromSessionStorage,
|
|
170
|
+
V as writeBookingSearchParamsToSessionStorage,
|
|
171
|
+
A as writeBookingSearchParamsToStorage
|
|
159
172
|
};
|
|
@@ -7,6 +7,40 @@ export declare const requestCheckoutItemSchema: z.ZodObject<{
|
|
|
7
7
|
quantity: z.ZodNumber;
|
|
8
8
|
}, z.core.$strip>;
|
|
9
9
|
export type RequestCheckoutItem = z.infer<typeof requestCheckoutItemSchema>;
|
|
10
|
+
export declare const requestBaseSchema: z.ZodObject<{
|
|
11
|
+
storeSlug: z.ZodString;
|
|
12
|
+
schedule: z.ZodObject<{
|
|
13
|
+
startDate: z.ZodString;
|
|
14
|
+
endDate: z.ZodString;
|
|
15
|
+
startTime: z.ZodString;
|
|
16
|
+
endTime: z.ZodString;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
fulfillment: z.ZodDefault<z.ZodEnum<{
|
|
19
|
+
pickup: "pickup";
|
|
20
|
+
delivery: "delivery";
|
|
21
|
+
}>>;
|
|
22
|
+
startAddress: z.ZodOptional<z.ZodString>;
|
|
23
|
+
endAddress: z.ZodOptional<z.ZodString>;
|
|
24
|
+
couponCode: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
25
|
+
couponAutoApplied: z.ZodOptional<z.ZodBoolean>;
|
|
26
|
+
customer: z.ZodObject<{
|
|
27
|
+
fullName: z.ZodString;
|
|
28
|
+
email: z.ZodString;
|
|
29
|
+
phone: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
30
|
+
notes: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
items: z.ZodArray<z.ZodObject<{
|
|
33
|
+
kind: any;
|
|
34
|
+
productId: z.ZodString;
|
|
35
|
+
productVariantId: z.ZodOptional<z.ZodString>;
|
|
36
|
+
quantity: z.ZodNumber;
|
|
37
|
+
}, z.core.$strip>>;
|
|
38
|
+
nowIso: z.ZodOptional<z.ZodString>;
|
|
39
|
+
}, z.core.$strip>;
|
|
40
|
+
export declare const requestDeliveryRefinement: (payload: {
|
|
41
|
+
fulfillment?: string;
|
|
42
|
+
startAddress?: string;
|
|
43
|
+
}, ctx: z.RefinementCtx) => void;
|
|
10
44
|
export declare const requestSchema: z.ZodObject<{
|
|
11
45
|
storeSlug: z.ZodString;
|
|
12
46
|
schedule: z.ZodObject<{
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { z as t } from "zod";
|
|
2
|
-
import { bookingScheduleInputSchema as
|
|
3
|
-
import { productKindSchema as
|
|
2
|
+
import { bookingScheduleInputSchema as r } from "../chunks/pkg/booking-engine/dist/schemas/cart-inputs-ByBK0IVJ.js";
|
|
3
|
+
import { productKindSchema as o } from "../chunks/pkg/booking-engine/dist/models/Product.shared-BiDGmurZ.js";
|
|
4
4
|
import "../chunks/pkg/booking-engine/dist/models/LocalizedString--6q77SPQ.js";
|
|
5
5
|
import "../chunks/pkg/booking-engine/dist/models/Price-BlFRDHXV.js";
|
|
6
6
|
import "../chunks/pkg/booking-engine/dist/schemas/base-asset-GJ9eIvIL.js";
|
|
7
7
|
import "../chunks/pkg/booking-engine/dist/schemas/base-booking-D9k8ehGi.js";
|
|
8
8
|
import "../chunks/pkg/booking-engine/dist/schemas/rich-text-CqXhNDN3.js";
|
|
9
9
|
import "../chunks/pkg/booking-engine/dist/schemas/money-Dy4b9loa.js";
|
|
10
|
-
import "../chunks/pkg/booking-engine/dist/schemas/shop-opening-hours-
|
|
11
|
-
import "../chunks/pkg/booking-engine/dist/schemas/public-booking-engine-configuration-
|
|
12
|
-
import "../chunks/pkg/booking-engine/dist/schemas/booking-engine-configuration-
|
|
10
|
+
import "../chunks/pkg/booking-engine/dist/schemas/shop-opening-hours-DqNWstqT.js";
|
|
11
|
+
import "../chunks/pkg/booking-engine/dist/schemas/public-booking-engine-configuration-DKoak4s5.js";
|
|
12
|
+
import "../chunks/pkg/booking-engine/dist/schemas/booking-engine-configuration-BKlzwJJX.js";
|
|
13
13
|
import { storefrontFulfillmentModeSchema as s } from "../storefrontSchemas.js";
|
|
14
|
-
const
|
|
15
|
-
kind:
|
|
14
|
+
const x = "/api/public/storefront/checkout/submit", n = t.object({
|
|
15
|
+
kind: o,
|
|
16
16
|
productId: t.string().trim().min(1),
|
|
17
17
|
productVariantId: t.string().trim().min(1).optional(),
|
|
18
18
|
quantity: t.number().int().positive()
|
|
19
|
-
}),
|
|
19
|
+
}), m = t.object({
|
|
20
20
|
storeSlug: t.string().trim().min(1).toLowerCase(),
|
|
21
|
-
schedule:
|
|
21
|
+
schedule: r,
|
|
22
22
|
fulfillment: s.default("pickup"),
|
|
23
23
|
startAddress: t.string().trim().max(500).optional(),
|
|
24
24
|
endAddress: t.string().trim().max(500).optional(),
|
|
@@ -34,13 +34,13 @@ const k = "/api/public/storefront/checkout/submit", n = t.object({
|
|
|
34
34
|
// Test-only clock override: the server honors it outside production and
|
|
35
35
|
// always uses its own clock in production.
|
|
36
36
|
nowIso: t.string().datetime({ offset: !0 }).optional()
|
|
37
|
-
})
|
|
38
|
-
|
|
37
|
+
}), a = (e, i) => {
|
|
38
|
+
e.fulfillment === "delivery" && (e.startAddress?.trim() || i.addIssue({
|
|
39
39
|
code: t.ZodIssueCode.custom,
|
|
40
40
|
message: "Delivery start address is required.",
|
|
41
41
|
path: ["startAddress"]
|
|
42
42
|
}));
|
|
43
|
-
}
|
|
43
|
+
}, A = m.superRefine(a), j = t.object({
|
|
44
44
|
success: t.boolean(),
|
|
45
45
|
message: t.string().optional(),
|
|
46
46
|
checkout: t.object({
|
|
@@ -52,8 +52,10 @@ const k = "/api/public/storefront/checkout/submit", n = t.object({
|
|
|
52
52
|
}).optional()
|
|
53
53
|
});
|
|
54
54
|
export {
|
|
55
|
-
|
|
55
|
+
x as ROUTE,
|
|
56
|
+
m as requestBaseSchema,
|
|
56
57
|
n as requestCheckoutItemSchema,
|
|
57
|
-
|
|
58
|
-
A as
|
|
58
|
+
a as requestDeliveryRefinement,
|
|
59
|
+
A as requestSchema,
|
|
60
|
+
j as responseSchema
|
|
59
61
|
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ROUTE = "/api/public/storefront/availability/time-slots";
|
|
3
|
+
export declare const timeSlotJourneySchema: z.ZodEnum<{
|
|
4
|
+
start: "start";
|
|
5
|
+
end: "end";
|
|
6
|
+
}>;
|
|
7
|
+
export type TimeSlotJourney = z.infer<typeof timeSlotJourneySchema>;
|
|
8
|
+
export declare const requestSchema: z.ZodObject<{
|
|
9
|
+
storeSlug: z.ZodString;
|
|
10
|
+
date: z.ZodOptional<z.ZodString>;
|
|
11
|
+
journey: z.ZodDefault<z.ZodEnum<{
|
|
12
|
+
start: "start";
|
|
13
|
+
end: "end";
|
|
14
|
+
}>>;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
export type RequestPayload = z.infer<typeof requestSchema>;
|
|
17
|
+
export declare const storefrontTimeSlotSchema: z.ZodObject<{
|
|
18
|
+
value: z.ZodString;
|
|
19
|
+
label: z.ZodString;
|
|
20
|
+
startMinutes: z.ZodNumber;
|
|
21
|
+
endMinutes: z.ZodNumber;
|
|
22
|
+
isExtra: z.ZodBoolean;
|
|
23
|
+
extraAmount: z.ZodOptional<z.ZodNumber>;
|
|
24
|
+
isDisabled: z.ZodBoolean;
|
|
25
|
+
disabledReason: z.ZodOptional<z.ZodString>;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
export type StorefrontTimeSlot = z.infer<typeof storefrontTimeSlotSchema>;
|
|
28
|
+
export declare const responseSchema: z.ZodObject<{
|
|
29
|
+
success: z.ZodBoolean;
|
|
30
|
+
message: z.ZodOptional<z.ZodString>;
|
|
31
|
+
timeSlots: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
32
|
+
value: z.ZodString;
|
|
33
|
+
label: z.ZodString;
|
|
34
|
+
startMinutes: z.ZodNumber;
|
|
35
|
+
endMinutes: z.ZodNumber;
|
|
36
|
+
isExtra: z.ZodBoolean;
|
|
37
|
+
extraAmount: z.ZodOptional<z.ZodNumber>;
|
|
38
|
+
isDisabled: z.ZodBoolean;
|
|
39
|
+
disabledReason: z.ZodOptional<z.ZodString>;
|
|
40
|
+
}, z.core.$strip>>>;
|
|
41
|
+
}, z.core.$strip>;
|
|
42
|
+
export type ResponsePayload = z.infer<typeof responseSchema>;
|
|
43
|
+
//# sourceMappingURL=storefrontTimeSlots.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z as t } from "zod";
|
|
2
|
+
const n = "/api/public/storefront/availability/time-slots", e = t.enum(["start", "end"]), a = t.object({
|
|
3
|
+
storeSlug: t.string().trim().min(1).toLowerCase(),
|
|
4
|
+
date: t.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional(),
|
|
5
|
+
journey: e.default("start")
|
|
6
|
+
}), o = t.object({
|
|
7
|
+
value: t.string(),
|
|
8
|
+
label: t.string(),
|
|
9
|
+
startMinutes: t.number(),
|
|
10
|
+
endMinutes: t.number(),
|
|
11
|
+
isExtra: t.boolean(),
|
|
12
|
+
extraAmount: t.number().optional(),
|
|
13
|
+
isDisabled: t.boolean(),
|
|
14
|
+
disabledReason: t.string().optional()
|
|
15
|
+
}), r = t.object({
|
|
16
|
+
success: t.boolean(),
|
|
17
|
+
message: t.string().optional(),
|
|
18
|
+
timeSlots: t.array(o).optional()
|
|
19
|
+
});
|
|
20
|
+
export {
|
|
21
|
+
n as ROUTE,
|
|
22
|
+
a as requestSchema,
|
|
23
|
+
r as responseSchema,
|
|
24
|
+
o as storefrontTimeSlotSchema,
|
|
25
|
+
e as timeSlotJourneySchema
|
|
26
|
+
};
|