@builder.io/sdk-react 2.0.16 → 2.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser/blocks-exports.cjs +31 -31
- package/lib/browser/blocks-exports.mjs +852 -829
- package/lib/browser/index.cjs +1 -1
- package/lib/browser/index.mjs +22 -23
- package/lib/browser/{server-entry-c1666709.cjs → server-entry-6e52be8e.cjs} +2 -2
- package/lib/browser/{server-entry-1db0d96b.js → server-entry-8f273525.js} +1 -3
- package/lib/browser/server-entry.cjs +1 -1
- package/lib/browser/server-entry.mjs +1 -1
- package/lib/edge/{accordion-7c1c7c56.js → accordion-0fa0cd9f.js} +1 -1
- package/lib/edge/{accordion-09162a27.cjs → accordion-98e5d925.cjs} +1 -1
- package/lib/edge/blocks-4dac2e8c.cjs +12 -0
- package/lib/edge/{blocks-46c07b56.js → blocks-805edb5d.js} +296 -276
- package/lib/edge/blocks-exports.cjs +1 -1
- package/lib/edge/blocks-exports.mjs +2 -2
- package/lib/edge/{button-f2daea13.cjs → button-04692c59.cjs} +1 -1
- package/lib/edge/{button-a923f8ff.js → button-8c912189.js} +2 -2
- package/lib/edge/columns-4d8db53c.cjs +28 -0
- package/lib/edge/{columns-eee4f51c.js → columns-70a13cfe.js} +8 -9
- package/lib/edge/content-variants-7570438f.cjs +134 -0
- package/lib/edge/{content-variants-1368cab1.js → content-variants-d11198bc.js} +306 -309
- package/lib/edge/{evaluate-93701356.js → evaluate-29e9d055.js} +736 -711
- package/lib/edge/{evaluate-4c9b2e86.cjs → evaluate-826010e9.cjs} +13 -15
- package/lib/edge/form-13c77d47.cjs +1 -0
- package/lib/edge/{form-d0eb0af4.js → form-28c6dcde.js} +16 -17
- package/lib/edge/{get-class-prop-name-7cd1376f.cjs → get-class-prop-name-182b0edb.cjs} +1 -1
- package/lib/edge/{get-class-prop-name-1c373615.js → get-class-prop-name-c9e11804.js} +1 -1
- package/lib/edge/{image-eebfcbac.cjs → image-54d2f755.cjs} +3 -3
- package/lib/edge/{image-6a074aab.js → image-6970c193.js} +24 -24
- package/lib/edge/{img-6c8139db.cjs → img-8f2d03d2.cjs} +1 -1
- package/lib/edge/{img-6e16ade6.js → img-ca1be569.js} +1 -1
- package/lib/edge/index.cjs +1 -1
- package/lib/edge/index.mjs +1 -1
- package/lib/edge/{input-c78fef2b.cjs → input-0456a323.cjs} +1 -1
- package/lib/edge/{input-a7e9c157.js → input-3db08208.js} +1 -1
- package/lib/edge/{select-3cf593bd.js → select-251dfaa4.js} +1 -1
- package/lib/edge/{select-bd1e231b.cjs → select-b851ff58.cjs} +1 -1
- package/lib/edge/{server-entry-6b3ad048.js → server-entry-05e6ebef.js} +1 -3
- package/lib/edge/{server-entry-d09af943.cjs → server-entry-75427eb3.cjs} +2 -2
- package/lib/edge/server-entry.cjs +1 -1
- package/lib/edge/server-entry.mjs +1 -1
- package/lib/edge/slot-279f992e.cjs +1 -0
- package/lib/edge/{slot-a5a9a30f.js → slot-76c2cebc.js} +6 -7
- package/lib/edge/{symbol-9de15518.cjs → symbol-020487c5.cjs} +1 -1
- package/lib/edge/{symbol-77d331c6.js → symbol-47130603.js} +2 -2
- package/lib/edge/{tabs-63d6ea85.js → tabs-3cc397e4.js} +13 -14
- package/lib/edge/tabs-c6053c2d.cjs +1 -0
- package/lib/edge/{text-4d508bbc.js → text-29ef4fd5.js} +8 -9
- package/lib/edge/text-c9d83141.cjs +1 -0
- package/lib/node/blocks-exports.cjs +31 -31
- package/lib/node/blocks-exports.mjs +807 -822
- package/lib/node/index.cjs +1 -1
- package/lib/node/index.mjs +2 -2
- package/lib/node/init.cjs +1 -1
- package/lib/node/init.mjs +2 -2
- package/lib/node/{server-entry-1db0d96b.js → server-entry-83392238.js} +1 -2
- package/lib/node/{server-entry-c1666709.cjs → server-entry-b5908591.cjs} +2 -2
- package/lib/node/server-entry.cjs +1 -1
- package/lib/node/server-entry.mjs +1 -1
- package/lib/node/{should-force-browser-runtime-in-node-1188ea7b.js → should-force-browser-runtime-in-node-31b1e2f2.js} +57 -30
- package/lib/node/should-force-browser-runtime-in-node-391032cf.cjs +48 -0
- package/package.json +1 -1
- package/types/components/awaiter.d.ts +14 -0
- package/types/constants/sdk-version.d.ts +1 -1
- package/types/context/component-reference-types.d.ts +4 -0
- package/types/context/types.d.ts +2 -1
- package/types/functions/evaluate/browser-runtime/browser.d.ts +0 -6
- package/types/functions/evaluate/helpers.d.ts +5 -0
- package/lib/browser/init.cjs +0 -8
- package/lib/browser/init.mjs +0 -64
- package/lib/browser/should-force-browser-runtime-in-node-00f3cfef.js +0 -17
- package/lib/browser/should-force-browser-runtime-in-node-f768fb5d.cjs +0 -1
- package/lib/edge/blocks-273f24cc.cjs +0 -12
- package/lib/edge/columns-0b8c2260.cjs +0 -28
- package/lib/edge/content-variants-575b5dbf.cjs +0 -134
- package/lib/edge/form-bd184008.cjs +0 -1
- package/lib/edge/init.cjs +0 -8
- package/lib/edge/init.mjs +0 -64
- package/lib/edge/should-force-browser-runtime-in-node-2b14e4a8.cjs +0 -1
- package/lib/edge/should-force-browser-runtime-in-node-560bddfb.js +0 -17
- package/lib/edge/slot-ab7fc875.cjs +0 -1
- package/lib/edge/tabs-e6fa664e.cjs +0 -1
- package/lib/edge/text-ab5d2747.cjs +0 -1
- package/lib/node/should-force-browser-runtime-in-node-37010e2f.cjs +0 -48
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react");require("./server-entry-
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react");require("./server-entry-75427eb3.cjs");const t=e.lazy(()=>Promise.resolve().then(()=>require("./button-04692c59.cjs"))),r=e.lazy(()=>Promise.resolve().then(()=>require("./columns-4d8db53c.cjs"))),n=e.lazy(()=>Promise.resolve().then(()=>require("./fragment-b6e3a326.cjs"))),s=e.lazy(()=>Promise.resolve().then(()=>require("./image-54d2f755.cjs"))),i=e.lazy(()=>Promise.resolve().then(()=>require("./section-d655ea14.cjs"))),l=e.lazy(()=>Promise.resolve().then(()=>require("./symbol-020487c5.cjs"))),c=e.lazy(()=>Promise.resolve().then(()=>require("./text-c9d83141.cjs"))),a=e.lazy(()=>Promise.resolve().then(()=>require("./video-e20dcbbc.cjs"))),u=e.lazy(()=>Promise.resolve().then(()=>require("./blocks-4dac2e8c.cjs")).then(o=>o.blocks)),m=e.lazy(()=>Promise.resolve().then(()=>require("./content-variants-7570438f.cjs"))),y=e.createContext({content:null,context:{},localState:void 0,rootSetState(){},rootState:{},apiKey:null,apiVersion:void 0,componentInfos:{},inheritedStyles:{},BlocksWrapper:"div",BlocksWrapperProps:{},nonce:""});exports.Blocks=u;exports.BuilderContext=y;exports.Button=t;exports.Columns=r;exports.Content=m;exports.Fragment=n;exports.Image=s;exports.Section=i;exports.Symbol=l;exports.Text=c;exports.Video=a;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { lazy as t, createContext as n } from "react";
|
|
3
|
-
import "./server-entry-
|
|
4
|
-
const i = t(() => import("./button-
|
|
3
|
+
import "./server-entry-05e6ebef.js";
|
|
4
|
+
const i = t(() => import("./button-8c912189.js")), r = t(() => import("./columns-70a13cfe.js")), a = t(() => import("./fragment-1492bc7f.js")), c = t(() => import("./image-6970c193.js")), m = t(() => import("./section-d83e2dd3.js")), p = t(() => import("./symbol-47130603.js")), l = t(() => import("./text-29ef4fd5.js")), u = t(() => import("./video-58c2cc8d.js")), d = t(() => import("./blocks-805edb5d.js").then((o) => o.blocks)), x = t(() => import("./content-variants-d11198bc.js")), S = n({
|
|
5
5
|
content: null,
|
|
6
6
|
context: {},
|
|
7
7
|
localState: void 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),r=require("./dynamic-renderer-b29b45ca.cjs"),t=require("./get-class-prop-name-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),r=require("./dynamic-renderer-b29b45ca.cjs"),t=require("./get-class-prop-name-182b0edb.cjs");require("./server-entry-75427eb3.cjs");function u(e){function n(){return{...e.attributes,[t.getClassPropName()]:`${e.link?"":"builder-button"} ${e.attributes[t.getClassPropName()]||""}`,...e.link?{href:e.link,target:e.openLinkInNewTab?"_blank":void 0,role:"link"}:{role:"button"}}}return i.jsx(r.DynamicRenderer,{attributes:n(),TagName:e.link?e.builderLinkComponent||"a":"button",actionAttributes:{},children:e.text})}exports.default=u;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { DynamicRenderer as r } from "./dynamic-renderer-8b343325.js";
|
|
3
|
-
import { getClassPropName as n } from "./get-class-prop-name-
|
|
4
|
-
import "./server-entry-
|
|
3
|
+
import { getClassPropName as n } from "./get-class-prop-name-c9e11804.js";
|
|
4
|
+
import "./server-entry-05e6ebef.js";
|
|
5
5
|
function b(t) {
|
|
6
6
|
function e() {
|
|
7
7
|
return {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),o=require("react"),s=require("./blocks-4dac2e8c.cjs"),p=require("./dynamic-renderer-b29b45ca.cjs"),q=require("./get-class-prop-name-182b0edb.cjs");require("./blocks-exports.cjs");require("./server-entry-75427eb3.cjs");require("./evaluate-826010e9.cjs");const B=t=>`builder-columns ${t}-breakpoints`;function z(t){var k,g;const[u,A]=o.useState(()=>typeof t.space=="number"?t.space||0:20),[c,L]=o.useState(()=>t.columns||[]),[d,N]=o.useState(()=>t.stackColumnsAt||"tablet");function y(e){return e.link?t.builderLinkComponent||"a":"div"}function x(e){var n;return((n=c[e])==null?void 0:n.width)||100/c.length}function C(e){const n=x(e),i=u*(c.length-1)*(n/100);return`calc(${n}% - ${i}px)`}function a({stackedStyle:e,desktopStyle:n}){return d==="tablet"?e:n}function m({stackedStyle:e,desktopStyle:n}){return d==="never"?n:e}const[b,W]=o.useState(()=>t.stackColumnsAt==="never"?"row":t.reverseColumnsWhenStacked?"column-reverse":"column");function v(){return{"--flex-dir":b,"--flex-dir-tablet":a({stackedStyle:b,desktopStyle:"row"})}}function w(e){const n=e===0?0:u,i=C(e),r=`${n}px`,h="100%",S=0;return{...{display:"flex",flexDirection:"column",alignItems:"stretch"},width:i,["marginLeft"]:r,"--column-width-mobile":m({stackedStyle:h,desktopStyle:i}),"--column-margin-left-mobile":m({stackedStyle:S,desktopStyle:r}),"--column-width-tablet":a({stackedStyle:h,desktopStyle:i}),"--column-margin-left-tablet":a({stackedStyle:S,desktopStyle:r})}}function f(e){var i,r;return s.getSizesForBreakpoints(((r=(i=t.builderContext.content)==null?void 0:i.meta)==null?void 0:r.breakpoints)||{})[e].max}function $(){const e=`.${t.builderBlock.id}-breakpoints > .builder-column`;return`
|
|
2
|
+
@media (max-width: ${f("medium")}px) {
|
|
3
|
+
.${t.builderBlock.id}-breakpoints {
|
|
4
|
+
flex-direction: var(--flex-dir-tablet);
|
|
5
|
+
align-items: stretch;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
${e} {
|
|
9
|
+
width: var(--column-width-tablet) !important;
|
|
10
|
+
margin-left: var(--column-margin-left-tablet) !important;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@media (max-width: ${f("small")}px) {
|
|
15
|
+
.${t.builderBlock.id}-breakpoints {
|
|
16
|
+
flex-direction: var(--flex-dir);
|
|
17
|
+
align-items: stretch;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
${e} {
|
|
21
|
+
width: var(--column-width-mobile) !important;
|
|
22
|
+
margin-left: var(--column-margin-left-mobile) !important;
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
`}function j(e,n){return{...e.link?{href:e.link}:{},[q.getClassPropName()]:"builder-column",style:s.mapStyleObjToStrIfNeeded(w(n))}}return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:B((k=t.builderBlock)==null?void 0:k.id)+" div-3b0f6fe2",style:v(),children:[l.jsx(s.InlinedStyles,{id:"builderio-columns",styles:$(),nonce:t.builderContext.nonce}),(g=t.columns)==null?void 0:g.map((e,n)=>l.jsx(p.DynamicRenderer,{TagName:y(e),actionAttributes:{},attributes:j(e,n),children:l.jsx(s.Blocks,{path:`component.options.columns.${n}.blocks`,parent:t.builderBlock.id,styleProp:{flexGrow:"1"},context:t.builderContext,registeredComponents:t.builderComponents,linkComponent:t.builderLinkComponent,blocks:e.blocks})},n))]}),l.jsx("style",{children:`.div-3b0f6fe2 {
|
|
26
|
+
display: flex;
|
|
27
|
+
line-height: normal;
|
|
28
|
+
}`})]})}exports.default=z;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { jsxs as y, Fragment as B, jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import { useState as r } from "react";
|
|
3
|
-
import { InlinedStyles as z, Blocks as A, mapStyleObjToStrIfNeeded as L, getSizesForBreakpoints as W } from "./blocks-
|
|
3
|
+
import { InlinedStyles as z, Blocks as A, mapStyleObjToStrIfNeeded as L, getSizesForBreakpoints as W } from "./blocks-805edb5d.js";
|
|
4
4
|
import { DynamicRenderer as D } from "./dynamic-renderer-8b343325.js";
|
|
5
|
-
import { getClassPropName as N } from "./get-class-prop-name-
|
|
5
|
+
import { getClassPropName as N } from "./get-class-prop-name-c9e11804.js";
|
|
6
6
|
import "./blocks-exports.mjs";
|
|
7
|
-
import "./server-entry-
|
|
8
|
-
import "./evaluate-
|
|
9
|
-
import "./should-force-browser-runtime-in-node-560bddfb.js";
|
|
7
|
+
import "./server-entry-05e6ebef.js";
|
|
8
|
+
import "./evaluate-29e9d055.js";
|
|
10
9
|
const F = (e) => `builder-columns ${e}-breakpoints`;
|
|
11
|
-
function
|
|
10
|
+
function Q(e) {
|
|
12
11
|
var f, k;
|
|
13
12
|
const [c, T] = r(
|
|
14
13
|
() => typeof e.space == "number" ? e.space || 0 : 20
|
|
@@ -125,7 +124,7 @@ function U(e) {
|
|
|
125
124
|
/* @__PURE__ */ y(
|
|
126
125
|
"div",
|
|
127
126
|
{
|
|
128
|
-
className: F((f = e.builderBlock) == null ? void 0 : f.id) + " div-
|
|
127
|
+
className: F((f = e.builderBlock) == null ? void 0 : f.id) + " div-3b0f6fe2",
|
|
129
128
|
style: p(),
|
|
130
129
|
children: [
|
|
131
130
|
/* @__PURE__ */ o(
|
|
@@ -162,12 +161,12 @@ function U(e) {
|
|
|
162
161
|
]
|
|
163
162
|
}
|
|
164
163
|
),
|
|
165
|
-
/* @__PURE__ */ o("style", { children: `.div-
|
|
164
|
+
/* @__PURE__ */ o("style", { children: `.div-3b0f6fe2 {
|
|
166
165
|
display: flex;
|
|
167
166
|
line-height: normal;
|
|
168
167
|
}` })
|
|
169
168
|
] });
|
|
170
169
|
}
|
|
171
170
|
export {
|
|
172
|
-
|
|
171
|
+
Q as default
|
|
173
172
|
};
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("react/jsx-runtime"),r=require("react"),d=require("./server-entry-75427eb3.cjs"),k=require("./blocks-exports.cjs"),R=require("./blocks-4dac2e8c.cjs"),K=require("./evaluate-826010e9.cjs");require("./get-class-prop-name-182b0edb.cjs");require("./dynamic-renderer-b29b45ca.cjs");const q={"@type":"@builder.io/sdk:Element",layerName:"Accordion item title",responsiveStyles:{large:{marginTop:"10px",position:"relative",display:"flex",alignItems:"stretch",flexDirection:"column",paddingBottom:"10px"}},children:[{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{textAlign:"left",display:"flex",flexDirection:"column"}},component:{name:"Text",options:{text:"I am an accordion title. Click me!"}}}]},D={"@type":"@builder.io/sdk:Element",layerName:"Accordion item detail",responsiveStyles:{large:{position:"relative",display:"flex",alignItems:"stretch",flexDirection:"column",marginTop:"10px",paddingBottom:"10px"}},children:[{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{paddingTop:"50px",textAlign:"left",display:"flex",flexDirection:"column",paddingBottom:"50px"}},component:{name:"Text",options:{text:"I am an accordion detail, hello!"}}}]},Y={name:"Builder:Accordion",canHaveChildren:!0,image:"https://cdn.builder.io/api/v1/image/assets%2FagZ9n5CUKRfbL9t6CaJOyVSK4Es2%2Ffab6c1fd3fe542408cbdec078bca7f35",defaultStyles:{display:"flex",flexDirection:"column",alignItems:"stretch"},inputs:[{name:"items",type:"list",broadcast:!0,subFields:[{name:"title",type:"uiBlocks",hideFromUI:!0,defaultValue:[q]},{name:"detail",type:"uiBlocks",hideFromUI:!0,defaultValue:[D]}],defaultValue:[{title:[q],detail:[D]},{title:[q],detail:[D]}],showIf:e=>!e.get("useChildrenForItems")},{name:"oneAtATime",helperText:"Only allow opening one at a time (collapse all others when new item openned)",type:"boolean",defaultValue:!1},{name:"grid",helperText:"Display as a grid",type:"boolean",defaultValue:!1},{name:"gridRowWidth",helperText:"Display as a grid",type:"string",showIf:e=>e.get("grid"),defaultValue:"25%"},{name:"useChildrenForItems",type:"boolean",helperText:"Use child elements for each slide, instead of the array. Useful for dynamically repeating items",advanced:!0,defaultValue:!1,onChange:e=>{e.get("useChildrenForItems")===!0&&e.set("items",[])}}],shouldReceiveBuilderProps:{builderBlock:!0,builderContext:!0,builderComponents:!0,builderLinkComponent:!0}},G=r.lazy(()=>Promise.resolve().then(()=>require("./accordion-98e5d925.cjs"))),Q={name:"Core:Button",image:"https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13",defaultStyles:{appearance:"none",paddingTop:"15px",paddingBottom:"15px",paddingLeft:"25px",paddingRight:"25px",backgroundColor:"#000000",color:"white",borderRadius:"4px",textAlign:"center",cursor:"pointer"},inputs:[{name:"text",type:"text",defaultValue:"Click me!",bubble:!0},{name:"link",type:"url",bubble:!0},{name:"openLinkInNewTab",type:"boolean",defaultValue:!1,friendlyName:"Open link in new tab"}],static:!0,noWrap:!0,shouldReceiveBuilderProps:{builderLinkComponent:!0}},X={name:"Columns",isRSC:!0,inputs:[{name:"columns",type:"array",broadcast:!0,subFields:[{name:"blocks",type:"array",hideFromUI:!0,defaultValue:[{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto",minHeight:"20px",minWidth:"20px",overflow:"hidden"}},component:{name:"Image",options:{image:"https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",backgroundPosition:"center",backgroundSize:"cover",aspectRatio:.7004048582995948}}},{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto"}},component:{name:"Text",options:{text:"<p>Enter some text...</p>"}}}]},{name:"width",type:"number",hideFromUI:!0,helperText:"Width %, e.g. set to 50 to fill half of the space"},{name:"link",type:"url",helperText:"Optionally set a url that clicking this column will link to"}],defaultValue:[{blocks:[{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto",minHeight:"20px",minWidth:"20px",overflow:"hidden"}},component:{name:"Image",options:{image:"https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",backgroundPosition:"center",backgroundSize:"cover",aspectRatio:.7004048582995948}}},{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto"}},component:{name:"Text",options:{text:"<p>Enter some text...</p>"}}}]},{blocks:[{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto",minHeight:"20px",minWidth:"20px",overflow:"hidden"}},component:{name:"Image",options:{image:"https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",backgroundPosition:"center",backgroundSize:"cover",aspectRatio:.7004048582995948}}},{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto"}},component:{name:"Text",options:{text:"<p>Enter some text...</p>"}}}]}],onChange:e=>{function t(){n.forEach(i=>{i.delete("width")})}const n=e.get("columns");Array.isArray(n)&&n.find(c=>c.get("width"))&&(n.find(f=>!f.get("width"))||n.reduce((o,g)=>o+g.get("width"),0)!==100)&&t()}},{name:"space",type:"number",defaultValue:20,helperText:"Size of gap between columns",advanced:!0},{name:"stackColumnsAt",type:"string",defaultValue:"tablet",helperText:"Convert horizontal columns to vertical at what device size",enum:["tablet","mobile","never"],advanced:!0},{name:"reverseColumnsWhenStacked",type:"boolean",defaultValue:!1,helperText:"When stacking columns for mobile devices, reverse the ordering",advanced:!0}],shouldReceiveBuilderProps:{builderBlock:!0,builderContext:!0,builderComponents:!0,builderLinkComponent:!0}},Z={name:"Fragment",static:!0,hidden:!0,canHaveChildren:!0,noWrap:!0},ee={name:"Image",static:!0,image:"https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4",defaultStyles:{position:"relative",minHeight:"20px",minWidth:"20px",overflow:"hidden"},canHaveChildren:!0,inputs:[{name:"image",type:"file",bubble:!0,allowedFileTypes:["jpeg","jpg","png","svg","webp"],required:!0,defaultValue:"https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a",onChange:e=>{e.delete("srcset"),e.delete("noWebp");function n(a,o=6e4){return new Promise((g,T)=>{const v=document.createElement("img");let w=!1;v.onload=()=>{w=!0,g(v)},v.addEventListener("error",I=>{console.warn("Image load failed",I.error),T(I.error)}),v.src=a,setTimeout(()=>{w||T(new Error("Image load timed out"))},o)})}function i(a){return Math.round(a*1e3)/1e3}const c=e.get("image"),f=e.get("aspectRatio");if(fetch(c).then(a=>a.blob()).then(a=>{a.type.includes("svg")&&e.set("noWebp",!0)}),c&&(!f||f===.7041))return n(c).then(a=>{const o=e.get("aspectRatio");e.get("image")===c&&(!o||o===.7041)&&a.width&&a.height&&(e.set("aspectRatio",i(a.height/a.width)),e.set("height",a.height),e.set("width",a.width))})}},{name:"backgroundSize",type:"text",defaultValue:"cover",enum:[{label:"contain",value:"contain",helperText:"The image should never get cropped"},{label:"cover",value:"cover",helperText:"The image should fill it's box, cropping when needed"}]},{name:"backgroundPosition",type:"text",defaultValue:"center",enum:["center","top","left","right","bottom","top left","top right","bottom left","bottom right"]},{name:"altText",type:"string",helperText:"Text to display when the user has images off"},{name:"height",type:"number",hideFromUI:!0},{name:"width",type:"number",hideFromUI:!0},{name:"sizes",type:"string",hideFromUI:!0},{name:"srcset",type:"string",hideFromUI:!0},{name:"lazy",type:"boolean",defaultValue:!0,hideFromUI:!0},{name:"fitContent",type:"boolean",helperText:"When child blocks are provided, fit to them instead of using the image's aspect ratio",defaultValue:!0},{name:"highPriority",type:"boolean",advanced:!0,helperText:"Mark this image as high priority compared to other images on the page. This prevents lazy loading of the image and tells the browser to load this image before others on the page."},{name:"aspectRatio",type:"number",helperText:"This is the ratio of height/width, e.g. set to 1.5 for a 300px wide and 200px tall photo. Set to 0 to not force the image to maintain it's aspect ratio",advanced:!0,defaultValue:.7041}],shouldReceiveBuilderProps:{builderBlock:!0}},te={name:"Core:Section",static:!0,image:"https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",inputs:[{name:"maxWidth",type:"number",defaultValue:1200},{name:"lazyLoad",type:"boolean",defaultValue:!1,advanced:!0,description:"Only render this section when in view"}],defaultStyles:{paddingLeft:"20px",paddingRight:"20px",paddingTop:"50px",paddingBottom:"50px",marginTop:"0px",width:"100vw",marginLeft:"calc(50% - 50vw)"},canHaveChildren:!0,defaultChildren:[{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{textAlign:"center"}},component:{name:"Text",options:{text:"<p><b>I am a section! My content keeps from getting too wide, so that it's easy to read even on big screens.</b></p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur</p>"}}}]},ne={name:"Slot",isRSC:!0,description:"Allow child blocks to be inserted into this content when used as a Symbol",docsLink:"https://www.builder.io/c/docs/symbols-with-blocks",image:"https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F3aad6de36eae43b59b52c85190fdef56",inputs:[{name:"name",type:"string",required:!0,defaultValue:"children"}],shouldReceiveBuilderProps:{builderContext:!0,builderComponents:!0}},ae=r.lazy(()=>Promise.resolve().then(()=>require("./slot-279f992e.cjs"))),ie={name:"Symbol",noWrap:!0,static:!0,isRSC:!0,inputs:[{name:"symbol",type:"uiSymbol"},{name:"dataOnly",helperText:"Make this a data symbol that doesn't display any UI",type:"boolean",defaultValue:!1,advanced:!0,hideFromUI:!0},{name:"inheritState",helperText:"Inherit the parent component state and data",type:"boolean",defaultValue:!1,advanced:!0},{name:"renderToLiquid",helperText:"Render this symbols contents to liquid. Turn off to fetch with javascript and use custom targeting",type:"boolean",defaultValue:!1,advanced:!0,hideFromUI:!0},{name:"useChildren",hideFromUI:!0,type:"boolean"}],shouldReceiveBuilderProps:{builderBlock:!0,builderContext:!0,builderComponents:!0,builderLinkComponent:!0}},j={"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{paddingLeft:"20px",paddingRight:"20px",paddingTop:"10px",paddingBottom:"10px",minWidth:"100px",textAlign:"center",display:"flex",flexDirection:"column",cursor:"pointer",userSelect:"none"}},component:{name:"Text",options:{text:"New tab"}}},U={"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{height:"200px",display:"flex",marginTop:"20px",flexDirection:"column"}},component:{name:"Text",options:{text:"New tab content "}}},oe={name:"Builder: Tabs",inputs:[{name:"tabs",type:"list",broadcast:!0,subFields:[{name:"label",type:"uiBlocks",hideFromUI:!0,defaultValue:[j]},{name:"content",type:"uiBlocks",hideFromUI:!0,defaultValue:[U]}],defaultValue:[{label:[{...j,component:{name:"Text",options:{text:"Tab 1"}}}],content:[{...U,component:{name:"Text",options:{text:"Tab 1 content"}}}]},{label:[{...j,component:{name:"Text",options:{text:"Tab 2"}}}],content:[{...U,component:{name:"Text",options:{text:"Tab 2 content"}}}]}]},{name:"activeTabStyle",type:"uiStyle",helperText:"CSS styles for the active tab",defaultValue:{backgroundColor:"rgba(0, 0, 0, 0.1)"}},{name:"defaultActiveTab",type:"number",helperText:'Default tab to open to. Set to "1" for the first tab, "2" for the second, or choose "0" for none',defaultValue:1,advanced:!0},{name:"collapsible",type:"boolean",helperText:"If on, clicking an open tab closes it so no tabs are active",defaultValue:!1,advanced:!0},{name:"tabHeaderLayout",type:"enum",helperText:"Change the layout of the tab headers (uses justify-content)",defaultValue:"flex-start",enum:[{label:"Center",value:"center"},{label:"Space between",value:"space-between"},{label:"Space around",value:"space-around"},{label:"Left",value:"flex-start"},{label:"Right",value:"flex-end"}]}],shouldReceiveBuilderProps:{builderBlock:!0,builderContext:!0,builderComponents:!0,builderLinkComponent:!0}},re=r.lazy(()=>Promise.resolve().then(()=>require("./tabs-c6053c2d.cjs"))),le={shouldReceiveBuilderProps:{builderBlock:!1,builderContext:!0},name:"Text",static:!0,isRSC:!0,image:"https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-text_fields-24px%20(1).svg?alt=media&token=12177b73-0ee3-42ca-98c6-0dd003de1929",inputs:[{name:"text",type:"html",required:!0,autoFocus:!0,bubble:!0,defaultValue:"Enter some text..."}],defaultStyles:{lineHeight:"normal",height:"auto",textAlign:"center"}},se={name:"Custom Code",static:!0,requiredPermissions:["editCode"],inputs:[{name:"code",type:"html",required:!0,defaultValue:"<p>Hello there, I am custom HTML code!</p>",code:!0},{name:"replaceNodes",type:"boolean",helperText:"Preserve server rendered dom nodes",advanced:!0},{name:"scriptsClientOnly",type:"boolean",defaultValue:!1,helperText:"Only print and run scripts on the client. Important when scripts influence DOM that could be replaced when client loads",advanced:!0}]},de=r.lazy(()=>Promise.resolve().then(()=>require("./custom-code-6d9730ff.cjs"))),ue={name:"Embed",static:!0,inputs:[{name:"url",type:"url",required:!0,defaultValue:"",helperText:"e.g. enter a youtube url, google map, etc"},{name:"content",type:"html",defaultValue:'<div style="padding: 20px; text-align: center">(Choose an embed URL)<div>',hideFromUI:!0}]},ce=r.lazy(()=>Promise.resolve().then(()=>require("./embed-32bdd007.cjs"))),me={name:"Form:Form",defaults:{responsiveStyles:{large:{marginTop:"15px",paddingBottom:"15px"}}},image:"https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fef36d2a846134910b64b88e6d18c5ca5",inputs:[{name:"sendSubmissionsTo",type:"string",enum:[{label:"Send to email",value:"email",helperText:"Send form submissions to the email address of your choosing"},{label:"Custom",value:"custom",helperText:"Handle where the form requests go manually with a little code, e.g. to your own custom backend"}],defaultValue:"email"},{name:"sendSubmissionsToEmail",type:"string",required:!0,defaultValue:"your@email.com",showIf:'options.get("sendSubmissionsTo") === "email"'},{name:"sendWithJs",type:"boolean",helperText:"Set to false to use basic html form action",defaultValue:!0,showIf:'options.get("sendSubmissionsTo") === "custom"'},{name:"name",type:"string",defaultValue:"My form"},{name:"action",type:"string",helperText:"URL to send the form data to",showIf:'options.get("sendSubmissionsTo") === "custom"'},{name:"contentType",type:"string",defaultValue:"application/json",advanced:!0,enum:["application/json","multipart/form-data","application/x-www-form-urlencoded"],showIf:'options.get("sendSubmissionsTo") === "custom" && options.get("sendWithJs") === true'},{name:"method",type:"string",showIf:'options.get("sendSubmissionsTo") === "custom"',defaultValue:"POST",advanced:!0},{name:"previewState",type:"string",enum:["unsubmitted","sending","success","error"],defaultValue:"unsubmitted",helperText:'Choose a state to edit, e.g. choose "success" to show what users see on success and edit the message',showIf:'options.get("sendSubmissionsTo") !== "zapier" && options.get("sendWithJs") === true'},{name:"successUrl",type:"url",helperText:"Optional URL to redirect the user to on form submission success",showIf:'options.get("sendSubmissionsTo") !== "zapier" && options.get("sendWithJs") === true'},{name:"resetFormOnSubmit",type:"boolean",showIf:"options.get('sendSubmissionsTo') === 'custom' && options.get('sendWithJs') === true",advanced:!0},{name:"successMessage",type:"uiBlocks",hideFromUI:!0,defaultValue:[{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{marginTop:"10px"}},component:{name:"Text",options:{text:"<span>Thanks!</span>"}}}]},{name:"validate",type:"boolean",defaultValue:!0,advanced:!0},{name:"errorMessagePath",type:"text",advanced:!0,helperText:'Path to where to get the error message from in a JSON response to display to the user, e.g. "error.message" for a response like { "error": { "message": "this username is taken" }}'},{name:"errorMessage",type:"uiBlocks",hideFromUI:!0,defaultValue:[{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{marginTop:"10px"}},bindings:{"component.options.text":"state.formErrorMessage || block.component.options.text"},component:{name:"Text",options:{text:"<span>Form submission error :( Please check your answers and try again</span>"}}}]},{name:"sendingMessage",type:"uiBlocks",hideFromUI:!0,defaultValue:[{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{marginTop:"10px"}},component:{name:"Text",options:{text:"<span>Sending...</span>"}}}]},{name:"customHeaders",type:"map",valueType:{type:"string"},advanced:!0,showIf:'options.get("sendSubmissionsTo") === "custom" && options.get("sendWithJs") === true'}],noWrap:!0,canHaveChildren:!0,defaultChildren:[{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{marginTop:"10px"}},component:{name:"Text",options:{text:"<span>Enter your name</span>"}}},{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{marginTop:"10px"}},component:{name:"Form:Input",options:{name:"name",placeholder:"Jane Doe"}}},{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{marginTop:"10px"}},component:{name:"Text",options:{text:"<span>Enter your email</span>"}}},{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{marginTop:"10px"}},component:{name:"Form:Input",options:{name:"email",placeholder:"jane@doe.com"}}},{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{marginTop:"10px"}},component:{name:"Form:SubmitButton",options:{text:"Submit"}}}],shouldReceiveBuilderProps:{builderBlock:!0,builderContext:!0,builderComponents:!0,builderLinkComponent:!0}},pe=r.lazy(()=>Promise.resolve().then(()=>require("./form-13c77d47.cjs"))),fe={name:"Form:Input",image:"https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fad6f37889d9e40bbbbc72cdb5875d6ca",inputs:[{name:"type",type:"text",enum:["text","number","email","url","checkbox","radio","range","date","datetime-local","search","tel","time","file","month","week","password","color","hidden"],defaultValue:"text"},{name:"name",type:"string",required:!0,helperText:'Every input in a form needs a unique name describing what it takes, e.g. "email"'},{name:"placeholder",type:"string",defaultValue:"Hello there",helperText:"Text to display when there is no value"},{name:"defaultValue",type:"string"},{name:"value",type:"string",advanced:!0},{name:"required",type:"boolean",helperText:"Is this input required to be filled out to submit a form",defaultValue:!1}],noWrap:!0,static:!0,defaultStyles:{paddingTop:"10px",paddingBottom:"10px",paddingLeft:"10px",paddingRight:"10px",borderRadius:"3px",borderWidth:"1px",borderStyle:"solid",borderColor:"#ccc"}},ge=r.lazy(()=>Promise.resolve().then(()=>require("./input-0456a323.cjs"))),he={name:"Form:Select",image:"https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F83acca093fb24aaf94dee136e9a4b045",defaultStyles:{alignSelf:"flex-start"},inputs:[{name:"options",type:"list",required:!0,subFields:[{name:"value",type:"text",required:!0},{name:"name",type:"text"}],defaultValue:[{value:"option 1"},{value:"option 2"}]},{name:"name",type:"string",required:!0,helperText:'Every select in a form needs a unique name describing what it gets, e.g. "email"'},{name:"defaultValue",type:"string"},{name:"value",type:"string",advanced:!0},{name:"required",type:"boolean",defaultValue:!1}],static:!0,noWrap:!0},be=r.lazy(()=>Promise.resolve().then(()=>require("./select-b851ff58.cjs"))),ye={name:"Form:SubmitButton",image:"https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fdf2820ffed1f4349a94c40b3221f5b98",defaultStyles:{appearance:"none",paddingTop:"15px",paddingBottom:"15px",paddingLeft:"25px",paddingRight:"25px",backgroundColor:"#3898EC",color:"white",borderRadius:"4px",cursor:"pointer"},inputs:[{name:"text",type:"text",defaultValue:"Click me"}],static:!0,noWrap:!0},xe=r.lazy(()=>Promise.resolve().then(()=>require("./submit-button-b363e0ed.cjs"))),ve={name:"Form:TextArea",image:"https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Ff74a2f3de58c4c3e939204e5b6b8f6c3",inputs:[{advanced:!0,name:"value",type:"string"},{name:"name",type:"string",required:!0,helperText:'Every input in a form needs a unique name describing what it gets, e.g. "email"'},{name:"defaultValue",type:"string"},{name:"placeholder",type:"string",defaultValue:"Hello there"},{name:"required",type:"boolean",defaultValue:!1}],defaultStyles:{paddingTop:"10px",paddingBottom:"10px",paddingLeft:"10px",paddingRight:"10px",borderRadius:"3px",borderWidth:"1px",borderStyle:"solid",borderColor:"#ccc"},static:!0,noWrap:!0},Se=r.lazy(()=>Promise.resolve().then(()=>require("./textarea-56a875bc.cjs"))),Te={name:"Raw:Img",hideFromInsertMenu:!0,image:"https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4",inputs:[{name:"image",bubble:!0,type:"file",allowedFileTypes:["jpeg","jpg","png","svg","gif","webp"],required:!0}],noWrap:!0,static:!0},ke=r.lazy(()=>Promise.resolve().then(()=>require("./img-8f2d03d2.cjs"))),Ie={name:"Video",canHaveChildren:!0,defaultStyles:{minHeight:"20px",minWidth:"20px"},image:"https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-videocam-24px%20(1).svg?alt=media&token=49a84e4a-b20e-4977-a650-047f986874bb",inputs:[{name:"video",type:"file",allowedFileTypes:["mp4"],bubble:!0,defaultValue:"https://cdn.builder.io/o/assets%2FYJIGb4i01jvw0SRdL5Bt%2Fd27731a526464deba0016216f5f9e570%2Fcompressed?apiKey=YJIGb4i01jvw0SRdL5Bt&token=d27731a526464deba0016216f5f9e570&alt=media&optimized=true",required:!0},{name:"posterImage",type:"file",allowedFileTypes:["jpeg","png"],helperText:"Image to show before the video plays"},{name:"autoPlay",type:"boolean",defaultValue:!0},{name:"controls",type:"boolean",defaultValue:!1},{name:"muted",type:"boolean",defaultValue:!0},{name:"loop",type:"boolean",defaultValue:!0},{name:"playsInline",type:"boolean",defaultValue:!0},{name:"fit",type:"text",defaultValue:"cover",enum:["contain","cover","fill","auto"]},{name:"preload",type:"text",defaultValue:"metadata",enum:["auto","metadata","none"]},{name:"fitContent",type:"boolean",helperText:"When child blocks are provided, fit to them instead of using the aspect ratio",defaultValue:!0,advanced:!0},{name:"position",type:"text",defaultValue:"center",enum:["center","top","left","right","bottom","top left","top right","bottom left","bottom right"]},{name:"height",type:"number",advanced:!0},{name:"width",type:"number",advanced:!0},{name:"aspectRatio",type:"number",advanced:!0,defaultValue:.7004048582995948},{name:"lazyLoad",type:"boolean",helperText:'Load this video "lazily" - as in only when a user scrolls near the video. Recommended for optmized performance and bandwidth consumption',defaultValue:!0,advanced:!0}],shouldReceiveBuilderProps:{builderBlock:!0}},Ce=()=>[{component:de,...se},{component:ce,...ue},{component:pe,...me},{component:ge,...fe},{component:xe,...ye},{component:be,...he},{component:Se,...ve},{component:ke,...Te},{component:k.Video,...Ie}],H=()=>[{component:k.Button,...Q},{component:k.Columns,...X},{component:k.Fragment,...Z},{component:k.Image,...ee},{component:k.Section,...te},{component:ae,...ne},{component:k.Symbol,...ie},{component:k.Text,...le},{component:re,...oe},{component:G,...Y},...Ce()],we=`function updateCookiesAndStyles(contentId, variants, isHydrationTarget) {
|
|
2
|
+
function getAndSetVariantId() {
|
|
3
|
+
function setCookie(name, value, days) {
|
|
4
|
+
let expires = '';
|
|
5
|
+
if (days) {
|
|
6
|
+
const date = new Date();
|
|
7
|
+
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
|
|
8
|
+
expires = '; expires=' + date.toUTCString();
|
|
9
|
+
}
|
|
10
|
+
document.cookie = name + '=' + (value || '') + expires + '; path=/' + '; Secure; SameSite=None';
|
|
11
|
+
}
|
|
12
|
+
function getCookie(name) {
|
|
13
|
+
const nameEQ = name + '=';
|
|
14
|
+
const ca = document.cookie.split(';');
|
|
15
|
+
for (let i = 0; i < ca.length; i++) {
|
|
16
|
+
let c = ca[i];
|
|
17
|
+
while (c.charAt(0) === ' ') c = c.substring(1, c.length);
|
|
18
|
+
if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);
|
|
19
|
+
}
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
const cookieName = \`builder.tests.\${contentId}\`;
|
|
23
|
+
const variantInCookie = getCookie(cookieName);
|
|
24
|
+
const availableIDs = variants.map(vr => vr.id).concat(contentId);
|
|
25
|
+
if (variantInCookie && availableIDs.includes(variantInCookie)) {
|
|
26
|
+
return variantInCookie;
|
|
27
|
+
}
|
|
28
|
+
let n = 0;
|
|
29
|
+
const random = Math.random();
|
|
30
|
+
for (let i = 0; i < variants.length; i++) {
|
|
31
|
+
const variant = variants[i];
|
|
32
|
+
const testRatio = variant.testRatio;
|
|
33
|
+
n += testRatio;
|
|
34
|
+
if (random < n) {
|
|
35
|
+
setCookie(cookieName, variant.id);
|
|
36
|
+
return variant.id;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
setCookie(cookieName, contentId);
|
|
40
|
+
return contentId;
|
|
41
|
+
}
|
|
42
|
+
const winningVariantId = getAndSetVariantId();
|
|
43
|
+
const styleEl = document.currentScript?.previousElementSibling;
|
|
44
|
+
if (isHydrationTarget) {
|
|
45
|
+
styleEl.remove();
|
|
46
|
+
const thisScriptEl = document.currentScript;
|
|
47
|
+
thisScriptEl?.remove();
|
|
48
|
+
} else {
|
|
49
|
+
const newStyleStr = variants.concat({
|
|
50
|
+
id: contentId
|
|
51
|
+
}).filter(variant => variant.id !== winningVariantId).map(value => {
|
|
52
|
+
return \`.variant-\${value.id} { display: none; }
|
|
53
|
+
\`;
|
|
54
|
+
}).join('');
|
|
55
|
+
styleEl.innerHTML = newStyleStr;
|
|
56
|
+
}
|
|
57
|
+
}`,Ve=`function updateVariantVisibility(variantContentId, defaultContentId, isHydrationTarget) {
|
|
58
|
+
if (!navigator.cookieEnabled) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
function getCookie(name) {
|
|
62
|
+
const nameEQ = name + '=';
|
|
63
|
+
const ca = document.cookie.split(';');
|
|
64
|
+
for (let i = 0; i < ca.length; i++) {
|
|
65
|
+
let c = ca[i];
|
|
66
|
+
while (c.charAt(0) === ' ') c = c.substring(1, c.length);
|
|
67
|
+
if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);
|
|
68
|
+
}
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
const cookieName = \`builder.tests.\${defaultContentId}\`;
|
|
72
|
+
const winningVariant = getCookie(cookieName);
|
|
73
|
+
const parentDiv = document.currentScript?.parentElement;
|
|
74
|
+
const isDefaultContent = variantContentId === defaultContentId;
|
|
75
|
+
const isWinningVariant = winningVariant === variantContentId;
|
|
76
|
+
if (isWinningVariant && !isDefaultContent) {
|
|
77
|
+
parentDiv?.removeAttribute('hidden');
|
|
78
|
+
parentDiv?.removeAttribute('aria-hidden');
|
|
79
|
+
} else if (!isWinningVariant && isDefaultContent) {
|
|
80
|
+
parentDiv?.setAttribute('hidden', 'true');
|
|
81
|
+
parentDiv?.setAttribute('aria-hidden', 'true');
|
|
82
|
+
}
|
|
83
|
+
if (isHydrationTarget) {
|
|
84
|
+
if (!isWinningVariant) {
|
|
85
|
+
parentDiv?.remove();
|
|
86
|
+
}
|
|
87
|
+
const thisScriptEl = document.currentScript;
|
|
88
|
+
thisScriptEl?.remove();
|
|
89
|
+
}
|
|
90
|
+
return;
|
|
91
|
+
}`,M="builderIoAbTest",O="builderIoRenderContent",B=e=>Object.values((e==null?void 0:e.variations)||{}).map(t=>({...t,testVariationId:t.id,id:e==null?void 0:e.id})),Re=({canTrack:e,content:t})=>!(!(B(t).length>0)||!e||d.isBrowser()),Ee=e=>e==="react"||e==="reactNative",_=Ee(d.TARGET),Fe=()=>`
|
|
92
|
+
window.${M} = ${we}
|
|
93
|
+
window.${O} = ${Ve}
|
|
94
|
+
`,Pe=(e,t)=>`
|
|
95
|
+
window.${M}(
|
|
96
|
+
"${t}",${JSON.stringify(e)}, ${_}
|
|
97
|
+
)`,We=({contentId:e,variationId:t})=>`window.${O}(
|
|
98
|
+
"${t}", "${e}", ${_}
|
|
99
|
+
)`;function L(e){return h.jsx("script",{dangerouslySetInnerHTML:{__html:e.scriptStr},"data-id":e.id,nonce:e.nonce||""})}function $(e){return Math.round(e*1e3)/1e3}const Ae=(e,t,n=!0)=>{if(!(e instanceof HTMLElement))return null;let i=n?e:e.parentElement;do{if(!i)return null;if(t(i))return i}while(i=i.parentElement);return null},Be=e=>Ae(e,t=>{const n=t.getAttribute("builder-id")||t.id;return(n==null?void 0:n.indexOf("builder-"))===0}),N=({event:e,target:t})=>{const n=t.getBoundingClientRect(),i=e.clientX-n.left,c=e.clientY-n.top,f=$(i/n.width),a=$(c/n.height);return{x:f,y:a}},qe=e=>{const t=e.target,n=t&&Be(t),i=(n==null?void 0:n.getAttribute("builder-id"))||(n==null?void 0:n.id);return{targetBuilderElement:i||void 0,metadata:{targetOffset:t?N({event:e,target:t}):void 0,builderTargetOffset:n?N({event:e,target:n}):void 0,builderElementIndex:n&&i?[].slice.call(document.getElementsByClassName(i)).indexOf(n):void 0}}},De=e=>{var f,a;const t=e.family+(e.kind&&!e.kind.includes("#")?", "+e.kind:""),n=t.split(",")[0],i=(a=e.fileUrl)!=null?a:(f=e==null?void 0:e.files)==null?void 0:f.regular;let c="";if(i&&t&&n&&(c+=`
|
|
100
|
+
@font-face {
|
|
101
|
+
font-family: "${t}";
|
|
102
|
+
src: local("${n}"), url('${i}') format('woff2');
|
|
103
|
+
font-display: fallback;
|
|
104
|
+
font-weight: 400;
|
|
105
|
+
}
|
|
106
|
+
`.trim()),e.files)for(const o in e.files){if(!(String(Number(o))===o))continue;const T=e.files[o];T&&T!==i&&(c+=`
|
|
107
|
+
@font-face {
|
|
108
|
+
font-family: "${t}";
|
|
109
|
+
src: url('${T}') format('woff2');
|
|
110
|
+
font-display: fallback;
|
|
111
|
+
font-weight: ${o};
|
|
112
|
+
}
|
|
113
|
+
`.trim())}return c},je=({customFonts:e})=>{var t;return((t=e==null?void 0:e.map(n=>De(n)))==null?void 0:t.join(" "))||""},Ue=({cssCode:e,contentId:t})=>e?t?(e==null?void 0:e.replace(/&/g,`div[builder-content-id="${t}"]`))||"":e:"",Le=`
|
|
114
|
+
.builder-button {
|
|
115
|
+
all: unset;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.builder-text > p:first-of-type, .builder-text > .builder-paragraph:first-of-type {
|
|
119
|
+
margin: 0;
|
|
120
|
+
}
|
|
121
|
+
.builder-text > p, .builder-text > .builder-paragraph {
|
|
122
|
+
color: inherit;
|
|
123
|
+
line-height: inherit;
|
|
124
|
+
letter-spacing: inherit;
|
|
125
|
+
font-weight: inherit;
|
|
126
|
+
font-size: inherit;
|
|
127
|
+
text-align: inherit;
|
|
128
|
+
font-family: inherit;
|
|
129
|
+
}
|
|
130
|
+
`,He=e=>e?"":Le,$e=e=>`variant-${e}`;function Ne(e){var b,m,F;const t=r.useRef(null);function n(l){var y,u;const p={...e.builderContextSignal.rootState,...l};e.builderContextSignal.rootSetState?(u=(y=e.builderContextSignal).rootSetState)==null||u.call(y,p):e.setBuilderContextSignal(s=>({...s,rootState:p}))}function i(l){var y,u,s,x,V;const p={...e.builderContextSignal.content,...l,data:{...(y=e.builderContextSignal.content)==null?void 0:y.data,...l==null?void 0:l.data},meta:{...(u=e.builderContextSignal.content)==null?void 0:u.meta,...l==null?void 0:l.meta,breakpoints:((s=l==null?void 0:l.meta)==null?void 0:s.breakpoints)||((V=(x=e.builderContextSignal.content)==null?void 0:x.meta)==null?void 0:V.breakpoints)}};e.setBuilderContextSignal(S=>({...S,content:p}))}function c(){return e.showContent?{}:{hidden:!0,"aria-hidden":!0}}const[f,a]=r.useState(()=>e.contentWrapper||"div");function o(l){return d.createEditorListener({model:e.model,trustedHosts:e.trustedHosts,callbacks:{configureSdk:p=>{var s;const{breakpoints:y,contentId:u}=p;!u||u!==((s=e.builderContextSignal.content)==null?void 0:s.id)||y&&i({meta:{breakpoints:y}})},animation:p=>{R.triggerAnimation(p)},contentUpdate:p=>{i(p)}}})(l)}const[g,T]=r.useState(()=>({})),[v,w]=r.useState(()=>({})),[I,P]=r.useState(()=>!1);function W(l){var p,y;if(e.builderContextSignal.content){const u=(p=e.builderContextSignal.content)==null?void 0:p.testVariationId,s=(y=e.builderContextSignal.content)==null?void 0:y.id;d._track({type:"click",canTrack:d.getDefaultCanTrack(e.canTrack),contentId:s,apiKey:e.apiKey,variationId:u!==s?u:void 0,...qe(l),unique:!I})}I||P(!0)}function A(){var p,y,u;const l=(u=(y=(p=e.builderContextSignal.content)==null?void 0:p.data)==null?void 0:y.httpRequests)!=null?u:{};Object.entries(l).forEach(([s,x])=>{if(!x||v[s]||g[s]&&!d.isEditing())return;v[s]=!0;const V=x.replace(/{{([^}]+)}}/g,(S,J)=>String(K.evaluate({code:J,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState,enableCache:!0})));fetch(V).then(S=>S.json()).then(S=>{n({[s]:S}),g[s]=!0}).catch(S=>{console.error("error fetching dynamic data",x,S)}).finally(()=>{v[s]=!1})})}function C(){d.isEditing()&&window.dispatchEvent(new CustomEvent("builder:component:stateChange",{detail:{state:R.fastClone(e.builderContextSignal.rootState),ref:{name:e.model}}}))}const E=r.useRef(!1);return E.current||(A(),C(),E.current=!0),r.useEffect(()=>{var l,p;if(d.isBrowser()){if(d.isEditing()&&(window.addEventListener("message",o),d.registerInsertMenu(),d.setupBrowserForEditing({...e.locale?{locale:e.locale}:{},...e.enrich?{enrich:e.enrich}:{},...e.trustedHosts?{trustedHosts:e.trustedHosts}:{}}),Object.values(e.builderContextSignal.componentInfos).forEach(u=>{var x;const s=d.createRegisterComponentMessage(u);(x=window.parent)==null||x.postMessage(s,"*")}),window.addEventListener("builder:component:stateChangeListenerActivated",C)),e.builderContextSignal.content&&d.getDefaultCanTrack(e.canTrack)){const u=(l=e.builderContextSignal.content)==null?void 0:l.testVariationId,s=(p=e.builderContextSignal.content)==null?void 0:p.id,x=e.apiKey;d._track({type:"impression",canTrack:!0,contentId:s,apiKey:x,variationId:u!==s?u:void 0})}if(d.isPreviewing()&&!d.isEditing()){const u=new URL(location.href).searchParams,s=u.get("builder.preview"),x=u.get(`builder.overrides.${s}`),V=u.get("apiKey")||u.get("builder.space");s===e.model&&V===e.apiKey&&(!e.content||x===e.content.id)&&d.fetchOneEntry({model:e.model,apiKey:e.apiKey,apiVersion:e.builderContextSignal.apiVersion}).then(S=>{S&&i(S)})}}},[]),r.useEffect(()=>{e.content&&i(e.content)},[e.content]),r.useEffect(()=>{C()},[e.builderContextSignal.rootState]),r.useEffect(()=>{e.data&&n(e.data)},[e.data]),r.useEffect(()=>{e.locale&&n({locale:e.locale})},[e.locale]),r.useEffect(()=>()=>{d.isBrowser()&&(window.removeEventListener("message",o),window.removeEventListener("builder:component:stateChangeListenerActivated",C))},[]),h.jsx(k.BuilderContext.Provider,{value:e.builderContextSignal,children:e.builderContextSignal.content?h.jsx(f,{ref:t,onClick:l=>W(l),"builder-content-id":(b=e.builderContextSignal.content)==null?void 0:b.id,"builder-model":e.model,className:$e(((m=e.content)==null?void 0:m.testVariationId)||((F=e.content)==null?void 0:F.id)),...c(),...e.contentWrapperProps,children:e.children}):null})}function ze(e){const[t,n]=r.useState(()=>`
|
|
131
|
+
${Ue({cssCode:e.cssCode,contentId:e.contentId})}
|
|
132
|
+
${je({customFonts:e.customFonts})}
|
|
133
|
+
${He(e.isNestedRender)}
|
|
134
|
+
`.trim());return h.jsx(R.InlinedStyles,{id:"builderio-content",styles:t,nonce:e.nonce})}const Ke=({content:e,data:t,locale:n})=>{var f,a,o;const i={},c=((f=e==null?void 0:e.data)==null?void 0:f.state)||{};return(o=(a=e==null?void 0:e.data)==null?void 0:a.inputs)==null||o.forEach(g=>{g.name&&g.defaultValue!==void 0&&(i[g.name]=g.defaultValue)}),{...i,...c,...t,...n?{locale:n}:{}}},Me=({content:e,data:t})=>e?{...e,data:{...e==null?void 0:e.data,...t},meta:e==null?void 0:e.meta}:void 0;function z(e){var T,v,w,I,P,W,A,C,E;const[t,n]=r.useState(()=>{var b,m;return We({variationId:(b=e.content)==null?void 0:b.testVariationId,contentId:(m=e.content)==null?void 0:m.id})});function i(b){o(m=>({...m,rootState:b}))}const[c,f]=r.useState(()=>{var b;return[...H(),...((b=e.customComponents)==null?void 0:b.filter(({models:m})=>!(m!=null&&m.length)||!e.model?!0:m.includes(e.model)))||[]].reduce((m,{component:F,...l})=>({...m,[l.name]:{component:F,...d.serializeIncludingFunctions(l)}}),{})}),[a,o]=r.useState(()=>{var b;return{content:Me({content:e.content,data:e.data}),localState:void 0,rootState:Ke({content:e.content,data:e.data,locale:e.locale}),rootSetState:i,context:e.context||{},canTrack:e.canTrack,apiKey:e.apiKey,apiVersion:e.apiVersion,componentInfos:[...H(),...((b=e.customComponents)==null?void 0:b.filter(({models:m})=>!(m!=null&&m.length)||!e.model?!0:m.includes(e.model)))||[]].reduce((m,{component:F,...l})=>({...m,[l.name]:d.serializeIncludingFunctions(l)}),{}),inheritedStyles:{},BlocksWrapper:e.blocksWrapper||"div",BlocksWrapperProps:e.blocksWrapperProps||{},nonce:e.nonce||""}}),g=r.useRef(!1);if(!g.current){e.apiKey||d.logger.error("No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop.");const b=(v=(T=a.content)==null?void 0:T.data)==null?void 0:v.jsCode;b&&K.evaluate({code:b,context:e.context||{},localState:void 0,rootState:a.rootState,rootSetState:m=>{Object.assign(a.rootState,m)},isExpression:!1,enableCache:!1}),g.current=!0}return h.jsx(R.ComponentsContext.Provider,{value:{registeredComponents:c},children:h.jsxs(Ne,{nonce:e.nonce,content:e.content,data:e.data,model:e.model,context:e.context,apiKey:e.apiKey,canTrack:e.canTrack,locale:e.locale,enrich:e.enrich,showContent:e.showContent,builderContextSignal:a,contentWrapper:e.contentWrapper,contentWrapperProps:e.contentWrapperProps,trustedHosts:e.trustedHosts,setBuilderContextSignal:o,children:[e.isSsrAbTest?h.jsx(L,{id:"builderio-variant-visibility",scriptStr:t,nonce:e.nonce||""}):null,h.jsx(ze,{nonce:e.nonce||"",isNestedRender:e.isNestedRender,contentId:(w=a.content)==null?void 0:w.id,cssCode:(P=(I=a.content)==null?void 0:I.data)==null?void 0:P.cssCode,customFonts:(A=(W=a.content)==null?void 0:W.data)==null?void 0:A.customFonts}),h.jsx(R.Blocks,{blocks:(E=(C=a.content)==null?void 0:C.data)==null?void 0:E.blocks,context:a,registeredComponents:c,linkComponent:e.linkComponent})]})})}function Oe(e){var a;const[t,n]=r.useState(()=>Re({canTrack:d.getDefaultCanTrack(e.canTrack),content:e.content}));function i(){var o;return Pe(B(e.content).map(g=>({id:g.testVariationId,testRatio:g.testRatio})),((o=e.content)==null?void 0:o.id)||"")}function c(){return B(e.content).map(o=>`.variant-${o.testVariationId} { display: none; } `).join("")}function f(){var o;return t?{...e.content,testVariationId:(o=e.content)==null?void 0:o.id}:d.handleABTestingSync({item:e.content,canTrack:d.getDefaultCanTrack(e.canTrack)})}return r.useEffect(()=>{},[]),h.jsxs(h.Fragment,{children:[!e.isNestedRender&&d.TARGET!=="reactNative"?h.jsx(L,{id:"builderio-init-variants-fns",scriptStr:Fe(),nonce:e.nonce||""}):null,t?h.jsxs(h.Fragment,{children:[h.jsx(R.InlinedStyles,{id:"builderio-variants",styles:c(),nonce:e.nonce||""}),h.jsx(L,{id:"builderio-variants-visibility",scriptStr:i(),nonce:e.nonce||""}),(a=B(e.content))==null?void 0:a.map(o=>h.jsx(z,{isNestedRender:e.isNestedRender,nonce:e.nonce,content:o,showContent:!1,model:e.model,data:e.data,context:e.context,apiKey:e.apiKey,apiVersion:e.apiVersion,customComponents:e.customComponents,linkComponent:e.linkComponent,canTrack:e.canTrack,locale:e.locale,enrich:e.enrich,isSsrAbTest:t,blocksWrapper:e.blocksWrapper,blocksWrapperProps:e.blocksWrapperProps,contentWrapper:e.contentWrapper,contentWrapperProps:e.contentWrapperProps,trustedHosts:e.trustedHosts},o.testVariationId))]}):null,h.jsx(z,{nonce:e.nonce,isNestedRender:e.isNestedRender,content:f(),showContent:!0,model:e.model,data:e.data,context:e.context,apiKey:e.apiKey,apiVersion:e.apiVersion,customComponents:e.customComponents,linkComponent:e.linkComponent,canTrack:e.canTrack,locale:e.locale,enrich:e.enrich,isSsrAbTest:t,blocksWrapper:e.blocksWrapper,blocksWrapperProps:e.blocksWrapperProps,contentWrapper:e.contentWrapper,contentWrapperProps:e.contentWrapperProps,trustedHosts:e.trustedHosts})]})}exports.default=Oe;
|