@suiteop/storefront 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/astro-content-model.cjs +3 -3
- package/dist/astro-content-model.js +2 -2
- package/dist/chunk-A43EXKPY.js +3 -0
- package/dist/{chunk-HLGSWF4I.js → chunk-BFUMJBZV.js} +2 -2
- package/dist/chunk-EVSAMV5K.cjs +8 -0
- package/dist/{chunk-KKJCPKPY.js → chunk-IBIDIWTI.js} +1 -1
- package/dist/{chunk-2U6L33AT.cjs → chunk-PUY7GWID.cjs} +2 -2
- package/dist/{chunk-ZHFZ6II2.cjs → chunk-W4VKQWXY.cjs} +2 -2
- package/dist/chunk-WNCQ6YBT.cjs +18 -0
- package/dist/chunk-Y6INA5K7.js +5 -0
- package/dist/{client-goQnVoLP.d.ts → client-CdsTfFv7.d.ts} +13 -7
- package/dist/{client-DER7y1WE.d.cts → client-CmoApA__.d.cts} +13 -7
- package/dist/components.cjs +2 -1
- package/dist/components.d.cts +5 -2
- package/dist/components.d.ts +5 -2
- package/dist/components.js +2 -1
- package/dist/content.cjs +9 -9
- package/dist/content.d.cts +2 -2
- package/dist/content.d.ts +2 -2
- package/dist/content.js +2 -2
- package/dist/{errors-D-dULpp1.d.ts → errors-Ct7uJn5o.d.ts} +1 -1
- package/dist/{errors-B2eCo5Cz.d.cts → errors-LMVeW29z.d.cts} +1 -1
- package/dist/index.cjs +28 -11
- package/dist/index.d.cts +14 -4
- package/dist/index.d.ts +14 -4
- package/dist/index.js +3 -2
- package/dist/react.cjs +3 -3
- package/dist/react.d.cts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-4GZBXKBU.cjs +0 -18
- package/dist/chunk-GJSCEBSU.js +0 -5
|
@@ -78,6 +78,13 @@ declare const storefrontListingSummarySchema: z.ZodObject<{
|
|
|
78
78
|
bookable: z.ZodBoolean;
|
|
79
79
|
}, z.core.$strip>;
|
|
80
80
|
type StorefrontListingSummary = z.infer<typeof storefrontListingSummarySchema>;
|
|
81
|
+
declare const storefrontImageSchema: z.ZodObject<{
|
|
82
|
+
url: z.ZodString;
|
|
83
|
+
alt: z.ZodNullable<z.ZodString>;
|
|
84
|
+
width: z.ZodNullable<z.ZodNumber>;
|
|
85
|
+
height: z.ZodNullable<z.ZodNumber>;
|
|
86
|
+
}, z.core.$strip>;
|
|
87
|
+
type StorefrontImage = z.infer<typeof storefrontImageSchema>;
|
|
81
88
|
declare const storefrontListingSchema: z.ZodObject<{
|
|
82
89
|
id: z.ZodUUID;
|
|
83
90
|
buildingId: z.ZodUUID;
|
|
@@ -98,6 +105,12 @@ declare const storefrontListingSchema: z.ZodObject<{
|
|
|
98
105
|
description: z.ZodNullable<z.ZodString>;
|
|
99
106
|
amenities: z.ZodArray<z.ZodString>;
|
|
100
107
|
pictures: z.ZodUnknown;
|
|
108
|
+
images: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
109
|
+
url: z.ZodString;
|
|
110
|
+
alt: z.ZodNullable<z.ZodString>;
|
|
111
|
+
width: z.ZodNullable<z.ZodNumber>;
|
|
112
|
+
height: z.ZodNullable<z.ZodNumber>;
|
|
113
|
+
}, z.core.$strip>>>;
|
|
101
114
|
rooms: z.ZodUnknown;
|
|
102
115
|
houseRules: z.ZodNullable<z.ZodString>;
|
|
103
116
|
checkInTime: z.ZodNullable<z.ZodString>;
|
|
@@ -115,13 +128,6 @@ declare const storefrontListingsQuerySchema: z.ZodObject<{
|
|
|
115
128
|
offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
116
129
|
}, z.core.$strip>;
|
|
117
130
|
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>;
|
|
125
131
|
declare const storefrontBuildingSchema: z.ZodObject<{
|
|
126
132
|
id: z.ZodUUID;
|
|
127
133
|
locationId: z.ZodNullable<z.ZodUUID>;
|
|
@@ -78,6 +78,13 @@ declare const storefrontListingSummarySchema: z.ZodObject<{
|
|
|
78
78
|
bookable: z.ZodBoolean;
|
|
79
79
|
}, z.core.$strip>;
|
|
80
80
|
type StorefrontListingSummary = z.infer<typeof storefrontListingSummarySchema>;
|
|
81
|
+
declare const storefrontImageSchema: z.ZodObject<{
|
|
82
|
+
url: z.ZodString;
|
|
83
|
+
alt: z.ZodNullable<z.ZodString>;
|
|
84
|
+
width: z.ZodNullable<z.ZodNumber>;
|
|
85
|
+
height: z.ZodNullable<z.ZodNumber>;
|
|
86
|
+
}, z.core.$strip>;
|
|
87
|
+
type StorefrontImage = z.infer<typeof storefrontImageSchema>;
|
|
81
88
|
declare const storefrontListingSchema: z.ZodObject<{
|
|
82
89
|
id: z.ZodUUID;
|
|
83
90
|
buildingId: z.ZodUUID;
|
|
@@ -98,6 +105,12 @@ declare const storefrontListingSchema: z.ZodObject<{
|
|
|
98
105
|
description: z.ZodNullable<z.ZodString>;
|
|
99
106
|
amenities: z.ZodArray<z.ZodString>;
|
|
100
107
|
pictures: z.ZodUnknown;
|
|
108
|
+
images: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
109
|
+
url: z.ZodString;
|
|
110
|
+
alt: z.ZodNullable<z.ZodString>;
|
|
111
|
+
width: z.ZodNullable<z.ZodNumber>;
|
|
112
|
+
height: z.ZodNullable<z.ZodNumber>;
|
|
113
|
+
}, z.core.$strip>>>;
|
|
101
114
|
rooms: z.ZodUnknown;
|
|
102
115
|
houseRules: z.ZodNullable<z.ZodString>;
|
|
103
116
|
checkInTime: z.ZodNullable<z.ZodString>;
|
|
@@ -115,13 +128,6 @@ declare const storefrontListingsQuerySchema: z.ZodObject<{
|
|
|
115
128
|
offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
116
129
|
}, z.core.$strip>;
|
|
117
130
|
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>;
|
|
125
131
|
declare const storefrontBuildingSchema: z.ZodObject<{
|
|
126
132
|
id: z.ZodUUID;
|
|
127
133
|
locationId: z.ZodNullable<z.ZodUUID>;
|
package/dist/components.cjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var chunkEVSAMV5K_cjs = require('./chunk-EVSAMV5K.cjs');
|
|
3
4
|
var chunkLVFRVNT3_cjs = require('./chunk-LVFRVNT3.cjs');
|
|
4
5
|
var react = require('react');
|
|
5
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
7
|
|
|
7
|
-
var monthFormat=new Intl.DateTimeFormat("en-US",{month:"long",year:"numeric",timeZone:"UTC"});var dayFormat=new Intl.DateTimeFormat("en-US",{dateStyle:"full",timeZone:"UTC"});var WEEKDAYS=["Su","Mo","Tu","We","Th","Fr","Sa"];var utc=isoDate=>new Date(`${isoDate}T00:00:00Z`);var defaultLabels={dateRangePicker:{month:monthStart=>monthFormat.format(utc(monthStart)),weekday:dayIndex=>WEEKDAYS[dayIndex]??"",day:date=>dayFormat.format(utc(date)),previousMonth:"Previous month",nextMonth:"Next month"},guestPicker:{adults:"Adults",children:"Children",increment:field=>`Add ${field}`,decrement:field=>`Remove ${field}`},gallery:{region:"Photos",photo:(index,total)=>`Photo ${index+1} of ${total}`,previous:"Previous photo",next:"Next photo"}};function unavailableDates(days){return days.filter(d=>d.status!=="available").map(d=>d.date)}var DAY_MS=864e5;var toTime=date=>Date.parse(`${date}T00:00:00Z`);var fromTime=time=>new Date(time).toISOString().slice(0,10);var addDays=(date,days)=>fromTime(toTime(date)+days*DAY_MS);var monthOf=date=>`${date.slice(0,7)}-01`;function addMonths(monthStart,months){const d=new Date(toTime(monthStart));d.setUTCMonth(d.getUTCMonth()+months,1);return fromTime(d.getTime())}function localToday(){const now=new Date;const pad=n=>String(n).padStart(2,"0");return `${now.getFullYear()}-${pad(now.getMonth()+1)}-${pad(now.getDate())}`}function monthWeeks(monthStart,weekStartsOn){const lead=(new Date(toTime(monthStart)).getUTCDay()-weekStartsOn+7)%7;const next=addMonths(monthStart,1);const cells=Array.from({length:lead},()=>null);for(let d=monthStart;d<next;d=addDays(d,1))cells.push(d);while(cells.length%7)cells.push(null);return Array.from({length:cells.length/7},(_,w)=>cells.slice(w*7,w*7+7))}function DateRangePicker({value,onChange,unavailable,minNights=1,today:todayProp,defaultMonth,weekStartsOn=0,labels:labelsProp,className,classNames={}}){const labels={...defaultLabels.dateRangePicker,...labelsProp};const today=todayProp??localToday();const blocked=react.useMemo(()=>new Set(unavailable??[]),[unavailable]);const[focused,setFocused]=react.useState(()=>value.checkIn??today);const[month,setMonth]=react.useState(()=>defaultMonth?`${defaultMonth}-01`:monthOf(value.checkIn??today));const[shownCheckIn,setShownCheckIn]=react.useState(value.checkIn);if(value.checkIn!==shownCheckIn){setShownCheckIn(value.checkIn);if(value.checkIn!==null){setFocused(value.checkIn);setMonth(monthOf(value.checkIn));}}const grid=react.useRef(null);const moveFocus=react.useRef(false);react.useEffect(()=>{if(!moveFocus.current)return;moveFocus.current=false;grid.current?.querySelector(`[data-date="${focused}"]`)?.focus();},[focused,month]);const{checkIn,checkOut}=value;const pickingEnd=checkIn!==null&&checkOut===null;const nightFree=d=>d>=today&&!blocked.has(d);const validEnd=d=>{if(checkIn===null||d<=checkIn)return false;if((toTime(d)-toTime(checkIn))/DAY_MS<minNights)return false;for(let n=checkIn;n<d;n=addDays(n,1))if(!nightFree(n))return false;return true};const disabled=d=>pickingEnd&&checkIn!==null&&d>checkIn?!validEnd(d):!nightFree(d);function select(d){if(disabled(d))return;onChange(pickingEnd&&checkIn!==null&&d>checkIn?{checkIn,checkOut:d}:{checkIn:d,checkOut:null});}function stateOf(d){if(d===checkIn)return "start";if(d===checkOut)return "end";if(checkIn!==null&&checkOut!==null&&d>checkIn&&d<checkOut)return "in-range";return disabled(d)?"disabled":"available"}function focusDate(d){moveFocus.current=true;setFocused(d);setMonth(monthOf(d));}function onKeyDown(event,d){const step={ArrowLeft:-1,ArrowRight:1,ArrowUp:-7,ArrowDown:7}[event.key];if(step!==void 0){event.preventDefault();focusDate(addDays(d,step));}else if(event.key==="Enter"||event.key===" "){event.preventDefault();select(d);}}const tabStop=monthOf(focused)===month?focused:month;const weekdays=Array.from({length:7},(_,i)=>(i+weekStartsOn)%7);return jsxRuntime.jsxs("div",{className,children:[jsxRuntime.jsxs("div",{className:classNames.header,children:[jsxRuntime.jsx("button",{type:"button",className:classNames.nav,"aria-label":labels.previousMonth,onClick:()=>setMonth(addMonths(month,-1)),children:"\u2039"}),jsxRuntime.jsx("span",{className:classNames.title,"aria-live":"polite",children:labels.month(month)}),jsxRuntime.jsx("button",{type:"button",className:classNames.nav,"aria-label":labels.nextMonth,onClick:()=>setMonth(addMonths(month,1)),children:"\u203A"})]}),jsxRuntime.jsxs("table",{role:"grid","aria-label":labels.month(month),className:classNames.grid,ref:grid,children:[jsxRuntime.jsx("thead",{children:jsxRuntime.jsx("tr",{children:weekdays.map(i=>jsxRuntime.jsx("th",{scope:"col",className:classNames.weekday,children:labels.weekday(i)},i))})}),jsxRuntime.jsx("tbody",{children:monthWeeks(month,weekStartsOn).map((week,w)=>jsxRuntime.jsx("tr",{children:week.map((d,i)=>{if(d===null)return jsxRuntime.jsx("td",{role:"gridcell"},`pad-${i}`);const state=stateOf(d);return jsxRuntime.jsx("td",{role:"gridcell","data-date":d,"data-state":state,"data-today":d===today?"":void 0,className:classNames.day,tabIndex:d===tabStop?0:-1,"aria-label":labels.day(d),"aria-selected":state==="start"||state==="end"||state==="in-range","aria-disabled":disabled(d)||void 0,onClick:()=>select(d),onKeyDown:event=>onKeyDown(event,d),onFocus:()=>setFocused(d),children:Number(d.slice(8))},d)})},w))})]})]})}function isRecord(value){return typeof value==="object"&&value!==null}var firstString=(record,keys)=>keys.map(k=>record[k]).find(v=>typeof v==="string"&&v.length>0);function listingPhotos(pictures){if(!Array.isArray(pictures))return [];return pictures.flatMap(picture=>{if(typeof picture==="string")return picture?[{url:picture,caption:null}]:[];if(!isRecord(picture))return [];const url=firstString(picture,["original","url","large","regular","original_path","image_path","thumbnail","thumbnail_path"]);if(!url)return [];return [{url,caption:firstString(picture,["caption","description"])??null}]})}function Gallery({photos,onIndexChange,labels:labelsProp,className,classNames={}}){const labels={...defaultLabels.gallery,...labelsProp};const[index,setIndex]=react.useState(0);const total=photos.length;const current=Math.min(index,Math.max(0,total-1));const go=next=>{if(next<0||next>=total||next===current)return;setIndex(next);onIndexChange?.(next);};const onKeyDown=event=>{if(event.key==="ArrowLeft")go(current-1);else if(event.key==="ArrowRight")go(current+1);};return jsxRuntime.jsxs("section",{role:"region","aria-roledescription":"carousel","aria-label":labels.region,className,onKeyDown,children:[jsxRuntime.jsx("div",{className:classNames.viewport,"aria-live":"polite",children:photos.map((photo,i)=>jsxRuntime.jsx("div",{role:"group","aria-roledescription":"slide","aria-label":labels.photo(i,total),"data-state":i===current?"active":"inactive",hidden:i!==current,className:classNames.slide,children:jsxRuntime.jsx("img",{src:photo.url,alt:photo.caption||labels.photo(i,total),loading:i===0?"eager":"lazy",decoding:"async",className:classNames.image})},`${i}-${photo.url}`))}),jsxRuntime.jsx("button",{type:"button",className:classNames.button,"aria-label":labels.previous,disabled:current===0,onClick:()=>go(current-1),children:"\u2039"}),jsxRuntime.jsx("button",{type:"button",className:classNames.button,"aria-label":labels.next,disabled:current>=total-1,onClick:()=>go(current+1),children:"\u203A"})]})}function GuestPicker({value,onChange,max=chunkLVFRVNT3_cjs.STOREFRONT_MAX_GUESTS,labels:labelsProp,className,classNames={}}){const labels={...defaultLabels.guestPicker,...labelsProp};const id=react.useId();const fields=[{key:"adults",label:labels.adults,min:1,max:Math.max(value.adults,max-value.children)},{key:"children",label:labels.children,min:0,max:Math.max(value.children,max-value.adults)}];return jsxRuntime.jsx("div",{className,children:fields.map(field=>{const now=value[field.key];const set=next=>{const clamped=Math.min(field.max,Math.max(field.min,next));if(clamped!==now)onChange({...value,[field.key]:clamped});};const onKeyDown=event=>{const next={ArrowUp:now+1,ArrowRight:now+1,ArrowDown:now-1,ArrowLeft:now-1,Home:field.min,End:field.max}[event.key];if(next===void 0)return;event.preventDefault();set(next);};const labelId=`${id}-${field.key}`;return jsxRuntime.jsxs("div",{className:classNames.field,"data-field":field.key,children:[jsxRuntime.jsx("span",{id:labelId,className:classNames.label,children:field.label}),jsxRuntime.jsx("button",{type:"button",className:classNames.button,"aria-label":labels.decrement(field.label),disabled:now<=field.min,onClick:()=>set(now-1),children:"\u2212"}),jsxRuntime.jsx("div",{role:"spinbutton",tabIndex:0,className:classNames.value,"aria-labelledby":labelId,"aria-valuenow":now,"aria-valuemin":field.min,"aria-valuemax":field.max,onKeyDown,children:now}),jsxRuntime.jsx("button",{type:"button",className:classNames.button,"aria-label":labels.increment(field.label),disabled:now>=field.max,onClick:()=>set(now+1),children:"+"})]},field.key)})})}var usable=(lat,lng)=>typeof lat==="number"&&typeof lng==="number"&&Number.isFinite(lat)&&Number.isFinite(lng)&&Math.abs(lat)<=90&&Math.abs(lng)<=180;function Map({listings,children}){const markers=[];for(const listing of listings){if(usable(listing.latitude,listing.longitude)){markers.push({id:listing.id,lat:listing.latitude,lng:listing.longitude,listing});}}const bounds=markers.length===0?null:{north:Math.max(...markers.map(m=>m.lat)),south:Math.min(...markers.map(m=>m.lat)),east:Math.max(...markers.map(m=>m.lng)),west:Math.min(...markers.map(m=>m.lng))};return jsxRuntime.jsx(jsxRuntime.Fragment,{children:children({markers,bounds})})}
|
|
8
|
+
var monthFormat=new Intl.DateTimeFormat("en-US",{month:"long",year:"numeric",timeZone:"UTC"});var dayFormat=new Intl.DateTimeFormat("en-US",{dateStyle:"full",timeZone:"UTC"});var WEEKDAYS=["Su","Mo","Tu","We","Th","Fr","Sa"];var utc=isoDate=>new Date(`${isoDate}T00:00:00Z`);var defaultLabels={dateRangePicker:{month:monthStart=>monthFormat.format(utc(monthStart)),weekday:dayIndex=>WEEKDAYS[dayIndex]??"",day:date=>dayFormat.format(utc(date)),previousMonth:"Previous month",nextMonth:"Next month"},guestPicker:{adults:"Adults",children:"Children",increment:field=>`Add ${field}`,decrement:field=>`Remove ${field}`},gallery:{region:"Photos",photo:(index,total)=>`Photo ${index+1} of ${total}`,previous:"Previous photo",next:"Next photo"}};function unavailableDates(days){return days.filter(d=>d.status!=="available").map(d=>d.date)}var DAY_MS=864e5;var toTime=date=>Date.parse(`${date}T00:00:00Z`);var fromTime=time=>new Date(time).toISOString().slice(0,10);var addDays=(date,days)=>fromTime(toTime(date)+days*DAY_MS);var monthOf=date=>`${date.slice(0,7)}-01`;function addMonths(monthStart,months){const d=new Date(toTime(monthStart));d.setUTCMonth(d.getUTCMonth()+months,1);return fromTime(d.getTime())}function localToday(){const now=new Date;const pad=n=>String(n).padStart(2,"0");return `${now.getFullYear()}-${pad(now.getMonth()+1)}-${pad(now.getDate())}`}function monthWeeks(monthStart,weekStartsOn){const lead=(new Date(toTime(monthStart)).getUTCDay()-weekStartsOn+7)%7;const next=addMonths(monthStart,1);const cells=Array.from({length:lead},()=>null);for(let d=monthStart;d<next;d=addDays(d,1))cells.push(d);while(cells.length%7)cells.push(null);return Array.from({length:cells.length/7},(_,w)=>cells.slice(w*7,w*7+7))}function DateRangePicker({value,onChange,unavailable,minNights=1,today:todayProp,defaultMonth,weekStartsOn=0,labels:labelsProp,className,classNames={}}){const labels={...defaultLabels.dateRangePicker,...labelsProp};const today=todayProp??localToday();const blocked=react.useMemo(()=>new Set(unavailable??[]),[unavailable]);const[focused,setFocused]=react.useState(()=>value.checkIn??today);const[month,setMonth]=react.useState(()=>defaultMonth?`${defaultMonth}-01`:monthOf(value.checkIn??today));const[shownCheckIn,setShownCheckIn]=react.useState(value.checkIn);if(value.checkIn!==shownCheckIn){setShownCheckIn(value.checkIn);if(value.checkIn!==null){setFocused(value.checkIn);setMonth(monthOf(value.checkIn));}}const grid=react.useRef(null);const moveFocus=react.useRef(false);react.useEffect(()=>{if(!moveFocus.current)return;moveFocus.current=false;grid.current?.querySelector(`[data-date="${focused}"]`)?.focus();},[focused,month]);const{checkIn,checkOut}=value;const pickingEnd=checkIn!==null&&checkOut===null;const nightFree=d=>d>=today&&!blocked.has(d);const validEnd=d=>{if(checkIn===null||d<=checkIn)return false;if((toTime(d)-toTime(checkIn))/DAY_MS<minNights)return false;for(let n=checkIn;n<d;n=addDays(n,1))if(!nightFree(n))return false;return true};const disabled=d=>pickingEnd&&checkIn!==null&&d>checkIn?!validEnd(d):!nightFree(d);function select(d){if(disabled(d))return;onChange(pickingEnd&&checkIn!==null&&d>checkIn?{checkIn,checkOut:d}:{checkIn:d,checkOut:null});}function stateOf(d){if(d===checkIn)return "start";if(d===checkOut)return "end";if(checkIn!==null&&checkOut!==null&&d>checkIn&&d<checkOut)return "in-range";return disabled(d)?"disabled":"available"}function focusDate(d){moveFocus.current=true;setFocused(d);setMonth(monthOf(d));}function onKeyDown(event,d){const step={ArrowLeft:-1,ArrowRight:1,ArrowUp:-7,ArrowDown:7}[event.key];if(step!==void 0){event.preventDefault();focusDate(addDays(d,step));}else if(event.key==="Enter"||event.key===" "){event.preventDefault();select(d);}}const tabStop=monthOf(focused)===month?focused:month;const weekdays=Array.from({length:7},(_,i)=>(i+weekStartsOn)%7);return jsxRuntime.jsxs("div",{className,children:[jsxRuntime.jsxs("div",{className:classNames.header,children:[jsxRuntime.jsx("button",{type:"button",className:classNames.nav,"aria-label":labels.previousMonth,onClick:()=>setMonth(addMonths(month,-1)),children:"\u2039"}),jsxRuntime.jsx("span",{className:classNames.title,"aria-live":"polite",children:labels.month(month)}),jsxRuntime.jsx("button",{type:"button",className:classNames.nav,"aria-label":labels.nextMonth,onClick:()=>setMonth(addMonths(month,1)),children:"\u203A"})]}),jsxRuntime.jsxs("table",{role:"grid","aria-label":labels.month(month),className:classNames.grid,ref:grid,children:[jsxRuntime.jsx("thead",{children:jsxRuntime.jsx("tr",{children:weekdays.map(i=>jsxRuntime.jsx("th",{scope:"col",className:classNames.weekday,children:labels.weekday(i)},i))})}),jsxRuntime.jsx("tbody",{children:monthWeeks(month,weekStartsOn).map((week,w)=>jsxRuntime.jsx("tr",{children:week.map((d,i)=>{if(d===null)return jsxRuntime.jsx("td",{role:"gridcell"},`pad-${i}`);const state=stateOf(d);return jsxRuntime.jsx("td",{role:"gridcell","data-date":d,"data-state":state,"data-today":d===today?"":void 0,className:classNames.day,tabIndex:d===tabStop?0:-1,"aria-label":labels.day(d),"aria-selected":state==="start"||state==="end"||state==="in-range","aria-disabled":disabled(d)||void 0,onClick:()=>select(d),onKeyDown:event=>onKeyDown(event,d),onFocus:()=>setFocused(d),children:Number(d.slice(8))},d)})},w))})]})]})}function isRecord(value){return typeof value==="object"&&value!==null}var firstString=(record,keys)=>keys.map(k=>record[k]).find(v=>typeof v==="string"&&v.length>0);function listingPhotos(listingOrPictures){if(isRecord(listingOrPictures)&&!Array.isArray(listingOrPictures)){const{images,pictures:pictures2}=listingOrPictures;if(images?.length){return images.map(({url,alt,width,height})=>({url,caption:alt,width,height}))}return listingPhotos(pictures2)}const pictures=listingOrPictures;if(!Array.isArray(pictures))return [];return pictures.flatMap(picture=>{if(typeof picture==="string")return picture?[{url:picture,caption:null}]:[];if(!isRecord(picture))return [];const url=firstString(picture,["original","url","large","regular","original_path","image_path","thumbnail","thumbnail_path"]);if(!url)return [];return [{url,caption:firstString(picture,["caption","description"])??null}]})}function Gallery({photos,onIndexChange,labels:labelsProp,sizes="100vw",className,classNames={}}){const labels={...defaultLabels.gallery,...labelsProp};const[index,setIndex]=react.useState(0);const total=photos.length;const current=Math.min(index,Math.max(0,total-1));const go=next=>{if(next<0||next>=total||next===current)return;setIndex(next);onIndexChange?.(next);};const onKeyDown=event=>{if(event.key==="ArrowLeft")go(current-1);else if(event.key==="ArrowRight")go(current+1);};return jsxRuntime.jsxs("section",{role:"region","aria-roledescription":"carousel","aria-label":labels.region,className,onKeyDown,children:[jsxRuntime.jsx("div",{className:classNames.viewport,"aria-live":"polite",children:photos.map((photo,i)=>jsxRuntime.jsx("div",{role:"group","aria-roledescription":"slide","aria-label":labels.photo(i,total),"data-state":i===current?"active":"inactive",hidden:i!==current,className:classNames.slide,children:jsxRuntime.jsx("img",{...chunkEVSAMV5K_cjs.cdnImageProps(photo.url,1080,sizes),...photo.width&&photo.height?{width:photo.width,height:photo.height}:{},alt:photo.caption||labels.photo(i,total),loading:i===0?"eager":"lazy",decoding:"async",className:classNames.image})},`${i}-${photo.url}`))}),jsxRuntime.jsx("button",{type:"button",className:classNames.button,"aria-label":labels.previous,disabled:current===0,onClick:()=>go(current-1),children:"\u2039"}),jsxRuntime.jsx("button",{type:"button",className:classNames.button,"aria-label":labels.next,disabled:current>=total-1,onClick:()=>go(current+1),children:"\u203A"})]})}function GuestPicker({value,onChange,max=chunkLVFRVNT3_cjs.STOREFRONT_MAX_GUESTS,labels:labelsProp,className,classNames={}}){const labels={...defaultLabels.guestPicker,...labelsProp};const id=react.useId();const fields=[{key:"adults",label:labels.adults,min:1,max:Math.max(value.adults,max-value.children)},{key:"children",label:labels.children,min:0,max:Math.max(value.children,max-value.adults)}];return jsxRuntime.jsx("div",{className,children:fields.map(field=>{const now=value[field.key];const set=next=>{const clamped=Math.min(field.max,Math.max(field.min,next));if(clamped!==now)onChange({...value,[field.key]:clamped});};const onKeyDown=event=>{const next={ArrowUp:now+1,ArrowRight:now+1,ArrowDown:now-1,ArrowLeft:now-1,Home:field.min,End:field.max}[event.key];if(next===void 0)return;event.preventDefault();set(next);};const labelId=`${id}-${field.key}`;return jsxRuntime.jsxs("div",{className:classNames.field,"data-field":field.key,children:[jsxRuntime.jsx("span",{id:labelId,className:classNames.label,children:field.label}),jsxRuntime.jsx("button",{type:"button",className:classNames.button,"aria-label":labels.decrement(field.label),disabled:now<=field.min,onClick:()=>set(now-1),children:"\u2212"}),jsxRuntime.jsx("div",{role:"spinbutton",tabIndex:0,className:classNames.value,"aria-labelledby":labelId,"aria-valuenow":now,"aria-valuemin":field.min,"aria-valuemax":field.max,onKeyDown,children:now}),jsxRuntime.jsx("button",{type:"button",className:classNames.button,"aria-label":labels.increment(field.label),disabled:now>=field.max,onClick:()=>set(now+1),children:"+"})]},field.key)})})}var usable=(lat,lng)=>typeof lat==="number"&&typeof lng==="number"&&Number.isFinite(lat)&&Number.isFinite(lng)&&Math.abs(lat)<=90&&Math.abs(lng)<=180;function Map({listings,children}){const markers=[];for(const listing of listings){if(usable(listing.latitude,listing.longitude)){markers.push({id:listing.id,lat:listing.latitude,lng:listing.longitude,listing});}}const bounds=markers.length===0?null:{north:Math.max(...markers.map(m=>m.lat)),south:Math.min(...markers.map(m=>m.lat)),east:Math.max(...markers.map(m=>m.lng)),west:Math.min(...markers.map(m=>m.lng))};return jsxRuntime.jsx(jsxRuntime.Fragment,{children:children({markers,bounds})})}
|
|
8
9
|
|
|
9
10
|
exports.DateRangePicker = DateRangePicker;
|
|
10
11
|
exports.Gallery = Gallery;
|
package/dist/components.d.cts
CHANGED
|
@@ -51,17 +51,20 @@ declare function DateRangePicker({ value, onChange, unavailable, minNights, toda
|
|
|
51
51
|
interface GalleryPhoto {
|
|
52
52
|
url: string;
|
|
53
53
|
caption?: string | null;
|
|
54
|
+
width?: number | null;
|
|
55
|
+
height?: number | null;
|
|
54
56
|
}
|
|
55
57
|
type Slot$1 = 'viewport' | 'slide' | 'image' | 'button';
|
|
56
58
|
interface GalleryProps {
|
|
57
59
|
photos: readonly GalleryPhoto[];
|
|
58
60
|
onIndexChange?(index: number): void;
|
|
59
61
|
labels?: Partial<GalleryLabels>;
|
|
62
|
+
sizes?: string;
|
|
60
63
|
className?: string;
|
|
61
64
|
classNames?: Partial<Record<Slot$1, string>>;
|
|
62
65
|
}
|
|
63
|
-
declare function listingPhotos(
|
|
64
|
-
declare function Gallery({ photos, onIndexChange, labels: labelsProp, className, classNames, }: GalleryProps): react.JSX.Element;
|
|
66
|
+
declare function listingPhotos(listingOrPictures: unknown): GalleryPhoto[];
|
|
67
|
+
declare function Gallery({ photos, onIndexChange, labels: labelsProp, sizes, className, classNames, }: GalleryProps): react.JSX.Element;
|
|
65
68
|
|
|
66
69
|
interface GuestCounts {
|
|
67
70
|
adults: number;
|
package/dist/components.d.ts
CHANGED
|
@@ -51,17 +51,20 @@ declare function DateRangePicker({ value, onChange, unavailable, minNights, toda
|
|
|
51
51
|
interface GalleryPhoto {
|
|
52
52
|
url: string;
|
|
53
53
|
caption?: string | null;
|
|
54
|
+
width?: number | null;
|
|
55
|
+
height?: number | null;
|
|
54
56
|
}
|
|
55
57
|
type Slot$1 = 'viewport' | 'slide' | 'image' | 'button';
|
|
56
58
|
interface GalleryProps {
|
|
57
59
|
photos: readonly GalleryPhoto[];
|
|
58
60
|
onIndexChange?(index: number): void;
|
|
59
61
|
labels?: Partial<GalleryLabels>;
|
|
62
|
+
sizes?: string;
|
|
60
63
|
className?: string;
|
|
61
64
|
classNames?: Partial<Record<Slot$1, string>>;
|
|
62
65
|
}
|
|
63
|
-
declare function listingPhotos(
|
|
64
|
-
declare function Gallery({ photos, onIndexChange, labels: labelsProp, className, classNames, }: GalleryProps): react.JSX.Element;
|
|
66
|
+
declare function listingPhotos(listingOrPictures: unknown): GalleryPhoto[];
|
|
67
|
+
declare function Gallery({ photos, onIndexChange, labels: labelsProp, sizes, className, classNames, }: GalleryProps): react.JSX.Element;
|
|
65
68
|
|
|
66
69
|
interface GuestCounts {
|
|
67
70
|
adults: number;
|
package/dist/components.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { cdnImageProps } from './chunk-A43EXKPY.js';
|
|
1
2
|
import { STOREFRONT_MAX_GUESTS } from './chunk-6NFURJXI.js';
|
|
2
3
|
import { useMemo, useState, useRef, useEffect, useId } from 'react';
|
|
3
4
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
4
5
|
|
|
5
|
-
var monthFormat=new Intl.DateTimeFormat("en-US",{month:"long",year:"numeric",timeZone:"UTC"});var dayFormat=new Intl.DateTimeFormat("en-US",{dateStyle:"full",timeZone:"UTC"});var WEEKDAYS=["Su","Mo","Tu","We","Th","Fr","Sa"];var utc=isoDate=>new Date(`${isoDate}T00:00:00Z`);var defaultLabels={dateRangePicker:{month:monthStart=>monthFormat.format(utc(monthStart)),weekday:dayIndex=>WEEKDAYS[dayIndex]??"",day:date=>dayFormat.format(utc(date)),previousMonth:"Previous month",nextMonth:"Next month"},guestPicker:{adults:"Adults",children:"Children",increment:field=>`Add ${field}`,decrement:field=>`Remove ${field}`},gallery:{region:"Photos",photo:(index,total)=>`Photo ${index+1} of ${total}`,previous:"Previous photo",next:"Next photo"}};function unavailableDates(days){return days.filter(d=>d.status!=="available").map(d=>d.date)}var DAY_MS=864e5;var toTime=date=>Date.parse(`${date}T00:00:00Z`);var fromTime=time=>new Date(time).toISOString().slice(0,10);var addDays=(date,days)=>fromTime(toTime(date)+days*DAY_MS);var monthOf=date=>`${date.slice(0,7)}-01`;function addMonths(monthStart,months){const d=new Date(toTime(monthStart));d.setUTCMonth(d.getUTCMonth()+months,1);return fromTime(d.getTime())}function localToday(){const now=new Date;const pad=n=>String(n).padStart(2,"0");return `${now.getFullYear()}-${pad(now.getMonth()+1)}-${pad(now.getDate())}`}function monthWeeks(monthStart,weekStartsOn){const lead=(new Date(toTime(monthStart)).getUTCDay()-weekStartsOn+7)%7;const next=addMonths(monthStart,1);const cells=Array.from({length:lead},()=>null);for(let d=monthStart;d<next;d=addDays(d,1))cells.push(d);while(cells.length%7)cells.push(null);return Array.from({length:cells.length/7},(_,w)=>cells.slice(w*7,w*7+7))}function DateRangePicker({value,onChange,unavailable,minNights=1,today:todayProp,defaultMonth,weekStartsOn=0,labels:labelsProp,className,classNames={}}){const labels={...defaultLabels.dateRangePicker,...labelsProp};const today=todayProp??localToday();const blocked=useMemo(()=>new Set(unavailable??[]),[unavailable]);const[focused,setFocused]=useState(()=>value.checkIn??today);const[month,setMonth]=useState(()=>defaultMonth?`${defaultMonth}-01`:monthOf(value.checkIn??today));const[shownCheckIn,setShownCheckIn]=useState(value.checkIn);if(value.checkIn!==shownCheckIn){setShownCheckIn(value.checkIn);if(value.checkIn!==null){setFocused(value.checkIn);setMonth(monthOf(value.checkIn));}}const grid=useRef(null);const moveFocus=useRef(false);useEffect(()=>{if(!moveFocus.current)return;moveFocus.current=false;grid.current?.querySelector(`[data-date="${focused}"]`)?.focus();},[focused,month]);const{checkIn,checkOut}=value;const pickingEnd=checkIn!==null&&checkOut===null;const nightFree=d=>d>=today&&!blocked.has(d);const validEnd=d=>{if(checkIn===null||d<=checkIn)return false;if((toTime(d)-toTime(checkIn))/DAY_MS<minNights)return false;for(let n=checkIn;n<d;n=addDays(n,1))if(!nightFree(n))return false;return true};const disabled=d=>pickingEnd&&checkIn!==null&&d>checkIn?!validEnd(d):!nightFree(d);function select(d){if(disabled(d))return;onChange(pickingEnd&&checkIn!==null&&d>checkIn?{checkIn,checkOut:d}:{checkIn:d,checkOut:null});}function stateOf(d){if(d===checkIn)return "start";if(d===checkOut)return "end";if(checkIn!==null&&checkOut!==null&&d>checkIn&&d<checkOut)return "in-range";return disabled(d)?"disabled":"available"}function focusDate(d){moveFocus.current=true;setFocused(d);setMonth(monthOf(d));}function onKeyDown(event,d){const step={ArrowLeft:-1,ArrowRight:1,ArrowUp:-7,ArrowDown:7}[event.key];if(step!==void 0){event.preventDefault();focusDate(addDays(d,step));}else if(event.key==="Enter"||event.key===" "){event.preventDefault();select(d);}}const tabStop=monthOf(focused)===month?focused:month;const weekdays=Array.from({length:7},(_,i)=>(i+weekStartsOn)%7);return jsxs("div",{className,children:[jsxs("div",{className:classNames.header,children:[jsx("button",{type:"button",className:classNames.nav,"aria-label":labels.previousMonth,onClick:()=>setMonth(addMonths(month,-1)),children:"\u2039"}),jsx("span",{className:classNames.title,"aria-live":"polite",children:labels.month(month)}),jsx("button",{type:"button",className:classNames.nav,"aria-label":labels.nextMonth,onClick:()=>setMonth(addMonths(month,1)),children:"\u203A"})]}),jsxs("table",{role:"grid","aria-label":labels.month(month),className:classNames.grid,ref:grid,children:[jsx("thead",{children:jsx("tr",{children:weekdays.map(i=>jsx("th",{scope:"col",className:classNames.weekday,children:labels.weekday(i)},i))})}),jsx("tbody",{children:monthWeeks(month,weekStartsOn).map((week,w)=>jsx("tr",{children:week.map((d,i)=>{if(d===null)return jsx("td",{role:"gridcell"},`pad-${i}`);const state=stateOf(d);return jsx("td",{role:"gridcell","data-date":d,"data-state":state,"data-today":d===today?"":void 0,className:classNames.day,tabIndex:d===tabStop?0:-1,"aria-label":labels.day(d),"aria-selected":state==="start"||state==="end"||state==="in-range","aria-disabled":disabled(d)||void 0,onClick:()=>select(d),onKeyDown:event=>onKeyDown(event,d),onFocus:()=>setFocused(d),children:Number(d.slice(8))},d)})},w))})]})]})}function isRecord(value){return typeof value==="object"&&value!==null}var firstString=(record,keys)=>keys.map(k=>record[k]).find(v=>typeof v==="string"&&v.length>0);function listingPhotos(pictures){if(!Array.isArray(pictures))return [];return pictures.flatMap(picture=>{if(typeof picture==="string")return picture?[{url:picture,caption:null}]:[];if(!isRecord(picture))return [];const url=firstString(picture,["original","url","large","regular","original_path","image_path","thumbnail","thumbnail_path"]);if(!url)return [];return [{url,caption:firstString(picture,["caption","description"])??null}]})}function Gallery({photos,onIndexChange,labels:labelsProp,className,classNames={}}){const labels={...defaultLabels.gallery,...labelsProp};const[index,setIndex]=useState(0);const total=photos.length;const current=Math.min(index,Math.max(0,total-1));const go=next=>{if(next<0||next>=total||next===current)return;setIndex(next);onIndexChange?.(next);};const onKeyDown=event=>{if(event.key==="ArrowLeft")go(current-1);else if(event.key==="ArrowRight")go(current+1);};return jsxs("section",{role:"region","aria-roledescription":"carousel","aria-label":labels.region,className,onKeyDown,children:[jsx("div",{className:classNames.viewport,"aria-live":"polite",children:photos.map((photo,i)=>jsx("div",{role:"group","aria-roledescription":"slide","aria-label":labels.photo(i,total),"data-state":i===current?"active":"inactive",hidden:i!==current,className:classNames.slide,children:jsx("img",{
|
|
6
|
+
var monthFormat=new Intl.DateTimeFormat("en-US",{month:"long",year:"numeric",timeZone:"UTC"});var dayFormat=new Intl.DateTimeFormat("en-US",{dateStyle:"full",timeZone:"UTC"});var WEEKDAYS=["Su","Mo","Tu","We","Th","Fr","Sa"];var utc=isoDate=>new Date(`${isoDate}T00:00:00Z`);var defaultLabels={dateRangePicker:{month:monthStart=>monthFormat.format(utc(monthStart)),weekday:dayIndex=>WEEKDAYS[dayIndex]??"",day:date=>dayFormat.format(utc(date)),previousMonth:"Previous month",nextMonth:"Next month"},guestPicker:{adults:"Adults",children:"Children",increment:field=>`Add ${field}`,decrement:field=>`Remove ${field}`},gallery:{region:"Photos",photo:(index,total)=>`Photo ${index+1} of ${total}`,previous:"Previous photo",next:"Next photo"}};function unavailableDates(days){return days.filter(d=>d.status!=="available").map(d=>d.date)}var DAY_MS=864e5;var toTime=date=>Date.parse(`${date}T00:00:00Z`);var fromTime=time=>new Date(time).toISOString().slice(0,10);var addDays=(date,days)=>fromTime(toTime(date)+days*DAY_MS);var monthOf=date=>`${date.slice(0,7)}-01`;function addMonths(monthStart,months){const d=new Date(toTime(monthStart));d.setUTCMonth(d.getUTCMonth()+months,1);return fromTime(d.getTime())}function localToday(){const now=new Date;const pad=n=>String(n).padStart(2,"0");return `${now.getFullYear()}-${pad(now.getMonth()+1)}-${pad(now.getDate())}`}function monthWeeks(monthStart,weekStartsOn){const lead=(new Date(toTime(monthStart)).getUTCDay()-weekStartsOn+7)%7;const next=addMonths(monthStart,1);const cells=Array.from({length:lead},()=>null);for(let d=monthStart;d<next;d=addDays(d,1))cells.push(d);while(cells.length%7)cells.push(null);return Array.from({length:cells.length/7},(_,w)=>cells.slice(w*7,w*7+7))}function DateRangePicker({value,onChange,unavailable,minNights=1,today:todayProp,defaultMonth,weekStartsOn=0,labels:labelsProp,className,classNames={}}){const labels={...defaultLabels.dateRangePicker,...labelsProp};const today=todayProp??localToday();const blocked=useMemo(()=>new Set(unavailable??[]),[unavailable]);const[focused,setFocused]=useState(()=>value.checkIn??today);const[month,setMonth]=useState(()=>defaultMonth?`${defaultMonth}-01`:monthOf(value.checkIn??today));const[shownCheckIn,setShownCheckIn]=useState(value.checkIn);if(value.checkIn!==shownCheckIn){setShownCheckIn(value.checkIn);if(value.checkIn!==null){setFocused(value.checkIn);setMonth(monthOf(value.checkIn));}}const grid=useRef(null);const moveFocus=useRef(false);useEffect(()=>{if(!moveFocus.current)return;moveFocus.current=false;grid.current?.querySelector(`[data-date="${focused}"]`)?.focus();},[focused,month]);const{checkIn,checkOut}=value;const pickingEnd=checkIn!==null&&checkOut===null;const nightFree=d=>d>=today&&!blocked.has(d);const validEnd=d=>{if(checkIn===null||d<=checkIn)return false;if((toTime(d)-toTime(checkIn))/DAY_MS<minNights)return false;for(let n=checkIn;n<d;n=addDays(n,1))if(!nightFree(n))return false;return true};const disabled=d=>pickingEnd&&checkIn!==null&&d>checkIn?!validEnd(d):!nightFree(d);function select(d){if(disabled(d))return;onChange(pickingEnd&&checkIn!==null&&d>checkIn?{checkIn,checkOut:d}:{checkIn:d,checkOut:null});}function stateOf(d){if(d===checkIn)return "start";if(d===checkOut)return "end";if(checkIn!==null&&checkOut!==null&&d>checkIn&&d<checkOut)return "in-range";return disabled(d)?"disabled":"available"}function focusDate(d){moveFocus.current=true;setFocused(d);setMonth(monthOf(d));}function onKeyDown(event,d){const step={ArrowLeft:-1,ArrowRight:1,ArrowUp:-7,ArrowDown:7}[event.key];if(step!==void 0){event.preventDefault();focusDate(addDays(d,step));}else if(event.key==="Enter"||event.key===" "){event.preventDefault();select(d);}}const tabStop=monthOf(focused)===month?focused:month;const weekdays=Array.from({length:7},(_,i)=>(i+weekStartsOn)%7);return jsxs("div",{className,children:[jsxs("div",{className:classNames.header,children:[jsx("button",{type:"button",className:classNames.nav,"aria-label":labels.previousMonth,onClick:()=>setMonth(addMonths(month,-1)),children:"\u2039"}),jsx("span",{className:classNames.title,"aria-live":"polite",children:labels.month(month)}),jsx("button",{type:"button",className:classNames.nav,"aria-label":labels.nextMonth,onClick:()=>setMonth(addMonths(month,1)),children:"\u203A"})]}),jsxs("table",{role:"grid","aria-label":labels.month(month),className:classNames.grid,ref:grid,children:[jsx("thead",{children:jsx("tr",{children:weekdays.map(i=>jsx("th",{scope:"col",className:classNames.weekday,children:labels.weekday(i)},i))})}),jsx("tbody",{children:monthWeeks(month,weekStartsOn).map((week,w)=>jsx("tr",{children:week.map((d,i)=>{if(d===null)return jsx("td",{role:"gridcell"},`pad-${i}`);const state=stateOf(d);return jsx("td",{role:"gridcell","data-date":d,"data-state":state,"data-today":d===today?"":void 0,className:classNames.day,tabIndex:d===tabStop?0:-1,"aria-label":labels.day(d),"aria-selected":state==="start"||state==="end"||state==="in-range","aria-disabled":disabled(d)||void 0,onClick:()=>select(d),onKeyDown:event=>onKeyDown(event,d),onFocus:()=>setFocused(d),children:Number(d.slice(8))},d)})},w))})]})]})}function isRecord(value){return typeof value==="object"&&value!==null}var firstString=(record,keys)=>keys.map(k=>record[k]).find(v=>typeof v==="string"&&v.length>0);function listingPhotos(listingOrPictures){if(isRecord(listingOrPictures)&&!Array.isArray(listingOrPictures)){const{images,pictures:pictures2}=listingOrPictures;if(images?.length){return images.map(({url,alt,width,height})=>({url,caption:alt,width,height}))}return listingPhotos(pictures2)}const pictures=listingOrPictures;if(!Array.isArray(pictures))return [];return pictures.flatMap(picture=>{if(typeof picture==="string")return picture?[{url:picture,caption:null}]:[];if(!isRecord(picture))return [];const url=firstString(picture,["original","url","large","regular","original_path","image_path","thumbnail","thumbnail_path"]);if(!url)return [];return [{url,caption:firstString(picture,["caption","description"])??null}]})}function Gallery({photos,onIndexChange,labels:labelsProp,sizes="100vw",className,classNames={}}){const labels={...defaultLabels.gallery,...labelsProp};const[index,setIndex]=useState(0);const total=photos.length;const current=Math.min(index,Math.max(0,total-1));const go=next=>{if(next<0||next>=total||next===current)return;setIndex(next);onIndexChange?.(next);};const onKeyDown=event=>{if(event.key==="ArrowLeft")go(current-1);else if(event.key==="ArrowRight")go(current+1);};return jsxs("section",{role:"region","aria-roledescription":"carousel","aria-label":labels.region,className,onKeyDown,children:[jsx("div",{className:classNames.viewport,"aria-live":"polite",children:photos.map((photo,i)=>jsx("div",{role:"group","aria-roledescription":"slide","aria-label":labels.photo(i,total),"data-state":i===current?"active":"inactive",hidden:i!==current,className:classNames.slide,children:jsx("img",{...cdnImageProps(photo.url,1080,sizes),...photo.width&&photo.height?{width:photo.width,height:photo.height}:{},alt:photo.caption||labels.photo(i,total),loading:i===0?"eager":"lazy",decoding:"async",className:classNames.image})},`${i}-${photo.url}`))}),jsx("button",{type:"button",className:classNames.button,"aria-label":labels.previous,disabled:current===0,onClick:()=>go(current-1),children:"\u2039"}),jsx("button",{type:"button",className:classNames.button,"aria-label":labels.next,disabled:current>=total-1,onClick:()=>go(current+1),children:"\u203A"})]})}function GuestPicker({value,onChange,max=STOREFRONT_MAX_GUESTS,labels:labelsProp,className,classNames={}}){const labels={...defaultLabels.guestPicker,...labelsProp};const id=useId();const fields=[{key:"adults",label:labels.adults,min:1,max:Math.max(value.adults,max-value.children)},{key:"children",label:labels.children,min:0,max:Math.max(value.children,max-value.adults)}];return jsx("div",{className,children:fields.map(field=>{const now=value[field.key];const set=next=>{const clamped=Math.min(field.max,Math.max(field.min,next));if(clamped!==now)onChange({...value,[field.key]:clamped});};const onKeyDown=event=>{const next={ArrowUp:now+1,ArrowRight:now+1,ArrowDown:now-1,ArrowLeft:now-1,Home:field.min,End:field.max}[event.key];if(next===void 0)return;event.preventDefault();set(next);};const labelId=`${id}-${field.key}`;return jsxs("div",{className:classNames.field,"data-field":field.key,children:[jsx("span",{id:labelId,className:classNames.label,children:field.label}),jsx("button",{type:"button",className:classNames.button,"aria-label":labels.decrement(field.label),disabled:now<=field.min,onClick:()=>set(now-1),children:"\u2212"}),jsx("div",{role:"spinbutton",tabIndex:0,className:classNames.value,"aria-labelledby":labelId,"aria-valuenow":now,"aria-valuemin":field.min,"aria-valuemax":field.max,onKeyDown,children:now}),jsx("button",{type:"button",className:classNames.button,"aria-label":labels.increment(field.label),disabled:now>=field.max,onClick:()=>set(now+1),children:"+"})]},field.key)})})}var usable=(lat,lng)=>typeof lat==="number"&&typeof lng==="number"&&Number.isFinite(lat)&&Number.isFinite(lng)&&Math.abs(lat)<=90&&Math.abs(lng)<=180;function Map({listings,children}){const markers=[];for(const listing of listings){if(usable(listing.latitude,listing.longitude)){markers.push({id:listing.id,lat:listing.latitude,lng:listing.longitude,listing});}}const bounds=markers.length===0?null:{north:Math.max(...markers.map(m=>m.lat)),south:Math.min(...markers.map(m=>m.lat)),east:Math.max(...markers.map(m=>m.lng)),west:Math.min(...markers.map(m=>m.lng))};return jsx(Fragment,{children:children({markers,bounds})})}
|
|
6
7
|
|
|
7
8
|
export { DateRangePicker, Gallery, GuestPicker, Map, defaultLabels, listingPhotos, unavailableDates };
|
package/dist/content.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var chunkW4VKQWXY_cjs = require('./chunk-W4VKQWXY.cjs');
|
|
4
|
+
require('./chunk-WNCQ6YBT.cjs');
|
|
5
5
|
require('./chunk-USOISC2R.cjs');
|
|
6
6
|
require('./chunk-LVFRVNT3.cjs');
|
|
7
7
|
|
|
@@ -9,29 +9,29 @@ require('./chunk-LVFRVNT3.cjs');
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, "contentModelSchema", {
|
|
11
11
|
enumerable: true,
|
|
12
|
-
get: function () { return
|
|
12
|
+
get: function () { return chunkW4VKQWXY_cjs.contentModelSchema; }
|
|
13
13
|
});
|
|
14
14
|
Object.defineProperty(exports, "createContentReader", {
|
|
15
15
|
enumerable: true,
|
|
16
|
-
get: function () { return
|
|
16
|
+
get: function () { return chunkW4VKQWXY_cjs.createContentReader; }
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "defineContent", {
|
|
19
19
|
enumerable: true,
|
|
20
|
-
get: function () { return
|
|
20
|
+
get: function () { return chunkW4VKQWXY_cjs.defineContent; }
|
|
21
21
|
});
|
|
22
22
|
Object.defineProperty(exports, "field", {
|
|
23
23
|
enumerable: true,
|
|
24
|
-
get: function () { return
|
|
24
|
+
get: function () { return chunkW4VKQWXY_cjs.field; }
|
|
25
25
|
});
|
|
26
26
|
Object.defineProperty(exports, "parseContentModel", {
|
|
27
27
|
enumerable: true,
|
|
28
|
-
get: function () { return
|
|
28
|
+
get: function () { return chunkW4VKQWXY_cjs.parseContentModel; }
|
|
29
29
|
});
|
|
30
30
|
Object.defineProperty(exports, "readFields", {
|
|
31
31
|
enumerable: true,
|
|
32
|
-
get: function () { return
|
|
32
|
+
get: function () { return chunkW4VKQWXY_cjs.readFields; }
|
|
33
33
|
});
|
|
34
34
|
Object.defineProperty(exports, "toContentModel", {
|
|
35
35
|
enumerable: true,
|
|
36
|
-
get: function () { return
|
|
36
|
+
get: function () { return chunkW4VKQWXY_cjs.toContentModel; }
|
|
37
37
|
});
|
package/dist/content.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RequestOptions, P as Page, q as StorefrontImage, o as StorefrontContentRef, j as StorefrontClient } from './client-
|
|
2
|
-
export { m as StorefrontContentItem } from './client-
|
|
1
|
+
import { R as RequestOptions, P as Page, q as StorefrontImage, o as StorefrontContentRef, j as StorefrontClient } from './client-CmoApA__.cjs';
|
|
2
|
+
export { m as StorefrontContentItem } from './client-CmoApA__.cjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import './availability-CnzmxuV3.cjs';
|
|
5
5
|
|
package/dist/content.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RequestOptions, P as Page, q as StorefrontImage, o as StorefrontContentRef, j as StorefrontClient } from './client-
|
|
2
|
-
export { m as StorefrontContentItem } from './client-
|
|
1
|
+
import { R as RequestOptions, P as Page, q as StorefrontImage, o as StorefrontContentRef, j as StorefrontClient } from './client-CdsTfFv7.js';
|
|
2
|
+
export { m as StorefrontContentItem } from './client-CdsTfFv7.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import './availability-CnzmxuV3.js';
|
|
5
5
|
|
package/dist/content.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { contentModelSchema, createContentReader, defineContent, field, parseContentModel, readFields, toContentModel } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { contentModelSchema, createContentReader, defineContent, field, parseContentModel, readFields, toContentModel } from './chunk-IBIDIWTI.js';
|
|
2
|
+
import './chunk-Y6INA5K7.js';
|
|
3
3
|
import './chunk-ZI2PG7LS.js';
|
|
4
4
|
import './chunk-6NFURJXI.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as BookingResult, v as StorefrontQuote } from './client-
|
|
1
|
+
import { B as BookingResult, v as StorefrontQuote } from './client-CdsTfFv7.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
declare const storefrontClientEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as BookingResult, v as StorefrontQuote } from './client-
|
|
1
|
+
import { B as BookingResult, v as StorefrontQuote } from './client-CmoApA__.cjs';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
declare const storefrontClientEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkPUY7GWID_cjs = require('./chunk-PUY7GWID.cjs');
|
|
4
|
+
var chunkEVSAMV5K_cjs = require('./chunk-EVSAMV5K.cjs');
|
|
4
5
|
require('./chunk-ZLAOY6IF.cjs');
|
|
5
|
-
require('./chunk-
|
|
6
|
+
require('./chunk-WNCQ6YBT.cjs');
|
|
6
7
|
var chunkUSOISC2R_cjs = require('./chunk-USOISC2R.cjs');
|
|
7
8
|
require('./chunk-LVFRVNT3.cjs');
|
|
8
9
|
|
|
@@ -10,39 +11,55 @@ require('./chunk-LVFRVNT3.cjs');
|
|
|
10
11
|
|
|
11
12
|
Object.defineProperty(exports, "SDK_VERSION", {
|
|
12
13
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunkPUY7GWID_cjs.SDK_VERSION; }
|
|
14
15
|
});
|
|
15
16
|
Object.defineProperty(exports, "STOREFRONT_API_PATH", {
|
|
16
17
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
18
|
+
get: function () { return chunkPUY7GWID_cjs.STOREFRONT_API_PATH; }
|
|
18
19
|
});
|
|
19
20
|
Object.defineProperty(exports, "STOREFRONT_API_VERSION", {
|
|
20
21
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
22
|
+
get: function () { return chunkPUY7GWID_cjs.STOREFRONT_API_VERSION; }
|
|
22
23
|
});
|
|
23
24
|
Object.defineProperty(exports, "analyticsFor", {
|
|
24
25
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
26
|
+
get: function () { return chunkPUY7GWID_cjs.analyticsFor; }
|
|
26
27
|
});
|
|
27
28
|
Object.defineProperty(exports, "createAnalytics", {
|
|
28
29
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
30
|
+
get: function () { return chunkPUY7GWID_cjs.createAnalytics; }
|
|
30
31
|
});
|
|
31
32
|
Object.defineProperty(exports, "createStorefrontClient", {
|
|
32
33
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
34
|
+
get: function () { return chunkPUY7GWID_cjs.createStorefrontClient; }
|
|
34
35
|
});
|
|
35
36
|
Object.defineProperty(exports, "getAttribution", {
|
|
36
37
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
38
|
+
get: function () { return chunkPUY7GWID_cjs.getAttribution; }
|
|
38
39
|
});
|
|
39
40
|
Object.defineProperty(exports, "parsePublishableKey", {
|
|
40
41
|
enumerable: true,
|
|
41
|
-
get: function () { return
|
|
42
|
+
get: function () { return chunkPUY7GWID_cjs.parsePublishableKey; }
|
|
42
43
|
});
|
|
43
44
|
Object.defineProperty(exports, "trackPurchasePixel", {
|
|
44
45
|
enumerable: true,
|
|
45
|
-
get: function () { return
|
|
46
|
+
get: function () { return chunkPUY7GWID_cjs.trackPurchasePixel; }
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "IMAGE_WIDTHS", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () { return chunkEVSAMV5K_cjs.CDN_IMAGE_WIDTHS; }
|
|
51
|
+
});
|
|
52
|
+
Object.defineProperty(exports, "imageProps", {
|
|
53
|
+
enumerable: true,
|
|
54
|
+
get: function () { return chunkEVSAMV5K_cjs.cdnImageProps; }
|
|
55
|
+
});
|
|
56
|
+
Object.defineProperty(exports, "imageSrcSet", {
|
|
57
|
+
enumerable: true,
|
|
58
|
+
get: function () { return chunkEVSAMV5K_cjs.cdnImageSrcSet; }
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(exports, "imageUrl", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function () { return chunkEVSAMV5K_cjs.cdnImageUrl; }
|
|
46
63
|
});
|
|
47
64
|
Object.defineProperty(exports, "PriceChangedError", {
|
|
48
65
|
enumerable: true,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { S as StorefrontRegion } from './errors-
|
|
2
|
-
export { A as AnalyticsOptions, a as AnalyticsReporter, P as PriceChangedError, R as RateLimitedError, b as STOREFRONT_ERROR_CODES, c as StorefrontAnalytics, d as StorefrontConfigError, e as StorefrontError, f as StorefrontErrorCode, g as StorefrontErrorInit, h as StorefrontNetworkError, i as StorefrontTimeoutError, T as TrackEvent, W as WrongRegionError, j as analyticsFor, k as createAnalytics, t as trackPurchasePixel } from './errors-
|
|
1
|
+
import { S as StorefrontRegion } from './errors-LMVeW29z.cjs';
|
|
2
|
+
export { A as AnalyticsOptions, a as AnalyticsReporter, P as PriceChangedError, R as RateLimitedError, b as STOREFRONT_ERROR_CODES, c as StorefrontAnalytics, d as StorefrontConfigError, e as StorefrontError, f as StorefrontErrorCode, g as StorefrontErrorInit, h as StorefrontNetworkError, i as StorefrontTimeoutError, T as TrackEvent, W as WrongRegionError, j as analyticsFor, k as createAnalytics, t as trackPurchasePixel } from './errors-LMVeW29z.cjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
-
export { B as BookingResult, C as CheckoutMountDescriptor, a as CheckoutSession, b as ConfirmCheckoutSessionInput, c as ConfirmCheckoutSessionRequest, d as ContentListQuery, e as CreateCheckoutSessionInput, f as CreateCheckoutSessionOptions, g as CreatedCheckoutSession, P as Page, R as RequestOptions, S as STOREFRONT_API_PATH, h as StorefrontBooking, i as StorefrontBuilding, j as StorefrontClient, k as StorefrontClientOptions, l as StorefrontContactInput, m as StorefrontContentItem, n as StorefrontContentModel, o as StorefrontContentRef, p as StorefrontGuestInput, q as StorefrontImage, r as StorefrontListing, s as StorefrontListingSummary, t as StorefrontListingsQuery, u as StorefrontLocation, v as StorefrontQuote, w as StorefrontQuoteInput, x as StorefrontRatePlanQuote, y as StorefrontReview, z as StorefrontReviewsQuery, A as StorefrontSite, D as createStorefrontClient } from './client-
|
|
4
|
+
export { B as BookingResult, C as CheckoutMountDescriptor, a as CheckoutSession, b as ConfirmCheckoutSessionInput, c as ConfirmCheckoutSessionRequest, d as ContentListQuery, e as CreateCheckoutSessionInput, f as CreateCheckoutSessionOptions, g as CreatedCheckoutSession, P as Page, R as RequestOptions, S as STOREFRONT_API_PATH, h as StorefrontBooking, i as StorefrontBuilding, j as StorefrontClient, k as StorefrontClientOptions, l as StorefrontContactInput, m as StorefrontContentItem, n as StorefrontContentModel, o as StorefrontContentRef, p as StorefrontGuestInput, q as StorefrontImage, r as StorefrontListing, s as StorefrontListingSummary, t as StorefrontListingsQuery, u as StorefrontLocation, v as StorefrontQuote, w as StorefrontQuoteInput, x as StorefrontRatePlanQuote, y as StorefrontReview, z as StorefrontReviewsQuery, A as StorefrontSite, D as createStorefrontClient } from './client-CmoApA__.cjs';
|
|
5
5
|
export { S as StorefrontAvailability, a as StorefrontCalendar, b as StorefrontCalendarDay, c as StorefrontCalendarQuery, d as StorefrontStay, e as StorefrontUnavailableReason } from './availability-CnzmxuV3.cjs';
|
|
6
6
|
|
|
7
7
|
declare const attributionTouchSchema: z.ZodObject<{
|
|
@@ -108,6 +108,16 @@ interface AttributionOptions {
|
|
|
108
108
|
}
|
|
109
109
|
declare function getAttribution(opts?: AttributionOptions): StorefrontAttributionInput | null;
|
|
110
110
|
|
|
111
|
+
declare const CDN_IMAGE_WIDTHS: readonly [320, 640, 1080, 1600];
|
|
112
|
+
type CdnImageWidth = (typeof CDN_IMAGE_WIDTHS)[number];
|
|
113
|
+
declare function cdnImageUrl(url: string | null | undefined, width: CdnImageWidth): string | undefined;
|
|
114
|
+
declare function cdnImageSrcSet(url: string | null | undefined, widths?: readonly CdnImageWidth[]): string | undefined;
|
|
115
|
+
declare function cdnImageProps(url: string | null | undefined, width: CdnImageWidth, sizes: string): {
|
|
116
|
+
src: string | undefined;
|
|
117
|
+
srcSet?: string;
|
|
118
|
+
sizes?: string;
|
|
119
|
+
};
|
|
120
|
+
|
|
111
121
|
interface ParsedPublishableKey {
|
|
112
122
|
environment: 'live' | 'test';
|
|
113
123
|
region: StorefrontRegion;
|
|
@@ -117,4 +127,4 @@ declare function parsePublishableKey(key: string): ParsedPublishableKey;
|
|
|
117
127
|
declare const SDK_VERSION: string;
|
|
118
128
|
declare const STOREFRONT_API_VERSION = "2026-09-27";
|
|
119
129
|
|
|
120
|
-
export { type AttributionIds, type AttributionOptions, type AttributionReporter, type AttributionTouch, type ParsedPublishableKey, SDK_VERSION, STOREFRONT_API_VERSION, type StorefrontAttributionInput, StorefrontRegion, getAttribution, parsePublishableKey };
|
|
130
|
+
export { type AttributionIds, type AttributionOptions, type AttributionReporter, type AttributionTouch, CDN_IMAGE_WIDTHS as IMAGE_WIDTHS, type CdnImageWidth as ImageWidth, type ParsedPublishableKey, SDK_VERSION, STOREFRONT_API_VERSION, type StorefrontAttributionInput, StorefrontRegion, getAttribution, cdnImageProps as imageProps, cdnImageSrcSet as imageSrcSet, cdnImageUrl as imageUrl, parsePublishableKey };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { S as StorefrontRegion } from './errors-
|
|
2
|
-
export { A as AnalyticsOptions, a as AnalyticsReporter, P as PriceChangedError, R as RateLimitedError, b as STOREFRONT_ERROR_CODES, c as StorefrontAnalytics, d as StorefrontConfigError, e as StorefrontError, f as StorefrontErrorCode, g as StorefrontErrorInit, h as StorefrontNetworkError, i as StorefrontTimeoutError, T as TrackEvent, W as WrongRegionError, j as analyticsFor, k as createAnalytics, t as trackPurchasePixel } from './errors-
|
|
1
|
+
import { S as StorefrontRegion } from './errors-Ct7uJn5o.js';
|
|
2
|
+
export { A as AnalyticsOptions, a as AnalyticsReporter, P as PriceChangedError, R as RateLimitedError, b as STOREFRONT_ERROR_CODES, c as StorefrontAnalytics, d as StorefrontConfigError, e as StorefrontError, f as StorefrontErrorCode, g as StorefrontErrorInit, h as StorefrontNetworkError, i as StorefrontTimeoutError, T as TrackEvent, W as WrongRegionError, j as analyticsFor, k as createAnalytics, t as trackPurchasePixel } from './errors-Ct7uJn5o.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
-
export { B as BookingResult, C as CheckoutMountDescriptor, a as CheckoutSession, b as ConfirmCheckoutSessionInput, c as ConfirmCheckoutSessionRequest, d as ContentListQuery, e as CreateCheckoutSessionInput, f as CreateCheckoutSessionOptions, g as CreatedCheckoutSession, P as Page, R as RequestOptions, S as STOREFRONT_API_PATH, h as StorefrontBooking, i as StorefrontBuilding, j as StorefrontClient, k as StorefrontClientOptions, l as StorefrontContactInput, m as StorefrontContentItem, n as StorefrontContentModel, o as StorefrontContentRef, p as StorefrontGuestInput, q as StorefrontImage, r as StorefrontListing, s as StorefrontListingSummary, t as StorefrontListingsQuery, u as StorefrontLocation, v as StorefrontQuote, w as StorefrontQuoteInput, x as StorefrontRatePlanQuote, y as StorefrontReview, z as StorefrontReviewsQuery, A as StorefrontSite, D as createStorefrontClient } from './client-
|
|
4
|
+
export { B as BookingResult, C as CheckoutMountDescriptor, a as CheckoutSession, b as ConfirmCheckoutSessionInput, c as ConfirmCheckoutSessionRequest, d as ContentListQuery, e as CreateCheckoutSessionInput, f as CreateCheckoutSessionOptions, g as CreatedCheckoutSession, P as Page, R as RequestOptions, S as STOREFRONT_API_PATH, h as StorefrontBooking, i as StorefrontBuilding, j as StorefrontClient, k as StorefrontClientOptions, l as StorefrontContactInput, m as StorefrontContentItem, n as StorefrontContentModel, o as StorefrontContentRef, p as StorefrontGuestInput, q as StorefrontImage, r as StorefrontListing, s as StorefrontListingSummary, t as StorefrontListingsQuery, u as StorefrontLocation, v as StorefrontQuote, w as StorefrontQuoteInput, x as StorefrontRatePlanQuote, y as StorefrontReview, z as StorefrontReviewsQuery, A as StorefrontSite, D as createStorefrontClient } from './client-CdsTfFv7.js';
|
|
5
5
|
export { S as StorefrontAvailability, a as StorefrontCalendar, b as StorefrontCalendarDay, c as StorefrontCalendarQuery, d as StorefrontStay, e as StorefrontUnavailableReason } from './availability-CnzmxuV3.js';
|
|
6
6
|
|
|
7
7
|
declare const attributionTouchSchema: z.ZodObject<{
|
|
@@ -108,6 +108,16 @@ interface AttributionOptions {
|
|
|
108
108
|
}
|
|
109
109
|
declare function getAttribution(opts?: AttributionOptions): StorefrontAttributionInput | null;
|
|
110
110
|
|
|
111
|
+
declare const CDN_IMAGE_WIDTHS: readonly [320, 640, 1080, 1600];
|
|
112
|
+
type CdnImageWidth = (typeof CDN_IMAGE_WIDTHS)[number];
|
|
113
|
+
declare function cdnImageUrl(url: string | null | undefined, width: CdnImageWidth): string | undefined;
|
|
114
|
+
declare function cdnImageSrcSet(url: string | null | undefined, widths?: readonly CdnImageWidth[]): string | undefined;
|
|
115
|
+
declare function cdnImageProps(url: string | null | undefined, width: CdnImageWidth, sizes: string): {
|
|
116
|
+
src: string | undefined;
|
|
117
|
+
srcSet?: string;
|
|
118
|
+
sizes?: string;
|
|
119
|
+
};
|
|
120
|
+
|
|
111
121
|
interface ParsedPublishableKey {
|
|
112
122
|
environment: 'live' | 'test';
|
|
113
123
|
region: StorefrontRegion;
|
|
@@ -117,4 +127,4 @@ declare function parsePublishableKey(key: string): ParsedPublishableKey;
|
|
|
117
127
|
declare const SDK_VERSION: string;
|
|
118
128
|
declare const STOREFRONT_API_VERSION = "2026-09-27";
|
|
119
129
|
|
|
120
|
-
export { type AttributionIds, type AttributionOptions, type AttributionReporter, type AttributionTouch, type ParsedPublishableKey, SDK_VERSION, STOREFRONT_API_VERSION, type StorefrontAttributionInput, StorefrontRegion, getAttribution, parsePublishableKey };
|
|
130
|
+
export { type AttributionIds, type AttributionOptions, type AttributionReporter, type AttributionTouch, CDN_IMAGE_WIDTHS as IMAGE_WIDTHS, type CdnImageWidth as ImageWidth, type ParsedPublishableKey, SDK_VERSION, STOREFRONT_API_VERSION, type StorefrontAttributionInput, StorefrontRegion, getAttribution, cdnImageProps as imageProps, cdnImageSrcSet as imageSrcSet, cdnImageUrl as imageUrl, parsePublishableKey };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export { SDK_VERSION, STOREFRONT_API_PATH, STOREFRONT_API_VERSION, analyticsFor, createAnalytics, createStorefrontClient, getAttribution, parsePublishableKey, trackPurchasePixel } from './chunk-
|
|
1
|
+
export { SDK_VERSION, STOREFRONT_API_PATH, STOREFRONT_API_VERSION, analyticsFor, createAnalytics, createStorefrontClient, getAttribution, parsePublishableKey, trackPurchasePixel } from './chunk-BFUMJBZV.js';
|
|
2
|
+
export { CDN_IMAGE_WIDTHS as IMAGE_WIDTHS, cdnImageProps as imageProps, cdnImageSrcSet as imageSrcSet, cdnImageUrl as imageUrl } from './chunk-A43EXKPY.js';
|
|
2
3
|
import './chunk-PYVUDQSQ.js';
|
|
3
|
-
import './chunk-
|
|
4
|
+
import './chunk-Y6INA5K7.js';
|
|
4
5
|
export { PriceChangedError, RateLimitedError, STOREFRONT_ERROR_CODES, StorefrontConfigError, StorefrontError, StorefrontNetworkError, StorefrontTimeoutError, WrongRegionError } from './chunk-ZI2PG7LS.js';
|
|
5
6
|
import './chunk-6NFURJXI.js';
|
package/dist/react.cjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkPUY7GWID_cjs = require('./chunk-PUY7GWID.cjs');
|
|
4
4
|
var chunkVV2UNVQ2_cjs = require('./chunk-VV2UNVQ2.cjs');
|
|
5
5
|
require('./chunk-ZLAOY6IF.cjs');
|
|
6
|
-
require('./chunk-
|
|
6
|
+
require('./chunk-WNCQ6YBT.cjs');
|
|
7
7
|
var chunkUSOISC2R_cjs = require('./chunk-USOISC2R.cjs');
|
|
8
8
|
require('./chunk-LVFRVNT3.cjs');
|
|
9
9
|
var react = require('react');
|
|
10
10
|
var jsxRuntime = require('react/jsx-runtime');
|
|
11
11
|
|
|
12
|
-
var SuiteOpContext=react.createContext(null);var ASTRO_PAGE_LOAD="astro:page-load";function SuiteOpProvider({client,children}){const value=react.useMemo(()=>({client,requests:new Map,analytics:
|
|
12
|
+
var SuiteOpContext=react.createContext(null);var ASTRO_PAGE_LOAD="astro:page-load";function SuiteOpProvider({client,children}){const value=react.useMemo(()=>({client,requests:new Map,analytics:chunkPUY7GWID_cjs.analyticsFor(client.publishableKey)}),[client]);const{analytics}=value;react.useEffect(()=>{const onPageLoad=()=>analytics.pageView();onPageLoad();document.addEventListener(ASTRO_PAGE_LOAD,onPageLoad);return ()=>document.removeEventListener(ASTRO_PAGE_LOAD,onPageLoad)},[analytics]);return jsxRuntime.jsx(SuiteOpContext.Provider,{value,children})}function useTrack(){const{analytics}=useSuiteOpContext("useTrack");return analytics.track}function useSuiteOpContext(hookName){const value=react.useContext(SuiteOpContext);if(!value)throw new chunkUSOISC2R_cjs.StorefrontConfigError(`${hookName} must be used inside <SuiteOpProvider>`);return value}function useStorefrontClient(){return useSuiteOpContext("useStorefrontClient").client}var SHARED_TTL_MS=3e4;function toStorefrontError(err){if(err instanceof chunkUSOISC2R_cjs.StorefrontError)return err;return new chunkUSOISC2R_cjs.StorefrontError({status:0,code:"internal_error",message:err instanceof Error?err.message:"Unexpected error",cause:err})}function acquire(requests,key,run){const now=Date.now();for(const[k,entry2]of requests){if(entry2.refs===0&&entry2.settledAt!==null&&now-entry2.settledAt>=SHARED_TTL_MS){requests.delete(k);}}const cached=requests.get(key);if(cached&&(cached.settledAt===null||now-cached.settledAt<SHARED_TTL_MS)){cached.refs+=1;return cached}const controller=new AbortController;const entry={promise:Promise.resolve(),controller,refs:1,settledAt:null};entry.promise=run({signal:controller.signal}).then(data=>{entry.settledAt=Date.now();return data},err=>{if(requests.get(key)===entry)requests.delete(key);throw err});requests.set(key,entry);return entry}function release(requests,key,entry){entry.refs-=1;queueMicrotask(()=>{if(entry.refs>0||entry.settledAt!==null)return;entry.controller.abort();if(requests.get(key)===entry)requests.delete(key);});}function useSharedRead(hookName,key,run){const{requests}=useSuiteOpContext(hookName);const[current,setCurrent]=react.useState(null);const runRef=react.useRef(run);runRef.current=run;react.useEffect(()=>{if(key===null)return;let active=true;const entry=acquire(requests,key,opts=>runRef.current(opts));entry.promise.then(data=>{if(active)setCurrent({key,state:{status:"success",data}});},err=>{if(active&&!entry.controller.signal.aborted){setCurrent({key,state:{status:"error",error:toStorefrontError(err)}});}});return ()=>{active=false;release(requests,key,entry);}},[requests,key]);if(key===null)return {status:"idle"};return current?.key===key?current.state:{status:"loading"}}function useListing(id){const{client}=useSuiteOpContext("useListing");return useSharedRead("useListing",id===null?null:`listing:${id}`,opts=>client.listings.get(id,opts))}function useAvailability(listingId,stay){const{client}=useSuiteOpContext("useAvailability");const key=listingId===null||stay===null?null:`availability:${JSON.stringify([listingId,stay.checkIn,stay.checkOut,stay.guests])}`;return useSharedRead("useAvailability",key,opts=>client.availability.get(listingId,stay,opts))}function useMutationState(){const[state,setState]=react.useState({status:"idle"});const seq=react.useRef(0);const track=react.useCallback(async(work,onError)=>{const mine=++seq.current;setState({status:"loading"});try{const data=await work();if(mine===seq.current)setState({status:"success",data});return data}catch(err){if(mine===seq.current){onError?.(err);setState({status:"error",error:toStorefrontError(err)});}throw err}},[]);return {state,track}}function useQuote(){const{client}=useSuiteOpContext("useQuote");const{state,track}=useMutationState();const quote=react.useCallback(input=>track(()=>client.quotes.create(input)),[client,track]);return {quote,state}}function useCheckoutSession(){const{client}=useSuiteOpContext("useCheckoutSession");const{state,track}=useMutationState();const[priceChanged,setPriceChanged]=react.useState(null);const create=react.useCallback((input,opts)=>{setPriceChanged(null);return track(()=>client.checkoutSessions.create(input,opts),err=>{if(err instanceof chunkUSOISC2R_cjs.PriceChangedError)setPriceChanged(err.quote);})},[client,track]);return {create,session:state,priceChanged}}var EVENTS={"suiteop-checkout:ready":h=>h.onReady?.(),"suiteop-checkout:confirmed":(h,detail)=>h.onComplete(detail),"suiteop-checkout:pending":(h,detail)=>h.onPending?.(detail),"suiteop-checkout:error":(h,detail)=>{const error=detail;if(error.code==="price_changed"&&h.onPriceChanged)h.onPriceChanged();else h.onError?.(error);}};function SuiteOpCheckout(props){const client=useStorefrontClient();const ref=react.useRef(null);const handlers=react.useRef(props);handlers.current=props;react.useEffect(()=>{let active=true;chunkVV2UNVQ2_cjs.loadCheckout({origin:props.checkoutOrigin}).catch(err=>{if(!active)return;const code=err instanceof chunkUSOISC2R_cjs.StorefrontError?err.code:"checkout_unavailable";handlers.current.onError?.({code,requiresNewSession:false});});return ()=>{active=false;}},[props.checkoutOrigin]);react.useEffect(()=>{const element=ref.current;if(!element)return;const listeners=Object.entries(EVENTS).map(([type,handle])=>{const listener=event=>handle(handlers.current,event.detail);element.addEventListener(type,listener);return [type,listener]});return ()=>{for(const[type,listener]of listeners)element.removeEventListener(type,listener);}},[]);const apiBase=client.baseUrl.endsWith(chunkPUY7GWID_cjs.STOREFRONT_API_PATH)?client.baseUrl.slice(0,-chunkPUY7GWID_cjs.STOREFRONT_API_PATH.length):client.baseUrl;return react.createElement("suiteop-checkout",{ref,class:props.className,"session-id":props.checkoutSessionId,"quote-ref":props.quoteRef,"idempotency-key":props.idempotencyKey,"api-base":apiBase,"publishable-key":client.publishableKey,locale:props.locale})}
|
|
13
13
|
|
|
14
14
|
exports.SuiteOpCheckout = SuiteOpCheckout;
|
|
15
15
|
exports.SuiteOpProvider = SuiteOpProvider;
|
package/dist/react.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { d as StorefrontStay, S as StorefrontAvailability } from './availability-CnzmxuV3.cjs';
|
|
2
|
-
import { e as CreateCheckoutSessionInput, f as CreateCheckoutSessionOptions, g as CreatedCheckoutSession, v as StorefrontQuote, r as StorefrontListing, w as StorefrontQuoteInput, j as StorefrontClient, B as BookingResult } from './client-
|
|
3
|
-
import { e as StorefrontError, T as TrackEvent } from './errors-
|
|
2
|
+
import { e as CreateCheckoutSessionInput, f as CreateCheckoutSessionOptions, g as CreatedCheckoutSession, v as StorefrontQuote, r as StorefrontListing, w as StorefrontQuoteInput, j as StorefrontClient, B as BookingResult } from './client-CmoApA__.cjs';
|
|
3
|
+
import { e as StorefrontError, T as TrackEvent } from './errors-LMVeW29z.cjs';
|
|
4
4
|
import * as react from 'react';
|
|
5
5
|
import { ReactNode, JSX } from 'react';
|
|
6
6
|
import 'zod';
|
package/dist/react.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { d as StorefrontStay, S as StorefrontAvailability } from './availability-CnzmxuV3.js';
|
|
2
|
-
import { e as CreateCheckoutSessionInput, f as CreateCheckoutSessionOptions, g as CreatedCheckoutSession, v as StorefrontQuote, r as StorefrontListing, w as StorefrontQuoteInput, j as StorefrontClient, B as BookingResult } from './client-
|
|
3
|
-
import { e as StorefrontError, T as TrackEvent } from './errors-
|
|
2
|
+
import { e as CreateCheckoutSessionInput, f as CreateCheckoutSessionOptions, g as CreatedCheckoutSession, v as StorefrontQuote, r as StorefrontListing, w as StorefrontQuoteInput, j as StorefrontClient, B as BookingResult } from './client-CdsTfFv7.js';
|
|
3
|
+
import { e as StorefrontError, T as TrackEvent } from './errors-Ct7uJn5o.js';
|
|
4
4
|
import * as react from 'react';
|
|
5
5
|
import { ReactNode, JSX } from 'react';
|
|
6
6
|
import 'zod';
|
package/dist/react.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { analyticsFor, STOREFRONT_API_PATH } from './chunk-
|
|
1
|
+
import { analyticsFor, STOREFRONT_API_PATH } from './chunk-BFUMJBZV.js';
|
|
2
2
|
import { loadCheckout } from './chunk-HMLBMNGA.js';
|
|
3
3
|
import './chunk-PYVUDQSQ.js';
|
|
4
|
-
import './chunk-
|
|
4
|
+
import './chunk-Y6INA5K7.js';
|
|
5
5
|
import { StorefrontConfigError, PriceChangedError, StorefrontError } from './chunk-ZI2PG7LS.js';
|
|
6
6
|
import './chunk-6NFURJXI.js';
|
|
7
7
|
import { createContext, useMemo, useEffect, useContext, useCallback, useState, useRef, createElement } from 'react';
|
package/package.json
CHANGED