@builder.io/sdk-react 4.2.3 → 4.2.4
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 +1 -1
- package/lib/browser/blocks-exports.mjs +2 -2
- package/lib/browser/index.cjs +1 -1
- package/lib/browser/index.mjs +1 -1
- package/lib/browser/{server-entry-331e2fd4.js → server-entry-1c122812.js} +1 -1
- package/lib/browser/{server-entry-0817de95.cjs → server-entry-4452b993.cjs} +1 -1
- package/lib/browser/server-entry.cjs +1 -1
- package/lib/browser/server-entry.mjs +1 -1
- package/lib/edge/{accordion-1559ca68.cjs → accordion-3f30d417.cjs} +1 -1
- package/lib/edge/{accordion-3e9ee224.js → accordion-48a5b362.js} +1 -1
- package/lib/edge/{blocks-4f20c19a.cjs → blocks-3024bb2c.cjs} +1 -1
- package/lib/edge/{blocks-b9be7dc1.js → blocks-729e6331.js} +2 -2
- package/lib/edge/blocks-exports.cjs +1 -1
- package/lib/edge/blocks-exports.mjs +2 -2
- package/lib/edge/{button-ba852235.js → button-36cacb47.js} +2 -2
- package/lib/edge/{button-0a632d4f.cjs → button-8ab624e2.cjs} +1 -1
- package/lib/edge/{columns-66170ac9.cjs → columns-0d6d8b29.cjs} +1 -1
- package/lib/edge/{columns-ee2fba7b.js → columns-597b4a0e.js} +3 -3
- package/lib/edge/{content-variants-c013569a.js → content-variants-78e04173.js} +12 -12
- package/lib/edge/{content-variants-4f54d98a.cjs → content-variants-b2c99976.cjs} +2 -2
- package/lib/edge/{custom-code-38e2c9d5.js → custom-code-0a11f81d.js} +1 -1
- package/lib/edge/{custom-code-48579935.cjs → custom-code-1d8040fe.cjs} +1 -1
- package/lib/edge/{embed-1ce0435c.js → embed-5b2461a4.js} +1 -1
- package/lib/edge/{embed-9a7f29ff.cjs → embed-89e540df.cjs} +1 -1
- package/lib/edge/{form-d9b6dea6.cjs → form-46264810.cjs} +1 -1
- package/lib/edge/{form-f558f5d4.js → form-4f5ea678.js} +3 -3
- package/lib/edge/{get-class-prop-name-d2be9a48.cjs → get-class-prop-name-a8c4e896.cjs} +1 -1
- package/lib/edge/{get-class-prop-name-35ccd32a.js → get-class-prop-name-e31571bf.js} +1 -1
- package/lib/edge/{img-a1e0f10e.js → img-194b08ce.js} +2 -2
- package/lib/edge/{img-b21eb075.cjs → img-821534bf.cjs} +1 -1
- package/lib/edge/index.cjs +1 -1
- package/lib/edge/index.mjs +1 -1
- package/lib/edge/{input-6854bc85.cjs → input-6d65470b.cjs} +1 -1
- package/lib/edge/{input-5c0d3350.js → input-cfd5294a.js} +1 -1
- package/lib/edge/{personalization-container-adf9e0bd.js → personalization-container-0d92ab21.js} +4 -4
- package/lib/edge/{personalization-container-f7fdc090.cjs → personalization-container-74138dc4.cjs} +1 -1
- package/lib/edge/{select-6c4637ae.cjs → select-cec6b7d9.cjs} +1 -1
- package/lib/edge/{select-713e73f6.js → select-d665e4e4.js} +1 -1
- package/lib/edge/{server-entry-0bef3cb1.cjs → server-entry-d79ba493.cjs} +1 -1
- package/lib/edge/{server-entry-71badd34.js → server-entry-fec7344c.js} +1 -1
- package/lib/edge/server-entry.cjs +1 -1
- package/lib/edge/server-entry.mjs +1 -1
- package/lib/edge/{slot-59a86f46.cjs → slot-4ad8e165.cjs} +1 -1
- package/lib/edge/{slot-a3c27352.js → slot-f2279693.js} +3 -3
- package/lib/edge/{symbol-3d81a9de.cjs → symbol-064c9433.cjs} +1 -1
- package/lib/edge/{symbol-86e5a3f0.js → symbol-93b85799.js} +2 -2
- package/lib/edge/{tabs-60f8bb61.js → tabs-d87f99ab.js} +3 -3
- package/lib/edge/{tabs-0d914e5c.cjs → tabs-f81e3a59.cjs} +1 -1
- package/lib/node/blocks-exports.cjs +1 -1
- package/lib/node/blocks-exports.mjs +4 -4
- package/lib/node/index.cjs +1 -1
- package/lib/node/index.mjs +3 -3
- package/lib/node/init.cjs +1 -1
- package/lib/node/init.mjs +3 -3
- package/lib/node/{server-entry-68823bb0.js → server-entry-b75016aa.js} +1 -1
- package/lib/node/{server-entry-05b0f263.cjs → server-entry-fec6b9d9.cjs} +1 -1
- package/lib/node/server-entry.cjs +1 -1
- package/lib/node/server-entry.mjs +1 -1
- package/lib/node/{setIvm-bb3d0e32.js → setIvm-6290921a.js} +1 -1
- package/lib/node/{setIvm-bec8f1ed.cjs → setIvm-9ebbab5f.cjs} +1 -1
- package/lib/node/setIvm.cjs +1 -1
- package/lib/node/setIvm.mjs +2 -2
- package/lib/node/{should-force-browser-runtime-in-node-bbbdf124.cjs → should-force-browser-runtime-in-node-209c023a.cjs} +1 -1
- package/lib/node/{should-force-browser-runtime-in-node-a4c71d14.js → should-force-browser-runtime-in-node-4ca1840a.js} +1 -1
- package/package.json +1 -1
- package/types/constants/sdk-version.d.ts +1 -1
- package/types/functions/get-builder-search-params/index.d.ts +8 -2
- package/types/functions/is-previewing.d.ts +11 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./server-entry-
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./server-entry-fec6b9d9.cjs"),r=require("react/jsx-runtime"),m=require("react"),U=require("./setIvm-9ebbab5f.cjs"),Xe=require("./should-force-browser-runtime-in-node-209c023a.cjs");function Ze(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const et=Ze(m),tt=new Set(["area","base","br","col","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),nt=e=>typeof e=="string"&&tt.has(e.toLowerCase());function ce(e){return r.jsx(r.Fragment,{children:nt(e.TagName)?r.jsx(r.Fragment,{children:r.jsx(e.TagName,{...e.attributes,...e.actionAttributes})}):r.jsx(r.Fragment,{children:typeof e.TagName=="string"?r.jsx(e.TagName,{...e.attributes,...e.actionAttributes,children:e.children}):r.jsx(e.TagName,{...e.attributes,...e.actionAttributes,children:e.children})})})}const H=()=>{switch(h.TARGET){case"react":case"reactNative":case"rsc":return"className";case"svelte":case"vue":case"solid":case"qwik":case"angular":return"class"}};function Te(e){function t(){return{...e.attributes,[H()]:`${e.link?"":"builder-button"} ${e.attributes[H()]||""}`,...e.link?{href:e.link,target:e.openLinkInNewTab?"_blank":void 0,role:"link"}:{role:"button"}}}return r.jsx(ce,{attributes:t(),TagName:e.link?e.builderLinkComponent||"a":"button",actionAttributes:{},children:e.text})}const G=m.createContext({content:null,context:{},localState:void 0,rootSetState(){},rootState:{},apiKey:null,apiVersion:void 0,componentInfos:{},inheritedStyles:{},BlocksWrapper:"div",BlocksWrapperProps:{},nonce:"",model:""}),Ie=m.createContext({registeredComponents:{}}),we=(e,t,n)=>{const i=String.prototype.split.call(t,/[,[\].]+?/).filter(Boolean).reduce((a,o)=>a!=null?a[o]:a,e);return i===void 0||i===e?n:i},it=({code:e,builder:t,context:n,event:i,localState:a,rootSetState:o,rootState:l})=>{const s=U.getFunctionArguments({builder:t,context:n,event:i,state:U.flattenState({rootState:l,localState:a,rootSetState:o})});return new Function(...s.map(([c])=>c),e)(...s.map(([,c])=>c))},at=e=>h.isBrowser()||Xe.shouldForceBrowserRuntimeInNode({shouldLogWarning:!0})?it(e):U.runInNode(e),rt=/^(return )?(\s*)?state(?<getPath>(\.\w+)+)(\s*);?$/,ot=/(\s)*var(\s)+_virtual_index(\s)*=(\s)*state(?<getPath>(\.\w+)+)(\s*);?(\s)*return(\s)*_virtual_index(\s)*/,lt=e=>{var t,n,i,a,o,l;return((i=(n=(t=rt.exec(e.trim()))==null?void 0:t.groups)==null?void 0:n.getPath)==null?void 0:i.slice(1))||((l=(o=(a=ot.exec(e.trim()))==null?void 0:a.groups)==null?void 0:o.getPath)==null?void 0:l.slice(1))};function M({code:e,context:t,localState:n,rootState:i,rootSetState:a,event:o,isExpression:l=!0}){if(e.trim()==="")return;const s=lt(e.trim());if(s)return we({...i,...n},s);const c={code:U.parseCode(e,{isExpression:l}),builder:U.getBuilderGlobals(),context:t,event:o,rootSetState:a,rootState:i,localState:n};try{return at(c)}catch(d){h.logger.error("Failed code evaluation: "+d.message,{code:e});return}}function st(e,t){var n;return{...(n=e.component)==null?void 0:n.options,...e.options,...ct(e,t)}}const ct=(e,t)=>{var n,i;if(((n=e.component)==null?void 0:n.name)==="Text"&&((i=e.component.options)!=null&&i.text)&&typeof e.component.options.text=="string")return{...e.component.options,text:e.component.options.text.replace(/{{([^}]+)}}/g,(a,o)=>M({code:o,context:t,localState:t.localState,rootState:t.rootState,rootSetState:t.rootSetState}))}};function ut(e,...t){const n=Object.assign({},e);for(const i of t)delete n[i];return n}function Z(e,t,n=null,i=null,a=new WeakSet){if(e==null||typeof e!="object"){t(e,o=>{n!==null&&i!==null&&(n[i]=o)});return}a.has(e)||(a.add(e),Array.isArray(e)?e.forEach((o,l)=>{t(o,c=>{e[l]=c}),Z(o,t,e,l,a)}):Object.entries(e).forEach(([o,l])=>{t(l,c=>{e[o]=c}),Z(l,t,e,o,a)}))}function Ee(e){return e&&typeof e=="object"&&e["@type"]==="@builder.io/core:LocalizedValue"}function dt(e){if(!e||!Object.getOwnPropertyNames(e).length)return!1;let t=!1;return Z(e,n=>{if(Ee(n)){t=!0;return}}),t}function mt(e,t){return!e||!Object.getOwnPropertyNames(e).length?{}:(Z(e,(n,i)=>{var a;Ee(n)&&i((a=n[t])!=null?a:void 0)}),e)}function ft(e,t){var n,i;return(n=e.component)!=null&&n.options&&dt((i=e.component)==null?void 0:i.options)&&(t||console.warn("[Builder.io] In order to use localized fields in Builder, you must pass a locale prop to the BuilderComponent or to options object while fetching the content to resolve localized fields. Learn more: https://www.builder.io/c/docs/localization-inline#targeting-and-inline-localization"),e.component.options=mt(e.component.options,t!=null?t:"Default")),e}function se(e){if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(n=>se(n));if(e["@type"]==="@builder.io/sdk:Element")return e;const t={};for(const n in e)n!=="meta"&&Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=se(e[n]));return t}const gt=["svelte","vue","angular","qwik","solid"].includes(h.TARGET),ht=e=>{if(gt){const t=U.fastClone(e);return{...t,properties:{...t.properties},actions:{...t.actions}}}else{const t=se(ut(e,"children","meta"));return{...t,properties:{...t.properties},actions:{...t.actions},children:e.children,meta:e.meta}}},bt=({block:e,context:t,localState:n,rootState:i,rootSetState:a})=>{if(!e.bindings)return e;const o=ht(e);for(const l in e.bindings){const s=e.bindings[l],c=M({code:s,localState:n,rootState:i,rootSetState:a,context:t});U.set(o,l,c)}return o};function yt({block:e,context:t,localState:n,rootState:i,rootSetState:a}){let o=e;return o=bt({block:o,localState:n,rootState:i,rootSetState:a,context:t}),o=ft(o,i.locale),o}const ee=e=>e?e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase():"";function pt(e,t,n={}){let i,a,o,l=null,s=0;const c=function(){s=n.leading===!1?0:Date.now(),l=null,o=e.apply(i,a),l||(i=a=null)};return function(){const d=Date.now();!s&&n.leading===!1&&(s=d);const b=t-(d-s);return i=this,a=arguments,b<=0||b>t?(l&&(clearTimeout(l),l=null),s=d,o=e.apply(i,a),l||(i=a=null)):!l&&n.trailing!==!1&&(l=setTimeout(c,b)),o}}function K(e,...t){const n=Object(e);for(let i=1;i<arguments.length;i++){const a=arguments[i];if(a!=null)for(const o in a)Object.prototype.hasOwnProperty.call(a,o)&&(n[o]=a[o])}return n}function xt(e){for(const t of e)switch(t.trigger){case"pageLoad":je(t);break;case"scrollInView":St(t);break}}function Re(e){console.warn(`Cannot animate element: element with ID ${e} not found!`)}function Pe(e,t){const n=vt(e),i=getComputedStyle(t),a=e.steps[0].styles,o=e.steps[e.steps.length-1].styles,l=[a,o];for(const s of l)for(const c of n)c in s||(s[c]=i[c])}function vt(e){const t=[];for(const n of e.steps)for(const i in n.styles)t.indexOf(i)===-1&&t.push(i);return t}function je(e){const t=Array.prototype.slice.call(document.getElementsByClassName(e.elementId||e.id||""));if(!t.length){Re(e.elementId||e.id||"");return}Array.from(t).forEach(n=>{Pe(e,n),n.style.transition="none",n.style.transitionDelay="0",K(n.style,e.steps[0].styles),setTimeout(()=>{n.style.transition=`all ${e.duration}s ${ee(e.easing)}`,e.delay&&(n.style.transitionDelay=e.delay+"s"),K(n.style,e.steps[1].styles),setTimeout(()=>{n.style.transition="",n.style.transitionDelay=""},(e.delay||0)*1e3+e.duration*1e3+100)})})}function St(e){const t=Array.prototype.slice.call(document.getElementsByClassName(e.elementId||e.id||""));if(!t.length){Re(e.elementId||e.id||"");return}Array.from(t).forEach(n=>{Pe(e,n);let i=!1,a=!1;function o(){!i&&s(n)?(i=!0,a=!0,setTimeout(()=>{K(n.style,e.steps[1].styles),e.repeat||document.removeEventListener("scroll",l),setTimeout(()=>{a=!1,e.repeat||(n.style.transition="",n.style.transitionDelay="")},(e.duration+(e.delay||0))*1e3+100)})):e.repeat&&i&&!a&&!s(n)&&(i=!1,K(n.style,e.steps[0].styles))}const l=pt(o,200,{leading:!1});function s(b){const p=b.getBoundingClientRect(),u=window.innerHeight,g=(e.thresholdPercent||0)/100*u;return p.bottom>g&&p.top<u-g}const c=e.steps[0].styles;function d(){K(n.style,c)}d(),setTimeout(()=>{n.style.transition=`all ${e.duration}s ${ee(e.easing)}`,e.delay&&(n.style.transitionDelay=e.delay+"s")}),document.addEventListener("scroll",l,{capture:!0,passive:!0}),o()})}const Ve=e=>Object.entries(e).map(([n,i])=>{if(typeof i=="string")return`${ee(n)}: ${i};`}).filter(h.checkIsDefined),kt=e=>Ve(e).join(`
|
|
2
2
|
`),z=({mediaQuery:e,className:t,styles:n})=>{const i=`.${t} {
|
|
3
3
|
${kt(n)}
|
|
4
4
|
}`;return e?`${e} {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { TARGET as F, isBrowser as G, logger as ee, checkIsDefined as ge, isPreviewing as oe, isEditing as U, userAttributesService as Te, getDefaultCanTrack as Z, logFetch as Le, setupBrowserForEditing as st, createRegisterComponentMessage as ct, getCookieSync as ut, _track as Ie, fetchOneEntry as Oe, createEditorListener as dt, serializeIncludingFunctions as we, handleABTestingSync as mt } from "./server-entry-
|
|
3
|
-
import { setClientUserAttributes as qi } from "./server-entry-
|
|
2
|
+
import { TARGET as F, isBrowser as G, logger as ee, checkIsDefined as ge, isPreviewing as oe, isEditing as U, userAttributesService as Te, getDefaultCanTrack as Z, logFetch as Le, setupBrowserForEditing as st, createRegisterComponentMessage as ct, getCookieSync as ut, _track as Ie, fetchOneEntry as Oe, createEditorListener as dt, serializeIncludingFunctions as we, handleABTestingSync as mt } from "./server-entry-b75016aa.js";
|
|
3
|
+
import { setClientUserAttributes as qi } from "./server-entry-b75016aa.js";
|
|
4
4
|
import { jsx as s, Fragment as w, jsxs as D } from "react/jsx-runtime";
|
|
5
5
|
import * as ft from "react";
|
|
6
6
|
import { createContext as _e, useEffect as N, useState as k, useContext as ye, useRef as z, createElement as Ue } from "react";
|
|
7
|
-
import { getFunctionArguments as ht, flattenState as bt, runInNode as gt, parseCode as yt, getBuilderGlobals as pt, set as He, fastClone as ve } from "./setIvm-
|
|
8
|
-
import { shouldForceBrowserRuntimeInNode as vt } from "./should-force-browser-runtime-in-node-
|
|
7
|
+
import { getFunctionArguments as ht, flattenState as bt, runInNode as gt, parseCode as yt, getBuilderGlobals as pt, set as He, fastClone as ve } from "./setIvm-6290921a.js";
|
|
8
|
+
import { shouldForceBrowserRuntimeInNode as vt } from "./should-force-browser-runtime-in-node-4ca1840a.js";
|
|
9
9
|
const xt = /* @__PURE__ */ new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"]), St = (e) => typeof e == "string" && xt.has(e.toLowerCase());
|
|
10
10
|
function xe(e) {
|
|
11
11
|
return /* @__PURE__ */ s(w, { children: St(e.TagName) ? /* @__PURE__ */ s(w, { children: /* @__PURE__ */ s(e.TagName, { ...e.attributes, ...e.actionAttributes }) }) : /* @__PURE__ */ s(w, { children: typeof e.TagName == "string" ? /* @__PURE__ */ s(e.TagName, { ...e.attributes, ...e.actionAttributes, children: e.children }) : /* @__PURE__ */ s(e.TagName, { ...e.attributes, ...e.actionAttributes, children: e.children }) }) });
|
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-fec6b9d9.cjs");require("react/jsx-runtime");require("react");require("./setIvm-9ebbab5f.cjs");require("./should-force-browser-runtime-in-node-209c023a.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.registerAction=e.registerAction;exports.setClientUserAttributes=e.setClientUserAttributes;exports.setEditorSettings=e.setEditorSettings;exports.subscribeToEditor=e.subscribeToEditor;exports.track=e.track;
|
package/lib/node/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Blocks as n, BuilderContext as m, Button as c, Columns as g, Content as p, Fragment as a, Image as l, Section as u, Symbol as d, Text as C, Video as f } from "./blocks-exports.mjs";
|
|
2
|
-
import { _processContentResult as E, createRegisterComponentMessage as b, fetchBuilderProps as h, fetchEntries as x, fetchOneEntry as S, getBuilderSearchParams as P, isEditing as k, isPreviewing as y, register as A, registerAction as R, setClientUserAttributes as T, setEditorSettings as v, subscribeToEditor as w, track as F } from "./server-entry-
|
|
2
|
+
import { _processContentResult as E, createRegisterComponentMessage as b, fetchBuilderProps as h, fetchEntries as x, fetchOneEntry as S, getBuilderSearchParams as P, isEditing as k, isPreviewing as y, register as A, registerAction as R, setClientUserAttributes as T, setEditorSettings as v, subscribeToEditor as w, track as F } from "./server-entry-b75016aa.js";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "react";
|
|
5
|
-
import "./setIvm-
|
|
6
|
-
import "./should-force-browser-runtime-in-node-
|
|
5
|
+
import "./setIvm-6290921a.js";
|
|
6
|
+
import "./should-force-browser-runtime-in-node-4ca1840a.js";
|
|
7
7
|
export {
|
|
8
8
|
n as Blocks,
|
|
9
9
|
m as BuilderContext,
|
package/lib/node/init.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./should-force-browser-runtime-in-node-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./should-force-browser-runtime-in-node-209c023a.cjs"),t=require("isolated-vm"),r=require("./setIvm-9ebbab5f.cjs");require("./server-entry-fec6b9d9.cjs");const n=e=>{if(o.shouldForceBrowserRuntimeInNode({shouldLogWarning:!0}))return;const{ivmIsolateOptions:i}=e||{};r.setIvm(t,i)};exports.initializeNodeRuntime=n;
|
package/lib/node/init.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { shouldForceBrowserRuntimeInNode as r } from "./should-force-browser-runtime-in-node-
|
|
1
|
+
import { shouldForceBrowserRuntimeInNode as r } from "./should-force-browser-runtime-in-node-4ca1840a.js";
|
|
2
2
|
import t from "isolated-vm";
|
|
3
|
-
import { setIvm as e } from "./setIvm-
|
|
4
|
-
import "./server-entry-
|
|
3
|
+
import { setIvm as e } from "./setIvm-6290921a.js";
|
|
4
|
+
import "./server-entry-b75016aa.js";
|
|
5
5
|
const u = (o) => {
|
|
6
6
|
if (r({
|
|
7
7
|
shouldLogWarning: !0
|
|
@@ -122,7 +122,7 @@ const L = "builder.", ht = "options.", j = (t) => {
|
|
|
122
122
|
return {};
|
|
123
123
|
const t = new URLSearchParams(window.location.search);
|
|
124
124
|
return j(t);
|
|
125
|
-
}, $ = "4.2.
|
|
125
|
+
}, $ = "4.2.4", G = () => ({
|
|
126
126
|
"X-Builder-SDK": b,
|
|
127
127
|
"X-Builder-SDK-GEN": "2",
|
|
128
128
|
"X-Builder-SDK-Version": $
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const b="react",A="[Builder.io]: ",f={log:(...t)=>console.log(A,...t),error:(...t)=>console.error(A,...t),warn:(...t)=>console.warn(A,...t),debug:(...t)=>console.debug(A,...t)};function a(){return typeof window!="undefined"&&typeof document!="undefined"}const St=t=>{const e={};return t.forEach((r,n)=>{e[n]=r}),e},j=t=>t instanceof URLSearchParams?St(t):t,G=t=>typeof t=="string"?t:t instanceof URLSearchParams?t.toString():new URLSearchParams(t).toString();function bt(){return a()&&window.self!==window.top}function $(t){return bt()&&G(t||window.location.search).indexOf("builder.frameEditing=")!==-1}const yt=()=>{if(a()){const t=new URL(location.href);return t.pathname===""&&(t.pathname="/"),t}else return console.warn("Cannot get location for tracking in non-browser environment"),null},mt=()=>typeof navigator=="object"&&navigator.userAgent||"",J=()=>{const t=mt(),e={Android(){return t.match(/Android/i)},BlackBerry(){return t.match(/BlackBerry/i)},iOS(){return t.match(/iPhone|iPod/i)},Opera(){return t.match(/Opera Mini/i)},Windows(){return t.match(/IEMobile/i)||t.match(/WPDesktop/i)},any(){return e.Android()||e.BlackBerry()||e.iOS()||e.Opera()||e.Windows()||b==="reactNative"}},r=t.match(/Tablet|iPad/i),n=yt();return{urlPath:n==null?void 0:n.pathname,host:(n==null?void 0:n.host)||(n==null?void 0:n.hostname),device:r?"tablet":e.any()?"mobile":"desktop"}},S=t=>t!=null;function wt(t){const e=t||(a()?window.location.search:void 0);return e?G(e).indexOf("builder.preview=")!==-1:!1}const Et=t=>({type:"builder.registerComponent",data:U(t)}),At=t=>{const e=t.toString().trim(),r=/^[a-zA-Z0-9_]+\s*=>/i.test(e);return`return (${!e.startsWith("function")&&!e.startsWith("async")&&!e.startsWith("(")&&!r?"function ":""}${e}).apply(this, arguments)`};function U(t){return JSON.parse(JSON.stringify(t,(e,r)=>typeof r=="function"?At(r):r))}const N={};function It(t,e){t==="plugin"&&(e=U(e));let r=N[t];if(r||(r=N[t]=[]),r.push(e),a()){const n={type:"builder.register",data:{type:t,info:e}};try{parent.postMessage(n,"*"),parent!==window&&window.postMessage(n,"*")}catch(s){console.debug("Could not postmessage",s)}}}function vt(t){var e;if(a()){const r=JSON.parse(JSON.stringify(t));t.action&&(r.action=t.action.toString()),(e=window.parent)==null||e.postMessage({type:"builder.registerAction",data:r},"*")}}const V={};function kt(t){if(a()){Object.assign(V,t);const e={type:"builder.settingsChange",data:V};parent.postMessage(e,"*")}}const D="builder.",Tt="options.",O=t=>{if(!t)return{};const e=j(t),r={};return Object.keys(e).forEach(n=>{if(n.startsWith(D)){const s=n.replace(D,"").replace(Tt,"");r[s]=e[n]}}),r},Ut=()=>{if(!a())return{};const t=new URLSearchParams(window.location.search);return O(t)},z="4.2.3",X=()=>({"X-Builder-SDK":b,"X-Builder-SDK-GEN":"2","X-Builder-SDK-Version":z}),Ot=t=>{if(t==="localhost"||t==="127.0.0.1")return t;const e=t.split(".");return e.length>2?e.slice(1).join("."):t},v=({name:t,canTrack:e})=>{var r;try{return e?(r=document.cookie.split("; ").find(n=>n.startsWith(`${t}=`)))==null?void 0:r.split("=")[1]:void 0}catch(n){f.warn("[COOKIE] GET error: ",(n==null?void 0:n.message)||n);return}},H=async t=>v(t),Pt=t=>t.map(([e,r])=>r?`${e}=${r}`:e).filter(S).join("; "),Rt=[["secure",""],["SameSite","None"]],Ct=({name:t,value:e,expires:r})=>{const s=(a()?location.protocol==="https:":!0)?Rt:[[]],o=r?[["expires",r.toUTCString()]]:[[]],i=[[t,e],...o,["path","/"],["domain",Ot(window.location.hostname)],...s];return Pt(i)},P=async({name:t,value:e,expires:r,canTrack:n})=>{try{if(!n)return;const s=Ct({name:t,value:e,expires:r});document.cookie=s}catch(s){f.warn("[COOKIE] SET error: ",(s==null?void 0:s.message)||s)}};function Bt(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t=="x"?e:e&3|8).toString(16)})}function Q(){return Bt().replace(/-/g,"")}const Y="builderSessionId",_t=async({canTrack:t})=>{if(!t)return;const e=await H({name:Y,canTrack:t});if(S(e))return e;{const r=xt();return Lt({id:r,canTrack:t}),r}},xt=()=>Q(),Lt=({id:t,canTrack:e})=>P({name:Y,value:t,canTrack:e}),Z=()=>a()&&typeof localStorage!="undefined"?localStorage:void 0,Nt=({key:t,canTrack:e})=>{var r;try{return e?(r=Z())==null?void 0:r.getItem(t):void 0}catch(n){console.debug("[LocalStorage] GET error: ",n);return}},Vt=({key:t,canTrack:e,value:r})=>{var n;try{e&&((n=Z())==null||n.setItem(t,r))}catch(s){console.debug("[LocalStorage] SET error: ",s)}},q="builderVisitorId",Dt=({canTrack:t})=>{if(!t)return;const e=Nt({key:q,canTrack:t});if(S(e))return e;{const r=Ft();return Mt({id:r,canTrack:t}),r}},Ft=()=>Q(),Mt=({id:t,canTrack:e})=>Vt({key:q,value:t,canTrack:e});function tt(t){var e;typeof process!="undefined"&&((e=process.env)!=null&&e.DEBUG)&&String(process.env.DEBUG)=="true"&&f.log(t)}const Kt=async({canTrack:t})=>{if(!t)return{visitorId:void 0,sessionId:void 0};const e=await _t({canTrack:t}),r=Dt({canTrack:t});return{sessionId:e,visitorId:r}},Wt=async({type:t,canTrack:e,apiKey:r,metadata:n,...s})=>({type:t,data:{...s,metadata:{url:location.href,...n},...await Kt({canTrack:e}),userAttributes:J(),ownerId:r}});async function et({apiHost:t,...e}){if(!e.apiKey){f.error("Missing API key for track call. Please provide your API key.");return}if(!e.canTrack||$()||!(a()||b==="reactNative"))return;const n=`${t||"https://cdn.builder.io"}/api/v1/track`;return tt(n),fetch(n,{method:"POST",body:JSON.stringify({events:[await Wt(e)]}),headers:{"content-type":"application/json",...X()},mode:"cors"}).catch(s=>{console.error("Failed to track: ",s)})}const jt=t=>et({...t,canTrack:!0}),Gt=["*.beta.builder.io","beta.builder.io","builder.io","localhost","qa.builder.io"];function rt(t,e){if(!e.origin.startsWith("http")&&!e.origin.startsWith("https"))return!1;const r=new URL(e.origin),n=r.hostname;return(t||Gt).findIndex(s=>s.startsWith("*.")?n.endsWith(s.slice(1)):s===n)>-1}let F=!1;const nt=t=>{var e,r;F||(F=!0,a()&&((e=window.parent)==null||e.postMessage({type:"builder.sdkInfo",data:{target:b,version:z,supportsPatchUpdates:!1,supportsAddBlockScoping:!0,supportsCustomBreakpoints:!0,modelName:t.modelName,apiKey:t.apiKey,supportsXSmallBreakpoint:!0,blockLevelPersonalization:!0}},"*"),(r=window.parent)==null||r.postMessage({type:"builder.updateContent",data:{options:t}},"*"),window.addEventListener("message",n=>{var o,i;if(!rt(t.trustedHosts,n))return;const{data:s}=n;if(s!=null&&s.type)switch(s.type){case"builder.evaluate":{const u=s.data.text,l=s.data.arguments||[],y=s.data.id,m=new Function(u);let d,h=null;try{d=m.apply(null,l)}catch(p){h=p}h?(o=window.parent)==null||o.postMessage({type:"builder.evaluateError",data:{id:y,error:h.message}},"*"):d&&typeof d.then=="function"?d.then(p=>{var w;(w=window.parent)==null||w.postMessage({type:"builder.evaluateResult",data:{id:y,result:p}},"*")}).catch(console.error):(i=window.parent)==null||i.postMessage({type:"builder.evaluateResult",data:{result:d,id:y}},"*");break}}})))},st=({model:t,trustedHosts:e,callbacks:r})=>n=>{if(!rt(e,n))return;const{data:s}=n;if(s)switch(s.type){case"builder.configureSdk":{r.configureSdk(s.data);break}case"builder.triggerAnimation":{r.animation(s.data);break}case"builder.resetState":{const o=s.data,i=o.model,u=o==null?void 0:o.state,l=o.editType;i===t&&u&&r.stateUpdate(u,l);break}case"builder.contentUpdate":{const o=s.data,i=o.key||o.alias||o.entry||o.modelName,u=o.data,l=o.editType;i===t&&r.contentUpdate(u,l);break}}},$t=({model:t,apiKey:e,callback:r,trustedHosts:n})=>{if(!a)return f.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."),()=>{};nt({modelName:t,apiKey:e});const s=st({callbacks:{contentUpdate:r,animation:()=>{},configureSdk:()=>{},stateUpdate:()=>{}},model:t,trustedHosts:n});return window.addEventListener("message",s),()=>{window.removeEventListener("message",s)}},Jt="builder.tests",R=t=>`${Jt}.${t}`,zt=({contentId:t})=>H({name:R(t),canTrack:!0}),Xt=({contentId:t})=>v({name:R(t),canTrack:!0}),Ht=({contentId:t,value:e})=>P({name:R(t),value:e,canTrack:!0}),ot=t=>S(t.id)&&S(t.variations)&&Object.keys(t.variations).length>0,Qt=({id:t,variations:e})=>{var s;let r=0;const n=Math.random();for(const o in e){const i=(s=e[o])==null?void 0:s.testRatio;if(r+=i,n<r)return o}return t},it=t=>{const e=Qt(t);return Ht({contentId:t.id,value:e}).catch(r=>{f.error("could not store A/B test variation: ",r)}),e},at=({item:t,testGroupId:e})=>{const r=t.variations[e];return e===t.id||!r?{testVariationId:t.id,testVariationName:"Default"}:{data:r.data,testVariationId:r.id,testVariationName:r.name||(r.id===t.id?"Default":"")}},Yt=({item:t,canTrack:e})=>{if(!e)return t;if(!t)return;if(!ot(t))return t;const r=Xt({contentId:t.id})||it({variations:t.variations,id:t.id}),n=at({item:t,testGroupId:r});return{...t,...n}},Zt=async({item:t,canTrack:e})=>{if(!e||!ot(t))return t;const n=await zt({contentId:t.id})||it({variations:t.variations,id:t.id}),s=at({item:t,testGroupId:n});return{...t,...s}};const M="builder.userAttributes";function K(){let t=!0;const e=new Set;return{setUserAttributes(r){if(!a())return;const n={...this.getUserAttributes(),...r};P({name:M,value:JSON.stringify(n),canTrack:t}),e.forEach(s=>s(n))},getUserAttributes(){return a()?JSON.parse(v({name:M,canTrack:t})||"{}"):{}},subscribeOnUserAttributesChange(r,{fireImmediately:n}={}){return e.add(r),n&&r(this.getUserAttributes()),function(){e.delete(r)}},setCanTrack(r){t=r}}}let k;a()&&b==="qwik"?(window.__BUILDER_USER_ATTRIBUTES_SERVICE__||(window.__BUILDER_USER_ATTRIBUTES_SERVICE__=K()),k=window.__BUILDER_USER_ATTRIBUTES_SERVICE__):k=K();const C=k,qt=t=>{C.setUserAttributes(t)},ct=t=>{const e=S(t)?t:!0;return C.setCanTrack(e),e};function te(){return typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:globalThis}function ee(){const t=te().fetch;if(typeof t=="undefined")throw console.warn(`Builder SDK could not find a global fetch function. Make sure you have a polyfill for fetch in your project.
|
|
1
|
+
"use strict";const b="react",A="[Builder.io]: ",f={log:(...t)=>console.log(A,...t),error:(...t)=>console.error(A,...t),warn:(...t)=>console.warn(A,...t),debug:(...t)=>console.debug(A,...t)};function a(){return typeof window!="undefined"&&typeof document!="undefined"}const St=t=>{const e={};return t.forEach((r,n)=>{e[n]=r}),e},j=t=>t instanceof URLSearchParams?St(t):t,G=t=>typeof t=="string"?t:t instanceof URLSearchParams?t.toString():new URLSearchParams(t).toString();function bt(){return a()&&window.self!==window.top}function $(t){return bt()&&G(t||window.location.search).indexOf("builder.frameEditing=")!==-1}const yt=()=>{if(a()){const t=new URL(location.href);return t.pathname===""&&(t.pathname="/"),t}else return console.warn("Cannot get location for tracking in non-browser environment"),null},mt=()=>typeof navigator=="object"&&navigator.userAgent||"",J=()=>{const t=mt(),e={Android(){return t.match(/Android/i)},BlackBerry(){return t.match(/BlackBerry/i)},iOS(){return t.match(/iPhone|iPod/i)},Opera(){return t.match(/Opera Mini/i)},Windows(){return t.match(/IEMobile/i)||t.match(/WPDesktop/i)},any(){return e.Android()||e.BlackBerry()||e.iOS()||e.Opera()||e.Windows()||b==="reactNative"}},r=t.match(/Tablet|iPad/i),n=yt();return{urlPath:n==null?void 0:n.pathname,host:(n==null?void 0:n.host)||(n==null?void 0:n.hostname),device:r?"tablet":e.any()?"mobile":"desktop"}},S=t=>t!=null;function wt(t){const e=t||(a()?window.location.search:void 0);return e?G(e).indexOf("builder.preview=")!==-1:!1}const Et=t=>({type:"builder.registerComponent",data:U(t)}),At=t=>{const e=t.toString().trim(),r=/^[a-zA-Z0-9_]+\s*=>/i.test(e);return`return (${!e.startsWith("function")&&!e.startsWith("async")&&!e.startsWith("(")&&!r?"function ":""}${e}).apply(this, arguments)`};function U(t){return JSON.parse(JSON.stringify(t,(e,r)=>typeof r=="function"?At(r):r))}const N={};function It(t,e){t==="plugin"&&(e=U(e));let r=N[t];if(r||(r=N[t]=[]),r.push(e),a()){const n={type:"builder.register",data:{type:t,info:e}};try{parent.postMessage(n,"*"),parent!==window&&window.postMessage(n,"*")}catch(s){console.debug("Could not postmessage",s)}}}function vt(t){var e;if(a()){const r=JSON.parse(JSON.stringify(t));t.action&&(r.action=t.action.toString()),(e=window.parent)==null||e.postMessage({type:"builder.registerAction",data:r},"*")}}const V={};function kt(t){if(a()){Object.assign(V,t);const e={type:"builder.settingsChange",data:V};parent.postMessage(e,"*")}}const D="builder.",Tt="options.",O=t=>{if(!t)return{};const e=j(t),r={};return Object.keys(e).forEach(n=>{if(n.startsWith(D)){const s=n.replace(D,"").replace(Tt,"");r[s]=e[n]}}),r},Ut=()=>{if(!a())return{};const t=new URLSearchParams(window.location.search);return O(t)},z="4.2.4",X=()=>({"X-Builder-SDK":b,"X-Builder-SDK-GEN":"2","X-Builder-SDK-Version":z}),Ot=t=>{if(t==="localhost"||t==="127.0.0.1")return t;const e=t.split(".");return e.length>2?e.slice(1).join("."):t},v=({name:t,canTrack:e})=>{var r;try{return e?(r=document.cookie.split("; ").find(n=>n.startsWith(`${t}=`)))==null?void 0:r.split("=")[1]:void 0}catch(n){f.warn("[COOKIE] GET error: ",(n==null?void 0:n.message)||n);return}},H=async t=>v(t),Pt=t=>t.map(([e,r])=>r?`${e}=${r}`:e).filter(S).join("; "),Rt=[["secure",""],["SameSite","None"]],Ct=({name:t,value:e,expires:r})=>{const s=(a()?location.protocol==="https:":!0)?Rt:[[]],o=r?[["expires",r.toUTCString()]]:[[]],i=[[t,e],...o,["path","/"],["domain",Ot(window.location.hostname)],...s];return Pt(i)},P=async({name:t,value:e,expires:r,canTrack:n})=>{try{if(!n)return;const s=Ct({name:t,value:e,expires:r});document.cookie=s}catch(s){f.warn("[COOKIE] SET error: ",(s==null?void 0:s.message)||s)}};function Bt(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t=="x"?e:e&3|8).toString(16)})}function Q(){return Bt().replace(/-/g,"")}const Y="builderSessionId",_t=async({canTrack:t})=>{if(!t)return;const e=await H({name:Y,canTrack:t});if(S(e))return e;{const r=xt();return Lt({id:r,canTrack:t}),r}},xt=()=>Q(),Lt=({id:t,canTrack:e})=>P({name:Y,value:t,canTrack:e}),Z=()=>a()&&typeof localStorage!="undefined"?localStorage:void 0,Nt=({key:t,canTrack:e})=>{var r;try{return e?(r=Z())==null?void 0:r.getItem(t):void 0}catch(n){console.debug("[LocalStorage] GET error: ",n);return}},Vt=({key:t,canTrack:e,value:r})=>{var n;try{e&&((n=Z())==null||n.setItem(t,r))}catch(s){console.debug("[LocalStorage] SET error: ",s)}},q="builderVisitorId",Dt=({canTrack:t})=>{if(!t)return;const e=Nt({key:q,canTrack:t});if(S(e))return e;{const r=Ft();return Mt({id:r,canTrack:t}),r}},Ft=()=>Q(),Mt=({id:t,canTrack:e})=>Vt({key:q,value:t,canTrack:e});function tt(t){var e;typeof process!="undefined"&&((e=process.env)!=null&&e.DEBUG)&&String(process.env.DEBUG)=="true"&&f.log(t)}const Kt=async({canTrack:t})=>{if(!t)return{visitorId:void 0,sessionId:void 0};const e=await _t({canTrack:t}),r=Dt({canTrack:t});return{sessionId:e,visitorId:r}},Wt=async({type:t,canTrack:e,apiKey:r,metadata:n,...s})=>({type:t,data:{...s,metadata:{url:location.href,...n},...await Kt({canTrack:e}),userAttributes:J(),ownerId:r}});async function et({apiHost:t,...e}){if(!e.apiKey){f.error("Missing API key for track call. Please provide your API key.");return}if(!e.canTrack||$()||!(a()||b==="reactNative"))return;const n=`${t||"https://cdn.builder.io"}/api/v1/track`;return tt(n),fetch(n,{method:"POST",body:JSON.stringify({events:[await Wt(e)]}),headers:{"content-type":"application/json",...X()},mode:"cors"}).catch(s=>{console.error("Failed to track: ",s)})}const jt=t=>et({...t,canTrack:!0}),Gt=["*.beta.builder.io","beta.builder.io","builder.io","localhost","qa.builder.io"];function rt(t,e){if(!e.origin.startsWith("http")&&!e.origin.startsWith("https"))return!1;const r=new URL(e.origin),n=r.hostname;return(t||Gt).findIndex(s=>s.startsWith("*.")?n.endsWith(s.slice(1)):s===n)>-1}let F=!1;const nt=t=>{var e,r;F||(F=!0,a()&&((e=window.parent)==null||e.postMessage({type:"builder.sdkInfo",data:{target:b,version:z,supportsPatchUpdates:!1,supportsAddBlockScoping:!0,supportsCustomBreakpoints:!0,modelName:t.modelName,apiKey:t.apiKey,supportsXSmallBreakpoint:!0,blockLevelPersonalization:!0}},"*"),(r=window.parent)==null||r.postMessage({type:"builder.updateContent",data:{options:t}},"*"),window.addEventListener("message",n=>{var o,i;if(!rt(t.trustedHosts,n))return;const{data:s}=n;if(s!=null&&s.type)switch(s.type){case"builder.evaluate":{const u=s.data.text,l=s.data.arguments||[],y=s.data.id,m=new Function(u);let d,h=null;try{d=m.apply(null,l)}catch(p){h=p}h?(o=window.parent)==null||o.postMessage({type:"builder.evaluateError",data:{id:y,error:h.message}},"*"):d&&typeof d.then=="function"?d.then(p=>{var w;(w=window.parent)==null||w.postMessage({type:"builder.evaluateResult",data:{id:y,result:p}},"*")}).catch(console.error):(i=window.parent)==null||i.postMessage({type:"builder.evaluateResult",data:{result:d,id:y}},"*");break}}})))},st=({model:t,trustedHosts:e,callbacks:r})=>n=>{if(!rt(e,n))return;const{data:s}=n;if(s)switch(s.type){case"builder.configureSdk":{r.configureSdk(s.data);break}case"builder.triggerAnimation":{r.animation(s.data);break}case"builder.resetState":{const o=s.data,i=o.model,u=o==null?void 0:o.state,l=o.editType;i===t&&u&&r.stateUpdate(u,l);break}case"builder.contentUpdate":{const o=s.data,i=o.key||o.alias||o.entry||o.modelName,u=o.data,l=o.editType;i===t&&r.contentUpdate(u,l);break}}},$t=({model:t,apiKey:e,callback:r,trustedHosts:n})=>{if(!a)return f.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."),()=>{};nt({modelName:t,apiKey:e});const s=st({callbacks:{contentUpdate:r,animation:()=>{},configureSdk:()=>{},stateUpdate:()=>{}},model:t,trustedHosts:n});return window.addEventListener("message",s),()=>{window.removeEventListener("message",s)}},Jt="builder.tests",R=t=>`${Jt}.${t}`,zt=({contentId:t})=>H({name:R(t),canTrack:!0}),Xt=({contentId:t})=>v({name:R(t),canTrack:!0}),Ht=({contentId:t,value:e})=>P({name:R(t),value:e,canTrack:!0}),ot=t=>S(t.id)&&S(t.variations)&&Object.keys(t.variations).length>0,Qt=({id:t,variations:e})=>{var s;let r=0;const n=Math.random();for(const o in e){const i=(s=e[o])==null?void 0:s.testRatio;if(r+=i,n<r)return o}return t},it=t=>{const e=Qt(t);return Ht({contentId:t.id,value:e}).catch(r=>{f.error("could not store A/B test variation: ",r)}),e},at=({item:t,testGroupId:e})=>{const r=t.variations[e];return e===t.id||!r?{testVariationId:t.id,testVariationName:"Default"}:{data:r.data,testVariationId:r.id,testVariationName:r.name||(r.id===t.id?"Default":"")}},Yt=({item:t,canTrack:e})=>{if(!e)return t;if(!t)return;if(!ot(t))return t;const r=Xt({contentId:t.id})||it({variations:t.variations,id:t.id}),n=at({item:t,testGroupId:r});return{...t,...n}},Zt=async({item:t,canTrack:e})=>{if(!e||!ot(t))return t;const n=await zt({contentId:t.id})||it({variations:t.variations,id:t.id}),s=at({item:t,testGroupId:n});return{...t,...s}};const M="builder.userAttributes";function K(){let t=!0;const e=new Set;return{setUserAttributes(r){if(!a())return;const n={...this.getUserAttributes(),...r};P({name:M,value:JSON.stringify(n),canTrack:t}),e.forEach(s=>s(n))},getUserAttributes(){return a()?JSON.parse(v({name:M,canTrack:t})||"{}"):{}},subscribeOnUserAttributesChange(r,{fireImmediately:n}={}){return e.add(r),n&&r(this.getUserAttributes()),function(){e.delete(r)}},setCanTrack(r){t=r}}}let k;a()&&b==="qwik"?(window.__BUILDER_USER_ATTRIBUTES_SERVICE__||(window.__BUILDER_USER_ATTRIBUTES_SERVICE__=K()),k=window.__BUILDER_USER_ATTRIBUTES_SERVICE__):k=K();const C=k,qt=t=>{C.setUserAttributes(t)},ct=t=>{const e=S(t)?t:!0;return C.setCanTrack(e),e};function te(){return typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:globalThis}function ee(){const t=te().fetch;if(typeof t=="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 t}const re=ee();function T(t,e=null,r="."){return Object.keys(t).reduce((n,s)=>{const o=t[s],i=[e,s].filter(Boolean).join(r);return[typeof o=="object",o!==null,!(Array.isArray(o)&&o.length===0)].every(Boolean)?{...n,...T(o,i,r)}:{...n,[i]:o}},{})}function ut(t,e,r={}){for(const n in t){const s=t[n],o=e?e+"."+n:n;s&&typeof s=="object"&&!Array.isArray(s)&&!Object.keys(s).find(i=>i.startsWith("$"))?ut(s,o,r):r[o]=s}return r}function ne(t){const e={};for(const r in t){const n=r.split(".");let s=e;for(let o=0;o<n.length;o++){const i=n[o];o===n.length-1?s[i]=t[r]:(s[i]=s[i]||{},s=s[i])}}return e}const se="v3",W=t=>typeof t=="number"&&!isNaN(t)&&t>=0,B=t=>{const{limit:e=30,userAttributes:r,query:n,model:s,apiKey:o,enrich:i,locale:u,apiVersion:l=se,fields:y,omit:m,offset:d,cacheSeconds:h,staleCacheSeconds:p,sort:w,includeUnpublished:_,apiHost:gt}=t;if(!o)throw new Error("Missing API key");if(!["v3"].includes(l))throw new Error(`Invalid apiVersion: expected 'v3', received '${l}'`);const ht=e!==1,pt=gt||"https://cdn.builder.io",c=new URL(`${pt}/api/${l}/content/${s}`);c.searchParams.set("apiKey",o),c.searchParams.set("limit",String(e)),c.searchParams.set("noTraverse",String(ht)),c.searchParams.set("includeRefs",String(!0)),u&&c.searchParams.set("locale",u);let I=r||{};if(i&&c.searchParams.set("enrich",String(i)),c.searchParams.set("omit",m!=null?m:"meta.componentsUsed"),y&&c.searchParams.set("fields",y),Number.isFinite(d)&&d>-1&&c.searchParams.set("offset",String(Math.floor(d))),typeof _=="boolean"&&c.searchParams.set("includeUnpublished",String(_)),h&&W(h)&&c.searchParams.set("cacheSeconds",String(h)),p&&W(p)&&c.searchParams.set("staleCacheSeconds",String(p)),w){const g=T({sort:w});for(const E in g)c.searchParams.set(E,JSON.stringify(g[E]))}const x={...Ut(),...j(t.options||{})};I={...I,...ie(x)};const L=T(x);for(const g in L)c.searchParams.set(g,String(L[g]));if(Object.keys(I).length>0&&c.searchParams.set("userAttributes",JSON.stringify(I)),n){const g=ut({query:n});for(const E in g)c.searchParams.set(E,JSON.stringify(g[E]))}return c},oe=t=>{const e={};for(const r in t)r.startsWith("userAttributes.")&&(e[r]=t[r],delete t[r]);return e},ie=t=>{if(a()&&t.preview==="BUILDER_STUDIO"){t["userAttributes.urlPath"]=window.location.pathname,t["userAttributes.host"]=window.location.host;const e=oe(t),{userAttributes:r}=ne(e);return r}return{}},ae=t=>"results"in t;async function lt(t){var n;const e=t.locale||((n=t.userAttributes)==null?void 0:n.locale);e&&(t.locale=e,t.userAttributes={locale:e,...t.userAttributes});const r=await ft({...t,limit:1});return r&&r[0]||null}const ce=async t=>{var i,u;const e=B(t),r=(i=t.fetch)!=null?i:re,n={...t.fetchOptions,headers:{...(u=t.fetchOptions)==null?void 0:u.headers,...X()}};return await(await r(e.href,n)).json()},dt=async(t,e,r=B(t))=>{const n=ct(t.canTrack);if(r.search.includes("preview="),!n||!(a()||b==="reactNative"))return e.results;try{const s=[];for(const o of e.results)s.push(await Zt({item:o,canTrack:n}));e.results=s}catch(s){f.error("Could not process A/B tests. ",s)}return e.results};async function ft(t){const e=B(t),r=await ce(t);if(!ae(r))throw f.error("Error fetching data. ",{url:e,content:r,options:t}),r;return dt(t,r)}const ue=async t=>{var n,s,o;const e=t.path||((n=t.url)==null?void 0:n.pathname)||((s=t.userAttributes)==null?void 0:s.urlPath),r={...t,apiKey:t.apiKey,model:t.model||"page",userAttributes:{...t.userAttributes,...e?{urlPath:e}:{}},options:O(t.searchParams||((o=t.url)==null?void 0:o.searchParams)||t.options)};return{apiKey:r.apiKey,model:r.model,content:await lt(r)}};exports.MSG_PREFIX=A;exports.TARGET=b;exports._processContentResult=dt;exports._track=et;exports.checkIsDefined=S;exports.createEditorListener=st;exports.createRegisterComponentMessage=Et;exports.fetchBuilderProps=ue;exports.fetchEntries=ft;exports.fetchOneEntry=lt;exports.getBuilderSearchParams=O;exports.getCookieSync=v;exports.getDefaultCanTrack=ct;exports.getUserAttributes=J;exports.handleABTestingSync=Yt;exports.isBrowser=a;exports.isEditing=$;exports.isPreviewing=wt;exports.logFetch=tt;exports.logger=f;exports.register=It;exports.registerAction=vt;exports.serializeIncludingFunctions=U;exports.setClientUserAttributes=qt;exports.setEditorSettings=kt;exports.setupBrowserForEditing=nt;exports.subscribeToEditor=$t;exports.track=jt;exports.userAttributesService=C;
|
|
@@ -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-fec6b9d9.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.registerAction=e.registerAction;exports.setEditorSettings=e.setEditorSettings;exports.subscribeToEditor=e.subscribeToEditor;exports.track=e.track;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _processContentResult as r, createRegisterComponentMessage as i, fetchBuilderProps as s, fetchEntries as n, fetchOneEntry as o, getBuilderSearchParams as c, isEditing as g, isPreviewing as a, register as d, registerAction as E, setEditorSettings as f, subscribeToEditor as h, track as p } from "./server-entry-
|
|
1
|
+
import { _processContentResult as r, createRegisterComponentMessage as i, fetchBuilderProps as s, fetchEntries as n, fetchOneEntry as o, getBuilderSearchParams as c, isEditing as g, isPreviewing as a, register as d, registerAction as E, setEditorSettings as f, subscribeToEditor as h, track as p } from "./server-entry-b75016aa.js";
|
|
2
2
|
export {
|
|
3
3
|
r as _processContentResult,
|
|
4
4
|
i as createRegisterComponentMessage,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isEditing, isBrowser, getUserAttributes, TARGET, logger, MSG_PREFIX } from "./server-entry-
|
|
1
|
+
import { isEditing, isBrowser, getUserAttributes, TARGET, logger, MSG_PREFIX } from "./server-entry-b75016aa.js";
|
|
2
2
|
const getFunctionArguments = ({
|
|
3
3
|
builder: e,
|
|
4
4
|
context: t,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const serverEntry=require("./server-entry-
|
|
1
|
+
"use strict";const serverEntry=require("./server-entry-fec6b9d9.cjs"),getFunctionArguments=({builder:e,context:t,event:s,state:r})=>Object.entries({state:r,Builder:e,builder:e,context:t,event:s}),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;function flattenState({rootState:e,localState:t,rootSetState:s}){return new Proxy(e,{get:(r,n)=>{if(t&&n in t)return t[n];const o=r[n];return typeof o=="object"&&o!==null?flattenState({rootState:o,localState:void 0,rootSetState:s?i=>{r[n]=i,s(r)}:void 0}):o},set:(r,n,o)=>{if(t&&n in t)throw new Error("Writing to local state is not allowed as it is read-only.");return r[n]=o,s==null||s(r),!0}})}const 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,s)=>{if(Object(e)!==e)return e;const r=Array.isArray(t)?t:t.toString().match(/[^.[\]]+/g);return r.slice(0,-1).reduce((n,o,i)=>Object(n[o])===n[o]?n[o]:n[o]=Math.abs(Number(r[i+1]))>>0===+r[i+1]?[]:{},e)[r[r.length-1]]=s,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;
|
package/lib/node/setIvm.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./setIvm-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./setIvm-9ebbab5f.cjs");require("./server-entry-fec6b9d9.cjs");exports.setIvm=e.setIvm;
|
package/lib/node/setIvm.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const s=require("./server-entry-
|
|
1
|
+
"use strict";const s=require("./server-entry-fec6b9d9.cjs");function t(){var e;return typeof process!="undefined"&&s.checkIsDefined((e=process==null?void 0:process.versions)==null?void 0:e.node)}const c=({shouldLogWarning:e})=>{var o;if(!t())return!1;const n=process.arch==="arm64",r=process.version.startsWith("v20"),i=(o=process.env.NODE_OPTIONS)==null?void 0:o.includes("--no-node-snapshot");return n&&r&&!i?(e&&s.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.shouldForceBrowserRuntimeInNode=c;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { checkIsDefined as i, logger as t } from "./server-entry-
|
|
1
|
+
import { checkIsDefined as i, logger as t } from "./server-entry-b75016aa.js";
|
|
2
2
|
function a() {
|
|
3
3
|
var o;
|
|
4
4
|
return typeof process != "undefined" && i((o = process == null ? void 0 : process.versions) == null ? void 0 : o.node);
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "4.2.
|
|
1
|
+
export declare const SDK_VERSION = "4.2.4";
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import type { QueryObject } from '../../helpers/search/search';
|
|
2
2
|
/**
|
|
3
|
-
* Receives a `URLSearchParams` object or a regular query object, and returns
|
|
4
|
-
* relevant to the Builder SDK.
|
|
3
|
+
* Receives a `URLSearchParams` object or a regular query object, and returns
|
|
4
|
+
* the subset of query params that are relevant to the Builder SDK.
|
|
5
|
+
*
|
|
6
|
+
* Outputs a key-value object to be passed to `fetchOneEntry` or `fetchEntries`
|
|
7
|
+
* functions as the `options` argument.
|
|
8
|
+
*
|
|
9
|
+
* NOTE: This function is generally not needed. Instead, it is recommended to use `isPreviewing()`
|
|
10
|
+
* to check if the current page requires previewed content.
|
|
5
11
|
*
|
|
6
12
|
* @returns
|
|
7
13
|
*/
|
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
import type { Search } from '../helpers/search/search';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Checks the current URL's search parameters to see if it is attempting to
|
|
4
|
+
* preview Builder Content.
|
|
5
|
+
*
|
|
6
|
+
* When called on the client, it uses `window.location.search`.
|
|
7
|
+
* When called on the server (SSR), it requires a `search` argument.
|
|
8
|
+
*
|
|
9
|
+
* @param search - The search parameters to check. Can be a URL string (containing the search parameters), `URLSearchParams`, or a key-value object containing the search parameters.
|
|
10
|
+
* @returns `true` if the current page is being previewed, `false` otherwise.
|
|
11
|
+
*/
|
|
12
|
+
export declare function isPreviewing(search?: Search): boolean;
|