@loczer/storefront-sdk 0.182.0 → 0.183.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.
Files changed (77) hide show
  1. package/dist/StorefrontProvider.d.ts +18 -15
  2. package/dist/StorefrontProvider.d.ts.map +1 -1
  3. package/dist/StorefrontProvider.js +24 -34
  4. package/dist/chunks/booking-engine/dist/models/{Product.shared-CJ6vPb6n.js → Product.shared-CTuk4fiR.js} +2 -2
  5. package/dist/chunks/booking-engine/dist/schemas/{base-asset-PqhtKnZA.js → base-asset-B_Dm8_Vk.js} +1 -1
  6. package/dist/chunks/booking-engine/dist/schemas/{base-booking-BM3jZzqu.js → base-booking-DW8AEPKo.js} +1 -1
  7. package/dist/chunks/booking-engine/dist/schemas/{base-product-BJd4ttMP.js → base-product-1H8l2aUv.js} +1 -1
  8. package/dist/chunks/booking-engine/dist/{schemas-BNlwu75Z.js → schemas-34QQv0EH.js} +4 -4
  9. package/dist/chunks/ui/dist/Map/{MapContent--PwVTg2W.js → MapContent-QPkuTBvK.js} +2 -2
  10. package/dist/chunks/ui/dist/Map/{constants-DqrK8UkE.js → constants-BNmiJXfg.js} +1 -1
  11. package/dist/chunks/ui/dist/{Map-B45AxZ-D.js → Map-BXmRf5Ep.js} +3 -3
  12. package/dist/chunks/ui/dist/static/strings-1T2w7LqX.js +4 -0
  13. package/dist/components/AboutSection/index.d.ts +1 -6
  14. package/dist/components/AboutSection/index.d.ts.map +1 -1
  15. package/dist/components/AboutSection/index.js +43 -39
  16. package/dist/components/ContactSection/index.d.ts +1 -3
  17. package/dist/components/ContactSection/index.d.ts.map +1 -1
  18. package/dist/components/ContactSection/index.js +222 -164
  19. package/dist/components/Footer/index.d.ts +3 -4
  20. package/dist/components/Footer/index.d.ts.map +1 -1
  21. package/dist/components/Footer/index.js +98 -69
  22. package/dist/components/FulfillmentSection/index.d.ts.map +1 -1
  23. package/dist/components/FulfillmentSection/index.js +17 -16
  24. package/dist/components/Header/index.d.ts +1 -3
  25. package/dist/components/Header/index.d.ts.map +1 -1
  26. package/dist/components/Header/index.js +77 -72
  27. package/dist/components/Layout/index.d.ts +3 -1
  28. package/dist/components/Layout/index.d.ts.map +1 -1
  29. package/dist/components/Layout/index.js +45 -47
  30. package/dist/components/Map/index.js +1 -1
  31. package/dist/components/ProductPriceBadge/index.d.ts.map +1 -1
  32. package/dist/components/ProductPriceBadge/index.js +68 -60
  33. package/dist/i18n/I18nProvider.js +1 -1
  34. package/dist/i18n/fr.js +1 -1
  35. package/dist/index.d.ts +151 -150
  36. package/dist/index.js +62 -62
  37. package/dist/lib/cart.d.ts +4 -1
  38. package/dist/lib/cart.d.ts.map +1 -1
  39. package/dist/lib/cart.js +64 -40
  40. package/dist/lib/cartSummary.d.ts.map +1 -1
  41. package/dist/lib/cartSummary.js +4 -3
  42. package/dist/lib/checkoutSubmit.js +2 -2
  43. package/dist/lib/productVariants.d.ts.map +1 -1
  44. package/dist/lib/productVariants.js +20 -9
  45. package/dist/lib/storefrontAddress.d.ts +5 -0
  46. package/dist/lib/storefrontAddress.d.ts.map +1 -0
  47. package/dist/lib/storefrontAddress.js +24 -0
  48. package/dist/lib/storefrontAvailability.d.ts +6 -6
  49. package/dist/lib/storefrontContact.d.ts +10 -0
  50. package/dist/lib/storefrontContact.d.ts.map +1 -0
  51. package/dist/lib/storefrontContact.js +24 -0
  52. package/dist/lib/storefrontMissingValues.d.ts +5 -0
  53. package/dist/lib/storefrontMissingValues.d.ts.map +1 -0
  54. package/dist/lib/storefrontMissingValues.js +4 -0
  55. package/dist/lib/storefrontProducts.d.ts +23 -21
  56. package/dist/lib/storefrontProducts.d.ts.map +1 -1
  57. package/dist/lib/storefrontProducts.js +7 -5
  58. package/dist/lib/whatsapp.d.ts +8 -6
  59. package/dist/lib/whatsapp.d.ts.map +1 -1
  60. package/dist/lib/whatsapp.js +16 -43
  61. package/dist/pages/BookingPage.js +36 -36
  62. package/dist/pages/HomePage.d.ts.map +1 -1
  63. package/dist/pages/HomePage.js +126 -128
  64. package/dist/pages/ProductPage.js +160 -160
  65. package/dist/storefront.css +1 -1
  66. package/dist/storefrontSchemas.d.ts +14 -12
  67. package/dist/storefrontSchemas.d.ts.map +1 -1
  68. package/dist/storefrontSchemas.js +3 -2
  69. package/dist/ui/radio-group.d.ts +1 -1
  70. package/package.json +7 -6
  71. package/dist/chunks/ui/dist/static/strings-CPnO-KbA.js +0 -4
  72. package/dist/data/config.d.ts +0 -15
  73. package/dist/data/config.d.ts.map +0 -1
  74. package/dist/data/config.js +0 -24
  75. package/dist/static/strings.d.ts +0 -2
  76. package/dist/static/strings.d.ts.map +0 -1
  77. package/dist/static/strings.js +0 -4
@@ -0,0 +1,5 @@
1
+ export declare const MISSING_SHOP_ADDRESS = "[Missing shop address]";
2
+ export declare const MISSING_SHOP_EMAIL = "[Missing shop email]";
3
+ export declare const MISSING_SHOP_PHONE_NUMBER = "[Missing phone number]";
4
+ export declare const UNCONFIGURED_SHOP_MAP_CENTER: readonly [0, 0];
5
+ //# sourceMappingURL=storefrontMissingValues.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storefrontMissingValues.d.ts","sourceRoot":"","sources":["../../src/lib/storefrontMissingValues.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,2BAA2B,CAAA;AAC5D,eAAO,MAAM,kBAAkB,yBAAyB,CAAA;AACxD,eAAO,MAAM,yBAAyB,2BAA2B,CAAA;AAGjE,eAAO,MAAM,4BAA4B,iBAAkB,CAAA"}
@@ -0,0 +1,4 @@
1
+ //#region src/lib/storefrontMissingValues.ts
2
+ var e = "[Missing shop address]", t = "[Missing shop email]", n = "[Missing phone number]", r = [0, 0];
3
+ //#endregion
4
+ export { e as MISSING_SHOP_ADDRESS, t as MISSING_SHOP_EMAIL, n as MISSING_SHOP_PHONE_NUMBER, r as UNCONFIGURED_SHOP_MAP_CENTER };
@@ -2,11 +2,11 @@ import { z } from 'zod';
2
2
  export declare const storefrontPublicProductPriceSchema: z.ZodObject<{
3
3
  value: z.ZodNumber;
4
4
  unit: z.ZodEnum<{
5
- hour: "hour";
6
- half_day: "half_day";
7
5
  day: "day";
8
- week: "week";
6
+ half_day: "half_day";
7
+ hour: "hour";
9
8
  month: "month";
9
+ week: "week";
10
10
  }>;
11
11
  quantity: z.ZodNumber;
12
12
  currency: z.ZodOptional<z.ZodString>;
@@ -105,11 +105,11 @@ export declare const storefrontPublicBikeProductSchema: z.ZodObject<{
105
105
  prices: z.ZodOptional<z.ZodArray<z.ZodObject<{
106
106
  value: z.ZodNumber;
107
107
  unit: z.ZodEnum<{
108
- hour: "hour";
109
- half_day: "half_day";
110
108
  day: "day";
111
- week: "week";
109
+ half_day: "half_day";
110
+ hour: "hour";
112
111
  month: "month";
112
+ week: "week";
113
113
  }>;
114
114
  quantity: z.ZodNumber;
115
115
  currency: z.ZodOptional<z.ZodString>;
@@ -178,11 +178,11 @@ export declare const storefrontPublicAccessoryProductSchema: z.ZodObject<{
178
178
  prices: z.ZodArray<z.ZodObject<{
179
179
  value: z.ZodNumber;
180
180
  unit: z.ZodEnum<{
181
- hour: "hour";
182
- half_day: "half_day";
183
181
  day: "day";
184
- week: "week";
182
+ half_day: "half_day";
183
+ hour: "hour";
185
184
  month: "month";
185
+ week: "week";
186
186
  }>;
187
187
  quantity: z.ZodNumber;
188
188
  currency: z.ZodOptional<z.ZodString>;
@@ -217,10 +217,9 @@ export declare const requestSchema: z.ZodObject<{
217
217
  }, z.core.$strip>;
218
218
  export type RequestPayload = z.infer<typeof requestSchema>;
219
219
  export type StorefrontProductsRequestPayload = RequestPayload;
220
- export declare const responseSchema: z.ZodObject<{
221
- success: z.ZodBoolean;
222
- message: z.ZodOptional<z.ZodString>;
223
- products: z.ZodOptional<z.ZodObject<{
220
+ export declare const responseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
221
+ success: z.ZodLiteral<true>;
222
+ products: z.ZodObject<{
224
223
  bikes: z.ZodDefault<z.ZodArray<z.ZodObject<{
225
224
  id: z.ZodString;
226
225
  checkoutProductId: z.ZodOptional<z.ZodString>;
@@ -260,11 +259,11 @@ export declare const responseSchema: z.ZodObject<{
260
259
  prices: z.ZodOptional<z.ZodArray<z.ZodObject<{
261
260
  value: z.ZodNumber;
262
261
  unit: z.ZodEnum<{
263
- hour: "hour";
264
- half_day: "half_day";
265
262
  day: "day";
266
- week: "week";
263
+ half_day: "half_day";
264
+ hour: "hour";
267
265
  month: "month";
266
+ week: "week";
268
267
  }>;
269
268
  quantity: z.ZodNumber;
270
269
  currency: z.ZodOptional<z.ZodString>;
@@ -332,11 +331,11 @@ export declare const responseSchema: z.ZodObject<{
332
331
  prices: z.ZodArray<z.ZodObject<{
333
332
  value: z.ZodNumber;
334
333
  unit: z.ZodEnum<{
335
- hour: "hour";
336
- half_day: "half_day";
337
334
  day: "day";
338
- week: "week";
335
+ half_day: "half_day";
336
+ hour: "hour";
339
337
  month: "month";
338
+ week: "week";
340
339
  }>;
341
340
  quantity: z.ZodNumber;
342
341
  currency: z.ZodOptional<z.ZodString>;
@@ -364,8 +363,11 @@ export declare const responseSchema: z.ZodObject<{
364
363
  variants_as_products: "variants_as_products";
365
364
  }>>;
366
365
  }, z.core.$strip>>>;
367
- }, z.core.$strip>>;
368
- }, z.core.$strip>;
366
+ }, z.core.$strip>;
367
+ }, z.core.$strip>, z.ZodObject<{
368
+ success: z.ZodLiteral<false>;
369
+ message: z.ZodOptional<z.ZodString>;
370
+ }, z.core.$strip>], "success">;
369
371
  export type ResponsePayload = z.infer<typeof responseSchema>;
370
372
  export type StorefrontProductsResponsePayload = ResponsePayload;
371
373
  //# sourceMappingURL=storefrontProducts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"storefrontProducts.d.ts","sourceRoot":"","sources":["../../src/lib/storefrontProducts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAevB,eAAO,MAAM,kCAAkC;;;;;;;;;;;iBAK7C,CAAA;A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,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AAC1D,MAAM,MAAM,gCAAgC,GAAG,cAAc,CAAA;AAE7D,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BAYzB,CAAA;AACF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA;AAC5D,MAAM,MAAM,iCAAiC,GAAG,eAAe,CAAA"}
@@ -71,13 +71,15 @@ var t = e.object({
71
71
  features: e.array(n).optional(),
72
72
  productVariants: e.array(c).min(1),
73
73
  storefrontDisplayMode: f.default("variant_selector")
74
- }), g = "/api/public/storefront/products", _ = e.object({ storeSlug: e.string().trim().min(1).toLowerCase() }), v = e.object({
75
- success: e.boolean(),
76
- message: e.string().optional(),
74
+ }), g = "/api/public/storefront/products", _ = e.object({ storeSlug: e.string().trim().min(1).toLowerCase() }), v = e.discriminatedUnion("success", [e.object({
75
+ success: e.literal(!0),
77
76
  products: e.object({
78
77
  bikes: e.array(m).default([]),
79
78
  accessories: e.array(h).default([])
80
- }).optional()
81
- });
79
+ })
80
+ }), e.object({
81
+ success: e.literal(!1),
82
+ message: e.string().optional()
83
+ })]);
82
84
  //#endregion
83
85
  export { g as ROUTE, _ as requestSchema, v as responseSchema, h as storefrontPublicAccessoryProductSchema, l as storefrontPublicBikeAvailabilityStatusSchema, u as storefrontPublicBikeKindSchema, m as storefrontPublicBikeProductSchema, p as storefrontPublicImageStyleSchema, f as storefrontPublicProductDisplayModeSchema, a as storefrontPublicProductPriceSchema, d as storefrontPublicProductSlugSchema, s as storefrontPublicProductVariantAttributeSchema, o as storefrontPublicProductVariantIdentifierSchema, c as storefrontPublicProductVariantSchema };
@@ -1,17 +1,19 @@
1
- import { StorefrontPreset } from '../data/config';
2
1
  import { StorefrontConfiguration } from '../storefrontSchemas';
2
+ type StorefrontWhatsAppConfiguration = {
3
+ shop: Pick<StorefrontConfiguration["shop"], "contactPhone1" | "contactPhone2" | "country">;
4
+ content?: Pick<NonNullable<StorefrontConfiguration["content"]>, "whatsappMessage" | "whatsappPhone1Enabled" | "whatsappPhone2Enabled">;
5
+ };
3
6
  export declare function buildWhatsAppHref(phone: string | undefined, message?: string): string | undefined;
4
- export declare function resolveStorefrontWhatsAppContact({ preset, storefrontConfiguration, language, }: {
5
- preset: StorefrontPreset;
6
- storefrontConfiguration?: StorefrontConfiguration;
7
+ export declare function resolveStorefrontWhatsAppContact({ storefrontConfiguration, language, }: {
8
+ storefrontConfiguration?: StorefrontWhatsAppConfiguration;
7
9
  language: string;
8
10
  }): {
9
11
  href: string;
10
12
  phoneDisplay: string;
11
13
  } | undefined;
12
14
  export declare function resolveStorefrontWhatsAppHref(params: {
13
- preset: StorefrontPreset;
14
- storefrontConfiguration?: StorefrontConfiguration;
15
+ storefrontConfiguration?: StorefrontWhatsAppConfiguration;
15
16
  language: string;
16
17
  }): string | undefined;
18
+ export {};
17
19
  //# sourceMappingURL=whatsapp.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"whatsapp.d.ts","sourceRoot":"","sources":["../../src/lib/whatsapp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAEtD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AAgDnE,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAOjG;AAED,wBAAgB,gCAAgC,CAAC,EAC/C,MAAM,EACN,uBAAuB,EACvB,QAAQ,GACT,EAAE;IACD,MAAM,EAAE,gBAAgB,CAAA;IACx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AAA;CACjB,GAAG,MAAM,GAAG,SAAS,CAErB"}
@@ -1,55 +1,28 @@
1
1
  import { getLocalizedValue as e } from "../localization.js";
2
+ import { formatStorefrontPhoneDisplay as t } from "./storefrontContact.js";
2
3
  //#region src/lib/whatsapp.ts
3
- var t = (e) => e?.replace(/\D/g, "") ?? "", n = (e) => e.match(/.{1,2}/g)?.join(" ") ?? e, r = (e) => t(e.phone_href) || t(e.phone_display), i = (e) => e ? e.match(/(?:wa\.me\/|[?&]phone=)(\d+)/)?.[1] ?? "" : "", a = (e, i) => {
4
- let a = t(e);
5
- if (!a) return e.trim();
6
- if (i?.preset && a === r(i.preset)) return i.preset.phone_display;
7
- let o = i?.country?.trim().toUpperCase() ?? "";
8
- if ((o === "FR" || a.startsWith("33")) && a.startsWith("33") && a.length === 11) {
9
- let e = a.slice(2);
10
- return `+33 (0)${e.slice(0, 1)} ${n(e.slice(1))}`;
11
- }
12
- return (o === "US" || o === "CA" || a.startsWith("1")) && a.startsWith("1") && a.length === 11 ? `+1 (${a.slice(1, 4)}) ${a.slice(4, 7)}-${a.slice(7)}` : e.trim();
13
- };
14
- function o(e, n) {
15
- let r = t(e);
4
+ var n = (e) => e?.replace(/\D/g, "") ?? "";
5
+ function r(e, t) {
6
+ let r = n(e);
16
7
  if (!r) return;
17
- let i = n?.trim() ?? "";
8
+ let i = t?.trim() ?? "";
18
9
  return `https://wa.me/${r}${i ? `?text=${encodeURIComponent(i)}` : ""}`;
19
10
  }
20
- function s({ preset: t, storefrontConfiguration: n, language: r }) {
21
- if (!n) {
22
- let e = i(t.whatsapp_href);
23
- return {
24
- href: t.whatsapp_href,
25
- phoneDisplay: e ? a(`+${e}`, { preset: t }) : t.phone_display
26
- };
27
- }
28
- let { content: s, shop: c } = n;
29
- if (!s) {
30
- let e = i(t.whatsapp_href);
31
- return {
32
- href: t.whatsapp_href,
33
- phoneDisplay: e ? a(`+${e}`, {
34
- country: c.country,
35
- preset: t
36
- }) : t.phone_display
37
- };
38
- }
39
- let l = e(s?.whatsappMessage, r).trim(), u = [s.whatsappPhone1Enabled ? c.contactPhone1 : void 0, s.whatsappPhone2Enabled ? c.contactPhone2 : void 0];
40
- for (let e of u) {
41
- let n = o(e, l);
11
+ function i({ storefrontConfiguration: n, language: i }) {
12
+ if (!n) return;
13
+ let { content: a, shop: o } = n;
14
+ if (!a) return;
15
+ let s = e(a?.whatsappMessage, i).trim(), c = [a.whatsappPhone1Enabled ? o.contactPhone1 : void 0, a.whatsappPhone2Enabled ? o.contactPhone2 : void 0];
16
+ for (let e of c) {
17
+ let n = r(e, s);
42
18
  if (n) return {
43
19
  href: n,
44
- phoneDisplay: a(e ?? "", {
45
- country: c.country,
46
- preset: t
47
- })
20
+ phoneDisplay: t(e ?? "", o.country)
48
21
  };
49
22
  }
50
23
  }
51
- function c(e) {
52
- return s(e)?.href;
24
+ function a(e) {
25
+ return i(e)?.href;
53
26
  }
54
27
  //#endregion
55
- export { o as buildWhatsAppHref, s as resolveStorefrontWhatsAppContact, c as resolveStorefrontWhatsAppHref };
28
+ export { r as buildWhatsAppHref, i as resolveStorefrontWhatsAppContact, a as resolveStorefrontWhatsAppHref };
@@ -1,7 +1,7 @@
1
1
  import { applyBookingParamsToSearch as e, createBookingPeriodConfigFromStorefrontConfiguration as t, getBookingParamsFromSearch as n, getDefaultBookingParamsForStorefrontConfiguration as r, resolveBookingSearchParamsFromSessionStorage as i, writeBookingSearchParamsToSessionStorage as a } from "../lib/booking.js";
2
- import { useStorefrontCart as o } from "../lib/cart.js";
3
- import { getProductVariantAttributeValue as s, getStorefrontProductVariantDisplay as c } from "../lib/productVariants.js";
4
- import { getStorefrontCheckoutProductId as l } from "../lib/products.js";
2
+ import { getProductVariantAttributeValue as o, getStorefrontProductVariantDisplay as s } from "../lib/productVariants.js";
3
+ import { getStorefrontCheckoutProductId as c } from "../lib/products.js";
4
+ import { useStorefrontCart as l } from "../lib/cart.js";
5
5
  import { getLocalizedValue as u } from "../localization.js";
6
6
  import { buildStorefrontCartSummary as d } from "../lib/cartSummary.js";
7
7
  import { ROUTE as f, buildStorefrontAvailabilityKey as p, getStorefrontAvailabilityIssue as ee, getStorefrontAvailabilityStatus as m, getValidStorefrontAvailabilitySchedule as h, isStorefrontAvailabilityInsufficient as te, responseSchema as ne } from "../lib/storefrontAvailability.js";
@@ -43,19 +43,19 @@ var D = (e) => String(e).padStart(2, "0"), O = "product_modal", De = (e) => `${e
43
43
  ...e,
44
44
  fulfillment: "pickup"
45
45
  } : e, Ae = (e, t) => {
46
- let n = l(e), r = e.representedVariantId?.trim();
46
+ let n = c(e), r = e.representedVariantId?.trim();
47
47
  if (r) {
48
48
  let e = t.get(p(n, r));
49
49
  if (e) return e;
50
50
  }
51
51
  return t.get(p(n));
52
- }, je = (e, t, n) => n.get(p(l(e), t)), Me = (e, t, n) => {
52
+ }, je = (e, t, n) => n.get(p(c(e), t)), Me = (e, t, n) => {
53
53
  let r = ee(t);
54
54
  return r === "quantity_unavailable" ? e("availability_quantity_unavailable") : r === "unavailable" || n === "OUT_OF_STOCK" ? e("availability_out_of_stock") : t?.remaining === void 0 ? t?.fewRemaining || n === "LOW_STOCK" ? e("availability_low_stock") : e("availability_in_stock") : e("availability_remaining_count", { count: t.remaining });
55
55
  }, Ne = (e) => {
56
56
  let t = /* @__PURE__ */ new Map();
57
57
  for (let n of e) {
58
- let e = l(n);
58
+ let e = c(n);
59
59
  t.set(p(e), { productId: e });
60
60
  for (let r of n.productVariants ?? []) t.set(p(e, r.id), {
61
61
  productId: e,
@@ -69,21 +69,21 @@ var D = (e) => String(e).padStart(2, "0"), O = "product_modal", De = (e) => `${e
69
69
  }
70
70
  return Array.from(t.values());
71
71
  };
72
- function Pe({ product: e, selectedVariantId: t, onSelect: n, onConfirm: r, onCancel: i, getVariantAvailabilityLabel: a, isVariantOutOfCapacity: o }) {
72
+ function Pe({ product: e, selectedVariantId: t, onSelect: n, onConfirm: r, onCancel: i, getVariantAvailabilityLabel: a, isVariantOutOfCapacity: c }) {
73
73
  let { t: l } = Se(), u = e.productVariants ?? [];
74
74
  return /* @__PURE__ */ w("div", {
75
75
  className: "grid gap-3 rounded-xl border border-slate-200 bg-slate-50 p-3",
76
76
  children: [
77
77
  /* @__PURE__ */ C("p", {
78
78
  className: "text-xs font-medium text-slate-700",
79
- children: /* @__PURE__ */ C("span", { children: u.some((e) => !!s(e, "size")) ? l("product_size_label") : l("product_variant_label") })
79
+ children: /* @__PURE__ */ C("span", { children: u.some((e) => !!o(e, "size")) ? l("product_size_label") : l("product_variant_label") })
80
80
  }),
81
81
  /* @__PURE__ */ C(v, {
82
82
  value: t,
83
83
  onValueChange: n,
84
84
  className: "grid gap-2",
85
85
  children: u.map((n) => {
86
- let r = `booking-variant-${e.id}-${n.id}`.toLowerCase(), i = `storefront-booking-variant-option-${e.id}-${n.id}`.toLowerCase(), { label: s, description: l } = c(n), u = o(n.id), d = a(n.id);
86
+ let r = `booking-variant-${e.id}-${n.id}`.toLowerCase(), i = `storefront-booking-variant-option-${e.id}-${n.id}`.toLowerCase(), { label: o, description: l } = s(n), u = c(n.id), d = a(n.id);
87
87
  return /* @__PURE__ */ w("label", {
88
88
  htmlFor: r,
89
89
  "data-testid": i,
@@ -97,7 +97,7 @@ function Pe({ product: e, selectedVariantId: t, onSelect: n, onConfirm: r, onCan
97
97
  children: [
98
98
  /* @__PURE__ */ C("span", {
99
99
  className: "text-sm font-medium text-slate-950",
100
- children: s
100
+ children: o
101
101
  }),
102
102
  l ? /* @__PURE__ */ C("span", {
103
103
  className: "text-xs text-slate-600",
@@ -139,7 +139,7 @@ function Pe({ product: e, selectedVariantId: t, onSelect: n, onConfirm: r, onCan
139
139
  });
140
140
  }
141
141
  function j() {
142
- let { t: s, i18n: c } = Se(), { storeSlug: v } = be(), y = ye(), { storefrontConfiguration: D } = oe(), j = D.workspace?.workspaceLanguage, { bikes: Fe, accessories: Ie } = ce(), { bikes: M, accessories: N } = se(), [P, F] = xe(), { items: Le, itemCount: I, addItem: Re, clear: ze, removeItem: Be, setQuantity: Ve } = o(), He = x(() => t(D), [D]), L = x(() => r(D), [D]), R = D.settings.fulfillmentModes.includes("delivery"), Ue = D.settings.deliveryDisabledReason.trim(), We = D.shop.address?.trim() ?? "", z = x(() => i(P, v), [P, v]), [B, Ge] = S(() => ke(n(z, L), R));
142
+ let { t: o, i18n: s } = Se(), { storeSlug: v } = be(), y = ye(), { storefrontConfiguration: D } = oe(), j = D.workspace?.workspaceLanguage, { bikes: Fe, accessories: Ie } = ce(), { bikes: M, accessories: N } = se(), [P, F] = xe(), { items: Le, itemCount: I, addItem: Re, clear: ze, removeItem: Be, setQuantity: Ve } = l(), He = x(() => t(D), [D]), L = x(() => r(D), [D]), R = D.settings.fulfillmentModes.includes("delivery"), Ue = D.settings.deliveryDisabledReason.trim(), We = D.shop.address?.trim() ?? "", z = x(() => i(P, v), [P, v]), [B, Ge] = S(() => ke(n(z, L), R));
143
143
  b(() => {
144
144
  Ge((e) => {
145
145
  let t = {
@@ -208,16 +208,16 @@ function j() {
208
208
  return n ? te(n) : e.availabilityStatus === "OUT_OF_STOCK";
209
209
  }, Xe = (e) => (e.productVariants ?? []).length > 0, Ze = (e, t) => {
210
210
  let n = je(e, t, H);
211
- return n ? Me(s, n, m(n)) : e.availabilityStatus === "OUT_OF_STOCK" ? s("availability_out_of_stock") : null;
211
+ return n ? Me(o, n, m(n)) : e.availabilityStatus === "OUT_OF_STOCK" ? o("availability_out_of_stock") : null;
212
212
  }, Qe = ge(v), $e = x(() => ({
213
- startDate: s("booking_start_date"),
214
- pickStartDate: s("booking_start_date"),
215
- startTime: s("booking_start_time"),
216
- endDate: s("booking_end_date"),
217
- pickEndDate: s("booking_end_date"),
218
- endTime: s("booking_end_time"),
219
- selectedDaysTooltip: ({ count: e }) => s("booking_selected_days_tooltip", { count: e })
220
- }), [c.language, s]), U = (e) => {
213
+ startDate: o("booking_start_date"),
214
+ pickStartDate: o("booking_start_date"),
215
+ startTime: o("booking_start_time"),
216
+ endDate: o("booking_end_date"),
217
+ pickEndDate: o("booking_end_date"),
218
+ endTime: o("booking_end_time"),
219
+ selectedDaysTooltip: ({ count: e }) => o("booking_selected_days_tooltip", { count: e })
220
+ }), [s.language, o]), U = (e) => {
221
221
  Ge((t) => {
222
222
  let n = {
223
223
  ...t,
@@ -241,10 +241,10 @@ function j() {
241
241
  bookingPeriodConfig: He,
242
242
  fetchTimeSlots: Qe,
243
243
  labels: $e,
244
- localeCode: c.language
244
+ localeCode: s.language
245
245
  }, W = x(() => d({
246
246
  items: Le,
247
- language: c.language,
247
+ language: s.language,
248
248
  fallbackLanguage: j,
249
249
  products: {
250
250
  bikes: Fe,
@@ -253,7 +253,7 @@ function j() {
253
253
  }), [
254
254
  Ie,
255
255
  Fe,
256
- c.language,
256
+ s.language,
257
257
  Le,
258
258
  j
259
259
  ]), G = x(() => W.lines.map((e) => ({
@@ -320,7 +320,7 @@ function j() {
320
320
  }, $ = (e, t, n = 1) => {
321
321
  Re({
322
322
  kind: e.kind,
323
- productId: l(e),
323
+ productId: c(e),
324
324
  ...t ? { productVariantId: t } : {},
325
325
  quantity: n
326
326
  });
@@ -363,7 +363,7 @@ function j() {
363
363
  children: [/* @__PURE__ */ C(Ce, {
364
364
  className: "h-4 w-4",
365
365
  "aria-hidden": "true"
366
- }), /* @__PURE__ */ C("span", { children: s("back_to_home") })]
366
+ }), /* @__PURE__ */ C("span", { children: o("back_to_home") })]
367
367
  }), /* @__PURE__ */ C(E, {
368
368
  to: q,
369
369
  className: T(I > 0 ? "inline-flex" : "hidden"),
@@ -373,7 +373,7 @@ function j() {
373
373
  children: [/* @__PURE__ */ C(Ee, {
374
374
  className: "h-4 w-4",
375
375
  "aria-hidden": "true"
376
- }), /* @__PURE__ */ C("span", { children: s("checkout_button") })]
376
+ }), /* @__PURE__ */ C("span", { children: o("checkout_button") })]
377
377
  })
378
378
  })]
379
379
  }),
@@ -389,7 +389,7 @@ function j() {
389
389
  children: [
390
390
  /* @__PURE__ */ C(_, {
391
391
  stepNumber: 1,
392
- title: s("booking_summary_title")
392
+ title: o("booking_summary_title")
393
393
  }),
394
394
  /* @__PURE__ */ C(ie, {
395
395
  ...et,
@@ -416,10 +416,10 @@ function j() {
416
416
  className: "space-y-2 scroll-mt-32",
417
417
  children: [/* @__PURE__ */ C(_, {
418
418
  stepNumber: 2,
419
- title: s("products_title")
419
+ title: o("products_title")
420
420
  }), /* @__PURE__ */ C("p", {
421
421
  className: "text-sm text-slate-600",
422
- children: /* @__PURE__ */ C("span", { children: s("products_description") })
422
+ children: /* @__PURE__ */ C("span", { children: o("products_description") })
423
423
  })]
424
424
  }),
425
425
  /* @__PURE__ */ C("div", {
@@ -443,16 +443,16 @@ function j() {
443
443
  className: "space-y-2 pt-4",
444
444
  children: [/* @__PURE__ */ C(_, {
445
445
  stepNumber: 3,
446
- title: s("accessories_title")
446
+ title: o("accessories_title")
447
447
  }), /* @__PURE__ */ C("p", {
448
448
  className: "text-sm text-slate-600",
449
- children: /* @__PURE__ */ C("span", { children: s("accessories_description") })
449
+ children: /* @__PURE__ */ C("span", { children: o("accessories_description") })
450
450
  })]
451
451
  }),
452
452
  /* @__PURE__ */ C("div", {
453
453
  className: "grid gap-4 sm:grid-cols-2 lg:grid-cols-3",
454
454
  children: N.map((e) => {
455
- let t = u(e.name, c.language, j), n = u(e.description, c.language, j), r = u(e.warning, c.language, j), i = typeof e.images?.[0] == "string" ? e.images[0].trim() : "", a = pe(e.primaryImageStyle), o = `/${v ?? ""}/products/${e.slug}`, l = A(e), d = X(e), f = m(Ae(e, H)) === "OUT_OF_STOCK", p = !!l || Xe(e);
455
+ let t = u(e.name, s.language, j), n = u(e.description, s.language, j), r = u(e.warning, s.language, j), i = typeof e.images?.[0] == "string" ? e.images[0].trim() : "", a = pe(e.primaryImageStyle), c = `/${v ?? ""}/products/${e.slug}`, l = A(e), d = X(e), f = m(Ae(e, H)) === "OUT_OF_STOCK", p = !!l || Xe(e);
456
456
  return /* @__PURE__ */ C(le, {
457
457
  className: "h-full border-slate-200 bg-white shadow-sm",
458
458
  children: /* @__PURE__ */ w("div", {
@@ -475,7 +475,7 @@ function j() {
475
475
  }), f ? /* @__PURE__ */ C(re, {
476
476
  variant: "destructive",
477
477
  className: "pointer-events-none absolute right-2 top-2 shadow-sm",
478
- children: /* @__PURE__ */ C("span", { children: s("availability_out_of_stock") })
478
+ children: /* @__PURE__ */ C("span", { children: o("availability_out_of_stock") })
479
479
  }) : null]
480
480
  }),
481
481
  /* @__PURE__ */ w("div", {
@@ -516,17 +516,17 @@ function j() {
516
516
  /* @__PURE__ */ w("div", {
517
517
  className: "mt-auto flex items-center gap-2",
518
518
  children: [/* @__PURE__ */ C(E, {
519
- to: o,
519
+ to: c,
520
520
  state: J,
521
521
  className: "text-xs font-medium text-slate-700 hover:text-slate-950",
522
- children: /* @__PURE__ */ C("span", { children: s("product_details_link") })
522
+ children: /* @__PURE__ */ C("span", { children: o("product_details_link") })
523
523
  }), /* @__PURE__ */ w(g, {
524
524
  type: "button",
525
525
  size: "sm",
526
526
  className: "ml-auto rounded-full gap-2",
527
527
  onClick: () => mt(e),
528
528
  disabled: !p,
529
- children: [/* @__PURE__ */ C("span", { children: s("add_to_cart") }), /* @__PURE__ */ C(we, {
529
+ children: [/* @__PURE__ */ C("span", { children: o("add_to_cart") }), /* @__PURE__ */ C(we, {
530
530
  className: "h-4 w-4",
531
531
  "aria-hidden": "true"
532
532
  })]
@@ -1 +1 @@
1
- {"version":3,"file":"HomePage.d.ts","sourceRoot":"","sources":["../../src/pages/HomePage.tsx"],"names":[],"mappings":"AA6GA,MAAM,CAAC,OAAO,UAAU,QAAQ,4CA2qB/B"}
1
+ {"version":3,"file":"HomePage.d.ts","sourceRoot":"","sources":["../../src/pages/HomePage.tsx"],"names":[],"mappings":"AA6GA,MAAM,CAAC,OAAO,UAAU,QAAQ,4CA8qB/B"}