@suiteop/storefront 0.7.1 → 0.8.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 (42) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/astro-content-model.cjs +3 -3
  3. package/dist/astro-content-model.js +2 -2
  4. package/dist/astro.cjs +1 -1
  5. package/dist/astro.d.cts +14 -0
  6. package/dist/astro.d.ts +14 -0
  7. package/dist/astro.js +1 -1
  8. package/dist/checkout.cjs +3 -3
  9. package/dist/checkout.js +2 -2
  10. package/dist/{chunk-7ZAI36LH.js → chunk-5PBR3IP6.js} +1 -1
  11. package/dist/{chunk-W5K7IDYN.js → chunk-5QO273QX.js} +1 -1
  12. package/dist/chunk-7FVBUJSF.cjs +19 -0
  13. package/dist/{chunk-GYLTB4RR.js → chunk-LCEUS25M.js} +1 -1
  14. package/dist/{chunk-C32JK25B.cjs → chunk-LI7MQZUZ.cjs} +1 -1
  15. package/dist/{chunk-J5FZ4WDQ.cjs → chunk-OGVX5IEI.cjs} +1 -1
  16. package/dist/{chunk-QWPIOXVO.js → chunk-SCCDAZRA.js} +1 -1
  17. package/dist/{chunk-KMOZO6ZQ.cjs → chunk-TS7VLM6W.cjs} +2 -2
  18. package/dist/chunk-UDOZ3H5K.js +9 -0
  19. package/dist/{chunk-UMCI4YBN.cjs → chunk-XHR5XI3C.cjs} +2 -2
  20. package/dist/{client-w3nIcvlB.d.cts → client-BW-ELwHu.d.cts} +63 -1
  21. package/dist/{client-CYEzQ7Ul.d.ts → client-CCtoE6vX.d.ts} +63 -1
  22. package/dist/components.cjs +2 -2
  23. package/dist/components.js +1 -1
  24. package/dist/config.cjs +1 -1
  25. package/dist/config.js +1 -1
  26. package/dist/content.cjs +9 -9
  27. package/dist/content.d.cts +2 -2
  28. package/dist/content.d.ts +2 -2
  29. package/dist/content.js +2 -2
  30. package/dist/{errors-SQ70Q9cy.d.ts → errors-5JYsbYj1.d.cts} +2 -2
  31. package/dist/{errors-BkyyoQFu.d.cts → errors-DPMLuWdA.d.ts} +2 -2
  32. package/dist/index.cjs +24 -24
  33. package/dist/index.d.cts +31 -3
  34. package/dist/index.d.ts +31 -3
  35. package/dist/index.js +3 -3
  36. package/dist/react.cjs +4 -4
  37. package/dist/react.d.cts +2 -2
  38. package/dist/react.d.ts +2 -2
  39. package/dist/react.js +3 -3
  40. package/package.json +1 -1
  41. package/dist/chunk-H25KRMDV.cjs +0 -19
  42. package/dist/chunk-OGOT5DRO.js +0 -9
package/dist/config.js CHANGED
@@ -2,6 +2,6 @@ import { STOREFRONT_FONTS, STOREFRONT_FONT_FAMILIES } from './chunk-26HFUROE.js'
2
2
  export { STOREFRONT_FONT_FAMILIES } from './chunk-26HFUROE.js';
3
3
  import { z } from 'zod';
4
4
 
5
- var STOREFRONT_LOCALES=["en","fr","es","de","it","pt","nl"];var STOREFRONT_LAYOUTS=["listings","locations","areas","single"];var STOREFRONT_THEMES=["folio","hearth","circuit","tide","noir","fjord"];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({layout:z.enum(STOREFRONT_LAYOUTS).optional().catch(void 0),theme:z.enum(STOREFRONT_THEMES).optional().catch(void 0),brand:z.object({name:text(80).min(1,REQUIRED),logoUrl:assetUrlSchema.nullable(),logoOnDarkUrl:assetUrlSchema.nullable().optional(),faviconUrl:assetUrlSchema.nullable()},INVALID),colors:z.object({primary:hexSchema,secondary:hexSchema.nullable().optional(),primaryForeground:hexSchema.optional(),background:hexSchema.optional(),foreground:hexSchema.optional(),accent:hexSchema.optional()},INVALID),fonts:z.object({heading:fontSchema.optional(),body:fontSchema.optional()},INVALID).optional(),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"});var DEFAULT_STOREFRONT_LAYOUT="listings";var DEFAULT_STOREFRONT_THEME="tide";var STOREFRONT_THEME_RECIPES={folio:{mode:"light",fonts:{heading:"eb_garamond",body:"libre_franklin"},radius:{sm:0,md:0,lg:0,btn:0},btn:{size:12,w:600,ls:"0.14em",tt:"uppercase",h:46},type:{display:[88,1,400,"-0.015em"],h1:[56,1.05,400,"-0.01em"],h2:[36,1.15,400,"0"],h3:[24,1.25,500,"0"],body:[18,1.6,400,"0"],small:[14,1.5,400,"0"],label:[11,1.3,600,"0.16em","uppercase"]},space:{section:144,gutter:32},neutral:{hue:null,mix:0,c:.006},L:{bg:.985,surface:1,surface2:.955,tint:.95,border:.87,ink:.19,muted:.47,dark:.22},C:{ink:.02,dark:.04,tint:.022},shadow:false},hearth:{mode:"light",fonts:{heading:"lora",body:"karla"},radius:{sm:6,md:12,lg:18,btn:8},btn:{size:15,w:700,ls:"0",tt:"none",h:48},type:{display:[64,1.08,500,"-0.01em"],h1:[48,1.12,500,"-0.01em"],h2:[32,1.2,500,"0"],h3:[22,1.3,600,"0"],body:[17,1.6,400,"0"],small:[14,1.5,400,"0"],label:[12,1.3,700,"0.1em","uppercase"]},space:{section:112,gutter:28},neutral:{hue:75,mix:.85,c:.014},L:{bg:.972,surface:.99,surface2:.945,tint:.935,border:.885,ink:.25,muted:.48,dark:.28},C:{ink:.025,dark:.05,tint:.032},shadow:true},circuit:{mode:"light",fonts:{heading:"space_grotesk",body:"ibm_plex_sans"},radius:{sm:8,md:12,lg:16,btn:999},btn:{size:15,w:600,ls:"-0.005em",tt:"none",h:44},type:{display:[64,1.02,600,"-0.035em"],h1:[44,1.08,600,"-0.03em"],h2:[30,1.15,600,"-0.02em"],h3:[20,1.3,600,"-0.01em"],body:[16,1.55,400,"0"],small:[14,1.45,400,"0"],label:[12,1.3,600,"0.02em"]},space:{section:88,gutter:20},neutral:{hue:null,mix:0,c:.004},L:{bg:1,surface:.975,surface2:.958,tint:.958,border:.915,ink:.17,muted:.48,dark:.19},C:{ink:.012,dark:.03,tint:.035},shadow:true},tide:{mode:"light",fonts:{heading:"outfit",body:"mulish"},radius:{sm:12,md:20,lg:28,btn:999},btn:{size:15,w:700,ls:"0.01em",tt:"none",h:50},type:{display:[76,1.02,300,"-0.02em"],h1:[48,1.1,400,"-0.015em"],h2:[34,1.15,400,"-0.01em"],h3:[21,1.3,500,"0"],body:[17,1.6,400,"0"],small:[14,1.5,400,"0"],label:[12,1.3,700,"0.08em","uppercase"]},space:{section:120,gutter:24},neutral:{hue:null,mix:0,c:.005},L:{bg:.99,surface:.968,surface2:.945,tint:.95,border:.905,ink:.26,muted:.48,dark:.29},C:{ink:.035,dark:.055,tint:.028},shadow:true},noir:{mode:"dark",fonts:{heading:"cormorant_garamond",body:"manrope"},radius:{sm:0,md:2,lg:2,btn:0},btn:{size:11,w:600,ls:"0.22em",tt:"uppercase",h:48},type:{display:[84,1,300,"0.02em","uppercase"],h1:[56,1.05,300,"0.01em"],h2:[38,1.15,400,"0"],h3:[24,1.25,500,"0.02em"],body:[16,1.7,400,"0"],small:[13,1.55,400,"0.01em"],label:[11,1.3,600,"0.24em","uppercase"]},space:{section:152,gutter:32},neutral:{hue:null,mix:0,c:.016},L:{bg:.165,surface:.205,surface2:.245,tint:.24,border:.34,ink:.94,muted:.76,dark:.12},C:{ink:.01,dark:.014,tint:.035},shadow:false},fjord:{mode:"light",fonts:{heading:"dm_sans",body:"dm_sans"},radius:{sm:2,md:4,lg:6,btn:4},btn:{size:14,w:500,ls:"0",tt:"none",h:44},type:{display:[60,1.05,500,"-0.03em"],h1:[42,1.1,500,"-0.025em"],h2:[28,1.2,500,"-0.015em"],h3:[19,1.35,500,"-0.005em"],body:[16,1.6,400,"0"],small:[13,1.5,400,"0"],label:[12,1.3,500,"0"]},space:{section:128,gutter:24},neutral:{hue:85,mix:.85,c:.006},L:{bg:.976,surface:.995,surface2:.948,tint:.945,border:.895,ink:.23,muted:.49,dark:.26},C:{ink:.008,dark:.02,tint:.022},shadow:false}};var clamp=(v,a,b)=>Math.min(b,Math.max(a,v));var toLin=c=>c<=.04045?c/12.92:Math.pow((c+.055)/1.055,2.4);var toGam=c=>c<=.0031308?12.92*c:1.055*Math.pow(c,1/2.4)-.055;var hexToRgb=hex=>{const h=hex.replace("#","");return [0,2,4].map(i=>parseInt(h.slice(i,i+2),16)/255)};var rgbToHex=rgb=>"#"+rgb.map(v=>Math.round(clamp(v,0,1)*255).toString(16).padStart(2,"0")).join("").toUpperCase();function hexToOklch(hex){const[r,g,b]=hexToRgb(hex).map(toLin);const l=Math.cbrt(.4122214708*r+.5363325363*g+.0514459929*b);const m=Math.cbrt(.2119034982*r+.6806995451*g+.1073969566*b);const s=Math.cbrt(.0883024619*r+.2817188376*g+.6299787005*b);const L=.2104542553*l+.793617785*m-.0040720468*s;const A=1.9779984951*l-2.428592205*m+.4505937099*s;const B=.0259040371*l+.7827717662*m-.808675766*s;let H=Math.atan2(B,A)*180/Math.PI;if(H<0)H+=360;return [L,Math.sqrt(A*A+B*B),H]}function oklchToLinear(L,C,H){const a=C*Math.cos(H*Math.PI/180);const b=C*Math.sin(H*Math.PI/180);const l=(L+.3963377774*a+.2158037573*b)**3;const m=(L-.1055613458*a-.0638541728*b)**3;const s=(L-.0894841775*a-1.291485548*b)**3;return [4.0767416621*l-3.3077115913*m+.2309699292*s,-1.2684380046*l+2.6097574011*m-.3413193965*s,-0.0041960863*l-.7034186147*m+1.707614701*s]}var inGamut=rgb=>rgb.every(v=>v>=-1e-4&&v<=1.0001);function oklchToHex(lightness,C,H){const L=clamp(lightness,0,1);let rgb=oklchToLinear(L,C,H);if(!inGamut(rgb)){let lo=0;let hi=C;for(let i=0;i<22;i++){const mid=(lo+hi)/2;if(inGamut(oklchToLinear(L,mid,H)))lo=mid;else hi=mid;}rgb=oklchToLinear(L,lo,H);}return rgbToHex(rgb.map(v=>toGam(clamp(v,0,1))))}var luminance=hex=>{const[r,g,b]=hexToRgb(hex).map(toLin);return .2126*r+.7152*g+.0722*b};function contrastRatio(a,b){const x=luminance(a);const y=luminance(b);return (Math.max(x,y)+.05)/(Math.min(x,y)+.05)}var minContrast=(hex,grounds)=>Math.min(...grounds.map(g=>contrastRatio(hex,g)));var rgba=(hex,alpha)=>{const[r,g,b]=hexToRgb(hex).map(v=>Math.round(v*255));return `rgba(${r},${g},${b},${alpha})`};var mixHue=(a,b,t)=>{const d=(b-a+540)%360-180;return (a+d*t+360)%360};function fit(lightness,C,H,grounds,target,dir){let L=lightness;let hex=oklchToHex(L,C,H);let steps=0;while(minContrast(hex,grounds)<target&&steps<100){L=clamp(L+dir*.01,0,1);hex=oklchToHex(L,C,H);steps++;}return {hex,L,steps}}var SERIF_FONTS=new Set(["playfair_display","merriweather","bitter","fraunces","cormorant_garamond","eb_garamond","lora","crimson_pro","source_serif_4","ibm_plex_serif"]);function storefrontFontStack(font){return `'${STOREFRONT_FONT_FAMILIES[font]}', ${SERIF_FONTS.has(font)?"serif":"sans-serif"}`}var AA=4.5;var INK=7;function derivePalette(recipe,brandHex,secondary,overrides){const[bL,bC,bH]=hexToOklch(brandHex);const nh=recipe.neutral.hue==null?bH:mixHue(bH,recipe.neutral.hue,recipe.neutral.mix);const nc=recipe.neutral.c;const{L,C}=recipe;const dark=recipe.mode==="dark";const dir=dark?1:-1;const N=(l,c=nc)=>oklchToHex(l,c,nh);const bg=overrides.background?.toUpperCase()??N(L.bg);const surface=N(L.surface,L.surface>=.999?0:nc);const surface2=N(L.surface2);const tint=oklchToHex(L.tint,Math.min(bC,C.tint),bH);const border=N(L.border,nc*1.5);const borderStrong=N(dark?L.border+.12:L.border-.2,nc*1.5);const grounds=[bg,surface,surface2,tint];const ink=overrides.foreground?.toUpperCase()??fit(L.ink,C.ink,nh,grounds,INK,dir).hex;const muted=fit(L.muted,nc*2.5,nh,grounds,AA,dir).hex;const brandText=fit(bL,bC,bH,grounds,AA,dir);const accentText=overrides.accent?.toUpperCase()??brandText.hex;const notes=[];let p;let on;if(!dark){const white=oklchToHex(.995,.003,bH);if(contrastRatio(brandHex,white)>=AA){p={hex:brandHex.toUpperCase(),L:bL};on=white;}else if(bL>=.7&&contrastRatio(brandHex,ink)>=AA){p={hex:brandHex.toUpperCase(),L:bL};on=ink;notes.push({code:"light_brand_ink_label",text:"Light brand: button keeps the colour and takes an ink label"});}else {p=fit(bL,bC,bH,[white],AA,-1);on=white;notes.push({code:"button_darkened",from:round2(bL),to:round2(p.L),text:`Button darkened L ${bL.toFixed(2)} \u2192 ${p.L.toFixed(2)} for a white label`});}}else {on=bg;p=fit(Math.max(bL,.72),bC,bH,[bg,surface],AA,1);if(p.L>bL+.005){notes.push({code:"brand_lifted",from:round2(bL),to:round2(p.L),text:`Brand lifted L ${bL.toFixed(2)} \u2192 ${p.L.toFixed(2)} to read on dark`});}}const onPrimary=overrides.primaryForeground?.toUpperCase()??on;let primaryHover=oklchToHex(p.L+(dark?.05:-0.06),bC,bH);if(contrastRatio(primaryHover,onPrimary)<AA){primaryHover=oklchToHex(p.L+(dark?-0.04:.04),bC,bH);}const darkToken=oklchToHex(L.dark,Math.min(bC,C.dark),bH);const phBg=dark?oklchToHex(.27,Math.min(bC,.03),bH):oklchToHex(L.tint-.045,Math.min(bC,.03),bH);const t={bg,surface,surface2,tint,border,borderStrong,ink,muted,primary:p.hex,onPrimary,primaryHover,accentText,dark:darkToken,onDark:oklchToHex(.97,.008,bH),onDarkMuted:fit(.82,.012,bH,[darkToken],AA,1).hex,darkAccent:fit(Math.max(bL,.72),bC,bH,[darkToken],AA,1).hex,focus:dark?p.hex:accentText,phBg,phText:fit(dark?.7:.48,.02,bH,[phBg],AA,dir).hex};if(secondary)t.accent2=fit(...hexToOklch(secondary),grounds,AA,dir).hex;if(!dark&&brandText.steps>0&&accentText===brandText.hex){notes.push({code:"brand_text_darkened",steps:brandText.steps,text:`Brand text darkened ${brandText.steps} step${brandText.steps>1?"s":""} to reach 4.5:1`});}return {t,notes}}var round2=n=>Math.round(n*100)/100;function failingOverride(t,overrides){const grounds=[t.bg,t.surface,t.surface2,t.tint];if(overrides.foreground){const ratio=minContrast(t.ink,grounds);if(ratio<AA)return {field:"foreground",ratio,against:"background"}}if(overrides.accent){const ratio=minContrast(t.accentText,grounds);if(ratio<AA)return {field:"accent",ratio,against:"background"}}if(overrides.primaryForeground){const ratio=contrastRatio(t.onPrimary,t.primary);if(ratio<AA)return {field:"primaryForeground",ratio,against:"button"}}if(overrides.background){const ratio=Math.min(contrastRatio(t.ink,t.bg),contrastRatio(t.muted,t.bg));if(ratio<AA)return {field:"background",ratio,against:"text"}}return null}function deriveStorefrontTheme(theme,brandHex,opts={}){const recipe=STOREFRONT_THEME_RECIPES[theme];const overrides={...opts.overrides};const problems=[];let palette=derivePalette(recipe,brandHex,opts.secondary,overrides);for(let problem=failingOverride(palette.t,overrides);problem;){problems.push({...problem,ratio:Math.round(problem.ratio*10)/10});delete overrides[problem.field];palette=derivePalette(recipe,brandHex,opts.secondary,overrides);problem=failingOverride(palette.t,overrides);}const{t,notes}=palette;const r=recipe.radius;const px=n=>`${n}px`;const vars={"--so-bg":t.bg,"--so-surface":t.surface,"--so-surface-2":t.surface2,"--so-tint":t.tint,"--so-border":t.border,"--so-border-strong":t.borderStrong,"--so-ink":t.ink,"--so-muted":t.muted,"--so-primary":t.primary,"--so-on-primary":t.onPrimary,"--so-primary-hover":t.primaryHover,"--so-accent-text":t.accentText,"--so-dark":t.dark,"--so-on-dark":t.onDark,"--so-on-dark-muted":t.onDarkMuted,"--so-dark-accent":t.darkAccent,"--so-focus":t.focus,"--so-ph-bg":t.phBg,"--so-ph-text":t.phText,"--so-ph-line":rgba(t.phText,.16),"--so-accent-2":t.accent2??t.accentText,"--so-scrim":`linear-gradient(180deg, ${rgba(t.dark,.55)} 0%, ${rgba(t.dark,0)} 26%, ${rgba(t.dark,0)} 40%, ${rgba(t.dark,.72)} 100%)`,"--so-scrim-solid":rgba(t.dark,.45),"--so-shadow":recipe.shadow?`0 1px 2px ${rgba(t.dark,.06)}, 0 10px 30px ${rgba(t.dark,.1)}`:"none","--so-shadow-float":`0 2px 6px ${rgba(t.dark,.08)}, 0 18px 50px ${rgba(t.dark,.18)}`,"--so-font-heading":storefrontFontStack(opts.heading??recipe.fonts.heading),"--so-font-body":storefrontFontStack(opts.body??recipe.fonts.body),"--so-r-sm":px(r.sm),"--so-r-md":px(r.md),"--so-r-lg":px(r.lg),"--so-r-btn":px(r.btn),"--so-btn-size":px(recipe.btn.size),"--so-btn-w":String(recipe.btn.w),"--so-btn-ls":recipe.btn.ls,"--so-btn-tt":recipe.btn.tt,"--so-btn-h":px(recipe.btn.h),"--so-section":px(recipe.space.section),"--so-gutter":px(recipe.space.gutter)};for(const[step,[size,lh,w,ls,tt]]of Object.entries(recipe.type)){vars[`--t-${step}-size`]=px(size);vars[`--t-${step}-lh`]=String(lh);vars[`--t-${step}-w`]=String(w);vars[`--t-${step}-ls`]=ls;vars[`--t-${step}-tt`]=tt??"none";}const grade=x=>x>=7?"AAA":x>=AA?"AA":"Fail";const checks=[["Body text",t.ink,t.bg],["Muted text",t.muted,t.surface2],["Button label",t.onPrimary,t.primary],["Brand text",t.accentText,t.bg],["On dark section",t.onDark,t.dark],["Brand on dark",t.darkAccent,t.dark]].map(([label,a,b])=>{const x=Math.round(contrastRatio(a,b)*10)/10;return {label,ratio:x.toFixed(1),grade:grade(x),pass:x>=AA}});return {theme,tokens:t,vars,checks,notes,problems}}function storefrontThemeFonts(theme,fonts){const pair=STOREFRONT_THEME_RECIPES[theme].fonts;return {heading:fonts?.heading??pair.heading,body:fonts?.body??pair.body}}function resolveStorefrontTheme(config){const theme=config.theme??DEFAULT_STOREFRONT_THEME;const fonts=storefrontThemeFonts(theme,config.fonts);const{primary,secondary,background,foreground,accent,primaryForeground}=explicitThemeChoices(config).colors;const derived=deriveStorefrontTheme(theme,primary,{secondary,...fonts,overrides:{background,foreground,accent,primaryForeground}});return {theme,layout:config.layout??DEFAULT_STOREFRONT_LAYOUT,fonts,derived,cssVariables:derived.vars}}var OVERRIDE_TOKENS={background:"bg",foreground:"ink",accent:"accentText",primaryForeground:"onPrimary"};var OVERRIDES=Object.keys(OVERRIDE_TOKENS);function explicitThemeChoices(config){const theme=config.theme??DEFAULT_STOREFRONT_THEME;const given=pickOverrides(config.colors);const colors={...config.colors};for(const field of OVERRIDES){const value=given[field];if(!value)continue;const others={...given};delete others[field];const{tokens}=deriveStorefrontTheme(theme,config.colors.primary,{overrides:others});if(tokens[OVERRIDE_TOKENS[field]]===value.toUpperCase())delete colors[field];}const pair=STOREFRONT_THEME_RECIPES[theme].fonts;const fonts={...config.fonts?.heading&&config.fonts.heading!==pair.heading?{heading:config.fonts.heading}:{},...config.fonts?.body&&config.fonts.body!==pair.body?{body:config.fonts.body}:{}};const{fonts:_fonts,...rest}=config;return {...rest,colors,...fonts.heading||fonts.body?{fonts}:{}}}function pickOverrides(colors){const{background,foreground,accent,primaryForeground}=colors;return Object.fromEntries(Object.entries({background,foreground,accent,primaryForeground}).filter(([,v])=>!!v))}function defineSuiteOpConfig(config){return storefrontSiteConfigSchema.parse(config)}
5
+ var STOREFRONT_LOCALES=["en","fr","es","de","it","pt","nl"];var STOREFRONT_LAYOUTS=["listings","locations","areas","single"];var STOREFRONT_THEMES=["folio","hearth","circuit","tide","noir","fjord"];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(/^(\/(?![/\\])[^\t\n\r\\]*|https:\/\/[^\t\n\r\\]+)$/,"validation.storefront.link_href")},INVALID);var fontSchema=z.enum(STOREFRONT_FONTS,"validation.invalid_option");var storefrontSiteConfigSchema=z.object({layout:z.enum(STOREFRONT_LAYOUTS).optional().catch(void 0),theme:z.enum(STOREFRONT_THEMES).optional().catch(void 0),brand:z.object({name:text(80).min(1,REQUIRED),logoUrl:assetUrlSchema.nullable(),logoOnDarkUrl:assetUrlSchema.nullable().optional(),faviconUrl:assetUrlSchema.nullable()},INVALID),colors:z.object({primary:hexSchema,secondary:hexSchema.nullable().optional(),primaryForeground:hexSchema.optional(),background:hexSchema.optional(),foreground:hexSchema.optional(),accent:hexSchema.optional()},INVALID),fonts:z.object({heading:fontSchema.optional(),body:fontSchema.optional()},INVALID).optional(),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"});var DEFAULT_STOREFRONT_LAYOUT="listings";var DEFAULT_STOREFRONT_THEME="tide";var STOREFRONT_THEME_RECIPES={folio:{mode:"light",fonts:{heading:"eb_garamond",body:"libre_franklin"},radius:{sm:0,md:0,lg:0,btn:0},btn:{size:12,w:600,ls:"0.14em",tt:"uppercase",h:46},type:{display:[88,1,400,"-0.015em"],h1:[56,1.05,400,"-0.01em"],h2:[36,1.15,400,"0"],h3:[24,1.25,500,"0"],body:[18,1.6,400,"0"],small:[14,1.5,400,"0"],label:[11,1.3,600,"0.16em","uppercase"]},space:{section:144,gutter:32},neutral:{hue:null,mix:0,c:.006},L:{bg:.985,surface:1,surface2:.955,tint:.95,border:.87,ink:.19,muted:.47,dark:.22},C:{ink:.02,dark:.04,tint:.022},shadow:false},hearth:{mode:"light",fonts:{heading:"lora",body:"karla"},radius:{sm:6,md:12,lg:18,btn:8},btn:{size:15,w:700,ls:"0",tt:"none",h:48},type:{display:[64,1.08,500,"-0.01em"],h1:[48,1.12,500,"-0.01em"],h2:[32,1.2,500,"0"],h3:[22,1.3,600,"0"],body:[17,1.6,400,"0"],small:[14,1.5,400,"0"],label:[12,1.3,700,"0.1em","uppercase"]},space:{section:112,gutter:28},neutral:{hue:75,mix:.85,c:.014},L:{bg:.972,surface:.99,surface2:.945,tint:.935,border:.885,ink:.25,muted:.48,dark:.28},C:{ink:.025,dark:.05,tint:.032},shadow:true},circuit:{mode:"light",fonts:{heading:"space_grotesk",body:"ibm_plex_sans"},radius:{sm:8,md:12,lg:16,btn:999},btn:{size:15,w:600,ls:"-0.005em",tt:"none",h:44},type:{display:[64,1.02,600,"-0.035em"],h1:[44,1.08,600,"-0.03em"],h2:[30,1.15,600,"-0.02em"],h3:[20,1.3,600,"-0.01em"],body:[16,1.55,400,"0"],small:[14,1.45,400,"0"],label:[12,1.3,600,"0.02em"]},space:{section:88,gutter:20},neutral:{hue:null,mix:0,c:.004},L:{bg:1,surface:.975,surface2:.958,tint:.958,border:.915,ink:.17,muted:.48,dark:.19},C:{ink:.012,dark:.03,tint:.035},shadow:true},tide:{mode:"light",fonts:{heading:"outfit",body:"mulish"},radius:{sm:12,md:20,lg:28,btn:999},btn:{size:15,w:700,ls:"0.01em",tt:"none",h:50},type:{display:[76,1.02,300,"-0.02em"],h1:[48,1.1,400,"-0.015em"],h2:[34,1.15,400,"-0.01em"],h3:[21,1.3,500,"0"],body:[17,1.6,400,"0"],small:[14,1.5,400,"0"],label:[12,1.3,700,"0.08em","uppercase"]},space:{section:120,gutter:24},neutral:{hue:null,mix:0,c:.005},L:{bg:.99,surface:.968,surface2:.945,tint:.95,border:.905,ink:.26,muted:.48,dark:.29},C:{ink:.035,dark:.055,tint:.028},shadow:true},noir:{mode:"dark",fonts:{heading:"cormorant_garamond",body:"manrope"},radius:{sm:0,md:2,lg:2,btn:0},btn:{size:11,w:600,ls:"0.22em",tt:"uppercase",h:48},type:{display:[84,1,300,"0.02em","uppercase"],h1:[56,1.05,300,"0.01em"],h2:[38,1.15,400,"0"],h3:[24,1.25,500,"0.02em"],body:[16,1.7,400,"0"],small:[13,1.55,400,"0.01em"],label:[11,1.3,600,"0.24em","uppercase"]},space:{section:152,gutter:32},neutral:{hue:null,mix:0,c:.016},L:{bg:.165,surface:.205,surface2:.245,tint:.24,border:.34,ink:.94,muted:.76,dark:.12},C:{ink:.01,dark:.014,tint:.035},shadow:false},fjord:{mode:"light",fonts:{heading:"dm_sans",body:"dm_sans"},radius:{sm:2,md:4,lg:6,btn:4},btn:{size:14,w:500,ls:"0",tt:"none",h:44},type:{display:[60,1.05,500,"-0.03em"],h1:[42,1.1,500,"-0.025em"],h2:[28,1.2,500,"-0.015em"],h3:[19,1.35,500,"-0.005em"],body:[16,1.6,400,"0"],small:[13,1.5,400,"0"],label:[12,1.3,500,"0"]},space:{section:128,gutter:24},neutral:{hue:85,mix:.85,c:.006},L:{bg:.976,surface:.995,surface2:.948,tint:.945,border:.895,ink:.23,muted:.49,dark:.26},C:{ink:.008,dark:.02,tint:.022},shadow:false}};var clamp=(v,a,b)=>Math.min(b,Math.max(a,v));var toLin=c=>c<=.04045?c/12.92:Math.pow((c+.055)/1.055,2.4);var toGam=c=>c<=.0031308?12.92*c:1.055*Math.pow(c,1/2.4)-.055;var hexToRgb=hex=>{const h=hex.replace("#","");return [0,2,4].map(i=>parseInt(h.slice(i,i+2),16)/255)};var rgbToHex=rgb=>"#"+rgb.map(v=>Math.round(clamp(v,0,1)*255).toString(16).padStart(2,"0")).join("").toUpperCase();function hexToOklch(hex){const[r,g,b]=hexToRgb(hex).map(toLin);const l=Math.cbrt(.4122214708*r+.5363325363*g+.0514459929*b);const m=Math.cbrt(.2119034982*r+.6806995451*g+.1073969566*b);const s=Math.cbrt(.0883024619*r+.2817188376*g+.6299787005*b);const L=.2104542553*l+.793617785*m-.0040720468*s;const A=1.9779984951*l-2.428592205*m+.4505937099*s;const B=.0259040371*l+.7827717662*m-.808675766*s;let H=Math.atan2(B,A)*180/Math.PI;if(H<0)H+=360;return [L,Math.sqrt(A*A+B*B),H]}function oklchToLinear(L,C,H){const a=C*Math.cos(H*Math.PI/180);const b=C*Math.sin(H*Math.PI/180);const l=(L+.3963377774*a+.2158037573*b)**3;const m=(L-.1055613458*a-.0638541728*b)**3;const s=(L-.0894841775*a-1.291485548*b)**3;return [4.0767416621*l-3.3077115913*m+.2309699292*s,-1.2684380046*l+2.6097574011*m-.3413193965*s,-0.0041960863*l-.7034186147*m+1.707614701*s]}var inGamut=rgb=>rgb.every(v=>v>=-1e-4&&v<=1.0001);function oklchToHex(lightness,C,H){const L=clamp(lightness,0,1);let rgb=oklchToLinear(L,C,H);if(!inGamut(rgb)){let lo=0;let hi=C;for(let i=0;i<22;i++){const mid=(lo+hi)/2;if(inGamut(oklchToLinear(L,mid,H)))lo=mid;else hi=mid;}rgb=oklchToLinear(L,lo,H);}return rgbToHex(rgb.map(v=>toGam(clamp(v,0,1))))}var luminance=hex=>{const[r,g,b]=hexToRgb(hex).map(toLin);return .2126*r+.7152*g+.0722*b};function contrastRatio(a,b){const x=luminance(a);const y=luminance(b);return (Math.max(x,y)+.05)/(Math.min(x,y)+.05)}var minContrast=(hex,grounds)=>Math.min(...grounds.map(g=>contrastRatio(hex,g)));var rgba=(hex,alpha)=>{const[r,g,b]=hexToRgb(hex).map(v=>Math.round(v*255));return `rgba(${r},${g},${b},${alpha})`};var mixHue=(a,b,t)=>{const d=(b-a+540)%360-180;return (a+d*t+360)%360};function fit(lightness,C,H,grounds,target,dir){let L=lightness;let hex=oklchToHex(L,C,H);let steps=0;while(minContrast(hex,grounds)<target&&steps<100){L=clamp(L+dir*.01,0,1);hex=oklchToHex(L,C,H);steps++;}return {hex,L,steps}}var SERIF_FONTS=new Set(["playfair_display","merriweather","bitter","fraunces","cormorant_garamond","eb_garamond","lora","crimson_pro","source_serif_4","ibm_plex_serif"]);function storefrontFontStack(font){return `'${STOREFRONT_FONT_FAMILIES[font]}', ${SERIF_FONTS.has(font)?"serif":"sans-serif"}`}var AA=4.5;var INK=7;function derivePalette(recipe,brandHex,secondary,overrides){const[bL,bC,bH]=hexToOklch(brandHex);const nh=recipe.neutral.hue==null?bH:mixHue(bH,recipe.neutral.hue,recipe.neutral.mix);const nc=recipe.neutral.c;const{L,C}=recipe;const dark=recipe.mode==="dark";const dir=dark?1:-1;const N=(l,c=nc)=>oklchToHex(l,c,nh);const bg=overrides.background?.toUpperCase()??N(L.bg);const surface=N(L.surface,L.surface>=.999?0:nc);const surface2=N(L.surface2);const tint=oklchToHex(L.tint,Math.min(bC,C.tint),bH);const border=N(L.border,nc*1.5);const borderStrong=N(dark?L.border+.12:L.border-.2,nc*1.5);const grounds=[bg,surface,surface2,tint];const ink=overrides.foreground?.toUpperCase()??fit(L.ink,C.ink,nh,grounds,INK,dir).hex;const muted=fit(L.muted,nc*2.5,nh,grounds,AA,dir).hex;const brandText=fit(bL,bC,bH,grounds,AA,dir);const accentText=overrides.accent?.toUpperCase()??brandText.hex;const notes=[];let p;let on;if(!dark){const white=oklchToHex(.995,.003,bH);if(contrastRatio(brandHex,white)>=AA){p={hex:brandHex.toUpperCase(),L:bL};on=white;}else if(bL>=.7&&contrastRatio(brandHex,ink)>=AA){p={hex:brandHex.toUpperCase(),L:bL};on=ink;notes.push({code:"light_brand_ink_label",text:"Light brand: button keeps the colour and takes an ink label"});}else {p=fit(bL,bC,bH,[white],AA,-1);on=white;notes.push({code:"button_darkened",from:round2(bL),to:round2(p.L),text:`Button darkened L ${bL.toFixed(2)} \u2192 ${p.L.toFixed(2)} for a white label`});}}else {on=bg;p=fit(Math.max(bL,.72),bC,bH,[bg,surface],AA,1);if(p.L>bL+.005){notes.push({code:"brand_lifted",from:round2(bL),to:round2(p.L),text:`Brand lifted L ${bL.toFixed(2)} \u2192 ${p.L.toFixed(2)} to read on dark`});}}const onPrimary=overrides.primaryForeground?.toUpperCase()??on;let primaryHover=oklchToHex(p.L+(dark?.05:-0.06),bC,bH);if(contrastRatio(primaryHover,onPrimary)<AA){primaryHover=oklchToHex(p.L+(dark?-0.04:.04),bC,bH);}const darkToken=oklchToHex(L.dark,Math.min(bC,C.dark),bH);const phBg=dark?oklchToHex(.27,Math.min(bC,.03),bH):oklchToHex(L.tint-.045,Math.min(bC,.03),bH);const t={bg,surface,surface2,tint,border,borderStrong,ink,muted,primary:p.hex,onPrimary,primaryHover,accentText,dark:darkToken,onDark:oklchToHex(.97,.008,bH),onDarkMuted:fit(.82,.012,bH,[darkToken],AA,1).hex,darkAccent:fit(Math.max(bL,.72),bC,bH,[darkToken],AA,1).hex,focus:dark?p.hex:accentText,phBg,phText:fit(dark?.7:.48,.02,bH,[phBg],AA,dir).hex};if(secondary)t.accent2=fit(...hexToOklch(secondary),grounds,AA,dir).hex;if(!dark&&brandText.steps>0&&accentText===brandText.hex){notes.push({code:"brand_text_darkened",steps:brandText.steps,text:`Brand text darkened ${brandText.steps} step${brandText.steps>1?"s":""} to reach 4.5:1`});}return {t,notes}}var round2=n=>Math.round(n*100)/100;function failingOverride(t,overrides){const grounds=[t.bg,t.surface,t.surface2,t.tint];if(overrides.foreground){const ratio=minContrast(t.ink,grounds);if(ratio<AA)return {field:"foreground",ratio,against:"background"}}if(overrides.accent){const ratio=minContrast(t.accentText,grounds);if(ratio<AA)return {field:"accent",ratio,against:"background"}}if(overrides.primaryForeground){const ratio=contrastRatio(t.onPrimary,t.primary);if(ratio<AA)return {field:"primaryForeground",ratio,against:"button"}}if(overrides.background){const ratio=Math.min(contrastRatio(t.ink,t.bg),contrastRatio(t.muted,t.bg));if(ratio<AA)return {field:"background",ratio,against:"text"}}return null}function deriveStorefrontTheme(theme,brandHex,opts={}){const recipe=STOREFRONT_THEME_RECIPES[theme];const overrides={...opts.overrides};const problems=[];let palette=derivePalette(recipe,brandHex,opts.secondary,overrides);for(let problem=failingOverride(palette.t,overrides);problem;){problems.push({...problem,ratio:Math.round(problem.ratio*10)/10});delete overrides[problem.field];palette=derivePalette(recipe,brandHex,opts.secondary,overrides);problem=failingOverride(palette.t,overrides);}const{t,notes}=palette;const r=recipe.radius;const px=n=>`${n}px`;const vars={"--so-bg":t.bg,"--so-surface":t.surface,"--so-surface-2":t.surface2,"--so-tint":t.tint,"--so-border":t.border,"--so-border-strong":t.borderStrong,"--so-ink":t.ink,"--so-muted":t.muted,"--so-primary":t.primary,"--so-on-primary":t.onPrimary,"--so-primary-hover":t.primaryHover,"--so-accent-text":t.accentText,"--so-dark":t.dark,"--so-on-dark":t.onDark,"--so-on-dark-muted":t.onDarkMuted,"--so-dark-accent":t.darkAccent,"--so-focus":t.focus,"--so-ph-bg":t.phBg,"--so-ph-text":t.phText,"--so-ph-line":rgba(t.phText,.16),"--so-accent-2":t.accent2??t.accentText,"--so-scrim":`linear-gradient(180deg, ${rgba(t.dark,.55)} 0%, ${rgba(t.dark,0)} 26%, ${rgba(t.dark,0)} 40%, ${rgba(t.dark,.72)} 100%)`,"--so-scrim-solid":rgba(t.dark,.45),"--so-shadow":recipe.shadow?`0 1px 2px ${rgba(t.dark,.06)}, 0 10px 30px ${rgba(t.dark,.1)}`:"none","--so-shadow-float":`0 2px 6px ${rgba(t.dark,.08)}, 0 18px 50px ${rgba(t.dark,.18)}`,"--so-font-heading":storefrontFontStack(opts.heading??recipe.fonts.heading),"--so-font-body":storefrontFontStack(opts.body??recipe.fonts.body),"--so-r-sm":px(r.sm),"--so-r-md":px(r.md),"--so-r-lg":px(r.lg),"--so-r-btn":px(r.btn),"--so-btn-size":px(recipe.btn.size),"--so-btn-w":String(recipe.btn.w),"--so-btn-ls":recipe.btn.ls,"--so-btn-tt":recipe.btn.tt,"--so-btn-h":px(recipe.btn.h),"--so-section":px(recipe.space.section),"--so-gutter":px(recipe.space.gutter)};for(const[step,[size,lh,w,ls,tt]]of Object.entries(recipe.type)){vars[`--t-${step}-size`]=px(size);vars[`--t-${step}-lh`]=String(lh);vars[`--t-${step}-w`]=String(w);vars[`--t-${step}-ls`]=ls;vars[`--t-${step}-tt`]=tt??"none";}const grade=x=>x>=7?"AAA":x>=AA?"AA":"Fail";const checks=[["Body text",t.ink,t.bg],["Muted text",t.muted,t.surface2],["Button label",t.onPrimary,t.primary],["Brand text",t.accentText,t.bg],["On dark section",t.onDark,t.dark],["Brand on dark",t.darkAccent,t.dark]].map(([label,a,b])=>{const x=Math.round(contrastRatio(a,b)*10)/10;return {label,ratio:x.toFixed(1),grade:grade(x),pass:x>=AA}});return {theme,tokens:t,vars,checks,notes,problems}}function storefrontThemeFonts(theme,fonts){const pair=STOREFRONT_THEME_RECIPES[theme].fonts;return {heading:fonts?.heading??pair.heading,body:fonts?.body??pair.body}}function resolveStorefrontTheme(config){const theme=config.theme??DEFAULT_STOREFRONT_THEME;const fonts=storefrontThemeFonts(theme,config.fonts);const{primary,secondary,background,foreground,accent,primaryForeground}=explicitThemeChoices(config).colors;const derived=deriveStorefrontTheme(theme,primary,{secondary,...fonts,overrides:{background,foreground,accent,primaryForeground}});return {theme,layout:config.layout??DEFAULT_STOREFRONT_LAYOUT,fonts,derived,cssVariables:derived.vars}}var OVERRIDE_TOKENS={background:"bg",foreground:"ink",accent:"accentText",primaryForeground:"onPrimary"};var OVERRIDES=Object.keys(OVERRIDE_TOKENS);function explicitThemeChoices(config){const theme=config.theme??DEFAULT_STOREFRONT_THEME;const given=pickOverrides(config.colors);const colors={...config.colors};for(const field of OVERRIDES){const value=given[field];if(!value)continue;const others={...given};delete others[field];const{tokens}=deriveStorefrontTheme(theme,config.colors.primary,{overrides:others});if(tokens[OVERRIDE_TOKENS[field]]===value.toUpperCase())delete colors[field];}const pair=STOREFRONT_THEME_RECIPES[theme].fonts;const fonts={...config.fonts?.heading&&config.fonts.heading!==pair.heading?{heading:config.fonts.heading}:{},...config.fonts?.body&&config.fonts.body!==pair.body?{body:config.fonts.body}:{}};const{fonts:_fonts,...rest}=config;return {...rest,colors,...fonts.heading||fonts.body?{fonts}:{}}}function pickOverrides(colors){const{background,foreground,accent,primaryForeground}=colors;return Object.fromEntries(Object.entries({background,foreground,accent,primaryForeground}).filter(([,v])=>!!v))}function defineSuiteOpConfig(config){return storefrontSiteConfigSchema.parse(config)}
6
6
 
7
7
  export { DEFAULT_STOREFRONT_LAYOUT, DEFAULT_STOREFRONT_THEME, STOREFRONT_LAYOUTS, STOREFRONT_LOCALES, STOREFRONT_THEMES, STOREFRONT_THEME_RECIPES, defineSuiteOpConfig, deriveStorefrontTheme, resolveStorefrontTheme, storefrontSiteConfigSchema };
package/dist/content.cjs CHANGED
@@ -1,37 +1,37 @@
1
1
  'use strict';
2
2
 
3
- var chunkKMOZO6ZQ_cjs = require('./chunk-KMOZO6ZQ.cjs');
3
+ var chunkTS7VLM6W_cjs = require('./chunk-TS7VLM6W.cjs');
4
4
  require('./chunk-IGZVNTD2.cjs');
5
- require('./chunk-J5FZ4WDQ.cjs');
5
+ require('./chunk-OGVX5IEI.cjs');
6
6
  require('./chunk-EHQFWSP6.cjs');
7
7
 
8
8
 
9
9
 
10
10
  Object.defineProperty(exports, "contentModelSchema", {
11
11
  enumerable: true,
12
- get: function () { return chunkKMOZO6ZQ_cjs.contentModelSchema; }
12
+ get: function () { return chunkTS7VLM6W_cjs.contentModelSchema; }
13
13
  });
14
14
  Object.defineProperty(exports, "createContentReader", {
15
15
  enumerable: true,
16
- get: function () { return chunkKMOZO6ZQ_cjs.createContentReader; }
16
+ get: function () { return chunkTS7VLM6W_cjs.createContentReader; }
17
17
  });
18
18
  Object.defineProperty(exports, "defineContent", {
19
19
  enumerable: true,
20
- get: function () { return chunkKMOZO6ZQ_cjs.defineContent; }
20
+ get: function () { return chunkTS7VLM6W_cjs.defineContent; }
21
21
  });
22
22
  Object.defineProperty(exports, "field", {
23
23
  enumerable: true,
24
- get: function () { return chunkKMOZO6ZQ_cjs.field; }
24
+ get: function () { return chunkTS7VLM6W_cjs.field; }
25
25
  });
26
26
  Object.defineProperty(exports, "parseContentModel", {
27
27
  enumerable: true,
28
- get: function () { return chunkKMOZO6ZQ_cjs.parseContentModel; }
28
+ get: function () { return chunkTS7VLM6W_cjs.parseContentModel; }
29
29
  });
30
30
  Object.defineProperty(exports, "readFields", {
31
31
  enumerable: true,
32
- get: function () { return chunkKMOZO6ZQ_cjs.readFields; }
32
+ get: function () { return chunkTS7VLM6W_cjs.readFields; }
33
33
  });
34
34
  Object.defineProperty(exports, "toContentModel", {
35
35
  enumerable: true,
36
- get: function () { return chunkKMOZO6ZQ_cjs.toContentModel; }
36
+ get: function () { return chunkTS7VLM6W_cjs.toContentModel; }
37
37
  });
@@ -1,5 +1,5 @@
1
- import { R as RequestOptions, P as Page, u as StorefrontImage, q as StorefrontContentRef, l as StorefrontClient } from './client-w3nIcvlB.cjs';
2
- export { o as StorefrontContentItem } from './client-w3nIcvlB.cjs';
1
+ import { R as RequestOptions, P as Page, u as StorefrontImage, q as StorefrontContentRef, l as StorefrontClient } from './client-BW-ELwHu.cjs';
2
+ export { o as StorefrontContentItem } from './client-BW-ELwHu.cjs';
3
3
  import { z } from 'zod';
4
4
  import './availability.d-Cla9GuGc.cjs';
5
5
 
package/dist/content.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { R as RequestOptions, P as Page, u as StorefrontImage, q as StorefrontContentRef, l as StorefrontClient } from './client-CYEzQ7Ul.js';
2
- export { o as StorefrontContentItem } from './client-CYEzQ7Ul.js';
1
+ import { R as RequestOptions, P as Page, u as StorefrontImage, q as StorefrontContentRef, l as StorefrontClient } from './client-CCtoE6vX.js';
2
+ export { o as StorefrontContentItem } from './client-CCtoE6vX.js';
3
3
  import { z } from 'zod';
4
4
  import './availability.d-Cla9GuGc.js';
5
5
 
package/dist/content.js CHANGED
@@ -1,4 +1,4 @@
1
- export { contentModelSchema, createContentReader, defineContent, field, parseContentModel, readFields, toContentModel } from './chunk-GYLTB4RR.js';
1
+ export { contentModelSchema, createContentReader, defineContent, field, parseContentModel, readFields, toContentModel } from './chunk-LCEUS25M.js';
2
2
  import './chunk-6AGNQD7J.js';
3
- import './chunk-W5K7IDYN.js';
3
+ import './chunk-5QO273QX.js';
4
4
  import './chunk-IBCBDAGY.js';
@@ -1,4 +1,4 @@
1
- import { B as BookingResult, D as StorefrontQuote } from './client-CYEzQ7Ul.js';
1
+ import { B as BookingResult, D as StorefrontQuote } from './client-BW-ELwHu.cjs';
2
2
  import { z } from 'zod';
3
3
 
4
4
  declare const storefrontClientEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -142,7 +142,7 @@ declare function analyticsFor(publishableKey: string): StorefrontAnalytics;
142
142
  * and the SDK's own.
143
143
  * `StorefrontError.code` stays `string`, so a code a newer API adds degrades, never throws.
144
144
  */
145
- declare const STOREFRONT_ERROR_CODES: readonly ["wrong_region", "origin_not_allowed", "origin_required", "site_archived", "not_bookable", "quote_invalid", "quote_expired", "price_changed", "currency_unsupported", "payment_declined", "session_expired", "rate_limited", "contact_not_configured", "payment_account_unavailable", "idempotency_key_required", "idempotency_key_reused", "payment_mode_unsupported", "payment_not_authorized", "payment_method_required", "site_not_published", "preview_read_only", "bookings_closed", "extras_invalid", "UNAUTHORIZED", "VALIDATION_ERROR", "NOT_FOUND", "site_not_found", "upstream_timeout", "timeout", "network", "invalid_response", "internal_error", "checkout_unavailable"];
145
+ declare const STOREFRONT_ERROR_CODES: readonly ["wrong_region", "origin_not_allowed", "origin_required", "site_archived", "not_bookable", "quote_invalid", "quote_expired", "price_changed", "currency_unsupported", "payment_declined", "session_expired", "rate_limited", "pms_unavailable", "contact_not_configured", "payment_account_unavailable", "idempotency_key_required", "idempotency_key_reused", "payment_mode_unsupported", "payment_not_authorized", "payment_method_required", "site_not_published", "preview_read_only", "bookings_closed", "extras_invalid", "offer_code_refused", "loyalty_points_invalid", "UNAUTHORIZED", "VALIDATION_ERROR", "NOT_FOUND", "site_not_found", "upstream_timeout", "timeout", "network", "invalid_response", "internal_error", "checkout_unavailable"];
146
146
  type StorefrontErrorCode = (typeof STOREFRONT_ERROR_CODES)[number];
147
147
  type StorefrontRegion = 'us' | 'eu' | 'apac';
148
148
  interface StorefrontErrorInit {
@@ -1,4 +1,4 @@
1
- import { B as BookingResult, D as StorefrontQuote } from './client-w3nIcvlB.cjs';
1
+ import { B as BookingResult, D as StorefrontQuote } from './client-CCtoE6vX.js';
2
2
  import { z } from 'zod';
3
3
 
4
4
  declare const storefrontClientEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -142,7 +142,7 @@ declare function analyticsFor(publishableKey: string): StorefrontAnalytics;
142
142
  * and the SDK's own.
143
143
  * `StorefrontError.code` stays `string`, so a code a newer API adds degrades, never throws.
144
144
  */
145
- declare const STOREFRONT_ERROR_CODES: readonly ["wrong_region", "origin_not_allowed", "origin_required", "site_archived", "not_bookable", "quote_invalid", "quote_expired", "price_changed", "currency_unsupported", "payment_declined", "session_expired", "rate_limited", "contact_not_configured", "payment_account_unavailable", "idempotency_key_required", "idempotency_key_reused", "payment_mode_unsupported", "payment_not_authorized", "payment_method_required", "site_not_published", "preview_read_only", "bookings_closed", "extras_invalid", "UNAUTHORIZED", "VALIDATION_ERROR", "NOT_FOUND", "site_not_found", "upstream_timeout", "timeout", "network", "invalid_response", "internal_error", "checkout_unavailable"];
145
+ declare const STOREFRONT_ERROR_CODES: readonly ["wrong_region", "origin_not_allowed", "origin_required", "site_archived", "not_bookable", "quote_invalid", "quote_expired", "price_changed", "currency_unsupported", "payment_declined", "session_expired", "rate_limited", "pms_unavailable", "contact_not_configured", "payment_account_unavailable", "idempotency_key_required", "idempotency_key_reused", "payment_mode_unsupported", "payment_not_authorized", "payment_method_required", "site_not_published", "preview_read_only", "bookings_closed", "extras_invalid", "offer_code_refused", "loyalty_points_invalid", "UNAUTHORIZED", "VALIDATION_ERROR", "NOT_FOUND", "site_not_found", "upstream_timeout", "timeout", "network", "invalid_response", "internal_error", "checkout_unavailable"];
146
146
  type StorefrontErrorCode = (typeof STOREFRONT_ERROR_CODES)[number];
147
147
  type StorefrontRegion = 'us' | 'eu' | 'apac';
148
148
  interface StorefrontErrorInit {
package/dist/index.cjs CHANGED
@@ -1,95 +1,95 @@
1
1
  'use strict';
2
2
 
3
- var chunkH25KRMDV_cjs = require('./chunk-H25KRMDV.cjs');
4
- var chunkC32JK25B_cjs = require('./chunk-C32JK25B.cjs');
3
+ var chunk7FVBUJSF_cjs = require('./chunk-7FVBUJSF.cjs');
4
+ var chunkLI7MQZUZ_cjs = require('./chunk-LI7MQZUZ.cjs');
5
5
  require('./chunk-TGG3EO2D.cjs');
6
6
  require('./chunk-IGZVNTD2.cjs');
7
- var chunkJ5FZ4WDQ_cjs = require('./chunk-J5FZ4WDQ.cjs');
7
+ var chunkOGVX5IEI_cjs = require('./chunk-OGVX5IEI.cjs');
8
8
  require('./chunk-EHQFWSP6.cjs');
9
9
 
10
10
 
11
11
 
12
12
  Object.defineProperty(exports, "SDK_VERSION", {
13
13
  enumerable: true,
14
- get: function () { return chunkH25KRMDV_cjs.SDK_VERSION; }
14
+ get: function () { return chunk7FVBUJSF_cjs.SDK_VERSION; }
15
15
  });
16
16
  Object.defineProperty(exports, "STOREFRONT_API_PATH", {
17
17
  enumerable: true,
18
- get: function () { return chunkH25KRMDV_cjs.STOREFRONT_API_PATH; }
18
+ get: function () { return chunk7FVBUJSF_cjs.STOREFRONT_API_PATH; }
19
19
  });
20
20
  Object.defineProperty(exports, "STOREFRONT_API_VERSION", {
21
21
  enumerable: true,
22
- get: function () { return chunkH25KRMDV_cjs.STOREFRONT_API_VERSION; }
22
+ get: function () { return chunk7FVBUJSF_cjs.STOREFRONT_API_VERSION; }
23
23
  });
24
24
  Object.defineProperty(exports, "analyticsFor", {
25
25
  enumerable: true,
26
- get: function () { return chunkH25KRMDV_cjs.analyticsFor; }
26
+ get: function () { return chunk7FVBUJSF_cjs.analyticsFor; }
27
27
  });
28
28
  Object.defineProperty(exports, "createAnalytics", {
29
29
  enumerable: true,
30
- get: function () { return chunkH25KRMDV_cjs.createAnalytics; }
30
+ get: function () { return chunk7FVBUJSF_cjs.createAnalytics; }
31
31
  });
32
32
  Object.defineProperty(exports, "createStorefrontClient", {
33
33
  enumerable: true,
34
- get: function () { return chunkH25KRMDV_cjs.createStorefrontClient; }
34
+ get: function () { return chunk7FVBUJSF_cjs.createStorefrontClient; }
35
35
  });
36
36
  Object.defineProperty(exports, "getAttribution", {
37
37
  enumerable: true,
38
- get: function () { return chunkH25KRMDV_cjs.getAttribution; }
38
+ get: function () { return chunk7FVBUJSF_cjs.getAttribution; }
39
39
  });
40
40
  Object.defineProperty(exports, "parsePublishableKey", {
41
41
  enumerable: true,
42
- get: function () { return chunkH25KRMDV_cjs.parsePublishableKey; }
42
+ get: function () { return chunk7FVBUJSF_cjs.parsePublishableKey; }
43
43
  });
44
44
  Object.defineProperty(exports, "trackPurchasePixel", {
45
45
  enumerable: true,
46
- get: function () { return chunkH25KRMDV_cjs.trackPurchasePixel; }
46
+ get: function () { return chunk7FVBUJSF_cjs.trackPurchasePixel; }
47
47
  });
48
48
  Object.defineProperty(exports, "IMAGE_WIDTHS", {
49
49
  enumerable: true,
50
- get: function () { return chunkC32JK25B_cjs.CDN_IMAGE_WIDTHS; }
50
+ get: function () { return chunkLI7MQZUZ_cjs.CDN_IMAGE_WIDTHS; }
51
51
  });
52
52
  Object.defineProperty(exports, "imageProps", {
53
53
  enumerable: true,
54
- get: function () { return chunkC32JK25B_cjs.cdnImageProps; }
54
+ get: function () { return chunkLI7MQZUZ_cjs.cdnImageProps; }
55
55
  });
56
56
  Object.defineProperty(exports, "imageSrcSet", {
57
57
  enumerable: true,
58
- get: function () { return chunkC32JK25B_cjs.cdnImageSrcSet; }
58
+ get: function () { return chunkLI7MQZUZ_cjs.cdnImageSrcSet; }
59
59
  });
60
60
  Object.defineProperty(exports, "imageUrl", {
61
61
  enumerable: true,
62
- get: function () { return chunkC32JK25B_cjs.cdnImageUrl; }
62
+ get: function () { return chunkLI7MQZUZ_cjs.cdnImageUrl; }
63
63
  });
64
64
  Object.defineProperty(exports, "PriceChangedError", {
65
65
  enumerable: true,
66
- get: function () { return chunkJ5FZ4WDQ_cjs.PriceChangedError; }
66
+ get: function () { return chunkOGVX5IEI_cjs.PriceChangedError; }
67
67
  });
68
68
  Object.defineProperty(exports, "RateLimitedError", {
69
69
  enumerable: true,
70
- get: function () { return chunkJ5FZ4WDQ_cjs.RateLimitedError; }
70
+ get: function () { return chunkOGVX5IEI_cjs.RateLimitedError; }
71
71
  });
72
72
  Object.defineProperty(exports, "STOREFRONT_ERROR_CODES", {
73
73
  enumerable: true,
74
- get: function () { return chunkJ5FZ4WDQ_cjs.STOREFRONT_ERROR_CODES; }
74
+ get: function () { return chunkOGVX5IEI_cjs.STOREFRONT_ERROR_CODES; }
75
75
  });
76
76
  Object.defineProperty(exports, "StorefrontConfigError", {
77
77
  enumerable: true,
78
- get: function () { return chunkJ5FZ4WDQ_cjs.StorefrontConfigError; }
78
+ get: function () { return chunkOGVX5IEI_cjs.StorefrontConfigError; }
79
79
  });
80
80
  Object.defineProperty(exports, "StorefrontError", {
81
81
  enumerable: true,
82
- get: function () { return chunkJ5FZ4WDQ_cjs.StorefrontError; }
82
+ get: function () { return chunkOGVX5IEI_cjs.StorefrontError; }
83
83
  });
84
84
  Object.defineProperty(exports, "StorefrontNetworkError", {
85
85
  enumerable: true,
86
- get: function () { return chunkJ5FZ4WDQ_cjs.StorefrontNetworkError; }
86
+ get: function () { return chunkOGVX5IEI_cjs.StorefrontNetworkError; }
87
87
  });
88
88
  Object.defineProperty(exports, "StorefrontTimeoutError", {
89
89
  enumerable: true,
90
- get: function () { return chunkJ5FZ4WDQ_cjs.StorefrontTimeoutError; }
90
+ get: function () { return chunkOGVX5IEI_cjs.StorefrontTimeoutError; }
91
91
  });
92
92
  Object.defineProperty(exports, "WrongRegionError", {
93
93
  enumerable: true,
94
- get: function () { return chunkJ5FZ4WDQ_cjs.WrongRegionError; }
94
+ get: function () { return chunkOGVX5IEI_cjs.WrongRegionError; }
95
95
  });
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
- import { S as StorefrontRegion } from './errors-BkyyoQFu.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-BkyyoQFu.cjs';
1
+ import { S as StorefrontRegion } from './errors-5JYsbYj1.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-5JYsbYj1.cjs';
3
3
  import { z } from 'zod';
4
- export { B as BookingResult, C as CheckoutExtensions, a as CheckoutExtensionsOptions, b as CheckoutMountDescriptor, c as CheckoutSession, d as ConfirmCheckoutSessionInput, e as ConfirmCheckoutSessionRequest, f as ContentListQuery, g as CreateCheckoutSessionInput, h as CreateCheckoutSessionOptions, i as CreatedCheckoutSession, P as Page, R as RequestOptions, S as STOREFRONT_API_PATH, j as StorefrontBooking, k as StorefrontBuilding, l as StorefrontClient, m as StorefrontClientOptions, n as StorefrontContactInput, o as StorefrontContentItem, p as StorefrontContentModel, q as StorefrontContentRef, r as StorefrontGuestInput, s as StorefrontGuide, t as StorefrontGuideItem, u as StorefrontImage, v as StorefrontListing, w as StorefrontListingFacets, x as StorefrontListingSort, y as StorefrontListingSummary, z as StorefrontListingsQuery, A as StorefrontLocation, D as StorefrontQuote, E as StorefrontQuoteInput, F as StorefrontRatePlanQuote, G as StorefrontReview, H as StorefrontReviewsQuery, I as StorefrontSite, J as createStorefrontClient } from './client-w3nIcvlB.cjs';
4
+ export { B as BookingResult, C as CheckoutExtensions, a as CheckoutExtensionsOptions, b as CheckoutMountDescriptor, c as CheckoutSession, d as ConfirmCheckoutSessionInput, e as ConfirmCheckoutSessionRequest, f as ContentListQuery, g as CreateCheckoutSessionInput, h as CreateCheckoutSessionOptions, i as CreatedCheckoutSession, P as Page, R as RequestOptions, S as STOREFRONT_API_PATH, j as StorefrontBooking, k as StorefrontBuilding, l as StorefrontClient, m as StorefrontClientOptions, n as StorefrontContactInput, o as StorefrontContentItem, p as StorefrontContentModel, q as StorefrontContentRef, r as StorefrontGuestInput, s as StorefrontGuide, t as StorefrontGuideItem, u as StorefrontImage, v as StorefrontListing, w as StorefrontListingFacets, x as StorefrontListingSort, y as StorefrontListingSummary, z as StorefrontListingsQuery, A as StorefrontLocation, D as StorefrontQuote, E as StorefrontQuoteInput, F as StorefrontRatePlanQuote, G as StorefrontReview, H as StorefrontReviewsQuery, I as StorefrontSite, J as createStorefrontClient } from './client-BW-ELwHu.cjs';
5
5
  export { S as StorefrontAvailability, a as StorefrontBuildingAvailabilityQuery, b as StorefrontCalendar, c as StorefrontCalendarDay, d as StorefrontCalendarQuery, e as StorefrontStay, f as StorefrontUnavailableReason, g as StorefrontUnitAvailability, h as StorefrontUnitUnavailableReason } from './availability.d-Cla9GuGc.cjs';
6
6
 
7
7
  declare const attributionTouchSchema: z.ZodObject<{
@@ -97,6 +97,34 @@ declare const storefrontAttributionInputSchema: z.ZodObject<{
97
97
  social: "social";
98
98
  }>>>;
99
99
  }, z.core.$strip>>;
100
+ campaign: z.ZodOptional<z.ZodNullable<z.ZodObject<{
101
+ ts: z.ZodISODateTime;
102
+ landingPath: z.ZodString;
103
+ referrerHost: z.ZodNullable<z.ZodString>;
104
+ utmSource: z.ZodNullable<z.ZodString>;
105
+ utmMedium: z.ZodNullable<z.ZodString>;
106
+ utmCampaign: z.ZodNullable<z.ZodString>;
107
+ utmTerm: z.ZodNullable<z.ZodString>;
108
+ utmContent: z.ZodNullable<z.ZodString>;
109
+ gclid: z.ZodNullable<z.ZodString>;
110
+ gbraid: z.ZodNullable<z.ZodString>;
111
+ wbraid: z.ZodNullable<z.ZodString>;
112
+ fbclid: z.ZodNullable<z.ZodString>;
113
+ msclkid: z.ZodNullable<z.ZodString>;
114
+ paidClick: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
115
+ google: "google";
116
+ meta: "meta";
117
+ microsoft: "microsoft";
118
+ }>>>;
119
+ soSend: z.ZodDefault<z.ZodNullable<z.ZodUUID>>;
120
+ soChannel: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
121
+ email: "email";
122
+ phone: "phone";
123
+ qr: "qr";
124
+ sms: "sms";
125
+ social: "social";
126
+ }>>>;
127
+ }, z.core.$strip>>>;
100
128
  ids: z.ZodObject<{
101
129
  gaClientId: z.ZodNullable<z.ZodString>;
102
130
  gaSessionId: z.ZodNullable<z.ZodString>;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { S as StorefrontRegion } from './errors-SQ70Q9cy.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-SQ70Q9cy.js';
1
+ import { S as StorefrontRegion } from './errors-DPMLuWdA.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-DPMLuWdA.js';
3
3
  import { z } from 'zod';
4
- export { B as BookingResult, C as CheckoutExtensions, a as CheckoutExtensionsOptions, b as CheckoutMountDescriptor, c as CheckoutSession, d as ConfirmCheckoutSessionInput, e as ConfirmCheckoutSessionRequest, f as ContentListQuery, g as CreateCheckoutSessionInput, h as CreateCheckoutSessionOptions, i as CreatedCheckoutSession, P as Page, R as RequestOptions, S as STOREFRONT_API_PATH, j as StorefrontBooking, k as StorefrontBuilding, l as StorefrontClient, m as StorefrontClientOptions, n as StorefrontContactInput, o as StorefrontContentItem, p as StorefrontContentModel, q as StorefrontContentRef, r as StorefrontGuestInput, s as StorefrontGuide, t as StorefrontGuideItem, u as StorefrontImage, v as StorefrontListing, w as StorefrontListingFacets, x as StorefrontListingSort, y as StorefrontListingSummary, z as StorefrontListingsQuery, A as StorefrontLocation, D as StorefrontQuote, E as StorefrontQuoteInput, F as StorefrontRatePlanQuote, G as StorefrontReview, H as StorefrontReviewsQuery, I as StorefrontSite, J as createStorefrontClient } from './client-CYEzQ7Ul.js';
4
+ export { B as BookingResult, C as CheckoutExtensions, a as CheckoutExtensionsOptions, b as CheckoutMountDescriptor, c as CheckoutSession, d as ConfirmCheckoutSessionInput, e as ConfirmCheckoutSessionRequest, f as ContentListQuery, g as CreateCheckoutSessionInput, h as CreateCheckoutSessionOptions, i as CreatedCheckoutSession, P as Page, R as RequestOptions, S as STOREFRONT_API_PATH, j as StorefrontBooking, k as StorefrontBuilding, l as StorefrontClient, m as StorefrontClientOptions, n as StorefrontContactInput, o as StorefrontContentItem, p as StorefrontContentModel, q as StorefrontContentRef, r as StorefrontGuestInput, s as StorefrontGuide, t as StorefrontGuideItem, u as StorefrontImage, v as StorefrontListing, w as StorefrontListingFacets, x as StorefrontListingSort, y as StorefrontListingSummary, z as StorefrontListingsQuery, A as StorefrontLocation, D as StorefrontQuote, E as StorefrontQuoteInput, F as StorefrontRatePlanQuote, G as StorefrontReview, H as StorefrontReviewsQuery, I as StorefrontSite, J as createStorefrontClient } from './client-CCtoE6vX.js';
5
5
  export { S as StorefrontAvailability, a as StorefrontBuildingAvailabilityQuery, b as StorefrontCalendar, c as StorefrontCalendarDay, d as StorefrontCalendarQuery, e as StorefrontStay, f as StorefrontUnavailableReason, g as StorefrontUnitAvailability, h as StorefrontUnitUnavailableReason } from './availability.d-Cla9GuGc.js';
6
6
 
7
7
  declare const attributionTouchSchema: z.ZodObject<{
@@ -97,6 +97,34 @@ declare const storefrontAttributionInputSchema: z.ZodObject<{
97
97
  social: "social";
98
98
  }>>>;
99
99
  }, z.core.$strip>>;
100
+ campaign: z.ZodOptional<z.ZodNullable<z.ZodObject<{
101
+ ts: z.ZodISODateTime;
102
+ landingPath: z.ZodString;
103
+ referrerHost: z.ZodNullable<z.ZodString>;
104
+ utmSource: z.ZodNullable<z.ZodString>;
105
+ utmMedium: z.ZodNullable<z.ZodString>;
106
+ utmCampaign: z.ZodNullable<z.ZodString>;
107
+ utmTerm: z.ZodNullable<z.ZodString>;
108
+ utmContent: z.ZodNullable<z.ZodString>;
109
+ gclid: z.ZodNullable<z.ZodString>;
110
+ gbraid: z.ZodNullable<z.ZodString>;
111
+ wbraid: z.ZodNullable<z.ZodString>;
112
+ fbclid: z.ZodNullable<z.ZodString>;
113
+ msclkid: z.ZodNullable<z.ZodString>;
114
+ paidClick: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
115
+ google: "google";
116
+ meta: "meta";
117
+ microsoft: "microsoft";
118
+ }>>>;
119
+ soSend: z.ZodDefault<z.ZodNullable<z.ZodUUID>>;
120
+ soChannel: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
121
+ email: "email";
122
+ phone: "phone";
123
+ qr: "qr";
124
+ sms: "sms";
125
+ social: "social";
126
+ }>>>;
127
+ }, z.core.$strip>>>;
100
128
  ids: z.ZodObject<{
101
129
  gaClientId: z.ZodNullable<z.ZodString>;
102
130
  gaSessionId: z.ZodNullable<z.ZodString>;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- export { SDK_VERSION, STOREFRONT_API_PATH, STOREFRONT_API_VERSION, analyticsFor, createAnalytics, createStorefrontClient, getAttribution, parsePublishableKey, trackPurchasePixel } from './chunk-OGOT5DRO.js';
2
- export { CDN_IMAGE_WIDTHS as IMAGE_WIDTHS, cdnImageProps as imageProps, cdnImageSrcSet as imageSrcSet, cdnImageUrl as imageUrl } from './chunk-QWPIOXVO.js';
1
+ export { SDK_VERSION, STOREFRONT_API_PATH, STOREFRONT_API_VERSION, analyticsFor, createAnalytics, createStorefrontClient, getAttribution, parsePublishableKey, trackPurchasePixel } from './chunk-UDOZ3H5K.js';
2
+ export { CDN_IMAGE_WIDTHS as IMAGE_WIDTHS, cdnImageProps as imageProps, cdnImageSrcSet as imageSrcSet, cdnImageUrl as imageUrl } from './chunk-SCCDAZRA.js';
3
3
  import './chunk-26HFUROE.js';
4
4
  import './chunk-6AGNQD7J.js';
5
- export { PriceChangedError, RateLimitedError, STOREFRONT_ERROR_CODES, StorefrontConfigError, StorefrontError, StorefrontNetworkError, StorefrontTimeoutError, WrongRegionError } from './chunk-W5K7IDYN.js';
5
+ export { PriceChangedError, RateLimitedError, STOREFRONT_ERROR_CODES, StorefrontConfigError, StorefrontError, StorefrontNetworkError, StorefrontTimeoutError, WrongRegionError } from './chunk-5QO273QX.js';
6
6
  import './chunk-IBCBDAGY.js';
package/dist/react.cjs CHANGED
@@ -1,15 +1,15 @@
1
1
  'use strict';
2
2
 
3
- var chunkH25KRMDV_cjs = require('./chunk-H25KRMDV.cjs');
4
- var chunkUMCI4YBN_cjs = require('./chunk-UMCI4YBN.cjs');
3
+ var chunk7FVBUJSF_cjs = require('./chunk-7FVBUJSF.cjs');
4
+ var chunkXHR5XI3C_cjs = require('./chunk-XHR5XI3C.cjs');
5
5
  require('./chunk-TGG3EO2D.cjs');
6
6
  require('./chunk-IGZVNTD2.cjs');
7
- var chunkJ5FZ4WDQ_cjs = require('./chunk-J5FZ4WDQ.cjs');
7
+ var chunkOGVX5IEI_cjs = require('./chunk-OGVX5IEI.cjs');
8
8
  require('./chunk-EHQFWSP6.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:chunkH25KRMDV_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 chunkJ5FZ4WDQ_cjs.StorefrontConfigError(`${hookName} must be used inside <SuiteOpProvider>`);return value}function useStorefrontClient(){return useSuiteOpContext("useStorefrontClient").client}var useIsomorphicLayoutEffect=typeof window==="undefined"?react.useEffect:react.useLayoutEffect;function useLatest(value){const ref=react.useRef(value);useIsomorphicLayoutEffect(()=>{ref.current=value;});return ref}var SHARED_TTL_MS=3e4;function toStorefrontError(err){if(err instanceof chunkJ5FZ4WDQ_cjs.StorefrontError)return err;return new chunkJ5FZ4WDQ_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=useLatest(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,runRef]);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 chunkJ5FZ4WDQ_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);}};var CheckoutElement="suiteop-checkout";function SuiteOpCheckout(props){const client=useStorefrontClient();const ref=react.useRef(null);const handlers=react.useRef(props);handlers.current=props;react.useEffect(()=>{let active=true;chunkUMCI4YBN_cjs.loadCheckout({origin:props.checkoutOrigin}).catch(err=>{if(!active)return;const code=err instanceof chunkJ5FZ4WDQ_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(chunkH25KRMDV_cjs.STOREFRONT_API_PATH)?client.baseUrl.slice(0,-chunkH25KRMDV_cjs.STOREFRONT_API_PATH.length):client.baseUrl;return jsxRuntime.jsx(CheckoutElement,{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})}
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:chunk7FVBUJSF_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 chunkOGVX5IEI_cjs.StorefrontConfigError(`${hookName} must be used inside <SuiteOpProvider>`);return value}function useStorefrontClient(){return useSuiteOpContext("useStorefrontClient").client}var useIsomorphicLayoutEffect=typeof window==="undefined"?react.useEffect:react.useLayoutEffect;function useLatest(value){const ref=react.useRef(value);useIsomorphicLayoutEffect(()=>{ref.current=value;});return ref}var SHARED_TTL_MS=3e4;function toStorefrontError(err){if(err instanceof chunkOGVX5IEI_cjs.StorefrontError)return err;return new chunkOGVX5IEI_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=useLatest(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,runRef]);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 chunkOGVX5IEI_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);}};var CheckoutElement="suiteop-checkout";function SuiteOpCheckout(props){const client=useStorefrontClient();const ref=react.useRef(null);const handlers=react.useRef(props);handlers.current=props;react.useEffect(()=>{let active=true;chunkXHR5XI3C_cjs.loadCheckout({origin:props.checkoutOrigin}).catch(err=>{if(!active)return;const code=err instanceof chunkOGVX5IEI_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(chunk7FVBUJSF_cjs.STOREFRONT_API_PATH)?client.baseUrl.slice(0,-chunk7FVBUJSF_cjs.STOREFRONT_API_PATH.length):client.baseUrl;return jsxRuntime.jsx(CheckoutElement,{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 { e as StorefrontStay, S as StorefrontAvailability } from './availability.d-Cla9GuGc.cjs';
2
- import { g as CreateCheckoutSessionInput, h as CreateCheckoutSessionOptions, i as CreatedCheckoutSession, D as StorefrontQuote, v as StorefrontListing, E as StorefrontQuoteInput, l as StorefrontClient, B as BookingResult } from './client-w3nIcvlB.cjs';
3
- import { e as StorefrontError, T as TrackEvent } from './errors-BkyyoQFu.cjs';
2
+ import { g as CreateCheckoutSessionInput, h as CreateCheckoutSessionOptions, i as CreatedCheckoutSession, D as StorefrontQuote, v as StorefrontListing, E as StorefrontQuoteInput, l as StorefrontClient, B as BookingResult } from './client-BW-ELwHu.cjs';
3
+ import { e as StorefrontError, T as TrackEvent } from './errors-5JYsbYj1.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 { e as StorefrontStay, S as StorefrontAvailability } from './availability.d-Cla9GuGc.js';
2
- import { g as CreateCheckoutSessionInput, h as CreateCheckoutSessionOptions, i as CreatedCheckoutSession, D as StorefrontQuote, v as StorefrontListing, E as StorefrontQuoteInput, l as StorefrontClient, B as BookingResult } from './client-CYEzQ7Ul.js';
3
- import { e as StorefrontError, T as TrackEvent } from './errors-SQ70Q9cy.js';
2
+ import { g as CreateCheckoutSessionInput, h as CreateCheckoutSessionOptions, i as CreatedCheckoutSession, D as StorefrontQuote, v as StorefrontListing, E as StorefrontQuoteInput, l as StorefrontClient, B as BookingResult } from './client-CCtoE6vX.js';
3
+ import { e as StorefrontError, T as TrackEvent } from './errors-DPMLuWdA.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,8 +1,8 @@
1
- import { analyticsFor, STOREFRONT_API_PATH } from './chunk-OGOT5DRO.js';
2
- import { loadCheckout } from './chunk-7ZAI36LH.js';
1
+ import { analyticsFor, STOREFRONT_API_PATH } from './chunk-UDOZ3H5K.js';
2
+ import { loadCheckout } from './chunk-5PBR3IP6.js';
3
3
  import './chunk-26HFUROE.js';
4
4
  import './chunk-6AGNQD7J.js';
5
- import { StorefrontConfigError, PriceChangedError, StorefrontError } from './chunk-W5K7IDYN.js';
5
+ import { StorefrontConfigError, PriceChangedError, StorefrontError } from './chunk-5QO273QX.js';
6
6
  import './chunk-IBCBDAGY.js';
7
7
  import { createContext, useMemo, useEffect, useContext, useCallback, useState, useRef, useLayoutEffect } from 'react';
8
8
  import { jsx } from 'react/jsx-runtime';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suiteop/storefront",
3
- "version": "0.7.1",
3
+ "version": "0.8.0",
4
4
  "description": "Typed client, React hooks and headless components for the SuiteOp Storefront API.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://developer.suiteop.com",