@builder.io/sdk-react-nextjs 0.13.2 → 0.13.3
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/{node/USE_CLIENT_BUNDLE-2b075311.js → browser/USE_CLIENT_BUNDLE-04cd188b.js} +4 -4
- package/lib/browser/{USE_CLIENT_BUNDLE-65d8df10.cjs → USE_CLIENT_BUNDLE-dcad73d0.cjs} +1 -1
- package/lib/{edge/USE_SERVER_BUNDLE-1a4a2318.js → browser/USE_SERVER_BUNDLE-498895bc.js} +1 -1
- package/lib/{edge/USE_SERVER_BUNDLE-7fb84390.cjs → browser/USE_SERVER_BUNDLE-f6de6931.cjs} +1 -1
- package/lib/browser/{bundle-af821e69.cjs → bundle-09521c43.cjs} +3 -3
- package/lib/browser/{bundle-0a12b387.js → bundle-16af19fc.js} +4 -4
- package/lib/browser/index.cjs +1 -1
- package/lib/browser/index.mjs +3 -3
- package/lib/{node/USE_CLIENT_BUNDLE-902511d8.cjs → edge/USE_CLIENT_BUNDLE-403b6348.cjs} +1 -1
- package/lib/{browser/USE_CLIENT_BUNDLE-660c05f1.js → edge/USE_CLIENT_BUNDLE-5b75ae27.js} +4 -4
- package/lib/{node/USE_SERVER_BUNDLE-2a94723d.js → edge/USE_SERVER_BUNDLE-1f2bfec0.js} +1 -1
- package/lib/{node/USE_SERVER_BUNDLE-c44d2651.cjs → edge/USE_SERVER_BUNDLE-c05264ac.cjs} +1 -1
- package/lib/edge/{bundle-ab7ced06.cjs → bundle-10fb1352.cjs} +13 -13
- package/lib/edge/{bundle-d76f7298.js → bundle-32e28c53.js} +4 -4
- package/lib/edge/index.cjs +1 -1
- package/lib/edge/index.mjs +3 -3
- package/lib/{edge/USE_CLIENT_BUNDLE-4ecfa86c.cjs → node/USE_CLIENT_BUNDLE-85cf7e92.cjs} +1 -1
- package/lib/{edge/USE_CLIENT_BUNDLE-a2d2d15f.js → node/USE_CLIENT_BUNDLE-d1e6dcd3.js} +4 -4
- package/lib/{browser/USE_SERVER_BUNDLE-2e3b6eff.cjs → node/USE_SERVER_BUNDLE-1aafe1f0.cjs} +1 -1
- package/lib/{browser/USE_SERVER_BUNDLE-7204eec6.js → node/USE_SERVER_BUNDLE-601fafbe.js} +1 -1
- package/lib/node/{bundle-2f991b0d.cjs → bundle-3f825965.cjs} +3 -3
- package/lib/node/{bundle-903b1df4.js → bundle-42fea3bc.js} +4 -4
- package/lib/node/index.cjs +1 -1
- package/lib/node/index.mjs +3 -3
- package/package.json +1 -1
- package/types/cjs/blocks/columns/columns.d.ts +1 -2
- package/types/cjs/blocks/columns/columns.types.d.ts +2 -2
- package/types/cjs/blocks/form/form/form.d.ts +3 -3
- package/types/cjs/blocks/slot/slot.d.ts +3 -3
- package/types/cjs/blocks/symbol/symbol.d.ts +1 -2
- package/types/cjs/blocks/symbol/symbol.types.d.ts +2 -2
- package/types/cjs/components/block/components/block-wrapper.d.ts +2 -2
- package/types/cjs/components/block/components/component-ref/component-ref.helpers.d.ts +3 -3
- package/types/cjs/components/block/components/interactive-element.d.ts +3 -2
- package/types/cjs/components/blocks/blocks-wrapper.d.ts +2 -2
- package/types/cjs/components/content/content.types.d.ts +1 -8
- package/types/cjs/components/content/contentProps.types.d.ts +12 -0
- package/types/cjs/components/dynamic-renderer/dynamic-renderer.d.ts +4 -3
- package/types/cjs/constants/sdk-version.d.ts +1 -1
- package/types/cjs/types/builder-props.d.ts +1 -1
- package/types/cjs/types/input.d.ts +1 -0
- package/types/cjs/types/typescript.d.ts +0 -3
- package/types/esm/blocks/columns/columns.d.ts +1 -2
- package/types/esm/blocks/columns/columns.types.d.ts +2 -2
- package/types/esm/blocks/form/form/form.d.ts +3 -3
- package/types/esm/blocks/slot/slot.d.ts +3 -3
- package/types/esm/blocks/symbol/symbol.d.ts +1 -2
- package/types/esm/blocks/symbol/symbol.types.d.ts +2 -2
- package/types/esm/components/block/components/block-wrapper.d.ts +2 -2
- package/types/esm/components/block/components/component-ref/component-ref.helpers.d.ts +3 -3
- package/types/esm/components/block/components/interactive-element.d.ts +3 -2
- package/types/esm/components/blocks/blocks-wrapper.d.ts +2 -2
- package/types/esm/components/content/content.types.d.ts +1 -8
- package/types/esm/components/content/contentProps.types.d.ts +12 -0
- package/types/esm/components/dynamic-renderer/dynamic-renderer.d.ts +4 -3
- package/types/esm/constants/sdk-version.d.ts +1 -1
- package/types/esm/types/builder-props.d.ts +1 -1
- package/types/esm/types/input.d.ts +1 -0
- package/types/esm/types/typescript.d.ts +0 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LRUCache as to } from "lru-cache";
|
|
2
2
|
import { jsx as C, Fragment as L, jsxs as xe } from "react/jsx-runtime";
|
|
3
|
-
import { I as no, B as ro, a as oo, D as io, C as ao, E as so, b as lo, V as co, c as uo, F as fo, d as po, S as ho, e as mo } from "./USE_CLIENT_BUNDLE-
|
|
3
|
+
import { I as no, B as ro, a as oo, D as io, C as ao, E as so, b as lo, V as co, c as uo, F as fo, d as po, S as ho, e as mo } from "./USE_CLIENT_BUNDLE-5b75ae27.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import "next/navigation";
|
|
6
6
|
const go = /* @__PURE__ */ new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"]), La = (e) => typeof e == "string" && go.has(e.toLowerCase()), he = "rsc", Xt = () => {
|
|
@@ -3263,7 +3263,7 @@ function si(e) {
|
|
|
3263
3263
|
/* @__PURE__ */ xe(
|
|
3264
3264
|
"div",
|
|
3265
3265
|
{
|
|
3266
|
-
className: `builder-columns ${e.builderBlock.id}-breakpoints div-
|
|
3266
|
+
className: `builder-columns ${e.builderBlock.id}-breakpoints div-65bb9135`,
|
|
3267
3267
|
style: k(),
|
|
3268
3268
|
children: [
|
|
3269
3269
|
/* @__PURE__ */ C(L, { children: /* @__PURE__ */ C(dt, { styles: P() }) }),
|
|
@@ -3299,7 +3299,7 @@ function si(e) {
|
|
|
3299
3299
|
]
|
|
3300
3300
|
}
|
|
3301
3301
|
),
|
|
3302
|
-
/* @__PURE__ */ C("style", { children: `.div-
|
|
3302
|
+
/* @__PURE__ */ C("style", { children: `.div-65bb9135 {
|
|
3303
3303
|
display: flex;
|
|
3304
3304
|
line-height: normal;
|
|
3305
3305
|
}` })
|
|
@@ -4611,7 +4611,7 @@ function Fr(e, t) {
|
|
|
4611
4611
|
const n = new URL(t.origin), r = n.hostname;
|
|
4612
4612
|
return (e || ba).findIndex((o) => o.startsWith("*.") ? r.endsWith(o.slice(1)) : o === r) > -1;
|
|
4613
4613
|
}
|
|
4614
|
-
const Sa = "0.13.
|
|
4614
|
+
const Sa = "0.13.3", rr = {};
|
|
4615
4615
|
function wa(e, t) {
|
|
4616
4616
|
let n = rr[e];
|
|
4617
4617
|
if (n || (n = rr[e] = []), n.push(t), G()) {
|
package/lib/edge/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./bundle-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./bundle-10fb1352.cjs"),t=require("./USE_CLIENT_BUNDLE-403b6348.cjs");require("lru-cache");require("react/jsx-runtime");require("react");require("next/navigation");require("./USE_SERVER_BUNDLE-c05264ac.cjs");exports.Blocks=e.Blocks;exports.Columns=e.Columns;exports.Content=e.ContentVariants;exports.RenderBlocks=e.RenderBlocks;exports.RenderContent=e.RenderContent;exports.Symbol=e.Symbol;exports.Text=e.Text;exports._processContentResult=e._processContentResult;exports.createRegisterComponentMessage=e.createRegisterComponentMessage;exports.fetchBuilderProps=e.fetchBuilderProps;exports.fetchEntries=e.fetchEntries;exports.fetchOneEntry=e.fetchOneEntry;exports.getAllContent=e.getAllContent;exports.getBuilderSearchParams=e.getBuilderSearchParams;exports.getContent=e.getContent;exports.isEditing=e.isEditing;exports.isPreviewing=e.isPreviewing;exports.register=e.register;exports.setEditorSettings=e.setEditorSettings;exports.subscribeToEditor=e.subscribeToEditor;exports.track=e.track;exports.Button=t.Button;exports.Fragment=t.FragmentComponent;exports.Image=t.Image;exports.Section=t.SectionComponent;exports.Video=t.Video;
|
package/lib/edge/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { B as i, x as c, C as m, R as g, w as p, S as d, T as l, G as C, p as u, F as B, H as E, q as S, I as f, A as R, J as h, c as x, j as b, y as k, z as y, E as F, D as P } from "./bundle-
|
|
2
|
-
import { c as w, F as A, d as I, S as V, V as j } from "./USE_CLIENT_BUNDLE-
|
|
1
|
+
import { B as i, x as c, C as m, R as g, w as p, S as d, T as l, G as C, p as u, F as B, H as E, q as S, I as f, A as R, J as h, c as x, j as b, y as k, z as y, E as F, D as P } from "./bundle-32e28c53.js";
|
|
2
|
+
import { c as w, F as A, d as I, S as V, V as j } from "./USE_CLIENT_BUNDLE-5b75ae27.js";
|
|
3
3
|
import "lru-cache";
|
|
4
4
|
import "react/jsx-runtime";
|
|
5
5
|
import "react";
|
|
6
6
|
import "next/navigation";
|
|
7
|
-
import "./USE_SERVER_BUNDLE-
|
|
7
|
+
import "./USE_SERVER_BUNDLE-1f2bfec0.js";
|
|
8
8
|
export {
|
|
9
9
|
i as Blocks,
|
|
10
10
|
w as Button,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use client";"use strict";const t=require("react/jsx-runtime"),a=require("./bundle-
|
|
1
|
+
"use client";"use strict";const t=require("react/jsx-runtime"),a=require("./bundle-3f825965.cjs"),r=require("react"),D=require("./USE_SERVER_BUNDLE-1aafe1f0.cjs"),V=require("next/navigation");function C(e){return t.jsx(t.Fragment,{children:a.isEmptyElement(e.TagName)?t.jsx(t.Fragment,{children:t.jsx(e.TagName,{...e.attributes,...e.actionAttributes})}):t.jsx(t.Fragment,{children:typeof e.TagName=="string"?t.jsx(t.Fragment,{children:t.jsx(e.TagName,{...e.attributes,...e.actionAttributes,children:e.children})}):t.jsx(t.Fragment,{children:t.jsx(e.TagName,{...e.attributes,...e.actionAttributes,children:e.children})})})})}function H(e){return t.jsx(C,{TagName:e.link?e.builderLinkComponent||"a":"button",attributes:{...e.attributes,[a.getClassPropName()]:`${e.link?"":"builder-button"} ${e.attributes[a.getClassPropName()]||""}`,...e.link?{href:e.link,target:e.openLinkInNewTab?"_blank":void 0,role:"link"}:{role:"button"}},actionAttributes:{},children:e.text})}function U(e){return t.jsx(C,{TagName:e.Wrapper,attributes:a.getBlockProperties({block:e.block,context:e.context}),actionAttributes:a.getBlockActions({block:e.block,rootState:e.context.rootState,rootSetState:e.context.rootSetState,localState:e.context.localState,context:e.context.context,stripPrefix:!0}),children:e.children})}function $(e){return t.jsx(e.Wrapper,{...e.wrapperProps,attributes:e.includeBlockProps?{...a.getBlockProperties({block:e.block,context:e.context}),...a.getBlockActions({block:e.block,rootState:e.context.rootState,rootSetState:e.context.rootSetState,localState:e.context.localState,context:e.context.context})}:{},children:e.children})}function O(e){function l(){var o;return"builder-blocks"+((o=e.blocks)!=null&&o.length?"":" no-blocks")}function g(){var o,m;a.isEditing()&&!((o=e.blocks)!=null&&o.length)&&((m=window.parent)==null||m.postMessage({type:"builder.clickEmptyBlocks",data:{parentElementId:e.parent,dataPath:e.path}},"*"))}function x(){var o,m;a.isEditing()&&!((o=e.blocks)!=null&&o.length)&&((m=window.parent)==null||m.postMessage({type:"builder.hoverEmptyBlocks",data:{parentElementId:e.parent,dataPath:e.path}},"*"))}return t.jsxs(t.Fragment,{children:[t.jsx(e.BlocksWrapper,{className:l()+" props-blocks-wrapper-7354e098","builder-path":e.path,"builder-parent-id":e.parent,style:e.styleProp,onClick:o=>g(),onMouseEnter:o=>x(),onKeyPress:o=>g(),...e.BlocksWrapperProps,children:e.children}),t.jsx("style",{children:`.props-blocks-wrapper-7354e098 {
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
align-items: stretch;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as i, Fragment as h, jsxs as E } from "react/jsx-runtime";
|
|
3
|
-
import { i as p, g as H, a as $, b as O, c as w, d as R, e as ee, f as P, h as V, _ as D, j as te, l as ne, k as ie, t as ae, m as U, n as ce, o as re, r as le, s as oe, p as de, q as se, u as ue } from "./bundle-
|
|
3
|
+
import { i as p, g as H, a as $, b as O, c as w, d as R, e as ee, f as P, h as V, _ as D, j as te, l as ne, k as ie, t as ae, m as U, n as ce, o as re, r as le, s as oe, p as de, q as se, u as ue } from "./bundle-42fea3bc.js";
|
|
4
4
|
import { useRef as T, useState as x, useEffect as b, createContext as me, createElement as ge } from "react";
|
|
5
|
-
import { p as he } from "./USE_SERVER_BUNDLE-
|
|
5
|
+
import { p as he } from "./USE_SERVER_BUNDLE-601fafbe.js";
|
|
6
6
|
import { useRouter as be } from "next/navigation";
|
|
7
7
|
function J(e) {
|
|
8
8
|
return /* @__PURE__ */ i(h, { children: p(e.TagName) ? /* @__PURE__ */ i(h, { children: /* @__PURE__ */ i(e.TagName, { ...e.attributes, ...e.actionAttributes }) }) : /* @__PURE__ */ i(h, { children: typeof e.TagName == "string" ? /* @__PURE__ */ i(h, { children: /* @__PURE__ */ i(e.TagName, { ...e.attributes, ...e.actionAttributes, children: e.children }) }) : /* @__PURE__ */ i(h, { children: /* @__PURE__ */ i(e.TagName, { ...e.attributes, ...e.actionAttributes, children: e.children }) }) }) });
|
|
@@ -106,7 +106,7 @@ function Re(e) {
|
|
|
106
106
|
/* @__PURE__ */ i(
|
|
107
107
|
e.BlocksWrapper,
|
|
108
108
|
{
|
|
109
|
-
className: c() + " props-blocks-wrapper-
|
|
109
|
+
className: c() + " props-blocks-wrapper-7354e098",
|
|
110
110
|
"builder-path": e.path,
|
|
111
111
|
"builder-parent-id": e.parent,
|
|
112
112
|
style: e.styleProp,
|
|
@@ -117,7 +117,7 @@ function Re(e) {
|
|
|
117
117
|
children: e.children
|
|
118
118
|
}
|
|
119
119
|
),
|
|
120
|
-
/* @__PURE__ */ i("style", { children: `.props-blocks-wrapper-
|
|
120
|
+
/* @__PURE__ */ i("style", { children: `.props-blocks-wrapper-7354e098 {
|
|
121
121
|
display: flex;
|
|
122
122
|
flex-direction: column;
|
|
123
123
|
align-items: stretch;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use server";"use strict";const n=require("./bundle-
|
|
1
|
+
"use server";"use strict";const n=require("./bundle-3f825965.cjs");async function s({key:e,value:t}){return n.init(),globalThis._BUILDER_PREVIEW_LRU_CACHE.set(e,t),{[e]:t}}exports.postPreviewContent=s;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const lruCache=require("lru-cache"),jsxRuntime=require("react/jsx-runtime"),USE_CLIENT_BUNDLE=require("./USE_CLIENT_BUNDLE-
|
|
1
|
+
"use strict";const lruCache=require("lru-cache"),jsxRuntime=require("react/jsx-runtime"),USE_CLIENT_BUNDLE=require("./USE_CLIENT_BUNDLE-85cf7e92.cjs");require("react");require("next/navigation");const EMPTY_HTML_ELEMENTS=new Set(["area","base","br","col","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),isEmptyElement=e=>typeof e=="string"&&EMPTY_HTML_ELEMENTS.has(e.toLowerCase()),TARGET="rsc",getClassPropName=()=>{switch(TARGET){case"react":case"reactNative":case"rsc":return"className";case"svelte":case"vue":case"solid":case"qwik":return"class"}};function getBlockComponentOptions(e){var t;return{...(t=e.component)==null?void 0:t.options,...e.options,builderBlock:e}}const MSG_PREFIX="[Builder.io]: ",logger={log:(...e)=>console.log(MSG_PREFIX,...e),error:(...e)=>console.error(MSG_PREFIX,...e),warn:(...e)=>console.warn(MSG_PREFIX,...e),debug:(...e)=>console.debug(MSG_PREFIX,...e)};function isBrowser(){return typeof window<"u"&&typeof document<"u"}function isIframe(){return isBrowser()&&window.self!==window.top}function isEditing(){return isIframe()&&window.location.search.indexOf("builder.frameEditing=")!==-1}const getLocation=()=>{if(isBrowser()){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},getUserAgent=()=>typeof navigator=="object"&&navigator.userAgent||"",getUserAttributes=()=>{const e=getUserAgent(),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()||TARGET==="reactNative"}},n=e.match(/Tablet|iPad/i),o=getLocation();return{urlPath:o==null?void 0:o.pathname,host:(o==null?void 0:o.host)||(o==null?void 0:o.hostname),device:n?"tablet":t.any()?"mobile":"desktop"}},getFunctionArguments=({builder:e,context:t,event:n,state:o})=>Object.entries({state:o,Builder:e,builder:e,context:t,event:n}),getBuilderGlobals=()=>({isEditing:isEditing(),isBrowser:isBrowser(),isServer:!isBrowser(),getUserAttributes:()=>getUserAttributes()}),parseCode=(e,{isExpression:t=!0})=>t&&!(e.includes(";")||e.includes(" return ")||e.trim().startsWith("return "))?`return (${e});`:e,runInBrowser=({code:e,builder:t,context:n,event:o,localState:r,rootSetState:i,rootState:a})=>{const s=getFunctionArguments({builder:t,context:n,event:o,state:flattenState({rootState:a,localState:r,rootSetState:i})});return new Function(...s.map(([c])=>c),e)(...s.map(([,c])=>c))};function flattenState({rootState:e,localState:t,rootSetState:n}){return new Proxy(e,{get:(o,r)=>{if(t&&r in t)return t[r];const i=o[r];return typeof i=="object"?flattenState({rootState:i,localState:void 0,rootSetState:n?a=>{o[r]=a,n(o)}:void 0}):i},set:(o,r,i)=>{if(t&&r in t)throw new Error("Writing to local state is not allowed as it is read-only.");return o[r]=i,n==null||n(o),!0}})}const fastClone=e=>JSON.parse(JSON.stringify(e)),set=(e,t,n)=>{if(Object(e)!==e)return e;const o=Array.isArray(t)?t:t.toString().match(/[^.[\]]+/g);return o.slice(0,-1).reduce((r,i,a)=>Object(r[i])===r[i]?r[i]:r[i]=Math.abs(Number(o[a+1]))>>0===+o[a+1]?[]:{},e)[o[o.length-1]]=n,e},noop=()=>{};let safeDynamicRequire=noop;try{safeDynamicRequire=eval("require")}catch(e){}const ivm=safeDynamicRequire("isolated-vm"),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;
|
|
@@ -69,7 +69,7 @@ output;
|
|
|
69
69
|
margin-left: var(--column-margin-left-mobile) !important;
|
|
70
70
|
}
|
|
71
71
|
},
|
|
72
|
-
`};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:`builder-columns ${e.builderBlock.id}-breakpoints div-
|
|
72
|
+
`};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:`builder-columns ${e.builderBlock.id}-breakpoints div-65bb9135`,style:m(),children:[jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx(InlinedStyles,{styles:g()})}),(u=e.columns)==null?void 0:u.map((l,d)=>jsxRuntime.jsx(USE_CLIENT_BUNDLE.DynamicRenderer,{TagName:l.link?e.builderLinkComponent||"a":"div",actionAttributes:{},attributes:{...l.link?{href:l.link}:{},[getClassPropName()]:"builder-column",style:mapStyleObjToStrIfNeeded(f(d))},children:jsxRuntime.jsx(Blocks,{path:`component.options.columns.${d}.blocks`,parent:e.builderBlock.id,styleProp:{flexGrow:"1"},context:e.builderContext,registeredComponents:e.builderComponents,linkComponent:e.builderLinkComponent,blocks:l.blocks})},d))]}),jsxRuntime.jsx("style",{children:`.div-65bb9135 {
|
|
73
73
|
display: flex;
|
|
74
74
|
line-height: normal;
|
|
75
75
|
}`})]})}function removeProtocol(e){return e.replace(/http(s)?:/,"")}function updateQueryParam(e="",t,n){const o=new RegExp("([?&])"+t+"=.*?(&|$)","i"),r=e.indexOf("?")!==-1?"&":"?";return e.match(o)?e.replace(o,"$1"+t+"="+encodeURIComponent(n)+"$2"):e+r+t+"="+encodeURIComponent(n)}function getShopifyImageUrl(e,t){if(!e||!(e!=null&&e.match(/cdn\.shopify\.com/))||!t)return e;if(t==="master")return removeProtocol(e);const n=e.match(/(_\d+x(\d+)?)?(\.(jpg|jpeg|gif|png|bmp|bitmap|tiff|tif)(\?v=\d+)?)/i);if(n){const o=e.split(n[0]),r=n[3],i=t.match("x")?t:`${t}x`;return removeProtocol(`${o[0]}_${i}${r}`)}return null}function getSrcSet(e){if(!e)return e;const t=[100,200,400,800,1200,1600,2e3];if(e.match(/builder\.io/)){let n=e;const o=Number(e.split("?width=")[1]);return isNaN(o)||(n=`${n} ${o}w`),t.filter(r=>r!==o).map(r=>`${updateQueryParam(e,"width",r)} ${r}w`).concat([n]).join(", ")}return e.match(/cdn\.shopify\.com/)?t.map(n=>[getShopifyImageUrl(e,`${n}x${n}`),n]).filter(([n])=>!!n).map(([n,o])=>`${n} ${o}w`).concat([e]).join(", "):e}const getTopLevelDomain=e=>{if(e==="localhost"||e==="127.0.0.1")return e;const t=e.split(".");return t.length>2?t.slice(1).join("."):e},getCookieSync=({name:e,canTrack:t})=>{var n;try{return t?(n=document.cookie.split("; ").find(o=>o.startsWith(`${e}=`)))==null?void 0:n.split("=")[1]:void 0}catch(o){logger.warn("[COOKIE] GET error: ",(o==null?void 0:o.message)||o);return}},getCookie=async e=>getCookieSync(e),stringifyCookie=e=>e.map(([t,n])=>n?`${t}=${n}`:t).filter(checkIsDefined).join("; "),SECURE_CONFIG=[["secure",""],["SameSite","None"]],createCookieString=({name:e,value:t,expires:n})=>{const r=(isBrowser()?location.protocol==="https:":!0)?SECURE_CONFIG:[[]],i=n?[["expires",n.toUTCString()]]:[[]],a=[[e,t],...i,["path","/"],["domain",getTopLevelDomain(window.location.hostname)],...r];return stringifyCookie(a)},setCookie=async({name:e,value:t,expires:n,canTrack:o})=>{try{if(!o)return;const r=createCookieString({name:e,value:t,expires:n});document.cookie=r}catch(r){logger.warn("[COOKIE] SET error: ",(r==null?void 0:r.message)||r)}},BUILDER_STORE_PREFIX="builder.tests",getContentTestKey=e=>`${BUILDER_STORE_PREFIX}.${e}`,getContentVariationCookie=({contentId:e})=>getCookie({name:getContentTestKey(e),canTrack:!0}),getContentVariationCookieSync=({contentId:e})=>getCookieSync({name:getContentTestKey(e),canTrack:!0}),setContentVariationCookie=({contentId:e,value:t})=>setCookie({name:getContentTestKey(e),value:t,canTrack:!0}),checkIsBuilderContentWithVariations=e=>checkIsDefined(e.id)&&checkIsDefined(e.variations)&&Object.keys(e.variations).length>0,getRandomVariationId=({id:e,variations:t})=>{var r;let n=0;const o=Math.random();for(const i in t){const a=(r=t[i])==null?void 0:r.testRatio;if(n+=a,o<n)return i}return e},getAndSetVariantId=e=>{const t=getRandomVariationId(e);return setContentVariationCookie({contentId:e.id,value:t}).catch(n=>{logger.error("could not store A/B test variation: ",n)}),t},getTestFields=({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":"")}},handleABTestingSync=({item:e,canTrack:t})=>{if(!t)return e;if(!e)return;if(!checkIsBuilderContentWithVariations(e))return e;const n=getContentVariationCookieSync({contentId:e.id})||getAndSetVariantId({variations:e.variations,id:e.id}),o=getTestFields({item:e,testGroupId:n});return{...e,...o}},handleABTesting=async({item:e,canTrack:t})=>{if(!t||!checkIsBuilderContentWithVariations(e))return e;const o=await getContentVariationCookie({contentId:e.id})||getAndSetVariantId({variations:e.variations,id:e.id}),r=getTestFields({item:e,testGroupId:o});return{...e,...r}},getDefaultCanTrack=e=>checkIsDefined(e)?e:!0,componentInfo$b={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},componentInfo$a={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(o=>{o.delete("width")})}const n=e.get("columns");Array.isArray(n)&&n.find(r=>r.get("width"))&&(n.find(i=>!i.get("width"))||n.reduce((s,c)=>s+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}]},componentInfo$9={name:"Fragment",static:!0,hidden:!0,canHaveChildren:!0,noWrap:!0},componentInfo$8={name:"Image",static:!0,image:"https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4",defaultStyles:{position:"relative",minHeight:"20px",minWidth:"20px",overflow:"hidden"},canHaveChildren:!0,inputs:[{name:"image",type:"file",bubble:!0,allowedFileTypes:["jpeg","jpg","png","svg"],required:!0,defaultValue:"https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a",onChange:e=>{e.delete("srcset"),e.delete("noWebp");function n(a,s=6e4){return new Promise((c,m)=>{const f=document.createElement("img");let p=!1;f.onload=()=>{p=!0,c(f)},f.addEventListener("error",g=>{console.warn("Image load failed",g.error),m(g.error)}),f.src=a,setTimeout(()=>{p||m(new Error("Image load timed out"))},s)})}function o(a){return Math.round(a*1e3)/1e3}const r=e.get("image"),i=e.get("aspectRatio");if(fetch(r).then(a=>a.blob()).then(a=>{a.type.includes("svg")&&e.set("noWebp",!0)}),r&&(!i||i===.7041))return n(r).then(a=>{const s=e.get("aspectRatio");e.get("image")===r&&(!s||s===.7041)&&a.width&&a.height&&(e.set("aspectRatio",o(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:"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}]},componentInfo$7={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>"}}}]},componentInfo$6={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"}]};function Slot(e){var t,n,o;return jsxRuntime.jsx("div",{style:{pointerEvents:"auto"},...!((t=e.builderContext.context)!=null&&t.symbolId)&&{"builder-slot":e.name},children:jsxRuntime.jsx(Blocks,{parent:(n=e.builderContext.context)==null?void 0:n.symbolId,path:`symbol.data.${e.name}`,context:e.builderContext,blocks:(o=e.builderContext.rootState)==null?void 0:o[e.name]})})}const componentInfo$5={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"}]},componentInfo$4={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"}};function Text(e){var t;return jsxRuntime.jsx("div",{className:"builder-text",dangerouslySetInnerHTML:{__html:((t=e.text)==null?void 0:t.toString())||""},style:{outline:"none"}})}const componentInfo$3={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}]},componentInfo$2={name:"Embed",static:!0,inputs:[{name:"url",type:"url",required:!0,defaultValue:"",helperText:"e.g. enter a youtube url, google map, etc",onChange:e=>{const t=e.get("url");if(t)return e.set("content","Loading..."),fetch(`https://iframe.ly/api/iframely?url=${t}&api_key=ae0e60e78201a3f2b0de4b`).then(o=>o.json()).then(o=>{e.get("url")===t&&(o.html?e.set("content",o.html):e.set("content","Invalid url, please try another"))}).catch(o=>{e.set("content","There was an error embedding this URL, please try again or another URL")});e.delete("content")}},{name:"content",type:"html",defaultValue:'<div style="padding: 20px; text-align: center">(Choose an embed URL)<div>',hideFromUI:!0}]},SCRIPT_MIME_TYPES=["text/javascript","application/javascript","application/ecmascript"],isJsScript=e=>SCRIPT_MIME_TYPES.includes(e.type),componentInfo$1={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},componentInfo={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://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/assets%2FKQlEmWDxA0coC3PK6UvkrjwkIGI2%2F28cb070609f546cdbe5efa20e931aa4b?alt=media&token=912e9551-7a7c-4dfb-86b6-3da1537d1a7f",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}]},getExtraComponents=()=>[{component:USE_CLIENT_BUNDLE.CustomCode,...componentInfo$3},{component:USE_CLIENT_BUNDLE.Embed,...componentInfo$2},{component:USE_CLIENT_BUNDLE.ImgComponent,...componentInfo$1},{component:USE_CLIENT_BUNDLE.Video,...componentInfo}],getDefaultRegisteredComponents=()=>[{component:USE_CLIENT_BUNDLE.Button,...componentInfo$b},{component:Columns,...componentInfo$a},{component:USE_CLIENT_BUNDLE.FragmentComponent,...componentInfo$9},{component:USE_CLIENT_BUNDLE.Image,...componentInfo$8},{component:USE_CLIENT_BUNDLE.SectionComponent,...componentInfo$7},{component:Slot,...componentInfo$6},{component:Symbol$1,...componentInfo$5},{component:Text,...componentInfo$4},...getExtraComponents()],components=[],createRegisterComponentMessage=e=>({type:"builder.registerComponent",data:serializeComponentInfo(e)}),serializeFn=e=>{const t=e.toString().trim();return`return (${!t.startsWith("function")&&!t.startsWith("(")?"function ":""}${t}).apply(this, arguments)`},serializeValue=e=>typeof e=="function"?serializeFn(e):fastClone(e),serializeComponentInfo=({inputs:e,...t})=>({...fastClone(t),inputs:e==null?void 0:e.map(n=>Object.entries(n).reduce((o,[r,i])=>({...o,[r]:serializeValue(i)}),{}))}),UPDATE_COOKIES_AND_STYLES_SCRIPT=`function updateCookiesAndStyles(contentId, variants, isHydrationTarget) {
|
|
@@ -171,7 +171,7 @@ output;
|
|
|
171
171
|
)`,getUpdateVariantVisibilityScript=({contentId:e,variationId:t})=>`window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME}(
|
|
172
172
|
"${t}", "${e}", ${isHydrationTarget}
|
|
173
173
|
)`;function InlinedScript(e){return jsxRuntime.jsx("script",{dangerouslySetInnerHTML:{__html:e.scriptStr},id:e.id||""})}const getIdFromSearchParams=e=>{const t=e.get("preview"),n=e.get("overrides."+t);return n||logger.warn("No previewed ID found in search params."),n};function init(){globalThis._BUILDER_PREVIEW_LRU_CACHE||(globalThis._BUILDER_PREVIEW_LRU_CACHE=new lruCache.LRUCache({max:500,ttl:1e3*60*5}))}function getPreviewContent(e){init();const t=getIdFromSearchParams(e);return typeof t=="string"?globalThis._BUILDER_PREVIEW_LRU_CACHE.get(t):void 0}function getGlobalThis(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:globalThis}function getFetch(){const e=getGlobalThis().fetch;if(typeof e>"u")throw console.warn(`Builder SDK could not find a global fetch function. Make sure you have a polyfill for fetch in your project.
|
|
174
|
-
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 fetch$1=getFetch();function flatten(e,t=null,n="."){return Object.keys(e).reduce((o,r)=>{const i=e[r],a=[t,r].filter(Boolean).join(n);return[typeof i=="object",i!==null,!(Array.isArray(i)&&i.length===0)].every(Boolean)?{...o,...flatten(i,a,n)}:{...o,[a]:i}},{})}const DEFAULT_API_VERSION="v3",BUILDER_SEARCHPARAMS_PREFIX="builder.",BUILDER_OPTIONS_PREFIX="options.",convertSearchParamsToQueryObject=e=>{const t={};return e.forEach((n,o)=>{t[o]=n}),t},getBuilderSearchParams=e=>{if(!e)return{};const t=normalizeSearchParams(e),n={};return Object.keys(t).forEach(o=>{if(o.startsWith(BUILDER_SEARCHPARAMS_PREFIX)){const r=o.replace(BUILDER_SEARCHPARAMS_PREFIX,"").replace(BUILDER_OPTIONS_PREFIX,"");n[r]=t[o]}}),n},getBuilderSearchParamsFromWindow=()=>{if(!isBrowser())return{};const e=new URLSearchParams(window.location.search);return getBuilderSearchParams(e)},normalizeSearchParams=e=>e instanceof URLSearchParams?convertSearchParamsToQueryObject(e):e,isPositiveNumber=e=>typeof e=="number"&&!isNaN(e)&&e>=0,generateContentUrl=e=>{let{noTraverse:t=!1}=e;const{limit:n=30,userAttributes:o,query:r,model:i,apiKey:a,includeRefs:s=!0,enrich:c,locale:m,apiVersion:f=DEFAULT_API_VERSION,fields:p,omit:g,offset:u,cacheSeconds:l,staleCacheSeconds:d,sort:b,includeUnpublished:y}=e;if(!a)throw new Error("Missing API key");if(!["v3"].includes(f))throw new Error(`Invalid apiVersion: expected 'v3', received '${f}'`);(e.limit===void 0||e.limit>1)&&!("noTraverse"in e)&&(t=!0);const h=new URL(`https://cdn.builder.io/api/${f}/content/${i}?apiKey=${a}&limit=${n}&noTraverse=${t}&includeRefs=${s}${m?`&locale=${m}`:""}${c?`&enrich=${c}`:""}`);if(h.searchParams.set("omit",g||"meta.componentsUsed"),p&&h.searchParams.set("fields",p),Number.isFinite(u)&&u>-1&&h.searchParams.set("offset",String(Math.floor(u))),typeof y=="boolean"&&h.searchParams.set("includeUnpublished",String(y)),l&&isPositiveNumber(l)&&h.searchParams.set("cacheSeconds",String(l)),d&&isPositiveNumber(d)&&h.searchParams.set("staleCacheSeconds",String(d)),b){const S=flatten({sort:b});for(const x in S)h.searchParams.set(x,JSON.stringify(S[x]))}const k={...getBuilderSearchParamsFromWindow(),...normalizeSearchParams(e.options||{})},C=flatten(k);for(const S in C)h.searchParams.set(S,String(C[S]));if(o&&h.searchParams.set("userAttributes",JSON.stringify(o)),r){const S=flatten({query:r});for(const x in S)h.searchParams.set(x,JSON.stringify(S[x]))}return h},checkContentHasResults=e=>"results"in e;async function fetchOneEntry(e){const t=await fetchEntries({...e,limit:1});return t&&t[0]||null}const getContent=fetchOneEntry,_fetchContent=async e=>{const t=generateContentUrl(e);return await(await fetch$1(t.href)).json()},_processContentResult=async(e,t,n=generateContentUrl(e))=>{const o=getDefaultCanTrack(e.canTrack);if(n.search.includes("preview=")){const i=[];for(const a of t.results){const s=getPreviewContent(n.searchParams);i.push(s||a)}t.results=i}if(!o||!(isBrowser()||TARGET==="reactNative"))return t.results;try{const i=[];for(const a of t.results)i.push(await handleABTesting({item:a,canTrack:o}));t.results=i}catch(i){logger.error("Could not process A/B tests. ",i)}return t.results};async function fetchEntries(e){try{const t=generateContentUrl(e),n=await _fetchContent(e);return checkContentHasResults(n)?_processContentResult(e,n):(logger.error("Error fetching data. ",{url:t,content:n,options:e}),null)}catch(t){return logger.error("Error fetching data. ",t),null}}const getAllContent=fetchEntries;function isPreviewing(){return!isBrowser()||isEditing()?!1:location.search.indexOf("builder.preview=")!==-1}function uuidv4(){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 uuid(){return uuidv4().replace(/-/g,"")}const SESSION_LOCAL_STORAGE_KEY="builderSessionId",getSessionId=async({canTrack:e})=>{if(!e)return;const t=await getCookie({name:SESSION_LOCAL_STORAGE_KEY,canTrack:e});if(checkIsDefined(t))return t;{const n=createSessionId();return setSessionId({id:n,canTrack:e}),n}},createSessionId=()=>uuid(),setSessionId=({id:e,canTrack:t})=>setCookie({name:SESSION_LOCAL_STORAGE_KEY,value:e,canTrack:t}),getLocalStorage=()=>isBrowser()&&typeof localStorage<"u"?localStorage:void 0,getLocalStorageItem=({key:e,canTrack:t})=>{var n;try{return t?(n=getLocalStorage())==null?void 0:n.getItem(e):void 0}catch(o){console.debug("[LocalStorage] GET error: ",o);return}},setLocalStorageItem=({key:e,canTrack:t,value:n})=>{var o;try{t&&((o=getLocalStorage())==null||o.setItem(e,n))}catch(r){console.debug("[LocalStorage] SET error: ",r)}},VISITOR_LOCAL_STORAGE_KEY="builderVisitorId",getVisitorId=({canTrack:e})=>{if(!e)return;const t=getLocalStorageItem({key:VISITOR_LOCAL_STORAGE_KEY,canTrack:e});if(checkIsDefined(t))return t;{const n=createVisitorId();return setVisitorId({id:n,canTrack:e}),n}},createVisitorId=()=>uuid(),setVisitorId=({id:e,canTrack:t})=>setLocalStorageItem({key:VISITOR_LOCAL_STORAGE_KEY,value:e,canTrack:t}),getTrackingEventData=async({canTrack:e})=>{if(!e)return{visitorId:void 0,sessionId:void 0};const t=await getSessionId({canTrack:e}),n=getVisitorId({canTrack:e});return{sessionId:t,visitorId:n}},createEvent=async({type:e,canTrack:t,apiKey:n,metadata:o,...r})=>({type:e,data:{...r,metadata:{url:location.href,...o},...await getTrackingEventData({canTrack:t}),userAttributes:getUserAttributes(),ownerId:n}});async function _track(e){if(!e.apiKey){logger.error("Missing API key for track call. Please provide your API key.");return}if(e.canTrack&&!isEditing()&&(isBrowser()||TARGET==="reactNative"))return fetch("https://cdn.builder.io/api/v1/track",{method:"POST",body:JSON.stringify({events:[await createEvent(e)]}),headers:{"content-type":"application/json"},mode:"cors"}).catch(t=>{console.error("Failed to track: ",t)})}const track=e=>_track({...e,canTrack:!0});function round(e){return Math.round(e*1e3)/1e3}const findParentElement=(e,t,n=!0)=>{if(!(e instanceof HTMLElement))return null;let o=n?e:e.parentElement;do{if(!o)return null;if(t(o))return o}while(o=o.parentElement);return null},findBuilderParent=e=>findParentElement(e,t=>{const n=t.getAttribute("builder-id")||t.id;return(n==null?void 0:n.indexOf("builder-"))===0}),computeOffset=({event:e,target:t})=>{const n=t.getBoundingClientRect(),o=e.clientX-n.left,r=e.clientY-n.top,i=round(o/n.width),a=round(r/n.height);return{x:i,y:a}},getInteractionPropertiesForEvent=e=>{const t=e.target,n=t&&findBuilderParent(t),o=(n==null?void 0:n.getAttribute("builder-id"))||(n==null?void 0:n.id);return{targetBuilderElement:o||void 0,metadata:{targetOffset:t?computeOffset({event:e,target:t}):void 0,builderTargetOffset:n?computeOffset({event:e,target:n}):void 0,builderElementIndex:n&&o?[].slice.call(document.getElementsByClassName(o)).indexOf(n):void 0}}},DEFAULT_TRUSTED_HOSTS=["*.beta.builder.io","beta.builder.io","builder.io","localhost","qa.builder.io"];function isFromTrustedHost(e,t){const n=new URL(t.origin),o=n.hostname;return(e||DEFAULT_TRUSTED_HOSTS).findIndex(r=>r.startsWith("*.")?o.endsWith(r.slice(1)):r===o)>-1}const SDK_VERSION="0.13.2",registry={};function register(e,t){let n=registry[e];if(n||(n=registry[e]=[]),n.push(t),isBrowser()){const o={type:"builder.register",data:{type:e,info:t}};try{parent.postMessage(o,"*"),parent!==window&&window.postMessage(o,"*")}catch(r){console.debug("Could not postmessage",r)}}}const registerInsertMenu=()=>{register("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 isSetupForEditing=!1;const setupBrowserForEditing=(e={})=>{var t,n;isSetupForEditing||(isSetupForEditing=!0,isBrowser()&&((t=window.parent)==null||t.postMessage({type:"builder.sdkInfo",data:{target:TARGET,version:SDK_VERSION,supportsPatchUpdates:!1,supportsAddBlockScoping:!0,supportsCustomBreakpoints:!0}},"*"),(n=window.parent)==null||n.postMessage({type:"builder.updateContent",data:{options:e}},"*"),window.addEventListener("message",o=>{var i,a;if(!isFromTrustedHost(e.trustedHosts,o))return;const{data:r}=o;if(r!=null&&r.type)switch(r.type){case"builder.evaluate":{const s=r.data.text,c=r.data.arguments||[],m=r.data.id,f=new Function(s);let p,g=null;try{p=f.apply(null,c)}catch(u){g=u}g?(i=window.parent)==null||i.postMessage({type:"builder.evaluateError",data:{id:m,error:g.message}},"*"):p&&typeof p.then=="function"?p.then(u=>{var l;(l=window.parent)==null||l.postMessage({type:"builder.evaluateResult",data:{id:m,result:u}},"*")}).catch(console.error):(a=window.parent)==null||a.postMessage({type:"builder.evaluateResult",data:{result:p,id:m}},"*");break}}})))},createEditorListener=({model:e,trustedHosts:t,callbacks:n})=>o=>{if(!isFromTrustedHost(t,o))return;const{data:r}=o;if(r)switch(r.type){case"builder.configureSdk":{n.configureSdk(r.data);break}case"builder.triggerAnimation":{n.animation(r.data);break}case"builder.contentUpdate":{const i=r.data,a=i.key||i.alias||i.entry||i.modelName,s=i.data;a===e&&n.contentUpdate(s);break}}},subscribeToEditor=(e,t,n)=>{if(!isBrowser)return logger.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."),()=>{};setupBrowserForEditing();const o=createEditorListener({callbacks:{contentUpdate:t,animation:()=>{},configureSdk:()=>{}},model:e,trustedHosts:n==null?void 0:n.trustedHosts});return window.addEventListener("message",o),()=>{window.removeEventListener("message",o)}};function assign(e,...t){const n=Object(e);for(let o=1;o<arguments.length;o++){const r=arguments[o];if(r!=null)for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])}return n}const camelCaseToKebabCase=e=>e?e.replace(/([A-Z])/g,t=>`-${t[0].toLowerCase()}`):"";function warnElementNotPresent(e){console.warn(`Cannot animate element: element with ID ${e} not found!`)}function augmentAnimation(e,t){const n=getAllStylesUsed(e),o=getComputedStyle(t),r=e.steps[0].styles,i=e.steps[e.steps.length-1].styles,a=[r,i];for(const s of a)for(const c of n)c in s||(s[c]=o[c])}function getAllStylesUsed(e){const t=[];for(const n of e.steps)for(const o in n.styles)t.indexOf(o)===-1&&t.push(o);return t}function triggerAnimation(e){const t=Array.prototype.slice.call(document.getElementsByClassName(e.elementId||e.id||""));if(!t.length){warnElementNotPresent(e.elementId||e.id||"");return}Array.from(t).forEach(n=>{augmentAnimation(e,n),n.style.transition="none",n.style.transitionDelay="0",assign(n.style,e.steps[0].styles),setTimeout(()=>{n.style.transition=`all ${e.duration}s ${camelCaseToKebabCase(e.easing)}`,e.delay&&(n.style.transitionDelay=e.delay+"s"),assign(n.style,e.steps[1].styles),setTimeout(()=>{n.style.transition="",n.style.transitionDelay=""},(e.delay||0)*1e3+e.duration*1e3+100)})})}const getCssFromFont=e=>{var i;const t=e.family+(e.kind&&!e.kind.includes("#")?", "+e.kind:""),n=t.split(",")[0],o=e.fileUrl??((i=e==null?void 0:e.files)==null?void 0:i.regular);let r="";if(o&&t&&n&&(r+=`
|
|
174
|
+
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 fetch$1=getFetch();function flatten(e,t=null,n="."){return Object.keys(e).reduce((o,r)=>{const i=e[r],a=[t,r].filter(Boolean).join(n);return[typeof i=="object",i!==null,!(Array.isArray(i)&&i.length===0)].every(Boolean)?{...o,...flatten(i,a,n)}:{...o,[a]:i}},{})}const DEFAULT_API_VERSION="v3",BUILDER_SEARCHPARAMS_PREFIX="builder.",BUILDER_OPTIONS_PREFIX="options.",convertSearchParamsToQueryObject=e=>{const t={};return e.forEach((n,o)=>{t[o]=n}),t},getBuilderSearchParams=e=>{if(!e)return{};const t=normalizeSearchParams(e),n={};return Object.keys(t).forEach(o=>{if(o.startsWith(BUILDER_SEARCHPARAMS_PREFIX)){const r=o.replace(BUILDER_SEARCHPARAMS_PREFIX,"").replace(BUILDER_OPTIONS_PREFIX,"");n[r]=t[o]}}),n},getBuilderSearchParamsFromWindow=()=>{if(!isBrowser())return{};const e=new URLSearchParams(window.location.search);return getBuilderSearchParams(e)},normalizeSearchParams=e=>e instanceof URLSearchParams?convertSearchParamsToQueryObject(e):e,isPositiveNumber=e=>typeof e=="number"&&!isNaN(e)&&e>=0,generateContentUrl=e=>{let{noTraverse:t=!1}=e;const{limit:n=30,userAttributes:o,query:r,model:i,apiKey:a,includeRefs:s=!0,enrich:c,locale:m,apiVersion:f=DEFAULT_API_VERSION,fields:p,omit:g,offset:u,cacheSeconds:l,staleCacheSeconds:d,sort:b,includeUnpublished:y}=e;if(!a)throw new Error("Missing API key");if(!["v3"].includes(f))throw new Error(`Invalid apiVersion: expected 'v3', received '${f}'`);(e.limit===void 0||e.limit>1)&&!("noTraverse"in e)&&(t=!0);const h=new URL(`https://cdn.builder.io/api/${f}/content/${i}?apiKey=${a}&limit=${n}&noTraverse=${t}&includeRefs=${s}${m?`&locale=${m}`:""}${c?`&enrich=${c}`:""}`);if(h.searchParams.set("omit",g||"meta.componentsUsed"),p&&h.searchParams.set("fields",p),Number.isFinite(u)&&u>-1&&h.searchParams.set("offset",String(Math.floor(u))),typeof y=="boolean"&&h.searchParams.set("includeUnpublished",String(y)),l&&isPositiveNumber(l)&&h.searchParams.set("cacheSeconds",String(l)),d&&isPositiveNumber(d)&&h.searchParams.set("staleCacheSeconds",String(d)),b){const S=flatten({sort:b});for(const x in S)h.searchParams.set(x,JSON.stringify(S[x]))}const k={...getBuilderSearchParamsFromWindow(),...normalizeSearchParams(e.options||{})},C=flatten(k);for(const S in C)h.searchParams.set(S,String(C[S]));if(o&&h.searchParams.set("userAttributes",JSON.stringify(o)),r){const S=flatten({query:r});for(const x in S)h.searchParams.set(x,JSON.stringify(S[x]))}return h},checkContentHasResults=e=>"results"in e;async function fetchOneEntry(e){const t=await fetchEntries({...e,limit:1});return t&&t[0]||null}const getContent=fetchOneEntry,_fetchContent=async e=>{const t=generateContentUrl(e);return await(await fetch$1(t.href)).json()},_processContentResult=async(e,t,n=generateContentUrl(e))=>{const o=getDefaultCanTrack(e.canTrack);if(n.search.includes("preview=")){const i=[];for(const a of t.results){const s=getPreviewContent(n.searchParams);i.push(s||a)}t.results=i}if(!o||!(isBrowser()||TARGET==="reactNative"))return t.results;try{const i=[];for(const a of t.results)i.push(await handleABTesting({item:a,canTrack:o}));t.results=i}catch(i){logger.error("Could not process A/B tests. ",i)}return t.results};async function fetchEntries(e){try{const t=generateContentUrl(e),n=await _fetchContent(e);return checkContentHasResults(n)?_processContentResult(e,n):(logger.error("Error fetching data. ",{url:t,content:n,options:e}),null)}catch(t){return logger.error("Error fetching data. ",t),null}}const getAllContent=fetchEntries;function isPreviewing(){return!isBrowser()||isEditing()?!1:location.search.indexOf("builder.preview=")!==-1}function uuidv4(){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 uuid(){return uuidv4().replace(/-/g,"")}const SESSION_LOCAL_STORAGE_KEY="builderSessionId",getSessionId=async({canTrack:e})=>{if(!e)return;const t=await getCookie({name:SESSION_LOCAL_STORAGE_KEY,canTrack:e});if(checkIsDefined(t))return t;{const n=createSessionId();return setSessionId({id:n,canTrack:e}),n}},createSessionId=()=>uuid(),setSessionId=({id:e,canTrack:t})=>setCookie({name:SESSION_LOCAL_STORAGE_KEY,value:e,canTrack:t}),getLocalStorage=()=>isBrowser()&&typeof localStorage<"u"?localStorage:void 0,getLocalStorageItem=({key:e,canTrack:t})=>{var n;try{return t?(n=getLocalStorage())==null?void 0:n.getItem(e):void 0}catch(o){console.debug("[LocalStorage] GET error: ",o);return}},setLocalStorageItem=({key:e,canTrack:t,value:n})=>{var o;try{t&&((o=getLocalStorage())==null||o.setItem(e,n))}catch(r){console.debug("[LocalStorage] SET error: ",r)}},VISITOR_LOCAL_STORAGE_KEY="builderVisitorId",getVisitorId=({canTrack:e})=>{if(!e)return;const t=getLocalStorageItem({key:VISITOR_LOCAL_STORAGE_KEY,canTrack:e});if(checkIsDefined(t))return t;{const n=createVisitorId();return setVisitorId({id:n,canTrack:e}),n}},createVisitorId=()=>uuid(),setVisitorId=({id:e,canTrack:t})=>setLocalStorageItem({key:VISITOR_LOCAL_STORAGE_KEY,value:e,canTrack:t}),getTrackingEventData=async({canTrack:e})=>{if(!e)return{visitorId:void 0,sessionId:void 0};const t=await getSessionId({canTrack:e}),n=getVisitorId({canTrack:e});return{sessionId:t,visitorId:n}},createEvent=async({type:e,canTrack:t,apiKey:n,metadata:o,...r})=>({type:e,data:{...r,metadata:{url:location.href,...o},...await getTrackingEventData({canTrack:t}),userAttributes:getUserAttributes(),ownerId:n}});async function _track(e){if(!e.apiKey){logger.error("Missing API key for track call. Please provide your API key.");return}if(e.canTrack&&!isEditing()&&(isBrowser()||TARGET==="reactNative"))return fetch("https://cdn.builder.io/api/v1/track",{method:"POST",body:JSON.stringify({events:[await createEvent(e)]}),headers:{"content-type":"application/json"},mode:"cors"}).catch(t=>{console.error("Failed to track: ",t)})}const track=e=>_track({...e,canTrack:!0});function round(e){return Math.round(e*1e3)/1e3}const findParentElement=(e,t,n=!0)=>{if(!(e instanceof HTMLElement))return null;let o=n?e:e.parentElement;do{if(!o)return null;if(t(o))return o}while(o=o.parentElement);return null},findBuilderParent=e=>findParentElement(e,t=>{const n=t.getAttribute("builder-id")||t.id;return(n==null?void 0:n.indexOf("builder-"))===0}),computeOffset=({event:e,target:t})=>{const n=t.getBoundingClientRect(),o=e.clientX-n.left,r=e.clientY-n.top,i=round(o/n.width),a=round(r/n.height);return{x:i,y:a}},getInteractionPropertiesForEvent=e=>{const t=e.target,n=t&&findBuilderParent(t),o=(n==null?void 0:n.getAttribute("builder-id"))||(n==null?void 0:n.id);return{targetBuilderElement:o||void 0,metadata:{targetOffset:t?computeOffset({event:e,target:t}):void 0,builderTargetOffset:n?computeOffset({event:e,target:n}):void 0,builderElementIndex:n&&o?[].slice.call(document.getElementsByClassName(o)).indexOf(n):void 0}}},DEFAULT_TRUSTED_HOSTS=["*.beta.builder.io","beta.builder.io","builder.io","localhost","qa.builder.io"];function isFromTrustedHost(e,t){const n=new URL(t.origin),o=n.hostname;return(e||DEFAULT_TRUSTED_HOSTS).findIndex(r=>r.startsWith("*.")?o.endsWith(r.slice(1)):r===o)>-1}const SDK_VERSION="0.13.3",registry={};function register(e,t){let n=registry[e];if(n||(n=registry[e]=[]),n.push(t),isBrowser()){const o={type:"builder.register",data:{type:e,info:t}};try{parent.postMessage(o,"*"),parent!==window&&window.postMessage(o,"*")}catch(r){console.debug("Could not postmessage",r)}}}const registerInsertMenu=()=>{register("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 isSetupForEditing=!1;const setupBrowserForEditing=(e={})=>{var t,n;isSetupForEditing||(isSetupForEditing=!0,isBrowser()&&((t=window.parent)==null||t.postMessage({type:"builder.sdkInfo",data:{target:TARGET,version:SDK_VERSION,supportsPatchUpdates:!1,supportsAddBlockScoping:!0,supportsCustomBreakpoints:!0}},"*"),(n=window.parent)==null||n.postMessage({type:"builder.updateContent",data:{options:e}},"*"),window.addEventListener("message",o=>{var i,a;if(!isFromTrustedHost(e.trustedHosts,o))return;const{data:r}=o;if(r!=null&&r.type)switch(r.type){case"builder.evaluate":{const s=r.data.text,c=r.data.arguments||[],m=r.data.id,f=new Function(s);let p,g=null;try{p=f.apply(null,c)}catch(u){g=u}g?(i=window.parent)==null||i.postMessage({type:"builder.evaluateError",data:{id:m,error:g.message}},"*"):p&&typeof p.then=="function"?p.then(u=>{var l;(l=window.parent)==null||l.postMessage({type:"builder.evaluateResult",data:{id:m,result:u}},"*")}).catch(console.error):(a=window.parent)==null||a.postMessage({type:"builder.evaluateResult",data:{result:p,id:m}},"*");break}}})))},createEditorListener=({model:e,trustedHosts:t,callbacks:n})=>o=>{if(!isFromTrustedHost(t,o))return;const{data:r}=o;if(r)switch(r.type){case"builder.configureSdk":{n.configureSdk(r.data);break}case"builder.triggerAnimation":{n.animation(r.data);break}case"builder.contentUpdate":{const i=r.data,a=i.key||i.alias||i.entry||i.modelName,s=i.data;a===e&&n.contentUpdate(s);break}}},subscribeToEditor=(e,t,n)=>{if(!isBrowser)return logger.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."),()=>{};setupBrowserForEditing();const o=createEditorListener({callbacks:{contentUpdate:t,animation:()=>{},configureSdk:()=>{}},model:e,trustedHosts:n==null?void 0:n.trustedHosts});return window.addEventListener("message",o),()=>{window.removeEventListener("message",o)}};function assign(e,...t){const n=Object(e);for(let o=1;o<arguments.length;o++){const r=arguments[o];if(r!=null)for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])}return n}const camelCaseToKebabCase=e=>e?e.replace(/([A-Z])/g,t=>`-${t[0].toLowerCase()}`):"";function warnElementNotPresent(e){console.warn(`Cannot animate element: element with ID ${e} not found!`)}function augmentAnimation(e,t){const n=getAllStylesUsed(e),o=getComputedStyle(t),r=e.steps[0].styles,i=e.steps[e.steps.length-1].styles,a=[r,i];for(const s of a)for(const c of n)c in s||(s[c]=o[c])}function getAllStylesUsed(e){const t=[];for(const n of e.steps)for(const o in n.styles)t.indexOf(o)===-1&&t.push(o);return t}function triggerAnimation(e){const t=Array.prototype.slice.call(document.getElementsByClassName(e.elementId||e.id||""));if(!t.length){warnElementNotPresent(e.elementId||e.id||"");return}Array.from(t).forEach(n=>{augmentAnimation(e,n),n.style.transition="none",n.style.transitionDelay="0",assign(n.style,e.steps[0].styles),setTimeout(()=>{n.style.transition=`all ${e.duration}s ${camelCaseToKebabCase(e.easing)}`,e.delay&&(n.style.transitionDelay=e.delay+"s"),assign(n.style,e.steps[1].styles),setTimeout(()=>{n.style.transition="",n.style.transitionDelay=""},(e.delay||0)*1e3+e.duration*1e3+100)})})}const getCssFromFont=e=>{var i;const t=e.family+(e.kind&&!e.kind.includes("#")?", "+e.kind:""),n=t.split(",")[0],o=e.fileUrl??((i=e==null?void 0:e.files)==null?void 0:i.regular);let r="";if(o&&t&&n&&(r+=`
|
|
175
175
|
@font-face {
|
|
176
176
|
font-family: "${t}";
|
|
177
177
|
src: local("${n}"), url('${o}') format('woff2');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LRUCache } from "lru-cache";
|
|
2
2
|
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { I as InteractiveElement, B as BlockWrapper, a as BlocksWrapper, D as DynamicRenderer, C as CustomCode, E as Embed, b as ImgComponent, V as Video, c as Button, F as FragmentComponent, d as Image, S as SectionComponent, e as EnableEditor } from "./USE_CLIENT_BUNDLE-
|
|
3
|
+
import { I as InteractiveElement, B as BlockWrapper, a as BlocksWrapper, D as DynamicRenderer, C as CustomCode, E as Embed, b as ImgComponent, V as Video, c as Button, F as FragmentComponent, d as Image, S as SectionComponent, e as EnableEditor } from "./USE_CLIENT_BUNDLE-d1e6dcd3.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import "next/navigation";
|
|
6
6
|
const EMPTY_HTML_ELEMENTS = /* @__PURE__ */ new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"]), isEmptyElement = (e) => typeof e == "string" && EMPTY_HTML_ELEMENTS.has(e.toLowerCase()), TARGET = "rsc", getClassPropName = () => {
|
|
@@ -888,7 +888,7 @@ function Columns(e) {
|
|
|
888
888
|
/* @__PURE__ */ jsxs(
|
|
889
889
|
"div",
|
|
890
890
|
{
|
|
891
|
-
className: `builder-columns ${e.builderBlock.id}-breakpoints div-
|
|
891
|
+
className: `builder-columns ${e.builderBlock.id}-breakpoints div-65bb9135`,
|
|
892
892
|
style: m(),
|
|
893
893
|
children: [
|
|
894
894
|
/* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(InlinedStyles, { styles: g() }) }),
|
|
@@ -924,7 +924,7 @@ function Columns(e) {
|
|
|
924
924
|
]
|
|
925
925
|
}
|
|
926
926
|
),
|
|
927
|
-
/* @__PURE__ */ jsx("style", { children: `.div-
|
|
927
|
+
/* @__PURE__ */ jsx("style", { children: `.div-65bb9135 {
|
|
928
928
|
display: flex;
|
|
929
929
|
line-height: normal;
|
|
930
930
|
}` })
|
|
@@ -2236,7 +2236,7 @@ function isFromTrustedHost(e, t) {
|
|
|
2236
2236
|
const n = new URL(t.origin), o = n.hostname;
|
|
2237
2237
|
return (e || DEFAULT_TRUSTED_HOSTS).findIndex((r) => r.startsWith("*.") ? o.endsWith(r.slice(1)) : r === o) > -1;
|
|
2238
2238
|
}
|
|
2239
|
-
const SDK_VERSION = "0.13.
|
|
2239
|
+
const SDK_VERSION = "0.13.3", registry = {};
|
|
2240
2240
|
function register(e, t) {
|
|
2241
2241
|
let n = registry[e];
|
|
2242
2242
|
if (n || (n = registry[e] = []), n.push(t), isBrowser()) {
|
package/lib/node/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./bundle-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./bundle-3f825965.cjs"),t=require("./USE_CLIENT_BUNDLE-85cf7e92.cjs");require("lru-cache");require("react/jsx-runtime");require("react");require("next/navigation");require("./USE_SERVER_BUNDLE-1aafe1f0.cjs");exports.Blocks=e.Blocks;exports.Columns=e.Columns;exports.Content=e.ContentVariants;exports.RenderBlocks=e.RenderBlocks;exports.RenderContent=e.RenderContent;exports.Symbol=e.Symbol;exports.Text=e.Text;exports._processContentResult=e._processContentResult;exports.createRegisterComponentMessage=e.createRegisterComponentMessage;exports.fetchBuilderProps=e.fetchBuilderProps;exports.fetchEntries=e.fetchEntries;exports.fetchOneEntry=e.fetchOneEntry;exports.getAllContent=e.getAllContent;exports.getBuilderSearchParams=e.getBuilderSearchParams;exports.getContent=e.getContent;exports.isEditing=e.isEditing;exports.isPreviewing=e.isPreviewing;exports.register=e.register;exports.setEditorSettings=e.setEditorSettings;exports.subscribeToEditor=e.subscribeToEditor;exports.track=e.track;exports.Button=t.Button;exports.Fragment=t.FragmentComponent;exports.Image=t.Image;exports.Section=t.SectionComponent;exports.Video=t.Video;
|
package/lib/node/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { B as i, x as c, C as m, R as g, w as p, S as d, T as l, G as C, p as u, F as B, H as E, q as S, I as f, A as R, J as h, c as x, j as b, y as k, z as y, E as F, D as P } from "./bundle-
|
|
2
|
-
import { c as w, F as A, d as I, S as V, V as j } from "./USE_CLIENT_BUNDLE-
|
|
1
|
+
import { B as i, x as c, C as m, R as g, w as p, S as d, T as l, G as C, p as u, F as B, H as E, q as S, I as f, A as R, J as h, c as x, j as b, y as k, z as y, E as F, D as P } from "./bundle-42fea3bc.js";
|
|
2
|
+
import { c as w, F as A, d as I, S as V, V as j } from "./USE_CLIENT_BUNDLE-d1e6dcd3.js";
|
|
3
3
|
import "lru-cache";
|
|
4
4
|
import "react/jsx-runtime";
|
|
5
5
|
import "react";
|
|
6
6
|
import "next/navigation";
|
|
7
|
-
import "./USE_SERVER_BUNDLE-
|
|
7
|
+
import "./USE_SERVER_BUNDLE-601fafbe.js";
|
|
8
8
|
export {
|
|
9
9
|
i as Blocks,
|
|
10
10
|
w as Button,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@builder.io/sdk-react-nextjs",
|
|
3
3
|
"description": "Builder.io RSC SDK for NextJS App Directory",
|
|
4
|
-
"version": "0.13.
|
|
4
|
+
"version": "0.13.3",
|
|
5
5
|
"homepage": "https://github.com/BuilderIO/builder/tree/main/packages/sdks/output/nextjs",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import type { PropsWithBuilderData } from "../../types/builder-props.js";
|
|
3
2
|
import type { ColumnProps } from "./columns.types.js";
|
|
4
|
-
declare function Columns(props:
|
|
3
|
+
declare function Columns(props: ColumnProps): React.JSX.Element;
|
|
5
4
|
export default Columns;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { BuilderBlock } from '../../types/builder-block.js';
|
|
2
|
-
import type { BuilderComponentsProp, BuilderLinkComponentProp } from '../../types/builder-props.js';
|
|
2
|
+
import type { BuilderComponentsProp, BuilderDataProps, BuilderLinkComponentProp } from '../../types/builder-props.js';
|
|
3
3
|
type Column = {
|
|
4
4
|
blocks: BuilderBlock[];
|
|
5
5
|
width?: number;
|
|
6
6
|
link?: string;
|
|
7
7
|
};
|
|
8
8
|
type StackColumnsAt = 'tablet' | 'mobile' | 'never';
|
|
9
|
-
export interface ColumnProps extends BuilderComponentsProp, BuilderLinkComponentProp {
|
|
9
|
+
export interface ColumnProps extends BuilderComponentsProp, BuilderLinkComponentProp, BuilderDataProps {
|
|
10
10
|
columns?: Column[];
|
|
11
11
|
space?: number;
|
|
12
12
|
stackColumnsAt?: StackColumnsAt;
|
|
@@ -2,7 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
/**
|
|
3
3
|
* This import is used by the Svelte SDK. Do not remove.
|
|
4
4
|
*/
|
|
5
|
-
export type FormProps =
|
|
5
|
+
export type FormProps = BuilderDataProps & BuilderComponentsProp & BuilderLinkComponentProp & {
|
|
6
6
|
attributes?: any;
|
|
7
7
|
name?: string;
|
|
8
8
|
action?: string;
|
|
@@ -22,12 +22,12 @@ export type FormProps = PropsWithBuilderData<BuilderComponentsProp & BuilderLink
|
|
|
22
22
|
sendingMessage?: BuilderBlock[];
|
|
23
23
|
resetFormOnSubmit?: boolean;
|
|
24
24
|
errorMessagePath?: string;
|
|
25
|
-
}
|
|
25
|
+
};
|
|
26
26
|
/**
|
|
27
27
|
* This import is used by the Svelte SDK. Do not remove.
|
|
28
28
|
*/
|
|
29
29
|
export type FormState = "unsubmitted" | "sending" | "success" | "error";
|
|
30
30
|
import type { BuilderBlock } from "../../../types/builder-block.js";
|
|
31
|
-
import type { BuilderComponentsProp,
|
|
31
|
+
import type { BuilderComponentsProp, BuilderDataProps, BuilderLinkComponentProp } from "../../../types/builder-props.js";
|
|
32
32
|
declare function FormComponent(props: FormProps): React.JSX.Element;
|
|
33
33
|
export default FormComponent;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
export type DropzoneProps =
|
|
2
|
+
export type DropzoneProps = BuilderDataProps & {
|
|
3
3
|
name: string;
|
|
4
4
|
attributes: any;
|
|
5
|
-
}
|
|
6
|
-
import type {
|
|
5
|
+
};
|
|
6
|
+
import type { BuilderDataProps } from "../../types/builder-props.js";
|
|
7
7
|
declare function Slot(props: DropzoneProps): React.JSX.Element;
|
|
8
8
|
export default Slot;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import type { PropsWithBuilderData } from "../../types/builder-props.js";
|
|
3
2
|
import type { SymbolProps } from "./symbol.types.js";
|
|
4
|
-
declare function Symbol(props:
|
|
3
|
+
declare function Symbol(props: SymbolProps): Promise<React.JSX.Element>;
|
|
5
4
|
export default Symbol;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BuilderContent } from '../../types/builder-content.js';
|
|
2
|
-
import type { BuilderComponentsProp, BuilderLinkComponentProp } from '../../types/builder-props.js';
|
|
2
|
+
import type { BuilderComponentsProp, BuilderDataProps, BuilderLinkComponentProp } from '../../types/builder-props.js';
|
|
3
3
|
interface SymbolInfo {
|
|
4
4
|
model?: string;
|
|
5
5
|
entry?: string;
|
|
@@ -8,7 +8,7 @@ interface SymbolInfo {
|
|
|
8
8
|
inline?: boolean;
|
|
9
9
|
dynamic?: boolean;
|
|
10
10
|
}
|
|
11
|
-
export interface SymbolProps extends BuilderComponentsProp, BuilderLinkComponentProp {
|
|
11
|
+
export interface SymbolProps extends BuilderComponentsProp, BuilderDataProps, BuilderLinkComponentProp {
|
|
12
12
|
symbol?: SymbolInfo;
|
|
13
13
|
dataOnly?: boolean;
|
|
14
14
|
dynamic?: boolean;
|
|
@@ -4,12 +4,12 @@ type BlockWrapperProps = {
|
|
|
4
4
|
block: BuilderBlock;
|
|
5
5
|
context: BuilderContextInterface;
|
|
6
6
|
linkComponent: any;
|
|
7
|
+
children?: any;
|
|
7
8
|
};
|
|
8
9
|
/**
|
|
9
10
|
* This component renders a block's wrapper HTML element (from the block's `tagName` property).
|
|
10
11
|
*/
|
|
11
12
|
import type { BuilderContextInterface } from "../../../context/types.js";
|
|
12
13
|
import type { BuilderBlock } from "../../../types/builder-block.js";
|
|
13
|
-
|
|
14
|
-
declare function BlockWrapper(props: PropsWithChildren<BlockWrapperProps>): React.JSX.Element;
|
|
14
|
+
declare function BlockWrapper(props: BlockWrapperProps): React.JSX.Element;
|
|
15
15
|
export default BlockWrapper;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { BuilderContextInterface, RegisteredComponents } from '../../../../context/types.js';
|
|
2
2
|
import type { BuilderBlock } from '../../../../types/builder-block.js';
|
|
3
|
-
import type {
|
|
3
|
+
import type { BuilderDataProps } from '../../../../types/builder-props.js';
|
|
4
4
|
import type { InteractiveElementProps } from '../interactive-element.js';
|
|
5
|
-
type ComponentOptions =
|
|
5
|
+
type ComponentOptions = BuilderDataProps & {
|
|
6
6
|
[index: string]: any;
|
|
7
7
|
attributes?: {
|
|
8
8
|
[index: string]: any;
|
|
9
9
|
};
|
|
10
|
-
}
|
|
10
|
+
};
|
|
11
11
|
export interface ComponentProps {
|
|
12
12
|
componentRef: any;
|
|
13
13
|
componentOptions: ComponentOptions;
|
|
@@ -5,9 +5,10 @@ export type InteractiveElementProps = {
|
|
|
5
5
|
context: BuilderContextInterface;
|
|
6
6
|
wrapperProps: Dictionary<any>;
|
|
7
7
|
includeBlockProps: boolean;
|
|
8
|
+
children?: any;
|
|
8
9
|
};
|
|
9
10
|
import type { BuilderContextInterface } from "../../../context/types.js";
|
|
10
11
|
import type { BuilderBlock } from "../../../types/builder-block.js";
|
|
11
|
-
import type { Dictionary
|
|
12
|
-
declare function InteractiveElement(props:
|
|
12
|
+
import type { Dictionary } from "../../../types/typescript.js";
|
|
13
|
+
declare function InteractiveElement(props: InteractiveElementProps): React.JSX.Element;
|
|
13
14
|
export default InteractiveElement;
|
|
@@ -12,8 +12,8 @@ export type BlocksWrapperProps = {
|
|
|
12
12
|
* Additonal props to pass to `blocksWrapper`. Defaults to `{}`.
|
|
13
13
|
*/
|
|
14
14
|
BlocksWrapperProps: any;
|
|
15
|
+
children?: any;
|
|
15
16
|
};
|
|
16
17
|
import type { BuilderBlock } from "../../types/builder-block.js";
|
|
17
|
-
|
|
18
|
-
declare function BlocksWrapper(props: PropsWithChildren<BlocksWrapperProps>): React.JSX.Element;
|
|
18
|
+
declare function BlocksWrapper(props: BlocksWrapperProps): React.JSX.Element;
|
|
19
19
|
export default BlocksWrapper;
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import type { BuilderRenderState } from '../../context/types.js';
|
|
2
|
-
|
|
3
|
-
import type { ContentVariantsPrps } from '../content-variants/content-variants.types.js';
|
|
4
|
-
interface InternalRenderProps {
|
|
5
|
-
showContent: boolean;
|
|
6
|
-
isSsrAbTest: boolean;
|
|
7
|
-
}
|
|
8
|
-
export type ContentProps = InternalRenderProps & EnforcePartials<ContentVariantsPrps>;
|
|
2
|
+
export type { ContentProps } from './contentProps.types.js';
|
|
9
3
|
export interface BuilderComponentStateChange {
|
|
10
4
|
state: BuilderRenderState;
|
|
11
5
|
ref: {
|
|
@@ -17,4 +11,3 @@ export interface BuilderComponentStateChange {
|
|
|
17
11
|
};
|
|
18
12
|
};
|
|
19
13
|
}
|
|
20
|
-
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { EnforcePartials } from '../../types/enforced-partials.js';
|
|
2
|
+
import type { ContentVariantsPrps } from '../content-variants/content-variants.types.js';
|
|
3
|
+
interface InternalRenderProps {
|
|
4
|
+
showContent: boolean;
|
|
5
|
+
isSsrAbTest: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* This is in a separate file so that we can override it (most notably in Vue,
|
|
9
|
+
* where prop types cannot be wrapped by generics like `EnforcePartials`).
|
|
10
|
+
*/
|
|
11
|
+
export type ContentProps = InternalRenderProps & EnforcePartials<ContentVariantsPrps>;
|
|
12
|
+
export {};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
export interface DynamicRendererProps {
|
|
3
|
+
children?: any;
|
|
4
4
|
TagName: any;
|
|
5
5
|
attributes: any;
|
|
6
6
|
actionAttributes: any;
|
|
7
|
-
}
|
|
7
|
+
}
|
|
8
|
+
declare function DynamicRenderer(props: DynamicRendererProps): React.JSX.Element;
|
|
8
9
|
export default DynamicRenderer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.13.
|
|
1
|
+
export declare const SDK_VERSION = "0.13.3";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BuilderContextInterface, RegisteredComponents } from '../context/types.js';
|
|
2
2
|
import type { BuilderBlock } from './builder-block.js';
|
|
3
|
-
export type
|
|
3
|
+
export type BuilderDataProps = {
|
|
4
4
|
builderBlock: BuilderBlock;
|
|
5
5
|
builderContext: BuilderContextInterface;
|
|
6
6
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import type { PropsWithBuilderData } from "../../types/builder-props.js";
|
|
3
2
|
import type { ColumnProps } from "./columns.types.js";
|
|
4
|
-
declare function Columns(props:
|
|
3
|
+
declare function Columns(props: ColumnProps): React.JSX.Element;
|
|
5
4
|
export default Columns;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { BuilderBlock } from '../../types/builder-block.js';
|
|
2
|
-
import type { BuilderComponentsProp, BuilderLinkComponentProp } from '../../types/builder-props.js';
|
|
2
|
+
import type { BuilderComponentsProp, BuilderDataProps, BuilderLinkComponentProp } from '../../types/builder-props.js';
|
|
3
3
|
type Column = {
|
|
4
4
|
blocks: BuilderBlock[];
|
|
5
5
|
width?: number;
|
|
6
6
|
link?: string;
|
|
7
7
|
};
|
|
8
8
|
type StackColumnsAt = 'tablet' | 'mobile' | 'never';
|
|
9
|
-
export interface ColumnProps extends BuilderComponentsProp, BuilderLinkComponentProp {
|
|
9
|
+
export interface ColumnProps extends BuilderComponentsProp, BuilderLinkComponentProp, BuilderDataProps {
|
|
10
10
|
columns?: Column[];
|
|
11
11
|
space?: number;
|
|
12
12
|
stackColumnsAt?: StackColumnsAt;
|