@builder.io/sdk-react-nextjs 0.17.8 → 0.18.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 +20 -20
- package/lib/browser/blocks/video/video.cjs +1 -1
- package/lib/browser/blocks/video/video.mjs +54 -17
- package/lib/browser/components/content/components/enable-editor.cjs +1 -1
- package/lib/browser/components/content/components/enable-editor.mjs +68 -62
- package/lib/browser/components/content/content.cjs +1 -1
- package/lib/browser/components/content/content.mjs +1 -1
- package/lib/browser/constants/sdk-version.cjs +1 -1
- package/lib/browser/constants/sdk-version.mjs +1 -1
- package/lib/browser/helpers/subscribe-to-editor.cjs +1 -1
- package/lib/browser/helpers/subscribe-to-editor.mjs +35 -20
- package/lib/browser/scripts/init-editing.cjs +1 -1
- package/lib/browser/scripts/init-editing.mjs +9 -7
- package/lib/edge/blocks/symbol/symbol.cjs +1 -1
- package/lib/edge/blocks/symbol/symbol.mjs +20 -20
- package/lib/edge/blocks/video/video.cjs +1 -1
- package/lib/edge/blocks/video/video.mjs +54 -17
- package/lib/edge/components/content/components/enable-editor.cjs +1 -1
- package/lib/edge/components/content/components/enable-editor.mjs +68 -62
- package/lib/edge/components/content/content.cjs +1 -1
- package/lib/edge/components/content/content.mjs +1 -1
- package/lib/edge/constants/sdk-version.cjs +1 -1
- package/lib/edge/constants/sdk-version.mjs +1 -1
- package/lib/edge/helpers/subscribe-to-editor.cjs +1 -1
- package/lib/edge/helpers/subscribe-to-editor.mjs +35 -20
- package/lib/edge/scripts/init-editing.cjs +1 -1
- package/lib/edge/scripts/init-editing.mjs +9 -7
- package/lib/node/blocks/symbol/symbol.cjs +1 -1
- package/lib/node/blocks/symbol/symbol.mjs +20 -20
- package/lib/node/blocks/video/video.cjs +1 -1
- package/lib/node/blocks/video/video.mjs +54 -17
- package/lib/node/components/content/components/enable-editor.cjs +1 -1
- package/lib/node/components/content/components/enable-editor.mjs +68 -62
- package/lib/node/components/content/content.cjs +1 -1
- package/lib/node/components/content/content.mjs +1 -1
- package/lib/node/constants/sdk-version.cjs +1 -1
- package/lib/node/constants/sdk-version.mjs +1 -1
- package/lib/node/helpers/subscribe-to-editor.cjs +1 -1
- package/lib/node/helpers/subscribe-to-editor.mjs +35 -20
- package/lib/node/scripts/init-editing.cjs +1 -1
- package/lib/node/scripts/init-editing.mjs +9 -7
- package/package.json +1 -1
- package/types/cjs/components/content-variants/content-variants.types.d.ts +2 -2
- package/types/cjs/constants/sdk-version.d.ts +1 -1
- package/types/cjs/helpers/subscribe-to-editor.d.ts +15 -13
- package/types/cjs/scripts/init-editing.d.ts +3 -1
- package/types/esm/components/content-variants/content-variants.types.d.ts +2 -2
- package/types/esm/constants/sdk-version.d.ts +1 -1
- package/types/esm/helpers/subscribe-to-editor.d.ts +15 -13
- package/types/esm/scripts/init-editing.d.ts +3 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as k } from "react/jsx-runtime";
|
|
3
|
-
import { useRef as P, useState as
|
|
3
|
+
import { useRef as P, useState as f, useEffect as l } from "react";
|
|
4
4
|
import O from "../../../context/builder.context.mjs";
|
|
5
5
|
import { evaluate as W } from "../../../functions/evaluate/evaluate.mjs";
|
|
6
6
|
import { fastClone as j } from "../../../functions/fast-clone.mjs";
|
|
7
7
|
import { fetchOneEntry as A } from "../../../functions/get-content/index.mjs";
|
|
8
8
|
import { isBrowser as L } from "../../../functions/is-browser.mjs";
|
|
9
|
-
import { isEditing as
|
|
9
|
+
import { isEditing as g } from "../../../functions/is-editing.mjs";
|
|
10
10
|
import { isPreviewing as B } from "../../../functions/is-previewing.mjs";
|
|
11
11
|
import { logFetch as F } from "../../../functions/log-fetch.mjs";
|
|
12
12
|
import { createRegisterComponentMessage as z } from "../../../functions/register-component.mjs";
|
|
@@ -20,19 +20,19 @@ import { triggerAnimation as Y } from "../../block/animator.mjs";
|
|
|
20
20
|
import { needsElementRefDivForEditing as q } from "./enable-editor.helpers.mjs";
|
|
21
21
|
import { getWrapperClassName as Z } from "./styles.helpers.mjs";
|
|
22
22
|
import { useRouter as p } from "next/navigation";
|
|
23
|
-
function
|
|
24
|
-
var R, w
|
|
23
|
+
function Re(e) {
|
|
24
|
+
var y, R, w;
|
|
25
25
|
const c = P(null);
|
|
26
|
-
function
|
|
27
|
-
var i,
|
|
26
|
+
function m(n) {
|
|
27
|
+
var i, r;
|
|
28
28
|
const t = {
|
|
29
29
|
...e.builderContextSignal.rootState,
|
|
30
30
|
...n
|
|
31
31
|
};
|
|
32
|
-
e.builderContextSignal.rootSetState ? (
|
|
32
|
+
e.builderContextSignal.rootSetState ? (r = (i = e.builderContextSignal).rootSetState) == null || r.call(i, t) : e.builderContextSignal.rootState = t;
|
|
33
33
|
}
|
|
34
34
|
function b(n) {
|
|
35
|
-
var i,
|
|
35
|
+
var i, r, a, o, d;
|
|
36
36
|
const t = {
|
|
37
37
|
...e.builderContextSignal.content,
|
|
38
38
|
...n,
|
|
@@ -41,16 +41,16 @@ function we(e) {
|
|
|
41
41
|
...n == null ? void 0 : n.data
|
|
42
42
|
},
|
|
43
43
|
meta: {
|
|
44
|
-
...(
|
|
44
|
+
...(r = e.builderContextSignal.content) == null ? void 0 : r.meta,
|
|
45
45
|
...n == null ? void 0 : n.meta,
|
|
46
|
-
breakpoints: ((
|
|
46
|
+
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)
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
49
|
G({
|
|
50
50
|
value: t,
|
|
51
51
|
key: t.id
|
|
52
52
|
}).then(() => {
|
|
53
|
-
|
|
53
|
+
_.refresh();
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
56
|
function T() {
|
|
@@ -59,7 +59,7 @@ function we(e) {
|
|
|
59
59
|
"aria-hidden": !0
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
|
-
const [
|
|
62
|
+
const [U, ee] = f(
|
|
63
63
|
() => e.contentWrapper || "div"
|
|
64
64
|
);
|
|
65
65
|
function v(n) {
|
|
@@ -68,9 +68,9 @@ function we(e) {
|
|
|
68
68
|
trustedHosts: e.trustedHosts,
|
|
69
69
|
callbacks: {
|
|
70
70
|
configureSdk: (t) => {
|
|
71
|
-
var
|
|
72
|
-
const { breakpoints: i, contentId:
|
|
73
|
-
!
|
|
71
|
+
var a;
|
|
72
|
+
const { breakpoints: i, contentId: r } = t;
|
|
73
|
+
!r || r !== ((a = e.builderContextSignal.content) == null ? void 0 : a.id) || i && b({
|
|
74
74
|
meta: {
|
|
75
75
|
breakpoints: i
|
|
76
76
|
}
|
|
@@ -81,40 +81,43 @@ function we(e) {
|
|
|
81
81
|
},
|
|
82
82
|
contentUpdate: (t) => {
|
|
83
83
|
b(t);
|
|
84
|
+
},
|
|
85
|
+
stateUpdate: (t) => {
|
|
86
|
+
m(t);
|
|
84
87
|
}
|
|
85
88
|
}
|
|
86
89
|
})(n);
|
|
87
90
|
}
|
|
88
|
-
const [h, te] =
|
|
89
|
-
function
|
|
91
|
+
const [h, te] = f(() => ({})), [S, ne] = f(() => ({})), [x, D] = f(() => !1);
|
|
92
|
+
function N(n) {
|
|
90
93
|
var t, i;
|
|
91
94
|
if (e.builderContextSignal.content) {
|
|
92
|
-
const
|
|
95
|
+
const r = (t = e.builderContextSignal.content) == null ? void 0 : t.testVariationId, a = (i = e.builderContextSignal.content) == null ? void 0 : i.id;
|
|
93
96
|
H({
|
|
94
97
|
apiHost: e.apiHost,
|
|
95
98
|
type: "click",
|
|
96
99
|
canTrack: K(e.canTrack),
|
|
97
|
-
contentId:
|
|
100
|
+
contentId: a,
|
|
98
101
|
apiKey: e.apiKey,
|
|
99
|
-
variationId:
|
|
102
|
+
variationId: r !== a ? r : void 0,
|
|
100
103
|
...$(n),
|
|
101
104
|
unique: !x
|
|
102
105
|
});
|
|
103
106
|
}
|
|
104
|
-
x ||
|
|
107
|
+
x || D(!0);
|
|
105
108
|
}
|
|
106
|
-
function
|
|
107
|
-
var t, i,
|
|
108
|
-
const n = (
|
|
109
|
-
Object.entries(n).forEach(([
|
|
110
|
-
if (!o || S[
|
|
109
|
+
function V() {
|
|
110
|
+
var t, i, r;
|
|
111
|
+
const n = (r = (i = (t = e.builderContextSignal.content) == null ? void 0 : t.data) == null ? void 0 : i.httpRequests) != null ? r : {};
|
|
112
|
+
Object.entries(n).forEach(([a, o]) => {
|
|
113
|
+
if (!o || S[a] || h[a] && !g())
|
|
111
114
|
return;
|
|
112
|
-
S[
|
|
115
|
+
S[a] = !0;
|
|
113
116
|
const d = o.replace(
|
|
114
117
|
/{{([^}]+)}}/g,
|
|
115
|
-
(u,
|
|
118
|
+
(u, M) => String(
|
|
116
119
|
W({
|
|
117
|
-
code:
|
|
120
|
+
code: M,
|
|
118
121
|
context: e.context || {},
|
|
119
122
|
localState: void 0,
|
|
120
123
|
rootState: e.builderContextSignal.rootState,
|
|
@@ -123,18 +126,18 @@ function we(e) {
|
|
|
123
126
|
)
|
|
124
127
|
);
|
|
125
128
|
F(d), fetch(d).then((u) => u.json()).then((u) => {
|
|
126
|
-
|
|
127
|
-
[
|
|
128
|
-
}), h[
|
|
129
|
+
m({
|
|
130
|
+
[a]: u
|
|
131
|
+
}), h[a] = !0;
|
|
129
132
|
}).catch((u) => {
|
|
130
133
|
console.error("error fetching dynamic data", o, u);
|
|
131
134
|
}).finally(() => {
|
|
132
|
-
S[
|
|
135
|
+
S[a] = !1;
|
|
133
136
|
});
|
|
134
137
|
});
|
|
135
138
|
}
|
|
136
|
-
function
|
|
137
|
-
|
|
139
|
+
function s() {
|
|
140
|
+
g() && window.dispatchEvent(
|
|
138
141
|
new CustomEvent(
|
|
139
142
|
"builder:component:stateChange",
|
|
140
143
|
{
|
|
@@ -149,6 +152,7 @@ function we(e) {
|
|
|
149
152
|
);
|
|
150
153
|
}
|
|
151
154
|
function C(n) {
|
|
155
|
+
var t;
|
|
152
156
|
window.addEventListener("message", v), Q(), X({
|
|
153
157
|
...e.locale ? {
|
|
154
158
|
locale: e.locale
|
|
@@ -158,27 +162,29 @@ function we(e) {
|
|
|
158
162
|
} : {},
|
|
159
163
|
...e.trustedHosts ? {
|
|
160
164
|
trustedHosts: e.trustedHosts
|
|
161
|
-
} : {}
|
|
165
|
+
} : {},
|
|
166
|
+
modelName: (t = e.model) != null ? t : "",
|
|
167
|
+
apiKey: e.apiKey
|
|
162
168
|
}), Object.values(
|
|
163
169
|
e.builderContextSignal.componentInfos
|
|
164
|
-
).forEach((
|
|
165
|
-
var
|
|
166
|
-
if (!
|
|
167
|
-
const
|
|
168
|
-
(a = window.parent) == null || a.postMessage(
|
|
170
|
+
).forEach((i) => {
|
|
171
|
+
var r, a;
|
|
172
|
+
if (!((r = i.models) != null && r.length) || i.models.includes(e.model)) {
|
|
173
|
+
const o = z(i);
|
|
174
|
+
(a = window.parent) == null || a.postMessage(o, "*");
|
|
169
175
|
}
|
|
170
176
|
}), window.addEventListener(
|
|
171
177
|
"builder:component:stateChangeListenerActivated",
|
|
172
|
-
|
|
178
|
+
s
|
|
173
179
|
);
|
|
174
180
|
}
|
|
175
181
|
function E(n) {
|
|
176
182
|
var o;
|
|
177
|
-
const t = new URL(location.href).searchParams, i = t.get("builder.preview"),
|
|
183
|
+
const t = new URL(location.href).searchParams, i = t.get("builder.preview"), r = t.get(
|
|
178
184
|
`builder.overrides.${i}`
|
|
179
|
-
),
|
|
180
|
-
(i === "BUILDER_STUDIO" || i === e.model &&
|
|
181
|
-
model: e.model
|
|
185
|
+
), a = t.get("apiKey") || t.get("builder.space");
|
|
186
|
+
(i === "BUILDER_STUDIO" || i === e.model && a === e.apiKey && (!e.content || r === e.content.id)) && A({
|
|
187
|
+
model: e.model,
|
|
182
188
|
apiKey: e.apiKey,
|
|
183
189
|
apiVersion: e.builderContextSignal.apiVersion,
|
|
184
190
|
...i === "BUILDER_STUDIO" && ((o = e.context) != null && o.symbolId) ? {
|
|
@@ -190,8 +196,8 @@ function we(e) {
|
|
|
190
196
|
d && b(d);
|
|
191
197
|
});
|
|
192
198
|
}
|
|
193
|
-
const
|
|
194
|
-
return I.current || (
|
|
199
|
+
const _ = p(), I = P(!1);
|
|
200
|
+
return I.current || (V(), s(), I.current = !0), l(() => {
|
|
195
201
|
var n;
|
|
196
202
|
return (n = c.current) == null || n.addEventListener(
|
|
197
203
|
"initeditingbldr",
|
|
@@ -218,42 +224,42 @@ function we(e) {
|
|
|
218
224
|
}, []), l(() => {
|
|
219
225
|
var n, t;
|
|
220
226
|
if (L()) {
|
|
221
|
-
if (
|
|
222
|
-
const
|
|
227
|
+
if (g() && !e.isNestedRender && c.current && c.current.dispatchEvent(new CustomEvent("initeditingbldr")), e.builderContextSignal.content && K(e.canTrack)) {
|
|
228
|
+
const r = (n = e.builderContextSignal.content) == null ? void 0 : n.testVariationId, a = (t = e.builderContextSignal.content) == null ? void 0 : t.id, o = e.apiKey;
|
|
223
229
|
H({
|
|
224
230
|
apiHost: e.apiHost,
|
|
225
231
|
type: "impression",
|
|
226
232
|
canTrack: !0,
|
|
227
|
-
contentId:
|
|
233
|
+
contentId: a,
|
|
228
234
|
apiKey: o,
|
|
229
|
-
variationId:
|
|
235
|
+
variationId: r !== a ? r : void 0
|
|
230
236
|
});
|
|
231
237
|
}
|
|
232
|
-
B() &&
|
|
238
|
+
B() && g();
|
|
233
239
|
}
|
|
234
240
|
}, []), l(() => {
|
|
235
241
|
}, [e.content]), l(() => {
|
|
236
|
-
|
|
242
|
+
s();
|
|
237
243
|
}, [e.builderContextSignal.rootState]), l(() => {
|
|
238
|
-
e.data &&
|
|
244
|
+
e.data && m(e.data);
|
|
239
245
|
}, [e.data]), l(() => {
|
|
240
|
-
e.locale &&
|
|
246
|
+
e.locale && m({
|
|
241
247
|
locale: e.locale
|
|
242
248
|
});
|
|
243
249
|
}, [e.locale]), l(() => () => {
|
|
244
250
|
L() && (window.removeEventListener("message", v), window.removeEventListener(
|
|
245
251
|
"builder:component:stateChangeListenerActivated",
|
|
246
|
-
|
|
252
|
+
s
|
|
247
253
|
));
|
|
248
254
|
}, []), /* @__PURE__ */ k(O.Provider, { value: e.builderContextSignal, children: e.builderContextSignal.content || q() ? /* @__PURE__ */ k(
|
|
249
|
-
|
|
255
|
+
U,
|
|
250
256
|
{
|
|
251
257
|
ref: c,
|
|
252
|
-
onClick: (n) =>
|
|
253
|
-
"builder-content-id": (
|
|
258
|
+
onClick: (n) => N(n),
|
|
259
|
+
"builder-content-id": (y = e.builderContextSignal.content) == null ? void 0 : y.id,
|
|
254
260
|
"builder-model": e.model,
|
|
255
261
|
className: Z(
|
|
256
|
-
((
|
|
262
|
+
((R = e.content) == null ? void 0 : R.testVariationId) || ((w = e.content) == null ? void 0 : w.id)
|
|
257
263
|
),
|
|
258
264
|
style: {
|
|
259
265
|
display: !e.builderContextSignal.content && q() ? "none" : void 0
|
|
@@ -265,5 +271,5 @@ function we(e) {
|
|
|
265
271
|
) : null });
|
|
266
272
|
}
|
|
267
273
|
export {
|
|
268
|
-
|
|
274
|
+
Re as default
|
|
269
275
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const c=require("react/jsx-runtime"),b=require("../../constants/builder-registered-components.cjs"),h=require("../../functions/evaluate/evaluate.cjs"),y=require("../../functions/register-component.cjs"),R=require("../../helpers/logger.cjs"),W=require("../blocks/blocks.cjs"),j=require("../content-variants/helpers.cjs"),P=require("../inlined-script.cjs"),V=require("./components/enable-editor.cjs"),K=require("./components/styles.cjs"),q=require("./content.helpers.cjs");function T(e){var a,s,r,d,l,u,m,C,g,S,k;const v=j.getUpdateVariantVisibilityScript({variationId:(a=e.content)==null?void 0:a.testVariationId,contentId:(s=e.content)==null?void 0:s.id}),I=[...b.getDefaultRegisteredComponents(),...e.customComponents||[]].reduce((n,{component:x,...o})=>({...n,[o.name]:{component:x,...y.serializeIncludingFunctions(o)}}),{}),t={content:q.getContentInitialValue({content:e.content,data:e.data}),localState:void 0,rootState:q.getRootStateInitialValue({content:e.content,data:e.data,locale:e.locale}),rootSetState:void 0,context:e.context||{},canTrack:e.canTrack,apiKey:e.apiKey,apiVersion:e.apiVersion,componentInfos:[...b.getDefaultRegisteredComponents(),...e.customComponents||[]].reduce((n,{component:x,...o})=>({...n,[o.name]:y.serializeIncludingFunctions(o)}),{}),inheritedStyles:{},BlocksWrapper:e.blocksWrapper||"div",BlocksWrapperProps:e.blocksWrapperProps||{},nonce:e.nonce||"",model:e.model
|
|
1
|
+
"use strict";const c=require("react/jsx-runtime"),b=require("../../constants/builder-registered-components.cjs"),h=require("../../functions/evaluate/evaluate.cjs"),y=require("../../functions/register-component.cjs"),R=require("../../helpers/logger.cjs"),W=require("../blocks/blocks.cjs"),j=require("../content-variants/helpers.cjs"),P=require("../inlined-script.cjs"),V=require("./components/enable-editor.cjs"),K=require("./components/styles.cjs"),q=require("./content.helpers.cjs");function T(e){var a,s,r,d,l,u,m,C,g,S,k;const v=j.getUpdateVariantVisibilityScript({variationId:(a=e.content)==null?void 0:a.testVariationId,contentId:(s=e.content)==null?void 0:s.id}),I=[...b.getDefaultRegisteredComponents(),...e.customComponents||[]].reduce((n,{component:x,...o})=>({...n,[o.name]:{component:x,...y.serializeIncludingFunctions(o)}}),{}),t={content:q.getContentInitialValue({content:e.content,data:e.data}),localState:void 0,rootState:q.getRootStateInitialValue({content:e.content,data:e.data,locale:e.locale}),rootSetState:void 0,context:e.context||{},canTrack:e.canTrack,apiKey:e.apiKey,apiVersion:e.apiVersion,componentInfos:[...b.getDefaultRegisteredComponents(),...e.customComponents||[]].reduce((n,{component:x,...o})=>({...n,[o.name]:y.serializeIncludingFunctions(o)}),{}),inheritedStyles:{},BlocksWrapper:e.blocksWrapper||"div",BlocksWrapperProps:e.blocksWrapperProps||{},nonce:e.nonce||"",model:e.model};e.apiKey||R.logger.error("No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop.");const i=(d=(r=t.content)==null?void 0:r.data)==null?void 0:d.jsCode;return i&&h.evaluate({code:i,context:e.context||{},localState:void 0,rootState:t.rootState,rootSetState:n=>{t.rootState=n},isExpression:!1}),c.jsxs(V,{apiHost:e.apiHost,nonce:e.nonce,content:e.content,data:e.data,model:e.model,context:e.context,apiKey:e.apiKey,canTrack:e.canTrack,locale:e.locale,enrich:e.enrich,showContent:e.showContent,builderContextSignal:t,contentWrapper:e.contentWrapper,contentWrapperProps:e.contentWrapperProps,trustedHosts:e.trustedHosts,isNestedRender:e.isNestedRender,children:[e.isSsrAbTest?c.jsx(P,{id:"builderio-variant-visibility",scriptStr:v,nonce:e.nonce||""}):null,c.jsx(K,{nonce:e.nonce||"",isNestedRender:e.isNestedRender,contentId:(l=t.content)==null?void 0:l.id,cssCode:(m=(u=t.content)==null?void 0:u.data)==null?void 0:m.cssCode,customFonts:(g=(C=t.content)==null?void 0:C.data)==null?void 0:g.customFonts}),c.jsx(W,{blocks:(k=(S=t.content)==null?void 0:S.data)==null?void 0:k.blocks,context:t,registeredComponents:I,linkComponent:e.linkComponent})]})}module.exports=T;
|
|
@@ -58,7 +58,7 @@ function G(t) {
|
|
|
58
58
|
BlocksWrapper: t.blocksWrapper || "div",
|
|
59
59
|
BlocksWrapperProps: t.blocksWrapperProps || {},
|
|
60
60
|
nonce: t.nonce || "",
|
|
61
|
-
model: t.model
|
|
61
|
+
model: t.model
|
|
62
62
|
};
|
|
63
63
|
t.apiKey || W.error(
|
|
64
64
|
"No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop."
|
|
@@ -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.18.1";exports.SDK_VERSION=e;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../functions/is-browser.cjs"),u=require("../functions/is-from-trusted-host.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../functions/is-browser.cjs"),u=require("../functions/is-from-trusted-host.cjs"),b=require("../scripts/init-editing.cjs"),g=require("./logger.cjs"),d=({model:n,trustedHosts:i,callbacks:r})=>o=>{if(!u.isFromTrustedHost(i,o))return;const{data:t}=o;if(t)switch(t.type){case"builder.configureSdk":{r.configureSdk(t.data);break}case"builder.triggerAnimation":{r.animation(t.data);break}case"builder.resetState":{const e=t.data,a=e.model,s=e==null?void 0:e.state;a===n&&s&&r.stateUpdate(s);break}case"builder.contentUpdate":{const e=t.data,a=e.key||e.alias||e.entry||e.modelName,s=e.data;a===n&&r.contentUpdate(s);break}}},m=({model:n,apiKey:i,callback:r,trustedHosts:o})=>{if(!c.isBrowser)return g.logger.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."),()=>{};b.setupBrowserForEditing({modelName:n,apiKey:i});const t=d({callbacks:{contentUpdate:r,animation:()=>{},configureSdk:()=>{},stateUpdate:()=>{}},model:n,trustedHosts:o});return window.addEventListener("message",t),()=>{window.removeEventListener("message",t)}};exports.createEditorListener=d;exports.subscribeToEditor=m;
|
|
@@ -2,53 +2,68 @@ import { isBrowser as d } from "../functions/is-browser.mjs";
|
|
|
2
2
|
import { isFromTrustedHost as c } from "../functions/is-from-trusted-host.mjs";
|
|
3
3
|
import { setupBrowserForEditing as m } from "../scripts/init-editing.mjs";
|
|
4
4
|
import { logger as u } from "./logger.mjs";
|
|
5
|
-
const
|
|
5
|
+
const b = ({
|
|
6
6
|
model: o,
|
|
7
|
-
trustedHosts:
|
|
8
|
-
callbacks:
|
|
9
|
-
}) => (
|
|
10
|
-
if (!c(
|
|
7
|
+
trustedHosts: i,
|
|
8
|
+
callbacks: r
|
|
9
|
+
}) => (n) => {
|
|
10
|
+
if (!c(i, n))
|
|
11
11
|
return;
|
|
12
12
|
const {
|
|
13
|
-
data:
|
|
14
|
-
} =
|
|
15
|
-
if (
|
|
16
|
-
switch (
|
|
13
|
+
data: t
|
|
14
|
+
} = n;
|
|
15
|
+
if (t)
|
|
16
|
+
switch (t.type) {
|
|
17
17
|
case "builder.configureSdk": {
|
|
18
|
-
|
|
18
|
+
r.configureSdk(t.data);
|
|
19
19
|
break;
|
|
20
20
|
}
|
|
21
21
|
case "builder.triggerAnimation": {
|
|
22
|
-
|
|
22
|
+
r.animation(t.data);
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
25
|
+
case "builder.resetState": {
|
|
26
|
+
const e = t.data, s = e.model, a = e == null ? void 0 : e.state;
|
|
27
|
+
s === o && a && r.stateUpdate(a);
|
|
23
28
|
break;
|
|
24
29
|
}
|
|
25
30
|
case "builder.contentUpdate": {
|
|
26
|
-
const
|
|
27
|
-
|
|
31
|
+
const e = t.data, s = e.key || e.alias || e.entry || e.modelName, a = e.data;
|
|
32
|
+
s === o && r.contentUpdate(a);
|
|
28
33
|
break;
|
|
29
34
|
}
|
|
30
35
|
}
|
|
31
|
-
},
|
|
36
|
+
}, k = ({
|
|
37
|
+
model: o,
|
|
38
|
+
apiKey: i,
|
|
39
|
+
callback: r,
|
|
40
|
+
trustedHosts: n
|
|
41
|
+
}) => {
|
|
32
42
|
if (!d)
|
|
33
43
|
return u.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."), () => {
|
|
34
44
|
};
|
|
35
|
-
m(
|
|
36
|
-
|
|
45
|
+
m({
|
|
46
|
+
modelName: o,
|
|
47
|
+
apiKey: i
|
|
48
|
+
});
|
|
49
|
+
const t = b({
|
|
37
50
|
callbacks: {
|
|
38
|
-
contentUpdate:
|
|
51
|
+
contentUpdate: r,
|
|
39
52
|
animation: () => {
|
|
40
53
|
},
|
|
41
54
|
configureSdk: () => {
|
|
55
|
+
},
|
|
56
|
+
stateUpdate: () => {
|
|
42
57
|
}
|
|
43
58
|
},
|
|
44
59
|
model: o,
|
|
45
|
-
trustedHosts:
|
|
60
|
+
trustedHosts: n
|
|
46
61
|
});
|
|
47
62
|
return window.addEventListener("message", t), () => {
|
|
48
63
|
window.removeEventListener("message", t);
|
|
49
64
|
};
|
|
50
65
|
};
|
|
51
66
|
export {
|
|
52
|
-
|
|
53
|
-
|
|
67
|
+
b as createEditorListener,
|
|
68
|
+
k as subscribeToEditor
|
|
54
69
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../constants/sdk-version.cjs"),y=require("../constants/target.cjs"),b=require("../functions/is-browser.cjs"),B=require("../functions/is-from-trusted-host.cjs"),M=require("../functions/register.cjs"),E=()=>{M.register("insertMenu",{name:"_default",default:!0,items:[{name:"Box"},{name:"Text"},{name:"Image"},{name:"Columns"},{name:"Core:Section"},{name:"Core:Button"},{name:"Embed"},{name:"Custom Code"}]})};let c=!1;const S=
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../constants/sdk-version.cjs"),y=require("../constants/target.cjs"),b=require("../functions/is-browser.cjs"),B=require("../functions/is-from-trusted-host.cjs"),M=require("../functions/register.cjs"),E=()=>{M.register("insertMenu",{name:"_default",default:!0,items:[{name:"Box"},{name:"Text"},{name:"Image"},{name:"Columns"},{name:"Core:Section"},{name:"Core:Button"},{name:"Embed"},{name:"Custom Code"}]})};let c=!1;const S=r=>{var o,i;c||(c=!0,b.isBrowser()&&((o=window.parent)==null||o.postMessage({type:"builder.sdkInfo",data:{target:y.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(!B.isFromTrustedHost(r.trustedHosts,u))return;const{data:e}=u;if(e!=null&&e.type)switch(e.type){case"builder.evaluate":{const m=e.data.text,g=e.data.arguments||[],s=e.data.id,w=new Function(m);let t,a=null;try{t=w.apply(null,g)}catch(n){a=n}a?(d=window.parent)==null||d.postMessage({type:"builder.evaluateError",data:{id:s,error:a.message}},"*"):t&&typeof t.then=="function"?t.then(n=>{var p;(p=window.parent)==null||p.postMessage({type:"builder.evaluateResult",data:{id:s,result:n}},"*")}).catch(console.error):(l=window.parent)==null||l.postMessage({type:"builder.evaluateResult",data:{result:t,id:s}},"*");break}}})))};exports.registerInsertMenu=E;exports.setupBrowserForEditing=S;
|
|
@@ -27,7 +27,7 @@ const S = () => {
|
|
|
27
27
|
});
|
|
28
28
|
};
|
|
29
29
|
let m = !1;
|
|
30
|
-
const x = (
|
|
30
|
+
const x = (r) => {
|
|
31
31
|
var n, i;
|
|
32
32
|
m || (m = !0, b() && ((n = window.parent) == null || n.postMessage({
|
|
33
33
|
type: "builder.sdkInfo",
|
|
@@ -39,17 +39,19 @@ const x = (a = {}) => {
|
|
|
39
39
|
// scope our '+ add block' button styling
|
|
40
40
|
supportsAddBlockScoping: !0,
|
|
41
41
|
supportsCustomBreakpoints: !0,
|
|
42
|
+
modelName: r.modelName,
|
|
43
|
+
apiKey: r.apiKey,
|
|
42
44
|
supportsXSmallBreakpoint: !0,
|
|
43
45
|
blockLevelPersonalization: !0
|
|
44
46
|
}
|
|
45
47
|
}, "*"), (i = window.parent) == null || i.postMessage({
|
|
46
48
|
type: "builder.updateContent",
|
|
47
49
|
data: {
|
|
48
|
-
options:
|
|
50
|
+
options: r
|
|
49
51
|
}
|
|
50
52
|
}, "*"), window.addEventListener("message", (u) => {
|
|
51
53
|
var p, d;
|
|
52
|
-
if (!B(
|
|
54
|
+
if (!B(r.trustedHosts, u))
|
|
53
55
|
return;
|
|
54
56
|
const {
|
|
55
57
|
data: e
|
|
@@ -57,7 +59,7 @@ const x = (a = {}) => {
|
|
|
57
59
|
if (e != null && e.type)
|
|
58
60
|
switch (e.type) {
|
|
59
61
|
case "builder.evaluate": {
|
|
60
|
-
const c = e.data.text, f = e.data.arguments || [],
|
|
62
|
+
const c = e.data.text, f = e.data.arguments || [], a = e.data.id, g = new Function(c);
|
|
61
63
|
let t, s = null;
|
|
62
64
|
try {
|
|
63
65
|
t = g.apply(null, f);
|
|
@@ -67,7 +69,7 @@ const x = (a = {}) => {
|
|
|
67
69
|
s ? (p = window.parent) == null || p.postMessage({
|
|
68
70
|
type: "builder.evaluateError",
|
|
69
71
|
data: {
|
|
70
|
-
id:
|
|
72
|
+
id: a,
|
|
71
73
|
error: s.message
|
|
72
74
|
}
|
|
73
75
|
}, "*") : t && typeof t.then == "function" ? t.then((o) => {
|
|
@@ -75,7 +77,7 @@ const x = (a = {}) => {
|
|
|
75
77
|
(l = window.parent) == null || l.postMessage({
|
|
76
78
|
type: "builder.evaluateResult",
|
|
77
79
|
data: {
|
|
78
|
-
id:
|
|
80
|
+
id: a,
|
|
79
81
|
result: o
|
|
80
82
|
}
|
|
81
83
|
}, "*");
|
|
@@ -83,7 +85,7 @@ const x = (a = {}) => {
|
|
|
83
85
|
type: "builder.evaluateResult",
|
|
84
86
|
data: {
|
|
85
87
|
result: t,
|
|
86
|
-
id:
|
|
88
|
+
id: a
|
|
87
89
|
}
|
|
88
90
|
}, "*");
|
|
89
91
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const u=require("react/jsx-runtime"),C=require("../../components/content-variants/content-variants.cjs"),x=require("../../functions/get-class-prop-name.cjs"),k=require("./symbol.helpers.cjs");async function f(e){var n,i,o,l,a,c;const d=function(){return"div"},m=function(){return"div"},y=function(){var b,s;return[e.attributes[x.getClassPropName()],"builder-symbol",(b=e.symbol)!=null&&b.inline?"builder-inline-symbol":void 0,(s=e.symbol)!=null&&s.dynamic||e.dynamic?"builder-dynamic-symbol":void 0].filter(Boolean).join(" ")},t=((n=e.symbol)==null?void 0:n.content)||await k.fetchSymbolContent({symbol:e.symbol,builderContextValue:e.builderContext});return u.jsx("div",{...e.attributes,className:y(),children:u.jsx(C,{nonce:e.builderContext.nonce,isNestedRender:!0,apiVersion:e.builderContext.apiVersion,apiKey:e.builderContext.apiKey,context:{...e.builderContext.context,symbolId:(i=e.builderBlock)==null?void 0:i.id},customComponents:Object.values(e.builderComponents),data:{...(o=e.symbol)==null?void 0:o.data,...e.builderContext.localState,...(l=t==null?void 0:t.data)==null?void 0:l.state},canTrack:e.builderContext.canTrack,model:(c=(a=e.symbol)==null?void 0:a.model)!=null?c:"",content:t,linkComponent:e.builderLinkComponent,blocksWrapper:d(),contentWrapper:m()})})}module.exports=f;
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { getClassPropName as
|
|
4
|
-
import { fetchSymbolContent as
|
|
5
|
-
async function
|
|
6
|
-
var n, o, i, l, a;
|
|
7
|
-
const
|
|
8
|
-
return "div";
|
|
9
|
-
}, u = function() {
|
|
1
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import C from "../../components/content-variants/content-variants.mjs";
|
|
3
|
+
import { getClassPropName as x } from "../../functions/get-class-prop-name.mjs";
|
|
4
|
+
import { fetchSymbolContent as f } from "./symbol.helpers.mjs";
|
|
5
|
+
async function V(e) {
|
|
6
|
+
var n, o, i, l, a, r;
|
|
7
|
+
const u = function() {
|
|
10
8
|
return "div";
|
|
11
9
|
}, s = function() {
|
|
12
|
-
|
|
10
|
+
return "div";
|
|
11
|
+
}, y = function() {
|
|
12
|
+
var m, b;
|
|
13
13
|
return [
|
|
14
|
-
e.attributes[
|
|
14
|
+
e.attributes[x()],
|
|
15
15
|
"builder-symbol",
|
|
16
|
-
(
|
|
17
|
-
(
|
|
16
|
+
(m = e.symbol) != null && m.inline ? "builder-inline-symbol" : void 0,
|
|
17
|
+
(b = e.symbol) != null && b.dynamic || e.dynamic ? "builder-dynamic-symbol" : void 0
|
|
18
18
|
].filter(Boolean).join(" ");
|
|
19
|
-
}, t = ((n = e.symbol) == null ? void 0 : n.content) || await
|
|
19
|
+
}, t = ((n = e.symbol) == null ? void 0 : n.content) || await f({
|
|
20
20
|
symbol: e.symbol,
|
|
21
21
|
builderContextValue: e.builderContext
|
|
22
22
|
});
|
|
23
|
-
return /* @__PURE__ */
|
|
24
|
-
|
|
23
|
+
return /* @__PURE__ */ d("div", { ...e.attributes, className: y(), children: /* @__PURE__ */ d(
|
|
24
|
+
C,
|
|
25
25
|
{
|
|
26
26
|
nonce: e.builderContext.nonce,
|
|
27
27
|
isNestedRender: !0,
|
|
@@ -38,14 +38,14 @@ async function N(e) {
|
|
|
38
38
|
...(l = t == null ? void 0 : t.data) == null ? void 0 : l.state
|
|
39
39
|
},
|
|
40
40
|
canTrack: e.builderContext.canTrack,
|
|
41
|
-
model: (a = e.symbol) == null ? void 0 : a.model,
|
|
41
|
+
model: (r = (a = e.symbol) == null ? void 0 : a.model) != null ? r : "",
|
|
42
42
|
content: t,
|
|
43
43
|
linkComponent: e.builderLinkComponent,
|
|
44
|
-
blocksWrapper:
|
|
45
|
-
contentWrapper:
|
|
44
|
+
blocksWrapper: u(),
|
|
45
|
+
contentWrapper: s()
|
|
46
46
|
}
|
|
47
47
|
) });
|
|
48
48
|
}
|
|
49
49
|
export {
|
|
50
|
-
|
|
50
|
+
V as default
|
|
51
51
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";const
|
|
1
|
+
"use client";"use strict";const i=require("react/jsx-runtime"),n=require("react");function j(e){var a,d,s,u,f,h,v;const l=n.useRef(null);function m(){return{...e.autoPlay===!0?{autoPlay:!0}:{},...e.muted===!0?{muted:!0}:{},...e.controls===!0?{controls:!0}:{},...e.loop===!0?{loop:!0}:{},...e.playsInline===!0?{playsInline:!0}:{}}}function x(){return{...m()}}const[c,g]=n.useState(()=>{});return n.useEffect(()=>{if(e.lazyLoad){const o=new IntersectionObserver(function(E){E.forEach(function(y){if(!y.isIntersecting)return;const r=y.target;try{Array.from(r.children).filter(t=>t instanceof HTMLElement&&t.tagName==="SOURCE").forEach(t=>{const b=t.dataset.src;b&&(t.src=b)}),r.load(),o.unobserve(r)}catch(t){console.error("Error loading lazy video:",t)}})});l.current&&o.observe(l.current),g(o)}},[]),n.useEffect(()=>()=>{c&&c.disconnect()},[]),i.jsxs("div",{style:{position:"relative"},children:[i.jsx("video",{className:"builder-video",...x(),ref:l,preload:e.lazyLoad?"none":e.preload||"metadata",style:{width:"100%",height:"100%",...(a=e.attributes)==null?void 0:a.style,objectFit:e.fit,objectPosition:e.position,borderRadius:"1px",...e.aspectRatio?{position:"absolute"}:null},poster:e.posterImage,children:i.jsx("source",{type:"video/mp4",...e.lazyLoad?{"data-src":e.video}:{src:e.video}})}),e.aspectRatio&&!(e.fitContent&&((s=(d=e.builderBlock)==null?void 0:d.children)!=null&&s.length))?i.jsx("div",{style:{width:"100%",paddingTop:e.aspectRatio*100+"%",pointerEvents:"none",fontSize:"0px"}}):null,(f=(u=e.builderBlock)==null?void 0:u.children)!=null&&f.length&&e.fitContent?i.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch"},children:e.children}):null,(v=(h=e.builderBlock)==null?void 0:h.children)!=null&&v.length&&!e.fitContent?i.jsx("div",{style:{pointerEvents:"none",display:"flex",flexDirection:"column",alignItems:"stretch",position:"absolute",top:"0",left:"0",width:"100%",height:"100%"},children:e.children}):null]})}module.exports=j;
|