@builder.io/sdk-react 1.0.16 → 1.0.19-dev-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser/blocks-exports.cjs +23 -23
- package/lib/browser/blocks-exports.mjs +661 -659
- package/lib/browser/index.cjs +1 -1
- package/lib/browser/index.mjs +22 -21
- package/lib/browser/{server-entry-11e01841.cjs → server-entry-1a86f409.cjs} +1 -1
- package/lib/browser/{server-entry-afeff3cb.js → server-entry-cfff49d1.js} +1 -1
- package/lib/browser/server-entry.cjs +1 -1
- package/lib/browser/server-entry.mjs +1 -1
- package/lib/edge/{blocks-8e5cc463.js → blocks-03aafa4f.js} +196 -209
- package/lib/edge/{blocks-a0a9d452.cjs → blocks-87a3568e.cjs} +9 -9
- package/lib/edge/blocks-exports.cjs +1 -1
- package/lib/edge/blocks-exports.mjs +27 -13
- package/lib/edge/{button-764707c4.js → button-14d13356.js} +3 -3
- package/lib/edge/{button-66c46316.cjs → button-58695538.cjs} +1 -1
- package/lib/edge/{columns-0bdc7586.js → columns-d2f7e212.js} +48 -47
- package/lib/edge/columns-f98bd830.cjs +28 -0
- package/lib/edge/content-variants-7e661199.cjs +134 -0
- package/lib/edge/{content-variants-db1e0281.js → content-variants-ad9f707f.js} +264 -273
- package/lib/edge/dynamic-blocks-exports.cjs +2 -0
- package/lib/edge/dynamic-blocks-exports.mjs +4 -1
- package/lib/edge/{dynamic-renderer-b29b45ca.cjs → dynamic-renderer-1c9f24c0.cjs} +1 -1
- package/lib/edge/dynamic-renderer-96ba4e48.js +8 -0
- package/lib/edge/{form-7a6f998f.js → form-04cf10db.js} +69 -58
- package/lib/edge/form-e83f7b7a.cjs +1 -0
- package/lib/edge/{get-class-prop-name-49cbb2c6.js → get-class-prop-name-859a7f60.js} +1 -1
- package/lib/edge/{get-class-prop-name-bbc4d2f3.cjs → get-class-prop-name-f1301669.cjs} +1 -1
- package/lib/edge/{image-0008c792.js → image-2cc909d9.js} +25 -25
- package/lib/edge/image-7e1361ce.cjs +17 -0
- package/lib/edge/{img-058cb6f0.cjs → img-0c1e53c0.cjs} +1 -1
- package/lib/edge/{img-c9630f56.js → img-b4ff1bef.js} +1 -1
- package/lib/edge/index.cjs +1 -1
- package/lib/edge/index.mjs +22 -21
- package/lib/edge/{input-ceacd029.cjs → input-2103da14.cjs} +1 -1
- package/lib/edge/{input-3de90790.js → input-c6fee09c.js} +1 -1
- package/lib/edge/{select-df72f987.cjs → select-b8ad0a4c.cjs} +1 -1
- package/lib/edge/{select-ee266e60.js → select-f260d051.js} +1 -1
- package/lib/edge/{server-entry-ef266884.cjs → server-entry-00891f33.cjs} +1 -1
- package/lib/edge/{server-entry-2b1068fd.js → server-entry-d46a218d.js} +1 -1
- package/lib/edge/server-entry.cjs +1 -1
- package/lib/edge/server-entry.mjs +1 -1
- package/lib/edge/{slot-f246e67e.js → slot-8fa7f242.js} +7 -6
- package/lib/edge/slot-bb84f342.cjs +1 -0
- package/lib/edge/{symbol-f68a7357.js → symbol-324dadc8.js} +2 -2
- package/lib/edge/{symbol-991f09b3.cjs → symbol-636383eb.cjs} +1 -1
- package/lib/edge/video-64014cc4.cjs +1 -0
- package/lib/edge/{video-58c2cc8d.js → video-d02ff89b.js} +15 -15
- package/lib/node/blocks-exports.cjs +32 -72
- package/lib/node/blocks-exports.mjs +887 -1011
- package/lib/node/index.cjs +1 -1
- package/lib/node/index.mjs +24 -22
- package/lib/node/init.cjs +1 -0
- package/lib/node/init.mjs +8 -0
- package/lib/node/node-runtime-1ca09d03.js +137 -0
- package/lib/node/node-runtime-56212f7c.cjs +41 -0
- package/lib/node/{server-entry-a221fe66.js → server-entry-8c84ddbd.js} +1 -1
- package/lib/node/{server-entry-4ba58cf3.cjs → server-entry-ff6fc2b4.cjs} +1 -1
- package/lib/node/server-entry.cjs +1 -1
- package/lib/node/server-entry.mjs +1 -1
- package/package.json +6 -1
- package/types/blocks/form/component-info.d.ts +2 -0
- package/types/blocks/form/form.d.ts +3 -0
- package/types/blocks/input/component-info.d.ts +2 -0
- package/types/blocks/input/input.d.ts +15 -0
- package/types/blocks/select/component-info.d.ts +2 -0
- package/types/blocks/select/select.d.ts +16 -0
- package/types/blocks/submit-button/component-info.d.ts +2 -0
- package/types/blocks/submit-button/submit-button.d.ts +10 -0
- package/types/components/content/components/context-updater.d.ts +5 -0
- package/types/components/dynamic-renderer.d.ts +3 -0
- package/types/constants/sdk-version.d.ts +1 -1
- package/types/context/index.d.ts +1 -0
- package/types/functions/evaluate/node-runtime/init.d.ts +2 -0
- package/types/functions/evaluate/node-runtime/node-runtime.d.ts +1 -0
- package/types/functions/get-react-native-block-styles.d.ts +15 -0
- package/types/functions/sanitize-react-native-block-styles.d.ts +3 -0
- package/types/functions/sanitize-rn-allowed-css.d.ts +8 -0
- package/types/index-helpers/blocks-exports.d.ts +4 -0
- package/types/node-runtime/index.d.ts +1 -0
- package/types/node-runtime/node-runtime.d.ts +9 -0
- package/types/node-runtime.d.ts +1 -0
- package/lib/edge/columns-0a14db0e.cjs +0 -28
- package/lib/edge/content-variants-c03ec7a1.cjs +0 -134
- package/lib/edge/dynamic-renderer-8b343325.js +0 -8
- package/lib/edge/form-a5d18c89.cjs +0 -1
- package/lib/edge/image-ee3dd857.cjs +0 -17
- package/lib/edge/slot-83d735d6.cjs +0 -1
- package/lib/edge/video-e20dcbbc.cjs +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import { DynamicRenderer as i } from "./dynamic-renderer-
|
|
3
|
-
import { getClassPropName as e } from "./get-class-prop-name-
|
|
4
|
-
import "./server-entry-
|
|
2
|
+
import { DynamicRenderer as i } from "./dynamic-renderer-96ba4e48.js";
|
|
3
|
+
import { getClassPropName as e } from "./get-class-prop-name-859a7f60.js";
|
|
4
|
+
import "./server-entry-d46a218d.js";
|
|
5
5
|
function u(t) {
|
|
6
6
|
return /* @__PURE__ */ n(
|
|
7
7
|
i,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),i=require("./dynamic-renderer-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),i=require("./dynamic-renderer-1c9f24c0.cjs"),t=require("./get-class-prop-name-f1301669.cjs");require("./server-entry-00891f33.cjs");function r(e){return n.jsx(i.DynamicRenderer,{attributes:{...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"}},TagName:e.link?e.builderLinkComponent||"a":"button",actionAttributes:{},children:e.text})}exports.default=r;
|
|
@@ -1,83 +1,84 @@
|
|
|
1
|
-
import { jsxs as g, Fragment as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { InlinedStyles as w, mapStyleObjToStrIfNeeded as $, Blocks as B, getSizesForBreakpoints as z } from "./blocks-
|
|
4
|
-
import { DynamicRenderer as L } from "./dynamic-renderer-
|
|
5
|
-
import { getClassPropName as W } from "./get-class-prop-name-
|
|
6
|
-
import "./
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { jsxs as g, Fragment as y, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useState as a } from "react";
|
|
3
|
+
import { InlinedStyles as w, mapStyleObjToStrIfNeeded as $, Blocks as B, getSizesForBreakpoints as z } from "./blocks-03aafa4f.js";
|
|
4
|
+
import { DynamicRenderer as L } from "./dynamic-renderer-96ba4e48.js";
|
|
5
|
+
import { getClassPropName as W } from "./get-class-prop-name-859a7f60.js";
|
|
6
|
+
import "./blocks-exports.mjs";
|
|
7
|
+
import "./server-entry-d46a218d.js";
|
|
8
|
+
function R(t) {
|
|
9
|
+
var k;
|
|
10
|
+
const [c, A] = a(
|
|
10
11
|
() => typeof t.space == "number" ? t.space || 0 : 20
|
|
11
|
-
), [
|
|
12
|
+
), [r, D] = a(() => t.columns || []), [m, F] = a(
|
|
12
13
|
() => t.stackColumnsAt || "tablet"
|
|
13
14
|
);
|
|
14
|
-
function y(e) {
|
|
15
|
-
var n;
|
|
16
|
-
return ((n = o[e]) == null ? void 0 : n.width) || 100 / o.length;
|
|
17
|
-
}
|
|
18
15
|
function S(e) {
|
|
19
|
-
|
|
20
|
-
return
|
|
16
|
+
var i;
|
|
17
|
+
return ((i = r[e]) == null ? void 0 : i.width) || 100 / r.length;
|
|
18
|
+
}
|
|
19
|
+
function x(e) {
|
|
20
|
+
const i = c * (r.length - 1) / r.length;
|
|
21
|
+
return `calc(${S(e)}% - ${i}px)`;
|
|
21
22
|
}
|
|
22
|
-
function
|
|
23
|
+
function s({
|
|
23
24
|
stackedStyle: e,
|
|
24
|
-
desktopStyle:
|
|
25
|
+
desktopStyle: i
|
|
25
26
|
}) {
|
|
26
|
-
return m === "tablet" ? e :
|
|
27
|
+
return m === "tablet" ? e : i;
|
|
27
28
|
}
|
|
28
29
|
function d({
|
|
29
30
|
stackedStyle: e,
|
|
30
|
-
desktopStyle:
|
|
31
|
+
desktopStyle: i
|
|
31
32
|
}) {
|
|
32
|
-
return m === "never" ?
|
|
33
|
+
return m === "never" ? i : e;
|
|
33
34
|
}
|
|
34
|
-
const [u, N] =
|
|
35
|
+
const [u, N] = a(
|
|
35
36
|
() => t.stackColumnsAt === "never" ? "row" : t.reverseColumnsWhenStacked ? "column-reverse" : "column"
|
|
36
37
|
);
|
|
37
|
-
function
|
|
38
|
+
function C() {
|
|
38
39
|
return {
|
|
39
40
|
"--flex-dir": u,
|
|
40
|
-
"--flex-dir-tablet":
|
|
41
|
+
"--flex-dir-tablet": s({
|
|
41
42
|
stackedStyle: u,
|
|
42
43
|
desktopStyle: "row"
|
|
43
44
|
})
|
|
44
45
|
};
|
|
45
46
|
}
|
|
46
|
-
function
|
|
47
|
-
const
|
|
47
|
+
function p(e) {
|
|
48
|
+
const i = e === 0 ? 0 : c, n = x(e), l = `${i}px`, f = "100%", h = 0;
|
|
48
49
|
return {
|
|
49
50
|
...{
|
|
50
51
|
display: "flex",
|
|
51
52
|
flexDirection: "column",
|
|
52
53
|
alignItems: "stretch"
|
|
53
54
|
},
|
|
54
|
-
width:
|
|
55
|
+
width: n,
|
|
55
56
|
["marginLeft"]: l,
|
|
56
57
|
"--column-width-mobile": d({
|
|
57
|
-
stackedStyle:
|
|
58
|
-
desktopStyle:
|
|
58
|
+
stackedStyle: f,
|
|
59
|
+
desktopStyle: n
|
|
59
60
|
}),
|
|
60
61
|
"--column-margin-left-mobile": d({
|
|
61
62
|
stackedStyle: h,
|
|
62
63
|
desktopStyle: l
|
|
63
64
|
}),
|
|
64
|
-
"--column-width-tablet":
|
|
65
|
-
stackedStyle:
|
|
66
|
-
desktopStyle:
|
|
65
|
+
"--column-width-tablet": s({
|
|
66
|
+
stackedStyle: f,
|
|
67
|
+
desktopStyle: n
|
|
67
68
|
}),
|
|
68
|
-
"--column-margin-left-tablet":
|
|
69
|
+
"--column-margin-left-tablet": s({
|
|
69
70
|
stackedStyle: h,
|
|
70
71
|
desktopStyle: l
|
|
71
72
|
})
|
|
72
73
|
};
|
|
73
74
|
}
|
|
74
75
|
function b(e) {
|
|
75
|
-
var
|
|
76
|
+
var n, l;
|
|
76
77
|
return z(
|
|
77
|
-
((l = (
|
|
78
|
+
((l = (n = t.builderContext.content) == null ? void 0 : n.meta) == null ? void 0 : l.breakpoints) || {}
|
|
78
79
|
)[e].max;
|
|
79
80
|
}
|
|
80
|
-
function
|
|
81
|
+
function v() {
|
|
81
82
|
return `
|
|
82
83
|
@media (max-width: ${b("medium")}px) {
|
|
83
84
|
.${t.builderBlock.id}-breakpoints {
|
|
@@ -104,15 +105,15 @@ function O(t) {
|
|
|
104
105
|
},
|
|
105
106
|
`;
|
|
106
107
|
}
|
|
107
|
-
return /* @__PURE__ */ g(
|
|
108
|
+
return /* @__PURE__ */ g(y, { children: [
|
|
108
109
|
/* @__PURE__ */ g(
|
|
109
110
|
"div",
|
|
110
111
|
{
|
|
111
|
-
className: `builder-columns ${t.builderBlock.id}-breakpoints div-
|
|
112
|
-
style:
|
|
112
|
+
className: `builder-columns ${t.builderBlock.id}-breakpoints div-7a098ce6`,
|
|
113
|
+
style: C(),
|
|
113
114
|
children: [
|
|
114
|
-
/* @__PURE__ */
|
|
115
|
-
(
|
|
115
|
+
/* @__PURE__ */ o(y, { children: /* @__PURE__ */ o(w, { id: "builderio-columns", styles: v() }) }),
|
|
116
|
+
(k = t.columns) == null ? void 0 : k.map((e, i) => /* @__PURE__ */ o(
|
|
116
117
|
L,
|
|
117
118
|
{
|
|
118
119
|
TagName: e.link ? t.builderLinkComponent || "a" : "div",
|
|
@@ -122,12 +123,12 @@ function O(t) {
|
|
|
122
123
|
href: e.link
|
|
123
124
|
} : {},
|
|
124
125
|
[W()]: "builder-column",
|
|
125
|
-
style: $(
|
|
126
|
+
style: $(p(i))
|
|
126
127
|
},
|
|
127
|
-
children: /* @__PURE__ */
|
|
128
|
+
children: /* @__PURE__ */ o(
|
|
128
129
|
B,
|
|
129
130
|
{
|
|
130
|
-
path: `component.options.columns.${
|
|
131
|
+
path: `component.options.columns.${i}.blocks`,
|
|
131
132
|
parent: t.builderBlock.id,
|
|
132
133
|
styleProp: {
|
|
133
134
|
flexGrow: "1"
|
|
@@ -139,17 +140,17 @@ function O(t) {
|
|
|
139
140
|
}
|
|
140
141
|
)
|
|
141
142
|
},
|
|
142
|
-
|
|
143
|
+
i
|
|
143
144
|
))
|
|
144
145
|
]
|
|
145
146
|
}
|
|
146
147
|
),
|
|
147
|
-
/* @__PURE__ */
|
|
148
|
+
/* @__PURE__ */ o("style", { children: `.div-7a098ce6 {
|
|
148
149
|
display: flex;
|
|
149
150
|
line-height: normal;
|
|
150
151
|
}` })
|
|
151
152
|
] });
|
|
152
153
|
}
|
|
153
154
|
export {
|
|
154
|
-
|
|
155
|
+
R as default
|
|
155
156
|
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),s=require("react"),a=require("./blocks-87a3568e.cjs"),w=require("./dynamic-renderer-1c9f24c0.cjs"),$=require("./get-class-prop-name-f1301669.cjs");require("./blocks-exports.cjs");require("./server-entry-00891f33.cjs");function j(e){var f;const[u,p]=s.useState(()=>typeof e.space=="number"?e.space||0:20),[o,B]=s.useState(()=>e.columns||[]),[d,q]=s.useState(()=>e.stackColumnsAt||"tablet");function S(t){var n;return((n=o[t])==null?void 0:n.width)||100/o.length}function y(t){const n=u*(o.length-1)/o.length;return`calc(${S(t)}% - ${n}px)`}function c({stackedStyle:t,desktopStyle:n}){return d==="tablet"?t:n}function m({stackedStyle:t,desktopStyle:n}){return d==="never"?n:t}const[b,z]=s.useState(()=>e.stackColumnsAt==="never"?"row":e.reverseColumnsWhenStacked?"column-reverse":"column");function x(){return{"--flex-dir":b,"--flex-dir-tablet":c({stackedStyle:b,desktopStyle:"row"})}}function C(t){const n=t===0?0:u,l=y(t),r=`${n}px`,g="100%",h=0;return{...{display:"flex",flexDirection:"column",alignItems:"stretch"},width:l,["marginLeft"]:r,"--column-width-mobile":m({stackedStyle:g,desktopStyle:l}),"--column-margin-left-mobile":m({stackedStyle:h,desktopStyle:r}),"--column-width-tablet":c({stackedStyle:g,desktopStyle:l}),"--column-margin-left-tablet":c({stackedStyle:h,desktopStyle:r})}}function k(t){var l,r;return a.getSizesForBreakpoints(((r=(l=e.builderContext.content)==null?void 0:l.meta)==null?void 0:r.breakpoints)||{})[t].max}function v(){return`
|
|
2
|
+
@media (max-width: ${k("medium")}px) {
|
|
3
|
+
.${e.builderBlock.id}-breakpoints {
|
|
4
|
+
flex-direction: var(--flex-dir-tablet);
|
|
5
|
+
align-items: stretch;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.${e.builderBlock.id}-breakpoints > .builder-column {
|
|
9
|
+
width: var(--column-width-tablet) !important;
|
|
10
|
+
margin-left: var(--column-margin-left-tablet) !important;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@media (max-width: ${k("small")}px) {
|
|
15
|
+
.${e.builderBlock.id}-breakpoints {
|
|
16
|
+
flex-direction: var(--flex-dir);
|
|
17
|
+
align-items: stretch;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.${e.builderBlock.id}-breakpoints > .builder-column {
|
|
21
|
+
width: var(--column-width-mobile) !important;
|
|
22
|
+
margin-left: var(--column-margin-left-mobile) !important;
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
`}return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:`builder-columns ${e.builderBlock.id}-breakpoints div-7a098ce6`,style:x(),children:[i.jsx(i.Fragment,{children:i.jsx(a.InlinedStyles,{id:"builderio-columns",styles:v()})}),(f=e.columns)==null?void 0:f.map((t,n)=>i.jsx(w.DynamicRenderer,{TagName:t.link?e.builderLinkComponent||"a":"div",actionAttributes:{},attributes:{...t.link?{href:t.link}:{},[$.getClassPropName()]:"builder-column",style:a.mapStyleObjToStrIfNeeded(C(n))},children:i.jsx(a.Blocks,{path:`component.options.columns.${n}.blocks`,parent:e.builderBlock.id,styleProp:{flexGrow:"1"},context:e.builderContext,registeredComponents:e.builderComponents,linkComponent:e.builderLinkComponent,blocks:t.blocks})},n))]}),i.jsx("style",{children:`.div-7a098ce6 {
|
|
26
|
+
display: flex;
|
|
27
|
+
line-height: normal;
|
|
28
|
+
}`})]})}exports.default=j;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),r=require("react"),l=require("./server-entry-00891f33.cjs"),k=require("./blocks-exports.cjs"),w=require("./blocks-87a3568e.cjs");require("./get-class-prop-name-f1301669.cjs");require("./dynamic-renderer-1c9f24c0.cjs");const O={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},J={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(a=>{a.delete("width")})}const n=e.get("columns");Array.isArray(n)&&n.find(m=>m.get("width"))&&(n.find(h=>!h.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}]},Y={name:"Fragment",static:!0,hidden:!0,canHaveChildren:!0,noWrap:!0},G={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"],required:!0,defaultValue:"https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a",onChange:e=>{e.delete("srcset"),e.delete("noWebp");function n(i,o=6e4){return new Promise((g,I)=>{const x=document.createElement("img");let V=!1;x.onload=()=>{V=!0,g(x)},x.addEventListener("error",T=>{console.warn("Image load failed",T.error),I(T.error)}),x.src=i,setTimeout(()=>{V||I(new Error("Image load timed out"))},o)})}function a(i){return Math.round(i*1e3)/1e3}const m=e.get("image"),h=e.get("aspectRatio");if(fetch(m).then(i=>i.blob()).then(i=>{i.type.includes("svg")&&e.set("noWebp",!0)}),m&&(!h||h===.7041))return n(m).then(i=>{const o=e.get("aspectRatio");e.get("image")===m&&(!o||o===.7041)&&i.width&&i.height&&(e.set("aspectRatio",a(i.height/i.width)),e.set("height",i.height),e.set("width",i.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:"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}]},Q={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>"}}}]},X={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"}]},Z=r.lazy(()=>Promise.resolve().then(()=>require("./slot-bb84f342.cjs"))),ee={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"}]},te={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"}},ne={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}]},ae=r.lazy(()=>Promise.resolve().then(()=>require("./custom-code-6d9730ff.cjs"))),ie={name:"Embed",static:!0,inputs:[{name:"url",type:"url",required:!0,defaultValue:"",helperText:"e.g. enter a youtube url, google map, etc",onChange:e=>{const t=e.get("url");if(t)return e.set("content","Loading..."),fetch(`https://iframe.ly/api/iframely?url=${t}&api_key=ae0e60e78201a3f2b0de4b`).then(a=>a.json()).then(a=>{e.get("url")===t&&(a.html?e.set("content",a.html):e.set("content","Invalid url, please try another"))}).catch(a=>{e.set("content","There was an error embedding this URL, please try again or another URL")});e.delete("content")}},{name:"content",type:"html",defaultValue:'<div style="padding: 20px; text-align: center">(Choose an embed URL)<div>',hideFromUI:!0}]},oe=r.lazy(()=>Promise.resolve().then(()=>require("./embed-32bdd007.cjs"))),re={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"}}}]},se=r.lazy(()=>Promise.resolve().then(()=>require("./form-e83f7b7a.cjs"))),le={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"}},de=r.lazy(()=>Promise.resolve().then(()=>require("./input-2103da14.cjs"))),ce={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},ue=r.lazy(()=>Promise.resolve().then(()=>require("./select-b8ad0a4c.cjs"))),me={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},pe=r.lazy(()=>Promise.resolve().then(()=>require("./submit-button-b363e0ed.cjs"))),ge={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},fe=r.lazy(()=>Promise.resolve().then(()=>require("./img-0c1e53c0.cjs"))),he={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}]},be=()=>[{component:ae,...ne},{component:oe,...ie},{component:se,...re},{component:de,...le},{component:pe,...me},{component:ue,...ce},{component:fe,...ge},{component:k.Video,...he}],$=()=>[{component:k.Button,...O},{component:k.Columns,...J},{component:k.Fragment,...Y},{component:k.Image,...G},{component:k.Section,...Q},{component:Z,...X},{component:k.Symbol,...ee},{component:k.Text,...te},...be()],ye=`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
|
+
}`,xe=`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
|
+
}`,B="builderIoAbTest",_="builderIoRenderContent",P=e=>Object.values((e==null?void 0:e.variations)||{}).map(t=>({...t,testVariationId:t.id,id:e==null?void 0:e.id})),ve=({canTrack:e,content:t})=>!(!(P(t).length>0)||!e||l.isBrowser()),Se=e=>e==="react"||e==="reactNative",M=Se(l.TARGET),Ie=()=>`
|
|
92
|
+
window.${B} = ${ye}
|
|
93
|
+
window.${_} = ${xe}
|
|
94
|
+
`,ke=(e,t)=>`
|
|
95
|
+
window.${B}(
|
|
96
|
+
"${t}",${JSON.stringify(e)}, ${M}
|
|
97
|
+
)`,Te=({contentId:e,variationId:t})=>`window.${_}(
|
|
98
|
+
"${t}", "${e}", ${M}
|
|
99
|
+
)`;function W(e){return d.jsx("script",{dangerouslySetInnerHTML:{__html:e.scriptStr},"data-id":e.id})}function L(e){return Math.round(e*1e3)/1e3}const Ce=(e,t,n=!0)=>{if(!(e instanceof HTMLElement))return null;let a=n?e:e.parentElement;do{if(!a)return null;if(t(a))return a}while(a=a.parentElement);return null},we=e=>Ce(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(),a=e.clientX-n.left,m=e.clientY-n.top,h=L(a/n.width),i=L(m/n.height);return{x:h,y:i}},Ve=e=>{const t=e.target,n=t&&we(t),a=(n==null?void 0:n.getAttribute("builder-id"))||(n==null?void 0:n.id);return{targetBuilderElement:a||void 0,metadata:{targetOffset:t?N({event:e,target:t}):void 0,builderTargetOffset:n?N({event:e,target:n}):void 0,builderElementIndex:n&&a?[].slice.call(document.getElementsByClassName(a)).indexOf(n):void 0}}};function Ee(e){var C,A,j,q,U,D,H;const t=r.useRef(null);function n(s){var f,u;const p={...e.builderContextSignal.rootState,...s};e.builderContextSignal.rootSetState?(u=(f=e.builderContextSignal).rootSetState)==null||u.call(f,p):e.setBuilderContextSignal(c=>({...c,rootState:p}))}function a(s){var f,u,c,b,E;const p={...e.builderContextSignal.content,...s,data:{...(f=e.builderContextSignal.content)==null?void 0:f.data,...s==null?void 0:s.data},meta:{...(u=e.builderContextSignal.content)==null?void 0:u.meta,...s==null?void 0:s.meta,breakpoints:((c=s==null?void 0:s.meta)==null?void 0:c.breakpoints)||((E=(b=e.builderContextSignal.content)==null?void 0:b.meta)==null?void 0:E.breakpoints)}};e.setBuilderContextSignal(S=>({...S,content:p}))}const[m,h]=r.useState(()=>e.contentWrapper||"div");function i(s){return l.createEditorListener({model:e.model,trustedHosts:e.trustedHosts,callbacks:{configureSdk:p=>{var c;const{breakpoints:f,contentId:u}=p;!u||u!==((c=e.builderContextSignal.content)==null?void 0:c.id)||f&&a({meta:{breakpoints:f}})},animation:p=>{w.triggerAnimation(p)},contentUpdate:p=>{a(p)}}})(s)}function o(){var p,f;const s=(f=(p=e.builderContextSignal.content)==null?void 0:p.data)==null?void 0:f.jsCode;s&&w.evaluate({code:s,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState,enableCache:!1})}const[g,I]=r.useState(()=>({})),[x,V]=r.useState(()=>({})),[T,R]=r.useState(()=>!1);function F(s){var p,f;if(e.builderContextSignal.content){const u=(p=e.builderContextSignal.content)==null?void 0:p.testVariationId,c=(f=e.builderContextSignal.content)==null?void 0:f.id;l._track({type:"click",canTrack:l.getDefaultCanTrack(e.canTrack),contentId:c,apiKey:e.apiKey,variationId:u!==c?u:void 0,...Ve(s),unique:!T})}T||R(!0)}function v(){var p,f,u;const s=(u=(f=(p=e.builderContextSignal.content)==null?void 0:p.data)==null?void 0:f.httpRequests)!=null?u:{};Object.entries(s).forEach(([c,b])=>{if(!b||x[c]||g[c]&&!l.isEditing())return;x[c]=!0;const E=b.replace(/{{([^}]+)}}/g,(S,z)=>String(w.evaluate({code:z,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState,enableCache:!0})));l.fetch(E).then(S=>S.json()).then(S=>{n({[c]:S}),g[c]=!0}).catch(S=>{console.error("error fetching dynamic data",b,S)}).finally(()=>{x[c]=!1})})}function y(){l.isEditing()&&window.dispatchEvent(new CustomEvent("builder:component:stateChange",{detail:{state:l.fastClone(e.builderContextSignal.rootState),ref:{name:e.model}}}))}return r.useEffect(()=>{var s,p;if(l.isBrowser()){if(l.isEditing()&&(window.addEventListener("message",i),l.registerInsertMenu(),l.setupBrowserForEditing({...e.locale?{locale:e.locale}:{},...e.enrich?{enrich:e.enrich}:{},...e.trustedHosts?{trustedHosts:e.trustedHosts}:{}}),Object.values(e.builderContextSignal.componentInfos).forEach(u=>{var b;const c=l.createRegisterComponentMessage(u);(b=window.parent)==null||b.postMessage(c,"*")}),window.addEventListener("builder:component:stateChangeListenerActivated",y)),e.builderContextSignal.content&&l.getDefaultCanTrack(e.canTrack)){const u=(s=e.builderContextSignal.content)==null?void 0:s.testVariationId,c=(p=e.builderContextSignal.content)==null?void 0:p.id,b=e.apiKey;l._track({type:"impression",canTrack:!0,contentId:c,apiKey:b,variationId:u!==c?u:void 0})}if(l.isPreviewing()){const u=new URL(location.href).searchParams,c=u.get("builder.preview"),b=u.get(`builder.preview.${c}`),E=u.get("apiKey")||u.get("builder.space");c===e.model&&E===e.apiKey&&(!e.content||b===e.content.id)&&l.fetchOneEntry({model:e.model,apiKey:e.apiKey,apiVersion:e.builderContextSignal.apiVersion}).then(S=>{S&&a(S)})}}},[]),r.useEffect(()=>{e.apiKey||l.logger.error("No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."),o(),v(),y()},[]),r.useEffect(()=>{e.content&&a(e.content)},[e.content]),r.useEffect(()=>{o()},[(A=(C=e.builderContextSignal.content)==null?void 0:C.data)==null?void 0:A.jsCode]),r.useEffect(()=>{v()},[(q=(j=e.builderContextSignal.content)==null?void 0:j.data)==null?void 0:q.httpRequests]),r.useEffect(()=>{y()},[e.builderContextSignal.rootState]),r.useEffect(()=>{e.data&&n(e.data)},[e.data]),r.useEffect(()=>{e.locale&&n({locale:e.locale})},[e.locale]),r.useEffect(()=>()=>{l.isBrowser()&&(window.removeEventListener("message",i),window.removeEventListener("builder:component:stateChangeListenerActivated",y))},[]),d.jsx(k.BuilderContext.Provider,{value:e.builderContextSignal,children:e.builderContextSignal.content?d.jsx(d.Fragment,{children:d.jsx(m,{ref:t,onClick:s=>F(s),"builder-content-id":(U=e.builderContextSignal.content)==null?void 0:U.id,"builder-model":e.model,...e.showContent?{}:{hidden:!0,"aria-hidden":!0},...e.contentWrapperProps,className:`variant-${((D=e.content)==null?void 0:D.testVariationId)||((H=e.content)==null?void 0:H.id)}`,children:e.children})}):null})}const Re=e=>{var h,i;const t=e.family+(e.kind&&!e.kind.includes("#")?", "+e.kind:""),n=t.split(",")[0],a=(i=e.fileUrl)!=null?i:(h=e==null?void 0:e.files)==null?void 0:h.regular;let m="";if(a&&t&&n&&(m+=`
|
|
100
|
+
@font-face {
|
|
101
|
+
font-family: "${t}";
|
|
102
|
+
src: local("${n}"), url('${a}') 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 I=e.files[o];I&&I!==a&&(m+=`
|
|
107
|
+
@font-face {
|
|
108
|
+
font-family: "${t}";
|
|
109
|
+
src: url('${I}') format('woff2');
|
|
110
|
+
font-display: fallback;
|
|
111
|
+
font-weight: ${o};
|
|
112
|
+
}
|
|
113
|
+
`.trim())}return m},Fe=({customFonts:e})=>{var t;return((t=e==null?void 0:e.map(n=>Re(n)))==null?void 0:t.join(" "))||""},Pe=({cssCode:e,contentId:t})=>e?t?(e==null?void 0:e.replace(/&/g,`div[builder-content-id="${t}"]`))||"":e:"",We=`
|
|
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
|
+
`,Ae=e=>e?"":We;function je(e){const[t,n]=r.useState(()=>`
|
|
131
|
+
${Pe({cssCode:e.cssCode,contentId:e.contentId})}
|
|
132
|
+
${Fe({customFonts:e.customFonts})}
|
|
133
|
+
${Ae(e.isNestedRender)}
|
|
134
|
+
`.trim());return d.jsx(w.InlinedStyles,{id:"builderio-content",styles:t})}const qe=({content:e,data:t,locale:n})=>{var h,i,o;const a={},m=((h=e==null?void 0:e.data)==null?void 0:h.state)||{};return(o=(i=e==null?void 0:e.data)==null?void 0:i.inputs)==null||o.forEach(g=>{g.name&&g.defaultValue!==void 0&&(a[g.name]=g.defaultValue)}),{...a,...m,...t,...n?{locale:n}:{}}},Ue=({content:e,data:t})=>e?{...e,data:{...e==null?void 0:e.data,...t},meta:e==null?void 0:e.meta}:void 0;function K(e){var g,I,x,V,T,R,F;const[t,n]=r.useState(()=>{var v,y;return Te({variationId:(v=e.content)==null?void 0:v.testVariationId,contentId:(y=e.content)==null?void 0:y.id})});function a(v){o(y=>({...y,rootState:v}))}const[m,h]=r.useState(()=>[...$(),...e.customComponents||[]].reduce((v,{component:y,...C})=>({...v,[C.name]:{component:y,...l.serializeComponentInfo(C)}}),{})),[i,o]=r.useState(()=>({content:Ue({content:e.content,data:e.data}),localState:void 0,rootState:qe({content:e.content,data:e.data,locale:e.locale}),rootSetState:a,context:e.context||{},apiKey:e.apiKey,apiVersion:e.apiVersion,componentInfos:[...$(),...e.customComponents||[]].reduce((v,{component:y,...C})=>({...v,[C.name]:l.serializeComponentInfo(C)}),{}),inheritedStyles:{},BlocksWrapper:e.blocksWrapper||"div",BlocksWrapperProps:e.blocksWrapperProps||{}}));return d.jsx(w.ComponentsContext.Provider,{value:{registeredComponents:m},children:d.jsxs(Ee,{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:i,contentWrapper:e.contentWrapper,contentWrapperProps:e.contentWrapperProps,linkComponent:e.linkComponent,trustedHosts:e.trustedHosts,setBuilderContextSignal:o,children:[e.isSsrAbTest?d.jsx(d.Fragment,{children:d.jsx(W,{id:"builderio-variant-visibility",scriptStr:t})}):null,d.jsx(d.Fragment,{children:d.jsx(je,{isNestedRender:e.isNestedRender,contentId:(g=i.content)==null?void 0:g.id,cssCode:(x=(I=i.content)==null?void 0:I.data)==null?void 0:x.cssCode,customFonts:(T=(V=i.content)==null?void 0:V.data)==null?void 0:T.customFonts})}),d.jsx(w.Blocks,{blocks:(F=(R=i.content)==null?void 0:R.data)==null?void 0:F.blocks,context:i,registeredComponents:m,linkComponent:e.linkComponent})]})})}function De(e){var i;const[t,n]=r.useState(()=>ve({canTrack:l.getDefaultCanTrack(e.canTrack),content:e.content}));function a(){var o;return ke(P(e.content).map(g=>({id:g.testVariationId,testRatio:g.testRatio})),((o=e.content)==null?void 0:o.id)||"")}function m(){return P(e.content).map(o=>`.variant-${o.testVariationId} { display: none; } `).join("")}function h(){var o;return t?{...e.content,testVariationId:(o=e.content)==null?void 0:o.id}:l.handleABTestingSync({item:e.content,canTrack:l.getDefaultCanTrack(e.canTrack)})}return r.useEffect(()=>{},[]),d.jsxs(d.Fragment,{children:[!e.isNestedRender&&l.TARGET!=="reactNative"?d.jsx(d.Fragment,{children:d.jsx(W,{id:"builderio-init-variants-fns",scriptStr:Ie()})}):null,t?d.jsxs(d.Fragment,{children:[d.jsx(w.InlinedStyles,{id:"builderio-variants",styles:m()}),d.jsx(W,{id:"builderio-variants-visibility",scriptStr:a()}),(i=P(e.content))==null?void 0:i.map(o=>d.jsx(K,{isNestedRender:e.isNestedRender,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,d.jsx(K,{isNestedRender:e.isNestedRender,content:h(),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=De;
|