@suiteop/storefront 0.1.1 → 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.
Files changed (57) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/README.md +74 -0
  3. package/dist/astro-content-model.cjs +17 -0
  4. package/dist/astro-content-model.d.cts +4 -0
  5. package/dist/astro-content-model.d.ts +4 -0
  6. package/dist/astro-content-model.js +10 -0
  7. package/dist/astro.cjs +3 -1
  8. package/dist/astro.d.cts +38 -17
  9. package/dist/astro.d.ts +38 -17
  10. package/dist/astro.js +2 -2
  11. package/dist/checkout.cjs +3 -3
  12. package/dist/checkout.js +2 -2
  13. package/dist/chunk-A43EXKPY.js +3 -0
  14. package/dist/chunk-BFUMJBZV.js +9 -0
  15. package/dist/chunk-EVSAMV5K.cjs +8 -0
  16. package/dist/{chunk-YFTWGF3L.js → chunk-HMLBMNGA.js} +1 -1
  17. package/dist/chunk-IBIDIWTI.js +8 -0
  18. package/dist/chunk-PUY7GWID.cjs +19 -0
  19. package/dist/chunk-PYVUDQSQ.js +3 -0
  20. package/dist/chunk-USOISC2R.cjs +17 -0
  21. package/dist/{chunk-RDREYP27.cjs → chunk-VV2UNVQ2.cjs} +2 -2
  22. package/dist/chunk-W4VKQWXY.cjs +16 -0
  23. package/dist/chunk-WNCQ6YBT.cjs +18 -0
  24. package/dist/chunk-Y6INA5K7.js +5 -0
  25. package/dist/chunk-ZI2PG7LS.js +6 -0
  26. package/dist/chunk-ZLAOY6IF.cjs +9 -0
  27. package/dist/{errors-Bp_jmXbA.d.ts → client-CdsTfFv7.d.ts} +104 -147
  28. package/dist/{errors-y-BiaVAk.d.cts → client-CmoApA__.d.cts} +104 -147
  29. package/dist/components.cjs +2 -1
  30. package/dist/components.d.cts +5 -2
  31. package/dist/components.d.ts +5 -2
  32. package/dist/components.js +2 -1
  33. package/dist/config.cjs +6 -2
  34. package/dist/config.d.cts +33 -1
  35. package/dist/config.d.ts +33 -1
  36. package/dist/config.js +3 -2
  37. package/dist/content.cjs +37 -0
  38. package/dist/content.d.cts +254 -0
  39. package/dist/content.d.ts +254 -0
  40. package/dist/content.js +4 -0
  41. package/dist/errors-Ct7uJn5o.d.ts +151 -0
  42. package/dist/errors-LMVeW29z.d.cts +151 -0
  43. package/dist/index.cjs +38 -20
  44. package/dist/index.d.cts +14 -3
  45. package/dist/index.d.ts +14 -3
  46. package/dist/index.js +5 -3
  47. package/dist/react.cjs +6 -5
  48. package/dist/react.d.cts +2 -1
  49. package/dist/react.d.ts +2 -1
  50. package/dist/react.js +5 -4
  51. package/package.json +22 -2
  52. package/dist/chunk-AIQUVZEI.cjs +0 -8
  53. package/dist/chunk-GIIXCS6X.cjs +0 -18
  54. package/dist/chunk-LIBKUMJV.js +0 -8
  55. package/dist/chunk-SK5TD73J.js +0 -3
  56. package/dist/chunk-UACP7BZ7.js +0 -6
  57. package/dist/chunk-XIAAWHAY.cjs +0 -17
@@ -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","thumbnail"]);if(!url)return [];return [{url,caption:firstString(picture,["caption","description"])??null}]})}function Gallery({photos,onIndexChange,labels:labelsProp,className,classNames={}}){const labels={...defaultLabels.gallery,...labelsProp};const[index,setIndex]=react.useState(0);const total=photos.length;const current=Math.min(index,Math.max(0,total-1));const go=next=>{if(next<0||next>=total||next===current)return;setIndex(next);onIndexChange?.(next);};const onKeyDown=event=>{if(event.key==="ArrowLeft")go(current-1);else if(event.key==="ArrowRight")go(current+1);};return jsxRuntime.jsxs("section",{role:"region","aria-roledescription":"carousel","aria-label":labels.region,className,onKeyDown,children:[jsxRuntime.jsx("div",{className:classNames.viewport,"aria-live":"polite",children:photos.map((photo,i)=>jsxRuntime.jsx("div",{role:"group","aria-roledescription":"slide","aria-label":labels.photo(i,total),"data-state":i===current?"active":"inactive",hidden:i!==current,className:classNames.slide,children:jsxRuntime.jsx("img",{src:photo.url,alt:photo.caption||labels.photo(i,total),loading:i===0?"eager":"lazy",decoding:"async",className:classNames.image})},`${i}-${photo.url}`))}),jsxRuntime.jsx("button",{type:"button",className:classNames.button,"aria-label":labels.previous,disabled:current===0,onClick:()=>go(current-1),children:"\u2039"}),jsxRuntime.jsx("button",{type:"button",className:classNames.button,"aria-label":labels.next,disabled:current>=total-1,onClick:()=>go(current+1),children:"\u203A"})]})}function GuestPicker({value,onChange,max=chunkLVFRVNT3_cjs.STOREFRONT_MAX_GUESTS,labels:labelsProp,className,classNames={}}){const labels={...defaultLabels.guestPicker,...labelsProp};const id=react.useId();const fields=[{key:"adults",label:labels.adults,min:1,max:Math.max(value.adults,max-value.children)},{key:"children",label:labels.children,min:0,max:Math.max(value.children,max-value.adults)}];return jsxRuntime.jsx("div",{className,children:fields.map(field=>{const now=value[field.key];const set=next=>{const clamped=Math.min(field.max,Math.max(field.min,next));if(clamped!==now)onChange({...value,[field.key]:clamped});};const onKeyDown=event=>{const next={ArrowUp:now+1,ArrowRight:now+1,ArrowDown:now-1,ArrowLeft:now-1,Home:field.min,End:field.max}[event.key];if(next===void 0)return;event.preventDefault();set(next);};const labelId=`${id}-${field.key}`;return jsxRuntime.jsxs("div",{className:classNames.field,"data-field":field.key,children:[jsxRuntime.jsx("span",{id:labelId,className:classNames.label,children:field.label}),jsxRuntime.jsx("button",{type:"button",className:classNames.button,"aria-label":labels.decrement(field.label),disabled:now<=field.min,onClick:()=>set(now-1),children:"\u2212"}),jsxRuntime.jsx("div",{role:"spinbutton",tabIndex:0,className:classNames.value,"aria-labelledby":labelId,"aria-valuenow":now,"aria-valuemin":field.min,"aria-valuemax":field.max,onKeyDown,children:now}),jsxRuntime.jsx("button",{type:"button",className:classNames.button,"aria-label":labels.increment(field.label),disabled:now>=field.max,onClick:()=>set(now+1),children:"+"})]},field.key)})})}var usable=(lat,lng)=>typeof lat==="number"&&typeof lng==="number"&&Number.isFinite(lat)&&Number.isFinite(lng)&&Math.abs(lat)<=90&&Math.abs(lng)<=180;function Map({listings,children}){const markers=[];for(const listing of listings){if(usable(listing.latitude,listing.longitude)){markers.push({id:listing.id,lat:listing.latitude,lng:listing.longitude,listing});}}const bounds=markers.length===0?null:{north:Math.max(...markers.map(m=>m.lat)),south:Math.min(...markers.map(m=>m.lat)),east:Math.max(...markers.map(m=>m.lng)),west:Math.min(...markers.map(m=>m.lng))};return jsxRuntime.jsx(jsxRuntime.Fragment,{children:children({markers,bounds})})}
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;
@@ -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(pictures: unknown): GalleryPhoto[];
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;
@@ -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(pictures: unknown): GalleryPhoto[];
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;
@@ -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","thumbnail"]);if(!url)return [];return [{url,caption:firstString(picture,["caption","description"])??null}]})}function Gallery({photos,onIndexChange,labels:labelsProp,className,classNames={}}){const labels={...defaultLabels.gallery,...labelsProp};const[index,setIndex]=useState(0);const total=photos.length;const current=Math.min(index,Math.max(0,total-1));const go=next=>{if(next<0||next>=total||next===current)return;setIndex(next);onIndexChange?.(next);};const onKeyDown=event=>{if(event.key==="ArrowLeft")go(current-1);else if(event.key==="ArrowRight")go(current+1);};return jsxs("section",{role:"region","aria-roledescription":"carousel","aria-label":labels.region,className,onKeyDown,children:[jsx("div",{className:classNames.viewport,"aria-live":"polite",children:photos.map((photo,i)=>jsx("div",{role:"group","aria-roledescription":"slide","aria-label":labels.photo(i,total),"data-state":i===current?"active":"inactive",hidden:i!==current,className:classNames.slide,children:jsx("img",{src:photo.url,alt:photo.caption||labels.photo(i,total),loading:i===0?"eager":"lazy",decoding:"async",className:classNames.image})},`${i}-${photo.url}`))}),jsx("button",{type:"button",className:classNames.button,"aria-label":labels.previous,disabled:current===0,onClick:()=>go(current-1),children:"\u2039"}),jsx("button",{type:"button",className:classNames.button,"aria-label":labels.next,disabled:current>=total-1,onClick:()=>go(current+1),children:"\u203A"})]})}function GuestPicker({value,onChange,max=STOREFRONT_MAX_GUESTS,labels:labelsProp,className,classNames={}}){const labels={...defaultLabels.guestPicker,...labelsProp};const id=useId();const fields=[{key:"adults",label:labels.adults,min:1,max:Math.max(value.adults,max-value.children)},{key:"children",label:labels.children,min:0,max:Math.max(value.children,max-value.adults)}];return jsx("div",{className,children:fields.map(field=>{const now=value[field.key];const set=next=>{const clamped=Math.min(field.max,Math.max(field.min,next));if(clamped!==now)onChange({...value,[field.key]:clamped});};const onKeyDown=event=>{const next={ArrowUp:now+1,ArrowRight:now+1,ArrowDown:now-1,ArrowLeft:now-1,Home:field.min,End:field.max}[event.key];if(next===void 0)return;event.preventDefault();set(next);};const labelId=`${id}-${field.key}`;return jsxs("div",{className:classNames.field,"data-field":field.key,children:[jsx("span",{id:labelId,className:classNames.label,children:field.label}),jsx("button",{type:"button",className:classNames.button,"aria-label":labels.decrement(field.label),disabled:now<=field.min,onClick:()=>set(now-1),children:"\u2212"}),jsx("div",{role:"spinbutton",tabIndex:0,className:classNames.value,"aria-labelledby":labelId,"aria-valuenow":now,"aria-valuemin":field.min,"aria-valuemax":field.max,onKeyDown,children:now}),jsx("button",{type:"button",className:classNames.button,"aria-label":labels.increment(field.label),disabled:now>=field.max,onClick:()=>set(now+1),children:"+"})]},field.key)})})}var usable=(lat,lng)=>typeof lat==="number"&&typeof lng==="number"&&Number.isFinite(lat)&&Number.isFinite(lng)&&Math.abs(lat)<=90&&Math.abs(lng)<=180;function Map({listings,children}){const markers=[];for(const listing of listings){if(usable(listing.latitude,listing.longitude)){markers.push({id:listing.id,lat:listing.latitude,lng:listing.longitude,listing});}}const bounds=markers.length===0?null:{north:Math.max(...markers.map(m=>m.lat)),south:Math.min(...markers.map(m=>m.lat)),east:Math.max(...markers.map(m=>m.lng)),west:Math.min(...markers.map(m=>m.lng))};return jsx(Fragment,{children:children({markers,bounds})})}
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/config.cjs CHANGED
@@ -1,10 +1,14 @@
1
1
  'use strict';
2
2
 
3
- var chunkAIQUVZEI_cjs = require('./chunk-AIQUVZEI.cjs');
3
+ var chunkZLAOY6IF_cjs = require('./chunk-ZLAOY6IF.cjs');
4
4
  var zod = require('zod');
5
5
 
6
- var STOREFRONT_LOCALES=["en","fr","es","de","it","pt","nl"];var REQUIRED="validation.required";var TOO_LONG="validation.max_length";var TOO_MANY="validation.too_large";var INVALID="validation.invalid";var text=max=>zod.z.string(INVALID).max(max,TOO_LONG);var localeSchema=zod.z.enum(STOREFRONT_LOCALES,"validation.storefront.locale_unsupported");var hexSchema=zod.z.string(INVALID).regex(/^#[0-9A-Fa-f]{6}$/,"validation.storefront.color_hex");var assetUrlSchema=zod.z.url({protocol:/^https$/,error:"validation.storefront.url_https"});var localizedSchema=zod.z.partialRecord(localeSchema,text(200),INVALID);var linkSchema=zod.z.object({label:localizedSchema,href:text(500).regex(/^(\/(?!\/)|https:\/\/)/,"validation.storefront.link_href")},INVALID);var fontSchema=zod.z.enum(chunkAIQUVZEI_cjs.GOOGLE_FONTS,"validation.invalid_option");var storefrontSiteConfigSchema=zod.z.object({brand:zod.z.object({name:text(80).min(1,REQUIRED),logoUrl:assetUrlSchema.nullable(),faviconUrl:assetUrlSchema.nullable()},INVALID),colors:zod.z.object({primary:hexSchema,primaryForeground:hexSchema,background:hexSchema,foreground:hexSchema,accent:hexSchema},INVALID),fonts:zod.z.object({heading:fontSchema,body:fontSchema},INVALID),nav:zod.z.array(linkSchema,INVALID).max(8,TOO_MANY),footer:zod.z.object({text:localizedSchema,links:zod.z.array(linkSchema,INVALID).max(12,TOO_MANY)},INVALID),defaultLocale:localeSchema,locales:zod.z.array(localeSchema,INVALID).min(1,REQUIRED).max(STOREFRONT_LOCALES.length,TOO_MANY),seo:zod.z.object({titleTemplate:text(80).includes("%s",{error:"validation.storefront.title_template_placeholder"}),defaultDescription:localizedSchema,ogImageUrl:assetUrlSchema.nullable()},INVALID)},INVALID).refine(c=>c.locales.includes(c.defaultLocale),{path:["defaultLocale"],message:"validation.storefront.default_locale_not_listed"});function defineSuiteOpConfig(config){return storefrontSiteConfigSchema.parse(config)}
6
+ var STOREFRONT_LOCALES=["en","fr","es","de","it","pt","nl"];var REQUIRED="validation.required";var TOO_LONG="validation.max_length";var TOO_MANY="validation.too_large";var INVALID="validation.invalid";var text=max=>zod.z.string(INVALID).max(max,TOO_LONG);var localeSchema=zod.z.enum(STOREFRONT_LOCALES,"validation.storefront.locale_unsupported");var hexSchema=zod.z.string(INVALID).regex(/^#[0-9A-Fa-f]{6}$/,"validation.storefront.color_hex");var assetUrlSchema=zod.z.url({protocol:/^https$/,error:"validation.storefront.url_https"});var localizedSchema=zod.z.partialRecord(localeSchema,text(200),INVALID);var linkSchema=zod.z.object({label:localizedSchema,href:text(500).regex(/^(\/(?!\/)|https:\/\/)/,"validation.storefront.link_href")},INVALID);var fontSchema=zod.z.enum(chunkZLAOY6IF_cjs.STOREFRONT_FONTS,"validation.invalid_option");var storefrontSiteConfigSchema=zod.z.object({brand:zod.z.object({name:text(80).min(1,REQUIRED),logoUrl:assetUrlSchema.nullable(),faviconUrl:assetUrlSchema.nullable()},INVALID),colors:zod.z.object({primary:hexSchema,primaryForeground:hexSchema,background:hexSchema,foreground:hexSchema,accent:hexSchema},INVALID),fonts:zod.z.object({heading:fontSchema,body:fontSchema},INVALID),nav:zod.z.array(linkSchema,INVALID).max(8,TOO_MANY),footer:zod.z.object({text:localizedSchema,links:zod.z.array(linkSchema,INVALID).max(12,TOO_MANY)},INVALID),defaultLocale:localeSchema,locales:zod.z.array(localeSchema,INVALID).min(1,REQUIRED).max(STOREFRONT_LOCALES.length,TOO_MANY),seo:zod.z.object({titleTemplate:text(80).includes("%s",{error:"validation.storefront.title_template_placeholder"}),defaultDescription:localizedSchema,ogImageUrl:assetUrlSchema.nullable()},INVALID)},INVALID).refine(c=>c.locales.includes(c.defaultLocale),{path:["defaultLocale"],message:"validation.storefront.default_locale_not_listed"});function defineSuiteOpConfig(config){return storefrontSiteConfigSchema.parse(config)}
7
7
 
8
+ Object.defineProperty(exports, "STOREFRONT_FONT_FAMILIES", {
9
+ enumerable: true,
10
+ get: function () { return chunkZLAOY6IF_cjs.STOREFRONT_FONT_FAMILIES; }
11
+ });
8
12
  exports.STOREFRONT_LOCALES = STOREFRONT_LOCALES;
9
13
  exports.defineSuiteOpConfig = defineSuiteOpConfig;
10
14
  exports.storefrontSiteConfigSchema = storefrontSiteConfigSchema;
package/dist/config.d.cts CHANGED
@@ -1,5 +1,9 @@
1
1
  import { z } from 'zod';
2
2
 
3
+ declare const STOREFRONT_FONTS: readonly ["inter", "montserrat", "poppins", "raleway", "nunito", "work_sans", "mulish", "barlow", "jost", "bitter", "archivo", "public_sans", "gantari", "anybody", "lato", "playfair_display", "karla", "reddit_sans", "overpass", "roboto", "open_sans", "merriweather", "outfit", "fraunces", "dm_sans", "cormorant_garamond", "eb_garamond", "lora", "crimson_pro", "source_serif_4", "ibm_plex_serif", "manrope", "plus_jakarta_sans", "space_grotesk", "ibm_plex_sans", "libre_franklin", "josefin_sans"];
4
+ type StorefrontFont = (typeof STOREFRONT_FONTS)[number];
5
+ declare const STOREFRONT_FONT_FAMILIES: Record<StorefrontFont, string>;
6
+
3
7
  declare const STOREFRONT_LOCALES: readonly ["en", "fr", "es", "de", "it", "pt", "nl"];
4
8
  type StorefrontLocale = (typeof STOREFRONT_LOCALES)[number];
5
9
  declare const storefrontSiteConfigSchema: z.ZodObject<{
@@ -40,6 +44,20 @@ declare const storefrontSiteConfigSchema: z.ZodObject<{
40
44
  open_sans: "open_sans";
41
45
  merriweather: "merriweather";
42
46
  outfit: "outfit";
47
+ fraunces: "fraunces";
48
+ dm_sans: "dm_sans";
49
+ cormorant_garamond: "cormorant_garamond";
50
+ eb_garamond: "eb_garamond";
51
+ lora: "lora";
52
+ crimson_pro: "crimson_pro";
53
+ source_serif_4: "source_serif_4";
54
+ ibm_plex_serif: "ibm_plex_serif";
55
+ manrope: "manrope";
56
+ plus_jakarta_sans: "plus_jakarta_sans";
57
+ space_grotesk: "space_grotesk";
58
+ ibm_plex_sans: "ibm_plex_sans";
59
+ libre_franklin: "libre_franklin";
60
+ josefin_sans: "josefin_sans";
43
61
  }>;
44
62
  body: z.ZodEnum<{
45
63
  inter: "inter";
@@ -65,6 +83,20 @@ declare const storefrontSiteConfigSchema: z.ZodObject<{
65
83
  open_sans: "open_sans";
66
84
  merriweather: "merriweather";
67
85
  outfit: "outfit";
86
+ fraunces: "fraunces";
87
+ dm_sans: "dm_sans";
88
+ cormorant_garamond: "cormorant_garamond";
89
+ eb_garamond: "eb_garamond";
90
+ lora: "lora";
91
+ crimson_pro: "crimson_pro";
92
+ source_serif_4: "source_serif_4";
93
+ ibm_plex_serif: "ibm_plex_serif";
94
+ manrope: "manrope";
95
+ plus_jakarta_sans: "plus_jakarta_sans";
96
+ space_grotesk: "space_grotesk";
97
+ ibm_plex_sans: "ibm_plex_sans";
98
+ libre_franklin: "libre_franklin";
99
+ josefin_sans: "josefin_sans";
68
100
  }>;
69
101
  }, z.core.$strip>;
70
102
  nav: z.ZodArray<z.ZodObject<{
@@ -138,4 +170,4 @@ type StorefrontSiteConfig = z.infer<typeof storefrontSiteConfigSchema>;
138
170
 
139
171
  declare function defineSuiteOpConfig(config: StorefrontSiteConfig): StorefrontSiteConfig;
140
172
 
141
- export { STOREFRONT_LOCALES, type StorefrontLocale, type StorefrontSiteConfig, defineSuiteOpConfig, storefrontSiteConfigSchema };
173
+ export { STOREFRONT_FONT_FAMILIES, STOREFRONT_LOCALES, type StorefrontLocale, type StorefrontSiteConfig, defineSuiteOpConfig, storefrontSiteConfigSchema };
package/dist/config.d.ts CHANGED
@@ -1,5 +1,9 @@
1
1
  import { z } from 'zod';
2
2
 
3
+ declare const STOREFRONT_FONTS: readonly ["inter", "montserrat", "poppins", "raleway", "nunito", "work_sans", "mulish", "barlow", "jost", "bitter", "archivo", "public_sans", "gantari", "anybody", "lato", "playfair_display", "karla", "reddit_sans", "overpass", "roboto", "open_sans", "merriweather", "outfit", "fraunces", "dm_sans", "cormorant_garamond", "eb_garamond", "lora", "crimson_pro", "source_serif_4", "ibm_plex_serif", "manrope", "plus_jakarta_sans", "space_grotesk", "ibm_plex_sans", "libre_franklin", "josefin_sans"];
4
+ type StorefrontFont = (typeof STOREFRONT_FONTS)[number];
5
+ declare const STOREFRONT_FONT_FAMILIES: Record<StorefrontFont, string>;
6
+
3
7
  declare const STOREFRONT_LOCALES: readonly ["en", "fr", "es", "de", "it", "pt", "nl"];
4
8
  type StorefrontLocale = (typeof STOREFRONT_LOCALES)[number];
5
9
  declare const storefrontSiteConfigSchema: z.ZodObject<{
@@ -40,6 +44,20 @@ declare const storefrontSiteConfigSchema: z.ZodObject<{
40
44
  open_sans: "open_sans";
41
45
  merriweather: "merriweather";
42
46
  outfit: "outfit";
47
+ fraunces: "fraunces";
48
+ dm_sans: "dm_sans";
49
+ cormorant_garamond: "cormorant_garamond";
50
+ eb_garamond: "eb_garamond";
51
+ lora: "lora";
52
+ crimson_pro: "crimson_pro";
53
+ source_serif_4: "source_serif_4";
54
+ ibm_plex_serif: "ibm_plex_serif";
55
+ manrope: "manrope";
56
+ plus_jakarta_sans: "plus_jakarta_sans";
57
+ space_grotesk: "space_grotesk";
58
+ ibm_plex_sans: "ibm_plex_sans";
59
+ libre_franklin: "libre_franklin";
60
+ josefin_sans: "josefin_sans";
43
61
  }>;
44
62
  body: z.ZodEnum<{
45
63
  inter: "inter";
@@ -65,6 +83,20 @@ declare const storefrontSiteConfigSchema: z.ZodObject<{
65
83
  open_sans: "open_sans";
66
84
  merriweather: "merriweather";
67
85
  outfit: "outfit";
86
+ fraunces: "fraunces";
87
+ dm_sans: "dm_sans";
88
+ cormorant_garamond: "cormorant_garamond";
89
+ eb_garamond: "eb_garamond";
90
+ lora: "lora";
91
+ crimson_pro: "crimson_pro";
92
+ source_serif_4: "source_serif_4";
93
+ ibm_plex_serif: "ibm_plex_serif";
94
+ manrope: "manrope";
95
+ plus_jakarta_sans: "plus_jakarta_sans";
96
+ space_grotesk: "space_grotesk";
97
+ ibm_plex_sans: "ibm_plex_sans";
98
+ libre_franklin: "libre_franklin";
99
+ josefin_sans: "josefin_sans";
68
100
  }>;
69
101
  }, z.core.$strip>;
70
102
  nav: z.ZodArray<z.ZodObject<{
@@ -138,4 +170,4 @@ type StorefrontSiteConfig = z.infer<typeof storefrontSiteConfigSchema>;
138
170
 
139
171
  declare function defineSuiteOpConfig(config: StorefrontSiteConfig): StorefrontSiteConfig;
140
172
 
141
- export { STOREFRONT_LOCALES, type StorefrontLocale, type StorefrontSiteConfig, defineSuiteOpConfig, storefrontSiteConfigSchema };
173
+ export { STOREFRONT_FONT_FAMILIES, STOREFRONT_LOCALES, type StorefrontLocale, type StorefrontSiteConfig, defineSuiteOpConfig, storefrontSiteConfigSchema };
package/dist/config.js CHANGED
@@ -1,6 +1,7 @@
1
- import { GOOGLE_FONTS } from './chunk-SK5TD73J.js';
1
+ import { STOREFRONT_FONTS } from './chunk-PYVUDQSQ.js';
2
+ export { STOREFRONT_FONT_FAMILIES } from './chunk-PYVUDQSQ.js';
2
3
  import { z } from 'zod';
3
4
 
4
- var STOREFRONT_LOCALES=["en","fr","es","de","it","pt","nl"];var REQUIRED="validation.required";var TOO_LONG="validation.max_length";var TOO_MANY="validation.too_large";var INVALID="validation.invalid";var text=max=>z.string(INVALID).max(max,TOO_LONG);var localeSchema=z.enum(STOREFRONT_LOCALES,"validation.storefront.locale_unsupported");var hexSchema=z.string(INVALID).regex(/^#[0-9A-Fa-f]{6}$/,"validation.storefront.color_hex");var assetUrlSchema=z.url({protocol:/^https$/,error:"validation.storefront.url_https"});var localizedSchema=z.partialRecord(localeSchema,text(200),INVALID);var linkSchema=z.object({label:localizedSchema,href:text(500).regex(/^(\/(?!\/)|https:\/\/)/,"validation.storefront.link_href")},INVALID);var fontSchema=z.enum(GOOGLE_FONTS,"validation.invalid_option");var storefrontSiteConfigSchema=z.object({brand:z.object({name:text(80).min(1,REQUIRED),logoUrl:assetUrlSchema.nullable(),faviconUrl:assetUrlSchema.nullable()},INVALID),colors:z.object({primary:hexSchema,primaryForeground:hexSchema,background:hexSchema,foreground:hexSchema,accent:hexSchema},INVALID),fonts:z.object({heading:fontSchema,body:fontSchema},INVALID),nav:z.array(linkSchema,INVALID).max(8,TOO_MANY),footer:z.object({text:localizedSchema,links:z.array(linkSchema,INVALID).max(12,TOO_MANY)},INVALID),defaultLocale:localeSchema,locales:z.array(localeSchema,INVALID).min(1,REQUIRED).max(STOREFRONT_LOCALES.length,TOO_MANY),seo:z.object({titleTemplate:text(80).includes("%s",{error:"validation.storefront.title_template_placeholder"}),defaultDescription:localizedSchema,ogImageUrl:assetUrlSchema.nullable()},INVALID)},INVALID).refine(c=>c.locales.includes(c.defaultLocale),{path:["defaultLocale"],message:"validation.storefront.default_locale_not_listed"});function defineSuiteOpConfig(config){return storefrontSiteConfigSchema.parse(config)}
5
+ var STOREFRONT_LOCALES=["en","fr","es","de","it","pt","nl"];var REQUIRED="validation.required";var TOO_LONG="validation.max_length";var TOO_MANY="validation.too_large";var INVALID="validation.invalid";var text=max=>z.string(INVALID).max(max,TOO_LONG);var localeSchema=z.enum(STOREFRONT_LOCALES,"validation.storefront.locale_unsupported");var hexSchema=z.string(INVALID).regex(/^#[0-9A-Fa-f]{6}$/,"validation.storefront.color_hex");var assetUrlSchema=z.url({protocol:/^https$/,error:"validation.storefront.url_https"});var localizedSchema=z.partialRecord(localeSchema,text(200),INVALID);var linkSchema=z.object({label:localizedSchema,href:text(500).regex(/^(\/(?!\/)|https:\/\/)/,"validation.storefront.link_href")},INVALID);var fontSchema=z.enum(STOREFRONT_FONTS,"validation.invalid_option");var storefrontSiteConfigSchema=z.object({brand:z.object({name:text(80).min(1,REQUIRED),logoUrl:assetUrlSchema.nullable(),faviconUrl:assetUrlSchema.nullable()},INVALID),colors:z.object({primary:hexSchema,primaryForeground:hexSchema,background:hexSchema,foreground:hexSchema,accent:hexSchema},INVALID),fonts:z.object({heading:fontSchema,body:fontSchema},INVALID),nav:z.array(linkSchema,INVALID).max(8,TOO_MANY),footer:z.object({text:localizedSchema,links:z.array(linkSchema,INVALID).max(12,TOO_MANY)},INVALID),defaultLocale:localeSchema,locales:z.array(localeSchema,INVALID).min(1,REQUIRED).max(STOREFRONT_LOCALES.length,TOO_MANY),seo:z.object({titleTemplate:text(80).includes("%s",{error:"validation.storefront.title_template_placeholder"}),defaultDescription:localizedSchema,ogImageUrl:assetUrlSchema.nullable()},INVALID)},INVALID).refine(c=>c.locales.includes(c.defaultLocale),{path:["defaultLocale"],message:"validation.storefront.default_locale_not_listed"});function defineSuiteOpConfig(config){return storefrontSiteConfigSchema.parse(config)}
5
6
 
6
7
  export { STOREFRONT_LOCALES, defineSuiteOpConfig, storefrontSiteConfigSchema };
@@ -0,0 +1,37 @@
1
+ 'use strict';
2
+
3
+ var chunkW4VKQWXY_cjs = require('./chunk-W4VKQWXY.cjs');
4
+ require('./chunk-WNCQ6YBT.cjs');
5
+ require('./chunk-USOISC2R.cjs');
6
+ require('./chunk-LVFRVNT3.cjs');
7
+
8
+
9
+
10
+ Object.defineProperty(exports, "contentModelSchema", {
11
+ enumerable: true,
12
+ get: function () { return chunkW4VKQWXY_cjs.contentModelSchema; }
13
+ });
14
+ Object.defineProperty(exports, "createContentReader", {
15
+ enumerable: true,
16
+ get: function () { return chunkW4VKQWXY_cjs.createContentReader; }
17
+ });
18
+ Object.defineProperty(exports, "defineContent", {
19
+ enumerable: true,
20
+ get: function () { return chunkW4VKQWXY_cjs.defineContent; }
21
+ });
22
+ Object.defineProperty(exports, "field", {
23
+ enumerable: true,
24
+ get: function () { return chunkW4VKQWXY_cjs.field; }
25
+ });
26
+ Object.defineProperty(exports, "parseContentModel", {
27
+ enumerable: true,
28
+ get: function () { return chunkW4VKQWXY_cjs.parseContentModel; }
29
+ });
30
+ Object.defineProperty(exports, "readFields", {
31
+ enumerable: true,
32
+ get: function () { return chunkW4VKQWXY_cjs.readFields; }
33
+ });
34
+ Object.defineProperty(exports, "toContentModel", {
35
+ enumerable: true,
36
+ get: function () { return chunkW4VKQWXY_cjs.toContentModel; }
37
+ });
@@ -0,0 +1,254 @@
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
+ import { z } from 'zod';
4
+ import './availability-CnzmxuV3.cjs';
5
+
6
+ declare const contentLocalizedSchema: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
7
+ type ContentLocalized = z.infer<typeof contentLocalizedSchema>;
8
+ declare const contentModelSchema: z.ZodObject<{
9
+ version: z.ZodLiteral<1>;
10
+ types: z.ZodArray<z.ZodObject<{
11
+ key: z.ZodString;
12
+ kind: z.ZodEnum<{
13
+ fields: "fields";
14
+ collection: "collection";
15
+ section: "section";
16
+ }>;
17
+ label: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
18
+ description: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
19
+ attachesTo: z.ZodOptional<z.ZodEnum<{
20
+ area: "area";
21
+ building: "building";
22
+ }>>;
23
+ titleField: z.ZodOptional<z.ZodString>;
24
+ routable: z.ZodDefault<z.ZodBoolean>;
25
+ drafts: z.ZodDefault<z.ZodBoolean>;
26
+ order: z.ZodDefault<z.ZodEnum<{
27
+ manual: "manual";
28
+ newest: "newest";
29
+ }>>;
30
+ fields: z.ZodArray<z.ZodObject<{
31
+ key: z.ZodString;
32
+ type: z.ZodEnum<{
33
+ number: "number";
34
+ boolean: "boolean";
35
+ rich_text: "rich_text";
36
+ link: "link";
37
+ text: "text";
38
+ date: "date";
39
+ image: "image";
40
+ gallery: "gallery";
41
+ option: "option";
42
+ reference: "reference";
43
+ references: "references";
44
+ }>;
45
+ label: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
46
+ help: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
47
+ required: z.ZodDefault<z.ZodBoolean>;
48
+ translatable: z.ZodOptional<z.ZodBoolean>;
49
+ maxLength: z.ZodOptional<z.ZodNumber>;
50
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
51
+ value: z.ZodString;
52
+ label: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
53
+ }, z.core.$strip>>>;
54
+ to: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
55
+ area: "area";
56
+ building: "building";
57
+ listing: "listing";
58
+ }>, z.ZodString]>>;
59
+ max: z.ZodOptional<z.ZodNumber>;
60
+ removed: z.ZodOptional<z.ZodBoolean>;
61
+ }, z.core.$strip>>;
62
+ }, z.core.$strip>>;
63
+ }, z.core.$strip>;
64
+ type ContentModel = z.infer<typeof contentModelSchema>;
65
+ type ContentModelInput = z.input<typeof contentModelSchema>;
66
+
67
+ type Localized = ContentLocalized;
68
+ interface FieldBase {
69
+ label: Localized;
70
+ help?: Localized;
71
+ required?: boolean;
72
+ }
73
+ interface TextOptions extends FieldBase {
74
+ translatable?: boolean;
75
+ maxLength?: number;
76
+ }
77
+ interface ListOptions extends FieldBase {
78
+ max?: number;
79
+ }
80
+ type ReferenceTarget = 'listing' | 'building' | 'area' | `collection:${string}`;
81
+ type OptionChoice<V extends string = string> = V | {
82
+ value: V;
83
+ label: Localized;
84
+ };
85
+ type TextField = TextOptions & {
86
+ type: 'text';
87
+ };
88
+ type RichTextField = TextOptions & {
89
+ type: 'rich_text';
90
+ };
91
+ type ImageField = FieldBase & {
92
+ type: 'image';
93
+ };
94
+ type GalleryField = ListOptions & {
95
+ type: 'gallery';
96
+ };
97
+ type NumberField = FieldBase & {
98
+ type: 'number';
99
+ };
100
+ type BooleanField = FieldBase & {
101
+ type: 'boolean';
102
+ };
103
+ type DateField = FieldBase & {
104
+ type: 'date';
105
+ };
106
+ type OptionField<V extends string = string> = FieldBase & {
107
+ type: 'option';
108
+ options: readonly OptionChoice<V>[];
109
+ };
110
+ type LinkField = FieldBase & {
111
+ type: 'link';
112
+ };
113
+ type ReferenceField = FieldBase & {
114
+ type: 'reference';
115
+ to: ReferenceTarget;
116
+ };
117
+ type ReferencesField = ListOptions & {
118
+ type: 'references';
119
+ to: ReferenceTarget;
120
+ };
121
+ type ContentFieldDefinition = TextField | RichTextField | ImageField | GalleryField | NumberField | BooleanField | DateField | OptionField | LinkField | ReferenceField | ReferencesField;
122
+ interface TypeBase {
123
+ label: Localized;
124
+ description?: Localized;
125
+ fields: Record<string, ContentFieldDefinition>;
126
+ }
127
+ interface CollectionDefinition extends TypeBase {
128
+ kind: 'collection';
129
+ titleField: string;
130
+ routable?: boolean;
131
+ drafts?: boolean;
132
+ order?: 'manual' | 'newest';
133
+ }
134
+ interface SectionDefinition extends TypeBase {
135
+ kind: 'section';
136
+ }
137
+ interface FieldsDefinition extends TypeBase {
138
+ kind: 'fields';
139
+ attachesTo: 'building' | 'area';
140
+ }
141
+ type ContentTypeDefinition = CollectionDefinition | SectionDefinition | FieldsDefinition;
142
+ type ContentDefinition = Record<string, ContentTypeDefinition>;
143
+ declare function defineContent<const T extends ContentDefinition>(definition: T): T;
144
+ declare const field: {
145
+ text: <const O extends TextOptions>(o: O) => O & {
146
+ type: "text";
147
+ };
148
+ richText: <const O extends TextOptions>(o: O) => O & {
149
+ type: "rich_text";
150
+ };
151
+ image: <const O extends FieldBase>(o: O) => O & {
152
+ type: "image";
153
+ };
154
+ gallery: <const O extends ListOptions>(o: O) => O & {
155
+ type: "gallery";
156
+ };
157
+ number: <const O extends FieldBase>(o: O) => O & {
158
+ type: "number";
159
+ };
160
+ boolean: <const O extends FieldBase>(o: O) => O & {
161
+ type: "boolean";
162
+ };
163
+ date: <const O extends FieldBase>(o: O) => O & {
164
+ type: "date";
165
+ };
166
+ option: <const V extends string, const O extends FieldBase>(o: O & {
167
+ options: readonly OptionChoice<V>[];
168
+ }) => O & {
169
+ type: "option";
170
+ options: readonly OptionChoice<V>[];
171
+ };
172
+ link: <const O extends FieldBase>(o: O) => O & {
173
+ type: "link";
174
+ };
175
+ reference: <const O extends FieldBase & {
176
+ to: ReferenceTarget;
177
+ }>(o: O) => O & {
178
+ type: "reference";
179
+ };
180
+ references: <const O extends ListOptions & {
181
+ to: ReferenceTarget;
182
+ }>(o: O) => O & {
183
+ type: "references";
184
+ };
185
+ };
186
+ interface ContentLink {
187
+ url: string;
188
+ label?: string;
189
+ }
190
+ type OptionValue<C> = C extends string ? C : C extends {
191
+ value: infer V;
192
+ } ? V : never;
193
+ type FieldValue<F> = F extends {
194
+ type: 'text' | 'rich_text' | 'date';
195
+ } ? string | null : F extends {
196
+ type: 'image';
197
+ } ? StorefrontImage | null : F extends {
198
+ type: 'gallery';
199
+ } ? StorefrontImage[] : F extends {
200
+ type: 'number';
201
+ } ? number | null : F extends {
202
+ type: 'boolean';
203
+ } ? boolean | null : F extends {
204
+ type: 'option';
205
+ options: readonly (infer C)[];
206
+ } ? OptionValue<C> | null : F extends {
207
+ type: 'link';
208
+ } ? ContentLink | null : F extends {
209
+ type: 'reference';
210
+ } ? StorefrontContentRef | null : F extends {
211
+ type: 'references';
212
+ } ? StorefrontContentRef[] : unknown;
213
+ type FieldsOf<T> = T extends {
214
+ fields: infer F;
215
+ } ? {
216
+ -readonly [K in keyof F]: FieldValue<F[K]>;
217
+ } : never;
218
+ interface ItemOf<D, K extends keyof D> {
219
+ id: string;
220
+ slug: string | null;
221
+ publishedAt: string | null;
222
+ updatedAt: string;
223
+ sortOrder: number;
224
+ fields: FieldsOf<D[K]>;
225
+ }
226
+ type KeysOfKind<D, Kind> = {
227
+ [K in keyof D]: D[K] extends {
228
+ kind: Kind;
229
+ } ? K : never;
230
+ }[keyof D] & string;
231
+ type CollectionKeys<D> = KeysOfKind<D, 'collection'>;
232
+ type SectionKeys<D> = KeysOfKind<D, 'section'>;
233
+ type FieldsKeys<D> = KeysOfKind<D, 'fields'>;
234
+ declare function toContentModel(definition: ContentDefinition): ContentModelInput;
235
+ declare function parseContentModel(definition: ContentDefinition): ContentModel;
236
+ declare function readFields<T extends ContentTypeDefinition>(type: T, values: Record<string, unknown> | null | undefined): FieldsOf<T>;
237
+ interface ContentReader<D extends ContentDefinition> {
238
+ collection<K extends CollectionKeys<D>>(key: K): {
239
+ list(query?: {
240
+ limit?: number;
241
+ offset?: number;
242
+ }, opts?: RequestOptions): Promise<Page<ItemOf<D, K>>>;
243
+ get(slugOrId: string, opts?: RequestOptions): Promise<ItemOf<D, K> | null>;
244
+ };
245
+ section<K extends SectionKeys<D>>(key: K): {
246
+ get(opts?: RequestOptions): Promise<ItemOf<D, K>>;
247
+ };
248
+ fieldsOf<K extends FieldsKeys<D>>(key: K, record: {
249
+ fields?: Record<string, Record<string, unknown>> | null;
250
+ }): FieldsOf<D[K]>;
251
+ }
252
+ declare function createContentReader<D extends ContentDefinition>(client: StorefrontClient, definition: D): ContentReader<D>;
253
+
254
+ export { type BooleanField, type CollectionDefinition, type CollectionKeys, type ContentDefinition, type ContentFieldDefinition, type ContentLink, type ContentReader, type ContentTypeDefinition, type DateField, type FieldValue, type FieldsDefinition, type FieldsKeys, type FieldsOf, type GalleryField, type ImageField, type ItemOf, type LinkField, type Localized, type NumberField, type OptionChoice, type OptionField, type ReferenceField, type ReferenceTarget, type ReferencesField, type RichTextField, type SectionDefinition, type SectionKeys, StorefrontContentRef, StorefrontImage, type TextField, contentModelSchema, createContentReader, defineContent, field, parseContentModel, readFields, toContentModel };