@suiteop/storefront 0.4.0 → 0.6.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 (61) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/README.md +9 -2
  3. package/dist/astro-content-model.cjs +5 -5
  4. package/dist/astro-content-model.js +4 -4
  5. package/dist/astro.cjs +1 -1
  6. package/dist/astro.d.cts +66 -1
  7. package/dist/astro.d.ts +66 -1
  8. package/dist/astro.js +1 -1
  9. package/dist/availability.d-Cla9GuGc.d.cts +84 -0
  10. package/dist/availability.d-Cla9GuGc.d.ts +84 -0
  11. package/dist/checkout.cjs +4 -4
  12. package/dist/checkout.d.cts +11 -0
  13. package/dist/checkout.d.ts +11 -0
  14. package/dist/checkout.js +3 -3
  15. package/dist/{chunk-TLTL7M3O.js → chunk-3B6ZYRYF.js} +2 -2
  16. package/dist/chunk-3NE27PHL.cjs +19 -0
  17. package/dist/{chunk-HMLBMNGA.js → chunk-7ZAI36LH.js} +1 -1
  18. package/dist/{chunk-LVFRVNT3.cjs → chunk-EHQFWSP6.cjs} +2 -1
  19. package/dist/{chunk-6NFURJXI.js → chunk-IBCBDAGY.js} +2 -2
  20. package/dist/{chunk-USOISC2R.cjs → chunk-J5FZ4WDQ.cjs} +2 -2
  21. package/dist/chunk-JF245QUY.cjs +9 -0
  22. package/dist/{chunk-IUJTHNB3.cjs → chunk-OXCLLFCY.cjs} +3 -3
  23. package/dist/chunk-QBHOJGZI.cjs +21 -0
  24. package/dist/{chunk-VV2UNVQ2.cjs → chunk-UMCI4YBN.cjs} +2 -2
  25. package/dist/chunk-UQWQPTHO.js +3 -0
  26. package/dist/{chunk-ZI2PG7LS.js → chunk-W5K7IDYN.js} +1 -1
  27. package/dist/chunk-XOCFEVP4.js +6 -0
  28. package/dist/chunk-YIYGBTAM.js +9 -0
  29. package/dist/{client-oyYRhUv0.d.ts → client-CX8K7JNt.d.cts} +108 -20
  30. package/dist/{client-CZWN4im4.d.cts → client-s-lEwqzc.d.ts} +108 -20
  31. package/dist/components.cjs +2 -2
  32. package/dist/components.d.cts +43 -1
  33. package/dist/components.d.ts +43 -1
  34. package/dist/components.js +1 -1
  35. package/dist/config.cjs +10 -3
  36. package/dist/config.d.cts +240 -79
  37. package/dist/config.d.ts +240 -79
  38. package/dist/config.js +4 -4
  39. package/dist/content.cjs +11 -11
  40. package/dist/content.d.cts +53 -9
  41. package/dist/content.d.ts +53 -9
  42. package/dist/content.js +4 -4
  43. package/dist/{errors-CAW7nLHr.d.cts → errors-Oax7djdp.d.ts} +54 -13
  44. package/dist/{errors-DoXdi1vS.d.ts → errors-welPvrD6.d.cts} +54 -13
  45. package/dist/index.cjs +22 -22
  46. package/dist/index.d.cts +27 -8
  47. package/dist/index.d.ts +27 -8
  48. package/dist/index.js +5 -5
  49. package/dist/react.cjs +7 -7
  50. package/dist/react.d.cts +24 -3
  51. package/dist/react.d.ts +24 -3
  52. package/dist/react.js +6 -6
  53. package/package.json +1 -1
  54. package/dist/availability-CnzmxuV3.d.cts +0 -60
  55. package/dist/availability-CnzmxuV3.d.ts +0 -60
  56. package/dist/chunk-CTHHMNLE.cjs +0 -19
  57. package/dist/chunk-E5CGGMCO.cjs +0 -19
  58. package/dist/chunk-PYVUDQSQ.js +0 -3
  59. package/dist/chunk-TRXDDUEL.js +0 -5
  60. package/dist/chunk-UWUKERLK.js +0 -9
  61. package/dist/chunk-ZLAOY6IF.cjs +0 -9
@@ -0,0 +1,9 @@
1
+ import { BE_BOOKING_REQUEST_STATUSES, STOREFRONT_KEY_ENVIRONMENTS, REGIONS } from './chunk-UQWQPTHO.js';
2
+ import { requiredTrimmedEmailField, storefrontReviewSchema, storefrontContentItemSchema, storefrontIdSchema, storefrontLocationSchema, storefrontBuildingSchema, storefrontListingSummarySchema, storefrontListingFacetsSchema, storefrontContactResultSchema, storefrontContentModelSchema, storefrontListingSchema, storefrontSiteSchema } from './chunk-XOCFEVP4.js';
3
+ import { StorefrontConfigError, StorefrontError, storefrontQuoteSchema, StorefrontTimeoutError, StorefrontNetworkError, errorFromResponse } from './chunk-W5K7IDYN.js';
4
+ import { openEnum, storefrontDateSchema, storefrontCalendarSchema, storefrontAvailabilitySchema, storefrontUnitAvailabilitySchema } from './chunk-IBCBDAGY.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(),preview:z.literal(true).optional()});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 storefrontGuideItemSchema=z.object({id:z.uuid(),title:z.string().nullable(),description:z.string().nullable(),address:z.string().nullable(),latitude:z.number().nullable(),longitude:z.number().nullable(),googleMapsUrl:z.string().nullable(),websiteUrl:z.string().nullable(),imageUrl:z.string().nullable(),categories:z.array(z.string()),priceLevel:z.number().int().min(1).max(4).nullable(),rating:z.number().nullable(),ratingsCount:z.number().int().nullable()});var storefrontGuideSchema=z.object({id:z.uuid(),name:z.string(),category:z.string().nullable(),coverImageUrl:z.string().nullable(),items:z.array(storefrontGuideItemSchema)});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.")}if(parsed.region==="demo"){throw new StorefrontConfigError("Invalid SuiteOp publishable key: expected pk_{live|test}_{us|eu|apac}_ followed by 24 letters or digits.")}return {environment:parsed.environment,region:parsed.region}}function defaultApiOrigin({environment,region}){return environment==="live"?`https://api-${region}.suiteop.com`:`https://api-${region}-staging.suiteop.com`}var SDK_VERSION="0.6.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(Array.isArray(value))for(const item of value)params.append(key,item);else 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:typeof query?.location==="string"?query.location:query?.location?.length?query.location.join(","):void 0,building:query?.building,guests:query?.guests,bedrooms:query?.bedrooms,currency:query?.currency,priceMin:query?.priceMin,priceMax:query?.priceMax,amenities:query?.amenities,bounds:typeof query?.bounds==="string"?query.bounds:query?.bounds?.join(","),checkIn:query?.checkIn,checkOut:query?.checkOut,sort:query?.sort,facets:query?.facets?1:void 0,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);const facets=res.meta["facets"]===void 0?void 0:validate(storefrontListingFacetsSchema,res.meta["facets"],res);return {items,...pagination,...facets?{facets}:{}}},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),async availability(id,query,opts){const res=await transport.send({method:"GET",path:`/buildings/${seg(id)}/availability`,query:{checkIn:query.checkIn,checkOut:query.checkOut,guests:query.guests,limit:query.limit,offset:query.offset},timeoutMs:readTimeoutMs,signal:opts?.signal});const items=validate(z.array(storefrontUnitAvailabilitySchema),res.data,res);const pagination=validate(paginationSchema,res.meta["pagination"],res);return {items,...pagination}}},locations:{list:opts=>get(z.array(storefrontLocationSchema),"/locations",opts)},guides:{list:opts=>get(z.array(storefrontGuideSchema),"/guides",opts),async get(id,opts){if(!storefrontIdSchema.safeParse(id).success)return null;try{return await get(storefrontGuideSchema,`/guides/${seg(id)}`,opts)}catch(err){if(err instanceof StorefrontError&&err.status===404)return null;throw err}}},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,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { d as StorefrontStay, S as StorefrontAvailability, c as StorefrontCalendarQuery, a as StorefrontCalendar } from './availability-CnzmxuV3.js';
2
+ import { e as StorefrontStay, a as StorefrontBuildingAvailabilityQuery, g as StorefrontUnitAvailability, S as StorefrontAvailability, d as StorefrontCalendarQuery, b as StorefrontCalendar } from './availability.d-Cla9GuGc.cjs';
3
3
 
4
4
  declare const storefrontGuestInputSchema: z.ZodObject<{
5
5
  firstName: z.ZodString;
@@ -27,13 +27,13 @@ type ConfirmCheckoutSessionInput = z.infer<typeof confirmCheckoutSessionInputSch
27
27
  declare const bookingResultSchema: z.ZodObject<{
28
28
  bookingRequestId: z.ZodUUID;
29
29
  confirmationToken: z.ZodString;
30
- status: z.ZodType<"inquiry" | "processing" | "confirmed" | "failed" | "expired" | "pending_pms_sync" | "pending_payment" | "authorized" | "reserved" | "cancelled" | (string & {}), unknown, z.core.$ZodTypeInternals<"inquiry" | "processing" | "confirmed" | "failed" | "expired" | "pending_pms_sync" | "pending_payment" | "authorized" | "reserved" | "cancelled" | (string & {}), unknown>>;
30
+ status: z.ZodType<"authorized" | "cancelled" | "confirmed" | "expired" | "failed" | "inquiry" | "pending_payment" | "pending_pms_sync" | "processing" | "reserved" | (string & {}), unknown, z.core.$ZodTypeInternals<"authorized" | "cancelled" | "confirmed" | "expired" | "failed" | "inquiry" | "pending_payment" | "pending_pms_sync" | "processing" | "reserved" | (string & {}), unknown>>;
31
31
  confirmationCode: z.ZodNullable<z.ZodString>;
32
32
  }, z.core.$strip>;
33
33
  type BookingResult = z.infer<typeof bookingResultSchema>;
34
34
  declare const storefrontBookingSchema: z.ZodObject<{
35
35
  id: z.ZodUUID;
36
- status: z.ZodType<"inquiry" | "processing" | "confirmed" | "failed" | "expired" | "pending_pms_sync" | "pending_payment" | "authorized" | "reserved" | "cancelled" | (string & {}), unknown, z.core.$ZodTypeInternals<"inquiry" | "processing" | "confirmed" | "failed" | "expired" | "pending_pms_sync" | "pending_payment" | "authorized" | "reserved" | "cancelled" | (string & {}), unknown>>;
36
+ status: z.ZodType<"authorized" | "cancelled" | "confirmed" | "expired" | "failed" | "inquiry" | "pending_payment" | "pending_pms_sync" | "processing" | "reserved" | (string & {}), unknown, z.core.$ZodTypeInternals<"authorized" | "cancelled" | "confirmed" | "expired" | "failed" | "inquiry" | "pending_payment" | "pending_pms_sync" | "processing" | "reserved" | (string & {}), unknown>>;
37
37
  propertyId: z.ZodNullable<z.ZodUUID>;
38
38
  checkIn: z.ZodNullable<z.ZodISODate>;
39
39
  checkOut: z.ZodNullable<z.ZodISODate>;
@@ -76,6 +76,8 @@ declare const storefrontListingSummarySchema: z.ZodObject<{
76
76
  latitude: z.ZodNullable<z.ZodNumber>;
77
77
  longitude: z.ZodNullable<z.ZodNumber>;
78
78
  bookable: z.ZodBoolean;
79
+ fromPriceMinor: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
80
+ currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
79
81
  }, z.core.$strip>;
80
82
  type StorefrontListingSummary = z.infer<typeof storefrontListingSummarySchema>;
81
83
  declare const storefrontImageSchema: z.ZodObject<{
@@ -100,6 +102,8 @@ declare const storefrontListingSchema: z.ZodObject<{
100
102
  latitude: z.ZodNullable<z.ZodNumber>;
101
103
  longitude: z.ZodNullable<z.ZodNumber>;
102
104
  bookable: z.ZodBoolean;
105
+ fromPriceMinor: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
106
+ currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
103
107
  buildingSlug: z.ZodString;
104
108
  buildingAddress: z.ZodUnknown;
105
109
  description: z.ZodNullable<z.ZodString>;
@@ -116,18 +120,47 @@ declare const storefrontListingSchema: z.ZodObject<{
116
120
  checkInTime: z.ZodNullable<z.ZodString>;
117
121
  checkOutTime: z.ZodNullable<z.ZodString>;
118
122
  beds: z.ZodNullable<z.ZodNumber>;
119
- fromPriceMinor: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
120
- currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
121
123
  countryCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
122
124
  }, z.core.$strip>;
123
125
  type StorefrontListing = z.infer<typeof storefrontListingSchema>;
124
- declare const storefrontListingsQuerySchema: z.ZodObject<{
125
- location: z.ZodOptional<z.ZodString>;
126
- building: z.ZodOptional<z.ZodUUID>;
127
- limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
128
- offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
126
+ declare const STOREFRONT_LISTING_SORTS: readonly ['recommended', 'price_asc', 'price_desc', 'rating'];
127
+ type StorefrontListingSort = (typeof STOREFRONT_LISTING_SORTS)[number];
128
+ interface StorefrontListingsQuery {
129
+ location?: string | readonly string[];
130
+ building?: string;
131
+ guests?: number;
132
+ bedrooms?: number;
133
+ currency?: string;
134
+ priceMin?: number;
135
+ priceMax?: number;
136
+ amenities?: readonly string[];
137
+ bounds?: readonly [number, number, number, number] | string;
138
+ checkIn?: string;
139
+ checkOut?: string;
140
+ sort?: StorefrontListingSort;
141
+ facets?: boolean;
142
+ limit?: number;
143
+ offset?: number;
144
+ }
145
+ declare const storefrontListingFacetsSchema: z.ZodObject<{
146
+ total: z.ZodNumber;
147
+ areas: z.ZodArray<z.ZodObject<{
148
+ id: z.ZodUUID;
149
+ slug: z.ZodNullable<z.ZodString>;
150
+ count: z.ZodNumber;
151
+ }, z.core.$strip>>;
152
+ bedrooms: z.ZodArray<z.ZodObject<{
153
+ bedrooms: z.ZodNumber;
154
+ count: z.ZodNumber;
155
+ }, z.core.$strip>>;
156
+ price: z.ZodNullable<z.ZodObject<{
157
+ min: z.ZodNumber;
158
+ max: z.ZodNumber;
159
+ currency: z.ZodNullable<z.ZodString>;
160
+ buckets: z.ZodArray<z.ZodNumber>;
161
+ }, z.core.$strip>>;
129
162
  }, z.core.$strip>;
130
- type StorefrontListingsQuery = z.infer<typeof storefrontListingsQuerySchema>;
163
+ type StorefrontListingFacets = z.infer<typeof storefrontListingFacetsSchema>;
131
164
  declare const storefrontBuildingSchema: z.ZodObject<{
132
165
  id: z.ZodUUID;
133
166
  locationId: z.ZodNullable<z.ZodUUID>;
@@ -253,7 +286,7 @@ declare const createCheckoutSessionInputSchema: z.ZodObject<{
253
286
  wbraid: string | null;
254
287
  fbclid: string | null;
255
288
  msclkid: string | null;
256
- paidClick: "google" | "microsoft" | "meta" | null;
289
+ paidClick: "google" | "meta" | "microsoft" | null;
257
290
  } | null;
258
291
  last: {
259
292
  ts: string;
@@ -269,7 +302,7 @@ declare const createCheckoutSessionInputSchema: z.ZodObject<{
269
302
  wbraid: string | null;
270
303
  fbclid: string | null;
271
304
  msclkid: string | null;
272
- paidClick: "google" | "microsoft" | "meta" | null;
305
+ paidClick: "google" | "meta" | "microsoft" | null;
273
306
  } | null;
274
307
  ids: {
275
308
  gaClientId: string | null;
@@ -281,7 +314,7 @@ declare const createCheckoutSessionInputSchema: z.ZodObject<{
281
314
  analytics: boolean;
282
315
  ads: boolean;
283
316
  source: "default" | "user";
284
- region: "restricted" | "other";
317
+ region: "other" | "restricted";
285
318
  decidedAt: string | null;
286
319
  };
287
320
  experiment?: {
@@ -303,7 +336,7 @@ declare const createCheckoutSessionInputSchema: z.ZodObject<{
303
336
  wbraid: string | null;
304
337
  fbclid: string | null;
305
338
  msclkid: string | null;
306
- paidClick: "google" | "microsoft" | "meta" | null;
339
+ paidClick: "google" | "meta" | "microsoft" | null;
307
340
  } | null;
308
341
  last: {
309
342
  ts: string;
@@ -319,7 +352,7 @@ declare const createCheckoutSessionInputSchema: z.ZodObject<{
319
352
  wbraid: string | null;
320
353
  fbclid: string | null;
321
354
  msclkid: string | null;
322
- paidClick: "google" | "microsoft" | "meta" | null;
355
+ paidClick: "google" | "meta" | "microsoft" | null;
323
356
  } | null;
324
357
  ids: {
325
358
  gaClientId: string | null;
@@ -331,7 +364,7 @@ declare const createCheckoutSessionInputSchema: z.ZodObject<{
331
364
  analytics: boolean;
332
365
  ads: boolean;
333
366
  source: "default" | "user";
334
- region: "restricted" | "other";
367
+ region: "other" | "restricted";
335
368
  decidedAt: string | null;
336
369
  };
337
370
  experiment?: {
@@ -351,7 +384,7 @@ declare const createCheckoutSessionInputSchema: z.ZodObject<{
351
384
  type CreateCheckoutSessionInput = z.infer<typeof createCheckoutSessionInputSchema>;
352
385
  declare const checkoutSessionSchema: z.ZodObject<{
353
386
  id: z.ZodUUID;
354
- status: z.ZodType<"inquiry" | "processing" | "confirmed" | "failed" | "expired" | "pending_pms_sync" | "pending_payment" | "authorized" | "reserved" | "cancelled" | (string & {}), unknown, z.core.$ZodTypeInternals<"inquiry" | "processing" | "confirmed" | "failed" | "expired" | "pending_pms_sync" | "pending_payment" | "authorized" | "reserved" | "cancelled" | (string & {}), unknown>>;
387
+ status: z.ZodType<"authorized" | "cancelled" | "confirmed" | "expired" | "failed" | "inquiry" | "pending_payment" | "pending_pms_sync" | "processing" | "reserved" | (string & {}), unknown, z.core.$ZodTypeInternals<"authorized" | "cancelled" | "confirmed" | "expired" | "failed" | "inquiry" | "pending_payment" | "pending_pms_sync" | "processing" | "reserved" | (string & {}), unknown>>;
355
388
  quote: z.ZodObject<{
356
389
  listingId: z.ZodUUID;
357
390
  checkIn: z.ZodISODate;
@@ -526,18 +559,33 @@ type StorefrontQuote = z.infer<typeof storefrontQuoteSchema>;
526
559
  declare const STOREFRONT_API_PATH = "/api/storefront/v1";
527
560
  interface StorefrontClientOptions {
528
561
  publishableKey: string;
562
+ /**
563
+ * `'same-origin'` → `/api/storefront/v1` on the page's origin (SuiteOp-hosted sites, via the
564
+ * storefront edge). A URL → that origin (a `WrongRegionError.baseUrl` works as is). Omitted →
565
+ * the key's regional host: `https://api-<region>.suiteop.com` for `pk_live_`, the region's
566
+ * staging host for `pk_test_`.
567
+ */
529
568
  baseUrl?: 'same-origin' | (string & {});
569
+ /** Per-request timeout. Default 10 s for reads, 20 s for quotes and checkout. */
530
570
  timeoutMs?: number;
531
571
  fetch?: typeof fetch;
572
+ /** Sent as `Accept-Language`, so API-side copy (cancellation policy text) localises. */
532
573
  locale?: string;
533
574
  }
534
575
  interface RequestOptions {
576
+ /** Aborting rejects the call with the signal's reason (an `AbortError`). */
535
577
  signal?: AbortSignal;
536
578
  }
537
579
  interface CreateCheckoutSessionOptions extends RequestOptions {
580
+ /**
581
+ * Omitted → one UUID v4 per quoteRef + ratePlanId, reused by every retry on this client until
582
+ * the outcome is final (a dead session or a definitive refusal releases it).
583
+ */
538
584
  idempotencyKey?: string;
539
585
  }
586
+ /** `collections.list` paging. */
540
587
  interface ContentListQuery {
588
+ /** 1–100, default 20. */
541
589
  limit?: number;
542
590
  offset?: number;
543
591
  }
@@ -547,38 +595,67 @@ interface Page<T> {
547
595
  limit: number;
548
596
  offset: number;
549
597
  }
598
+ /** The session plus the Idempotency-Key it was created with — `<suiteop-checkout>` replays both. */
550
599
  type CreatedCheckoutSession = CheckoutSession & {
551
600
  idempotencyKey: string;
552
601
  };
602
+ /** `POST /checkout-sessions/:id/confirm` body as sent (consents and language are optional). */
553
603
  type ConfirmCheckoutSessionRequest = z.input<typeof confirmCheckoutSessionInputSchema>;
554
604
  interface StorefrontClient {
605
+ /** The publishable key this client sends (public by design). */
555
606
  readonly publishableKey: string;
607
+ /** The resolved Storefront API base, ending in `/api/storefront/v1`. */
556
608
  readonly baseUrl: string;
557
609
  site: {
558
610
  get(opts?: RequestOptions): Promise<StorefrontSite>;
559
611
  };
560
612
  listings: {
561
- list(query?: Partial<StorefrontListingsQuery>, opts?: RequestOptions): Promise<Page<StorefrontListingSummary>>;
613
+ /**
614
+ * The site's listings, filtered and sorted. `facets: true` adds the filters sheet's
615
+ * `facets` (one more query on the API).
616
+ */
617
+ list(query?: StorefrontListingsQuery, opts?: RequestOptions): Promise<Page<StorefrontListingSummary> & {
618
+ facets?: StorefrontListingFacets;
619
+ }>;
562
620
  get(id: string, opts?: RequestOptions): Promise<StorefrontListing>;
563
621
  };
564
622
  buildings: {
565
623
  list(opts?: RequestOptions): Promise<StorefrontBuilding[]>;
566
624
  get(id: string, opts?: RequestOptions): Promise<StorefrontBuilding>;
625
+ /**
626
+ * Every unit of the building for one stay — status, stay total and the next free window of the
627
+ * same length — in one call. Display only: read from the synced calendar, and the total is the
628
+ * nightly rates plus the cleaning fee, before taxes. `quotes.create` gives the bookable price.
629
+ * Pages like `listings.list` (`limit` 1–100, default 50).
630
+ */
631
+ availability(id: string, query: StorefrontStay & Partial<Pick<StorefrontBuildingAvailabilityQuery, 'limit' | 'offset'>>, opts?: RequestOptions): Promise<Page<StorefrontUnitAvailability>>;
567
632
  };
568
633
  locations: {
569
634
  list(opts?: RequestOptions): Promise<StorefrontLocation[]>;
570
635
  };
636
+ /**
637
+ * "Things to do": the guest-portal guide lists the manager shows on booking sites, with their
638
+ * places, in the client's `locale` (English fallback). Lists with no place are left out.
639
+ */
571
640
  guides: {
572
641
  list(opts?: RequestOptions): Promise<StorefrontGuide[]>;
642
+ /** By id; null when the site does not show that list. */
573
643
  get(id: string, opts?: RequestOptions): Promise<StorefrontGuide | null>;
574
644
  };
645
+ /** The site's content model as its code declared it (hidden types and fields left out). */
575
646
  contentModel: {
576
647
  get(opts?: RequestOptions): Promise<StorefrontContentModel>;
577
648
  };
649
+ /**
650
+ * Items of a collection the site declares (`defineContent`): published ones only, dated up to
651
+ * now, in the collection's order. `createContentReader` gives the typed version.
652
+ */
578
653
  collections: {
579
654
  list(key: string, query?: ContentListQuery, opts?: RequestOptions): Promise<Page<StorefrontContentItem>>;
655
+ /** By slug or id; null when there is none published (a draft, a future post, a typo). */
580
656
  get(key: string, slugOrId: string, opts?: RequestOptions): Promise<StorefrontContentItem | null>;
581
657
  };
658
+ /** A page section's one item. A section nobody filled in yet has `fields: {}`. */
582
659
  sections: {
583
660
  get(key: string, opts?: RequestOptions): Promise<StorefrontContentItem>;
584
661
  };
@@ -600,7 +677,17 @@ interface StorefrontClient {
600
677
  checkoutSessions: {
601
678
  create(input: CreateCheckoutSessionInput, opts?: CreateCheckoutSessionOptions): Promise<CreatedCheckoutSession>;
602
679
  get(id: string, opts?: RequestOptions): Promise<CheckoutSession>;
680
+ /**
681
+ * Drop the kept Idempotency-Key for this quote + rate plan; the next `create` opens a new
682
+ * session and a new payment hold. Never call it after a `failed` session or booking result:
683
+ * the guest may already have been charged, and a new session would take a second payment.
684
+ */
603
685
  forget(quoteRef: string, ratePlanId?: string): void;
686
+ /**
687
+ * Idempotent on the session: a double submit or a second tab gets the same booking. A
688
+ * confirm error that ends the session (`session_expired`, or `requiresNewSession`) releases
689
+ * the quote's key, so the next `create` opens a new session. A `failed` result does not.
690
+ */
604
691
  confirm(id: string, input: ConfirmCheckoutSessionRequest, opts?: RequestOptions): Promise<BookingResult>;
605
692
  };
606
693
  bookings: {
@@ -610,6 +697,7 @@ interface StorefrontClient {
610
697
  create(input: StorefrontContactInput, opts?: RequestOptions): Promise<void>;
611
698
  };
612
699
  }
700
+ /** A typed client for one site's Storefront API, bound to its publishable key. */
613
701
  declare function createStorefrontClient(options: StorefrontClientOptions): StorefrontClient;
614
702
 
615
- export { type StorefrontReview as A, type BookingResult as B, type CheckoutMountDescriptor as C, type StorefrontReviewsQuery as D, type StorefrontSite as E, createStorefrontClient as F, 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 StorefrontGuide as q, type StorefrontGuideItem as r, type StorefrontImage as s, type StorefrontListing as t, type StorefrontListingSummary as u, type StorefrontListingsQuery as v, type StorefrontLocation as w, type StorefrontQuote as x, type StorefrontQuoteInput as y, type StorefrontRatePlanQuote as z };
703
+ export { type StorefrontQuoteInput as A, type BookingResult as B, type CheckoutMountDescriptor as C, type StorefrontRatePlanQuote as D, type StorefrontReview as E, type StorefrontReviewsQuery as F, type StorefrontSite as G, createStorefrontClient as H, 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 StorefrontGuide as q, type StorefrontGuideItem as r, type StorefrontImage as s, type StorefrontListing as t, type StorefrontListingFacets as u, type StorefrontListingSort as v, type StorefrontListingSummary as w, type StorefrontListingsQuery as x, type StorefrontLocation as y, type StorefrontQuote as z };