@builder.io/sdk-react 2.0.25 → 2.0.27
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 +5 -5
- package/lib/browser/blocks-exports.mjs +47 -41
- package/lib/browser/index.cjs +1 -1
- package/lib/browser/index.mjs +1 -1
- package/lib/browser/server-entry-b2eed856.cjs +2 -0
- package/lib/browser/{server-entry-350f7ecc.js → server-entry-fea90db1.js} +138 -135
- package/lib/browser/server-entry.cjs +1 -1
- package/lib/browser/server-entry.mjs +1 -1
- package/lib/edge/{accordion-e2aeca0a.js → accordion-6557fd47.js} +1 -1
- package/lib/edge/{accordion-d14d05aa.cjs → accordion-c7ebd14b.cjs} +1 -1
- package/lib/edge/{blocks-5a60a8fa.cjs → blocks-00d9b985.cjs} +1 -1
- package/lib/edge/{blocks-9a763eda.js → blocks-b7b78f6f.js} +3 -3
- package/lib/edge/blocks-exports.cjs +1 -1
- package/lib/edge/blocks-exports.mjs +2 -2
- package/lib/edge/{button-265653d5.js → button-07555543.js} +2 -2
- package/lib/edge/{button-6ab0c490.cjs → button-ca865fd7.cjs} +1 -1
- package/lib/edge/{columns-449335a4.cjs → columns-1d6d0f14.cjs} +1 -1
- package/lib/edge/{columns-346d4ab7.js → columns-a8fb6e6e.js} +4 -4
- package/lib/edge/{content-variants-71459280.cjs → content-variants-5de0e605.cjs} +8 -8
- package/lib/edge/{content-variants-bdb3d738.js → content-variants-f7aadfcc.js} +51 -45
- package/lib/edge/{evaluate-db1f9237.cjs → evaluate-2596ffe5.cjs} +1 -1
- package/lib/edge/{evaluate-be86a5d8.js → evaluate-3fbf8291.js} +1 -1
- package/lib/edge/{form-90310cab.cjs → form-7f214547.cjs} +1 -1
- package/lib/edge/{form-41305e00.js → form-be8d48c0.js} +4 -4
- package/lib/edge/{get-class-prop-name-711d58eb.cjs → get-class-prop-name-00a9606b.cjs} +1 -1
- package/lib/edge/{get-class-prop-name-b49b7684.js → get-class-prop-name-35810f43.js} +1 -1
- package/lib/edge/{img-a75bf17b.js → img-1c578e3b.js} +1 -1
- package/lib/edge/{img-1ab7ba48.cjs → img-3eab09f2.cjs} +1 -1
- package/lib/edge/index.cjs +1 -1
- package/lib/edge/index.mjs +1 -1
- package/lib/edge/{input-137d07aa.cjs → input-0d7c1c27.cjs} +1 -1
- package/lib/edge/{input-6c50146c.js → input-9c1e8a98.js} +1 -1
- package/lib/edge/{select-55d2c8fa.cjs → select-c58218b7.cjs} +1 -1
- package/lib/edge/{select-b6c2fdd5.js → select-fd1e4221.js} +1 -1
- package/lib/edge/{server-entry-e914f16e.js → server-entry-72a543d1.js} +138 -135
- package/lib/edge/server-entry-f03cbcfe.cjs +2 -0
- package/lib/edge/server-entry.cjs +1 -1
- package/lib/edge/server-entry.mjs +1 -1
- package/lib/edge/{slot-8d3b7707.cjs → slot-864f8ee7.cjs} +1 -1
- package/lib/edge/{slot-84e40920.js → slot-ec9f4a5e.js} +4 -4
- package/lib/edge/{symbol-468348d8.cjs → symbol-68340c52.cjs} +1 -1
- package/lib/edge/{symbol-7436ff06.js → symbol-78fe0b05.js} +2 -2
- package/lib/edge/{tabs-802a32f0.cjs → tabs-b0f30ed3.cjs} +1 -1
- package/lib/edge/{tabs-65d455da.js → tabs-c847b763.js} +4 -4
- package/lib/edge/{text-423e3303.js → text-5ed7f583.js} +2 -2
- package/lib/edge/{text-450bf7e4.cjs → text-ff0134a1.cjs} +1 -1
- package/lib/node/blocks-exports.cjs +21 -21
- package/lib/node/blocks-exports.mjs +53 -46
- package/lib/node/index.cjs +1 -1
- package/lib/node/index.mjs +26 -25
- package/lib/node/init.cjs +1 -1
- package/lib/node/init.mjs +6 -5
- package/lib/node/server-entry-b19b6f07.cjs +2 -0
- package/lib/node/{server-entry-569f32b2.js → server-entry-bac0a183.js} +138 -135
- package/lib/node/server-entry.cjs +1 -1
- package/lib/node/server-entry.mjs +1 -1
- package/lib/node/{should-force-browser-runtime-in-node-3f610831.js → setIvm-22947995.js} +45 -57
- package/lib/node/setIvm-e38cb38e.cjs +48 -0
- package/lib/node/setIvm.cjs +1 -0
- package/lib/node/setIvm.mjs +5 -0
- package/lib/node/should-force-browser-runtime-in-node-0d7217c7.cjs +1 -0
- package/lib/node/should-force-browser-runtime-in-node-5458ba48.js +17 -0
- package/package.json +8 -2
- package/types/components/content/components/enable-editor.d.ts +1 -1
- package/types/components/content-variants/content-variants.types.d.ts +4 -0
- package/types/constants/sdk-version.d.ts +1 -1
- package/types/functions/evaluate/node-runtime/setIvm.d.ts +1 -0
- package/types/functions/get-content/types.d.ts +4 -0
- package/types/functions/track/index.d.ts +3 -1
- package/lib/browser/server-entry-f8b08c1e.cjs +0 -2
- package/lib/edge/server-entry-ae44ef40.cjs +0 -2
- package/lib/node/server-entry-781dde88.cjs +0 -2
- package/lib/node/should-force-browser-runtime-in-node-13070d3a.cjs +0 -48
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as l, Fragment as w, jsxs as V } from "react/jsx-runtime";
|
|
3
|
-
import { TARGET as D, isBrowser as
|
|
3
|
+
import { TARGET as D, isBrowser as _, logger as ne, checkIsDefined as Z, isPreviewing as xe, isEditing as N, registerInsertMenu as Le, setupBrowserForEditing as Oe, createRegisterComponentMessage as Ue, getDefaultCanTrack as q, _track as le, fetchOneEntry as ve, createEditorListener as He, serializeIncludingFunctions as se, handleABTestingSync as je } from "./server-entry-bac0a183.js";
|
|
4
4
|
import { createContext as Se, useEffect as B, useState as T, useRef as $, useContext as ce, createElement as ke } from "react";
|
|
5
|
-
import { getFunctionArguments as
|
|
5
|
+
import { getFunctionArguments as Me, flattenState as _e, runInNode as qe, parseCode as Ke, getBuilderGlobals as ze, set as Ce, fastClone as ie } from "./setIvm-22947995.js";
|
|
6
|
+
import { shouldForceBrowserRuntimeInNode as Je } from "./should-force-browser-runtime-in-node-5458ba48.js";
|
|
6
7
|
const Ge = /* @__PURE__ */ new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"]), Ye = (e) => typeof e == "string" && Ge.has(e.toLowerCase());
|
|
7
8
|
function oe(e) {
|
|
8
9
|
return /* @__PURE__ */ l(w, { children: Ye(e.TagName) ? /* @__PURE__ */ l(w, { children: /* @__PURE__ */ l(e.TagName, { ...e.attributes, ...e.actionAttributes }) }) : /* @__PURE__ */ l(w, { children: typeof e.TagName == "string" ? /* @__PURE__ */ l(e.TagName, { ...e.attributes, ...e.actionAttributes, children: e.children }) : /* @__PURE__ */ l(e.TagName, { ...e.attributes, ...e.actionAttributes, children: e.children }) }) });
|
|
@@ -85,20 +86,20 @@ const Ie = (e, t, n) => {
|
|
|
85
86
|
rootSetState: a,
|
|
86
87
|
rootState: r
|
|
87
88
|
}) => {
|
|
88
|
-
const s =
|
|
89
|
+
const s = Me({
|
|
89
90
|
builder: t,
|
|
90
91
|
context: n,
|
|
91
92
|
event: i,
|
|
92
|
-
state:
|
|
93
|
+
state: _e({
|
|
93
94
|
rootState: r,
|
|
94
95
|
localState: o,
|
|
95
96
|
rootSetState: a
|
|
96
97
|
})
|
|
97
98
|
});
|
|
98
99
|
return new Function(...s.map(([d]) => d), e)(...s.map(([, d]) => d));
|
|
99
|
-
}, tt = (e) =>
|
|
100
|
+
}, tt = (e) => _() || Je({
|
|
100
101
|
shouldLogWarning: !0
|
|
101
|
-
}) ? et(e) :
|
|
102
|
+
}) ? et(e) : qe(e), nt = /^(return )?(\s*)?state(?<getPath>(\.\w+)+)(\s*);?$/, it = /(\s)*var(\s)+_virtual_index(\s)*=(\s)*state(?<getPath>(\.\w+)+)(\s*);?(\s)*return(\s)*_virtual_index(\s)*/, ot = (e) => {
|
|
102
103
|
var t, n, i, o, a, r;
|
|
103
104
|
return ((i = (n = (t = nt.exec(e.trim())) == null ? void 0 : t.groups) == null ? void 0 : n.getPath) == null ? void 0 : i.slice(1)) || ((r = (a = (o = it.exec(e.trim())) == null ? void 0 : o.groups) == null ? void 0 : a.getPath) == null ? void 0 : r.slice(1));
|
|
104
105
|
};
|
|
@@ -120,10 +121,10 @@ function L({
|
|
|
120
121
|
...n
|
|
121
122
|
}, s);
|
|
122
123
|
const d = {
|
|
123
|
-
code:
|
|
124
|
+
code: Ke(e, {
|
|
124
125
|
isExpression: r
|
|
125
126
|
}),
|
|
126
|
-
builder:
|
|
127
|
+
builder: ze(),
|
|
127
128
|
context: t,
|
|
128
129
|
event: a,
|
|
129
130
|
rootSetState: o,
|
|
@@ -319,7 +320,7 @@ const Pe = (e) => Object.entries(e).map(([n, i]) => {
|
|
|
319
320
|
if (typeof i == "string")
|
|
320
321
|
return `${K(n)}: ${i};`;
|
|
321
322
|
}).filter(Z), ft = (e) => Pe(e).join(`
|
|
322
|
-
`),
|
|
323
|
+
`), j = ({
|
|
323
324
|
mediaQuery: e,
|
|
324
325
|
className: t,
|
|
325
326
|
styles: n
|
|
@@ -490,17 +491,17 @@ function kt(e) {
|
|
|
490
491
|
), s = o == null ? void 0 : o.large, d = o == null ? void 0 : o.medium, c = o == null ? void 0 : o.small, h = i.id;
|
|
491
492
|
if (!h)
|
|
492
493
|
return "";
|
|
493
|
-
const b = s ?
|
|
494
|
+
const b = s ? j({
|
|
494
495
|
className: h,
|
|
495
496
|
styles: s
|
|
496
|
-
}) : "", f = d ?
|
|
497
|
+
}) : "", f = d ? j({
|
|
497
498
|
className: h,
|
|
498
499
|
styles: d,
|
|
499
500
|
mediaQuery: de(
|
|
500
501
|
"medium",
|
|
501
502
|
r
|
|
502
503
|
)
|
|
503
|
-
}) : "", v = c ?
|
|
504
|
+
}) : "", v = c ? j({
|
|
504
505
|
className: h,
|
|
505
506
|
styles: c,
|
|
506
507
|
mediaQuery: de(
|
|
@@ -511,7 +512,7 @@ function kt(e) {
|
|
|
511
512
|
let S = "";
|
|
512
513
|
if (g) {
|
|
513
514
|
const k = ((C = (R = g.steps) == null ? void 0 : R[1]) == null ? void 0 : C.styles) || {};
|
|
514
|
-
S =
|
|
515
|
+
S = j({
|
|
515
516
|
className: `${h}:hover`,
|
|
516
517
|
styles: {
|
|
517
518
|
...k,
|
|
@@ -701,7 +702,7 @@ function ue(e) {
|
|
|
701
702
|
contextValue: e.context
|
|
702
703
|
}),
|
|
703
704
|
children: (i = e.blockChildren) == null ? void 0 : i.map((o) => /* @__PURE__ */ l(
|
|
704
|
-
|
|
705
|
+
H,
|
|
705
706
|
{
|
|
706
707
|
block: o,
|
|
707
708
|
context: e.context,
|
|
@@ -716,7 +717,7 @@ function ue(e) {
|
|
|
716
717
|
function me(e) {
|
|
717
718
|
const [t, n] = T(() => e.repeatContext);
|
|
718
719
|
return /* @__PURE__ */ l(ae.Provider, { value: t, children: /* @__PURE__ */ l(
|
|
719
|
-
|
|
720
|
+
H,
|
|
720
721
|
{
|
|
721
722
|
block: e.block,
|
|
722
723
|
context: t,
|
|
@@ -725,7 +726,7 @@ function me(e) {
|
|
|
725
726
|
}
|
|
726
727
|
) });
|
|
727
728
|
}
|
|
728
|
-
function
|
|
729
|
+
function H(e) {
|
|
729
730
|
var h, b, f, v;
|
|
730
731
|
function t() {
|
|
731
732
|
return pt({
|
|
@@ -860,7 +861,7 @@ function j(e) {
|
|
|
860
861
|
}
|
|
861
862
|
),
|
|
862
863
|
(b = d()) == null ? void 0 : b.map((g) => /* @__PURE__ */ l(
|
|
863
|
-
|
|
864
|
+
H,
|
|
864
865
|
{
|
|
865
866
|
block: g,
|
|
866
867
|
registeredComponents: e.registeredComponents,
|
|
@@ -948,7 +949,7 @@ function F(e) {
|
|
|
948
949
|
BlocksWrapper: ((i = e.context) == null ? void 0 : i.BlocksWrapper) || (t == null ? void 0 : t.BlocksWrapper),
|
|
949
950
|
BlocksWrapperProps: ((o = e.context) == null ? void 0 : o.BlocksWrapperProps) || (t == null ? void 0 : t.BlocksWrapperProps),
|
|
950
951
|
children: e.blocks ? /* @__PURE__ */ l(w, { children: (a = e.blocks) == null ? void 0 : a.map((r) => /* @__PURE__ */ l(
|
|
951
|
-
|
|
952
|
+
H,
|
|
952
953
|
{
|
|
953
954
|
block: r,
|
|
954
955
|
linkComponent: e.linkComponent,
|
|
@@ -1387,7 +1388,7 @@ const G = {
|
|
|
1387
1388
|
builderLinkComponent: !0
|
|
1388
1389
|
}
|
|
1389
1390
|
}, he = (e) => e.toString();
|
|
1390
|
-
function
|
|
1391
|
+
function Ht(e) {
|
|
1391
1392
|
var b;
|
|
1392
1393
|
const [t, n] = T(() => []);
|
|
1393
1394
|
function i() {
|
|
@@ -1510,7 +1511,7 @@ function jt(e) {
|
|
|
1510
1511
|
) : null
|
|
1511
1512
|
] })) });
|
|
1512
1513
|
}
|
|
1513
|
-
const
|
|
1514
|
+
const jt = {
|
|
1514
1515
|
name: "Core:Button",
|
|
1515
1516
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13",
|
|
1516
1517
|
defaultStyles: {
|
|
@@ -1546,7 +1547,7 @@ const Mt = {
|
|
|
1546
1547
|
shouldReceiveBuilderProps: {
|
|
1547
1548
|
builderLinkComponent: !0
|
|
1548
1549
|
}
|
|
1549
|
-
},
|
|
1550
|
+
}, Mt = {
|
|
1550
1551
|
// TODO: ways to statically preprocess JSON for references, functions, etc
|
|
1551
1552
|
name: "Columns",
|
|
1552
1553
|
isRSC: !0,
|
|
@@ -1753,7 +1754,7 @@ const Mt = {
|
|
|
1753
1754
|
builderComponents: !0,
|
|
1754
1755
|
builderLinkComponent: !0
|
|
1755
1756
|
}
|
|
1756
|
-
},
|
|
1757
|
+
}, _t = {
|
|
1757
1758
|
name: "Fragment",
|
|
1758
1759
|
static: !0,
|
|
1759
1760
|
hidden: !0,
|
|
@@ -2714,7 +2715,7 @@ function dn(e) {
|
|
|
2714
2715
|
...e.attributes,
|
|
2715
2716
|
children: [
|
|
2716
2717
|
e.builderBlock && e.builderBlock.children ? /* @__PURE__ */ l(w, { children: (f = (b = e.builderBlock) == null ? void 0 : b.children) == null ? void 0 : f.map((v, g) => /* @__PURE__ */ l(
|
|
2717
|
-
|
|
2718
|
+
H,
|
|
2718
2719
|
{
|
|
2719
2720
|
block: v,
|
|
2720
2721
|
context: e.builderContext,
|
|
@@ -3205,13 +3206,13 @@ const Cn = () => [{
|
|
|
3205
3206
|
...Sn
|
|
3206
3207
|
}], ge = () => [{
|
|
3207
3208
|
component: Qe,
|
|
3208
|
-
...
|
|
3209
|
+
...jt
|
|
3209
3210
|
}, {
|
|
3210
3211
|
component: Nt,
|
|
3211
|
-
...
|
|
3212
|
+
...Mt
|
|
3212
3213
|
}, {
|
|
3213
3214
|
component: Ft,
|
|
3214
|
-
...
|
|
3215
|
+
..._t
|
|
3215
3216
|
}, {
|
|
3216
3217
|
component: Lt,
|
|
3217
3218
|
...qt
|
|
@@ -3231,7 +3232,7 @@ const Cn = () => [{
|
|
|
3231
3232
|
component: Qt,
|
|
3232
3233
|
...Yt
|
|
3233
3234
|
}, {
|
|
3234
|
-
component:
|
|
3235
|
+
component: Ht,
|
|
3235
3236
|
...Ut
|
|
3236
3237
|
}, ...Cn()], Tn = `function updateCookiesAndStyles(contentId, variants, isHydrationTarget) {
|
|
3237
3238
|
function getAndSetVariantId() {
|
|
@@ -3323,14 +3324,14 @@ const Cn = () => [{
|
|
|
3323
3324
|
thisScriptEl?.remove();
|
|
3324
3325
|
}
|
|
3325
3326
|
return;
|
|
3326
|
-
}`, Ne = "builderIoAbTest", Fe = "builderIoRenderContent",
|
|
3327
|
+
}`, Ne = "builderIoAbTest", Fe = "builderIoRenderContent", M = (e) => Object.values((e == null ? void 0 : e.variations) || {}).map((t) => ({
|
|
3327
3328
|
...t,
|
|
3328
3329
|
testVariationId: t.id,
|
|
3329
3330
|
id: e == null ? void 0 : e.id
|
|
3330
3331
|
})), wn = ({
|
|
3331
3332
|
canTrack: e,
|
|
3332
3333
|
content: t
|
|
3333
|
-
}) => !(!(
|
|
3334
|
+
}) => !(!(M(t).length > 0) || !e || _()), En = (e) => e === "react" || e === "reactNative", $e = En(D), Rn = () => `
|
|
3334
3335
|
window.${Ne} = ${Tn}
|
|
3335
3336
|
window.${Fe} = ${In}
|
|
3336
3337
|
`, Pn = (e, t) => `
|
|
@@ -3490,7 +3491,7 @@ function Un(e) {
|
|
|
3490
3491
|
() => e.contentWrapper || "div"
|
|
3491
3492
|
);
|
|
3492
3493
|
function s(m) {
|
|
3493
|
-
return
|
|
3494
|
+
return He({
|
|
3494
3495
|
model: e.model,
|
|
3495
3496
|
trustedHosts: e.trustedHosts,
|
|
3496
3497
|
callbacks: {
|
|
@@ -3518,6 +3519,7 @@ function Un(e) {
|
|
|
3518
3519
|
if (e.builderContextSignal.content) {
|
|
3519
3520
|
const u = (y = e.builderContextSignal.content) == null ? void 0 : y.testVariationId, p = (I = e.builderContextSignal.content) == null ? void 0 : I.id;
|
|
3520
3521
|
le({
|
|
3522
|
+
apiHost: e.apiHost,
|
|
3521
3523
|
type: "click",
|
|
3522
3524
|
canTrack: q(e.canTrack),
|
|
3523
3525
|
contentId: p,
|
|
@@ -3577,8 +3579,8 @@ function Un(e) {
|
|
|
3577
3579
|
const R = $(!1);
|
|
3578
3580
|
return R.current || (S(), x(), R.current = !0), B(() => {
|
|
3579
3581
|
var m, y;
|
|
3580
|
-
if (
|
|
3581
|
-
if (N() && (window.addEventListener("message", s), Le(), Oe({
|
|
3582
|
+
if (_()) {
|
|
3583
|
+
if (N() && !e.isNestedRender && (window.addEventListener("message", s), Le(), Oe({
|
|
3582
3584
|
...e.locale ? {
|
|
3583
3585
|
locale: e.locale
|
|
3584
3586
|
} : {},
|
|
@@ -3600,6 +3602,7 @@ function Un(e) {
|
|
|
3600
3602
|
)), e.builderContextSignal.content && q(e.canTrack)) {
|
|
3601
3603
|
const u = (m = e.builderContextSignal.content) == null ? void 0 : m.testVariationId, p = (y = e.builderContextSignal.content) == null ? void 0 : y.id, E = e.apiKey;
|
|
3602
3604
|
le({
|
|
3605
|
+
apiHost: e.apiHost,
|
|
3603
3606
|
type: "impression",
|
|
3604
3607
|
canTrack: !0,
|
|
3605
3608
|
contentId: p,
|
|
@@ -3631,7 +3634,7 @@ function Un(e) {
|
|
|
3631
3634
|
locale: e.locale
|
|
3632
3635
|
});
|
|
3633
3636
|
}, [e.locale]), B(() => () => {
|
|
3634
|
-
|
|
3637
|
+
_() && (window.removeEventListener("message", s), window.removeEventListener(
|
|
3635
3638
|
"builder:component:stateChangeListenerActivated",
|
|
3636
3639
|
x
|
|
3637
3640
|
));
|
|
@@ -3651,7 +3654,7 @@ function Un(e) {
|
|
|
3651
3654
|
}
|
|
3652
3655
|
) : null });
|
|
3653
3656
|
}
|
|
3654
|
-
function
|
|
3657
|
+
function Hn(e) {
|
|
3655
3658
|
const [t, n] = T(
|
|
3656
3659
|
() => `
|
|
3657
3660
|
${$n({
|
|
@@ -3673,7 +3676,7 @@ ${Ln(e.isNestedRender)}
|
|
|
3673
3676
|
}
|
|
3674
3677
|
);
|
|
3675
3678
|
}
|
|
3676
|
-
const
|
|
3679
|
+
const jn = ({
|
|
3677
3680
|
content: e,
|
|
3678
3681
|
data: t,
|
|
3679
3682
|
locale: n
|
|
@@ -3690,7 +3693,7 @@ const Mn = ({
|
|
|
3690
3693
|
locale: n
|
|
3691
3694
|
} : {}
|
|
3692
3695
|
};
|
|
3693
|
-
},
|
|
3696
|
+
}, Mn = ({
|
|
3694
3697
|
content: e,
|
|
3695
3698
|
data: t
|
|
3696
3699
|
}) => e ? {
|
|
@@ -3740,12 +3743,12 @@ function ye(e) {
|
|
|
3740
3743
|
), [r, s] = T(() => {
|
|
3741
3744
|
var C;
|
|
3742
3745
|
return {
|
|
3743
|
-
content:
|
|
3746
|
+
content: Mn({
|
|
3744
3747
|
content: e.content,
|
|
3745
3748
|
data: e.data
|
|
3746
3749
|
}),
|
|
3747
3750
|
localState: void 0,
|
|
3748
|
-
rootState:
|
|
3751
|
+
rootState: jn({
|
|
3749
3752
|
content: e.content,
|
|
3750
3753
|
data: e.data,
|
|
3751
3754
|
locale: e.locale
|
|
@@ -3796,6 +3799,7 @@ function ye(e) {
|
|
|
3796
3799
|
children: /* @__PURE__ */ V(
|
|
3797
3800
|
Un,
|
|
3798
3801
|
{
|
|
3802
|
+
apiHost: e.apiHost,
|
|
3799
3803
|
nonce: e.nonce,
|
|
3800
3804
|
content: e.content,
|
|
3801
3805
|
data: e.data,
|
|
@@ -3810,6 +3814,7 @@ function ye(e) {
|
|
|
3810
3814
|
contentWrapper: e.contentWrapper,
|
|
3811
3815
|
contentWrapperProps: e.contentWrapperProps,
|
|
3812
3816
|
trustedHosts: e.trustedHosts,
|
|
3817
|
+
isNestedRender: e.isNestedRender,
|
|
3813
3818
|
setBuilderContextSignal: s,
|
|
3814
3819
|
children: [
|
|
3815
3820
|
e.isSsrAbTest ? /* @__PURE__ */ l(
|
|
@@ -3821,7 +3826,7 @@ function ye(e) {
|
|
|
3821
3826
|
}
|
|
3822
3827
|
) : null,
|
|
3823
3828
|
/* @__PURE__ */ l(
|
|
3824
|
-
|
|
3829
|
+
Hn,
|
|
3825
3830
|
{
|
|
3826
3831
|
nonce: e.nonce || "",
|
|
3827
3832
|
isNestedRender: e.isNestedRender,
|
|
@@ -3845,7 +3850,7 @@ function ye(e) {
|
|
|
3845
3850
|
}
|
|
3846
3851
|
);
|
|
3847
3852
|
}
|
|
3848
|
-
function
|
|
3853
|
+
function _n(e) {
|
|
3849
3854
|
var r;
|
|
3850
3855
|
const [t, n] = T(
|
|
3851
3856
|
() => wn({
|
|
@@ -3856,7 +3861,7 @@ function Hn(e) {
|
|
|
3856
3861
|
function i() {
|
|
3857
3862
|
var s;
|
|
3858
3863
|
return Pn(
|
|
3859
|
-
|
|
3864
|
+
M(e.content).map((d) => ({
|
|
3860
3865
|
id: d.testVariationId,
|
|
3861
3866
|
testRatio: d.testRatio
|
|
3862
3867
|
})),
|
|
@@ -3864,14 +3869,14 @@ function Hn(e) {
|
|
|
3864
3869
|
);
|
|
3865
3870
|
}
|
|
3866
3871
|
function o() {
|
|
3867
|
-
return
|
|
3872
|
+
return M(e.content).map((s) => `.variant-${s.testVariationId} { display: none; } `).join("");
|
|
3868
3873
|
}
|
|
3869
3874
|
function a() {
|
|
3870
3875
|
var s;
|
|
3871
3876
|
return t ? {
|
|
3872
3877
|
...e.content,
|
|
3873
3878
|
testVariationId: (s = e.content) == null ? void 0 : s.id
|
|
3874
|
-
} :
|
|
3879
|
+
} : je({
|
|
3875
3880
|
item: e.content,
|
|
3876
3881
|
canTrack: q(e.canTrack)
|
|
3877
3882
|
});
|
|
@@ -3903,9 +3908,10 @@ function Hn(e) {
|
|
|
3903
3908
|
nonce: e.nonce || ""
|
|
3904
3909
|
}
|
|
3905
3910
|
),
|
|
3906
|
-
(r =
|
|
3911
|
+
(r = M(e.content)) == null ? void 0 : r.map((s) => /* @__PURE__ */ l(
|
|
3907
3912
|
ye,
|
|
3908
3913
|
{
|
|
3914
|
+
apiHost: e.apiHost,
|
|
3909
3915
|
isNestedRender: e.isNestedRender,
|
|
3910
3916
|
nonce: e.nonce,
|
|
3911
3917
|
content: s,
|
|
@@ -3933,6 +3939,7 @@ function Hn(e) {
|
|
|
3933
3939
|
/* @__PURE__ */ l(
|
|
3934
3940
|
ye,
|
|
3935
3941
|
{
|
|
3942
|
+
apiHost: e.apiHost,
|
|
3936
3943
|
nonce: e.nonce,
|
|
3937
3944
|
isNestedRender: e.isNestedRender,
|
|
3938
3945
|
content: a(),
|
|
@@ -4009,7 +4016,7 @@ function Kn(e) {
|
|
|
4009
4016
|
}, []), B(() => {
|
|
4010
4017
|
r();
|
|
4011
4018
|
}, [e.symbol]), /* @__PURE__ */ l("div", { ...e.attributes, className: i(), children: /* @__PURE__ */ l(
|
|
4012
|
-
|
|
4019
|
+
_n,
|
|
4013
4020
|
{
|
|
4014
4021
|
nonce: e.builderContext.nonce,
|
|
4015
4022
|
isNestedRender: !0,
|
|
@@ -4039,7 +4046,7 @@ export {
|
|
|
4039
4046
|
ae as BuilderContext,
|
|
4040
4047
|
Qe as Button,
|
|
4041
4048
|
Nt as Columns,
|
|
4042
|
-
|
|
4049
|
+
_n as Content,
|
|
4043
4050
|
Ft as Fragment,
|
|
4044
4051
|
Lt as Image,
|
|
4045
4052
|
Ot as Section,
|
package/lib/node/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-b19b6f07.cjs");require("react/jsx-runtime");require("react");require("./setIvm-e38cb38e.cjs");require("./should-force-browser-runtime-in-node-0d7217c7.cjs");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/node/index.mjs
CHANGED
|
@@ -1,30 +1,31 @@
|
|
|
1
|
-
import { Blocks as
|
|
2
|
-
import { _processContentResult as
|
|
1
|
+
import { Blocks as n, BuilderContext as m, Button as c, Columns as g, Content as p, Fragment as a, Image as d, Section as l, Symbol as u, Text as f, Video as B } from "./blocks-exports.mjs";
|
|
2
|
+
import { _processContentResult as E, createRegisterComponentMessage as h, fetchBuilderProps as x, fetchEntries as S, fetchOneEntry as b, getBuilderSearchParams as P, isEditing as k, isPreviewing as y, register as R, setEditorSettings as T, subscribeToEditor as v, track as w } from "./server-entry-bac0a183.js";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "react";
|
|
5
|
-
import "./
|
|
5
|
+
import "./setIvm-22947995.js";
|
|
6
|
+
import "./should-force-browser-runtime-in-node-5458ba48.js";
|
|
6
7
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
n as Blocks,
|
|
9
|
+
m as BuilderContext,
|
|
10
|
+
c as Button,
|
|
11
|
+
g as Columns,
|
|
12
|
+
p as Content,
|
|
12
13
|
a as Fragment,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
14
|
+
d as Image,
|
|
15
|
+
l as Section,
|
|
16
|
+
u as Symbol,
|
|
17
|
+
f as Text,
|
|
18
|
+
B as Video,
|
|
19
|
+
E as _processContentResult,
|
|
20
|
+
h as createRegisterComponentMessage,
|
|
21
|
+
x as fetchBuilderProps,
|
|
22
|
+
S as fetchEntries,
|
|
23
|
+
b as fetchOneEntry,
|
|
24
|
+
P as getBuilderSearchParams,
|
|
25
|
+
k as isEditing,
|
|
26
|
+
y as isPreviewing,
|
|
27
|
+
R as register,
|
|
28
|
+
T as setEditorSettings,
|
|
29
|
+
v as subscribeToEditor,
|
|
30
|
+
w as track
|
|
30
31
|
};
|
package/lib/node/init.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./should-force-browser-runtime-in-node-0d7217c7.cjs"),t=require("isolated-vm"),r=require("./setIvm-e38cb38e.cjs");require("./server-entry-b19b6f07.cjs");const n=e=>{if(o.shouldForceBrowserRuntimeInNode({shouldLogWarning:!0}))return;const{ivmIsolateOptions:i}=e||{};r.setIvm(t,i)};exports.initializeNodeRuntime=n;
|
package/lib/node/init.mjs
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { shouldForceBrowserRuntimeInNode as
|
|
2
|
-
import
|
|
3
|
-
import "./
|
|
1
|
+
import { shouldForceBrowserRuntimeInNode as r } from "./should-force-browser-runtime-in-node-5458ba48.js";
|
|
2
|
+
import t from "isolated-vm";
|
|
3
|
+
import { setIvm as e } from "./setIvm-22947995.js";
|
|
4
|
+
import "./server-entry-bac0a183.js";
|
|
4
5
|
const u = (o) => {
|
|
5
|
-
if (
|
|
6
|
+
if (r({
|
|
6
7
|
shouldLogWarning: !0
|
|
7
8
|
}))
|
|
8
9
|
return;
|
|
9
10
|
const {
|
|
10
11
|
ivmIsolateOptions: i
|
|
11
12
|
} = o || {};
|
|
12
|
-
|
|
13
|
+
e(t, i);
|
|
13
14
|
};
|
|
14
15
|
export {
|
|
15
16
|
u as initializeNodeRuntime
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const y="react",I="[Builder.io]: ",l={log:(...e)=>console.log(I,...e),error:(...e)=>console.error(I,...e),warn:(...e)=>console.warn(I,...e),debug:(...e)=>console.debug(I,...e)};function c(){return typeof window!="undefined"&&typeof document!="undefined"}const le=e=>{const t={};return e.forEach((n,r)=>{t[r]=n}),t},V=e=>e instanceof URLSearchParams?le(e):e,M=e=>typeof e=="string"?e:e instanceof URLSearchParams?e.toString():new URLSearchParams(e).toString();function fe(){return c()&&window.self!==window.top}function F(e){return fe()&&M(e||window.location.search).indexOf("builder.frameEditing=")!==-1}const ge=()=>{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},he=()=>typeof navigator=="object"&&navigator.userAgent||"",N=()=>{const e=he(),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=ge();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 pe(e){const t=e||(c()?window.location.search:void 0);return t?M(t).indexOf("builder.preview=")!==-1:!1}const me=e=>({type:"builder.registerComponent",data:k(e)}),ye=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"?ye(n):n))}const x={};function D(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 R={};function Se(e){if(c()){Object.assign(R,e);const t={type:"builder.settingsChange",data:R};parent.postMessage(t,"*")}}const B="builder.",we="options.",P=e=>{if(!e)return{};const t=V(e),n={};return Object.keys(t).forEach(r=>{if(r.startsWith(B)){const o=r.replace(B,"").replace(we,"");n[o]=t[r]}}),n},be=()=>{if(!c())return{};const e=new URLSearchParams(window.location.search);return P(e)},K="2.0.27",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){l.warn("[COOKIE] GET error: ",(r==null?void 0:r.message)||r);return}},_=async e=>W(e),ve=e=>e.map(([t,n])=>n?`${t}=${n}`:t).filter(p).join("; "),Ee=[["secure",""],["SameSite","None"]],ke=({name:e,value:t,expires:n})=>{const o=(c()?location.protocol==="https:":!0)?Ee:[[]],s=n?[["expires",n.toUTCString()]]:[[]],i=[[e,t],...s,["path","/"],["domain",Ie(window.location.hostname)],...o];return ve(i)},$=async({name:e,value:t,expires:n,canTrack:r})=>{try{if(!r)return;const o=ke({name:e,value:t,expires:n});document.cookie=o}catch(o){l.warn("[COOKIE] SET error: ",(o==null?void 0:o.message)||o)}};function Pe(){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 G(){return Pe().replace(/-/g,"")}const X="builderSessionId",Oe=async({canTrack:e})=>{if(!e)return;const t=await _({name:X,canTrack:e});if(p(t))return t;{const n=Ce();return Ae({id:n,canTrack:e}),n}},Ce=()=>G(),Ae=({id:e,canTrack:t})=>$({name:X,value:e,canTrack:t}),H=()=>c()&&typeof localStorage!="undefined"?localStorage:void 0,Te=({key:e,canTrack:t})=>{var n;try{return t?(n=H())==null?void 0:n.getItem(e):void 0}catch(r){console.debug("[LocalStorage] GET error: ",r);return}},xe=({key:e,canTrack:t,value:n})=>{var r;try{t&&((r=H())==null||r.setItem(e,n))}catch(o){console.debug("[LocalStorage] SET error: ",o)}},z="builderVisitorId",Re=({canTrack:e})=>{if(!e)return;const t=Te({key:z,canTrack:e});if(p(t))return t;{const n=Be();return Le({id:n,canTrack:e}),n}},Be=()=>G(),Le=({id:e,canTrack:t})=>xe({key:z,value:e,canTrack:t}),Ue=async({canTrack:e})=>{if(!e)return{visitorId:void 0,sessionId:void 0};const t=await Oe({canTrack:e}),n=Re({canTrack:e});return{sessionId:t,visitorId:n}},Ve=async({type:e,canTrack:t,apiKey:n,metadata:r,...o})=>({type:e,data:{...o,metadata:{url:location.href,...r},...await Ue({canTrack:t}),userAttributes:N(),ownerId:n}});async function J({apiHost:e,...t}){if(!t.apiKey){l.error("Missing API key for track call. Please provide your API key.");return}return!t.canTrack||F()||!(c()||y==="reactNative")?void 0:fetch(`${e||"https://cdn.builder.io"}/api/v1/track`,{method:"POST",body:JSON.stringify({events:[await Ve(t)]}),headers:{"content-type":"application/json",...j()},mode:"cors"}).catch(r=>{console.error("Failed to track: ",r)})}const Me=e=>J({...e,canTrack:!0}),Fe=["*.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||Fe).findIndex(o=>o.startsWith("*.")?r.endsWith(o.slice(1)):o===r)>-1}const Ne=()=>{D("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 L=!1;const Q=(e={})=>{var t,n;L||(L=!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,v=new Function(u);let d,g=null;try{d=v.apply(null,S)}catch(h){g=h}g?(s=window.parent)==null||s.postMessage({type:"builder.evaluateError",data:{id:m,error:g.message}},"*"):d&&typeof d.then=="function"?d.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:d,id:m}},"*");break}}})))},Y=({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}}},De=(e,t,n)=>{if(!c)return l.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."),()=>{};Q();const r=Y({callbacks:{contentUpdate:t,animation:()=>{},configureSdk:()=>{}},model:e,trustedHosts:n==null?void 0:n.trustedHosts});return window.addEventListener("message",r),()=>{window.removeEventListener("message",r)}},Ke="builder.tests",O=e=>`${Ke}.${e}`,je=({contentId:e})=>_({name:O(e),canTrack:!0}),We=({contentId:e})=>W({name:O(e),canTrack:!0}),_e=({contentId:e,value:t})=>$({name:O(e),value:t,canTrack:!0}),Z=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},ee=e=>{const t=$e(e);return _e({contentId:e.id,value:t}).catch(n=>{l.error("could not store A/B test variation: ",n)}),t},te=({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":"")}},Ge=({item:e,canTrack:t})=>{if(!t)return e;if(!e)return;if(!Z(e))return e;const n=We({contentId:e.id})||ee({variations:e.variations,id:e.id}),r=te({item:e,testGroupId:n});return{...e,...r}},Xe=async({item:e,canTrack:t})=>{if(!t||!Z(e))return e;const r=await je({contentId:e.id})||ee({variations:e.variations,id:e.id}),o=te({item:e,testGroupId:r});return{...e,...o}},ne=e=>p(e)?e:!0;function He(){return typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:globalThis}function ze(){const e=He().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 Je=ze();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 re(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("$"))?re(o,s,n):n[s]=o}return n}const qe="v3",U=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:v,offset:d,cacheSeconds:g,staleCacheSeconds:h,sort:w,includeUnpublished:A,apiHost:ae}=e;if(!s)throw new Error("Missing API key");if(!["v3"].includes(S))throw new Error(`Invalid apiVersion: expected 'v3', received '${S}'`);const ce=t!==1,ue=ae||"https://cdn.builder.io",a=new URL(`${ue}/api/${S}/content/${o}`);if(a.searchParams.set("apiKey",s),a.searchParams.set("limit",String(t)),a.searchParams.set("noTraverse",String(ce)),a.searchParams.set("includeRefs",String(!0)),u&&a.searchParams.set("locale",u),i&&a.searchParams.set("enrich",String(i)),a.searchParams.set("omit",v||"meta.componentsUsed"),m&&a.searchParams.set("fields",m),Number.isFinite(d)&&d>-1&&a.searchParams.set("offset",String(Math.floor(d))),typeof A=="boolean"&&a.searchParams.set("includeUnpublished",String(A)),g&&U(g)&&a.searchParams.set("cacheSeconds",String(g)),h&&U(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 de={...be(),...V(e.options||{})},T=E(de);for(const f in T)a.searchParams.set(f,String(T[f]));if(n&&a.searchParams.set("userAttributes",JSON.stringify(n)),r){const f=re({query:r});for(const b in f)a.searchParams.set(b,JSON.stringify(f[b]))}return a},Qe=e=>"results"in e;async function oe(e){const t=await ie({...e,limit:1});return t&&t[0]||null}const Ye=async e=>{var i,u;const t=C(e),n=(i=e.fetch)!=null?i:Je,r={...e.fetchOptions,headers:{...(u=e.fetchOptions)==null?void 0:u.headers,...j()}};return await(await n(t.href,r)).json()},se=async(e,t,n=C(e))=>{const r=ne(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){l.error("Could not process A/B tests. ",o)}return t.results};async function ie(e){try{const t=C(e),n=await Ye(e);return Qe(n)?se(e,n):(l.error("Error fetching data. ",{url:t,content:n,options:e}),null)}catch(t){return l.error("Error fetching data. ",t),null}}const Ze=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 oe(n)}};exports.MSG_PREFIX=I;exports.TARGET=y;exports._processContentResult=se;exports._track=J;exports.checkIsDefined=p;exports.createEditorListener=Y;exports.createRegisterComponentMessage=me;exports.fetchBuilderProps=Ze;exports.fetchEntries=ie;exports.fetchOneEntry=oe;exports.getBuilderSearchParams=P;exports.getDefaultCanTrack=ne;exports.getUserAttributes=N;exports.handleABTestingSync=Ge;exports.isBrowser=c;exports.isEditing=F;exports.isPreviewing=pe;exports.logger=l;exports.register=D;exports.registerInsertMenu=Ne;exports.serializeIncludingFunctions=k;exports.setEditorSettings=Se;exports.setupBrowserForEditing=Q;exports.subscribeToEditor=De;exports.track=Me;
|