@loczer/storefront-sdk 0.187.0 → 0.189.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 (66) hide show
  1. package/dist/chunks/booking-engine/dist/models/{Product.shared-CTuk4fiR.js → Product.shared-IYOeC3N7.js} +12 -10
  2. package/dist/chunks/booking-engine/dist/schemas/{base-asset-B_Dm8_Vk.js → base-asset-zsUj5_3O.js} +1 -1
  3. package/dist/chunks/booking-engine/dist/schemas/{base-booking-DW8AEPKo.js → base-booking-TzCge_mR.js} +2 -2
  4. package/dist/chunks/booking-engine/dist/schemas/{base-product-1H8l2aUv.js → base-product-DvFFzAcg.js} +1 -1
  5. package/dist/chunks/booking-engine/dist/schemas/{booking-engine-configuration-D02MRF9U.js → booking-engine-configuration-LnrhShqm.js} +4 -1
  6. package/dist/chunks/booking-engine/dist/schemas/{cart-inputs-j1yWfJxO.js → cart-inputs-B0HpcFe5.js} +1 -1
  7. package/dist/chunks/booking-engine/dist/schemas/{public-booking-engine-configuration-BnJ_H-p1.js → public-booking-engine-configuration-CEM9mexX.js} +1 -1
  8. package/dist/chunks/booking-engine/dist/schemas-BNUzqsci.js +13 -0
  9. package/dist/chunks/ui/dist/Map/{MapContent-QPkuTBvK.js → MapContent-PK-ptOx6.js} +126 -94
  10. package/dist/chunks/ui/dist/Map/mapboxError-oRn0l3EE.js +25 -0
  11. package/dist/chunks/ui/dist/{Map-BXmRf5Ep.js → Map-BwXj49kV.js} +1 -1
  12. package/dist/components/BookingBikeVariantDialog/index.d.ts +2 -1
  13. package/dist/components/BookingBikeVariantDialog/index.d.ts.map +1 -1
  14. package/dist/components/BookingBikeVariantDialog/index.js +39 -38
  15. package/dist/components/BookingPeriodSelector/components/BookingEndTimeField.d.ts.map +1 -1
  16. package/dist/components/BookingPeriodSelector/components/BookingEndTimeField.js +32 -30
  17. package/dist/components/BookingPeriodSelector/components/BookingMobileDateDrawer.d.ts.map +1 -1
  18. package/dist/components/BookingPeriodSelector/components/BookingMobileDateDrawer.js +127 -122
  19. package/dist/components/BookingPeriodSelector/components/BookingStartTimeField.d.ts.map +1 -1
  20. package/dist/components/BookingPeriodSelector/components/BookingStartTimeField.js +32 -30
  21. package/dist/components/BookingPeriodSelector/components/BookingTimeSlotsStatus.d.ts +7 -0
  22. package/dist/components/BookingPeriodSelector/components/BookingTimeSlotsStatus.d.ts.map +1 -0
  23. package/dist/components/BookingPeriodSelector/components/BookingTimeSlotsStatus.js +29 -0
  24. package/dist/components/BookingPeriodSelector/index.d.ts +2 -1
  25. package/dist/components/BookingPeriodSelector/index.d.ts.map +1 -1
  26. package/dist/components/BookingPeriodSelector/index.js +15 -14
  27. package/dist/components/BookingPeriodSelector/useBookingPeriodController.d.ts +11 -0
  28. package/dist/components/BookingPeriodSelector/useBookingPeriodController.d.ts.map +1 -1
  29. package/dist/components/BookingPeriodSelector/useBookingPeriodController.js +280 -216
  30. package/dist/components/ContactSection/index.d.ts.map +1 -1
  31. package/dist/components/ContactSection/index.js +120 -116
  32. package/dist/components/Header/index.d.ts.map +1 -1
  33. package/dist/components/Header/index.js +35 -35
  34. package/dist/components/Map/index.js +1 -1
  35. package/dist/components/StorefrontCancellationPolicyNotice/index.d.ts.map +1 -1
  36. package/dist/components/StorefrontCancellationPolicyNotice/index.js +51 -48
  37. package/dist/components/StorefrontInsuranceNotice/index.d.ts +9 -0
  38. package/dist/components/StorefrontInsuranceNotice/index.d.ts.map +1 -0
  39. package/dist/components/StorefrontInsuranceNotice/index.js +191 -0
  40. package/dist/i18n/en.d.ts +24 -0
  41. package/dist/i18n/en.d.ts.map +1 -1
  42. package/dist/i18n/en.js +26 -2
  43. package/dist/i18n/fr.d.ts +24 -0
  44. package/dist/i18n/fr.d.ts.map +1 -1
  45. package/dist/i18n/fr.js +26 -2
  46. package/dist/index.d.ts +91 -0
  47. package/dist/index.js +69 -68
  48. package/dist/lib/booking.js +2 -2
  49. package/dist/lib/checkoutSubmit.js +3 -3
  50. package/dist/lib/fetchStorefrontTimeSlots.d.ts.map +1 -1
  51. package/dist/lib/fetchStorefrontTimeSlots.js +2 -1
  52. package/dist/lib/storefrontProducts.d.ts +16 -0
  53. package/dist/lib/storefrontProducts.d.ts.map +1 -1
  54. package/dist/lib/storefrontProducts.js +27 -22
  55. package/dist/pages/BookingPage.d.ts.map +1 -1
  56. package/dist/pages/BookingPage.js +109 -95
  57. package/dist/pages/CheckoutPage.d.ts.map +1 -1
  58. package/dist/pages/CheckoutPage.js +229 -231
  59. package/dist/pages/HomePage.d.ts.map +1 -1
  60. package/dist/pages/HomePage.js +339 -314
  61. package/dist/pages/ProductPage.d.ts.map +1 -1
  62. package/dist/pages/ProductPage.js +60 -52
  63. package/dist/storefront.css +1 -1
  64. package/dist/storefrontSchemas.js +2 -2
  65. package/package.json +1 -1
  66. package/dist/chunks/booking-engine/dist/schemas-DftrSnTE.js +0 -13
@@ -33,6 +33,10 @@ var m = o.object({
33
33
  attributes: o.array(h).default([]),
34
34
  identifiers: o.array(m).default([])
35
35
  }), _ = o.object({
36
+ enabled: o.boolean().default(!1),
37
+ pricePerDayMinor: i.default(0),
38
+ deductibleAmountMinor: i.default(0)
39
+ }), v = o.object({
36
40
  _id: e,
37
41
  kind: s,
38
42
  name: r,
@@ -41,12 +45,10 @@ var m = o.object({
41
45
  images: o.array(l).optional(),
42
46
  prices: o.array(a).optional(),
43
47
  depositAmount: i.default(0),
44
- insurance: o.object({
45
- enabled: o.boolean().default(!1),
46
- pricePerDayMinor: i.default(0)
47
- }).default({
48
+ insurance: _.default({
48
49
  enabled: !1,
49
- pricePerDayMinor: 0
50
+ pricePerDayMinor: 0,
51
+ deductibleAmountMinor: 0
50
52
  }),
51
53
  bufferStartMinutes: o.number().int().min(0).optional(),
52
54
  bufferEndMinutes: o.number().int().min(0).optional(),
@@ -54,13 +56,13 @@ var m = o.object({
54
56
  createdAt: t,
55
57
  updatedAt: t,
56
58
  productVariants: o.array(g).min(1)
57
- }), v = _.extend({ features: n.optional() }), y = v.extend({ kind: o.literal("bike") }), b = v.extend({ kind: o.literal("e-bike") }), x = _.extend({
59
+ }), y = v.extend({ features: n.optional() }), b = y.extend({ kind: o.literal("bike") }), x = y.extend({ kind: o.literal("e-bike") }), S = v.extend({
58
60
  kind: o.literal("accessory"),
59
61
  prices: o.array(a)
60
- }), S = o.discriminatedUnion("kind", [
61
- y,
62
+ }), C = o.discriminatedUnion("kind", [
62
63
  b,
63
- x
64
+ x,
65
+ S
64
66
  ]);
65
67
  //#endregion
66
- export { u as PRODUCT_VARIANT_CODE_IDENTIFIER_KIND, d as PRODUCT_VARIANT_CODE_MAX_LENGTH, x as accessoryProductSchema, y as bikeProductSchema, b as eBikeProductSchema, p as isProductVariantCodeIdentifierKind, s as productKindSchema, S as productSchema, c as productStorefrontDisplayModeSchema, h as productVariantAttributeSchema, f as productVariantCodeSchema, m as productVariantIdentifierSchema, g as productVariantSchema };
68
+ export { u as PRODUCT_VARIANT_CODE_IDENTIFIER_KIND, d as PRODUCT_VARIANT_CODE_MAX_LENGTH, S as accessoryProductSchema, b as bikeProductSchema, x as eBikeProductSchema, p as isProductVariantCodeIdentifierKind, _ as productInsuranceSchema, s as productKindSchema, C as productSchema, c as productStorefrontDisplayModeSchema, h as productVariantAttributeSchema, f as productVariantCodeSchema, m as productVariantIdentifierSchema, g as productVariantSchema };
@@ -1,5 +1,5 @@
1
1
  import { booleanNumberRecordSchema as e, identifierSchema as t, isoDateTimeSchema as n } from "../models/types-rIp4ReXN.js";
2
- import { productVariantIdentifierSchema as r } from "../models/Product.shared-CTuk4fiR.js";
2
+ import { productVariantIdentifierSchema as r } from "../models/Product.shared-IYOeC3N7.js";
3
3
  import { z as i } from "zod";
4
4
  //#region ../booking-engine/dist/schemas/base-asset.js
5
5
  var a = i.enum([
@@ -1,8 +1,8 @@
1
1
  import { identifierSchema as e, isoDateTimeSchema as t, objectIdStringSchema as n, ulidStringSchema as r } from "../models/types-rIp4ReXN.js";
2
2
  import { moneyMinorSchema as i } from "./money-CVoCY4of.js";
3
- import { productKindSchema as a } from "../models/Product.shared-CTuk4fiR.js";
3
+ import { productKindSchema as a } from "../models/Product.shared-IYOeC3N7.js";
4
4
  import { richTextSchema as o } from "./rich-text-DTRh7U3z.js";
5
- import { cancellationPolicySchema as s } from "./booking-engine-configuration-D02MRF9U.js";
5
+ import { cancellationPolicySchema as s } from "./booking-engine-configuration-LnrhShqm.js";
6
6
  import { z as c } from "zod";
7
7
  //#region ../booking-engine/dist/schemas/base-booking.js
8
8
  var l = c.enum([
@@ -1,3 +1,3 @@
1
1
  import "../models/LocalizedString-D_TRgAdr.js";
2
2
  import "../models/Price-DCAgqkKh.js";
3
- import "../models/Product.shared-CTuk4fiR.js";
3
+ import "../models/Product.shared-IYOeC3N7.js";
@@ -48,7 +48,10 @@ var a = i.enum([
48
48
  "upToHours"
49
49
  ]
50
50
  });
51
- }), _ = { tiers: [] }, v = i.object({ mode: i.enum([
51
+ }), _ = { tiers: [{
52
+ upToHours: 24,
53
+ refundPercentage: .975
54
+ }] }, v = i.object({ mode: i.enum([
52
55
  "disabled",
53
56
  "optional",
54
57
  "required"
@@ -2,7 +2,7 @@ import { identifierSchema as e } from "../models/types-rIp4ReXN.js";
2
2
  import { moneyMinorSchema as t } from "./money-CVoCY4of.js";
3
3
  import { richTextSchema as n } from "./rich-text-DTRh7U3z.js";
4
4
  import { isoDateSchema as r, timeOfDaySchema as i } from "./shop-opening-hours-BlLD1gfz.js";
5
- import { fulfillmentModeSchema as a } from "./public-booking-engine-configuration-BnJ_H-p1.js";
5
+ import { fulfillmentModeSchema as a } from "./public-booking-engine-configuration-CEM9mexX.js";
6
6
  import { z as o } from "zod";
7
7
  //#region ../booking-engine/dist/schemas/cart-inputs.js
8
8
  var s = o.object({
@@ -1,5 +1,5 @@
1
1
  import { timeOfDaySchema as e } from "./shop-opening-hours-BlLD1gfz.js";
2
- import { bookingEngineConfigurationSchema as t, checkoutConfigurationSchema as n } from "./booking-engine-configuration-D02MRF9U.js";
2
+ import { bookingEngineConfigurationSchema as t, checkoutConfigurationSchema as n } from "./booking-engine-configuration-LnrhShqm.js";
3
3
  import { z as r } from "zod";
4
4
  //#region ../booking-engine/dist/schemas/public-booking-engine-configuration.js
5
5
  var i = r.enum(["pickup", "delivery"]), a = r.object({
@@ -0,0 +1,13 @@
1
+ import { createLocalizedStringEntry as e, getLocalizedStringValue as t, localizedStringArraySchema as n, localizedStringEntrySchema as r, localizedStringSchema as i } from "./models/LocalizedString-D_TRgAdr.js";
2
+ import { currencyCodeSchema as a, currencyMinorUnitDigits as o, majorToMinor as s, minorToMajor as c, moneyMinorSchema as l, signedMoneyMinorSchema as u } from "./schemas/money-CVoCY4of.js";
3
+ import { priceSchema as d, priceUnitSchema as f } from "./models/Price-DCAgqkKh.js";
4
+ import { PRODUCT_VARIANT_CODE_IDENTIFIER_KIND as p, PRODUCT_VARIANT_CODE_MAX_LENGTH as m, accessoryProductSchema as h, bikeProductSchema as g, eBikeProductSchema as _, isProductVariantCodeIdentifierKind as v, productInsuranceSchema as y, productKindSchema as b, productSchema as x, productStorefrontDisplayModeSchema as S, productVariantAttributeSchema as C, productVariantCodeSchema as w, productVariantIdentifierSchema as T, productVariantSchema as E } from "./models/Product.shared-IYOeC3N7.js";
5
+ import { richTextJsonDocSchema as D, richTextSchema as O, richTextVersionSchema as k } from "./schemas/rich-text-DTRh7U3z.js";
6
+ import { isoDateSchema as A, shopConfigurationSchema as j, shopExtraTimeSlotRuleSchema as M, shopOpeningDayIndexSchema as N, shopOpeningDaySchema as P, shopOpeningHoursOverrideSchema as F, shopOpeningHoursPeriodSchema as I, shopOpeningSlotSchema as L, timeOfDaySchema as R } from "./schemas/shop-opening-hours-BlLD1gfz.js";
7
+ import { DEFAULT_CANCELLATION_POLICY as z, DEFAULT_PAYMENT_POLICIES as B, cancellationPolicySchema as V, cancellationPolicyTierSchema as H, paymentPoliciesSchema as U } from "./schemas/booking-engine-configuration-LnrhShqm.js";
8
+ import { fulfillmentModeSchema as W, publicBookingEngineConfigurationSchema as G, publicCheckoutConfigurationSchema as K, publicCheckoutDynamicOptionsSchema as q } from "./schemas/public-booking-engine-configuration-CEM9mexX.js";
9
+ import { DEFAULT_BOOKING_DELIVERY_OPTION as J, bookingCustomerInputSchema as Y, bookingDeliveryOptionSchema as X, bookingScheduleInputSchema as Z, cartItemInputSchema as Q, createBookingInputBaseSchema as $, createBookingInputSchema as ee, resolveBookingDeliveryOption as te, validateBookingDeliveryAddress as ne } from "./schemas/cart-inputs-B0HpcFe5.js";
10
+ import "./schemas/base-product-DvFFzAcg.js";
11
+ import { baseAssetSchema as re, baseAssetStatusSchema as ie } from "./schemas/base-asset-zsUj5_3O.js";
12
+ import { baseBookingItemSchema as ae, baseBookingSchema as oe, baseBookingStateSchema as se } from "./schemas/base-booking-TzCge_mR.js";
13
+ export { J as DEFAULT_BOOKING_DELIVERY_OPTION, z as DEFAULT_CANCELLATION_POLICY, B as DEFAULT_PAYMENT_POLICIES, p as PRODUCT_VARIANT_CODE_IDENTIFIER_KIND, m as PRODUCT_VARIANT_CODE_MAX_LENGTH, h as accessoryProductSchema, re as baseAssetSchema, ie as baseAssetStatusSchema, ae as baseBookingItemSchema, oe as baseBookingSchema, se as baseBookingStateSchema, g as bikeProductSchema, Y as bookingCustomerInputSchema, X as bookingDeliveryOptionSchema, Z as bookingScheduleInputSchema, V as cancellationPolicySchema, H as cancellationPolicyTierSchema, Q as cartItemInputSchema, $ as createBookingInputBaseSchema, ee as createBookingInputSchema, e as createLocalizedStringEntry, a as currencyCodeSchema, o as currencyMinorUnitDigits, _ as eBikeProductSchema, W as fulfillmentModeSchema, t as getLocalizedStringValue, v as isProductVariantCodeIdentifierKind, A as isoDateSchema, n as localizedStringArraySchema, r as localizedStringEntrySchema, i as localizedStringSchema, s as majorToMinor, c as minorToMajor, l as moneyMinorSchema, U as paymentPoliciesSchema, d as priceSchema, f as priceUnitSchema, y as productInsuranceSchema, b as productKindSchema, x as productSchema, S as productStorefrontDisplayModeSchema, C as productVariantAttributeSchema, w as productVariantCodeSchema, T as productVariantIdentifierSchema, E as productVariantSchema, G as publicBookingEngineConfigurationSchema, K as publicCheckoutConfigurationSchema, q as publicCheckoutDynamicOptionsSchema, te as resolveBookingDeliveryOption, D as richTextJsonDocSchema, O as richTextSchema, k as richTextVersionSchema, j as shopConfigurationSchema, M as shopExtraTimeSlotRuleSchema, N as shopOpeningDayIndexSchema, P as shopOpeningDaySchema, F as shopOpeningHoursOverrideSchema, I as shopOpeningHoursPeriodSchema, L as shopOpeningSlotSchema, u as signedMoneyMinorSchema, R as timeOfDaySchema, ne as validateBookingDeliveryAddress };
@@ -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"}