@builder.io/sdk-react-nextjs 0.6.4 → 0.7.1-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 (37) hide show
  1. package/lib/browser/USE_CLIENT_BUNDLE-7a3bf41a.mjs +657 -0
  2. package/lib/browser/USE_CLIENT_BUNDLE-9195e6a5.js +23 -0
  3. package/lib/{edge/USE_SERVER_BUNDLE-5955a553.js → browser/USE_SERVER_BUNDLE-d7b13097.js} +1 -1
  4. package/lib/browser/USE_SERVER_BUNDLE-e5c2279a.mjs +11 -0
  5. package/lib/browser/{bundle-e116a057.js → bundle-620ae296.js} +9 -9
  6. package/lib/browser/{bundle-6ca5e123.mjs → bundle-7285a09d.mjs} +268 -267
  7. package/lib/browser/index.cjs +1 -1
  8. package/lib/browser/index.mjs +3 -3
  9. package/lib/edge/USE_CLIENT_BUNDLE-3cca560e.js +23 -0
  10. package/lib/edge/USE_CLIENT_BUNDLE-4a0cfa69.mjs +657 -0
  11. package/lib/{node/USE_SERVER_BUNDLE-c4ad0f9f.js → edge/USE_SERVER_BUNDLE-3f12faf4.js} +1 -1
  12. package/lib/edge/USE_SERVER_BUNDLE-f184d7eb.mjs +11 -0
  13. package/lib/edge/{bundle-df0d312f.js → bundle-a0f5cad2.js} +25 -25
  14. package/lib/edge/{bundle-1e4b4476.mjs → bundle-a5949d33.mjs} +1082 -1081
  15. package/lib/edge/index.cjs +1 -1
  16. package/lib/edge/index.mjs +3 -3
  17. package/lib/node/USE_CLIENT_BUNDLE-63c7fe77.js +61 -0
  18. package/lib/node/USE_CLIENT_BUNDLE-d9e90ed7.mjs +747 -0
  19. package/lib/node/USE_SERVER_BUNDLE-22e86776.mjs +11 -0
  20. package/lib/{browser/USE_SERVER_BUNDLE-c4ad0f9f.js → node/USE_SERVER_BUNDLE-cd844269.js} +1 -1
  21. package/lib/node/{bundle-6ca5e123.mjs → bundle-0358b224.mjs} +417 -442
  22. package/lib/node/bundle-630ffe6d.js +76 -0
  23. package/lib/node/index.cjs +1 -1
  24. package/lib/node/index.mjs +23 -22
  25. package/package.json +6 -3
  26. package/types/blocks/image/image.d.ts +1 -1
  27. package/types/constants/sdk-version.d.ts +1 -1
  28. package/lib/browser/USE_CLIENT_BUNDLE-4b8ab2a7.js +0 -23
  29. package/lib/browser/USE_CLIENT_BUNDLE-f8df6014.mjs +0 -620
  30. package/lib/browser/USE_SERVER_BUNDLE-a9a2d553.mjs +0 -11
  31. package/lib/edge/USE_CLIENT_BUNDLE-bd1c5cd0.mjs +0 -620
  32. package/lib/edge/USE_CLIENT_BUNDLE-fc2e4ccd.js +0 -23
  33. package/lib/edge/USE_SERVER_BUNDLE-079fd7e9.mjs +0 -11
  34. package/lib/node/USE_CLIENT_BUNDLE-4b8ab2a7.js +0 -23
  35. package/lib/node/USE_CLIENT_BUNDLE-f8df6014.mjs +0 -620
  36. package/lib/node/USE_SERVER_BUNDLE-a9a2d553.mjs +0 -11
  37. package/lib/node/bundle-e116a057.js +0 -76
@@ -1,23 +0,0 @@
1
- "use client";"use strict";const t=require("react/jsx-runtime"),n=require("./bundle-e116a057.js"),r=require("react"),W=require("./USE_SERVER_BUNDLE-c4ad0f9f.js"),_=require("next/navigation");function A(e){return t.jsxs(t.Fragment,{children:[e.link?t.jsx(t.Fragment,{children:t.jsx("a",{role:"button",...e.attributes,href:e.link,target:e.openLinkInNewTab?"_blank":void 0,children:e.text})}):t.jsx(t.Fragment,{children:t.jsx("button",{...e.attributes,style:e.attributes.style,className:e.attributes.className+" button-3e7bc8b2",children:e.text})}),t.jsx("style",{children:`.button-3e7bc8b2 {
2
- all: unset;
3
- }`})]})}function z(e){return t.jsx(e.Wrapper,{...e.wrapperProps,attributes:{...n.getBlockProperties({block:e.block,context:e.context}),...n.getBlockActions({block:e.block,rootState:e.context.rootState,rootSetState:e.context.rootSetState,localState:e.context.localState,context:e.context.context})},children:e.children})}function K(e){return t.jsxs(t.Fragment,{children:[" ",e.hasChildren?t.jsx(t.Fragment,{children:t.jsxs(e.Wrapper,{...n.getBlockProperties({block:e.block,context:e.context}),...n.getBlockActions({block:e.block,rootState:e.context.rootState,rootSetState:e.context.rootSetState,localState:e.context.localState,context:e.context.context,stripPrefix:!0}),children:[" ",e.children," "]})}):t.jsx(t.Fragment,{children:t.jsx(e.Wrapper,{...n.getBlockProperties({block:e.block,context:e.context}),...n.getBlockActions({block:e.block,rootState:e.context.rootState,rootSetState:e.context.rootSetState,localState:e.context.localState,context:e.context.context,stripPrefix:!0})})})," "]})}function U(e){function l(){var a;return"builder-blocks"+((a=e.blocks)!=null&&a.length?"":" no-blocks")}function g(){var a,f;n.isEditing()&&!((a=e.blocks)!=null&&a.length)&&((f=window.parent)==null||f.postMessage({type:"builder.clickEmptyBlocks",data:{parentElementId:e.parent,dataPath:e.path}},"*"))}function k(){var a,f;n.isEditing()&&!((a=e.blocks)!=null&&a.length)&&((f=window.parent)==null||f.postMessage({type:"builder.hoverEmptyBlocks",data:{parentElementId:e.parent,dataPath:e.path}},"*"))}return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:l()+" div-5821bd52","builder-path":e.path,"builder-parent-id":e.parent,style:e.styleProp,onClick:a=>g(),onMouseEnter:a=>k(),onKeyPress:a=>g(),children:e.children}),t.jsx("style",{children:`.div-5821bd52 {
4
- display: flex;
5
- flex-direction: column;
6
- align-items: stretch;
7
- }`})]})}function V(e){return t.jsx("span",{children:e.children})}function D(e){var a,f,h,v;function l(){var m;const o=e.image||e.src;if(!o||!(o.match(/builder\.io/)||o.match(/cdn\.shopify\.com/)))return e.srcset;if(e.srcset&&((m=e.image)!=null&&m.includes("builder.io/api/v1/image"))){if(!e.srcset.includes(e.image.split("?")[0]))return console.debug("Removed given srcset"),n.getSrcSet(o)}else if(e.image&&!e.srcset)return n.getSrcSet(o);return n.getSrcSet(o)}function g(){var b;return(b=l==null?void 0:l())!=null&&b.match(/builder\.io/)&&!e.noWebp?l().replace(/\?/g,"?format=webp&"):""}function k(){const b={position:"absolute",height:"100%",width:"100%",left:"0px",top:"0px"};return e.aspectRatio?b:void 0}return t.jsxs(t.Fragment,{children:[t.jsxs(t.Fragment,{children:[t.jsxs("picture",{children:[g()?t.jsx(t.Fragment,{children:t.jsx("source",{type:"image/webp",srcSet:g()})}):null,t.jsx("img",{loading:"lazy",alt:e.altText,role:e.altText?"presentation":void 0,style:{objectPosition:e.backgroundPosition||"center",objectFit:e.backgroundSize||"cover",...k()},className:"builder-image"+(e.className?" "+e.className:"")+" img-ef11a6be",src:e.image,srcSet:l(),sizes:e.sizes})]}),e.aspectRatio&&!((f=(a=e.builderBlock)==null?void 0:a.children)!=null&&f.length&&e.fitContent)?t.jsx(t.Fragment,{children:t.jsx("div",{className:"builder-image-sizer div-ef11a6be",style:{paddingTop:e.aspectRatio*100+"%"}})}):null,(v=(h=e.builderBlock)==null?void 0:h.children)!=null&&v.length&&e.fitContent?t.jsx(t.Fragment,{children:e.children}):null,!e.fitContent&&e.children?t.jsx(t.Fragment,{children:t.jsx("div",{className:"div-ef11a6be-2",children:e.children})}):null]}),t.jsx("style",{children:`.img-ef11a6be {
8
- opacity: 1;
9
- transition: opacity 0.2s ease-in-out;
10
- }.div-ef11a6be {
11
- width: 100%;
12
- pointer-events: none;
13
- font-size: 0;
14
- }.div-ef11a6be-2 {
15
- display: flex;
16
- flex-direction: column;
17
- align-items: stretch;
18
- position: absolute;
19
- top: 0;
20
- left: 0;
21
- width: 100%;
22
- height: 100%;
23
- }`})]})}function H(e){return t.jsx("section",{...e.attributes,style:{width:"100%",alignSelf:"stretch",flexGrow:1,boxSizing:"border-box",maxWidth:e.maxWidth||1200,display:"flex",flexDirection:"column",alignItems:"stretch",marginLeft:"auto",marginRight:"auto"},children:e.children})}function J(e){var k;function l(){return{...e.autoPlay===!0?{autoPlay:!0}:{},...e.muted===!0?{muted:!0}:{},...e.controls===!0?{controls:!0}:{},...e.loop===!0?{loop:!0}:{},...e.playsInline===!0?{playsInline:!0}:{}}}function g(){return{...e.attributes,...l()}}return t.jsx("video",{...g(),preload:e.preload||"metadata",style:{width:"100%",height:"100%",...(k=e.attributes)==null?void 0:k.style,objectFit:e.fit,objectPosition:e.position,borderRadius:1},src:e.video||"no-src",poster:e.posterImage})}function O(e){const l=r.useRef(null),[g,k]=r.useState(()=>[]),[a,f]=r.useState(()=>[]),[h,v]=r.useState(()=>!1);function b(){if(!l.current||!l.current.getElementsByTagName)return;const o=l.current.getElementsByTagName("script");for(let m=0;m<o.length;m++){const x=o[m];if(x.src&&!g.includes(x.src)){g.push(x.src);const y=document.createElement("script");y.async=!0,y.src=x.src,document.head.appendChild(y)}else if(n.isJsScript(x)&&!a.includes(x.innerText))try{a.push(x.innerText),new Function(x.innerText)()}catch(y){console.warn("`Embed`: Error running script:",y)}}}return r.useEffect(()=>{l.current&&!h&&(v(!0),b())},[l.current,h]),t.jsx("div",{className:"builder-embed",ref:l,dangerouslySetInnerHTML:{__html:e.content}})}function G(e){return t.jsx("img",{style:{objectFit:e.backgroundSize||"cover",objectPosition:e.backgroundPosition||"center"},alt:e.altText,src:e.imgSrc||e.image,...e.attributes},n.isEditing()&&e.imgSrc||"default-key")}function Q(e){const l=r.useRef(null),[g,k]=r.useState(()=>[]),[a,f]=r.useState(()=>[]);function h(){if(l.current&&l.current.getElementsByTagName&&typeof window<"u"){const v=l.current.getElementsByTagName("script");for(let b=0;b<v.length;b++){const o=v[b];if(o.src){if(g.includes(o.src))continue;g.push(o.src);const m=document.createElement("script");m.async=!0,m.src=o.src,document.head.appendChild(m)}else if(!o.type||["text/javascript","application/javascript","application/ecmascript"].includes(o.type)){if(a.includes(o.innerText))continue;try{a.push(o.innerText),new Function(o.innerText)()}catch(m){console.warn("`CustomCode`: Error running script:",m)}}}}}return r.useEffect(()=>{h()},[]),t.jsx("div",{ref:l,className:"builder-custom-code"+(e.replaceNodes?" replace-nodes":""),dangerouslySetInnerHTML:{__html:e.code}})}const X=r.createContext({content:null,context:{},localState:void 0,rootSetState(){},rootState:{},apiKey:null,apiVersion:void 0,componentInfos:{},inheritedStyles:{}});function Y(e){var R,I,w,T,F;const l=r.useRef(null),[g,k]=r.useState(()=>n.checkIsDefined(e.canTrack)?e.canTrack:!0),[a,f]=r.useState(()=>0);function h(i){var c,d,u,S,P;const s={...e.builderContextSignal.content,...i,data:{...(c=e.builderContextSignal.content)==null?void 0:c.data,...i==null?void 0:i.data},meta:{...(d=e.builderContextSignal.content)==null?void 0:d.meta,...i==null?void 0:i.meta,breakpoints:((u=i==null?void 0:i.meta)==null?void 0:u.breakpoints)||((P=(S=e.builderContextSignal.content)==null?void 0:S.meta)==null?void 0:P.breakpoints)}};W.postPreviewContent({value:s,key:s.id}).then(()=>{M.refresh()})}r.useState(()=>0);const[v,b]=r.useState(()=>!1);function o(i){var c;const{data:s}=i;if(s)switch(s.type){case"builder.configureSdk":{const d=s.data,{breakpoints:u,contentId:S}=d;if(!S||S!==((c=e.builderContextSignal.content)==null?void 0:c.id))return;u&&h({meta:{breakpoints:u}}),f(a+1);break}case"builder.contentUpdate":{const d=s.data,u=d.key||d.alias||d.entry||d.modelName,S=d.data;u===e.model&&(h(S),f(a+1));break}}}function m(){var s,c;const i=(c=(s=e.builderContextSignal.content)==null?void 0:s.data)==null?void 0:c.jsCode;i&&n.evaluate({code:i,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState})}const[x,y]=r.useState(()=>({})),[E,B]=r.useState(()=>!1);function N(i){var s,c;if(e.builderContextSignal.content){const d=(s=e.builderContextSignal.content)==null?void 0:s.testVariationId,u=(c=e.builderContextSignal.content)==null?void 0:c.id;n._track({type:"click",canTrack:g,contentId:u,apiKey:e.apiKey,variationId:d!==u?d:void 0,...n.getInteractionPropertiesForEvent(i),unique:!E})}E||B(!0)}function q(i){return i.replace(/{{([^}]+)}}/g,(s,c)=>n.evaluate({code:c,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState}))}function L({url:i,key:s}){n.fetch(i).then(c=>c.json()).then(c=>{var u,S;const d={...e.builderContextSignal.rootState,[s]:c};(S=(u=e.builderContextSignal).rootSetState)==null||S.call(u,d),x[s]=!0}).catch(c=>{console.error("error fetching dynamic data",i,c)})}function j(){var s,c;const i=((c=(s=e.builderContextSignal.content)==null?void 0:s.data)==null?void 0:c.httpRequests)??{};Object.entries(i).forEach(([d,u])=>{if(u&&(!x[d]||n.isEditing())){const S=q(u);L({url:S,key:d})}})}function C(){n.isEditing()&&window.dispatchEvent(new CustomEvent("builder:component:stateChange",{detail:{state:n.fastClone(e.builderContextSignal.rootState),ref:{name:e.model}}}))}const M=_.useRouter();return r.useEffect(()=>{var i,s;if(e.apiKey||n.logger.error("No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."),n.isBrowser()){if(n.isEditing()&&(f(a+1),window.addEventListener("message",o),n.registerInsertMenu(),n.setupBrowserForEditing({...e.locale?{locale:e.locale}:{},...e.includeRefs?{includeRefs:e.includeRefs}:{},...e.enrich?{enrich:e.enrich}:{}}),Object.values(e.builderContextSignal.componentInfos).forEach(c=>{var u;const d=n.createRegisterComponentMessage(c);(u=window.parent)==null||u.postMessage(d,"*")}),window.addEventListener("builder:component:stateChangeListenerActivated",C)),e.builderContextSignal.content){const c=(i=e.builderContextSignal.content)==null?void 0:i.testVariationId,d=(s=e.builderContextSignal.content)==null?void 0:s.id;n._track({type:"impression",canTrack:g,contentId:d,apiKey:e.apiKey,variationId:c!==d?c:void 0})}m(),j(),C()}},[]),r.useEffect(()=>{},[e.content]),r.useEffect(()=>{n.isBrowser()&&(window.removeEventListener("message",o),window.addEventListener("message",o))},[v]),r.useEffect(()=>{m()},[(I=(R=e.builderContextSignal.content)==null?void 0:R.data)==null?void 0:I.jsCode,e.builderContextSignal.rootState]),r.useEffect(()=>{j()},[(T=(w=e.builderContextSignal.content)==null?void 0:w.data)==null?void 0:T.httpRequests]),r.useEffect(()=>{C()},[e.builderContextSignal.rootState]),r.useEffect(()=>()=>{n.isBrowser()&&(window.removeEventListener("message",o),window.removeEventListener("builder:component:stateChangeListenerActivated",C))},[]),t.jsx(X.Provider,{value:e.builderContextSignal,children:e.builderContextSignal.content?t.jsx(t.Fragment,{children:t.jsx("div",{ref:l,onClick:i=>N(i),"builder-content-id":(F=e.builderContextSignal.content)==null?void 0:F.id,"builder-model":e.model,...e.showContent?{}:{hidden:!0,"aria-hidden":!0},className:e.classNameProp,children:e.children},a)}):null})}exports.BlockWrapper=K;exports.BlocksWrapper=U;exports.Button=A;exports.CustomCode=Q;exports.Embed=O;exports.EnableEditor=Y;exports.FragmentComponent=V;exports.Image=D;exports.ImgComponent=G;exports.InteractiveElement=z;exports.SectionComponent=H;exports.Video=J;
@@ -1,620 +0,0 @@
1
- "use client";
2
- import { jsxs as C, Fragment as b, jsx as n } from "react/jsx-runtime";
3
- import { g as P, a as N, i as I, b as w, c as O, d as G, l as Q, e as T, r as X, s as Y, f as Z, _, h as A, j as $, k as p, m as ee } from "./bundle-6ca5e123.mjs";
4
- import { useRef as j, useState as S, useEffect as y, createContext as te } from "react";
5
- import { p as ne } from "./USE_SERVER_BUNDLE-a9a2d553.mjs";
6
- import { useRouter as ie } from "next/navigation";
7
- function se(e) {
8
- return /* @__PURE__ */ C(b, { children: [
9
- e.link ? /* @__PURE__ */ n(b, { children: /* @__PURE__ */ n(
10
- "a",
11
- {
12
- role: "button",
13
- ...e.attributes,
14
- href: e.link,
15
- target: e.openLinkInNewTab ? "_blank" : void 0,
16
- children: e.text
17
- }
18
- ) }) : /* @__PURE__ */ n(b, { children: /* @__PURE__ */ n(
19
- "button",
20
- {
21
- ...e.attributes,
22
- style: e.attributes.style,
23
- className: e.attributes.className + " button-3e7bc8b2",
24
- children: e.text
25
- }
26
- ) }),
27
- /* @__PURE__ */ n("style", { children: `.button-3e7bc8b2 {
28
- all: unset;
29
- }` })
30
- ] });
31
- }
32
- function ue(e) {
33
- return /* @__PURE__ */ n(
34
- e.Wrapper,
35
- {
36
- ...e.wrapperProps,
37
- attributes: {
38
- ...P({
39
- block: e.block,
40
- context: e.context
41
- }),
42
- ...N({
43
- block: e.block,
44
- rootState: e.context.rootState,
45
- rootSetState: e.context.rootSetState,
46
- localState: e.context.localState,
47
- context: e.context.context
48
- })
49
- },
50
- children: e.children
51
- }
52
- );
53
- }
54
- function me(e) {
55
- return /* @__PURE__ */ C(b, { children: [
56
- " ",
57
- e.hasChildren ? /* @__PURE__ */ n(b, { children: /* @__PURE__ */ C(
58
- e.Wrapper,
59
- {
60
- ...P({
61
- block: e.block,
62
- context: e.context
63
- }),
64
- ...N({
65
- block: e.block,
66
- rootState: e.context.rootState,
67
- rootSetState: e.context.rootSetState,
68
- localState: e.context.localState,
69
- context: e.context.context,
70
- stripPrefix: !0
71
- }),
72
- children: [
73
- " ",
74
- e.children,
75
- " "
76
- ]
77
- }
78
- ) }) : /* @__PURE__ */ n(b, { children: /* @__PURE__ */ n(
79
- e.Wrapper,
80
- {
81
- ...P({
82
- block: e.block,
83
- context: e.context
84
- }),
85
- ...N({
86
- block: e.block,
87
- rootState: e.context.rootState,
88
- rootSetState: e.context.rootSetState,
89
- localState: e.context.localState,
90
- context: e.context.context,
91
- stripPrefix: !0
92
- })
93
- }
94
- ) }),
95
- " "
96
- ] });
97
- }
98
- function be(e) {
99
- function o() {
100
- var a;
101
- return "builder-blocks" + ((a = e.blocks) != null && a.length ? "" : " no-blocks");
102
- }
103
- function s() {
104
- var a, m;
105
- I() && !((a = e.blocks) != null && a.length) && ((m = window.parent) == null || m.postMessage(
106
- {
107
- type: "builder.clickEmptyBlocks",
108
- data: {
109
- parentElementId: e.parent,
110
- dataPath: e.path
111
- }
112
- },
113
- "*"
114
- ));
115
- }
116
- function v() {
117
- var a, m;
118
- I() && !((a = e.blocks) != null && a.length) && ((m = window.parent) == null || m.postMessage(
119
- {
120
- type: "builder.hoverEmptyBlocks",
121
- data: {
122
- parentElementId: e.parent,
123
- dataPath: e.path
124
- }
125
- },
126
- "*"
127
- ));
128
- }
129
- return /* @__PURE__ */ C(b, { children: [
130
- /* @__PURE__ */ n(
131
- "div",
132
- {
133
- className: o() + " div-5821bd52",
134
- "builder-path": e.path,
135
- "builder-parent-id": e.parent,
136
- style: e.styleProp,
137
- onClick: (a) => s(),
138
- onMouseEnter: (a) => v(),
139
- onKeyPress: (a) => s(),
140
- children: e.children
141
- }
142
- ),
143
- /* @__PURE__ */ n("style", { children: `.div-5821bd52 {
144
- display: flex;
145
- flex-direction: column;
146
- align-items: stretch;
147
- }` })
148
- ] });
149
- }
150
- function fe(e) {
151
- return /* @__PURE__ */ n("span", { children: e.children });
152
- }
153
- function ge(e) {
154
- var a, m, x, k;
155
- function o() {
156
- var u;
157
- const c = e.image || e.src;
158
- if (!c || // We can auto add srcset for cdn.builder.io and shopify
159
- // images, otherwise you can supply this prop manually
160
- !(c.match(/builder\.io/) || c.match(/cdn\.shopify\.com/)))
161
- return e.srcset;
162
- if (e.srcset && ((u = e.image) != null && u.includes("builder.io/api/v1/image"))) {
163
- if (!e.srcset.includes(e.image.split("?")[0]))
164
- return console.debug("Removed given srcset"), w(c);
165
- } else if (e.image && !e.srcset)
166
- return w(c);
167
- return w(c);
168
- }
169
- function s() {
170
- var f;
171
- return (f = o == null ? void 0 : o()) != null && f.match(/builder\.io/) && !e.noWebp ? o().replace(/\?/g, "?format=webp&") : "";
172
- }
173
- function v() {
174
- const f = {
175
- position: "absolute",
176
- height: "100%",
177
- width: "100%",
178
- left: "0px",
179
- top: "0px"
180
- };
181
- return e.aspectRatio ? f : void 0;
182
- }
183
- return /* @__PURE__ */ C(b, { children: [
184
- /* @__PURE__ */ C(b, { children: [
185
- /* @__PURE__ */ C("picture", { children: [
186
- s() ? /* @__PURE__ */ n(b, { children: /* @__PURE__ */ n("source", { type: "image/webp", srcSet: s() }) }) : null,
187
- /* @__PURE__ */ n(
188
- "img",
189
- {
190
- loading: "lazy",
191
- alt: e.altText,
192
- role: e.altText ? "presentation" : void 0,
193
- style: {
194
- objectPosition: e.backgroundPosition || "center",
195
- objectFit: e.backgroundSize || "cover",
196
- ...v()
197
- },
198
- className: "builder-image" + (e.className ? " " + e.className : "") + " img-ef11a6be",
199
- src: e.image,
200
- srcSet: o(),
201
- sizes: e.sizes
202
- }
203
- )
204
- ] }),
205
- e.aspectRatio && !((m = (a = e.builderBlock) == null ? void 0 : a.children) != null && m.length && e.fitContent) ? /* @__PURE__ */ n(b, { children: /* @__PURE__ */ n(
206
- "div",
207
- {
208
- className: "builder-image-sizer div-ef11a6be",
209
- style: {
210
- paddingTop: e.aspectRatio * 100 + "%"
211
- }
212
- }
213
- ) }) : null,
214
- (k = (x = e.builderBlock) == null ? void 0 : x.children) != null && k.length && e.fitContent ? /* @__PURE__ */ n(b, { children: e.children }) : null,
215
- !e.fitContent && e.children ? /* @__PURE__ */ n(b, { children: /* @__PURE__ */ n("div", { className: "div-ef11a6be-2", children: e.children }) }) : null
216
- ] }),
217
- /* @__PURE__ */ n("style", { children: `.img-ef11a6be {
218
- opacity: 1;
219
- transition: opacity 0.2s ease-in-out;
220
- }.div-ef11a6be {
221
- width: 100%;
222
- pointer-events: none;
223
- font-size: 0;
224
- }.div-ef11a6be-2 {
225
- display: flex;
226
- flex-direction: column;
227
- align-items: stretch;
228
- position: absolute;
229
- top: 0;
230
- left: 0;
231
- width: 100%;
232
- height: 100%;
233
- }` })
234
- ] });
235
- }
236
- function he(e) {
237
- return /* @__PURE__ */ n(
238
- "section",
239
- {
240
- ...e.attributes,
241
- style: {
242
- width: "100%",
243
- alignSelf: "stretch",
244
- flexGrow: 1,
245
- boxSizing: "border-box",
246
- maxWidth: e.maxWidth || 1200,
247
- display: "flex",
248
- flexDirection: "column",
249
- alignItems: "stretch",
250
- marginLeft: "auto",
251
- marginRight: "auto"
252
- },
253
- children: e.children
254
- }
255
- );
256
- }
257
- function Se(e) {
258
- var v;
259
- function o() {
260
- return {
261
- ...e.autoPlay === !0 ? {
262
- autoPlay: !0
263
- } : {},
264
- ...e.muted === !0 ? {
265
- muted: !0
266
- } : {},
267
- ...e.controls === !0 ? {
268
- controls: !0
269
- } : {},
270
- ...e.loop === !0 ? {
271
- loop: !0
272
- } : {},
273
- ...e.playsInline === !0 ? {
274
- playsInline: !0
275
- } : {}
276
- };
277
- }
278
- function s() {
279
- return {
280
- ...e.attributes,
281
- ...o()
282
- };
283
- }
284
- return /* @__PURE__ */ n(
285
- "video",
286
- {
287
- ...s(),
288
- preload: e.preload || "metadata",
289
- style: {
290
- width: "100%",
291
- height: "100%",
292
- ...(v = e.attributes) == null ? void 0 : v.style,
293
- objectFit: e.fit,
294
- objectPosition: e.position,
295
- // Hack to get object fit to work as expected and
296
- // not have the video overflow
297
- borderRadius: 1
298
- },
299
- src: e.video || "no-src",
300
- poster: e.posterImage
301
- }
302
- );
303
- }
304
- function xe(e) {
305
- const o = j(null), [s, v] = S(() => []), [a, m] = S(() => []), [x, k] = S(() => !1);
306
- function f() {
307
- if (!o.current || !o.current.getElementsByTagName)
308
- return;
309
- const c = o.current.getElementsByTagName("script");
310
- for (let u = 0; u < c.length; u++) {
311
- const h = c[u];
312
- if (h.src && !s.includes(h.src)) {
313
- s.push(h.src);
314
- const E = document.createElement("script");
315
- E.async = !0, E.src = h.src, document.head.appendChild(E);
316
- } else if (O(h) && !a.includes(h.innerText))
317
- try {
318
- a.push(h.innerText), new Function(h.innerText)();
319
- } catch (E) {
320
- console.warn("`Embed`: Error running script:", E);
321
- }
322
- }
323
- }
324
- return y(() => {
325
- o.current && !x && (k(!0), f());
326
- }, [o.current, x]), /* @__PURE__ */ n(
327
- "div",
328
- {
329
- className: "builder-embed",
330
- ref: o,
331
- dangerouslySetInnerHTML: { __html: e.content }
332
- }
333
- );
334
- }
335
- function ve(e) {
336
- return /* @__PURE__ */ n(
337
- "img",
338
- {
339
- style: {
340
- objectFit: e.backgroundSize || "cover",
341
- objectPosition: e.backgroundPosition || "center"
342
- },
343
- alt: e.altText,
344
- src: e.imgSrc || e.image,
345
- ...e.attributes
346
- },
347
- I() && e.imgSrc || "default-key"
348
- );
349
- }
350
- function ke(e) {
351
- const o = j(null), [s, v] = S(() => []), [a, m] = S(() => []);
352
- function x() {
353
- if (o.current && o.current.getElementsByTagName && typeof window < "u") {
354
- const k = o.current.getElementsByTagName("script");
355
- for (let f = 0; f < k.length; f++) {
356
- const c = k[f];
357
- if (c.src) {
358
- if (s.includes(c.src))
359
- continue;
360
- s.push(c.src);
361
- const u = document.createElement("script");
362
- u.async = !0, u.src = c.src, document.head.appendChild(u);
363
- } else if (!c.type || [
364
- "text/javascript",
365
- "application/javascript",
366
- "application/ecmascript"
367
- ].includes(c.type)) {
368
- if (a.includes(c.innerText))
369
- continue;
370
- try {
371
- a.push(c.innerText), new Function(c.innerText)();
372
- } catch (u) {
373
- console.warn("`CustomCode`: Error running script:", u);
374
- }
375
- }
376
- }
377
- }
378
- }
379
- return y(() => {
380
- x();
381
- }, []), /* @__PURE__ */ n(
382
- "div",
383
- {
384
- ref: o,
385
- className: "builder-custom-code" + (e.replaceNodes ? " replace-nodes" : ""),
386
- dangerouslySetInnerHTML: { __html: e.code }
387
- }
388
- );
389
- }
390
- const ae = te({
391
- content: null,
392
- context: {},
393
- localState: void 0,
394
- rootSetState() {
395
- },
396
- rootState: {},
397
- apiKey: null,
398
- apiVersion: void 0,
399
- componentInfos: {},
400
- inheritedStyles: {}
401
- });
402
- function ye(e) {
403
- var L, M, q, z, K;
404
- const o = j(null), [s, v] = S(
405
- () => G(e.canTrack) ? e.canTrack : !0
406
- ), [a, m] = S(() => 0);
407
- function x(t) {
408
- var i, r, d, g, W;
409
- const l = {
410
- ...e.builderContextSignal.content,
411
- ...t,
412
- data: {
413
- ...(i = e.builderContextSignal.content) == null ? void 0 : i.data,
414
- ...t == null ? void 0 : t.data
415
- },
416
- meta: {
417
- ...(r = e.builderContextSignal.content) == null ? void 0 : r.meta,
418
- ...t == null ? void 0 : t.meta,
419
- breakpoints: ((d = t == null ? void 0 : t.meta) == null ? void 0 : d.breakpoints) || ((W = (g = e.builderContextSignal.content) == null ? void 0 : g.meta) == null ? void 0 : W.breakpoints)
420
- }
421
- };
422
- ne({
423
- value: l,
424
- key: l.id
425
- }).then(() => {
426
- J.refresh();
427
- });
428
- }
429
- S(() => 0);
430
- const [k, f] = S(
431
- () => !1
432
- );
433
- function c(t) {
434
- var i;
435
- const { data: l } = t;
436
- if (l)
437
- switch (l.type) {
438
- case "builder.configureSdk": {
439
- const r = l.data, { breakpoints: d, contentId: g } = r;
440
- if (!g || g !== ((i = e.builderContextSignal.content) == null ? void 0 : i.id))
441
- return;
442
- d && x({
443
- meta: {
444
- breakpoints: d
445
- }
446
- }), m(a + 1);
447
- break;
448
- }
449
- case "builder.contentUpdate": {
450
- const r = l.data, d = r.key || r.alias || r.entry || r.modelName, g = r.data;
451
- d === e.model && (x(g), m(a + 1));
452
- break;
453
- }
454
- }
455
- }
456
- function u() {
457
- var l, i;
458
- const t = (i = (l = e.builderContextSignal.content) == null ? void 0 : l.data) == null ? void 0 : i.jsCode;
459
- t && A({
460
- code: t,
461
- context: e.context || {},
462
- localState: void 0,
463
- rootState: e.builderContextSignal.rootState,
464
- rootSetState: e.builderContextSignal.rootSetState
465
- });
466
- }
467
- const [h, E] = S(() => ({})), [B, U] = S(() => !1);
468
- function V(t) {
469
- var l, i;
470
- if (e.builderContextSignal.content) {
471
- const r = (l = e.builderContextSignal.content) == null ? void 0 : l.testVariationId, d = (i = e.builderContextSignal.content) == null ? void 0 : i.id;
472
- _({
473
- type: "click",
474
- canTrack: s,
475
- contentId: d,
476
- apiKey: e.apiKey,
477
- variationId: r !== d ? r : void 0,
478
- ...$(t),
479
- unique: !B
480
- });
481
- }
482
- B || U(!0);
483
- }
484
- function D(t) {
485
- return t.replace(
486
- /{{([^}]+)}}/g,
487
- (l, i) => A({
488
- code: i,
489
- context: e.context || {},
490
- localState: void 0,
491
- rootState: e.builderContextSignal.rootState,
492
- rootSetState: e.builderContextSignal.rootSetState
493
- })
494
- );
495
- }
496
- function H({ url: t, key: l }) {
497
- ee(t).then((i) => i.json()).then((i) => {
498
- var d, g;
499
- const r = {
500
- ...e.builderContextSignal.rootState,
501
- [l]: i
502
- };
503
- (g = (d = e.builderContextSignal).rootSetState) == null || g.call(d, r), h[l] = !0;
504
- }).catch((i) => {
505
- console.error("error fetching dynamic data", t, i);
506
- });
507
- }
508
- function F() {
509
- var l, i;
510
- const t = ((i = (l = e.builderContextSignal.content) == null ? void 0 : l.data) == null ? void 0 : i.httpRequests) ?? {};
511
- Object.entries(t).forEach(([r, d]) => {
512
- if (d && (!h[r] || I())) {
513
- const g = D(d);
514
- H({
515
- url: g,
516
- key: r
517
- });
518
- }
519
- });
520
- }
521
- function R() {
522
- I() && window.dispatchEvent(
523
- new CustomEvent(
524
- "builder:component:stateChange",
525
- {
526
- detail: {
527
- state: p(e.builderContextSignal.rootState),
528
- ref: {
529
- name: e.model
530
- }
531
- }
532
- }
533
- )
534
- );
535
- }
536
- const J = ie();
537
- return y(() => {
538
- var t, l;
539
- if (e.apiKey || Q.error(
540
- "No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."
541
- ), T()) {
542
- if (I() && (m(a + 1), window.addEventListener("message", c), X(), Y({
543
- ...e.locale ? {
544
- locale: e.locale
545
- } : {},
546
- ...e.includeRefs ? {
547
- includeRefs: e.includeRefs
548
- } : {},
549
- ...e.enrich ? {
550
- enrich: e.enrich
551
- } : {}
552
- }), Object.values(
553
- e.builderContextSignal.componentInfos
554
- ).forEach((i) => {
555
- var d;
556
- const r = Z(i);
557
- (d = window.parent) == null || d.postMessage(r, "*");
558
- }), window.addEventListener(
559
- "builder:component:stateChangeListenerActivated",
560
- R
561
- )), e.builderContextSignal.content) {
562
- const i = (t = e.builderContextSignal.content) == null ? void 0 : t.testVariationId, r = (l = e.builderContextSignal.content) == null ? void 0 : l.id;
563
- _({
564
- type: "impression",
565
- canTrack: s,
566
- contentId: r,
567
- apiKey: e.apiKey,
568
- variationId: i !== r ? i : void 0
569
- });
570
- }
571
- u(), F(), R();
572
- }
573
- }, []), y(() => {
574
- }, [e.content]), y(() => {
575
- T() && (window.removeEventListener("message", c), window.addEventListener("message", c));
576
- }, [k]), y(() => {
577
- u();
578
- }, [
579
- (M = (L = e.builderContextSignal.content) == null ? void 0 : L.data) == null ? void 0 : M.jsCode,
580
- e.builderContextSignal.rootState
581
- ]), y(() => {
582
- F();
583
- }, [(z = (q = e.builderContextSignal.content) == null ? void 0 : q.data) == null ? void 0 : z.httpRequests]), y(() => {
584
- R();
585
- }, [e.builderContextSignal.rootState]), y(() => () => {
586
- T() && (window.removeEventListener("message", c), window.removeEventListener(
587
- "builder:component:stateChangeListenerActivated",
588
- R
589
- ));
590
- }, []), /* @__PURE__ */ n(ae.Provider, { value: e.builderContextSignal, children: e.builderContextSignal.content ? /* @__PURE__ */ n(b, { children: /* @__PURE__ */ n(
591
- "div",
592
- {
593
- ref: o,
594
- onClick: (t) => V(t),
595
- "builder-content-id": (K = e.builderContextSignal.content) == null ? void 0 : K.id,
596
- "builder-model": e.model,
597
- ...e.showContent ? {} : {
598
- hidden: !0,
599
- "aria-hidden": !0
600
- },
601
- className: e.classNameProp,
602
- children: e.children
603
- },
604
- a
605
- ) }) : null });
606
- }
607
- export {
608
- me as B,
609
- ke as C,
610
- xe as E,
611
- fe as F,
612
- ue as I,
613
- he as S,
614
- Se as V,
615
- be as a,
616
- se as b,
617
- ge as c,
618
- ve as d,
619
- ye as e
620
- };
@@ -1,11 +0,0 @@
1
- "use server";
2
- import { n as r } from "./bundle-6ca5e123.mjs";
3
- async function e({
4
- key: t,
5
- value: n
6
- }) {
7
- return r(), globalThis._BUILDER_PREVIEW_LRU_CACHE.set(t, n), { [t]: n };
8
- }
9
- export {
10
- e as p
11
- };