@loczer/storefront-sdk 0.197.0 → 0.199.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 (63) hide show
  1. package/dist/StorefrontContext.d.ts +483 -0
  2. package/dist/StorefrontContext.d.ts.map +1 -0
  3. package/dist/StorefrontContext.js +39 -0
  4. package/dist/StorefrontProvider.d.ts +6 -486
  5. package/dist/StorefrontProvider.d.ts.map +1 -1
  6. package/dist/StorefrontProvider.js +34 -67
  7. package/dist/chunks/pkg/ui/dist/{MorphingModalWizard-j1CgFGLe.js → MorphingModalWizard-DOH1GYVR.js} +1 -0
  8. package/dist/components/AboutSection/index.js +5 -5
  9. package/dist/components/BikeProductCard/index.d.ts +2 -1
  10. package/dist/components/BikeProductCard/index.d.ts.map +1 -1
  11. package/dist/components/BikeProductCard/index.js +28 -28
  12. package/dist/components/BookingBikeQuickAddCard/index.d.ts +19 -0
  13. package/dist/components/BookingBikeQuickAddCard/index.d.ts.map +1 -0
  14. package/dist/components/BookingBikeQuickAddCard/index.js +174 -0
  15. package/dist/components/BookingBikeVariantDialog/index.d.ts +5 -2
  16. package/dist/components/BookingBikeVariantDialog/index.d.ts.map +1 -1
  17. package/dist/components/BookingBikeVariantDialog/index.js +85 -93
  18. package/dist/components/BookingPeriodSelector/components/BookingEndDateField.js +1 -1
  19. package/dist/components/BookingPeriodSelector/components/BookingEndTimeField.js +1 -1
  20. package/dist/components/BookingPeriodSelector/components/BookingStartDateField.js +1 -1
  21. package/dist/components/BookingPeriodSelector/components/BookingStartTimeField.js +1 -1
  22. package/dist/components/ContactSection/index.js +107 -107
  23. package/dist/components/ContractSaleDocument/Invoice.d.ts.map +1 -1
  24. package/dist/components/ContractSaleDocument/Invoice.js +117 -111
  25. package/dist/components/Header/index.js +4 -4
  26. package/dist/components/Layout/index.d.ts.map +1 -1
  27. package/dist/components/Layout/index.js +47 -40
  28. package/dist/components/PlatformFooter/index.js +1 -1
  29. package/dist/components/ProductPriceBadge/index.d.ts +2 -1
  30. package/dist/components/ProductPriceBadge/index.d.ts.map +1 -1
  31. package/dist/components/ProductPriceBadge/index.js +72 -70
  32. package/dist/components/TestimonialsSection/index.js +1 -1
  33. package/dist/i18n/en.d.ts +3 -0
  34. package/dist/i18n/en.d.ts.map +1 -1
  35. package/dist/i18n/en.js +3 -0
  36. package/dist/i18n/fr.d.ts +3 -0
  37. package/dist/i18n/fr.d.ts.map +1 -1
  38. package/dist/i18n/fr.js +3 -0
  39. package/dist/index.d.ts +19 -2
  40. package/dist/index.js +59 -58
  41. package/dist/lib/cartSummary.js +7 -7
  42. package/dist/lib/products.d.ts +6 -0
  43. package/dist/lib/products.d.ts.map +1 -1
  44. package/dist/lib/products.js +36 -32
  45. package/dist/lib/toast.d.ts +9 -0
  46. package/dist/lib/toast.d.ts.map +1 -0
  47. package/dist/lib/toast.js +13 -0
  48. package/dist/pages/BookingPage.d.ts.map +1 -1
  49. package/dist/pages/BookingPage.js +323 -396
  50. package/dist/pages/CheckoutPage.js +217 -217
  51. package/dist/pages/CheckoutPaymentPage.js +124 -124
  52. package/dist/pages/ContractSaleDocumentPage.d.ts.map +1 -1
  53. package/dist/pages/ContractSaleDocumentPage.js +83 -83
  54. package/dist/pages/ErrorPage.d.ts.map +1 -1
  55. package/dist/pages/ErrorPage.js +13 -13
  56. package/dist/pages/HomePage.js +6 -3
  57. package/dist/pages/NotFoundPage.js +1 -1
  58. package/dist/pages/ProductPage.d.ts.map +1 -1
  59. package/dist/pages/ProductPage.js +177 -165
  60. package/dist/pages/checkout/components/CheckoutPaymentSummaryCard.js +1 -1
  61. package/dist/storefront.css +1 -1
  62. package/dist/ui/button.js +3 -3
  63. package/package.json +3 -1
@@ -1,16 +1,3 @@
1
- import { StorefrontI18nLanguage } from './i18n/I18nProvider';
2
- import { StorefrontConfiguration } from './storefrontSchemas';
3
- import { AccessoryProduct, BikeProduct } from './lib/products';
4
- type StorefrontContextValue = {
5
- storeSlug: string;
6
- storefrontConfiguration: StorefrontConfiguration;
7
- bikes: BikeProduct[];
8
- accessories: AccessoryProduct[];
9
- bookingBikes: BikeProduct[];
10
- bookingAccessories: AccessoryProduct[];
11
- mapboxToken?: string;
12
- language: StorefrontI18nLanguage;
13
- };
14
1
  export declare const loader: ({ ctx, params }: import('@rpcbase/client').LoaderArgs) => Promise<{
15
2
  storeSlug: string;
16
3
  storefrontConfiguration: {
@@ -240,479 +227,12 @@ export declare const loader: ({ ctx, params }: import('@rpcbase/client').LoaderA
240
227
  } | undefined;
241
228
  } | undefined;
242
229
  };
243
- bikes: BikeProduct[];
244
- accessories: AccessoryProduct[];
245
- bookingBikes: BikeProduct[];
246
- bookingAccessories: AccessoryProduct[];
247
- language: StorefrontI18nLanguage;
230
+ bikes: import('.').BikeProduct[];
231
+ accessories: import('.').AccessoryProduct[];
232
+ bookingBikes: import('.').BikeProduct[];
233
+ bookingAccessories: import('.').AccessoryProduct[];
234
+ language: import('./i18n/I18nProvider').StorefrontI18nLanguage;
248
235
  }>;
249
236
  export default function StorefrontProvider(): import("react/jsx-runtime").JSX.Element;
250
- export declare function useStorefront(): StorefrontContextValue;
251
- export declare function useOptionalStorefront(): StorefrontContextValue | undefined;
252
- export declare function useStorefrontConfig(): {
253
- config: {
254
- storeSlug: string;
255
- shop: {
256
- id: string;
257
- name: string;
258
- slug?: string | undefined;
259
- logoImageId?: string | undefined;
260
- timeZone?: string | undefined;
261
- url?: string | undefined;
262
- googleMapsLink?: string | undefined;
263
- googleRequestReviewsLink?: string | undefined;
264
- emailAddress?: string | undefined;
265
- contactPhone1?: string | undefined;
266
- contactPhone2?: string | undefined;
267
- address?: string | undefined;
268
- city?: string | undefined;
269
- country?: string | undefined;
270
- gpsCoordinates?: [number, number] | undefined;
271
- };
272
- settings: {
273
- status: "unpublished" | "published";
274
- checkoutMode: "auto_approve_when_possible" | "manual_approval_required";
275
- availabilityDisplay: {
276
- defaultMode: "fewRemaining" | "fewRemainingCounts" | "remainingCounts" | "soldOutAndFewRemaining" | "soldOutOnly";
277
- defaultFewRemainingThreshold?: number | undefined;
278
- };
279
- enabled: boolean;
280
- fulfillmentModes: ("pickup" | "delivery")[];
281
- deliveryDisabledReason: string;
282
- sameDayCutoff: string;
283
- };
284
- bookingEngine: {
285
- availabilityDisplay: {
286
- defaultMode: "fewRemaining" | "fewRemainingCounts" | "remainingCounts" | "soldOutAndFewRemaining" | "soldOutOnly";
287
- defaultFewRemainingThreshold?: number | undefined;
288
- };
289
- holdSettings: {
290
- enabled: boolean;
291
- defaultTtlMinutes: number;
292
- };
293
- pricing: {
294
- baseUnit: "day" | "half_day" | "hour" | "month" | "week";
295
- rentalUnits: {
296
- unit: "day" | "half_day" | "hour" | "month" | "week";
297
- durationHours: number;
298
- label?: Record<string, {
299
- [x: string]: unknown;
300
- value: string;
301
- updatedAt: Date;
302
- autoTranslated?: boolean | undefined;
303
- }> | undefined;
304
- }[];
305
- halfDay?: {
306
- enabled: boolean;
307
- boundaryHour: number;
308
- } | undefined;
309
- };
310
- bookingDeposit: {
311
- enabled: boolean;
312
- percentage: number;
313
- optimizeDepositAmount: boolean;
314
- };
315
- cancellationPolicy: {
316
- tiers: {
317
- upToHours: number;
318
- refundPercentage: number;
319
- }[];
320
- };
321
- securityDeposit: {
322
- mode: "optional" | "disabled" | "required";
323
- };
324
- shop: {
325
- timeZone: string;
326
- openingHours: {
327
- name: string;
328
- startDate: string;
329
- endDate: string;
330
- openingHours: {
331
- day: 0 | 1 | 2 | 3 | 4 | 5 | 6;
332
- openingSlots: {
333
- start: string;
334
- end: string;
335
- }[];
336
- }[];
337
- }[];
338
- openingHoursOverrides?: {
339
- date: string;
340
- openingSlots: {
341
- start: string;
342
- end: string;
343
- }[];
344
- }[] | undefined;
345
- extraTimeSlots?: {
346
- minutesAfterClose: number;
347
- extraAmount: number;
348
- }[] | undefined;
349
- };
350
- currency: "CHF" | "EUR" | "GBP" | "USD";
351
- checkout: {
352
- mode: "auto_approve_when_possible" | "manual_approval_required";
353
- dynamicOptions?: {
354
- fulfillmentModes?: ("pickup" | "delivery")[] | undefined;
355
- sameDayCutoff?: string | undefined;
356
- } | undefined;
357
- };
358
- };
359
- workspace?: {
360
- name?: string | undefined;
361
- workspaceLanguage?: "fr" | "en" | undefined;
362
- languages?: string[] | undefined;
363
- } | undefined;
364
- content?: {
365
- heroMode: "current_booking_hero" | "booking_bar_overlay_hero" | "vertical_marquee_hero";
366
- galleryImageIds: string[];
367
- whatsappPhone1Enabled: boolean;
368
- whatsappPhone2Enabled: boolean;
369
- showWhatsappFloatingButton: boolean;
370
- modalMessages: {
371
- id: string;
372
- enabled: boolean;
373
- showOnEachVisit: boolean;
374
- startDate: string | null;
375
- endDate: string | null;
376
- imageIds: string[];
377
- title?: Record<string, {
378
- [x: string]: unknown;
379
- value: string;
380
- updatedAt: Date;
381
- autoTranslated?: boolean | undefined;
382
- }> | undefined;
383
- subtitle?: Record<string, {
384
- [x: string]: unknown;
385
- value: string;
386
- updatedAt: Date;
387
- autoTranslated?: boolean | undefined;
388
- }> | undefined;
389
- message?: Record<string, {
390
- version: 1;
391
- json: string;
392
- html: string;
393
- text: string;
394
- }> | undefined;
395
- }[];
396
- faq: {
397
- general: {
398
- id: string;
399
- question: Record<string, {
400
- [x: string]: unknown;
401
- value: string;
402
- updatedAt: Date;
403
- autoTranslated?: boolean | undefined;
404
- }>;
405
- answer: Record<string, {
406
- [x: string]: unknown;
407
- value: string;
408
- updatedAt: Date;
409
- autoTranslated?: boolean | undefined;
410
- }>;
411
- }[];
412
- deliveries: {
413
- id: string;
414
- question: Record<string, {
415
- [x: string]: unknown;
416
- value: string;
417
- updatedAt: Date;
418
- autoTranslated?: boolean | undefined;
419
- }>;
420
- answer: Record<string, {
421
- [x: string]: unknown;
422
- value: string;
423
- updatedAt: Date;
424
- autoTranslated?: boolean | undefined;
425
- }>;
426
- }[];
427
- booking: {
428
- id: string;
429
- question: Record<string, {
430
- [x: string]: unknown;
431
- value: string;
432
- updatedAt: Date;
433
- autoTranslated?: boolean | undefined;
434
- }>;
435
- answer: Record<string, {
436
- [x: string]: unknown;
437
- value: string;
438
- updatedAt: Date;
439
- autoTranslated?: boolean | undefined;
440
- }>;
441
- }[];
442
- };
443
- tagline?: Record<string, {
444
- [x: string]: unknown;
445
- value: string;
446
- updatedAt: Date;
447
- autoTranslated?: boolean | undefined;
448
- }> | undefined;
449
- logoSquareImageId?: string | undefined;
450
- logoWideImageId?: string | undefined;
451
- topBannerMessage?: Record<string, {
452
- [x: string]: unknown;
453
- value: string;
454
- updatedAt: Date;
455
- autoTranslated?: boolean | undefined;
456
- }> | undefined;
457
- about?: Record<string, {
458
- version: 1;
459
- json: string;
460
- html: string;
461
- text: string;
462
- }> | undefined;
463
- whatsappMessage?: Record<string, {
464
- [x: string]: unknown;
465
- value: string;
466
- updatedAt: Date;
467
- autoTranslated?: boolean | undefined;
468
- }> | undefined;
469
- } | undefined;
470
- modules?: {
471
- reviews?: {
472
- enabled: boolean;
473
- showRecentReviewsOnStorefront: boolean;
474
- } | undefined;
475
- insurance?: {
476
- enabled: boolean;
477
- } | undefined;
478
- } | undefined;
479
- };
480
- storefrontConfiguration: {
481
- storeSlug: string;
482
- shop: {
483
- id: string;
484
- name: string;
485
- slug?: string | undefined;
486
- logoImageId?: string | undefined;
487
- timeZone?: string | undefined;
488
- url?: string | undefined;
489
- googleMapsLink?: string | undefined;
490
- googleRequestReviewsLink?: string | undefined;
491
- emailAddress?: string | undefined;
492
- contactPhone1?: string | undefined;
493
- contactPhone2?: string | undefined;
494
- address?: string | undefined;
495
- city?: string | undefined;
496
- country?: string | undefined;
497
- gpsCoordinates?: [number, number] | undefined;
498
- };
499
- settings: {
500
- status: "unpublished" | "published";
501
- checkoutMode: "auto_approve_when_possible" | "manual_approval_required";
502
- availabilityDisplay: {
503
- defaultMode: "fewRemaining" | "fewRemainingCounts" | "remainingCounts" | "soldOutAndFewRemaining" | "soldOutOnly";
504
- defaultFewRemainingThreshold?: number | undefined;
505
- };
506
- enabled: boolean;
507
- fulfillmentModes: ("pickup" | "delivery")[];
508
- deliveryDisabledReason: string;
509
- sameDayCutoff: string;
510
- };
511
- bookingEngine: {
512
- availabilityDisplay: {
513
- defaultMode: "fewRemaining" | "fewRemainingCounts" | "remainingCounts" | "soldOutAndFewRemaining" | "soldOutOnly";
514
- defaultFewRemainingThreshold?: number | undefined;
515
- };
516
- holdSettings: {
517
- enabled: boolean;
518
- defaultTtlMinutes: number;
519
- };
520
- pricing: {
521
- baseUnit: "day" | "half_day" | "hour" | "month" | "week";
522
- rentalUnits: {
523
- unit: "day" | "half_day" | "hour" | "month" | "week";
524
- durationHours: number;
525
- label?: Record<string, {
526
- [x: string]: unknown;
527
- value: string;
528
- updatedAt: Date;
529
- autoTranslated?: boolean | undefined;
530
- }> | undefined;
531
- }[];
532
- halfDay?: {
533
- enabled: boolean;
534
- boundaryHour: number;
535
- } | undefined;
536
- };
537
- bookingDeposit: {
538
- enabled: boolean;
539
- percentage: number;
540
- optimizeDepositAmount: boolean;
541
- };
542
- cancellationPolicy: {
543
- tiers: {
544
- upToHours: number;
545
- refundPercentage: number;
546
- }[];
547
- };
548
- securityDeposit: {
549
- mode: "optional" | "disabled" | "required";
550
- };
551
- shop: {
552
- timeZone: string;
553
- openingHours: {
554
- name: string;
555
- startDate: string;
556
- endDate: string;
557
- openingHours: {
558
- day: 0 | 1 | 2 | 3 | 4 | 5 | 6;
559
- openingSlots: {
560
- start: string;
561
- end: string;
562
- }[];
563
- }[];
564
- }[];
565
- openingHoursOverrides?: {
566
- date: string;
567
- openingSlots: {
568
- start: string;
569
- end: string;
570
- }[];
571
- }[] | undefined;
572
- extraTimeSlots?: {
573
- minutesAfterClose: number;
574
- extraAmount: number;
575
- }[] | undefined;
576
- };
577
- currency: "CHF" | "EUR" | "GBP" | "USD";
578
- checkout: {
579
- mode: "auto_approve_when_possible" | "manual_approval_required";
580
- dynamicOptions?: {
581
- fulfillmentModes?: ("pickup" | "delivery")[] | undefined;
582
- sameDayCutoff?: string | undefined;
583
- } | undefined;
584
- };
585
- };
586
- workspace?: {
587
- name?: string | undefined;
588
- workspaceLanguage?: "fr" | "en" | undefined;
589
- languages?: string[] | undefined;
590
- } | undefined;
591
- content?: {
592
- heroMode: "current_booking_hero" | "booking_bar_overlay_hero" | "vertical_marquee_hero";
593
- galleryImageIds: string[];
594
- whatsappPhone1Enabled: boolean;
595
- whatsappPhone2Enabled: boolean;
596
- showWhatsappFloatingButton: boolean;
597
- modalMessages: {
598
- id: string;
599
- enabled: boolean;
600
- showOnEachVisit: boolean;
601
- startDate: string | null;
602
- endDate: string | null;
603
- imageIds: string[];
604
- title?: Record<string, {
605
- [x: string]: unknown;
606
- value: string;
607
- updatedAt: Date;
608
- autoTranslated?: boolean | undefined;
609
- }> | undefined;
610
- subtitle?: Record<string, {
611
- [x: string]: unknown;
612
- value: string;
613
- updatedAt: Date;
614
- autoTranslated?: boolean | undefined;
615
- }> | undefined;
616
- message?: Record<string, {
617
- version: 1;
618
- json: string;
619
- html: string;
620
- text: string;
621
- }> | undefined;
622
- }[];
623
- faq: {
624
- general: {
625
- id: string;
626
- question: Record<string, {
627
- [x: string]: unknown;
628
- value: string;
629
- updatedAt: Date;
630
- autoTranslated?: boolean | undefined;
631
- }>;
632
- answer: Record<string, {
633
- [x: string]: unknown;
634
- value: string;
635
- updatedAt: Date;
636
- autoTranslated?: boolean | undefined;
637
- }>;
638
- }[];
639
- deliveries: {
640
- id: string;
641
- question: Record<string, {
642
- [x: string]: unknown;
643
- value: string;
644
- updatedAt: Date;
645
- autoTranslated?: boolean | undefined;
646
- }>;
647
- answer: Record<string, {
648
- [x: string]: unknown;
649
- value: string;
650
- updatedAt: Date;
651
- autoTranslated?: boolean | undefined;
652
- }>;
653
- }[];
654
- booking: {
655
- id: string;
656
- question: Record<string, {
657
- [x: string]: unknown;
658
- value: string;
659
- updatedAt: Date;
660
- autoTranslated?: boolean | undefined;
661
- }>;
662
- answer: Record<string, {
663
- [x: string]: unknown;
664
- value: string;
665
- updatedAt: Date;
666
- autoTranslated?: boolean | undefined;
667
- }>;
668
- }[];
669
- };
670
- tagline?: Record<string, {
671
- [x: string]: unknown;
672
- value: string;
673
- updatedAt: Date;
674
- autoTranslated?: boolean | undefined;
675
- }> | undefined;
676
- logoSquareImageId?: string | undefined;
677
- logoWideImageId?: string | undefined;
678
- topBannerMessage?: Record<string, {
679
- [x: string]: unknown;
680
- value: string;
681
- updatedAt: Date;
682
- autoTranslated?: boolean | undefined;
683
- }> | undefined;
684
- about?: Record<string, {
685
- version: 1;
686
- json: string;
687
- html: string;
688
- text: string;
689
- }> | undefined;
690
- whatsappMessage?: Record<string, {
691
- [x: string]: unknown;
692
- value: string;
693
- updatedAt: Date;
694
- autoTranslated?: boolean | undefined;
695
- }> | undefined;
696
- } | undefined;
697
- modules?: {
698
- reviews?: {
699
- enabled: boolean;
700
- showRecentReviewsOnStorefront: boolean;
701
- } | undefined;
702
- insurance?: {
703
- enabled: boolean;
704
- } | undefined;
705
- } | undefined;
706
- };
707
- };
708
- export declare function useStorefrontWorkspaceLanguage(): StorefrontI18nLanguage;
709
- export declare function useStorefrontProducts(): {
710
- bikes: BikeProduct[];
711
- accessories: AccessoryProduct[];
712
- };
713
- export declare function useStorefrontBookingProducts(): {
714
- bikes: BikeProduct[];
715
- accessories: AccessoryProduct[];
716
- };
717
- export {};
237
+ export * from './StorefrontContext';
718
238
  //# sourceMappingURL=StorefrontProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"StorefrontProvider.d.ts","sourceRoot":"","sources":["../src/StorefrontProvider.tsx"],"names":[],"mappings":"AAKA,OAAO,EAIL,KAAK,sBAAsB,EAC5B,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAiC,KAAK,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAOjG,OAAO,EAIL,KAAK,gBAAgB,EACrB,KAAK,WAAW,EACjB,MAAM,gBAAgB,CAAA;AAGvB,KAAK,sBAAsB,GAAG;IAC5B,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;CACjC,CAAA;AAKD,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiEA,CAAA;AAGnB,MAAM,CAAC,OAAO,UAAU,kBAAkB,4CAqBzC;AAED,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"}
1
+ {"version":3,"file":"StorefrontProvider.d.ts","sourceRoot":"","sources":["../src/StorefrontProvider.tsx"],"names":[],"mappings":"AAwBA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiEA,CAAA;AAGnB,MAAM,CAAC,OAAO,UAAU,kBAAkB,4CAqBzC;AAED,cAAc,qBAAqB,CAAA"}
@@ -3,63 +3,63 @@ import { toStorefrontAccessoryProducts as t, toStorefrontBikeProducts as n, toSt
3
3
  import { ROUTE as i, responseSchema as a } from "./lib/storefrontProducts.js";
4
4
  import { I18nProvider as o, detectStorefrontI18nLanguage as s, resolveStorefrontI18nRequestLanguage as c } from "./i18n/I18nProvider.js";
5
5
  import { Layout as l } from "./components/Layout/index.js";
6
- import { createStorefrontUnavailableError as u, isStorefrontUnavailableRouteError as d, parseStorefrontUnavailableStatus as f } from "./lib/storefrontUnavailable.js";
7
- import { createContext as p, useContext as m } from "react";
8
- import { jsx as h } from "react/jsx-runtime";
9
- import { apiClient as g } from "@rpcbase/client";
10
- import { useLoaderData as _ } from "@rpcbase/router";
6
+ import { StorefrontContext as u, useOptionalStorefront as d, useStorefront as f, useStorefrontBookingProducts as p, useStorefrontConfig as m, useStorefrontProducts as h, useStorefrontWorkspaceLanguage as g } from "./StorefrontContext.js";
7
+ import { createStorefrontUnavailableError as _, isStorefrontUnavailableRouteError as v, parseStorefrontUnavailableStatus as y } from "./lib/storefrontUnavailable.js";
8
+ import { jsx as b } from "react/jsx-runtime";
9
+ import { apiClient as x } from "@rpcbase/client";
10
+ import { useLoaderData as S } from "@rpcbase/router";
11
11
  //#region src/StorefrontProvider.tsx
12
- var v = p(void 0), y = (async ({ ctx: o, params: l }) => {
13
- let p = typeof l.storeSlug == "string" ? l.storeSlug.trim().toLowerCase() : "";
14
- if (!p) throw u("unknown");
12
+ var C = (async ({ ctx: o, params: l }) => {
13
+ let u = typeof l.storeSlug == "string" ? l.storeSlug.trim().toLowerCase() : "";
14
+ if (!u) throw _("unknown");
15
15
  try {
16
- let [l, d] = await Promise.all([g.get("/api/public/storefront/config", { storeSlug: p }, o), g.get(i, { storeSlug: p }, o)]), m = typeof l == "object" && l ? l : {};
17
- if (m.success !== !0) throw u(f(m.storefrontStatus) ?? "unknown", typeof m.replacementSlug == "string" ? m.replacementSlug : void 0);
18
- let h = e.safeParse(m.storefrontConfiguration);
19
- if (!h.success) throw console.error("Invalid storefront config received", h.error.flatten()), new Response("Storefront config invalid", { status: 500 });
20
- let _ = a.safeParse(d);
21
- if (!_.success) throw console.error("Invalid storefront products received", _.error.flatten()), new Response("Storefront products invalid", { status: 500 });
22
- if (!_.data.success) throw console.error("Storefront products unavailable", _.data.message ?? "Unknown error"), new Response("Storefront products unavailable", { status: 500 });
23
- let v = n(_.data.products.bikes), y = t(_.data.products.accessories), b = r({
24
- bikes: v,
25
- accessories: y
26
- }), x = h.data.workspace?.languages ?? null, S = h.data.workspace?.workspaceLanguage ?? null, C = o?.req ? c({
16
+ let [l, d] = await Promise.all([x.get("/api/public/storefront/config", { storeSlug: u }, o), x.get(i, { storeSlug: u }, o)]), f = typeof l == "object" && l ? l : {};
17
+ if (f.success !== !0) throw _(y(f.storefrontStatus) ?? "unknown", typeof f.replacementSlug == "string" ? f.replacementSlug : void 0);
18
+ let p = e.safeParse(f.storefrontConfiguration);
19
+ if (!p.success) throw console.error("Invalid storefront config received", p.error.flatten()), new Response("Storefront config invalid", { status: 500 });
20
+ let m = a.safeParse(d);
21
+ if (!m.success) throw console.error("Invalid storefront products received", m.error.flatten()), new Response("Storefront products invalid", { status: 500 });
22
+ if (!m.data.success) throw console.error("Storefront products unavailable", m.data.message ?? "Unknown error"), new Response("Storefront products unavailable", { status: 500 });
23
+ let h = n(m.data.products.bikes), g = t(m.data.products.accessories), v = r({
24
+ bikes: h,
25
+ accessories: g
26
+ }), b = p.data.workspace?.languages ?? null, S = p.data.workspace?.workspaceLanguage ?? null, C = o?.req ? c({
27
27
  cookieHeader: o.req.headers?.cookie,
28
28
  acceptLanguageHeader: o.req.headers?.["accept-language"],
29
- configuredLanguages: x,
29
+ configuredLanguages: b,
30
30
  configuredFallbackLanguage: S
31
- }) : s(x, S);
31
+ }) : s(b, S);
32
32
  return {
33
- storeSlug: p,
34
- storefrontConfiguration: h.data,
35
- bikes: v,
36
- accessories: y,
37
- bookingBikes: b.bikes,
38
- bookingAccessories: b.accessories,
33
+ storeSlug: u,
34
+ storefrontConfiguration: p.data,
35
+ bikes: h,
36
+ accessories: g,
37
+ bookingBikes: v.bikes,
38
+ bookingAccessories: v.accessories,
39
39
  language: C
40
40
  };
41
41
  } catch (e) {
42
- throw d(e) || e instanceof Response ? e : (console.error("Error loading storefront:", e), new Response("Storefront unavailable", { status: 500 }));
42
+ throw v(e) || e instanceof Response ? e : (console.error("Error loading storefront:", e), new Response("Storefront unavailable", { status: 500 }));
43
43
  }
44
44
  });
45
- function b() {
46
- let e = _(), t = {
45
+ function w() {
46
+ let e = S(), t = {
47
47
  BASE_URL: "/",
48
48
  DEV: !1,
49
49
  MODE: "production",
50
50
  PROD: !0,
51
51
  SSR: !1
52
52
  }, 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__ */ h(v.Provider, {
53
+ return /* @__PURE__ */ b(u.Provider, {
54
54
  value: {
55
55
  ...e,
56
56
  mapboxToken: n
57
57
  },
58
- children: /* @__PURE__ */ h(o, {
58
+ children: /* @__PURE__ */ b(o, {
59
59
  initialLanguage: e.language,
60
60
  configuredLanguages: e.storefrontConfiguration.workspace?.languages,
61
61
  configuredFallbackLanguage: e.storefrontConfiguration.workspace?.workspaceLanguage,
62
- children: /* @__PURE__ */ h(l, {
62
+ children: /* @__PURE__ */ b(l, {
63
63
  storefrontConfiguration: e.storefrontConfiguration,
64
64
  storefrontProducts: {
65
65
  bikes: e.bikes,
@@ -69,38 +69,5 @@ function b() {
69
69
  })
70
70
  });
71
71
  }
72
- function x() {
73
- let e = m(v);
74
- if (e === void 0) throw Error("must be used within the provider");
75
- return e;
76
- }
77
- function S() {
78
- return m(v);
79
- }
80
- function C() {
81
- let { storefrontConfiguration: e } = x();
82
- return {
83
- config: e,
84
- storefrontConfiguration: e
85
- };
86
- }
87
- function w() {
88
- let { storefrontConfiguration: e } = x();
89
- return e.workspace?.workspaceLanguage ?? "en";
90
- }
91
- function T() {
92
- let { bikes: e, accessories: t } = x();
93
- return {
94
- bikes: e,
95
- accessories: t
96
- };
97
- }
98
- function E() {
99
- let { bookingBikes: e, bookingAccessories: t } = x();
100
- return {
101
- bikes: e,
102
- accessories: t
103
- };
104
- }
105
72
  //#endregion
106
- export { b as default, y as loader, S as useOptionalStorefront, x as useStorefront, E as useStorefrontBookingProducts, C as useStorefrontConfig, T as useStorefrontProducts, w as useStorefrontWorkspaceLanguage };
73
+ export { u as StorefrontContext, w as default, C as loader, d as useOptionalStorefront, f as useStorefront, p as useStorefrontBookingProducts, m as useStorefrontConfig, h as useStorefrontProducts, g as useStorefrontWorkspaceLanguage };
@@ -5,6 +5,7 @@ import "./Button-Cr_u8vnh.js";
5
5
  import { createContext as e, useContext as t } from "react";
6
6
  import "react/jsx-runtime";
7
7
  import "lucide-react";
8
+ import "framer-motion";
8
9
  //#region ../ui/dist/MorphingModalWizard.js
9
10
  var n = e(null), r = () => t(n);
10
11
  //#endregion