@builder.io/sdk-react 2.0.15 → 2.0.16
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 +25 -25
- package/lib/browser/blocks-exports.mjs +274 -281
- package/lib/browser/index.cjs +1 -1
- package/lib/browser/index.mjs +23 -22
- package/lib/browser/init.cjs +2 -2
- package/lib/browser/init.mjs +6 -1
- package/lib/browser/{server-entry-b4e02b7f.js → server-entry-1db0d96b.js} +1 -1
- package/lib/browser/{server-entry-6758904f.cjs → server-entry-c1666709.cjs} +1 -1
- package/lib/browser/server-entry.cjs +1 -1
- package/lib/browser/server-entry.mjs +1 -1
- package/lib/browser/should-force-browser-runtime-in-node-00f3cfef.js +17 -0
- package/lib/browser/should-force-browser-runtime-in-node-f768fb5d.cjs +1 -0
- package/lib/edge/{accordion-9d6ead4a.cjs → accordion-09162a27.cjs} +1 -1
- package/lib/edge/{accordion-cc5e4262.js → accordion-7c1c7c56.js} +1 -1
- package/lib/edge/{blocks-f9516def.cjs → blocks-273f24cc.cjs} +1 -1
- package/lib/edge/{blocks-28f8515f.js → blocks-46c07b56.js} +3 -3
- package/lib/edge/blocks-exports.cjs +1 -1
- package/lib/edge/blocks-exports.mjs +2 -2
- package/lib/edge/{button-5b479c4f.js → button-a923f8ff.js} +2 -2
- package/lib/edge/{button-d5d5a523.cjs → button-f2daea13.cjs} +1 -1
- package/lib/edge/columns-0b8c2260.cjs +28 -0
- package/lib/edge/{columns-80468479.js → columns-eee4f51c.js} +7 -6
- package/lib/edge/{content-variants-4a3c14d6.js → content-variants-1368cab1.js} +14 -13
- package/lib/edge/content-variants-575b5dbf.cjs +134 -0
- package/lib/edge/{evaluate-b34c0621.cjs → evaluate-4c9b2e86.cjs} +10 -10
- package/lib/edge/{evaluate-9643776e.js → evaluate-93701356.js} +336 -344
- package/lib/edge/form-bd184008.cjs +1 -0
- package/lib/edge/{form-8614781e.js → form-d0eb0af4.js} +15 -14
- package/lib/edge/{get-class-prop-name-982b0eeb.js → get-class-prop-name-1c373615.js} +1 -1
- package/lib/edge/{get-class-prop-name-3fcaaa4e.cjs → get-class-prop-name-7cd1376f.cjs} +1 -1
- package/lib/edge/{img-5481830d.cjs → img-6c8139db.cjs} +1 -1
- package/lib/edge/{img-2750ffb8.js → img-6e16ade6.js} +1 -1
- package/lib/edge/index.cjs +1 -1
- package/lib/edge/index.mjs +1 -1
- package/lib/edge/init.cjs +2 -2
- package/lib/edge/init.mjs +6 -1
- package/lib/edge/{input-a53f13e5.js → input-a7e9c157.js} +1 -1
- package/lib/edge/{input-4018ed38.cjs → input-c78fef2b.cjs} +1 -1
- package/lib/edge/{select-a9ba7290.js → select-3cf593bd.js} +1 -1
- package/lib/edge/{select-b5257730.cjs → select-bd1e231b.cjs} +1 -1
- package/lib/edge/{server-entry-425ab225.js → server-entry-6b3ad048.js} +1 -1
- package/lib/edge/{server-entry-c0a129cd.cjs → server-entry-d09af943.cjs} +1 -1
- package/lib/edge/server-entry.cjs +1 -1
- package/lib/edge/server-entry.mjs +1 -1
- package/lib/edge/should-force-browser-runtime-in-node-2b14e4a8.cjs +1 -0
- package/lib/edge/should-force-browser-runtime-in-node-560bddfb.js +17 -0
- package/lib/edge/{slot-2806840c.js → slot-a5a9a30f.js} +7 -6
- package/lib/edge/slot-ab7fc875.cjs +1 -0
- package/lib/edge/{symbol-f4a3bd00.js → symbol-77d331c6.js} +2 -2
- package/lib/edge/{symbol-2a759e66.cjs → symbol-9de15518.cjs} +1 -1
- package/lib/edge/{tabs-1e5bb78c.js → tabs-63d6ea85.js} +14 -13
- package/lib/edge/tabs-e6fa664e.cjs +1 -0
- package/lib/edge/{text-4492d4a7.js → text-4d508bbc.js} +9 -8
- package/lib/edge/text-ab5d2747.cjs +1 -0
- package/lib/node/blocks-exports.cjs +25 -25
- package/lib/node/blocks-exports.mjs +317 -325
- package/lib/node/index.cjs +1 -1
- package/lib/node/index.mjs +2 -2
- package/lib/node/init.cjs +1 -1
- package/lib/node/init.mjs +12 -8
- package/lib/node/{server-entry-b4e02b7f.js → server-entry-1db0d96b.js} +1 -1
- package/lib/node/{server-entry-6758904f.cjs → server-entry-c1666709.cjs} +1 -1
- package/lib/node/server-entry.cjs +1 -1
- package/lib/node/server-entry.mjs +1 -1
- package/lib/node/{node-runtime-e5a24b2b.js → should-force-browser-runtime-in-node-1188ea7b.js} +48 -34
- package/lib/node/{node-runtime-9a8c1fa3.cjs → should-force-browser-runtime-in-node-37010e2f.cjs} +4 -4
- package/package.json +1 -1
- package/types/constants/sdk-version.d.ts +1 -1
- package/types/functions/evaluate/should-force-browser-runtime-in-node.d.ts +3 -1
- package/lib/edge/columns-52de76ba.cjs +0 -28
- package/lib/edge/content-variants-ab7b16da.cjs +0 -134
- package/lib/edge/form-2490bc65.cjs +0 -1
- package/lib/edge/slot-7c52b924.cjs +0 -1
- package/lib/edge/tabs-238833b0.cjs +0 -1
- package/lib/edge/text-95df08ad.cjs +0 -1
package/lib/node/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-c1666709.cjs");require("react/jsx-runtime");require("react");require("./should-force-browser-runtime-in-node-37010e2f.cjs");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.setEditorSettings=e.setEditorSettings;exports.subscribeToEditor=e.subscribeToEditor;exports.track=e.track;
|
package/lib/node/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Blocks as s, BuilderContext as n, Button as m, Columns as c, Content as g, Fragment as a, Image as p, Section as d, Symbol as l, Text as u, Video as f } from "./blocks-exports.mjs";
|
|
2
|
-
import { _processContentResult as C, createRegisterComponentMessage as E, fetchBuilderProps as h, fetchEntries as x, fetchOneEntry as S, getBuilderSearchParams as b, isEditing as P, isPreviewing as k, register as y, setEditorSettings as R, subscribeToEditor as T, track as v } from "./server-entry-
|
|
2
|
+
import { _processContentResult as C, createRegisterComponentMessage as E, fetchBuilderProps as h, fetchEntries as x, fetchOneEntry as S, getBuilderSearchParams as b, isEditing as P, isPreviewing as k, register as y, setEditorSettings as R, subscribeToEditor as T, track as v } from "./server-entry-1db0d96b.js";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "react";
|
|
5
|
-
import "./
|
|
5
|
+
import "./should-force-browser-runtime-in-node-1188ea7b.js";
|
|
6
6
|
export {
|
|
7
7
|
s as Blocks,
|
|
8
8
|
n as BuilderContext,
|
package/lib/node/init.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./should-force-browser-runtime-in-node-37010e2f.cjs"),t=require("isolated-vm");require("./server-entry-c1666709.cjs");const r=i=>{if(e.shouldForceBrowserRuntimeInNode({shouldLogWarning:!0}))return;const{ivmIsolateOptions:o}=i||{};e.setIvm(t,o)};exports.initializeNodeRuntime=r;
|
package/lib/node/init.mjs
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import t from "
|
|
2
|
-
import
|
|
3
|
-
import "./server-entry-
|
|
4
|
-
const
|
|
1
|
+
import { shouldForceBrowserRuntimeInNode as t, setIvm as r } from "./should-force-browser-runtime-in-node-1188ea7b.js";
|
|
2
|
+
import e from "isolated-vm";
|
|
3
|
+
import "./server-entry-1db0d96b.js";
|
|
4
|
+
const u = (o) => {
|
|
5
|
+
if (t({
|
|
6
|
+
shouldLogWarning: !0
|
|
7
|
+
}))
|
|
8
|
+
return;
|
|
5
9
|
const {
|
|
6
|
-
ivmIsolateOptions:
|
|
7
|
-
} =
|
|
8
|
-
|
|
10
|
+
ivmIsolateOptions: i
|
|
11
|
+
} = o || {};
|
|
12
|
+
r(e, i);
|
|
9
13
|
};
|
|
10
14
|
export {
|
|
11
|
-
|
|
15
|
+
u as initializeNodeRuntime
|
|
12
16
|
};
|
|
@@ -302,7 +302,7 @@ function $(t, e) {
|
|
|
302
302
|
const n = new URL(e.origin), r = n.hostname;
|
|
303
303
|
return (t || kt).findIndex((o) => o.startsWith("*.") ? r.endsWith(o.slice(1)) : o === r) > -1;
|
|
304
304
|
}
|
|
305
|
-
const Et = "2.0.
|
|
305
|
+
const Et = "2.0.16", zt = () => {
|
|
306
306
|
ot("insertMenu", {
|
|
307
307
|
name: "_default",
|
|
308
308
|
default: !0,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const I="react",b="[Builder.io]: ",d={log:(...e)=>console.log(b,...e),error:(...e)=>console.error(b,...e),warn:(...e)=>console.warn(b,...e),debug:(...e)=>console.debug(b,...e)};function c(){return typeof window!="undefined"&&typeof document!="undefined"}const ce=e=>{const t={};return e.forEach((n,r)=>{t[r]=n}),t},M=e=>e instanceof URLSearchParams?ce(e):e,U=e=>typeof e=="string"?e:e instanceof URLSearchParams?e.toString():new URLSearchParams(e).toString();function ue(){return c()&&window.self!==window.top}function F(e){return ue()&&U(e||window.location.search).indexOf("builder.frameEditing=")!==-1}const de=()=>{if(c()){const e=new URL(location.href);return e.pathname===""&&(e.pathname="/"),e}else return console.warn("Cannot get location for tracking in non-browser environment"),null},le=()=>typeof navigator=="object"&&navigator.userAgent||"",N=()=>{const e=le(),t={Android(){return e.match(/Android/i)},BlackBerry(){return e.match(/BlackBerry/i)},iOS(){return e.match(/iPhone|iPod/i)},Opera(){return e.match(/Opera Mini/i)},Windows(){return e.match(/IEMobile/i)||e.match(/WPDesktop/i)},any(){return t.Android()||t.BlackBerry()||t.iOS()||t.Opera()||t.Windows()||I==="reactNative"}},n=e.match(/Tablet|iPad/i),r=de();return{urlPath:r==null?void 0:r.pathname,host:(r==null?void 0:r.host)||(r==null?void 0:r.hostname),device:n?"tablet":t.any()?"mobile":"desktop"}},p=e=>e!=null;function fe(e){const t=e||(c()?window.location.search:void 0);return t?U(t).indexOf("builder.preview=")!==-1:!1}const ge=e=>({type:"builder.registerComponent",data:k(e)}),he=e=>{const t=e.toString().trim();return`return (${!t.startsWith("function")&&!t.startsWith("(")?"function ":""}${t}).apply(this, arguments)`};function k(e){return JSON.parse(JSON.stringify(e,(t,n)=>typeof n=="function"?he(n):n))}const x={};function D(e,t){e==="plugin"&&(t=k(t));let n=x[e];if(n||(n=x[e]=[]),n.push(t),c()){const r={type:"builder.register",data:{type:e,info:t}};try{parent.postMessage(r,"*"),parent!==window&&window.postMessage(r,"*")}catch(o){console.debug("Could not postmessage",o)}}}const R={};function pe(e){if(c()){Object.assign(R,e);const t={type:"builder.settingsChange",data:R};parent.postMessage(t,"*")}}const B="builder.",me="options.",P=e=>{if(!e)return{};const t=M(e),n={};return Object.keys(t).forEach(r=>{if(r.startsWith(B)){const o=r.replace(B,"").replace(me,"");n[o]=t[r]}}),n},ye=()=>{if(!c())return{};const e=new URLSearchParams(window.location.search);return P(e)},Se=e=>{if(e==="localhost"||e==="127.0.0.1")return e;const t=e.split(".");return t.length>2?t.slice(1).join("."):e},j=({name:e,canTrack:t})=>{var n;try{return t?(n=document.cookie.split("; ").find(r=>r.startsWith(`${e}=`)))==null?void 0:n.split("=")[1]:void 0}catch(r){d.warn("[COOKIE] GET error: ",(r==null?void 0:r.message)||r);return}},K=async e=>j(e),we=e=>e.map(([t,n])=>n?`${t}=${n}`:t).filter(p).join("; "),be=[["secure",""],["SameSite","None"]],Ie=({name:e,value:t,expires:n})=>{const o=(c()?location.protocol==="https:":!0)?be:[[]],s=n?[["expires",n.toUTCString()]]:[[]],a=[[e,t],...s,["path","/"],["domain",Se(window.location.hostname)],...o];return we(a)},_=async({name:e,value:t,expires:n,canTrack:r})=>{try{if(!r)return;const o=Ie({name:e,value:t,expires:n});document.cookie=o}catch(o){d.warn("[COOKIE] SET error: ",(o==null?void 0:o.message)||o)}};function ve(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const t=Math.random()*16|0;return(e=="x"?t:t&3|8).toString(16)})}function W(){return ve().replace(/-/g,"")}const $="builderSessionId",Ee=async({canTrack:e})=>{if(!e)return;const t=await K({name:$,canTrack:e});if(p(t))return t;{const n=ke();return Pe({id:n,canTrack:e}),n}},ke=()=>W(),Pe=({id:e,canTrack:t})=>_({name:$,value:e,canTrack:t}),G=()=>c()&&typeof localStorage!="undefined"?localStorage:void 0,Ce=({key:e,canTrack:t})=>{var n;try{return t?(n=G())==null?void 0:n.getItem(e):void 0}catch(r){console.debug("[LocalStorage] GET error: ",r);return}},Oe=({key:e,canTrack:t,value:n})=>{var r;try{t&&((r=G())==null||r.setItem(e,n))}catch(o){console.debug("[LocalStorage] SET error: ",o)}},z="builderVisitorId",Ae=({canTrack:e})=>{if(!e)return;const t=Ce({key:z,canTrack:e});if(p(t))return t;{const n=Te();return xe({id:n,canTrack:e}),n}},Te=()=>W(),xe=({id:e,canTrack:t})=>Oe({key:z,value:e,canTrack:t}),Re=async({canTrack:e})=>{if(!e)return{visitorId:void 0,sessionId:void 0};const t=await Ee({canTrack:e}),n=Ae({canTrack:e});return{sessionId:t,visitorId:n}},Be=async({type:e,canTrack:t,apiKey:n,metadata:r,...o})=>({type:e,data:{...o,metadata:{url:location.href,...r},...await Re({canTrack:t}),userAttributes:N(),ownerId:n}});async function J(e){if(!e.apiKey){d.error("Missing API key for track call. Please provide your API key.");return}if(e.canTrack&&!F()&&(c()||I==="reactNative"))return fetch("https://cdn.builder.io/api/v1/track",{method:"POST",body:JSON.stringify({events:[await Be(e)]}),headers:{"content-type":"application/json"},mode:"cors"}).catch(t=>{console.error("Failed to track: ",t)})}const Le=e=>J({...e,canTrack:!0}),Ve=["*.beta.builder.io","beta.builder.io","builder.io","localhost","qa.builder.io"];function H(e,t){if(!t.origin.startsWith("http")&&!t.origin.startsWith("https"))return!1;const n=new URL(t.origin),r=n.hostname;return(e||Ve).findIndex(o=>o.startsWith("*.")?r.endsWith(o.slice(1)):o===r)>-1}const Me="2.0.
|
|
1
|
+
"use strict";const I="react",b="[Builder.io]: ",d={log:(...e)=>console.log(b,...e),error:(...e)=>console.error(b,...e),warn:(...e)=>console.warn(b,...e),debug:(...e)=>console.debug(b,...e)};function c(){return typeof window!="undefined"&&typeof document!="undefined"}const ce=e=>{const t={};return e.forEach((n,r)=>{t[r]=n}),t},M=e=>e instanceof URLSearchParams?ce(e):e,U=e=>typeof e=="string"?e:e instanceof URLSearchParams?e.toString():new URLSearchParams(e).toString();function ue(){return c()&&window.self!==window.top}function F(e){return ue()&&U(e||window.location.search).indexOf("builder.frameEditing=")!==-1}const de=()=>{if(c()){const e=new URL(location.href);return e.pathname===""&&(e.pathname="/"),e}else return console.warn("Cannot get location for tracking in non-browser environment"),null},le=()=>typeof navigator=="object"&&navigator.userAgent||"",N=()=>{const e=le(),t={Android(){return e.match(/Android/i)},BlackBerry(){return e.match(/BlackBerry/i)},iOS(){return e.match(/iPhone|iPod/i)},Opera(){return e.match(/Opera Mini/i)},Windows(){return e.match(/IEMobile/i)||e.match(/WPDesktop/i)},any(){return t.Android()||t.BlackBerry()||t.iOS()||t.Opera()||t.Windows()||I==="reactNative"}},n=e.match(/Tablet|iPad/i),r=de();return{urlPath:r==null?void 0:r.pathname,host:(r==null?void 0:r.host)||(r==null?void 0:r.hostname),device:n?"tablet":t.any()?"mobile":"desktop"}},p=e=>e!=null;function fe(e){const t=e||(c()?window.location.search:void 0);return t?U(t).indexOf("builder.preview=")!==-1:!1}const ge=e=>({type:"builder.registerComponent",data:k(e)}),he=e=>{const t=e.toString().trim();return`return (${!t.startsWith("function")&&!t.startsWith("(")?"function ":""}${t}).apply(this, arguments)`};function k(e){return JSON.parse(JSON.stringify(e,(t,n)=>typeof n=="function"?he(n):n))}const x={};function D(e,t){e==="plugin"&&(t=k(t));let n=x[e];if(n||(n=x[e]=[]),n.push(t),c()){const r={type:"builder.register",data:{type:e,info:t}};try{parent.postMessage(r,"*"),parent!==window&&window.postMessage(r,"*")}catch(o){console.debug("Could not postmessage",o)}}}const R={};function pe(e){if(c()){Object.assign(R,e);const t={type:"builder.settingsChange",data:R};parent.postMessage(t,"*")}}const B="builder.",me="options.",P=e=>{if(!e)return{};const t=M(e),n={};return Object.keys(t).forEach(r=>{if(r.startsWith(B)){const o=r.replace(B,"").replace(me,"");n[o]=t[r]}}),n},ye=()=>{if(!c())return{};const e=new URLSearchParams(window.location.search);return P(e)},Se=e=>{if(e==="localhost"||e==="127.0.0.1")return e;const t=e.split(".");return t.length>2?t.slice(1).join("."):e},j=({name:e,canTrack:t})=>{var n;try{return t?(n=document.cookie.split("; ").find(r=>r.startsWith(`${e}=`)))==null?void 0:n.split("=")[1]:void 0}catch(r){d.warn("[COOKIE] GET error: ",(r==null?void 0:r.message)||r);return}},K=async e=>j(e),we=e=>e.map(([t,n])=>n?`${t}=${n}`:t).filter(p).join("; "),be=[["secure",""],["SameSite","None"]],Ie=({name:e,value:t,expires:n})=>{const o=(c()?location.protocol==="https:":!0)?be:[[]],s=n?[["expires",n.toUTCString()]]:[[]],a=[[e,t],...s,["path","/"],["domain",Se(window.location.hostname)],...o];return we(a)},_=async({name:e,value:t,expires:n,canTrack:r})=>{try{if(!r)return;const o=Ie({name:e,value:t,expires:n});document.cookie=o}catch(o){d.warn("[COOKIE] SET error: ",(o==null?void 0:o.message)||o)}};function ve(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const t=Math.random()*16|0;return(e=="x"?t:t&3|8).toString(16)})}function W(){return ve().replace(/-/g,"")}const $="builderSessionId",Ee=async({canTrack:e})=>{if(!e)return;const t=await K({name:$,canTrack:e});if(p(t))return t;{const n=ke();return Pe({id:n,canTrack:e}),n}},ke=()=>W(),Pe=({id:e,canTrack:t})=>_({name:$,value:e,canTrack:t}),G=()=>c()&&typeof localStorage!="undefined"?localStorage:void 0,Ce=({key:e,canTrack:t})=>{var n;try{return t?(n=G())==null?void 0:n.getItem(e):void 0}catch(r){console.debug("[LocalStorage] GET error: ",r);return}},Oe=({key:e,canTrack:t,value:n})=>{var r;try{t&&((r=G())==null||r.setItem(e,n))}catch(o){console.debug("[LocalStorage] SET error: ",o)}},z="builderVisitorId",Ae=({canTrack:e})=>{if(!e)return;const t=Ce({key:z,canTrack:e});if(p(t))return t;{const n=Te();return xe({id:n,canTrack:e}),n}},Te=()=>W(),xe=({id:e,canTrack:t})=>Oe({key:z,value:e,canTrack:t}),Re=async({canTrack:e})=>{if(!e)return{visitorId:void 0,sessionId:void 0};const t=await Ee({canTrack:e}),n=Ae({canTrack:e});return{sessionId:t,visitorId:n}},Be=async({type:e,canTrack:t,apiKey:n,metadata:r,...o})=>({type:e,data:{...o,metadata:{url:location.href,...r},...await Re({canTrack:t}),userAttributes:N(),ownerId:n}});async function J(e){if(!e.apiKey){d.error("Missing API key for track call. Please provide your API key.");return}if(e.canTrack&&!F()&&(c()||I==="reactNative"))return fetch("https://cdn.builder.io/api/v1/track",{method:"POST",body:JSON.stringify({events:[await Be(e)]}),headers:{"content-type":"application/json"},mode:"cors"}).catch(t=>{console.error("Failed to track: ",t)})}const Le=e=>J({...e,canTrack:!0}),Ve=["*.beta.builder.io","beta.builder.io","builder.io","localhost","qa.builder.io"];function H(e,t){if(!t.origin.startsWith("http")&&!t.origin.startsWith("https"))return!1;const n=new URL(t.origin),r=n.hostname;return(e||Ve).findIndex(o=>o.startsWith("*.")?r.endsWith(o.slice(1)):o===r)>-1}const Me="2.0.16",Ue=()=>{D("insertMenu",{name:"_default",default:!0,items:[{name:"Box"},{name:"Text"},{name:"Image"},{name:"Columns"},{name:"Core:Section"},{name:"Core:Button"},{name:"Embed"},{name:"Custom Code"}]})};let L=!1;const X=(e={})=>{var t,n;L||(L=!0,c()&&((t=window.parent)==null||t.postMessage({type:"builder.sdkInfo",data:{target:I,version:Me,supportsPatchUpdates:!1,supportsAddBlockScoping:!0,supportsCustomBreakpoints:!0}},"*"),(n=window.parent)==null||n.postMessage({type:"builder.updateContent",data:{options:e}},"*"),window.addEventListener("message",r=>{var s,a;if(!H(e.trustedHosts,r))return;const{data:o}=r;if(o!=null&&o.type)switch(o.type){case"builder.evaluate":{const l=o.data.text,y=o.data.arguments||[],m=o.data.id,v=new Function(l);let u,g=null;try{u=v.apply(null,y)}catch(h){g=h}g?(s=window.parent)==null||s.postMessage({type:"builder.evaluateError",data:{id:m,error:g.message}},"*"):u&&typeof u.then=="function"?u.then(h=>{var S;(S=window.parent)==null||S.postMessage({type:"builder.evaluateResult",data:{id:m,result:h}},"*")}).catch(console.error):(a=window.parent)==null||a.postMessage({type:"builder.evaluateResult",data:{result:u,id:m}},"*");break}}})))},q=({model:e,trustedHosts:t,callbacks:n})=>r=>{if(!H(t,r))return;const{data:o}=r;if(o)switch(o.type){case"builder.configureSdk":{n.configureSdk(o.data);break}case"builder.triggerAnimation":{n.animation(o.data);break}case"builder.contentUpdate":{const s=o.data,a=s.key||s.alias||s.entry||s.modelName,l=s.data;a===e&&n.contentUpdate(l);break}}},Fe=(e,t,n)=>{if(!c)return d.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."),()=>{};X();const r=q({callbacks:{contentUpdate:t,animation:()=>{},configureSdk:()=>{}},model:e,trustedHosts:n==null?void 0:n.trustedHosts});return window.addEventListener("message",r),()=>{window.removeEventListener("message",r)}},Ne="builder.tests",C=e=>`${Ne}.${e}`,De=({contentId:e})=>K({name:C(e),canTrack:!0}),je=({contentId:e})=>j({name:C(e),canTrack:!0}),Ke=({contentId:e,value:t})=>_({name:C(e),value:t,canTrack:!0}),Q=e=>p(e.id)&&p(e.variations)&&Object.keys(e.variations).length>0,_e=({id:e,variations:t})=>{var o;let n=0;const r=Math.random();for(const s in t){const a=(o=t[s])==null?void 0:o.testRatio;if(n+=a,r<n)return s}return e},Y=e=>{const t=_e(e);return Ke({contentId:e.id,value:t}).catch(n=>{d.error("could not store A/B test variation: ",n)}),t},Z=({item:e,testGroupId:t})=>{const n=e.variations[t];return t===e.id||!n?{testVariationId:e.id,testVariationName:"Default"}:{data:n.data,testVariationId:n.id,testVariationName:n.name||(n.id===e.id?"Default":"")}},We=({item:e,canTrack:t})=>{if(!t)return e;if(!e)return;if(!Q(e))return e;const n=je({contentId:e.id})||Y({variations:e.variations,id:e.id}),r=Z({item:e,testGroupId:n});return{...e,...r}},$e=async({item:e,canTrack:t})=>{if(!t||!Q(e))return e;const r=await De({contentId:e.id})||Y({variations:e.variations,id:e.id}),o=Z({item:e,testGroupId:r});return{...e,...o}},ee=e=>p(e)?e:!0;function Ge(){return typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:globalThis}function ze(){const e=Ge().fetch;if(typeof e=="undefined")throw console.warn(`Builder SDK could not find a global fetch function. Make sure you have a polyfill for fetch in your project.
|
|
2
2
|
For more information, read https://github.com/BuilderIO/this-package-uses-fetch`),new Error("Builder SDK could not find a global `fetch` function");return e}const te=ze();function E(e,t=null,n="."){return Object.keys(e).reduce((r,o)=>{const s=e[o],a=[t,o].filter(Boolean).join(n);return[typeof s=="object",s!==null,!(Array.isArray(s)&&s.length===0)].every(Boolean)?{...r,...E(s,a,n)}:{...r,[a]:s}},{})}function ne(e,t,n={}){for(const r in e){const o=e[r],s=t?t+"."+r:r;o&&typeof o=="object"&&!Array.isArray(o)&&!Object.keys(o).find(a=>a.startsWith("$"))?ne(o,s,n):n[s]=o}return n}const Je="v3",V=e=>typeof e=="number"&&!isNaN(e)&&e>=0,O=e=>{const{limit:t=30,userAttributes:n,query:r,model:o,apiKey:s,enrich:a,locale:l,apiVersion:y=Je,fields:m,omit:v,offset:u,cacheSeconds:g,staleCacheSeconds:h,sort:S,includeUnpublished:A}=e;if(!s)throw new Error("Missing API key");if(!["v3"].includes(y))throw new Error(`Invalid apiVersion: expected 'v3', received '${y}'`);const ie=t!==1,i=new URL(`https://cdn.builder.io/api/${y}/content/${o}`);if(i.searchParams.set("apiKey",s),i.searchParams.set("limit",String(t)),i.searchParams.set("noTraverse",String(ie)),i.searchParams.set("includeRefs",String(!0)),l&&i.searchParams.set("locale",l),a&&i.searchParams.set("enrich",String(a)),i.searchParams.set("omit",v||"meta.componentsUsed"),m&&i.searchParams.set("fields",m),Number.isFinite(u)&&u>-1&&i.searchParams.set("offset",String(Math.floor(u))),typeof A=="boolean"&&i.searchParams.set("includeUnpublished",String(A)),g&&V(g)&&i.searchParams.set("cacheSeconds",String(g)),h&&V(h)&&i.searchParams.set("staleCacheSeconds",String(h)),S){const f=E({sort:S});for(const w in f)i.searchParams.set(w,JSON.stringify(f[w]))}const ae={...ye(),...M(e.options||{})},T=E(ae);for(const f in T)i.searchParams.set(f,String(T[f]));if(n&&i.searchParams.set("userAttributes",JSON.stringify(n)),r){const f=ne({query:r});for(const w in f)i.searchParams.set(w,JSON.stringify(f[w]))}return i},He=e=>"results"in e;async function re(e){const t=await se({...e,limit:1});return t&&t[0]||null}const Xe=async e=>{var s;const t=O(e);return await(await((s=e.fetch)!=null?s:te)(t.href,e.fetchOptions)).json()},oe=async(e,t,n=O(e))=>{const r=ee(e.canTrack);if(n.search.includes("preview="),!r||!(c()||I==="reactNative"))return t.results;try{const o=[];for(const s of t.results)o.push(await $e({item:s,canTrack:r}));t.results=o}catch(o){d.error("Could not process A/B tests. ",o)}return t.results};async function se(e){try{const t=O(e),n=await Xe(e);return He(n)?oe(e,n):(d.error("Error fetching data. ",{url:t,content:n,options:e}),null)}catch(t){return d.error("Error fetching data. ",t),null}}const qe=async e=>{var r,o,s;const t=e.path||((r=e.url)==null?void 0:r.pathname)||((o=e.userAttributes)==null?void 0:o.urlPath),n={...e,apiKey:e.apiKey,model:e.model||"page",userAttributes:{...e.userAttributes,...t?{urlPath:t}:{}},options:P(e.searchParams||((s=e.url)==null?void 0:s.searchParams)||e.options)};return{apiKey:n.apiKey,model:n.model,content:await re(n)}};exports.MSG_PREFIX=b;exports.TARGET=I;exports._processContentResult=oe;exports._track=J;exports.checkIsDefined=p;exports.createEditorListener=q;exports.createRegisterComponentMessage=ge;exports.fetch=te;exports.fetchBuilderProps=qe;exports.fetchEntries=se;exports.fetchOneEntry=re;exports.getBuilderSearchParams=P;exports.getDefaultCanTrack=ee;exports.getUserAttributes=N;exports.handleABTestingSync=We;exports.isBrowser=c;exports.isEditing=F;exports.isPreviewing=fe;exports.logger=d;exports.register=D;exports.registerInsertMenu=Ue;exports.serializeIncludingFunctions=k;exports.setEditorSettings=pe;exports.setupBrowserForEditing=X;exports.subscribeToEditor=Fe;exports.track=Le;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./server-entry-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./server-entry-c1666709.cjs");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.setEditorSettings=e.setEditorSettings;exports.subscribeToEditor=e.subscribeToEditor;exports.track=e.track;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _processContentResult as r, createRegisterComponentMessage as s, fetchBuilderProps as i, fetchEntries as n, fetchOneEntry as o, getBuilderSearchParams as c, isEditing as g, isPreviewing as a, register as d, setEditorSettings as E, subscribeToEditor as f, track as h } from "./server-entry-
|
|
1
|
+
import { _processContentResult as r, createRegisterComponentMessage as s, fetchBuilderProps as i, fetchEntries as n, fetchOneEntry as o, getBuilderSearchParams as c, isEditing as g, isPreviewing as a, register as d, setEditorSettings as E, subscribeToEditor as f, track as h } from "./server-entry-1db0d96b.js";
|
|
2
2
|
export {
|
|
3
3
|
r as _processContentResult,
|
|
4
4
|
s as createRegisterComponentMessage,
|
package/lib/node/{node-runtime-e5a24b2b.js → should-force-browser-runtime-in-node-1188ea7b.js}
RENAMED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { isEditing, isBrowser, getUserAttributes, TARGET, logger, MSG_PREFIX } from "./server-entry-
|
|
1
|
+
import { isEditing, isBrowser, getUserAttributes, TARGET, logger, MSG_PREFIX, checkIsDefined } from "./server-entry-1db0d96b.js";
|
|
2
2
|
const getFunctionArguments = ({
|
|
3
3
|
builder: e,
|
|
4
4
|
context: t,
|
|
5
|
-
event:
|
|
6
|
-
state:
|
|
5
|
+
event: r,
|
|
6
|
+
state: o
|
|
7
7
|
}) => Object.entries({
|
|
8
|
-
state:
|
|
8
|
+
state: o,
|
|
9
9
|
Builder: e,
|
|
10
10
|
// legacy
|
|
11
11
|
builder: e,
|
|
12
12
|
context: t,
|
|
13
|
-
event:
|
|
13
|
+
event: r
|
|
14
14
|
}), getBuilderGlobals = () => ({
|
|
15
15
|
isEditing: isEditing(),
|
|
16
16
|
isBrowser: isBrowser(),
|
|
@@ -27,11 +27,11 @@ const getFunctionArguments = ({
|
|
|
27
27
|
default:
|
|
28
28
|
return TARGET;
|
|
29
29
|
}
|
|
30
|
-
})(), SDK_NAME = `@builder.io/sdk-${SDK_NAME_FOR_TARGET}`, fastClone = (e) => JSON.parse(JSON.stringify(e)), set = (e, t,
|
|
30
|
+
})(), SDK_NAME = `@builder.io/sdk-${SDK_NAME_FOR_TARGET}`, fastClone = (e) => JSON.parse(JSON.stringify(e)), set = (e, t, r) => {
|
|
31
31
|
if (Object(e) !== e)
|
|
32
32
|
return e;
|
|
33
|
-
const
|
|
34
|
-
return
|
|
33
|
+
const o = Array.isArray(t) ? t : t.toString().match(/[^.[\]]+/g);
|
|
34
|
+
return o.slice(0, -1).reduce((n, s, i) => Object(n[s]) === n[s] ? n[s] : n[s] = Math.abs(Number(o[i + 1])) >> 0 === +o[i + 1] ? [] : {}, e)[o[o.length - 1]] = r, e;
|
|
35
35
|
}, noop = () => {
|
|
36
36
|
};
|
|
37
37
|
let safeDynamicRequire = noop;
|
|
@@ -69,10 +69,10 @@ var refToProxy = (obj) => {
|
|
|
69
69
|
code: e,
|
|
70
70
|
args: t
|
|
71
71
|
}) => {
|
|
72
|
-
const
|
|
72
|
+
const r = t.map(([o]) => `var ${o} = refToProxy(${getSyncValName(o)}); `).join("");
|
|
73
73
|
return `
|
|
74
74
|
${REF_TO_PROXY_FN}
|
|
75
|
-
${
|
|
75
|
+
${r}
|
|
76
76
|
function theFunction() {
|
|
77
77
|
${e}
|
|
78
78
|
}
|
|
@@ -112,51 +112,64 @@ const setIvm = (e, t = {}) => {
|
|
|
112
112
|
function setIsolateContext(e = {
|
|
113
113
|
memoryLimit: 128
|
|
114
114
|
}) {
|
|
115
|
-
const t = getIvm(),
|
|
116
|
-
return
|
|
117
|
-
console.log(...
|
|
118
|
-
}),
|
|
115
|
+
const t = getIvm(), o = new t.Isolate(e).createContextSync(), n = o.global;
|
|
116
|
+
return n.setSync("global", n.derefInto()), n.setSync("log", function(...s) {
|
|
117
|
+
console.log(...s);
|
|
118
|
+
}), n.setSync(INJECTED_IVM_GLOBAL, t), IVM_CONTEXT = o, o;
|
|
119
119
|
}
|
|
120
120
|
const getIsolateContext = () => IVM_CONTEXT || setIsolateContext(), runInNode = ({
|
|
121
121
|
code: e,
|
|
122
122
|
builder: t,
|
|
123
|
-
context:
|
|
124
|
-
event:
|
|
125
|
-
localState:
|
|
126
|
-
rootSetState:
|
|
123
|
+
context: r,
|
|
124
|
+
event: o,
|
|
125
|
+
localState: n,
|
|
126
|
+
rootSetState: s,
|
|
127
127
|
rootState: i
|
|
128
128
|
}) => {
|
|
129
|
-
const
|
|
129
|
+
const E = getIvm(), N = fastClone({
|
|
130
130
|
...i,
|
|
131
|
-
...
|
|
132
|
-
}),
|
|
131
|
+
...n
|
|
132
|
+
}), a = getFunctionArguments({
|
|
133
133
|
builder: t,
|
|
134
|
-
context:
|
|
135
|
-
event:
|
|
136
|
-
state:
|
|
137
|
-
}),
|
|
138
|
-
|
|
139
|
-
set(i, c, u),
|
|
140
|
-
}),
|
|
141
|
-
const
|
|
134
|
+
context: r,
|
|
135
|
+
event: o,
|
|
136
|
+
state: N
|
|
137
|
+
}), l = getIsolateContext(), d = l.global;
|
|
138
|
+
d.setSync(BUILDER_SET_STATE_NAME, function(c, u) {
|
|
139
|
+
set(i, c, u), s == null || s(i);
|
|
140
|
+
}), a.forEach(([c, u]) => {
|
|
141
|
+
const f = typeof u == "object" ? new E.Reference(
|
|
142
142
|
// workaround: methods with default values for arguments is not being cloned over
|
|
143
143
|
c === "builder" ? {
|
|
144
144
|
...u,
|
|
145
145
|
getUserAttributes: () => u.getUserAttributes()
|
|
146
146
|
} : u
|
|
147
147
|
) : null;
|
|
148
|
-
|
|
148
|
+
d.setSync(getSyncValName(c), f);
|
|
149
149
|
});
|
|
150
|
-
const
|
|
150
|
+
const p = processCode({
|
|
151
151
|
code: e,
|
|
152
|
-
args:
|
|
153
|
-
}), I =
|
|
152
|
+
args: a
|
|
153
|
+
}), I = l.evalClosureSync(p);
|
|
154
154
|
try {
|
|
155
155
|
return JSON.parse(I);
|
|
156
156
|
} catch {
|
|
157
157
|
return I;
|
|
158
158
|
}
|
|
159
159
|
};
|
|
160
|
+
function isNodeRuntime() {
|
|
161
|
+
var e;
|
|
162
|
+
return typeof process != "undefined" && checkIsDefined((e = process == null ? void 0 : process.versions) == null ? void 0 : e.node);
|
|
163
|
+
}
|
|
164
|
+
const shouldForceBrowserRuntimeInNode = ({
|
|
165
|
+
shouldLogWarning: e
|
|
166
|
+
}) => {
|
|
167
|
+
var n;
|
|
168
|
+
if (!isNodeRuntime())
|
|
169
|
+
return !1;
|
|
170
|
+
const t = process.arch === "arm64", r = process.version.startsWith("v20"), o = (n = process.env.NODE_OPTIONS) == null ? void 0 : n.includes("--no-node-snapshot");
|
|
171
|
+
return t && r && !o ? (e && logger.log("Skipping usage of `isolated-vm` to avoid crashes in Node v20 on an arm64 machine.\n If you would like to use the `isolated-vm` package on this machine, please provide the `NODE_OPTIONS=--no-node-snapshot` config to your Node process.\n See https://github.com/BuilderIO/builder/blob/main/packages/sdks/README.md#node-v20--m1-macs-apple-silicon-support for more information.\n "), !0) : !1;
|
|
172
|
+
};
|
|
160
173
|
export {
|
|
161
174
|
fastClone,
|
|
162
175
|
getBuilderGlobals,
|
|
@@ -164,5 +177,6 @@ export {
|
|
|
164
177
|
parseCode,
|
|
165
178
|
runInNode,
|
|
166
179
|
set,
|
|
167
|
-
setIvm
|
|
180
|
+
setIvm,
|
|
181
|
+
shouldForceBrowserRuntimeInNode
|
|
168
182
|
};
|
package/lib/node/{node-runtime-9a8c1fa3.cjs → should-force-browser-runtime-in-node-37010e2f.cjs}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const serverEntry=require("./server-entry-
|
|
1
|
+
"use strict";const serverEntry=require("./server-entry-c1666709.cjs"),getFunctionArguments=({builder:e,context:t,event:o,state:r})=>Object.entries({state:r,Builder:e,builder:e,context:t,event:o}),getBuilderGlobals=()=>({isEditing:serverEntry.isEditing(),isBrowser:serverEntry.isBrowser(),isServer:!serverEntry.isBrowser(),getUserAttributes:()=>serverEntry.getUserAttributes()}),parseCode=(e,{isExpression:t=!0})=>t&&!(e.includes(";")||e.includes(" return ")||e.trim().startsWith("return "))?`return (${e});`:e,SDK_NAME_FOR_TARGET=(()=>{switch(serverEntry.TARGET){case"rsc":return"react-nextjs";case"reactNative":return"react-native";default:return serverEntry.TARGET}})(),SDK_NAME=`@builder.io/sdk-${SDK_NAME_FOR_TARGET}`,fastClone=e=>JSON.parse(JSON.stringify(e)),set=(e,t,o)=>{if(Object(e)!==e)return e;const r=Array.isArray(t)?t:t.toString().match(/[^.[\]]+/g);return r.slice(0,-1).reduce((n,s,i)=>Object(n[s])===n[s]?n[s]:n[s]=Math.abs(Number(r[i+1]))>>0===+r[i+1]?[]:{},e)[r[r.length-1]]=o,e},noop=()=>{};let safeDynamicRequire=noop;try{safeDynamicRequire=eval("require")}catch(e){}const getSyncValName=e=>`bldr_${e}_sync`,BUILDER_SET_STATE_NAME="BUILDER_SET_STATE",INJECTED_IVM_GLOBAL="BUILDER_IVM",REF_TO_PROXY_FN=`
|
|
2
2
|
var refToProxy = (obj) => {
|
|
3
3
|
if (typeof obj !== 'object' || obj === null) {
|
|
4
4
|
return obj;
|
|
@@ -24,9 +24,9 @@ var refToProxy = (obj) => {
|
|
|
24
24
|
}
|
|
25
25
|
})
|
|
26
26
|
}
|
|
27
|
-
`,processCode=({code:e,args:t})=>{const
|
|
27
|
+
`,processCode=({code:e,args:t})=>{const o=t.map(([r])=>`var ${r} = refToProxy(${getSyncValName(r)}); `).join("");return`
|
|
28
28
|
${REF_TO_PROXY_FN}
|
|
29
|
-
${
|
|
29
|
+
${o}
|
|
30
30
|
function theFunction() {
|
|
31
31
|
${e}
|
|
32
32
|
}
|
|
@@ -45,4 +45,4 @@ if (typeof output === 'object' && output !== null) {
|
|
|
45
45
|
${SHOULD_MENTION_INITIALIZE_SCRIPT?`- import and call \`initializeNodeRuntime()\` from "${SDK_NAME}/node/init".`:""}
|
|
46
46
|
- add the following import: \`await import('isolated-vm')\`.
|
|
47
47
|
|
|
48
|
-
For more information, visit https://builder.io/c/docs/integration-tips#enabling-data-bindings-in-node-environments`;throw new Error(e)};function setIsolateContext(e={memoryLimit:128}){const t=getIvm(),r=new t.Isolate(e).createContextSync(),n=r.global;return n.setSync("global",n.derefInto()),n.setSync("log",function(...
|
|
48
|
+
For more information, visit https://builder.io/c/docs/integration-tips#enabling-data-bindings-in-node-environments`;throw new Error(e)};function setIsolateContext(e={memoryLimit:128}){const t=getIvm(),r=new t.Isolate(e).createContextSync(),n=r.global;return n.setSync("global",n.derefInto()),n.setSync("log",function(...s){console.log(...s)}),n.setSync(INJECTED_IVM_GLOBAL,t),IVM_CONTEXT=r,r}const getIsolateContext=()=>IVM_CONTEXT||setIsolateContext(),runInNode=({code:e,builder:t,context:o,event:r,localState:n,rootSetState:s,rootState:i})=>{const y=getIvm(),p=fastClone({...i,...n}),a=getFunctionArguments({builder:t,context:o,event:r,state:p}),l=getIsolateContext(),d=l.global;d.setSync(BUILDER_SET_STATE_NAME,function(c,u){set(i,c,u),s==null||s(i)}),a.forEach(([c,u])=>{const N=typeof u=="object"?new y.Reference(c==="builder"?{...u,getUserAttributes:()=>u.getUserAttributes()}:u):null;d.setSync(getSyncValName(c),N)});const I=processCode({code:e,args:a}),E=l.evalClosureSync(I);try{return JSON.parse(E)}catch{return E}};function isNodeRuntime(){var e;return typeof process!="undefined"&&serverEntry.checkIsDefined((e=process==null?void 0:process.versions)==null?void 0:e.node)}const shouldForceBrowserRuntimeInNode=({shouldLogWarning:e})=>{var n;if(!isNodeRuntime())return!1;const t=process.arch==="arm64",o=process.version.startsWith("v20"),r=(n=process.env.NODE_OPTIONS)==null?void 0:n.includes("--no-node-snapshot");return t&&o&&!r?(e&&serverEntry.logger.log("Skipping usage of `isolated-vm` to avoid crashes in Node v20 on an arm64 machine.\n If you would like to use the `isolated-vm` package on this machine, please provide the `NODE_OPTIONS=--no-node-snapshot` config to your Node process.\n See https://github.com/BuilderIO/builder/blob/main/packages/sdks/README.md#node-v20--m1-macs-apple-silicon-support for more information.\n "),!0):!1};exports.fastClone=fastClone;exports.getBuilderGlobals=getBuilderGlobals;exports.getFunctionArguments=getFunctionArguments;exports.parseCode=parseCode;exports.runInNode=runInNode;exports.set=set;exports.setIvm=setIvm;exports.shouldForceBrowserRuntimeInNode=shouldForceBrowserRuntimeInNode;
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.0.
|
|
1
|
+
export declare const SDK_VERSION = "2.0.16";
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),o=require("react"),s=require("./blocks-f9516def.cjs"),p=require("./dynamic-renderer-b29b45ca.cjs"),q=require("./get-class-prop-name-3fcaaa4e.cjs");require("./blocks-exports.cjs");require("./server-entry-c0a129cd.cjs");require("./evaluate-b34c0621.cjs");const B=t=>`builder-columns ${t}-breakpoints`;function z(t){var f,g;const[u,A]=o.useState(()=>typeof t.space=="number"?t.space||0:20),[c,L]=o.useState(()=>t.columns||[]),[d,N]=o.useState(()=>t.stackColumnsAt||"tablet");function y(e){return e.link?t.builderLinkComponent||"a":"div"}function x(e){var n;return((n=c[e])==null?void 0:n.width)||100/c.length}function C(e){const n=x(e),i=u*(c.length-1)*(n/100);return`calc(${n}% - ${i}px)`}function a({stackedStyle:e,desktopStyle:n}){return d==="tablet"?e:n}function m({stackedStyle:e,desktopStyle:n}){return d==="never"?n:e}const[b,W]=o.useState(()=>t.stackColumnsAt==="never"?"row":t.reverseColumnsWhenStacked?"column-reverse":"column");function v(){return{"--flex-dir":b,"--flex-dir-tablet":a({stackedStyle:b,desktopStyle:"row"})}}function w(e){const n=e===0?0:u,i=C(e),r=`${n}px`,h="100%",S=0;return{...{display:"flex",flexDirection:"column",alignItems:"stretch"},width:i,["marginLeft"]:r,"--column-width-mobile":m({stackedStyle:h,desktopStyle:i}),"--column-margin-left-mobile":m({stackedStyle:S,desktopStyle:r}),"--column-width-tablet":a({stackedStyle:h,desktopStyle:i}),"--column-margin-left-tablet":a({stackedStyle:S,desktopStyle:r})}}function k(e){var i,r;return s.getSizesForBreakpoints(((r=(i=t.builderContext.content)==null?void 0:i.meta)==null?void 0:r.breakpoints)||{})[e].max}function $(){const e=`.${t.builderBlock.id}-breakpoints > .builder-column`;return`
|
|
2
|
-
@media (max-width: ${k("medium")}px) {
|
|
3
|
-
.${t.builderBlock.id}-breakpoints {
|
|
4
|
-
flex-direction: var(--flex-dir-tablet);
|
|
5
|
-
align-items: stretch;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
${e} {
|
|
9
|
-
width: var(--column-width-tablet) !important;
|
|
10
|
-
margin-left: var(--column-margin-left-tablet) !important;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
@media (max-width: ${k("small")}px) {
|
|
15
|
-
.${t.builderBlock.id}-breakpoints {
|
|
16
|
-
flex-direction: var(--flex-dir);
|
|
17
|
-
align-items: stretch;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
${e} {
|
|
21
|
-
width: var(--column-width-mobile) !important;
|
|
22
|
-
margin-left: var(--column-margin-left-mobile) !important;
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
`}function j(e,n){return{...e.link?{href:e.link}:{},[q.getClassPropName()]:"builder-column",style:s.mapStyleObjToStrIfNeeded(w(n))}}return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:B((f=t.builderBlock)==null?void 0:f.id)+" div-34f576bb",style:v(),children:[l.jsx(s.InlinedStyles,{id:"builderio-columns",styles:$(),nonce:t.builderContext.nonce}),(g=t.columns)==null?void 0:g.map((e,n)=>l.jsx(p.DynamicRenderer,{TagName:y(e),actionAttributes:{},attributes:j(e,n),children:l.jsx(s.Blocks,{path:`component.options.columns.${n}.blocks`,parent:t.builderBlock.id,styleProp:{flexGrow:"1"},context:t.builderContext,registeredComponents:t.builderComponents,linkComponent:t.builderLinkComponent,blocks:e.blocks})},n))]}),l.jsx("style",{children:`.div-34f576bb {
|
|
26
|
-
display: flex;
|
|
27
|
-
line-height: normal;
|
|
28
|
-
}`})]})}exports.default=z;
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("react/jsx-runtime"),r=require("react"),s=require("./server-entry-c0a129cd.cjs"),k=require("./blocks-exports.cjs"),E=require("./blocks-f9516def.cjs"),z=require("./evaluate-b34c0621.cjs");require("./get-class-prop-name-3fcaaa4e.cjs");require("./dynamic-renderer-b29b45ca.cjs");const A={"@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!"}}}]},B={"@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!"}}}]},Z={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:[A]},{name:"detail",type:"uiBlocks",hideFromUI:!0,defaultValue:[B]}],defaultValue:[{title:[A],detail:[B]},{title:[A],detail:[B]}],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}},ee=r.lazy(()=>Promise.resolve().then(()=>require("./accordion-9d6ead4a.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}},ne={name:"Columns",isRSC:!0,inputs:[{name:"columns",type:"array",broadcast:!0,subFields:[{name:"blocks",type:"array",hideFromUI:!0,defaultValue:[{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto",minHeight:"20px",minWidth:"20px",overflow:"hidden"}},component:{name:"Image",options:{image:"https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",backgroundPosition:"center",backgroundSize:"cover",aspectRatio:.7004048582995948}}},{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto"}},component:{name:"Text",options:{text:"<p>Enter some text...</p>"}}}]},{name:"width",type:"number",hideFromUI:!0,helperText:"Width %, e.g. set to 50 to fill half of the space"},{name:"link",type:"url",helperText:"Optionally set a url that clicking this column will link to"}],defaultValue:[{blocks:[{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto",minHeight:"20px",minWidth:"20px",overflow:"hidden"}},component:{name:"Image",options:{image:"https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",backgroundPosition:"center",backgroundSize:"cover",aspectRatio:.7004048582995948}}},{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto"}},component:{name:"Text",options:{text:"<p>Enter some text...</p>"}}}]},{blocks:[{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto",minHeight:"20px",minWidth:"20px",overflow:"hidden"}},component:{name:"Image",options:{image:"https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",backgroundPosition:"center",backgroundSize:"cover",aspectRatio:.7004048582995948}}},{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto"}},component:{name:"Text",options:{text:"<p>Enter some text...</p>"}}}]}],onChange:e=>{function t(){n.forEach(i=>{i.delete("width")})}const n=e.get("columns");Array.isArray(n)&&n.find(c=>c.get("width"))&&(n.find(g=>!g.get("width"))||n.reduce((o,f)=>o+f.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}},ae={name:"Fragment",static:!0,hidden:!0,canHaveChildren:!0,noWrap:!0},ie={name:"Image",static:!0,image:"https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4",defaultStyles:{position:"relative",minHeight:"20px",minWidth:"20px",overflow:"hidden"},canHaveChildren:!0,inputs:[{name:"image",type:"file",bubble:!0,allowedFileTypes:["jpeg","jpg","png","svg","webp"],required:!0,defaultValue:"https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a",onChange:e=>{e.delete("srcset"),e.delete("noWebp");function n(a,o=6e4){return new Promise((f,y)=>{const C=document.createElement("img");let T=!1;C.onload=()=>{T=!0,f(C)},C.addEventListener("error",V=>{console.warn("Image load failed",V.error),y(V.error)}),C.src=a,setTimeout(()=>{T||y(new Error("Image load timed out"))},o)})}function i(a){return Math.round(a*1e3)/1e3}const c=e.get("image"),g=e.get("aspectRatio");if(fetch(c).then(a=>a.blob()).then(a=>{a.type.includes("svg")&&e.set("noWebp",!0)}),c&&(!g||g===.7041))return n(c).then(a=>{const o=e.get("aspectRatio");e.get("image")===c&&(!o||o===.7041)&&a.width&&a.height&&(e.set("aspectRatio",i(a.height/a.width)),e.set("height",a.height),e.set("width",a.width))})}},{name:"backgroundSize",type:"text",defaultValue:"cover",enum:[{label:"contain",value:"contain",helperText:"The image should never get cropped"},{label:"cover",value:"cover",helperText:"The image should fill it's box, cropping when needed"}]},{name:"backgroundPosition",type:"text",defaultValue:"center",enum:["center","top","left","right","bottom","top left","top right","bottom left","bottom right"]},{name:"altText",type:"string",helperText:"Text to display when the user has images off"},{name:"height",type:"number",hideFromUI:!0},{name:"width",type:"number",hideFromUI:!0},{name:"sizes",type:"string",hideFromUI:!0},{name:"srcset",type:"string",hideFromUI:!0},{name:"lazy",type:"boolean",defaultValue:!0,hideFromUI:!0},{name:"fitContent",type:"boolean",helperText:"When child blocks are provided, fit to them instead of using the image's aspect ratio",defaultValue:!0},{name:"highPriority",type:"boolean",advanced:!0,helperText:"Mark this image as high priority compared to other images on the page. This prevents lazy loading of the image and tells the browser to load this image before others on the page."},{name:"aspectRatio",type:"number",helperText:"This is the ratio of height/width, e.g. set to 1.5 for a 300px wide and 200px tall photo. Set to 0 to not force the image to maintain it's aspect ratio",advanced:!0,defaultValue:.7041}],shouldReceiveBuilderProps:{builderBlock:!0}},oe={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>"}}}]},re={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}},le=r.lazy(()=>Promise.resolve().then(()=>require("./slot-7c52b924.cjs"))),se={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}},q={"@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"}}},D={"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{height:"200px",display:"flex",marginTop:"20px",flexDirection:"column"}},component:{name:"Text",options:{text:"New tab content "}}},de={name:"Builder: Tabs",inputs:[{name:"tabs",type:"list",broadcast:!0,subFields:[{name:"label",type:"uiBlocks",hideFromUI:!0,defaultValue:[q]},{name:"content",type:"uiBlocks",hideFromUI:!0,defaultValue:[D]}],defaultValue:[{label:[{...q,component:{name:"Text",options:{text:"Tab 1"}}}],content:[{...D,component:{name:"Text",options:{text:"Tab 1 content"}}}]},{label:[{...q,component:{name:"Text",options:{text:"Tab 2"}}}],content:[{...D,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}},ue=r.lazy(()=>Promise.resolve().then(()=>require("./tabs-238833b0.cjs"))),ce={shouldReceiveBuilderProps:{builderBlock:!1,builderContext:!0},name:"Text",static:!0,isRSC:!0,image:"https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-text_fields-24px%20(1).svg?alt=media&token=12177b73-0ee3-42ca-98c6-0dd003de1929",inputs:[{name:"text",type:"html",required:!0,autoFocus:!0,bubble:!0,defaultValue:"Enter some text..."}],defaultStyles:{lineHeight:"normal",height:"auto",textAlign:"center"}},me={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}]},pe=r.lazy(()=>Promise.resolve().then(()=>require("./custom-code-6d9730ff.cjs"))),ge={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}]},fe=r.lazy(()=>Promise.resolve().then(()=>require("./embed-32bdd007.cjs"))),he={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}},be=r.lazy(()=>Promise.resolve().then(()=>require("./form-2490bc65.cjs"))),xe={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"}},ye=r.lazy(()=>Promise.resolve().then(()=>require("./input-4018ed38.cjs"))),ve={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},Se=r.lazy(()=>Promise.resolve().then(()=>require("./select-b5257730.cjs"))),Te={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},ke=r.lazy(()=>Promise.resolve().then(()=>require("./submit-button-b363e0ed.cjs"))),Ce={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},Ie=r.lazy(()=>Promise.resolve().then(()=>require("./textarea-56a875bc.cjs"))),we={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},Ve=r.lazy(()=>Promise.resolve().then(()=>require("./img-5481830d.cjs"))),Re={name:"Video",canHaveChildren:!0,defaultStyles:{minHeight:"20px",minWidth:"20px"},image:"https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-videocam-24px%20(1).svg?alt=media&token=49a84e4a-b20e-4977-a650-047f986874bb",inputs:[{name:"video",type:"file",allowedFileTypes:["mp4"],bubble:!0,defaultValue:"https://cdn.builder.io/o/assets%2FYJIGb4i01jvw0SRdL5Bt%2Fd27731a526464deba0016216f5f9e570%2Fcompressed?apiKey=YJIGb4i01jvw0SRdL5Bt&token=d27731a526464deba0016216f5f9e570&alt=media&optimized=true",required:!0},{name:"posterImage",type:"file",allowedFileTypes:["jpeg","png"],helperText:"Image to show before the video plays"},{name:"autoPlay",type:"boolean",defaultValue:!0},{name:"controls",type:"boolean",defaultValue:!1},{name:"muted",type:"boolean",defaultValue:!0},{name:"loop",type:"boolean",defaultValue:!0},{name:"playsInline",type:"boolean",defaultValue:!0},{name:"fit",type:"text",defaultValue:"cover",enum:["contain","cover","fill","auto"]},{name:"preload",type:"text",defaultValue:"metadata",enum:["auto","metadata","none"]},{name:"fitContent",type:"boolean",helperText:"When child blocks are provided, fit to them instead of using the aspect ratio",defaultValue:!0,advanced:!0},{name:"position",type:"text",defaultValue:"center",enum:["center","top","left","right","bottom","top left","top right","bottom left","bottom right"]},{name:"height",type:"number",advanced:!0},{name:"width",type:"number",advanced:!0},{name:"aspectRatio",type:"number",advanced:!0,defaultValue:.7004048582995948},{name:"lazyLoad",type:"boolean",helperText:'Load this video "lazily" - as in only when a user scrolls near the video. Recommended for optmized performance and bandwidth consumption',defaultValue:!0,advanced:!0}],shouldReceiveBuilderProps:{builderBlock:!0}},Ee=()=>[{component:pe,...me},{component:fe,...ge},{component:be,...he},{component:ye,...xe},{component:ke,...Te},{component:Se,...ve},{component:Ie,...Ce},{component:Ve,...we},{component:k.Video,...Re}],M=()=>[{component:k.Button,...te},{component:k.Columns,...ne},{component:k.Fragment,...ae},{component:k.Image,...ie},{component:k.Section,...oe},{component:le,...re},{component:k.Symbol,...se},{component:k.Text,...ce},{component:ue,...de},{component:ee,...Z},...Ee()],Fe=`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
|
-
}`,Pe=`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
|
-
}`,Y="builderIoAbTest",G="builderIoRenderContent",W=e=>Object.values((e==null?void 0:e.variations)||{}).map(t=>({...t,testVariationId:t.id,id:e==null?void 0:e.id})),We=({canTrack:e,content:t})=>!(!(W(t).length>0)||!e||s.isBrowser()),Ae=e=>e==="react"||e==="reactNative",Q=Ae(s.TARGET),Be=()=>`
|
|
92
|
-
window.${Y} = ${Fe}
|
|
93
|
-
window.${G} = ${Pe}
|
|
94
|
-
`,qe=(e,t)=>`
|
|
95
|
-
window.${Y}(
|
|
96
|
-
"${t}",${JSON.stringify(e)}, ${Q}
|
|
97
|
-
)`,De=({contentId:e,variationId:t})=>`window.${G}(
|
|
98
|
-
"${t}", "${e}", ${Q}
|
|
99
|
-
)`;function j(e){return b.jsx("script",{dangerouslySetInnerHTML:{__html:e.scriptStr},"data-id":e.id,nonce:e.nonce||""})}function O(e){return Math.round(e*1e3)/1e3}const je=(e,t,n=!0)=>{if(!(e instanceof HTMLElement))return null;let i=n?e:e.parentElement;do{if(!i)return null;if(t(i))return i}while(i=i.parentElement);return null},Ue=e=>je(e,t=>{const n=t.getAttribute("builder-id")||t.id;return(n==null?void 0:n.indexOf("builder-"))===0}),_=({event:e,target:t})=>{const n=t.getBoundingClientRect(),i=e.clientX-n.left,c=e.clientY-n.top,g=O(i/n.width),a=O(c/n.height);return{x:g,y:a}},Le=e=>{const t=e.target,n=t&&Ue(t),i=(n==null?void 0:n.getAttribute("builder-id"))||(n==null?void 0:n.id);return{targetBuilderElement:i||void 0,metadata:{targetOffset:t?_({event:e,target:t}):void 0,builderTargetOffset:n?_({event:e,target:n}):void 0,builderElementIndex:n&&i?[].slice.call(document.getElementsByClassName(i)).indexOf(n):void 0}}},He=e=>{var g,a;const t=e.family+(e.kind&&!e.kind.includes("#")?", "+e.kind:""),n=t.split(",")[0],i=(a=e.fileUrl)!=null?a:(g=e==null?void 0:e.files)==null?void 0:g.regular;let c="";if(i&&t&&n&&(c+=`
|
|
100
|
-
@font-face {
|
|
101
|
-
font-family: "${t}";
|
|
102
|
-
src: local("${n}"), url('${i}') format('woff2');
|
|
103
|
-
font-display: fallback;
|
|
104
|
-
font-weight: 400;
|
|
105
|
-
}
|
|
106
|
-
`.trim()),e.files)for(const o in e.files){if(!(String(Number(o))===o))continue;const y=e.files[o];y&&y!==i&&(c+=`
|
|
107
|
-
@font-face {
|
|
108
|
-
font-family: "${t}";
|
|
109
|
-
src: url('${y}') format('woff2');
|
|
110
|
-
font-display: fallback;
|
|
111
|
-
font-weight: ${o};
|
|
112
|
-
}
|
|
113
|
-
`.trim())}return c},$e=({customFonts:e})=>{var t;return((t=e==null?void 0:e.map(n=>He(n)))==null?void 0:t.join(" "))||""},Ne=({cssCode:e,contentId:t})=>e?t?(e==null?void 0:e.replace(/&/g,`div[builder-content-id="${t}"]`))||"":e:"",Ke=`
|
|
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
|
-
`,ze=e=>e?"":Ke,Me=e=>`variant-${e}`;function Oe(e){var I,U,L,H,$,N,K;const t=r.useRef(null);function n(l){var h,u;const m={...e.builderContextSignal.rootState,...l};e.builderContextSignal.rootSetState?(u=(h=e.builderContextSignal).rootSetState)==null||u.call(h,m):e.setBuilderContextSignal(d=>({...d,rootState:m}))}function i(l){var h,u,d,x,R;const m={...e.builderContextSignal.content,...l,data:{...(h=e.builderContextSignal.content)==null?void 0:h.data,...l==null?void 0:l.data},meta:{...(u=e.builderContextSignal.content)==null?void 0:u.meta,...l==null?void 0:l.meta,breakpoints:((d=l==null?void 0:l.meta)==null?void 0:d.breakpoints)||((R=(x=e.builderContextSignal.content)==null?void 0:x.meta)==null?void 0:R.breakpoints)}};e.setBuilderContextSignal(S=>({...S,content:m}))}function c(){return e.showContent?{}:{hidden:!0,"aria-hidden":!0}}const[g,a]=r.useState(()=>e.contentWrapper||"div");function o(l){return s.createEditorListener({model:e.model,trustedHosts:e.trustedHosts,callbacks:{configureSdk:m=>{var d;const{breakpoints:h,contentId:u}=m;!u||u!==((d=e.builderContextSignal.content)==null?void 0:d.id)||h&&i({meta:{breakpoints:h}})},animation:m=>{E.triggerAnimation(m)},contentUpdate:m=>{i(m)}}})(l)}function f(){var m,h;const l=(h=(m=e.builderContextSignal.content)==null?void 0:m.data)==null?void 0:h.jsCode;l&&z.evaluate({code:l,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState,enableCache:!1})}const[y,C]=r.useState(()=>({})),[T,V]=r.useState(()=>({})),[F,P]=r.useState(()=>!1);function v(l){var m,h;if(e.builderContextSignal.content){const u=(m=e.builderContextSignal.content)==null?void 0:m.testVariationId,d=(h=e.builderContextSignal.content)==null?void 0:h.id;s._track({type:"click",canTrack:s.getDefaultCanTrack(e.canTrack),contentId:d,apiKey:e.apiKey,variationId:u!==d?u:void 0,...Le(l),unique:!F})}F||P(!0)}function p(){var m,h,u;const l=(u=(h=(m=e.builderContextSignal.content)==null?void 0:m.data)==null?void 0:h.httpRequests)!=null?u:{};Object.entries(l).forEach(([d,x])=>{if(!x||T[d]||y[d]&&!s.isEditing())return;T[d]=!0;const R=x.replace(/{{([^}]+)}}/g,(S,X)=>String(z.evaluate({code:X,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState,enableCache:!0})));s.fetch(R).then(S=>S.json()).then(S=>{n({[d]:S}),y[d]=!0}).catch(S=>{console.error("error fetching dynamic data",x,S)}).finally(()=>{T[d]=!1})})}function w(){s.isEditing()&&window.dispatchEvent(new CustomEvent("builder:component:stateChange",{detail:{state:E.fastClone(e.builderContextSignal.rootState),ref:{name:e.model}}}))}return r.useEffect(()=>{var l,m;if(s.isBrowser()){if(s.isEditing()&&(window.addEventListener("message",o),s.registerInsertMenu(),s.setupBrowserForEditing({...e.locale?{locale:e.locale}:{},...e.enrich?{enrich:e.enrich}:{},...e.trustedHosts?{trustedHosts:e.trustedHosts}:{}}),Object.values(e.builderContextSignal.componentInfos).forEach(u=>{var x;const d=s.createRegisterComponentMessage(u);(x=window.parent)==null||x.postMessage(d,"*")}),window.addEventListener("builder:component:stateChangeListenerActivated",w)),e.builderContextSignal.content&&s.getDefaultCanTrack(e.canTrack)){const u=(l=e.builderContextSignal.content)==null?void 0:l.testVariationId,d=(m=e.builderContextSignal.content)==null?void 0:m.id,x=e.apiKey;s._track({type:"impression",canTrack:!0,contentId:d,apiKey:x,variationId:u!==d?u:void 0})}if(s.isPreviewing()&&!s.isEditing()){const u=new URL(location.href).searchParams,d=u.get("builder.preview"),x=u.get(`builder.overrides.${d}`),R=u.get("apiKey")||u.get("builder.space");d===e.model&&R===e.apiKey&&(!e.content||x===e.content.id)&&s.fetchOneEntry({model:e.model,apiKey:e.apiKey,apiVersion:e.builderContextSignal.apiVersion}).then(S=>{S&&i(S)})}}},[]),r.useEffect(()=>{e.apiKey||s.logger.error("No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop."),f(),p(),w()},[]),r.useEffect(()=>{e.content&&i(e.content)},[e.content]),r.useEffect(()=>{f()},[(U=(I=e.builderContextSignal.content)==null?void 0:I.data)==null?void 0:U.jsCode]),r.useEffect(()=>{p()},[(H=(L=e.builderContextSignal.content)==null?void 0:L.data)==null?void 0:H.httpRequests]),r.useEffect(()=>{w()},[e.builderContextSignal.rootState]),r.useEffect(()=>{e.data&&n(e.data)},[e.data]),r.useEffect(()=>{e.locale&&n({locale:e.locale})},[e.locale]),r.useEffect(()=>()=>{s.isBrowser()&&(window.removeEventListener("message",o),window.removeEventListener("builder:component:stateChangeListenerActivated",w))},[]),b.jsx(k.BuilderContext.Provider,{value:e.builderContextSignal,children:e.builderContextSignal.content?b.jsx(g,{ref:t,onClick:l=>v(l),"builder-content-id":($=e.builderContextSignal.content)==null?void 0:$.id,"builder-model":e.model,...c(),...e.contentWrapperProps,className:Me(((N=e.content)==null?void 0:N.testVariationId)||((K=e.content)==null?void 0:K.id)),children:e.children}):null})}function _e(e){const[t,n]=r.useState(()=>`
|
|
131
|
-
${Ne({cssCode:e.cssCode,contentId:e.contentId})}
|
|
132
|
-
${$e({customFonts:e.customFonts})}
|
|
133
|
-
${ze(e.isNestedRender)}
|
|
134
|
-
`.trim());return b.jsx(E.InlinedStyles,{id:"builderio-content",styles:t,nonce:e.nonce})}const Je=({content:e,data:t,locale:n})=>{var g,a,o;const i={},c=((g=e==null?void 0:e.data)==null?void 0:g.state)||{};return(o=(a=e==null?void 0:e.data)==null?void 0:a.inputs)==null||o.forEach(f=>{f.name&&f.defaultValue!==void 0&&(i[f.name]=f.defaultValue)}),{...i,...c,...t,...n?{locale:n}:{}}},Ye=({content:e,data:t})=>e?{...e,data:{...e==null?void 0:e.data,...t},meta:e==null?void 0:e.meta}:void 0;function J(e){var f,y,C,T,V,F,P;const[t,n]=r.useState(()=>{var v,p;return De({variationId:(v=e.content)==null?void 0:v.testVariationId,contentId:(p=e.content)==null?void 0:p.id})});function i(v){o(p=>({...p,rootState:v}))}const[c,g]=r.useState(()=>{var v;return[...M(),...((v=e.customComponents)==null?void 0:v.filter(({models:p})=>!(p!=null&&p.length)||!e.model?!0:p.includes(e.model)))||[]].reduce((p,{component:w,...I})=>({...p,[I.name]:{component:w,...s.serializeIncludingFunctions(I)}}),{})}),[a,o]=r.useState(()=>{var v;return{content:Ye({content:e.content,data:e.data}),localState:void 0,rootState:Je({content:e.content,data:e.data,locale:e.locale}),rootSetState:i,context:e.context||{},canTrack:e.canTrack,apiKey:e.apiKey,apiVersion:e.apiVersion,componentInfos:[...M(),...((v=e.customComponents)==null?void 0:v.filter(({models:p})=>!(p!=null&&p.length)||!e.model?!0:p.includes(e.model)))||[]].reduce((p,{component:w,...I})=>({...p,[I.name]:s.serializeIncludingFunctions(I)}),{}),inheritedStyles:{},BlocksWrapper:e.blocksWrapper||"div",BlocksWrapperProps:e.blocksWrapperProps||{},nonce:e.nonce||""}});return b.jsx(E.ComponentsContext.Provider,{value:{registeredComponents:c},children:b.jsxs(Oe,{nonce:e.nonce,content:e.content,data:e.data,model:e.model,context:e.context,apiKey:e.apiKey,canTrack:e.canTrack,locale:e.locale,enrich:e.enrich,showContent:e.showContent,builderContextSignal:a,contentWrapper:e.contentWrapper,contentWrapperProps:e.contentWrapperProps,trustedHosts:e.trustedHosts,setBuilderContextSignal:o,children:[e.isSsrAbTest?b.jsx(j,{id:"builderio-variant-visibility",scriptStr:t,nonce:e.nonce||""}):null,b.jsx(_e,{nonce:e.nonce||"",isNestedRender:e.isNestedRender,contentId:(f=a.content)==null?void 0:f.id,cssCode:(C=(y=a.content)==null?void 0:y.data)==null?void 0:C.cssCode,customFonts:(V=(T=a.content)==null?void 0:T.data)==null?void 0:V.customFonts}),b.jsx(E.Blocks,{blocks:(P=(F=a.content)==null?void 0:F.data)==null?void 0:P.blocks,context:a,registeredComponents:c,linkComponent:e.linkComponent})]})})}function Ge(e){var a;const[t,n]=r.useState(()=>We({canTrack:s.getDefaultCanTrack(e.canTrack),content:e.content}));function i(){var o;return qe(W(e.content).map(f=>({id:f.testVariationId,testRatio:f.testRatio})),((o=e.content)==null?void 0:o.id)||"")}function c(){return W(e.content).map(o=>`.variant-${o.testVariationId} { display: none; } `).join("")}function g(){var o;return t?{...e.content,testVariationId:(o=e.content)==null?void 0:o.id}:s.handleABTestingSync({item:e.content,canTrack:s.getDefaultCanTrack(e.canTrack)})}return r.useEffect(()=>{},[]),b.jsxs(b.Fragment,{children:[!e.isNestedRender&&s.TARGET!=="reactNative"?b.jsx(j,{id:"builderio-init-variants-fns",scriptStr:Be(),nonce:e.nonce||""}):null,t?b.jsxs(b.Fragment,{children:[b.jsx(E.InlinedStyles,{id:"builderio-variants",styles:c(),nonce:e.nonce||""}),b.jsx(j,{id:"builderio-variants-visibility",scriptStr:i(),nonce:e.nonce||""}),(a=W(e.content))==null?void 0:a.map(o=>b.jsx(J,{isNestedRender:e.isNestedRender,nonce:e.nonce,content:o,showContent:!1,model:e.model,data:e.data,context:e.context,apiKey:e.apiKey,apiVersion:e.apiVersion,customComponents:e.customComponents,linkComponent:e.linkComponent,canTrack:e.canTrack,locale:e.locale,enrich:e.enrich,isSsrAbTest:t,blocksWrapper:e.blocksWrapper,blocksWrapperProps:e.blocksWrapperProps,contentWrapper:e.contentWrapper,contentWrapperProps:e.contentWrapperProps,trustedHosts:e.trustedHosts},o.testVariationId))]}):null,b.jsx(J,{nonce:e.nonce,isNestedRender:e.isNestedRender,content:g(),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=Ge;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),v=require("react"),y=require("./blocks-f9516def.cjs"),P=require("./server-entry-c0a129cd.cjs"),B=require("./evaluate-b34c0621.cjs");require("./blocks-exports.cjs");require("./get-class-prop-name-3fcaaa4e.cjs");require("./dynamic-renderer-b29b45ca.cjs");const D=["production","qa","test","development","dev","cdn-qa","cloud","fast","cdn2","cdn-prod"],A=()=>{const e=process.env.NODE_ENV||"production";return D.includes(e)?e:"production"},O=(e,i,S)=>{const a=String.prototype.split.call(i,/[,[\].]+?/).filter(Boolean).reduce((c,b)=>c!=null?c[b]:c,e);return a===void 0||a===e?S:a};function J(e){var x,E;const i=v.useRef(null),[S,a]=v.useState(()=>"unsubmitted"),[c,b]=v.useState(()=>null),[R,T]=v.useState(()=>"");function q(s){var f,m;const u={...e.builderContext.rootState,...s};e.builderContext.rootSetState?(m=(f=e.builderContext).rootSetState)==null||m.call(f,u):e.builderContext.rootState=u}function h(){return P.isEditing()&&e.previewState||S}function F(s){var f;const u=e.sendWithJs||e.sendSubmissionsTo==="email";if(e.sendSubmissionsTo==="zapier")s.preventDefault();else if(u){if(!(e.action||e.sendSubmissionsTo==="email")){s.preventDefault();return}s.preventDefault();const m=s.currentTarget||s.target,k=e.customHeaders||{};let g;const N=new FormData(m),C=Array.from(m.querySelectorAll("input,select,textarea")).filter(t=>!!t.name).map(t=>{let n;const l=t.name;if(t instanceof HTMLInputElement)if(t.type==="radio"){if(t.checked)return n=t.name,{key:l,value:n}}else if(t.type==="checkbox")n=t.checked;else if(t.type==="number"||t.type==="range"){const r=t.valueAsNumber;isNaN(r)||(n=r)}else t.type==="file"?n=t.files:n=t.value;else n=t.value;return{key:l,value:n}});let d=e.contentType;if(e.sendSubmissionsTo==="email"&&(d="multipart/form-data"),Array.from(C).forEach(({value:t})=>{(t instanceof File||Array.isArray(t)&&t[0]instanceof File||t instanceof FileList)&&(d="multipart/form-data")}),d!=="application/json")g=N;else{const t={};Array.from(C).forEach(({value:n,key:l})=>{B.set(t,l,n)}),g=JSON.stringify(t)}d&&d!=="multipart/form-data"&&(u&&((f=e.action)!=null&&f.includes("zapier.com"))||(k["content-type"]=d));const j=new CustomEvent("presubmit",{detail:{body:g}});if(i.current&&(i.current.dispatchEvent(j),j.defaultPrevented))return;a("sending");const w=`${A()==="dev"?"http://localhost:5000":"https://builder.io"}/api/v1/form-submit?apiKey=${e.builderContext.apiKey}&to=${btoa(e.sendSubmissionsToEmail||"")}&name=${encodeURIComponent(e.name||"")}`;fetch(e.sendSubmissionsTo==="email"?w:e.action,{body:g,headers:k,method:e.method||"post"}).then(async t=>{let n;const l=t.headers.get("content-type");if(l&&l.indexOf("application/json")!==-1?n=await t.json():n=await t.text(),!t.ok&&e.errorMessagePath){let r=O(n,e.errorMessagePath);r&&(typeof r!="string"&&(r=JSON.stringify(r)),T(r),q({formErrorMessage:r}))}if(b(n),a(t.ok?"success":"error"),t.ok){const r=new CustomEvent("submit:success",{detail:{res:t,body:n}});if(i.current){if(i.current.dispatchEvent(r),r.defaultPrevented)return;e.resetFormOnSubmit!==!1&&i.current.reset()}if(e.successUrl)if(i.current){const M=new CustomEvent("route",{detail:{url:e.successUrl}});i.current.dispatchEvent(M),M.defaultPrevented||(location.href=e.successUrl)}else location.href=e.successUrl}},t=>{const n=new CustomEvent("submit:error",{detail:{error:t}});i.current&&(i.current.dispatchEvent(n),n.defaultPrevented)||(b(t),a("error"))})}}return o.jsxs(o.Fragment,{children:[" ",o.jsxs("form",{validate:e.validate,ref:i,action:!e.sendWithJs&&e.action,method:e.method,name:e.name,onSubmit:s=>F(s),...e.attributes,children:[e.builderBlock&&e.builderBlock.children?o.jsx(o.Fragment,{children:(E=(x=e.builderBlock)==null?void 0:x.children)==null?void 0:E.map((s,u)=>o.jsx(y.Block,{block:s,context:e.builderContext,registeredComponents:e.builderComponents,linkComponent:e.builderLinkComponent},`form-block-${u}`))}):null,h()==="error"?o.jsx(y.Blocks,{path:"errorMessage",blocks:e.errorMessage,context:e.builderContext}):null,h()==="sending"?o.jsx(y.Blocks,{path:"sendingMessage",blocks:e.sendingMessage,context:e.builderContext}):null,h()==="error"&&c?o.jsx("pre",{className:"builder-form-error-text pre-3a20f614",children:JSON.stringify(c,null,2)}):null,h()==="success"?o.jsx(y.Blocks,{path:"successMessage",blocks:e.successMessage,context:e.builderContext}):null]})," ",o.jsx("style",{children:".pre-3a20f614 { padding: 10px; color: red; text-align: center; }"})," "]})}exports.default=J;
|