@builder.io/sdk-react 4.2.0 → 4.2.2
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 +17 -17
- package/lib/browser/blocks-exports.mjs +759 -740
- package/lib/browser/index.cjs +1 -1
- package/lib/browser/index.mjs +6 -5
- package/lib/browser/server-entry-06504dba.cjs +2 -0
- package/lib/browser/{server-entry-065ec411.js → server-entry-074665de.js} +24 -13
- package/lib/browser/server-entry.cjs +1 -1
- package/lib/browser/server-entry.mjs +7 -6
- package/lib/edge/{accordion-c239771d.cjs → accordion-0768e15a.cjs} +1 -1
- package/lib/edge/{accordion-79f6d62c.js → accordion-d3831f48.js} +1 -1
- package/lib/edge/{blocks-3cb3a9cd.js → blocks-0269007e.js} +105 -106
- package/lib/edge/{blocks-56f79850.cjs → blocks-2af1d7c9.cjs} +10 -10
- package/lib/edge/blocks-exports.cjs +1 -1
- package/lib/edge/blocks-exports.mjs +2 -2
- package/lib/edge/{button-759b43fb.cjs → button-050f4fef.cjs} +1 -1
- package/lib/edge/{button-6dee05c9.js → button-a478ff1a.js} +2 -2
- package/lib/edge/{columns-2743498a.js → columns-0b3181f1.js} +3 -3
- package/lib/edge/{columns-a29ec0ac.cjs → columns-25375990.cjs} +1 -1
- package/lib/edge/{content-variants-4d5a1e3c.js → content-variants-0dd65b50.js} +426 -415
- package/lib/edge/content-variants-4cab7215.cjs +302 -0
- package/lib/edge/{custom-code-6129bd8c.cjs → custom-code-eb5aedd2.cjs} +1 -1
- package/lib/edge/{custom-code-8034fac0.js → custom-code-f7a0f1c1.js} +1 -1
- package/lib/edge/{embed-b2ea5150.cjs → embed-69114c35.cjs} +1 -1
- package/lib/edge/{embed-f5b10eeb.js → embed-e4979560.js} +1 -1
- package/lib/edge/{form-14942d4f.js → form-30fba682.js} +27 -22
- package/lib/edge/form-7b4bd399.cjs +1 -0
- package/lib/edge/{get-class-prop-name-f6a63f4a.js → get-class-prop-name-770bdff2.js} +1 -1
- package/lib/edge/{get-class-prop-name-7e739c9f.cjs → get-class-prop-name-f470d5ce.cjs} +1 -1
- package/lib/edge/{img-ba2ef9ee.js → img-3bb375bf.js} +1 -1
- package/lib/edge/{img-f33a2e42.cjs → img-ddf74e12.cjs} +1 -1
- package/lib/edge/index.cjs +1 -1
- package/lib/edge/index.mjs +4 -3
- package/lib/edge/{input-c2f95825.cjs → input-a6caf021.cjs} +1 -1
- package/lib/edge/{input-7089e95f.js → input-e4a9fe0b.js} +1 -1
- package/lib/edge/{personalization-container-eb1ecef2.js → personalization-container-64f3cd71.js} +4 -4
- package/lib/edge/{personalization-container-794b3939.cjs → personalization-container-f7030f08.cjs} +1 -1
- package/lib/edge/{select-af0bb9fe.cjs → select-c217566c.cjs} +1 -1
- package/lib/edge/{select-8f01592a.js → select-c59c9ac6.js} +1 -1
- package/lib/edge/server-entry-67200cf1.cjs +2 -0
- package/lib/edge/{server-entry-7c65c9a8.js → server-entry-fb5f2b80.js} +22 -11
- package/lib/edge/server-entry.cjs +1 -1
- package/lib/edge/server-entry.mjs +7 -6
- package/lib/edge/{slot-2638fd6d.js → slot-26ec2911.js} +3 -3
- package/lib/edge/{slot-db37860e.cjs → slot-ccd946e2.cjs} +1 -1
- package/lib/edge/{symbol-7faca118.js → symbol-10cb2f77.js} +26 -23
- package/lib/edge/symbol-4548e942.cjs +1 -0
- package/lib/edge/tabs-82a9170c.cjs +1 -0
- package/lib/edge/{tabs-2eee6422.js → tabs-f9110171.js} +24 -23
- package/lib/node/blocks-exports.cjs +20 -20
- package/lib/node/blocks-exports.mjs +919 -900
- package/lib/node/index.cjs +1 -1
- package/lib/node/index.mjs +6 -5
- package/lib/node/init.cjs +1 -1
- package/lib/node/init.mjs +3 -3
- package/lib/node/{server-entry-581dd491.js → server-entry-83d3751d.js} +24 -13
- package/lib/node/server-entry-d40e4b66.cjs +2 -0
- package/lib/node/server-entry.cjs +1 -1
- package/lib/node/server-entry.mjs +7 -6
- package/lib/node/{setIvm-2eb44b9d.cjs → setIvm-0a5b2ba2.cjs} +1 -1
- package/lib/node/{setIvm-8d02dc72.js → setIvm-596668c3.js} +1 -1
- package/lib/node/setIvm.cjs +1 -1
- package/lib/node/setIvm.mjs +2 -2
- package/lib/node/{should-force-browser-runtime-in-node-f461467e.js → should-force-browser-runtime-in-node-180c3315.js} +1 -1
- package/lib/node/{should-force-browser-runtime-in-node-ed3fa1f9.cjs → should-force-browser-runtime-in-node-5b9e373d.cjs} +1 -1
- package/package.json +1 -1
- package/types/blocks/symbol/symbol.types.d.ts +1 -2
- package/types/components/awaiter.d.ts +1 -11
- package/types/components/awaiter.types.d.ts +7 -0
- package/types/constants/sdk-version.d.ts +1 -1
- package/types/functions/register.d.ts +18 -0
- package/types/server-index.d.ts +1 -1
- package/lib/browser/server-entry-09953757.cjs +0 -2
- package/lib/edge/content-variants-bdf1748b.cjs +0 -302
- package/lib/edge/form-26c3a03e.cjs +0 -1
- package/lib/edge/server-entry-142a50e9.cjs +0 -2
- package/lib/edge/symbol-630b9a57.cjs +0 -1
- package/lib/edge/tabs-502123df.cjs +0 -1
- package/lib/node/server-entry-375d06e8.cjs +0 -2
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
"use strict";const h=require("react/jsx-runtime"),s=require("react"),o=require("./server-entry-67200cf1.cjs"),F=require("./blocks-exports.cjs"),W=require("./blocks-2af1d7c9.cjs");function de(e,t,n,r){function l(f){return typeof f=="string"}function u(f){return typeof f=="number"}function i(f,y){return(()=>{const k=y.property,A=y.operator;let d=y.value;if(y&&y.property==="urlPath"&&y.value&&typeof y.value=="string"&&y.value!=="/"&&y.value.endsWith("/")&&(d=y.value.slice(0,-1)),!(k&&A))return!0;if(Array.isArray(d))return A==="isNot"?d.every(P=>i(f,{property:k,operator:A,value:P})):!!d.find(P=>i(f,{property:k,operator:A,value:P}));const m=f[k];if(Array.isArray(m))return m.includes(d);switch(A){case"is":return m===d;case"isNot":return m!==d;case"contains":return(l(m)||Array.isArray(m))&&m.includes(String(d));case"startsWith":return l(m)&&m.startsWith(String(d));case"endsWith":return l(m)&&m.endsWith(String(d));case"greaterThan":return u(m)&&u(d)&&m>d;case"lessThan":return u(m)&&u(d)&&m<d;case"greaterThanOrEqualTo":return u(m)&&u(d)&&m>=d;case"lessThanOrEqualTo":return u(m)&&u(d)&&m<=d;default:return!1}})()}const a={query:t,startDate:n,endDate:r},c=e.date&&new Date(e.date)||new Date;return a.startDate&&new Date(a.startDate)>c||a.endDate&&new Date(a.endDate)<c?!1:!a.query||!a.query.length?!0:a.query.every(f=>i(e,f))}const ce=`function getPersonalizedVariant(variants, blockId, isHydrationTarget, locale) {
|
|
2
|
+
if (!navigator.cookieEnabled) {
|
|
3
|
+
return;
|
|
4
|
+
}
|
|
5
|
+
function getCookie(name) {
|
|
6
|
+
const nameEQ = name + '=';
|
|
7
|
+
const ca = document.cookie.split(';');
|
|
8
|
+
for (let i = 0; i < ca.length; i++) {
|
|
9
|
+
let c = ca[i];
|
|
10
|
+
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
|
|
11
|
+
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
|
|
12
|
+
}
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
const attributes = JSON.parse(getCookie('builder.userAttributes') || '{}');
|
|
16
|
+
if (locale) {
|
|
17
|
+
attributes.locale = locale;
|
|
18
|
+
}
|
|
19
|
+
const winningVariantIndex = variants?.findIndex(function (variant) {
|
|
20
|
+
return window.filterWithCustomTargeting(attributes, variant.query, variant.startDate, variant.endDate);
|
|
21
|
+
});
|
|
22
|
+
const parentDiv = document.currentScript?.parentElement;
|
|
23
|
+
const variantId = parentDiv?.getAttribute('data-variant-id');
|
|
24
|
+
const isDefaultVariant = variantId === \`\${blockId}-default\`;
|
|
25
|
+
const isWinningVariant = winningVariantIndex !== -1 && variantId === \`\${blockId}-\${winningVariantIndex}\` || winningVariantIndex === -1 && isDefaultVariant;
|
|
26
|
+
if (isWinningVariant && !isDefaultVariant) {
|
|
27
|
+
parentDiv?.removeAttribute('hidden');
|
|
28
|
+
parentDiv?.removeAttribute('aria-hidden');
|
|
29
|
+
} else if (!isWinningVariant && isDefaultVariant) {
|
|
30
|
+
parentDiv?.setAttribute('hidden', 'true');
|
|
31
|
+
parentDiv?.setAttribute('aria-hidden', 'true');
|
|
32
|
+
}
|
|
33
|
+
if (isHydrationTarget) {
|
|
34
|
+
if (!isWinningVariant) {
|
|
35
|
+
const itsStyleEl = parentDiv?.previousElementSibling;
|
|
36
|
+
if (itsStyleEl) {
|
|
37
|
+
itsStyleEl.remove();
|
|
38
|
+
}
|
|
39
|
+
parentDiv?.remove();
|
|
40
|
+
}
|
|
41
|
+
const thisScript = document.currentScript;
|
|
42
|
+
if (thisScript) {
|
|
43
|
+
thisScript.remove();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}`,me=`function filterWithCustomTargeting(userAttributes, query, startDate, endDate) {
|
|
47
|
+
function isString(val) {
|
|
48
|
+
return typeof val === 'string';
|
|
49
|
+
}
|
|
50
|
+
function isNumber(val) {
|
|
51
|
+
return typeof val === 'number';
|
|
52
|
+
}
|
|
53
|
+
function objectMatchesQuery(userattr, query) {
|
|
54
|
+
const result = (() => {
|
|
55
|
+
const property = query.property;
|
|
56
|
+
const operator = query.operator;
|
|
57
|
+
let testValue = query.value;
|
|
58
|
+
if (query && query.property === 'urlPath' && query.value && typeof query.value === 'string' && query.value !== '/' && query.value.endsWith('/')) {
|
|
59
|
+
testValue = query.value.slice(0, -1);
|
|
60
|
+
}
|
|
61
|
+
if (!(property && operator)) {
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
if (Array.isArray(testValue)) {
|
|
65
|
+
if (operator === 'isNot') {
|
|
66
|
+
return testValue.every(val => objectMatchesQuery(userattr, {
|
|
67
|
+
property,
|
|
68
|
+
operator,
|
|
69
|
+
value: val
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
return !!testValue.find(val => objectMatchesQuery(userattr, {
|
|
73
|
+
property,
|
|
74
|
+
operator,
|
|
75
|
+
value: val
|
|
76
|
+
}));
|
|
77
|
+
}
|
|
78
|
+
const value = userattr[property];
|
|
79
|
+
if (Array.isArray(value)) {
|
|
80
|
+
return value.includes(testValue);
|
|
81
|
+
}
|
|
82
|
+
switch (operator) {
|
|
83
|
+
case 'is':
|
|
84
|
+
return value === testValue;
|
|
85
|
+
case 'isNot':
|
|
86
|
+
return value !== testValue;
|
|
87
|
+
case 'contains':
|
|
88
|
+
return (isString(value) || Array.isArray(value)) && value.includes(String(testValue));
|
|
89
|
+
case 'startsWith':
|
|
90
|
+
return isString(value) && value.startsWith(String(testValue));
|
|
91
|
+
case 'endsWith':
|
|
92
|
+
return isString(value) && value.endsWith(String(testValue));
|
|
93
|
+
case 'greaterThan':
|
|
94
|
+
return isNumber(value) && isNumber(testValue) && value > testValue;
|
|
95
|
+
case 'lessThan':
|
|
96
|
+
return isNumber(value) && isNumber(testValue) && value < testValue;
|
|
97
|
+
case 'greaterThanOrEqualTo':
|
|
98
|
+
return isNumber(value) && isNumber(testValue) && value >= testValue;
|
|
99
|
+
case 'lessThanOrEqualTo':
|
|
100
|
+
return isNumber(value) && isNumber(testValue) && value <= testValue;
|
|
101
|
+
default:
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
})();
|
|
105
|
+
return result;
|
|
106
|
+
}
|
|
107
|
+
const item = {
|
|
108
|
+
query,
|
|
109
|
+
startDate,
|
|
110
|
+
endDate
|
|
111
|
+
};
|
|
112
|
+
const now = userAttributes.date && new Date(userAttributes.date) || new Date();
|
|
113
|
+
if (item.startDate && new Date(item.startDate) > now) {
|
|
114
|
+
return false;
|
|
115
|
+
} else if (item.endDate && new Date(item.endDate) < now) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
if (!item.query || !item.query.length) {
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
return item.query.every(filter => {
|
|
122
|
+
return objectMatchesQuery(userAttributes, filter);
|
|
123
|
+
});
|
|
124
|
+
}`,pe=`function updateVisibilityStylesScript(variants, blockId, isHydrationTarget, locale) {
|
|
125
|
+
function getCookie(name) {
|
|
126
|
+
const nameEQ = name + '=';
|
|
127
|
+
const ca = document.cookie.split(';');
|
|
128
|
+
for (let i = 0; i < ca.length; i++) {
|
|
129
|
+
let c = ca[i];
|
|
130
|
+
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
|
|
131
|
+
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
|
|
132
|
+
}
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
const visibilityStylesEl = document.currentScript?.previousElementSibling;
|
|
136
|
+
if (!visibilityStylesEl) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
if (isHydrationTarget) {
|
|
140
|
+
visibilityStylesEl.remove();
|
|
141
|
+
const currentScript = document.currentScript;
|
|
142
|
+
if (currentScript) {
|
|
143
|
+
currentScript.remove();
|
|
144
|
+
}
|
|
145
|
+
} else {
|
|
146
|
+
const attributes = JSON.parse(getCookie('builder.userAttributes') || '{}');
|
|
147
|
+
if (locale) {
|
|
148
|
+
attributes.locale = locale;
|
|
149
|
+
}
|
|
150
|
+
const winningVariantIndex = variants?.findIndex(function (variant) {
|
|
151
|
+
return window.filterWithCustomTargeting(attributes, variant.query, variant.startDate, variant.endDate);
|
|
152
|
+
});
|
|
153
|
+
if (winningVariantIndex !== -1) {
|
|
154
|
+
let newStyleStr = variants?.map((_, index) => {
|
|
155
|
+
if (index === winningVariantIndex) return '';
|
|
156
|
+
return \`div[data-variant-id="\${blockId}-\${index}"] { display: none !important; } \`;
|
|
157
|
+
}).join('') || '';
|
|
158
|
+
newStyleStr += \`div[data-variant-id="\${blockId}-default"] { display: none !important; } \`;
|
|
159
|
+
visibilityStylesEl.innerHTML = newStyleStr;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}`,te="default",fe="filterWithCustomTargeting",ne="builderIoPersonalization",ie="updateVisibilityStylesScript",ae=["react","vue","svelte","qwik"],oe=["vue","svelte","qwik"];function ge(e,t){return!(e&&e.length>0)||!t?!1:oe.includes(o.TARGET)?!0:!o.isBrowser()}function he({variants:e,previewingIndex:t,isHydrated:n,filteredVariants:r,fallbackBlocks:l}){var i;const u={blocks:l!=null?l:[],path:"this.children",index:te};if(n&&o.isEditing()){if(typeof t=="number"&&t<((i=e==null?void 0:e.length)!=null?i:0)){const a=e==null?void 0:e[t];if(a)return{blocks:a.blocks,path:`variants.${t}.blocks`,index:t}}return u}if(o.isBrowser()){const a=r==null?void 0:r[0];if(a&&e){const c=e.indexOf(a);if(c!==-1)return{blocks:a.blocks,path:`variants.${c}.blocks`,index:c}}}return u}const be=()=>`
|
|
163
|
+
window.${fe} = ${me}
|
|
164
|
+
window.${ne} = ${ce}
|
|
165
|
+
window.${ie} = ${pe}
|
|
166
|
+
`,re=o.TARGET==="react",ye=(e,t,n)=>`window.${ne}(${JSON.stringify(e)}, "${t}", ${re}${n?`, "${n}"`:""})`,ve=(e,t,n)=>`window.${ie}(${JSON.stringify(e)}, "${t}", ${re}${n?`, "${n}"`:""})`,U={"@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!"}}}]},H={"@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!"}}}]},xe={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:[U]},{name:"detail",type:"uiBlocks",hideFromUI:!0,defaultValue:[H]}],defaultValue:[{title:[U],detail:[H]},{title:[U],detail:[H]}],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}},Se=s.lazy(()=>Promise.resolve().then(()=>require("./accordion-0768e15a.cjs"))),Te={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}},Ie={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(r=>{r.delete("width")})}const n=e.get("columns");Array.isArray(n)&&n.find(l=>l.get("width"))&&(n.find(u=>!u.get("width"))||n.reduce((a,c)=>a+c.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}},ke={name:"Fragment",static:!0,hidden:!0,canHaveChildren:!0,noWrap:!0},z=["jpeg","jpg","png","svg","webp","gif","jfif","pjpeg","pjp","apng","avif","tif","tiff","heif","bmp","eps","raw","cr2","nef","orf","sr2","psd","heic","dib","ai"],Ce=["mp4","webm","mkv","flv","vob","ogv","ogg","drc","gif","gifv","mng","avi","mov","qt","mts","m2ts","ts","wmv","yuv","rm","rmvb","viv","asf","amv","m4p","mpeg","mpe","m2v","m4v","svi","3gp","3g2","mxf","roq","nsv","f4v","f4p","f4a","f4b"],we={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:z,required:!0,defaultValue:"https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a",onChange:e=>{e.delete("srcset"),e.delete("noWebp");function n(i,a=6e4){return new Promise((c,f)=>{const y=document.createElement("img");let R=!1;y.onload=()=>{R=!0,c(y)},y.addEventListener("error",k=>{console.warn("Image load failed",k.error),f(k.error)}),y.src=i,setTimeout(()=>{R||f(new Error("Image load timed out"))},a)})}function r(i){return Math.round(i*1e3)/1e3}const l=e.get("image"),u=e.get("aspectRatio");if(fetch(l).then(i=>i.blob()).then(i=>{i.type.includes("svg")&&e.set("noWebp",!0)}),l&&(!u||u===.7041))return n(l).then(i=>{const a=e.get("aspectRatio");e.get("image")===l&&(!a||a===.7041)&&i.width&&i.height&&(e.set("aspectRatio",r(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:"title",type:"string",helperText:"Text to display when hovering over the asset"},{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}},Ee={name:"PersonalizationContainer",shouldReceiveBuilderProps:{builderBlock:!0,builderContext:!0,builderComponents:!0},noWrap:!0,image:"https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F37229ed30d8c41dfb10b8cca1992053a",canHaveChildren:!0,inputs:[{name:"variants",defaultValue:[],behavior:"personalizationVariantList",type:"list",subFields:[{name:"name",type:"text"},{name:"query",friendlyName:"Targeting rules",type:"BuilderQuery",defaultValue:[]},{name:"startDate",type:"date"},{name:"endDate",type:"date"},{name:"blocks",type:"uiBlocks",hideFromUI:!0,defaultValue:[]}]}]},Ve=s.lazy(()=>Promise.resolve().then(()=>require("./personalization-container-f7030f08.cjs"))),Re={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>"}}}]},Ae={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}},Pe=s.lazy(()=>Promise.resolve().then(()=>require("./slot-ccd946e2.cjs"))),De={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"}}},O={"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{height:"200px",display:"flex",marginTop:"20px",flexDirection:"column"}},component:{name:"Text",options:{text:"New tab content "}}},Fe={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:[O]}],defaultValue:[{label:[{...j,component:{name:"Text",options:{text:"Tab 1"}}}],content:[{...O,component:{name:"Text",options:{text:"Tab 1 content"}}}]},{label:[{...j,component:{name:"Text",options:{text:"Tab 2"}}}],content:[{...O,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}},We=s.lazy(()=>Promise.resolve().then(()=>require("./tabs-82a9170c.cjs"))),Ne={shouldReceiveBuilderProps:{},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"}},qe={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}]},_e=s.lazy(()=>Promise.resolve().then(()=>require("./custom-code-eb5aedd2.cjs"))),$e={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}]},Be=s.lazy(()=>Promise.resolve().then(()=>require("./embed-69114c35.cjs"))),Le={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}},Ue=s.lazy(()=>Promise.resolve().then(()=>require("./form-7b4bd399.cjs"))),He={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"}},je=s.lazy(()=>Promise.resolve().then(()=>require("./input-a6caf021.cjs"))),Oe={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},ze=s.lazy(()=>Promise.resolve().then(()=>require("./select-c217566c.cjs"))),Ke={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},Me=s.lazy(()=>Promise.resolve().then(()=>require("./submit-button-b363e0ed.cjs"))),Ge={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},Je=s.lazy(()=>Promise.resolve().then(()=>require("./textarea-56a875bc.cjs"))),Qe={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:z,required:!0}],noWrap:!0,static:!0},Ye=s.lazy(()=>Promise.resolve().then(()=>require("./img-ddf74e12.cjs"))),Xe={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:Ce,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:z,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}},Ze=()=>[{component:_e,...qe},{component:Be,...$e},{component:Ue,...Le},{component:je,...He},{component:Me,...Ke},{component:ze,...Oe},{component:Je,...Ge},{component:Ye,...Qe},{component:F.Video,...Xe}],Q=()=>[{component:F.Button,...Te},{component:F.Columns,...Ie},{component:F.Fragment,...ke},{component:F.Image,...we},{component:F.Section,...Re},{component:Pe,...Ae},{component:F.Symbol,...De},{component:F.Text,...Ne},...ae.includes(o.TARGET)?[{component:Ve,...Ee}]:[],{component:We,...Fe},{component:Se,...xe},...Ze()],et=`function updateCookiesAndStyles(contentId, variants, isHydrationTarget, isAngularSDK) {
|
|
167
|
+
function getAndSetVariantId() {
|
|
168
|
+
function setCookie(name, value, days) {
|
|
169
|
+
let expires = '';
|
|
170
|
+
if (days) {
|
|
171
|
+
const date = new Date();
|
|
172
|
+
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
|
|
173
|
+
expires = '; expires=' + date.toUTCString();
|
|
174
|
+
}
|
|
175
|
+
document.cookie = name + '=' + (value || '') + expires + '; path=/' + '; Secure; SameSite=None';
|
|
176
|
+
}
|
|
177
|
+
function getCookie(name) {
|
|
178
|
+
const nameEQ = name + '=';
|
|
179
|
+
const ca = document.cookie.split(';');
|
|
180
|
+
for (let i = 0; i < ca.length; i++) {
|
|
181
|
+
let c = ca[i];
|
|
182
|
+
while (c.charAt(0) === ' ') c = c.substring(1, c.length);
|
|
183
|
+
if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);
|
|
184
|
+
}
|
|
185
|
+
return null;
|
|
186
|
+
}
|
|
187
|
+
const cookieName = \`builder.tests.\${contentId}\`;
|
|
188
|
+
const variantInCookie = getCookie(cookieName);
|
|
189
|
+
const availableIDs = variants.map(vr => vr.id).concat(contentId);
|
|
190
|
+
if (variantInCookie && availableIDs.includes(variantInCookie)) {
|
|
191
|
+
return variantInCookie;
|
|
192
|
+
}
|
|
193
|
+
let n = 0;
|
|
194
|
+
const random = Math.random();
|
|
195
|
+
for (let i = 0; i < variants.length; i++) {
|
|
196
|
+
const variant = variants[i];
|
|
197
|
+
const testRatio = variant.testRatio;
|
|
198
|
+
n += testRatio;
|
|
199
|
+
if (random < n) {
|
|
200
|
+
setCookie(cookieName, variant.id);
|
|
201
|
+
return variant.id;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
setCookie(cookieName, contentId);
|
|
205
|
+
return contentId;
|
|
206
|
+
}
|
|
207
|
+
const winningVariantId = getAndSetVariantId();
|
|
208
|
+
let styleEl = document.currentScript?.previousElementSibling;
|
|
209
|
+
if (isAngularSDK) {
|
|
210
|
+
styleEl = document.currentScript?.parentElement?.previousElementSibling?.querySelector('style');
|
|
211
|
+
}
|
|
212
|
+
if (isHydrationTarget) {
|
|
213
|
+
styleEl.remove();
|
|
214
|
+
const thisScriptEl = document.currentScript;
|
|
215
|
+
thisScriptEl?.remove();
|
|
216
|
+
} else {
|
|
217
|
+
const newStyleStr = variants.concat({
|
|
218
|
+
id: contentId
|
|
219
|
+
}).filter(variant => variant.id !== winningVariantId).map(value => {
|
|
220
|
+
return \`.variant-\${value.id} { display: none; }
|
|
221
|
+
\`;
|
|
222
|
+
}).join('');
|
|
223
|
+
styleEl.innerHTML = newStyleStr;
|
|
224
|
+
}
|
|
225
|
+
}`,tt=`function updateVariantVisibility(variantContentId, defaultContentId, isHydrationTarget) {
|
|
226
|
+
if (!navigator.cookieEnabled) {
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
function getCookie(name) {
|
|
230
|
+
const nameEQ = name + '=';
|
|
231
|
+
const ca = document.cookie.split(';');
|
|
232
|
+
for (let i = 0; i < ca.length; i++) {
|
|
233
|
+
let c = ca[i];
|
|
234
|
+
while (c.charAt(0) === ' ') c = c.substring(1, c.length);
|
|
235
|
+
if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);
|
|
236
|
+
}
|
|
237
|
+
return null;
|
|
238
|
+
}
|
|
239
|
+
const cookieName = \`builder.tests.\${defaultContentId}\`;
|
|
240
|
+
const winningVariant = getCookie(cookieName);
|
|
241
|
+
const parentDiv = document.currentScript?.parentElement;
|
|
242
|
+
const isDefaultContent = variantContentId === defaultContentId;
|
|
243
|
+
const isWinningVariant = winningVariant === variantContentId;
|
|
244
|
+
if (isWinningVariant && !isDefaultContent) {
|
|
245
|
+
parentDiv?.removeAttribute('hidden');
|
|
246
|
+
parentDiv?.removeAttribute('aria-hidden');
|
|
247
|
+
} else if (!isWinningVariant && isDefaultContent) {
|
|
248
|
+
parentDiv?.setAttribute('hidden', 'true');
|
|
249
|
+
parentDiv?.setAttribute('aria-hidden', 'true');
|
|
250
|
+
}
|
|
251
|
+
if (isHydrationTarget) {
|
|
252
|
+
if (!isWinningVariant) {
|
|
253
|
+
parentDiv?.remove();
|
|
254
|
+
}
|
|
255
|
+
const thisScriptEl = document.currentScript;
|
|
256
|
+
thisScriptEl?.remove();
|
|
257
|
+
}
|
|
258
|
+
return;
|
|
259
|
+
}`,se="builderIoAbTest",le="builderIoRenderContent",L=e=>Object.values((e==null?void 0:e.variations)||{}).map(t=>({...t,testVariationId:t.id,id:e==null?void 0:e.id})),nt=({canTrack:e,content:t})=>!(!(L(t).length>0)||!e||o.isBrowser()),it=e=>e==="react"||e==="reactNative",at=o.TARGET==="angular",ue=it(o.TARGET),ot=()=>`
|
|
260
|
+
window.${se} = ${et}
|
|
261
|
+
window.${le} = ${tt}
|
|
262
|
+
`,rt=(e,t)=>`
|
|
263
|
+
window.${se}(
|
|
264
|
+
"${t}",${JSON.stringify(e)}, ${ue}, ${at}
|
|
265
|
+
)`,st=({contentId:e,variationId:t})=>`window.${le}(
|
|
266
|
+
"${t}", "${e}", ${ue}
|
|
267
|
+
)`;function _(e){return h.jsx("script",{dangerouslySetInnerHTML:{__html:e.scriptStr},"data-id":e.id,nonce:e.nonce||""})}function Y(e){return Math.round(e*1e3)/1e3}const lt=(e,t,n=!0)=>{if(!(e instanceof HTMLElement))return null;let r=n?e:e.parentElement;do{if(!r)return null;if(t(r))return r}while(r=r.parentElement);return null},ut=e=>lt(e,t=>{const n=t.getAttribute("builder-id")||t.id;return(n==null?void 0:n.indexOf("builder-"))===0}),X=({event:e,target:t})=>{const n=t.getBoundingClientRect(),r=e.clientX-n.left,l=e.clientY-n.top,u=Y(r/n.width),i=Y(l/n.height);return{x:u,y:i}},dt=e=>{const t=e.target,n=t&&ut(t),r=(n==null?void 0:n.getAttribute("builder-id"))||(n==null?void 0:n.id);return{targetBuilderElement:r||void 0,metadata:{targetOffset:t?X({event:e,target:t}):void 0,builderTargetOffset:n?X({event:e,target:n}):void 0,builderElementIndex:n&&r?[].slice.call(document.getElementsByClassName(r)).indexOf(n):void 0}}},ct=["svelte","qwik","vue"],Z=()=>ct.includes(o.TARGET)&&(o.isEditing()||o.isPreviewing()),mt=e=>{var u,i;const t=e.family+(e.kind&&!e.kind.includes("#")?", "+e.kind:""),n=t.split(",")[0],r=(i=e.fileUrl)!=null?i:(u=e==null?void 0:e.files)==null?void 0:u.regular;let l="";if(r&&t&&n&&(l+=`
|
|
268
|
+
@font-face {
|
|
269
|
+
font-family: "${t}";
|
|
270
|
+
src: local("${n}"), url('${r}') format('woff2');
|
|
271
|
+
font-display: fallback;
|
|
272
|
+
font-weight: 400;
|
|
273
|
+
}
|
|
274
|
+
`.trim()),e.files)for(const a in e.files){if(!(String(Number(a))===a))continue;const f=e.files[a];f&&f!==r&&(l+=`
|
|
275
|
+
@font-face {
|
|
276
|
+
font-family: "${t}";
|
|
277
|
+
src: url('${f}') format('woff2');
|
|
278
|
+
font-display: fallback;
|
|
279
|
+
font-weight: ${a};
|
|
280
|
+
}
|
|
281
|
+
`.trim())}return l},pt=({customFonts:e})=>{var t;return((t=e==null?void 0:e.map(n=>mt(n)))==null?void 0:t.join(" "))||""},ft=({cssCode:e,contentId:t})=>e?t?(e==null?void 0:e.replace(/&/g,`div[builder-content-id="${t}"]`))||"":e:"",gt=`
|
|
282
|
+
.builder-button {
|
|
283
|
+
all: unset;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.builder-text > p:first-of-type, .builder-text > .builder-paragraph:first-of-type {
|
|
287
|
+
margin: 0;
|
|
288
|
+
}
|
|
289
|
+
.builder-text > p, .builder-text > .builder-paragraph {
|
|
290
|
+
color: inherit;
|
|
291
|
+
line-height: inherit;
|
|
292
|
+
letter-spacing: inherit;
|
|
293
|
+
font-weight: inherit;
|
|
294
|
+
font-size: inherit;
|
|
295
|
+
text-align: inherit;
|
|
296
|
+
font-family: inherit;
|
|
297
|
+
}
|
|
298
|
+
`,ht=e=>e?"":gt,bt=e=>`variant-${e}`;function yt(e){var M,G,J;const t=s.useRef(null);s.useState(()=>!1);const[n,r]=s.useState(()=>null),[l,u]=s.useState(()=>"");function i(p){var v,x;const g={...e.builderContextSignal.rootState,...p};e.builderContextSignal.rootSetState?(x=(v=e.builderContextSignal).rootSetState)==null||x.call(v,g):e.setBuilderContextSignal(b=>({...b,rootState:g}))}function a(p){var v,x,b,T,D;const g={...e.builderContextSignal.content,...p,data:{...(v=e.builderContextSignal.content)==null?void 0:v.data,...p==null?void 0:p.data},meta:{...(x=e.builderContextSignal.content)==null?void 0:x.meta,...p==null?void 0:p.meta,breakpoints:((b=p==null?void 0:p.meta)==null?void 0:b.breakpoints)||((D=(T=e.builderContextSignal.content)==null?void 0:T.meta)==null?void 0:D.breakpoints)}};e.setBuilderContextSignal(q=>({...q,content:g}))}function c(){return e.showContent?{}:{hidden:!0,"aria-hidden":!0}}const[f,y]=s.useState(()=>e.contentWrapper||"div");function R(p){return o.createEditorListener({model:e.model,trustedHosts:e.trustedHosts,callbacks:{configureSdk:g=>{var b;const{breakpoints:v,contentId:x}=g;!x||x!==((b=e.builderContextSignal.content)==null?void 0:b.id)||v&&a({meta:{breakpoints:v}})},animation:g=>{W.triggerAnimation(g)},contentUpdate:g=>{a(g)},stateUpdate:g=>{i(g)}}})(p)}const[k,A]=s.useState(()=>({})),[d,m]=s.useState(()=>({})),[P,$]=s.useState(()=>!1);function C(p){var g,v;if(e.builderContextSignal.content){const x=(g=e.builderContextSignal.content)==null?void 0:g.testVariationId,b=(v=e.builderContextSignal.content)==null?void 0:v.id;o._track({apiHost:e.apiHost,type:"click",canTrack:o.getDefaultCanTrack(e.canTrack),contentId:b,apiKey:e.apiKey,variationId:x!==b?x:void 0,...dt(p),unique:!P})}P||$(!0)}function w(){var g,v,x;const p=(x=(v=(g=e.builderContextSignal.content)==null?void 0:g.data)==null?void 0:v.httpRequests)!=null?x:{};Object.entries(p).forEach(([b,T])=>{if(!T)return;const D=typeof T=="object"&&T["@type"]==="@builder.io/core:Request";if(d[b]||k[b]&&!o.isEditing())return;const q=D?T.request.url:T;d[b]=!0;const I=q.replace(/{{([^}]+)}}/g,(V,B)=>String(W.evaluate({code:B,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState}))),S=D?{url:I,method:T.request.method,headers:T.request.headers,body:T.request.body}:{url:I,method:"GET"};o.logFetch(JSON.stringify(S));const N={method:S.method,headers:S.headers,body:S.body};S.method==="GET"&&delete N.body,fetch(S.url,N).then(V=>V.json()).then(V=>{i({[b]:V}),k[b]=!0}).catch(V=>{console.error("error fetching dynamic data",JSON.stringify(T),V)}).finally(()=>{d[b]=!1})})}function E(){o.isEditing()&&window.dispatchEvent(new CustomEvent("builder:component:stateChange",{detail:{state:W.fastClone(e.builderContextSignal.rootState),ref:{name:e.model}}}))}const K=s.useRef(!1);return K.current||(w(),E(),K.current=!0),s.useEffect(()=>{var p,g,v,x,b;if(o.isBrowser()){o.isEditing()&&!e.isNestedRender&&(window.addEventListener("message",R),o.setupBrowserForEditing({...e.locale?{locale:e.locale}:{},...e.enrich?{enrich:e.enrich}:{},...e.trustedHosts?{trustedHosts:e.trustedHosts}:{},modelName:(p=e.model)!=null?p:"",apiKey:e.apiKey}),Object.values(e.builderContextSignal.componentInfos).forEach(I=>{var S,N;if(!((S=I.models)!=null&&S.length)||I.models.includes(e.model)){const V=o.createRegisterComponentMessage(I);(N=window.parent)==null||N.postMessage(V,"*")}}),window.addEventListener("builder:component:stateChangeListenerActivated",E));const T=e.builderContextSignal.content&&o.getDefaultCanTrack(e.canTrack),D=o.getCookieSync({name:`builder.tests.${(g=e.builderContextSignal.content)==null?void 0:g.id}`,canTrack:!0}),q=(v=e.builderContextSignal.content)==null?void 0:v.testVariationId;if(T&&q===D){const I=(x=e.builderContextSignal.content)==null?void 0:x.id,S=e.apiKey;o._track({apiHost:e.apiHost,type:"impression",canTrack:!0,contentId:I,apiKey:S,variationId:D!==I?D:void 0})}if(o.isPreviewing()&&!o.isEditing()){const I=new URL(location.href).searchParams,S=I.get("builder.preview"),N=I.get(`builder.overrides.${S}`),V=I.get("apiKey")||I.get("builder.space");(S==="BUILDER_STUDIO"||S===e.model&&V===e.apiKey&&(!e.content||N===e.content.id))&&o.fetchOneEntry({model:e.model,apiKey:e.apiKey,apiVersion:e.builderContextSignal.apiVersion,...S==="BUILDER_STUDIO"&&((b=e.context)!=null&&b.symbolId)?{query:{id:e.context.symbolId}}:{}}).then(B=>{B&&a(B)})}}},[]),s.useEffect(()=>{e.content&&a(e.content)},[e.content]),s.useEffect(()=>{E()},[e.builderContextSignal.rootState]),s.useEffect(()=>{if(e.data){if(n===e.data)return;i(e.data),r(e.data)}},[e.data]),s.useEffect(()=>{if(e.locale){if(l===e.locale)return;i({locale:e.locale}),u(e.locale)}},[e.locale]),s.useEffect(()=>()=>{o.isBrowser()&&(window.removeEventListener("message",R),window.removeEventListener("builder:component:stateChangeListenerActivated",E))},[]),h.jsx(F.BuilderContext.Provider,{value:e.builderContextSignal,children:e.builderContextSignal.content||Z()?h.jsx(f,{ref:t,onClick:p=>C(p),"builder-content-id":(M=e.builderContextSignal.content)==null?void 0:M.id,"builder-model":e.model,className:bt(((G=e.content)==null?void 0:G.testVariationId)||((J=e.content)==null?void 0:J.id)),style:{display:!e.builderContextSignal.content&&Z()?"none":void 0},...c(),...e.contentWrapperProps,children:e.children}):null})}function vt(e){const[t,n]=s.useState(()=>`
|
|
299
|
+
${ft({cssCode:e.cssCode,contentId:e.contentId})}
|
|
300
|
+
${pt({customFonts:e.customFonts})}
|
|
301
|
+
${ht(e.isNestedRender)}
|
|
302
|
+
`.trim());return h.jsx(W.InlinedStyles,{id:"builderio-content",styles:t,nonce:e.nonce})}const xt=({content:e,data:t,locale:n})=>{var u,i,a;const r={},l=((u=e==null?void 0:e.data)==null?void 0:u.state)||{};return(a=(i=e==null?void 0:e.data)==null?void 0:i.inputs)==null||a.forEach(c=>{c.name&&c.defaultValue!==void 0&&(r[c.name]=c.defaultValue)}),{...r,...l,...t,...n?{locale:n}:{}}},St=({content:e,data:t})=>e?{...e,data:{...e==null?void 0:e.data,...t},meta:e==null?void 0:e.meta}:void 0;function ee(e){var f,y,R,k,A,d,m,P,$;const[t,n]=s.useState(()=>{var C,w;return st({variationId:(C=e.content)==null?void 0:C.testVariationId,contentId:(w=e.content)==null?void 0:w.id})});function r(C){a(w=>({...w,rootState:C}))}const[l,u]=s.useState(()=>[...Q(),...e.customComponents||[]].reduce((C,{component:w,...E})=>({...C,[E.name]:{component:w,...o.serializeIncludingFunctions(E)}}),{})),[i,a]=s.useState(()=>({content:St({content:e.content,data:e.data}),localState:void 0,rootState:xt({content:e.content,data:e.data,locale:e.locale}),rootSetState:r,context:e.context||{},canTrack:e.canTrack,apiKey:e.apiKey,apiVersion:e.apiVersion,componentInfos:[...Q(),...e.customComponents||[]].reduce((C,{component:w,...E})=>({...C,[E.name]:o.serializeIncludingFunctions(E)}),{}),inheritedStyles:{},BlocksWrapper:e.blocksWrapper||"div",BlocksWrapperProps:e.blocksWrapperProps||{},nonce:e.nonce||"",model:e.model})),c=s.useRef(!1);if(!c.current){e.apiKey||o.logger.error("No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop.");const C=(y=(f=i.content)==null?void 0:f.data)==null?void 0:y.jsCode;C&&W.evaluate({code:C,context:e.context||{},localState:void 0,rootState:i.rootState,rootSetState:w=>{Object.assign(i.rootState,w)},isExpression:!1}),c.current=!0}return h.jsx(W.ComponentsContext.Provider,{value:{registeredComponents:l},children:h.jsxs(yt,{apiHost:e.apiHost,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:i,contentWrapper:e.contentWrapper,contentWrapperProps:e.contentWrapperProps,trustedHosts:e.trustedHosts,isNestedRender:e.isNestedRender,setBuilderContextSignal:a,children:[e.isSsrAbTest?h.jsx(_,{id:"builderio-variant-visibility",scriptStr:t,nonce:e.nonce||""}):null,h.jsx(vt,{nonce:e.nonce||"",isNestedRender:e.isNestedRender,contentId:(R=i.content)==null?void 0:R.id,cssCode:(A=(k=i.content)==null?void 0:k.data)==null?void 0:A.cssCode,customFonts:(m=(d=i.content)==null?void 0:d.data)==null?void 0:m.customFonts}),h.jsx(W.Blocks,{blocks:($=(P=i.content)==null?void 0:P.data)==null?void 0:$.blocks,context:i,registeredComponents:l,linkComponent:e.linkComponent})]})})}function Tt(e){var i;const[t,n]=s.useState(()=>nt({canTrack:o.getDefaultCanTrack(e.canTrack),content:e.content}));function r(){var a;return rt(L(e.content).map(c=>({id:c.testVariationId,testRatio:c.testRatio})),((a=e.content)==null?void 0:a.id)||"")}function l(){return L(e.content).map(a=>`.variant-${a.testVariationId} { display: none; } `).join("")}function u(){var a;return t?{...e.content,testVariationId:(a=e.content)==null?void 0:a.id}:o.handleABTestingSync({item:e.content,canTrack:o.getDefaultCanTrack(e.canTrack)})}return s.useEffect(()=>{},[]),h.jsxs(h.Fragment,{children:[!e.isNestedRender&&o.TARGET!=="reactNative"?h.jsxs(h.Fragment,{children:[h.jsx(_,{id:"builderio-init-variants-fns",scriptStr:ot(),nonce:e.nonce||""}),ae.includes(o.TARGET)?h.jsx(_,{id:"builderio-init-personalization-variants-fns",nonce:e.nonce||"",scriptStr:be()}):null]}):null,t?h.jsxs(h.Fragment,{children:[h.jsx(W.InlinedStyles,{id:"builderio-variants",styles:l(),nonce:e.nonce||""}),h.jsx(_,{id:"builderio-variants-visibility",scriptStr:r(),nonce:e.nonce||""}),(i=L(e.content))==null?void 0:i.map(a=>h.jsx(ee,{apiHost:e.apiHost,isNestedRender:e.isNestedRender,nonce:e.nonce,content:a,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},a.testVariationId))]}):null,h.jsx(ee,{apiHost:e.apiHost,nonce:e.nonce,isNestedRender:e.isNestedRender,content:u(),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})]})}const It=Object.freeze(Object.defineProperty({__proto__:null,default:Tt},Symbol.toStringTag,{value:"Module"}));exports.DEFAULT_INDEX=te;exports.InlinedScript=_;exports.SDKS_REQUIRING_RESET_APPROACH=oe;exports.checkShouldRenderVariants=ge;exports.contentVariants=It;exports.filterWithCustomTargeting=de;exports.getBlocksToRender=he;exports.getPersonalizationScript=ye;exports.getUpdateVisibilityStylesScript=ve;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react/jsx-runtime"),n=require("react"),l=require("./server-entry-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react/jsx-runtime"),n=require("react"),l=require("./server-entry-67200cf1.cjs");function f(c){const r=n.useRef(null),[i,m]=n.useState(()=>[]),[u,g]=n.useState(()=>[]);function o(){var d;if(!r.current||!((d=r.current)!=null&&d.getElementsByTagName)||typeof window=="undefined")return;const a=r.current.getElementsByTagName("script");for(let s=0;s<a.length;s++){const e=a[s];if(e.src){if(i.includes(e.src))continue;i.push(e.src);const t=document.createElement("script");t.async=!0,t.src=e.src,document.head.appendChild(t)}else if(!e.type||["text/javascript","application/javascript","application/ecmascript"].includes(e.type)){if(u.includes(e.innerText))continue;try{u.push(e.innerText),new Function(e.innerText)()}catch(t){l.logger.warn("[BUILDER.IO] `CustomCode`: Error running script:",t)}}}}return n.useEffect(()=>{o()},[]),n.useEffect(()=>{l.isEditing()&&o()},[c.code]),p.jsx("div",{ref:r,className:"builder-custom-code"+(c.replaceNodes?" replace-nodes":""),dangerouslySetInnerHTML:{__html:c.code}})}exports.default=f;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as f, useState as p, useEffect as d } from "react";
|
|
3
|
-
import { isEditing as m, logger as g } from "./server-entry-
|
|
3
|
+
import { isEditing as m, logger as g } from "./server-entry-fb5f2b80.js";
|
|
4
4
|
function T(r) {
|
|
5
5
|
const n = f(null), [s, y] = p(() => []), [i, h] = p(() => []);
|
|
6
6
|
function o() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),r=require("react"),m=require("./server-entry-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),r=require("react"),m=require("./server-entry-67200cf1.cjs"),f=["text/javascript","application/javascript","application/ecmascript"],S=s=>f.includes(s.type);function g(s){const t=r.useRef(null),[i,E]=r.useState(()=>[]),[u,y]=r.useState(()=>[]),[a,l]=r.useState(()=>!1);function p(){if(!t.current||!t.current.getElementsByTagName)return;const o=t.current.getElementsByTagName("script");for(let c=0;c<o.length;c++){const e=o[c];if(e.src&&!i.includes(e.src)){i.push(e.src);const n=document.createElement("script");n.async=!0,n.src=e.src,document.head.appendChild(n)}else if(S(e)&&!u.includes(e.innerText))try{u.push(e.innerText),new Function(e.innerText)()}catch(n){m.logger.warn("[BUILDER.IO] `Embed`: Error running script:",n)}}}return r.useEffect(()=>{t.current&&!a&&(l(!0),p())},[t.current,a]),d.jsx("div",{className:"builder-embed",ref:t,dangerouslySetInnerHTML:{__html:s.content}})}exports.default=g;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as m } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as d, useState as c, useEffect as f } from "react";
|
|
3
|
-
import { logger as E } from "./server-entry-
|
|
3
|
+
import { logger as E } from "./server-entry-fb5f2b80.js";
|
|
4
4
|
const g = ["text/javascript", "application/javascript", "application/ecmascript"], I = (r) => g.includes(r.type);
|
|
5
5
|
function y(r) {
|
|
6
6
|
const e = d(null), [i, S] = c(() => []), [u, T] = c(() => []), [o, p] = c(() => !1);
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { jsxs as F, Fragment as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { Blocks as S, set as U, get as
|
|
4
|
-
import { isEditing as
|
|
1
|
+
import { jsxs as F, Fragment as O, jsx as b } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as R, useState as E } from "react";
|
|
3
|
+
import { Blocks as S, set as U, get as q } from "./blocks-0269007e.js";
|
|
4
|
+
import { isEditing as $, logFetch as L } from "./server-entry-fb5f2b80.js";
|
|
5
5
|
import "./blocks-exports.mjs";
|
|
6
|
-
import "./get-class-prop-name-
|
|
6
|
+
import "./get-class-prop-name-770bdff2.js";
|
|
7
7
|
import "./dynamic-renderer-8b343325.js";
|
|
8
|
-
const
|
|
8
|
+
const W = ["production", "qa", "test", "development", "dev", "cdn-qa", "cloud", "fast", "cdn2", "cdn-prod"], z = () => {
|
|
9
9
|
const e = process.env.NODE_ENV || "production";
|
|
10
|
-
return
|
|
10
|
+
return W.includes(e) ? e : "production";
|
|
11
11
|
};
|
|
12
|
-
function
|
|
13
|
-
const r =
|
|
12
|
+
function X(e) {
|
|
13
|
+
const r = R(null), [N, c] = E(() => "unsubmitted"), [y, v] = E(() => null), [H, P] = E(() => "");
|
|
14
14
|
function x(i) {
|
|
15
15
|
var m, l;
|
|
16
16
|
const u = {
|
|
@@ -20,9 +20,12 @@ function Q(e) {
|
|
|
20
20
|
e.builderContext.rootSetState ? (l = (m = e.builderContext).rootSetState) == null || l.call(m, u) : e.builderContext.rootState = u;
|
|
21
21
|
}
|
|
22
22
|
function h() {
|
|
23
|
-
return
|
|
23
|
+
return $() && e.previewState || N;
|
|
24
24
|
}
|
|
25
25
|
function D(i) {
|
|
26
|
+
return JSON.stringify(i, null, 2);
|
|
27
|
+
}
|
|
28
|
+
function A(i) {
|
|
26
29
|
var m;
|
|
27
30
|
const u = e.sendWithJs || e.sendSubmissionsTo === "email";
|
|
28
31
|
if (e.sendSubmissionsTo === "zapier")
|
|
@@ -35,13 +38,15 @@ function Q(e) {
|
|
|
35
38
|
i.preventDefault();
|
|
36
39
|
const l = i.currentTarget || i.target, C = e.customHeaders || {};
|
|
37
40
|
let g;
|
|
38
|
-
const
|
|
41
|
+
const j = new FormData(l), T = Array.from(l.querySelectorAll("input,select,textarea")).filter((t) => !!t.name).filter(
|
|
42
|
+
(t) => !!t.name && (t.type !== "radio" || t.checked)
|
|
43
|
+
).map((t) => {
|
|
39
44
|
let n;
|
|
40
45
|
const o = t.name;
|
|
41
46
|
if (t instanceof HTMLInputElement)
|
|
42
47
|
if (t.type === "radio") {
|
|
43
48
|
if (t.checked)
|
|
44
|
-
return n = t.
|
|
49
|
+
return n = t.value, {
|
|
45
50
|
key: o,
|
|
46
51
|
value: n
|
|
47
52
|
};
|
|
@@ -63,7 +68,7 @@ function Q(e) {
|
|
|
63
68
|
if (e.sendSubmissionsTo === "email" && (a = "multipart/form-data"), Array.from(T).forEach(({ value: t }) => {
|
|
64
69
|
(t instanceof File || Array.isArray(t) && t[0] instanceof File || t instanceof FileList) && (a = "multipart/form-data");
|
|
65
70
|
}), a !== "application/json")
|
|
66
|
-
g =
|
|
71
|
+
g = j;
|
|
67
72
|
else {
|
|
68
73
|
const t = {};
|
|
69
74
|
Array.from(T).forEach(({ value: n, key: o }) => {
|
|
@@ -79,10 +84,10 @@ function Q(e) {
|
|
|
79
84
|
console.error(t), c("error"), x({ formErrorMessage: t });
|
|
80
85
|
return;
|
|
81
86
|
}
|
|
82
|
-
const
|
|
87
|
+
const J = `${z() === "dev" ? "http://localhost:5000" : "https://builder.io"}/api/v1/form-submit?apiKey=${e.builderContext.apiKey}&to=${btoa(
|
|
83
88
|
e.sendSubmissionsToEmail || ""
|
|
84
|
-
)}&name=${encodeURIComponent(e.name || "")}`, k = e.sendSubmissionsTo === "email" ?
|
|
85
|
-
|
|
89
|
+
)}&name=${encodeURIComponent(e.name || "")}`, k = e.sendSubmissionsTo === "email" ? J : e.action;
|
|
90
|
+
L(k), fetch(k, { body: g, headers: C, method: e.method || "post" }).then(
|
|
86
91
|
async (t) => {
|
|
87
92
|
var d, w;
|
|
88
93
|
let n;
|
|
@@ -94,7 +99,7 @@ function Q(e) {
|
|
|
94
99
|
if ((d = r.current) != null && d.nativeElement && ((w = r.current) == null || w.nativeElement.dispatchEvent(f), f.defaultPrevented))
|
|
95
100
|
return;
|
|
96
101
|
v(n), c("error");
|
|
97
|
-
let s = e.errorMessagePath ?
|
|
102
|
+
let s = e.errorMessagePath ? q(n, e.errorMessagePath) : n.message || n.error || n;
|
|
98
103
|
typeof s != "string" && (s = JSON.stringify(s)), P(s), x({ formErrorMessage: s });
|
|
99
104
|
return;
|
|
100
105
|
}
|
|
@@ -126,9 +131,9 @@ function Q(e) {
|
|
|
126
131
|
);
|
|
127
132
|
}
|
|
128
133
|
}
|
|
129
|
-
return /* @__PURE__ */ F(
|
|
134
|
+
return /* @__PURE__ */ F(O, { children: [
|
|
130
135
|
" ",
|
|
131
|
-
/* @__PURE__ */ b("style", { children: ".pre-
|
|
136
|
+
/* @__PURE__ */ b("style", { children: ".pre-abc898ba { padding: 10px; color: red; text-align: center; }" }),
|
|
132
137
|
" ",
|
|
133
138
|
/* @__PURE__ */ F(
|
|
134
139
|
"form",
|
|
@@ -138,7 +143,7 @@ function Q(e) {
|
|
|
138
143
|
action: !e.sendWithJs && e.action,
|
|
139
144
|
method: e.method,
|
|
140
145
|
name: e.name,
|
|
141
|
-
onSubmit: (i) =>
|
|
146
|
+
onSubmit: (i) => A(i),
|
|
142
147
|
...e.attributes,
|
|
143
148
|
children: [
|
|
144
149
|
e.children,
|
|
@@ -158,7 +163,7 @@ function Q(e) {
|
|
|
158
163
|
context: e.builderContext
|
|
159
164
|
}
|
|
160
165
|
) : null,
|
|
161
|
-
h() === "error" && y ? /* @__PURE__ */ b("pre", { className: "builder-form-error-text pre-
|
|
166
|
+
h() === "error" && y ? /* @__PURE__ */ b("pre", { className: "builder-form-error-text pre-abc898ba", children: D(y) }) : null,
|
|
162
167
|
h() === "success" ? /* @__PURE__ */ b(
|
|
163
168
|
S,
|
|
164
169
|
{
|
|
@@ -174,5 +179,5 @@ function Q(e) {
|
|
|
174
179
|
] });
|
|
175
180
|
}
|
|
176
181
|
export {
|
|
177
|
-
|
|
182
|
+
X as default
|
|
178
183
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),S=require("react"),h=require("./blocks-2af1d7c9.cjs"),q=require("./server-entry-67200cf1.cjs");require("./blocks-exports.cjs");require("./get-class-prop-name-f470d5ce.cjs");require("./dynamic-renderer-b29b45ca.cjs");const A=["production","qa","test","development","dev","cdn-qa","cloud","fast","cdn2","cdn-prod"],O=()=>{const e=process.env.NODE_ENV||"production";return A.includes(e)?e:"production"};function J(e){const r=S.useRef(null),[w,u]=S.useState(()=>"unsubmitted"),[y,E]=S.useState(()=>null),[U,F]=S.useState(()=>"");function x(s){var m,d;const l={...e.builderContext.rootState,...s};e.builderContext.rootSetState?(d=(m=e.builderContext).rootSetState)==null||d.call(m,l):e.builderContext.rootState=l}function g(){return q.isEditing()&&e.previewState||w}function N(s){return JSON.stringify(s,null,2)}function P(s){var m;const l=e.sendWithJs||e.sendSubmissionsTo==="email";if(e.sendSubmissionsTo==="zapier")s.preventDefault();else if(l){if(!(e.action||e.sendSubmissionsTo==="email")){s.preventDefault();return}s.preventDefault();const d=s.currentTarget||s.target,T=e.customHeaders||{};let v;const D=new FormData(d),C=Array.from(d.querySelectorAll("input,select,textarea")).filter(t=>!!t.name).filter(t=>!!t.name&&(t.type!=="radio"||t.checked)).map(t=>{let n;const a=t.name;if(t instanceof HTMLInputElement)if(t.type==="radio"){if(t.checked)return n=t.value,{key:a,value:n}}else if(t.type==="checkbox")n=t.checked;else if(t.type==="number"||t.type==="range"){const f=t.valueAsNumber;isNaN(f)||(n=f)}else t.type==="file"?n=t.files:n=t.value;else n=t.value;return{key:a,value:n}});let c=e.contentType;if(e.sendSubmissionsTo==="email"&&(c="multipart/form-data"),Array.from(C).forEach(({value:t})=>{(t instanceof File||Array.isArray(t)&&t[0]instanceof File||t instanceof FileList)&&(c="multipart/form-data")}),c!=="application/json")v=D;else{const t={};Array.from(C).forEach(({value:n,key:a})=>{h.set(t,a,n)}),v=JSON.stringify(t)}c&&c!=="multipart/form-data"&&(l&&((m=e.action)!=null&&m.includes("zapier.com"))||(T["content-type"]=c));const k=new CustomEvent("presubmit",{detail:{body:v}});if(r.current&&(r.current.dispatchEvent(k),k.defaultPrevented))return;if(u("sending"),e.sendSubmissionsTo==="email"&&(e.sendSubmissionsToEmail==="your@email.com"||!e.sendSubmissionsToEmail)){const t="SubmissionsToEmail is required when sendSubmissionsTo is set to email";console.error(t),u("error"),x({formErrorMessage:t});return}const R=`${O()==="dev"?"http://localhost:5000":"https://builder.io"}/api/v1/form-submit?apiKey=${e.builderContext.apiKey}&to=${btoa(e.sendSubmissionsToEmail||"")}&name=${encodeURIComponent(e.name||"")}`,M=e.sendSubmissionsTo==="email"?R:e.action;q.logFetch(M),fetch(M,{body:v,headers:T,method:e.method||"post"}).then(async t=>{var f,j;let n;const a=t.headers.get("content-type");if(a&&a.indexOf("application/json")!==-1?n=await t.json():n=await t.text(),!t.ok){const b=new CustomEvent("submit:error",{detail:{error:n,status:t.status}});if((f=r.current)!=null&&f.nativeElement&&((j=r.current)==null||j.nativeElement.dispatchEvent(b),b.defaultPrevented))return;E(n),u("error");let i=e.errorMessagePath?h.get(n,e.errorMessagePath):n.message||n.error||n;typeof i!="string"&&(i=JSON.stringify(i)),F(i),x({formErrorMessage:i});return}if(E(n),u(t.ok?"success":"error"),t.ok){const b=new CustomEvent("submit:success",{detail:{res:t,body:n}});if(r.current){if(r.current.dispatchEvent(b),b.defaultPrevented)return;e.resetFormOnSubmit!==!1&&r.current.reset()}if(e.successUrl)if(r.current){const i=new CustomEvent("route",{detail:{url:e.successUrl}});r.current.dispatchEvent(i),i.defaultPrevented||(location.href=e.successUrl)}else location.href=e.successUrl}},t=>{const n=new CustomEvent("submit:error",{detail:{error:t}});r.current&&(r.current.dispatchEvent(n),n.defaultPrevented)||(E(t),u("error"))})}}return o.jsxs(o.Fragment,{children:[" ",o.jsx("style",{children:".pre-abc898ba { padding: 10px; color: red; text-align: center; }"})," ",o.jsxs("form",{validate:e.validate,ref:r,action:!e.sendWithJs&&e.action,method:e.method,name:e.name,onSubmit:s=>P(s),...e.attributes,children:[e.children,g()==="error"?o.jsx(h.Blocks,{path:"errorMessage",blocks:e.errorMessage,context:e.builderContext}):null,g()==="sending"?o.jsx(h.Blocks,{path:"sendingMessage",blocks:e.sendingMessage,context:e.builderContext}):null,g()==="error"&&y?o.jsx("pre",{className:"builder-form-error-text pre-abc898ba",children:N(y)}):null,g()==="success"?o.jsx(h.Blocks,{path:"successMessage",blocks:e.successMessage,context:e.builderContext}):null]})," "]})}exports.default=J;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("./server-entry-
|
|
1
|
+
"use strict";const e=require("./server-entry-67200cf1.cjs"),s=()=>{switch(e.TARGET){case"react":case"reactNative":case"rsc":return"className";case"svelte":case"vue":case"solid":case"qwik":case"angular":return"class"}};exports.getClassPropName=s;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { isEditing as n } from "./server-entry-
|
|
2
|
+
import { isEditing as n } from "./server-entry-fb5f2b80.js";
|
|
3
3
|
import { getSrcSet as o } from "./image.helpers-3e926d47.js";
|
|
4
4
|
function g(t) {
|
|
5
5
|
function e() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),n=require("./server-entry-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),n=require("./server-entry-67200cf1.cjs"),c=require("./image.helpers-dba8a869.cjs");function u(e){function i(){const t=e.imgSrc||e.image;if(!(!t||typeof t!="string")&&t.match(/builder\.io/))return c.getSrcSet(t)}return r.jsx("img",{loading:"lazy",style:{objectFit:e.backgroundSize||"cover",objectPosition:e.backgroundPosition||"center"},alt:e.altText,src:e.imgSrc||e.image,srcSet:i(),...e.attributes},n.isEditing()&&e.imgSrc||"default-key")}exports.default=u;
|
package/lib/edge/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./blocks-exports.cjs"),e=require("./server-entry-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./blocks-exports.cjs"),e=require("./server-entry-67200cf1.cjs");require("react");exports.Blocks=t.Blocks;exports.BuilderContext=t.BuilderContext;exports.Button=t.Button;exports.Columns=t.Columns;exports.Content=t.Content;exports.Fragment=t.Fragment;exports.Image=t.Image;exports.Section=t.Section;exports.Symbol=t.Symbol;exports.Text=t.Text;exports.Video=t.Video;exports._processContentResult=e._processContentResult;exports.createRegisterComponentMessage=e.createRegisterComponentMessage;exports.fetchBuilderProps=e.fetchBuilderProps;exports.fetchEntries=e.fetchEntries;exports.fetchOneEntry=e.fetchOneEntry;exports.getBuilderSearchParams=e.getBuilderSearchParams;exports.isEditing=e.isEditing;exports.isPreviewing=e.isPreviewing;exports.register=e.register;exports.registerAction=e.registerAction;exports.setClientUserAttributes=e.setClientUserAttributes;exports.setEditorSettings=e.setEditorSettings;exports.subscribeToEditor=e.subscribeToEditor;exports.track=e.track;
|