@builder.io/sdk-react-nextjs 0.19.1 → 0.19.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/browser/components/content/components/enable-editor.cjs +1 -1
- package/lib/browser/components/content/components/enable-editor.mjs +26 -26
- package/lib/browser/constants/sdk-version.cjs +1 -1
- package/lib/browser/constants/sdk-version.mjs +1 -1
- package/lib/browser/functions/get-processed-block.cjs +1 -1
- package/lib/browser/functions/get-processed-block.mjs +3 -3
- package/lib/browser/scripts/init-editing.cjs +1 -1
- package/lib/browser/scripts/init-editing.mjs +23 -48
- package/lib/edge/components/content/components/enable-editor.cjs +1 -1
- package/lib/edge/components/content/components/enable-editor.mjs +26 -26
- package/lib/edge/constants/sdk-version.cjs +1 -1
- package/lib/edge/constants/sdk-version.mjs +1 -1
- package/lib/edge/functions/get-processed-block.cjs +1 -1
- package/lib/edge/functions/get-processed-block.mjs +3 -3
- package/lib/edge/scripts/init-editing.cjs +1 -1
- package/lib/edge/scripts/init-editing.mjs +23 -48
- package/lib/node/components/content/components/enable-editor.cjs +1 -1
- package/lib/node/components/content/components/enable-editor.mjs +26 -26
- package/lib/node/constants/sdk-version.cjs +1 -1
- package/lib/node/constants/sdk-version.mjs +1 -1
- package/lib/node/functions/get-processed-block.cjs +1 -1
- package/lib/node/functions/get-processed-block.mjs +3 -3
- package/lib/node/scripts/init-editing.cjs +1 -1
- package/lib/node/scripts/init-editing.mjs +23 -48
- package/package.json +1 -1
- package/types/cjs/constants/sdk-version.d.ts +1 -1
- package/types/cjs/scripts/init-editing.d.ts +0 -1
- package/types/esm/constants/sdk-version.d.ts +1 -1
- package/types/esm/scripts/init-editing.d.ts +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";const R=require("react/jsx-runtime"),o=require("react"),
|
|
1
|
+
"use client";"use strict";const R=require("react/jsx-runtime"),o=require("react"),V=require("../../../context/builder.context.cjs"),j=require("../../../functions/evaluate/evaluate.cjs"),B=require("../../../functions/fast-clone.cjs"),F=require("../../../functions/get-content/index.cjs"),k=require("../../../functions/is-browser.cjs"),f=require("../../../functions/is-editing.cjs"),N=require("../../../functions/is-previewing.cjs"),O=require("../../../functions/log-fetch.cjs"),W=require("../../../functions/register-component.cjs"),y=require("../../../functions/track/index.cjs"),A=require("../../../functions/track/interaction.cjs"),P=require("../../../helpers/canTrack.cjs"),M=require("../../../helpers/cookie.cjs"),$=require("../../../helpers/preview-lru-cache/set.cjs"),z=require("../../../helpers/subscribe-to-editor.cjs"),G=require("../../../scripts/init-editing.cjs"),J=require("../../block/animator.cjs"),L=require("./enable-editor.helpers.cjs"),Q=require("./styles.helpers.cjs"),X=require("next/navigation");function Y(e){var q,I,w;const s=o.useRef(null);o.useState(()=>!1);function u(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 m(n){var i,r,a,c,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=(c=e.builderContextSignal.content)==null?void 0:c.meta)==null?void 0:d.breakpoints)}};$.postPreviewContent({value:t,key:t.id,url:window.location.pathname})}function H(){return e.showContent?{}:{hidden:!0,"aria-hidden":!0}}const[K,Z]=o.useState(()=>e.contentWrapper||"div");function S(n){return z.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&&m({meta:{breakpoints:i}})},animation:t=>{J.triggerAnimation(t)},contentUpdate:t=>{m(t)},stateUpdate:t=>{u(t)}}})(n)}const[v,p]=o.useState(()=>({})),[b,ee]=o.useState(()=>({})),[E,T]=o.useState(()=>!1);function D(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;y._track({apiHost:e.apiHost,type:"click",canTrack:P.getDefaultCanTrack(e.canTrack),contentId:a,apiKey:e.apiKey,variationId:r!==a?r:void 0,...A.getInteractionPropertiesForEvent(n),unique:!E})}E||T(!0)}function _(){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,c])=>{if(!c||b[a]||v[a]&&!f.isEditing())return;b[a]=!0;const d=c.replace(/{{([^}]+)}}/g,(l,U)=>String(j.evaluate({code:U,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState})));O.logFetch(d),fetch(d).then(l=>l.json()).then(l=>{u({[a]:l}),v[a]=!0}).catch(l=>{console.error("error fetching dynamic data",c,l)}).finally(()=>{b[a]=!1})})}function g(){f.isEditing()&&window.dispatchEvent(new CustomEvent("builder:component:stateChange",{detail:{state:B.fastClone(e.builderContextSignal.rootState),ref:{name:e.model}}}))}function h(n){var t;window.addEventListener("message",S),G.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 c=W.createRegisterComponentMessage(i);(a=window.parent)==null||a.postMessage(c,"*")}}),window.addEventListener("builder:component:stateChangeListenerActivated",g)}function x(n){var c;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))&&F.fetchOneEntry({model:e.model,apiKey:e.apiKey,apiVersion:e.builderContextSignal.apiVersion,...i==="BUILDER_STUDIO"&&((c=e.context)!=null&&c.symbolId)?{query:{id:e.context.symbolId}}:{}}).then(d=>{d&&m(d)})}X.useRouter();const C=o.useRef(!1);return C.current||(_(),g(),C.current=!0),o.useEffect(()=>{var n;return(n=s.current)==null||n.addEventListener("initeditingbldr",h),()=>{var t;return(t=s.current)==null?void 0:t.removeEventListener("initeditingbldr",h)}},[]),o.useEffect(()=>{var n;return(n=s.current)==null||n.addEventListener("initpreviewingbldr",x),()=>{var t;return(t=s.current)==null?void 0:t.removeEventListener("initpreviewingbldr",x)}},[]),o.useEffect(()=>{var n,t,i;if(k.isBrowser()){f.isEditing()&&!e.isNestedRender&&s.current&&s.current.dispatchEvent(new CustomEvent("initeditingbldr"));const r=e.builderContextSignal.content&&P.getDefaultCanTrack(e.canTrack),a=M.getCookieSync({name:`builder.tests.${(n=e.builderContextSignal.content)==null?void 0:n.id}`,canTrack:!0}),c=(t=e.builderContextSignal.content)==null?void 0:t.testVariationId;if(r&&c===a){const d=(i=e.builderContextSignal.content)==null?void 0:i.id,l=e.apiKey;y._track({apiHost:e.apiHost,type:"impression",canTrack:!0,contentId:d,apiKey:l,variationId:a!==d?a:void 0})}N.isPreviewing()&&f.isEditing()}},[]),o.useEffect(()=>{},[e.content]),o.useEffect(()=>{g()},[e.builderContextSignal.rootState]),o.useEffect(()=>{e.data&&u(e.data)},[e.data]),o.useEffect(()=>{e.locale&&u({locale:e.locale})},[e.locale]),o.useEffect(()=>()=>{k.isBrowser()&&(window.removeEventListener("message",S),window.removeEventListener("builder:component:stateChangeListenerActivated",g))},[]),R.jsx(V.Provider,{value:e.builderContextSignal,children:e.builderContextSignal.content||L.needsElementRefDivForEditing()?R.jsx(K,{ref:s,onClick:n=>D(n),"builder-content-id":(q=e.builderContextSignal.content)==null?void 0:q.id,"builder-model":e.model,className:Q.getWrapperClassName(((I=e.content)==null?void 0:I.testVariationId)||((w=e.content)==null?void 0:w.id)),style:{display:!e.builderContextSignal.content&&L.needsElementRefDivForEditing()?"none":void 0},...H(),...e.contentWrapperProps,children:e.children}):null})}module.exports=Y;
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as k } from "react/jsx-runtime";
|
|
3
3
|
import { useRef as P, useState as m, useEffect as c } from "react";
|
|
4
|
-
import
|
|
5
|
-
import { evaluate as
|
|
6
|
-
import { fastClone as
|
|
7
|
-
import { fetchOneEntry as
|
|
4
|
+
import O from "../../../context/builder.context.mjs";
|
|
5
|
+
import { evaluate as W } from "../../../functions/evaluate/evaluate.mjs";
|
|
6
|
+
import { fastClone as j } from "../../../functions/fast-clone.mjs";
|
|
7
|
+
import { fetchOneEntry as A } from "../../../functions/get-content/index.mjs";
|
|
8
8
|
import { isBrowser as L } from "../../../functions/is-browser.mjs";
|
|
9
9
|
import { isEditing as g } from "../../../functions/is-editing.mjs";
|
|
10
|
-
import { isPreviewing as
|
|
11
|
-
import { logFetch as
|
|
12
|
-
import { createRegisterComponentMessage as
|
|
10
|
+
import { isPreviewing as B } from "../../../functions/is-previewing.mjs";
|
|
11
|
+
import { logFetch as F } from "../../../functions/log-fetch.mjs";
|
|
12
|
+
import { createRegisterComponentMessage as M } from "../../../functions/register-component.mjs";
|
|
13
13
|
import { _track as H } from "../../../functions/track/index.mjs";
|
|
14
14
|
import { getInteractionPropertiesForEvent as $ } from "../../../functions/track/interaction.mjs";
|
|
15
15
|
import { getDefaultCanTrack as K } from "../../../helpers/canTrack.mjs";
|
|
16
16
|
import { getCookieSync as z } from "../../../helpers/cookie.mjs";
|
|
17
17
|
import { postPreviewContent as G } from "../../../helpers/preview-lru-cache/set.mjs";
|
|
18
18
|
import { createEditorListener as J } from "../../../helpers/subscribe-to-editor.mjs";
|
|
19
|
-
import {
|
|
20
|
-
import { triggerAnimation as
|
|
19
|
+
import { setupBrowserForEditing as Q } from "../../../scripts/init-editing.mjs";
|
|
20
|
+
import { triggerAnimation as X } from "../../block/animator.mjs";
|
|
21
21
|
import { needsElementRefDivForEditing as q } from "./enable-editor.helpers.mjs";
|
|
22
|
-
import { getWrapperClassName as
|
|
23
|
-
import { useRouter as
|
|
24
|
-
function
|
|
22
|
+
import { getWrapperClassName as Y } from "./styles.helpers.mjs";
|
|
23
|
+
import { useRouter as Z } from "next/navigation";
|
|
24
|
+
function yt(t) {
|
|
25
25
|
var w, y, R;
|
|
26
26
|
const u = P(null);
|
|
27
27
|
m(() => !1);
|
|
@@ -60,7 +60,7 @@ function Rt(t) {
|
|
|
60
60
|
"aria-hidden": !0
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
|
-
const [U,
|
|
63
|
+
const [U, p] = m(
|
|
64
64
|
() => t.contentWrapper || "div"
|
|
65
65
|
);
|
|
66
66
|
function v(n) {
|
|
@@ -78,7 +78,7 @@ function Rt(t) {
|
|
|
78
78
|
});
|
|
79
79
|
},
|
|
80
80
|
animation: (e) => {
|
|
81
|
-
|
|
81
|
+
X(e);
|
|
82
82
|
},
|
|
83
83
|
contentUpdate: (e) => {
|
|
84
84
|
b(e);
|
|
@@ -89,7 +89,7 @@ function Rt(t) {
|
|
|
89
89
|
}
|
|
90
90
|
})(n);
|
|
91
91
|
}
|
|
92
|
-
const [h,
|
|
92
|
+
const [h, tt] = m(() => ({})), [S, et] = m(() => ({})), [x, D] = m(() => !1);
|
|
93
93
|
function V(n) {
|
|
94
94
|
var e, i;
|
|
95
95
|
if (t.builderContextSignal.content) {
|
|
@@ -117,7 +117,7 @@ function Rt(t) {
|
|
|
117
117
|
const d = r.replace(
|
|
118
118
|
/{{([^}]+)}}/g,
|
|
119
119
|
(l, _) => String(
|
|
120
|
-
|
|
120
|
+
W({
|
|
121
121
|
code: _,
|
|
122
122
|
context: t.context || {},
|
|
123
123
|
localState: void 0,
|
|
@@ -126,7 +126,7 @@ function Rt(t) {
|
|
|
126
126
|
})
|
|
127
127
|
)
|
|
128
128
|
);
|
|
129
|
-
|
|
129
|
+
F(d), fetch(d).then((l) => l.json()).then((l) => {
|
|
130
130
|
s({
|
|
131
131
|
[a]: l
|
|
132
132
|
}), h[a] = !0;
|
|
@@ -143,7 +143,7 @@ function Rt(t) {
|
|
|
143
143
|
"builder:component:stateChange",
|
|
144
144
|
{
|
|
145
145
|
detail: {
|
|
146
|
-
state:
|
|
146
|
+
state: j(t.builderContextSignal.rootState),
|
|
147
147
|
ref: {
|
|
148
148
|
name: t.model
|
|
149
149
|
}
|
|
@@ -154,7 +154,7 @@ function Rt(t) {
|
|
|
154
154
|
}
|
|
155
155
|
function C(n) {
|
|
156
156
|
var e;
|
|
157
|
-
window.addEventListener("message", v), Q(
|
|
157
|
+
window.addEventListener("message", v), Q({
|
|
158
158
|
...t.locale ? {
|
|
159
159
|
locale: t.locale
|
|
160
160
|
} : {},
|
|
@@ -171,7 +171,7 @@ function Rt(t) {
|
|
|
171
171
|
).forEach((i) => {
|
|
172
172
|
var o, a;
|
|
173
173
|
if (!((o = i.models) != null && o.length) || i.models.includes(t.model)) {
|
|
174
|
-
const r =
|
|
174
|
+
const r = M(i);
|
|
175
175
|
(a = window.parent) == null || a.postMessage(r, "*");
|
|
176
176
|
}
|
|
177
177
|
}), window.addEventListener(
|
|
@@ -184,7 +184,7 @@ function Rt(t) {
|
|
|
184
184
|
const e = new URL(location.href).searchParams, i = e.get("builder.preview"), o = e.get(
|
|
185
185
|
`builder.overrides.${i}`
|
|
186
186
|
), a = e.get("apiKey") || e.get("builder.space");
|
|
187
|
-
(i === "BUILDER_STUDIO" || i === t.model && a === t.apiKey && (!t.content || o === t.content.id)) &&
|
|
187
|
+
(i === "BUILDER_STUDIO" || i === t.model && a === t.apiKey && (!t.content || o === t.content.id)) && A({
|
|
188
188
|
model: t.model,
|
|
189
189
|
apiKey: t.apiKey,
|
|
190
190
|
apiVersion: t.builderContextSignal.apiVersion,
|
|
@@ -197,7 +197,7 @@ function Rt(t) {
|
|
|
197
197
|
d && b(d);
|
|
198
198
|
});
|
|
199
199
|
}
|
|
200
|
-
|
|
200
|
+
Z();
|
|
201
201
|
const I = P(!1);
|
|
202
202
|
return I.current || (N(), f(), I.current = !0), c(() => {
|
|
203
203
|
var n;
|
|
@@ -242,7 +242,7 @@ function Rt(t) {
|
|
|
242
242
|
variationId: a !== d ? a : void 0
|
|
243
243
|
});
|
|
244
244
|
}
|
|
245
|
-
|
|
245
|
+
B() && g();
|
|
246
246
|
}
|
|
247
247
|
}, []), c(() => {
|
|
248
248
|
}, [t.content]), c(() => {
|
|
@@ -258,14 +258,14 @@ function Rt(t) {
|
|
|
258
258
|
"builder:component:stateChangeListenerActivated",
|
|
259
259
|
f
|
|
260
260
|
));
|
|
261
|
-
}, []), /* @__PURE__ */ k(
|
|
261
|
+
}, []), /* @__PURE__ */ k(O.Provider, { value: t.builderContextSignal, children: t.builderContextSignal.content || q() ? /* @__PURE__ */ k(
|
|
262
262
|
U,
|
|
263
263
|
{
|
|
264
264
|
ref: u,
|
|
265
265
|
onClick: (n) => V(n),
|
|
266
266
|
"builder-content-id": (w = t.builderContextSignal.content) == null ? void 0 : w.id,
|
|
267
267
|
"builder-model": t.model,
|
|
268
|
-
className:
|
|
268
|
+
className: Y(
|
|
269
269
|
((y = t.content) == null ? void 0 : y.testVariationId) || ((R = t.content) == null ? void 0 : R.id)
|
|
270
270
|
),
|
|
271
271
|
style: {
|
|
@@ -278,5 +278,5 @@ function Rt(t) {
|
|
|
278
278
|
) : null });
|
|
279
279
|
}
|
|
280
280
|
export {
|
|
281
|
-
|
|
281
|
+
yt as default
|
|
282
282
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.19.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.19.3";exports.SDK_VERSION=e;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../constants/target.cjs"),d=require("../helpers/omit.cjs"),p=require("./evaluate/evaluate.cjs"),f=require("./extract-localized-values.cjs"),g=require("./fast-clone.cjs"),m=require("./set.cjs"),y=require("./transform-block.cjs");function o(e){if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(n=>o(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]=o(e[n]));return t}const C=["svelte","vue","angular","qwik","solid"].includes(u.TARGET),q=e=>{if(C){const t=g.fastClone(e);return{...t,properties:{...t.properties},actions:{...t.actions}}}else{const t=o(d.omit(e,"children","meta"));return{...t,properties:{...t.properties},actions:{...t.actions},children:e.children,meta:e.meta}}},v=({block:e,context:t,localState:n,rootState:i,rootSetState:s})=>{if(!e.bindings)return e;const r=q(e);for(const c in e.bindings){const a=e.bindings[c],l=p.evaluate({code:a,localState:n,rootState:i,rootSetState:s,context:t});m.set(r,c,l)}return r};function B({block:e,context:t,localState:n,rootState:i,rootSetState:s}){let r=
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../constants/target.cjs"),d=require("../helpers/omit.cjs"),p=require("./evaluate/evaluate.cjs"),f=require("./extract-localized-values.cjs"),g=require("./fast-clone.cjs"),m=require("./set.cjs"),y=require("./transform-block.cjs");function o(e){if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(n=>o(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]=o(e[n]));return t}const C=["svelte","vue","angular","qwik","solid"].includes(u.TARGET),q=e=>{if(C){const t=g.fastClone(e);return{...t,properties:{...t.properties},actions:{...t.actions}}}else{const t=o(d.omit(e,"children","meta"));return{...t,properties:{...t.properties},actions:{...t.actions},children:e.children,meta:e.meta}}},v=({block:e,context:t,localState:n,rootState:i,rootSetState:s})=>{if(!e.bindings)return e;const r=q(e);for(const c in e.bindings){const a=e.bindings[c],l=p.evaluate({code:a,localState:n,rootState:i,rootSetState:s,context:t});m.set(r,c,l)}return r};function B({block:e,context:t,localState:n,rootState:i,rootSetState:s}){let r=y.transformBlock(e);return r=v({block:r,localState:n,rootState:i,rootSetState:s,context:t}),r=f.resolveLocalizedValues(r,i.locale),r}exports.deepCloneWithConditions=o;exports.getProcessedBlock=B;
|
|
@@ -72,14 +72,14 @@ function P({
|
|
|
72
72
|
rootState: i,
|
|
73
73
|
rootSetState: o
|
|
74
74
|
}) {
|
|
75
|
-
let n =
|
|
76
|
-
return n =
|
|
75
|
+
let n = g(e);
|
|
76
|
+
return n = O({
|
|
77
77
|
block: n,
|
|
78
78
|
localState: t,
|
|
79
79
|
rootState: i,
|
|
80
80
|
rootSetState: o,
|
|
81
81
|
context: r
|
|
82
|
-
});
|
|
82
|
+
}), n = f(n, i.locale), n;
|
|
83
83
|
}
|
|
84
84
|
export {
|
|
85
85
|
s as deepCloneWithConditions,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../constants/sdk-version.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../constants/sdk-version.cjs"),m=require("../constants/target.cjs"),b=require("../functions/is-browser.cjs"),k=require("../functions/is-from-trusted-host.cjs");let c=!1;const v=r=>{var n,i;c||(c=!0,b.isBrowser()&&((n=window.parent)==null||n.postMessage({type:"builder.sdkInfo",data:{target:m.TARGET,version:f.SDK_VERSION,supportsPatchUpdates:!1,supportsAddBlockScoping:!0,supportsCustomBreakpoints:!0,modelName:r.modelName,apiKey:r.apiKey,supportsXSmallBreakpoint:!0,blockLevelPersonalization:!0}},"*"),(i=window.parent)==null||i.postMessage({type:"builder.updateContent",data:{options:r}},"*"),window.addEventListener("message",u=>{var d,l;if(!k.isFromTrustedHost(r.trustedHosts,u))return;const{data:e}=u;if(e!=null&&e.type)switch(e.type){case"builder.evaluate":{const w=e.data.text,g=e.data.arguments||[],s=e.data.id,y=new Function(w);let t,a=null;try{t=y.apply(null,g)}catch(o){a=o}a?(d=window.parent)==null||d.postMessage({type:"builder.evaluateError",data:{id:s,error:a.message}},"*"):t&&typeof t.then=="function"?t.then(o=>{var p;(p=window.parent)==null||p.postMessage({type:"builder.evaluateResult",data:{id:s,result:o}},"*")}).catch(console.error):(l=window.parent)==null||l.postMessage({type:"builder.evaluateResult",data:{result:t,id:s}},"*");break}}})))};exports.setupBrowserForEditing=v;
|
|
@@ -1,39 +1,15 @@
|
|
|
1
|
-
import { SDK_VERSION as
|
|
1
|
+
import { SDK_VERSION as g } from "../constants/sdk-version.mjs";
|
|
2
2
|
import { TARGET as y } from "../constants/target.mjs";
|
|
3
3
|
import { isBrowser as b } from "../functions/is-browser.mjs";
|
|
4
|
-
import { isFromTrustedHost as
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
C("insertMenu", {
|
|
8
|
-
name: "_default",
|
|
9
|
-
default: !0,
|
|
10
|
-
items: [{
|
|
11
|
-
name: "Box"
|
|
12
|
-
}, {
|
|
13
|
-
name: "Text"
|
|
14
|
-
}, {
|
|
15
|
-
name: "Image"
|
|
16
|
-
}, {
|
|
17
|
-
name: "Columns"
|
|
18
|
-
}, {
|
|
19
|
-
name: "Core:Section"
|
|
20
|
-
}, {
|
|
21
|
-
name: "Core:Button"
|
|
22
|
-
}, {
|
|
23
|
-
name: "Embed"
|
|
24
|
-
}, {
|
|
25
|
-
name: "Custom Code"
|
|
26
|
-
}]
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
let m = !1;
|
|
30
|
-
const x = (r) => {
|
|
4
|
+
import { isFromTrustedHost as h } from "../functions/is-from-trusted-host.mjs";
|
|
5
|
+
let c = !1;
|
|
6
|
+
const M = (r) => {
|
|
31
7
|
var n, i;
|
|
32
|
-
|
|
8
|
+
c || (c = !0, b() && ((n = window.parent) == null || n.postMessage({
|
|
33
9
|
type: "builder.sdkInfo",
|
|
34
10
|
data: {
|
|
35
11
|
target: y,
|
|
36
|
-
version:
|
|
12
|
+
version: g,
|
|
37
13
|
supportsPatchUpdates: !1,
|
|
38
14
|
// Supports builder-model="..." attribute which is needed to
|
|
39
15
|
// scope our '+ add block' button styling
|
|
@@ -49,43 +25,43 @@ const x = (r) => {
|
|
|
49
25
|
data: {
|
|
50
26
|
options: r
|
|
51
27
|
}
|
|
52
|
-
}, "*"), window.addEventListener("message", (
|
|
53
|
-
var
|
|
54
|
-
if (!
|
|
28
|
+
}, "*"), window.addEventListener("message", (p) => {
|
|
29
|
+
var u, l;
|
|
30
|
+
if (!h(r.trustedHosts, p))
|
|
55
31
|
return;
|
|
56
32
|
const {
|
|
57
33
|
data: e
|
|
58
|
-
} =
|
|
34
|
+
} = p;
|
|
59
35
|
if (e != null && e.type)
|
|
60
36
|
switch (e.type) {
|
|
61
37
|
case "builder.evaluate": {
|
|
62
|
-
const
|
|
63
|
-
let t,
|
|
38
|
+
const m = e.data.text, f = e.data.arguments || [], s = e.data.id, w = new Function(m);
|
|
39
|
+
let t, a = null;
|
|
64
40
|
try {
|
|
65
|
-
t =
|
|
41
|
+
t = w.apply(null, f);
|
|
66
42
|
} catch (o) {
|
|
67
|
-
|
|
43
|
+
a = o;
|
|
68
44
|
}
|
|
69
|
-
|
|
45
|
+
a ? (u = window.parent) == null || u.postMessage({
|
|
70
46
|
type: "builder.evaluateError",
|
|
71
47
|
data: {
|
|
72
|
-
id:
|
|
73
|
-
error:
|
|
48
|
+
id: s,
|
|
49
|
+
error: a.message
|
|
74
50
|
}
|
|
75
51
|
}, "*") : t && typeof t.then == "function" ? t.then((o) => {
|
|
76
|
-
var
|
|
77
|
-
(
|
|
52
|
+
var d;
|
|
53
|
+
(d = window.parent) == null || d.postMessage({
|
|
78
54
|
type: "builder.evaluateResult",
|
|
79
55
|
data: {
|
|
80
|
-
id:
|
|
56
|
+
id: s,
|
|
81
57
|
result: o
|
|
82
58
|
}
|
|
83
59
|
}, "*");
|
|
84
|
-
}).catch(console.error) : (
|
|
60
|
+
}).catch(console.error) : (l = window.parent) == null || l.postMessage({
|
|
85
61
|
type: "builder.evaluateResult",
|
|
86
62
|
data: {
|
|
87
63
|
result: t,
|
|
88
|
-
id:
|
|
64
|
+
id: s
|
|
89
65
|
}
|
|
90
66
|
}, "*");
|
|
91
67
|
break;
|
|
@@ -94,6 +70,5 @@ const x = (r) => {
|
|
|
94
70
|
})));
|
|
95
71
|
};
|
|
96
72
|
export {
|
|
97
|
-
|
|
98
|
-
x as setupBrowserForEditing
|
|
73
|
+
M as setupBrowserForEditing
|
|
99
74
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";const R=require("react/jsx-runtime"),o=require("react"),
|
|
1
|
+
"use client";"use strict";const R=require("react/jsx-runtime"),o=require("react"),V=require("../../../context/builder.context.cjs"),j=require("../../../functions/evaluate/evaluate.cjs"),B=require("../../../functions/fast-clone.cjs"),F=require("../../../functions/get-content/index.cjs"),k=require("../../../functions/is-browser.cjs"),f=require("../../../functions/is-editing.cjs"),N=require("../../../functions/is-previewing.cjs"),O=require("../../../functions/log-fetch.cjs"),W=require("../../../functions/register-component.cjs"),y=require("../../../functions/track/index.cjs"),A=require("../../../functions/track/interaction.cjs"),P=require("../../../helpers/canTrack.cjs"),M=require("../../../helpers/cookie.cjs"),$=require("../../../helpers/preview-lru-cache/set.cjs"),z=require("../../../helpers/subscribe-to-editor.cjs"),G=require("../../../scripts/init-editing.cjs"),J=require("../../block/animator.cjs"),L=require("./enable-editor.helpers.cjs"),Q=require("./styles.helpers.cjs"),X=require("next/navigation");function Y(e){var q,I,w;const s=o.useRef(null);o.useState(()=>!1);function u(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 m(n){var i,r,a,c,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=(c=e.builderContextSignal.content)==null?void 0:c.meta)==null?void 0:d.breakpoints)}};$.postPreviewContent({value:t,key:t.id,url:window.location.pathname})}function H(){return e.showContent?{}:{hidden:!0,"aria-hidden":!0}}const[K,Z]=o.useState(()=>e.contentWrapper||"div");function S(n){return z.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&&m({meta:{breakpoints:i}})},animation:t=>{J.triggerAnimation(t)},contentUpdate:t=>{m(t)},stateUpdate:t=>{u(t)}}})(n)}const[v,p]=o.useState(()=>({})),[b,ee]=o.useState(()=>({})),[E,T]=o.useState(()=>!1);function D(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;y._track({apiHost:e.apiHost,type:"click",canTrack:P.getDefaultCanTrack(e.canTrack),contentId:a,apiKey:e.apiKey,variationId:r!==a?r:void 0,...A.getInteractionPropertiesForEvent(n),unique:!E})}E||T(!0)}function _(){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,c])=>{if(!c||b[a]||v[a]&&!f.isEditing())return;b[a]=!0;const d=c.replace(/{{([^}]+)}}/g,(l,U)=>String(j.evaluate({code:U,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState})));O.logFetch(d),fetch(d).then(l=>l.json()).then(l=>{u({[a]:l}),v[a]=!0}).catch(l=>{console.error("error fetching dynamic data",c,l)}).finally(()=>{b[a]=!1})})}function g(){f.isEditing()&&window.dispatchEvent(new CustomEvent("builder:component:stateChange",{detail:{state:B.fastClone(e.builderContextSignal.rootState),ref:{name:e.model}}}))}function h(n){var t;window.addEventListener("message",S),G.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 c=W.createRegisterComponentMessage(i);(a=window.parent)==null||a.postMessage(c,"*")}}),window.addEventListener("builder:component:stateChangeListenerActivated",g)}function x(n){var c;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))&&F.fetchOneEntry({model:e.model,apiKey:e.apiKey,apiVersion:e.builderContextSignal.apiVersion,...i==="BUILDER_STUDIO"&&((c=e.context)!=null&&c.symbolId)?{query:{id:e.context.symbolId}}:{}}).then(d=>{d&&m(d)})}X.useRouter();const C=o.useRef(!1);return C.current||(_(),g(),C.current=!0),o.useEffect(()=>{var n;return(n=s.current)==null||n.addEventListener("initeditingbldr",h),()=>{var t;return(t=s.current)==null?void 0:t.removeEventListener("initeditingbldr",h)}},[]),o.useEffect(()=>{var n;return(n=s.current)==null||n.addEventListener("initpreviewingbldr",x),()=>{var t;return(t=s.current)==null?void 0:t.removeEventListener("initpreviewingbldr",x)}},[]),o.useEffect(()=>{var n,t,i;if(k.isBrowser()){f.isEditing()&&!e.isNestedRender&&s.current&&s.current.dispatchEvent(new CustomEvent("initeditingbldr"));const r=e.builderContextSignal.content&&P.getDefaultCanTrack(e.canTrack),a=M.getCookieSync({name:`builder.tests.${(n=e.builderContextSignal.content)==null?void 0:n.id}`,canTrack:!0}),c=(t=e.builderContextSignal.content)==null?void 0:t.testVariationId;if(r&&c===a){const d=(i=e.builderContextSignal.content)==null?void 0:i.id,l=e.apiKey;y._track({apiHost:e.apiHost,type:"impression",canTrack:!0,contentId:d,apiKey:l,variationId:a!==d?a:void 0})}N.isPreviewing()&&f.isEditing()}},[]),o.useEffect(()=>{},[e.content]),o.useEffect(()=>{g()},[e.builderContextSignal.rootState]),o.useEffect(()=>{e.data&&u(e.data)},[e.data]),o.useEffect(()=>{e.locale&&u({locale:e.locale})},[e.locale]),o.useEffect(()=>()=>{k.isBrowser()&&(window.removeEventListener("message",S),window.removeEventListener("builder:component:stateChangeListenerActivated",g))},[]),R.jsx(V.Provider,{value:e.builderContextSignal,children:e.builderContextSignal.content||L.needsElementRefDivForEditing()?R.jsx(K,{ref:s,onClick:n=>D(n),"builder-content-id":(q=e.builderContextSignal.content)==null?void 0:q.id,"builder-model":e.model,className:Q.getWrapperClassName(((I=e.content)==null?void 0:I.testVariationId)||((w=e.content)==null?void 0:w.id)),style:{display:!e.builderContextSignal.content&&L.needsElementRefDivForEditing()?"none":void 0},...H(),...e.contentWrapperProps,children:e.children}):null})}module.exports=Y;
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as k } from "react/jsx-runtime";
|
|
3
3
|
import { useRef as P, useState as m, useEffect as c } from "react";
|
|
4
|
-
import
|
|
5
|
-
import { evaluate as
|
|
6
|
-
import { fastClone as
|
|
7
|
-
import { fetchOneEntry as
|
|
4
|
+
import O from "../../../context/builder.context.mjs";
|
|
5
|
+
import { evaluate as W } from "../../../functions/evaluate/evaluate.mjs";
|
|
6
|
+
import { fastClone as j } from "../../../functions/fast-clone.mjs";
|
|
7
|
+
import { fetchOneEntry as A } from "../../../functions/get-content/index.mjs";
|
|
8
8
|
import { isBrowser as L } from "../../../functions/is-browser.mjs";
|
|
9
9
|
import { isEditing as g } from "../../../functions/is-editing.mjs";
|
|
10
|
-
import { isPreviewing as
|
|
11
|
-
import { logFetch as
|
|
12
|
-
import { createRegisterComponentMessage as
|
|
10
|
+
import { isPreviewing as B } from "../../../functions/is-previewing.mjs";
|
|
11
|
+
import { logFetch as F } from "../../../functions/log-fetch.mjs";
|
|
12
|
+
import { createRegisterComponentMessage as M } from "../../../functions/register-component.mjs";
|
|
13
13
|
import { _track as H } from "../../../functions/track/index.mjs";
|
|
14
14
|
import { getInteractionPropertiesForEvent as $ } from "../../../functions/track/interaction.mjs";
|
|
15
15
|
import { getDefaultCanTrack as K } from "../../../helpers/canTrack.mjs";
|
|
16
16
|
import { getCookieSync as z } from "../../../helpers/cookie.mjs";
|
|
17
17
|
import { postPreviewContent as G } from "../../../helpers/preview-lru-cache/set.mjs";
|
|
18
18
|
import { createEditorListener as J } from "../../../helpers/subscribe-to-editor.mjs";
|
|
19
|
-
import {
|
|
20
|
-
import { triggerAnimation as
|
|
19
|
+
import { setupBrowserForEditing as Q } from "../../../scripts/init-editing.mjs";
|
|
20
|
+
import { triggerAnimation as X } from "../../block/animator.mjs";
|
|
21
21
|
import { needsElementRefDivForEditing as q } from "./enable-editor.helpers.mjs";
|
|
22
|
-
import { getWrapperClassName as
|
|
23
|
-
import { useRouter as
|
|
24
|
-
function
|
|
22
|
+
import { getWrapperClassName as Y } from "./styles.helpers.mjs";
|
|
23
|
+
import { useRouter as Z } from "next/navigation";
|
|
24
|
+
function yt(t) {
|
|
25
25
|
var w, y, R;
|
|
26
26
|
const u = P(null);
|
|
27
27
|
m(() => !1);
|
|
@@ -60,7 +60,7 @@ function Rt(t) {
|
|
|
60
60
|
"aria-hidden": !0
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
|
-
const [U,
|
|
63
|
+
const [U, p] = m(
|
|
64
64
|
() => t.contentWrapper || "div"
|
|
65
65
|
);
|
|
66
66
|
function v(n) {
|
|
@@ -78,7 +78,7 @@ function Rt(t) {
|
|
|
78
78
|
});
|
|
79
79
|
},
|
|
80
80
|
animation: (e) => {
|
|
81
|
-
|
|
81
|
+
X(e);
|
|
82
82
|
},
|
|
83
83
|
contentUpdate: (e) => {
|
|
84
84
|
b(e);
|
|
@@ -89,7 +89,7 @@ function Rt(t) {
|
|
|
89
89
|
}
|
|
90
90
|
})(n);
|
|
91
91
|
}
|
|
92
|
-
const [h,
|
|
92
|
+
const [h, tt] = m(() => ({})), [S, et] = m(() => ({})), [x, D] = m(() => !1);
|
|
93
93
|
function V(n) {
|
|
94
94
|
var e, i;
|
|
95
95
|
if (t.builderContextSignal.content) {
|
|
@@ -117,7 +117,7 @@ function Rt(t) {
|
|
|
117
117
|
const d = r.replace(
|
|
118
118
|
/{{([^}]+)}}/g,
|
|
119
119
|
(l, _) => String(
|
|
120
|
-
|
|
120
|
+
W({
|
|
121
121
|
code: _,
|
|
122
122
|
context: t.context || {},
|
|
123
123
|
localState: void 0,
|
|
@@ -126,7 +126,7 @@ function Rt(t) {
|
|
|
126
126
|
})
|
|
127
127
|
)
|
|
128
128
|
);
|
|
129
|
-
|
|
129
|
+
F(d), fetch(d).then((l) => l.json()).then((l) => {
|
|
130
130
|
s({
|
|
131
131
|
[a]: l
|
|
132
132
|
}), h[a] = !0;
|
|
@@ -143,7 +143,7 @@ function Rt(t) {
|
|
|
143
143
|
"builder:component:stateChange",
|
|
144
144
|
{
|
|
145
145
|
detail: {
|
|
146
|
-
state:
|
|
146
|
+
state: j(t.builderContextSignal.rootState),
|
|
147
147
|
ref: {
|
|
148
148
|
name: t.model
|
|
149
149
|
}
|
|
@@ -154,7 +154,7 @@ function Rt(t) {
|
|
|
154
154
|
}
|
|
155
155
|
function C(n) {
|
|
156
156
|
var e;
|
|
157
|
-
window.addEventListener("message", v), Q(
|
|
157
|
+
window.addEventListener("message", v), Q({
|
|
158
158
|
...t.locale ? {
|
|
159
159
|
locale: t.locale
|
|
160
160
|
} : {},
|
|
@@ -171,7 +171,7 @@ function Rt(t) {
|
|
|
171
171
|
).forEach((i) => {
|
|
172
172
|
var o, a;
|
|
173
173
|
if (!((o = i.models) != null && o.length) || i.models.includes(t.model)) {
|
|
174
|
-
const r =
|
|
174
|
+
const r = M(i);
|
|
175
175
|
(a = window.parent) == null || a.postMessage(r, "*");
|
|
176
176
|
}
|
|
177
177
|
}), window.addEventListener(
|
|
@@ -184,7 +184,7 @@ function Rt(t) {
|
|
|
184
184
|
const e = new URL(location.href).searchParams, i = e.get("builder.preview"), o = e.get(
|
|
185
185
|
`builder.overrides.${i}`
|
|
186
186
|
), a = e.get("apiKey") || e.get("builder.space");
|
|
187
|
-
(i === "BUILDER_STUDIO" || i === t.model && a === t.apiKey && (!t.content || o === t.content.id)) &&
|
|
187
|
+
(i === "BUILDER_STUDIO" || i === t.model && a === t.apiKey && (!t.content || o === t.content.id)) && A({
|
|
188
188
|
model: t.model,
|
|
189
189
|
apiKey: t.apiKey,
|
|
190
190
|
apiVersion: t.builderContextSignal.apiVersion,
|
|
@@ -197,7 +197,7 @@ function Rt(t) {
|
|
|
197
197
|
d && b(d);
|
|
198
198
|
});
|
|
199
199
|
}
|
|
200
|
-
|
|
200
|
+
Z();
|
|
201
201
|
const I = P(!1);
|
|
202
202
|
return I.current || (N(), f(), I.current = !0), c(() => {
|
|
203
203
|
var n;
|
|
@@ -242,7 +242,7 @@ function Rt(t) {
|
|
|
242
242
|
variationId: a !== d ? a : void 0
|
|
243
243
|
});
|
|
244
244
|
}
|
|
245
|
-
|
|
245
|
+
B() && g();
|
|
246
246
|
}
|
|
247
247
|
}, []), c(() => {
|
|
248
248
|
}, [t.content]), c(() => {
|
|
@@ -258,14 +258,14 @@ function Rt(t) {
|
|
|
258
258
|
"builder:component:stateChangeListenerActivated",
|
|
259
259
|
f
|
|
260
260
|
));
|
|
261
|
-
}, []), /* @__PURE__ */ k(
|
|
261
|
+
}, []), /* @__PURE__ */ k(O.Provider, { value: t.builderContextSignal, children: t.builderContextSignal.content || q() ? /* @__PURE__ */ k(
|
|
262
262
|
U,
|
|
263
263
|
{
|
|
264
264
|
ref: u,
|
|
265
265
|
onClick: (n) => V(n),
|
|
266
266
|
"builder-content-id": (w = t.builderContextSignal.content) == null ? void 0 : w.id,
|
|
267
267
|
"builder-model": t.model,
|
|
268
|
-
className:
|
|
268
|
+
className: Y(
|
|
269
269
|
((y = t.content) == null ? void 0 : y.testVariationId) || ((R = t.content) == null ? void 0 : R.id)
|
|
270
270
|
),
|
|
271
271
|
style: {
|
|
@@ -278,5 +278,5 @@ function Rt(t) {
|
|
|
278
278
|
) : null });
|
|
279
279
|
}
|
|
280
280
|
export {
|
|
281
|
-
|
|
281
|
+
yt as default
|
|
282
282
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.19.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.19.3";exports.SDK_VERSION=e;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../constants/target.cjs"),d=require("../helpers/omit.cjs"),p=require("./evaluate/evaluate.cjs"),f=require("./extract-localized-values.cjs"),g=require("./fast-clone.cjs"),m=require("./set.cjs"),y=require("./transform-block.cjs");function o(e){if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(n=>o(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]=o(e[n]));return t}const C=["svelte","vue","angular","qwik","solid"].includes(u.TARGET),q=e=>{if(C){const t=g.fastClone(e);return{...t,properties:{...t.properties},actions:{...t.actions}}}else{const t=o(d.omit(e,"children","meta"));return{...t,properties:{...t.properties},actions:{...t.actions},children:e.children,meta:e.meta}}},v=({block:e,context:t,localState:n,rootState:i,rootSetState:s})=>{if(!e.bindings)return e;const r=q(e);for(const c in e.bindings){const a=e.bindings[c],l=p.evaluate({code:a,localState:n,rootState:i,rootSetState:s,context:t});m.set(r,c,l)}return r};function B({block:e,context:t,localState:n,rootState:i,rootSetState:s}){let r=
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../constants/target.cjs"),d=require("../helpers/omit.cjs"),p=require("./evaluate/evaluate.cjs"),f=require("./extract-localized-values.cjs"),g=require("./fast-clone.cjs"),m=require("./set.cjs"),y=require("./transform-block.cjs");function o(e){if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(n=>o(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]=o(e[n]));return t}const C=["svelte","vue","angular","qwik","solid"].includes(u.TARGET),q=e=>{if(C){const t=g.fastClone(e);return{...t,properties:{...t.properties},actions:{...t.actions}}}else{const t=o(d.omit(e,"children","meta"));return{...t,properties:{...t.properties},actions:{...t.actions},children:e.children,meta:e.meta}}},v=({block:e,context:t,localState:n,rootState:i,rootSetState:s})=>{if(!e.bindings)return e;const r=q(e);for(const c in e.bindings){const a=e.bindings[c],l=p.evaluate({code:a,localState:n,rootState:i,rootSetState:s,context:t});m.set(r,c,l)}return r};function B({block:e,context:t,localState:n,rootState:i,rootSetState:s}){let r=y.transformBlock(e);return r=v({block:r,localState:n,rootState:i,rootSetState:s,context:t}),r=f.resolveLocalizedValues(r,i.locale),r}exports.deepCloneWithConditions=o;exports.getProcessedBlock=B;
|
|
@@ -72,14 +72,14 @@ function P({
|
|
|
72
72
|
rootState: i,
|
|
73
73
|
rootSetState: o
|
|
74
74
|
}) {
|
|
75
|
-
let n =
|
|
76
|
-
return n =
|
|
75
|
+
let n = g(e);
|
|
76
|
+
return n = O({
|
|
77
77
|
block: n,
|
|
78
78
|
localState: t,
|
|
79
79
|
rootState: i,
|
|
80
80
|
rootSetState: o,
|
|
81
81
|
context: r
|
|
82
|
-
});
|
|
82
|
+
}), n = f(n, i.locale), n;
|
|
83
83
|
}
|
|
84
84
|
export {
|
|
85
85
|
s as deepCloneWithConditions,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../constants/sdk-version.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../constants/sdk-version.cjs"),m=require("../constants/target.cjs"),b=require("../functions/is-browser.cjs"),k=require("../functions/is-from-trusted-host.cjs");let c=!1;const v=r=>{var n,i;c||(c=!0,b.isBrowser()&&((n=window.parent)==null||n.postMessage({type:"builder.sdkInfo",data:{target:m.TARGET,version:f.SDK_VERSION,supportsPatchUpdates:!1,supportsAddBlockScoping:!0,supportsCustomBreakpoints:!0,modelName:r.modelName,apiKey:r.apiKey,supportsXSmallBreakpoint:!0,blockLevelPersonalization:!0}},"*"),(i=window.parent)==null||i.postMessage({type:"builder.updateContent",data:{options:r}},"*"),window.addEventListener("message",u=>{var d,l;if(!k.isFromTrustedHost(r.trustedHosts,u))return;const{data:e}=u;if(e!=null&&e.type)switch(e.type){case"builder.evaluate":{const w=e.data.text,g=e.data.arguments||[],s=e.data.id,y=new Function(w);let t,a=null;try{t=y.apply(null,g)}catch(o){a=o}a?(d=window.parent)==null||d.postMessage({type:"builder.evaluateError",data:{id:s,error:a.message}},"*"):t&&typeof t.then=="function"?t.then(o=>{var p;(p=window.parent)==null||p.postMessage({type:"builder.evaluateResult",data:{id:s,result:o}},"*")}).catch(console.error):(l=window.parent)==null||l.postMessage({type:"builder.evaluateResult",data:{result:t,id:s}},"*");break}}})))};exports.setupBrowserForEditing=v;
|
|
@@ -1,39 +1,15 @@
|
|
|
1
|
-
import { SDK_VERSION as
|
|
1
|
+
import { SDK_VERSION as g } from "../constants/sdk-version.mjs";
|
|
2
2
|
import { TARGET as y } from "../constants/target.mjs";
|
|
3
3
|
import { isBrowser as b } from "../functions/is-browser.mjs";
|
|
4
|
-
import { isFromTrustedHost as
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
C("insertMenu", {
|
|
8
|
-
name: "_default",
|
|
9
|
-
default: !0,
|
|
10
|
-
items: [{
|
|
11
|
-
name: "Box"
|
|
12
|
-
}, {
|
|
13
|
-
name: "Text"
|
|
14
|
-
}, {
|
|
15
|
-
name: "Image"
|
|
16
|
-
}, {
|
|
17
|
-
name: "Columns"
|
|
18
|
-
}, {
|
|
19
|
-
name: "Core:Section"
|
|
20
|
-
}, {
|
|
21
|
-
name: "Core:Button"
|
|
22
|
-
}, {
|
|
23
|
-
name: "Embed"
|
|
24
|
-
}, {
|
|
25
|
-
name: "Custom Code"
|
|
26
|
-
}]
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
let m = !1;
|
|
30
|
-
const x = (r) => {
|
|
4
|
+
import { isFromTrustedHost as h } from "../functions/is-from-trusted-host.mjs";
|
|
5
|
+
let c = !1;
|
|
6
|
+
const M = (r) => {
|
|
31
7
|
var n, i;
|
|
32
|
-
|
|
8
|
+
c || (c = !0, b() && ((n = window.parent) == null || n.postMessage({
|
|
33
9
|
type: "builder.sdkInfo",
|
|
34
10
|
data: {
|
|
35
11
|
target: y,
|
|
36
|
-
version:
|
|
12
|
+
version: g,
|
|
37
13
|
supportsPatchUpdates: !1,
|
|
38
14
|
// Supports builder-model="..." attribute which is needed to
|
|
39
15
|
// scope our '+ add block' button styling
|
|
@@ -49,43 +25,43 @@ const x = (r) => {
|
|
|
49
25
|
data: {
|
|
50
26
|
options: r
|
|
51
27
|
}
|
|
52
|
-
}, "*"), window.addEventListener("message", (
|
|
53
|
-
var
|
|
54
|
-
if (!
|
|
28
|
+
}, "*"), window.addEventListener("message", (p) => {
|
|
29
|
+
var u, l;
|
|
30
|
+
if (!h(r.trustedHosts, p))
|
|
55
31
|
return;
|
|
56
32
|
const {
|
|
57
33
|
data: e
|
|
58
|
-
} =
|
|
34
|
+
} = p;
|
|
59
35
|
if (e != null && e.type)
|
|
60
36
|
switch (e.type) {
|
|
61
37
|
case "builder.evaluate": {
|
|
62
|
-
const
|
|
63
|
-
let t,
|
|
38
|
+
const m = e.data.text, f = e.data.arguments || [], s = e.data.id, w = new Function(m);
|
|
39
|
+
let t, a = null;
|
|
64
40
|
try {
|
|
65
|
-
t =
|
|
41
|
+
t = w.apply(null, f);
|
|
66
42
|
} catch (o) {
|
|
67
|
-
|
|
43
|
+
a = o;
|
|
68
44
|
}
|
|
69
|
-
|
|
45
|
+
a ? (u = window.parent) == null || u.postMessage({
|
|
70
46
|
type: "builder.evaluateError",
|
|
71
47
|
data: {
|
|
72
|
-
id:
|
|
73
|
-
error:
|
|
48
|
+
id: s,
|
|
49
|
+
error: a.message
|
|
74
50
|
}
|
|
75
51
|
}, "*") : t && typeof t.then == "function" ? t.then((o) => {
|
|
76
|
-
var
|
|
77
|
-
(
|
|
52
|
+
var d;
|
|
53
|
+
(d = window.parent) == null || d.postMessage({
|
|
78
54
|
type: "builder.evaluateResult",
|
|
79
55
|
data: {
|
|
80
|
-
id:
|
|
56
|
+
id: s,
|
|
81
57
|
result: o
|
|
82
58
|
}
|
|
83
59
|
}, "*");
|
|
84
|
-
}).catch(console.error) : (
|
|
60
|
+
}).catch(console.error) : (l = window.parent) == null || l.postMessage({
|
|
85
61
|
type: "builder.evaluateResult",
|
|
86
62
|
data: {
|
|
87
63
|
result: t,
|
|
88
|
-
id:
|
|
64
|
+
id: s
|
|
89
65
|
}
|
|
90
66
|
}, "*");
|
|
91
67
|
break;
|
|
@@ -94,6 +70,5 @@ const x = (r) => {
|
|
|
94
70
|
})));
|
|
95
71
|
};
|
|
96
72
|
export {
|
|
97
|
-
|
|
98
|
-
x as setupBrowserForEditing
|
|
73
|
+
M as setupBrowserForEditing
|
|
99
74
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";const R=require("react/jsx-runtime"),o=require("react"),
|
|
1
|
+
"use client";"use strict";const R=require("react/jsx-runtime"),o=require("react"),V=require("../../../context/builder.context.cjs"),j=require("../../../functions/evaluate/evaluate.cjs"),B=require("../../../functions/fast-clone.cjs"),F=require("../../../functions/get-content/index.cjs"),k=require("../../../functions/is-browser.cjs"),f=require("../../../functions/is-editing.cjs"),N=require("../../../functions/is-previewing.cjs"),O=require("../../../functions/log-fetch.cjs"),W=require("../../../functions/register-component.cjs"),y=require("../../../functions/track/index.cjs"),A=require("../../../functions/track/interaction.cjs"),P=require("../../../helpers/canTrack.cjs"),M=require("../../../helpers/cookie.cjs"),$=require("../../../helpers/preview-lru-cache/set.cjs"),z=require("../../../helpers/subscribe-to-editor.cjs"),G=require("../../../scripts/init-editing.cjs"),J=require("../../block/animator.cjs"),L=require("./enable-editor.helpers.cjs"),Q=require("./styles.helpers.cjs"),X=require("next/navigation");function Y(e){var q,I,w;const s=o.useRef(null);o.useState(()=>!1);function u(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 m(n){var i,r,a,c,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=(c=e.builderContextSignal.content)==null?void 0:c.meta)==null?void 0:d.breakpoints)}};$.postPreviewContent({value:t,key:t.id,url:window.location.pathname})}function H(){return e.showContent?{}:{hidden:!0,"aria-hidden":!0}}const[K,Z]=o.useState(()=>e.contentWrapper||"div");function S(n){return z.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&&m({meta:{breakpoints:i}})},animation:t=>{J.triggerAnimation(t)},contentUpdate:t=>{m(t)},stateUpdate:t=>{u(t)}}})(n)}const[v,p]=o.useState(()=>({})),[b,ee]=o.useState(()=>({})),[E,T]=o.useState(()=>!1);function D(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;y._track({apiHost:e.apiHost,type:"click",canTrack:P.getDefaultCanTrack(e.canTrack),contentId:a,apiKey:e.apiKey,variationId:r!==a?r:void 0,...A.getInteractionPropertiesForEvent(n),unique:!E})}E||T(!0)}function _(){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,c])=>{if(!c||b[a]||v[a]&&!f.isEditing())return;b[a]=!0;const d=c.replace(/{{([^}]+)}}/g,(l,U)=>String(j.evaluate({code:U,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState})));O.logFetch(d),fetch(d).then(l=>l.json()).then(l=>{u({[a]:l}),v[a]=!0}).catch(l=>{console.error("error fetching dynamic data",c,l)}).finally(()=>{b[a]=!1})})}function g(){f.isEditing()&&window.dispatchEvent(new CustomEvent("builder:component:stateChange",{detail:{state:B.fastClone(e.builderContextSignal.rootState),ref:{name:e.model}}}))}function h(n){var t;window.addEventListener("message",S),G.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 c=W.createRegisterComponentMessage(i);(a=window.parent)==null||a.postMessage(c,"*")}}),window.addEventListener("builder:component:stateChangeListenerActivated",g)}function x(n){var c;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))&&F.fetchOneEntry({model:e.model,apiKey:e.apiKey,apiVersion:e.builderContextSignal.apiVersion,...i==="BUILDER_STUDIO"&&((c=e.context)!=null&&c.symbolId)?{query:{id:e.context.symbolId}}:{}}).then(d=>{d&&m(d)})}X.useRouter();const C=o.useRef(!1);return C.current||(_(),g(),C.current=!0),o.useEffect(()=>{var n;return(n=s.current)==null||n.addEventListener("initeditingbldr",h),()=>{var t;return(t=s.current)==null?void 0:t.removeEventListener("initeditingbldr",h)}},[]),o.useEffect(()=>{var n;return(n=s.current)==null||n.addEventListener("initpreviewingbldr",x),()=>{var t;return(t=s.current)==null?void 0:t.removeEventListener("initpreviewingbldr",x)}},[]),o.useEffect(()=>{var n,t,i;if(k.isBrowser()){f.isEditing()&&!e.isNestedRender&&s.current&&s.current.dispatchEvent(new CustomEvent("initeditingbldr"));const r=e.builderContextSignal.content&&P.getDefaultCanTrack(e.canTrack),a=M.getCookieSync({name:`builder.tests.${(n=e.builderContextSignal.content)==null?void 0:n.id}`,canTrack:!0}),c=(t=e.builderContextSignal.content)==null?void 0:t.testVariationId;if(r&&c===a){const d=(i=e.builderContextSignal.content)==null?void 0:i.id,l=e.apiKey;y._track({apiHost:e.apiHost,type:"impression",canTrack:!0,contentId:d,apiKey:l,variationId:a!==d?a:void 0})}N.isPreviewing()&&f.isEditing()}},[]),o.useEffect(()=>{},[e.content]),o.useEffect(()=>{g()},[e.builderContextSignal.rootState]),o.useEffect(()=>{e.data&&u(e.data)},[e.data]),o.useEffect(()=>{e.locale&&u({locale:e.locale})},[e.locale]),o.useEffect(()=>()=>{k.isBrowser()&&(window.removeEventListener("message",S),window.removeEventListener("builder:component:stateChangeListenerActivated",g))},[]),R.jsx(V.Provider,{value:e.builderContextSignal,children:e.builderContextSignal.content||L.needsElementRefDivForEditing()?R.jsx(K,{ref:s,onClick:n=>D(n),"builder-content-id":(q=e.builderContextSignal.content)==null?void 0:q.id,"builder-model":e.model,className:Q.getWrapperClassName(((I=e.content)==null?void 0:I.testVariationId)||((w=e.content)==null?void 0:w.id)),style:{display:!e.builderContextSignal.content&&L.needsElementRefDivForEditing()?"none":void 0},...H(),...e.contentWrapperProps,children:e.children}):null})}module.exports=Y;
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as k } from "react/jsx-runtime";
|
|
3
3
|
import { useRef as P, useState as m, useEffect as c } from "react";
|
|
4
|
-
import
|
|
5
|
-
import { evaluate as
|
|
6
|
-
import { fastClone as
|
|
7
|
-
import { fetchOneEntry as
|
|
4
|
+
import O from "../../../context/builder.context.mjs";
|
|
5
|
+
import { evaluate as W } from "../../../functions/evaluate/evaluate.mjs";
|
|
6
|
+
import { fastClone as j } from "../../../functions/fast-clone.mjs";
|
|
7
|
+
import { fetchOneEntry as A } from "../../../functions/get-content/index.mjs";
|
|
8
8
|
import { isBrowser as L } from "../../../functions/is-browser.mjs";
|
|
9
9
|
import { isEditing as g } from "../../../functions/is-editing.mjs";
|
|
10
|
-
import { isPreviewing as
|
|
11
|
-
import { logFetch as
|
|
12
|
-
import { createRegisterComponentMessage as
|
|
10
|
+
import { isPreviewing as B } from "../../../functions/is-previewing.mjs";
|
|
11
|
+
import { logFetch as F } from "../../../functions/log-fetch.mjs";
|
|
12
|
+
import { createRegisterComponentMessage as M } from "../../../functions/register-component.mjs";
|
|
13
13
|
import { _track as H } from "../../../functions/track/index.mjs";
|
|
14
14
|
import { getInteractionPropertiesForEvent as $ } from "../../../functions/track/interaction.mjs";
|
|
15
15
|
import { getDefaultCanTrack as K } from "../../../helpers/canTrack.mjs";
|
|
16
16
|
import { getCookieSync as z } from "../../../helpers/cookie.mjs";
|
|
17
17
|
import { postPreviewContent as G } from "../../../helpers/preview-lru-cache/set.mjs";
|
|
18
18
|
import { createEditorListener as J } from "../../../helpers/subscribe-to-editor.mjs";
|
|
19
|
-
import {
|
|
20
|
-
import { triggerAnimation as
|
|
19
|
+
import { setupBrowserForEditing as Q } from "../../../scripts/init-editing.mjs";
|
|
20
|
+
import { triggerAnimation as X } from "../../block/animator.mjs";
|
|
21
21
|
import { needsElementRefDivForEditing as q } from "./enable-editor.helpers.mjs";
|
|
22
|
-
import { getWrapperClassName as
|
|
23
|
-
import { useRouter as
|
|
24
|
-
function
|
|
22
|
+
import { getWrapperClassName as Y } from "./styles.helpers.mjs";
|
|
23
|
+
import { useRouter as Z } from "next/navigation";
|
|
24
|
+
function yt(t) {
|
|
25
25
|
var w, y, R;
|
|
26
26
|
const u = P(null);
|
|
27
27
|
m(() => !1);
|
|
@@ -60,7 +60,7 @@ function Rt(t) {
|
|
|
60
60
|
"aria-hidden": !0
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
|
-
const [U,
|
|
63
|
+
const [U, p] = m(
|
|
64
64
|
() => t.contentWrapper || "div"
|
|
65
65
|
);
|
|
66
66
|
function v(n) {
|
|
@@ -78,7 +78,7 @@ function Rt(t) {
|
|
|
78
78
|
});
|
|
79
79
|
},
|
|
80
80
|
animation: (e) => {
|
|
81
|
-
|
|
81
|
+
X(e);
|
|
82
82
|
},
|
|
83
83
|
contentUpdate: (e) => {
|
|
84
84
|
b(e);
|
|
@@ -89,7 +89,7 @@ function Rt(t) {
|
|
|
89
89
|
}
|
|
90
90
|
})(n);
|
|
91
91
|
}
|
|
92
|
-
const [h,
|
|
92
|
+
const [h, tt] = m(() => ({})), [S, et] = m(() => ({})), [x, D] = m(() => !1);
|
|
93
93
|
function V(n) {
|
|
94
94
|
var e, i;
|
|
95
95
|
if (t.builderContextSignal.content) {
|
|
@@ -117,7 +117,7 @@ function Rt(t) {
|
|
|
117
117
|
const d = r.replace(
|
|
118
118
|
/{{([^}]+)}}/g,
|
|
119
119
|
(l, _) => String(
|
|
120
|
-
|
|
120
|
+
W({
|
|
121
121
|
code: _,
|
|
122
122
|
context: t.context || {},
|
|
123
123
|
localState: void 0,
|
|
@@ -126,7 +126,7 @@ function Rt(t) {
|
|
|
126
126
|
})
|
|
127
127
|
)
|
|
128
128
|
);
|
|
129
|
-
|
|
129
|
+
F(d), fetch(d).then((l) => l.json()).then((l) => {
|
|
130
130
|
s({
|
|
131
131
|
[a]: l
|
|
132
132
|
}), h[a] = !0;
|
|
@@ -143,7 +143,7 @@ function Rt(t) {
|
|
|
143
143
|
"builder:component:stateChange",
|
|
144
144
|
{
|
|
145
145
|
detail: {
|
|
146
|
-
state:
|
|
146
|
+
state: j(t.builderContextSignal.rootState),
|
|
147
147
|
ref: {
|
|
148
148
|
name: t.model
|
|
149
149
|
}
|
|
@@ -154,7 +154,7 @@ function Rt(t) {
|
|
|
154
154
|
}
|
|
155
155
|
function C(n) {
|
|
156
156
|
var e;
|
|
157
|
-
window.addEventListener("message", v), Q(
|
|
157
|
+
window.addEventListener("message", v), Q({
|
|
158
158
|
...t.locale ? {
|
|
159
159
|
locale: t.locale
|
|
160
160
|
} : {},
|
|
@@ -171,7 +171,7 @@ function Rt(t) {
|
|
|
171
171
|
).forEach((i) => {
|
|
172
172
|
var o, a;
|
|
173
173
|
if (!((o = i.models) != null && o.length) || i.models.includes(t.model)) {
|
|
174
|
-
const r =
|
|
174
|
+
const r = M(i);
|
|
175
175
|
(a = window.parent) == null || a.postMessage(r, "*");
|
|
176
176
|
}
|
|
177
177
|
}), window.addEventListener(
|
|
@@ -184,7 +184,7 @@ function Rt(t) {
|
|
|
184
184
|
const e = new URL(location.href).searchParams, i = e.get("builder.preview"), o = e.get(
|
|
185
185
|
`builder.overrides.${i}`
|
|
186
186
|
), a = e.get("apiKey") || e.get("builder.space");
|
|
187
|
-
(i === "BUILDER_STUDIO" || i === t.model && a === t.apiKey && (!t.content || o === t.content.id)) &&
|
|
187
|
+
(i === "BUILDER_STUDIO" || i === t.model && a === t.apiKey && (!t.content || o === t.content.id)) && A({
|
|
188
188
|
model: t.model,
|
|
189
189
|
apiKey: t.apiKey,
|
|
190
190
|
apiVersion: t.builderContextSignal.apiVersion,
|
|
@@ -197,7 +197,7 @@ function Rt(t) {
|
|
|
197
197
|
d && b(d);
|
|
198
198
|
});
|
|
199
199
|
}
|
|
200
|
-
|
|
200
|
+
Z();
|
|
201
201
|
const I = P(!1);
|
|
202
202
|
return I.current || (N(), f(), I.current = !0), c(() => {
|
|
203
203
|
var n;
|
|
@@ -242,7 +242,7 @@ function Rt(t) {
|
|
|
242
242
|
variationId: a !== d ? a : void 0
|
|
243
243
|
});
|
|
244
244
|
}
|
|
245
|
-
|
|
245
|
+
B() && g();
|
|
246
246
|
}
|
|
247
247
|
}, []), c(() => {
|
|
248
248
|
}, [t.content]), c(() => {
|
|
@@ -258,14 +258,14 @@ function Rt(t) {
|
|
|
258
258
|
"builder:component:stateChangeListenerActivated",
|
|
259
259
|
f
|
|
260
260
|
));
|
|
261
|
-
}, []), /* @__PURE__ */ k(
|
|
261
|
+
}, []), /* @__PURE__ */ k(O.Provider, { value: t.builderContextSignal, children: t.builderContextSignal.content || q() ? /* @__PURE__ */ k(
|
|
262
262
|
U,
|
|
263
263
|
{
|
|
264
264
|
ref: u,
|
|
265
265
|
onClick: (n) => V(n),
|
|
266
266
|
"builder-content-id": (w = t.builderContextSignal.content) == null ? void 0 : w.id,
|
|
267
267
|
"builder-model": t.model,
|
|
268
|
-
className:
|
|
268
|
+
className: Y(
|
|
269
269
|
((y = t.content) == null ? void 0 : y.testVariationId) || ((R = t.content) == null ? void 0 : R.id)
|
|
270
270
|
),
|
|
271
271
|
style: {
|
|
@@ -278,5 +278,5 @@ function Rt(t) {
|
|
|
278
278
|
) : null });
|
|
279
279
|
}
|
|
280
280
|
export {
|
|
281
|
-
|
|
281
|
+
yt as default
|
|
282
282
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.19.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.19.3";exports.SDK_VERSION=e;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../constants/target.cjs"),d=require("../helpers/omit.cjs"),p=require("./evaluate/evaluate.cjs"),f=require("./extract-localized-values.cjs"),g=require("./fast-clone.cjs"),m=require("./set.cjs"),y=require("./transform-block.cjs");function o(e){if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(n=>o(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]=o(e[n]));return t}const C=["svelte","vue","angular","qwik","solid"].includes(u.TARGET),q=e=>{if(C){const t=g.fastClone(e);return{...t,properties:{...t.properties},actions:{...t.actions}}}else{const t=o(d.omit(e,"children","meta"));return{...t,properties:{...t.properties},actions:{...t.actions},children:e.children,meta:e.meta}}},v=({block:e,context:t,localState:n,rootState:i,rootSetState:s})=>{if(!e.bindings)return e;const r=q(e);for(const c in e.bindings){const a=e.bindings[c],l=p.evaluate({code:a,localState:n,rootState:i,rootSetState:s,context:t});m.set(r,c,l)}return r};function B({block:e,context:t,localState:n,rootState:i,rootSetState:s}){let r=
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../constants/target.cjs"),d=require("../helpers/omit.cjs"),p=require("./evaluate/evaluate.cjs"),f=require("./extract-localized-values.cjs"),g=require("./fast-clone.cjs"),m=require("./set.cjs"),y=require("./transform-block.cjs");function o(e){if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(n=>o(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]=o(e[n]));return t}const C=["svelte","vue","angular","qwik","solid"].includes(u.TARGET),q=e=>{if(C){const t=g.fastClone(e);return{...t,properties:{...t.properties},actions:{...t.actions}}}else{const t=o(d.omit(e,"children","meta"));return{...t,properties:{...t.properties},actions:{...t.actions},children:e.children,meta:e.meta}}},v=({block:e,context:t,localState:n,rootState:i,rootSetState:s})=>{if(!e.bindings)return e;const r=q(e);for(const c in e.bindings){const a=e.bindings[c],l=p.evaluate({code:a,localState:n,rootState:i,rootSetState:s,context:t});m.set(r,c,l)}return r};function B({block:e,context:t,localState:n,rootState:i,rootSetState:s}){let r=y.transformBlock(e);return r=v({block:r,localState:n,rootState:i,rootSetState:s,context:t}),r=f.resolveLocalizedValues(r,i.locale),r}exports.deepCloneWithConditions=o;exports.getProcessedBlock=B;
|
|
@@ -72,14 +72,14 @@ function P({
|
|
|
72
72
|
rootState: i,
|
|
73
73
|
rootSetState: o
|
|
74
74
|
}) {
|
|
75
|
-
let n =
|
|
76
|
-
return n =
|
|
75
|
+
let n = g(e);
|
|
76
|
+
return n = O({
|
|
77
77
|
block: n,
|
|
78
78
|
localState: t,
|
|
79
79
|
rootState: i,
|
|
80
80
|
rootSetState: o,
|
|
81
81
|
context: r
|
|
82
|
-
});
|
|
82
|
+
}), n = f(n, i.locale), n;
|
|
83
83
|
}
|
|
84
84
|
export {
|
|
85
85
|
s as deepCloneWithConditions,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../constants/sdk-version.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../constants/sdk-version.cjs"),m=require("../constants/target.cjs"),b=require("../functions/is-browser.cjs"),k=require("../functions/is-from-trusted-host.cjs");let c=!1;const v=r=>{var n,i;c||(c=!0,b.isBrowser()&&((n=window.parent)==null||n.postMessage({type:"builder.sdkInfo",data:{target:m.TARGET,version:f.SDK_VERSION,supportsPatchUpdates:!1,supportsAddBlockScoping:!0,supportsCustomBreakpoints:!0,modelName:r.modelName,apiKey:r.apiKey,supportsXSmallBreakpoint:!0,blockLevelPersonalization:!0}},"*"),(i=window.parent)==null||i.postMessage({type:"builder.updateContent",data:{options:r}},"*"),window.addEventListener("message",u=>{var d,l;if(!k.isFromTrustedHost(r.trustedHosts,u))return;const{data:e}=u;if(e!=null&&e.type)switch(e.type){case"builder.evaluate":{const w=e.data.text,g=e.data.arguments||[],s=e.data.id,y=new Function(w);let t,a=null;try{t=y.apply(null,g)}catch(o){a=o}a?(d=window.parent)==null||d.postMessage({type:"builder.evaluateError",data:{id:s,error:a.message}},"*"):t&&typeof t.then=="function"?t.then(o=>{var p;(p=window.parent)==null||p.postMessage({type:"builder.evaluateResult",data:{id:s,result:o}},"*")}).catch(console.error):(l=window.parent)==null||l.postMessage({type:"builder.evaluateResult",data:{result:t,id:s}},"*");break}}})))};exports.setupBrowserForEditing=v;
|
|
@@ -1,39 +1,15 @@
|
|
|
1
|
-
import { SDK_VERSION as
|
|
1
|
+
import { SDK_VERSION as g } from "../constants/sdk-version.mjs";
|
|
2
2
|
import { TARGET as y } from "../constants/target.mjs";
|
|
3
3
|
import { isBrowser as b } from "../functions/is-browser.mjs";
|
|
4
|
-
import { isFromTrustedHost as
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
C("insertMenu", {
|
|
8
|
-
name: "_default",
|
|
9
|
-
default: !0,
|
|
10
|
-
items: [{
|
|
11
|
-
name: "Box"
|
|
12
|
-
}, {
|
|
13
|
-
name: "Text"
|
|
14
|
-
}, {
|
|
15
|
-
name: "Image"
|
|
16
|
-
}, {
|
|
17
|
-
name: "Columns"
|
|
18
|
-
}, {
|
|
19
|
-
name: "Core:Section"
|
|
20
|
-
}, {
|
|
21
|
-
name: "Core:Button"
|
|
22
|
-
}, {
|
|
23
|
-
name: "Embed"
|
|
24
|
-
}, {
|
|
25
|
-
name: "Custom Code"
|
|
26
|
-
}]
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
let m = !1;
|
|
30
|
-
const x = (r) => {
|
|
4
|
+
import { isFromTrustedHost as h } from "../functions/is-from-trusted-host.mjs";
|
|
5
|
+
let c = !1;
|
|
6
|
+
const M = (r) => {
|
|
31
7
|
var n, i;
|
|
32
|
-
|
|
8
|
+
c || (c = !0, b() && ((n = window.parent) == null || n.postMessage({
|
|
33
9
|
type: "builder.sdkInfo",
|
|
34
10
|
data: {
|
|
35
11
|
target: y,
|
|
36
|
-
version:
|
|
12
|
+
version: g,
|
|
37
13
|
supportsPatchUpdates: !1,
|
|
38
14
|
// Supports builder-model="..." attribute which is needed to
|
|
39
15
|
// scope our '+ add block' button styling
|
|
@@ -49,43 +25,43 @@ const x = (r) => {
|
|
|
49
25
|
data: {
|
|
50
26
|
options: r
|
|
51
27
|
}
|
|
52
|
-
}, "*"), window.addEventListener("message", (
|
|
53
|
-
var
|
|
54
|
-
if (!
|
|
28
|
+
}, "*"), window.addEventListener("message", (p) => {
|
|
29
|
+
var u, l;
|
|
30
|
+
if (!h(r.trustedHosts, p))
|
|
55
31
|
return;
|
|
56
32
|
const {
|
|
57
33
|
data: e
|
|
58
|
-
} =
|
|
34
|
+
} = p;
|
|
59
35
|
if (e != null && e.type)
|
|
60
36
|
switch (e.type) {
|
|
61
37
|
case "builder.evaluate": {
|
|
62
|
-
const
|
|
63
|
-
let t,
|
|
38
|
+
const m = e.data.text, f = e.data.arguments || [], s = e.data.id, w = new Function(m);
|
|
39
|
+
let t, a = null;
|
|
64
40
|
try {
|
|
65
|
-
t =
|
|
41
|
+
t = w.apply(null, f);
|
|
66
42
|
} catch (o) {
|
|
67
|
-
|
|
43
|
+
a = o;
|
|
68
44
|
}
|
|
69
|
-
|
|
45
|
+
a ? (u = window.parent) == null || u.postMessage({
|
|
70
46
|
type: "builder.evaluateError",
|
|
71
47
|
data: {
|
|
72
|
-
id:
|
|
73
|
-
error:
|
|
48
|
+
id: s,
|
|
49
|
+
error: a.message
|
|
74
50
|
}
|
|
75
51
|
}, "*") : t && typeof t.then == "function" ? t.then((o) => {
|
|
76
|
-
var
|
|
77
|
-
(
|
|
52
|
+
var d;
|
|
53
|
+
(d = window.parent) == null || d.postMessage({
|
|
78
54
|
type: "builder.evaluateResult",
|
|
79
55
|
data: {
|
|
80
|
-
id:
|
|
56
|
+
id: s,
|
|
81
57
|
result: o
|
|
82
58
|
}
|
|
83
59
|
}, "*");
|
|
84
|
-
}).catch(console.error) : (
|
|
60
|
+
}).catch(console.error) : (l = window.parent) == null || l.postMessage({
|
|
85
61
|
type: "builder.evaluateResult",
|
|
86
62
|
data: {
|
|
87
63
|
result: t,
|
|
88
|
-
id:
|
|
64
|
+
id: s
|
|
89
65
|
}
|
|
90
66
|
}, "*");
|
|
91
67
|
break;
|
|
@@ -94,6 +70,5 @@ const x = (r) => {
|
|
|
94
70
|
})));
|
|
95
71
|
};
|
|
96
72
|
export {
|
|
97
|
-
|
|
98
|
-
x as setupBrowserForEditing
|
|
73
|
+
M as setupBrowserForEditing
|
|
99
74
|
};
|
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.19.
|
|
4
|
+
"version": "0.19.3",
|
|
5
5
|
"homepage": "https://github.com/BuilderIO/builder/tree/main/packages/sdks/output/nextjs",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.19.
|
|
1
|
+
export declare const SDK_VERSION = "0.19.3";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.19.
|
|
1
|
+
export declare const SDK_VERSION = "0.19.3";
|