@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.
Files changed (53) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +74 -0
  3. package/dist/astro-content-model.cjs +17 -0
  4. package/dist/astro-content-model.d.cts +4 -0
  5. package/dist/astro-content-model.d.ts +4 -0
  6. package/dist/astro-content-model.js +10 -0
  7. package/dist/astro.cjs +3 -1
  8. package/dist/astro.d.cts +38 -17
  9. package/dist/astro.d.ts +38 -17
  10. package/dist/astro.js +2 -2
  11. package/dist/checkout.cjs +3 -3
  12. package/dist/checkout.js +2 -2
  13. package/dist/chunk-2U6L33AT.cjs +19 -0
  14. package/dist/chunk-4GZBXKBU.cjs +18 -0
  15. package/dist/chunk-GJSCEBSU.js +5 -0
  16. package/dist/chunk-HLGSWF4I.js +9 -0
  17. package/dist/{chunk-YFTWGF3L.js → chunk-HMLBMNGA.js} +1 -1
  18. package/dist/chunk-KKJCPKPY.js +8 -0
  19. package/dist/chunk-PYVUDQSQ.js +3 -0
  20. package/dist/chunk-USOISC2R.cjs +17 -0
  21. package/dist/{chunk-RDREYP27.cjs → chunk-VV2UNVQ2.cjs} +2 -2
  22. package/dist/chunk-ZHFZ6II2.cjs +16 -0
  23. package/dist/chunk-ZI2PG7LS.js +6 -0
  24. package/dist/chunk-ZLAOY6IF.cjs +9 -0
  25. package/dist/{errors-y-BiaVAk.d.cts → client-DER7y1WE.d.cts} +98 -147
  26. package/dist/{errors-Bp_jmXbA.d.ts → client-goQnVoLP.d.ts} +98 -147
  27. package/dist/components.cjs +1 -1
  28. package/dist/components.js +1 -1
  29. package/dist/config.cjs +6 -2
  30. package/dist/config.d.cts +33 -1
  31. package/dist/config.d.ts +33 -1
  32. package/dist/config.js +3 -2
  33. package/dist/content.cjs +37 -0
  34. package/dist/content.d.cts +254 -0
  35. package/dist/content.d.ts +254 -0
  36. package/dist/content.js +4 -0
  37. package/dist/errors-B2eCo5Cz.d.cts +151 -0
  38. package/dist/errors-D-dULpp1.d.ts +151 -0
  39. package/dist/index.cjs +21 -20
  40. package/dist/index.d.cts +3 -2
  41. package/dist/index.d.ts +3 -2
  42. package/dist/index.js +4 -3
  43. package/dist/react.cjs +6 -5
  44. package/dist/react.d.cts +2 -1
  45. package/dist/react.d.ts +2 -1
  46. package/dist/react.js +5 -4
  47. package/package.json +22 -2
  48. package/dist/chunk-AIQUVZEI.cjs +0 -8
  49. package/dist/chunk-GIIXCS6X.cjs +0 -18
  50. package/dist/chunk-LIBKUMJV.js +0 -8
  51. package/dist/chunk-SK5TD73J.js +0 -3
  52. package/dist/chunk-UACP7BZ7.js +0 -6
  53. package/dist/chunk-XIAAWHAY.cjs +0 -17
@@ -0,0 +1,5 @@
1
+ import { z } from 'zod';
2
+
3
+ var emailField=z.string().trim().toLowerCase().pipe(z.email("validation.email_invalid"));z.string().trim().min(1,"validation.email_required").pipe(emailField);var trimmedEmailField=z.string().trim().pipe(z.email("validation.email_invalid"));var requiredTrimmedEmailField=z.string().trim().min(1,"validation.email_required").pipe(trimmedEmailField);z.string().nullish().transform((raw,ctx)=>{if(raw===void 0)return void 0;const trimmed=(raw??"").trim().toLowerCase();if(!trimmed)return null;if(!z.email().safeParse(trimmed).success){ctx.addIssue({code:"custom",message:"validation.email_invalid"});return z.NEVER}return trimmed});z.uuid();var storefrontSiteSchema=z.object({id:z.uuid(),name:z.string(),slug:z.string(),isActive:z.boolean(),enableWebChat:z.boolean(),mapEmbedHost:z.string().nullable(),countryCode:z.string().nullish(),bookingsOpen:z.boolean().optional()});var storefrontListingSummarySchema=z.object({id:z.uuid(),buildingId:z.uuid(),sortOrder:z.number().int(),name:z.string(),coverImageUrl:z.string().nullable(),city:z.string().nullable(),state:z.string().nullable(),bedroomCount:z.number().int().nullable(),bathroomCount:z.number().nullable(),maxGuests:z.number().int().nullable(),averageRating:z.number().nullable(),latitude:z.number().nullable(),longitude:z.number().nullable(),bookable:z.boolean()});var storefrontListingSchema=storefrontListingSummarySchema.extend({buildingSlug:z.string(),buildingAddress:z.unknown(),description:z.string().nullable(),amenities:z.array(z.string()),pictures:z.unknown(),rooms:z.unknown(),houseRules:z.string().nullable(),checkInTime:z.string().nullable(),checkOutTime:z.string().nullable(),beds:z.number().nullable(),fromPriceMinor:z.number().int().nonnegative().nullish(),currency:z.string().nullish(),countryCode:z.string().nullish()});z.object({location:z.string().trim().min(1).max(200).optional(),building:z.uuid().optional(),limit:z.coerce.number().int().min(1).max(100).default(50),offset:z.coerce.number().int().min(0).max(1e4).default(0)});var storefrontImageSchema=z.object({url:z.string(),alt:z.string().nullable(),width:z.number().int().nullable(),height:z.number().int().nullable()});var storefrontBuildingSchema=z.object({id:z.uuid(),locationId:z.uuid().nullable(),nameId:z.uuid().nullable(),descriptionId:z.uuid().nullable(),slug:z.string(),imageId:z.uuid().nullable(),latitude:z.number().nullable(),longitude:z.number().nullable(),address:z.unknown(),name:z.string().nullish(),description:z.string().nullish(),imageUrl:z.string().nullish(),images:z.array(storefrontImageSchema).nullish(),sortOrder:z.number().int().nullish(),listingCount:z.number().int().nullish(),fields:z.record(z.string(),z.record(z.string(),z.unknown())).nullish()});var storefrontLocationSchema=z.object({id:z.uuid(),type:z.string(),parentId:z.uuid().nullable(),nameId:z.uuid().nullable(),slug:z.string().nullable(),imageId:z.uuid().nullable(),latitude:z.number().nullable(),longitude:z.number().nullable(),address:z.unknown(),sortOrder:z.number().int(),name:z.string().nullish(),description:z.string().nullish(),imageUrl:z.string().nullish(),images:z.array(storefrontImageSchema).nullish(),buildingCount:z.number().int().nullish(),fields:z.record(z.string(),z.record(z.string(),z.unknown())).nullish()});z.object({locale:z.string().max(35).optional().catch(void 0)});var storefrontReviewSchema=z.object({id:z.uuid(),listingId:z.uuid().nullable(),reviewedAt:z.string().nullable(),rating:z.number().nullable(),publicReview:z.string(),source:z.string().nullable()});z.object({listingId:z.uuid().optional(),limit:z.coerce.number().int().min(1).max(100).default(20),offset:z.coerce.number().int().min(0).max(1e4).default(0)});z.object({name:z.string().trim().min(1,"validation.name_required").max(200,"validation.name_max_length"),email:requiredTrimmedEmailField,subject:z.string().trim().min(1,"validation.title_required").max(300,"validation.title_max_length"),message:z.string().trim().min(10,"validation.message_min_length").max(1e4,"validation.message_max_length")});var storefrontContactResultSchema=z.object({sent:z.literal(true)});var storefrontContentRefSchema=z.object({kind:z.string(),id:z.uuid(),slug:z.string().nullable()});var storefrontContentItemSchema=z.object({id:z.uuid(),type:z.string(),slug:z.string().nullable(),publishedAt:z.string().nullable(),updatedAt:z.string(),sortOrder:z.number().int(),fields:z.record(z.string(),z.unknown())});var storefrontContentFieldDefSchema=z.object({key:z.string(),type:z.string()}).catchall(z.unknown());var storefrontContentModelSchema=z.object({version:z.number().int(),types:z.array(z.object({key:z.string(),kind:z.string(),fields:z.array(storefrontContentFieldDefSchema)}).catchall(z.unknown()))});z.object({limit:z.coerce.number().int().min(1).max(100).default(20),offset:z.coerce.number().int().min(0).max(1e4).default(0),locale:z.string().max(35).optional().catch(void 0)});z.string().regex(/^[a-z][a-z0-9_]{0,39}$/);z.string().min(1).max(120).regex(/^[a-z0-9-]+$/);
4
+
5
+ export { requiredTrimmedEmailField, storefrontBuildingSchema, storefrontContactResultSchema, storefrontContentItemSchema, storefrontContentModelSchema, storefrontContentRefSchema, storefrontImageSchema, storefrontListingSchema, storefrontListingSummarySchema, storefrontLocationSchema, storefrontReviewSchema, storefrontSiteSchema };
@@ -0,0 +1,9 @@
1
+ import { BE_BOOKING_REQUEST_STATUSES, STOREFRONT_KEY_ENVIRONMENTS, REGIONS } from './chunk-PYVUDQSQ.js';
2
+ import { requiredTrimmedEmailField, storefrontReviewSchema, storefrontContentItemSchema, storefrontLocationSchema, storefrontBuildingSchema, storefrontListingSummarySchema, storefrontContactResultSchema, storefrontContentModelSchema, storefrontListingSchema, storefrontSiteSchema } from './chunk-GJSCEBSU.js';
3
+ import { StorefrontConfigError, StorefrontError, storefrontQuoteSchema, StorefrontTimeoutError, StorefrontNetworkError, errorFromResponse } from './chunk-ZI2PG7LS.js';
4
+ import { openEnum, storefrontDateSchema, storefrontCalendarSchema, storefrontAvailabilitySchema } from './chunk-6NFURJXI.js';
5
+ import { z } from 'zod';
6
+
7
+ var STOREFRONT_CHANNELS=["ai_assistant","paid_search","paid_social","organic_search","organic_social","email","referral","direct"];var AI_ASSISTANT_HOSTS={"chatgpt.com":"chatgpt","chat.openai.com":"chatgpt","perplexity.ai":"perplexity","gemini.google.com":"gemini","copilot.microsoft.com":"copilot","claude.ai":"claude"};var AI_ASSISTANT_SOURCES={"chatgpt.com":"chatgpt",perplexity:"perplexity","perplexity.ai":"perplexity",gemini:"gemini",copilot:"copilot","claude.ai":"claude"};var PAID_CLICKS=["google","microsoft","meta"];var PAID_MEDIUMS=new Set(["cpc","ppc","paid","paidsearch","sem"]);var EMAIL_RE=/newsletter|mailchimp|klaviyo/;var SEARCH_SUFFIXES=["bing.com","duckduckgo.com","search.yahoo.com","baidu.com","ecosia.org","search.brave.com"];var SEARCH_ANY_TLD_RE=/^(?:www\.)?(?:google|yandex)\.[a-z]{2,3}(?:\.[a-z]{2})?$/;var SOCIAL_SUFFIXES=["facebook.com","instagram.com","t.co","x.com","twitter.com","linkedin.com","tiktok.com","youtube.com","reddit.com"];var SOCIAL_ANY_TLD_RE=/(?:^|\.)pinterest\.[a-z]{2,3}(?:\.[a-z]{2})?$/;var SOCIAL_SOURCES=new Set(["facebook","fb","instagram","ig","meta","twitter","x","linkedin","pinterest","tiktok","youtube","reddit"]);var clean=value=>{const v=value?.trim().toLowerCase();return v?v:null};var hostOf=value=>clean(value)?.replace(/\.$/,"")??null;var hostMatches=(host,suffix)=>host===suffix||host.endsWith(`.${suffix}`);var bareHost=host=>host.replace(/^www\./,"");function aiLabel(host,source){if(host){const suffix=Object.keys(AI_ASSISTANT_HOSTS).find(s=>hostMatches(host,s));if(suffix)return AI_ASSISTANT_HOSTS[suffix]}return source&&Object.hasOwn(AI_ASSISTANT_SOURCES,source)?AI_ASSISTANT_SOURCES[source]:null}var isSearchHost=host=>SEARCH_ANY_TLD_RE.test(host)||SEARCH_SUFFIXES.some(s=>hostMatches(host,s));var isSocialHost=host=>SOCIAL_ANY_TLD_RE.test(host)||SOCIAL_SUFFIXES.some(s=>hostMatches(host,s));function paidClickOf(t){const medium=clean(t.utmMedium);if(t.fbclid&&medium!==null&&PAID_MEDIUMS.has(medium))return "meta";if(t.gclid||t.gbraid||t.wbraid)return "google";if(t.msclkid)return "microsoft";if(t.fbclid)return "meta";return t.paidClick??null}function classifyChannel(t){const source=clean(t.utmSource);const medium=clean(t.utmMedium);const site=bareHost(hostOf(t.siteHost)??"");const ref=hostOf(t.referrerHost);const external=ref&&bareHost(ref)!==site?ref:null;const result=(channel,label=null)=>({channel,source:label??source??external,medium});const socialSource=source!==null&&(SOCIAL_SOURCES.has(source)||isSocialHost(source))||!!(external&&isSocialHost(external));const paidMedium=medium!==null&&PAID_MEDIUMS.has(medium);const searchClick=t.gclid||t.gbraid||t.wbraid||t.msclkid||t.paidClick==="google"||t.paidClick==="microsoft";const metaClick=t.fbclid||t.paidClick==="meta";if(searchClick||paidMedium){return result(socialSource||metaClick&&paidMedium?"paid_social":"paid_search")}if(medium==="email"||EMAIL_RE.test(source??"")||EMAIL_RE.test(medium??"")){return result("email")}const ai=aiLabel(external,source);if(ai)return result("ai_assistant",ai);if(external&&isSearchHost(external))return result("organic_search");if(socialSource||metaClick)return result("organic_social");const anyUtm=[source,medium,t.utmCampaign,t.utmTerm,t.utmContent].some(v=>clean(v??null));if(!external&&!anyUtm)return result("direct");return result("referral")}var consentStateSchema=z.object({analytics:z.boolean(),ads:z.boolean(),source:z.enum(["default","user"]),region:z.enum(["restricted","other"]),decidedAt:z.iso.datetime().max(40).nullable()});function isSafePrivacyUrl(value){if([...value].some(ch=>/\s/.test(ch)||ch.charCodeAt(0)<32))return false;if(value.startsWith("/"))return !value.startsWith("//")&&!value.startsWith("/\\");if(!value.startsWith("https://")||!URL.canParse(value))return false;const url=new URL(value);return url.hostname!==""&&url.username===""&&url.password===""}var STOREFRONT_CONSENT_MODES=["regional","strict"];var modeField=z.enum(STOREFRONT_CONSENT_MODES);var privacyPolicyUrlField=z.string().trim().max(2048,"validation.storefront.privacy_policy_url_invalid").refine(isSafePrivacyUrl,"validation.storefront.privacy_policy_url_invalid").nullable();z.object({mode:modeField.default("regional"),privacyPolicyUrl:privacyPolicyUrlField.default(null)});z.object({siteId:z.uuid(),consentSettings:z.object({mode:modeField.optional(),privacyPolicyUrl:privacyPolicyUrlField.optional()})});var ACTIVE_RESERVATION_STATUSES=["confirmed","reserved","awaiting_payment"];new Set(ACTIVE_RESERVATION_STATUSES);var SCHEDULABLE_RESERVATION_STATUSES=[...ACTIVE_RESERVATION_STATUSES,"blocked"];new Set(SCHEDULABLE_RESERVATION_STATUSES);var VOLATILE_SYNC_STATUSES=["pending","pending_deletion","failed_deletion"];new Set(VOLATILE_SYNC_STATUSES);var CURRENCIES=["usd","eur","aud","gbp","cad","chf","cny","jpy","nzd","nok","mxn","thb","bgn","aed","inr","rub","brl","zar","sgd","hkd","xcd","xof","clp","dkk","try","bnd","xcg","shp","fkp","idr","ron","czk"];var ZERO_DECIMAL_CURRENCY_CODES=new Set(["bif","clp","djf","gnf","jpy","kmf","krw","mga","pyg","rwf","vnd","vuv","xaf","xof","xpf"]);new Set(CURRENCIES.filter(code=>ZERO_DECIMAL_CURRENCY_CODES.has(code)));var LIVE_PAYMENT_INTENT_STATUS_LIST=["succeeded","processing","requires_capture","refunded","disputed","reversed"];new Set(LIVE_PAYMENT_INTENT_STATUS_LIST);var BE_SITE_EXPERIMENT_VARIANTS=["a","b"];var ACTIVE_MIGRATION_RUN_STATUSES=["running","writing","finalizing","rolling_back"];new Set(ACTIVE_MIGRATION_RUN_STATUSES.filter(status=>status!=="rolling_back"));var experimentVariantSchema=z.enum(BE_SITE_EXPERIMENT_VARIANTS);var experimentAssignmentSchema=z.object({id:z.uuid(),variant:experimentVariantSchema});z.object({siteId:z.uuid()});z.object({siteId:z.uuid(),deploymentBId:z.uuid("validation.storefront.experiment_variant_required"),splitBPercent:z.number("validation.storefront.experiment_split_range").int("validation.storefront.experiment_split_range").min(1,"validation.storefront.experiment_split_range").max(99,"validation.storefront.experiment_split_range")});z.object({id:z.uuid(),winner:experimentVariantSchema.nullable()});z.object({id:z.uuid()});var clickId=z.string().min(1).max(512).regex(/^[\w.\-~]+$/);var storable=value=>!value.includes("\0")&&!/\p{Surrogate}/u.test(value);var utm=z.string().max(150).refine(storable).nullable();var attributionTouchSchema=z.object({ts:z.iso.datetime().max(40),landingPath:z.string().max(512).regex(/^\/[^?#]*$/).refine(storable),referrerHost:z.string().max(253).regex(/^[a-z0-9.-]+$/).nullable(),utmSource:utm,utmMedium:utm,utmCampaign:utm,utmTerm:utm,utmContent:utm,gclid:clickId.nullable(),gbraid:clickId.nullable(),wbraid:clickId.nullable(),fbclid:clickId.nullable(),msclkid:clickId.nullable(),paidClick:z.enum(PAID_CLICKS).nullable().default(null)});var attributionIdsSchema=z.object({gaClientId:z.string().max(64).regex(/^\d+\.\d+$/).nullable(),gaSessionId:z.string().max(32).regex(/^\d+$/).nullable(),fbp:z.string().max(128).regex(/^fb\.\d\.\d+\.\d+$/).nullable(),fbc:z.string().max(600).regex(/^fb\.\d\.\d+\.[\w-]+$/).nullable()});var storefrontAttributionInputSchema=z.object({first:attributionTouchSchema.nullable(),last:attributionTouchSchema.nullable(),ids:attributionIdsSchema,consent:consentStateSchema,experiment:experimentAssignmentSchema.optional()});var STORED_ATTRIBUTION_CHANNELS=[...STOREFRONT_CHANNELS,"ai_agent_mcp"];storefrontAttributionInputSchema.extend({firstChannel:z.enum(STORED_ATTRIBUTION_CHANNELS).nullable(),lastChannel:z.enum(STORED_ATTRIBUTION_CHANNELS),userAgent:z.string().max(512).nullable(),capturedAt:z.iso.datetime()});function withoutClickIds(touch){return {...touch,gclid:null,gbraid:null,wbraid:null,fbclid:null,msclkid:null,paidClick:paidClickOf(touch)}}var MAX_CHECKOUT_CUSTOM_FIELDS=10;var MAX_CHECKOUT_UPSELLS=12;var MAX_CHECKOUT_UPSELL_QUANTITY=50;var MAX_CHECKOUT_FIELD_LENGTH=2e3;var MAX_FIELD_KEY_LENGTH=40;var BOOKING_UPSELL_CHARGE_TYPES=["fixed_price","price_per_quantity","price_per_night","price_per_guest_per_night","free"];var localizedTextSchema=z.object({default:z.string().trim().min(1,"validation.required").max(200,"validation.max_length"),translations:z.record(z.string().min(2).max(10),z.string().max(200,"validation.max_length")).optional()});var fieldKeySchema=z.string().regex(new RegExp(`^[a-z][a-z0-9_]{0,${MAX_FIELD_KEY_LENGTH-1}}$`),"validation.storefront.extensions_invalid_key").refine(key=>!(key in Object.prototype),"validation.storefront.extensions_invalid_key");var boundSchema=z.number({error:"validation.number_required"}).int("validation.integer_required");var fieldBase={key:fieldKeySchema,label:localizedTextSchema,required:z.boolean()};var customFieldDefSchema=z.discriminatedUnion("type",[z.object({type:z.enum(["text","textarea"]),...fieldBase,maxLength:z.number({error:"validation.number_required"}).int("validation.integer_required").min(1,"validation.too_small").max(MAX_CHECKOUT_FIELD_LENGTH,"validation.too_large").default(500)}),z.object({type:z.literal("select"),...fieldBase,options:z.array(z.object({value:z.string().max(64).refine(value=>value.trim()!=="","validation.required"),label:localizedTextSchema})).min(1,"validation.storefront.extensions_select_needs_options").max(30,"validation.too_large").refine(options=>new Set(options.map(o=>o.value)).size===options.length,{message:"validation.storefront.extensions_duplicate_option"})}),z.object({type:z.literal("checkbox"),...fieldBase}),z.object({type:z.literal("number"),...fieldBase,min:boundSchema.optional(),max:boundSchema.optional()}),z.object({type:z.literal("date"),...fieldBase})]);z.object({customFields:z.array(customFieldDefSchema).max(MAX_CHECKOUT_CUSTOM_FIELDS,"validation.too_large").superRefine((fields,ctx)=>{const seen=new Set;fields.forEach((field,index)=>{if(seen.has(field.key)){ctx.addIssue({code:"custom",path:[index,"key"],message:"validation.storefront.extensions_duplicate_key"});}seen.add(field.key);if(field.type==="number"&&field.min!=null&&field.max!=null&&field.min>field.max){ctx.addIssue({code:"custom",path:[index,"max"],message:"validation.storefront.extensions_number_range_invalid"});}});}).default([]),upsells:z.object({portalUpsellIds:z.array(z.uuid()).max(MAX_CHECKOUT_UPSELLS,"validation.too_large").refine(ids=>new Set(ids).size===ids.length,{message:"validation.storefront.extensions_duplicate_upsell"}).default([])}).default({portalUpsellIds:[]})});var checkoutExtrasInputSchema=z.object({customFields:z.record(z.string().max(MAX_FIELD_KEY_LENGTH),z.union([z.string().max(MAX_CHECKOUT_FIELD_LENGTH),z.number(),z.boolean()])).refine(values=>Object.keys(values).length<=MAX_CHECKOUT_CUSTOM_FIELDS,{message:"validation.too_large"}).default({}),upsells:z.array(z.object({portalUpsellId:z.uuid(),quantity:z.number().int().min(1).max(MAX_CHECKOUT_UPSELL_QUANTITY)})).max(MAX_CHECKOUT_UPSELLS).default([])});var upsellOfferSchema=z.object({portalUpsellId:z.uuid(),title:z.string(),description:z.string().nullable(),imageUrl:z.string().nullable(),chargeType:z.enum(BOOKING_UPSELL_CHARGE_TYPES),unitMinor:z.number().int(),minQuantity:z.number().int(),maxQuantity:z.number().int(),quantifierLabel:z.string().nullable(),currency:z.string().length(3)});z.object({locale:z.string().max(35).optional().catch(void 0)});z.object({customFields:z.array(customFieldDefSchema),upsellOffers:z.array(upsellOfferSchema)});var checkoutSessionExtrasSchema=z.object({lines:z.array(z.object({portalUpsellId:z.uuid().nullable(),title:z.string(),quantity:z.number().int(),totalMinor:z.number().int()})),extrasTotalMinor:z.number().int(),heldTotalMinor:z.number().int()});var amountMinor=z.number().int().positive();var currency=z.string().length(3);var chargedByHost=z.literal("host");var checkoutMountDescriptorKnownSchema=z.discriminatedUnion("provider",[z.object({provider:z.literal("stripe"),publishableKey:z.string().min(1),stripeAccountId:z.string().nullable(),clientSecret:z.string().min(1),amountMinor,currency}),z.object({provider:z.literal("juspay"),publishableKey:z.string().min(1),providerBaseUrl:z.url(),clientSecret:z.string().min(1),profileId:z.string().min(1),amountMinor,currency}),z.object({provider:z.literal("guesty_pay"),guestyPartnerId:z.string().min(1),paymentProviderId:z.string().min(1),externalListingId:z.string().min(1),pmsQuoteId:z.string().nullable(),amountMinor,currency,chargedBy:chargedByHost.optional()}),z.object({provider:z.literal("pms_stripe"),publishableKey:z.string().min(1),stripeAccountId:z.string().min(1),clientSecret:z.string().min(1),amountMinor,currency,chargedBy:chargedByHost})]);var KNOWN_MOUNT_PROVIDERS=["stripe","juspay","guesty_pay","pms_stripe"];var checkoutMountDescriptorSchema=z.union([checkoutMountDescriptorKnownSchema,z.object({provider:z.string().refine(p=>!KNOWN_MOUNT_PROVIDERS.includes(p))}).loose()]);z.enum(BE_BOOKING_REQUEST_STATUSES);var bookingRequestStatusResponseSchema=openEnum(BE_BOOKING_REQUEST_STATUSES);var checkoutSessionQuoteSchema=z.object({listingId:z.uuid(),checkIn:z.iso.date(),checkOut:z.iso.date(),guests:z.number().int().positive(),ratePlanId:z.string(),totalMinor:z.number().int(),currency:z.string().length(3)});z.object({quoteRef:z.string().min(1).max(4096),ratePlanId:z.string().min(1).max(200).optional(),attribution:z.custom().optional(),extras:checkoutExtrasInputSchema.optional(),hostSessionId:z.uuid().optional()});var checkoutSessionSchema=z.object({id:z.uuid(),status:bookingRequestStatusResponseSchema,quote:checkoutSessionQuoteSchema,mount:checkoutMountDescriptorSchema.nullable(),chargedBy:chargedByHost.optional(),guestSaved:z.literal(true).optional(),extras:checkoutSessionExtrasSchema.optional(),extrasSessionId:z.uuid().optional(),expiresAt:z.iso.datetime()});var storefrontGuestInputSchema=z.object({firstName:z.string().trim().min(1,"validation.first_name_required").max(100),lastName:z.string().trim().min(1,"validation.last_name_required").max(100),email:requiredTrimmedEmailField,phone:z.string().trim().min(1,"validation.phone_required").max(40)});var storefrontConsentsSchema=z.object({emailMarketing:z.boolean().default(false),smsMarketing:z.boolean().default(false)}).default({emailMarketing:false,smsMarketing:false});var confirmCheckoutSessionInputSchema=z.object({quoteRef:z.string().min(1).max(4096),guest:storefrontGuestInputSchema,consents:storefrontConsentsSchema,paymentMethodId:z.string().min(1).max(255).optional(),language:z.string().max(35).optional().catch(void 0)});confirmCheckoutSessionInputSchema.pick({quoteRef:true,guest:true,consents:true,language:true});z.object({saved:z.boolean()});var bookingResultSchema=z.object({bookingRequestId:z.uuid(),confirmationToken:z.string(),status:bookingRequestStatusResponseSchema,confirmationCode:z.string().nullable()});var storefrontBookingSchema=z.object({id:z.uuid(),status:bookingRequestStatusResponseSchema,propertyId:z.uuid().nullable(),checkIn:z.iso.date().nullable(),checkOut:z.iso.date().nullable(),guestCount:z.number().int().nullable(),guestFirstName:z.string().nullable(),totalMinor:z.number().int().nullable(),currency:z.string().nullable(),confirmationCode:z.string().nullable(),lines:z.array(z.object({title:z.string(),quantity:z.number().int(),totalMinor:z.number().int()})).optional()});z.enum(STOREFRONT_KEY_ENVIRONMENTS);var STOREFRONT_KEY_RE=new RegExp(`^pk_(${STOREFRONT_KEY_ENVIRONMENTS.join("|")})_(${REGIONS.join("|")})_[0-9A-Za-z]{24}$`);function parseStorefrontKey(token){const match=STOREFRONT_KEY_RE.exec(token);if(!match)return null;return {environment:match[1],region:match[2]}}var ORIGIN_HOST_RE=/^(?:[a-z0-9-]+\.)*[a-z0-9-]+$|^\[[0-9a-f:.]+\]$/;function parseUrl(value){try{return new URL(value)}catch{return null}}z.string().refine(value=>{const url=parseUrl(value);if(!url)return false;return (url.protocol==="https:"||url.protocol==="http:")&&url.origin===value&&ORIGIN_HOST_RE.test(url.hostname)},"validation.storefront.origin_invalid");var CLIENT_CONVERSION_EVENT_NAMES=["begin_checkout","generate_lead","sign_up"];var STOREFRONT_EVENT_PATH_MAX=512;var base={eventId:z.uuid(),ts:z.number().int(),path:z.string().max(STOREFRONT_EVENT_PATH_MAX),referrerHost:z.string().max(253).nullable()};var currency2=z.string().length(3).regex(/^[a-z]{3}$/);var storefrontClientEventSchema=z.discriminatedUnion("name",[z.object({...base,name:z.literal("page_view")}),z.object({...base,name:z.literal("view_search_results"),checkIn:storefrontDateSchema.optional(),checkOut:storefrontDateSchema.optional(),guests:z.number().int().min(1).max(50).optional(),locationId:z.uuid().optional()}),z.object({...base,name:z.literal("view_item_list"),listName:z.string().max(64),itemCount:z.number().int().min(0).max(500)}),z.object({...base,name:z.literal("view_item"),listingId:z.uuid()}),z.object({...base,name:z.literal("view_quote"),listingId:z.uuid(),valueMinor:z.number().int().nonnegative(),currency:currency2,nights:z.number().int().min(1).max(365)}),z.object({...base,name:z.literal("begin_checkout"),checkoutSessionId:z.uuid()}),z.object({...base,name:z.literal("add_payment_info"),checkoutSessionId:z.uuid()}),z.object({...base,name:z.literal("generate_lead"),formId:z.string().max(64).optional()}),z.object({...base,name:z.literal("sign_up"),method:z.literal("newsletter")})]);var STOREFRONT_EVENT_BATCH_MAX=20;z.object({events:z.array(storefrontClientEventSchema).min(1).max(STOREFRONT_EVENT_BATCH_MAX)});z.object({events:z.array(z.object({eventId:z.uuid(),name:z.enum(CLIENT_CONVERSION_EVENT_NAMES),occurredAt:z.iso.datetime(),pageUrl:z.url({protocol:/^https?$/}).max(2048),checkoutSessionId:z.uuid().nullable(),userAgent:z.string().max(512).nullable(),attribution:storefrontAttributionInputSchema.nullable()})).min(1).max(STOREFRONT_EVENT_BATCH_MAX)});var EXPERIMENT_COOKIE="__so_exp";var COOKIE_RE=/(?:^|;\s*)__so_exp=([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.(a|b)(?:\s*;|\s*$)/;function readExperimentCookie(cookies){const match=COOKIE_RE.exec(cookies??"");return match?{id:match[1],variant:match[2]}:null}var ATTRIBUTION_COOKIE="so_attr";var ATTRIBUTION_COOKIE_MAX_AGE_SECONDS=90*24*60*60;var COOKIE_SCOPE="Path=/; SameSite=Lax; Secure";var ATTRIBUTION_COOKIE_ATTRIBUTES=`Max-Age=${ATTRIBUTION_COOKIE_MAX_AGE_SECONDS}; ${COOKIE_SCOPE}`;var ATTRIBUTION_COOKIE_MAX_BYTES=3584;var attributionCookieSchema=z.object({first:attributionTouchSchema.nullable(),last:attributionTouchSchema.nullable()});function toBase64Url(text){let binary="";for(const byte of new TextEncoder().encode(text))binary+=String.fromCharCode(byte);return btoa(binary).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function fromBase64Url(value){const binary=atob(value.replace(/-/g,"+").replace(/_/g,"/"));return new TextDecoder().decode(Uint8Array.from(binary,ch=>ch.charCodeAt(0)))}function encodeAttributionCookie(value){const encoded=toBase64Url(JSON.stringify(value));return encoded.length>ATTRIBUTION_COOKIE_MAX_BYTES?null:encoded}function serializeAttributionCookie(value){const encoded=encodeAttributionCookie(value);return encoded===null?null:`${ATTRIBUTION_COOKIE}=${encoded}; ${ATTRIBUTION_COOKIE_ATTRIBUTES}`}function decodeAttributionCookie(value){if(!value)return null;return attributionCookieSchema.parse(JSON.parse(fromBase64Url(value)))}function expiredAttributionCookies(cookies,consent){const revoked=[...consent.analytics?[]:[ATTRIBUTION_COOKIE,EXPERIMENT_COOKIE],...consent.ads?[]:["_fbc","_fbp"]];return revoked.filter(name=>readCookie(cookies,name)!==null).map(name=>`${name}=; Max-Age=0; ${COOKIE_SCOPE}`)}function strippedAttributionCookie(held){const clicked=t=>t!==null&&[t.gclid,t.gbraid,t.wbraid,t.fbclid,t.msclkid].some(id=>id!==null);if(!held||!(clicked(held.first)||clicked(held.last)))return null;return serializeAttributionCookie({first:held.first&&withoutClickIds(held.first),last:held.last&&withoutClickIds(held.last)})??`${ATTRIBUTION_COOKIE}=; Max-Age=0; ${COOKIE_SCOPE}`}function readCookie(header,name){if(!header)return null;for(const part of header.split(";")){const eq=part.indexOf("=");if(eq!==-1&&part.slice(0,eq).trim()===name)return part.slice(eq+1).trim()}return null}var MalformedCookieError=class extends Error{constructor(name){super(`${name} is malformed`);this.name="MalformedAttributionError";}};var NO_IDS={gaClientId:null,gaSessionId:null,fbp:null,fbc:null};function matchCookie(cookies,name,re,report){const value=name?readCookie(cookies,name):null;if(!value)return null;const match=re.exec(value);if(!match){report(new MalformedCookieError(name),name);return null}return match.slice(1).filter(Boolean).join(".")}function browserIdsFromCookies(cookies,consent,report){const sessionCookie=cookies.split(";").map(part=>part.split("=")[0].trim()).find(name=>name.startsWith("_ga_"))??null;const ga=consent.analytics;const ads=consent.ads;const ids={gaClientId:ga?matchCookie(cookies,"_ga",/^GA\d\.\d+\.(\d+)\.(\d+)$/,report):null,gaSessionId:ga?matchCookie(cookies,sessionCookie,/^(?:GS1\.\d+\.(\d+)\.|GS2\.\d+\.s(\d+)(?:\$|$))/,report):null,fbp:ads?matchCookie(cookies,"_fbp",/^(fb\.\d\.\d+\.\d+)$/,report):null,fbc:ads?matchCookie(cookies,"_fbc",/^(fb\.\d\.\d+\.[\w-]+)$/,report):null};const parsed=attributionIdsSchema.safeParse(ids);if(parsed.success)return parsed.data;report(parsed.error,"ids");return NO_IDS}var isDirect=touch=>classifyChannel({...touch,siteHost:globalThis.location?.hostname??""}).channel==="direct";var TOUCH_ELEMENT_ID="__suiteop_touch";var CONSENT_EVENT="suiteop:consent";var DENIED={analytics:false,ads:false,source:"default",region:"restricted",decidedAt:null};var defaultReport=(err,where)=>{console.warn(`[suiteop] ignored malformed attribution input (${where})`,err);};function pageConsent(){const read=globalThis.__suiteop?.consent?.get;const parsed=consentStateSchema.safeParse(typeof read==="function"?read():null);return parsed.success?parsed.data:DENIED}function pageTouch(report){const text=document.getElementById(TOUCH_ELEMENT_ID)?.textContent;if(!text)return null;try{return attributionTouchSchema.parse(JSON.parse(text))}catch(err){report(err,TOUCH_ELEMENT_ID);return null}}function storedCookie(cookies,report){try{return decodeAttributionCookie(readCookie(cookies,ATTRIBUTION_COOKIE))}catch(err){report(err,ATTRIBUTION_COOKIE);return null}}function getAttribution(opts={}){if(typeof document==="undefined")return null;const report=opts.report??defaultReport;const cookies=document.cookie;const consent=pageConsent();const stored=consent.analytics?storedCookie(cookies,report):null;const touch=pageTouch(report);const pageIsLast=touch!==null&&!(stored?.last&&(isDirect(touch)||Date.parse(stored.last.ts)>Date.parse(touch.ts)));const experiment=consent.analytics?readExperimentCookie(cookies):null;return {first:stored?.first??touch,last:pageIsLast?touch:stored?.last??null,ids:browserIdsFromCookies(cookies,consent,report),consent,...experiment?{experiment}:{}}}function watchAttributionConsent(opts={}){if(typeof window==="undefined")return ()=>{};const report=opts.report??defaultReport;const persist=consent=>{if(readCookie(document.cookie,ATTRIBUTION_COOKIE))return;const touch=pageTouch(report);if(!touch)return;const kept=consent.ads?touch:withoutClickIds(touch);const cookie=serializeAttributionCookie({first:kept,last:kept});if(cookie)document.cookie=cookie;};const withdraw=consent=>{for(const cookie of expiredAttributionCookies(document.cookie,consent)){document.cookie=cookie;}if(consent.analytics&&!consent.ads){const stripped=strippedAttributionCookie(storedCookie(document.cookie,report));if(stripped)document.cookie=stripped;}};const initial=pageConsent();let analytics=initial.analytics;if(initial.source==="user")withdraw(initial);if(analytics)persist(initial);const onConsent=event=>{const next=consentStateSchema.safeParse(event.detail);if(!next.success)return;const granted=!analytics&&next.data.analytics;analytics=next.data.analytics;withdraw(next.data);if(granted)persist(next.data);};window.addEventListener(CONSENT_EVENT,onConsent);return ()=>window.removeEventListener(CONSENT_EVENT,onConsent)}var EVENTS_ENDPOINT="/_suiteop/events";var FLUSH_INTERVAL_MS=2e3;var FLUSH_AT_EVENTS=10;var defaultReport2=err=>{console.warn("[suiteop] storefront events could not be sent",err);};function hostOf2(url){try{return new URL(url).hostname||null}catch{return null}}var META_EVENTS={begin_checkout:"InitiateCheckout",generate_lead:"Lead",sign_up:"CompleteRegistration",view_item:"ViewContent",view_search_results:"Search",add_payment_info:"AddPaymentInfo"};var GTAG_SKIP=new Set(["page_view","purchase"]);function mirrorToTags(event){const w=window;if(typeof w.gtag!=="function"&&typeof w.fbq!=="function")return;const consent=pageConsent();const{name,eventId,ts:_ts,path:_path,referrerHost:_ref,...params}=event;if(consent.analytics&&typeof w.gtag==="function"&&!GTAG_SKIP.has(name)){w.gtag("event",name,params);}const metaName=META_EVENTS[name];if(consent.ads&&typeof w.fbq==="function"&&metaName){w.fbq("track",metaName,{},{eventID:eventId});}}function trackPurchasePixel(booking){if(typeof window==="undefined")return;const fbq=window.fbq;if(typeof fbq!=="function"||!pageConsent().ads)return;const amount=typeof booking.totalMinor==="number"&&booking.currency?{value:booking.totalMinor/100,currency:booking.currency.toUpperCase()}:{};fbq("track","Purchase",amount,{eventID:booking.bookingRequestId});}var NOOP={track(){},pageView(){},flush(){},dispose(){}};function createAnalytics(opts){if(typeof window==="undefined")return NOOP;const report=opts.report??defaultReport2;const url=`${EVENTS_ENDPOINT}?key=${encodeURIComponent(opts.publishableKey)}`;let queue=[];let timer=null;let landing=true;let lastViewedHref=null;let disabled=false;let reported=false;const fail=err=>{if(reported)return;reported=true;report(err);};const send=(events,beacon)=>{const body=JSON.stringify({events});if(beacon&&typeof navigator.sendBeacon==="function"&&navigator.sendBeacon(url,body)){return}fetch(url,{method:"POST",body,keepalive:true,credentials:"same-origin",headers:{"content-type":"application/json"}}).then(response=>{if(response.status===404)disabled=true;else if(!response.ok)fail(new Error(`storefront events answered ${response.status}`));}).catch(fail);};const flush=({beacon=false}={})=>{if(timer)clearTimeout(timer);timer=null;if(disabled||queue.length===0)return;const pending=queue;queue=[];for(let i=0;i<pending.length;i+=STOREFRONT_EVENT_BATCH_MAX){send(pending.slice(i,i+STOREFRONT_EVENT_BATCH_MAX),beacon);}};const enqueue=(event,referrerHost)=>{const full={...event,eventId:crypto.randomUUID(),ts:Date.now(),path:location.pathname.slice(0,STOREFRONT_EVENT_PATH_MAX),referrerHost};try{mirrorToTags(full);}catch(err){fail(err);}if(disabled)return;queue.push(full);if(queue.length>=FLUSH_AT_EVENTS)flush();else timer??=setTimeout(()=>flush(),FLUSH_INTERVAL_MS);};const pageView=()=>{if(location.href===lastViewedHref)return;lastViewedHref=location.href;const referrerHost=landing?hostOf2(document.referrer):location.hostname;landing=false;enqueue({name:"page_view"},referrerHost);};const onPageHide=()=>flush({beacon:true});const onPageShow=event=>{if(!event.persisted)return;lastViewedHref=null;pageView();};window.addEventListener("pagehide",onPageHide);window.addEventListener("pageshow",onPageShow);return {track:event=>enqueue(event,location.hostname),pageView,flush,dispose:()=>{flush({beacon:true});window.removeEventListener("pagehide",onPageHide);window.removeEventListener("pageshow",onPageShow);}}}var shared=new Map;function analyticsFor(publishableKey){let instance=shared.get(publishableKey);if(!instance){instance=createAnalytics({publishableKey});if(instance!==NOOP)shared.set(publishableKey,instance);}return instance}function parsePublishableKey(key){if(typeof key==="string"&&key.trim().startsWith("sk_")){throw new StorefrontConfigError("A SuiteOp secret key (sk_\u2026) was passed as the publishable key. Secret keys must never be used in a browser or shipped in site code \u2014 revoke it now, then use a publishable key (pk_live_\u2026 / pk_test_\u2026) from the site settings.")}const parsed=typeof key==="string"?parseStorefrontKey(key.trim()):null;if(!parsed){throw new StorefrontConfigError("Invalid SuiteOp publishable key: expected pk_{live|test}_{us|eu|apac}_ followed by 24 letters or digits.")}return parsed}function defaultApiOrigin({environment,region}){return environment==="live"?`https://api-${region}.suiteop.com`:`https://api-${region}-staging.suiteop.com`}var SDK_VERSION="0.2.0";var STOREFRONT_API_VERSION="2026-09-27";var GET_RETRY_JITTER_MS=300;function buildUrl(base2,spec){const params=new URLSearchParams;for(const[key,value]of Object.entries(spec.query??{})){if(value!==void 0&&value!==null)params.set(key,String(value));}const search=params.toString();return `${base2}${spec.path}${search?`?${search}`:""}`}function sleep(ms,signal){return new Promise((resolve,reject)=>{if(signal?.aborted)return reject(signal.reason);const onAbort=()=>{clearTimeout(timer);reject(signal?.reason);};const timer=setTimeout(()=>{signal?.removeEventListener("abort",onAbort);resolve();},ms);signal?.addEventListener("abort",onAbort,{once:true});})}function parseJson(text){if(!text)return void 0;try{return JSON.parse(text)}catch{return void 0}}function isRetryable(err){return err instanceof StorefrontNetworkError||err instanceof StorefrontError&&err.status>=500}function createTransport(opts){async function attempt(spec){const controller=new AbortController;let timedOut=false;const timer=setTimeout(()=>{timedOut=true;controller.abort(new DOMException("The request timed out","TimeoutError"));},spec.timeoutMs);const onCallerAbort=()=>controller.abort(spec.signal?.reason);if(spec.signal?.aborted)onCallerAbort();else spec.signal?.addEventListener("abort",onCallerAbort,{once:true});try{let response;let text;try{response=await opts.fetch(buildUrl(opts.baseUrl(),spec),{method:spec.method,headers:{...opts.headers,...spec.body===void 0?{}:{"Content-Type":"application/json"},...spec.headers},body:spec.body===void 0?void 0:JSON.stringify(spec.body),signal:controller.signal});text=await response.text();}catch(err){if(spec.signal?.aborted)throw spec.signal.reason;if(timedOut)throw new StorefrontTimeoutError(spec.timeoutMs);throw new StorefrontNetworkError(err)}const body=parseJson(text);if(!response.ok)throw errorFromResponse(response,body);const envelope=body;const meta=envelope?.meta??{};const requestId=typeof meta["requestId"]==="string"?meta["requestId"]:response.headers.get("x-request-id");if(!envelope||typeof envelope!=="object"||!("data"in envelope)){throw new StorefrontError({status:response.status,code:"invalid_response",message:"The Storefront API answered without a data envelope",requestId})}return {status:response.status,requestId,data:envelope.data,meta}}finally{clearTimeout(timer);spec.signal?.removeEventListener("abort",onCallerAbort);}}return {async send(spec){try{return await attempt(spec)}catch(err){if(spec.method!=="GET"||!isRetryable(err))throw err;await sleep(Math.random()*GET_RETRY_JITTER_MS,spec.signal);return attempt(spec)}}}}var STOREFRONT_API_PATH="/api/storefront/v1";var READ_TIMEOUT_MS=1e4;var WRITE_TIMEOUT_MS=2e4;function resolveBaseUrl(baseUrl,origin){if(baseUrl===void 0)return `${origin}${STOREFRONT_API_PATH}`;if(baseUrl==="same-origin"){const pageOrigin=globalThis.location?.origin;if(!pageOrigin||pageOrigin==="null"){throw new StorefrontConfigError("baseUrl 'same-origin' needs a page origin; pass an explicit baseUrl outside a browser.")}return `${pageOrigin}${STOREFRONT_API_PATH}`}let url;try{url=new URL(baseUrl);}catch{throw new StorefrontConfigError(`baseUrl must be an absolute URL or 'same-origin'.`)}const path=url.pathname.replace(/\/+$/,"");return `${url.origin}${path.endsWith(STOREFRONT_API_PATH)?path:`${path}${STOREFRONT_API_PATH}`}`}function uuidV4(){const c=globalThis.crypto;if(typeof c.randomUUID==="function")return c.randomUUID();const b=c.getRandomValues(new Uint8Array(16));b[6]=b[6]&15|64;b[8]=b[8]&63|128;const hex=Array.from(b,x=>x.toString(16).padStart(2,"0")).join("");return `${hex.slice(0,8)}-${hex.slice(8,12)}-${hex.slice(12,16)}-${hex.slice(16,20)}-${hex.slice(20)}`}function validate(schema,value,res){const parsed=schema.safeParse(value);if(parsed.success)return parsed.data;throw new StorefrontError({status:res.status,code:"invalid_response",message:"The Storefront API answered a shape this SDK version does not understand",requestId:res.requestId,details:{issues:parsed.error.issues.map(i=>({path:i.path,code:i.code}))}})}var paginationSchema=z.object({total:z.number().int(),limit:z.number().int(),offset:z.number().int()});var seg=value=>encodeURIComponent(value);var SLUG_OR_ID=/^[a-z0-9-]{1,120}$/;var slotOf=(quoteRef,ratePlanId)=>`${quoteRef}\0${ratePlanId??""}`;var RELEASED_SESSION_STATUSES=new Set(["expired","cancelled"]);var KEY_BOUND_ELSEWHERE="idempotency_key_reused";function endsSession(err){return err.code==="session_expired"||err.details["requiresNewSession"]===true}var attributionWatched=false;function createStorefrontClient(options){const key=parsePublishableKey(options.publishableKey);const baseUrl=resolveBaseUrl(options.baseUrl,defaultApiOrigin(key));const transport=createTransport({baseUrl:()=>baseUrl,fetch:(input,init)=>(options.fetch??globalThis.fetch)(input,init),headers:{Authorization:`Bearer ${options.publishableKey.trim()}`,Accept:"application/json","X-SuiteOp-SDK":`storefront-js/${SDK_VERSION}`,"X-SuiteOp-Api-Version":STOREFRONT_API_VERSION,...options.locale?{"Accept-Language":options.locale}:{}}});const keySlots=new Map;const sessionSlots=new Map;const release=(slot,key2)=>{if(keySlots.get(slot)===key2)keySlots.delete(slot);};const releaseSession=id=>{const entry=sessionSlots.get(id);if(!entry)return;sessionSlots.delete(id);release(...entry);};if(!attributionWatched&&typeof window!=="undefined"){attributionWatched=true;watchAttributionConsent();}const readTimeoutMs=options.timeoutMs??READ_TIMEOUT_MS;const writeTimeoutMs=options.timeoutMs??WRITE_TIMEOUT_MS;async function get(schema,path,opts,query){const res=await transport.send({method:"GET",path,query,timeoutMs:readTimeoutMs,signal:opts?.signal});return validate(schema,res.data,res)}async function post(schema,path,body,opts,headers){const res=await transport.send({method:"POST",path,body,headers,timeoutMs:writeTimeoutMs,signal:opts?.signal});return validate(schema,res.data,res)}return {publishableKey:options.publishableKey.trim(),baseUrl,site:{get:opts=>get(storefrontSiteSchema,"/site",opts)},listings:{async list(query,opts){const res=await transport.send({method:"GET",path:"/listings",query:{location:query?.location,building:query?.building,limit:query?.limit,offset:query?.offset},timeoutMs:readTimeoutMs,signal:opts?.signal});const items=validate(z.array(storefrontListingSummarySchema),res.data,res);const pagination=validate(paginationSchema,res.meta["pagination"],res);return {items,...pagination}},get:(id,opts)=>get(storefrontListingSchema,`/listings/${seg(id)}`,opts)},buildings:{list:opts=>get(z.array(storefrontBuildingSchema),"/buildings",opts),get:(id,opts)=>get(storefrontBuildingSchema,`/buildings/${seg(id)}`,opts)},locations:{list:opts=>get(z.array(storefrontLocationSchema),"/locations",opts)},contentModel:{get:opts=>get(storefrontContentModelSchema,"/content-model",opts)},collections:{async list(key2,query,opts){const res=await transport.send({method:"GET",path:`/collections/${seg(key2)}/items`,query:{limit:query?.limit,offset:query?.offset},timeoutMs:readTimeoutMs,signal:opts?.signal});const items=validate(z.array(storefrontContentItemSchema),res.data,res);const pagination=validate(paginationSchema,res.meta["pagination"],res);return {items,...pagination}},async get(key2,slugOrId,opts){if(!SLUG_OR_ID.test(slugOrId))return null;try{return await get(storefrontContentItemSchema,`/collections/${seg(key2)}/items/${seg(slugOrId)}`,opts)}catch(err){if(err instanceof StorefrontError&&err.status===404)return null;throw err}}},sections:{get:(key2,opts)=>get(storefrontContentItemSchema,`/sections/${seg(key2)}`,opts)},amenities:{list:opts=>get(z.array(z.string()),"/amenities",opts)},reviews:{list:(query,opts)=>get(z.array(storefrontReviewSchema),"/reviews",opts,{listingId:query?.listingId,limit:query?.limit,offset:query?.offset})},availability:{get:(listingId,stay,opts)=>get(storefrontAvailabilitySchema,`/listings/${seg(listingId)}/availability`,opts,{checkIn:stay.checkIn,checkOut:stay.checkOut,guests:stay.guests})},calendar:{get:(listingId,range,opts)=>get(storefrontCalendarSchema,`/listings/${seg(listingId)}/calendar`,opts,{from:range.from,to:range.to})},quotes:{create:(input,opts)=>post(storefrontQuoteSchema,"/quotes",input,opts)},checkoutSessions:{async create(input,opts){const slot=slotOf(input.quoteRef,input.ratePlanId);const idempotencyKey=opts?.idempotencyKey??keySlots.get(slot)??uuidV4();keySlots.set(slot,idempotencyKey);const attribution=input.attribution===void 0?getAttribution():input.attribution;const body=attribution?{...input,attribution}:input;try{const created=await post(checkoutSessionSchema,"/checkout-sessions",body,opts,{"Idempotency-Key":idempotencyKey});if(RELEASED_SESSION_STATUSES.has(created.status))release(slot,idempotencyKey);else sessionSlots.set(created.id,[slot,idempotencyKey]);return {...created,idempotencyKey}}catch(err){if(err instanceof StorefrontError){err.details["idempotencyKey"]=idempotencyKey;if(err.code===KEY_BOUND_ELSEWHERE)release(slot,idempotencyKey);}throw err}},get:(id,opts)=>get(checkoutSessionSchema,`/checkout-sessions/${seg(id)}`,opts),async confirm(id,input,opts){try{const result=await post(bookingResultSchema,`/checkout-sessions/${seg(id)}/confirm`,input,opts);return result}catch(err){if(err instanceof StorefrontError&&endsSession(err)){releaseSession(id);}throw err}},forget(quoteRef,ratePlanId){keySlots.delete(slotOf(quoteRef,ratePlanId));}},bookings:{get:(token,opts)=>get(storefrontBookingSchema,`/bookings/${seg(token)}`,opts)},contact:{async create(input,opts){await post(storefrontContactResultSchema,"/contact",input,opts);}}}}
8
+
9
+ export { SDK_VERSION, STOREFRONT_API_PATH, STOREFRONT_API_VERSION, analyticsFor, createAnalytics, createStorefrontClient, getAttribution, parsePublishableKey, trackPurchasePixel };
@@ -1,4 +1,4 @@
1
- import { StorefrontError } from './chunk-UACP7BZ7.js';
1
+ import { StorefrontError } from './chunk-ZI2PG7LS.js';
2
2
  import { z } from 'zod';
3
3
 
4
4
  var TAG="suiteop-checkout";var manifestSchema=z.object({v1:z.object({path:z.string().regex(/^\/checkout\/v1\.[0-9a-f]{12}\.js$/),integrity:z.string().regex(/^sha384-[A-Za-z0-9+/]+={0,2}$/)})});var loads=new Map;var requested=new Map;function scriptUrl(url){const n=requested.get(url)??0;requested.set(url,n+1);return n===0?url:`${url}?retry=${n}`}function unavailable(message,cause){return new StorefrontError({status:0,code:"checkout_unavailable",message,cause})}async function fetchEntry(origin,fresh){const res=await fetch(`${origin}/checkout/manifest.json`,{cache:fresh?"no-store":"default",credentials:"omit"});if(!res.ok)throw unavailable(`The checkout manifest answered ${res.status}`);const parsed=manifestSchema.safeParse(await res.json());if(!parsed.success)throw unavailable("The checkout manifest has no usable v1 entry");return parsed.data.v1}function inject(src,integrity){const script=document.createElement("script");script.type="module";script.src=src;script.integrity=integrity;script.crossOrigin="anonymous";const ready=new Promise((resolve,reject)=>{script.addEventListener("error",()=>reject(unavailable(`${src} failed to load`)),{once:true});script.addEventListener("load",()=>customElements.get(TAG)?resolve():reject(unavailable(`${src} defined no <${TAG}>`)),{once:true});void customElements.whenDefined(TAG).then(()=>resolve());});document.head.append(script);return [script,ready]}async function load(origin){if(customElements.get(TAG))return;for(const fresh of [false,true]){try{const entry=await fetchEntry(origin,fresh);const[script,ready]=inject(scriptUrl(`${origin}${entry.path}`),entry.integrity);try{return await ready}catch(err){script.remove();if(fresh)throw err}}catch(err){if(err instanceof StorefrontError)throw err;throw unavailable("The checkout bundle could not be loaded",err)}}}function loadCheckout(options={}){if(typeof window==="undefined"||typeof document==="undefined")return Promise.resolve();let origin;try{origin=new URL(options.origin??window.location.origin).origin;}catch(err){return Promise.reject(unavailable("loadCheckout: origin must be an absolute URL",err))}const key=`${origin}|v${options.major??1}`;const existing=loads.get(key);if(existing)return existing;const loading=load(origin);loads.set(key,loading);loading.catch(()=>{if(loads.get(key)===loading)loads.delete(key);});return loading}
@@ -0,0 +1,8 @@
1
+ import { storefrontContentRefSchema, storefrontImageSchema } from './chunk-GJSCEBSU.js';
2
+ import { StorefrontError } from './chunk-ZI2PG7LS.js';
3
+ import { z } from 'zod';
4
+
5
+ var CONTENT_FIELD_TYPES=["text","rich_text","image","gallery","number","boolean","date","option","link","reference","references"];var CONTENT_TYPE_KINDS=["collection","section","fields"];var CONTENT_SUBJECT_KINDS=["building","area"];var CONTENT_REFERENCE_KINDS=["listing","building","area"];var MAX_CONTENT_TYPES=40;var MAX_CONTENT_FIELDS=40;var contentKeySchema=z.string().regex(/^[a-z][a-z0-9_]{0,39}$/,"validation.invalid_format");var contentLocalizedSchema=z.union([z.string().min(1).max(120),z.record(z.string().min(2).max(35),z.string().min(1).max(120))]);var COLLECTION_TARGET=/^collection:[a-z][a-z0-9_]{0,39}$/;var contentReferenceTargetSchema=z.union([z.enum(CONTENT_REFERENCE_KINDS),z.string().regex(COLLECTION_TARGET,"validation.invalid_format")]);var TEXT_TYPES=new Set(["text","rich_text"]);var LIST_TYPES=new Set(["gallery","references"]);var REFERENCE_TYPES=new Set(["reference","references"]);var contentFieldSchema=z.object({key:contentKeySchema,type:z.enum(CONTENT_FIELD_TYPES),label:contentLocalizedSchema,help:contentLocalizedSchema.optional(),required:z.boolean().default(false),translatable:z.boolean().optional(),maxLength:z.number().int().min(1).max(6e4).optional(),options:z.array(z.object({value:contentKeySchema,label:contentLocalizedSchema})).min(1).max(50).optional(),to:contentReferenceTargetSchema.optional(),max:z.number().int().min(1).max(100).optional(),removed:z.boolean().optional()}).superRefine((field2,ctx)=>{if(field2.type==="option"&&!field2.options?.length){ctx.addIssue({code:"custom",path:["options"],message:"validation.required"});}if(field2.options&&new Set(field2.options.map(o=>o.value)).size!==field2.options.length){ctx.addIssue({code:"custom",path:["options"],message:"validation.invalid"});}if(REFERENCE_TYPES.has(field2.type)&&!field2.to){ctx.addIssue({code:"custom",path:["to"],message:"validation.required"});}if(field2.maxLength!==void 0&&!TEXT_TYPES.has(field2.type)){ctx.addIssue({code:"custom",path:["maxLength"],message:"validation.invalid"});}if(field2.max!==void 0&&!LIST_TYPES.has(field2.type)){ctx.addIssue({code:"custom",path:["max"],message:"validation.invalid"});}});var contentTypeSchema=z.object({key:contentKeySchema,kind:z.enum(CONTENT_TYPE_KINDS),label:contentLocalizedSchema,description:contentLocalizedSchema.optional(),attachesTo:z.enum(CONTENT_SUBJECT_KINDS).optional(),titleField:contentKeySchema.optional(),routable:z.boolean().default(false),drafts:z.boolean().default(false),order:z.enum(["manual","newest"]).default("manual"),fields:z.array(contentFieldSchema).min(1).max(MAX_CONTENT_FIELDS)}).superRefine((type,ctx)=>{const keys=type.fields.map(f=>f.key);keys.forEach((key,i)=>{if(keys.indexOf(key)!==i){ctx.addIssue({code:"custom",path:["fields",i,"key"],message:"validation.invalid"});}});if(type.kind==="fields"!==(type.attachesTo!==void 0)){ctx.addIssue({code:"custom",path:["attachesTo"],message:"validation.invalid"});}if(type.kind==="collection"){const title=type.fields.find(f=>f.key===type.titleField);if(!title||title.type!=="text"){ctx.addIssue({code:"custom",path:["titleField"],message:"validation.invalid"});}}else if(type.titleField!==void 0){ctx.addIssue({code:"custom",path:["titleField"],message:"validation.invalid"});}});var contentModelSchema=z.object({version:z.literal(1),types:z.array(contentTypeSchema).max(MAX_CONTENT_TYPES)}).superRefine((model,ctx)=>{const keys=model.types.map(t=>t.key);const collections=new Set(model.types.filter(t=>t.kind==="collection").map(t=>t.key));model.types.forEach((type,i)=>{if(keys.indexOf(type.key)!==i){ctx.addIssue({code:"custom",path:["types",i,"key"],message:"validation.invalid"});}type.fields.forEach((field2,j)=>{const target=field2.to?.startsWith("collection:")?field2.to.slice(11):null;if(target!==null&&!collections.has(target)){ctx.addIssue({code:"custom",path:["types",i,"fields",j,"to"],message:"validation.invalid"});}});});});function defineContent(definition){return definition}var field={text:o=>({...o,type:"text"}),richText:o=>({...o,type:"rich_text"}),image:o=>({...o,type:"image"}),gallery:o=>({...o,type:"gallery"}),number:o=>({...o,type:"number"}),boolean:o=>({...o,type:"boolean"}),date:o=>({...o,type:"date"}),option:o=>({...o,type:"option"}),link:o=>({...o,type:"link"}),reference:o=>({...o,type:"reference"}),references:o=>({...o,type:"references"})};var optionOf=choice=>typeof choice==="string"?{value:choice,label:choice}:choice;function toContentModel(definition){return {version:1,types:Object.entries(definition).map(([key,type])=>({...type,key,fields:Object.entries(type.fields).map(([fieldKey,f])=>f.type==="option"?{...f,key:fieldKey,options:f.options.map(optionOf)}:{...f,key:fieldKey})}))}}function parseContentModel(definition){const parsed=contentModelSchema.safeParse(toContentModel(definition));if(parsed.success)return parsed.data;const problems=parsed.error.issues.map(i=>`${i.path.join(".")}: ${i.message}`);throw new Error(`Invalid SuiteOp content model:
6
+ ${problems.join("\n ")}`)}var DAY=/^\d{4}-\d{2}-\d{2}$/;var linkSchema=z.object({url:z.string(),label:z.string().optional()});function valueSchema(f){switch(f.type){case "text":case "rich_text":return z.string();case "date":return z.string().regex(DAY);case "image":return z.union([storefrontImageSchema,z.array(storefrontImageSchema).min(1).transform(photos=>photos[0])]);case "gallery":return z.array(storefrontImageSchema);case "number":return z.number();case "boolean":return z.boolean();case "option":{const values=new Set(f.options.map(o=>optionOf(o).value));return z.string().refine(v=>values.has(v))}case "link":return linkSchema;case "reference":return storefrontContentRefSchema;case "references":return z.array(storefrontContentRefSchema)}}var isList=f=>f.type==="gallery"||f.type==="references";function readFields(type,values){const out={};for(const[key,f]of Object.entries(type.fields)){const raw=values?.[key];const parsed=raw===void 0||raw===null?null:valueSchema(f).safeParse(raw);out[key]=parsed?.success?parsed.data:isList(f)?[]:null;}return out}function toItem(type,item){return {id:item.id,slug:item.slug,publishedAt:item.publishedAt,updatedAt:item.updatedAt,sortOrder:item.sortOrder,fields:readFields(type,item.fields)}}async function orEmpty(read,empty){try{return await read}catch(err){if(err instanceof StorefrontError&&err.status===404)return empty();throw err}}function createContentReader(client,definition){return {collection:key=>({async list(query,opts){const page=await orEmpty(client.collections.list(key,query,opts),()=>({items:[],total:0,limit:query?.limit??20,offset:query?.offset??0}));return {...page,items:page.items.map(item=>toItem(definition[key],item))}},async get(slugOrId,opts){const item=await client.collections.get(key,slugOrId,opts);return item?toItem(definition[key],item):null}}),section:key=>({get:async opts=>toItem(definition[key],await orEmpty(client.sections.get(key,opts),()=>({id:"",type:key,slug:null,publishedAt:null,updatedAt:new Date(0).toISOString(),sortOrder:0,fields:{}})))}),fieldsOf:(key,record)=>readFields(definition[key],record.fields?.[key])}}
7
+
8
+ export { contentModelSchema, createContentReader, defineContent, field, parseContentModel, readFields, toContentModel };
@@ -0,0 +1,3 @@
1
+ var REGIONS=["us","eu","apac"];var BE_BOOKING_REQUEST_STATUSES=["inquiry","processing","confirmed","failed","expired","pending_pms_sync","pending_payment","authorized","reserved","cancelled"];var STOREFRONT_KEY_ENVIRONMENTS=["live","test"];var GOOGLE_FONTS=["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"];var STOREFRONT_FONTS=[...GOOGLE_FONTS,"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"];var STOREFRONT_FONT_FAMILIES={inter:"Inter",montserrat:"Montserrat",poppins:"Poppins",raleway:"Raleway",nunito:"Nunito",work_sans:"Work Sans",mulish:"Mulish",barlow:"Barlow",jost:"Jost",bitter:"Bitter",archivo:"Archivo",public_sans:"Public Sans",gantari:"Gantari",anybody:"Anybody",lato:"Lato",playfair_display:"Playfair Display",karla:"Karla",reddit_sans:"Reddit Sans",overpass:"Overpass",roboto:"Roboto",open_sans:"Open Sans",merriweather:"Merriweather",outfit:"Outfit",fraunces:"Fraunces",dm_sans:"DM Sans",cormorant_garamond:"Cormorant Garamond",eb_garamond:"EB Garamond",lora:"Lora",crimson_pro:"Crimson Pro",source_serif_4:"Source Serif 4",ibm_plex_serif:"IBM Plex Serif",manrope:"Manrope",plus_jakarta_sans:"Plus Jakarta Sans",space_grotesk:"Space Grotesk",ibm_plex_sans:"IBM Plex Sans",libre_franklin:"Libre Franklin",josefin_sans:"Josefin Sans"};
2
+
3
+ export { BE_BOOKING_REQUEST_STATUSES, REGIONS, STOREFRONT_FONTS, STOREFRONT_FONT_FAMILIES, STOREFRONT_KEY_ENVIRONMENTS };
@@ -0,0 +1,17 @@
1
+ 'use strict';
2
+
3
+ var chunkLVFRVNT3_cjs = require('./chunk-LVFRVNT3.cjs');
4
+ var zod = require('zod');
5
+
6
+ var storefrontRatePlanQuoteSchema=zod.z.object({ratePlanId:zod.z.string(),name:zod.z.string(),accommodationMinor:zod.z.number().int(),feesMinor:zod.z.number().int(),taxesMinor:zod.z.number().int(),totalMinor:zod.z.number().int().positive(),currency:zod.z.string().regex(/^[a-z]{3}$/),cancellationPolicy:zod.z.string().nullable(),cancellationFee:zod.z.unknown().optional(),quoteRef:zod.z.string()});chunkLVFRVNT3_cjs.withStayRules(zod.z.object({listingId:zod.z.uuid({message:"validation.storefront.listing_invalid"}),checkIn:chunkLVFRVNT3_cjs.storefrontDateSchema,checkOut:chunkLVFRVNT3_cjs.storefrontDateSchema,guests:chunkLVFRVNT3_cjs.storefrontGuestsSchema}));var storefrontQuoteSchema=zod.z.object({quoteRef:zod.z.string(),propertyId:zod.z.uuid(),checkIn:chunkLVFRVNT3_cjs.storefrontDateSchema,checkOut:chunkLVFRVNT3_cjs.storefrontDateSchema,guests:zod.z.number().int().positive(),ratePlans:zod.z.array(storefrontRatePlanQuoteSchema).min(1),expiresAt:zod.z.iso.datetime()});var STOREFRONT_ERROR_CODES=["wrong_region","origin_not_allowed","origin_required","site_archived","not_bookable","quote_invalid","quote_expired","price_changed","currency_unsupported","payment_declined","session_expired","rate_limited","contact_not_configured","payment_account_unavailable","idempotency_key_required","idempotency_key_reused","payment_mode_unsupported","payment_not_authorized","payment_method_required","site_not_published","preview_read_only","bookings_closed","extras_invalid","UNAUTHORIZED","VALIDATION_ERROR","NOT_FOUND","site_not_found","upstream_timeout","timeout","network","invalid_response","internal_error","checkout_unavailable"];var StorefrontError=class extends Error{name="StorefrontError";status;type;code;requestId;details;constructor(init){super(init.message,init.cause===void 0?void 0:{cause:init.cause});this.status=init.status;this.code=init.code;this.type=init.type??init.code;this.requestId=init.requestId??null;this.details=init.details??{};}};var PriceChangedError=class extends StorefrontError{name="PriceChangedError";quote;requiresNewSession;constructor(init){super(init);const raw=this.details["quote"];const parsed=storefrontQuoteSchema.safeParse(raw);this.quote=parsed.success?parsed.data:null;this.requiresNewSession=this.details["requiresNewSession"]===true||raw!=null&&!parsed.success;}};var WrongRegionError=class extends StorefrontError{name="WrongRegionError";region;baseUrl;constructor(init){super(init);const{region,baseUrl}=this.details;this.region=region==="us"||region==="eu"||region==="apac"?region:null;this.baseUrl=typeof baseUrl==="string"?baseUrl:null;}};var RateLimitedError=class extends StorefrontError{name="RateLimitedError";retryAfterSec;scope;constructor(init){super(init);this.retryAfterSec=init.retryAfterSec;const{scope}=this.details;this.scope=scope==="key"||scope==="ip"||scope==="pms"?scope:null;}};var StorefrontTimeoutError=class extends StorefrontError{name="StorefrontTimeoutError";constructor(timeoutMs,requestId=null){super({status:0,code:"timeout",message:`No response within ${timeoutMs} ms`,requestId});}};var StorefrontNetworkError=class extends StorefrontError{name="StorefrontNetworkError";constructor(cause){super({status:0,code:"network",message:"The Storefront API could not be reached",cause});}};var StorefrontConfigError=class extends Error{name="StorefrontConfigError"};function isRecord(value){return typeof value==="object"&&value!==null&&!Array.isArray(value)}function parseRetryAfter(header){if(header===null)return null;const seconds=Number(header);if(Number.isFinite(seconds)&&seconds>=0)return Math.ceil(seconds);const at=Date.parse(header);return Number.isNaN(at)?null:Math.max(0,Math.ceil((at-Date.now())/1e3))}function errorFromResponse(response,body){const headerRequestId=response.headers.get("x-request-id");const wire=isRecord(body)&&isRecord(body["error"])?body["error"]:null;const meta=isRecord(body)&&isRecord(body["meta"])?body["meta"]:null;const requestId=typeof meta?.["requestId"]==="string"?meta["requestId"]:headerRequestId;if(!wire||typeof wire["code"]!=="string"){return new StorefrontError({status:response.status,code:"internal_error",message:`The Storefront API answered ${response.status}`,requestId})}const init={status:response.status,code:wire["code"],type:typeof wire["type"]==="string"?wire["type"]:wire["code"],message:typeof wire["message"]==="string"?wire["message"]:wire["code"],requestId,details:isRecord(wire["details"])?wire["details"]:{}};switch(init.code){case "price_changed":return new PriceChangedError(init);case "wrong_region":return new WrongRegionError(init);case "rate_limited":return new RateLimitedError({...init,retryAfterSec:parseRetryAfter(response.headers.get("retry-after"))??parseRetryAfter(typeof init.details?.["retryAfterSeconds"]==="number"?String(init.details["retryAfterSeconds"]):null)});default:return new StorefrontError(init)}}
7
+
8
+ exports.PriceChangedError = PriceChangedError;
9
+ exports.RateLimitedError = RateLimitedError;
10
+ exports.STOREFRONT_ERROR_CODES = STOREFRONT_ERROR_CODES;
11
+ exports.StorefrontConfigError = StorefrontConfigError;
12
+ exports.StorefrontError = StorefrontError;
13
+ exports.StorefrontNetworkError = StorefrontNetworkError;
14
+ exports.StorefrontTimeoutError = StorefrontTimeoutError;
15
+ exports.WrongRegionError = WrongRegionError;
16
+ exports.errorFromResponse = errorFromResponse;
17
+ exports.storefrontQuoteSchema = storefrontQuoteSchema;
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunkXIAAWHAY_cjs = require('./chunk-XIAAWHAY.cjs');
3
+ var chunkUSOISC2R_cjs = require('./chunk-USOISC2R.cjs');
4
4
  var zod = require('zod');
5
5
 
6
- var TAG="suiteop-checkout";var manifestSchema=zod.z.object({v1:zod.z.object({path:zod.z.string().regex(/^\/checkout\/v1\.[0-9a-f]{12}\.js$/),integrity:zod.z.string().regex(/^sha384-[A-Za-z0-9+/]+={0,2}$/)})});var loads=new Map;var requested=new Map;function scriptUrl(url){const n=requested.get(url)??0;requested.set(url,n+1);return n===0?url:`${url}?retry=${n}`}function unavailable(message,cause){return new chunkXIAAWHAY_cjs.StorefrontError({status:0,code:"checkout_unavailable",message,cause})}async function fetchEntry(origin,fresh){const res=await fetch(`${origin}/checkout/manifest.json`,{cache:fresh?"no-store":"default",credentials:"omit"});if(!res.ok)throw unavailable(`The checkout manifest answered ${res.status}`);const parsed=manifestSchema.safeParse(await res.json());if(!parsed.success)throw unavailable("The checkout manifest has no usable v1 entry");return parsed.data.v1}function inject(src,integrity){const script=document.createElement("script");script.type="module";script.src=src;script.integrity=integrity;script.crossOrigin="anonymous";const ready=new Promise((resolve,reject)=>{script.addEventListener("error",()=>reject(unavailable(`${src} failed to load`)),{once:true});script.addEventListener("load",()=>customElements.get(TAG)?resolve():reject(unavailable(`${src} defined no <${TAG}>`)),{once:true});void customElements.whenDefined(TAG).then(()=>resolve());});document.head.append(script);return [script,ready]}async function load(origin){if(customElements.get(TAG))return;for(const fresh of [false,true]){try{const entry=await fetchEntry(origin,fresh);const[script,ready]=inject(scriptUrl(`${origin}${entry.path}`),entry.integrity);try{return await ready}catch(err){script.remove();if(fresh)throw err}}catch(err){if(err instanceof chunkXIAAWHAY_cjs.StorefrontError)throw err;throw unavailable("The checkout bundle could not be loaded",err)}}}function loadCheckout(options={}){if(typeof window==="undefined"||typeof document==="undefined")return Promise.resolve();let origin;try{origin=new URL(options.origin??window.location.origin).origin;}catch(err){return Promise.reject(unavailable("loadCheckout: origin must be an absolute URL",err))}const key=`${origin}|v${options.major??1}`;const existing=loads.get(key);if(existing)return existing;const loading=load(origin);loads.set(key,loading);loading.catch(()=>{if(loads.get(key)===loading)loads.delete(key);});return loading}
6
+ var TAG="suiteop-checkout";var manifestSchema=zod.z.object({v1:zod.z.object({path:zod.z.string().regex(/^\/checkout\/v1\.[0-9a-f]{12}\.js$/),integrity:zod.z.string().regex(/^sha384-[A-Za-z0-9+/]+={0,2}$/)})});var loads=new Map;var requested=new Map;function scriptUrl(url){const n=requested.get(url)??0;requested.set(url,n+1);return n===0?url:`${url}?retry=${n}`}function unavailable(message,cause){return new chunkUSOISC2R_cjs.StorefrontError({status:0,code:"checkout_unavailable",message,cause})}async function fetchEntry(origin,fresh){const res=await fetch(`${origin}/checkout/manifest.json`,{cache:fresh?"no-store":"default",credentials:"omit"});if(!res.ok)throw unavailable(`The checkout manifest answered ${res.status}`);const parsed=manifestSchema.safeParse(await res.json());if(!parsed.success)throw unavailable("The checkout manifest has no usable v1 entry");return parsed.data.v1}function inject(src,integrity){const script=document.createElement("script");script.type="module";script.src=src;script.integrity=integrity;script.crossOrigin="anonymous";const ready=new Promise((resolve,reject)=>{script.addEventListener("error",()=>reject(unavailable(`${src} failed to load`)),{once:true});script.addEventListener("load",()=>customElements.get(TAG)?resolve():reject(unavailable(`${src} defined no <${TAG}>`)),{once:true});void customElements.whenDefined(TAG).then(()=>resolve());});document.head.append(script);return [script,ready]}async function load(origin){if(customElements.get(TAG))return;for(const fresh of [false,true]){try{const entry=await fetchEntry(origin,fresh);const[script,ready]=inject(scriptUrl(`${origin}${entry.path}`),entry.integrity);try{return await ready}catch(err){script.remove();if(fresh)throw err}}catch(err){if(err instanceof chunkUSOISC2R_cjs.StorefrontError)throw err;throw unavailable("The checkout bundle could not be loaded",err)}}}function loadCheckout(options={}){if(typeof window==="undefined"||typeof document==="undefined")return Promise.resolve();let origin;try{origin=new URL(options.origin??window.location.origin).origin;}catch(err){return Promise.reject(unavailable("loadCheckout: origin must be an absolute URL",err))}const key=`${origin}|v${options.major??1}`;const existing=loads.get(key);if(existing)return existing;const loading=load(origin);loads.set(key,loading);loading.catch(()=>{if(loads.get(key)===loading)loads.delete(key);});return loading}
7
7
 
8
8
  exports.loadCheckout = loadCheckout;
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ var chunk4GZBXKBU_cjs = require('./chunk-4GZBXKBU.cjs');
4
+ var chunkUSOISC2R_cjs = require('./chunk-USOISC2R.cjs');
5
+ var zod = require('zod');
6
+
7
+ var CONTENT_FIELD_TYPES=["text","rich_text","image","gallery","number","boolean","date","option","link","reference","references"];var CONTENT_TYPE_KINDS=["collection","section","fields"];var CONTENT_SUBJECT_KINDS=["building","area"];var CONTENT_REFERENCE_KINDS=["listing","building","area"];var MAX_CONTENT_TYPES=40;var MAX_CONTENT_FIELDS=40;var contentKeySchema=zod.z.string().regex(/^[a-z][a-z0-9_]{0,39}$/,"validation.invalid_format");var contentLocalizedSchema=zod.z.union([zod.z.string().min(1).max(120),zod.z.record(zod.z.string().min(2).max(35),zod.z.string().min(1).max(120))]);var COLLECTION_TARGET=/^collection:[a-z][a-z0-9_]{0,39}$/;var contentReferenceTargetSchema=zod.z.union([zod.z.enum(CONTENT_REFERENCE_KINDS),zod.z.string().regex(COLLECTION_TARGET,"validation.invalid_format")]);var TEXT_TYPES=new Set(["text","rich_text"]);var LIST_TYPES=new Set(["gallery","references"]);var REFERENCE_TYPES=new Set(["reference","references"]);var contentFieldSchema=zod.z.object({key:contentKeySchema,type:zod.z.enum(CONTENT_FIELD_TYPES),label:contentLocalizedSchema,help:contentLocalizedSchema.optional(),required:zod.z.boolean().default(false),translatable:zod.z.boolean().optional(),maxLength:zod.z.number().int().min(1).max(6e4).optional(),options:zod.z.array(zod.z.object({value:contentKeySchema,label:contentLocalizedSchema})).min(1).max(50).optional(),to:contentReferenceTargetSchema.optional(),max:zod.z.number().int().min(1).max(100).optional(),removed:zod.z.boolean().optional()}).superRefine((field2,ctx)=>{if(field2.type==="option"&&!field2.options?.length){ctx.addIssue({code:"custom",path:["options"],message:"validation.required"});}if(field2.options&&new Set(field2.options.map(o=>o.value)).size!==field2.options.length){ctx.addIssue({code:"custom",path:["options"],message:"validation.invalid"});}if(REFERENCE_TYPES.has(field2.type)&&!field2.to){ctx.addIssue({code:"custom",path:["to"],message:"validation.required"});}if(field2.maxLength!==void 0&&!TEXT_TYPES.has(field2.type)){ctx.addIssue({code:"custom",path:["maxLength"],message:"validation.invalid"});}if(field2.max!==void 0&&!LIST_TYPES.has(field2.type)){ctx.addIssue({code:"custom",path:["max"],message:"validation.invalid"});}});var contentTypeSchema=zod.z.object({key:contentKeySchema,kind:zod.z.enum(CONTENT_TYPE_KINDS),label:contentLocalizedSchema,description:contentLocalizedSchema.optional(),attachesTo:zod.z.enum(CONTENT_SUBJECT_KINDS).optional(),titleField:contentKeySchema.optional(),routable:zod.z.boolean().default(false),drafts:zod.z.boolean().default(false),order:zod.z.enum(["manual","newest"]).default("manual"),fields:zod.z.array(contentFieldSchema).min(1).max(MAX_CONTENT_FIELDS)}).superRefine((type,ctx)=>{const keys=type.fields.map(f=>f.key);keys.forEach((key,i)=>{if(keys.indexOf(key)!==i){ctx.addIssue({code:"custom",path:["fields",i,"key"],message:"validation.invalid"});}});if(type.kind==="fields"!==(type.attachesTo!==void 0)){ctx.addIssue({code:"custom",path:["attachesTo"],message:"validation.invalid"});}if(type.kind==="collection"){const title=type.fields.find(f=>f.key===type.titleField);if(!title||title.type!=="text"){ctx.addIssue({code:"custom",path:["titleField"],message:"validation.invalid"});}}else if(type.titleField!==void 0){ctx.addIssue({code:"custom",path:["titleField"],message:"validation.invalid"});}});var contentModelSchema=zod.z.object({version:zod.z.literal(1),types:zod.z.array(contentTypeSchema).max(MAX_CONTENT_TYPES)}).superRefine((model,ctx)=>{const keys=model.types.map(t=>t.key);const collections=new Set(model.types.filter(t=>t.kind==="collection").map(t=>t.key));model.types.forEach((type,i)=>{if(keys.indexOf(type.key)!==i){ctx.addIssue({code:"custom",path:["types",i,"key"],message:"validation.invalid"});}type.fields.forEach((field2,j)=>{const target=field2.to?.startsWith("collection:")?field2.to.slice(11):null;if(target!==null&&!collections.has(target)){ctx.addIssue({code:"custom",path:["types",i,"fields",j,"to"],message:"validation.invalid"});}});});});function defineContent(definition){return definition}var field={text:o=>({...o,type:"text"}),richText:o=>({...o,type:"rich_text"}),image:o=>({...o,type:"image"}),gallery:o=>({...o,type:"gallery"}),number:o=>({...o,type:"number"}),boolean:o=>({...o,type:"boolean"}),date:o=>({...o,type:"date"}),option:o=>({...o,type:"option"}),link:o=>({...o,type:"link"}),reference:o=>({...o,type:"reference"}),references:o=>({...o,type:"references"})};var optionOf=choice=>typeof choice==="string"?{value:choice,label:choice}:choice;function toContentModel(definition){return {version:1,types:Object.entries(definition).map(([key,type])=>({...type,key,fields:Object.entries(type.fields).map(([fieldKey,f])=>f.type==="option"?{...f,key:fieldKey,options:f.options.map(optionOf)}:{...f,key:fieldKey})}))}}function parseContentModel(definition){const parsed=contentModelSchema.safeParse(toContentModel(definition));if(parsed.success)return parsed.data;const problems=parsed.error.issues.map(i=>`${i.path.join(".")}: ${i.message}`);throw new Error(`Invalid SuiteOp content model:
8
+ ${problems.join("\n ")}`)}var DAY=/^\d{4}-\d{2}-\d{2}$/;var linkSchema=zod.z.object({url:zod.z.string(),label:zod.z.string().optional()});function valueSchema(f){switch(f.type){case "text":case "rich_text":return zod.z.string();case "date":return zod.z.string().regex(DAY);case "image":return zod.z.union([chunk4GZBXKBU_cjs.storefrontImageSchema,zod.z.array(chunk4GZBXKBU_cjs.storefrontImageSchema).min(1).transform(photos=>photos[0])]);case "gallery":return zod.z.array(chunk4GZBXKBU_cjs.storefrontImageSchema);case "number":return zod.z.number();case "boolean":return zod.z.boolean();case "option":{const values=new Set(f.options.map(o=>optionOf(o).value));return zod.z.string().refine(v=>values.has(v))}case "link":return linkSchema;case "reference":return chunk4GZBXKBU_cjs.storefrontContentRefSchema;case "references":return zod.z.array(chunk4GZBXKBU_cjs.storefrontContentRefSchema)}}var isList=f=>f.type==="gallery"||f.type==="references";function readFields(type,values){const out={};for(const[key,f]of Object.entries(type.fields)){const raw=values?.[key];const parsed=raw===void 0||raw===null?null:valueSchema(f).safeParse(raw);out[key]=parsed?.success?parsed.data:isList(f)?[]:null;}return out}function toItem(type,item){return {id:item.id,slug:item.slug,publishedAt:item.publishedAt,updatedAt:item.updatedAt,sortOrder:item.sortOrder,fields:readFields(type,item.fields)}}async function orEmpty(read,empty){try{return await read}catch(err){if(err instanceof chunkUSOISC2R_cjs.StorefrontError&&err.status===404)return empty();throw err}}function createContentReader(client,definition){return {collection:key=>({async list(query,opts){const page=await orEmpty(client.collections.list(key,query,opts),()=>({items:[],total:0,limit:query?.limit??20,offset:query?.offset??0}));return {...page,items:page.items.map(item=>toItem(definition[key],item))}},async get(slugOrId,opts){const item=await client.collections.get(key,slugOrId,opts);return item?toItem(definition[key],item):null}}),section:key=>({get:async opts=>toItem(definition[key],await orEmpty(client.sections.get(key,opts),()=>({id:"",type:key,slug:null,publishedAt:null,updatedAt:new Date(0).toISOString(),sortOrder:0,fields:{}})))}),fieldsOf:(key,record)=>readFields(definition[key],record.fields?.[key])}}
9
+
10
+ exports.contentModelSchema = contentModelSchema;
11
+ exports.createContentReader = createContentReader;
12
+ exports.defineContent = defineContent;
13
+ exports.field = field;
14
+ exports.parseContentModel = parseContentModel;
15
+ exports.readFields = readFields;
16
+ exports.toContentModel = toContentModel;
@@ -0,0 +1,6 @@
1
+ import { withStayRules, storefrontGuestsSchema, storefrontDateSchema } from './chunk-6NFURJXI.js';
2
+ import { z } from 'zod';
3
+
4
+ var storefrontRatePlanQuoteSchema=z.object({ratePlanId:z.string(),name:z.string(),accommodationMinor:z.number().int(),feesMinor:z.number().int(),taxesMinor:z.number().int(),totalMinor:z.number().int().positive(),currency:z.string().regex(/^[a-z]{3}$/),cancellationPolicy:z.string().nullable(),cancellationFee:z.unknown().optional(),quoteRef:z.string()});withStayRules(z.object({listingId:z.uuid({message:"validation.storefront.listing_invalid"}),checkIn:storefrontDateSchema,checkOut:storefrontDateSchema,guests:storefrontGuestsSchema}));var storefrontQuoteSchema=z.object({quoteRef:z.string(),propertyId:z.uuid(),checkIn:storefrontDateSchema,checkOut:storefrontDateSchema,guests:z.number().int().positive(),ratePlans:z.array(storefrontRatePlanQuoteSchema).min(1),expiresAt:z.iso.datetime()});var STOREFRONT_ERROR_CODES=["wrong_region","origin_not_allowed","origin_required","site_archived","not_bookable","quote_invalid","quote_expired","price_changed","currency_unsupported","payment_declined","session_expired","rate_limited","contact_not_configured","payment_account_unavailable","idempotency_key_required","idempotency_key_reused","payment_mode_unsupported","payment_not_authorized","payment_method_required","site_not_published","preview_read_only","bookings_closed","extras_invalid","UNAUTHORIZED","VALIDATION_ERROR","NOT_FOUND","site_not_found","upstream_timeout","timeout","network","invalid_response","internal_error","checkout_unavailable"];var StorefrontError=class extends Error{name="StorefrontError";status;type;code;requestId;details;constructor(init){super(init.message,init.cause===void 0?void 0:{cause:init.cause});this.status=init.status;this.code=init.code;this.type=init.type??init.code;this.requestId=init.requestId??null;this.details=init.details??{};}};var PriceChangedError=class extends StorefrontError{name="PriceChangedError";quote;requiresNewSession;constructor(init){super(init);const raw=this.details["quote"];const parsed=storefrontQuoteSchema.safeParse(raw);this.quote=parsed.success?parsed.data:null;this.requiresNewSession=this.details["requiresNewSession"]===true||raw!=null&&!parsed.success;}};var WrongRegionError=class extends StorefrontError{name="WrongRegionError";region;baseUrl;constructor(init){super(init);const{region,baseUrl}=this.details;this.region=region==="us"||region==="eu"||region==="apac"?region:null;this.baseUrl=typeof baseUrl==="string"?baseUrl:null;}};var RateLimitedError=class extends StorefrontError{name="RateLimitedError";retryAfterSec;scope;constructor(init){super(init);this.retryAfterSec=init.retryAfterSec;const{scope}=this.details;this.scope=scope==="key"||scope==="ip"||scope==="pms"?scope:null;}};var StorefrontTimeoutError=class extends StorefrontError{name="StorefrontTimeoutError";constructor(timeoutMs,requestId=null){super({status:0,code:"timeout",message:`No response within ${timeoutMs} ms`,requestId});}};var StorefrontNetworkError=class extends StorefrontError{name="StorefrontNetworkError";constructor(cause){super({status:0,code:"network",message:"The Storefront API could not be reached",cause});}};var StorefrontConfigError=class extends Error{name="StorefrontConfigError"};function isRecord(value){return typeof value==="object"&&value!==null&&!Array.isArray(value)}function parseRetryAfter(header){if(header===null)return null;const seconds=Number(header);if(Number.isFinite(seconds)&&seconds>=0)return Math.ceil(seconds);const at=Date.parse(header);return Number.isNaN(at)?null:Math.max(0,Math.ceil((at-Date.now())/1e3))}function errorFromResponse(response,body){const headerRequestId=response.headers.get("x-request-id");const wire=isRecord(body)&&isRecord(body["error"])?body["error"]:null;const meta=isRecord(body)&&isRecord(body["meta"])?body["meta"]:null;const requestId=typeof meta?.["requestId"]==="string"?meta["requestId"]:headerRequestId;if(!wire||typeof wire["code"]!=="string"){return new StorefrontError({status:response.status,code:"internal_error",message:`The Storefront API answered ${response.status}`,requestId})}const init={status:response.status,code:wire["code"],type:typeof wire["type"]==="string"?wire["type"]:wire["code"],message:typeof wire["message"]==="string"?wire["message"]:wire["code"],requestId,details:isRecord(wire["details"])?wire["details"]:{}};switch(init.code){case "price_changed":return new PriceChangedError(init);case "wrong_region":return new WrongRegionError(init);case "rate_limited":return new RateLimitedError({...init,retryAfterSec:parseRetryAfter(response.headers.get("retry-after"))??parseRetryAfter(typeof init.details?.["retryAfterSeconds"]==="number"?String(init.details["retryAfterSeconds"]):null)});default:return new StorefrontError(init)}}
5
+
6
+ export { PriceChangedError, RateLimitedError, STOREFRONT_ERROR_CODES, StorefrontConfigError, StorefrontError, StorefrontNetworkError, StorefrontTimeoutError, WrongRegionError, errorFromResponse, storefrontQuoteSchema };
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ var REGIONS=["us","eu","apac"];var BE_BOOKING_REQUEST_STATUSES=["inquiry","processing","confirmed","failed","expired","pending_pms_sync","pending_payment","authorized","reserved","cancelled"];var STOREFRONT_KEY_ENVIRONMENTS=["live","test"];var GOOGLE_FONTS=["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"];var STOREFRONT_FONTS=[...GOOGLE_FONTS,"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"];var STOREFRONT_FONT_FAMILIES={inter:"Inter",montserrat:"Montserrat",poppins:"Poppins",raleway:"Raleway",nunito:"Nunito",work_sans:"Work Sans",mulish:"Mulish",barlow:"Barlow",jost:"Jost",bitter:"Bitter",archivo:"Archivo",public_sans:"Public Sans",gantari:"Gantari",anybody:"Anybody",lato:"Lato",playfair_display:"Playfair Display",karla:"Karla",reddit_sans:"Reddit Sans",overpass:"Overpass",roboto:"Roboto",open_sans:"Open Sans",merriweather:"Merriweather",outfit:"Outfit",fraunces:"Fraunces",dm_sans:"DM Sans",cormorant_garamond:"Cormorant Garamond",eb_garamond:"EB Garamond",lora:"Lora",crimson_pro:"Crimson Pro",source_serif_4:"Source Serif 4",ibm_plex_serif:"IBM Plex Serif",manrope:"Manrope",plus_jakarta_sans:"Plus Jakarta Sans",space_grotesk:"Space Grotesk",ibm_plex_sans:"IBM Plex Sans",libre_franklin:"Libre Franklin",josefin_sans:"Josefin Sans"};
4
+
5
+ exports.BE_BOOKING_REQUEST_STATUSES = BE_BOOKING_REQUEST_STATUSES;
6
+ exports.REGIONS = REGIONS;
7
+ exports.STOREFRONT_FONTS = STOREFRONT_FONTS;
8
+ exports.STOREFRONT_FONT_FAMILIES = STOREFRONT_FONT_FAMILIES;
9
+ exports.STOREFRONT_KEY_ENVIRONMENTS = STOREFRONT_KEY_ENVIRONMENTS;
@@ -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 storefrontClientEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
356
- name: z.ZodLiteral<"page_view">;
357
- eventId: z.ZodUUID;
358
- ts: z.ZodNumber;
359
- path: z.ZodString;
360
- referrerHost: z.ZodNullable<z.ZodString>;
361
- }, z.core.$strip>, z.ZodObject<{
362
- name: z.ZodLiteral<"view_search_results">;
363
- checkIn: z.ZodOptional<z.ZodISODate>;
364
- checkOut: z.ZodOptional<z.ZodISODate>;
365
- guests: z.ZodOptional<z.ZodNumber>;
366
- locationId: z.ZodOptional<z.ZodUUID>;
367
- eventId: z.ZodUUID;
368
- ts: z.ZodNumber;
369
- path: z.ZodString;
370
- referrerHost: z.ZodNullable<z.ZodString>;
371
- }, z.core.$strip>, z.ZodObject<{
372
- name: z.ZodLiteral<"view_item_list">;
373
- listName: z.ZodString;
374
- itemCount: z.ZodNumber;
375
- eventId: z.ZodUUID;
376
- ts: z.ZodNumber;
377
- path: z.ZodString;
378
- referrerHost: z.ZodNullable<z.ZodString>;
379
- }, z.core.$strip>, z.ZodObject<{
380
- name: z.ZodLiteral<"view_item">;
381
- listingId: z.ZodUUID;
382
- eventId: z.ZodUUID;
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
- declare const STOREFRONT_ERROR_CODES: readonly ["wrong_region", "origin_not_allowed", "origin_required", "site_archived", "not_bookable", "quote_invalid", "quote_expired", "price_changed", "currency_unsupported", "payment_declined", "session_expired", "rate_limited", "contact_not_configured", "payment_account_unavailable", "idempotency_key_required", "idempotency_key_reused", "payment_mode_unsupported", "payment_not_authorized", "payment_method_required", "site_not_published", "preview_read_only", "UNAUTHORIZED", "VALIDATION_ERROR", "NOT_FOUND", "site_not_found", "upstream_timeout", "timeout", "network", "invalid_response", "internal_error", "checkout_unavailable"];
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 };