@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 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>;
@@ -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;
@@ -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;AAMD,KAAK,0BAA0B,GAAG;IAChC,KAAK,E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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
- }, d = (t, n) => [...n.bikes, ...n.accessories].find((n) => {
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, f = (e, t) => {
12
- let n = e.filter((e) => d(e, t) !== null);
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
- }, p = (e) => {
14
+ }, m = (e) => {
15
15
  if (!e) return { items: [] };
16
16
  try {
17
- let t = JSON.parse(e);
18
- return { items: (Array.isArray(t.items) ? t.items : []).map((e) => {
19
- 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;
20
- if (!n || r.length === 0 || a <= 0) return null;
21
- let o = {
22
- kind: n,
23
- productId: r,
24
- ...i ? { productVariantId: i } : {},
25
- quantity: a
26
- };
27
- return {
28
- key: u(o),
29
- ...o
30
- };
31
- }).filter((e) => e !== null) };
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 m({ storeSlug: e, products: t, children: r }) {
37
- let d = `${l}.${e || "unknown"}`, [m, h] = o(!1), [g, _] = o({ items: [] }), v = t.bikes, y = t.accessories;
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 = p(window.localStorage.getItem(d));
41
- _((t) => !m && t.items.length > 0 ? t : e), h(!0);
42
- }, [d]), i(() => {
43
- typeof window > "u" || m && window.localStorage.setItem(d, JSON.stringify(g));
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
- m,
46
- g,
47
- d
48
+ h,
49
+ _,
50
+ f
48
51
  ]), i(() => {
49
- if (!m) return;
52
+ if (!h) return;
50
53
  let e = {
51
- bikes: v,
52
- accessories: y
54
+ bikes: y,
55
+ accessories: b
53
56
  };
54
- _((t) => {
55
- let n = f(t.items, e);
56
- return n === t.items ? t : { items: n };
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
- v,
61
- m
67
+ h
62
68
  ]);
63
- let b = n((e) => {
64
- _((t) => {
65
- let n = e.key?.trim() ? e.key.trim().toLowerCase() : u(e), r = Math.max(1, Math.floor(e.quantity));
66
- return t.items.find((e) => e.key === n) ? { items: t.items.map((e) => e.key === n ? {
67
- ...e,
68
- quantity: e.quantity + r
69
- } : e) } : { items: [...t.items, {
70
- key: n,
71
- kind: e.kind,
72
- productId: e.productId,
73
- productVariantId: e.productVariantId,
74
- quantity: r
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
- }, []), x = n((e, t) => {
78
- _((n) => {
89
+ }, []), S = n((e, t) => {
90
+ v((n) => {
79
91
  let r = Math.max(0, Math.floor(t));
80
- return r <= 0 ? { items: n.items.filter((t) => t.key !== e) } : { items: n.items.map((t) => t.key === e ? {
81
- ...t,
82
- quantity: r
83
- } : t) };
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
- }, []), S = n((e) => {
86
- _((t) => ({ items: t.items.filter((t) => t.key !== e) }));
87
- }, []), C = n(() => {
88
- _({ items: [] });
89
- }, []), w = f(g.items, {
90
- bikes: v,
91
- accessories: y
92
- }), T = w.reduce((e, t) => e + t.quantity, 0), E = a(() => ({
93
- items: w,
94
- itemCount: T,
95
- addItem: b,
96
- setQuantity: x,
97
- removeItem: S,
98
- clear: C
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
- b,
101
- C,
135
+ x,
136
+ E,
102
137
  T,
103
138
  w,
139
+ O,
140
+ D,
141
+ C,
104
142
  S,
105
- x
143
+ _.checkoutSessionId
106
144
  ]);
107
145
  return /* @__PURE__ */ s(c.Provider, {
108
- value: E,
146
+ value: k,
109
147
  children: r
110
148
  });
111
149
  }
112
- var h = () => {
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 { m as StorefrontCartProvider, d as resolveStorefrontCartItemProduct, h as useStorefrontCart };
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.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;;;;;;;;;;;;;;;;;;;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;A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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;;;iBAGxB,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,KAAG,MAO5E,CAAA"}
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
- }), a = (e, t) => {
7
- let n = e.trim();
8
- if (!n) return "";
9
- if (!/^[a-f0-9]{24}$/i.test(n)) return n;
10
- let i = t.trim().toLowerCase();
11
- return i ? `${r}?imageId=${encodeURIComponent(n)}&storeSlug=${encodeURIComponent(i)}` : n;
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,4CAoqBnC"}
1
+ {"version":3,"file":"CheckoutPage.d.ts","sourceRoot":"","sources":["../../src/pages/CheckoutPage.tsx"],"names":[],"mappings":"AAyGA,MAAM,CAAC,OAAO,UAAU,YAAY,4CAisBnC"}