@loczer/storefront-sdk 0.202.0 → 0.204.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/index.d.ts +7 -1
- package/dist/lib/cart.d.ts +3 -0
- package/dist/lib/cart.d.ts.map +1 -1
- package/dist/lib/cart.js +114 -76
- package/dist/lib/checkoutPaymentSession.d.ts +1 -0
- package/dist/lib/checkoutPaymentSession.d.ts.map +1 -1
- package/dist/lib/checkoutPaymentSession.js +1 -0
- package/dist/lib/checkoutSubmit.d.ts +2 -0
- package/dist/lib/checkoutSubmit.d.ts.map +1 -1
- package/dist/lib/checkoutSubmit.js +1 -0
- package/dist/lib/storefrontImage.d.ts +2 -1
- package/dist/lib/storefrontImage.d.ts.map +1 -1
- package/dist/lib/storefrontImage.js +13 -7
- package/dist/pages/CheckoutPage.d.ts.map +1 -1
- package/dist/pages/CheckoutPage.js +222 -211
- package/dist/pages/CheckoutPaymentPage.d.ts.map +1 -1
- package/dist/pages/CheckoutPaymentPage.js +190 -159
- package/dist/pages/HomePage.d.ts.map +1 -1
- package/dist/pages/HomePage.js +227 -226
- package/dist/storefront.css +1 -1
- package/dist/ui/day-picker.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -925,7 +925,7 @@ export declare const buildStorefrontCartSummary: (params: {
|
|
|
925
925
|
estimatedDays?: number;
|
|
926
926
|
}) => StorefrontCartSummary;
|
|
927
927
|
|
|
928
|
-
export declare const buildStorefrontImageUrl: (imageId: string, storeSlug: string) => string;
|
|
928
|
+
export declare const buildStorefrontImageUrl: (imageId: string, storeSlug: string, width?: number) => string;
|
|
929
929
|
|
|
930
930
|
export declare const buildStorefrontProductSlug: ({ id, productShortCode, name, }: {
|
|
931
931
|
id: string;
|
|
@@ -3184,11 +3184,14 @@ export declare const storefrontButtonRadiusClassName = "rounded-[var(--storefron
|
|
|
3184
3184
|
declare type StorefrontCartContextValue = {
|
|
3185
3185
|
items: StorefrontCartItem[];
|
|
3186
3186
|
itemCount: number;
|
|
3187
|
+
checkoutSessionId?: string;
|
|
3187
3188
|
addItem: (item: Omit<StorefrontCartItem, "key"> & {
|
|
3188
3189
|
key?: string;
|
|
3189
3190
|
}) => void;
|
|
3190
3191
|
setQuantity: (key: string, quantity: number) => void;
|
|
3191
3192
|
removeItem: (key: string) => void;
|
|
3193
|
+
ensureCheckoutSessionId: () => string;
|
|
3194
|
+
clearCheckoutSession: () => void;
|
|
3192
3195
|
clear: () => void;
|
|
3193
3196
|
};
|
|
3194
3197
|
|
|
@@ -3277,6 +3280,7 @@ export declare const storefrontCheckoutSubmitItemSchema: z.ZodObject<{
|
|
|
3277
3280
|
|
|
3278
3281
|
export declare const storefrontCheckoutSubmitRequestBaseSchema: z.ZodObject<{
|
|
3279
3282
|
storeSlug: z.ZodString;
|
|
3283
|
+
checkoutSessionId: z.ZodOptional<z.ZodString>;
|
|
3280
3284
|
schedule: z.ZodObject<{
|
|
3281
3285
|
startDate: z.ZodString;
|
|
3282
3286
|
endDate: z.ZodString;
|
|
@@ -3313,6 +3317,7 @@ export declare type StorefrontCheckoutSubmitRequestPayload = z.infer<typeof stor
|
|
|
3313
3317
|
|
|
3314
3318
|
export declare const storefrontCheckoutSubmitRequestSchema: z.ZodObject<{
|
|
3315
3319
|
storeSlug: z.ZodString;
|
|
3320
|
+
checkoutSessionId: z.ZodOptional<z.ZodString>;
|
|
3316
3321
|
schedule: z.ZodObject<{
|
|
3317
3322
|
startDate: z.ZodString;
|
|
3318
3323
|
endDate: z.ZodString;
|
|
@@ -4739,6 +4744,7 @@ export declare type StorefrontImageRequestPayload = z.infer<typeof storefrontIma
|
|
|
4739
4744
|
export declare const storefrontImageRequestSchema: z.ZodObject<{
|
|
4740
4745
|
imageId: z.ZodString;
|
|
4741
4746
|
storeSlug: z.ZodString;
|
|
4747
|
+
w: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
4742
4748
|
}, z.core.$strip>;
|
|
4743
4749
|
|
|
4744
4750
|
export declare type StorefrontLocalizedRichText = z.infer<typeof storefrontLocalizedRichTextSchema>;
|
package/dist/lib/cart.d.ts
CHANGED
|
@@ -10,11 +10,14 @@ export type StorefrontCartItem = {
|
|
|
10
10
|
type StorefrontCartContextValue = {
|
|
11
11
|
items: StorefrontCartItem[];
|
|
12
12
|
itemCount: number;
|
|
13
|
+
checkoutSessionId?: string;
|
|
13
14
|
addItem: (item: Omit<StorefrontCartItem, "key"> & {
|
|
14
15
|
key?: string;
|
|
15
16
|
}) => void;
|
|
16
17
|
setQuantity: (key: string, quantity: number) => void;
|
|
17
18
|
removeItem: (key: string) => void;
|
|
19
|
+
ensureCheckoutSessionId: () => string;
|
|
20
|
+
clearCheckoutSession: () => void;
|
|
18
21
|
clear: () => void;
|
|
19
22
|
};
|
|
20
23
|
export declare const resolveStorefrontCartItemProduct: (item: StorefrontCartItem, products: StorefrontProductsCollections) => StorefrontProduct | null;
|
package/dist/lib/cart.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cart.d.ts","sourceRoot":"","sources":["../../src/lib/cart.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAE5G,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,6BAA6B,EACnC,MAAM,YAAY,CAAA;AAGnB,MAAM,MAAM,kBAAkB,GAAG;IAC/B,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,WAAW,CAAA;IACrC,SAAS,EAAE,MAAM,CAAA;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;
|
|
1
|
+
{"version":3,"file":"cart.d.ts","sourceRoot":"","sources":["../../src/lib/cart.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAE5G,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,6BAA6B,EACnC,MAAM,YAAY,CAAA;AAGnB,MAAM,MAAM,kBAAkB,GAAG;IAC/B,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,WAAW,CAAA;IACrC,SAAS,EAAE,MAAM,CAAA;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAOD,KAAK,0BAA0B,GAAG;IAChC,KAAK,EAAE,kBAAkB,EAAE,CAAA;IAC3B,SAAS,EAAE,MAAM,CAAA;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,kBAAkB,EAAE,KAAK,CAAC,GAAG;QAAE,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;IAC3E,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;IACpD,UAAU,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,uBAAuB,EAAE,MAAM,MAAM,CAAA;IACrC,oBAAoB,EAAE,MAAM,IAAI,CAAA;IAChC,KAAK,EAAE,MAAM,IAAI,CAAA;CAClB,CAAA;AAiBD,eAAO,MAAM,gCAAgC,GAC3C,MAAM,kBAAkB,EACxB,UAAU,6BAA6B,KACtC,iBAAiB,GAAG,IAQtB,CAAA;AAsDD,wBAAgB,sBAAsB,CAAC,EACrC,SAAS,EACT,QAAQ,EACR,QAAQ,GACT,EAAE;IACD,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,6BAA6B,CAAA;IACvC,QAAQ,EAAE,SAAS,CAAA;CACpB,2CA4IA;AAED,eAAO,MAAM,iBAAiB,kCAM7B,CAAA"}
|
package/dist/lib/cart.js
CHANGED
|
@@ -2,117 +2,155 @@ import { getStorefrontCheckoutProductId as e } from "./products.js";
|
|
|
2
2
|
import { createContext as t, useCallback as n, useContext as r, useEffect as i, useMemo as a, useState as o } from "react";
|
|
3
3
|
import { jsx as s } from "react/jsx-runtime";
|
|
4
4
|
//#region src/lib/cart.tsx
|
|
5
|
-
var c = t(void 0), l = "loczer.storefront.cart.v5", u = (e) => {
|
|
5
|
+
var c = t(void 0), l = "loczer.storefront.cart.v5", u = () => globalThis.crypto?.randomUUID?.() || `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`, d = (e) => {
|
|
6
6
|
let t = e.productVariantId ? `variant:${e.productVariantId}` : "product";
|
|
7
7
|
return `${e.kind}:${e.productId}:${t}`.toLowerCase();
|
|
8
|
-
},
|
|
8
|
+
}, f = (t, n) => [...n.bikes, ...n.accessories].find((n) => {
|
|
9
9
|
let r = n.id === t.productId || e(n) === t.productId, i = !t.productVariantId || n.productVariants?.some((e) => e.id === t.productVariantId);
|
|
10
10
|
return r && n.kind === t.kind && i;
|
|
11
|
-
}) ?? null,
|
|
12
|
-
let n = e.filter((e) =>
|
|
11
|
+
}) ?? null, p = (e, t) => {
|
|
12
|
+
let n = e.filter((e) => f(e, t) !== null);
|
|
13
13
|
return n.length === e.length ? e : n;
|
|
14
|
-
},
|
|
14
|
+
}, m = (e) => {
|
|
15
15
|
if (!e) return { items: [] };
|
|
16
16
|
try {
|
|
17
|
-
let t = JSON.parse(e);
|
|
18
|
-
return {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
17
|
+
let t = JSON.parse(e), n = typeof t.checkoutSessionId == "string" ? t.checkoutSessionId.trim() : "";
|
|
18
|
+
return {
|
|
19
|
+
items: (Array.isArray(t.items) ? t.items : []).map((e) => {
|
|
20
|
+
let t = e ?? {}, n = t.kind === "accessory" ? "accessory" : t.kind === "e-bike" ? "e-bike" : t.kind === "bike" ? "bike" : null, r = typeof t.productId == "string" ? t.productId.trim() : "", i = typeof t.productVariantId == "string" ? t.productVariantId.trim() : "", a = typeof t.quantity == "number" ? Math.floor(t.quantity) : 0;
|
|
21
|
+
if (!n || r.length === 0 || a <= 0) return null;
|
|
22
|
+
let o = {
|
|
23
|
+
kind: n,
|
|
24
|
+
productId: r,
|
|
25
|
+
...i ? { productVariantId: i } : {},
|
|
26
|
+
quantity: a
|
|
27
|
+
};
|
|
28
|
+
return {
|
|
29
|
+
key: d(o),
|
|
30
|
+
...o
|
|
31
|
+
};
|
|
32
|
+
}).filter((e) => e !== null),
|
|
33
|
+
...n ? { checkoutSessionId: n } : {}
|
|
34
|
+
};
|
|
32
35
|
} catch {
|
|
33
36
|
return { items: [] };
|
|
34
37
|
}
|
|
35
38
|
};
|
|
36
|
-
function
|
|
37
|
-
let
|
|
39
|
+
function h({ storeSlug: e, products: t, children: r }) {
|
|
40
|
+
let f = `${l}.${e || "unknown"}`, [h, g] = o(!1), [_, v] = o({ items: [] }), y = t.bikes, b = t.accessories;
|
|
38
41
|
i(() => {
|
|
39
42
|
if (typeof window > "u") return;
|
|
40
|
-
let e =
|
|
41
|
-
|
|
42
|
-
}, [
|
|
43
|
-
typeof window > "u" ||
|
|
43
|
+
let e = m(window.localStorage.getItem(f));
|
|
44
|
+
v((t) => !h && t.items.length > 0 ? t : e), g(!0);
|
|
45
|
+
}, [f]), i(() => {
|
|
46
|
+
typeof window > "u" || h && window.localStorage.setItem(f, JSON.stringify(_));
|
|
44
47
|
}, [
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
h,
|
|
49
|
+
_,
|
|
50
|
+
f
|
|
48
51
|
]), i(() => {
|
|
49
|
-
if (!
|
|
52
|
+
if (!h) return;
|
|
50
53
|
let e = {
|
|
51
|
-
bikes:
|
|
52
|
-
accessories:
|
|
54
|
+
bikes: y,
|
|
55
|
+
accessories: b
|
|
53
56
|
};
|
|
54
|
-
|
|
55
|
-
let n =
|
|
56
|
-
return n === t.items ? t : {
|
|
57
|
+
v((t) => {
|
|
58
|
+
let n = p(t.items, e);
|
|
59
|
+
return n === t.items ? t : {
|
|
60
|
+
...t,
|
|
61
|
+
items: n
|
|
62
|
+
};
|
|
57
63
|
});
|
|
58
64
|
}, [
|
|
65
|
+
b,
|
|
59
66
|
y,
|
|
60
|
-
|
|
61
|
-
m
|
|
67
|
+
h
|
|
62
68
|
]);
|
|
63
|
-
let
|
|
64
|
-
|
|
65
|
-
let n = e.key?.trim() ? e.key.trim().toLowerCase() :
|
|
66
|
-
return t.items.find((e) => e.key === n) ? {
|
|
67
|
-
...
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
69
|
+
let x = n((e) => {
|
|
70
|
+
v((t) => {
|
|
71
|
+
let n = e.key?.trim() ? e.key.trim().toLowerCase() : d(e), r = Math.max(1, Math.floor(e.quantity));
|
|
72
|
+
return t.items.find((e) => e.key === n) ? {
|
|
73
|
+
...t,
|
|
74
|
+
items: t.items.map((e) => e.key === n ? {
|
|
75
|
+
...e,
|
|
76
|
+
quantity: e.quantity + r
|
|
77
|
+
} : e)
|
|
78
|
+
} : {
|
|
79
|
+
...t,
|
|
80
|
+
items: [...t.items, {
|
|
81
|
+
key: n,
|
|
82
|
+
kind: e.kind,
|
|
83
|
+
productId: e.productId,
|
|
84
|
+
productVariantId: e.productVariantId,
|
|
85
|
+
quantity: r
|
|
86
|
+
}]
|
|
87
|
+
};
|
|
76
88
|
});
|
|
77
|
-
}, []),
|
|
78
|
-
|
|
89
|
+
}, []), S = n((e, t) => {
|
|
90
|
+
v((n) => {
|
|
79
91
|
let r = Math.max(0, Math.floor(t));
|
|
80
|
-
return r <= 0 ? {
|
|
81
|
-
...
|
|
82
|
-
|
|
83
|
-
} :
|
|
92
|
+
return r <= 0 ? {
|
|
93
|
+
...n,
|
|
94
|
+
items: n.items.filter((t) => t.key !== e)
|
|
95
|
+
} : {
|
|
96
|
+
...n,
|
|
97
|
+
items: n.items.map((t) => t.key === e ? {
|
|
98
|
+
...t,
|
|
99
|
+
quantity: r
|
|
100
|
+
} : t)
|
|
101
|
+
};
|
|
84
102
|
});
|
|
85
|
-
}, []),
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
103
|
+
}, []), C = n((e) => {
|
|
104
|
+
v((t) => ({
|
|
105
|
+
...t,
|
|
106
|
+
items: t.items.filter((t) => t.key !== e)
|
|
107
|
+
}));
|
|
108
|
+
}, []), w = n(() => {
|
|
109
|
+
let e = _.checkoutSessionId?.trim();
|
|
110
|
+
if (e) return e;
|
|
111
|
+
let t = u(), n = {
|
|
112
|
+
..._,
|
|
113
|
+
checkoutSessionId: t
|
|
114
|
+
};
|
|
115
|
+
return v(n), typeof window < "u" && window.localStorage.setItem(f, JSON.stringify(n)), t;
|
|
116
|
+
}, [_, f]), T = n(() => {
|
|
117
|
+
let e = { items: _.items };
|
|
118
|
+
v(e), typeof window < "u" && window.localStorage.setItem(f, JSON.stringify(e));
|
|
119
|
+
}, [_.items, f]), E = n(() => {
|
|
120
|
+
v({ items: [] });
|
|
121
|
+
}, []), D = p(_.items, {
|
|
122
|
+
bikes: y,
|
|
123
|
+
accessories: b
|
|
124
|
+
}), O = D.reduce((e, t) => e + t.quantity, 0), k = a(() => ({
|
|
125
|
+
items: D,
|
|
126
|
+
itemCount: O,
|
|
127
|
+
checkoutSessionId: _.checkoutSessionId,
|
|
128
|
+
addItem: x,
|
|
129
|
+
setQuantity: S,
|
|
130
|
+
removeItem: C,
|
|
131
|
+
ensureCheckoutSessionId: w,
|
|
132
|
+
clearCheckoutSession: T,
|
|
133
|
+
clear: E
|
|
99
134
|
}), [
|
|
100
|
-
|
|
101
|
-
|
|
135
|
+
x,
|
|
136
|
+
E,
|
|
102
137
|
T,
|
|
103
138
|
w,
|
|
139
|
+
O,
|
|
140
|
+
D,
|
|
141
|
+
C,
|
|
104
142
|
S,
|
|
105
|
-
|
|
143
|
+
_.checkoutSessionId
|
|
106
144
|
]);
|
|
107
145
|
return /* @__PURE__ */ s(c.Provider, {
|
|
108
|
-
value:
|
|
146
|
+
value: k,
|
|
109
147
|
children: r
|
|
110
148
|
});
|
|
111
149
|
}
|
|
112
|
-
var
|
|
150
|
+
var g = () => {
|
|
113
151
|
let e = r(c);
|
|
114
152
|
if (!e) throw Error("useStorefrontCart must be used within StorefrontCartProvider");
|
|
115
153
|
return e;
|
|
116
154
|
};
|
|
117
155
|
//#endregion
|
|
118
|
-
export {
|
|
156
|
+
export { h as StorefrontCartProvider, f as resolveStorefrontCartItemProduct, g as useStorefrontCart };
|
|
@@ -23,6 +23,7 @@ export type RequestPayload = z.infer<typeof requestSchema>;
|
|
|
23
23
|
export declare const responseSchema: z.ZodObject<{
|
|
24
24
|
success: z.ZodBoolean;
|
|
25
25
|
message: z.ZodString;
|
|
26
|
+
canRetryCheckout: z.ZodOptional<z.ZodBoolean>;
|
|
26
27
|
providerType: z.ZodOptional<z.ZodEnum<{
|
|
27
28
|
stripe_connect_oauth: "stripe_connect_oauth";
|
|
28
29
|
mollie_connect_oauth: "mollie_connect_oauth";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkoutPaymentSession.d.ts","sourceRoot":"","sources":["../../src/lib/checkoutPaymentSession.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,eAAO,MAAM,KAAK,oDAAoD,CAAA;AAEtE,eAAO,MAAM,wCAAwC;;;EAGnD,CAAA;AACF,MAAM,MAAM,kCAAkC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wCAAwC,CAAC,CAAA;AAEzG,eAAO,MAAM,kCAAkC;;;;;;EAM7C,CAAA;AACF,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAA;AAE7F,eAAO,MAAM,aAAa;;;;;iBAKxB,CAAA;AAEF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AAY1D,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"checkoutPaymentSession.d.ts","sourceRoot":"","sources":["../../src/lib/checkoutPaymentSession.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,eAAO,MAAM,KAAK,oDAAoD,CAAA;AAEtE,eAAO,MAAM,wCAAwC;;;EAGnD,CAAA;AACF,MAAM,MAAM,kCAAkC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wCAAwC,CAAC,CAAA;AAEzG,eAAO,MAAM,kCAAkC;;;;;;EAM7C,CAAA;AACF,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAA;AAE7F,eAAO,MAAM,aAAa;;;;;iBAKxB,CAAA;AAEF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AAY1D,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAezB,CAAA;AAEF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA"}
|
|
@@ -22,6 +22,7 @@ var t = "/api/public/storefront/checkout/payment-session", n = e.enum(["stripe_c
|
|
|
22
22
|
}), o = e.object({
|
|
23
23
|
success: e.boolean(),
|
|
24
24
|
message: e.string(),
|
|
25
|
+
canRetryCheckout: e.boolean().optional(),
|
|
25
26
|
providerType: n.optional(),
|
|
26
27
|
paymentStatus: r.optional(),
|
|
27
28
|
amountMinor: e.number().int().positive().optional(),
|
|
@@ -11,6 +11,7 @@ export declare const requestCheckoutItemSchema: z.ZodObject<{
|
|
|
11
11
|
export type RequestCheckoutItem = z.infer<typeof requestCheckoutItemSchema>;
|
|
12
12
|
export declare const requestBaseSchema: z.ZodObject<{
|
|
13
13
|
storeSlug: z.ZodString;
|
|
14
|
+
checkoutSessionId: z.ZodOptional<z.ZodString>;
|
|
14
15
|
schedule: z.ZodObject<{
|
|
15
16
|
startDate: z.ZodString;
|
|
16
17
|
endDate: z.ZodString;
|
|
@@ -48,6 +49,7 @@ export declare const requestDeliveryRefinement: (payload: {
|
|
|
48
49
|
}, ctx: z.RefinementCtx) => void;
|
|
49
50
|
export declare const requestSchema: z.ZodObject<{
|
|
50
51
|
storeSlug: z.ZodString;
|
|
52
|
+
checkoutSessionId: z.ZodOptional<z.ZodString>;
|
|
51
53
|
schedule: z.ZodObject<{
|
|
52
54
|
startDate: z.ZodString;
|
|
53
55
|
endDate: z.ZodString;
|
|
@@ -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;AAQvB,OAAO,EAEL,0CAA0C,EAC3C,MAAM,2BAA2B,CAAA;AAGlC,OAAO,EAAE,0CAA0C,EAAE,CAAA;AAGrD,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
|
|
1
|
+
{"version":3,"file":"checkoutSubmit.d.ts","sourceRoot":"","sources":["../../src/lib/checkoutSubmit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAQvB,OAAO,EAEL,0CAA0C,EAC3C,MAAM,2BAA2B,CAAA;AAGlC,OAAO,EAAE,0CAA0C,EAAE,CAAA;AAGrD,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8B5B,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;;;;;;;;;;;iBAazB,CAAA;AACF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA"}
|
|
@@ -12,6 +12,7 @@ var s = "/api/public/storefront/checkout/submit", c = o.object({
|
|
|
12
12
|
quantity: o.number().int().positive()
|
|
13
13
|
}), l = o.object({
|
|
14
14
|
storeSlug: o.string().trim().min(1).toLowerCase(),
|
|
15
|
+
checkoutSessionId: o.string().trim().min(1).max(256).optional(),
|
|
15
16
|
schedule: n,
|
|
16
17
|
fulfillment: r.default(t),
|
|
17
18
|
startAddress: o.string().trim().max(500).optional(),
|
|
@@ -3,8 +3,9 @@ export declare const ROUTE = "/api/public/storefront/images/get";
|
|
|
3
3
|
export declare const requestSchema: z.ZodObject<{
|
|
4
4
|
imageId: z.ZodString;
|
|
5
5
|
storeSlug: z.ZodString;
|
|
6
|
+
w: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
6
7
|
}, z.core.$strip>;
|
|
7
8
|
export type RequestPayload = z.infer<typeof requestSchema>;
|
|
8
9
|
export type StorefrontImageRequestPayload = RequestPayload;
|
|
9
|
-
export declare const buildStorefrontImageUrl: (imageId: string, storeSlug: string) => string;
|
|
10
|
+
export declare const buildStorefrontImageUrl: (imageId: string, storeSlug: string, width?: number) => string;
|
|
10
11
|
//# sourceMappingURL=storefrontImage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storefrontImage.d.ts","sourceRoot":"","sources":["../../src/lib/storefrontImage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAMvB,eAAO,MAAM,KAAK,sCAAsC,CAAA;AAExD,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"storefrontImage.d.ts","sourceRoot":"","sources":["../../src/lib/storefrontImage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAMvB,eAAO,MAAM,KAAK,sCAAsC,CAAA;AAExD,eAAO,MAAM,aAAa;;;;iBAIxB,CAAA;AACF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AAC1D,MAAM,MAAM,6BAA6B,GAAG,cAAc,CAAA;AAE1D,eAAO,MAAM,uBAAuB,GAAI,SAAS,MAAM,EAAE,WAAW,MAAM,EAAE,QAAQ,MAAM,KAAG,MAc5F,CAAA"}
|
|
@@ -2,13 +2,19 @@ import { z as e } from "zod";
|
|
|
2
2
|
//#region src/lib/storefrontImage.ts
|
|
3
3
|
var t = e.string().trim().regex(/^[a-f0-9]{24}$/i), n = e.string().trim().min(1).toLowerCase(), r = "/api/public/storefront/images/get", i = e.object({
|
|
4
4
|
imageId: t,
|
|
5
|
-
storeSlug: n
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
if (
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
storeSlug: n,
|
|
6
|
+
w: e.coerce.number().int().min(1).max(4096).optional()
|
|
7
|
+
}), a = (e, t, n) => {
|
|
8
|
+
let i = e.trim();
|
|
9
|
+
if (!i) return "";
|
|
10
|
+
if (!/^[a-f0-9]{24}$/i.test(i)) return i;
|
|
11
|
+
let a = t.trim().toLowerCase();
|
|
12
|
+
if (!a) return i;
|
|
13
|
+
let o = new URLSearchParams({
|
|
14
|
+
imageId: i,
|
|
15
|
+
storeSlug: a
|
|
16
|
+
});
|
|
17
|
+
return typeof n == "number" && Number.isInteger(n) && n > 0 && n <= 4096 && o.set("w", String(n)), `${r}?${o.toString()}`;
|
|
12
18
|
};
|
|
13
19
|
//#endregion
|
|
14
20
|
export { r as ROUTE, a as buildStorefrontImageUrl, i as requestSchema };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckoutPage.d.ts","sourceRoot":"","sources":["../../src/pages/CheckoutPage.tsx"],"names":[],"mappings":"AAyGA,MAAM,CAAC,OAAO,UAAU,YAAY,
|
|
1
|
+
{"version":3,"file":"CheckoutPage.d.ts","sourceRoot":"","sources":["../../src/pages/CheckoutPage.tsx"],"names":[],"mappings":"AAyGA,MAAM,CAAC,OAAO,UAAU,YAAY,4CAisBnC"}
|