@builder.io/sdk-react-nextjs 0.21.1 → 0.22.0
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/text/component-info.cjs +1 -1
- package/lib/browser/blocks/text/component-info.mjs +0 -1
- package/lib/browser/blocks/text/text.cjs +1 -1
- package/lib/browser/blocks/text/text.mjs +3 -2
- package/lib/browser/components/block/block.cjs +1 -1
- package/lib/browser/components/block/block.mjs +27 -20
- package/lib/browser/components/block/components/interactive-element.cjs +1 -1
- package/lib/browser/components/block/components/interactive-element.mjs +27 -15
- package/lib/browser/components/block/components/live-edit-block-styles.cjs +1 -0
- package/lib/browser/components/block/components/live-edit-block-styles.mjs +94 -0
- package/lib/browser/components/block/components/style-wrapper.cjs +1 -0
- package/lib/browser/components/block/components/style-wrapper.mjs +24 -0
- package/lib/browser/components/content/components/enable-editor.cjs +1 -1
- package/lib/browser/components/content/components/enable-editor.mjs +182 -164
- package/lib/browser/components/live-edit.cjs +1 -0
- package/lib/browser/components/live-edit.mjs +19 -0
- package/lib/browser/constants/builder-registered-components.cjs +1 -1
- package/lib/browser/constants/builder-registered-components.mjs +3 -2
- package/lib/browser/constants/extra-components.cjs +1 -1
- package/lib/browser/constants/extra-components.mjs +3 -2
- package/lib/browser/constants/sdk-version.cjs +1 -1
- package/lib/browser/constants/sdk-version.mjs +1 -1
- package/lib/browser/helpers/find-block.cjs +1 -0
- package/lib/browser/helpers/find-block.mjs +30 -0
- package/lib/browser/helpers/subscribe-to-editor.cjs +1 -1
- package/lib/browser/helpers/subscribe-to-editor.mjs +15 -15
- package/lib/edge/blocks/text/component-info.cjs +1 -1
- package/lib/edge/blocks/text/component-info.mjs +0 -1
- package/lib/edge/blocks/text/text.cjs +1 -1
- package/lib/edge/blocks/text/text.mjs +3 -2
- package/lib/edge/components/block/block.cjs +1 -1
- package/lib/edge/components/block/block.mjs +27 -20
- package/lib/edge/components/block/components/interactive-element.cjs +1 -1
- package/lib/edge/components/block/components/interactive-element.mjs +27 -15
- package/lib/edge/components/block/components/live-edit-block-styles.cjs +1 -0
- package/lib/edge/components/block/components/live-edit-block-styles.mjs +94 -0
- package/lib/edge/components/block/components/style-wrapper.cjs +1 -0
- package/lib/edge/components/block/components/style-wrapper.mjs +24 -0
- package/lib/edge/components/content/components/enable-editor.cjs +1 -1
- package/lib/edge/components/content/components/enable-editor.mjs +182 -164
- package/lib/edge/components/live-edit.cjs +1 -0
- package/lib/edge/components/live-edit.mjs +19 -0
- package/lib/edge/constants/builder-registered-components.cjs +1 -1
- package/lib/edge/constants/builder-registered-components.mjs +3 -2
- package/lib/edge/constants/extra-components.cjs +1 -1
- package/lib/edge/constants/extra-components.mjs +3 -2
- package/lib/edge/constants/sdk-version.cjs +1 -1
- package/lib/edge/constants/sdk-version.mjs +1 -1
- package/lib/edge/helpers/find-block.cjs +1 -0
- package/lib/edge/helpers/find-block.mjs +30 -0
- package/lib/edge/helpers/subscribe-to-editor.cjs +1 -1
- package/lib/edge/helpers/subscribe-to-editor.mjs +15 -15
- package/lib/node/blocks/text/component-info.cjs +1 -1
- package/lib/node/blocks/text/component-info.mjs +0 -1
- package/lib/node/blocks/text/text.cjs +1 -1
- package/lib/node/blocks/text/text.mjs +3 -2
- package/lib/node/components/block/block.cjs +1 -1
- package/lib/node/components/block/block.mjs +27 -20
- package/lib/node/components/block/components/interactive-element.cjs +1 -1
- package/lib/node/components/block/components/interactive-element.mjs +27 -15
- package/lib/node/components/block/components/live-edit-block-styles.cjs +1 -0
- package/lib/node/components/block/components/live-edit-block-styles.mjs +94 -0
- package/lib/node/components/block/components/style-wrapper.cjs +1 -0
- package/lib/node/components/block/components/style-wrapper.mjs +24 -0
- package/lib/node/components/content/components/enable-editor.cjs +1 -1
- package/lib/node/components/content/components/enable-editor.mjs +182 -164
- package/lib/node/components/live-edit.cjs +1 -0
- package/lib/node/components/live-edit.mjs +19 -0
- package/lib/node/constants/builder-registered-components.cjs +1 -1
- package/lib/node/constants/builder-registered-components.mjs +3 -2
- package/lib/node/constants/extra-components.cjs +1 -1
- package/lib/node/constants/extra-components.mjs +3 -2
- package/lib/node/constants/sdk-version.cjs +1 -1
- package/lib/node/constants/sdk-version.mjs +1 -1
- package/lib/node/helpers/find-block.cjs +1 -0
- package/lib/node/helpers/find-block.mjs +30 -0
- package/lib/node/helpers/subscribe-to-editor.cjs +1 -1
- package/lib/node/helpers/subscribe-to-editor.mjs +15 -15
- package/package.json +1 -1
- package/types/cjs/components/block/components/live-edit-block-styles.d.ts +8 -0
- package/types/cjs/components/block/components/style-wrapper.d.ts +9 -0
- package/types/cjs/components/live-edit.d.ts +9 -0
- package/types/cjs/constants/sdk-version.d.ts +1 -1
- package/types/cjs/helpers/find-block.d.ts +18 -0
- package/types/cjs/helpers/subscribe-to-editor.d.ts +3 -2
- package/types/esm/components/block/components/live-edit-block-styles.d.ts +8 -0
- package/types/esm/components/block/components/style-wrapper.d.ts +9 -0
- package/types/esm/components/live-edit.d.ts +9 -0
- package/types/esm/constants/sdk-version.d.ts +1 -1
- package/types/esm/helpers/find-block.d.ts +18 -0
- package/types/esm/helpers/subscribe-to-editor.d.ts +3 -2
|
@@ -1,174 +1,192 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { useRef as
|
|
4
|
-
import
|
|
5
|
-
import { evaluate as
|
|
6
|
-
import { fastClone as
|
|
7
|
-
import { fetchOneEntry as
|
|
8
|
-
import { isBrowser as
|
|
9
|
-
import { isEditing as
|
|
10
|
-
import { isPreviewing as
|
|
11
|
-
import { logFetch as
|
|
12
|
-
import { createRegisterComponentMessage as
|
|
13
|
-
import { _track as
|
|
14
|
-
import { getInteractionPropertiesForEvent as
|
|
2
|
+
import { jsx as T } from "react/jsx-runtime";
|
|
3
|
+
import { useRef as D, useState as u, useEffect as s } from "react";
|
|
4
|
+
import z from "../../../context/builder.context.mjs";
|
|
5
|
+
import { evaluate as Q } from "../../../functions/evaluate/evaluate.mjs";
|
|
6
|
+
import { fastClone as X } from "../../../functions/fast-clone.mjs";
|
|
7
|
+
import { fetchOneEntry as Y } from "../../../functions/get-content/index.mjs";
|
|
8
|
+
import { isBrowser as N } from "../../../functions/is-browser.mjs";
|
|
9
|
+
import { isEditing as v } from "../../../functions/is-editing.mjs";
|
|
10
|
+
import { isPreviewing as Z } from "../../../functions/is-previewing.mjs";
|
|
11
|
+
import { logFetch as p } from "../../../functions/log-fetch.mjs";
|
|
12
|
+
import { createRegisterComponentMessage as ee } from "../../../functions/register-component.mjs";
|
|
13
|
+
import { _track as V } from "../../../functions/track/index.mjs";
|
|
14
|
+
import { getInteractionPropertiesForEvent as te } from "../../../functions/track/interaction.mjs";
|
|
15
15
|
import { getDefaultCanTrack as U } from "../../../helpers/canTrack.mjs";
|
|
16
|
-
import { getCookieSync as
|
|
17
|
-
import { postPreviewContent as
|
|
18
|
-
import { createEditorListener as
|
|
19
|
-
import { setupBrowserForEditing as
|
|
20
|
-
import { triggerAnimation as
|
|
16
|
+
import { getCookieSync as ne } from "../../../helpers/cookie.mjs";
|
|
17
|
+
import { postPreviewContent as ie } from "../../../helpers/preview-lru-cache/set.mjs";
|
|
18
|
+
import { createEditorListener as ae } from "../../../helpers/subscribe-to-editor.mjs";
|
|
19
|
+
import { setupBrowserForEditing as oe } from "../../../scripts/init-editing.mjs";
|
|
20
|
+
import { triggerAnimation as re } 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
|
|
25
|
-
var
|
|
26
|
-
const
|
|
22
|
+
import { getWrapperClassName as de } from "./styles.helpers.mjs";
|
|
23
|
+
import { useRouter as le } from "next/navigation";
|
|
24
|
+
function Ne(e) {
|
|
25
|
+
var R, H, K;
|
|
26
|
+
const m = D(null);
|
|
27
27
|
u(() => !1);
|
|
28
|
-
const [
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
const [C, y] = u(
|
|
29
|
+
() => e.builderContextSignal
|
|
30
|
+
), [j, _] = u(() => null), [W, A] = u(() => "");
|
|
31
|
+
function g(i, t) {
|
|
32
|
+
var r, a, o, d;
|
|
33
|
+
const n = {
|
|
32
34
|
...e.builderContextSignal.rootState,
|
|
33
|
-
...
|
|
35
|
+
...i
|
|
34
36
|
};
|
|
35
|
-
e.builderContextSignal.rootSetState ? (
|
|
37
|
+
if (e.builderContextSignal.rootSetState ? (a = (r = e.builderContextSignal).rootSetState) == null || a.call(r, n) : e.builderContextSignal.rootState = n, t === "server")
|
|
38
|
+
e.builderContextSignal.rootSetState ? (d = (o = e.builderContextSignal).rootSetState) == null || d.call(o, n) : e.builderContextSignal.rootState = n;
|
|
39
|
+
else {
|
|
40
|
+
const l = {
|
|
41
|
+
...e.builderContextSignal,
|
|
42
|
+
rootState: n
|
|
43
|
+
};
|
|
44
|
+
y(l);
|
|
45
|
+
}
|
|
36
46
|
}
|
|
37
|
-
function
|
|
38
|
-
var
|
|
39
|
-
const
|
|
47
|
+
function h(i, t) {
|
|
48
|
+
var r, a, o, d, l;
|
|
49
|
+
const n = {
|
|
40
50
|
...e.builderContextSignal.content,
|
|
41
|
-
...
|
|
51
|
+
...i,
|
|
42
52
|
data: {
|
|
43
|
-
...(
|
|
44
|
-
...
|
|
53
|
+
...(r = e.builderContextSignal.content) == null ? void 0 : r.data,
|
|
54
|
+
...i == null ? void 0 : i.data
|
|
45
55
|
},
|
|
46
56
|
meta: {
|
|
47
|
-
...(
|
|
48
|
-
...
|
|
49
|
-
breakpoints: ((
|
|
57
|
+
...(a = e.builderContextSignal.content) == null ? void 0 : a.meta,
|
|
58
|
+
...i == null ? void 0 : i.meta,
|
|
59
|
+
breakpoints: ((o = i == null ? void 0 : i.meta) == null ? void 0 : o.breakpoints) || ((l = (d = e.builderContextSignal.content) == null ? void 0 : d.meta) == null ? void 0 : l.breakpoints)
|
|
50
60
|
}
|
|
51
61
|
};
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
62
|
+
if (t === "server")
|
|
63
|
+
ie({
|
|
64
|
+
value: n,
|
|
65
|
+
key: n.id,
|
|
66
|
+
url: window.location.pathname
|
|
67
|
+
});
|
|
68
|
+
else {
|
|
69
|
+
const S = JSON.parse(JSON.stringify(n)), c = {
|
|
70
|
+
...C,
|
|
71
|
+
content: S
|
|
72
|
+
};
|
|
73
|
+
y(c);
|
|
74
|
+
}
|
|
57
75
|
}
|
|
58
|
-
function
|
|
76
|
+
function B() {
|
|
59
77
|
return e.showContent ? {} : {
|
|
60
78
|
hidden: !0,
|
|
61
79
|
"aria-hidden": !0
|
|
62
80
|
};
|
|
63
81
|
}
|
|
64
|
-
const [
|
|
82
|
+
const [F, ce] = u(
|
|
65
83
|
() => e.contentWrapper || "div"
|
|
66
84
|
);
|
|
67
|
-
function
|
|
68
|
-
return
|
|
85
|
+
function E(i) {
|
|
86
|
+
return ae({
|
|
69
87
|
model: e.model,
|
|
70
88
|
trustedHosts: e.trustedHosts,
|
|
71
89
|
callbacks: {
|
|
72
90
|
configureSdk: (t) => {
|
|
73
91
|
var a;
|
|
74
|
-
const { breakpoints:
|
|
75
|
-
!
|
|
92
|
+
const { breakpoints: n, contentId: r } = t;
|
|
93
|
+
!r || r !== ((a = e.builderContextSignal.content) == null ? void 0 : a.id) || n && h({
|
|
76
94
|
meta: {
|
|
77
|
-
breakpoints:
|
|
95
|
+
breakpoints: n
|
|
78
96
|
}
|
|
79
97
|
});
|
|
80
98
|
},
|
|
81
99
|
animation: (t) => {
|
|
82
|
-
|
|
100
|
+
re(t);
|
|
83
101
|
},
|
|
84
|
-
contentUpdate: (t) => {
|
|
85
|
-
|
|
102
|
+
contentUpdate: (t, n) => {
|
|
103
|
+
h(t, n);
|
|
86
104
|
},
|
|
87
|
-
stateUpdate: (t) => {
|
|
88
|
-
|
|
105
|
+
stateUpdate: (t, n) => {
|
|
106
|
+
g(t, n);
|
|
89
107
|
}
|
|
90
108
|
}
|
|
91
|
-
})(
|
|
109
|
+
})(i);
|
|
92
110
|
}
|
|
93
|
-
const [
|
|
94
|
-
function
|
|
95
|
-
var t,
|
|
111
|
+
const [I, ue] = u(() => ({})), [x, se] = u(() => ({})), [w, J] = u(() => !1);
|
|
112
|
+
function M(i) {
|
|
113
|
+
var t, n;
|
|
96
114
|
if (e.builderContextSignal.content) {
|
|
97
|
-
const
|
|
98
|
-
|
|
115
|
+
const r = (t = e.builderContextSignal.content) == null ? void 0 : t.testVariationId, a = (n = e.builderContextSignal.content) == null ? void 0 : n.id;
|
|
116
|
+
V({
|
|
99
117
|
apiHost: e.apiHost,
|
|
100
118
|
type: "click",
|
|
101
119
|
canTrack: U(e.canTrack),
|
|
102
120
|
contentId: a,
|
|
103
121
|
apiKey: e.apiKey,
|
|
104
|
-
variationId:
|
|
105
|
-
...
|
|
106
|
-
unique: !
|
|
122
|
+
variationId: r !== a ? r : void 0,
|
|
123
|
+
...te(i),
|
|
124
|
+
unique: !w
|
|
107
125
|
});
|
|
108
126
|
}
|
|
109
|
-
|
|
127
|
+
w || J(!0);
|
|
110
128
|
}
|
|
111
|
-
function
|
|
112
|
-
var t,
|
|
113
|
-
const
|
|
114
|
-
Object.entries(
|
|
115
|
-
([a,
|
|
116
|
-
if (!
|
|
129
|
+
function G() {
|
|
130
|
+
var t, n, r;
|
|
131
|
+
const i = (r = (n = (t = e.builderContextSignal.content) == null ? void 0 : t.data) == null ? void 0 : n.httpRequests) != null ? r : {};
|
|
132
|
+
Object.entries(i).forEach(
|
|
133
|
+
([a, o]) => {
|
|
134
|
+
if (!o)
|
|
117
135
|
return;
|
|
118
|
-
const d = typeof
|
|
119
|
-
if (
|
|
136
|
+
const d = typeof o == "object" && o["@type"] === "@builder.io/core:Request";
|
|
137
|
+
if (x[a] || I[a] && !v())
|
|
120
138
|
return;
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
const
|
|
139
|
+
const l = d ? o.request.url : o;
|
|
140
|
+
x[a] = !0;
|
|
141
|
+
const S = l.replace(
|
|
124
142
|
/{{([^}]+)}}/g,
|
|
125
|
-
(
|
|
126
|
-
|
|
127
|
-
code:
|
|
143
|
+
(f, $) => String(
|
|
144
|
+
Q({
|
|
145
|
+
code: $,
|
|
128
146
|
context: e.context || {},
|
|
129
147
|
localState: void 0,
|
|
130
148
|
rootState: e.builderContextSignal.rootState,
|
|
131
149
|
rootSetState: e.builderContextSignal.rootSetState
|
|
132
150
|
})
|
|
133
151
|
)
|
|
134
|
-
),
|
|
135
|
-
url:
|
|
136
|
-
method:
|
|
137
|
-
headers:
|
|
138
|
-
body:
|
|
152
|
+
), c = d ? {
|
|
153
|
+
url: S,
|
|
154
|
+
method: o.request.method,
|
|
155
|
+
headers: o.request.headers,
|
|
156
|
+
body: o.request.body
|
|
139
157
|
} : {
|
|
140
|
-
url:
|
|
158
|
+
url: S,
|
|
141
159
|
method: "GET"
|
|
142
160
|
};
|
|
143
|
-
|
|
144
|
-
const
|
|
145
|
-
method:
|
|
146
|
-
headers:
|
|
147
|
-
body:
|
|
161
|
+
p(JSON.stringify(c));
|
|
162
|
+
const O = {
|
|
163
|
+
method: c.method,
|
|
164
|
+
headers: c.headers,
|
|
165
|
+
body: c.body
|
|
148
166
|
};
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
[a]:
|
|
152
|
-
}),
|
|
153
|
-
}).catch((
|
|
167
|
+
c.method === "GET" && delete O.body, fetch(c.url, O).then((f) => f.json()).then((f) => {
|
|
168
|
+
g({
|
|
169
|
+
[a]: f
|
|
170
|
+
}), I[a] = !0;
|
|
171
|
+
}).catch((f) => {
|
|
154
172
|
console.error(
|
|
155
173
|
"error fetching dynamic data",
|
|
156
|
-
JSON.stringify(
|
|
157
|
-
|
|
174
|
+
JSON.stringify(o),
|
|
175
|
+
f
|
|
158
176
|
);
|
|
159
177
|
}).finally(() => {
|
|
160
|
-
|
|
178
|
+
x[a] = !1;
|
|
161
179
|
});
|
|
162
180
|
}
|
|
163
181
|
);
|
|
164
182
|
}
|
|
165
|
-
function
|
|
166
|
-
|
|
183
|
+
function b() {
|
|
184
|
+
v() && window.dispatchEvent(
|
|
167
185
|
new CustomEvent(
|
|
168
186
|
"builder:component:stateChange",
|
|
169
187
|
{
|
|
170
188
|
detail: {
|
|
171
|
-
state:
|
|
189
|
+
state: X(e.builderContextSignal.rootState),
|
|
172
190
|
ref: {
|
|
173
191
|
name: e.model
|
|
174
192
|
}
|
|
@@ -177,9 +195,9 @@ function De(e) {
|
|
|
177
195
|
)
|
|
178
196
|
);
|
|
179
197
|
}
|
|
180
|
-
function
|
|
198
|
+
function P(i) {
|
|
181
199
|
var t;
|
|
182
|
-
window.addEventListener("message",
|
|
200
|
+
window.addEventListener("message", E), oe({
|
|
183
201
|
...e.locale ? {
|
|
184
202
|
locale: e.locale
|
|
185
203
|
} : {},
|
|
@@ -193,123 +211,123 @@ function De(e) {
|
|
|
193
211
|
apiKey: e.apiKey
|
|
194
212
|
}), Object.values(
|
|
195
213
|
e.builderContextSignal.componentInfos
|
|
196
|
-
).forEach((
|
|
197
|
-
var
|
|
198
|
-
if (!((
|
|
199
|
-
const
|
|
200
|
-
(a = window.parent) == null || a.postMessage(
|
|
214
|
+
).forEach((n) => {
|
|
215
|
+
var r, a;
|
|
216
|
+
if (!((r = n.models) != null && r.length) || n.models.includes(e.model)) {
|
|
217
|
+
const o = ee(n);
|
|
218
|
+
(a = window.parent) == null || a.postMessage(o, "*");
|
|
201
219
|
}
|
|
202
220
|
}), window.addEventListener(
|
|
203
221
|
"builder:component:stateChangeListenerActivated",
|
|
204
|
-
|
|
222
|
+
b
|
|
205
223
|
);
|
|
206
224
|
}
|
|
207
|
-
function
|
|
208
|
-
var
|
|
209
|
-
const t = new URL(location.href).searchParams,
|
|
210
|
-
`builder.overrides.${
|
|
225
|
+
function k(i) {
|
|
226
|
+
var o;
|
|
227
|
+
const t = new URL(location.href).searchParams, n = t.get("builder.preview"), r = t.get(
|
|
228
|
+
`builder.overrides.${n}`
|
|
211
229
|
), a = t.get("apiKey") || t.get("builder.space");
|
|
212
|
-
(
|
|
230
|
+
(n === "BUILDER_STUDIO" || n === e.model && a === e.apiKey && (!e.content || r === e.content.id)) && Y({
|
|
213
231
|
model: e.model,
|
|
214
232
|
apiKey: e.apiKey,
|
|
215
233
|
apiVersion: e.builderContextSignal.apiVersion,
|
|
216
|
-
...
|
|
234
|
+
...n === "BUILDER_STUDIO" && ((o = e.context) != null && o.symbolId) ? {
|
|
217
235
|
query: {
|
|
218
236
|
id: e.context.symbolId
|
|
219
237
|
}
|
|
220
238
|
} : {}
|
|
221
239
|
}).then((d) => {
|
|
222
|
-
d &&
|
|
240
|
+
d && h(d);
|
|
223
241
|
});
|
|
224
242
|
}
|
|
225
|
-
|
|
226
|
-
const
|
|
227
|
-
return
|
|
228
|
-
var
|
|
229
|
-
return (
|
|
243
|
+
le();
|
|
244
|
+
const L = D(!1);
|
|
245
|
+
return L.current || (G(), b(), L.current = !0), s(() => {
|
|
246
|
+
var i;
|
|
247
|
+
return (i = m.current) == null || i.addEventListener(
|
|
230
248
|
"initeditingbldr",
|
|
231
|
-
|
|
249
|
+
P
|
|
232
250
|
), () => {
|
|
233
251
|
var t;
|
|
234
|
-
return (t =
|
|
252
|
+
return (t = m.current) == null ? void 0 : t.removeEventListener(
|
|
235
253
|
"initeditingbldr",
|
|
236
|
-
|
|
254
|
+
P
|
|
237
255
|
);
|
|
238
256
|
};
|
|
239
|
-
}, []),
|
|
240
|
-
var
|
|
241
|
-
return (
|
|
257
|
+
}, []), s(() => {
|
|
258
|
+
var i;
|
|
259
|
+
return (i = m.current) == null || i.addEventListener(
|
|
242
260
|
"initpreviewingbldr",
|
|
243
|
-
|
|
261
|
+
k
|
|
244
262
|
), () => {
|
|
245
263
|
var t;
|
|
246
|
-
return (t =
|
|
264
|
+
return (t = m.current) == null ? void 0 : t.removeEventListener(
|
|
247
265
|
"initpreviewingbldr",
|
|
248
|
-
|
|
266
|
+
k
|
|
249
267
|
);
|
|
250
268
|
};
|
|
251
|
-
}, []),
|
|
252
|
-
var
|
|
253
|
-
if (
|
|
254
|
-
|
|
255
|
-
const
|
|
256
|
-
name: `builder.tests.${(
|
|
269
|
+
}, []), s(() => {
|
|
270
|
+
var i, t, n;
|
|
271
|
+
if (N()) {
|
|
272
|
+
v() && !e.isNestedRender && m.current && m.current.dispatchEvent(new CustomEvent("initeditingbldr"));
|
|
273
|
+
const r = e.builderContextSignal.content && U(e.canTrack), a = ne({
|
|
274
|
+
name: `builder.tests.${(i = e.builderContextSignal.content) == null ? void 0 : i.id}`,
|
|
257
275
|
canTrack: !0
|
|
258
|
-
}),
|
|
259
|
-
if (
|
|
260
|
-
const d = (
|
|
261
|
-
|
|
276
|
+
}), o = (t = e.builderContextSignal.content) == null ? void 0 : t.testVariationId;
|
|
277
|
+
if (r && o === a) {
|
|
278
|
+
const d = (n = e.builderContextSignal.content) == null ? void 0 : n.id, l = e.apiKey;
|
|
279
|
+
V({
|
|
262
280
|
apiHost: e.apiHost,
|
|
263
281
|
type: "impression",
|
|
264
282
|
canTrack: !0,
|
|
265
283
|
contentId: d,
|
|
266
|
-
apiKey:
|
|
284
|
+
apiKey: l,
|
|
267
285
|
variationId: a !== d ? a : void 0
|
|
268
286
|
});
|
|
269
287
|
}
|
|
270
|
-
|
|
288
|
+
Z() && v();
|
|
271
289
|
}
|
|
272
|
-
}, []),
|
|
273
|
-
}, [e.content]),
|
|
274
|
-
|
|
275
|
-
}, [e.builderContextSignal.rootState]),
|
|
290
|
+
}, []), s(() => {
|
|
291
|
+
}, [e.content]), s(() => {
|
|
292
|
+
b();
|
|
293
|
+
}, [e.builderContextSignal.rootState]), s(() => {
|
|
276
294
|
if (e.data) {
|
|
277
|
-
if (
|
|
295
|
+
if (j === e.data)
|
|
278
296
|
return;
|
|
279
|
-
|
|
297
|
+
g(e.data), _(e.data);
|
|
280
298
|
}
|
|
281
|
-
}, [e.data]),
|
|
299
|
+
}, [e.data]), s(() => {
|
|
282
300
|
if (e.locale) {
|
|
283
|
-
if (
|
|
301
|
+
if (W === e.locale)
|
|
284
302
|
return;
|
|
285
|
-
|
|
303
|
+
g({
|
|
286
304
|
locale: e.locale
|
|
287
|
-
}),
|
|
305
|
+
}), A(e.locale);
|
|
288
306
|
}
|
|
289
|
-
}, [e.locale]),
|
|
290
|
-
|
|
307
|
+
}, [e.locale]), s(() => () => {
|
|
308
|
+
N() && (window.removeEventListener("message", E), window.removeEventListener(
|
|
291
309
|
"builder:component:stateChangeListenerActivated",
|
|
292
|
-
|
|
310
|
+
b
|
|
293
311
|
));
|
|
294
|
-
}, []), /* @__PURE__ */
|
|
295
|
-
|
|
312
|
+
}, []), /* @__PURE__ */ T(z.Provider, { value: C, children: e.builderContextSignal.content || q() ? /* @__PURE__ */ T(
|
|
313
|
+
F,
|
|
296
314
|
{
|
|
297
|
-
ref:
|
|
298
|
-
onClick: (
|
|
299
|
-
"builder-content-id": (
|
|
315
|
+
ref: m,
|
|
316
|
+
onClick: (i) => M(i),
|
|
317
|
+
"builder-content-id": (R = e.builderContextSignal.content) == null ? void 0 : R.id,
|
|
300
318
|
"builder-model": e.model,
|
|
301
|
-
className:
|
|
302
|
-
((
|
|
319
|
+
className: de(
|
|
320
|
+
((H = e.content) == null ? void 0 : H.testVariationId) || ((K = e.content) == null ? void 0 : K.id)
|
|
303
321
|
),
|
|
304
322
|
style: {
|
|
305
323
|
display: !e.builderContextSignal.content && q() ? "none" : void 0
|
|
306
324
|
},
|
|
307
|
-
...
|
|
325
|
+
...B(),
|
|
308
326
|
...e.contentWrapperProps,
|
|
309
327
|
children: e.children
|
|
310
328
|
}
|
|
311
329
|
) : null });
|
|
312
330
|
}
|
|
313
331
|
export {
|
|
314
|
-
|
|
332
|
+
Ne as default
|
|
315
333
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";const o=require("react/jsx-runtime"),u=require("react"),s=require("../context/builder.context.cjs"),d=require("../helpers/find-block.cjs");function x(t){function e(){return d.findBlockById(c.content,t.id)}function r(){var n,i;return((i=(n=e==null?void 0:e())==null?void 0:n.component)==null?void 0:i.options)||{}}const c=u.useContext(s);return o.jsx(t.Wrapper,{...r(),attributes:t.attributes,children:t.children})}module.exports=x;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
3
|
+
import { useContext as c } from "react";
|
|
4
|
+
import f from "../context/builder.context.mjs";
|
|
5
|
+
import { findBlockById as m } from "../helpers/find-block.mjs";
|
|
6
|
+
function x(t) {
|
|
7
|
+
function n() {
|
|
8
|
+
return m(r.content, t.id);
|
|
9
|
+
}
|
|
10
|
+
function i() {
|
|
11
|
+
var e, o;
|
|
12
|
+
return ((o = (e = n == null ? void 0 : n()) == null ? void 0 : e.component) == null ? void 0 : o.options) || {};
|
|
13
|
+
}
|
|
14
|
+
const r = c(f);
|
|
15
|
+
return /* @__PURE__ */ u(t.Wrapper, { ...i(), attributes: t.attributes, children: t.children });
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
x as default
|
|
19
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("react");const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("react");const e=require("./target.cjs");require("../functions/evaluate/node-runtime/safeDynamicRequire.cjs");require("../helpers/user-attributes.cjs");require("../functions/get-fetch.cjs");require("../context/builder.context.cjs");const o=require("../blocks/button/component-info.cjs"),n=require("../blocks/button/button.cjs"),t=require("../blocks/columns/component-info.cjs"),r=require("../blocks/columns/columns.cjs"),c=require("../blocks/fragment/component-info.cjs"),i=require("../blocks/fragment/fragment.cjs"),s=require("../blocks/image/component-info.cjs"),m=require("../blocks/image/image.cjs"),u=require("../blocks/personalization-container/component-info.cjs"),p=require("../blocks/personalization-container/helpers.cjs"),q=require("../blocks/personalization-container/personalization-container.cjs"),f=require("../blocks/section/component-info.cjs"),I=require("../blocks/section/section.cjs"),a=require("../blocks/slot/component-info.cjs"),l=require("../blocks/slot/slot.cjs"),g=require("../blocks/symbol/component-info.cjs"),$=require("../blocks/symbol/symbol.cjs"),S=require("../blocks/text/component-info.cjs"),d=require("../blocks/text/text.cjs"),C=require("./extra-components.cjs"),R=()=>[{component:n,...o.componentInfo},{component:r,...t.componentInfo},{component:i,...c.componentInfo},{component:m,...s.componentInfo},{component:I,...f.componentInfo},{component:l,...a.componentInfo},{component:$,...g.componentInfo},{component:d,...S.componentInfo},...p.SDKS_SUPPORTING_PERSONALIZATION.includes(e.TARGET)?[{component:q,...u.componentInfo}]:[],...C.getExtraComponents()];exports.getDefaultRegisteredComponents=R;
|
|
@@ -4,6 +4,7 @@ import { TARGET as o } from "./target.mjs";
|
|
|
4
4
|
import "../functions/evaluate/node-runtime/safeDynamicRequire.mjs";
|
|
5
5
|
import "../helpers/user-attributes.mjs";
|
|
6
6
|
import "../functions/get-fetch.mjs";
|
|
7
|
+
import "../context/builder.context.mjs";
|
|
7
8
|
import { componentInfo as n } from "../blocks/button/component-info.mjs";
|
|
8
9
|
import m from "../blocks/button/button.mjs";
|
|
9
10
|
import { componentInfo as t } from "../blocks/columns/component-info.mjs";
|
|
@@ -24,7 +25,7 @@ import g from "../blocks/symbol/symbol.mjs";
|
|
|
24
25
|
import { componentInfo as T } from "../blocks/text/component-info.mjs";
|
|
25
26
|
import u from "../blocks/text/text.mjs";
|
|
26
27
|
import { getExtraComponents as P } from "./extra-components.mjs";
|
|
27
|
-
const
|
|
28
|
+
const M = () => [{
|
|
28
29
|
component: m,
|
|
29
30
|
...n
|
|
30
31
|
}, {
|
|
@@ -53,5 +54,5 @@ const J = () => [{
|
|
|
53
54
|
...c
|
|
54
55
|
}] : [], ...P()];
|
|
55
56
|
export {
|
|
56
|
-
|
|
57
|
+
M as getDefaultRegisteredComponents
|
|
57
58
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../blocks/custom-code/component-info.cjs"),o=require("../blocks/custom-code/custom-code.cjs"),n=require("../blocks/embed/component-info.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../blocks/custom-code/component-info.cjs"),o=require("../blocks/custom-code/custom-code.cjs"),n=require("../blocks/embed/component-info.cjs"),r=require("../blocks/embed/embed.cjs");require("react/jsx-runtime");require("react");require("../functions/evaluate/node-runtime/safeDynamicRequire.cjs");require("../helpers/user-attributes.cjs");require("../functions/get-fetch.cjs");require("../context/builder.context.cjs");const t=require("../blocks/img/component-info.cjs"),c=require("../blocks/img/img.cjs"),i=require("../blocks/video/component-info.cjs"),m=require("../blocks/video/video.cjs"),u=()=>[{component:o,...e.componentInfo},{component:r,...n.componentInfo},{component:c,...t.componentInfo},{component:m,...i.componentInfo}];exports.getExtraComponents=u;
|
|
@@ -7,11 +7,12 @@ import "react";
|
|
|
7
7
|
import "../functions/evaluate/node-runtime/safeDynamicRequire.mjs";
|
|
8
8
|
import "../helpers/user-attributes.mjs";
|
|
9
9
|
import "../functions/get-fetch.mjs";
|
|
10
|
+
import "../context/builder.context.mjs";
|
|
10
11
|
import { componentInfo as p } from "../blocks/img/component-info.mjs";
|
|
11
12
|
import r from "../blocks/img/img.mjs";
|
|
12
13
|
import { componentInfo as e } from "../blocks/video/component-info.mjs";
|
|
13
14
|
import f from "../blocks/video/video.mjs";
|
|
14
|
-
const
|
|
15
|
+
const h = () => [{
|
|
15
16
|
component: m,
|
|
16
17
|
...o
|
|
17
18
|
}, {
|
|
@@ -25,5 +26,5 @@ const V = () => [{
|
|
|
25
26
|
...e
|
|
26
27
|
}];
|
|
27
28
|
export {
|
|
28
|
-
|
|
29
|
+
h as getExtraComponents
|
|
29
30
|
};
|
|
@@ -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.22.0";exports.SDK_VERSION=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=(e,o)=>{var c;return l((c=e.data)==null?void 0:c.blocks,o)},l=(e,o)=>{var c,r,i;if(!e)return null;for(const n of e){if(n.id===o)return n;if(n.children){const t=l(n.children,o);if(t)return t}if(((c=n.component)==null?void 0:c.name)==="Columns"&&((i=(r=n.component)==null?void 0:r.options)!=null&&i.columns)){for(const t of n.component.options.columns)if(t.blocks){const f=l(t.blocks,o);if(f)return f}}}return null};exports.findBlockById=s;exports.findBlockInTree=l;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const s = (r, o) => {
|
|
2
|
+
var c;
|
|
3
|
+
return l((c = r.data) == null ? void 0 : c.blocks, o);
|
|
4
|
+
}, l = (r, o) => {
|
|
5
|
+
var c, e, i;
|
|
6
|
+
if (!r)
|
|
7
|
+
return null;
|
|
8
|
+
for (const n of r) {
|
|
9
|
+
if (n.id === o)
|
|
10
|
+
return n;
|
|
11
|
+
if (n.children) {
|
|
12
|
+
const t = l(n.children, o);
|
|
13
|
+
if (t)
|
|
14
|
+
return t;
|
|
15
|
+
}
|
|
16
|
+
if (((c = n.component) == null ? void 0 : c.name) === "Columns" && ((i = (e = n.component) == null ? void 0 : e.options) != null && i.columns)) {
|
|
17
|
+
for (const t of n.component.options.columns)
|
|
18
|
+
if (t.blocks) {
|
|
19
|
+
const f = l(t.blocks, o);
|
|
20
|
+
if (f)
|
|
21
|
+
return f;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return null;
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
s as findBlockById,
|
|
29
|
+
l as findBlockInTree
|
|
30
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../functions/is-browser.cjs"),b=require("../functions/is-from-trusted-host.cjs"),g=require("../scripts/init-editing.cjs"),m=require("./logger.cjs"),c=({model:n,trustedHosts:s,callbacks:r})=>i=>{if(!b.isFromTrustedHost(s,i))return;const{data:t}=i;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,o=e==null?void 0:e.state,d=e.editType;a===n&&o&&r.stateUpdate(o,d);break}case"builder.contentUpdate":{const e=t.data,a=e.key||e.alias||e.entry||e.modelName,o=e.data,d=e.editType;a===n&&r.contentUpdate(o,d);break}}},p=({model:n,apiKey:s,callback:r,trustedHosts:i})=>{if(!u.isBrowser)return m.logger.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."),()=>{};g.setupBrowserForEditing({modelName:n,apiKey:s});const t=c({callbacks:{contentUpdate:r,animation:()=>{},configureSdk:()=>{},stateUpdate:()=>{}},model:n,trustedHosts:i});return window.addEventListener("message",t),()=>{window.removeEventListener("message",t)}};exports.createEditorListener=c;exports.subscribeToEditor=p;
|