@suiteop/storefront 0.1.1 → 0.2.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/CHANGELOG.md +29 -0
- package/README.md +74 -0
- package/dist/astro-content-model.cjs +17 -0
- package/dist/astro-content-model.d.cts +4 -0
- package/dist/astro-content-model.d.ts +4 -0
- package/dist/astro-content-model.js +10 -0
- package/dist/astro.cjs +3 -1
- package/dist/astro.d.cts +38 -17
- package/dist/astro.d.ts +38 -17
- package/dist/astro.js +2 -2
- package/dist/checkout.cjs +3 -3
- package/dist/checkout.js +2 -2
- package/dist/chunk-2U6L33AT.cjs +19 -0
- package/dist/chunk-4GZBXKBU.cjs +18 -0
- package/dist/chunk-GJSCEBSU.js +5 -0
- package/dist/chunk-HLGSWF4I.js +9 -0
- package/dist/{chunk-YFTWGF3L.js → chunk-HMLBMNGA.js} +1 -1
- package/dist/chunk-KKJCPKPY.js +8 -0
- package/dist/chunk-PYVUDQSQ.js +3 -0
- package/dist/chunk-USOISC2R.cjs +17 -0
- package/dist/{chunk-RDREYP27.cjs → chunk-VV2UNVQ2.cjs} +2 -2
- package/dist/chunk-ZHFZ6II2.cjs +16 -0
- package/dist/chunk-ZI2PG7LS.js +6 -0
- package/dist/chunk-ZLAOY6IF.cjs +9 -0
- package/dist/{errors-y-BiaVAk.d.cts → client-DER7y1WE.d.cts} +98 -147
- package/dist/{errors-Bp_jmXbA.d.ts → client-goQnVoLP.d.ts} +98 -147
- package/dist/components.cjs +1 -1
- package/dist/components.js +1 -1
- package/dist/config.cjs +6 -2
- package/dist/config.d.cts +33 -1
- package/dist/config.d.ts +33 -1
- package/dist/config.js +3 -2
- package/dist/content.cjs +37 -0
- package/dist/content.d.cts +254 -0
- package/dist/content.d.ts +254 -0
- package/dist/content.js +4 -0
- package/dist/errors-B2eCo5Cz.d.cts +151 -0
- package/dist/errors-D-dULpp1.d.ts +151 -0
- package/dist/index.cjs +21 -20
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +4 -3
- package/dist/react.cjs +6 -5
- package/dist/react.d.cts +2 -1
- package/dist/react.d.ts +2 -1
- package/dist/react.js +5 -4
- package/package.json +22 -2
- package/dist/chunk-AIQUVZEI.cjs +0 -8
- package/dist/chunk-GIIXCS6X.cjs +0 -18
- package/dist/chunk-LIBKUMJV.js +0 -8
- package/dist/chunk-SK5TD73J.js +0 -3
- package/dist/chunk-UACP7BZ7.js +0 -6
- package/dist/chunk-XIAAWHAY.cjs +0 -17
|
@@ -42,6 +42,11 @@ declare const storefrontBookingSchema: z.ZodObject<{
|
|
|
42
42
|
totalMinor: z.ZodNullable<z.ZodNumber>;
|
|
43
43
|
currency: z.ZodNullable<z.ZodString>;
|
|
44
44
|
confirmationCode: z.ZodNullable<z.ZodString>;
|
|
45
|
+
lines: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
46
|
+
title: z.ZodString;
|
|
47
|
+
quantity: z.ZodNumber;
|
|
48
|
+
totalMinor: z.ZodNumber;
|
|
49
|
+
}, z.core.$strip>>>;
|
|
45
50
|
}, z.core.$strip>;
|
|
46
51
|
type StorefrontBooking = z.infer<typeof storefrontBookingSchema>;
|
|
47
52
|
|
|
@@ -53,6 +58,7 @@ declare const storefrontSiteSchema: z.ZodObject<{
|
|
|
53
58
|
enableWebChat: z.ZodBoolean;
|
|
54
59
|
mapEmbedHost: z.ZodNullable<z.ZodString>;
|
|
55
60
|
countryCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
61
|
+
bookingsOpen: z.ZodOptional<z.ZodBoolean>;
|
|
56
62
|
}, z.core.$strip>;
|
|
57
63
|
type StorefrontSite = z.infer<typeof storefrontSiteSchema>;
|
|
58
64
|
declare const storefrontListingSummarySchema: z.ZodObject<{
|
|
@@ -109,6 +115,13 @@ declare const storefrontListingsQuerySchema: z.ZodObject<{
|
|
|
109
115
|
offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
110
116
|
}, z.core.$strip>;
|
|
111
117
|
type StorefrontListingsQuery = z.infer<typeof storefrontListingsQuerySchema>;
|
|
118
|
+
declare const storefrontImageSchema: z.ZodObject<{
|
|
119
|
+
url: z.ZodString;
|
|
120
|
+
alt: z.ZodNullable<z.ZodString>;
|
|
121
|
+
width: z.ZodNullable<z.ZodNumber>;
|
|
122
|
+
height: z.ZodNullable<z.ZodNumber>;
|
|
123
|
+
}, z.core.$strip>;
|
|
124
|
+
type StorefrontImage = z.infer<typeof storefrontImageSchema>;
|
|
112
125
|
declare const storefrontBuildingSchema: z.ZodObject<{
|
|
113
126
|
id: z.ZodUUID;
|
|
114
127
|
locationId: z.ZodNullable<z.ZodUUID>;
|
|
@@ -119,6 +132,18 @@ declare const storefrontBuildingSchema: z.ZodObject<{
|
|
|
119
132
|
latitude: z.ZodNullable<z.ZodNumber>;
|
|
120
133
|
longitude: z.ZodNullable<z.ZodNumber>;
|
|
121
134
|
address: z.ZodUnknown;
|
|
135
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
136
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
137
|
+
imageUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
138
|
+
images: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
139
|
+
url: z.ZodString;
|
|
140
|
+
alt: z.ZodNullable<z.ZodString>;
|
|
141
|
+
width: z.ZodNullable<z.ZodNumber>;
|
|
142
|
+
height: z.ZodNullable<z.ZodNumber>;
|
|
143
|
+
}, z.core.$strip>>>>;
|
|
144
|
+
sortOrder: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
145
|
+
listingCount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
146
|
+
fields: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
|
|
122
147
|
}, z.core.$strip>;
|
|
123
148
|
type StorefrontBuilding = z.infer<typeof storefrontBuildingSchema>;
|
|
124
149
|
declare const storefrontLocationSchema: z.ZodObject<{
|
|
@@ -132,6 +157,17 @@ declare const storefrontLocationSchema: z.ZodObject<{
|
|
|
132
157
|
longitude: z.ZodNullable<z.ZodNumber>;
|
|
133
158
|
address: z.ZodUnknown;
|
|
134
159
|
sortOrder: z.ZodNumber;
|
|
160
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
161
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
162
|
+
imageUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
163
|
+
images: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
164
|
+
url: z.ZodString;
|
|
165
|
+
alt: z.ZodNullable<z.ZodString>;
|
|
166
|
+
width: z.ZodNullable<z.ZodNumber>;
|
|
167
|
+
height: z.ZodNullable<z.ZodNumber>;
|
|
168
|
+
}, z.core.$strip>>>>;
|
|
169
|
+
buildingCount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
170
|
+
fields: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
|
|
135
171
|
}, z.core.$strip>;
|
|
136
172
|
type StorefrontLocation = z.infer<typeof storefrontLocationSchema>;
|
|
137
173
|
declare const storefrontReviewSchema: z.ZodObject<{
|
|
@@ -297,6 +333,14 @@ declare const createCheckoutSessionInputSchema: z.ZodObject<{
|
|
|
297
333
|
variant: "a" | "b";
|
|
298
334
|
} | undefined;
|
|
299
335
|
} | null>>;
|
|
336
|
+
extras: z.ZodOptional<z.ZodObject<{
|
|
337
|
+
customFields: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
338
|
+
upsells: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
339
|
+
portalUpsellId: z.ZodUUID;
|
|
340
|
+
quantity: z.ZodNumber;
|
|
341
|
+
}, z.core.$strip>>>;
|
|
342
|
+
}, z.core.$strip>>;
|
|
343
|
+
hostSessionId: z.ZodOptional<z.ZodUUID>;
|
|
300
344
|
}, z.core.$strip>;
|
|
301
345
|
type CreateCheckoutSessionInput = z.infer<typeof createCheckoutSessionInputSchema>;
|
|
302
346
|
declare const checkoutSessionSchema: z.ZodObject<{
|
|
@@ -348,81 +392,49 @@ declare const checkoutSessionSchema: z.ZodObject<{
|
|
|
348
392
|
}, z.core.$loose>]>>;
|
|
349
393
|
chargedBy: z.ZodOptional<z.ZodLiteral<"host">>;
|
|
350
394
|
guestSaved: z.ZodOptional<z.ZodLiteral<true>>;
|
|
395
|
+
extras: z.ZodOptional<z.ZodObject<{
|
|
396
|
+
lines: z.ZodArray<z.ZodObject<{
|
|
397
|
+
portalUpsellId: z.ZodNullable<z.ZodUUID>;
|
|
398
|
+
title: z.ZodString;
|
|
399
|
+
quantity: z.ZodNumber;
|
|
400
|
+
totalMinor: z.ZodNumber;
|
|
401
|
+
}, z.core.$strip>>;
|
|
402
|
+
extrasTotalMinor: z.ZodNumber;
|
|
403
|
+
heldTotalMinor: z.ZodNumber;
|
|
404
|
+
}, z.core.$strip>>;
|
|
405
|
+
extrasSessionId: z.ZodOptional<z.ZodUUID>;
|
|
351
406
|
expiresAt: z.ZodISODateTime;
|
|
352
407
|
}, z.core.$strip>;
|
|
353
408
|
type CheckoutSession = z.infer<typeof checkoutSessionSchema>;
|
|
354
409
|
|
|
355
|
-
declare const
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
}, z.core.$
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
ts: z.ZodNumber;
|
|
384
|
-
path: z.ZodString;
|
|
385
|
-
referrerHost: z.ZodNullable<z.ZodString>;
|
|
386
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
387
|
-
name: z.ZodLiteral<"view_quote">;
|
|
388
|
-
listingId: z.ZodUUID;
|
|
389
|
-
valueMinor: z.ZodNumber;
|
|
390
|
-
currency: z.ZodString;
|
|
391
|
-
nights: z.ZodNumber;
|
|
392
|
-
eventId: z.ZodUUID;
|
|
393
|
-
ts: z.ZodNumber;
|
|
394
|
-
path: z.ZodString;
|
|
395
|
-
referrerHost: z.ZodNullable<z.ZodString>;
|
|
396
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
397
|
-
name: z.ZodLiteral<"begin_checkout">;
|
|
398
|
-
checkoutSessionId: z.ZodUUID;
|
|
399
|
-
eventId: z.ZodUUID;
|
|
400
|
-
ts: z.ZodNumber;
|
|
401
|
-
path: z.ZodString;
|
|
402
|
-
referrerHost: z.ZodNullable<z.ZodString>;
|
|
403
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
404
|
-
name: z.ZodLiteral<"add_payment_info">;
|
|
405
|
-
checkoutSessionId: z.ZodUUID;
|
|
406
|
-
eventId: z.ZodUUID;
|
|
407
|
-
ts: z.ZodNumber;
|
|
408
|
-
path: z.ZodString;
|
|
409
|
-
referrerHost: z.ZodNullable<z.ZodString>;
|
|
410
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
411
|
-
name: z.ZodLiteral<"generate_lead">;
|
|
412
|
-
formId: z.ZodOptional<z.ZodString>;
|
|
413
|
-
eventId: z.ZodUUID;
|
|
414
|
-
ts: z.ZodNumber;
|
|
415
|
-
path: z.ZodString;
|
|
416
|
-
referrerHost: z.ZodNullable<z.ZodString>;
|
|
417
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
418
|
-
name: z.ZodLiteral<"sign_up">;
|
|
419
|
-
method: z.ZodLiteral<"newsletter">;
|
|
420
|
-
eventId: z.ZodUUID;
|
|
421
|
-
ts: z.ZodNumber;
|
|
422
|
-
path: z.ZodString;
|
|
423
|
-
referrerHost: z.ZodNullable<z.ZodString>;
|
|
424
|
-
}, z.core.$strip>], "name">;
|
|
425
|
-
type StorefrontClientEvent = z.infer<typeof storefrontClientEventSchema>;
|
|
410
|
+
declare const storefrontContentRefSchema: z.ZodObject<{
|
|
411
|
+
kind: z.ZodString;
|
|
412
|
+
id: z.ZodUUID;
|
|
413
|
+
slug: z.ZodNullable<z.ZodString>;
|
|
414
|
+
}, z.core.$strip>;
|
|
415
|
+
type StorefrontContentRef = z.infer<typeof storefrontContentRefSchema>;
|
|
416
|
+
declare const storefrontContentItemSchema: z.ZodObject<{
|
|
417
|
+
id: z.ZodUUID;
|
|
418
|
+
type: z.ZodString;
|
|
419
|
+
slug: z.ZodNullable<z.ZodString>;
|
|
420
|
+
publishedAt: z.ZodNullable<z.ZodString>;
|
|
421
|
+
updatedAt: z.ZodString;
|
|
422
|
+
sortOrder: z.ZodNumber;
|
|
423
|
+
fields: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
424
|
+
}, z.core.$strip>;
|
|
425
|
+
type StorefrontContentItem = z.infer<typeof storefrontContentItemSchema>;
|
|
426
|
+
declare const storefrontContentModelSchema: z.ZodObject<{
|
|
427
|
+
version: z.ZodNumber;
|
|
428
|
+
types: z.ZodArray<z.ZodObject<{
|
|
429
|
+
key: z.ZodString;
|
|
430
|
+
kind: z.ZodString;
|
|
431
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
432
|
+
key: z.ZodString;
|
|
433
|
+
type: z.ZodString;
|
|
434
|
+
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
435
|
+
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
436
|
+
}, z.core.$strip>;
|
|
437
|
+
type StorefrontContentModel = z.infer<typeof storefrontContentModelSchema>;
|
|
426
438
|
|
|
427
439
|
declare const storefrontRatePlanQuoteSchema: z.ZodObject<{
|
|
428
440
|
ratePlanId: z.ZodString;
|
|
@@ -466,28 +478,6 @@ declare const storefrontQuoteSchema: z.ZodObject<{
|
|
|
466
478
|
}, z.core.$strip>;
|
|
467
479
|
type StorefrontQuote = z.infer<typeof storefrontQuoteSchema>;
|
|
468
480
|
|
|
469
|
-
type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
|
|
470
|
-
type TrackEvent = DistributiveOmit<StorefrontClientEvent, 'eventId' | 'ts' | 'path' | 'referrerHost'>;
|
|
471
|
-
type AnalyticsReporter = (err: unknown) => void;
|
|
472
|
-
interface AnalyticsOptions {
|
|
473
|
-
publishableKey: string;
|
|
474
|
-
report?: AnalyticsReporter;
|
|
475
|
-
}
|
|
476
|
-
interface StorefrontAnalytics {
|
|
477
|
-
track(event: TrackEvent): void;
|
|
478
|
-
pageView(): void;
|
|
479
|
-
flush(opts?: {
|
|
480
|
-
beacon?: boolean;
|
|
481
|
-
}): void;
|
|
482
|
-
dispose(): void;
|
|
483
|
-
}
|
|
484
|
-
declare function trackPurchasePixel(booking: Pick<BookingResult, 'bookingRequestId'> & {
|
|
485
|
-
totalMinor?: number | null;
|
|
486
|
-
currency?: string | null;
|
|
487
|
-
}): void;
|
|
488
|
-
declare function createAnalytics(opts: AnalyticsOptions): StorefrontAnalytics;
|
|
489
|
-
declare function analyticsFor(publishableKey: string): StorefrontAnalytics;
|
|
490
|
-
|
|
491
481
|
declare const STOREFRONT_API_PATH = "/api/storefront/v1";
|
|
492
482
|
interface StorefrontClientOptions {
|
|
493
483
|
publishableKey: string;
|
|
@@ -502,6 +492,10 @@ interface RequestOptions {
|
|
|
502
492
|
interface CreateCheckoutSessionOptions extends RequestOptions {
|
|
503
493
|
idempotencyKey?: string;
|
|
504
494
|
}
|
|
495
|
+
interface ContentListQuery {
|
|
496
|
+
limit?: number;
|
|
497
|
+
offset?: number;
|
|
498
|
+
}
|
|
505
499
|
interface Page<T> {
|
|
506
500
|
items: T[];
|
|
507
501
|
total: number;
|
|
@@ -529,6 +523,16 @@ interface StorefrontClient {
|
|
|
529
523
|
locations: {
|
|
530
524
|
list(opts?: RequestOptions): Promise<StorefrontLocation[]>;
|
|
531
525
|
};
|
|
526
|
+
contentModel: {
|
|
527
|
+
get(opts?: RequestOptions): Promise<StorefrontContentModel>;
|
|
528
|
+
};
|
|
529
|
+
collections: {
|
|
530
|
+
list(key: string, query?: ContentListQuery, opts?: RequestOptions): Promise<Page<StorefrontContentItem>>;
|
|
531
|
+
get(key: string, slugOrId: string, opts?: RequestOptions): Promise<StorefrontContentItem | null>;
|
|
532
|
+
};
|
|
533
|
+
sections: {
|
|
534
|
+
get(key: string, opts?: RequestOptions): Promise<StorefrontContentItem>;
|
|
535
|
+
};
|
|
532
536
|
amenities: {
|
|
533
537
|
list(opts?: RequestOptions): Promise<string[]>;
|
|
534
538
|
};
|
|
@@ -559,57 +563,4 @@ interface StorefrontClient {
|
|
|
559
563
|
}
|
|
560
564
|
declare function createStorefrontClient(options: StorefrontClientOptions): StorefrontClient;
|
|
561
565
|
|
|
562
|
-
|
|
563
|
-
type StorefrontErrorCode = (typeof STOREFRONT_ERROR_CODES)[number];
|
|
564
|
-
type StorefrontRegion = 'us' | 'eu' | 'apac';
|
|
565
|
-
interface StorefrontErrorInit {
|
|
566
|
-
status: number;
|
|
567
|
-
code: string;
|
|
568
|
-
message: string;
|
|
569
|
-
type?: string;
|
|
570
|
-
requestId?: string | null;
|
|
571
|
-
details?: Record<string, unknown>;
|
|
572
|
-
cause?: unknown;
|
|
573
|
-
}
|
|
574
|
-
declare class StorefrontError extends Error {
|
|
575
|
-
name: string;
|
|
576
|
-
readonly status: number;
|
|
577
|
-
readonly type: string;
|
|
578
|
-
readonly code: StorefrontErrorCode | (string & {});
|
|
579
|
-
readonly requestId: string | null;
|
|
580
|
-
readonly details: Record<string, unknown>;
|
|
581
|
-
constructor(init: StorefrontErrorInit);
|
|
582
|
-
}
|
|
583
|
-
declare class PriceChangedError extends StorefrontError {
|
|
584
|
-
name: string;
|
|
585
|
-
readonly quote: StorefrontQuote | null;
|
|
586
|
-
readonly requiresNewSession: boolean;
|
|
587
|
-
constructor(init: StorefrontErrorInit);
|
|
588
|
-
}
|
|
589
|
-
declare class WrongRegionError extends StorefrontError {
|
|
590
|
-
name: string;
|
|
591
|
-
readonly region: StorefrontRegion | null;
|
|
592
|
-
readonly baseUrl: string | null;
|
|
593
|
-
constructor(init: StorefrontErrorInit);
|
|
594
|
-
}
|
|
595
|
-
declare class RateLimitedError extends StorefrontError {
|
|
596
|
-
name: string;
|
|
597
|
-
readonly retryAfterSec: number | null;
|
|
598
|
-
readonly scope: 'key' | 'ip' | 'pms' | null;
|
|
599
|
-
constructor(init: StorefrontErrorInit & {
|
|
600
|
-
retryAfterSec: number | null;
|
|
601
|
-
});
|
|
602
|
-
}
|
|
603
|
-
declare class StorefrontTimeoutError extends StorefrontError {
|
|
604
|
-
name: string;
|
|
605
|
-
constructor(timeoutMs: number, requestId?: string | null);
|
|
606
|
-
}
|
|
607
|
-
declare class StorefrontNetworkError extends StorefrontError {
|
|
608
|
-
name: string;
|
|
609
|
-
constructor(cause: unknown);
|
|
610
|
-
}
|
|
611
|
-
declare class StorefrontConfigError extends Error {
|
|
612
|
-
name: string;
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
export { type AnalyticsOptions as A, type BookingResult as B, type CheckoutMountDescriptor as C, StorefrontNetworkError as D, type StorefrontQuote as E, type StorefrontQuoteInput as F, type StorefrontRatePlanQuote as G, type StorefrontReview as H, type StorefrontReviewsQuery as I, type StorefrontSite as J, StorefrontTimeoutError as K, analyticsFor as L, createAnalytics as M, createStorefrontClient as N, trackPurchasePixel as O, type Page as P, RateLimitedError as R, type StorefrontRegion as S, type TrackEvent as T, WrongRegionError as W, type AnalyticsReporter as a, type CheckoutSession as b, type ConfirmCheckoutSessionInput as c, type ConfirmCheckoutSessionRequest as d, type CreateCheckoutSessionInput as e, type CreateCheckoutSessionOptions as f, type CreatedCheckoutSession as g, PriceChangedError as h, type RequestOptions as i, STOREFRONT_API_PATH as j, STOREFRONT_ERROR_CODES as k, type StorefrontAnalytics as l, type StorefrontBooking as m, type StorefrontBuilding as n, type StorefrontClient as o, type StorefrontClientOptions as p, StorefrontConfigError as q, type StorefrontContactInput as r, StorefrontError as s, type StorefrontErrorCode as t, type StorefrontErrorInit as u, type StorefrontGuestInput as v, type StorefrontListing as w, type StorefrontListingSummary as x, type StorefrontListingsQuery as y, type StorefrontLocation as z };
|
|
566
|
+
export { type StorefrontSite as A, type BookingResult as B, type CheckoutMountDescriptor as C, createStorefrontClient as D, type Page as P, type RequestOptions as R, STOREFRONT_API_PATH as S, type CheckoutSession as a, type ConfirmCheckoutSessionInput as b, type ConfirmCheckoutSessionRequest as c, type ContentListQuery as d, type CreateCheckoutSessionInput as e, type CreateCheckoutSessionOptions as f, type CreatedCheckoutSession as g, type StorefrontBooking as h, type StorefrontBuilding as i, type StorefrontClient as j, type StorefrontClientOptions as k, type StorefrontContactInput as l, type StorefrontContentItem as m, type StorefrontContentModel as n, type StorefrontContentRef as o, type StorefrontGuestInput as p, type StorefrontImage as q, type StorefrontListing as r, type StorefrontListingSummary as s, type StorefrontListingsQuery as t, type StorefrontLocation as u, type StorefrontQuote as v, type StorefrontQuoteInput as w, type StorefrontRatePlanQuote as x, type StorefrontReview as y, type StorefrontReviewsQuery as z };
|
package/dist/components.cjs
CHANGED
|
@@ -4,7 +4,7 @@ var chunkLVFRVNT3_cjs = require('./chunk-LVFRVNT3.cjs');
|
|
|
4
4
|
var react = require('react');
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
|
|
7
|
-
var monthFormat=new Intl.DateTimeFormat("en-US",{month:"long",year:"numeric",timeZone:"UTC"});var dayFormat=new Intl.DateTimeFormat("en-US",{dateStyle:"full",timeZone:"UTC"});var WEEKDAYS=["Su","Mo","Tu","We","Th","Fr","Sa"];var utc=isoDate=>new Date(`${isoDate}T00:00:00Z`);var defaultLabels={dateRangePicker:{month:monthStart=>monthFormat.format(utc(monthStart)),weekday:dayIndex=>WEEKDAYS[dayIndex]??"",day:date=>dayFormat.format(utc(date)),previousMonth:"Previous month",nextMonth:"Next month"},guestPicker:{adults:"Adults",children:"Children",increment:field=>`Add ${field}`,decrement:field=>`Remove ${field}`},gallery:{region:"Photos",photo:(index,total)=>`Photo ${index+1} of ${total}`,previous:"Previous photo",next:"Next photo"}};function unavailableDates(days){return days.filter(d=>d.status!=="available").map(d=>d.date)}var DAY_MS=864e5;var toTime=date=>Date.parse(`${date}T00:00:00Z`);var fromTime=time=>new Date(time).toISOString().slice(0,10);var addDays=(date,days)=>fromTime(toTime(date)+days*DAY_MS);var monthOf=date=>`${date.slice(0,7)}-01`;function addMonths(monthStart,months){const d=new Date(toTime(monthStart));d.setUTCMonth(d.getUTCMonth()+months,1);return fromTime(d.getTime())}function localToday(){const now=new Date;const pad=n=>String(n).padStart(2,"0");return `${now.getFullYear()}-${pad(now.getMonth()+1)}-${pad(now.getDate())}`}function monthWeeks(monthStart,weekStartsOn){const lead=(new Date(toTime(monthStart)).getUTCDay()-weekStartsOn+7)%7;const next=addMonths(monthStart,1);const cells=Array.from({length:lead},()=>null);for(let d=monthStart;d<next;d=addDays(d,1))cells.push(d);while(cells.length%7)cells.push(null);return Array.from({length:cells.length/7},(_,w)=>cells.slice(w*7,w*7+7))}function DateRangePicker({value,onChange,unavailable,minNights=1,today:todayProp,defaultMonth,weekStartsOn=0,labels:labelsProp,className,classNames={}}){const labels={...defaultLabels.dateRangePicker,...labelsProp};const today=todayProp??localToday();const blocked=react.useMemo(()=>new Set(unavailable??[]),[unavailable]);const[focused,setFocused]=react.useState(()=>value.checkIn??today);const[month,setMonth]=react.useState(()=>defaultMonth?`${defaultMonth}-01`:monthOf(value.checkIn??today));const[shownCheckIn,setShownCheckIn]=react.useState(value.checkIn);if(value.checkIn!==shownCheckIn){setShownCheckIn(value.checkIn);if(value.checkIn!==null){setFocused(value.checkIn);setMonth(monthOf(value.checkIn));}}const grid=react.useRef(null);const moveFocus=react.useRef(false);react.useEffect(()=>{if(!moveFocus.current)return;moveFocus.current=false;grid.current?.querySelector(`[data-date="${focused}"]`)?.focus();},[focused,month]);const{checkIn,checkOut}=value;const pickingEnd=checkIn!==null&&checkOut===null;const nightFree=d=>d>=today&&!blocked.has(d);const validEnd=d=>{if(checkIn===null||d<=checkIn)return false;if((toTime(d)-toTime(checkIn))/DAY_MS<minNights)return false;for(let n=checkIn;n<d;n=addDays(n,1))if(!nightFree(n))return false;return true};const disabled=d=>pickingEnd&&checkIn!==null&&d>checkIn?!validEnd(d):!nightFree(d);function select(d){if(disabled(d))return;onChange(pickingEnd&&checkIn!==null&&d>checkIn?{checkIn,checkOut:d}:{checkIn:d,checkOut:null});}function stateOf(d){if(d===checkIn)return "start";if(d===checkOut)return "end";if(checkIn!==null&&checkOut!==null&&d>checkIn&&d<checkOut)return "in-range";return disabled(d)?"disabled":"available"}function focusDate(d){moveFocus.current=true;setFocused(d);setMonth(monthOf(d));}function onKeyDown(event,d){const step={ArrowLeft:-1,ArrowRight:1,ArrowUp:-7,ArrowDown:7}[event.key];if(step!==void 0){event.preventDefault();focusDate(addDays(d,step));}else if(event.key==="Enter"||event.key===" "){event.preventDefault();select(d);}}const tabStop=monthOf(focused)===month?focused:month;const weekdays=Array.from({length:7},(_,i)=>(i+weekStartsOn)%7);return jsxRuntime.jsxs("div",{className,children:[jsxRuntime.jsxs("div",{className:classNames.header,children:[jsxRuntime.jsx("button",{type:"button",className:classNames.nav,"aria-label":labels.previousMonth,onClick:()=>setMonth(addMonths(month,-1)),children:"\u2039"}),jsxRuntime.jsx("span",{className:classNames.title,"aria-live":"polite",children:labels.month(month)}),jsxRuntime.jsx("button",{type:"button",className:classNames.nav,"aria-label":labels.nextMonth,onClick:()=>setMonth(addMonths(month,1)),children:"\u203A"})]}),jsxRuntime.jsxs("table",{role:"grid","aria-label":labels.month(month),className:classNames.grid,ref:grid,children:[jsxRuntime.jsx("thead",{children:jsxRuntime.jsx("tr",{children:weekdays.map(i=>jsxRuntime.jsx("th",{scope:"col",className:classNames.weekday,children:labels.weekday(i)},i))})}),jsxRuntime.jsx("tbody",{children:monthWeeks(month,weekStartsOn).map((week,w)=>jsxRuntime.jsx("tr",{children:week.map((d,i)=>{if(d===null)return jsxRuntime.jsx("td",{role:"gridcell"},`pad-${i}`);const state=stateOf(d);return jsxRuntime.jsx("td",{role:"gridcell","data-date":d,"data-state":state,"data-today":d===today?"":void 0,className:classNames.day,tabIndex:d===tabStop?0:-1,"aria-label":labels.day(d),"aria-selected":state==="start"||state==="end"||state==="in-range","aria-disabled":disabled(d)||void 0,onClick:()=>select(d),onKeyDown:event=>onKeyDown(event,d),onFocus:()=>setFocused(d),children:Number(d.slice(8))},d)})},w))})]})]})}function isRecord(value){return typeof value==="object"&&value!==null}var firstString=(record,keys)=>keys.map(k=>record[k]).find(v=>typeof v==="string"&&v.length>0);function listingPhotos(pictures){if(!Array.isArray(pictures))return [];return pictures.flatMap(picture=>{if(typeof picture==="string")return picture?[{url:picture,caption:null}]:[];if(!isRecord(picture))return [];const url=firstString(picture,["original","url","large","regular","thumbnail"]);if(!url)return [];return [{url,caption:firstString(picture,["caption","description"])??null}]})}function Gallery({photos,onIndexChange,labels:labelsProp,className,classNames={}}){const labels={...defaultLabels.gallery,...labelsProp};const[index,setIndex]=react.useState(0);const total=photos.length;const current=Math.min(index,Math.max(0,total-1));const go=next=>{if(next<0||next>=total||next===current)return;setIndex(next);onIndexChange?.(next);};const onKeyDown=event=>{if(event.key==="ArrowLeft")go(current-1);else if(event.key==="ArrowRight")go(current+1);};return jsxRuntime.jsxs("section",{role:"region","aria-roledescription":"carousel","aria-label":labels.region,className,onKeyDown,children:[jsxRuntime.jsx("div",{className:classNames.viewport,"aria-live":"polite",children:photos.map((photo,i)=>jsxRuntime.jsx("div",{role:"group","aria-roledescription":"slide","aria-label":labels.photo(i,total),"data-state":i===current?"active":"inactive",hidden:i!==current,className:classNames.slide,children:jsxRuntime.jsx("img",{src:photo.url,alt:photo.caption||labels.photo(i,total),loading:i===0?"eager":"lazy",decoding:"async",className:classNames.image})},`${i}-${photo.url}`))}),jsxRuntime.jsx("button",{type:"button",className:classNames.button,"aria-label":labels.previous,disabled:current===0,onClick:()=>go(current-1),children:"\u2039"}),jsxRuntime.jsx("button",{type:"button",className:classNames.button,"aria-label":labels.next,disabled:current>=total-1,onClick:()=>go(current+1),children:"\u203A"})]})}function GuestPicker({value,onChange,max=chunkLVFRVNT3_cjs.STOREFRONT_MAX_GUESTS,labels:labelsProp,className,classNames={}}){const labels={...defaultLabels.guestPicker,...labelsProp};const id=react.useId();const fields=[{key:"adults",label:labels.adults,min:1,max:Math.max(value.adults,max-value.children)},{key:"children",label:labels.children,min:0,max:Math.max(value.children,max-value.adults)}];return jsxRuntime.jsx("div",{className,children:fields.map(field=>{const now=value[field.key];const set=next=>{const clamped=Math.min(field.max,Math.max(field.min,next));if(clamped!==now)onChange({...value,[field.key]:clamped});};const onKeyDown=event=>{const next={ArrowUp:now+1,ArrowRight:now+1,ArrowDown:now-1,ArrowLeft:now-1,Home:field.min,End:field.max}[event.key];if(next===void 0)return;event.preventDefault();set(next);};const labelId=`${id}-${field.key}`;return jsxRuntime.jsxs("div",{className:classNames.field,"data-field":field.key,children:[jsxRuntime.jsx("span",{id:labelId,className:classNames.label,children:field.label}),jsxRuntime.jsx("button",{type:"button",className:classNames.button,"aria-label":labels.decrement(field.label),disabled:now<=field.min,onClick:()=>set(now-1),children:"\u2212"}),jsxRuntime.jsx("div",{role:"spinbutton",tabIndex:0,className:classNames.value,"aria-labelledby":labelId,"aria-valuenow":now,"aria-valuemin":field.min,"aria-valuemax":field.max,onKeyDown,children:now}),jsxRuntime.jsx("button",{type:"button",className:classNames.button,"aria-label":labels.increment(field.label),disabled:now>=field.max,onClick:()=>set(now+1),children:"+"})]},field.key)})})}var usable=(lat,lng)=>typeof lat==="number"&&typeof lng==="number"&&Number.isFinite(lat)&&Number.isFinite(lng)&&Math.abs(lat)<=90&&Math.abs(lng)<=180;function Map({listings,children}){const markers=[];for(const listing of listings){if(usable(listing.latitude,listing.longitude)){markers.push({id:listing.id,lat:listing.latitude,lng:listing.longitude,listing});}}const bounds=markers.length===0?null:{north:Math.max(...markers.map(m=>m.lat)),south:Math.min(...markers.map(m=>m.lat)),east:Math.max(...markers.map(m=>m.lng)),west:Math.min(...markers.map(m=>m.lng))};return jsxRuntime.jsx(jsxRuntime.Fragment,{children:children({markers,bounds})})}
|
|
7
|
+
var monthFormat=new Intl.DateTimeFormat("en-US",{month:"long",year:"numeric",timeZone:"UTC"});var dayFormat=new Intl.DateTimeFormat("en-US",{dateStyle:"full",timeZone:"UTC"});var WEEKDAYS=["Su","Mo","Tu","We","Th","Fr","Sa"];var utc=isoDate=>new Date(`${isoDate}T00:00:00Z`);var defaultLabels={dateRangePicker:{month:monthStart=>monthFormat.format(utc(monthStart)),weekday:dayIndex=>WEEKDAYS[dayIndex]??"",day:date=>dayFormat.format(utc(date)),previousMonth:"Previous month",nextMonth:"Next month"},guestPicker:{adults:"Adults",children:"Children",increment:field=>`Add ${field}`,decrement:field=>`Remove ${field}`},gallery:{region:"Photos",photo:(index,total)=>`Photo ${index+1} of ${total}`,previous:"Previous photo",next:"Next photo"}};function unavailableDates(days){return days.filter(d=>d.status!=="available").map(d=>d.date)}var DAY_MS=864e5;var toTime=date=>Date.parse(`${date}T00:00:00Z`);var fromTime=time=>new Date(time).toISOString().slice(0,10);var addDays=(date,days)=>fromTime(toTime(date)+days*DAY_MS);var monthOf=date=>`${date.slice(0,7)}-01`;function addMonths(monthStart,months){const d=new Date(toTime(monthStart));d.setUTCMonth(d.getUTCMonth()+months,1);return fromTime(d.getTime())}function localToday(){const now=new Date;const pad=n=>String(n).padStart(2,"0");return `${now.getFullYear()}-${pad(now.getMonth()+1)}-${pad(now.getDate())}`}function monthWeeks(monthStart,weekStartsOn){const lead=(new Date(toTime(monthStart)).getUTCDay()-weekStartsOn+7)%7;const next=addMonths(monthStart,1);const cells=Array.from({length:lead},()=>null);for(let d=monthStart;d<next;d=addDays(d,1))cells.push(d);while(cells.length%7)cells.push(null);return Array.from({length:cells.length/7},(_,w)=>cells.slice(w*7,w*7+7))}function DateRangePicker({value,onChange,unavailable,minNights=1,today:todayProp,defaultMonth,weekStartsOn=0,labels:labelsProp,className,classNames={}}){const labels={...defaultLabels.dateRangePicker,...labelsProp};const today=todayProp??localToday();const blocked=react.useMemo(()=>new Set(unavailable??[]),[unavailable]);const[focused,setFocused]=react.useState(()=>value.checkIn??today);const[month,setMonth]=react.useState(()=>defaultMonth?`${defaultMonth}-01`:monthOf(value.checkIn??today));const[shownCheckIn,setShownCheckIn]=react.useState(value.checkIn);if(value.checkIn!==shownCheckIn){setShownCheckIn(value.checkIn);if(value.checkIn!==null){setFocused(value.checkIn);setMonth(monthOf(value.checkIn));}}const grid=react.useRef(null);const moveFocus=react.useRef(false);react.useEffect(()=>{if(!moveFocus.current)return;moveFocus.current=false;grid.current?.querySelector(`[data-date="${focused}"]`)?.focus();},[focused,month]);const{checkIn,checkOut}=value;const pickingEnd=checkIn!==null&&checkOut===null;const nightFree=d=>d>=today&&!blocked.has(d);const validEnd=d=>{if(checkIn===null||d<=checkIn)return false;if((toTime(d)-toTime(checkIn))/DAY_MS<minNights)return false;for(let n=checkIn;n<d;n=addDays(n,1))if(!nightFree(n))return false;return true};const disabled=d=>pickingEnd&&checkIn!==null&&d>checkIn?!validEnd(d):!nightFree(d);function select(d){if(disabled(d))return;onChange(pickingEnd&&checkIn!==null&&d>checkIn?{checkIn,checkOut:d}:{checkIn:d,checkOut:null});}function stateOf(d){if(d===checkIn)return "start";if(d===checkOut)return "end";if(checkIn!==null&&checkOut!==null&&d>checkIn&&d<checkOut)return "in-range";return disabled(d)?"disabled":"available"}function focusDate(d){moveFocus.current=true;setFocused(d);setMonth(monthOf(d));}function onKeyDown(event,d){const step={ArrowLeft:-1,ArrowRight:1,ArrowUp:-7,ArrowDown:7}[event.key];if(step!==void 0){event.preventDefault();focusDate(addDays(d,step));}else if(event.key==="Enter"||event.key===" "){event.preventDefault();select(d);}}const tabStop=monthOf(focused)===month?focused:month;const weekdays=Array.from({length:7},(_,i)=>(i+weekStartsOn)%7);return jsxRuntime.jsxs("div",{className,children:[jsxRuntime.jsxs("div",{className:classNames.header,children:[jsxRuntime.jsx("button",{type:"button",className:classNames.nav,"aria-label":labels.previousMonth,onClick:()=>setMonth(addMonths(month,-1)),children:"\u2039"}),jsxRuntime.jsx("span",{className:classNames.title,"aria-live":"polite",children:labels.month(month)}),jsxRuntime.jsx("button",{type:"button",className:classNames.nav,"aria-label":labels.nextMonth,onClick:()=>setMonth(addMonths(month,1)),children:"\u203A"})]}),jsxRuntime.jsxs("table",{role:"grid","aria-label":labels.month(month),className:classNames.grid,ref:grid,children:[jsxRuntime.jsx("thead",{children:jsxRuntime.jsx("tr",{children:weekdays.map(i=>jsxRuntime.jsx("th",{scope:"col",className:classNames.weekday,children:labels.weekday(i)},i))})}),jsxRuntime.jsx("tbody",{children:monthWeeks(month,weekStartsOn).map((week,w)=>jsxRuntime.jsx("tr",{children:week.map((d,i)=>{if(d===null)return jsxRuntime.jsx("td",{role:"gridcell"},`pad-${i}`);const state=stateOf(d);return jsxRuntime.jsx("td",{role:"gridcell","data-date":d,"data-state":state,"data-today":d===today?"":void 0,className:classNames.day,tabIndex:d===tabStop?0:-1,"aria-label":labels.day(d),"aria-selected":state==="start"||state==="end"||state==="in-range","aria-disabled":disabled(d)||void 0,onClick:()=>select(d),onKeyDown:event=>onKeyDown(event,d),onFocus:()=>setFocused(d),children:Number(d.slice(8))},d)})},w))})]})]})}function isRecord(value){return typeof value==="object"&&value!==null}var firstString=(record,keys)=>keys.map(k=>record[k]).find(v=>typeof v==="string"&&v.length>0);function listingPhotos(pictures){if(!Array.isArray(pictures))return [];return pictures.flatMap(picture=>{if(typeof picture==="string")return picture?[{url:picture,caption:null}]:[];if(!isRecord(picture))return [];const url=firstString(picture,["original","url","large","regular","original_path","image_path","thumbnail","thumbnail_path"]);if(!url)return [];return [{url,caption:firstString(picture,["caption","description"])??null}]})}function Gallery({photos,onIndexChange,labels:labelsProp,className,classNames={}}){const labels={...defaultLabels.gallery,...labelsProp};const[index,setIndex]=react.useState(0);const total=photos.length;const current=Math.min(index,Math.max(0,total-1));const go=next=>{if(next<0||next>=total||next===current)return;setIndex(next);onIndexChange?.(next);};const onKeyDown=event=>{if(event.key==="ArrowLeft")go(current-1);else if(event.key==="ArrowRight")go(current+1);};return jsxRuntime.jsxs("section",{role:"region","aria-roledescription":"carousel","aria-label":labels.region,className,onKeyDown,children:[jsxRuntime.jsx("div",{className:classNames.viewport,"aria-live":"polite",children:photos.map((photo,i)=>jsxRuntime.jsx("div",{role:"group","aria-roledescription":"slide","aria-label":labels.photo(i,total),"data-state":i===current?"active":"inactive",hidden:i!==current,className:classNames.slide,children:jsxRuntime.jsx("img",{src:photo.url,alt:photo.caption||labels.photo(i,total),loading:i===0?"eager":"lazy",decoding:"async",className:classNames.image})},`${i}-${photo.url}`))}),jsxRuntime.jsx("button",{type:"button",className:classNames.button,"aria-label":labels.previous,disabled:current===0,onClick:()=>go(current-1),children:"\u2039"}),jsxRuntime.jsx("button",{type:"button",className:classNames.button,"aria-label":labels.next,disabled:current>=total-1,onClick:()=>go(current+1),children:"\u203A"})]})}function GuestPicker({value,onChange,max=chunkLVFRVNT3_cjs.STOREFRONT_MAX_GUESTS,labels:labelsProp,className,classNames={}}){const labels={...defaultLabels.guestPicker,...labelsProp};const id=react.useId();const fields=[{key:"adults",label:labels.adults,min:1,max:Math.max(value.adults,max-value.children)},{key:"children",label:labels.children,min:0,max:Math.max(value.children,max-value.adults)}];return jsxRuntime.jsx("div",{className,children:fields.map(field=>{const now=value[field.key];const set=next=>{const clamped=Math.min(field.max,Math.max(field.min,next));if(clamped!==now)onChange({...value,[field.key]:clamped});};const onKeyDown=event=>{const next={ArrowUp:now+1,ArrowRight:now+1,ArrowDown:now-1,ArrowLeft:now-1,Home:field.min,End:field.max}[event.key];if(next===void 0)return;event.preventDefault();set(next);};const labelId=`${id}-${field.key}`;return jsxRuntime.jsxs("div",{className:classNames.field,"data-field":field.key,children:[jsxRuntime.jsx("span",{id:labelId,className:classNames.label,children:field.label}),jsxRuntime.jsx("button",{type:"button",className:classNames.button,"aria-label":labels.decrement(field.label),disabled:now<=field.min,onClick:()=>set(now-1),children:"\u2212"}),jsxRuntime.jsx("div",{role:"spinbutton",tabIndex:0,className:classNames.value,"aria-labelledby":labelId,"aria-valuenow":now,"aria-valuemin":field.min,"aria-valuemax":field.max,onKeyDown,children:now}),jsxRuntime.jsx("button",{type:"button",className:classNames.button,"aria-label":labels.increment(field.label),disabled:now>=field.max,onClick:()=>set(now+1),children:"+"})]},field.key)})})}var usable=(lat,lng)=>typeof lat==="number"&&typeof lng==="number"&&Number.isFinite(lat)&&Number.isFinite(lng)&&Math.abs(lat)<=90&&Math.abs(lng)<=180;function Map({listings,children}){const markers=[];for(const listing of listings){if(usable(listing.latitude,listing.longitude)){markers.push({id:listing.id,lat:listing.latitude,lng:listing.longitude,listing});}}const bounds=markers.length===0?null:{north:Math.max(...markers.map(m=>m.lat)),south:Math.min(...markers.map(m=>m.lat)),east:Math.max(...markers.map(m=>m.lng)),west:Math.min(...markers.map(m=>m.lng))};return jsxRuntime.jsx(jsxRuntime.Fragment,{children:children({markers,bounds})})}
|
|
8
8
|
|
|
9
9
|
exports.DateRangePicker = DateRangePicker;
|
|
10
10
|
exports.Gallery = Gallery;
|
package/dist/components.js
CHANGED
|
@@ -2,6 +2,6 @@ import { STOREFRONT_MAX_GUESTS } from './chunk-6NFURJXI.js';
|
|
|
2
2
|
import { useMemo, useState, useRef, useEffect, useId } from 'react';
|
|
3
3
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
4
4
|
|
|
5
|
-
var monthFormat=new Intl.DateTimeFormat("en-US",{month:"long",year:"numeric",timeZone:"UTC"});var dayFormat=new Intl.DateTimeFormat("en-US",{dateStyle:"full",timeZone:"UTC"});var WEEKDAYS=["Su","Mo","Tu","We","Th","Fr","Sa"];var utc=isoDate=>new Date(`${isoDate}T00:00:00Z`);var defaultLabels={dateRangePicker:{month:monthStart=>monthFormat.format(utc(monthStart)),weekday:dayIndex=>WEEKDAYS[dayIndex]??"",day:date=>dayFormat.format(utc(date)),previousMonth:"Previous month",nextMonth:"Next month"},guestPicker:{adults:"Adults",children:"Children",increment:field=>`Add ${field}`,decrement:field=>`Remove ${field}`},gallery:{region:"Photos",photo:(index,total)=>`Photo ${index+1} of ${total}`,previous:"Previous photo",next:"Next photo"}};function unavailableDates(days){return days.filter(d=>d.status!=="available").map(d=>d.date)}var DAY_MS=864e5;var toTime=date=>Date.parse(`${date}T00:00:00Z`);var fromTime=time=>new Date(time).toISOString().slice(0,10);var addDays=(date,days)=>fromTime(toTime(date)+days*DAY_MS);var monthOf=date=>`${date.slice(0,7)}-01`;function addMonths(monthStart,months){const d=new Date(toTime(monthStart));d.setUTCMonth(d.getUTCMonth()+months,1);return fromTime(d.getTime())}function localToday(){const now=new Date;const pad=n=>String(n).padStart(2,"0");return `${now.getFullYear()}-${pad(now.getMonth()+1)}-${pad(now.getDate())}`}function monthWeeks(monthStart,weekStartsOn){const lead=(new Date(toTime(monthStart)).getUTCDay()-weekStartsOn+7)%7;const next=addMonths(monthStart,1);const cells=Array.from({length:lead},()=>null);for(let d=monthStart;d<next;d=addDays(d,1))cells.push(d);while(cells.length%7)cells.push(null);return Array.from({length:cells.length/7},(_,w)=>cells.slice(w*7,w*7+7))}function DateRangePicker({value,onChange,unavailable,minNights=1,today:todayProp,defaultMonth,weekStartsOn=0,labels:labelsProp,className,classNames={}}){const labels={...defaultLabels.dateRangePicker,...labelsProp};const today=todayProp??localToday();const blocked=useMemo(()=>new Set(unavailable??[]),[unavailable]);const[focused,setFocused]=useState(()=>value.checkIn??today);const[month,setMonth]=useState(()=>defaultMonth?`${defaultMonth}-01`:monthOf(value.checkIn??today));const[shownCheckIn,setShownCheckIn]=useState(value.checkIn);if(value.checkIn!==shownCheckIn){setShownCheckIn(value.checkIn);if(value.checkIn!==null){setFocused(value.checkIn);setMonth(monthOf(value.checkIn));}}const grid=useRef(null);const moveFocus=useRef(false);useEffect(()=>{if(!moveFocus.current)return;moveFocus.current=false;grid.current?.querySelector(`[data-date="${focused}"]`)?.focus();},[focused,month]);const{checkIn,checkOut}=value;const pickingEnd=checkIn!==null&&checkOut===null;const nightFree=d=>d>=today&&!blocked.has(d);const validEnd=d=>{if(checkIn===null||d<=checkIn)return false;if((toTime(d)-toTime(checkIn))/DAY_MS<minNights)return false;for(let n=checkIn;n<d;n=addDays(n,1))if(!nightFree(n))return false;return true};const disabled=d=>pickingEnd&&checkIn!==null&&d>checkIn?!validEnd(d):!nightFree(d);function select(d){if(disabled(d))return;onChange(pickingEnd&&checkIn!==null&&d>checkIn?{checkIn,checkOut:d}:{checkIn:d,checkOut:null});}function stateOf(d){if(d===checkIn)return "start";if(d===checkOut)return "end";if(checkIn!==null&&checkOut!==null&&d>checkIn&&d<checkOut)return "in-range";return disabled(d)?"disabled":"available"}function focusDate(d){moveFocus.current=true;setFocused(d);setMonth(monthOf(d));}function onKeyDown(event,d){const step={ArrowLeft:-1,ArrowRight:1,ArrowUp:-7,ArrowDown:7}[event.key];if(step!==void 0){event.preventDefault();focusDate(addDays(d,step));}else if(event.key==="Enter"||event.key===" "){event.preventDefault();select(d);}}const tabStop=monthOf(focused)===month?focused:month;const weekdays=Array.from({length:7},(_,i)=>(i+weekStartsOn)%7);return jsxs("div",{className,children:[jsxs("div",{className:classNames.header,children:[jsx("button",{type:"button",className:classNames.nav,"aria-label":labels.previousMonth,onClick:()=>setMonth(addMonths(month,-1)),children:"\u2039"}),jsx("span",{className:classNames.title,"aria-live":"polite",children:labels.month(month)}),jsx("button",{type:"button",className:classNames.nav,"aria-label":labels.nextMonth,onClick:()=>setMonth(addMonths(month,1)),children:"\u203A"})]}),jsxs("table",{role:"grid","aria-label":labels.month(month),className:classNames.grid,ref:grid,children:[jsx("thead",{children:jsx("tr",{children:weekdays.map(i=>jsx("th",{scope:"col",className:classNames.weekday,children:labels.weekday(i)},i))})}),jsx("tbody",{children:monthWeeks(month,weekStartsOn).map((week,w)=>jsx("tr",{children:week.map((d,i)=>{if(d===null)return jsx("td",{role:"gridcell"},`pad-${i}`);const state=stateOf(d);return jsx("td",{role:"gridcell","data-date":d,"data-state":state,"data-today":d===today?"":void 0,className:classNames.day,tabIndex:d===tabStop?0:-1,"aria-label":labels.day(d),"aria-selected":state==="start"||state==="end"||state==="in-range","aria-disabled":disabled(d)||void 0,onClick:()=>select(d),onKeyDown:event=>onKeyDown(event,d),onFocus:()=>setFocused(d),children:Number(d.slice(8))},d)})},w))})]})]})}function isRecord(value){return typeof value==="object"&&value!==null}var firstString=(record,keys)=>keys.map(k=>record[k]).find(v=>typeof v==="string"&&v.length>0);function listingPhotos(pictures){if(!Array.isArray(pictures))return [];return pictures.flatMap(picture=>{if(typeof picture==="string")return picture?[{url:picture,caption:null}]:[];if(!isRecord(picture))return [];const url=firstString(picture,["original","url","large","regular","thumbnail"]);if(!url)return [];return [{url,caption:firstString(picture,["caption","description"])??null}]})}function Gallery({photos,onIndexChange,labels:labelsProp,className,classNames={}}){const labels={...defaultLabels.gallery,...labelsProp};const[index,setIndex]=useState(0);const total=photos.length;const current=Math.min(index,Math.max(0,total-1));const go=next=>{if(next<0||next>=total||next===current)return;setIndex(next);onIndexChange?.(next);};const onKeyDown=event=>{if(event.key==="ArrowLeft")go(current-1);else if(event.key==="ArrowRight")go(current+1);};return jsxs("section",{role:"region","aria-roledescription":"carousel","aria-label":labels.region,className,onKeyDown,children:[jsx("div",{className:classNames.viewport,"aria-live":"polite",children:photos.map((photo,i)=>jsx("div",{role:"group","aria-roledescription":"slide","aria-label":labels.photo(i,total),"data-state":i===current?"active":"inactive",hidden:i!==current,className:classNames.slide,children:jsx("img",{src:photo.url,alt:photo.caption||labels.photo(i,total),loading:i===0?"eager":"lazy",decoding:"async",className:classNames.image})},`${i}-${photo.url}`))}),jsx("button",{type:"button",className:classNames.button,"aria-label":labels.previous,disabled:current===0,onClick:()=>go(current-1),children:"\u2039"}),jsx("button",{type:"button",className:classNames.button,"aria-label":labels.next,disabled:current>=total-1,onClick:()=>go(current+1),children:"\u203A"})]})}function GuestPicker({value,onChange,max=STOREFRONT_MAX_GUESTS,labels:labelsProp,className,classNames={}}){const labels={...defaultLabels.guestPicker,...labelsProp};const id=useId();const fields=[{key:"adults",label:labels.adults,min:1,max:Math.max(value.adults,max-value.children)},{key:"children",label:labels.children,min:0,max:Math.max(value.children,max-value.adults)}];return jsx("div",{className,children:fields.map(field=>{const now=value[field.key];const set=next=>{const clamped=Math.min(field.max,Math.max(field.min,next));if(clamped!==now)onChange({...value,[field.key]:clamped});};const onKeyDown=event=>{const next={ArrowUp:now+1,ArrowRight:now+1,ArrowDown:now-1,ArrowLeft:now-1,Home:field.min,End:field.max}[event.key];if(next===void 0)return;event.preventDefault();set(next);};const labelId=`${id}-${field.key}`;return jsxs("div",{className:classNames.field,"data-field":field.key,children:[jsx("span",{id:labelId,className:classNames.label,children:field.label}),jsx("button",{type:"button",className:classNames.button,"aria-label":labels.decrement(field.label),disabled:now<=field.min,onClick:()=>set(now-1),children:"\u2212"}),jsx("div",{role:"spinbutton",tabIndex:0,className:classNames.value,"aria-labelledby":labelId,"aria-valuenow":now,"aria-valuemin":field.min,"aria-valuemax":field.max,onKeyDown,children:now}),jsx("button",{type:"button",className:classNames.button,"aria-label":labels.increment(field.label),disabled:now>=field.max,onClick:()=>set(now+1),children:"+"})]},field.key)})})}var usable=(lat,lng)=>typeof lat==="number"&&typeof lng==="number"&&Number.isFinite(lat)&&Number.isFinite(lng)&&Math.abs(lat)<=90&&Math.abs(lng)<=180;function Map({listings,children}){const markers=[];for(const listing of listings){if(usable(listing.latitude,listing.longitude)){markers.push({id:listing.id,lat:listing.latitude,lng:listing.longitude,listing});}}const bounds=markers.length===0?null:{north:Math.max(...markers.map(m=>m.lat)),south:Math.min(...markers.map(m=>m.lat)),east:Math.max(...markers.map(m=>m.lng)),west:Math.min(...markers.map(m=>m.lng))};return jsx(Fragment,{children:children({markers,bounds})})}
|
|
5
|
+
var monthFormat=new Intl.DateTimeFormat("en-US",{month:"long",year:"numeric",timeZone:"UTC"});var dayFormat=new Intl.DateTimeFormat("en-US",{dateStyle:"full",timeZone:"UTC"});var WEEKDAYS=["Su","Mo","Tu","We","Th","Fr","Sa"];var utc=isoDate=>new Date(`${isoDate}T00:00:00Z`);var defaultLabels={dateRangePicker:{month:monthStart=>monthFormat.format(utc(monthStart)),weekday:dayIndex=>WEEKDAYS[dayIndex]??"",day:date=>dayFormat.format(utc(date)),previousMonth:"Previous month",nextMonth:"Next month"},guestPicker:{adults:"Adults",children:"Children",increment:field=>`Add ${field}`,decrement:field=>`Remove ${field}`},gallery:{region:"Photos",photo:(index,total)=>`Photo ${index+1} of ${total}`,previous:"Previous photo",next:"Next photo"}};function unavailableDates(days){return days.filter(d=>d.status!=="available").map(d=>d.date)}var DAY_MS=864e5;var toTime=date=>Date.parse(`${date}T00:00:00Z`);var fromTime=time=>new Date(time).toISOString().slice(0,10);var addDays=(date,days)=>fromTime(toTime(date)+days*DAY_MS);var monthOf=date=>`${date.slice(0,7)}-01`;function addMonths(monthStart,months){const d=new Date(toTime(monthStart));d.setUTCMonth(d.getUTCMonth()+months,1);return fromTime(d.getTime())}function localToday(){const now=new Date;const pad=n=>String(n).padStart(2,"0");return `${now.getFullYear()}-${pad(now.getMonth()+1)}-${pad(now.getDate())}`}function monthWeeks(monthStart,weekStartsOn){const lead=(new Date(toTime(monthStart)).getUTCDay()-weekStartsOn+7)%7;const next=addMonths(monthStart,1);const cells=Array.from({length:lead},()=>null);for(let d=monthStart;d<next;d=addDays(d,1))cells.push(d);while(cells.length%7)cells.push(null);return Array.from({length:cells.length/7},(_,w)=>cells.slice(w*7,w*7+7))}function DateRangePicker({value,onChange,unavailable,minNights=1,today:todayProp,defaultMonth,weekStartsOn=0,labels:labelsProp,className,classNames={}}){const labels={...defaultLabels.dateRangePicker,...labelsProp};const today=todayProp??localToday();const blocked=useMemo(()=>new Set(unavailable??[]),[unavailable]);const[focused,setFocused]=useState(()=>value.checkIn??today);const[month,setMonth]=useState(()=>defaultMonth?`${defaultMonth}-01`:monthOf(value.checkIn??today));const[shownCheckIn,setShownCheckIn]=useState(value.checkIn);if(value.checkIn!==shownCheckIn){setShownCheckIn(value.checkIn);if(value.checkIn!==null){setFocused(value.checkIn);setMonth(monthOf(value.checkIn));}}const grid=useRef(null);const moveFocus=useRef(false);useEffect(()=>{if(!moveFocus.current)return;moveFocus.current=false;grid.current?.querySelector(`[data-date="${focused}"]`)?.focus();},[focused,month]);const{checkIn,checkOut}=value;const pickingEnd=checkIn!==null&&checkOut===null;const nightFree=d=>d>=today&&!blocked.has(d);const validEnd=d=>{if(checkIn===null||d<=checkIn)return false;if((toTime(d)-toTime(checkIn))/DAY_MS<minNights)return false;for(let n=checkIn;n<d;n=addDays(n,1))if(!nightFree(n))return false;return true};const disabled=d=>pickingEnd&&checkIn!==null&&d>checkIn?!validEnd(d):!nightFree(d);function select(d){if(disabled(d))return;onChange(pickingEnd&&checkIn!==null&&d>checkIn?{checkIn,checkOut:d}:{checkIn:d,checkOut:null});}function stateOf(d){if(d===checkIn)return "start";if(d===checkOut)return "end";if(checkIn!==null&&checkOut!==null&&d>checkIn&&d<checkOut)return "in-range";return disabled(d)?"disabled":"available"}function focusDate(d){moveFocus.current=true;setFocused(d);setMonth(monthOf(d));}function onKeyDown(event,d){const step={ArrowLeft:-1,ArrowRight:1,ArrowUp:-7,ArrowDown:7}[event.key];if(step!==void 0){event.preventDefault();focusDate(addDays(d,step));}else if(event.key==="Enter"||event.key===" "){event.preventDefault();select(d);}}const tabStop=monthOf(focused)===month?focused:month;const weekdays=Array.from({length:7},(_,i)=>(i+weekStartsOn)%7);return jsxs("div",{className,children:[jsxs("div",{className:classNames.header,children:[jsx("button",{type:"button",className:classNames.nav,"aria-label":labels.previousMonth,onClick:()=>setMonth(addMonths(month,-1)),children:"\u2039"}),jsx("span",{className:classNames.title,"aria-live":"polite",children:labels.month(month)}),jsx("button",{type:"button",className:classNames.nav,"aria-label":labels.nextMonth,onClick:()=>setMonth(addMonths(month,1)),children:"\u203A"})]}),jsxs("table",{role:"grid","aria-label":labels.month(month),className:classNames.grid,ref:grid,children:[jsx("thead",{children:jsx("tr",{children:weekdays.map(i=>jsx("th",{scope:"col",className:classNames.weekday,children:labels.weekday(i)},i))})}),jsx("tbody",{children:monthWeeks(month,weekStartsOn).map((week,w)=>jsx("tr",{children:week.map((d,i)=>{if(d===null)return jsx("td",{role:"gridcell"},`pad-${i}`);const state=stateOf(d);return jsx("td",{role:"gridcell","data-date":d,"data-state":state,"data-today":d===today?"":void 0,className:classNames.day,tabIndex:d===tabStop?0:-1,"aria-label":labels.day(d),"aria-selected":state==="start"||state==="end"||state==="in-range","aria-disabled":disabled(d)||void 0,onClick:()=>select(d),onKeyDown:event=>onKeyDown(event,d),onFocus:()=>setFocused(d),children:Number(d.slice(8))},d)})},w))})]})]})}function isRecord(value){return typeof value==="object"&&value!==null}var firstString=(record,keys)=>keys.map(k=>record[k]).find(v=>typeof v==="string"&&v.length>0);function listingPhotos(pictures){if(!Array.isArray(pictures))return [];return pictures.flatMap(picture=>{if(typeof picture==="string")return picture?[{url:picture,caption:null}]:[];if(!isRecord(picture))return [];const url=firstString(picture,["original","url","large","regular","original_path","image_path","thumbnail","thumbnail_path"]);if(!url)return [];return [{url,caption:firstString(picture,["caption","description"])??null}]})}function Gallery({photos,onIndexChange,labels:labelsProp,className,classNames={}}){const labels={...defaultLabels.gallery,...labelsProp};const[index,setIndex]=useState(0);const total=photos.length;const current=Math.min(index,Math.max(0,total-1));const go=next=>{if(next<0||next>=total||next===current)return;setIndex(next);onIndexChange?.(next);};const onKeyDown=event=>{if(event.key==="ArrowLeft")go(current-1);else if(event.key==="ArrowRight")go(current+1);};return jsxs("section",{role:"region","aria-roledescription":"carousel","aria-label":labels.region,className,onKeyDown,children:[jsx("div",{className:classNames.viewport,"aria-live":"polite",children:photos.map((photo,i)=>jsx("div",{role:"group","aria-roledescription":"slide","aria-label":labels.photo(i,total),"data-state":i===current?"active":"inactive",hidden:i!==current,className:classNames.slide,children:jsx("img",{src:photo.url,alt:photo.caption||labels.photo(i,total),loading:i===0?"eager":"lazy",decoding:"async",className:classNames.image})},`${i}-${photo.url}`))}),jsx("button",{type:"button",className:classNames.button,"aria-label":labels.previous,disabled:current===0,onClick:()=>go(current-1),children:"\u2039"}),jsx("button",{type:"button",className:classNames.button,"aria-label":labels.next,disabled:current>=total-1,onClick:()=>go(current+1),children:"\u203A"})]})}function GuestPicker({value,onChange,max=STOREFRONT_MAX_GUESTS,labels:labelsProp,className,classNames={}}){const labels={...defaultLabels.guestPicker,...labelsProp};const id=useId();const fields=[{key:"adults",label:labels.adults,min:1,max:Math.max(value.adults,max-value.children)},{key:"children",label:labels.children,min:0,max:Math.max(value.children,max-value.adults)}];return jsx("div",{className,children:fields.map(field=>{const now=value[field.key];const set=next=>{const clamped=Math.min(field.max,Math.max(field.min,next));if(clamped!==now)onChange({...value,[field.key]:clamped});};const onKeyDown=event=>{const next={ArrowUp:now+1,ArrowRight:now+1,ArrowDown:now-1,ArrowLeft:now-1,Home:field.min,End:field.max}[event.key];if(next===void 0)return;event.preventDefault();set(next);};const labelId=`${id}-${field.key}`;return jsxs("div",{className:classNames.field,"data-field":field.key,children:[jsx("span",{id:labelId,className:classNames.label,children:field.label}),jsx("button",{type:"button",className:classNames.button,"aria-label":labels.decrement(field.label),disabled:now<=field.min,onClick:()=>set(now-1),children:"\u2212"}),jsx("div",{role:"spinbutton",tabIndex:0,className:classNames.value,"aria-labelledby":labelId,"aria-valuenow":now,"aria-valuemin":field.min,"aria-valuemax":field.max,onKeyDown,children:now}),jsx("button",{type:"button",className:classNames.button,"aria-label":labels.increment(field.label),disabled:now>=field.max,onClick:()=>set(now+1),children:"+"})]},field.key)})})}var usable=(lat,lng)=>typeof lat==="number"&&typeof lng==="number"&&Number.isFinite(lat)&&Number.isFinite(lng)&&Math.abs(lat)<=90&&Math.abs(lng)<=180;function Map({listings,children}){const markers=[];for(const listing of listings){if(usable(listing.latitude,listing.longitude)){markers.push({id:listing.id,lat:listing.latitude,lng:listing.longitude,listing});}}const bounds=markers.length===0?null:{north:Math.max(...markers.map(m=>m.lat)),south:Math.min(...markers.map(m=>m.lat)),east:Math.max(...markers.map(m=>m.lng)),west:Math.min(...markers.map(m=>m.lng))};return jsx(Fragment,{children:children({markers,bounds})})}
|
|
6
6
|
|
|
7
7
|
export { DateRangePicker, Gallery, GuestPicker, Map, defaultLabels, listingPhotos, unavailableDates };
|
package/dist/config.cjs
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkZLAOY6IF_cjs = require('./chunk-ZLAOY6IF.cjs');
|
|
4
4
|
var zod = require('zod');
|
|
5
5
|
|
|
6
|
-
var STOREFRONT_LOCALES=["en","fr","es","de","it","pt","nl"];var REQUIRED="validation.required";var TOO_LONG="validation.max_length";var TOO_MANY="validation.too_large";var INVALID="validation.invalid";var text=max=>zod.z.string(INVALID).max(max,TOO_LONG);var localeSchema=zod.z.enum(STOREFRONT_LOCALES,"validation.storefront.locale_unsupported");var hexSchema=zod.z.string(INVALID).regex(/^#[0-9A-Fa-f]{6}$/,"validation.storefront.color_hex");var assetUrlSchema=zod.z.url({protocol:/^https$/,error:"validation.storefront.url_https"});var localizedSchema=zod.z.partialRecord(localeSchema,text(200),INVALID);var linkSchema=zod.z.object({label:localizedSchema,href:text(500).regex(/^(\/(?!\/)|https:\/\/)/,"validation.storefront.link_href")},INVALID);var fontSchema=zod.z.enum(
|
|
6
|
+
var STOREFRONT_LOCALES=["en","fr","es","de","it","pt","nl"];var REQUIRED="validation.required";var TOO_LONG="validation.max_length";var TOO_MANY="validation.too_large";var INVALID="validation.invalid";var text=max=>zod.z.string(INVALID).max(max,TOO_LONG);var localeSchema=zod.z.enum(STOREFRONT_LOCALES,"validation.storefront.locale_unsupported");var hexSchema=zod.z.string(INVALID).regex(/^#[0-9A-Fa-f]{6}$/,"validation.storefront.color_hex");var assetUrlSchema=zod.z.url({protocol:/^https$/,error:"validation.storefront.url_https"});var localizedSchema=zod.z.partialRecord(localeSchema,text(200),INVALID);var linkSchema=zod.z.object({label:localizedSchema,href:text(500).regex(/^(\/(?!\/)|https:\/\/)/,"validation.storefront.link_href")},INVALID);var fontSchema=zod.z.enum(chunkZLAOY6IF_cjs.STOREFRONT_FONTS,"validation.invalid_option");var storefrontSiteConfigSchema=zod.z.object({brand:zod.z.object({name:text(80).min(1,REQUIRED),logoUrl:assetUrlSchema.nullable(),faviconUrl:assetUrlSchema.nullable()},INVALID),colors:zod.z.object({primary:hexSchema,primaryForeground:hexSchema,background:hexSchema,foreground:hexSchema,accent:hexSchema},INVALID),fonts:zod.z.object({heading:fontSchema,body:fontSchema},INVALID),nav:zod.z.array(linkSchema,INVALID).max(8,TOO_MANY),footer:zod.z.object({text:localizedSchema,links:zod.z.array(linkSchema,INVALID).max(12,TOO_MANY)},INVALID),defaultLocale:localeSchema,locales:zod.z.array(localeSchema,INVALID).min(1,REQUIRED).max(STOREFRONT_LOCALES.length,TOO_MANY),seo:zod.z.object({titleTemplate:text(80).includes("%s",{error:"validation.storefront.title_template_placeholder"}),defaultDescription:localizedSchema,ogImageUrl:assetUrlSchema.nullable()},INVALID)},INVALID).refine(c=>c.locales.includes(c.defaultLocale),{path:["defaultLocale"],message:"validation.storefront.default_locale_not_listed"});function defineSuiteOpConfig(config){return storefrontSiteConfigSchema.parse(config)}
|
|
7
7
|
|
|
8
|
+
Object.defineProperty(exports, "STOREFRONT_FONT_FAMILIES", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return chunkZLAOY6IF_cjs.STOREFRONT_FONT_FAMILIES; }
|
|
11
|
+
});
|
|
8
12
|
exports.STOREFRONT_LOCALES = STOREFRONT_LOCALES;
|
|
9
13
|
exports.defineSuiteOpConfig = defineSuiteOpConfig;
|
|
10
14
|
exports.storefrontSiteConfigSchema = storefrontSiteConfigSchema;
|
package/dist/config.d.cts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
+
declare const STOREFRONT_FONTS: readonly ["inter", "montserrat", "poppins", "raleway", "nunito", "work_sans", "mulish", "barlow", "jost", "bitter", "archivo", "public_sans", "gantari", "anybody", "lato", "playfair_display", "karla", "reddit_sans", "overpass", "roboto", "open_sans", "merriweather", "outfit", "fraunces", "dm_sans", "cormorant_garamond", "eb_garamond", "lora", "crimson_pro", "source_serif_4", "ibm_plex_serif", "manrope", "plus_jakarta_sans", "space_grotesk", "ibm_plex_sans", "libre_franklin", "josefin_sans"];
|
|
4
|
+
type StorefrontFont = (typeof STOREFRONT_FONTS)[number];
|
|
5
|
+
declare const STOREFRONT_FONT_FAMILIES: Record<StorefrontFont, string>;
|
|
6
|
+
|
|
3
7
|
declare const STOREFRONT_LOCALES: readonly ["en", "fr", "es", "de", "it", "pt", "nl"];
|
|
4
8
|
type StorefrontLocale = (typeof STOREFRONT_LOCALES)[number];
|
|
5
9
|
declare const storefrontSiteConfigSchema: z.ZodObject<{
|
|
@@ -40,6 +44,20 @@ declare const storefrontSiteConfigSchema: z.ZodObject<{
|
|
|
40
44
|
open_sans: "open_sans";
|
|
41
45
|
merriweather: "merriweather";
|
|
42
46
|
outfit: "outfit";
|
|
47
|
+
fraunces: "fraunces";
|
|
48
|
+
dm_sans: "dm_sans";
|
|
49
|
+
cormorant_garamond: "cormorant_garamond";
|
|
50
|
+
eb_garamond: "eb_garamond";
|
|
51
|
+
lora: "lora";
|
|
52
|
+
crimson_pro: "crimson_pro";
|
|
53
|
+
source_serif_4: "source_serif_4";
|
|
54
|
+
ibm_plex_serif: "ibm_plex_serif";
|
|
55
|
+
manrope: "manrope";
|
|
56
|
+
plus_jakarta_sans: "plus_jakarta_sans";
|
|
57
|
+
space_grotesk: "space_grotesk";
|
|
58
|
+
ibm_plex_sans: "ibm_plex_sans";
|
|
59
|
+
libre_franklin: "libre_franklin";
|
|
60
|
+
josefin_sans: "josefin_sans";
|
|
43
61
|
}>;
|
|
44
62
|
body: z.ZodEnum<{
|
|
45
63
|
inter: "inter";
|
|
@@ -65,6 +83,20 @@ declare const storefrontSiteConfigSchema: z.ZodObject<{
|
|
|
65
83
|
open_sans: "open_sans";
|
|
66
84
|
merriweather: "merriweather";
|
|
67
85
|
outfit: "outfit";
|
|
86
|
+
fraunces: "fraunces";
|
|
87
|
+
dm_sans: "dm_sans";
|
|
88
|
+
cormorant_garamond: "cormorant_garamond";
|
|
89
|
+
eb_garamond: "eb_garamond";
|
|
90
|
+
lora: "lora";
|
|
91
|
+
crimson_pro: "crimson_pro";
|
|
92
|
+
source_serif_4: "source_serif_4";
|
|
93
|
+
ibm_plex_serif: "ibm_plex_serif";
|
|
94
|
+
manrope: "manrope";
|
|
95
|
+
plus_jakarta_sans: "plus_jakarta_sans";
|
|
96
|
+
space_grotesk: "space_grotesk";
|
|
97
|
+
ibm_plex_sans: "ibm_plex_sans";
|
|
98
|
+
libre_franklin: "libre_franklin";
|
|
99
|
+
josefin_sans: "josefin_sans";
|
|
68
100
|
}>;
|
|
69
101
|
}, z.core.$strip>;
|
|
70
102
|
nav: z.ZodArray<z.ZodObject<{
|
|
@@ -138,4 +170,4 @@ type StorefrontSiteConfig = z.infer<typeof storefrontSiteConfigSchema>;
|
|
|
138
170
|
|
|
139
171
|
declare function defineSuiteOpConfig(config: StorefrontSiteConfig): StorefrontSiteConfig;
|
|
140
172
|
|
|
141
|
-
export { STOREFRONT_LOCALES, type StorefrontLocale, type StorefrontSiteConfig, defineSuiteOpConfig, storefrontSiteConfigSchema };
|
|
173
|
+
export { STOREFRONT_FONT_FAMILIES, STOREFRONT_LOCALES, type StorefrontLocale, type StorefrontSiteConfig, defineSuiteOpConfig, storefrontSiteConfigSchema };
|
package/dist/config.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
+
declare const STOREFRONT_FONTS: readonly ["inter", "montserrat", "poppins", "raleway", "nunito", "work_sans", "mulish", "barlow", "jost", "bitter", "archivo", "public_sans", "gantari", "anybody", "lato", "playfair_display", "karla", "reddit_sans", "overpass", "roboto", "open_sans", "merriweather", "outfit", "fraunces", "dm_sans", "cormorant_garamond", "eb_garamond", "lora", "crimson_pro", "source_serif_4", "ibm_plex_serif", "manrope", "plus_jakarta_sans", "space_grotesk", "ibm_plex_sans", "libre_franklin", "josefin_sans"];
|
|
4
|
+
type StorefrontFont = (typeof STOREFRONT_FONTS)[number];
|
|
5
|
+
declare const STOREFRONT_FONT_FAMILIES: Record<StorefrontFont, string>;
|
|
6
|
+
|
|
3
7
|
declare const STOREFRONT_LOCALES: readonly ["en", "fr", "es", "de", "it", "pt", "nl"];
|
|
4
8
|
type StorefrontLocale = (typeof STOREFRONT_LOCALES)[number];
|
|
5
9
|
declare const storefrontSiteConfigSchema: z.ZodObject<{
|
|
@@ -40,6 +44,20 @@ declare const storefrontSiteConfigSchema: z.ZodObject<{
|
|
|
40
44
|
open_sans: "open_sans";
|
|
41
45
|
merriweather: "merriweather";
|
|
42
46
|
outfit: "outfit";
|
|
47
|
+
fraunces: "fraunces";
|
|
48
|
+
dm_sans: "dm_sans";
|
|
49
|
+
cormorant_garamond: "cormorant_garamond";
|
|
50
|
+
eb_garamond: "eb_garamond";
|
|
51
|
+
lora: "lora";
|
|
52
|
+
crimson_pro: "crimson_pro";
|
|
53
|
+
source_serif_4: "source_serif_4";
|
|
54
|
+
ibm_plex_serif: "ibm_plex_serif";
|
|
55
|
+
manrope: "manrope";
|
|
56
|
+
plus_jakarta_sans: "plus_jakarta_sans";
|
|
57
|
+
space_grotesk: "space_grotesk";
|
|
58
|
+
ibm_plex_sans: "ibm_plex_sans";
|
|
59
|
+
libre_franklin: "libre_franklin";
|
|
60
|
+
josefin_sans: "josefin_sans";
|
|
43
61
|
}>;
|
|
44
62
|
body: z.ZodEnum<{
|
|
45
63
|
inter: "inter";
|
|
@@ -65,6 +83,20 @@ declare const storefrontSiteConfigSchema: z.ZodObject<{
|
|
|
65
83
|
open_sans: "open_sans";
|
|
66
84
|
merriweather: "merriweather";
|
|
67
85
|
outfit: "outfit";
|
|
86
|
+
fraunces: "fraunces";
|
|
87
|
+
dm_sans: "dm_sans";
|
|
88
|
+
cormorant_garamond: "cormorant_garamond";
|
|
89
|
+
eb_garamond: "eb_garamond";
|
|
90
|
+
lora: "lora";
|
|
91
|
+
crimson_pro: "crimson_pro";
|
|
92
|
+
source_serif_4: "source_serif_4";
|
|
93
|
+
ibm_plex_serif: "ibm_plex_serif";
|
|
94
|
+
manrope: "manrope";
|
|
95
|
+
plus_jakarta_sans: "plus_jakarta_sans";
|
|
96
|
+
space_grotesk: "space_grotesk";
|
|
97
|
+
ibm_plex_sans: "ibm_plex_sans";
|
|
98
|
+
libre_franklin: "libre_franklin";
|
|
99
|
+
josefin_sans: "josefin_sans";
|
|
68
100
|
}>;
|
|
69
101
|
}, z.core.$strip>;
|
|
70
102
|
nav: z.ZodArray<z.ZodObject<{
|
|
@@ -138,4 +170,4 @@ type StorefrontSiteConfig = z.infer<typeof storefrontSiteConfigSchema>;
|
|
|
138
170
|
|
|
139
171
|
declare function defineSuiteOpConfig(config: StorefrontSiteConfig): StorefrontSiteConfig;
|
|
140
172
|
|
|
141
|
-
export { STOREFRONT_LOCALES, type StorefrontLocale, type StorefrontSiteConfig, defineSuiteOpConfig, storefrontSiteConfigSchema };
|
|
173
|
+
export { STOREFRONT_FONT_FAMILIES, STOREFRONT_LOCALES, type StorefrontLocale, type StorefrontSiteConfig, defineSuiteOpConfig, storefrontSiteConfigSchema };
|
package/dist/config.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { STOREFRONT_FONTS } from './chunk-PYVUDQSQ.js';
|
|
2
|
+
export { STOREFRONT_FONT_FAMILIES } from './chunk-PYVUDQSQ.js';
|
|
2
3
|
import { z } from 'zod';
|
|
3
4
|
|
|
4
|
-
var STOREFRONT_LOCALES=["en","fr","es","de","it","pt","nl"];var REQUIRED="validation.required";var TOO_LONG="validation.max_length";var TOO_MANY="validation.too_large";var INVALID="validation.invalid";var text=max=>z.string(INVALID).max(max,TOO_LONG);var localeSchema=z.enum(STOREFRONT_LOCALES,"validation.storefront.locale_unsupported");var hexSchema=z.string(INVALID).regex(/^#[0-9A-Fa-f]{6}$/,"validation.storefront.color_hex");var assetUrlSchema=z.url({protocol:/^https$/,error:"validation.storefront.url_https"});var localizedSchema=z.partialRecord(localeSchema,text(200),INVALID);var linkSchema=z.object({label:localizedSchema,href:text(500).regex(/^(\/(?!\/)|https:\/\/)/,"validation.storefront.link_href")},INVALID);var fontSchema=z.enum(
|
|
5
|
+
var STOREFRONT_LOCALES=["en","fr","es","de","it","pt","nl"];var REQUIRED="validation.required";var TOO_LONG="validation.max_length";var TOO_MANY="validation.too_large";var INVALID="validation.invalid";var text=max=>z.string(INVALID).max(max,TOO_LONG);var localeSchema=z.enum(STOREFRONT_LOCALES,"validation.storefront.locale_unsupported");var hexSchema=z.string(INVALID).regex(/^#[0-9A-Fa-f]{6}$/,"validation.storefront.color_hex");var assetUrlSchema=z.url({protocol:/^https$/,error:"validation.storefront.url_https"});var localizedSchema=z.partialRecord(localeSchema,text(200),INVALID);var linkSchema=z.object({label:localizedSchema,href:text(500).regex(/^(\/(?!\/)|https:\/\/)/,"validation.storefront.link_href")},INVALID);var fontSchema=z.enum(STOREFRONT_FONTS,"validation.invalid_option");var storefrontSiteConfigSchema=z.object({brand:z.object({name:text(80).min(1,REQUIRED),logoUrl:assetUrlSchema.nullable(),faviconUrl:assetUrlSchema.nullable()},INVALID),colors:z.object({primary:hexSchema,primaryForeground:hexSchema,background:hexSchema,foreground:hexSchema,accent:hexSchema},INVALID),fonts:z.object({heading:fontSchema,body:fontSchema},INVALID),nav:z.array(linkSchema,INVALID).max(8,TOO_MANY),footer:z.object({text:localizedSchema,links:z.array(linkSchema,INVALID).max(12,TOO_MANY)},INVALID),defaultLocale:localeSchema,locales:z.array(localeSchema,INVALID).min(1,REQUIRED).max(STOREFRONT_LOCALES.length,TOO_MANY),seo:z.object({titleTemplate:text(80).includes("%s",{error:"validation.storefront.title_template_placeholder"}),defaultDescription:localizedSchema,ogImageUrl:assetUrlSchema.nullable()},INVALID)},INVALID).refine(c=>c.locales.includes(c.defaultLocale),{path:["defaultLocale"],message:"validation.storefront.default_locale_not_listed"});function defineSuiteOpConfig(config){return storefrontSiteConfigSchema.parse(config)}
|
|
5
6
|
|
|
6
7
|
export { STOREFRONT_LOCALES, defineSuiteOpConfig, storefrontSiteConfigSchema };
|
package/dist/content.cjs
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkZHFZ6II2_cjs = require('./chunk-ZHFZ6II2.cjs');
|
|
4
|
+
require('./chunk-4GZBXKBU.cjs');
|
|
5
|
+
require('./chunk-USOISC2R.cjs');
|
|
6
|
+
require('./chunk-LVFRVNT3.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
Object.defineProperty(exports, "contentModelSchema", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () { return chunkZHFZ6II2_cjs.contentModelSchema; }
|
|
13
|
+
});
|
|
14
|
+
Object.defineProperty(exports, "createContentReader", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return chunkZHFZ6II2_cjs.createContentReader; }
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "defineContent", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () { return chunkZHFZ6II2_cjs.defineContent; }
|
|
21
|
+
});
|
|
22
|
+
Object.defineProperty(exports, "field", {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function () { return chunkZHFZ6II2_cjs.field; }
|
|
25
|
+
});
|
|
26
|
+
Object.defineProperty(exports, "parseContentModel", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function () { return chunkZHFZ6II2_cjs.parseContentModel; }
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "readFields", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () { return chunkZHFZ6II2_cjs.readFields; }
|
|
33
|
+
});
|
|
34
|
+
Object.defineProperty(exports, "toContentModel", {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
get: function () { return chunkZHFZ6II2_cjs.toContentModel; }
|
|
37
|
+
});
|