@builder.io/sdk-react-nextjs 0.16.12 → 0.16.14
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/columns/columns.cjs +2 -2
- package/lib/browser/blocks/columns/columns.mjs +2 -2
- package/lib/browser/blocks/image/image.cjs +4 -4
- package/lib/browser/blocks/image/image.mjs +25 -25
- package/lib/browser/components/awaiter.cjs +1 -0
- package/lib/browser/components/awaiter.mjs +10 -0
- package/lib/browser/components/block/components/interactive-element.cjs +1 -1
- package/lib/browser/components/block/components/interactive-element.mjs +19 -9
- package/lib/browser/components/blocks/blocks-wrapper.cjs +1 -1
- package/lib/browser/components/blocks/blocks-wrapper.mjs +5 -5
- package/lib/browser/components/content/components/enable-editor.cjs +1 -1
- package/lib/browser/components/content/components/enable-editor.mjs +114 -139
- package/lib/browser/components/content/content.cjs +1 -1
- package/lib/browser/components/content/content.mjs +62 -43
- package/lib/browser/constants/sdk-version.cjs +1 -1
- package/lib/browser/constants/sdk-version.mjs +1 -1
- package/lib/browser/functions/evaluate/browser-runtime/browser.cjs +1 -1
- package/lib/browser/functions/evaluate/browser-runtime/browser.mjs +19 -45
- package/lib/browser/functions/evaluate/choose-eval.cjs +1 -1
- package/lib/browser/functions/evaluate/choose-eval.mjs +5 -3
- package/lib/browser/functions/evaluate/helpers.cjs +1 -1
- package/lib/browser/functions/evaluate/helpers.mjs +50 -24
- package/lib/browser/functions/evaluate/node-runtime/node-runtime.cjs +3 -3
- package/lib/browser/functions/evaluate/node-runtime/node-runtime.mjs +7 -7
- package/lib/browser/functions/evaluate/should-force-browser-runtime-in-node.cjs +1 -1
- package/lib/browser/functions/evaluate/should-force-browser-runtime-in-node.mjs +8 -6
- package/lib/browser/init.cjs +1 -1
- package/lib/browser/init.mjs +11 -6
- package/lib/edge/blocks/columns/columns.cjs +2 -2
- package/lib/edge/blocks/columns/columns.mjs +2 -2
- package/lib/edge/blocks/image/image.cjs +4 -4
- package/lib/edge/blocks/image/image.mjs +25 -25
- package/lib/edge/components/awaiter.cjs +1 -0
- package/lib/edge/components/awaiter.mjs +10 -0
- package/lib/edge/components/block/components/interactive-element.cjs +1 -1
- package/lib/edge/components/block/components/interactive-element.mjs +19 -9
- package/lib/edge/components/blocks/blocks-wrapper.cjs +1 -1
- package/lib/edge/components/blocks/blocks-wrapper.mjs +5 -5
- package/lib/edge/components/content/components/enable-editor.cjs +1 -1
- package/lib/edge/components/content/components/enable-editor.mjs +114 -139
- package/lib/edge/components/content/content.cjs +1 -1
- package/lib/edge/components/content/content.mjs +62 -43
- package/lib/edge/constants/builder-registered-components.cjs +1 -1
- package/lib/edge/constants/builder-registered-components.mjs +1 -1
- package/lib/edge/constants/extra-components.cjs +1 -1
- package/lib/edge/constants/extra-components.mjs +1 -1
- package/lib/edge/constants/sdk-version.cjs +1 -1
- package/lib/edge/constants/sdk-version.mjs +1 -1
- package/lib/edge/functions/evaluate/browser-runtime/browser.cjs +1 -1
- package/lib/edge/functions/evaluate/browser-runtime/browser.mjs +19 -45
- package/lib/edge/functions/evaluate/choose-eval.cjs +1 -1
- package/lib/edge/functions/evaluate/choose-eval.mjs +4 -2
- package/lib/edge/functions/evaluate/edge-runtime/edge-runtime.cjs +8 -10
- package/lib/edge/functions/evaluate/edge-runtime/edge-runtime.mjs +70 -53
- package/lib/edge/functions/evaluate/helpers.cjs +1 -1
- package/lib/edge/functions/evaluate/helpers.mjs +50 -24
- package/lib/edge/functions/evaluate/node-runtime/node-runtime.cjs +3 -3
- package/lib/edge/functions/evaluate/node-runtime/node-runtime.mjs +7 -7
- package/lib/edge/functions/evaluate/should-force-browser-runtime-in-node.cjs +1 -1
- package/lib/edge/functions/evaluate/should-force-browser-runtime-in-node.mjs +8 -6
- package/lib/edge/init.cjs +1 -1
- package/lib/edge/init.mjs +11 -6
- package/lib/node/blocks/columns/columns.cjs +2 -2
- package/lib/node/blocks/columns/columns.mjs +2 -2
- package/lib/node/blocks/image/image.cjs +4 -4
- package/lib/node/blocks/image/image.mjs +25 -25
- package/lib/node/components/awaiter.cjs +1 -0
- package/lib/node/components/awaiter.mjs +10 -0
- package/lib/node/components/block/components/interactive-element.cjs +1 -1
- package/lib/node/components/block/components/interactive-element.mjs +19 -9
- package/lib/node/components/blocks/blocks-wrapper.cjs +1 -1
- package/lib/node/components/blocks/blocks-wrapper.mjs +5 -5
- package/lib/node/components/content/components/enable-editor.cjs +1 -1
- package/lib/node/components/content/components/enable-editor.mjs +114 -139
- package/lib/node/components/content/content.cjs +1 -1
- package/lib/node/components/content/content.mjs +62 -43
- package/lib/node/constants/sdk-version.cjs +1 -1
- package/lib/node/constants/sdk-version.mjs +1 -1
- package/lib/node/functions/evaluate/browser-runtime/browser.cjs +1 -1
- package/lib/node/functions/evaluate/browser-runtime/browser.mjs +19 -45
- package/lib/node/functions/evaluate/choose-eval.cjs +1 -1
- package/lib/node/functions/evaluate/choose-eval.mjs +4 -2
- package/lib/node/functions/evaluate/helpers.cjs +1 -1
- package/lib/node/functions/evaluate/helpers.mjs +50 -24
- package/lib/node/functions/evaluate/node-runtime/node-runtime.cjs +9 -9
- package/lib/node/functions/evaluate/node-runtime/node-runtime.mjs +26 -26
- package/lib/node/functions/evaluate/should-force-browser-runtime-in-node.cjs +1 -1
- package/lib/node/functions/evaluate/should-force-browser-runtime-in-node.mjs +8 -6
- package/lib/node/init.cjs +1 -1
- package/lib/node/init.mjs +11 -6
- package/package.json +1 -1
- package/types/cjs/components/awaiter.d.ts +14 -0
- package/types/cjs/constants/sdk-version.d.ts +1 -1
- package/types/cjs/context/component-reference-types.d.ts +4 -0
- package/types/cjs/context/types.d.ts +2 -1
- package/types/cjs/functions/evaluate/browser-runtime/browser.d.ts +0 -6
- package/types/cjs/functions/evaluate/helpers.d.ts +5 -0
- package/types/cjs/functions/evaluate/should-force-browser-runtime-in-node.d.ts +3 -1
- package/types/esm/components/awaiter.d.ts +14 -0
- package/types/esm/constants/sdk-version.d.ts +1 -1
- package/types/esm/context/component-reference-types.d.ts +4 -0
- package/types/esm/context/types.d.ts +2 -1
- package/types/esm/functions/evaluate/browser-runtime/browser.d.ts +0 -6
- package/types/esm/functions/evaluate/helpers.d.ts +5 -0
- package/types/esm/functions/evaluate/should-force-browser-runtime-in-node.d.ts +3 -1
|
@@ -1,134 +1,117 @@
|
|
|
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 {
|
|
9
|
-
import { isBrowser as j } from "../../../functions/is-browser.mjs";
|
|
2
|
+
import { jsx as R } from "react/jsx-runtime";
|
|
3
|
+
import { useRef as L, useState as m, useEffect as c } from "react";
|
|
4
|
+
import N from "../../../context/builder.context.mjs";
|
|
5
|
+
import { evaluate as U } from "../../../functions/evaluate/evaluate.mjs";
|
|
6
|
+
import { fastClone as _ } from "../../../functions/fast-clone.mjs";
|
|
7
|
+
import { fetchOneEntry as D } from "../../../functions/get-content/index.mjs";
|
|
8
|
+
import { isBrowser as y } from "../../../functions/is-browser.mjs";
|
|
10
9
|
import { isEditing as f } from "../../../functions/is-editing.mjs";
|
|
11
|
-
import { isPreviewing as
|
|
12
|
-
import { createRegisterComponentMessage as
|
|
13
|
-
import { _track as
|
|
14
|
-
import { getInteractionPropertiesForEvent as
|
|
15
|
-
import { getDefaultCanTrack as
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const c = O(null);
|
|
10
|
+
import { isPreviewing as O } from "../../../functions/is-previewing.mjs";
|
|
11
|
+
import { createRegisterComponentMessage as B } from "../../../functions/register-component.mjs";
|
|
12
|
+
import { _track as K } from "../../../functions/track/index.mjs";
|
|
13
|
+
import { getInteractionPropertiesForEvent as F } from "../../../functions/track/interaction.mjs";
|
|
14
|
+
import { getDefaultCanTrack as q } from "../../../helpers/canTrack.mjs";
|
|
15
|
+
import { postPreviewContent as z } from "../../../helpers/preview-lru-cache/set.mjs";
|
|
16
|
+
import { createEditorListener as $ } from "../../../helpers/subscribe-to-editor.mjs";
|
|
17
|
+
import { registerInsertMenu as G, setupBrowserForEditing as J } from "../../../scripts/init-editing.mjs";
|
|
18
|
+
import { triggerAnimation as Q } from "../../block/animator.mjs";
|
|
19
|
+
import { getWrapperClassName as X } from "./styles.helpers.mjs";
|
|
20
|
+
import { useRouter as Y } from "next/navigation";
|
|
21
|
+
function xe(e) {
|
|
22
|
+
var w, k, P;
|
|
23
|
+
const d = L(null);
|
|
26
24
|
function g(n) {
|
|
27
|
-
var
|
|
25
|
+
var r, i;
|
|
28
26
|
const t = {
|
|
29
27
|
...e.builderContextSignal.rootState,
|
|
30
28
|
...n
|
|
31
29
|
};
|
|
32
|
-
e.builderContextSignal.rootSetState ? (
|
|
30
|
+
e.builderContextSignal.rootSetState ? (i = (r = e.builderContextSignal).rootSetState) == null || i.call(r, t) : e.builderContextSignal.rootState = t;
|
|
33
31
|
}
|
|
34
|
-
function
|
|
35
|
-
var i, a, o,
|
|
32
|
+
function b(n) {
|
|
33
|
+
var r, i, a, o, s;
|
|
36
34
|
const t = {
|
|
37
35
|
...e.builderContextSignal.content,
|
|
38
36
|
...n,
|
|
39
37
|
data: {
|
|
40
|
-
...(
|
|
38
|
+
...(r = e.builderContextSignal.content) == null ? void 0 : r.data,
|
|
41
39
|
...n == null ? void 0 : n.data
|
|
42
40
|
},
|
|
43
41
|
meta: {
|
|
44
|
-
...(
|
|
42
|
+
...(i = e.builderContextSignal.content) == null ? void 0 : i.meta,
|
|
45
43
|
...n == null ? void 0 : n.meta,
|
|
46
|
-
breakpoints: ((
|
|
44
|
+
breakpoints: ((a = n == null ? void 0 : n.meta) == null ? void 0 : a.breakpoints) || ((s = (o = e.builderContextSignal.content) == null ? void 0 : o.meta) == null ? void 0 : s.breakpoints)
|
|
47
45
|
}
|
|
48
46
|
};
|
|
49
|
-
|
|
47
|
+
z({
|
|
50
48
|
value: t,
|
|
51
49
|
key: t.id
|
|
52
50
|
}).then(() => {
|
|
53
|
-
|
|
51
|
+
j.refresh();
|
|
54
52
|
});
|
|
55
53
|
}
|
|
56
|
-
function
|
|
54
|
+
function H() {
|
|
57
55
|
return e.showContent ? {} : {
|
|
58
56
|
hidden: !0,
|
|
59
57
|
"aria-hidden": !0
|
|
60
58
|
};
|
|
61
59
|
}
|
|
62
|
-
const [
|
|
60
|
+
const [T, Z] = m(
|
|
63
61
|
() => e.contentWrapper || "div"
|
|
64
62
|
);
|
|
65
63
|
function v(n) {
|
|
66
|
-
return
|
|
64
|
+
return $({
|
|
67
65
|
model: e.model,
|
|
68
66
|
trustedHosts: e.trustedHosts,
|
|
69
67
|
callbacks: {
|
|
70
68
|
configureSdk: (t) => {
|
|
71
|
-
var
|
|
72
|
-
const { breakpoints:
|
|
73
|
-
!
|
|
69
|
+
var a;
|
|
70
|
+
const { breakpoints: r, contentId: i } = t;
|
|
71
|
+
!i || i !== ((a = e.builderContextSignal.content) == null ? void 0 : a.id) || r && b({
|
|
74
72
|
meta: {
|
|
75
|
-
breakpoints:
|
|
73
|
+
breakpoints: r
|
|
76
74
|
}
|
|
77
75
|
});
|
|
78
76
|
},
|
|
79
77
|
animation: (t) => {
|
|
80
|
-
|
|
78
|
+
Q(t);
|
|
81
79
|
},
|
|
82
80
|
contentUpdate: (t) => {
|
|
83
|
-
|
|
81
|
+
b(t);
|
|
84
82
|
}
|
|
85
83
|
}
|
|
86
84
|
})(n);
|
|
87
85
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
n && T({
|
|
92
|
-
code: n,
|
|
93
|
-
context: e.context || {},
|
|
94
|
-
localState: void 0,
|
|
95
|
-
rootState: e.builderContextSignal.rootState,
|
|
96
|
-
rootSetState: e.builderContextSignal.rootSetState,
|
|
97
|
-
/**
|
|
98
|
-
* We don't want to cache the result of the JS code, since it's arbitrary side effect code.
|
|
99
|
-
*/
|
|
100
|
-
enableCache: !1
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
const [C, oe] = m(() => ({})), [b, re] = m(() => ({})), [x, W] = m(() => !1);
|
|
104
|
-
function U(n) {
|
|
105
|
-
var t, i;
|
|
86
|
+
const [h, p] = m(() => ({})), [S, ee] = m(() => ({})), [C, V] = m(() => !1);
|
|
87
|
+
function M(n) {
|
|
88
|
+
var t, r;
|
|
106
89
|
if (e.builderContextSignal.content) {
|
|
107
|
-
const
|
|
108
|
-
|
|
90
|
+
const i = (t = e.builderContextSignal.content) == null ? void 0 : t.testVariationId, a = (r = e.builderContextSignal.content) == null ? void 0 : r.id;
|
|
91
|
+
K({
|
|
109
92
|
type: "click",
|
|
110
|
-
canTrack:
|
|
111
|
-
contentId:
|
|
93
|
+
canTrack: q(e.canTrack),
|
|
94
|
+
contentId: a,
|
|
112
95
|
apiKey: e.apiKey,
|
|
113
|
-
variationId:
|
|
114
|
-
...
|
|
115
|
-
unique: !
|
|
96
|
+
variationId: i !== a ? i : void 0,
|
|
97
|
+
...F(n),
|
|
98
|
+
unique: !C
|
|
116
99
|
});
|
|
117
100
|
}
|
|
118
|
-
|
|
101
|
+
C || V(!0);
|
|
119
102
|
}
|
|
120
|
-
function
|
|
121
|
-
var t,
|
|
122
|
-
const n = (
|
|
123
|
-
Object.entries(n).forEach(([
|
|
124
|
-
if (!
|
|
103
|
+
function W() {
|
|
104
|
+
var t, r, i;
|
|
105
|
+
const n = (i = (r = (t = e.builderContextSignal.content) == null ? void 0 : t.data) == null ? void 0 : r.httpRequests) != null ? i : {};
|
|
106
|
+
Object.entries(n).forEach(([a, o]) => {
|
|
107
|
+
if (!o || S[a] || h[a] && !f())
|
|
125
108
|
return;
|
|
126
|
-
|
|
127
|
-
const s =
|
|
109
|
+
S[a] = !0;
|
|
110
|
+
const s = o.replace(
|
|
128
111
|
/{{([^}]+)}}/g,
|
|
129
|
-
(l,
|
|
130
|
-
|
|
131
|
-
code:
|
|
112
|
+
(l, A) => String(
|
|
113
|
+
U({
|
|
114
|
+
code: A,
|
|
132
115
|
context: e.context || {},
|
|
133
116
|
localState: void 0,
|
|
134
117
|
rootState: e.builderContextSignal.rootState,
|
|
@@ -137,14 +120,14 @@ function Ke(e) {
|
|
|
137
120
|
})
|
|
138
121
|
)
|
|
139
122
|
);
|
|
140
|
-
|
|
123
|
+
fetch(s).then((l) => l.json()).then((l) => {
|
|
141
124
|
g({
|
|
142
|
-
[
|
|
143
|
-
}),
|
|
125
|
+
[a]: l
|
|
126
|
+
}), h[a] = !0;
|
|
144
127
|
}).catch((l) => {
|
|
145
|
-
console.error("error fetching dynamic data",
|
|
128
|
+
console.error("error fetching dynamic data", o, l);
|
|
146
129
|
}).finally(() => {
|
|
147
|
-
|
|
130
|
+
S[a] = !1;
|
|
148
131
|
});
|
|
149
132
|
});
|
|
150
133
|
}
|
|
@@ -154,7 +137,7 @@ function Ke(e) {
|
|
|
154
137
|
"builder:component:stateChange",
|
|
155
138
|
{
|
|
156
139
|
detail: {
|
|
157
|
-
state:
|
|
140
|
+
state: _(e.builderContextSignal.rootState),
|
|
158
141
|
ref: {
|
|
159
142
|
name: e.model
|
|
160
143
|
}
|
|
@@ -163,8 +146,8 @@ function Ke(e) {
|
|
|
163
146
|
)
|
|
164
147
|
);
|
|
165
148
|
}
|
|
166
|
-
function
|
|
167
|
-
window.addEventListener("message", v),
|
|
149
|
+
function x(n) {
|
|
150
|
+
window.addEventListener("message", v), G(), J({
|
|
168
151
|
...e.locale ? {
|
|
169
152
|
locale: e.locale
|
|
170
153
|
} : {},
|
|
@@ -177,104 +160,96 @@ function Ke(e) {
|
|
|
177
160
|
}), Object.values(
|
|
178
161
|
e.builderContextSignal.componentInfos
|
|
179
162
|
).forEach((t) => {
|
|
180
|
-
var
|
|
181
|
-
const
|
|
182
|
-
(
|
|
163
|
+
var i;
|
|
164
|
+
const r = B(t);
|
|
165
|
+
(i = window.parent) == null || i.postMessage(r, "*");
|
|
183
166
|
}), window.addEventListener(
|
|
184
167
|
"builder:component:stateChangeListenerActivated",
|
|
185
168
|
u
|
|
186
169
|
);
|
|
187
170
|
}
|
|
188
|
-
function
|
|
189
|
-
const t = new URL(location.href).searchParams,
|
|
190
|
-
`builder.overrides.${
|
|
191
|
-
),
|
|
192
|
-
|
|
171
|
+
function E(n) {
|
|
172
|
+
const t = new URL(location.href).searchParams, r = t.get("builder.preview"), i = t.get(
|
|
173
|
+
`builder.overrides.${r}`
|
|
174
|
+
), a = t.get("apiKey") || t.get("builder.space");
|
|
175
|
+
r === e.model && a === e.apiKey && (!e.content || i === e.content.id) && D({
|
|
193
176
|
model: e.model,
|
|
194
177
|
apiKey: e.apiKey,
|
|
195
178
|
apiVersion: e.builderContextSignal.apiVersion
|
|
196
|
-
}).then((
|
|
197
|
-
|
|
179
|
+
}).then((o) => {
|
|
180
|
+
o && b(o);
|
|
198
181
|
});
|
|
199
182
|
}
|
|
200
|
-
const
|
|
201
|
-
return
|
|
183
|
+
const j = Y(), I = L(!1);
|
|
184
|
+
return I.current || (W(), u(), I.current = !0), c(() => {
|
|
202
185
|
var n;
|
|
203
|
-
return (n =
|
|
186
|
+
return (n = d.current) == null || n.addEventListener(
|
|
204
187
|
"initeditingbldr",
|
|
205
|
-
|
|
188
|
+
x
|
|
206
189
|
), () => {
|
|
207
190
|
var t;
|
|
208
|
-
return (t =
|
|
191
|
+
return (t = d.current) == null ? void 0 : t.removeEventListener(
|
|
209
192
|
"initeditingbldr",
|
|
210
|
-
|
|
193
|
+
x
|
|
211
194
|
);
|
|
212
195
|
};
|
|
213
|
-
}, []),
|
|
196
|
+
}, []), c(() => {
|
|
214
197
|
var n;
|
|
215
|
-
return (n =
|
|
198
|
+
return (n = d.current) == null || n.addEventListener(
|
|
216
199
|
"initpreviewingbldr",
|
|
217
|
-
|
|
200
|
+
E
|
|
218
201
|
), () => {
|
|
219
202
|
var t;
|
|
220
|
-
return (t =
|
|
203
|
+
return (t = d.current) == null ? void 0 : t.removeEventListener(
|
|
221
204
|
"initpreviewingbldr",
|
|
222
|
-
|
|
205
|
+
E
|
|
223
206
|
);
|
|
224
207
|
};
|
|
225
|
-
}, []),
|
|
208
|
+
}, []), c(() => {
|
|
226
209
|
var n, t;
|
|
227
|
-
if (
|
|
228
|
-
if (f() &&
|
|
229
|
-
const
|
|
230
|
-
|
|
210
|
+
if (y()) {
|
|
211
|
+
if (f() && d.current && d.current.dispatchEvent(new CustomEvent("initeditingbldr")), e.builderContextSignal.content && q(e.canTrack)) {
|
|
212
|
+
const i = (n = e.builderContextSignal.content) == null ? void 0 : n.testVariationId, a = (t = e.builderContextSignal.content) == null ? void 0 : t.id, o = e.apiKey;
|
|
213
|
+
K({
|
|
231
214
|
type: "impression",
|
|
232
215
|
canTrack: !0,
|
|
233
|
-
contentId:
|
|
234
|
-
apiKey:
|
|
235
|
-
variationId:
|
|
216
|
+
contentId: a,
|
|
217
|
+
apiKey: o,
|
|
218
|
+
variationId: i !== a ? i : void 0
|
|
236
219
|
});
|
|
237
220
|
}
|
|
238
|
-
|
|
221
|
+
O() && f();
|
|
239
222
|
}
|
|
240
|
-
}, []),
|
|
241
|
-
|
|
242
|
-
"No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop."
|
|
243
|
-
), h(), E(), u();
|
|
244
|
-
}, []), d(() => {
|
|
245
|
-
}, [e.content]), d(() => {
|
|
246
|
-
h();
|
|
247
|
-
}, [(w = (k = e.builderContextSignal.content) == null ? void 0 : k.data) == null ? void 0 : w.jsCode]), d(() => {
|
|
248
|
-
E();
|
|
249
|
-
}, [(R = (y = e.builderContextSignal.content) == null ? void 0 : y.data) == null ? void 0 : R.httpRequests]), d(() => {
|
|
223
|
+
}, []), c(() => {
|
|
224
|
+
}, [e.content]), c(() => {
|
|
250
225
|
u();
|
|
251
|
-
}, [e.builderContextSignal.rootState]),
|
|
226
|
+
}, [e.builderContextSignal.rootState]), c(() => {
|
|
252
227
|
e.data && g(e.data);
|
|
253
|
-
}, [e.data]),
|
|
228
|
+
}, [e.data]), c(() => {
|
|
254
229
|
e.locale && g({
|
|
255
230
|
locale: e.locale
|
|
256
231
|
});
|
|
257
|
-
}, [e.locale]),
|
|
258
|
-
|
|
232
|
+
}, [e.locale]), c(() => () => {
|
|
233
|
+
y() && (window.removeEventListener("message", v), window.removeEventListener(
|
|
259
234
|
"builder:component:stateChangeListenerActivated",
|
|
260
235
|
u
|
|
261
236
|
));
|
|
262
|
-
}, []), /* @__PURE__ */
|
|
263
|
-
|
|
237
|
+
}, []), /* @__PURE__ */ R(N.Provider, { value: e.builderContextSignal, children: e.builderContextSignal.content ? /* @__PURE__ */ R(
|
|
238
|
+
T,
|
|
264
239
|
{
|
|
265
|
-
ref:
|
|
266
|
-
onClick: (n) =>
|
|
267
|
-
"builder-content-id": (
|
|
240
|
+
ref: d,
|
|
241
|
+
onClick: (n) => M(n),
|
|
242
|
+
"builder-content-id": (w = e.builderContextSignal.content) == null ? void 0 : w.id,
|
|
268
243
|
"builder-model": e.model,
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
className: ne(
|
|
272
|
-
((L = e.content) == null ? void 0 : L.testVariationId) || ((q = e.content) == null ? void 0 : q.id)
|
|
244
|
+
className: X(
|
|
245
|
+
((k = e.content) == null ? void 0 : k.testVariationId) || ((P = e.content) == null ? void 0 : P.id)
|
|
273
246
|
),
|
|
247
|
+
...H(),
|
|
248
|
+
...e.contentWrapperProps,
|
|
274
249
|
children: e.children
|
|
275
250
|
}
|
|
276
251
|
) : null });
|
|
277
252
|
}
|
|
278
253
|
export {
|
|
279
|
-
|
|
254
|
+
xe as default
|
|
280
255
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const c=require("react/jsx-runtime"),f=require("../../constants/builder-registered-components.cjs"),W=require("../../functions/evaluate/evaluate.cjs"),y=require("../../functions/register-component.cjs"),j=require("../../helpers/logger.cjs"),P=require("../blocks/blocks.cjs"),R=require("../content-variants/helpers.cjs"),V=require("../inlined-script.cjs"),K=require("./components/enable-editor.cjs"),T=require("./components/styles.cjs"),q=require("./content.helpers.cjs");function F(e){var a,r,l,s,u,d,C,g,S,m,k,x,b;const v=R.getUpdateVariantVisibilityScript({variationId:(a=e.content)==null?void 0:a.testVariationId,contentId:(r=e.content)==null?void 0:r.id}),I=[...f.getDefaultRegisteredComponents(),...((l=e.customComponents)==null?void 0:l.filter(({models:t})=>!(t!=null&&t.length)||!e.model?!0:t.includes(e.model)))||[]].reduce((t,{component:h,...o})=>({...t,[o.name]:{component:h,...y.serializeIncludingFunctions(o)}}),{}),n={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:[...f.getDefaultRegisteredComponents(),...((s=e.customComponents)==null?void 0:s.filter(({models:t})=>!(t!=null&&t.length)||!e.model?!0:t.includes(e.model)))||[]].reduce((t,{component:h,...o})=>({...t,[o.name]:y.serializeIncludingFunctions(o)}),{}),inheritedStyles:{},BlocksWrapper:e.blocksWrapper||"div",BlocksWrapperProps:e.blocksWrapperProps||{},nonce:e.nonce||""};e.apiKey||j.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=(u=n.content)==null?void 0:u.data)==null?void 0:d.jsCode;return i&&W.evaluate({code:i,context:e.context||{},localState:void 0,rootState:n.rootState,rootSetState:t=>{n.rootState=t},isExpression:!1,enableCache:!1}),c.jsxs(K,{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:n,contentWrapper:e.contentWrapper,contentWrapperProps:e.contentWrapperProps,trustedHosts:e.trustedHosts,children:[e.isSsrAbTest?c.jsx(V,{id:"builderio-variant-visibility",scriptStr:v,nonce:e.nonce||""}):null,c.jsx(T,{nonce:e.nonce||"",isNestedRender:e.isNestedRender,contentId:(C=n.content)==null?void 0:C.id,cssCode:(S=(g=n.content)==null?void 0:g.data)==null?void 0:S.cssCode,customFonts:(k=(m=n.content)==null?void 0:m.data)==null?void 0:k.customFonts}),c.jsx(P,{blocks:(b=(x=n.content)==null?void 0:x.data)==null?void 0:b.blocks,context:n,registeredComponents:I,linkComponent:e.linkComponent})]})}module.exports=F;
|
|
@@ -1,38 +1,40 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as W, jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import { getDefaultRegisteredComponents as b } from "../../constants/builder-registered-components.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
import { evaluate as P } from "../../functions/evaluate/evaluate.mjs";
|
|
4
|
+
import { serializeIncludingFunctions as h } from "../../functions/register-component.mjs";
|
|
5
|
+
import { logger as V } from "../../helpers/logger.mjs";
|
|
6
|
+
import K from "../blocks/blocks.mjs";
|
|
7
|
+
import { getUpdateVariantVisibilityScript as T } from "../content-variants/helpers.mjs";
|
|
8
|
+
import j from "../inlined-script.mjs";
|
|
9
|
+
import R from "./components/enable-editor.mjs";
|
|
10
|
+
import A from "./components/styles.mjs";
|
|
11
|
+
import { getContentInitialValue as B, getRootStateInitialValue as E } from "./content.helpers.mjs";
|
|
12
|
+
function L(t) {
|
|
13
|
+
var c, r, l, d, u, m, s, f, C, S, k, g, x;
|
|
14
|
+
const I = T({
|
|
13
15
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
14
|
-
variationId: (
|
|
16
|
+
variationId: (c = t.content) == null ? void 0 : c.testVariationId,
|
|
15
17
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
16
|
-
contentId: (
|
|
17
|
-
}),
|
|
18
|
+
contentId: (r = t.content) == null ? void 0 : r.id
|
|
19
|
+
}), v = [
|
|
18
20
|
...b(),
|
|
19
|
-
...((
|
|
21
|
+
...((l = t.customComponents) == null ? void 0 : l.filter(({ models: e }) => !(e != null && e.length) || !t.model ? !0 : e.includes(t.model))) || []
|
|
20
22
|
].reduce(
|
|
21
|
-
(
|
|
22
|
-
...
|
|
23
|
+
(e, { component: y, ...o }) => ({
|
|
24
|
+
...e,
|
|
23
25
|
[o.name]: {
|
|
24
|
-
component:
|
|
25
|
-
...
|
|
26
|
+
component: y,
|
|
27
|
+
...h(o)
|
|
26
28
|
}
|
|
27
29
|
}),
|
|
28
30
|
{}
|
|
29
|
-
),
|
|
30
|
-
content:
|
|
31
|
+
), n = {
|
|
32
|
+
content: B({
|
|
31
33
|
content: t.content,
|
|
32
34
|
data: t.data
|
|
33
35
|
}),
|
|
34
36
|
localState: void 0,
|
|
35
|
-
rootState:
|
|
37
|
+
rootState: E({
|
|
36
38
|
content: t.content,
|
|
37
39
|
data: t.data,
|
|
38
40
|
locale: t.locale
|
|
@@ -44,11 +46,11 @@ function A(t) {
|
|
|
44
46
|
apiVersion: t.apiVersion,
|
|
45
47
|
componentInfos: [
|
|
46
48
|
...b(),
|
|
47
|
-
...((
|
|
49
|
+
...((d = t.customComponents) == null ? void 0 : d.filter(({ models: e }) => !(e != null && e.length) || !t.model ? !0 : e.includes(t.model))) || []
|
|
48
50
|
].reduce(
|
|
49
|
-
(
|
|
50
|
-
...
|
|
51
|
-
[o.name]:
|
|
51
|
+
(e, { component: y, ...o }) => ({
|
|
52
|
+
...e,
|
|
53
|
+
[o.name]: h(o)
|
|
52
54
|
}),
|
|
53
55
|
{}
|
|
54
56
|
),
|
|
@@ -57,8 +59,25 @@ function A(t) {
|
|
|
57
59
|
BlocksWrapperProps: t.blocksWrapperProps || {},
|
|
58
60
|
nonce: t.nonce || ""
|
|
59
61
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
t.apiKey || V.error(
|
|
63
|
+
"No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop."
|
|
64
|
+
);
|
|
65
|
+
const i = (m = (u = n.content) == null ? void 0 : u.data) == null ? void 0 : m.jsCode;
|
|
66
|
+
return i && P({
|
|
67
|
+
code: i,
|
|
68
|
+
context: t.context || {},
|
|
69
|
+
localState: void 0,
|
|
70
|
+
rootState: n.rootState,
|
|
71
|
+
rootSetState: (e) => {
|
|
72
|
+
n.rootState = e;
|
|
73
|
+
},
|
|
74
|
+
isExpression: !1,
|
|
75
|
+
/**
|
|
76
|
+
* We don't want to cache the result of the JS code, since it's arbitrary side effect code.
|
|
77
|
+
*/
|
|
78
|
+
enableCache: !1
|
|
79
|
+
}), /* @__PURE__ */ W(
|
|
80
|
+
R,
|
|
62
81
|
{
|
|
63
82
|
nonce: t.nonce,
|
|
64
83
|
content: t.content,
|
|
@@ -70,35 +89,35 @@ function A(t) {
|
|
|
70
89
|
locale: t.locale,
|
|
71
90
|
enrich: t.enrich,
|
|
72
91
|
showContent: t.showContent,
|
|
73
|
-
builderContextSignal:
|
|
92
|
+
builderContextSignal: n,
|
|
74
93
|
contentWrapper: t.contentWrapper,
|
|
75
94
|
contentWrapperProps: t.contentWrapperProps,
|
|
76
95
|
trustedHosts: t.trustedHosts,
|
|
77
96
|
children: [
|
|
78
|
-
t.isSsrAbTest ? /* @__PURE__ */
|
|
79
|
-
|
|
97
|
+
t.isSsrAbTest ? /* @__PURE__ */ a(
|
|
98
|
+
j,
|
|
80
99
|
{
|
|
81
100
|
id: "builderio-variant-visibility",
|
|
82
|
-
scriptStr:
|
|
101
|
+
scriptStr: I,
|
|
83
102
|
nonce: t.nonce || ""
|
|
84
103
|
}
|
|
85
104
|
) : null,
|
|
86
|
-
/* @__PURE__ */
|
|
87
|
-
|
|
105
|
+
/* @__PURE__ */ a(
|
|
106
|
+
A,
|
|
88
107
|
{
|
|
89
108
|
nonce: t.nonce || "",
|
|
90
109
|
isNestedRender: t.isNestedRender,
|
|
91
|
-
contentId: (
|
|
92
|
-
cssCode: (
|
|
93
|
-
customFonts: (
|
|
110
|
+
contentId: (s = n.content) == null ? void 0 : s.id,
|
|
111
|
+
cssCode: (C = (f = n.content) == null ? void 0 : f.data) == null ? void 0 : C.cssCode,
|
|
112
|
+
customFonts: (k = (S = n.content) == null ? void 0 : S.data) == null ? void 0 : k.customFonts
|
|
94
113
|
}
|
|
95
114
|
),
|
|
96
|
-
/* @__PURE__ */
|
|
97
|
-
|
|
115
|
+
/* @__PURE__ */ a(
|
|
116
|
+
K,
|
|
98
117
|
{
|
|
99
|
-
blocks: (
|
|
100
|
-
context:
|
|
101
|
-
registeredComponents:
|
|
118
|
+
blocks: (x = (g = n.content) == null ? void 0 : g.data) == null ? void 0 : x.blocks,
|
|
119
|
+
context: n,
|
|
120
|
+
registeredComponents: v,
|
|
102
121
|
linkComponent: t.linkComponent
|
|
103
122
|
}
|
|
104
123
|
)
|
|
@@ -107,5 +126,5 @@ function A(t) {
|
|
|
107
126
|
);
|
|
108
127
|
}
|
|
109
128
|
export {
|
|
110
|
-
|
|
129
|
+
L as default
|
|
111
130
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.16.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.16.14";exports.SDK_VERSION=e;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../helpers.cjs"),g=({code:r,builder:o,context:s,event:u,localState:c,rootSetState:a,rootState:i})=>{const e=n.getFunctionArguments({builder:o,context:s,event:u,state:n.flattenState({rootState:i,localState:c,rootSetState:a})});return new Function(...e.map(([t])=>t),r)(...e.map(([,t])=>t))};exports.runInBrowser=g;
|