@builder.io/sdk-react-nextjs 0.16.19 → 0.16.23
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 +3 -3
- package/lib/browser/blocks/columns/columns.mjs +42 -34
- package/lib/browser/components/blocks/blocks-wrapper.cjs +1 -1
- package/lib/browser/components/blocks/blocks-wrapper.mjs +26 -20
- package/lib/browser/components/content/components/enable-editor.cjs +1 -1
- package/lib/browser/components/content/components/enable-editor.mjs +58 -57
- package/lib/browser/constants/sdk-version.cjs +1 -1
- package/lib/browser/constants/sdk-version.mjs +1 -1
- package/lib/browser/functions/evaluate/node-runtime/node-runtime.cjs +3 -3
- package/lib/browser/functions/evaluate/node-runtime/node-runtime.mjs +16 -14
- package/lib/browser/functions/log-fetch.cjs +1 -0
- package/lib/browser/functions/log-fetch.mjs +8 -0
- package/lib/browser/functions/track/index.cjs +1 -1
- package/lib/browser/functions/track/index.mjs +18 -14
- package/lib/edge/blocks/columns/columns.cjs +3 -3
- package/lib/edge/blocks/columns/columns.mjs +42 -34
- package/lib/edge/components/blocks/blocks-wrapper.cjs +1 -1
- package/lib/edge/components/blocks/blocks-wrapper.mjs +26 -20
- package/lib/edge/components/content/components/enable-editor.cjs +1 -1
- package/lib/edge/components/content/components/enable-editor.mjs +58 -57
- package/lib/edge/constants/sdk-version.cjs +1 -1
- package/lib/edge/constants/sdk-version.mjs +1 -1
- package/lib/edge/functions/evaluate/node-runtime/node-runtime.cjs +3 -3
- package/lib/edge/functions/evaluate/node-runtime/node-runtime.mjs +16 -14
- package/lib/edge/functions/log-fetch.cjs +1 -0
- package/lib/edge/functions/log-fetch.mjs +8 -0
- package/lib/edge/functions/track/index.cjs +1 -1
- package/lib/edge/functions/track/index.mjs +18 -14
- package/lib/node/blocks/columns/columns.cjs +3 -3
- package/lib/node/blocks/columns/columns.mjs +42 -34
- package/lib/node/components/blocks/blocks-wrapper.cjs +1 -1
- package/lib/node/components/blocks/blocks-wrapper.mjs +26 -20
- package/lib/node/components/content/components/enable-editor.cjs +1 -1
- package/lib/node/components/content/components/enable-editor.mjs +58 -57
- package/lib/node/constants/sdk-version.cjs +1 -1
- package/lib/node/constants/sdk-version.mjs +1 -1
- package/lib/node/functions/evaluate/node-runtime/node-runtime.cjs +6 -6
- package/lib/node/functions/evaluate/node-runtime/node-runtime.mjs +20 -18
- package/lib/node/functions/log-fetch.cjs +1 -0
- package/lib/node/functions/log-fetch.mjs +8 -0
- package/lib/node/functions/track/index.cjs +1 -1
- package/lib/node/functions/track/index.mjs +18 -14
- package/package.json +1 -1
- package/types/cjs/constants/sdk-version.d.ts +1 -1
- package/types/cjs/functions/evaluate/node-runtime/setIvm.d.ts +1 -0
- package/types/cjs/functions/log-fetch.d.ts +1 -0
- package/types/esm/constants/sdk-version.d.ts +1 -1
- package/types/esm/functions/evaluate/node-runtime/setIvm.d.ts +1 -0
- package/types/esm/functions/log-fetch.d.ts +1 -0
|
@@ -7,44 +7,45 @@ import { fastClone as _ } from "../../../functions/fast-clone.mjs";
|
|
|
7
7
|
import { fetchOneEntry as D } 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
|
|
10
|
+
import { isPreviewing as F } from "../../../functions/is-previewing.mjs";
|
|
11
|
+
import { logFetch as O } from "../../../functions/log-fetch.mjs";
|
|
11
12
|
import { createRegisterComponentMessage as B } from "../../../functions/register-component.mjs";
|
|
12
13
|
import { _track as y } from "../../../functions/track/index.mjs";
|
|
13
|
-
import { getInteractionPropertiesForEvent as
|
|
14
|
+
import { getInteractionPropertiesForEvent as z } from "../../../functions/track/interaction.mjs";
|
|
14
15
|
import { getDefaultCanTrack as K } from "../../../helpers/canTrack.mjs";
|
|
15
|
-
import { postPreviewContent as
|
|
16
|
-
import { createEditorListener as
|
|
17
|
-
import { registerInsertMenu as
|
|
18
|
-
import { triggerAnimation as
|
|
19
|
-
import { getWrapperClassName as
|
|
20
|
-
import { useRouter as
|
|
21
|
-
function
|
|
16
|
+
import { postPreviewContent as $ } from "../../../helpers/preview-lru-cache/set.mjs";
|
|
17
|
+
import { createEditorListener as G } from "../../../helpers/subscribe-to-editor.mjs";
|
|
18
|
+
import { registerInsertMenu as J, setupBrowserForEditing as Q } from "../../../scripts/init-editing.mjs";
|
|
19
|
+
import { triggerAnimation as X } from "../../block/animator.mjs";
|
|
20
|
+
import { getWrapperClassName as Y } from "./styles.helpers.mjs";
|
|
21
|
+
import { useRouter as Z } from "next/navigation";
|
|
22
|
+
function It(t) {
|
|
22
23
|
var w, k, P;
|
|
23
24
|
const d = H(null);
|
|
24
25
|
function g(n) {
|
|
25
|
-
var
|
|
26
|
+
var r, i;
|
|
26
27
|
const e = {
|
|
27
28
|
...t.builderContextSignal.rootState,
|
|
28
29
|
...n
|
|
29
30
|
};
|
|
30
|
-
t.builderContextSignal.rootSetState ? (i = (
|
|
31
|
+
t.builderContextSignal.rootSetState ? (i = (r = t.builderContextSignal).rootSetState) == null || i.call(r, e) : t.builderContextSignal.rootState = e;
|
|
31
32
|
}
|
|
32
33
|
function b(n) {
|
|
33
|
-
var
|
|
34
|
+
var r, i, a, o, u;
|
|
34
35
|
const e = {
|
|
35
36
|
...t.builderContextSignal.content,
|
|
36
37
|
...n,
|
|
37
38
|
data: {
|
|
38
|
-
...(
|
|
39
|
+
...(r = t.builderContextSignal.content) == null ? void 0 : r.data,
|
|
39
40
|
...n == null ? void 0 : n.data
|
|
40
41
|
},
|
|
41
42
|
meta: {
|
|
42
43
|
...(i = t.builderContextSignal.content) == null ? void 0 : i.meta,
|
|
43
44
|
...n == null ? void 0 : n.meta,
|
|
44
|
-
breakpoints: ((
|
|
45
|
+
breakpoints: ((a = n == null ? void 0 : n.meta) == null ? void 0 : a.breakpoints) || ((u = (o = t.builderContextSignal.content) == null ? void 0 : o.meta) == null ? void 0 : u.breakpoints)
|
|
45
46
|
}
|
|
46
47
|
};
|
|
47
|
-
|
|
48
|
+
$({
|
|
48
49
|
value: e,
|
|
49
50
|
key: e.id
|
|
50
51
|
}).then(() => {
|
|
@@ -57,25 +58,25 @@ function Ct(t) {
|
|
|
57
58
|
"aria-hidden": !0
|
|
58
59
|
};
|
|
59
60
|
}
|
|
60
|
-
const [T,
|
|
61
|
+
const [T, p] = m(
|
|
61
62
|
() => t.contentWrapper || "div"
|
|
62
63
|
);
|
|
63
64
|
function v(n) {
|
|
64
|
-
return
|
|
65
|
+
return G({
|
|
65
66
|
model: t.model,
|
|
66
67
|
trustedHosts: t.trustedHosts,
|
|
67
68
|
callbacks: {
|
|
68
69
|
configureSdk: (e) => {
|
|
69
|
-
var
|
|
70
|
-
const { breakpoints:
|
|
71
|
-
!i || i !== ((
|
|
70
|
+
var a;
|
|
71
|
+
const { breakpoints: r, contentId: i } = e;
|
|
72
|
+
!i || i !== ((a = t.builderContextSignal.content) == null ? void 0 : a.id) || r && b({
|
|
72
73
|
meta: {
|
|
73
|
-
breakpoints:
|
|
74
|
+
breakpoints: r
|
|
74
75
|
}
|
|
75
76
|
});
|
|
76
77
|
},
|
|
77
78
|
animation: (e) => {
|
|
78
|
-
|
|
79
|
+
X(e);
|
|
79
80
|
},
|
|
80
81
|
contentUpdate: (e) => {
|
|
81
82
|
b(e);
|
|
@@ -83,32 +84,32 @@ function Ct(t) {
|
|
|
83
84
|
}
|
|
84
85
|
})(n);
|
|
85
86
|
}
|
|
86
|
-
const [h,
|
|
87
|
+
const [h, tt] = m(() => ({})), [S, et] = m(() => ({})), [x, V] = m(() => !1);
|
|
87
88
|
function M(n) {
|
|
88
|
-
var e,
|
|
89
|
+
var e, r;
|
|
89
90
|
if (t.builderContextSignal.content) {
|
|
90
|
-
const i = (e = t.builderContextSignal.content) == null ? void 0 : e.testVariationId,
|
|
91
|
+
const i = (e = t.builderContextSignal.content) == null ? void 0 : e.testVariationId, a = (r = t.builderContextSignal.content) == null ? void 0 : r.id;
|
|
91
92
|
y({
|
|
92
93
|
apiHost: t.apiHost,
|
|
93
94
|
type: "click",
|
|
94
95
|
canTrack: K(t.canTrack),
|
|
95
|
-
contentId:
|
|
96
|
+
contentId: a,
|
|
96
97
|
apiKey: t.apiKey,
|
|
97
|
-
variationId: i !==
|
|
98
|
-
...
|
|
98
|
+
variationId: i !== a ? i : void 0,
|
|
99
|
+
...z(n),
|
|
99
100
|
unique: !x
|
|
100
101
|
});
|
|
101
102
|
}
|
|
102
103
|
x || V(!0);
|
|
103
104
|
}
|
|
104
105
|
function N() {
|
|
105
|
-
var e,
|
|
106
|
-
const n = (i = (
|
|
107
|
-
Object.entries(n).forEach(([
|
|
108
|
-
if (!o || S[
|
|
106
|
+
var e, r, i;
|
|
107
|
+
const n = (i = (r = (e = t.builderContextSignal.content) == null ? void 0 : e.data) == null ? void 0 : r.httpRequests) != null ? i : {};
|
|
108
|
+
Object.entries(n).forEach(([a, o]) => {
|
|
109
|
+
if (!o || S[a] || h[a] && !f())
|
|
109
110
|
return;
|
|
110
|
-
S[
|
|
111
|
-
const
|
|
111
|
+
S[a] = !0;
|
|
112
|
+
const u = o.replace(
|
|
112
113
|
/{{([^}]+)}}/g,
|
|
113
114
|
(l, j) => String(
|
|
114
115
|
U({
|
|
@@ -120,18 +121,18 @@ function Ct(t) {
|
|
|
120
121
|
})
|
|
121
122
|
)
|
|
122
123
|
);
|
|
123
|
-
fetch(
|
|
124
|
+
O(u), fetch(u).then((l) => l.json()).then((l) => {
|
|
124
125
|
g({
|
|
125
|
-
[
|
|
126
|
-
}), h[
|
|
126
|
+
[a]: l
|
|
127
|
+
}), h[a] = !0;
|
|
127
128
|
}).catch((l) => {
|
|
128
129
|
console.error("error fetching dynamic data", o, l);
|
|
129
130
|
}).finally(() => {
|
|
130
|
-
S[
|
|
131
|
+
S[a] = !1;
|
|
131
132
|
});
|
|
132
133
|
});
|
|
133
134
|
}
|
|
134
|
-
function
|
|
135
|
+
function s() {
|
|
135
136
|
f() && window.dispatchEvent(
|
|
136
137
|
new CustomEvent(
|
|
137
138
|
"builder:component:stateChange",
|
|
@@ -147,7 +148,7 @@ function Ct(t) {
|
|
|
147
148
|
);
|
|
148
149
|
}
|
|
149
150
|
function C(n) {
|
|
150
|
-
window.addEventListener("message", v),
|
|
151
|
+
window.addEventListener("message", v), J(), Q({
|
|
151
152
|
...t.locale ? {
|
|
152
153
|
locale: t.locale
|
|
153
154
|
} : {},
|
|
@@ -161,18 +162,18 @@ function Ct(t) {
|
|
|
161
162
|
t.builderContextSignal.componentInfos
|
|
162
163
|
).forEach((e) => {
|
|
163
164
|
var i;
|
|
164
|
-
const
|
|
165
|
-
(i = window.parent) == null || i.postMessage(
|
|
165
|
+
const r = B(e);
|
|
166
|
+
(i = window.parent) == null || i.postMessage(r, "*");
|
|
166
167
|
}), window.addEventListener(
|
|
167
168
|
"builder:component:stateChangeListenerActivated",
|
|
168
|
-
|
|
169
|
+
s
|
|
169
170
|
);
|
|
170
171
|
}
|
|
171
172
|
function E(n) {
|
|
172
|
-
const e = new URL(location.href).searchParams,
|
|
173
|
-
`builder.overrides.${
|
|
174
|
-
),
|
|
175
|
-
|
|
173
|
+
const e = new URL(location.href).searchParams, r = e.get("builder.preview"), i = e.get(
|
|
174
|
+
`builder.overrides.${r}`
|
|
175
|
+
), a = e.get("apiKey") || e.get("builder.space");
|
|
176
|
+
r === t.model && a === t.apiKey && (!t.content || i === t.content.id) && D({
|
|
176
177
|
model: t.model,
|
|
177
178
|
apiKey: t.apiKey,
|
|
178
179
|
apiVersion: t.builderContextSignal.apiVersion
|
|
@@ -180,8 +181,8 @@ function Ct(t) {
|
|
|
180
181
|
o && b(o);
|
|
181
182
|
});
|
|
182
183
|
}
|
|
183
|
-
const W =
|
|
184
|
-
return I.current || (N(),
|
|
184
|
+
const W = Z(), I = H(!1);
|
|
185
|
+
return I.current || (N(), s(), I.current = !0), c(() => {
|
|
185
186
|
var n;
|
|
186
187
|
return (n = d.current) == null || n.addEventListener(
|
|
187
188
|
"initeditingbldr",
|
|
@@ -209,21 +210,21 @@ function Ct(t) {
|
|
|
209
210
|
var n, e;
|
|
210
211
|
if (L()) {
|
|
211
212
|
if (f() && !t.isNestedRender && d.current && d.current.dispatchEvent(new CustomEvent("initeditingbldr")), t.builderContextSignal.content && K(t.canTrack)) {
|
|
212
|
-
const i = (n = t.builderContextSignal.content) == null ? void 0 : n.testVariationId,
|
|
213
|
+
const i = (n = t.builderContextSignal.content) == null ? void 0 : n.testVariationId, a = (e = t.builderContextSignal.content) == null ? void 0 : e.id, o = t.apiKey;
|
|
213
214
|
y({
|
|
214
215
|
apiHost: t.apiHost,
|
|
215
216
|
type: "impression",
|
|
216
217
|
canTrack: !0,
|
|
217
|
-
contentId:
|
|
218
|
+
contentId: a,
|
|
218
219
|
apiKey: o,
|
|
219
|
-
variationId: i !==
|
|
220
|
+
variationId: i !== a ? i : void 0
|
|
220
221
|
});
|
|
221
222
|
}
|
|
222
|
-
|
|
223
|
+
F() && f();
|
|
223
224
|
}
|
|
224
225
|
}, []), c(() => {
|
|
225
226
|
}, [t.content]), c(() => {
|
|
226
|
-
|
|
227
|
+
s();
|
|
227
228
|
}, [t.builderContextSignal.rootState]), c(() => {
|
|
228
229
|
t.data && g(t.data);
|
|
229
230
|
}, [t.data]), c(() => {
|
|
@@ -233,7 +234,7 @@ function Ct(t) {
|
|
|
233
234
|
}, [t.locale]), c(() => () => {
|
|
234
235
|
L() && (window.removeEventListener("message", v), window.removeEventListener(
|
|
235
236
|
"builder:component:stateChangeListenerActivated",
|
|
236
|
-
|
|
237
|
+
s
|
|
237
238
|
));
|
|
238
239
|
}, []), /* @__PURE__ */ R(A.Provider, { value: t.builderContextSignal, children: t.builderContextSignal.content ? /* @__PURE__ */ R(
|
|
239
240
|
T,
|
|
@@ -242,7 +243,7 @@ function Ct(t) {
|
|
|
242
243
|
onClick: (n) => M(n),
|
|
243
244
|
"builder-content-id": (w = t.builderContextSignal.content) == null ? void 0 : w.id,
|
|
244
245
|
"builder-model": t.model,
|
|
245
|
-
className:
|
|
246
|
+
className: Y(
|
|
246
247
|
((k = t.content) == null ? void 0 : k.testVariationId) || ((P = t.content) == null ? void 0 : P.id)
|
|
247
248
|
),
|
|
248
249
|
...q(),
|
|
@@ -252,5 +253,5 @@ function Ct(t) {
|
|
|
252
253
|
) : null });
|
|
253
254
|
}
|
|
254
255
|
export {
|
|
255
|
-
|
|
256
|
+
It as default
|
|
256
257
|
};
|
|
@@ -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.23";exports.SDK_VERSION=e;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../../constants/sdk-name.cjs"),l=require("../../../helpers/logger.cjs"),c=require("./safeDynamicRequire.cjs"),d="BUILDER_IVM";let n=null,s=null;const u=(t,e={})=>{n||(n=t,S(e))},m=o.SDK_NAME==="@builder.io/sdk-react-nextjs"||o.SDK_NAME==="@builder.io/sdk-react"||o.SDK_NAME==="@builder.io/sdk-qwik"||o.SDK_NAME==="@builder.io/sdk-vue",I=()=>{try{if(n)return n;const e=c.safeDynamicRequire("isolated-vm");if(e)return e}catch(e){l.logger.error("isolated-vm import error.",e)}const t=`${l.MSG_PREFIX}could not import \`isolated-vm\` module for safe script execution on a Node server.
|
|
2
2
|
|
|
3
3
|
SOLUTION: In a server-only execution path within your application, do one of the following:
|
|
4
4
|
|
|
5
|
-
${m?`- import and call \`initializeNodeRuntime()\` from "${
|
|
5
|
+
${m?`- import and call \`initializeNodeRuntime()\` from "${o.SDK_NAME}/node/init".`:""}
|
|
6
6
|
- add the following import: \`await import('isolated-vm')\`.
|
|
7
7
|
|
|
8
|
-
For more information, visit https://builder.io/c/docs/integration-tips#enabling-data-bindings-in-node-environments`;throw new Error(
|
|
8
|
+
For more information, visit https://builder.io/c/docs/integration-tips#enabling-data-bindings-in-node-environments`;throw new Error(t)};function S(t={memoryLimit:128}){if(s)return s;const e=I(),r=new e.Isolate(t).createContextSync(),i=r.global;return i.setSync("global",i.derefInto()),i.setSync("log",function(...a){console.log(...a)}),i.setSync(d,e),s=r,r}exports.setIvm=u;
|
|
@@ -1,38 +1,40 @@
|
|
|
1
1
|
import { SDK_NAME as e } from "../../../constants/sdk-name.mjs";
|
|
2
|
-
import { logger as
|
|
3
|
-
import { safeDynamicRequire as
|
|
4
|
-
const
|
|
5
|
-
let n = null;
|
|
6
|
-
const
|
|
7
|
-
n = t,
|
|
8
|
-
},
|
|
2
|
+
import { logger as a, MSG_PREFIX as c } from "../../../helpers/logger.mjs";
|
|
3
|
+
import { safeDynamicRequire as d } from "./safeDynamicRequire.mjs";
|
|
4
|
+
const m = "BUILDER_IVM";
|
|
5
|
+
let n = null, l = null;
|
|
6
|
+
const S = (t, o = {}) => {
|
|
7
|
+
n || (n = t, f(o));
|
|
8
|
+
}, u = e === "@builder.io/sdk-react-nextjs" || e === "@builder.io/sdk-react" || e === "@builder.io/sdk-qwik" || e === "@builder.io/sdk-vue", I = () => {
|
|
9
9
|
try {
|
|
10
10
|
if (n)
|
|
11
11
|
return n;
|
|
12
|
-
const o =
|
|
12
|
+
const o = d("isolated-vm");
|
|
13
13
|
if (o)
|
|
14
14
|
return o;
|
|
15
15
|
} catch (o) {
|
|
16
|
-
|
|
16
|
+
a.error("isolated-vm import error.", o);
|
|
17
17
|
}
|
|
18
|
-
const t = `${
|
|
18
|
+
const t = `${c}could not import \`isolated-vm\` module for safe script execution on a Node server.
|
|
19
19
|
|
|
20
20
|
SOLUTION: In a server-only execution path within your application, do one of the following:
|
|
21
21
|
|
|
22
|
-
${
|
|
22
|
+
${u ? `- import and call \`initializeNodeRuntime()\` from "${e}/node/init".` : ""}
|
|
23
23
|
- add the following import: \`await import('isolated-vm')\`.
|
|
24
24
|
|
|
25
25
|
For more information, visit https://builder.io/c/docs/integration-tips#enabling-data-bindings-in-node-environments`;
|
|
26
26
|
throw new Error(t);
|
|
27
27
|
};
|
|
28
|
-
function
|
|
28
|
+
function f(t = {
|
|
29
29
|
memoryLimit: 128
|
|
30
30
|
}) {
|
|
31
|
+
if (l)
|
|
32
|
+
return l;
|
|
31
33
|
const o = I(), r = new o.Isolate(t).createContextSync(), i = r.global;
|
|
32
34
|
return i.setSync("global", i.derefInto()), i.setSync("log", function(...s) {
|
|
33
35
|
console.log(...s);
|
|
34
|
-
}), i.setSync(
|
|
36
|
+
}), i.setSync(m, o), l = r, r;
|
|
35
37
|
}
|
|
36
38
|
export {
|
|
37
|
-
|
|
39
|
+
S as setIvm
|
|
38
40
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../helpers/logger.cjs");function t(o){var e;typeof process!="undefined"&&((e=process.env)!=null&&e.DEBUG)&&String(process.env.DEBUG)=="true"&&r.logger.log(o)}exports.logFetch=t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../../constants/target.cjs"),a=require("../../helpers/logger.cjs"),c=require("../../helpers/sdk-headers.cjs"),d=require("../../helpers/sessionId.cjs"),u=require("../../helpers/visitorId.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../../constants/target.cjs"),a=require("../../helpers/logger.cjs"),c=require("../../helpers/sdk-headers.cjs"),d=require("../../helpers/sessionId.cjs"),u=require("../../helpers/visitorId.cjs"),l=require("../is-browser.cjs"),g=require("../is-editing.cjs"),y=require("../log-fetch.cjs"),I=require("./helpers.cjs"),k=async({canTrack:e})=>{if(!e)return{visitorId:void 0,sessionId:void 0};const t=await d.getSessionId({canTrack:e}),r=u.getVisitorId({canTrack:e});return{sessionId:t,visitorId:r}},f=async({type:e,canTrack:t,apiKey:r,metadata:s,...i})=>({type:e,data:{...i,metadata:{url:location.href,...s},...await k({canTrack:t}),userAttributes:I.getUserAttributes(),ownerId:r}});async function o({apiHost:e,...t}){if(!t.apiKey){a.logger.error("Missing API key for track call. Please provide your API key.");return}if(!t.canTrack||g.isEditing()||!(l.isBrowser()||n.TARGET==="reactNative"))return;const s=`${e||"https://cdn.builder.io"}/api/v1/track`;return y.logFetch(s),fetch(s,{method:"POST",body:JSON.stringify({events:[await f(t)]}),headers:{"content-type":"application/json",...c.getSdkHeaders()},mode:"cors"}).catch(i=>{console.error("Failed to track: ",i)})}const v=e=>o({...e,canTrack:!0});exports._track=o;exports.track=v;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { TARGET as
|
|
2
|
-
import { logger as
|
|
1
|
+
import { TARGET as s } from "../../constants/target.mjs";
|
|
2
|
+
import { logger as a } from "../../helpers/logger.mjs";
|
|
3
3
|
import { getSdkHeaders as n } from "../../helpers/sdk-headers.mjs";
|
|
4
4
|
import { getSessionId as c } from "../../helpers/sessionId.mjs";
|
|
5
5
|
import { getVisitorId as d } from "../../helpers/visitorId.mjs";
|
|
6
6
|
import { isBrowser as m } from "../is-browser.mjs";
|
|
7
7
|
import { isEditing as f } from "../is-editing.mjs";
|
|
8
|
-
import {
|
|
9
|
-
|
|
8
|
+
import { logFetch as p } from "../log-fetch.mjs";
|
|
9
|
+
import { getUserAttributes as u } from "./helpers.mjs";
|
|
10
|
+
const l = async ({
|
|
10
11
|
canTrack: t
|
|
11
12
|
}) => {
|
|
12
13
|
if (!t)
|
|
@@ -23,7 +24,7 @@ const u = async ({
|
|
|
23
24
|
sessionId: r,
|
|
24
25
|
visitorId: e
|
|
25
26
|
};
|
|
26
|
-
},
|
|
27
|
+
}, g = async ({
|
|
27
28
|
type: t,
|
|
28
29
|
canTrack: r,
|
|
29
30
|
apiKey: e,
|
|
@@ -37,10 +38,10 @@ const u = async ({
|
|
|
37
38
|
url: location.href,
|
|
38
39
|
...o
|
|
39
40
|
},
|
|
40
|
-
...await
|
|
41
|
+
...await l({
|
|
41
42
|
canTrack: r
|
|
42
43
|
}),
|
|
43
|
-
userAttributes:
|
|
44
|
+
userAttributes: u(),
|
|
44
45
|
ownerId: e
|
|
45
46
|
}
|
|
46
47
|
});
|
|
@@ -49,28 +50,31 @@ async function y({
|
|
|
49
50
|
...r
|
|
50
51
|
}) {
|
|
51
52
|
if (!r.apiKey) {
|
|
52
|
-
|
|
53
|
+
a.error("Missing API key for track call. Please provide your API key.");
|
|
53
54
|
return;
|
|
54
55
|
}
|
|
55
|
-
|
|
56
|
+
if (!r.canTrack || f() || !(m() || s === "reactNative"))
|
|
57
|
+
return;
|
|
58
|
+
const o = `${t || "https://cdn.builder.io"}/api/v1/track`;
|
|
59
|
+
return p(o), fetch(o, {
|
|
56
60
|
method: "POST",
|
|
57
61
|
body: JSON.stringify({
|
|
58
|
-
events: [await
|
|
62
|
+
events: [await g(r)]
|
|
59
63
|
}),
|
|
60
64
|
headers: {
|
|
61
65
|
"content-type": "application/json",
|
|
62
66
|
...n()
|
|
63
67
|
},
|
|
64
68
|
mode: "cors"
|
|
65
|
-
}).catch((
|
|
66
|
-
console.error("Failed to track: ",
|
|
69
|
+
}).catch((i) => {
|
|
70
|
+
console.error("Failed to track: ", i);
|
|
67
71
|
});
|
|
68
72
|
}
|
|
69
|
-
const
|
|
73
|
+
const T = (t) => y({
|
|
70
74
|
...t,
|
|
71
75
|
canTrack: !0
|
|
72
76
|
});
|
|
73
77
|
export {
|
|
74
78
|
y as _track,
|
|
75
|
-
|
|
79
|
+
T as track
|
|
76
80
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const o=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";const o=require("react/jsx-runtime"),W=require("../../components/blocks/blocks.cjs"),j=require("../../components/dynamic-renderer/dynamic-renderer.cjs"),q=require("../../components/inlined-styles.cjs"),z=require("../../constants/device-sizes.cjs"),B=require("../../functions/get-class-prop-name.cjs"),p=require("../../functions/get-style.cjs"),A=require("./helpers.cjs");function N(e){var g,f;const a=function(){return typeof e.space=="number"?e.space||0:20},s=function(){return e.columns||[]},u=function(){return e.stackColumnsAt||"tablet"},y=function(t){return t.link?e.builderLinkComponent||"a":"div"},S=function(t){var i;return((i=s()[t])==null?void 0:i.width)||100/s().length},x=function(t){const i=S(t),l=a()*(s().length-1)*(i/100);return`calc(${i}% - ${l}px)`},c=function({stackedStyle:t,desktopStyle:i}){return u()==="tablet"?t:i},m=function({stackedStyle:t,desktopStyle:i}){return u()==="never"?i:t},d=function(){return e.stackColumnsAt==="never"?"row":e.reverseColumnsWhenStacked?"column-reverse":"column"},C=function(){return{"--flex-dir":d(),"--flex-dir-tablet":c({stackedStyle:d(),desktopStyle:"row"})}},v=function(t){const i=t===0?0:a(),l=x(t),r=`${i}px`,k="100%",h=0;return{...{display:"flex",flexDirection:"column",alignItems:"stretch"},width:l,["marginLeft"]:r,"--column-width-mobile":m({stackedStyle:k,desktopStyle:l}),"--column-margin-left-mobile":m({stackedStyle:h,desktopStyle:r}),"--column-width-tablet":c({stackedStyle:k,desktopStyle:l}),"--column-margin-left-tablet":c({stackedStyle:h,desktopStyle:r})}},b=function(t){var l,r;return z.getSizesForBreakpoints(((r=(l=e.builderContext.content)==null?void 0:l.meta)==null?void 0:r.breakpoints)||{})[t].max},w=function(){const t=`.${e.builderBlock.id}-breakpoints > .builder-column`;return`
|
|
2
2
|
@media (max-width: ${b("medium")}px) {
|
|
3
3
|
.${e.builderBlock.id}-breakpoints {
|
|
4
4
|
flex-direction: var(--flex-dir-tablet);
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
margin-left: var(--column-margin-left-mobile) !important;
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
|
-
`},$=function(t,
|
|
25
|
+
`},$=function(t,i){return{...t.link?{href:t.link}:{},[B.getClassPropName()]:"builder-column",style:p.mapStyleObjToStrIfNeeded(v(i))}};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:A.getColumnsClass((g=e.builderBlock)==null?void 0:g.id)+" div-6e395700",style:C(),children:[o.jsx(q,{id:"builderio-columns",styles:w(),nonce:e.builderContext.nonce}),(f=e.columns)==null?void 0:f.map((n,t)=>o.jsx(j,{TagName:y(n),actionAttributes:{},attributes:$(n,t),children:o.jsx(W,{path:`columns.${t}.blocks`,parent:e.builderBlock.id,styleProp:{flexGrow:"1"},context:e.builderContext,registeredComponents:e.builderComponents,linkComponent:e.builderLinkComponent,blocks:n.blocks})},t))]}),o.jsx("style",{children:`.div-6e395700 {
|
|
26
26
|
display: flex;
|
|
27
27
|
line-height: normal;
|
|
28
|
-
}`})]})}module.exports=
|
|
28
|
+
}`})]})}module.exports=N;
|
|
@@ -7,35 +7,43 @@ import { getClassPropName as N } from "../../functions/get-class-prop-name.mjs";
|
|
|
7
7
|
import { mapStyleObjToStrIfNeeded as T } from "../../functions/get-style.mjs";
|
|
8
8
|
import { getColumnsClass as D } from "./helpers.mjs";
|
|
9
9
|
function q(e) {
|
|
10
|
-
var
|
|
11
|
-
const a =
|
|
10
|
+
var b, g;
|
|
11
|
+
const a = function() {
|
|
12
|
+
return typeof e.space == "number" ? e.space || 0 : 20;
|
|
13
|
+
}, s = function() {
|
|
14
|
+
return e.columns || [];
|
|
15
|
+
}, m = function() {
|
|
16
|
+
return e.stackColumnsAt || "tablet";
|
|
17
|
+
}, S = function(t) {
|
|
12
18
|
return t.link ? e.builderLinkComponent || "a" : "div";
|
|
13
|
-
}, C = function(t) {
|
|
14
|
-
var n;
|
|
15
|
-
return ((n = s[t]) == null ? void 0 : n.width) || 100 / s.length;
|
|
16
19
|
}, x = function(t) {
|
|
17
|
-
|
|
18
|
-
return
|
|
20
|
+
var i;
|
|
21
|
+
return ((i = s()[t]) == null ? void 0 : i.width) || 100 / s().length;
|
|
22
|
+
}, C = function(t) {
|
|
23
|
+
const i = x(t), l = a() * (s().length - 1) * (i / 100);
|
|
24
|
+
return `calc(${i}% - ${l}px)`;
|
|
19
25
|
}, c = function({
|
|
20
26
|
stackedStyle: t,
|
|
21
|
-
desktopStyle:
|
|
27
|
+
desktopStyle: i
|
|
22
28
|
}) {
|
|
23
|
-
return m === "tablet" ? t :
|
|
24
|
-
},
|
|
29
|
+
return m() === "tablet" ? t : i;
|
|
30
|
+
}, u = function({
|
|
25
31
|
stackedStyle: t,
|
|
26
|
-
desktopStyle:
|
|
32
|
+
desktopStyle: i
|
|
27
33
|
}) {
|
|
28
|
-
return m === "never" ?
|
|
29
|
-
},
|
|
34
|
+
return m() === "never" ? i : t;
|
|
35
|
+
}, d = function() {
|
|
36
|
+
return e.stackColumnsAt === "never" ? "row" : e.reverseColumnsWhenStacked ? "column-reverse" : "column";
|
|
37
|
+
}, v = function() {
|
|
30
38
|
return {
|
|
31
|
-
"--flex-dir":
|
|
39
|
+
"--flex-dir": d(),
|
|
32
40
|
"--flex-dir-tablet": c({
|
|
33
|
-
stackedStyle:
|
|
41
|
+
stackedStyle: d(),
|
|
34
42
|
desktopStyle: "row"
|
|
35
43
|
})
|
|
36
44
|
};
|
|
37
|
-
},
|
|
38
|
-
const
|
|
45
|
+
}, w = function(t) {
|
|
46
|
+
const i = t === 0 ? 0 : a(), l = C(t), o = `${i}px`, k = "100%", h = 0;
|
|
39
47
|
return {
|
|
40
48
|
...{
|
|
41
49
|
display: "flex",
|
|
@@ -44,11 +52,11 @@ function q(e) {
|
|
|
44
52
|
},
|
|
45
53
|
width: l,
|
|
46
54
|
["marginLeft"]: o,
|
|
47
|
-
"--column-width-mobile":
|
|
55
|
+
"--column-width-mobile": u({
|
|
48
56
|
stackedStyle: k,
|
|
49
57
|
desktopStyle: l
|
|
50
58
|
}),
|
|
51
|
-
"--column-margin-left-mobile":
|
|
59
|
+
"--column-margin-left-mobile": u({
|
|
52
60
|
stackedStyle: h,
|
|
53
61
|
desktopStyle: o
|
|
54
62
|
}),
|
|
@@ -61,15 +69,15 @@ function q(e) {
|
|
|
61
69
|
desktopStyle: o
|
|
62
70
|
})
|
|
63
71
|
};
|
|
64
|
-
},
|
|
72
|
+
}, f = function(t) {
|
|
65
73
|
var l, o;
|
|
66
74
|
return L(
|
|
67
75
|
((o = (l = e.builderContext.content) == null ? void 0 : l.meta) == null ? void 0 : o.breakpoints) || {}
|
|
68
76
|
)[t].max;
|
|
69
|
-
},
|
|
77
|
+
}, p = function() {
|
|
70
78
|
const t = `.${e.builderBlock.id}-breakpoints > .builder-column`;
|
|
71
79
|
return `
|
|
72
|
-
@media (max-width: ${
|
|
80
|
+
@media (max-width: ${f("medium")}px) {
|
|
73
81
|
.${e.builderBlock.id}-breakpoints {
|
|
74
82
|
flex-direction: var(--flex-dir-tablet);
|
|
75
83
|
align-items: stretch;
|
|
@@ -81,7 +89,7 @@ function q(e) {
|
|
|
81
89
|
}
|
|
82
90
|
}
|
|
83
91
|
|
|
84
|
-
@media (max-width: ${
|
|
92
|
+
@media (max-width: ${f("small")}px) {
|
|
85
93
|
.${e.builderBlock.id}-breakpoints {
|
|
86
94
|
flex-direction: var(--flex-dir);
|
|
87
95
|
align-items: stretch;
|
|
@@ -93,40 +101,40 @@ function q(e) {
|
|
|
93
101
|
}
|
|
94
102
|
},
|
|
95
103
|
`;
|
|
96
|
-
}, $ = function(t,
|
|
104
|
+
}, $ = function(t, i) {
|
|
97
105
|
return {
|
|
98
106
|
...t.link ? {
|
|
99
107
|
href: t.link
|
|
100
108
|
} : {},
|
|
101
109
|
[N()]: "builder-column",
|
|
102
|
-
style: T(
|
|
110
|
+
style: T(w(i))
|
|
103
111
|
};
|
|
104
112
|
};
|
|
105
113
|
return /* @__PURE__ */ y(B, { children: [
|
|
106
114
|
/* @__PURE__ */ y(
|
|
107
115
|
"div",
|
|
108
116
|
{
|
|
109
|
-
className: D((
|
|
110
|
-
style:
|
|
117
|
+
className: D((b = e.builderBlock) == null ? void 0 : b.id) + " div-6e395700",
|
|
118
|
+
style: v(),
|
|
111
119
|
children: [
|
|
112
120
|
/* @__PURE__ */ r(
|
|
113
121
|
A,
|
|
114
122
|
{
|
|
115
123
|
id: "builderio-columns",
|
|
116
|
-
styles:
|
|
124
|
+
styles: p(),
|
|
117
125
|
nonce: e.builderContext.nonce
|
|
118
126
|
}
|
|
119
127
|
),
|
|
120
|
-
(g = e.columns) == null ? void 0 : g.map((
|
|
128
|
+
(g = e.columns) == null ? void 0 : g.map((n, t) => /* @__PURE__ */ r(
|
|
121
129
|
z,
|
|
122
130
|
{
|
|
123
|
-
TagName: S(
|
|
131
|
+
TagName: S(n),
|
|
124
132
|
actionAttributes: {},
|
|
125
|
-
attributes: $(
|
|
133
|
+
attributes: $(n, t),
|
|
126
134
|
children: /* @__PURE__ */ r(
|
|
127
135
|
W,
|
|
128
136
|
{
|
|
129
|
-
path: `
|
|
137
|
+
path: `columns.${t}.blocks`,
|
|
130
138
|
parent: e.builderBlock.id,
|
|
131
139
|
styleProp: {
|
|
132
140
|
flexGrow: "1"
|
|
@@ -134,7 +142,7 @@ function q(e) {
|
|
|
134
142
|
context: e.builderContext,
|
|
135
143
|
registeredComponents: e.builderComponents,
|
|
136
144
|
linkComponent: e.builderLinkComponent,
|
|
137
|
-
blocks:
|
|
145
|
+
blocks: n.blocks
|
|
138
146
|
}
|
|
139
147
|
)
|
|
140
148
|
},
|
|
@@ -143,7 +151,7 @@ function q(e) {
|
|
|
143
151
|
]
|
|
144
152
|
}
|
|
145
153
|
),
|
|
146
|
-
/* @__PURE__ */ r("style", { children: `.div-
|
|
154
|
+
/* @__PURE__ */ r("style", { children: `.div-6e395700 {
|
|
147
155
|
display: flex;
|
|
148
156
|
line-height: normal;
|
|
149
157
|
}` })
|