@loczer/storefront-sdk 0.197.0 → 0.199.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 (63) hide show
  1. package/dist/StorefrontContext.d.ts +483 -0
  2. package/dist/StorefrontContext.d.ts.map +1 -0
  3. package/dist/StorefrontContext.js +39 -0
  4. package/dist/StorefrontProvider.d.ts +6 -486
  5. package/dist/StorefrontProvider.d.ts.map +1 -1
  6. package/dist/StorefrontProvider.js +34 -67
  7. package/dist/chunks/pkg/ui/dist/{MorphingModalWizard-j1CgFGLe.js → MorphingModalWizard-DOH1GYVR.js} +1 -0
  8. package/dist/components/AboutSection/index.js +5 -5
  9. package/dist/components/BikeProductCard/index.d.ts +2 -1
  10. package/dist/components/BikeProductCard/index.d.ts.map +1 -1
  11. package/dist/components/BikeProductCard/index.js +28 -28
  12. package/dist/components/BookingBikeQuickAddCard/index.d.ts +19 -0
  13. package/dist/components/BookingBikeQuickAddCard/index.d.ts.map +1 -0
  14. package/dist/components/BookingBikeQuickAddCard/index.js +174 -0
  15. package/dist/components/BookingBikeVariantDialog/index.d.ts +5 -2
  16. package/dist/components/BookingBikeVariantDialog/index.d.ts.map +1 -1
  17. package/dist/components/BookingBikeVariantDialog/index.js +85 -93
  18. package/dist/components/BookingPeriodSelector/components/BookingEndDateField.js +1 -1
  19. package/dist/components/BookingPeriodSelector/components/BookingEndTimeField.js +1 -1
  20. package/dist/components/BookingPeriodSelector/components/BookingStartDateField.js +1 -1
  21. package/dist/components/BookingPeriodSelector/components/BookingStartTimeField.js +1 -1
  22. package/dist/components/ContactSection/index.js +107 -107
  23. package/dist/components/ContractSaleDocument/Invoice.d.ts.map +1 -1
  24. package/dist/components/ContractSaleDocument/Invoice.js +117 -111
  25. package/dist/components/Header/index.js +4 -4
  26. package/dist/components/Layout/index.d.ts.map +1 -1
  27. package/dist/components/Layout/index.js +47 -40
  28. package/dist/components/PlatformFooter/index.js +1 -1
  29. package/dist/components/ProductPriceBadge/index.d.ts +2 -1
  30. package/dist/components/ProductPriceBadge/index.d.ts.map +1 -1
  31. package/dist/components/ProductPriceBadge/index.js +72 -70
  32. package/dist/components/TestimonialsSection/index.js +1 -1
  33. package/dist/i18n/en.d.ts +3 -0
  34. package/dist/i18n/en.d.ts.map +1 -1
  35. package/dist/i18n/en.js +3 -0
  36. package/dist/i18n/fr.d.ts +3 -0
  37. package/dist/i18n/fr.d.ts.map +1 -1
  38. package/dist/i18n/fr.js +3 -0
  39. package/dist/index.d.ts +19 -2
  40. package/dist/index.js +59 -58
  41. package/dist/lib/cartSummary.js +7 -7
  42. package/dist/lib/products.d.ts +6 -0
  43. package/dist/lib/products.d.ts.map +1 -1
  44. package/dist/lib/products.js +36 -32
  45. package/dist/lib/toast.d.ts +9 -0
  46. package/dist/lib/toast.d.ts.map +1 -0
  47. package/dist/lib/toast.js +13 -0
  48. package/dist/pages/BookingPage.d.ts.map +1 -1
  49. package/dist/pages/BookingPage.js +323 -396
  50. package/dist/pages/CheckoutPage.js +217 -217
  51. package/dist/pages/CheckoutPaymentPage.js +124 -124
  52. package/dist/pages/ContractSaleDocumentPage.d.ts.map +1 -1
  53. package/dist/pages/ContractSaleDocumentPage.js +83 -83
  54. package/dist/pages/ErrorPage.d.ts.map +1 -1
  55. package/dist/pages/ErrorPage.js +13 -13
  56. package/dist/pages/HomePage.js +6 -3
  57. package/dist/pages/NotFoundPage.js +1 -1
  58. package/dist/pages/ProductPage.d.ts.map +1 -1
  59. package/dist/pages/ProductPage.js +177 -165
  60. package/dist/pages/checkout/components/CheckoutPaymentSummaryCard.js +1 -1
  61. package/dist/storefront.css +1 -1
  62. package/dist/ui/button.js +3 -3
  63. package/package.json +3 -1
@@ -1,7 +1,7 @@
1
- import { cn as e } from "../../lib/utils.js";
2
- import { getLocalizedEntry as t } from "../../localization.js";
1
+ import { getLocalizedEntry as e } from "../../localization.js";
2
+ import { cn as t } from "../../lib/utils.js";
3
3
  import { UNCONFIGURED_SHOP_MAP_CENTER as n } from "../../lib/storefrontMissingValues.js";
4
- import { useStorefront as r } from "../../StorefrontProvider.js";
4
+ import { useStorefront as r } from "../../StorefrontContext.js";
5
5
  import { createMarkerElement as i } from "../Map/createMarkerElement.js";
6
6
  import { Map as a } from "../Map/index.js";
7
7
  import { useEffect as o, useMemo as s, useRef as c, useState as l } from "react";
@@ -9,7 +9,7 @@ import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
9
9
  import { useTranslation as p } from "react-i18next";
10
10
  //#region src/components/AboutSection/index.tsx
11
11
  function m() {
12
- let { i18n: m, t: h } = p(), { storefrontConfiguration: g, mapboxToken: _ } = r(), v = g.workspace?.workspaceLanguage, [y, b] = l(!1), [x, S] = l(!1), C = c(null), w = t(g.content?.about, m.language, v)?.html?.trim(), T = s(() => {
12
+ let { i18n: m, t: h } = p(), { storefrontConfiguration: g, mapboxToken: _ } = r(), v = g.workspace?.workspaceLanguage, [y, b] = l(!1), [x, S] = l(!1), C = c(null), w = e(g.content?.about, m.language, v)?.html?.trim(), T = s(() => {
13
13
  let e = g.shop.gpsCoordinates;
14
14
  return e ? [e[1], e[0]] : null;
15
15
  }, [g.shop.gpsCoordinates]), E = T ?? n, D = s(() => i(), []), O = g.shop.address?.trim() ?? "", k = s(() => T ? {
@@ -59,7 +59,7 @@ function m() {
59
59
  className: "relative mt-4",
60
60
  children: [/* @__PURE__ */ d("div", {
61
61
  ref: C,
62
- className: e("overflow-hidden text-sm leading-6 text-slate-700 transition-[max-height] duration-300 ease-out sm:text-base [&_a]:text-slate-900 [&_a]:underline [&_blockquote]:border-l-2 [&_blockquote]:border-slate-300 [&_blockquote]:pl-4 [&_h1]:text-2xl [&_h1]:font-semibold [&_h2]:text-xl [&_h2]:font-semibold [&_h3]:text-lg [&_h3]:font-semibold [&_li]:my-1 [&_ol]:list-decimal [&_ol]:pl-6 [&_p]:my-2 [&_ul]:list-disc [&_ul]:pl-6", !y && "max-h-[320px]"),
62
+ className: t("overflow-hidden text-sm leading-6 text-slate-700 transition-[max-height] duration-300 ease-out sm:text-base [&_a]:text-slate-900 [&_a]:underline [&_blockquote]:border-l-2 [&_blockquote]:border-slate-300 [&_blockquote]:pl-4 [&_h1]:text-2xl [&_h1]:font-semibold [&_h2]:text-xl [&_h2]:font-semibold [&_h3]:text-lg [&_h3]:font-semibold [&_li]:my-1 [&_ol]:list-decimal [&_ol]:pl-6 [&_p]:my-2 [&_ul]:list-disc [&_ul]:pl-6", !y && "max-h-[320px]"),
63
63
  dangerouslySetInnerHTML: { __html: w }
64
64
  }), !y && x && /* @__PURE__ */ d("div", {
65
65
  "aria-hidden": !0,
@@ -1,6 +1,7 @@
1
1
  import { BikeProduct } from '../../lib/products';
2
2
  type BikeProductCardProps = {
3
3
  bike: BikeProduct;
4
+ className?: string;
4
5
  detailsPath: string;
5
6
  productDetailsLinkState: {
6
7
  backTo: string;
@@ -13,6 +14,6 @@ type BikeProductCardProps = {
13
14
  variant?: "default" | "booking";
14
15
  testId?: string;
15
16
  };
16
- export declare function BikeProductCard({ bike, detailsPath, productDetailsLinkState, actionLabelKey, onAction, actionDisabled, availabilityLabel, fallbackLanguage, variant, testId, }: BikeProductCardProps): import("react/jsx-runtime").JSX.Element;
17
+ export declare function BikeProductCard({ bike, className, detailsPath, productDetailsLinkState, actionLabelKey, onAction, actionDisabled, availabilityLabel, fallbackLanguage, variant, testId, }: BikeProductCardProps): import("react/jsx-runtime").JSX.Element;
17
18
  export {};
18
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/BikeProductCard/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AASrD,KAAK,oBAAoB,GAAG;IAC1B,IAAI,EAAE,WAAW,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,uBAAuB,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAA;IA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OAAmB,EACnB,MAAM,GACP,EAAE,oBAAoB,2CAoFtB"}
@@ -1,5 +1,5 @@
1
- import { getAvailabilityVariant as e } from "../../lib/utils.js";
2
- import { getLocalizedValue as t } from "../../localization.js";
1
+ import { getLocalizedValue as e } from "../../localization.js";
2
+ import { getAvailabilityVariant as t } from "../../lib/utils.js";
3
3
  import { Badge as n } from "../../ui/badge.js";
4
4
  import { Button as r } from "../../ui/button.js";
5
5
  import { ProductPriceBadge as i } from "../ProductPriceBadge/index.js";
@@ -8,23 +8,23 @@ import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
8
8
  import { Link as l } from "@rpcbase/router";
9
9
  import { useTranslation as u } from "react-i18next";
10
10
  import { cn as d } from "@rpcbase/ui";
11
- import { ArrowRight as f, Bike as p } from "lucide-react";
11
+ import { ArrowRight as f, Bike as p, Plus as m } from "lucide-react";
12
12
  //#region src/components/BikeProductCard/index.tsx
13
- function m({ bike: m, detailsPath: h, productDetailsLinkState: g, actionLabelKey: _ = "product_cta", onAction: v, actionDisabled: y = !1, availabilityLabel: b, fallbackLanguage: x, variant: S = "default", testId: C }) {
14
- let { t: w, i18n: T } = u(), E = t(m.name, T.language, x), D = t(m.description, T.language, x), O = typeof m.images?.[0] == "string" ? m.images[0].trim() : "", k = a(m.primaryImageStyle), A = e(m.availabilityStatus), j = S === "booking", M = m.availabilityStatus === "OUT_OF_STOCK";
13
+ function h({ bike: h, className: g, detailsPath: _, productDetailsLinkState: v, actionLabelKey: y = "product_cta", onAction: b, actionDisabled: x = !1, availabilityLabel: S, fallbackLanguage: C, variant: w = "default", testId: T }) {
14
+ let { t: E, i18n: D } = u(), O = e(h.name, D.language, C), k = e(h.description, D.language, C), A = typeof h.images?.[0] == "string" ? h.images[0].trim() : "", j = a(h.primaryImageStyle), M = t(h.availabilityStatus), N = w === "booking", P = h.availabilityStatus === "OUT_OF_STOCK";
15
15
  return /* @__PURE__ */ c("div", {
16
- className: "flex h-full flex-col gap-2 rounded-xl border border-slate-200 bg-white p-3 shadow-sm",
17
- "data-testid": C,
16
+ className: d("flex h-full flex-col gap-2 rounded-xl border border-slate-200 bg-white p-3 shadow-sm", g),
17
+ "data-testid": T,
18
18
  children: [/* @__PURE__ */ c("div", {
19
19
  className: "flex flex-1 items-stretch gap-4",
20
20
  children: [/* @__PURE__ */ s("div", {
21
21
  className: "w-24 shrink-0 sm:w-28",
22
22
  children: /* @__PURE__ */ c("div", {
23
- className: d("relative h-full min-h-20 overflow-hidden rounded-xl", k.className),
24
- style: k.style,
25
- children: [O ? /* @__PURE__ */ s("img", {
26
- src: O,
27
- alt: E,
23
+ className: d("relative h-full min-h-20 overflow-hidden rounded-xl", j.className),
24
+ style: j.style,
25
+ children: [A ? /* @__PURE__ */ s("img", {
26
+ src: A,
27
+ alt: O,
28
28
  className: "absolute inset-0 h-full w-full object-contain p-1",
29
29
  loading: "lazy"
30
30
  }) : /* @__PURE__ */ s("div", {
@@ -33,10 +33,10 @@ function m({ bike: m, detailsPath: h, productDetailsLinkState: g, actionLabelKey
33
33
  className: "h-7 w-7",
34
34
  "aria-hidden": "true"
35
35
  })
36
- }), j && M ? /* @__PURE__ */ s(n, {
36
+ }), N && P ? /* @__PURE__ */ s(n, {
37
37
  variant: "destructive",
38
38
  className: "pointer-events-none absolute right-2 top-2 shadow-sm",
39
- children: /* @__PURE__ */ s("span", { children: w("availability_out_of_stock") })
39
+ children: /* @__PURE__ */ s("span", { children: E("availability_out_of_stock") })
40
40
  }) : null]
41
41
  })
42
42
  }), /* @__PURE__ */ c("div", {
@@ -44,41 +44,41 @@ function m({ bike: m, detailsPath: h, productDetailsLinkState: g, actionLabelKey
44
44
  children: [
45
45
  /* @__PURE__ */ s("p", {
46
46
  className: "min-w-0 text-sm font-semibold text-slate-950",
47
- children: /* @__PURE__ */ s("span", { children: E })
47
+ children: /* @__PURE__ */ s("span", { children: O })
48
48
  }),
49
49
  /* @__PURE__ */ s(i, {
50
- prices: m.prices,
50
+ prices: h.prices,
51
51
  className: "self-start"
52
52
  }),
53
53
  /* @__PURE__ */ s("p", {
54
54
  className: "line-clamp-2 text-xs text-slate-600",
55
- children: /* @__PURE__ */ s("span", { children: D })
55
+ children: /* @__PURE__ */ s("span", { children: k })
56
56
  })
57
57
  ]
58
58
  })]
59
59
  }), /* @__PURE__ */ c("div", {
60
60
  className: "flex flex-wrap items-center gap-x-2 gap-y-1",
61
61
  children: [
62
- j ? null : /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s(n, {
63
- variant: A.variant,
64
- children: /* @__PURE__ */ s("span", { children: b ?? w(A.labelKey) })
62
+ N ? null : /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s(n, {
63
+ variant: M.variant,
64
+ children: /* @__PURE__ */ s("span", { children: S ?? E(M.labelKey) })
65
65
  }), /* @__PURE__ */ s("span", {
66
66
  className: "text-slate-400",
67
67
  children: "·"
68
68
  })] }),
69
69
  /* @__PURE__ */ s(l, {
70
- to: h,
71
- state: g,
70
+ to: _,
71
+ state: v,
72
72
  className: "text-xs font-medium text-slate-700 hover:text-slate-950",
73
- children: /* @__PURE__ */ s("span", { children: w("product_details_link") })
73
+ children: /* @__PURE__ */ s("span", { children: E("product_details_link") })
74
74
  }),
75
75
  /* @__PURE__ */ c(r, {
76
76
  type: "button",
77
77
  size: "sm",
78
- className: "ml-auto rounded-full gap-2 text-xs",
79
- onClick: v,
80
- disabled: y,
81
- children: [/* @__PURE__ */ s("span", { children: w(_) }), /* @__PURE__ */ s(f, {
78
+ className: "ml-auto gap-2 text-xs",
79
+ onClick: b,
80
+ disabled: x,
81
+ children: [/* @__PURE__ */ s("span", { children: E(y) }), s(N ? m : f, {
82
82
  className: "h-4 w-4",
83
83
  "aria-hidden": "true"
84
84
  })]
@@ -88,4 +88,4 @@ function m({ bike: m, detailsPath: h, productDetailsLinkState: g, actionLabelKey
88
88
  });
89
89
  }
90
90
  //#endregion
91
- export { m as BikeProductCard };
91
+ export { h as BikeProductCard };
@@ -0,0 +1,19 @@
1
+ import { BikeProduct } from '../../lib/products';
2
+ type BookingBikeQuickAddCardProps = {
3
+ bike: BikeProduct;
4
+ detailsPath: string;
5
+ productDetailsLinkState: {
6
+ backTo: string;
7
+ };
8
+ actionDisabled?: boolean;
9
+ fallbackLanguage?: string;
10
+ dimOnColumnCount: 1 | 2 | null;
11
+ onAction: () => void;
12
+ onQuickAdd: (variantId: string, quantity: number) => void;
13
+ onHoverStart: () => void;
14
+ onHoverEnd: () => void;
15
+ testId: string;
16
+ };
17
+ export declare function BookingBikeQuickAddCard({ bike, detailsPath, productDetailsLinkState, actionDisabled, fallbackLanguage, dimOnColumnCount, onAction, onQuickAdd, onHoverStart, onHoverEnd, testId, }: BookingBikeQuickAddCardProps): import("react/jsx-runtime").JSX.Element;
18
+ export {};
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/BookingBikeQuickAddCard/index.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AA0ErD,KAAK,4BAA4B,GAAG;IAClC,IAAI,EAAE,WAAW,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,uBAAuB,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAA;IAC3C,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,gBAAgB,EAAE,CAAC,GAAG,CAAC,GAAG,IAAI,CAAA;IAC9B,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;IACzD,YAAY,EAAE,MAAM,IAAI,CAAA;IACxB,UAAU,EAAE,MAAM,IAAI,CAAA;IACtB,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,wBAAgB,uBAAuB,CAAC,EACtC,IAAI,EACJ,WAAW,EACX,uBAAuB,EACvB,cAAsB,EACtB,gBAAgB,EAChB,gBAAgB,EAChB,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,UAAU,EACV,MAAM,GACP,EAAE,4BAA4B,2CAwN9B"}
@@ -0,0 +1,174 @@
1
+ import { getStorefrontProductVariantDisplay as e } from "../../lib/productVariants.js";
2
+ import { Button as t } from "../../ui/button.js";
3
+ import { Input as n } from "../../ui/input.js";
4
+ import { BikeProductCard as r } from "../BikeProductCard/index.js";
5
+ import { useEffect as i, useRef as a, useState as o } from "react";
6
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
7
+ import { useTranslation as l } from "react-i18next";
8
+ import { cn as u } from "@rpcbase/ui";
9
+ import { Plus as d } from "lucide-react";
10
+ import { AnimatePresence as f, motion as p } from "framer-motion";
11
+ //#region src/components/BookingBikeQuickAddCard/index.tsx
12
+ var m = () => typeof window < "u" && window.matchMedia("(hover: hover) and (pointer: fine)").matches, h = (e) => {
13
+ let t = Number.parseInt(e, 10);
14
+ return !Number.isFinite(t) || t < 1 ? 1 : t;
15
+ }, g = (e) => {
16
+ let t = e.replace(/\D/g, "");
17
+ return t ? String(h(t)) : "";
18
+ }, _ = (e) => {
19
+ if (!e) return;
20
+ let t = Number(e.trim().replace(",", "."));
21
+ if (!(!Number.isFinite(t) || t <= 0)) return Math.round(t);
22
+ }, v = (e) => (e / 100).toFixed(2), y = (e, t) => e.attributes.find((e) => e.key.trim().toLowerCase() === t)?.value, b = (e) => {
23
+ let t = _(y(e, "min_height_cm")), n = _(y(e, "max_height_cm")), r = t ? v(t) : null, i = n ? v(n) : null;
24
+ return r && i ? `${r} - ${i} m` : r ? `min ${r} m` : i ? `max ${i} m` : null;
25
+ };
26
+ function x({ bike: _, detailsPath: v, productDetailsLinkState: y, actionDisabled: x = !1, fallbackLanguage: S, dimOnColumnCount: C, onAction: w, onQuickAdd: T, onHoverStart: E, onHoverEnd: D, testId: O }) {
27
+ let { t: k } = l(), A = a(null), [j, M] = o(!1), [N, P] = o({}), F = _.productVariants ?? [], I = !x && F.length > 0, L = () => !I || !m() ? !1 : (M(!0), !0), R = () => {
28
+ M(!1), P({});
29
+ };
30
+ i(() => {
31
+ if (!j) return;
32
+ let e = (e) => {
33
+ if (e.pointerType !== "mouse") return;
34
+ let t = e.target;
35
+ t instanceof Node && A.current?.contains(t) || R();
36
+ }, t = (e) => {
37
+ let t = e.target;
38
+ t instanceof Node && A.current?.contains(t) || R();
39
+ };
40
+ return document.addEventListener("pointermove", e), document.addEventListener("pointerdown", t), () => {
41
+ document.removeEventListener("pointermove", e), document.removeEventListener("pointerdown", t);
42
+ };
43
+ }, [j]);
44
+ let z = (e) => {
45
+ e.pointerType === "mouse" && L() && E();
46
+ }, B = (e) => {
47
+ if (e.pointerType !== "mouse") return;
48
+ let t = e.relatedTarget;
49
+ t instanceof Node && e.currentTarget.contains(t) || (R(), D());
50
+ }, V = (e) => {
51
+ let t = e.relatedTarget;
52
+ (!(t instanceof Node) || !e.currentTarget.contains(t)) && R();
53
+ }, H = (e) => N[e] ?? "1", U = (e, t) => {
54
+ P((n) => ({
55
+ ...n,
56
+ [e]: t
57
+ }));
58
+ }, W = (e, t) => {
59
+ let n = t.target.value;
60
+ if (n === "") {
61
+ U(e, "");
62
+ return;
63
+ }
64
+ U(e, g(n));
65
+ }, G = (e) => {
66
+ U(e, String(h(H(e))));
67
+ }, K = (e) => {
68
+ let t = h(H(e));
69
+ U(e, String(t)), T(e, t);
70
+ };
71
+ return /* @__PURE__ */ c("div", {
72
+ ref: A,
73
+ "data-testid": O,
74
+ onPointerEnter: z,
75
+ onPointerLeave: B,
76
+ onFocusCapture: L,
77
+ onBlurCapture: V,
78
+ className: u("relative h-full overflow-visible transition-opacity duration-200", C === 1 && "opacity-20 md:opacity-100", C === 2 && "md:opacity-20", j && I && "z-30"),
79
+ children: [/* @__PURE__ */ s(r, {
80
+ bike: _,
81
+ detailsPath: v,
82
+ productDetailsLinkState: y,
83
+ actionLabelKey: "add_to_cart",
84
+ onAction: w,
85
+ actionDisabled: x,
86
+ fallbackLanguage: S,
87
+ variant: "booking",
88
+ className: u("transition-[border-color,box-shadow,border-radius] duration-200 hover:border-primary/20 hover:shadow-md", j && I && "!rounded-b-none border-primary/20 !border-b-white shadow-lg")
89
+ }), /* @__PURE__ */ s(f, {
90
+ initial: !1,
91
+ children: j && I ? /* @__PURE__ */ s(p.div, {
92
+ initial: {
93
+ opacity: 0,
94
+ y: -8,
95
+ scaleY: .96
96
+ },
97
+ animate: {
98
+ opacity: 1,
99
+ y: 0,
100
+ scaleY: 1
101
+ },
102
+ exit: {
103
+ opacity: 0,
104
+ y: -8,
105
+ scaleY: .96
106
+ },
107
+ transition: {
108
+ duration: .16,
109
+ ease: [
110
+ .22,
111
+ 1,
112
+ .36,
113
+ 1
114
+ ]
115
+ },
116
+ className: "absolute left-0 right-0 top-full z-30 origin-top rounded-b-lg border border-t-0 border-primary/20 bg-white px-3 py-2 shadow-xl",
117
+ "data-testid": `storefront-booking-bike-quick-selector-${_.id}`.toLowerCase(),
118
+ onClick: (e) => e.stopPropagation(),
119
+ onKeyDown: (e) => e.stopPropagation(),
120
+ children: /* @__PURE__ */ s("div", { children: F.map((r) => {
121
+ let { label: i } = e(r), a = b(r), o = `storefront-booking-bike-quick-quantity-${_.id}-${r.id}`.toLowerCase();
122
+ return /* @__PURE__ */ c("div", {
123
+ className: "flex items-center justify-between gap-3 border-b border-slate-100 py-1.5 last:border-b-0",
124
+ children: [
125
+ /* @__PURE__ */ c("div", {
126
+ className: "flex min-w-0 flex-1 items-baseline gap-2",
127
+ children: [/* @__PURE__ */ s("span", {
128
+ className: "min-w-0 truncate text-sm font-semibold text-slate-950",
129
+ title: i,
130
+ children: i
131
+ }), a ? /* @__PURE__ */ s("span", {
132
+ className: "truncate text-xs text-slate-500",
133
+ children: a
134
+ }) : null]
135
+ }),
136
+ /* @__PURE__ */ s("label", {
137
+ className: "sr-only",
138
+ htmlFor: o,
139
+ children: /* @__PURE__ */ s("span", { children: k("quantity_label") })
140
+ }),
141
+ /* @__PURE__ */ c("div", {
142
+ className: "flex shrink-0 items-center",
143
+ children: [/* @__PURE__ */ s(n, {
144
+ id: o,
145
+ type: "text",
146
+ inputMode: "numeric",
147
+ pattern: "[0-9]*",
148
+ value: H(r.id),
149
+ onChange: (e) => W(r.id, e),
150
+ onBlur: () => G(r.id),
151
+ className: "h-8 w-9 rounded-r-none border-r-0 px-1 text-center text-sm focus-visible:z-10",
152
+ "aria-label": k("quantity_label"),
153
+ "data-testid": o
154
+ }), /* @__PURE__ */ c(t, {
155
+ type: "button",
156
+ size: "sm",
157
+ className: "h-8 gap-1 rounded-l-none px-2 text-xs",
158
+ onClick: () => K(r.id),
159
+ "data-testid": `storefront-booking-bike-quick-add-${_.id}-${r.id}`.toLowerCase(),
160
+ children: [/* @__PURE__ */ s("span", { children: k("add_short") }), /* @__PURE__ */ s(d, {
161
+ className: "h-3.5 w-3.5",
162
+ "aria-hidden": "true"
163
+ })]
164
+ })]
165
+ })
166
+ ]
167
+ }, r.id);
168
+ }) })
169
+ }, "quick-selector") : null
170
+ })]
171
+ });
172
+ }
173
+ //#endregion
174
+ export { x as BookingBikeQuickAddCard };
@@ -1,7 +1,10 @@
1
- import { BikeProduct } from '../../lib/products';
1
+ import { StorefrontProduct } from '../../lib/products';
2
+ type StorefrontProductWithAvailability = StorefrontProduct & {
3
+ availabilityStatus?: "AVAILABLE" | "LOW_STOCK" | "OUT_OF_STOCK";
4
+ };
2
5
  type BookingBikeVariantDialogProps = {
3
6
  open: boolean;
4
- product: BikeProduct | null;
7
+ product: StorefrontProductWithAvailability | null;
5
8
  onOpenChange: (open: boolean) => void;
6
9
  getVariantAvailabilityLabel?: (variantId: string) => string | null;
7
10
  isVariantOutOfCapacity?: (variantId: string) => boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/BookingBikeVariantDialog/index.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EA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