@loczer/storefront-sdk 0.208.0 → 0.210.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/booking-engine/dist/node_modules/@date-fns/tz/date/index-DAbcklF5.js +1 -0
- package/dist/chunks/pkg/booking-engine/dist/node_modules/@date-fns/tz/date/mini-CSEBo1ZP.js +60 -0
- package/dist/chunks/pkg/booking-engine/dist/node_modules/@date-fns/tz/index--u3Qf-qy.js +4 -0
- package/dist/chunks/pkg/booking-engine/dist/node_modules/@date-fns/tz/tz/index-CEcibV-H.js +1 -0
- package/dist/chunks/pkg/booking-engine/dist/node_modules/@date-fns/tz/tzOffset/index-COlDDdap.js +22 -0
- package/dist/chunks/pkg/booking-engine/dist/pricing-BJaynUu_.js +3 -0
- package/dist/chunks/pkg/booking-engine/dist/utils/schedule-ssRov9xe.js +39 -0
- package/dist/chunks/pkg/booking-engine/dist/utils/timezone-B6XIbBPz.js +79 -0
- 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/components/ProductPriceBadge/index.d.ts.map +1 -1
- package/dist/components/ProductPriceBadge/index.js +86 -80
- package/dist/components/StorefrontCartPanel/index.d.ts +4 -4
- package/dist/components/StorefrontCartPanel/index.d.ts.map +1 -1
- package/dist/components/StorefrontCartPanel/index.js +10 -9
- package/dist/i18n/en.d.ts +42 -6
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +44 -8
- package/dist/i18n/fr.d.ts +42 -6
- package/dist/i18n/fr.d.ts.map +1 -1
- package/dist/i18n/fr.js +44 -8
- package/dist/index.d.ts +817 -36
- package/dist/index.js +67 -60
- package/dist/lib/booking.d.ts +0 -6
- package/dist/lib/booking.d.ts.map +1 -1
- package/dist/lib/booking.js +51 -65
- package/dist/lib/cartSummary.d.ts +5 -3
- package/dist/lib/cartSummary.d.ts.map +1 -1
- package/dist/lib/cartSummary.js +7 -7
- 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/pricing.d.ts +18 -6
- package/dist/lib/pricing.d.ts.map +1 -1
- package/dist/lib/pricing.js +45 -29
- 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.d.ts.map +1 -1
- package/dist/pages/BookingPage.js +205 -201
- package/dist/pages/CheckoutPage.d.ts.map +1 -1
- package/dist/pages/CheckoutPage.js +276 -273
- 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/checkout/components/CheckoutSummaryColumn.d.ts +2 -2
- package/dist/pages/checkout/components/CheckoutSummaryColumn.d.ts.map +1 -1
- package/dist/pages/checkout/components/CheckoutSummaryColumn.js +4 -4
- 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 };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./mini-CSEBo1ZP.js";
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { tzOffset as e } from "../tzOffset/index-COlDDdap.js";
|
|
2
|
+
//#region ../booking-engine/dist/node_modules/@date-fns/tz/date/mini.js
|
|
3
|
+
var t = class t extends Date {
|
|
4
|
+
constructor(...t) {
|
|
5
|
+
super(), t.length > 1 && typeof t[t.length - 1] == "string" && (this.timeZone = t.pop()), this.internal = /* @__PURE__ */ new Date(), isNaN(e(this.timeZone, this)) ? this.setTime(NaN) : t.length ? typeof t[0] == "number" && (t.length === 1 || t.length === 2 && typeof t[1] != "number") ? this.setTime(t[0]) : typeof t[0] == "string" ? this.setTime(+new Date(t[0])) : t[0] instanceof Date ? this.setTime(+t[0]) : (this.setTime(+new Date(...t)), a(this, NaN), r(this)) : this.setTime(Date.now());
|
|
6
|
+
}
|
|
7
|
+
static tz(e, ...n) {
|
|
8
|
+
return n.length ? new t(...n, e) : new t(Date.now(), e);
|
|
9
|
+
}
|
|
10
|
+
withTimeZone(e) {
|
|
11
|
+
return new t(+this, e);
|
|
12
|
+
}
|
|
13
|
+
getTimezoneOffset() {
|
|
14
|
+
let t = -e(this.timeZone, this);
|
|
15
|
+
return t > 0 ? Math.floor(t) : Math.ceil(t);
|
|
16
|
+
}
|
|
17
|
+
setTime(e) {
|
|
18
|
+
return Date.prototype.setTime.apply(this, arguments), r(this), +this;
|
|
19
|
+
}
|
|
20
|
+
[Symbol.for("constructDateFrom")](e) {
|
|
21
|
+
return new t(+new Date(e), this.timeZone);
|
|
22
|
+
}
|
|
23
|
+
}, n = /^(get|set)(?!UTC)/;
|
|
24
|
+
Object.getOwnPropertyNames(Date.prototype).forEach((e) => {
|
|
25
|
+
if (!n.test(e)) return;
|
|
26
|
+
let a = e.replace(n, "$1UTC");
|
|
27
|
+
t.prototype[a] && (e.startsWith("get") ? t.prototype[e] = function() {
|
|
28
|
+
return this.internal[a]();
|
|
29
|
+
} : (t.prototype[e] = function() {
|
|
30
|
+
return Date.prototype[a].apply(this.internal, arguments), i(this), +this;
|
|
31
|
+
}, t.prototype[a] = function() {
|
|
32
|
+
return Date.prototype[a].apply(this, arguments), r(this), +this;
|
|
33
|
+
}));
|
|
34
|
+
});
|
|
35
|
+
function r(t) {
|
|
36
|
+
t.internal.setTime(+t), t.internal.setUTCSeconds(t.internal.getUTCSeconds() - Math.round(-e(t.timeZone, t) * 60));
|
|
37
|
+
}
|
|
38
|
+
function i(e) {
|
|
39
|
+
Date.prototype.setFullYear.call(e, e.internal.getUTCFullYear(), e.internal.getUTCMonth(), e.internal.getUTCDate()), Date.prototype.setHours.call(e, e.internal.getUTCHours(), e.internal.getUTCMinutes(), e.internal.getUTCSeconds(), e.internal.getUTCMilliseconds()), a(e);
|
|
40
|
+
}
|
|
41
|
+
function a(t) {
|
|
42
|
+
let n = e(t.timeZone, t), r = n > 0 ? Math.floor(n) : Math.ceil(n), i = /* @__PURE__ */ new Date(+t);
|
|
43
|
+
i.setUTCHours(i.getUTCHours() - 1);
|
|
44
|
+
let a = -(/* @__PURE__ */ new Date(+t)).getTimezoneOffset(), o = a - -(/* @__PURE__ */ new Date(+i)).getTimezoneOffset(), s = Date.prototype.getHours.apply(t) !== t.internal.getUTCHours();
|
|
45
|
+
o && s && t.internal.setUTCMinutes(t.internal.getUTCMinutes() + o);
|
|
46
|
+
let c = a - r;
|
|
47
|
+
c && Date.prototype.setUTCMinutes.call(t, Date.prototype.getUTCMinutes.call(t) + c);
|
|
48
|
+
let l = /* @__PURE__ */ new Date(+t);
|
|
49
|
+
l.setUTCSeconds(0);
|
|
50
|
+
let u = a > 0 ? l.getSeconds() : (l.getSeconds() - 60) % 60, d = Math.round(-(e(t.timeZone, t) * 60)) % 60;
|
|
51
|
+
(d || u) && (t.internal.setUTCSeconds(t.internal.getUTCSeconds() + d), Date.prototype.setUTCSeconds.call(t, Date.prototype.getUTCSeconds.call(t) + d + u));
|
|
52
|
+
let f = e(t.timeZone, t), p = f > 0 ? Math.floor(f) : Math.ceil(f), m = -(/* @__PURE__ */ new Date(+t)).getTimezoneOffset() - p, h = p !== r, g = m - c;
|
|
53
|
+
if (h && g) {
|
|
54
|
+
Date.prototype.setUTCMinutes.call(t, Date.prototype.getUTCMinutes.call(t) + g);
|
|
55
|
+
let n = e(t.timeZone, t), r = p - (n > 0 ? Math.floor(n) : Math.ceil(n));
|
|
56
|
+
r && (t.internal.setUTCMinutes(t.internal.getUTCMinutes() + r), Date.prototype.setUTCMinutes.call(t, Date.prototype.getUTCMinutes.call(t) + r));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
//#endregion
|
|
60
|
+
export { t as TZDateMini };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "../date/index-DAbcklF5.js";
|
package/dist/chunks/pkg/booking-engine/dist/node_modules/@date-fns/tz/tzOffset/index-COlDDdap.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//#region ../booking-engine/dist/node_modules/@date-fns/tz/tzOffset/index.js
|
|
2
|
+
var e = {}, t = {};
|
|
3
|
+
function n(n, a) {
|
|
4
|
+
try {
|
|
5
|
+
let r = (e[n] ||= new Intl.DateTimeFormat("en-US", {
|
|
6
|
+
timeZone: n,
|
|
7
|
+
timeZoneName: "longOffset"
|
|
8
|
+
}).format)(a).split("GMT")[1];
|
|
9
|
+
return r in t ? t[r] : i(r, r.split(":"));
|
|
10
|
+
} catch {
|
|
11
|
+
if (n in t) return t[n];
|
|
12
|
+
let e = n?.match(r);
|
|
13
|
+
return e ? i(n, e.slice(1)) : NaN;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
var r = /([+-]\d\d):?(\d\d)?/;
|
|
17
|
+
function i(e, n) {
|
|
18
|
+
let r = +(n[0] || 0), i = +(n[1] || 0), a = (n[2] || 0) / 60;
|
|
19
|
+
return t[e] = r * 60 + i > 0 ? r * 60 + i + a : r * 60 - i - a;
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { n as tzOffset };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { calculatePriceForQuantity as e } from "./utils/pricing-CqXJ5fMP.js";
|
|
2
|
+
import { calculateRentalQuantity as t, combineDateAndTime as n } from "./utils/schedule-ssRov9xe.js";
|
|
3
|
+
export { e as calculatePriceForQuantity, t as calculateRentalQuantity, n as combineDateAndTime };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { getZonedDateTimeParts as e, zonedTimeToUtcDate as t } from "./timezone-B6XIbBPz.js";
|
|
2
|
+
//#region ../booking-engine/dist/utils/schedule.js
|
|
3
|
+
function n(e, n, r = "UTC") {
|
|
4
|
+
return t(e, n, r);
|
|
5
|
+
}
|
|
6
|
+
var r = 3600 * 1e3, i = 24 * r;
|
|
7
|
+
function a(t, n) {
|
|
8
|
+
let r = n === "UTC" ? {
|
|
9
|
+
year: t.getUTCFullYear(),
|
|
10
|
+
month: t.getUTCMonth() + 1,
|
|
11
|
+
day: t.getUTCDate()
|
|
12
|
+
} : e(t, n);
|
|
13
|
+
return Date.UTC(r.year, r.month - 1, r.day);
|
|
14
|
+
}
|
|
15
|
+
function o(t, n) {
|
|
16
|
+
return n === "UTC" ? t.getUTCHours() : e(t, n).hour;
|
|
17
|
+
}
|
|
18
|
+
function s(e, t, n, r) {
|
|
19
|
+
let s = a(e, r), c = a(t, r), l = Math.round((c - s) / i);
|
|
20
|
+
if (l <= 0) return 1;
|
|
21
|
+
let u = o(e, r) >= n, d = o(t, r) < n, f = u || d ? .5 : 0;
|
|
22
|
+
return l + 1 - f;
|
|
23
|
+
}
|
|
24
|
+
function c(e) {
|
|
25
|
+
let t = e.rentalUnits.find((t) => t.unit === e.baseUnit);
|
|
26
|
+
if (!t) throw Error(`Pricing configuration is missing a rental unit for base unit ${e.baseUnit}`);
|
|
27
|
+
if (t.durationHours <= 0) throw Error(`Rental unit ${e.baseUnit} must declare a positive duration`);
|
|
28
|
+
return t;
|
|
29
|
+
}
|
|
30
|
+
function l(e, t, n, i = "UTC") {
|
|
31
|
+
let a = c(n), o = n.halfDay, l = n.rentalUnits.some((e) => e.unit === "half_day");
|
|
32
|
+
if (n.baseUnit === "day" && o?.enabled === !0 && !l) return s(e, t, o?.boundaryHour ?? 12, i);
|
|
33
|
+
let u = a.durationHours * r;
|
|
34
|
+
if (u <= 0) throw Error("Base pricing unit must convert to a positive duration");
|
|
35
|
+
let d = Math.max(0, t.getTime() - e.getTime()) / u;
|
|
36
|
+
return Math.max(1, Math.ceil(d));
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { l as calculateRentalQuantity, n as combineDateAndTime };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { TZDateMini as e } from "../node_modules/@date-fns/tz/date/mini-CSEBo1ZP.js";
|
|
2
|
+
import "../node_modules/@date-fns/tz/index--u3Qf-qy.js";
|
|
3
|
+
//#region ../booking-engine/dist/utils/timezone.js
|
|
4
|
+
var t = /^(\d{4})-(\d{2})-(\d{2})$/, n = /^(\d{2}):(\d{2})$/;
|
|
5
|
+
function r(e) {
|
|
6
|
+
try {
|
|
7
|
+
new Intl.DateTimeFormat("en-US", { timeZone: e });
|
|
8
|
+
} catch (t) {
|
|
9
|
+
throw t instanceof RangeError ? Error(`Invalid IANA timeZone provided: ${e}`) : t;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function i(e, n = "date") {
|
|
13
|
+
let r = t.exec(e);
|
|
14
|
+
if (!r) throw Error(`Invalid ${n}: expected YYYY-MM-DD, received ${e}`);
|
|
15
|
+
let i = Number(r[1]), a = Number(r[2]), o = Number(r[3]);
|
|
16
|
+
if (!Number.isInteger(i) || i < 0) throw Error(`Invalid ${n}: year must be a positive integer, received ${e}`);
|
|
17
|
+
if (!Number.isInteger(a) || a < 1 || a > 12) throw Error(`Invalid ${n}: month must be between 01 and 12, received ${e}`);
|
|
18
|
+
if (!Number.isInteger(o) || o < 1 || o > 31) throw Error(`Invalid ${n}: day must be between 01 and 31, received ${e}`);
|
|
19
|
+
let s = new Date(Date.UTC(i, a - 1, o));
|
|
20
|
+
if (s.getUTCFullYear() !== i || s.getUTCMonth() !== a - 1 || s.getUTCDate() !== o) throw Error(`Invalid ${n}: received ${e}`);
|
|
21
|
+
return {
|
|
22
|
+
year: i,
|
|
23
|
+
month: a,
|
|
24
|
+
day: o
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function a(e, t = "time") {
|
|
28
|
+
let r = n.exec(e);
|
|
29
|
+
if (!r) throw Error(`Invalid ${t}: expected HH:mm, received ${e}`);
|
|
30
|
+
let i = Number(r[1]), a = Number(r[2]);
|
|
31
|
+
if (!Number.isInteger(i) || i < 0 || i > 23) throw Error(`Invalid ${t}: hour must be between 00 and 23, received ${e}`);
|
|
32
|
+
if (!Number.isInteger(a) || a < 0 || a > 59) throw Error(`Invalid ${t}: minute must be between 00 and 59, received ${e}`);
|
|
33
|
+
return {
|
|
34
|
+
hour: i,
|
|
35
|
+
minute: a
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function o(e) {
|
|
39
|
+
let t = (t, n) => {
|
|
40
|
+
let r = e.find((e) => e.type === t)?.value;
|
|
41
|
+
if (!r) throw Error(`Unable to resolve ${n} from timeZone conversion`);
|
|
42
|
+
return Number(r);
|
|
43
|
+
};
|
|
44
|
+
return {
|
|
45
|
+
year: t("year", "year"),
|
|
46
|
+
month: t("month", "month"),
|
|
47
|
+
day: t("day", "day"),
|
|
48
|
+
hour: t("hour", "hour"),
|
|
49
|
+
minute: t("minute", "minute"),
|
|
50
|
+
second: t("second", "second")
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function s(e, t) {
|
|
54
|
+
return r(t), o(new Intl.DateTimeFormat("en-US", {
|
|
55
|
+
timeZone: t,
|
|
56
|
+
year: "numeric",
|
|
57
|
+
month: "2-digit",
|
|
58
|
+
day: "2-digit",
|
|
59
|
+
hour: "2-digit",
|
|
60
|
+
minute: "2-digit",
|
|
61
|
+
second: "2-digit",
|
|
62
|
+
hour12: !1,
|
|
63
|
+
hourCycle: "h23"
|
|
64
|
+
}).formatToParts(e));
|
|
65
|
+
}
|
|
66
|
+
function c(e, t) {
|
|
67
|
+
return e.year === t.year && e.month === t.month && e.day === t.day && e.hour === t.hour && e.minute === t.minute;
|
|
68
|
+
}
|
|
69
|
+
function l(t, n, o) {
|
|
70
|
+
r(o);
|
|
71
|
+
let l = i(t, "date"), u = a(n, "time"), d = {
|
|
72
|
+
...l,
|
|
73
|
+
...u
|
|
74
|
+
}, f = new e(d.year, d.month - 1, d.day, d.hour, d.minute, 0, o).getTime();
|
|
75
|
+
if (!c(s(new Date(f), o), d)) throw Error(`Invalid local datetime for timeZone ${o}: ${t} ${n} (DST shift?)`);
|
|
76
|
+
return new Date(f);
|
|
77
|
+
}
|
|
78
|
+
//#endregion
|
|
79
|
+
export { s as getZonedDateTimeParts, i as parseIsoDateParts, a as parseTimeOfDayParts, l as zonedTimeToUtcDate };
|