@loczer/storefront-sdk 0.208.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.
- package/dist/StorefrontContext.d.ts +89 -0
- package/dist/StorefrontContext.d.ts.map +1 -1
- package/dist/StorefrontContext.js +8 -1
- package/dist/StorefrontProvider.d.ts +84 -0
- package/dist/StorefrontProvider.d.ts.map +1 -1
- package/dist/StorefrontProvider.js +55 -41
- package/dist/chunks/pkg/ui/dist/Map/{MapContent-CDeWtwKa.js → MapContent-TzYCv8ji.js} +109 -108
- package/dist/chunks/pkg/ui/dist/Map/constants-dF2KdJZy.js +8 -0
- package/dist/chunks/pkg/ui/dist/{Map-Cs7wgtH9.js → Map-ZM-ZOU9P.js} +1 -1
- package/dist/components/BookingBikeVariantDialog/index.js +15 -15
- package/dist/components/ContactSection/index.js +9 -9
- package/dist/components/Header/index.d.ts.map +1 -1
- package/dist/components/Header/index.js +72 -66
- package/dist/components/Itineraries/ItinerariesSection.d.ts +2 -0
- package/dist/components/Itineraries/ItinerariesSection.d.ts.map +1 -0
- package/dist/components/Itineraries/ItinerariesSection.js +81 -0
- package/dist/components/Itineraries/ItineraryListItem.d.ts +9 -0
- package/dist/components/Itineraries/ItineraryListItem.d.ts.map +1 -0
- package/dist/components/Itineraries/ItineraryListItem.js +100 -0
- package/dist/components/Itineraries/ItineraryRouteMap.d.ts +10 -0
- package/dist/components/Itineraries/ItineraryRouteMap.d.ts.map +1 -0
- package/dist/components/Itineraries/ItineraryRouteMap.js +67 -0
- package/dist/components/Itineraries/index.d.ts +4 -0
- package/dist/components/Itineraries/index.d.ts.map +1 -0
- package/dist/components/Itineraries/index.js +4 -0
- package/dist/components/Map/index.d.ts +12 -0
- package/dist/components/Map/index.d.ts.map +1 -1
- package/dist/components/Map/index.js +1 -1
- package/dist/i18n/en.d.ts +31 -0
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +31 -0
- package/dist/i18n/fr.d.ts +31 -0
- package/dist/i18n/fr.d.ts.map +1 -1
- package/dist/i18n/fr.js +31 -0
- package/dist/index.d.ts +763 -0
- package/dist/index.js +58 -51
- package/dist/lib/itineraryPresentation.d.ts +14 -0
- package/dist/lib/itineraryPresentation.d.ts.map +1 -0
- package/dist/lib/itineraryPresentation.js +26 -0
- package/dist/lib/storefrontItineraries.d.ts +418 -0
- package/dist/lib/storefrontItineraries.d.ts.map +1 -0
- package/dist/lib/storefrontItineraries.js +81 -0
- package/dist/pages/BookingPage.js +8 -8
- package/dist/pages/CheckoutPage.js +4 -4
- package/dist/pages/HomePage.d.ts.map +1 -1
- package/dist/pages/HomePage.js +111 -108
- package/dist/pages/ItinerariesPage.d.ts +2 -0
- package/dist/pages/ItinerariesPage.d.ts.map +1 -0
- package/dist/pages/ItinerariesPage.js +76 -0
- package/dist/pages/ItineraryDetailsPage.d.ts +66 -0
- package/dist/pages/ItineraryDetailsPage.d.ts.map +1 -0
- package/dist/pages/ItineraryDetailsPage.js +223 -0
- package/dist/pages/ProductPage.js +6 -6
- package/dist/pages/itineraries/ElevationProfile.d.ts +5 -0
- package/dist/pages/itineraries/ElevationProfile.d.ts.map +1 -0
- package/dist/pages/itineraries/ElevationProfile.js +59 -0
- package/dist/routes.d.ts.map +1 -1
- package/dist/routes.js +18 -10
- package/dist/storefront.css +1 -1
- package/package.json +1 -1
- package/dist/chunks/pkg/ui/dist/Map/constants-BNmiJXfg.js +0 -4
|
@@ -2,6 +2,7 @@ import { Context } from 'react';
|
|
|
2
2
|
import { StorefrontI18nLanguage } from './i18n/I18nProvider';
|
|
3
3
|
import { AccessoryProduct, BikeProduct } from './lib/products';
|
|
4
4
|
import { StorefrontConfiguration } from './storefrontSchemas';
|
|
5
|
+
import { StorefrontItineraryPreview, StorefrontItinerarySummary } from './lib/storefrontItineraries';
|
|
5
6
|
export type StorefrontContextValue = {
|
|
6
7
|
storeSlug: string;
|
|
7
8
|
storefrontConfiguration: StorefrontConfiguration;
|
|
@@ -11,6 +12,8 @@ export type StorefrontContextValue = {
|
|
|
11
12
|
bookingAccessories: AccessoryProduct[];
|
|
12
13
|
mapboxToken?: string;
|
|
13
14
|
language: StorefrontI18nLanguage;
|
|
15
|
+
itineraries: StorefrontItinerarySummary[];
|
|
16
|
+
featuredItineraries: StorefrontItineraryPreview[];
|
|
14
17
|
};
|
|
15
18
|
export declare const StorefrontContext: Context<StorefrontContextValue | undefined>;
|
|
16
19
|
export declare function useStorefront(): StorefrontContextValue;
|
|
@@ -480,4 +483,90 @@ export declare function useStorefrontBookingProducts(): {
|
|
|
480
483
|
bikes: BikeProduct[];
|
|
481
484
|
accessories: AccessoryProduct[];
|
|
482
485
|
};
|
|
486
|
+
export declare function useStorefrontItineraries(): {
|
|
487
|
+
itineraries: {
|
|
488
|
+
slug: string;
|
|
489
|
+
title: Record<string, {
|
|
490
|
+
[x: string]: unknown;
|
|
491
|
+
value: string;
|
|
492
|
+
updatedAt: Date;
|
|
493
|
+
autoTranslated?: boolean | undefined;
|
|
494
|
+
}>;
|
|
495
|
+
introduction: Record<string, {
|
|
496
|
+
[x: string]: unknown;
|
|
497
|
+
value: string;
|
|
498
|
+
updatedAt: Date;
|
|
499
|
+
autoTranslated?: boolean | undefined;
|
|
500
|
+
}>;
|
|
501
|
+
tags: Record<string, {
|
|
502
|
+
[x: string]: unknown;
|
|
503
|
+
value: string;
|
|
504
|
+
updatedAt: Date;
|
|
505
|
+
autoTranslated?: boolean | undefined;
|
|
506
|
+
}>[];
|
|
507
|
+
coverImageId: string | null;
|
|
508
|
+
difficulty: "easy" | "moderate" | "challenging";
|
|
509
|
+
tripType: "one_way" | "out_and_back" | "loop";
|
|
510
|
+
metrics: {
|
|
511
|
+
distanceMeters: number;
|
|
512
|
+
durationSeconds: number;
|
|
513
|
+
elevationGainMeters: number;
|
|
514
|
+
elevationLossMeters: number;
|
|
515
|
+
};
|
|
516
|
+
}[];
|
|
517
|
+
featuredItineraries: {
|
|
518
|
+
slug: string;
|
|
519
|
+
title: Record<string, {
|
|
520
|
+
[x: string]: unknown;
|
|
521
|
+
value: string;
|
|
522
|
+
updatedAt: Date;
|
|
523
|
+
autoTranslated?: boolean | undefined;
|
|
524
|
+
}>;
|
|
525
|
+
introduction: Record<string, {
|
|
526
|
+
[x: string]: unknown;
|
|
527
|
+
value: string;
|
|
528
|
+
updatedAt: Date;
|
|
529
|
+
autoTranslated?: boolean | undefined;
|
|
530
|
+
}>;
|
|
531
|
+
tags: Record<string, {
|
|
532
|
+
[x: string]: unknown;
|
|
533
|
+
value: string;
|
|
534
|
+
updatedAt: Date;
|
|
535
|
+
autoTranslated?: boolean | undefined;
|
|
536
|
+
}>[];
|
|
537
|
+
coverImageId: string | null;
|
|
538
|
+
difficulty: "easy" | "moderate" | "challenging";
|
|
539
|
+
tripType: "one_way" | "out_and_back" | "loop";
|
|
540
|
+
metrics: {
|
|
541
|
+
distanceMeters: number;
|
|
542
|
+
durationSeconds: number;
|
|
543
|
+
elevationGainMeters: number;
|
|
544
|
+
elevationLossMeters: number;
|
|
545
|
+
};
|
|
546
|
+
previewCoordinates: ([number, number] | [number, number, number])[];
|
|
547
|
+
steps: {
|
|
548
|
+
id: string;
|
|
549
|
+
label: Record<string, {
|
|
550
|
+
[x: string]: unknown;
|
|
551
|
+
value: string;
|
|
552
|
+
updatedAt: Date;
|
|
553
|
+
autoTranslated?: boolean | undefined;
|
|
554
|
+
}>;
|
|
555
|
+
description: Record<string, {
|
|
556
|
+
[x: string]: unknown;
|
|
557
|
+
value: string;
|
|
558
|
+
updatedAt: Date;
|
|
559
|
+
autoTranslated?: boolean | undefined;
|
|
560
|
+
}>;
|
|
561
|
+
role: "shaping" | "stop" | "detached";
|
|
562
|
+
point: {
|
|
563
|
+
lng: number;
|
|
564
|
+
lat: number;
|
|
565
|
+
ele?: number | undefined;
|
|
566
|
+
};
|
|
567
|
+
imageIds: string[];
|
|
568
|
+
category?: string | undefined;
|
|
569
|
+
}[];
|
|
570
|
+
}[];
|
|
571
|
+
};
|
|
483
572
|
//# sourceMappingURL=StorefrontContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StorefrontContext.d.ts","sourceRoot":"","sources":["../src/StorefrontContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,OAAO,EAAE,MAAM,OAAO,CAAA;AAE/D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACnE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"StorefrontContext.d.ts","sourceRoot":"","sources":["../src/StorefrontContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,OAAO,EAAE,MAAM,OAAO,CAAA;AAE/D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACnE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAClE,OAAO,KAAK,EAAE,0BAA0B,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAA;AAGzG,MAAM,MAAM,sBAAsB,GAAG;IACnC,SAAS,EAAE,MAAM,CAAA;IACjB,uBAAuB,EAAE,uBAAuB,CAAA;IAChD,KAAK,EAAE,WAAW,EAAE,CAAA;IACpB,WAAW,EAAE,gBAAgB,EAAE,CAAA;IAC/B,YAAY,EAAE,WAAW,EAAE,CAAA;IAC3B,kBAAkB,EAAE,gBAAgB,EAAE,CAAA;IACtC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,sBAAsB,CAAA;IAChC,WAAW,EAAE,0BAA0B,EAAE,CAAA;IACzC,mBAAmB,EAAE,0BAA0B,EAAE,CAAA;CAClD,CAAA;AAUD,eAAO,MAAM,iBAAiB,6CAEmC,CAAA;AAKjE,wBAAgB,aAAa,2BAQ5B;AAED,wBAAgB,qBAAqB,uCAEpC;AAED,wBAAgB,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMlC;AAED,wBAAgB,8BAA8B,IAAI,sBAAsB,CAGvE;AAED,wBAAgB,qBAAqB;;;EAGpC;AAED,wBAAgB,4BAA4B;;;EAG3C;AAED,wBAAgB,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGvC"}
|
|
@@ -35,5 +35,12 @@ function l() {
|
|
|
35
35
|
accessories: t
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
|
+
function u() {
|
|
39
|
+
let { itineraries: e, featuredItineraries: t } = i();
|
|
40
|
+
return {
|
|
41
|
+
itineraries: e,
|
|
42
|
+
featuredItineraries: t
|
|
43
|
+
};
|
|
44
|
+
}
|
|
38
45
|
//#endregion
|
|
39
|
-
export { r as StorefrontContext, a as useOptionalStorefront, i as useStorefront, l as useStorefrontBookingProducts, o as useStorefrontConfig, c as useStorefrontProducts, s as useStorefrontWorkspaceLanguage };
|
|
46
|
+
export { r as StorefrontContext, a as useOptionalStorefront, i as useStorefront, l as useStorefrontBookingProducts, o as useStorefrontConfig, u as useStorefrontItineraries, c as useStorefrontProducts, s as useStorefrontWorkspaceLanguage };
|
|
@@ -232,6 +232,90 @@ export declare const loader: ({ ctx, params }: import('@rpcbase/client').LoaderA
|
|
|
232
232
|
bookingBikes: import('.').BikeProduct[];
|
|
233
233
|
bookingAccessories: import('.').AccessoryProduct[];
|
|
234
234
|
language: import('./i18n/I18nProvider').StorefrontI18nLanguage;
|
|
235
|
+
itineraries: {
|
|
236
|
+
slug: string;
|
|
237
|
+
title: Record<string, {
|
|
238
|
+
[x: string]: unknown;
|
|
239
|
+
value: string;
|
|
240
|
+
updatedAt: Date;
|
|
241
|
+
autoTranslated?: boolean | undefined;
|
|
242
|
+
}>;
|
|
243
|
+
introduction: Record<string, {
|
|
244
|
+
[x: string]: unknown;
|
|
245
|
+
value: string;
|
|
246
|
+
updatedAt: Date;
|
|
247
|
+
autoTranslated?: boolean | undefined;
|
|
248
|
+
}>;
|
|
249
|
+
tags: Record<string, {
|
|
250
|
+
[x: string]: unknown;
|
|
251
|
+
value: string;
|
|
252
|
+
updatedAt: Date;
|
|
253
|
+
autoTranslated?: boolean | undefined;
|
|
254
|
+
}>[];
|
|
255
|
+
coverImageId: string | null;
|
|
256
|
+
difficulty: "easy" | "moderate" | "challenging";
|
|
257
|
+
tripType: "one_way" | "out_and_back" | "loop";
|
|
258
|
+
metrics: {
|
|
259
|
+
distanceMeters: number;
|
|
260
|
+
durationSeconds: number;
|
|
261
|
+
elevationGainMeters: number;
|
|
262
|
+
elevationLossMeters: number;
|
|
263
|
+
};
|
|
264
|
+
}[];
|
|
265
|
+
featuredItineraries: {
|
|
266
|
+
slug: string;
|
|
267
|
+
title: Record<string, {
|
|
268
|
+
[x: string]: unknown;
|
|
269
|
+
value: string;
|
|
270
|
+
updatedAt: Date;
|
|
271
|
+
autoTranslated?: boolean | undefined;
|
|
272
|
+
}>;
|
|
273
|
+
introduction: Record<string, {
|
|
274
|
+
[x: string]: unknown;
|
|
275
|
+
value: string;
|
|
276
|
+
updatedAt: Date;
|
|
277
|
+
autoTranslated?: boolean | undefined;
|
|
278
|
+
}>;
|
|
279
|
+
tags: Record<string, {
|
|
280
|
+
[x: string]: unknown;
|
|
281
|
+
value: string;
|
|
282
|
+
updatedAt: Date;
|
|
283
|
+
autoTranslated?: boolean | undefined;
|
|
284
|
+
}>[];
|
|
285
|
+
coverImageId: string | null;
|
|
286
|
+
difficulty: "easy" | "moderate" | "challenging";
|
|
287
|
+
tripType: "one_way" | "out_and_back" | "loop";
|
|
288
|
+
metrics: {
|
|
289
|
+
distanceMeters: number;
|
|
290
|
+
durationSeconds: number;
|
|
291
|
+
elevationGainMeters: number;
|
|
292
|
+
elevationLossMeters: number;
|
|
293
|
+
};
|
|
294
|
+
previewCoordinates: ([number, number] | [number, number, number])[];
|
|
295
|
+
steps: {
|
|
296
|
+
id: string;
|
|
297
|
+
label: Record<string, {
|
|
298
|
+
[x: string]: unknown;
|
|
299
|
+
value: string;
|
|
300
|
+
updatedAt: Date;
|
|
301
|
+
autoTranslated?: boolean | undefined;
|
|
302
|
+
}>;
|
|
303
|
+
description: Record<string, {
|
|
304
|
+
[x: string]: unknown;
|
|
305
|
+
value: string;
|
|
306
|
+
updatedAt: Date;
|
|
307
|
+
autoTranslated?: boolean | undefined;
|
|
308
|
+
}>;
|
|
309
|
+
role: "shaping" | "stop" | "detached";
|
|
310
|
+
point: {
|
|
311
|
+
lng: number;
|
|
312
|
+
lat: number;
|
|
313
|
+
ele?: number | undefined;
|
|
314
|
+
};
|
|
315
|
+
imageIds: string[];
|
|
316
|
+
category?: string | undefined;
|
|
317
|
+
}[];
|
|
318
|
+
}[];
|
|
235
319
|
}>;
|
|
236
320
|
export default function StorefrontProvider(): import("react/jsx-runtime").JSX.Element;
|
|
237
321
|
export * from './StorefrontContext';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StorefrontProvider.d.ts","sourceRoot":"","sources":["../src/StorefrontProvider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"StorefrontProvider.d.ts","sourceRoot":"","sources":["../src/StorefrontProvider.tsx"],"names":[],"mappings":"AA8BA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiFA,CAAA;AAGnB,MAAM,CAAC,OAAO,UAAU,kBAAkB,4CAqBzC;AAED,cAAc,qBAAqB,CAAA"}
|
|
@@ -1,65 +1,79 @@
|
|
|
1
1
|
import { storefrontConfigurationSchema as e } from "./storefrontSchemas.js";
|
|
2
2
|
import { toStorefrontAccessoryProducts as t, toStorefrontBikeProducts as n, toStorefrontBookingProductsCollections as r } from "./lib/products.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
3
|
+
import { STOREFRONT_ITINERARIES_FEATURED_ROUTE as i, STOREFRONT_ITINERARIES_LIST_ROUTE as a, storefrontItinerariesFeaturedResponseSchema as o, storefrontItinerariesListResponseSchema as s } from "./lib/storefrontItineraries.js";
|
|
4
|
+
import { ROUTE as c, responseSchema as l } from "./lib/storefrontProducts.js";
|
|
5
|
+
import { StorefrontContext as u, useOptionalStorefront as d, useStorefront as f, useStorefrontBookingProducts as p, useStorefrontConfig as m, useStorefrontItineraries as h, useStorefrontProducts as g, useStorefrontWorkspaceLanguage as _ } from "./StorefrontContext.js";
|
|
6
|
+
import { I18nProvider as v, detectStorefrontI18nLanguage as y, resolveStorefrontI18nRequestLanguage as b } from "./i18n/I18nProvider.js";
|
|
7
|
+
import { Layout as x } from "./components/Layout/index.js";
|
|
8
|
+
import { createStorefrontUnavailableError as S, isStorefrontUnavailableRouteError as C, parseStorefrontUnavailableStatus as w } from "./lib/storefrontUnavailable.js";
|
|
9
|
+
import { jsx as T } from "react/jsx-runtime";
|
|
10
|
+
import { apiClient as E } from "@rpcbase/client";
|
|
11
|
+
import { useLoaderData as D } from "@rpcbase/router";
|
|
11
12
|
//#region src/StorefrontProvider.tsx
|
|
12
|
-
var
|
|
13
|
-
let
|
|
14
|
-
if (!
|
|
13
|
+
var O = (async ({ ctx: u, params: d }) => {
|
|
14
|
+
let f = typeof d.storeSlug == "string" ? d.storeSlug.trim().toLowerCase() : "";
|
|
15
|
+
if (!f) throw S("unknown");
|
|
15
16
|
try {
|
|
16
|
-
let [
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
17
|
+
let [d, p, m, h] = await Promise.all([
|
|
18
|
+
E.get("/api/public/storefront/config", { storeSlug: f }, u),
|
|
19
|
+
E.get(c, { storeSlug: f }, u),
|
|
20
|
+
E.get(a, { storeSlug: f }, u).catch((e) => (console.error("Unable to load Storefront itineraries", e), {
|
|
21
|
+
success: !1,
|
|
22
|
+
itineraries: []
|
|
23
|
+
})),
|
|
24
|
+
E.get(i, { storeSlug: f }, u).catch((e) => (console.error("Unable to load featured Storefront itineraries", e), {
|
|
25
|
+
success: !1,
|
|
26
|
+
itineraries: []
|
|
27
|
+
}))
|
|
28
|
+
]), g = typeof d == "object" && d ? d : {};
|
|
29
|
+
if (g.success !== !0) throw S(w(g.storefrontStatus) ?? "unknown", typeof g.replacementSlug == "string" ? g.replacementSlug : void 0);
|
|
30
|
+
let _ = e.safeParse(g.storefrontConfiguration);
|
|
31
|
+
if (!_.success) throw console.error("Invalid storefront config received", _.error.flatten()), new Response("Storefront config invalid", { status: 500 });
|
|
32
|
+
let v = l.safeParse(p);
|
|
33
|
+
if (!v.success) throw console.error("Invalid storefront products received", v.error.flatten()), new Response("Storefront products invalid", { status: 500 });
|
|
34
|
+
if (!v.data.success) throw console.error("Storefront products unavailable", v.data.message ?? "Unknown error"), new Response("Storefront products unavailable", { status: 500 });
|
|
35
|
+
let x = n(v.data.products.bikes), C = t(v.data.products.accessories), T = r({
|
|
36
|
+
bikes: x,
|
|
37
|
+
accessories: C
|
|
38
|
+
}), D = s.safeParse(m), O = o.safeParse(h), k = _.data.workspace?.languages ?? null, A = _.data.workspace?.workspaceLanguage ?? null, j = u?.req ? b({
|
|
39
|
+
cookieHeader: u.req.headers?.cookie,
|
|
40
|
+
acceptLanguageHeader: u.req.headers?.["accept-language"],
|
|
41
|
+
configuredLanguages: k,
|
|
42
|
+
configuredFallbackLanguage: A
|
|
43
|
+
}) : y(k, A);
|
|
32
44
|
return {
|
|
33
|
-
storeSlug:
|
|
34
|
-
storefrontConfiguration:
|
|
35
|
-
bikes:
|
|
36
|
-
accessories:
|
|
37
|
-
bookingBikes:
|
|
38
|
-
bookingAccessories:
|
|
39
|
-
language:
|
|
45
|
+
storeSlug: f,
|
|
46
|
+
storefrontConfiguration: _.data,
|
|
47
|
+
bikes: x,
|
|
48
|
+
accessories: C,
|
|
49
|
+
bookingBikes: T.bikes,
|
|
50
|
+
bookingAccessories: T.accessories,
|
|
51
|
+
language: j,
|
|
52
|
+
itineraries: D.success && D.data.success ? D.data.itineraries : [],
|
|
53
|
+
featuredItineraries: O.success && O.data.success ? O.data.itineraries : []
|
|
40
54
|
};
|
|
41
55
|
} catch (e) {
|
|
42
|
-
throw
|
|
56
|
+
throw C(e) || e instanceof Response ? e : (console.error("Error loading storefront:", e), new Response("Storefront unavailable", { status: 500 }));
|
|
43
57
|
}
|
|
44
58
|
});
|
|
45
|
-
function
|
|
46
|
-
let e =
|
|
59
|
+
function k() {
|
|
60
|
+
let e = D(), t = {
|
|
47
61
|
BASE_URL: "/",
|
|
48
62
|
DEV: !1,
|
|
49
63
|
MODE: "production",
|
|
50
64
|
PROD: !0,
|
|
51
65
|
SSR: !1
|
|
52
66
|
}, n = typeof t?.RB_PUBLIC_MAPBOX_TOKEN == "string" && t.RB_PUBLIC_MAPBOX_TOKEN.trim().length > 0 ? t.RB_PUBLIC_MAPBOX_TOKEN : void 0;
|
|
53
|
-
return /* @__PURE__ */
|
|
67
|
+
return /* @__PURE__ */ T(u.Provider, {
|
|
54
68
|
value: {
|
|
55
69
|
...e,
|
|
56
70
|
mapboxToken: n
|
|
57
71
|
},
|
|
58
|
-
children: /* @__PURE__ */
|
|
72
|
+
children: /* @__PURE__ */ T(v, {
|
|
59
73
|
initialLanguage: e.language,
|
|
60
74
|
configuredLanguages: e.storefrontConfiguration.workspace?.languages,
|
|
61
75
|
configuredFallbackLanguage: e.storefrontConfiguration.workspace?.workspaceLanguage,
|
|
62
|
-
children: /* @__PURE__ */
|
|
76
|
+
children: /* @__PURE__ */ T(x, {
|
|
63
77
|
storefrontConfiguration: e.storefrontConfiguration,
|
|
64
78
|
storefrontProducts: {
|
|
65
79
|
bikes: e.bikes,
|
|
@@ -70,4 +84,4 @@ function w() {
|
|
|
70
84
|
});
|
|
71
85
|
}
|
|
72
86
|
//#endregion
|
|
73
|
-
export { u as StorefrontContext,
|
|
87
|
+
export { u as StorefrontContext, k as default, O as loader, d as useOptionalStorefront, f as useStorefront, p as useStorefrontBookingProducts, m as useStorefrontConfig, h as useStorefrontItineraries, g as useStorefrontProducts, _ as useStorefrontWorkspaceLanguage };
|