@loczer/storefront-sdk 0.207.0 → 0.209.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 (62) hide show
  1. package/dist/StorefrontContext.d.ts +89 -0
  2. package/dist/StorefrontContext.d.ts.map +1 -1
  3. package/dist/StorefrontContext.js +8 -1
  4. package/dist/StorefrontProvider.d.ts +84 -0
  5. package/dist/StorefrontProvider.d.ts.map +1 -1
  6. package/dist/StorefrontProvider.js +55 -41
  7. package/dist/chunks/pkg/ui/dist/Map/{MapContent-CDeWtwKa.js → MapContent-TzYCv8ji.js} +109 -108
  8. package/dist/chunks/pkg/ui/dist/Map/constants-dF2KdJZy.js +8 -0
  9. package/dist/chunks/pkg/ui/dist/{Map-Cs7wgtH9.js → Map-ZM-ZOU9P.js} +1 -1
  10. package/dist/components/BookingBikeVariantDialog/index.js +15 -15
  11. package/dist/components/ContactSection/index.js +9 -9
  12. package/dist/components/Header/index.d.ts.map +1 -1
  13. package/dist/components/Header/index.js +72 -66
  14. package/dist/components/Itineraries/ItinerariesSection.d.ts +2 -0
  15. package/dist/components/Itineraries/ItinerariesSection.d.ts.map +1 -0
  16. package/dist/components/Itineraries/ItinerariesSection.js +81 -0
  17. package/dist/components/Itineraries/ItineraryListItem.d.ts +9 -0
  18. package/dist/components/Itineraries/ItineraryListItem.d.ts.map +1 -0
  19. package/dist/components/Itineraries/ItineraryListItem.js +100 -0
  20. package/dist/components/Itineraries/ItineraryRouteMap.d.ts +10 -0
  21. package/dist/components/Itineraries/ItineraryRouteMap.d.ts.map +1 -0
  22. package/dist/components/Itineraries/ItineraryRouteMap.js +67 -0
  23. package/dist/components/Itineraries/index.d.ts +4 -0
  24. package/dist/components/Itineraries/index.d.ts.map +1 -0
  25. package/dist/components/Itineraries/index.js +4 -0
  26. package/dist/components/Map/index.d.ts +12 -0
  27. package/dist/components/Map/index.d.ts.map +1 -1
  28. package/dist/components/Map/index.js +1 -1
  29. package/dist/components/StorefrontCancellationPolicyNotice/index.js +1 -1
  30. package/dist/i18n/en.d.ts +31 -0
  31. package/dist/i18n/en.d.ts.map +1 -1
  32. package/dist/i18n/en.js +31 -0
  33. package/dist/i18n/fr.d.ts +31 -0
  34. package/dist/i18n/fr.d.ts.map +1 -1
  35. package/dist/i18n/fr.js +31 -0
  36. package/dist/index.d.ts +763 -0
  37. package/dist/index.js +58 -51
  38. package/dist/lib/itineraryPresentation.d.ts +14 -0
  39. package/dist/lib/itineraryPresentation.d.ts.map +1 -0
  40. package/dist/lib/itineraryPresentation.js +26 -0
  41. package/dist/lib/storefrontItineraries.d.ts +418 -0
  42. package/dist/lib/storefrontItineraries.d.ts.map +1 -0
  43. package/dist/lib/storefrontItineraries.js +81 -0
  44. package/dist/pages/BookingPage.js +8 -8
  45. package/dist/pages/CheckoutPage.js +5 -5
  46. package/dist/pages/HomePage.d.ts.map +1 -1
  47. package/dist/pages/HomePage.js +111 -108
  48. package/dist/pages/ItinerariesPage.d.ts +2 -0
  49. package/dist/pages/ItinerariesPage.d.ts.map +1 -0
  50. package/dist/pages/ItinerariesPage.js +76 -0
  51. package/dist/pages/ItineraryDetailsPage.d.ts +66 -0
  52. package/dist/pages/ItineraryDetailsPage.d.ts.map +1 -0
  53. package/dist/pages/ItineraryDetailsPage.js +223 -0
  54. package/dist/pages/ProductPage.js +6 -6
  55. package/dist/pages/itineraries/ElevationProfile.d.ts +5 -0
  56. package/dist/pages/itineraries/ElevationProfile.d.ts.map +1 -0
  57. package/dist/pages/itineraries/ElevationProfile.js +59 -0
  58. package/dist/routes.d.ts.map +1 -1
  59. package/dist/routes.js +18 -10
  60. package/dist/storefront.css +1 -1
  61. package/package.json +1 -1
  62. package/dist/chunks/pkg/ui/dist/Map/constants-BNmiJXfg.js +0 -4
@@ -0,0 +1,66 @@
1
+ import { LoaderArgs } from '@rpcbase/client';
2
+ export declare const loader: ({ ctx, params }: LoaderArgs) => Promise<{
3
+ slug: string;
4
+ title: Record<string, {
5
+ [x: string]: unknown;
6
+ value: string;
7
+ updatedAt: Date;
8
+ autoTranslated?: boolean | undefined;
9
+ }>;
10
+ introduction: Record<string, {
11
+ [x: string]: unknown;
12
+ value: string;
13
+ updatedAt: Date;
14
+ autoTranslated?: boolean | undefined;
15
+ }>;
16
+ tags: Record<string, {
17
+ [x: string]: unknown;
18
+ value: string;
19
+ updatedAt: Date;
20
+ autoTranslated?: boolean | undefined;
21
+ }>[];
22
+ coverImageId: string | null;
23
+ difficulty: "easy" | "moderate" | "challenging";
24
+ tripType: "one_way" | "out_and_back" | "loop";
25
+ metrics: {
26
+ distanceMeters: number;
27
+ durationSeconds: number;
28
+ elevationGainMeters: number;
29
+ elevationLossMeters: number;
30
+ };
31
+ geometry: {
32
+ type: "LineString";
33
+ coordinates: ([number, number] | [number, number, number])[];
34
+ };
35
+ bounds: {
36
+ west: number;
37
+ south: number;
38
+ east: number;
39
+ north: number;
40
+ } | null;
41
+ steps: {
42
+ id: string;
43
+ label: Record<string, {
44
+ [x: string]: unknown;
45
+ value: string;
46
+ updatedAt: Date;
47
+ autoTranslated?: boolean | undefined;
48
+ }>;
49
+ description: Record<string, {
50
+ [x: string]: unknown;
51
+ value: string;
52
+ updatedAt: Date;
53
+ autoTranslated?: boolean | undefined;
54
+ }>;
55
+ role: "shaping" | "stop" | "detached";
56
+ point: {
57
+ lng: number;
58
+ lat: number;
59
+ ele?: number | undefined;
60
+ };
61
+ imageIds: string[];
62
+ category?: string | undefined;
63
+ }[];
64
+ }>;
65
+ export default function ItineraryDetailsPage(): import("react/jsx-runtime").JSX.Element;
66
+ //# sourceMappingURL=ItineraryDetailsPage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ItineraryDetailsPage.d.ts","sourceRoot":"","sources":["../../src/pages/ItineraryDetailsPage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAuBzE,eAAO,MAAM,MAAM,oBAA4B,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUtC,CAAA;AAEnB,MAAM,CAAC,OAAO,UAAU,oBAAoB,4CAyL3C"}
@@ -0,0 +1,223 @@
1
+ import { STOREFRONT_ITINERARY_DETAIL_ROUTE as e, storefrontItineraryDetailResponseSchema as t } from "../lib/storefrontItineraries.js";
2
+ import { buildStorefrontImageUrl as n } from "../lib/storefrontImage.js";
3
+ import { Badge as r } from "../ui/badge.js";
4
+ import { Button as i } from "../ui/button.js";
5
+ import { useStorefront as a } from "../StorefrontContext.js";
6
+ import { formatItineraryDistance as o, formatItineraryDuration as s, resolveItineraryText as c } from "../lib/itineraryPresentation.js";
7
+ import { ItineraryRouteMap as l } from "../components/Itineraries/ItineraryRouteMap.js";
8
+ import "../components/Itineraries/index.js";
9
+ import { Card as u } from "../ui/card.js";
10
+ import { ElevationProfile as d } from "./itineraries/ElevationProfile.js";
11
+ import { jsx as f, jsxs as p } from "react/jsx-runtime";
12
+ import { apiClient as m } from "@rpcbase/client";
13
+ import { Link as h, useLoaderData as g } from "@rpcbase/router";
14
+ import { useTranslation as _ } from "react-i18next";
15
+ import { ArrowLeft as v, Clock as y, Gauge as b, Route as x, TrendingDown as S, TrendingUp as C } from "lucide-react";
16
+ //#region src/pages/ItineraryDetailsPage.tsx
17
+ var w = (async ({ ctx: n, params: r }) => {
18
+ let i = typeof r.storeSlug == "string" ? r.storeSlug.trim().toLowerCase() : "", a = typeof r.itinerarySlug == "string" ? r.itinerarySlug.trim().toLowerCase() : "";
19
+ if (!i || !a) throw new Response("Itinerary not found", { status: 404 });
20
+ let o = await m.get(e, {
21
+ storeSlug: i,
22
+ itinerarySlug: a
23
+ }, n), s = t.safeParse(o);
24
+ if (!s.success || !s.data.success || !s.data.itinerary) throw new Response("Itinerary not found", { status: 404 });
25
+ return s.data.itinerary;
26
+ });
27
+ function T() {
28
+ let e = g(), { t, i18n: m } = _(), { mapboxToken: w, storeSlug: T, storefrontConfiguration: E } = a(), D = E.workspace?.workspaceLanguage ?? "en", O = c(e.title, m.language, D), k = c(e.introduction, m.language, D), A = e.tags.map((e) => c(e, m.language, D)).filter(Boolean), j = e.steps.filter((e) => e.role !== "shaping"), M = e.geometry.coordinates.length >= 2, N = M || j.length > 0, P = [...M ? [
29
+ {
30
+ Icon: x,
31
+ label: t("itineraries_distance_label"),
32
+ value: o(e.metrics.distanceMeters, m.language)
33
+ },
34
+ {
35
+ Icon: y,
36
+ label: t("itineraries_duration_label"),
37
+ value: s(e.metrics.durationSeconds)
38
+ },
39
+ {
40
+ Icon: C,
41
+ label: t("itineraries_elevation_gain_label"),
42
+ value: `${Math.round(e.metrics.elevationGainMeters)} m`
43
+ },
44
+ {
45
+ Icon: S,
46
+ label: t("itineraries_elevation_loss_label"),
47
+ value: `${Math.round(e.metrics.elevationLossMeters)} m`
48
+ }
49
+ ] : [], {
50
+ Icon: b,
51
+ label: t("itineraries_difficulty_label"),
52
+ value: t(`itineraries_difficulty_${e.difficulty}`)
53
+ }];
54
+ return /* @__PURE__ */ f("section", {
55
+ "data-testid": "storefront-itinerary-details",
56
+ className: "min-h-[70vh] bg-white",
57
+ children: /* @__PURE__ */ p("div", {
58
+ className: "mx-auto max-w-7xl px-4 py-8 sm:px-6",
59
+ children: [
60
+ /* @__PURE__ */ f(i, {
61
+ asChild: !0,
62
+ variant: "ghost",
63
+ className: "h-auto justify-start gap-2 px-0 text-sm font-medium text-slate-700 hover:bg-transparent hover:text-slate-950",
64
+ children: /* @__PURE__ */ p(h, {
65
+ to: `/${T}/itineraries`,
66
+ children: [/* @__PURE__ */ f(v, {
67
+ className: "size-4",
68
+ "aria-hidden": "true"
69
+ }), /* @__PURE__ */ f("span", { children: t("itineraries_back_to_list") })]
70
+ })
71
+ }),
72
+ /* @__PURE__ */ p("header", {
73
+ className: "mt-6 max-w-3xl",
74
+ children: [
75
+ /* @__PURE__ */ p("div", {
76
+ className: "flex flex-wrap gap-2",
77
+ children: [/* @__PURE__ */ f(r, {
78
+ variant: "secondary",
79
+ className: "text-slate-700",
80
+ children: t(`itineraries_difficulty_${e.difficulty}`)
81
+ }), A.map((e, t) => /* @__PURE__ */ f(r, {
82
+ variant: "outline",
83
+ className: "font-normal text-slate-600",
84
+ children: e
85
+ }, `${e}-${t}`))]
86
+ }),
87
+ /* @__PURE__ */ f("h1", {
88
+ className: "mt-3 text-2xl font-semibold tracking-tight text-slate-950 sm:text-3xl",
89
+ children: /* @__PURE__ */ f("span", { children: O })
90
+ }),
91
+ k ? /* @__PURE__ */ f("p", {
92
+ className: "mt-3 text-sm leading-6 text-slate-600 sm:text-base",
93
+ children: /* @__PURE__ */ f("span", { children: k })
94
+ }) : null
95
+ ]
96
+ }),
97
+ /* @__PURE__ */ p("div", {
98
+ className: "mt-6 grid gap-8 lg:grid-cols-12 lg:items-start",
99
+ children: [N ? /* @__PURE__ */ p("main", {
100
+ className: "min-w-0 lg:col-span-8",
101
+ children: [M ? /* @__PURE__ */ f("div", {
102
+ className: "relative h-72 overflow-hidden rounded-2xl border border-slate-200 bg-slate-50 sm:h-96 lg:h-[28rem]",
103
+ children: /* @__PURE__ */ f(l, {
104
+ coordinates: e.geometry.coordinates,
105
+ steps: e.steps,
106
+ mapboxToken: w,
107
+ language: m.language,
108
+ fallbackLanguage: D,
109
+ className: "absolute inset-0 h-full w-full [&>div]:h-full"
110
+ })
111
+ }) : null, j.length > 0 ? /* @__PURE__ */ p("section", {
112
+ className: M ? "mt-8" : void 0,
113
+ children: [/* @__PURE__ */ f("h2", {
114
+ className: "text-lg font-semibold tracking-tight text-slate-950",
115
+ children: /* @__PURE__ */ f("span", { children: t("itineraries_route_label") })
116
+ }), /* @__PURE__ */ f("div", {
117
+ className: "mt-4 border-y border-slate-200",
118
+ children: j.map((e, r) => {
119
+ let i = c(e.label, m.language, D) || t("itineraries_step_fallback", { count: r + 1 }), a = c(e.description, m.language, D);
120
+ return /* @__PURE__ */ p("article", {
121
+ className: "flex gap-4 border-b border-slate-200 py-5 last:border-b-0",
122
+ children: [/* @__PURE__ */ f("span", {
123
+ className: "grid size-7 shrink-0 place-items-center rounded-md bg-slate-100 text-xs font-semibold text-slate-700",
124
+ children: r + 1
125
+ }), /* @__PURE__ */ p("div", {
126
+ className: "min-w-0 flex-1",
127
+ children: [
128
+ /* @__PURE__ */ f("h3", {
129
+ className: "text-sm font-semibold leading-6 text-slate-950",
130
+ children: /* @__PURE__ */ f("span", { children: i })
131
+ }),
132
+ a ? /* @__PURE__ */ f("p", {
133
+ className: "mt-1 text-sm leading-6 text-slate-600",
134
+ children: /* @__PURE__ */ f("span", { children: a })
135
+ }) : null,
136
+ e.imageIds.length > 0 ? /* @__PURE__ */ f("div", {
137
+ className: "mt-4 flex snap-x gap-3 overflow-x-auto pb-2",
138
+ children: e.imageIds.map((e, t) => /* @__PURE__ */ f("figure", {
139
+ className: "w-[82%] shrink-0 snap-start sm:w-72",
140
+ children: /* @__PURE__ */ f("img", {
141
+ src: n(e, T, 640),
142
+ alt: `${i} ${t + 1}`,
143
+ loading: "lazy",
144
+ className: "aspect-[4/3] w-full rounded-xl border border-slate-200 object-cover"
145
+ })
146
+ }, e))
147
+ }) : null
148
+ ]
149
+ })]
150
+ }, e.id);
151
+ })
152
+ })]
153
+ }) : null]
154
+ }) : null, /* @__PURE__ */ p("aside", {
155
+ className: N ? "space-y-4 lg:col-span-4 lg:sticky lg:top-28" : "space-y-4 lg:col-span-12 lg:max-w-sm",
156
+ children: [/* @__PURE__ */ p(u, {
157
+ className: "border-slate-200 bg-white shadow-sm",
158
+ children: [/* @__PURE__ */ f("div", {
159
+ className: "border-b border-slate-200 px-4 py-4",
160
+ children: /* @__PURE__ */ f("h2", {
161
+ className: "text-sm font-semibold text-slate-950",
162
+ children: /* @__PURE__ */ f("span", { children: t("itineraries_details_label") })
163
+ })
164
+ }), /* @__PURE__ */ f("dl", {
165
+ className: "divide-y divide-slate-200 px-4",
166
+ children: P.map(({ Icon: e, label: t, value: n }) => /* @__PURE__ */ p("div", {
167
+ className: "flex items-center justify-between gap-4 py-3",
168
+ children: [/* @__PURE__ */ p("dt", {
169
+ className: "inline-flex items-center gap-2 text-sm text-slate-600",
170
+ children: [/* @__PURE__ */ f(e, {
171
+ className: "size-4 text-slate-500",
172
+ "aria-hidden": "true"
173
+ }), /* @__PURE__ */ f("span", { children: t })]
174
+ }), /* @__PURE__ */ f("dd", {
175
+ className: "text-sm font-medium text-slate-950",
176
+ children: n
177
+ })]
178
+ }, t))
179
+ })]
180
+ }), M ? /* @__PURE__ */ p(u, {
181
+ className: "border-slate-200 bg-white shadow-sm",
182
+ children: [/* @__PURE__ */ f("div", {
183
+ className: "border-b border-slate-200 px-4 py-4",
184
+ children: /* @__PURE__ */ f("h2", {
185
+ className: "text-sm font-semibold text-slate-950",
186
+ children: /* @__PURE__ */ f("span", { children: t("itineraries_elevation_profile_label") })
187
+ })
188
+ }), /* @__PURE__ */ f("div", {
189
+ className: "px-4 py-4",
190
+ children: /* @__PURE__ */ f(d, { coordinates: e.geometry.coordinates })
191
+ })]
192
+ }) : null]
193
+ })]
194
+ }),
195
+ /* @__PURE__ */ f(u, {
196
+ className: "mt-8 border-slate-200 bg-slate-50 shadow-none",
197
+ children: /* @__PURE__ */ p("div", {
198
+ className: "flex flex-col gap-4 px-5 py-5 sm:flex-row sm:items-center sm:justify-between sm:px-6",
199
+ children: [/* @__PURE__ */ p("div", {
200
+ className: "max-w-2xl",
201
+ children: [/* @__PURE__ */ f("h2", {
202
+ className: "text-base font-semibold text-slate-950",
203
+ children: /* @__PURE__ */ f("span", { children: t("itineraries_booking_title") })
204
+ }), /* @__PURE__ */ f("p", {
205
+ className: "mt-1 text-sm leading-6 text-slate-600",
206
+ children: /* @__PURE__ */ f("span", { children: t("itineraries_booking_description") })
207
+ })]
208
+ }), /* @__PURE__ */ f(i, {
209
+ asChild: !0,
210
+ className: "w-full shrink-0 sm:w-auto sm:min-w-44",
211
+ children: /* @__PURE__ */ f(h, {
212
+ to: `/${T}/booking`,
213
+ children: /* @__PURE__ */ f("span", { children: t("itineraries_booking_cta") })
214
+ })
215
+ })]
216
+ })
217
+ })
218
+ ]
219
+ })
220
+ });
221
+ }
222
+ //#endregion
223
+ export { T as default, w as loader };
@@ -7,9 +7,9 @@ import { getAvailabilityVariant as te } from "../lib/utils.js";
7
7
  import { ROUTE as ne, buildStorefrontAvailabilityKey as l, getStorefrontAvailabilityIssue as u, getStorefrontAvailabilityStatus as d, getValidStorefrontAvailabilitySchedule as re, isStorefrontAvailabilityInsufficient as ie, responseSchema as ae } from "../lib/storefrontAvailability.js";
8
8
  import { Badge as f } from "../ui/badge.js";
9
9
  import { Button as p } from "../ui/button.js";
10
- import { toast as oe } from "../lib/toast.js";
11
- import { Input as se } from "../ui/input.js";
12
- import { useStorefront as ce, useStorefrontProducts as le } from "../StorefrontContext.js";
10
+ import { useStorefront as oe, useStorefrontProducts as se } from "../StorefrontContext.js";
11
+ import { toast as ce } from "../lib/toast.js";
12
+ import { Input as le } from "../ui/input.js";
13
13
  import { Card as ue } from "../ui/card.js";
14
14
  import { ProductWarningNotice as de } from "../components/ProductWarningNotice/index.js";
15
15
  import { ProductPriceBadge as fe } from "../components/ProductPriceBadge/index.js";
@@ -58,7 +58,7 @@ var C = (e, t = () => !0) => {
58
58
  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 });
59
59
  }, Oe = (e) => "availabilityStatus" in e ? e.availabilityStatus ?? "AVAILABLE" : "AVAILABLE";
60
60
  function T() {
61
- let { t: u, i18n: T } = xe(), { storeSlug: E, productSlug: D } = ye(), [O] = be(), ke = _e(), Ae = ve(), { addItem: je, itemCount: k } = ee(), { storefrontConfiguration: Me } = ce(), A = Me.workspace?.workspaceLanguage, { bikes: j, accessories: M } = le(), N = h(() => D ? o(D, {
61
+ let { t: u, i18n: T } = xe(), { storeSlug: E, productSlug: D } = ye(), [O] = be(), ke = _e(), Ae = ve(), { addItem: je, itemCount: k } = ee(), { storefrontConfiguration: Me } = oe(), A = Me.workspace?.workspaceLanguage, { bikes: j, accessories: M } = se(), N = h(() => D ? o(D, {
62
62
  bikes: j,
63
63
  accessories: M
64
64
  }) : null, [
@@ -301,7 +301,7 @@ function T() {
301
301
  children: [/* @__PURE__ */ _("p", {
302
302
  className: "text-xs font-medium text-slate-700",
303
303
  children: /* @__PURE__ */ _("span", { children: u("quantity_label") })
304
- }), /* @__PURE__ */ _(se, {
304
+ }), /* @__PURE__ */ _(le, {
305
305
  type: "number",
306
306
  min: 1,
307
307
  max: 99,
@@ -317,7 +317,7 @@ function T() {
317
317
  productId: s(N),
318
318
  ...U ? { productVariantId: U } : {},
319
319
  quantity: G
320
- }), oe.success(u("product_added_to_cart_successfully", {
320
+ }), ce.success(u("product_added_to_cart_successfully", {
321
321
  quantity: G,
322
322
  productName: c({
323
323
  product: N,
@@ -0,0 +1,5 @@
1
+ import { StorefrontItineraryCoordinate } from '../../lib/storefrontItineraries';
2
+ export declare function ElevationProfile({ coordinates }: {
3
+ coordinates: StorefrontItineraryCoordinate[];
4
+ }): import("react/jsx-runtime").JSX.Element;
5
+ //# sourceMappingURL=ElevationProfile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ElevationProfile.d.ts","sourceRoot":"","sources":["../../../src/pages/itineraries/ElevationProfile.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAA;AAKpF,wBAAgB,gBAAgB,CAAC,EAAE,WAAW,EAAE,EAAE;IAAE,WAAW,EAAE,6BAA6B,EAAE,CAAA;CAAE,2CA8CjG"}
@@ -0,0 +1,59 @@
1
+ import { useId as e } from "react";
2
+ import { jsx as t, jsxs as n } from "react/jsx-runtime";
3
+ import { useTranslation as r } from "react-i18next";
4
+ //#region src/pages/itineraries/ElevationProfile.tsx
5
+ var i = 400;
6
+ function a({ coordinates: a }) {
7
+ let { t: o } = r(), s = e().replace(/:/g, ""), c = a.map((e) => e[2]).filter((e) => typeof e == "number");
8
+ if (c.length < 2) return /* @__PURE__ */ t("span", {
9
+ className: "text-sm text-slate-500",
10
+ children: "—"
11
+ });
12
+ let { min: l, max: u } = c.reduce((e, t) => ({
13
+ min: Math.min(e.min, t),
14
+ max: Math.max(e.max, t)
15
+ }), {
16
+ min: c[0],
17
+ max: c[0]
18
+ }), d = Math.max(u - l, 1), f = c.length <= i ? c : Array.from({ length: i }, (e, t) => c[Math.round(t / (i - 1) * (c.length - 1))]), p = f.map((e, t) => `${t / (f.length - 1) * 300},${82 - (e - l) / d * 68}`).join(" "), m = `M 0 88 L ${p.replaceAll(" ", " L ")} L 300 88 Z`;
19
+ return /* @__PURE__ */ n("div", { children: [/* @__PURE__ */ n("svg", {
20
+ viewBox: "0 0 300 92",
21
+ className: "h-28 w-full",
22
+ role: "img",
23
+ "aria-label": o("itineraries_elevation_profile_chart_label"),
24
+ children: [
25
+ /* @__PURE__ */ t("defs", { children: /* @__PURE__ */ n("linearGradient", {
26
+ id: s,
27
+ x1: "0",
28
+ y1: "0",
29
+ x2: "0",
30
+ y2: "1",
31
+ children: [/* @__PURE__ */ t("stop", {
32
+ offset: "0%",
33
+ stopColor: "#64748b",
34
+ stopOpacity: "0.24"
35
+ }), /* @__PURE__ */ t("stop", {
36
+ offset: "100%",
37
+ stopColor: "#94a3b8",
38
+ stopOpacity: "0.03"
39
+ })]
40
+ }) }),
41
+ /* @__PURE__ */ t("path", {
42
+ d: m,
43
+ fill: `url(#${s})`
44
+ }),
45
+ /* @__PURE__ */ t("polyline", {
46
+ points: p,
47
+ fill: "none",
48
+ stroke: "#475569",
49
+ strokeWidth: "2",
50
+ vectorEffect: "non-scaling-stroke"
51
+ })
52
+ ]
53
+ }), /* @__PURE__ */ n("div", {
54
+ className: "flex justify-between text-xs text-slate-500",
55
+ children: [/* @__PURE__ */ n("span", { children: [Math.round(l), " m"] }), /* @__PURE__ */ n("span", { children: [Math.round(u), " m"] })]
56
+ })] });
57
+ }
58
+ //#endregion
59
+ export { a as ElevationProfile };
@@ -1 +1 @@
1
- {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.tsx"],"names":[],"mappings":";AA8BA,wBAsBC"}
1
+ {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.tsx"],"names":[],"mappings":";AAgCA,wBAwBC"}
package/dist/routes.js CHANGED
@@ -3,10 +3,10 @@ import t from "./pages/ErrorPage.js";
3
3
  import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
4
  import { Route as i, lazyRoute as a } from "@rpcbase/router";
5
5
  //#region src/routes.tsx
6
- var o = a(() => import("./StorefrontProvider.js")), s = a(() => import("./pages/HomePage.js")), c = a(() => import("./pages/BookingPage.js")), l = a(() => import("./pages/ProductPage.js")), u = a(() => import("./pages/CheckoutPage.js")), d = a(() => import("./pages/CheckoutPaymentPage.js")), f = a(() => import("./pages/CheckoutSuccessPage.js")), p = a(() => import("./pages/ContractSaleDocumentPage.js")), m = a(() => import("./pages/PaymentLinkPage.js")), h = a(() => import("./pages/PaymentLinkSuccessPage.js")), g = a(() => import("./pages/NotFoundPage.js")), _ = ({ currentParams: e, nextParams: t, defaultShouldRevalidate: n }) => e.storeSlug !== t.storeSlug && n, v = /* @__PURE__ */ r(i, {
6
+ var o = a(() => import("./StorefrontProvider.js")), s = a(() => import("./pages/HomePage.js")), c = a(() => import("./pages/BookingPage.js")), l = a(() => import("./pages/ProductPage.js")), u = a(() => import("./pages/ItinerariesPage.js")), d = a(() => import("./pages/ItineraryDetailsPage.js")), f = a(() => import("./pages/CheckoutPage.js")), p = a(() => import("./pages/CheckoutPaymentPage.js")), m = a(() => import("./pages/CheckoutSuccessPage.js")), h = a(() => import("./pages/ContractSaleDocumentPage.js")), g = a(() => import("./pages/PaymentLinkPage.js")), _ = a(() => import("./pages/PaymentLinkSuccessPage.js")), v = a(() => import("./pages/NotFoundPage.js")), y = ({ currentParams: e, nextParams: t, defaultShouldRevalidate: n }) => e.storeSlug !== t.storeSlug && n, b = /* @__PURE__ */ r(i, {
7
7
  path: ":storeSlug/*",
8
8
  ...o,
9
- shouldRevalidate: _,
9
+ shouldRevalidate: y,
10
10
  errorElement: /* @__PURE__ */ n(e, { children: /* @__PURE__ */ n(t, {}) }),
11
11
  children: [
12
12
  /* @__PURE__ */ n(i, {
@@ -22,34 +22,42 @@ var o = a(() => import("./StorefrontProvider.js")), s = a(() => import("./pages/
22
22
  ...l
23
23
  }),
24
24
  /* @__PURE__ */ n(i, {
25
- path: "checkout",
25
+ path: "itineraries",
26
26
  ...u
27
27
  }),
28
28
  /* @__PURE__ */ n(i, {
29
- path: "checkout/payment",
29
+ path: "itineraries/:itinerarySlug",
30
30
  ...d
31
31
  }),
32
32
  /* @__PURE__ */ n(i, {
33
- path: "checkout/success",
33
+ path: "checkout",
34
34
  ...f
35
35
  }),
36
36
  /* @__PURE__ */ n(i, {
37
- path: "docs/:referenceId/:saleDocumentId",
37
+ path: "checkout/payment",
38
38
  ...p
39
39
  }),
40
40
  /* @__PURE__ */ n(i, {
41
- path: "secure-payment-link/:token",
41
+ path: "checkout/success",
42
42
  ...m
43
43
  }),
44
44
  /* @__PURE__ */ n(i, {
45
- path: "secure-payment-link/:token/success",
45
+ path: "docs/:referenceId/:saleDocumentId",
46
46
  ...h
47
47
  }),
48
48
  /* @__PURE__ */ n(i, {
49
- path: "*",
49
+ path: "secure-payment-link/:token",
50
50
  ...g
51
+ }),
52
+ /* @__PURE__ */ n(i, {
53
+ path: "secure-payment-link/:token/success",
54
+ ..._
55
+ }),
56
+ /* @__PURE__ */ n(i, {
57
+ path: "*",
58
+ ...v
51
59
  })
52
60
  ]
53
61
  });
54
62
  //#endregion
55
- export { v as default };
63
+ export { b as default };