@builder.io/sdk-react-nextjs 0.17.0 → 0.17.2
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/image/component-info.cjs +1 -1
- package/lib/browser/blocks/image/component-info.mjs +4 -3
- package/lib/browser/blocks/image/image.cjs +4 -4
- package/lib/browser/blocks/image/image.mjs +20 -20
- package/lib/browser/blocks/img/component-info.cjs +1 -1
- package/lib/browser/blocks/img/component-info.mjs +4 -3
- package/lib/browser/blocks/text/text.cjs +1 -1
- package/lib/browser/blocks/text/text.mjs +6 -24
- package/lib/browser/blocks/video/component-info.cjs +1 -1
- package/lib/browser/blocks/video/component-info.mjs +5 -4
- package/lib/browser/components/block/block.cjs +1 -1
- package/lib/browser/components/block/block.helpers.cjs +3 -3
- package/lib/browser/components/block/block.helpers.mjs +57 -54
- package/lib/browser/components/block/block.mjs +49 -48
- package/lib/browser/components/content/components/enable-editor.cjs +1 -1
- package/lib/browser/components/content/components/enable-editor.helpers.cjs +1 -0
- package/lib/browser/components/content/components/enable-editor.helpers.mjs +8 -0
- package/lib/browser/components/content/components/enable-editor.mjs +159 -147
- package/lib/browser/components/content/content.cjs +1 -1
- package/lib/browser/components/content/content.mjs +57 -56
- package/lib/browser/constants/file-types.cjs +1 -0
- package/lib/browser/constants/file-types.mjs +5 -0
- package/lib/browser/constants/sdk-version.cjs +1 -1
- package/lib/browser/constants/sdk-version.mjs +1 -1
- package/lib/browser/context/builder.context.cjs +1 -1
- package/lib/browser/context/builder.context.mjs +2 -1
- package/lib/browser/functions/extract-localized-values.cjs +1 -0
- package/lib/browser/functions/extract-localized-values.mjs +28 -0
- package/lib/browser/functions/get-block-component-options.cjs +1 -1
- package/lib/browser/functions/get-block-component-options.mjs +21 -5
- package/lib/browser/functions/get-content/generate-content-url.cjs +1 -1
- package/lib/browser/functions/get-content/generate-content-url.mjs +60 -40
- package/lib/browser/functions/get-processed-block.cjs +1 -1
- package/lib/browser/functions/get-processed-block.mjs +49 -49
- package/lib/browser/functions/register-component.cjs +1 -1
- package/lib/browser/functions/register-component.mjs +7 -7
- package/lib/browser/functions/traverse.cjs +1 -0
- package/lib/browser/functions/traverse.mjs +20 -0
- package/lib/browser/helpers/flatten.cjs +1 -1
- package/lib/browser/helpers/flatten.mjs +28 -15
- package/lib/edge/blocks/image/component-info.cjs +1 -1
- package/lib/edge/blocks/image/component-info.mjs +4 -3
- package/lib/edge/blocks/image/image.cjs +4 -4
- package/lib/edge/blocks/image/image.mjs +20 -20
- package/lib/edge/blocks/img/component-info.cjs +1 -1
- package/lib/edge/blocks/img/component-info.mjs +4 -3
- package/lib/edge/blocks/text/text.cjs +1 -1
- package/lib/edge/blocks/text/text.mjs +6 -24
- package/lib/edge/blocks/video/component-info.cjs +1 -1
- package/lib/edge/blocks/video/component-info.mjs +5 -4
- package/lib/edge/components/block/block.cjs +1 -1
- package/lib/edge/components/block/block.helpers.cjs +3 -3
- package/lib/edge/components/block/block.helpers.mjs +57 -54
- package/lib/edge/components/block/block.mjs +49 -48
- package/lib/edge/components/content/components/enable-editor.cjs +1 -1
- package/lib/edge/components/content/components/enable-editor.helpers.cjs +1 -0
- package/lib/edge/components/content/components/enable-editor.helpers.mjs +8 -0
- package/lib/edge/components/content/components/enable-editor.mjs +159 -147
- package/lib/edge/components/content/content.cjs +1 -1
- package/lib/edge/components/content/content.mjs +57 -56
- package/lib/edge/constants/file-types.cjs +1 -0
- package/lib/edge/constants/file-types.mjs +5 -0
- package/lib/edge/constants/sdk-version.cjs +1 -1
- package/lib/edge/constants/sdk-version.mjs +1 -1
- package/lib/edge/context/builder.context.cjs +1 -1
- package/lib/edge/context/builder.context.mjs +2 -1
- package/lib/edge/functions/evaluate/edge-runtime/edge-runtime.cjs +5 -5
- package/lib/edge/functions/evaluate/edge-runtime/edge-runtime.mjs +25 -28
- package/lib/edge/functions/extract-localized-values.cjs +1 -0
- package/lib/edge/functions/extract-localized-values.mjs +28 -0
- package/lib/edge/functions/get-block-component-options.cjs +1 -1
- package/lib/edge/functions/get-block-component-options.mjs +21 -5
- package/lib/edge/functions/get-content/generate-content-url.cjs +1 -1
- package/lib/edge/functions/get-content/generate-content-url.mjs +60 -40
- package/lib/edge/functions/get-processed-block.cjs +1 -1
- package/lib/edge/functions/get-processed-block.mjs +49 -49
- package/lib/edge/functions/register-component.cjs +1 -1
- package/lib/edge/functions/register-component.mjs +7 -7
- package/lib/edge/functions/traverse.cjs +1 -0
- package/lib/edge/functions/traverse.mjs +20 -0
- package/lib/edge/helpers/flatten.cjs +1 -1
- package/lib/edge/helpers/flatten.mjs +28 -15
- package/lib/node/blocks/image/component-info.cjs +1 -1
- package/lib/node/blocks/image/component-info.mjs +4 -3
- package/lib/node/blocks/image/image.cjs +4 -4
- package/lib/node/blocks/image/image.mjs +20 -20
- package/lib/node/blocks/img/component-info.cjs +1 -1
- package/lib/node/blocks/img/component-info.mjs +4 -3
- package/lib/node/blocks/text/text.cjs +1 -1
- package/lib/node/blocks/text/text.mjs +6 -24
- package/lib/node/blocks/video/component-info.cjs +1 -1
- package/lib/node/blocks/video/component-info.mjs +5 -4
- package/lib/node/components/block/block.cjs +1 -1
- package/lib/node/components/block/block.helpers.cjs +3 -3
- package/lib/node/components/block/block.helpers.mjs +57 -54
- package/lib/node/components/block/block.mjs +49 -48
- package/lib/node/components/content/components/enable-editor.cjs +1 -1
- package/lib/node/components/content/components/enable-editor.helpers.cjs +1 -0
- package/lib/node/components/content/components/enable-editor.helpers.mjs +8 -0
- package/lib/node/components/content/components/enable-editor.mjs +159 -147
- package/lib/node/components/content/content.cjs +1 -1
- package/lib/node/components/content/content.mjs +57 -56
- package/lib/node/constants/file-types.cjs +1 -0
- package/lib/node/constants/file-types.mjs +5 -0
- package/lib/node/constants/sdk-version.cjs +1 -1
- package/lib/node/constants/sdk-version.mjs +1 -1
- package/lib/node/context/builder.context.cjs +1 -1
- package/lib/node/context/builder.context.mjs +2 -1
- package/lib/node/functions/extract-localized-values.cjs +1 -0
- package/lib/node/functions/extract-localized-values.mjs +28 -0
- package/lib/node/functions/get-block-component-options.cjs +1 -1
- package/lib/node/functions/get-block-component-options.mjs +21 -5
- package/lib/node/functions/get-content/generate-content-url.cjs +1 -1
- package/lib/node/functions/get-content/generate-content-url.mjs +60 -40
- package/lib/node/functions/get-processed-block.cjs +1 -1
- package/lib/node/functions/get-processed-block.mjs +49 -49
- package/lib/node/functions/register-component.cjs +1 -1
- package/lib/node/functions/register-component.mjs +7 -7
- package/lib/node/functions/traverse.cjs +1 -0
- package/lib/node/functions/traverse.mjs +20 -0
- package/lib/node/helpers/flatten.cjs +1 -1
- package/lib/node/helpers/flatten.mjs +28 -15
- package/package.json +1 -1
- package/types/cjs/components/block/block.helpers.d.ts +6 -3
- package/types/cjs/components/content/components/enable-editor.helpers.d.ts +11 -0
- package/types/cjs/constants/file-types.d.ts +2 -0
- package/types/cjs/constants/sdk-version.d.ts +1 -1
- package/types/cjs/context/types.d.ts +1 -0
- package/types/cjs/functions/extract-localized-values.d.ts +2 -0
- package/types/cjs/functions/get-block-component-options.d.ts +2 -1
- package/types/cjs/functions/get-processed-block.d.ts +1 -6
- package/types/cjs/functions/traverse.d.ts +34 -0
- package/types/cjs/helpers/flatten.d.ts +6 -0
- package/types/cjs/server-index.d.ts +1 -1
- package/types/cjs/types/components.d.ts +3 -0
- package/types/esm/components/block/block.helpers.d.ts +6 -3
- package/types/esm/components/content/components/enable-editor.helpers.d.ts +11 -0
- package/types/esm/constants/file-types.d.ts +2 -0
- package/types/esm/constants/sdk-version.d.ts +1 -1
- package/types/esm/context/types.d.ts +1 -0
- package/types/esm/functions/extract-localized-values.d.ts +2 -0
- package/types/esm/functions/get-block-component-options.d.ts +2 -1
- package/types/esm/functions/get-processed-block.d.ts +1 -6
- package/types/esm/functions/traverse.d.ts +34 -0
- package/types/esm/helpers/flatten.d.ts +6 -0
- package/types/esm/server-index.d.ts +1 -1
- package/types/esm/types/components.d.ts +3 -0
|
@@ -1,146 +1,147 @@
|
|
|
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
|
|
2
|
+
import { jsx as k } from "react/jsx-runtime";
|
|
3
|
+
import { useRef as P, useState as s, useEffect as l } from "react";
|
|
4
|
+
import O from "../../../context/builder.context.mjs";
|
|
5
|
+
import { evaluate as W } from "../../../functions/evaluate/evaluate.mjs";
|
|
6
|
+
import { fastClone as j } from "../../../functions/fast-clone.mjs";
|
|
7
|
+
import { fetchOneEntry as A } from "../../../functions/get-content/index.mjs";
|
|
8
8
|
import { isBrowser as L } from "../../../functions/is-browser.mjs";
|
|
9
9
|
import { isEditing as f } from "../../../functions/is-editing.mjs";
|
|
10
|
-
import { isPreviewing as
|
|
11
|
-
import { logFetch as
|
|
12
|
-
import { createRegisterComponentMessage as
|
|
13
|
-
import { _track as
|
|
14
|
-
import { getInteractionPropertiesForEvent as
|
|
10
|
+
import { isPreviewing as B } from "../../../functions/is-previewing.mjs";
|
|
11
|
+
import { logFetch as F } from "../../../functions/log-fetch.mjs";
|
|
12
|
+
import { createRegisterComponentMessage as z } from "../../../functions/register-component.mjs";
|
|
13
|
+
import { _track as H } from "../../../functions/track/index.mjs";
|
|
14
|
+
import { getInteractionPropertiesForEvent as $ } from "../../../functions/track/interaction.mjs";
|
|
15
15
|
import { getDefaultCanTrack as K } from "../../../helpers/canTrack.mjs";
|
|
16
|
-
import { postPreviewContent as
|
|
17
|
-
import { createEditorListener as
|
|
18
|
-
import { registerInsertMenu as
|
|
19
|
-
import { triggerAnimation as
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
import { postPreviewContent as G } from "../../../helpers/preview-lru-cache/set.mjs";
|
|
17
|
+
import { createEditorListener as J } from "../../../helpers/subscribe-to-editor.mjs";
|
|
18
|
+
import { registerInsertMenu as Q, setupBrowserForEditing as X } from "../../../scripts/init-editing.mjs";
|
|
19
|
+
import { triggerAnimation as Y } from "../../block/animator.mjs";
|
|
20
|
+
import { needsElementRefDivForEditing as q } from "./enable-editor.helpers.mjs";
|
|
21
|
+
import { getWrapperClassName as Z } from "./styles.helpers.mjs";
|
|
22
|
+
import { useRouter as p } from "next/navigation";
|
|
23
|
+
function we(e) {
|
|
24
|
+
var R, w, y;
|
|
25
|
+
const c = P(null);
|
|
25
26
|
function g(n) {
|
|
26
|
-
var
|
|
27
|
-
const
|
|
28
|
-
...
|
|
27
|
+
var i, a;
|
|
28
|
+
const t = {
|
|
29
|
+
...e.builderContextSignal.rootState,
|
|
29
30
|
...n
|
|
30
31
|
};
|
|
31
|
-
|
|
32
|
+
e.builderContextSignal.rootSetState ? (a = (i = e.builderContextSignal).rootSetState) == null || a.call(i, t) : e.builderContextSignal.rootState = t;
|
|
32
33
|
}
|
|
33
34
|
function b(n) {
|
|
34
|
-
var
|
|
35
|
-
const
|
|
36
|
-
...
|
|
35
|
+
var i, a, r, o, d;
|
|
36
|
+
const t = {
|
|
37
|
+
...e.builderContextSignal.content,
|
|
37
38
|
...n,
|
|
38
39
|
data: {
|
|
39
|
-
...(
|
|
40
|
+
...(i = e.builderContextSignal.content) == null ? void 0 : i.data,
|
|
40
41
|
...n == null ? void 0 : n.data
|
|
41
42
|
},
|
|
42
43
|
meta: {
|
|
43
|
-
...(
|
|
44
|
+
...(a = e.builderContextSignal.content) == null ? void 0 : a.meta,
|
|
44
45
|
...n == null ? void 0 : n.meta,
|
|
45
|
-
breakpoints: ((
|
|
46
|
+
breakpoints: ((r = n == null ? void 0 : n.meta) == null ? void 0 : r.breakpoints) || ((d = (o = e.builderContextSignal.content) == null ? void 0 : o.meta) == null ? void 0 : d.breakpoints)
|
|
46
47
|
}
|
|
47
48
|
};
|
|
48
|
-
|
|
49
|
-
value:
|
|
50
|
-
key:
|
|
49
|
+
G({
|
|
50
|
+
value: t,
|
|
51
|
+
key: t.id
|
|
51
52
|
}).then(() => {
|
|
52
|
-
|
|
53
|
+
M.refresh();
|
|
53
54
|
});
|
|
54
55
|
}
|
|
55
|
-
function
|
|
56
|
-
return
|
|
56
|
+
function T() {
|
|
57
|
+
return e.showContent ? {} : {
|
|
57
58
|
hidden: !0,
|
|
58
59
|
"aria-hidden": !0
|
|
59
60
|
};
|
|
60
61
|
}
|
|
61
|
-
const [
|
|
62
|
-
() =>
|
|
62
|
+
const [D, ee] = s(
|
|
63
|
+
() => e.contentWrapper || "div"
|
|
63
64
|
);
|
|
64
65
|
function v(n) {
|
|
65
|
-
return
|
|
66
|
-
model:
|
|
67
|
-
trustedHosts:
|
|
66
|
+
return J({
|
|
67
|
+
model: e.model,
|
|
68
|
+
trustedHosts: e.trustedHosts,
|
|
68
69
|
callbacks: {
|
|
69
|
-
configureSdk: (
|
|
70
|
-
var
|
|
71
|
-
const { breakpoints:
|
|
72
|
-
!
|
|
70
|
+
configureSdk: (t) => {
|
|
71
|
+
var r;
|
|
72
|
+
const { breakpoints: i, contentId: a } = t;
|
|
73
|
+
!a || a !== ((r = e.builderContextSignal.content) == null ? void 0 : r.id) || i && b({
|
|
73
74
|
meta: {
|
|
74
|
-
breakpoints:
|
|
75
|
+
breakpoints: i
|
|
75
76
|
}
|
|
76
77
|
});
|
|
77
78
|
},
|
|
78
|
-
animation: (
|
|
79
|
-
|
|
79
|
+
animation: (t) => {
|
|
80
|
+
Y(t);
|
|
80
81
|
},
|
|
81
|
-
contentUpdate: (
|
|
82
|
-
b(
|
|
82
|
+
contentUpdate: (t) => {
|
|
83
|
+
b(t);
|
|
83
84
|
}
|
|
84
85
|
}
|
|
85
86
|
})(n);
|
|
86
87
|
}
|
|
87
|
-
const [h,
|
|
88
|
-
function
|
|
89
|
-
var
|
|
90
|
-
if (
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
apiHost:
|
|
88
|
+
const [h, te] = s(() => ({})), [S, ne] = s(() => ({})), [x, U] = s(() => !1);
|
|
89
|
+
function V(n) {
|
|
90
|
+
var t, i;
|
|
91
|
+
if (e.builderContextSignal.content) {
|
|
92
|
+
const a = (t = e.builderContextSignal.content) == null ? void 0 : t.testVariationId, r = (i = e.builderContextSignal.content) == null ? void 0 : i.id;
|
|
93
|
+
H({
|
|
94
|
+
apiHost: e.apiHost,
|
|
94
95
|
type: "click",
|
|
95
|
-
canTrack: K(
|
|
96
|
-
contentId:
|
|
97
|
-
apiKey:
|
|
98
|
-
variationId:
|
|
99
|
-
|
|
96
|
+
canTrack: K(e.canTrack),
|
|
97
|
+
contentId: r,
|
|
98
|
+
apiKey: e.apiKey,
|
|
99
|
+
variationId: a !== r ? a : void 0,
|
|
100
|
+
...$(n),
|
|
100
101
|
unique: !x
|
|
101
102
|
});
|
|
102
103
|
}
|
|
103
|
-
x ||
|
|
104
|
+
x || U(!0);
|
|
104
105
|
}
|
|
105
|
-
function
|
|
106
|
-
var
|
|
107
|
-
const n = (
|
|
108
|
-
Object.entries(n).forEach(([
|
|
109
|
-
if (!o || S[
|
|
106
|
+
function _() {
|
|
107
|
+
var t, i, a;
|
|
108
|
+
const n = (a = (i = (t = e.builderContextSignal.content) == null ? void 0 : t.data) == null ? void 0 : i.httpRequests) != null ? a : {};
|
|
109
|
+
Object.entries(n).forEach(([r, o]) => {
|
|
110
|
+
if (!o || S[r] || h[r] && !f())
|
|
110
111
|
return;
|
|
111
|
-
S[
|
|
112
|
-
const
|
|
112
|
+
S[r] = !0;
|
|
113
|
+
const d = o.replace(
|
|
113
114
|
/{{([^}]+)}}/g,
|
|
114
|
-
(
|
|
115
|
-
|
|
116
|
-
code:
|
|
117
|
-
context:
|
|
115
|
+
(u, N) => String(
|
|
116
|
+
W({
|
|
117
|
+
code: N,
|
|
118
|
+
context: e.context || {},
|
|
118
119
|
localState: void 0,
|
|
119
|
-
rootState:
|
|
120
|
-
rootSetState:
|
|
120
|
+
rootState: e.builderContextSignal.rootState,
|
|
121
|
+
rootSetState: e.builderContextSignal.rootSetState
|
|
121
122
|
})
|
|
122
123
|
)
|
|
123
124
|
);
|
|
124
|
-
|
|
125
|
+
F(d), fetch(d).then((u) => u.json()).then((u) => {
|
|
125
126
|
g({
|
|
126
|
-
[
|
|
127
|
-
}), h[
|
|
128
|
-
}).catch((
|
|
129
|
-
console.error("error fetching dynamic data", o,
|
|
127
|
+
[r]: u
|
|
128
|
+
}), h[r] = !0;
|
|
129
|
+
}).catch((u) => {
|
|
130
|
+
console.error("error fetching dynamic data", o, u);
|
|
130
131
|
}).finally(() => {
|
|
131
|
-
S[
|
|
132
|
+
S[r] = !1;
|
|
132
133
|
});
|
|
133
134
|
});
|
|
134
135
|
}
|
|
135
|
-
function
|
|
136
|
+
function m() {
|
|
136
137
|
f() && window.dispatchEvent(
|
|
137
138
|
new CustomEvent(
|
|
138
139
|
"builder:component:stateChange",
|
|
139
140
|
{
|
|
140
141
|
detail: {
|
|
141
|
-
state:
|
|
142
|
+
state: j(e.builderContextSignal.rootState),
|
|
142
143
|
ref: {
|
|
143
|
-
name:
|
|
144
|
+
name: e.model
|
|
144
145
|
}
|
|
145
146
|
}
|
|
146
147
|
}
|
|
@@ -148,110 +149,121 @@ function It(t) {
|
|
|
148
149
|
);
|
|
149
150
|
}
|
|
150
151
|
function C(n) {
|
|
151
|
-
window.addEventListener("message", v),
|
|
152
|
-
...
|
|
153
|
-
locale:
|
|
152
|
+
window.addEventListener("message", v), Q(), X({
|
|
153
|
+
...e.locale ? {
|
|
154
|
+
locale: e.locale
|
|
154
155
|
} : {},
|
|
155
|
-
...
|
|
156
|
-
enrich:
|
|
156
|
+
...e.enrich ? {
|
|
157
|
+
enrich: e.enrich
|
|
157
158
|
} : {},
|
|
158
|
-
...
|
|
159
|
-
trustedHosts:
|
|
159
|
+
...e.trustedHosts ? {
|
|
160
|
+
trustedHosts: e.trustedHosts
|
|
160
161
|
} : {}
|
|
161
162
|
}), Object.values(
|
|
162
|
-
|
|
163
|
-
).forEach((
|
|
164
|
-
var i;
|
|
165
|
-
|
|
166
|
-
|
|
163
|
+
e.builderContextSignal.componentInfos
|
|
164
|
+
).forEach((t) => {
|
|
165
|
+
var i, a;
|
|
166
|
+
if (!e.model || !((i = t.models) != null && i.length) || t.models.includes(e.model)) {
|
|
167
|
+
const r = z(t);
|
|
168
|
+
(a = window.parent) == null || a.postMessage(r, "*");
|
|
169
|
+
}
|
|
167
170
|
}), window.addEventListener(
|
|
168
171
|
"builder:component:stateChangeListenerActivated",
|
|
169
|
-
|
|
172
|
+
m
|
|
170
173
|
);
|
|
171
174
|
}
|
|
172
175
|
function E(n) {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
r
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
176
|
+
var o;
|
|
177
|
+
const t = new URL(location.href).searchParams, i = t.get("builder.preview"), a = t.get(
|
|
178
|
+
`builder.overrides.${i}`
|
|
179
|
+
), r = t.get("apiKey") || t.get("builder.space");
|
|
180
|
+
(i === "BUILDER_STUDIO" || i === e.model && r === e.apiKey && (!e.content || a === e.content.id)) && A({
|
|
181
|
+
model: e.model || "",
|
|
182
|
+
apiKey: e.apiKey,
|
|
183
|
+
apiVersion: e.builderContextSignal.apiVersion,
|
|
184
|
+
...i === "BUILDER_STUDIO" && ((o = e.context) != null && o.symbolId) ? {
|
|
185
|
+
query: {
|
|
186
|
+
id: e.context.symbolId
|
|
187
|
+
}
|
|
188
|
+
} : {}
|
|
189
|
+
}).then((d) => {
|
|
190
|
+
d && b(d);
|
|
182
191
|
});
|
|
183
192
|
}
|
|
184
|
-
const
|
|
185
|
-
return I.current || (
|
|
193
|
+
const M = p(), I = P(!1);
|
|
194
|
+
return I.current || (_(), m(), I.current = !0), l(() => {
|
|
186
195
|
var n;
|
|
187
|
-
return (n =
|
|
196
|
+
return (n = c.current) == null || n.addEventListener(
|
|
188
197
|
"initeditingbldr",
|
|
189
198
|
C
|
|
190
199
|
), () => {
|
|
191
|
-
var
|
|
192
|
-
return (
|
|
200
|
+
var t;
|
|
201
|
+
return (t = c.current) == null ? void 0 : t.removeEventListener(
|
|
193
202
|
"initeditingbldr",
|
|
194
203
|
C
|
|
195
204
|
);
|
|
196
205
|
};
|
|
197
|
-
}, []),
|
|
206
|
+
}, []), l(() => {
|
|
198
207
|
var n;
|
|
199
|
-
return (n =
|
|
208
|
+
return (n = c.current) == null || n.addEventListener(
|
|
200
209
|
"initpreviewingbldr",
|
|
201
210
|
E
|
|
202
211
|
), () => {
|
|
203
|
-
var
|
|
204
|
-
return (
|
|
212
|
+
var t;
|
|
213
|
+
return (t = c.current) == null ? void 0 : t.removeEventListener(
|
|
205
214
|
"initpreviewingbldr",
|
|
206
215
|
E
|
|
207
216
|
);
|
|
208
217
|
};
|
|
209
|
-
}, []),
|
|
210
|
-
var n,
|
|
218
|
+
}, []), l(() => {
|
|
219
|
+
var n, t;
|
|
211
220
|
if (L()) {
|
|
212
|
-
if (f() && !
|
|
213
|
-
const
|
|
214
|
-
|
|
215
|
-
apiHost:
|
|
221
|
+
if (f() && !e.isNestedRender && c.current && c.current.dispatchEvent(new CustomEvent("initeditingbldr")), e.builderContextSignal.content && K(e.canTrack)) {
|
|
222
|
+
const a = (n = e.builderContextSignal.content) == null ? void 0 : n.testVariationId, r = (t = e.builderContextSignal.content) == null ? void 0 : t.id, o = e.apiKey;
|
|
223
|
+
H({
|
|
224
|
+
apiHost: e.apiHost,
|
|
216
225
|
type: "impression",
|
|
217
226
|
canTrack: !0,
|
|
218
|
-
contentId:
|
|
227
|
+
contentId: r,
|
|
219
228
|
apiKey: o,
|
|
220
|
-
variationId:
|
|
229
|
+
variationId: a !== r ? a : void 0
|
|
221
230
|
});
|
|
222
231
|
}
|
|
223
|
-
|
|
232
|
+
B() && f();
|
|
224
233
|
}
|
|
225
|
-
}, []),
|
|
226
|
-
}, [
|
|
227
|
-
|
|
228
|
-
}, [
|
|
229
|
-
|
|
230
|
-
}, [
|
|
231
|
-
|
|
232
|
-
locale:
|
|
234
|
+
}, []), l(() => {
|
|
235
|
+
}, [e.content]), l(() => {
|
|
236
|
+
m();
|
|
237
|
+
}, [e.builderContextSignal.rootState]), l(() => {
|
|
238
|
+
e.data && g(e.data);
|
|
239
|
+
}, [e.data]), l(() => {
|
|
240
|
+
e.locale && g({
|
|
241
|
+
locale: e.locale
|
|
233
242
|
});
|
|
234
|
-
}, [
|
|
243
|
+
}, [e.locale]), l(() => () => {
|
|
235
244
|
L() && (window.removeEventListener("message", v), window.removeEventListener(
|
|
236
245
|
"builder:component:stateChangeListenerActivated",
|
|
237
|
-
|
|
246
|
+
m
|
|
238
247
|
));
|
|
239
|
-
}, []), /* @__PURE__ */
|
|
240
|
-
|
|
248
|
+
}, []), /* @__PURE__ */ k(O.Provider, { value: e.builderContextSignal, children: e.builderContextSignal.content || q() ? /* @__PURE__ */ k(
|
|
249
|
+
D,
|
|
241
250
|
{
|
|
242
|
-
ref:
|
|
243
|
-
onClick: (n) =>
|
|
244
|
-
"builder-content-id": (
|
|
245
|
-
"builder-model":
|
|
246
|
-
className:
|
|
247
|
-
((
|
|
251
|
+
ref: c,
|
|
252
|
+
onClick: (n) => V(n),
|
|
253
|
+
"builder-content-id": (R = e.builderContextSignal.content) == null ? void 0 : R.id,
|
|
254
|
+
"builder-model": e.model,
|
|
255
|
+
className: Z(
|
|
256
|
+
((w = e.content) == null ? void 0 : w.testVariationId) || ((y = e.content) == null ? void 0 : y.id)
|
|
248
257
|
),
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
258
|
+
style: {
|
|
259
|
+
display: !e.builderContextSignal.content && q() ? "none" : void 0
|
|
260
|
+
},
|
|
261
|
+
...T(),
|
|
262
|
+
...e.contentWrapperProps,
|
|
263
|
+
children: e.children
|
|
252
264
|
}
|
|
253
265
|
) : null });
|
|
254
266
|
}
|
|
255
267
|
export {
|
|
256
|
-
|
|
268
|
+
we as default
|
|
257
269
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
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;
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { getDefaultRegisteredComponents as
|
|
3
|
-
import { evaluate as
|
|
4
|
-
import { serializeIncludingFunctions as
|
|
5
|
-
import { logger as
|
|
6
|
-
import
|
|
7
|
-
import { getUpdateVariantVisibilityScript as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import { getContentInitialValue as
|
|
12
|
-
function
|
|
13
|
-
var
|
|
14
|
-
const
|
|
1
|
+
import { jsxs as v, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { getDefaultRegisteredComponents as y } from "../../constants/builder-registered-components.mjs";
|
|
3
|
+
import { evaluate as h } from "../../functions/evaluate/evaluate.mjs";
|
|
4
|
+
import { serializeIncludingFunctions as g } from "../../functions/register-component.mjs";
|
|
5
|
+
import { logger as W } from "../../helpers/logger.mjs";
|
|
6
|
+
import P from "../blocks/blocks.mjs";
|
|
7
|
+
import { getUpdateVariantVisibilityScript as V } from "../content-variants/helpers.mjs";
|
|
8
|
+
import K from "../inlined-script.mjs";
|
|
9
|
+
import R from "./components/enable-editor.mjs";
|
|
10
|
+
import T from "./components/styles.mjs";
|
|
11
|
+
import { getContentInitialValue as N, getRootStateInitialValue as j } from "./content.helpers.mjs";
|
|
12
|
+
function G(t) {
|
|
13
|
+
var i, d, r, l, m, s, u, C, S, f, k;
|
|
14
|
+
const I = V({
|
|
15
15
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
16
|
-
variationId: (
|
|
16
|
+
variationId: (i = t.content) == null ? void 0 : i.testVariationId,
|
|
17
17
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
18
|
-
contentId: (
|
|
19
|
-
}),
|
|
20
|
-
...
|
|
21
|
-
...
|
|
18
|
+
contentId: (d = t.content) == null ? void 0 : d.id
|
|
19
|
+
}), b = [
|
|
20
|
+
...y(),
|
|
21
|
+
...t.customComponents || []
|
|
22
22
|
].reduce(
|
|
23
|
-
(
|
|
24
|
-
...
|
|
23
|
+
(n, { component: x, ...o }) => ({
|
|
24
|
+
...n,
|
|
25
25
|
[o.name]: {
|
|
26
|
-
component:
|
|
27
|
-
...
|
|
26
|
+
component: x,
|
|
27
|
+
...g(o)
|
|
28
28
|
}
|
|
29
29
|
}),
|
|
30
30
|
{}
|
|
31
|
-
),
|
|
32
|
-
content:
|
|
31
|
+
), e = {
|
|
32
|
+
content: N({
|
|
33
33
|
content: t.content,
|
|
34
34
|
data: t.data
|
|
35
35
|
}),
|
|
36
36
|
localState: void 0,
|
|
37
|
-
rootState:
|
|
37
|
+
rootState: j({
|
|
38
38
|
content: t.content,
|
|
39
39
|
data: t.data,
|
|
40
40
|
locale: t.locale
|
|
@@ -45,35 +45,36 @@ function L(t) {
|
|
|
45
45
|
apiKey: t.apiKey,
|
|
46
46
|
apiVersion: t.apiVersion,
|
|
47
47
|
componentInfos: [
|
|
48
|
-
...
|
|
49
|
-
...
|
|
48
|
+
...y(),
|
|
49
|
+
...t.customComponents || []
|
|
50
50
|
].reduce(
|
|
51
|
-
(
|
|
52
|
-
...
|
|
53
|
-
[o.name]:
|
|
51
|
+
(n, { component: x, ...o }) => ({
|
|
52
|
+
...n,
|
|
53
|
+
[o.name]: g(o)
|
|
54
54
|
}),
|
|
55
55
|
{}
|
|
56
56
|
),
|
|
57
57
|
inheritedStyles: {},
|
|
58
58
|
BlocksWrapper: t.blocksWrapper || "div",
|
|
59
59
|
BlocksWrapperProps: t.blocksWrapperProps || {},
|
|
60
|
-
nonce: t.nonce || ""
|
|
60
|
+
nonce: t.nonce || "",
|
|
61
|
+
model: t.model || ""
|
|
61
62
|
};
|
|
62
|
-
t.apiKey ||
|
|
63
|
+
t.apiKey || W.error(
|
|
63
64
|
"No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop."
|
|
64
65
|
);
|
|
65
|
-
const
|
|
66
|
-
return
|
|
67
|
-
code:
|
|
66
|
+
const c = (l = (r = e.content) == null ? void 0 : r.data) == null ? void 0 : l.jsCode;
|
|
67
|
+
return c && h({
|
|
68
|
+
code: c,
|
|
68
69
|
context: t.context || {},
|
|
69
70
|
localState: void 0,
|
|
70
|
-
rootState:
|
|
71
|
-
rootSetState: (
|
|
72
|
-
|
|
71
|
+
rootState: e.rootState,
|
|
72
|
+
rootSetState: (n) => {
|
|
73
|
+
e.rootState = n;
|
|
73
74
|
},
|
|
74
75
|
isExpression: !1
|
|
75
|
-
}), /* @__PURE__ */
|
|
76
|
-
|
|
76
|
+
}), /* @__PURE__ */ v(
|
|
77
|
+
R,
|
|
77
78
|
{
|
|
78
79
|
apiHost: t.apiHost,
|
|
79
80
|
nonce: t.nonce,
|
|
@@ -86,36 +87,36 @@ function L(t) {
|
|
|
86
87
|
locale: t.locale,
|
|
87
88
|
enrich: t.enrich,
|
|
88
89
|
showContent: t.showContent,
|
|
89
|
-
builderContextSignal:
|
|
90
|
+
builderContextSignal: e,
|
|
90
91
|
contentWrapper: t.contentWrapper,
|
|
91
92
|
contentWrapperProps: t.contentWrapperProps,
|
|
92
93
|
trustedHosts: t.trustedHosts,
|
|
93
94
|
isNestedRender: t.isNestedRender,
|
|
94
95
|
children: [
|
|
95
|
-
t.isSsrAbTest ? /* @__PURE__ */
|
|
96
|
-
|
|
96
|
+
t.isSsrAbTest ? /* @__PURE__ */ a(
|
|
97
|
+
K,
|
|
97
98
|
{
|
|
98
99
|
id: "builderio-variant-visibility",
|
|
99
|
-
scriptStr:
|
|
100
|
+
scriptStr: I,
|
|
100
101
|
nonce: t.nonce || ""
|
|
101
102
|
}
|
|
102
103
|
) : null,
|
|
103
|
-
/* @__PURE__ */
|
|
104
|
-
|
|
104
|
+
/* @__PURE__ */ a(
|
|
105
|
+
T,
|
|
105
106
|
{
|
|
106
107
|
nonce: t.nonce || "",
|
|
107
108
|
isNestedRender: t.isNestedRender,
|
|
108
|
-
contentId: (
|
|
109
|
-
cssCode: (
|
|
110
|
-
customFonts: (
|
|
109
|
+
contentId: (m = e.content) == null ? void 0 : m.id,
|
|
110
|
+
cssCode: (u = (s = e.content) == null ? void 0 : s.data) == null ? void 0 : u.cssCode,
|
|
111
|
+
customFonts: (S = (C = e.content) == null ? void 0 : C.data) == null ? void 0 : S.customFonts
|
|
111
112
|
}
|
|
112
113
|
),
|
|
113
|
-
/* @__PURE__ */
|
|
114
|
-
|
|
114
|
+
/* @__PURE__ */ a(
|
|
115
|
+
P,
|
|
115
116
|
{
|
|
116
|
-
blocks: (
|
|
117
|
-
context:
|
|
118
|
-
registeredComponents:
|
|
117
|
+
blocks: (k = (f = e.content) == null ? void 0 : f.data) == null ? void 0 : k.blocks,
|
|
118
|
+
context: e,
|
|
119
|
+
registeredComponents: b,
|
|
119
120
|
linkComponent: t.linkComponent
|
|
120
121
|
}
|
|
121
122
|
)
|
|
@@ -124,5 +125,5 @@ function L(t) {
|
|
|
124
125
|
);
|
|
125
126
|
}
|
|
126
127
|
export {
|
|
127
|
-
|
|
128
|
+
G as default
|
|
128
129
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=["jpeg","jpg","png","svg","webp","gif","jfif","pjpeg","pjp","apng","avif","tif","tiff","heif","bmp","eps","raw","cr2","nef","orf","sr2","psd","heic","dib","ai"],f=["mp4","webm","mkv","flv","vob","ogv","ogg","drc","gif","gifv","mng","avi","mov","qt","mts","m2ts","ts","wmv","yuv","rm","rmvb","viv","asf","amv","m4p","mpeg","mpe","m2v","m4v","svi","3gp","3g2","mxf","roq","nsv","f4v","f4p","f4a","f4b"];exports.IMAGE_FILE_TYPES=v;exports.VIDEO_FILE_TYPES=f;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const v = ["jpeg", "jpg", "png", "svg", "webp", "gif", "jfif", "pjpeg", "pjp", "apng", "avif", "tif", "tiff", "heif", "bmp", "eps", "raw", "cr2", "nef", "orf", "sr2", "psd", "heic", "dib", "ai"], f = ["mp4", "webm", "mkv", "flv", "vob", "ogv", "ogg", "drc", "gif", "gifv", "mng", "avi", "mov", "qt", "mts", "m2ts", "ts", "wmv", "yuv", "rm", "rmvb", "viv", "asf", "amv", "m4p", "mpeg", "mpe", "m2v", "m4v", "svi", "3gp", "3g2", "mxf", "roq", "nsv", "f4v", "f4p", "f4a", "f4b"];
|
|
2
|
+
export {
|
|
3
|
+
v as IMAGE_FILE_TYPES,
|
|
4
|
+
f as VIDEO_FILE_TYPES
|
|
5
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.17.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.17.2";exports.SDK_VERSION=e;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";const
|
|
1
|
+
"use client";"use strict";const e=require("react"),t=e.createContext({content:null,context:{},localState:void 0,rootSetState(){},rootState:{},apiKey:null,apiVersion:void 0,componentInfos:{},inheritedStyles:{},BlocksWrapper:"div",BlocksWrapperProps:{},nonce:"",model:""});module.exports=t;
|