@loczer/storefront-sdk 0.188.0 → 0.190.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 (46) hide show
  1. package/dist/chunks/ui/dist/Map/{MapContent-QPkuTBvK.js → MapContent-PK-ptOx6.js} +126 -94
  2. package/dist/chunks/ui/dist/Map/mapboxError-oRn0l3EE.js +25 -0
  3. package/dist/chunks/ui/dist/{Map-BXmRf5Ep.js → Map-BwXj49kV.js} +1 -1
  4. package/dist/components/BookingBikeVariantDialog/index.d.ts +2 -1
  5. package/dist/components/BookingBikeVariantDialog/index.d.ts.map +1 -1
  6. package/dist/components/BookingBikeVariantDialog/index.js +39 -38
  7. package/dist/components/BookingPeriodSelector/components/BookingEndTimeField.d.ts.map +1 -1
  8. package/dist/components/BookingPeriodSelector/components/BookingEndTimeField.js +32 -30
  9. package/dist/components/BookingPeriodSelector/components/BookingMobileDateDrawer.d.ts.map +1 -1
  10. package/dist/components/BookingPeriodSelector/components/BookingMobileDateDrawer.js +127 -122
  11. package/dist/components/BookingPeriodSelector/components/BookingStartTimeField.d.ts.map +1 -1
  12. package/dist/components/BookingPeriodSelector/components/BookingStartTimeField.js +32 -30
  13. package/dist/components/BookingPeriodSelector/components/BookingTimeSlotsStatus.d.ts +7 -0
  14. package/dist/components/BookingPeriodSelector/components/BookingTimeSlotsStatus.d.ts.map +1 -0
  15. package/dist/components/BookingPeriodSelector/components/BookingTimeSlotsStatus.js +29 -0
  16. package/dist/components/BookingPeriodSelector/index.d.ts +2 -1
  17. package/dist/components/BookingPeriodSelector/index.d.ts.map +1 -1
  18. package/dist/components/BookingPeriodSelector/index.js +15 -14
  19. package/dist/components/BookingPeriodSelector/useBookingPeriodController.d.ts +11 -0
  20. package/dist/components/BookingPeriodSelector/useBookingPeriodController.d.ts.map +1 -1
  21. package/dist/components/BookingPeriodSelector/useBookingPeriodController.js +280 -216
  22. package/dist/components/ContactSection/index.d.ts.map +1 -1
  23. package/dist/components/ContactSection/index.js +120 -116
  24. package/dist/components/Header/index.d.ts.map +1 -1
  25. package/dist/components/Header/index.js +35 -35
  26. package/dist/components/Map/index.js +1 -1
  27. package/dist/i18n/en.d.ts +5 -0
  28. package/dist/i18n/en.d.ts.map +1 -1
  29. package/dist/i18n/en.js +6 -1
  30. package/dist/i18n/fr.d.ts +5 -0
  31. package/dist/i18n/fr.d.ts.map +1 -1
  32. package/dist/i18n/fr.js +6 -1
  33. package/dist/index.d.ts +29 -0
  34. package/dist/index.js +26 -25
  35. package/dist/lib/fetchStorefrontTimeSlots.d.ts.map +1 -1
  36. package/dist/lib/fetchStorefrontTimeSlots.js +2 -1
  37. package/dist/pages/BookingPage.d.ts.map +1 -1
  38. package/dist/pages/BookingPage.js +109 -95
  39. package/dist/pages/CheckoutPage.d.ts.map +1 -1
  40. package/dist/pages/CheckoutPage.js +229 -231
  41. package/dist/pages/HomePage.d.ts.map +1 -1
  42. package/dist/pages/HomePage.js +304 -275
  43. package/dist/pages/ProductPage.d.ts.map +1 -1
  44. package/dist/pages/ProductPage.js +60 -52
  45. package/dist/storefront.css +1 -1
  46. package/package.json +1 -1
@@ -2,100 +2,132 @@ import { cn as e } from "../lib/utils-CoCD4bw8.js";
2
2
  import { __toESM as t } from "../_virtual/_rolldown/runtime-2EUTAT-G.js";
3
3
  import { DEFAULT_MAP_SKELETON_COLOR as n } from "./constants-BNmiJXfg.js";
4
4
  import { DEFAULT_MAP_CENTER as r } from "../static/strings-1T2w7LqX.js";
5
- import { Component as i, useEffect as a, useRef as o, useState as s } from "react";
6
- import { jsx as c, jsxs as l } from "react/jsx-runtime";
5
+ import { classifyMapboxError as i, toSanitizedMapboxError as a } from "./mapboxError-oRn0l3EE.js";
6
+ import { Component as o, useEffect as s, useRef as c, useState as l } from "react";
7
+ import { jsx as u, jsxs as d } from "react/jsx-runtime";
7
8
  //#region ../ui/dist/Map/MapContent.js
8
- var u = null, d = async () => (u ||= Promise.all([import("../node_modules/mapbox-gl/dist/mapbox-gl-Bc31JrDw.js").then((e) => /* @__PURE__ */ t(e.default, 1)), Promise.resolve({})]).then(([e]) => e.default ?? e).catch((e) => {
9
- throw u = null, e;
10
- }), u), f = ({ mapboxToken: t, initialCenter: i = r, initialZoom: u = 11, markers: f = [], routeGeoJson: p, polygonGeoJson: h, routeEndpointsToFetch: g, className: _, style: v, interactive: y = !0, showNavigationControl: b = !0, cooperativeGestures: x = !0, mapStyle: S = "mapbox://styles/pr37capital/cmajla29i003901s9ex09hiw4", onMapLoad: C, onMapMoveOrZoom: w, skeletonColor: T = n }) => {
11
- let E = o(null), D = o(null), [O, k] = s(null), A = o([]), j = o(u), [M, N] = s(null), [P, F] = s(!1), I = o(!1), L = e("relative overflow-clip w-full h-full", _);
12
- return a(() => {
13
- if (!E.current || O) return;
14
- let e = !1, n = null;
9
+ var f = 2, p = 750, m = null, h = async () => (m ||= Promise.all([import("../node_modules/mapbox-gl/dist/mapbox-gl-Bc31JrDw.js").then((e) => /* @__PURE__ */ t(e.default, 1)), Promise.resolve({})]).then(([e]) => e.default ?? e).catch((e) => {
10
+ throw m = null, e;
11
+ }), m), g = ({ mapboxToken: t, initialCenter: o = r, initialZoom: m = 11, markers: g = [], routeGeoJson: _, polygonGeoJson: y, routeEndpointsToFetch: b, className: x, style: S, interactive: C = !0, showNavigationControl: w = !0, cooperativeGestures: T = !0, mapStyle: E = "mapbox://styles/pr37capital/cmajla29i003901s9ex09hiw4", onMapLoad: D, onMapMoveOrZoom: O, skeletonColor: k = n }) => {
12
+ let A = c(null), j = c(null), [M, N] = l(null), P = c([]), F = c(m), [I, L] = l(null), [R, z] = l(!1), B = c(!1), V = e("relative overflow-clip w-full h-full", x);
13
+ return s(() => {
14
+ if (!A.current || M) return;
15
+ let e = !1, n = null, r = 0, s = null, c = !1;
15
16
  return (async () => {
16
17
  if (!t) {
17
- N("Configuration carte manquante (token).");
18
+ L("Configuration carte manquante (token).");
18
19
  return;
19
20
  }
20
21
  try {
21
- let n = await d();
22
+ let n = await h();
22
23
  if (e) return;
23
- if (D.current = n, n.accessToken = t, !(typeof n.supported != "function" || n.supported({ failIfMajorPerformanceCaveat: !0 }))) {
24
- N("La carte n'est pas supportée sur cet appareil.");
24
+ if (j.current = n, n.accessToken = t, !(typeof n.supported != "function" || n.supported({ failIfMajorPerformanceCaveat: !0 }))) {
25
+ L("La carte n'est pas supportée sur cet appareil.");
25
26
  return;
26
27
  }
27
28
  } catch (t) {
28
- e || (console.error("Failed to load Mapbox GL:", t), N("La carte n'est pas supportée sur cet appareil."));
29
+ e || (console.error("Failed to load Mapbox GL:", t), L("La carte n'est pas supportée sur cet appareil."));
29
30
  return;
30
31
  }
31
- if (e || !D.current || !E.current) return;
32
- E.current.hasChildNodes() && E.current.replaceChildren();
32
+ if (e || !j.current || !A.current) return;
33
+ A.current.hasChildNodes() && A.current.replaceChildren();
33
34
  try {
34
- n = new D.current.Map({
35
- container: E.current,
36
- style: S,
37
- center: i,
38
- zoom: u,
35
+ n = new j.current.Map({
36
+ container: A.current,
37
+ style: E,
38
+ center: o,
39
+ zoom: m,
39
40
  attributionControl: !1,
40
- interactive: y,
41
- cooperativeGestures: x,
41
+ interactive: C,
42
+ cooperativeGestures: T,
42
43
  pitchWithRotate: !1,
43
44
  dragRotate: !1,
44
45
  touchPitch: !1,
45
46
  performanceMetricsCollection: !1
46
47
  });
47
48
  } catch (e) {
48
- console.error("Failed to initialize Mapbox map:", e), N("Erreur lors du chargement de la carte.");
49
+ console.error("Failed to initialize Mapbox map:", e), L("Erreur lors du chargement de la carte.");
49
50
  return;
50
51
  }
51
- let r = n;
52
- if (r.on("error", (e) => {
53
- console.error("Mapbox map error event:", e?.error || e);
54
- try {
55
- r.remove();
56
- } catch (e) {
57
- console.error("Error removing failed map instance:", e);
52
+ let l = n, u = () => {
53
+ s !== null && (window.clearTimeout(s), s = null);
54
+ }, d = (t) => {
55
+ if (!(e || c)) {
56
+ c = !0, u(), console.error("Fatal Mapbox map error:", t);
57
+ try {
58
+ l.remove();
59
+ } catch (e) {
60
+ console.warn("Failed to remove unusable Mapbox map instance:", e);
61
+ }
62
+ n = null, N(null), L("Erreur lors du chargement de la carte.");
58
63
  }
59
- k(null), N("Erreur lors du chargement de la carte.");
60
- }), r.touchZoomRotate?.disableRotation?.(), b) {
61
- let e = new m({ showCompass: !1 });
62
- r.addControl(e, "bottom-right");
64
+ };
65
+ if (l.on("error", (t) => {
66
+ if (e || c) return;
67
+ let n = i(t), o = a(t);
68
+ if (n === "recoverable") {
69
+ console.warn("Recoverable Mapbox resource error; keeping the map mounted:", o);
70
+ return;
71
+ }
72
+ if (n === "fatal") {
73
+ d(o);
74
+ return;
75
+ }
76
+ if (s !== null) return;
77
+ if (r >= f) {
78
+ d(/* @__PURE__ */ Error(`Mapbox style failed after ${f} retries: ${o.message}`));
79
+ return;
80
+ }
81
+ r += 1;
82
+ let u = p * 2 ** (r - 1);
83
+ console.warn(`Transient Mapbox style error; retrying in ${u}ms:`, o), s = window.setTimeout(() => {
84
+ if (s = null, !(e || c)) try {
85
+ l.setStyle(E);
86
+ } catch (e) {
87
+ d(a(e));
88
+ }
89
+ }, u);
90
+ }), l.on("style.load", () => {
91
+ r = 0, u();
92
+ }), l.touchZoomRotate?.disableRotation?.(), w) {
93
+ let e = new v({ showCompass: !1 });
94
+ l.addControl(e, "bottom-right");
63
95
  }
64
- let a = () => {
65
- I.current || (I.current = !0, F(!0));
96
+ let g = () => {
97
+ B.current || (B.current = !0, z(!0));
66
98
  };
67
- r.on("load", () => {
68
- k(r), C && C(r), typeof r.areTilesLoaded == "function" && r.areTilesLoaded() ? a() : r.once("idle", a);
99
+ l.on("load", () => {
100
+ e || c || (N(l), D && D(l), typeof l.areTilesLoaded == "function" && l.areTilesLoaded() ? g() : l.once("idle", g));
69
101
  });
70
102
  })(), () => {
71
- e = !0;
103
+ e = !0, s !== null && window.clearTimeout(s);
72
104
  try {
73
105
  n?.remove();
74
106
  } catch (e) {
75
107
  console.error("Error removing map instance on unmount:", e);
76
108
  }
77
109
  };
78
- }, []), a(() => {
79
- O || (F(!1), I.current = !1);
80
- }, [O]), a(() => {
81
- if (!O || !w) return;
82
- let e = () => w(O);
83
- return O.on("moveend", e), O.on("zoomend", e), () => {
84
- O.off("moveend", e), O.off("zoomend", e);
110
+ }, []), s(() => {
111
+ M || (z(!1), B.current = !1);
112
+ }, [M]), s(() => {
113
+ if (!M || !O) return;
114
+ let e = () => O(M);
115
+ return M.on("moveend", e), M.on("zoomend", e), () => {
116
+ M.off("moveend", e), M.off("zoomend", e);
85
117
  };
86
- }, [O, w]), a(() => {
87
- O && u !== j.current && (O.setZoom(u), j.current = u);
88
- }, [u, O]), a(() => {
89
- let e = D.current;
90
- !O || !e || (A.current.forEach((e) => e.remove()), A.current = [], f.forEach((t) => {
118
+ }, [M, O]), s(() => {
119
+ M && m !== F.current && (M.setZoom(m), F.current = m);
120
+ }, [m, M]), s(() => {
121
+ let e = j.current;
122
+ !M || !e || (P.current.forEach((e) => e.remove()), P.current = [], g.forEach((t) => {
91
123
  let n = {};
92
124
  t.element ? n.element = t.element : n.color = t.color || "#3FB1CE", t.offset && (n.offset = t.offset);
93
- let r = new e.Marker(n).setLngLat(t.coords).addTo(O);
125
+ let r = new e.Marker(n).setLngLat(t.coords).addTo(M);
94
126
  if (t.popupHTML) {
95
127
  let n = { offset: 25 };
96
128
  t.popupCloseButton === !1 && (n.closeButton = !1);
97
129
  let i = new e.Popup(n).setHTML(t.popupHTML), a, o = () => {
98
- clearTimeout(a), i.isOpen() || i.setLngLat(t.coords).addTo(O);
130
+ clearTimeout(a), i.isOpen() || i.setLngLat(t.coords).addTo(M);
99
131
  }, s = () => {
100
132
  a = setTimeout(() => {
101
133
  i.remove();
@@ -106,15 +138,15 @@ var u = null, d = async () => (u ||= Promise.all([import("../node_modules/mapbox
106
138
  e && (e.addEventListener("mouseenter", o), e.addEventListener("mouseleave", s));
107
139
  });
108
140
  }
109
- A.current.push(r);
141
+ P.current.push(r);
110
142
  }));
111
- }, [O, f]), a(() => {
112
- if (!O || !O.isStyleLoaded()) return;
143
+ }, [M, g]), s(() => {
144
+ if (!M || !M.isStyleLoaded()) return;
113
145
  let e = "route-geojson-direct", t = "route-layer-direct";
114
- O.getLayer(t) && O.removeLayer(t), O.getSource(e) && O.removeSource(e), p && (O.addSource(e, {
146
+ M.getLayer(t) && M.removeLayer(t), M.getSource(e) && M.removeSource(e), _ && (M.addSource(e, {
115
147
  type: "geojson",
116
- data: p
117
- }), O.addLayer({
148
+ data: _
149
+ }), M.addLayer({
118
150
  id: t,
119
151
  type: "line",
120
152
  source: e,
@@ -128,13 +160,13 @@ var u = null, d = async () => (u ||= Promise.all([import("../node_modules/mapbox
128
160
  "line-opacity": .75
129
161
  }
130
162
  }));
131
- }, [O, p]), a(() => {
132
- if (!O || !O.isStyleLoaded()) return;
163
+ }, [M, _]), s(() => {
164
+ if (!M || !M.isStyleLoaded()) return;
133
165
  let e = "polygon-data", t = "polygon-fill-layer", n = "polygon-line-layer";
134
- O.getLayer(t) && O.removeLayer(t), O.getLayer(n) && O.removeLayer(n), O.getSource(e) && O.removeSource(e), h && (O.addSource(e, {
166
+ M.getLayer(t) && M.removeLayer(t), M.getLayer(n) && M.removeLayer(n), M.getSource(e) && M.removeSource(e), y && (M.addSource(e, {
135
167
  type: "geojson",
136
- data: h
137
- }), O.addLayer({
168
+ data: y
169
+ }), M.addLayer({
138
170
  id: t,
139
171
  type: "fill",
140
172
  source: e,
@@ -150,7 +182,7 @@ var u = null, d = async () => (u ||= Promise.all([import("../node_modules/mapbox
150
182
  .2
151
183
  ]
152
184
  }
153
- }), O.addLayer({
185
+ }), M.addLayer({
154
186
  id: n,
155
187
  type: "line",
156
188
  source: e,
@@ -167,9 +199,9 @@ var u = null, d = async () => (u ||= Promise.all([import("../node_modules/mapbox
167
199
  ]
168
200
  }
169
201
  }));
170
- }, [O, h]), a(() => {
171
- if (!O || !O.isStyleLoaded() || !g || g.coordinates.length < 2) return;
172
- let { profile: e = "cycling", coordinates: n } = g, r = "route-fetched", i = "route-layer-fetched";
202
+ }, [M, y]), s(() => {
203
+ if (!M || !M.isStyleLoaded() || !b || b.coordinates.length < 2) return;
204
+ let { profile: e = "cycling", coordinates: n } = b, r = "route-fetched", i = "route-layer-fetched";
173
205
  return (async () => {
174
206
  if (!t) return;
175
207
  let a = n.map((e) => {
@@ -187,10 +219,10 @@ var u = null, d = async () => (u ||= Promise.all([import("../node_modules/mapbox
187
219
  let t = await e.json();
188
220
  if (t.routes && t.routes.length > 0) {
189
221
  let e = t.routes[0].geometry;
190
- O.getLayer(i) && O.removeLayer(i), O.getSource(r) && O.removeSource(r), O.addSource(r, {
222
+ M.getLayer(i) && M.removeLayer(i), M.getSource(r) && M.removeSource(r), M.addSource(r, {
191
223
  type: "geojson",
192
224
  data: e
193
- }), O.addLayer({
225
+ }), M.addLayer({
194
226
  id: i,
195
227
  type: "line",
196
228
  source: r,
@@ -209,31 +241,31 @@ var u = null, d = async () => (u ||= Promise.all([import("../node_modules/mapbox
209
241
  console.error("Failed to fetch route from Mapbox:", e);
210
242
  }
211
243
  })(), () => {
212
- O && O.isStyleLoaded() && (O.getLayer(i) && O.removeLayer(i), O.getSource(r) && O.removeSource(r));
244
+ M && M.isStyleLoaded() && (M.getLayer(i) && M.removeLayer(i), M.getSource(r) && M.removeSource(r));
213
245
  };
214
- }, [O, g]), M ? /* @__PURE__ */ c("div", {
215
- className: L,
216
- style: v,
217
- children: /* @__PURE__ */ c("div", {
246
+ }, [M, b]), I ? /* @__PURE__ */ u("div", {
247
+ className: V,
248
+ style: S,
249
+ children: /* @__PURE__ */ u("div", {
218
250
  className: e("flex h-full w-full items-center justify-center text-center text-sm text-gray-500"),
219
- children: M
251
+ children: I
220
252
  })
221
- }) : /* @__PURE__ */ l("div", {
222
- className: L,
223
- style: v,
224
- children: [/* @__PURE__ */ c("div", {
253
+ }) : /* @__PURE__ */ d("div", {
254
+ className: V,
255
+ style: S,
256
+ children: [/* @__PURE__ */ u("div", {
225
257
  "aria-hidden": "true",
226
- className: e("absolute inset-0 transition-opacity duration-500 ease-out", P ? "pointer-events-none opacity-0" : "opacity-100"),
227
- children: /* @__PURE__ */ c("div", {
258
+ className: e("absolute inset-0 transition-opacity duration-500 ease-out", R ? "pointer-events-none opacity-0" : "opacity-100"),
259
+ children: /* @__PURE__ */ u("div", {
228
260
  className: "h-full w-full",
229
- style: { backgroundColor: T }
261
+ style: { backgroundColor: k }
230
262
  })
231
- }), /* @__PURE__ */ c("div", {
232
- ref: E,
233
- className: e("h-full w-full transition-opacity duration-500 ease-out", P ? "opacity-100" : "pointer-events-none opacity-0")
263
+ }), /* @__PURE__ */ u("div", {
264
+ ref: A,
265
+ className: e("h-full w-full transition-opacity duration-500 ease-out", R ? "opacity-100" : "pointer-events-none opacity-0")
234
266
  })]
235
267
  });
236
- }, p = class extends i {
268
+ }, _ = class extends o {
237
269
  constructor(e) {
238
270
  super(e), this.state = { hasError: !1 };
239
271
  }
@@ -245,16 +277,16 @@ var u = null, d = async () => (u ||= Promise.all([import("../node_modules/mapbox
245
277
  }
246
278
  render() {
247
279
  let t = e("overflow-clip w-full h-full", this.props.className);
248
- return this.state.hasError ? /* @__PURE__ */ c("div", {
280
+ return this.state.hasError ? /* @__PURE__ */ u("div", {
249
281
  className: t,
250
282
  style: this.props.style,
251
- children: /* @__PURE__ */ c("div", {
283
+ children: /* @__PURE__ */ u("div", {
252
284
  className: e("flex h-full w-full items-center justify-center text-center text-sm text-gray-500"),
253
285
  children: "Erreur lors du chargement de la carte."
254
286
  })
255
287
  }) : this.props.children;
256
288
  }
257
- }, m = class {
289
+ }, v = class {
258
290
  options;
259
291
  container = null;
260
292
  map = null;
@@ -298,10 +330,10 @@ var u = null, d = async () => (u ||= Promise.all([import("../node_modules/mapbox
298
330
  let n = Math.abs(e) < .01 && Math.abs(t) < .01;
299
331
  this.compassButton.classList.toggle("opacity-60", n);
300
332
  };
301
- }, h = (e) => /* @__PURE__ */ c(p, {
333
+ }, y = (e) => /* @__PURE__ */ u(_, {
302
334
  className: e.className,
303
335
  style: e.style,
304
- children: /* @__PURE__ */ c(f, { ...e })
336
+ children: /* @__PURE__ */ u(g, { ...e })
305
337
  });
306
338
  //#endregion
307
- export { h as default };
339
+ export { y as default };
@@ -0,0 +1,25 @@
1
+ //#region ../ui/dist/Map/mapboxError.js
2
+ var e = (e) => typeof e == "object" && e && "error" in e ? e.error : e, t = (t) => {
3
+ let n = e(t);
4
+ if (n instanceof Error) return n.message;
5
+ if (typeof n == "string") return n;
6
+ if (typeof n == "object" && n && "message" in n) {
7
+ let e = n.message;
8
+ if (typeof e == "string") return e;
9
+ }
10
+ return String(n ?? "Unknown Mapbox error");
11
+ }, n = (e) => e.replace(/([?&]access_token=)[^&\s]+/gi, "$1[redacted]"), r = (e) => {
12
+ let n = t(e).toLowerCase();
13
+ if (/\.(?:pbf|png|jpe?g|webp)(?:\?|$)/i.test(n) || n.includes("/fonts/") || n.includes("/sprites/")) return "recoverable";
14
+ let r = n.includes("/styles/v1/") || n.includes("style"), i = /load failed|failed to load|failed to fetch|network\s?error|timed?\s*out|connection/i.test(n);
15
+ if (r && i) return "retry-style";
16
+ let a = /invalid access token|access token.*(?:invalid|missing)|unauthori[sz]ed|forbidden/i.test(n), o = r && /(?:not found|does not exist|invalid|parse|http status (?:401|403|404))/i.test(n);
17
+ return a || o ? "fatal" : "recoverable";
18
+ }, i = (r) => {
19
+ let i = e(r), a = n(t(i));
20
+ if (i instanceof Error && a === i.message) return i;
21
+ let o = Error(a);
22
+ return i instanceof Error && (o.name = i.name), o;
23
+ };
24
+ //#endregion
25
+ export { r as classifyMapboxError, i as toSanitizedMapboxError };
@@ -14,7 +14,7 @@ var l = ({ className: t, style: n, color: r }) => /* @__PURE__ */ c("div", {
14
14
  style: { backgroundColor: r ?? "rgb(201 221 176)" }
15
15
  })
16
16
  }), /* @__PURE__ */ s("div", { className: "h-full w-full transition-opacity duration-500 ease-out pointer-events-none opacity-0" })]
17
- }), u = r(() => import("./Map/MapContent-QPkuTBvK.js")), d = (e) => {
17
+ }), u = r(() => import("./Map/MapContent-PK-ptOx6.js")), d = (e) => {
18
18
  let r = a(null), [c, d] = o(!1);
19
19
  i(() => {
20
20
  if (t()) return;
@@ -5,8 +5,9 @@ type BookingBikeVariantDialogProps = {
5
5
  onOpenChange: (open: boolean) => void;
6
6
  getVariantAvailabilityLabel?: (variantId: string) => string | null;
7
7
  isVariantOutOfCapacity?: (variantId: string) => boolean;
8
+ addDisabled?: boolean;
8
9
  onAddVariant: (variantId: string, quantity: number) => void;
9
10
  };
10
- export declare function BookingBikeVariantDialog({ open, product, onOpenChange, getVariantAvailabilityLabel, isVariantOutOfCapacity, onAddVariant, }: BookingBikeVariantDialogProps): import("react/jsx-runtime").JSX.Element | null;
11
+ export declare function BookingBikeVariantDialog({ open, product, onOpenChange, getVariantAvailabilityLabel, isVariantOutOfCapacity, addDisabled, onAddVariant, }: BookingBikeVariantDialogProps): import("react/jsx-runtime").JSX.Element | null;
11
12
  export {};
12
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/BookingBikeVariantDialog/index.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAarD,KAAK,6BAA6B,GAAG;IACnC,IAAI,EAAE,OAAO,CAAA;IACb,OAAO,EAAE,WAAW,GAAG,IAAI,CAAA;IAC3B,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,2BAA2B,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAA;IAClE,sBAAsB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAA;IACvD,YAAY,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;CAC5D,CAAA;AAED,wBAAgB,wBAAwB,CAAC,EACvC,IAAI,EACJ,OAAO,EACP,YAAY,EACZ,2BAA2B,EAC3B,sBAAsB,EACtB,YAAY,GACb,EAAE,6BAA6B,kDAqN/B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/BookingBikeVariantDialog/index.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAarD,KAAK,6BAA6B,GAAG;IACnC,IAAI,EAAE,OAAO,CAAA;IACb,OAAO,EAAE,WAAW,GAAG,IAAI,CAAA;IAC3B,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,2BAA2B,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAA;IAClE,sBAAsB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAA;IACvD,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,YAAY,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;CAC5D,CAAA;AAED,wBAAgB,wBAAwB,CAAC,EACvC,IAAI,EACJ,OAAO,EACP,YAAY,EACZ,2BAA2B,EAC3B,sBAAsB,EACtB,WAAmB,EACnB,YAAY,GACb,EAAE,6BAA6B,kDAsN/B"}
@@ -16,17 +16,17 @@ import { useMediaQuery as C } from "@rpcbase/client";
16
16
  import { useTranslation as w } from "react-i18next";
17
17
  import { Bike as T, CheckCircle2 as E, Plus as D } from "lucide-react";
18
18
  //#region src/components/BookingBikeVariantDialog/index.tsx
19
- function O({ open: p, product: O, onOpenChange: A, getVariantAvailabilityLabel: j, isVariantOutOfCapacity: M, onAddVariant: N }) {
20
- let { t: P, i18n: F } = w(), I = C(o), L = m(), [R, z] = y({});
19
+ function O({ open: p, product: O, onOpenChange: A, getVariantAvailabilityLabel: j, isVariantOutOfCapacity: M, addDisabled: N = !1, onAddVariant: P }) {
20
+ let { t: F, i18n: I } = w(), L = C(o), R = m(), [z, B] = y({});
21
21
  if (v(() => {
22
- !O || !p || z((O.productVariants ?? []).reduce((e, t) => (e[t.id] = 1, e), {}));
22
+ !O || !p || B((O.productVariants ?? []).reduce((e, t) => (e[t.id] = 1, e), {}));
23
23
  }, [p, O]), !O) return null;
24
- let B = (e, t) => {
25
- z((n) => ({
24
+ let V = (e, t) => {
25
+ B((n) => ({
26
26
  ...n,
27
27
  [e]: Math.max(1, Math.floor(t))
28
28
  }));
29
- }, V = r(O.name, F.language, L), H = r(O.description, F.language, L), U = r(O.warning, F.language, L), W = typeof O.images?.[0] == "string" ? O.images[0].trim() : "", G = _(O.primaryImageStyle), K = n(O.availabilityStatus), q = O.features?.slice(0, 4) ?? [], J = O.productVariants ?? [], Y = J.some((t) => !!e(t, "size")) ? P("product_size_label") : P("product_variant_label");
29
+ }, H = r(O.name, I.language, R), U = r(O.description, I.language, R), W = r(O.warning, I.language, R), G = typeof O.images?.[0] == "string" ? O.images[0].trim() : "", K = _(O.primaryImageStyle), q = n(O.availabilityStatus), J = O.features?.slice(0, 4) ?? [], Y = O.productVariants ?? [], X = Y.some((t) => !!e(t, "size")) ? F("product_size_label") : F("product_variant_label");
30
30
  return /* @__PURE__ */ b(s, {
31
31
  open: p,
32
32
  onOpenChange: A,
@@ -43,10 +43,10 @@ function O({ open: p, product: O, onOpenChange: A, getVariantAvailabilityLabel:
43
43
  className: "border-b border-slate-200 px-5 py-4 text-left sm:px-6",
44
44
  children: [/* @__PURE__ */ b(f, {
45
45
  className: "text-left text-lg font-semibold text-slate-950",
46
- children: /* @__PURE__ */ b("span", { children: V })
46
+ children: /* @__PURE__ */ b("span", { children: H })
47
47
  }), /* @__PURE__ */ b(l, {
48
48
  className: "line-clamp-2 text-left text-sm text-slate-600",
49
- children: /* @__PURE__ */ b("span", { children: H })
49
+ children: /* @__PURE__ */ b("span", { children: U })
50
50
  })]
51
51
  }),
52
52
  /* @__PURE__ */ b("div", {
@@ -57,11 +57,11 @@ function O({ open: p, product: O, onOpenChange: A, getVariantAvailabilityLabel:
57
57
  className: "grid gap-4",
58
58
  children: [
59
59
  /* @__PURE__ */ b("div", {
60
- className: S("relative aspect-[1618/1000] overflow-hidden rounded-2xl", G.className),
61
- style: G.style,
62
- children: W ? /* @__PURE__ */ b("img", {
63
- src: W,
64
- alt: V,
60
+ className: S("relative aspect-[1618/1000] overflow-hidden rounded-2xl", K.className),
61
+ style: K.style,
62
+ children: G ? /* @__PURE__ */ b("img", {
63
+ src: G,
64
+ alt: H,
65
65
  className: "absolute inset-0 h-full w-full object-contain p-2",
66
66
  loading: "lazy"
67
67
  }) : /* @__PURE__ */ b("div", {
@@ -72,46 +72,46 @@ function O({ open: p, product: O, onOpenChange: A, getVariantAvailabilityLabel:
72
72
  })
73
73
  })
74
74
  }),
75
- I ? null : /* @__PURE__ */ x("div", {
75
+ L ? null : /* @__PURE__ */ x("div", {
76
76
  className: "flex flex-wrap items-center gap-2",
77
77
  children: [/* @__PURE__ */ b(i, {
78
- variant: K.variant,
79
- children: /* @__PURE__ */ b("span", { children: P(K.labelKey) })
78
+ variant: q.variant,
79
+ children: /* @__PURE__ */ b("span", { children: F(q.labelKey) })
80
80
  }), /* @__PURE__ */ b(g, { prices: O.prices })]
81
81
  }),
82
- !I && q.length > 0 ? /* @__PURE__ */ x("div", {
82
+ !L && J.length > 0 ? /* @__PURE__ */ x("div", {
83
83
  className: "grid gap-2",
84
84
  children: [/* @__PURE__ */ b("p", {
85
85
  className: "text-sm font-semibold text-slate-950",
86
- children: /* @__PURE__ */ b("span", { children: P("product_features_title") })
86
+ children: /* @__PURE__ */ b("span", { children: F("product_features_title") })
87
87
  }), /* @__PURE__ */ b("ul", {
88
88
  className: "grid gap-1.5 text-sm text-slate-700",
89
- children: q.map((e, t) => /* @__PURE__ */ x("li", {
89
+ children: J.map((e, t) => /* @__PURE__ */ x("li", {
90
90
  className: "inline-flex items-start gap-2",
91
91
  children: [/* @__PURE__ */ b(E, {
92
92
  className: "mt-0.5 h-4 w-4 text-success",
93
93
  "aria-hidden": "true"
94
- }), /* @__PURE__ */ b("span", { children: r(e, F.language, L) })]
94
+ }), /* @__PURE__ */ b("span", { children: r(e, I.language, R) })]
95
95
  }, `${O.id}-${t}`))
96
96
  })]
97
97
  }) : null,
98
- I ? null : /* @__PURE__ */ b(h, { warning: U })
98
+ L ? null : /* @__PURE__ */ b(h, { warning: W })
99
99
  ]
100
100
  }), /* @__PURE__ */ x("div", {
101
101
  className: "grid content-start gap-3",
102
102
  children: [
103
- I ? /* @__PURE__ */ x("div", {
103
+ L ? /* @__PURE__ */ x("div", {
104
104
  className: "flex flex-wrap items-center gap-2",
105
105
  children: [/* @__PURE__ */ b(i, {
106
- variant: K.variant,
107
- children: /* @__PURE__ */ b("span", { children: P(K.labelKey) })
106
+ variant: q.variant,
107
+ children: /* @__PURE__ */ b("span", { children: F(q.labelKey) })
108
108
  }), /* @__PURE__ */ b(g, { prices: O.prices })]
109
109
  }) : null,
110
- I && q.length > 0 ? /* @__PURE__ */ x("details", {
110
+ L && J.length > 0 ? /* @__PURE__ */ x("details", {
111
111
  className: "group rounded-2xl border border-slate-200 bg-slate-50",
112
112
  children: [/* @__PURE__ */ x("summary", {
113
113
  className: "flex cursor-pointer list-none items-center justify-between gap-3 px-3 py-2.5 text-sm font-semibold text-slate-950 [&::-webkit-details-marker]:hidden",
114
- children: [/* @__PURE__ */ b("span", { children: P("product_features_title") }), /* @__PURE__ */ b(D, {
114
+ children: [/* @__PURE__ */ b("span", { children: F("product_features_title") }), /* @__PURE__ */ b(D, {
115
115
  className: "h-4 w-4 shrink-0 transition-transform group-open:rotate-45",
116
116
  "aria-hidden": "true"
117
117
  })]
@@ -119,25 +119,25 @@ function O({ open: p, product: O, onOpenChange: A, getVariantAvailabilityLabel:
119
119
  className: "border-t border-slate-200 px-3 py-3",
120
120
  children: /* @__PURE__ */ b("ul", {
121
121
  className: "grid gap-1.5 text-sm text-slate-700",
122
- children: q.map((e, t) => /* @__PURE__ */ x("li", {
122
+ children: J.map((e, t) => /* @__PURE__ */ x("li", {
123
123
  className: "inline-flex items-start gap-2",
124
124
  children: [/* @__PURE__ */ b(E, {
125
125
  className: "mt-0.5 h-4 w-4 text-success",
126
126
  "aria-hidden": "true"
127
- }), /* @__PURE__ */ b("span", { children: r(e, F.language, L) })]
127
+ }), /* @__PURE__ */ b("span", { children: r(e, I.language, R) })]
128
128
  }, `${O.id}-mobile-${t}`))
129
129
  })
130
130
  })]
131
131
  }) : null,
132
- I ? /* @__PURE__ */ b(h, { warning: U }) : null,
132
+ L ? /* @__PURE__ */ b(h, { warning: W }) : null,
133
133
  /* @__PURE__ */ b("p", {
134
134
  className: "text-2xs font-medium uppercase tracking-[0.18em] text-slate-500",
135
- children: /* @__PURE__ */ b("span", { children: Y })
135
+ children: /* @__PURE__ */ b("span", { children: X })
136
136
  }),
137
137
  /* @__PURE__ */ b("div", {
138
138
  className: "grid gap-2",
139
- children: J.map((e) => {
140
- let n = `storefront-booking-bike-dialog-variant-option-${O.id}-${e.id}`.toLowerCase(), { label: r, description: o } = t(e), s = R[e.id] ?? 1, c = M?.(e.id) === !0, l = j?.(e.id) ?? null;
139
+ children: Y.map((e) => {
140
+ let n = `storefront-booking-bike-dialog-variant-option-${O.id}-${e.id}`.toLowerCase(), { label: r, description: o } = t(e), s = z[e.id] ?? 1, c = M?.(e.id) === !0, l = j?.(e.id) ?? null;
141
141
  return /* @__PURE__ */ x("div", {
142
142
  "data-testid": n,
143
143
  className: S("flex flex-col gap-3 rounded-2xl border p-3 sm:flex-row sm:items-center sm:justify-between", "border-slate-200 bg-slate-50"),
@@ -164,18 +164,19 @@ function O({ open: p, product: O, onOpenChange: A, getVariantAvailabilityLabel:
164
164
  className: "flex flex-wrap items-center gap-2 sm:justify-end",
165
165
  children: [/* @__PURE__ */ b(k, {
166
166
  quantity: s,
167
- decreaseAriaLabel: P("decrease_quantity"),
168
- increaseAriaLabel: P("increase_quantity"),
169
- onQuantityChange: (t) => B(e.id, t),
167
+ decreaseAriaLabel: F("decrease_quantity"),
168
+ increaseAriaLabel: F("increase_quantity"),
169
+ onQuantityChange: (t) => V(e.id, t),
170
170
  testIdPrefix: `storefront-booking-bike-dialog-variant-quantity-${O.id}-${e.id}`.toLowerCase()
171
171
  }), /* @__PURE__ */ x(a, {
172
172
  type: "button",
173
173
  className: "gap-1.5 rounded-xl",
174
174
  "data-testid": `storefront-booking-bike-dialog-variant-add-${O.id}-${e.id}`.toLowerCase(),
175
+ disabled: N,
175
176
  onClick: () => {
176
- N(e.id, s);
177
+ P(e.id, s);
177
178
  },
178
- children: [/* @__PURE__ */ b("span", { children: P("add_short") }), /* @__PURE__ */ b(D, {
179
+ children: [/* @__PURE__ */ b("span", { children: F("add_short") }), /* @__PURE__ */ b(D, {
179
180
  className: "h-4 w-4",
180
181
  "aria-hidden": "true"
181
182
  })]
@@ -195,7 +196,7 @@ function O({ open: p, product: O, onOpenChange: A, getVariantAvailabilityLabel:
195
196
  variant: "outline",
196
197
  className: "h-11 w-full rounded-xl sm:w-auto",
197
198
  onClick: () => A(!1),
198
- children: /* @__PURE__ */ b("span", { children: P("close_modal") })
199
+ children: /* @__PURE__ */ b("span", { children: F("close_modal") })
199
200
  })
200
201
  })
201
202
  ]
@@ -1 +1 @@
1
- {"version":3,"file":"BookingEndTimeField.d.ts","sourceRoot":"","sources":["../../../../src/components/BookingPeriodSelector/components/BookingEndTimeField.tsx"],"names":[],"mappings":"AAmBA,eAAO,MAAM,mBAAmB,+CA8J/B,CAAA"}
1
+ {"version":3,"file":"BookingEndTimeField.d.ts","sourceRoot":"","sources":["../../../../src/components/BookingPeriodSelector/components/BookingEndTimeField.tsx"],"names":[],"mappings":"AAmBA,eAAO,MAAM,mBAAmB,+CA6K/B,CAAA"}