@builder.io/sdk-react-nextjs 0.20.0 → 0.21.1
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/symbol/symbol.cjs +1 -1
- package/lib/browser/blocks/symbol/symbol.mjs +27 -25
- package/lib/browser/components/block/components/component-ref/component-ref.cjs +1 -1
- package/lib/browser/components/block/components/component-ref/component-ref.mjs +11 -11
- package/lib/browser/components/blocks/blocks-wrapper.cjs +1 -1
- package/lib/browser/components/blocks/blocks-wrapper.mjs +2 -2
- package/lib/browser/components/content/components/enable-editor.cjs +1 -1
- package/lib/browser/components/content/components/enable-editor.mjs +81 -70
- package/lib/browser/constants/sdk-version.cjs +1 -1
- package/lib/browser/constants/sdk-version.mjs +1 -1
- package/lib/browser/functions/register.cjs +1 -1
- package/lib/browser/functions/register.mjs +24 -13
- package/lib/browser/index.cjs +1 -1
- package/lib/browser/index.mjs +26 -25
- package/lib/browser/server-entry.cjs +1 -1
- package/lib/browser/server-entry.mjs +18 -17
- package/lib/edge/blocks/symbol/symbol.cjs +1 -1
- package/lib/edge/blocks/symbol/symbol.mjs +27 -25
- package/lib/edge/components/block/components/component-ref/component-ref.cjs +1 -1
- package/lib/edge/components/block/components/component-ref/component-ref.mjs +11 -11
- package/lib/edge/components/blocks/blocks-wrapper.cjs +1 -1
- package/lib/edge/components/blocks/blocks-wrapper.mjs +2 -2
- package/lib/edge/components/content/components/enable-editor.cjs +1 -1
- package/lib/edge/components/content/components/enable-editor.mjs +81 -70
- package/lib/edge/constants/sdk-version.cjs +1 -1
- package/lib/edge/constants/sdk-version.mjs +1 -1
- package/lib/edge/functions/register.cjs +1 -1
- package/lib/edge/functions/register.mjs +24 -13
- package/lib/edge/index.cjs +1 -1
- package/lib/edge/index.mjs +26 -25
- package/lib/edge/server-entry.cjs +1 -1
- package/lib/edge/server-entry.mjs +18 -17
- package/lib/node/blocks/symbol/symbol.cjs +1 -1
- package/lib/node/blocks/symbol/symbol.mjs +27 -25
- package/lib/node/components/block/components/component-ref/component-ref.cjs +1 -1
- package/lib/node/components/block/components/component-ref/component-ref.mjs +11 -11
- package/lib/node/components/blocks/blocks-wrapper.cjs +1 -1
- package/lib/node/components/blocks/blocks-wrapper.mjs +2 -2
- package/lib/node/components/content/components/enable-editor.cjs +1 -1
- package/lib/node/components/content/components/enable-editor.mjs +81 -70
- package/lib/node/constants/sdk-version.cjs +1 -1
- package/lib/node/constants/sdk-version.mjs +1 -1
- package/lib/node/functions/register.cjs +1 -1
- package/lib/node/functions/register.mjs +24 -13
- package/lib/node/index.cjs +1 -1
- package/lib/node/index.mjs +26 -25
- package/lib/node/server-entry.cjs +1 -1
- package/lib/node/server-entry.mjs +18 -17
- package/package.json +1 -1
- package/types/cjs/blocks/symbol/symbol.types.d.ts +1 -2
- package/types/cjs/components/awaiter.d.ts +1 -11
- package/types/cjs/components/awaiter.types.d.ts +7 -0
- package/types/cjs/constants/sdk-version.d.ts +1 -1
- package/types/cjs/functions/register.d.ts +18 -0
- package/types/cjs/server-index.d.ts +1 -1
- package/types/esm/blocks/symbol/symbol.types.d.ts +1 -2
- package/types/esm/components/awaiter.d.ts +1 -11
- package/types/esm/components/awaiter.types.d.ts +7 -0
- package/types/esm/constants/sdk-version.d.ts +1 -1
- package/types/esm/functions/register.d.ts +18 -0
- package/types/esm/server-index.d.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const m=require("react/jsx-runtime"),k=require("../../components/content-variants/content-variants.cjs"),f=require("../../functions/get-class-prop-name.cjs"),v=require("./symbol.helpers.cjs");async function N(e){var o,i,l,a,c,r,s;const d=function(){return"div"},y=function(){return"div"},C=function(){return Object.values(e.builderComponents)},x=function(){var u,b;return[e.attributes[f.getClassPropName()],"builder-symbol",(u=e.symbol)!=null&&u.inline?"builder-inline-symbol":void 0,(b=e.symbol)!=null&&b.dynamic||e.dynamic?"builder-dynamic-symbol":void 0].filter(Boolean).join(" ")},t=((o=e.symbol)==null?void 0:o.content)||await v.fetchSymbolContent({symbol:e.symbol,builderContextValue:e.builderContext});return(i=e.symbol)==null||i.entry,m.jsx("div",{...e.attributes,className:x(),children:m.jsx(k,{nonce:e.builderContext.nonce,isNestedRender:!0,apiVersion:e.builderContext.apiVersion,apiKey:e.builderContext.apiKey,context:{...e.builderContext.context,symbolId:(l=e.builderBlock)==null?void 0:l.id},customComponents:C(),data:{...(a=e.symbol)==null?void 0:a.data,...e.builderContext.localState,...(c=t==null?void 0:t.data)==null?void 0:c.state},canTrack:e.builderContext.canTrack,model:(s=(r=e.symbol)==null?void 0:r.model)!=null?s:"",content:t,linkComponent:e.builderLinkComponent,blocksWrapper:d(),contentWrapper:y()})})}module.exports=N;
|
|
@@ -1,51 +1,53 @@
|
|
|
1
1
|
import { jsx as u } from "react/jsx-runtime";
|
|
2
2
|
import x from "../../components/content-variants/content-variants.mjs";
|
|
3
|
-
import { getClassPropName as
|
|
4
|
-
import { fetchSymbolContent as
|
|
5
|
-
async function
|
|
6
|
-
var
|
|
3
|
+
import { getClassPropName as k } from "../../functions/get-class-prop-name.mjs";
|
|
4
|
+
import { fetchSymbolContent as v } from "./symbol.helpers.mjs";
|
|
5
|
+
async function S(t) {
|
|
6
|
+
var o, i, l, a, c, m, r;
|
|
7
7
|
const s = function() {
|
|
8
8
|
return "div";
|
|
9
9
|
}, y = function() {
|
|
10
10
|
return "div";
|
|
11
11
|
}, C = function() {
|
|
12
|
+
return Object.values(t.builderComponents);
|
|
13
|
+
}, f = function() {
|
|
12
14
|
var b, d;
|
|
13
15
|
return [
|
|
14
|
-
|
|
16
|
+
t.attributes[k()],
|
|
15
17
|
"builder-symbol",
|
|
16
|
-
(b =
|
|
17
|
-
(d =
|
|
18
|
+
(b = t.symbol) != null && b.inline ? "builder-inline-symbol" : void 0,
|
|
19
|
+
(d = t.symbol) != null && d.dynamic || t.dynamic ? "builder-dynamic-symbol" : void 0
|
|
18
20
|
].filter(Boolean).join(" ");
|
|
19
|
-
},
|
|
20
|
-
symbol:
|
|
21
|
-
builderContextValue:
|
|
21
|
+
}, e = ((o = t.symbol) == null ? void 0 : o.content) || await v({
|
|
22
|
+
symbol: t.symbol,
|
|
23
|
+
builderContextValue: t.builderContext
|
|
22
24
|
});
|
|
23
|
-
return (
|
|
25
|
+
return (i = t.symbol) == null || i.entry, /* @__PURE__ */ u("div", { ...t.attributes, className: f(), children: /* @__PURE__ */ u(
|
|
24
26
|
x,
|
|
25
27
|
{
|
|
26
|
-
nonce:
|
|
28
|
+
nonce: t.builderContext.nonce,
|
|
27
29
|
isNestedRender: !0,
|
|
28
|
-
apiVersion:
|
|
29
|
-
apiKey:
|
|
30
|
+
apiVersion: t.builderContext.apiVersion,
|
|
31
|
+
apiKey: t.builderContext.apiKey,
|
|
30
32
|
context: {
|
|
31
|
-
...
|
|
32
|
-
symbolId: (
|
|
33
|
+
...t.builderContext.context,
|
|
34
|
+
symbolId: (l = t.builderBlock) == null ? void 0 : l.id
|
|
33
35
|
},
|
|
34
|
-
customComponents:
|
|
36
|
+
customComponents: C(),
|
|
35
37
|
data: {
|
|
36
|
-
...(
|
|
37
|
-
...
|
|
38
|
-
...(
|
|
38
|
+
...(a = t.symbol) == null ? void 0 : a.data,
|
|
39
|
+
...t.builderContext.localState,
|
|
40
|
+
...(c = e == null ? void 0 : e.data) == null ? void 0 : c.state
|
|
39
41
|
},
|
|
40
|
-
canTrack:
|
|
41
|
-
model: (
|
|
42
|
-
content:
|
|
43
|
-
linkComponent:
|
|
42
|
+
canTrack: t.builderContext.canTrack,
|
|
43
|
+
model: (r = (m = t.symbol) == null ? void 0 : m.model) != null ? r : "",
|
|
44
|
+
content: e,
|
|
45
|
+
linkComponent: t.builderLinkComponent,
|
|
44
46
|
blocksWrapper: s(),
|
|
45
47
|
contentWrapper: y()
|
|
46
48
|
}
|
|
47
49
|
) });
|
|
48
50
|
}
|
|
49
51
|
export {
|
|
50
|
-
|
|
52
|
+
S as default
|
|
51
53
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const n=require("react/jsx-runtime"),i=require("../../block.cjs"),l=require("../interactive-element.cjs"),r=require("./component-ref.helpers.cjs");function m(e){var t;const c=e.isInteractive?l:e.componentRef;return n.jsx(n.Fragment,{children:e.componentRef?n.jsx(n.Fragment,{children:n.jsx(c,{...r.getWrapperProps({componentOptions:e.componentOptions,builderBlock:e.builderBlock,context:e.context,componentRef:e.componentRef,linkComponent:e.linkComponent,includeBlockProps:e.includeBlockProps,isInteractive:e.isInteractive,contextValue:e.context}),children:(t=e.blockChildren)==null?void 0:t.map(o=>n.jsx(i,{block:o,context:e.context,registeredComponents:e.registeredComponents,linkComponent:e.linkComponent},o.id))})}):null})}module.exports=m;
|
|
1
|
+
"use strict";const n=require("react/jsx-runtime"),i=require("../../block.cjs"),l=require("../interactive-element.cjs"),r=require("./component-ref.helpers.cjs");function m(e){var t;const c=e.isInteractive?l:e.componentRef;return n.jsx(n.Fragment,{children:e.componentRef?n.jsx(n.Fragment,{children:n.jsx(c,{...r.getWrapperProps({componentOptions:e.componentOptions,builderBlock:e.builderBlock,context:e.context,componentRef:e.componentRef,linkComponent:e.linkComponent,includeBlockProps:e.includeBlockProps,isInteractive:e.isInteractive,contextValue:e.context}),children:e.componentRef?n.jsx(n.Fragment,{children:(t=e.blockChildren)==null?void 0:t.map(o=>n.jsx(i,{block:o,context:e.context,registeredComponents:e.registeredComponents,linkComponent:e.linkComponent},o.id))}):null})}):null})}module.exports=m;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsx as n, Fragment as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { jsx as n, Fragment as t } from "react/jsx-runtime";
|
|
2
|
+
import l from "../../block.mjs";
|
|
3
|
+
import m from "../interactive-element.mjs";
|
|
4
4
|
import { getWrapperProps as r } from "./component-ref.helpers.mjs";
|
|
5
5
|
function u(e) {
|
|
6
|
-
var
|
|
7
|
-
const i = e.isInteractive ?
|
|
8
|
-
return /* @__PURE__ */ n(
|
|
6
|
+
var o;
|
|
7
|
+
const i = e.isInteractive ? m : e.componentRef;
|
|
8
|
+
return /* @__PURE__ */ n(t, { children: e.componentRef ? /* @__PURE__ */ n(t, { children: /* @__PURE__ */ n(
|
|
9
9
|
i,
|
|
10
10
|
{
|
|
11
11
|
...r({
|
|
@@ -18,16 +18,16 @@ function u(e) {
|
|
|
18
18
|
isInteractive: e.isInteractive,
|
|
19
19
|
contextValue: e.context
|
|
20
20
|
}),
|
|
21
|
-
children: (t = e.blockChildren) == null ? void 0 :
|
|
22
|
-
|
|
21
|
+
children: e.componentRef ? /* @__PURE__ */ n(t, { children: (o = e.blockChildren) == null ? void 0 : o.map((c) => /* @__PURE__ */ n(
|
|
22
|
+
l,
|
|
23
23
|
{
|
|
24
|
-
block:
|
|
24
|
+
block: c,
|
|
25
25
|
context: e.context,
|
|
26
26
|
registeredComponents: e.registeredComponents,
|
|
27
27
|
linkComponent: e.linkComponent
|
|
28
28
|
},
|
|
29
|
-
|
|
30
|
-
))
|
|
29
|
+
c.id
|
|
30
|
+
)) }) : null
|
|
31
31
|
}
|
|
32
32
|
) }) : null });
|
|
33
33
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use client";"use strict";const a=require("react/jsx-runtime"),i=require("react"),r=require("../../functions/is-editing.cjs");function d(e){const c=i.useRef(null);i.useState(()=>!1);function o(){var t;return["builder-blocks",(t=e.blocks)!=null&&t.length?"":"no-blocks",e.classNameProp].filter(Boolean).join(" ")}function s(){if(!e.path)return;const t="this.",n="component.options.";return e.path.startsWith(t)?e.path.replace(t,""):e.path.startsWith(n)?e.path:`${n}${e.path||""}`}function l(){var t,n;r.isEditing()&&!((t=e.blocks)!=null&&t.length)&&((n=window.parent)==null||n.postMessage({type:"builder.clickEmptyBlocks",data:{parentElementId:e.parent,dataPath:s()}},"*"))}function u(){var t,n;r.isEditing()&&!((t=e.blocks)!=null&&t.length)&&((n=window.parent)==null||n.postMessage({type:"builder.hoverEmptyBlocks",data:{parentElementId:e.parent,dataPath:s()}},"*"))}return i.useEffect(()=>{},[]),i.useEffect(()=>{},[e.blocks]),a.jsxs(a.Fragment,{children:[a.jsx(e.BlocksWrapper,{ref:c,className:o()+" props-blocks-wrapper-
|
|
1
|
+
"use client";"use strict";const a=require("react/jsx-runtime"),i=require("react"),r=require("../../functions/is-editing.cjs");function d(e){const c=i.useRef(null);i.useState(()=>!1);function o(){var t;return["builder-blocks",(t=e.blocks)!=null&&t.length?"":"no-blocks",e.classNameProp].filter(Boolean).join(" ")}function s(){if(!e.path)return;const t="this.",n="component.options.";return e.path.startsWith(t)?e.path.replace(t,""):e.path.startsWith(n)?e.path:`${n}${e.path||""}`}function l(){var t,n;r.isEditing()&&!((t=e.blocks)!=null&&t.length)&&((n=window.parent)==null||n.postMessage({type:"builder.clickEmptyBlocks",data:{parentElementId:e.parent,dataPath:s()}},"*"))}function u(){var t,n;r.isEditing()&&!((t=e.blocks)!=null&&t.length)&&((n=window.parent)==null||n.postMessage({type:"builder.hoverEmptyBlocks",data:{parentElementId:e.parent,dataPath:s()}},"*"))}return i.useEffect(()=>{},[]),i.useEffect(()=>{},[e.blocks]),a.jsxs(a.Fragment,{children:[a.jsx(e.BlocksWrapper,{ref:c,className:o()+" props-blocks-wrapper-49da6528","builder-path":s(),"builder-parent-id":e.parent,style:e.styleProp,onClick:t=>l(),onMouseEnter:t=>u(),onKeyPress:t=>l(),...e.BlocksWrapperProps,children:e.children}),a.jsx("style",{children:`.props-blocks-wrapper-49da6528 {
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
align-items: stretch;
|
|
@@ -52,7 +52,7 @@ function y(e) {
|
|
|
52
52
|
e.BlocksWrapper,
|
|
53
53
|
{
|
|
54
54
|
ref: c,
|
|
55
|
-
className: o() + " props-blocks-wrapper-
|
|
55
|
+
className: o() + " props-blocks-wrapper-49da6528",
|
|
56
56
|
"builder-path": a(),
|
|
57
57
|
"builder-parent-id": e.parent,
|
|
58
58
|
style: e.styleProp,
|
|
@@ -63,7 +63,7 @@ function y(e) {
|
|
|
63
63
|
children: e.children
|
|
64
64
|
}
|
|
65
65
|
),
|
|
66
|
-
/* @__PURE__ */ r("style", { children: `.props-blocks-wrapper-
|
|
66
|
+
/* @__PURE__ */ r("style", { children: `.props-blocks-wrapper-49da6528 {
|
|
67
67
|
display: flex;
|
|
68
68
|
flex-direction: column;
|
|
69
69
|
align-items: stretch;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";const
|
|
1
|
+
"use client";"use strict";const L=require("react/jsx-runtime"),c=require("react"),M=require("../../../context/builder.context.cjs"),$=require("../../../functions/evaluate/evaluate.cjs"),G=require("../../../functions/fast-clone.cjs"),J=require("../../../functions/get-content/index.cjs"),T=require("../../../functions/is-browser.cjs"),m=require("../../../functions/is-editing.cjs"),z=require("../../../functions/is-previewing.cjs"),Q=require("../../../functions/log-fetch.cjs"),X=require("../../../functions/register-component.cjs"),D=require("../../../functions/track/index.cjs"),Y=require("../../../functions/track/interaction.cjs"),H=require("../../../helpers/canTrack.cjs"),Z=require("../../../helpers/cookie.cjs"),p=require("../../../helpers/preview-lru-cache/set.cjs"),ee=require("../../../helpers/subscribe-to-editor.cjs"),te=require("../../../scripts/init-editing.cjs"),ne=require("../../block/animator.cjs"),K=require("./enable-editor.helpers.cjs"),ie=require("./styles.helpers.cjs"),ae=require("next/navigation");function re(e){var I,w,k;const l=c.useRef(null);c.useState(()=>!1);const[_,O]=c.useState(()=>null),[U,j]=c.useState(()=>"");function f(n){var i,r;const t={...e.builderContextSignal.rootState,...n};e.builderContextSignal.rootSetState?(r=(i=e.builderContextSignal).rootSetState)==null||r.call(i,t):e.builderContextSignal.rootState=t}function b(n){var i,r,a,o,d;const t={...e.builderContextSignal.content,...n,data:{...(i=e.builderContextSignal.content)==null?void 0:i.data,...n==null?void 0:n.data},meta:{...(r=e.builderContextSignal.content)==null?void 0:r.meta,...n==null?void 0:n.meta,breakpoints:((a=n==null?void 0:n.meta)==null?void 0:a.breakpoints)||((d=(o=e.builderContextSignal.content)==null?void 0:o.meta)==null?void 0:d.breakpoints)}};p.postPreviewContent({value:t,key:t.id,url:window.location.pathname})}function N(){return e.showContent?{}:{hidden:!0,"aria-hidden":!0}}const[V,oe]=c.useState(()=>e.contentWrapper||"div");function h(n){return ee.createEditorListener({model:e.model,trustedHosts:e.trustedHosts,callbacks:{configureSdk:t=>{var a;const{breakpoints:i,contentId:r}=t;!r||r!==((a=e.builderContextSignal.content)==null?void 0:a.id)||i&&b({meta:{breakpoints:i}})},animation:t=>{ne.triggerAnimation(t)},contentUpdate:t=>{b(t)},stateUpdate:t=>{f(t)}}})(n)}const[E,ce]=c.useState(()=>({})),[S,de]=c.useState(()=>({})),[x,B]=c.useState(()=>!1);function F(n){var t,i;if(e.builderContextSignal.content){const r=(t=e.builderContextSignal.content)==null?void 0:t.testVariationId,a=(i=e.builderContextSignal.content)==null?void 0:i.id;D._track({apiHost:e.apiHost,type:"click",canTrack:H.getDefaultCanTrack(e.canTrack),contentId:a,apiKey:e.apiKey,variationId:r!==a?r:void 0,...Y.getInteractionPropertiesForEvent(n),unique:!x})}x||B(!0)}function W(){var t,i,r;const n=(r=(i=(t=e.builderContextSignal.content)==null?void 0:t.data)==null?void 0:i.httpRequests)!=null?r:{};Object.entries(n).forEach(([a,o])=>{if(!o)return;const d=typeof o=="object"&&o["@type"]==="@builder.io/core:Request";if(S[a]||E[a]&&!m.isEditing())return;const v=d?o.request.url:o;S[a]=!0;const P=v.replace(/{{([^}]+)}}/g,(u,A)=>String($.evaluate({code:A,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState}))),s=d?{url:P,method:o.request.method,headers:o.request.headers,body:o.request.body}:{url:P,method:"GET"};Q.logFetch(JSON.stringify(s));const R={method:s.method,headers:s.headers,body:s.body};s.method==="GET"&&delete R.body,fetch(s.url,R).then(u=>u.json()).then(u=>{f({[a]:u}),E[a]=!0}).catch(u=>{console.error("error fetching dynamic data",JSON.stringify(o),u)}).finally(()=>{S[a]=!1})})}function g(){m.isEditing()&&window.dispatchEvent(new CustomEvent("builder:component:stateChange",{detail:{state:G.fastClone(e.builderContextSignal.rootState),ref:{name:e.model}}}))}function C(n){var t;window.addEventListener("message",h),te.setupBrowserForEditing({...e.locale?{locale:e.locale}:{},...e.enrich?{enrich:e.enrich}:{},...e.trustedHosts?{trustedHosts:e.trustedHosts}:{},modelName:(t=e.model)!=null?t:"",apiKey:e.apiKey}),Object.values(e.builderContextSignal.componentInfos).forEach(i=>{var r,a;if(!((r=i.models)!=null&&r.length)||i.models.includes(e.model)){const o=X.createRegisterComponentMessage(i);(a=window.parent)==null||a.postMessage(o,"*")}}),window.addEventListener("builder:component:stateChangeListenerActivated",g)}function q(n){var o;const t=new URL(location.href).searchParams,i=t.get("builder.preview"),r=t.get(`builder.overrides.${i}`),a=t.get("apiKey")||t.get("builder.space");(i==="BUILDER_STUDIO"||i===e.model&&a===e.apiKey&&(!e.content||r===e.content.id))&&J.fetchOneEntry({model:e.model,apiKey:e.apiKey,apiVersion:e.builderContextSignal.apiVersion,...i==="BUILDER_STUDIO"&&((o=e.context)!=null&&o.symbolId)?{query:{id:e.context.symbolId}}:{}}).then(d=>{d&&b(d)})}ae.useRouter();const y=c.useRef(!1);return y.current||(W(),g(),y.current=!0),c.useEffect(()=>{var n;return(n=l.current)==null||n.addEventListener("initeditingbldr",C),()=>{var t;return(t=l.current)==null?void 0:t.removeEventListener("initeditingbldr",C)}},[]),c.useEffect(()=>{var n;return(n=l.current)==null||n.addEventListener("initpreviewingbldr",q),()=>{var t;return(t=l.current)==null?void 0:t.removeEventListener("initpreviewingbldr",q)}},[]),c.useEffect(()=>{var n,t,i;if(T.isBrowser()){m.isEditing()&&!e.isNestedRender&&l.current&&l.current.dispatchEvent(new CustomEvent("initeditingbldr"));const r=e.builderContextSignal.content&&H.getDefaultCanTrack(e.canTrack),a=Z.getCookieSync({name:`builder.tests.${(n=e.builderContextSignal.content)==null?void 0:n.id}`,canTrack:!0}),o=(t=e.builderContextSignal.content)==null?void 0:t.testVariationId;if(r&&o===a){const d=(i=e.builderContextSignal.content)==null?void 0:i.id,v=e.apiKey;D._track({apiHost:e.apiHost,type:"impression",canTrack:!0,contentId:d,apiKey:v,variationId:a!==d?a:void 0})}z.isPreviewing()&&m.isEditing()}},[]),c.useEffect(()=>{},[e.content]),c.useEffect(()=>{g()},[e.builderContextSignal.rootState]),c.useEffect(()=>{if(e.data){if(_===e.data)return;f(e.data),O(e.data)}},[e.data]),c.useEffect(()=>{if(e.locale){if(U===e.locale)return;f({locale:e.locale}),j(e.locale)}},[e.locale]),c.useEffect(()=>()=>{T.isBrowser()&&(window.removeEventListener("message",h),window.removeEventListener("builder:component:stateChangeListenerActivated",g))},[]),L.jsx(M.Provider,{value:e.builderContextSignal,children:e.builderContextSignal.content||K.needsElementRefDivForEditing()?L.jsx(V,{ref:l,onClick:n=>F(n),"builder-content-id":(I=e.builderContextSignal.content)==null?void 0:I.id,"builder-model":e.model,className:ie.getWrapperClassName(((w=e.content)==null?void 0:w.testVariationId)||((k=e.content)==null?void 0:k.id)),style:{display:!e.builderContextSignal.content&&K.needsElementRefDivForEditing()?"none":void 0},...N(),...e.contentWrapperProps,children:e.children}):null})}module.exports=re;
|
|
@@ -1,30 +1,31 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { useRef as
|
|
4
|
-
import
|
|
5
|
-
import { evaluate as
|
|
6
|
-
import { fastClone as
|
|
7
|
-
import { fetchOneEntry as
|
|
8
|
-
import { isBrowser as
|
|
2
|
+
import { jsx as K } from "react/jsx-runtime";
|
|
3
|
+
import { useRef as T, useState as u, useEffect as l } from "react";
|
|
4
|
+
import J from "../../../context/builder.context.mjs";
|
|
5
|
+
import { evaluate as $ } from "../../../functions/evaluate/evaluate.mjs";
|
|
6
|
+
import { fastClone as z } from "../../../functions/fast-clone.mjs";
|
|
7
|
+
import { fetchOneEntry as Q } from "../../../functions/get-content/index.mjs";
|
|
8
|
+
import { isBrowser as D } from "../../../functions/is-browser.mjs";
|
|
9
9
|
import { isEditing as b } from "../../../functions/is-editing.mjs";
|
|
10
|
-
import { isPreviewing as
|
|
11
|
-
import { logFetch as
|
|
12
|
-
import { createRegisterComponentMessage as
|
|
13
|
-
import { _track as
|
|
14
|
-
import { getInteractionPropertiesForEvent as
|
|
15
|
-
import { getDefaultCanTrack as
|
|
16
|
-
import { getCookieSync as
|
|
17
|
-
import { postPreviewContent as
|
|
18
|
-
import { createEditorListener as
|
|
19
|
-
import { setupBrowserForEditing as
|
|
20
|
-
import { triggerAnimation as
|
|
21
|
-
import { needsElementRefDivForEditing as
|
|
22
|
-
import { getWrapperClassName as
|
|
23
|
-
import { useRouter as
|
|
24
|
-
function
|
|
25
|
-
var
|
|
26
|
-
const c =
|
|
27
|
-
|
|
10
|
+
import { isPreviewing as X } from "../../../functions/is-previewing.mjs";
|
|
11
|
+
import { logFetch as Y } from "../../../functions/log-fetch.mjs";
|
|
12
|
+
import { createRegisterComponentMessage as Z } from "../../../functions/register-component.mjs";
|
|
13
|
+
import { _track as O } from "../../../functions/track/index.mjs";
|
|
14
|
+
import { getInteractionPropertiesForEvent as p } from "../../../functions/track/interaction.mjs";
|
|
15
|
+
import { getDefaultCanTrack as U } from "../../../helpers/canTrack.mjs";
|
|
16
|
+
import { getCookieSync as ee } from "../../../helpers/cookie.mjs";
|
|
17
|
+
import { postPreviewContent as te } from "../../../helpers/preview-lru-cache/set.mjs";
|
|
18
|
+
import { createEditorListener as ne } from "../../../helpers/subscribe-to-editor.mjs";
|
|
19
|
+
import { setupBrowserForEditing as ie } from "../../../scripts/init-editing.mjs";
|
|
20
|
+
import { triggerAnimation as ae } from "../../block/animator.mjs";
|
|
21
|
+
import { needsElementRefDivForEditing as q } from "./enable-editor.helpers.mjs";
|
|
22
|
+
import { getWrapperClassName as oe } from "./styles.helpers.mjs";
|
|
23
|
+
import { useRouter as re } from "next/navigation";
|
|
24
|
+
function De(e) {
|
|
25
|
+
var P, k, L;
|
|
26
|
+
const c = T(null);
|
|
27
|
+
u(() => !1);
|
|
28
|
+
const [N, V] = u(() => null), [j, _] = u(() => "");
|
|
28
29
|
function f(n) {
|
|
29
30
|
var i, o;
|
|
30
31
|
const t = {
|
|
@@ -48,23 +49,23 @@ function Le(e) {
|
|
|
48
49
|
breakpoints: ((a = n == null ? void 0 : n.meta) == null ? void 0 : a.breakpoints) || ((d = (r = e.builderContextSignal.content) == null ? void 0 : r.meta) == null ? void 0 : d.breakpoints)
|
|
49
50
|
}
|
|
50
51
|
};
|
|
51
|
-
|
|
52
|
+
te({
|
|
52
53
|
value: t,
|
|
53
54
|
key: t.id,
|
|
54
55
|
url: window.location.pathname
|
|
55
56
|
});
|
|
56
57
|
}
|
|
57
|
-
function
|
|
58
|
+
function W() {
|
|
58
59
|
return e.showContent ? {} : {
|
|
59
60
|
hidden: !0,
|
|
60
61
|
"aria-hidden": !0
|
|
61
62
|
};
|
|
62
63
|
}
|
|
63
|
-
const [
|
|
64
|
+
const [A, de] = u(
|
|
64
65
|
() => e.contentWrapper || "div"
|
|
65
66
|
);
|
|
66
67
|
function x(n) {
|
|
67
|
-
return
|
|
68
|
+
return ne({
|
|
68
69
|
model: e.model,
|
|
69
70
|
trustedHosts: e.trustedHosts,
|
|
70
71
|
callbacks: {
|
|
@@ -78,7 +79,7 @@ function Le(e) {
|
|
|
78
79
|
});
|
|
79
80
|
},
|
|
80
81
|
animation: (t) => {
|
|
81
|
-
|
|
82
|
+
ae(t);
|
|
82
83
|
},
|
|
83
84
|
contentUpdate: (t) => {
|
|
84
85
|
S(t);
|
|
@@ -89,25 +90,25 @@ function Le(e) {
|
|
|
89
90
|
}
|
|
90
91
|
})(n);
|
|
91
92
|
}
|
|
92
|
-
const [C,
|
|
93
|
-
function
|
|
93
|
+
const [C, le] = u(() => ({})), [v, ce] = u(() => ({})), [y, B] = u(() => !1);
|
|
94
|
+
function F(n) {
|
|
94
95
|
var t, i;
|
|
95
96
|
if (e.builderContextSignal.content) {
|
|
96
97
|
const o = (t = e.builderContextSignal.content) == null ? void 0 : t.testVariationId, a = (i = e.builderContextSignal.content) == null ? void 0 : i.id;
|
|
97
|
-
|
|
98
|
+
O({
|
|
98
99
|
apiHost: e.apiHost,
|
|
99
100
|
type: "click",
|
|
100
|
-
canTrack:
|
|
101
|
+
canTrack: U(e.canTrack),
|
|
101
102
|
contentId: a,
|
|
102
103
|
apiKey: e.apiKey,
|
|
103
104
|
variationId: o !== a ? o : void 0,
|
|
104
|
-
...
|
|
105
|
+
...p(n),
|
|
105
106
|
unique: !y
|
|
106
107
|
});
|
|
107
108
|
}
|
|
108
|
-
y ||
|
|
109
|
+
y || B(!0);
|
|
109
110
|
}
|
|
110
|
-
function
|
|
111
|
+
function M() {
|
|
111
112
|
var t, i, o;
|
|
112
113
|
const n = (o = (i = (t = e.builderContextSignal.content) == null ? void 0 : t.data) == null ? void 0 : i.httpRequests) != null ? o : {};
|
|
113
114
|
Object.entries(n).forEach(
|
|
@@ -121,9 +122,9 @@ function Le(e) {
|
|
|
121
122
|
v[a] = !0;
|
|
122
123
|
const R = h.replace(
|
|
123
124
|
/{{([^}]+)}}/g,
|
|
124
|
-
(
|
|
125
|
-
|
|
126
|
-
code:
|
|
125
|
+
(s, G) => String(
|
|
126
|
+
$({
|
|
127
|
+
code: G,
|
|
127
128
|
context: e.context || {},
|
|
128
129
|
localState: void 0,
|
|
129
130
|
rootState: e.builderContextSignal.rootState,
|
|
@@ -139,19 +140,21 @@ function Le(e) {
|
|
|
139
140
|
url: R,
|
|
140
141
|
method: "GET"
|
|
141
142
|
};
|
|
142
|
-
|
|
143
|
+
Y(JSON.stringify(m));
|
|
144
|
+
const H = {
|
|
143
145
|
method: m.method,
|
|
144
146
|
headers: m.headers,
|
|
145
147
|
body: m.body
|
|
146
|
-
}
|
|
148
|
+
};
|
|
149
|
+
m.method === "GET" && delete H.body, fetch(m.url, H).then((s) => s.json()).then((s) => {
|
|
147
150
|
f({
|
|
148
|
-
[a]:
|
|
151
|
+
[a]: s
|
|
149
152
|
}), C[a] = !0;
|
|
150
|
-
}).catch((
|
|
153
|
+
}).catch((s) => {
|
|
151
154
|
console.error(
|
|
152
155
|
"error fetching dynamic data",
|
|
153
156
|
JSON.stringify(r),
|
|
154
|
-
|
|
157
|
+
s
|
|
155
158
|
);
|
|
156
159
|
}).finally(() => {
|
|
157
160
|
v[a] = !1;
|
|
@@ -165,7 +168,7 @@ function Le(e) {
|
|
|
165
168
|
"builder:component:stateChange",
|
|
166
169
|
{
|
|
167
170
|
detail: {
|
|
168
|
-
state:
|
|
171
|
+
state: z(e.builderContextSignal.rootState),
|
|
169
172
|
ref: {
|
|
170
173
|
name: e.model
|
|
171
174
|
}
|
|
@@ -176,7 +179,7 @@ function Le(e) {
|
|
|
176
179
|
}
|
|
177
180
|
function E(n) {
|
|
178
181
|
var t;
|
|
179
|
-
window.addEventListener("message", x),
|
|
182
|
+
window.addEventListener("message", x), ie({
|
|
180
183
|
...e.locale ? {
|
|
181
184
|
locale: e.locale
|
|
182
185
|
} : {},
|
|
@@ -193,7 +196,7 @@ function Le(e) {
|
|
|
193
196
|
).forEach((i) => {
|
|
194
197
|
var o, a;
|
|
195
198
|
if (!((o = i.models) != null && o.length) || i.models.includes(e.model)) {
|
|
196
|
-
const r =
|
|
199
|
+
const r = Z(i);
|
|
197
200
|
(a = window.parent) == null || a.postMessage(r, "*");
|
|
198
201
|
}
|
|
199
202
|
}), window.addEventListener(
|
|
@@ -206,7 +209,7 @@ function Le(e) {
|
|
|
206
209
|
const t = new URL(location.href).searchParams, i = t.get("builder.preview"), o = t.get(
|
|
207
210
|
`builder.overrides.${i}`
|
|
208
211
|
), a = t.get("apiKey") || t.get("builder.space");
|
|
209
|
-
(i === "BUILDER_STUDIO" || i === e.model && a === e.apiKey && (!e.content || o === e.content.id)) &&
|
|
212
|
+
(i === "BUILDER_STUDIO" || i === e.model && a === e.apiKey && (!e.content || o === e.content.id)) && Q({
|
|
210
213
|
model: e.model,
|
|
211
214
|
apiKey: e.apiKey,
|
|
212
215
|
apiVersion: e.builderContextSignal.apiVersion,
|
|
@@ -219,9 +222,9 @@ function Le(e) {
|
|
|
219
222
|
d && S(d);
|
|
220
223
|
});
|
|
221
224
|
}
|
|
222
|
-
|
|
223
|
-
const w =
|
|
224
|
-
return w.current || (
|
|
225
|
+
re();
|
|
226
|
+
const w = T(!1);
|
|
227
|
+
return w.current || (M(), g(), w.current = !0), l(() => {
|
|
225
228
|
var n;
|
|
226
229
|
return (n = c.current) == null || n.addEventListener(
|
|
227
230
|
"initeditingbldr",
|
|
@@ -247,15 +250,15 @@ function Le(e) {
|
|
|
247
250
|
};
|
|
248
251
|
}, []), l(() => {
|
|
249
252
|
var n, t, i;
|
|
250
|
-
if (
|
|
253
|
+
if (D()) {
|
|
251
254
|
b() && !e.isNestedRender && c.current && c.current.dispatchEvent(new CustomEvent("initeditingbldr"));
|
|
252
|
-
const o = e.builderContextSignal.content &&
|
|
255
|
+
const o = e.builderContextSignal.content && U(e.canTrack), a = ee({
|
|
253
256
|
name: `builder.tests.${(n = e.builderContextSignal.content) == null ? void 0 : n.id}`,
|
|
254
257
|
canTrack: !0
|
|
255
258
|
}), r = (t = e.builderContextSignal.content) == null ? void 0 : t.testVariationId;
|
|
256
259
|
if (o && r === a) {
|
|
257
260
|
const d = (i = e.builderContextSignal.content) == null ? void 0 : i.id, h = e.apiKey;
|
|
258
|
-
|
|
261
|
+
O({
|
|
259
262
|
apiHost: e.apiHost,
|
|
260
263
|
type: "impression",
|
|
261
264
|
canTrack: !0,
|
|
@@ -264,41 +267,49 @@ function Le(e) {
|
|
|
264
267
|
variationId: a !== d ? a : void 0
|
|
265
268
|
});
|
|
266
269
|
}
|
|
267
|
-
|
|
270
|
+
X() && b();
|
|
268
271
|
}
|
|
269
272
|
}, []), l(() => {
|
|
270
273
|
}, [e.content]), l(() => {
|
|
271
274
|
g();
|
|
272
275
|
}, [e.builderContextSignal.rootState]), l(() => {
|
|
273
|
-
|
|
276
|
+
if (e.data) {
|
|
277
|
+
if (N === e.data)
|
|
278
|
+
return;
|
|
279
|
+
f(e.data), V(e.data);
|
|
280
|
+
}
|
|
274
281
|
}, [e.data]), l(() => {
|
|
275
|
-
e.locale
|
|
276
|
-
|
|
277
|
-
|
|
282
|
+
if (e.locale) {
|
|
283
|
+
if (j === e.locale)
|
|
284
|
+
return;
|
|
285
|
+
f({
|
|
286
|
+
locale: e.locale
|
|
287
|
+
}), _(e.locale);
|
|
288
|
+
}
|
|
278
289
|
}, [e.locale]), l(() => () => {
|
|
279
|
-
|
|
290
|
+
D() && (window.removeEventListener("message", x), window.removeEventListener(
|
|
280
291
|
"builder:component:stateChangeListenerActivated",
|
|
281
292
|
g
|
|
282
293
|
));
|
|
283
|
-
}, []), /* @__PURE__ */
|
|
284
|
-
|
|
294
|
+
}, []), /* @__PURE__ */ K(J.Provider, { value: e.builderContextSignal, children: e.builderContextSignal.content || q() ? /* @__PURE__ */ K(
|
|
295
|
+
A,
|
|
285
296
|
{
|
|
286
297
|
ref: c,
|
|
287
|
-
onClick: (n) =>
|
|
288
|
-
"builder-content-id": (
|
|
298
|
+
onClick: (n) => F(n),
|
|
299
|
+
"builder-content-id": (P = e.builderContextSignal.content) == null ? void 0 : P.id,
|
|
289
300
|
"builder-model": e.model,
|
|
290
|
-
className:
|
|
291
|
-
((
|
|
301
|
+
className: oe(
|
|
302
|
+
((k = e.content) == null ? void 0 : k.testVariationId) || ((L = e.content) == null ? void 0 : L.id)
|
|
292
303
|
),
|
|
293
304
|
style: {
|
|
294
|
-
display: !e.builderContextSignal.content &&
|
|
305
|
+
display: !e.builderContextSignal.content && q() ? "none" : void 0
|
|
295
306
|
},
|
|
296
|
-
...
|
|
307
|
+
...W(),
|
|
297
308
|
...e.contentWrapperProps,
|
|
298
309
|
children: e.children
|
|
299
310
|
}
|
|
300
311
|
) : null });
|
|
301
312
|
}
|
|
302
313
|
export {
|
|
303
|
-
|
|
314
|
+
De as default
|
|
304
315
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.21.1";exports.SDK_VERSION=e;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./is-browser.cjs"),g=require("./register-component.cjs"),i={};function a(e,t){e==="plugin"&&(t=g.serializeIncludingFunctions(t));let r=i[e];if(r||(r=i[e]=[]),r.push(t),o.isBrowser()){const s={type:"builder.register",data:{type:e,info:t}};try{parent.postMessage(s,"*"),parent!==window&&window.postMessage(s,"*")}catch(n){console.debug("Could not postmessage",n)}}}function c(e){var t;if(o.isBrowser()){const r=JSON.parse(JSON.stringify(e));e.action&&(r.action=e.action.toString()),(t=window.parent)==null||t.postMessage({type:"builder.registerAction",data:r},"*")}}exports.register=a;exports.registerAction=c;
|
|
@@ -1,24 +1,35 @@
|
|
|
1
|
-
import { isBrowser as
|
|
1
|
+
import { isBrowser as o } from "./is-browser.mjs";
|
|
2
2
|
import { serializeIncludingFunctions as a } from "./register-component.mjs";
|
|
3
|
-
const
|
|
4
|
-
function
|
|
5
|
-
|
|
6
|
-
let
|
|
7
|
-
if (
|
|
8
|
-
const
|
|
3
|
+
const r = {};
|
|
4
|
+
function p(t, e) {
|
|
5
|
+
t === "plugin" && (e = a(e));
|
|
6
|
+
let i = r[t];
|
|
7
|
+
if (i || (i = r[t] = []), i.push(e), o()) {
|
|
8
|
+
const s = {
|
|
9
9
|
type: "builder.register",
|
|
10
10
|
data: {
|
|
11
|
-
type:
|
|
12
|
-
info:
|
|
11
|
+
type: t,
|
|
12
|
+
info: e
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
15
|
try {
|
|
16
|
-
parent.postMessage(
|
|
17
|
-
} catch (
|
|
18
|
-
console.debug("Could not postmessage",
|
|
16
|
+
parent.postMessage(s, "*"), parent !== window && window.postMessage(s, "*");
|
|
17
|
+
} catch (n) {
|
|
18
|
+
console.debug("Could not postmessage", n);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
+
function d(t) {
|
|
23
|
+
var e;
|
|
24
|
+
if (o()) {
|
|
25
|
+
const i = JSON.parse(JSON.stringify(t));
|
|
26
|
+
t.action && (i.action = t.action.toString()), (e = window.parent) == null || e.postMessage({
|
|
27
|
+
type: "builder.registerAction",
|
|
28
|
+
data: i
|
|
29
|
+
}, "*");
|
|
30
|
+
}
|
|
31
|
+
}
|
|
22
32
|
export {
|
|
23
|
-
|
|
33
|
+
p as register,
|
|
34
|
+
d as registerAction
|
|
24
35
|
};
|
package/lib/browser/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./blocks/button/button.cjs"),i=require("./blocks/columns/columns.cjs"),s=require("./blocks/fragment/fragment.cjs"),n=require("./blocks/image/image.cjs"),o=require("./blocks/section/section.cjs"),c=require("./blocks/symbol/symbol.cjs"),u=require("./blocks/text/text.cjs"),g=require("./blocks/video/video.cjs"),d=require("./components/blocks/blocks.cjs"),q=require("./components/content-variants/content-variants.cjs"),a=require("./context/builder.context.cjs"),l=require("./helpers/user-attributes.cjs"),b=require("./functions/is-editing.cjs"),m=require("./functions/is-previewing.cjs"),E=require("./functions/register-component.cjs"),t=require("./functions/register.cjs"),C=require("./functions/set-editor-settings.cjs"),f=require("./functions/get-builder-search-params/index.cjs"),h=require("./functions/track/index.cjs"),p=require("./helpers/subscribe-to-editor.cjs"),P=require("./functions/fetch-builder-props.cjs"),e=require("./functions/get-content/index.cjs");exports.Button=r;exports.Columns=i;exports.Fragment=s;exports.Image=n;exports.Section=o;exports.Symbol=c;exports.Text=u;exports.Video=g;exports.Blocks=d;exports.Content=q;exports.BuilderContext=a;exports.setClientUserAttributes=l.setClientUserAttributes;exports.isEditing=b.isEditing;exports.isPreviewing=m.isPreviewing;exports.createRegisterComponentMessage=E.createRegisterComponentMessage;exports.register=t.register;exports.registerAction=t.registerAction;exports.setEditorSettings=C.setEditorSettings;exports.getBuilderSearchParams=f.getBuilderSearchParams;exports.track=h.track;exports.subscribeToEditor=p.subscribeToEditor;exports.fetchBuilderProps=P.fetchBuilderProps;exports._processContentResult=e._processContentResult;exports.fetchEntries=e.fetchEntries;exports.fetchOneEntry=e.fetchOneEntry;
|