@builder.io/sdk-react 2.0.28 → 2.0.30
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-exports.cjs +18 -18
- package/lib/browser/blocks-exports.mjs +819 -814
- package/lib/browser/index.cjs +1 -1
- package/lib/browser/index.mjs +1 -1
- package/lib/browser/{server-entry-ffd47885.js → server-entry-d133a206.js} +104 -95
- package/lib/browser/server-entry-d4ea1a12.cjs +2 -0
- package/lib/browser/server-entry.cjs +1 -1
- package/lib/browser/server-entry.mjs +1 -1
- package/lib/edge/{accordion-616460c1.js → accordion-359367e6.js} +5 -3
- package/lib/edge/{accordion-7ef6a928.cjs → accordion-93512a19.cjs} +1 -1
- package/lib/edge/{blocks-896a56b0.cjs → blocks-44a0617b.cjs} +3 -3
- package/lib/edge/{blocks-dd91ae28.js → blocks-d7ba8f6a.js} +63 -57
- package/lib/edge/blocks-exports.cjs +1 -1
- package/lib/edge/blocks-exports.mjs +2 -2
- package/lib/edge/{button-1fa8b647.cjs → button-0ae65c1d.cjs} +1 -1
- package/lib/edge/{button-f917a1c0.js → button-ae26a553.js} +2 -2
- package/lib/edge/{columns-dacb342b.js → columns-957c0468.js} +20 -20
- package/lib/edge/{columns-5756d7b8.cjs → columns-f7da8908.cjs} +3 -3
- package/lib/edge/{content-variants-afc4a718.cjs → content-variants-9bb0b7e9.cjs} +4 -4
- package/lib/edge/{content-variants-cd80b703.js → content-variants-d8a859a2.js} +118 -118
- package/lib/edge/{evaluate-2fcda9ec.cjs → evaluate-21c48a1d.cjs} +1 -1
- package/lib/edge/{evaluate-17c2cadd.js → evaluate-8e8c9fec.js} +1 -1
- package/lib/edge/form-0b09120c.cjs +1 -0
- package/lib/edge/{form-dc7f56c9.js → form-68fc4d5a.js} +30 -33
- package/lib/edge/{get-class-prop-name-5437ca23.js → get-class-prop-name-a6f0f92d.js} +1 -1
- package/lib/edge/{get-class-prop-name-2ce20e98.cjs → get-class-prop-name-ffeda28e.cjs} +1 -1
- package/lib/edge/{img-35a1343f.cjs → img-89e32a84.cjs} +1 -1
- package/lib/edge/{img-d187da14.js → img-912b190b.js} +1 -1
- package/lib/edge/index.cjs +1 -1
- package/lib/edge/index.mjs +1 -1
- package/lib/edge/{input-9a6498fd.cjs → input-5ff8ae2e.cjs} +1 -1
- package/lib/edge/{input-38f565ce.js → input-96ba83eb.js} +1 -1
- package/lib/edge/{select-135b7397.cjs → select-5f5fed1c.cjs} +1 -1
- package/lib/edge/{select-6cb0b4b7.js → select-f66026e1.js} +1 -1
- package/lib/edge/{server-entry-216eb1bf.js → server-entry-e26008c1.js} +110 -101
- package/lib/edge/server-entry-f09ee4f4.cjs +2 -0
- package/lib/edge/server-entry.cjs +1 -1
- package/lib/edge/server-entry.mjs +1 -1
- package/lib/edge/{slot-d692126c.js → slot-d09faa0a.js} +4 -4
- package/lib/edge/{slot-b0728030.cjs → slot-d3473421.cjs} +1 -1
- package/lib/edge/{symbol-df30241a.js → symbol-285d196c.js} +2 -2
- package/lib/edge/{symbol-0ac2655e.cjs → symbol-ebccca9b.cjs} +1 -1
- package/lib/edge/{tabs-b925777d.js → tabs-39d86f86.js} +15 -15
- package/lib/edge/tabs-61c59e0f.cjs +1 -0
- package/lib/edge/{text-0f85a76c.cjs → text-40a616f5.cjs} +1 -1
- package/lib/edge/{text-337389ba.js → text-dce27428.js} +2 -2
- package/lib/node/blocks-exports.cjs +20 -20
- package/lib/node/blocks-exports.mjs +802 -797
- package/lib/node/index.cjs +1 -1
- package/lib/node/index.mjs +3 -3
- package/lib/node/init.cjs +1 -1
- package/lib/node/init.mjs +3 -3
- package/lib/node/server-entry-8e901e75.cjs +2 -0
- package/lib/node/{server-entry-ca0dcb45.js → server-entry-c7147616.js} +104 -95
- package/lib/node/server-entry.cjs +1 -1
- package/lib/node/server-entry.mjs +1 -1
- package/lib/node/{setIvm-2100f4f5.js → setIvm-5ab140ad.js} +1 -1
- package/lib/node/{setIvm-2d47478e.cjs → setIvm-a85e255e.cjs} +1 -1
- package/lib/node/setIvm.cjs +1 -1
- package/lib/node/setIvm.mjs +2 -2
- package/lib/node/{should-force-browser-runtime-in-node-fd3ca2a8.cjs → should-force-browser-runtime-in-node-16ceec99.cjs} +1 -1
- package/lib/node/{should-force-browser-runtime-in-node-a77d7cfc.js → should-force-browser-runtime-in-node-1d3a044a.js} +1 -1
- package/package.json +1 -1
- package/types/constants/sdk-version.d.ts +1 -1
- package/types/functions/log-fetch.d.ts +1 -0
- package/lib/browser/server-entry-7260e494.cjs +0 -2
- package/lib/edge/form-efce5c78.cjs +0 -1
- package/lib/edge/server-entry-3e6518b6.cjs +0 -2
- package/lib/edge/tabs-47ed7dde.cjs +0 -1
- package/lib/node/server-entry-3e017173.cjs +0 -2
package/lib/browser/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./blocks-exports.cjs"),e=require("./server-entry-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./blocks-exports.cjs"),e=require("./server-entry-d4ea1a12.cjs");require("react/jsx-runtime");require("react");exports.Blocks=t.Blocks;exports.BuilderContext=t.BuilderContext;exports.Button=t.Button;exports.Columns=t.Columns;exports.Content=t.Content;exports.Fragment=t.Fragment;exports.Image=t.Image;exports.Section=t.Section;exports.Symbol=t.Symbol;exports.Text=t.Text;exports.Video=t.Video;exports._processContentResult=e._processContentResult;exports.createRegisterComponentMessage=e.createRegisterComponentMessage;exports.fetchBuilderProps=e.fetchBuilderProps;exports.fetchEntries=e.fetchEntries;exports.fetchOneEntry=e.fetchOneEntry;exports.getBuilderSearchParams=e.getBuilderSearchParams;exports.isEditing=e.isEditing;exports.isPreviewing=e.isPreviewing;exports.register=e.register;exports.setEditorSettings=e.setEditorSettings;exports.subscribeToEditor=e.subscribeToEditor;exports.track=e.track;
|
package/lib/browser/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Blocks as i, BuilderContext as s, Button as n, Columns as c, Content as m, Fragment as g, Image as a, Section as d, Symbol as l, Text as p, Video as u } from "./blocks-exports.mjs";
|
|
2
|
-
import { _processContentResult as B, createRegisterComponentMessage as C, fetchBuilderProps as E, fetchEntries as h, fetchOneEntry as x, getBuilderSearchParams as S, isEditing as b, isPreviewing as P, register as k, setEditorSettings as y, subscribeToEditor as R, track as T } from "./server-entry-
|
|
2
|
+
import { _processContentResult as B, createRegisterComponentMessage as C, fetchBuilderProps as E, fetchEntries as h, fetchOneEntry as x, getBuilderSearchParams as S, isEditing as b, isPreviewing as P, register as k, setEditorSettings as y, subscribeToEditor as R, track as T } from "./server-entry-d133a206.js";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "react";
|
|
5
5
|
export {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const b = "react", v = "[Builder.io]: ",
|
|
1
|
+
const b = "react", v = "[Builder.io]: ", l = {
|
|
2
2
|
log: (...e) => console.log(v, ...e),
|
|
3
3
|
error: (...e) => console.error(v, ...e),
|
|
4
4
|
warn: (...e) => console.warn(v, ...e),
|
|
@@ -12,13 +12,13 @@ const te = (e) => {
|
|
|
12
12
|
return e.forEach((n, r) => {
|
|
13
13
|
t[r] = n;
|
|
14
14
|
}), t;
|
|
15
|
-
},
|
|
15
|
+
}, U = (e) => e instanceof URLSearchParams ? te(e) : e, L = (e) => typeof e == "string" ? e : e instanceof URLSearchParams ? e.toString() : new URLSearchParams(e).toString();
|
|
16
16
|
function ne() {
|
|
17
17
|
return c() && window.self !== window.top;
|
|
18
18
|
}
|
|
19
19
|
function re(e) {
|
|
20
20
|
return ne() && // accessing window.location.search is safe here because `isIframe()` is only `true` if we're in a browser.
|
|
21
|
-
|
|
21
|
+
L(e || window.location.search).indexOf("builder.frameEditing=") !== -1;
|
|
22
22
|
}
|
|
23
23
|
const oe = () => {
|
|
24
24
|
if (c()) {
|
|
@@ -53,11 +53,11 @@ const oe = () => {
|
|
|
53
53
|
device: n ? "tablet" : t.any() ? "mobile" : "desktop"
|
|
54
54
|
};
|
|
55
55
|
}, m = (e) => e != null;
|
|
56
|
-
function
|
|
56
|
+
function Xe(e) {
|
|
57
57
|
const t = e || (c() ? window.location.search : void 0);
|
|
58
|
-
return t ?
|
|
58
|
+
return t ? L(t).indexOf("builder.preview=") !== -1 : !1;
|
|
59
59
|
}
|
|
60
|
-
const
|
|
60
|
+
const Je = (e) => ({
|
|
61
61
|
type: "builder.registerComponent",
|
|
62
62
|
data: V(e)
|
|
63
63
|
}), ae = (e) => {
|
|
@@ -87,7 +87,7 @@ function ce(e, t) {
|
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
const A = {};
|
|
90
|
-
function
|
|
90
|
+
function ze(e) {
|
|
91
91
|
if (c()) {
|
|
92
92
|
Object.assign(A, e);
|
|
93
93
|
const t = {
|
|
@@ -97,10 +97,10 @@ function Je(e) {
|
|
|
97
97
|
parent.postMessage(t, "*");
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
|
-
const T = "builder.", ue = "options.",
|
|
100
|
+
const T = "builder.", ue = "options.", F = (e) => {
|
|
101
101
|
if (!e)
|
|
102
102
|
return {};
|
|
103
|
-
const t =
|
|
103
|
+
const t = U(e), n = {};
|
|
104
104
|
return Object.keys(t).forEach((r) => {
|
|
105
105
|
if (r.startsWith(T)) {
|
|
106
106
|
const o = r.replace(T, "").replace(ue, "");
|
|
@@ -111,11 +111,11 @@ const T = "builder.", ue = "options.", M = (e) => {
|
|
|
111
111
|
if (!c())
|
|
112
112
|
return {};
|
|
113
113
|
const e = new URLSearchParams(window.location.search);
|
|
114
|
-
return
|
|
115
|
-
},
|
|
114
|
+
return F(e);
|
|
115
|
+
}, M = "2.0.30", N = () => ({
|
|
116
116
|
"X-Builder-SDK": b,
|
|
117
117
|
"X-Builder-SDK-GEN": "2",
|
|
118
|
-
"X-Builder-SDK-Version":
|
|
118
|
+
"X-Builder-SDK-Version": M
|
|
119
119
|
}), le = (e) => {
|
|
120
120
|
if (e === "localhost" || e === "127.0.0.1")
|
|
121
121
|
return e;
|
|
@@ -129,7 +129,7 @@ const T = "builder.", ue = "options.", M = (e) => {
|
|
|
129
129
|
try {
|
|
130
130
|
return t ? (n = document.cookie.split("; ").find((r) => r.startsWith(`${e}=`))) == null ? void 0 : n.split("=")[1] : void 0;
|
|
131
131
|
} catch (r) {
|
|
132
|
-
|
|
132
|
+
l.warn("[COOKIE] GET error: ", (r == null ? void 0 : r.message) || r);
|
|
133
133
|
return;
|
|
134
134
|
}
|
|
135
135
|
}, K = async (e) => D(e), fe = (e) => e.map(([t, n]) => n ? `${t}=${n}` : t).filter(m).join("; "), he = [["secure", ""], ["SameSite", "None"]], ge = ({
|
|
@@ -155,7 +155,7 @@ const T = "builder.", ue = "options.", M = (e) => {
|
|
|
155
155
|
});
|
|
156
156
|
document.cookie = o;
|
|
157
157
|
} catch (o) {
|
|
158
|
-
|
|
158
|
+
l.warn("[COOKIE] SET error: ", (o == null ? void 0 : o.message) || o);
|
|
159
159
|
}
|
|
160
160
|
};
|
|
161
161
|
function pe() {
|
|
@@ -192,13 +192,13 @@ const $ = "builderSessionId", me = async ({
|
|
|
192
192
|
name: $,
|
|
193
193
|
value: e,
|
|
194
194
|
canTrack: t
|
|
195
|
-
}),
|
|
195
|
+
}), G = () => c() && typeof localStorage != "undefined" ? localStorage : void 0, we = ({
|
|
196
196
|
key: e,
|
|
197
197
|
canTrack: t
|
|
198
198
|
}) => {
|
|
199
199
|
var n;
|
|
200
200
|
try {
|
|
201
|
-
return t ? (n =
|
|
201
|
+
return t ? (n = G()) == null ? void 0 : n.getItem(e) : void 0;
|
|
202
202
|
} catch (r) {
|
|
203
203
|
console.debug("[LocalStorage] GET error: ", r);
|
|
204
204
|
return;
|
|
@@ -210,17 +210,17 @@ const $ = "builderSessionId", me = async ({
|
|
|
210
210
|
}) => {
|
|
211
211
|
var r;
|
|
212
212
|
try {
|
|
213
|
-
t && ((r =
|
|
213
|
+
t && ((r = G()) == null || r.setItem(e, n));
|
|
214
214
|
} catch (o) {
|
|
215
215
|
console.debug("[LocalStorage] SET error: ", o);
|
|
216
216
|
}
|
|
217
|
-
},
|
|
217
|
+
}, _ = "builderVisitorId", ve = ({
|
|
218
218
|
canTrack: e
|
|
219
219
|
}) => {
|
|
220
220
|
if (!e)
|
|
221
221
|
return;
|
|
222
222
|
const t = we({
|
|
223
|
-
key:
|
|
223
|
+
key: _,
|
|
224
224
|
canTrack: e
|
|
225
225
|
});
|
|
226
226
|
if (m(t))
|
|
@@ -236,10 +236,15 @@ const $ = "builderSessionId", me = async ({
|
|
|
236
236
|
id: e,
|
|
237
237
|
canTrack: t
|
|
238
238
|
}) => be({
|
|
239
|
-
key:
|
|
239
|
+
key: _,
|
|
240
240
|
value: e,
|
|
241
241
|
canTrack: t
|
|
242
|
-
})
|
|
242
|
+
});
|
|
243
|
+
function Ee(e) {
|
|
244
|
+
var t;
|
|
245
|
+
typeof process != "undefined" && ((t = process.env) != null && t.DEBUG) && String(process.env.DEBUG) == "true" && l.log(e);
|
|
246
|
+
}
|
|
247
|
+
const Oe = async ({
|
|
243
248
|
canTrack: e
|
|
244
249
|
}) => {
|
|
245
250
|
if (!e)
|
|
@@ -256,7 +261,7 @@ const $ = "builderSessionId", me = async ({
|
|
|
256
261
|
sessionId: t,
|
|
257
262
|
visitorId: n
|
|
258
263
|
};
|
|
259
|
-
},
|
|
264
|
+
}, Pe = async ({
|
|
260
265
|
type: e,
|
|
261
266
|
canTrack: t,
|
|
262
267
|
apiKey: n,
|
|
@@ -270,46 +275,49 @@ const $ = "builderSessionId", me = async ({
|
|
|
270
275
|
url: location.href,
|
|
271
276
|
...r
|
|
272
277
|
},
|
|
273
|
-
...await
|
|
278
|
+
...await Oe({
|
|
274
279
|
canTrack: t
|
|
275
280
|
}),
|
|
276
281
|
userAttributes: ie(),
|
|
277
282
|
ownerId: n
|
|
278
283
|
}
|
|
279
284
|
});
|
|
280
|
-
async function
|
|
285
|
+
async function Ce({
|
|
281
286
|
apiHost: e,
|
|
282
287
|
...t
|
|
283
288
|
}) {
|
|
284
289
|
if (!t.apiKey) {
|
|
285
|
-
|
|
290
|
+
l.error("Missing API key for track call. Please provide your API key.");
|
|
286
291
|
return;
|
|
287
292
|
}
|
|
288
|
-
|
|
293
|
+
if (!t.canTrack || re() || !(c() || b === "reactNative"))
|
|
294
|
+
return;
|
|
295
|
+
const r = `${e || "https://cdn.builder.io"}/api/v1/track`;
|
|
296
|
+
return Ee(r), fetch(r, {
|
|
289
297
|
method: "POST",
|
|
290
298
|
body: JSON.stringify({
|
|
291
|
-
events: [await
|
|
299
|
+
events: [await Pe(t)]
|
|
292
300
|
}),
|
|
293
301
|
headers: {
|
|
294
302
|
"content-type": "application/json",
|
|
295
|
-
...
|
|
303
|
+
...N()
|
|
296
304
|
},
|
|
297
305
|
mode: "cors"
|
|
298
|
-
}).catch((
|
|
299
|
-
console.error("Failed to track: ",
|
|
306
|
+
}).catch((o) => {
|
|
307
|
+
console.error("Failed to track: ", o);
|
|
300
308
|
});
|
|
301
309
|
}
|
|
302
|
-
const
|
|
310
|
+
const qe = (e) => Ce({
|
|
303
311
|
...e,
|
|
304
312
|
canTrack: !0
|
|
305
|
-
}),
|
|
313
|
+
}), xe = ["*.beta.builder.io", "beta.builder.io", "builder.io", "localhost", "qa.builder.io"];
|
|
306
314
|
function H(e, t) {
|
|
307
315
|
if (!t.origin.startsWith("http") && !t.origin.startsWith("https"))
|
|
308
316
|
return !1;
|
|
309
317
|
const n = new URL(t.origin), r = n.hostname;
|
|
310
|
-
return (e ||
|
|
318
|
+
return (e || xe).findIndex((o) => o.startsWith("*.") ? r.endsWith(o.slice(1)) : o === r) > -1;
|
|
311
319
|
}
|
|
312
|
-
const
|
|
320
|
+
const Qe = () => {
|
|
313
321
|
ce("insertMenu", {
|
|
314
322
|
name: "_default",
|
|
315
323
|
default: !0,
|
|
@@ -332,14 +340,14 @@ const qe = () => {
|
|
|
332
340
|
}]
|
|
333
341
|
});
|
|
334
342
|
};
|
|
335
|
-
let
|
|
336
|
-
const
|
|
343
|
+
let B = !1;
|
|
344
|
+
const Ae = (e = {}) => {
|
|
337
345
|
var t, n;
|
|
338
|
-
|
|
346
|
+
B || (B = !0, c() && ((t = window.parent) == null || t.postMessage({
|
|
339
347
|
type: "builder.sdkInfo",
|
|
340
348
|
data: {
|
|
341
349
|
target: b,
|
|
342
|
-
version:
|
|
350
|
+
version: M,
|
|
343
351
|
supportsPatchUpdates: !1,
|
|
344
352
|
// Supports builder-model="..." attribute which is needed to
|
|
345
353
|
// scope our '+ add block' button styling
|
|
@@ -394,7 +402,7 @@ const xe = (e = {}) => {
|
|
|
394
402
|
}
|
|
395
403
|
}
|
|
396
404
|
})));
|
|
397
|
-
},
|
|
405
|
+
}, Te = ({
|
|
398
406
|
model: e,
|
|
399
407
|
trustedHosts: t,
|
|
400
408
|
callbacks: n
|
|
@@ -420,12 +428,12 @@ const xe = (e = {}) => {
|
|
|
420
428
|
break;
|
|
421
429
|
}
|
|
422
430
|
}
|
|
423
|
-
},
|
|
431
|
+
}, Ye = (e, t, n) => {
|
|
424
432
|
if (!c)
|
|
425
|
-
return
|
|
433
|
+
return l.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."), () => {
|
|
426
434
|
};
|
|
427
|
-
|
|
428
|
-
const r =
|
|
435
|
+
Ae();
|
|
436
|
+
const r = Te({
|
|
429
437
|
callbacks: {
|
|
430
438
|
contentUpdate: t,
|
|
431
439
|
animation: () => {
|
|
@@ -439,12 +447,12 @@ const xe = (e = {}) => {
|
|
|
439
447
|
return window.addEventListener("message", r), () => {
|
|
440
448
|
window.removeEventListener("message", r);
|
|
441
449
|
};
|
|
442
|
-
},
|
|
450
|
+
}, Be = "builder.tests", E = (e) => `${Be}.${e}`, Re = ({
|
|
443
451
|
contentId: e
|
|
444
452
|
}) => K({
|
|
445
453
|
name: E(e),
|
|
446
454
|
canTrack: !0
|
|
447
|
-
}),
|
|
455
|
+
}), Ue = ({
|
|
448
456
|
contentId: e
|
|
449
457
|
}) => D({
|
|
450
458
|
name: E(e),
|
|
@@ -456,7 +464,7 @@ const xe = (e = {}) => {
|
|
|
456
464
|
name: E(e),
|
|
457
465
|
value: t,
|
|
458
466
|
canTrack: !0
|
|
459
|
-
}), X = (e) => m(e.id) && m(e.variations) && Object.keys(e.variations).length > 0,
|
|
467
|
+
}), X = (e) => m(e.id) && m(e.variations) && Object.keys(e.variations).length > 0, Ve = ({
|
|
460
468
|
id: e,
|
|
461
469
|
variations: t
|
|
462
470
|
}) => {
|
|
@@ -470,12 +478,12 @@ const xe = (e = {}) => {
|
|
|
470
478
|
}
|
|
471
479
|
return e;
|
|
472
480
|
}, J = (e) => {
|
|
473
|
-
const t =
|
|
481
|
+
const t = Ve(e);
|
|
474
482
|
return Le({
|
|
475
483
|
contentId: e.id,
|
|
476
484
|
value: t
|
|
477
485
|
}).catch((n) => {
|
|
478
|
-
|
|
486
|
+
l.error("could not store A/B test variation: ", n);
|
|
479
487
|
}), t;
|
|
480
488
|
}, z = ({
|
|
481
489
|
item: e,
|
|
@@ -491,7 +499,7 @@ const xe = (e = {}) => {
|
|
|
491
499
|
testVariationId: n.id,
|
|
492
500
|
testVariationName: n.name || (n.id === e.id ? "Default" : "")
|
|
493
501
|
};
|
|
494
|
-
},
|
|
502
|
+
}, Ze = ({
|
|
495
503
|
item: e,
|
|
496
504
|
canTrack: t
|
|
497
505
|
}) => {
|
|
@@ -501,7 +509,7 @@ const xe = (e = {}) => {
|
|
|
501
509
|
return;
|
|
502
510
|
if (!X(e))
|
|
503
511
|
return e;
|
|
504
|
-
const n =
|
|
512
|
+
const n = Ue({
|
|
505
513
|
contentId: e.id
|
|
506
514
|
}) || J({
|
|
507
515
|
variations: e.variations,
|
|
@@ -514,7 +522,7 @@ const xe = (e = {}) => {
|
|
|
514
522
|
...e,
|
|
515
523
|
...r
|
|
516
524
|
};
|
|
517
|
-
},
|
|
525
|
+
}, Fe = async ({
|
|
518
526
|
item: e,
|
|
519
527
|
canTrack: t
|
|
520
528
|
}) => {
|
|
@@ -537,14 +545,14 @@ const xe = (e = {}) => {
|
|
|
537
545
|
function Ne() {
|
|
538
546
|
return typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : globalThis;
|
|
539
547
|
}
|
|
540
|
-
function
|
|
548
|
+
function De() {
|
|
541
549
|
const e = Ne().fetch;
|
|
542
550
|
if (typeof e == "undefined")
|
|
543
551
|
throw console.warn(`Builder SDK could not find a global fetch function. Make sure you have a polyfill for fetch in your project.
|
|
544
552
|
For more information, read https://github.com/BuilderIO/this-package-uses-fetch`), new Error("Builder SDK could not find a global `fetch` function");
|
|
545
553
|
return e;
|
|
546
554
|
}
|
|
547
|
-
const
|
|
555
|
+
const Ke = De();
|
|
548
556
|
function k(e, t = null, n = ".") {
|
|
549
557
|
return Object.keys(e).reduce((r, o) => {
|
|
550
558
|
const s = e[o], i = [t, o].filter(Boolean).join(n);
|
|
@@ -564,7 +572,7 @@ function q(e, t, n = {}) {
|
|
|
564
572
|
}
|
|
565
573
|
return n;
|
|
566
574
|
}
|
|
567
|
-
const
|
|
575
|
+
const je = "v3", R = (e) => typeof e == "number" && !isNaN(e) && e >= 0, O = (e) => {
|
|
568
576
|
const {
|
|
569
577
|
limit: t = 30,
|
|
570
578
|
userAttributes: n,
|
|
@@ -573,7 +581,7 @@ const Ke = "v3", B = (e) => typeof e == "number" && !isNaN(e) && e >= 0, O = (e)
|
|
|
573
581
|
apiKey: s,
|
|
574
582
|
enrich: i,
|
|
575
583
|
locale: u,
|
|
576
|
-
apiVersion: y =
|
|
584
|
+
apiVersion: y = je,
|
|
577
585
|
fields: p,
|
|
578
586
|
omit: I,
|
|
579
587
|
offset: d,
|
|
@@ -588,42 +596,42 @@ const Ke = "v3", B = (e) => typeof e == "number" && !isNaN(e) && e >= 0, O = (e)
|
|
|
588
596
|
if (!["v3"].includes(y))
|
|
589
597
|
throw new Error(`Invalid apiVersion: expected 'v3', received '${y}'`);
|
|
590
598
|
const Y = t !== 1, Z = Q || "https://cdn.builder.io", a = new URL(`${Z}/api/${y}/content/${o}`);
|
|
591
|
-
if (a.searchParams.set("apiKey", s), a.searchParams.set("limit", String(t)), a.searchParams.set("noTraverse", String(Y)), a.searchParams.set("includeRefs", String(!0)), u && a.searchParams.set("locale", u), i && a.searchParams.set("enrich", String(i)), a.searchParams.set("omit", I || "meta.componentsUsed"), p && a.searchParams.set("fields", p), Number.isFinite(d) && d > -1 && a.searchParams.set("offset", String(Math.floor(d))), typeof P == "boolean" && a.searchParams.set("includeUnpublished", String(P)), h &&
|
|
592
|
-
const
|
|
599
|
+
if (a.searchParams.set("apiKey", s), a.searchParams.set("limit", String(t)), a.searchParams.set("noTraverse", String(Y)), a.searchParams.set("includeRefs", String(!0)), u && a.searchParams.set("locale", u), i && a.searchParams.set("enrich", String(i)), a.searchParams.set("omit", I || "meta.componentsUsed"), p && a.searchParams.set("fields", p), Number.isFinite(d) && d > -1 && a.searchParams.set("offset", String(Math.floor(d))), typeof P == "boolean" && a.searchParams.set("includeUnpublished", String(P)), h && R(h) && a.searchParams.set("cacheSeconds", String(h)), g && R(g) && a.searchParams.set("staleCacheSeconds", String(g)), S) {
|
|
600
|
+
const f = k({
|
|
593
601
|
sort: S
|
|
594
602
|
});
|
|
595
|
-
for (const w in
|
|
596
|
-
a.searchParams.set(w, JSON.stringify(
|
|
603
|
+
for (const w in f)
|
|
604
|
+
a.searchParams.set(w, JSON.stringify(f[w]));
|
|
597
605
|
}
|
|
598
606
|
const ee = {
|
|
599
607
|
...de(),
|
|
600
|
-
...
|
|
608
|
+
...U(e.options || {})
|
|
601
609
|
}, C = k(ee);
|
|
602
|
-
for (const
|
|
603
|
-
a.searchParams.set(
|
|
610
|
+
for (const f in C)
|
|
611
|
+
a.searchParams.set(f, String(C[f]));
|
|
604
612
|
if (n && a.searchParams.set("userAttributes", JSON.stringify(n)), r) {
|
|
605
|
-
const
|
|
613
|
+
const f = q({
|
|
606
614
|
query: r
|
|
607
615
|
});
|
|
608
|
-
for (const w in
|
|
609
|
-
a.searchParams.set(w, JSON.stringify(
|
|
616
|
+
for (const w in f)
|
|
617
|
+
a.searchParams.set(w, JSON.stringify(f[w]));
|
|
610
618
|
}
|
|
611
619
|
return a;
|
|
612
|
-
},
|
|
613
|
-
async function
|
|
614
|
-
const t = await
|
|
620
|
+
}, We = (e) => "results" in e;
|
|
621
|
+
async function $e(e) {
|
|
622
|
+
const t = await He({
|
|
615
623
|
...e,
|
|
616
624
|
limit: 1
|
|
617
625
|
});
|
|
618
626
|
return t && t[0] || null;
|
|
619
627
|
}
|
|
620
|
-
const
|
|
628
|
+
const Ge = async (e) => {
|
|
621
629
|
var i, u;
|
|
622
|
-
const t = O(e), n = (i = e.fetch) != null ? i :
|
|
630
|
+
const t = O(e), n = (i = e.fetch) != null ? i : Ke, r = {
|
|
623
631
|
...e.fetchOptions,
|
|
624
632
|
headers: {
|
|
625
633
|
...(u = e.fetchOptions) == null ? void 0 : u.headers,
|
|
626
|
-
...
|
|
634
|
+
...N()
|
|
627
635
|
}
|
|
628
636
|
};
|
|
629
637
|
return await (await n(t.href, r)).json();
|
|
@@ -634,29 +642,29 @@ const $e = async (e) => {
|
|
|
634
642
|
try {
|
|
635
643
|
const o = [];
|
|
636
644
|
for (const s of t.results)
|
|
637
|
-
o.push(await
|
|
645
|
+
o.push(await Fe({
|
|
638
646
|
item: s,
|
|
639
647
|
canTrack: r
|
|
640
648
|
}));
|
|
641
649
|
t.results = o;
|
|
642
650
|
} catch (o) {
|
|
643
|
-
|
|
651
|
+
l.error("Could not process A/B tests. ", o);
|
|
644
652
|
}
|
|
645
653
|
return t.results;
|
|
646
654
|
};
|
|
647
|
-
async function
|
|
655
|
+
async function He(e) {
|
|
648
656
|
try {
|
|
649
|
-
const t = O(e), n = await
|
|
650
|
-
return
|
|
657
|
+
const t = O(e), n = await Ge(e);
|
|
658
|
+
return We(n) ? _e(e, n) : (l.error("Error fetching data. ", {
|
|
651
659
|
url: t,
|
|
652
660
|
content: n,
|
|
653
661
|
options: e
|
|
654
662
|
}), null);
|
|
655
663
|
} catch (t) {
|
|
656
|
-
return
|
|
664
|
+
return l.error("Error fetching data. ", t), null;
|
|
657
665
|
}
|
|
658
666
|
}
|
|
659
|
-
const
|
|
667
|
+
const et = async (e) => {
|
|
660
668
|
var r, o, s;
|
|
661
669
|
const t = e.path || ((r = e.url) == null ? void 0 : r.pathname) || ((o = e.userAttributes) == null ? void 0 : o.urlPath), n = {
|
|
662
670
|
...e,
|
|
@@ -668,37 +676,38 @@ const Ze = async (e) => {
|
|
|
668
676
|
urlPath: t
|
|
669
677
|
} : {}
|
|
670
678
|
},
|
|
671
|
-
options:
|
|
679
|
+
options: F(e.searchParams || ((s = e.url) == null ? void 0 : s.searchParams) || e.options)
|
|
672
680
|
};
|
|
673
681
|
return {
|
|
674
682
|
apiKey: n.apiKey,
|
|
675
683
|
model: n.model,
|
|
676
|
-
content: await
|
|
684
|
+
content: await $e(n)
|
|
677
685
|
};
|
|
678
686
|
};
|
|
679
687
|
export {
|
|
680
688
|
b as TARGET,
|
|
681
689
|
_e as _processContentResult,
|
|
682
|
-
|
|
690
|
+
Ce as _track,
|
|
683
691
|
m as checkIsDefined,
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
692
|
+
Te as createEditorListener,
|
|
693
|
+
Je as createRegisterComponentMessage,
|
|
694
|
+
et as fetchBuilderProps,
|
|
695
|
+
He as fetchEntries,
|
|
696
|
+
$e as fetchOneEntry,
|
|
697
|
+
F as getBuilderSearchParams,
|
|
690
698
|
Me as getDefaultCanTrack,
|
|
691
699
|
ie as getUserAttributes,
|
|
692
|
-
|
|
700
|
+
Ze as handleABTestingSync,
|
|
693
701
|
c as isBrowser,
|
|
694
702
|
re as isEditing,
|
|
695
|
-
|
|
696
|
-
|
|
703
|
+
Xe as isPreviewing,
|
|
704
|
+
Ee as logFetch,
|
|
705
|
+
l as logger,
|
|
697
706
|
ce as register,
|
|
698
|
-
|
|
707
|
+
Qe as registerInsertMenu,
|
|
699
708
|
V as serializeIncludingFunctions,
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
709
|
+
ze as setEditorSettings,
|
|
710
|
+
Ae as setupBrowserForEditing,
|
|
711
|
+
Ye as subscribeToEditor,
|
|
712
|
+
qe as track
|
|
704
713
|
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const y="react",v="[Builder.io]: ",d={log:(...e)=>console.log(v,...e),error:(...e)=>console.error(v,...e),warn:(...e)=>console.warn(v,...e),debug:(...e)=>console.debug(v,...e)};function c(){return typeof window!="undefined"&&typeof document!="undefined"}const fe=e=>{const t={};return e.forEach((n,r)=>{t[r]=n}),t},V=e=>e instanceof URLSearchParams?fe(e):e,F=e=>typeof e=="string"?e:e instanceof URLSearchParams?e.toString():new URLSearchParams(e).toString();function ge(){return c()&&window.self!==window.top}function M(e){return ge()&&F(e||window.location.search).indexOf("builder.frameEditing=")!==-1}const he=()=>{if(c()){const e=new URL(location.href);return e.pathname===""&&(e.pathname="/"),e}else return console.warn("Cannot get location for tracking in non-browser environment"),null},pe=()=>typeof navigator=="object"&&navigator.userAgent||"",D=()=>{const e=pe(),t={Android(){return e.match(/Android/i)},BlackBerry(){return e.match(/BlackBerry/i)},iOS(){return e.match(/iPhone|iPod/i)},Opera(){return e.match(/Opera Mini/i)},Windows(){return e.match(/IEMobile/i)||e.match(/WPDesktop/i)},any(){return t.Android()||t.BlackBerry()||t.iOS()||t.Opera()||t.Windows()||y==="reactNative"}},n=e.match(/Tablet|iPad/i),r=he();return{urlPath:r==null?void 0:r.pathname,host:(r==null?void 0:r.host)||(r==null?void 0:r.hostname),device:n?"tablet":t.any()?"mobile":"desktop"}},p=e=>e!=null;function me(e){const t=e||(c()?window.location.search:void 0);return t?F(t).indexOf("builder.preview=")!==-1:!1}const ye=e=>({type:"builder.registerComponent",data:k(e)}),Se=e=>{const t=e.toString().trim();return`return (${!t.startsWith("function")&&!t.startsWith("(")?"function ":""}${t}).apply(this, arguments)`};function k(e){return JSON.parse(JSON.stringify(e,(t,n)=>typeof n=="function"?Se(n):n))}const x={};function N(e,t){e==="plugin"&&(t=k(t));let n=x[e];if(n||(n=x[e]=[]),n.push(t),c()){const r={type:"builder.register",data:{type:e,info:t}};try{parent.postMessage(r,"*"),parent!==window&&window.postMessage(r,"*")}catch(o){console.debug("Could not postmessage",o)}}}const B={};function we(e){if(c()){Object.assign(B,e);const t={type:"builder.settingsChange",data:B};parent.postMessage(t,"*")}}const R="builder.",be="options.",P=e=>{if(!e)return{};const t=V(e),n={};return Object.keys(t).forEach(r=>{if(r.startsWith(R)){const o=r.replace(R,"").replace(be,"");n[o]=t[r]}}),n},ve=()=>{if(!c())return{};const e=new URLSearchParams(window.location.search);return P(e)},K="2.0.30",j=()=>({"X-Builder-SDK":y,"X-Builder-SDK-GEN":"2","X-Builder-SDK-Version":K}),Ie=e=>{if(e==="localhost"||e==="127.0.0.1")return e;const t=e.split(".");return t.length>2?t.slice(1).join("."):e},W=({name:e,canTrack:t})=>{var n;try{return t?(n=document.cookie.split("; ").find(r=>r.startsWith(`${e}=`)))==null?void 0:n.split("=")[1]:void 0}catch(r){d.warn("[COOKIE] GET error: ",(r==null?void 0:r.message)||r);return}},$=async e=>W(e),Ee=e=>e.map(([t,n])=>n?`${t}=${n}`:t).filter(p).join("; "),ke=[["secure",""],["SameSite","None"]],Pe=({name:e,value:t,expires:n})=>{const o=(c()?location.protocol==="https:":!0)?ke:[[]],s=n?[["expires",n.toUTCString()]]:[[]],i=[[e,t],...s,["path","/"],["domain",Ie(window.location.hostname)],...o];return Ee(i)},G=async({name:e,value:t,expires:n,canTrack:r})=>{try{if(!r)return;const o=Pe({name:e,value:t,expires:n});document.cookie=o}catch(o){d.warn("[COOKIE] SET error: ",(o==null?void 0:o.message)||o)}};function Oe(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const t=Math.random()*16|0;return(e=="x"?t:t&3|8).toString(16)})}function _(){return Oe().replace(/-/g,"")}const H="builderSessionId",Ce=async({canTrack:e})=>{if(!e)return;const t=await $({name:H,canTrack:e});if(p(t))return t;{const n=Ae();return Te({id:n,canTrack:e}),n}},Ae=()=>_(),Te=({id:e,canTrack:t})=>G({name:H,value:e,canTrack:t}),X=()=>c()&&typeof localStorage!="undefined"?localStorage:void 0,xe=({key:e,canTrack:t})=>{var n;try{return t?(n=X())==null?void 0:n.getItem(e):void 0}catch(r){console.debug("[LocalStorage] GET error: ",r);return}},Be=({key:e,canTrack:t,value:n})=>{var r;try{t&&((r=X())==null||r.setItem(e,n))}catch(o){console.debug("[LocalStorage] SET error: ",o)}},z="builderVisitorId",Re=({canTrack:e})=>{if(!e)return;const t=xe({key:z,canTrack:e});if(p(t))return t;{const n=Ue();return Le({id:n,canTrack:e}),n}},Ue=()=>_(),Le=({id:e,canTrack:t})=>Be({key:z,value:e,canTrack:t});function J(e){var t;typeof process!="undefined"&&((t=process.env)!=null&&t.DEBUG)&&String(process.env.DEBUG)=="true"&&d.log(e)}const Ve=async({canTrack:e})=>{if(!e)return{visitorId:void 0,sessionId:void 0};const t=await Ce({canTrack:e}),n=Re({canTrack:e});return{sessionId:t,visitorId:n}},Fe=async({type:e,canTrack:t,apiKey:n,metadata:r,...o})=>({type:e,data:{...o,metadata:{url:location.href,...r},...await Ve({canTrack:t}),userAttributes:D(),ownerId:n}});async function q({apiHost:e,...t}){if(!t.apiKey){d.error("Missing API key for track call. Please provide your API key.");return}if(!t.canTrack||M()||!(c()||y==="reactNative"))return;const r=`${e||"https://cdn.builder.io"}/api/v1/track`;return J(r),fetch(r,{method:"POST",body:JSON.stringify({events:[await Fe(t)]}),headers:{"content-type":"application/json",...j()},mode:"cors"}).catch(o=>{console.error("Failed to track: ",o)})}const Me=e=>q({...e,canTrack:!0}),De=["*.beta.builder.io","beta.builder.io","builder.io","localhost","qa.builder.io"];function Q(e,t){if(!t.origin.startsWith("http")&&!t.origin.startsWith("https"))return!1;const n=new URL(t.origin),r=n.hostname;return(e||De).findIndex(o=>o.startsWith("*.")?r.endsWith(o.slice(1)):o===r)>-1}const Ne=()=>{N("insertMenu",{name:"_default",default:!0,items:[{name:"Box"},{name:"Text"},{name:"Image"},{name:"Columns"},{name:"Core:Section"},{name:"Core:Button"},{name:"Embed"},{name:"Custom Code"}]})};let U=!1;const Y=(e={})=>{var t,n;U||(U=!0,c()&&((t=window.parent)==null||t.postMessage({type:"builder.sdkInfo",data:{target:y,version:K,supportsPatchUpdates:!1,supportsAddBlockScoping:!0,supportsCustomBreakpoints:!0}},"*"),(n=window.parent)==null||n.postMessage({type:"builder.updateContent",data:{options:e}},"*"),window.addEventListener("message",r=>{var s,i;if(!Q(e.trustedHosts,r))return;const{data:o}=r;if(o!=null&&o.type)switch(o.type){case"builder.evaluate":{const u=o.data.text,S=o.data.arguments||[],m=o.data.id,I=new Function(u);let l,g=null;try{l=I.apply(null,S)}catch(h){g=h}g?(s=window.parent)==null||s.postMessage({type:"builder.evaluateError",data:{id:m,error:g.message}},"*"):l&&typeof l.then=="function"?l.then(h=>{var w;(w=window.parent)==null||w.postMessage({type:"builder.evaluateResult",data:{id:m,result:h}},"*")}).catch(console.error):(i=window.parent)==null||i.postMessage({type:"builder.evaluateResult",data:{result:l,id:m}},"*");break}}})))},Z=({model:e,trustedHosts:t,callbacks:n})=>r=>{if(!Q(t,r))return;const{data:o}=r;if(o)switch(o.type){case"builder.configureSdk":{n.configureSdk(o.data);break}case"builder.triggerAnimation":{n.animation(o.data);break}case"builder.contentUpdate":{const s=o.data,i=s.key||s.alias||s.entry||s.modelName,u=s.data;i===e&&n.contentUpdate(u);break}}},Ke=(e,t,n)=>{if(!c)return d.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."),()=>{};Y();const r=Z({callbacks:{contentUpdate:t,animation:()=>{},configureSdk:()=>{}},model:e,trustedHosts:n==null?void 0:n.trustedHosts});return window.addEventListener("message",r),()=>{window.removeEventListener("message",r)}},je="builder.tests",O=e=>`${je}.${e}`,We=({contentId:e})=>$({name:O(e),canTrack:!0}),$e=({contentId:e})=>W({name:O(e),canTrack:!0}),Ge=({contentId:e,value:t})=>G({name:O(e),value:t,canTrack:!0}),ee=e=>p(e.id)&&p(e.variations)&&Object.keys(e.variations).length>0,_e=({id:e,variations:t})=>{var o;let n=0;const r=Math.random();for(const s in t){const i=(o=t[s])==null?void 0:o.testRatio;if(n+=i,r<n)return s}return e},te=e=>{const t=_e(e);return Ge({contentId:e.id,value:t}).catch(n=>{d.error("could not store A/B test variation: ",n)}),t},ne=({item:e,testGroupId:t})=>{const n=e.variations[t];return t===e.id||!n?{testVariationId:e.id,testVariationName:"Default"}:{data:n.data,testVariationId:n.id,testVariationName:n.name||(n.id===e.id?"Default":"")}},He=({item:e,canTrack:t})=>{if(!t)return e;if(!e)return;if(!ee(e))return e;const n=$e({contentId:e.id})||te({variations:e.variations,id:e.id}),r=ne({item:e,testGroupId:n});return{...e,...r}},Xe=async({item:e,canTrack:t})=>{if(!t||!ee(e))return e;const r=await We({contentId:e.id})||te({variations:e.variations,id:e.id}),o=ne({item:e,testGroupId:r});return{...e,...o}},re=e=>p(e)?e:!0;function ze(){return typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:globalThis}function Je(){const e=ze().fetch;if(typeof e=="undefined")throw console.warn(`Builder SDK could not find a global fetch function. Make sure you have a polyfill for fetch in your project.
|
|
2
|
+
For more information, read https://github.com/BuilderIO/this-package-uses-fetch`),new Error("Builder SDK could not find a global `fetch` function");return e}const qe=Je();function E(e,t=null,n="."){return Object.keys(e).reduce((r,o)=>{const s=e[o],i=[t,o].filter(Boolean).join(n);return[typeof s=="object",s!==null,!(Array.isArray(s)&&s.length===0)].every(Boolean)?{...r,...E(s,i,n)}:{...r,[i]:s}},{})}function oe(e,t,n={}){for(const r in e){const o=e[r],s=t?t+"."+r:r;o&&typeof o=="object"&&!Array.isArray(o)&&!Object.keys(o).find(i=>i.startsWith("$"))?oe(o,s,n):n[s]=o}return n}const Qe="v3",L=e=>typeof e=="number"&&!isNaN(e)&&e>=0,C=e=>{const{limit:t=30,userAttributes:n,query:r,model:o,apiKey:s,enrich:i,locale:u,apiVersion:S=Qe,fields:m,omit:I,offset:l,cacheSeconds:g,staleCacheSeconds:h,sort:w,includeUnpublished:A,apiHost:ce}=e;if(!s)throw new Error("Missing API key");if(!["v3"].includes(S))throw new Error(`Invalid apiVersion: expected 'v3', received '${S}'`);const ue=t!==1,de=ce||"https://cdn.builder.io",a=new URL(`${de}/api/${S}/content/${o}`);if(a.searchParams.set("apiKey",s),a.searchParams.set("limit",String(t)),a.searchParams.set("noTraverse",String(ue)),a.searchParams.set("includeRefs",String(!0)),u&&a.searchParams.set("locale",u),i&&a.searchParams.set("enrich",String(i)),a.searchParams.set("omit",I||"meta.componentsUsed"),m&&a.searchParams.set("fields",m),Number.isFinite(l)&&l>-1&&a.searchParams.set("offset",String(Math.floor(l))),typeof A=="boolean"&&a.searchParams.set("includeUnpublished",String(A)),g&&L(g)&&a.searchParams.set("cacheSeconds",String(g)),h&&L(h)&&a.searchParams.set("staleCacheSeconds",String(h)),w){const f=E({sort:w});for(const b in f)a.searchParams.set(b,JSON.stringify(f[b]))}const le={...ve(),...V(e.options||{})},T=E(le);for(const f in T)a.searchParams.set(f,String(T[f]));if(n&&a.searchParams.set("userAttributes",JSON.stringify(n)),r){const f=oe({query:r});for(const b in f)a.searchParams.set(b,JSON.stringify(f[b]))}return a},Ye=e=>"results"in e;async function se(e){const t=await ae({...e,limit:1});return t&&t[0]||null}const Ze=async e=>{var i,u;const t=C(e),n=(i=e.fetch)!=null?i:qe,r={...e.fetchOptions,headers:{...(u=e.fetchOptions)==null?void 0:u.headers,...j()}};return await(await n(t.href,r)).json()},ie=async(e,t,n=C(e))=>{const r=re(e.canTrack);if(n.search.includes("preview="),!r||!(c()||y==="reactNative"))return t.results;try{const o=[];for(const s of t.results)o.push(await Xe({item:s,canTrack:r}));t.results=o}catch(o){d.error("Could not process A/B tests. ",o)}return t.results};async function ae(e){try{const t=C(e),n=await Ze(e);return Ye(n)?ie(e,n):(d.error("Error fetching data. ",{url:t,content:n,options:e}),null)}catch(t){return d.error("Error fetching data. ",t),null}}const et=async e=>{var r,o,s;const t=e.path||((r=e.url)==null?void 0:r.pathname)||((o=e.userAttributes)==null?void 0:o.urlPath),n={...e,apiKey:e.apiKey,model:e.model||"page",userAttributes:{...e.userAttributes,...t?{urlPath:t}:{}},options:P(e.searchParams||((s=e.url)==null?void 0:s.searchParams)||e.options)};return{apiKey:n.apiKey,model:n.model,content:await se(n)}};exports.TARGET=y;exports._processContentResult=ie;exports._track=q;exports.checkIsDefined=p;exports.createEditorListener=Z;exports.createRegisterComponentMessage=ye;exports.fetchBuilderProps=et;exports.fetchEntries=ae;exports.fetchOneEntry=se;exports.getBuilderSearchParams=P;exports.getDefaultCanTrack=re;exports.getUserAttributes=D;exports.handleABTestingSync=He;exports.isBrowser=c;exports.isEditing=M;exports.isPreviewing=me;exports.logFetch=J;exports.logger=d;exports.register=N;exports.registerInsertMenu=Ne;exports.serializeIncludingFunctions=k;exports.setEditorSettings=we;exports.setupBrowserForEditing=Y;exports.subscribeToEditor=Ke;exports.track=Me;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./server-entry-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./server-entry-d4ea1a12.cjs");exports._processContentResult=e._processContentResult;exports.createRegisterComponentMessage=e.createRegisterComponentMessage;exports.fetchBuilderProps=e.fetchBuilderProps;exports.fetchEntries=e.fetchEntries;exports.fetchOneEntry=e.fetchOneEntry;exports.getBuilderSearchParams=e.getBuilderSearchParams;exports.isEditing=e.isEditing;exports.isPreviewing=e.isPreviewing;exports.register=e.register;exports.setEditorSettings=e.setEditorSettings;exports.subscribeToEditor=e.subscribeToEditor;exports.track=e.track;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _processContentResult as r, createRegisterComponentMessage as s, fetchBuilderProps as i, fetchEntries as n, fetchOneEntry as o, getBuilderSearchParams as c, isEditing as g, isPreviewing as a, register as d, setEditorSettings as E, subscribeToEditor as f, track as h } from "./server-entry-
|
|
1
|
+
import { _processContentResult as r, createRegisterComponentMessage as s, fetchBuilderProps as i, fetchEntries as n, fetchOneEntry as o, getBuilderSearchParams as c, isEditing as g, isPreviewing as a, register as d, setEditorSettings as E, subscribeToEditor as f, track as h } from "./server-entry-d133a206.js";
|
|
2
2
|
export {
|
|
3
3
|
r as _processContentResult,
|
|
4
4
|
s as createRegisterComponentMessage,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as r, jsxs as x, Fragment as j } from "react/jsx-runtime";
|
|
2
2
|
import { useState as A } from "react";
|
|
3
3
|
import { Blocks as g } from "./blocks-exports.mjs";
|
|
4
|
-
import "./server-entry-
|
|
4
|
+
import "./server-entry-e26008c1.js";
|
|
5
5
|
const y = (t) => t.toString();
|
|
6
6
|
function B(t) {
|
|
7
7
|
var a;
|
|
@@ -88,8 +88,10 @@ function B(t) {
|
|
|
88
88
|
className: I(n),
|
|
89
89
|
style: {
|
|
90
90
|
...h(),
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
...t.grid && {
|
|
92
|
+
width: t.gridRowWidth,
|
|
93
|
+
order: c() !== null ? y(n) : y(n + 1)
|
|
94
|
+
}
|
|
93
95
|
},
|
|
94
96
|
"data-index": n,
|
|
95
97
|
onClick: (l) => v(n),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),O=require("react"),g=require("./blocks-exports.cjs");require("./server-entry-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),O=require("react"),g=require("./blocks-exports.cjs");require("./server-entry-f09ee4f4.cjs");const y=t=>t.toString();function v(t){var u;const[o,s]=O.useState(()=>[]);function d(){return!!(t.grid||t.oneAtATime)}function C(){return{display:"flex",alignItems:"stretch",flexDirection:"column",...t.grid&&{flexDirection:"row",alignItems:"flex-start",flexWrap:"wrap"}}}function h(){const n={...{display:"flex",flexDirection:"column"},alignItems:"stretch",cursor:"pointer"};return Object.fromEntries(Object.entries(n).filter(([l,a])=>a!==void 0))}function j(e){return`builder-accordion-title builder-accordion-title-${o.includes(e)?"open":"closed"}`}function k(e){return`builder-accordion-detail builder-accordion-detail-${o.includes(e)?"open":"closed"}`}function c(){let e=null;if(t.grid&&o.length&&document){const l=o[0];let i=document.querySelector(`.builder-accordion-title[data-index="${l}"]`);if(e=l,i){let m=i.getBoundingClientRect();for(;i=i&&i.nextElementSibling;)if(i){if(i.classList.contains("builder-accordion-detail"))continue;const f=i.getBoundingClientRect();if(f.left>m.left){const b=parseInt(i.getAttribute("data-index")||"",10);isNaN(b)||(m=f,e=b)}else break}}}return typeof e=="number"&&(e=e+1),e}function x(){const e={order:typeof c()=="number"?c():void 0,...t.grid&&{width:"100%"}};return Object.fromEntries(Object.entries(e).filter(([n,l])=>l!==void 0))}function I(e){o.includes(e)?s(d()?[]:o.filter(n=>n!==e)):s(d()?[e]:o.concat(e))}return r.jsx("div",{className:"builder-accordion",style:C(),children:(u=t.items)==null?void 0:u.map((e,n)=>r.jsxs(r.Fragment,{children:[r.jsx("div",{className:j(n),style:{...h(),...t.grid&&{width:t.gridRowWidth,order:c()!==null?y(n):y(n+1)}},"data-index":n,onClick:l=>I(n),children:r.jsx(g.Blocks,{blocks:e.title,path:`items.${n}.title`,parent:t.builderBlock.id,context:t.builderContext,registeredComponents:t.builderComponents,linkComponent:t.builderLinkComponent})}),o.includes(n)?r.jsx("div",{className:k(n),style:x(),children:r.jsx(g.Blocks,{blocks:e.detail,path:`items.${n}.detail`,parent:t.builderBlock.id,context:t.builderContext,registeredComponents:t.builderComponents,linkComponent:t.builderLinkComponent})}):null]}))})}exports.default=v;
|