@builder.io/sdk-react 3.0.5 → 3.0.7
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 +167 -30
- package/lib/browser/blocks-exports.mjs +1370 -931
- package/lib/browser/index.cjs +1 -1
- package/lib/browser/index.mjs +17 -16
- package/lib/{edge/server-entry-67bfc740.js → browser/server-entry-20c79b90.js} +319 -274
- package/lib/browser/server-entry-762e29e0.cjs +2 -0
- package/lib/browser/server-entry.cjs +1 -1
- package/lib/browser/server-entry.mjs +1 -1
- package/lib/edge/{accordion-190c4426.cjs → accordion-071aa4f9.cjs} +1 -1
- package/lib/edge/{accordion-cd6e0363.js → accordion-22c2c037.js} +1 -1
- package/lib/edge/{blocks-fe2d7c1a.js → blocks-2989e629.js} +1343 -1318
- package/lib/edge/blocks-d3f37507.cjs +30 -0
- package/lib/edge/blocks-exports.cjs +1 -1
- package/lib/edge/blocks-exports.mjs +13 -12
- package/lib/edge/{button-6a27481c.js → button-2b5270c4.js} +2 -2
- package/lib/edge/{button-694fcd4f.cjs → button-a2cc6565.cjs} +1 -1
- package/lib/edge/{columns-90e6407e.js → columns-21b9be25.js} +3 -3
- package/lib/edge/{columns-b38bf0f7.cjs → columns-b7240242.cjs} +1 -1
- package/lib/edge/{content-variants-cbb89349.js → content-variants-88f4dc64.js} +165 -124
- package/lib/edge/content-variants-fdd5ee50.cjs +134 -0
- package/lib/edge/dynamic-blocks-exports.cjs +3 -1
- package/lib/edge/dynamic-blocks-exports.mjs +5 -2
- package/lib/edge/{form-547645eb.cjs → form-77687883.cjs} +1 -1
- package/lib/edge/{form-16bbf874.js → form-d29f3cc0.js} +3 -3
- package/lib/edge/{get-class-prop-name-8b719c6b.js → get-class-prop-name-dbc5d99c.js} +1 -1
- package/lib/edge/{get-class-prop-name-58770197.cjs → get-class-prop-name-f597545d.cjs} +1 -1
- package/lib/edge/{img-8859c851.cjs → img-03f9002b.cjs} +1 -1
- package/lib/edge/{img-d3351743.js → img-fed70928.js} +1 -1
- package/lib/edge/index.cjs +1 -1
- package/lib/edge/index.mjs +18 -17
- package/lib/edge/{input-24c601b4.js → input-083c3c35.js} +1 -1
- package/lib/edge/{input-4fe0fc6d.cjs → input-1e548fd0.cjs} +1 -1
- package/lib/edge/personalization-container-bcff3433.js +384 -0
- package/lib/edge/personalization-container-dde10a09.cjs +138 -0
- package/lib/edge/{select-c73bd418.cjs → select-21e33225.cjs} +1 -1
- package/lib/edge/{select-af05377b.js → select-9f22c2ba.js} +1 -1
- package/lib/{browser/server-entry-785c0408.js → edge/server-entry-43a6f5be.js} +339 -298
- package/lib/edge/server-entry-ac35a5c8.cjs +2 -0
- package/lib/edge/server-entry.cjs +1 -1
- package/lib/edge/server-entry.mjs +1 -1
- package/lib/edge/{slot-759c8dd9.cjs → slot-a9f5d6c0.cjs} +1 -1
- package/lib/edge/{slot-32a4df0c.js → slot-ca171e8c.js} +3 -3
- package/lib/edge/{symbol-50360a37.js → symbol-8f6ff028.js} +2 -2
- package/lib/edge/{symbol-8d63aa7d.cjs → symbol-a2015c7e.cjs} +1 -1
- package/lib/edge/{tabs-6535c934.js → tabs-6b67fca2.js} +3 -3
- package/lib/edge/{tabs-fc6c1700.cjs → tabs-880c9088.cjs} +1 -1
- package/lib/node/blocks-exports.cjs +168 -31
- package/lib/node/blocks-exports.mjs +1343 -904
- package/lib/node/index.cjs +1 -1
- package/lib/node/index.mjs +17 -16
- package/lib/node/init.cjs +1 -1
- package/lib/node/init.mjs +3 -3
- package/lib/node/server-entry-0b433783.cjs +2 -0
- package/lib/node/{server-entry-ffc70868.js → server-entry-6626257d.js} +280 -237
- package/lib/node/server-entry.cjs +1 -1
- package/lib/node/server-entry.mjs +1 -1
- package/lib/node/{setIvm-4ce0db03.cjs → setIvm-49abbae6.cjs} +1 -1
- package/lib/node/{setIvm-2cea7252.js → setIvm-5cb298bf.js} +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-d3e6df07.cjs → should-force-browser-runtime-in-node-11e8399e.cjs} +1 -1
- package/lib/node/{should-force-browser-runtime-in-node-c0d50009.js → should-force-browser-runtime-in-node-94f1a5b3.js} +1 -1
- package/package.json +1 -1
- package/types/blocks/personalization-container/component-info.d.ts +2 -0
- package/types/blocks/personalization-container/helpers/inlined-fns.d.ts +8 -0
- package/types/blocks/personalization-container/helpers.d.ts +27 -0
- package/types/blocks/personalization-container/index.d.ts +1 -0
- package/types/blocks/personalization-container/personalization-container.d.ts +4 -0
- package/types/blocks/personalization-container/personalization-container.types.d.ts +14 -0
- package/types/constants/device-sizes.d.ts +3 -2
- package/types/constants/sdk-version.d.ts +1 -1
- package/types/helpers/user-attributes.d.ts +17 -0
- package/types/index-helpers/blocks-exports.d.ts +1 -0
- package/types/types/builder-block.d.ts +0 -1
- package/types/types/builder-content.d.ts +1 -0
- package/types/types/input.d.ts +1 -0
- package/lib/browser/server-entry-101d66b8.cjs +0 -2
- package/lib/edge/blocks-766e8d45.cjs +0 -30
- package/lib/edge/content-variants-4e385c19.cjs +0 -134
- package/lib/edge/server-entry-3c7fa63a.cjs +0 -2
- package/lib/node/server-entry-95273908.cjs +0 -2
|
@@ -1,77 +1,120 @@
|
|
|
1
|
-
|
|
1
|
+
function c() {
|
|
2
|
+
return typeof window != "undefined" && typeof document != "undefined";
|
|
3
|
+
}
|
|
4
|
+
const I = "[Builder.io]: ", f = {
|
|
2
5
|
log: (...t) => console.log(I, ...t),
|
|
3
6
|
error: (...t) => console.error(I, ...t),
|
|
4
7
|
warn: (...t) => console.warn(I, ...t),
|
|
5
8
|
debug: (...t) => console.debug(I, ...t)
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
}, y = (t) => t != null, ot = (t) => {
|
|
10
|
+
if (t === "localhost" || t === "127.0.0.1")
|
|
11
|
+
return t;
|
|
12
|
+
const e = t.split(".");
|
|
13
|
+
return e.length > 2 ? e.slice(1).join(".") : t;
|
|
14
|
+
}, O = ({
|
|
15
|
+
name: t,
|
|
16
|
+
canTrack: e
|
|
17
|
+
}) => {
|
|
18
|
+
var n;
|
|
19
|
+
try {
|
|
20
|
+
return e ? (n = document.cookie.split("; ").find((r) => r.startsWith(`${t}=`))) == null ? void 0 : n.split("=")[1] : void 0;
|
|
21
|
+
} catch (r) {
|
|
22
|
+
f.warn("[COOKIE] GET error: ", (r == null ? void 0 : r.message) || r);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
}, M = async (t) => O(t), it = (t) => t.map(([e, n]) => n ? `${e}=${n}` : e).filter(y).join("; "), at = [["secure", ""], ["SameSite", "None"]], ct = ({
|
|
26
|
+
name: t,
|
|
27
|
+
value: e,
|
|
28
|
+
expires: n
|
|
29
|
+
}) => {
|
|
30
|
+
const s = (c() ? location.protocol === "https:" : !0) ? at : [[]], o = n ? [["expires", n.toUTCString()]] : [[]], i = [[t, e], ...o, ["path", "/"], ["domain", ot(window.location.hostname)], ...s];
|
|
31
|
+
return it(i);
|
|
32
|
+
}, P = async ({
|
|
33
|
+
name: t,
|
|
34
|
+
value: e,
|
|
35
|
+
expires: n,
|
|
36
|
+
canTrack: r
|
|
37
|
+
}) => {
|
|
38
|
+
try {
|
|
39
|
+
if (!r)
|
|
40
|
+
return;
|
|
41
|
+
const s = ct({
|
|
42
|
+
name: t,
|
|
43
|
+
value: e,
|
|
44
|
+
expires: n
|
|
45
|
+
});
|
|
46
|
+
document.cookie = s;
|
|
47
|
+
} catch (s) {
|
|
48
|
+
f.warn("[COOKIE] SET error: ", (s == null ? void 0 : s.message) || s);
|
|
49
|
+
}
|
|
50
|
+
}, R = "builder.userAttributes";
|
|
51
|
+
function ut() {
|
|
52
|
+
let t = !0;
|
|
53
|
+
const e = /* @__PURE__ */ new Set();
|
|
54
|
+
return {
|
|
55
|
+
setUserAttributes(n) {
|
|
56
|
+
if (!c())
|
|
57
|
+
return;
|
|
58
|
+
const r = {
|
|
59
|
+
...this.getUserAttributes(),
|
|
60
|
+
...n
|
|
61
|
+
};
|
|
62
|
+
P({
|
|
63
|
+
name: R,
|
|
64
|
+
value: JSON.stringify(r),
|
|
65
|
+
canTrack: t
|
|
66
|
+
}), e.forEach((s) => s(r));
|
|
67
|
+
},
|
|
68
|
+
getUserAttributes() {
|
|
69
|
+
return c() ? JSON.parse(O({
|
|
70
|
+
name: R,
|
|
71
|
+
canTrack: t
|
|
72
|
+
}) || "{}") : {};
|
|
73
|
+
},
|
|
74
|
+
subscribeOnUserAttributesChange(n) {
|
|
75
|
+
return e.add(n), () => {
|
|
76
|
+
e.delete(n);
|
|
77
|
+
};
|
|
78
|
+
},
|
|
79
|
+
setCanTrack(n) {
|
|
80
|
+
t = n;
|
|
81
|
+
}
|
|
82
|
+
};
|
|
9
83
|
}
|
|
10
|
-
const
|
|
84
|
+
const K = ut(), ee = (t) => {
|
|
85
|
+
K.setUserAttributes(t);
|
|
86
|
+
}, v = "react", lt = (t) => {
|
|
11
87
|
const e = {};
|
|
12
88
|
return t.forEach((n, r) => {
|
|
13
89
|
e[r] = n;
|
|
14
90
|
}), e;
|
|
15
|
-
},
|
|
16
|
-
function
|
|
91
|
+
}, j = (t) => t instanceof URLSearchParams ? lt(t) : t, W = (t) => typeof t == "string" ? t : t instanceof URLSearchParams ? t.toString() : new URLSearchParams(t).toString();
|
|
92
|
+
function dt() {
|
|
17
93
|
return c() && window.self !== window.top;
|
|
18
94
|
}
|
|
19
|
-
function
|
|
20
|
-
return
|
|
21
|
-
|
|
95
|
+
function ft(t) {
|
|
96
|
+
return dt() && // accessing window.location.search is safe here because `isIframe()` is only `true` if we're in a browser.
|
|
97
|
+
W(t || window.location.search).indexOf("builder.frameEditing=") !== -1;
|
|
22
98
|
}
|
|
23
|
-
|
|
24
|
-
if (c()) {
|
|
25
|
-
const t = new URL(location.href);
|
|
26
|
-
return t.pathname === "" && (t.pathname = "/"), t;
|
|
27
|
-
} else
|
|
28
|
-
return console.warn("Cannot get location for tracking in non-browser environment"), null;
|
|
29
|
-
}, at = () => typeof navigator == "object" && navigator.userAgent || "", ct = () => {
|
|
30
|
-
const t = at(), e = {
|
|
31
|
-
Android() {
|
|
32
|
-
return t.match(/Android/i);
|
|
33
|
-
},
|
|
34
|
-
BlackBerry() {
|
|
35
|
-
return t.match(/BlackBerry/i);
|
|
36
|
-
},
|
|
37
|
-
iOS() {
|
|
38
|
-
return t.match(/iPhone|iPod/i);
|
|
39
|
-
},
|
|
40
|
-
Opera() {
|
|
41
|
-
return t.match(/Opera Mini/i);
|
|
42
|
-
},
|
|
43
|
-
Windows() {
|
|
44
|
-
return t.match(/IEMobile/i) || t.match(/WPDesktop/i);
|
|
45
|
-
},
|
|
46
|
-
any() {
|
|
47
|
-
return e.Android() || e.BlackBerry() || e.iOS() || e.Opera() || e.Windows() || v === "reactNative";
|
|
48
|
-
}
|
|
49
|
-
}, n = t.match(/Tablet|iPad/i), r = it();
|
|
50
|
-
return {
|
|
51
|
-
urlPath: r == null ? void 0 : r.pathname,
|
|
52
|
-
host: (r == null ? void 0 : r.host) || (r == null ? void 0 : r.hostname),
|
|
53
|
-
device: n ? "tablet" : e.any() ? "mobile" : "desktop"
|
|
54
|
-
};
|
|
55
|
-
}, y = (t) => t != null;
|
|
56
|
-
function Zt(t) {
|
|
99
|
+
function ne(t) {
|
|
57
100
|
const e = t || (c() ? window.location.search : void 0);
|
|
58
|
-
return e ?
|
|
101
|
+
return e ? W(e).indexOf("builder.preview=") !== -1 : !1;
|
|
59
102
|
}
|
|
60
|
-
const
|
|
103
|
+
const re = (t) => ({
|
|
61
104
|
type: "builder.registerComponent",
|
|
62
|
-
data:
|
|
63
|
-
}),
|
|
105
|
+
data: _(t)
|
|
106
|
+
}), ht = (t) => {
|
|
64
107
|
const e = t.toString().trim(), n = /^[a-zA-Z0-9_]+\s*=>/i.test(e);
|
|
65
108
|
return `return (${!e.startsWith("function") && !e.startsWith("async") && !e.startsWith("(") && !n ? "function " : ""}${e}).apply(this, arguments)`;
|
|
66
109
|
};
|
|
67
|
-
function
|
|
68
|
-
return JSON.parse(JSON.stringify(t, (e, n) => typeof n == "function" ?
|
|
110
|
+
function _(t) {
|
|
111
|
+
return JSON.parse(JSON.stringify(t, (e, n) => typeof n == "function" ? ht(n) : n));
|
|
69
112
|
}
|
|
70
|
-
const
|
|
71
|
-
function
|
|
72
|
-
t === "plugin" && (e =
|
|
73
|
-
let n =
|
|
74
|
-
if (n || (n =
|
|
113
|
+
const L = {};
|
|
114
|
+
function gt(t, e) {
|
|
115
|
+
t === "plugin" && (e = _(e));
|
|
116
|
+
let n = L[t];
|
|
117
|
+
if (n || (n = L[t] = []), n.push(e), c()) {
|
|
75
118
|
const r = {
|
|
76
119
|
type: "builder.register",
|
|
77
120
|
data: {
|
|
@@ -81,124 +124,83 @@ function lt(t, e) {
|
|
|
81
124
|
};
|
|
82
125
|
try {
|
|
83
126
|
parent.postMessage(r, "*"), parent !== window && window.postMessage(r, "*");
|
|
84
|
-
} catch (
|
|
85
|
-
console.debug("Could not postmessage",
|
|
127
|
+
} catch (s) {
|
|
128
|
+
console.debug("Could not postmessage", s);
|
|
86
129
|
}
|
|
87
130
|
}
|
|
88
131
|
}
|
|
89
|
-
const
|
|
90
|
-
function
|
|
132
|
+
const V = {};
|
|
133
|
+
function se(t) {
|
|
91
134
|
if (c()) {
|
|
92
|
-
Object.assign(
|
|
135
|
+
Object.assign(V, t);
|
|
93
136
|
const e = {
|
|
94
137
|
type: "builder.settingsChange",
|
|
95
|
-
data:
|
|
138
|
+
data: V
|
|
96
139
|
};
|
|
97
140
|
parent.postMessage(e, "*");
|
|
98
141
|
}
|
|
99
142
|
}
|
|
100
|
-
const
|
|
143
|
+
const N = "builder.", pt = "options.", $ = (t) => {
|
|
101
144
|
if (!t)
|
|
102
145
|
return {};
|
|
103
|
-
const e =
|
|
146
|
+
const e = j(t), n = {};
|
|
104
147
|
return Object.keys(e).forEach((r) => {
|
|
105
|
-
if (r.startsWith(
|
|
106
|
-
const
|
|
107
|
-
n[
|
|
148
|
+
if (r.startsWith(N)) {
|
|
149
|
+
const s = r.replace(N, "").replace(pt, "");
|
|
150
|
+
n[s] = e[r];
|
|
108
151
|
}
|
|
109
152
|
}), n;
|
|
110
|
-
},
|
|
153
|
+
}, mt = () => {
|
|
111
154
|
if (!c())
|
|
112
155
|
return {};
|
|
113
156
|
const t = new URLSearchParams(window.location.search);
|
|
114
|
-
return
|
|
115
|
-
},
|
|
157
|
+
return $(t);
|
|
158
|
+
}, G = "3.0.7", J = () => ({
|
|
116
159
|
"X-Builder-SDK": v,
|
|
117
160
|
"X-Builder-SDK-GEN": "2",
|
|
118
|
-
"X-Builder-SDK-Version":
|
|
119
|
-
})
|
|
120
|
-
if (t === "localhost" || t === "127.0.0.1")
|
|
121
|
-
return t;
|
|
122
|
-
const e = t.split(".");
|
|
123
|
-
return e.length > 2 ? e.slice(1).join(".") : t;
|
|
124
|
-
}, W = ({
|
|
125
|
-
name: t,
|
|
126
|
-
canTrack: e
|
|
127
|
-
}) => {
|
|
128
|
-
var n;
|
|
129
|
-
try {
|
|
130
|
-
return e ? (n = document.cookie.split("; ").find((r) => r.startsWith(`${t}=`))) == null ? void 0 : n.split("=")[1] : void 0;
|
|
131
|
-
} catch (r) {
|
|
132
|
-
f.warn("[COOKIE] GET error: ", (r == null ? void 0 : r.message) || r);
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
}, $ = async (t) => W(t), gt = (t) => t.map(([e, n]) => n ? `${e}=${n}` : e).filter(y).join("; "), pt = [["secure", ""], ["SameSite", "None"]], mt = ({
|
|
136
|
-
name: t,
|
|
137
|
-
value: e,
|
|
138
|
-
expires: n
|
|
139
|
-
}) => {
|
|
140
|
-
const o = (c() ? location.protocol === "https:" : !0) ? pt : [[]], s = n ? [["expires", n.toUTCString()]] : [[]], i = [[t, e], ...s, ["path", "/"], ["domain", ht(window.location.hostname)], ...o];
|
|
141
|
-
return gt(i);
|
|
142
|
-
}, _ = async ({
|
|
143
|
-
name: t,
|
|
144
|
-
value: e,
|
|
145
|
-
expires: n,
|
|
146
|
-
canTrack: r
|
|
147
|
-
}) => {
|
|
148
|
-
try {
|
|
149
|
-
if (!r)
|
|
150
|
-
return;
|
|
151
|
-
const o = mt({
|
|
152
|
-
name: t,
|
|
153
|
-
value: e,
|
|
154
|
-
expires: n
|
|
155
|
-
});
|
|
156
|
-
document.cookie = o;
|
|
157
|
-
} catch (o) {
|
|
158
|
-
f.warn("[COOKIE] SET error: ", (o == null ? void 0 : o.message) || o);
|
|
159
|
-
}
|
|
160
|
-
};
|
|
161
|
+
"X-Builder-SDK-Version": G
|
|
162
|
+
});
|
|
161
163
|
function yt() {
|
|
162
164
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(t) {
|
|
163
165
|
const e = Math.random() * 16 | 0;
|
|
164
166
|
return (t == "x" ? e : e & 3 | 8).toString(16);
|
|
165
167
|
});
|
|
166
168
|
}
|
|
167
|
-
function
|
|
169
|
+
function X() {
|
|
168
170
|
return yt().replace(/-/g, "");
|
|
169
171
|
}
|
|
170
|
-
const
|
|
172
|
+
const z = "builderSessionId", bt = async ({
|
|
171
173
|
canTrack: t
|
|
172
174
|
}) => {
|
|
173
175
|
if (!t)
|
|
174
176
|
return;
|
|
175
|
-
const e = await
|
|
176
|
-
name:
|
|
177
|
+
const e = await M({
|
|
178
|
+
name: z,
|
|
177
179
|
canTrack: t
|
|
178
180
|
});
|
|
179
181
|
if (y(e))
|
|
180
182
|
return e;
|
|
181
183
|
{
|
|
182
184
|
const n = St();
|
|
183
|
-
return
|
|
185
|
+
return wt({
|
|
184
186
|
id: n,
|
|
185
187
|
canTrack: t
|
|
186
188
|
}), n;
|
|
187
189
|
}
|
|
188
|
-
}, St = () =>
|
|
190
|
+
}, St = () => X(), wt = ({
|
|
189
191
|
id: t,
|
|
190
192
|
canTrack: e
|
|
191
|
-
}) =>
|
|
192
|
-
name:
|
|
193
|
+
}) => P({
|
|
194
|
+
name: z,
|
|
193
195
|
value: t,
|
|
194
196
|
canTrack: e
|
|
195
|
-
}),
|
|
197
|
+
}), H = () => c() && typeof localStorage != "undefined" ? localStorage : void 0, vt = ({
|
|
196
198
|
key: t,
|
|
197
199
|
canTrack: e
|
|
198
200
|
}) => {
|
|
199
201
|
var n;
|
|
200
202
|
try {
|
|
201
|
-
return e ? (n =
|
|
203
|
+
return e ? (n = H()) == null ? void 0 : n.getItem(t) : void 0;
|
|
202
204
|
} catch (r) {
|
|
203
205
|
console.debug("[LocalStorage] GET error: ", r);
|
|
204
206
|
return;
|
|
@@ -210,41 +212,73 @@ const H = "builderSessionId", wt = async ({
|
|
|
210
212
|
}) => {
|
|
211
213
|
var r;
|
|
212
214
|
try {
|
|
213
|
-
e && ((r =
|
|
214
|
-
} catch (
|
|
215
|
-
console.debug("[LocalStorage] SET error: ",
|
|
215
|
+
e && ((r = H()) == null || r.setItem(t, n));
|
|
216
|
+
} catch (s) {
|
|
217
|
+
console.debug("[LocalStorage] SET error: ", s);
|
|
216
218
|
}
|
|
217
|
-
},
|
|
219
|
+
}, Q = "builderVisitorId", kt = ({
|
|
218
220
|
canTrack: t
|
|
219
221
|
}) => {
|
|
220
222
|
if (!t)
|
|
221
223
|
return;
|
|
222
224
|
const e = vt({
|
|
223
|
-
key:
|
|
225
|
+
key: Q,
|
|
224
226
|
canTrack: t
|
|
225
227
|
});
|
|
226
228
|
if (y(e))
|
|
227
229
|
return e;
|
|
228
230
|
{
|
|
229
|
-
const n =
|
|
230
|
-
return
|
|
231
|
+
const n = At();
|
|
232
|
+
return Et({
|
|
231
233
|
id: n,
|
|
232
234
|
canTrack: t
|
|
233
235
|
}), n;
|
|
234
236
|
}
|
|
235
|
-
},
|
|
237
|
+
}, At = () => X(), Et = ({
|
|
236
238
|
id: t,
|
|
237
239
|
canTrack: e
|
|
238
240
|
}) => It({
|
|
239
|
-
key:
|
|
241
|
+
key: Q,
|
|
240
242
|
value: t,
|
|
241
243
|
canTrack: e
|
|
242
244
|
});
|
|
243
|
-
function
|
|
245
|
+
function Ot(t) {
|
|
244
246
|
var e;
|
|
245
247
|
typeof process != "undefined" && ((e = process.env) != null && e.DEBUG) && String(process.env.DEBUG) == "true" && f.log(t);
|
|
246
248
|
}
|
|
247
|
-
const
|
|
249
|
+
const Pt = () => {
|
|
250
|
+
if (c()) {
|
|
251
|
+
const t = new URL(location.href);
|
|
252
|
+
return t.pathname === "" && (t.pathname = "/"), t;
|
|
253
|
+
} else
|
|
254
|
+
return console.warn("Cannot get location for tracking in non-browser environment"), null;
|
|
255
|
+
}, Ct = () => typeof navigator == "object" && navigator.userAgent || "", Ut = () => {
|
|
256
|
+
const t = Ct(), e = {
|
|
257
|
+
Android() {
|
|
258
|
+
return t.match(/Android/i);
|
|
259
|
+
},
|
|
260
|
+
BlackBerry() {
|
|
261
|
+
return t.match(/BlackBerry/i);
|
|
262
|
+
},
|
|
263
|
+
iOS() {
|
|
264
|
+
return t.match(/iPhone|iPod/i);
|
|
265
|
+
},
|
|
266
|
+
Opera() {
|
|
267
|
+
return t.match(/Opera Mini/i);
|
|
268
|
+
},
|
|
269
|
+
Windows() {
|
|
270
|
+
return t.match(/IEMobile/i) || t.match(/WPDesktop/i);
|
|
271
|
+
},
|
|
272
|
+
any() {
|
|
273
|
+
return e.Android() || e.BlackBerry() || e.iOS() || e.Opera() || e.Windows() || v === "reactNative";
|
|
274
|
+
}
|
|
275
|
+
}, n = t.match(/Tablet|iPad/i), r = Pt();
|
|
276
|
+
return {
|
|
277
|
+
urlPath: r == null ? void 0 : r.pathname,
|
|
278
|
+
host: (r == null ? void 0 : r.host) || (r == null ? void 0 : r.hostname),
|
|
279
|
+
device: n ? "tablet" : e.any() ? "mobile" : "desktop"
|
|
280
|
+
};
|
|
281
|
+
}, Tt = async ({
|
|
248
282
|
canTrack: t
|
|
249
283
|
}) => {
|
|
250
284
|
if (!t)
|
|
@@ -252,7 +286,7 @@ const Ot = async ({
|
|
|
252
286
|
visitorId: void 0,
|
|
253
287
|
sessionId: void 0
|
|
254
288
|
};
|
|
255
|
-
const e = await
|
|
289
|
+
const e = await bt({
|
|
256
290
|
canTrack: t
|
|
257
291
|
}), n = kt({
|
|
258
292
|
canTrack: t
|
|
@@ -261,28 +295,28 @@ const Ot = async ({
|
|
|
261
295
|
sessionId: e,
|
|
262
296
|
visitorId: n
|
|
263
297
|
};
|
|
264
|
-
},
|
|
298
|
+
}, xt = async ({
|
|
265
299
|
type: t,
|
|
266
300
|
canTrack: e,
|
|
267
301
|
apiKey: n,
|
|
268
302
|
metadata: r,
|
|
269
|
-
...
|
|
303
|
+
...s
|
|
270
304
|
}) => ({
|
|
271
305
|
type: t,
|
|
272
306
|
data: {
|
|
273
|
-
...
|
|
307
|
+
...s,
|
|
274
308
|
metadata: {
|
|
275
309
|
url: location.href,
|
|
276
310
|
...r
|
|
277
311
|
},
|
|
278
|
-
...await
|
|
312
|
+
...await Tt({
|
|
279
313
|
canTrack: e
|
|
280
314
|
}),
|
|
281
|
-
userAttributes:
|
|
315
|
+
userAttributes: Ut(),
|
|
282
316
|
ownerId: n
|
|
283
317
|
}
|
|
284
318
|
});
|
|
285
|
-
async function
|
|
319
|
+
async function Bt({
|
|
286
320
|
apiHost: t,
|
|
287
321
|
...e
|
|
288
322
|
}) {
|
|
@@ -290,35 +324,35 @@ async function xt({
|
|
|
290
324
|
f.error("Missing API key for track call. Please provide your API key.");
|
|
291
325
|
return;
|
|
292
326
|
}
|
|
293
|
-
if (!e.canTrack ||
|
|
327
|
+
if (!e.canTrack || ft() || !(c() || v === "reactNative"))
|
|
294
328
|
return;
|
|
295
329
|
const r = `${t || "https://cdn.builder.io"}/api/v1/track`;
|
|
296
|
-
return
|
|
330
|
+
return Ot(r), fetch(r, {
|
|
297
331
|
method: "POST",
|
|
298
332
|
body: JSON.stringify({
|
|
299
|
-
events: [await
|
|
333
|
+
events: [await xt(e)]
|
|
300
334
|
}),
|
|
301
335
|
headers: {
|
|
302
336
|
"content-type": "application/json",
|
|
303
|
-
...
|
|
337
|
+
...J()
|
|
304
338
|
},
|
|
305
339
|
mode: "cors"
|
|
306
|
-
}).catch((
|
|
307
|
-
console.error("Failed to track: ",
|
|
340
|
+
}).catch((s) => {
|
|
341
|
+
console.error("Failed to track: ", s);
|
|
308
342
|
});
|
|
309
343
|
}
|
|
310
|
-
const
|
|
344
|
+
const oe = (t) => Bt({
|
|
311
345
|
...t,
|
|
312
346
|
canTrack: !0
|
|
313
|
-
}),
|
|
314
|
-
function
|
|
347
|
+
}), Rt = ["*.beta.builder.io", "beta.builder.io", "builder.io", "localhost", "qa.builder.io"];
|
|
348
|
+
function Y(t, e) {
|
|
315
349
|
if (!e.origin.startsWith("http") && !e.origin.startsWith("https"))
|
|
316
350
|
return !1;
|
|
317
351
|
const n = new URL(e.origin), r = n.hostname;
|
|
318
|
-
return (t ||
|
|
352
|
+
return (t || Rt).findIndex((s) => s.startsWith("*.") ? r.endsWith(s.slice(1)) : s === r) > -1;
|
|
319
353
|
}
|
|
320
|
-
const
|
|
321
|
-
|
|
354
|
+
const ie = () => {
|
|
355
|
+
gt("insertMenu", {
|
|
322
356
|
name: "_default",
|
|
323
357
|
default: !0,
|
|
324
358
|
items: [{
|
|
@@ -340,19 +374,21 @@ const ne = () => {
|
|
|
340
374
|
}]
|
|
341
375
|
});
|
|
342
376
|
};
|
|
343
|
-
let
|
|
344
|
-
const
|
|
377
|
+
let F = !1;
|
|
378
|
+
const Lt = (t = {}) => {
|
|
345
379
|
var e, n;
|
|
346
|
-
|
|
380
|
+
F || (F = !0, c() && ((e = window.parent) == null || e.postMessage({
|
|
347
381
|
type: "builder.sdkInfo",
|
|
348
382
|
data: {
|
|
349
383
|
target: v,
|
|
350
|
-
version:
|
|
384
|
+
version: G,
|
|
351
385
|
supportsPatchUpdates: !1,
|
|
352
386
|
// Supports builder-model="..." attribute which is needed to
|
|
353
387
|
// scope our '+ add block' button styling
|
|
354
388
|
supportsAddBlockScoping: !0,
|
|
355
|
-
supportsCustomBreakpoints: !0
|
|
389
|
+
supportsCustomBreakpoints: !0,
|
|
390
|
+
supportsXSmallBreakpoint: !0,
|
|
391
|
+
blockLevelPersonalization: !0
|
|
356
392
|
}
|
|
357
393
|
}, "*"), (n = window.parent) == null || n.postMessage({
|
|
358
394
|
type: "builder.updateContent",
|
|
@@ -360,23 +396,23 @@ const Ut = (t = {}) => {
|
|
|
360
396
|
options: t
|
|
361
397
|
}
|
|
362
398
|
}, "*"), window.addEventListener("message", (r) => {
|
|
363
|
-
var
|
|
364
|
-
if (!
|
|
399
|
+
var o, i;
|
|
400
|
+
if (!Y(t.trustedHosts, r))
|
|
365
401
|
return;
|
|
366
402
|
const {
|
|
367
|
-
data:
|
|
403
|
+
data: s
|
|
368
404
|
} = r;
|
|
369
|
-
if (
|
|
370
|
-
switch (
|
|
405
|
+
if (s != null && s.type)
|
|
406
|
+
switch (s.type) {
|
|
371
407
|
case "builder.evaluate": {
|
|
372
|
-
const u =
|
|
408
|
+
const u = s.data.text, b = s.data.arguments || [], p = s.data.id, k = new Function(u);
|
|
373
409
|
let l, h = null;
|
|
374
410
|
try {
|
|
375
|
-
l = k.apply(null,
|
|
411
|
+
l = k.apply(null, b);
|
|
376
412
|
} catch (g) {
|
|
377
413
|
h = g;
|
|
378
414
|
}
|
|
379
|
-
h ? (
|
|
415
|
+
h ? (o = window.parent) == null || o.postMessage({
|
|
380
416
|
type: "builder.evaluateError",
|
|
381
417
|
data: {
|
|
382
418
|
id: p,
|
|
@@ -402,38 +438,38 @@ const Ut = (t = {}) => {
|
|
|
402
438
|
}
|
|
403
439
|
}
|
|
404
440
|
})));
|
|
405
|
-
},
|
|
441
|
+
}, Vt = ({
|
|
406
442
|
model: t,
|
|
407
443
|
trustedHosts: e,
|
|
408
444
|
callbacks: n
|
|
409
445
|
}) => (r) => {
|
|
410
|
-
if (!
|
|
446
|
+
if (!Y(e, r))
|
|
411
447
|
return;
|
|
412
448
|
const {
|
|
413
|
-
data:
|
|
449
|
+
data: s
|
|
414
450
|
} = r;
|
|
415
|
-
if (
|
|
416
|
-
switch (
|
|
451
|
+
if (s)
|
|
452
|
+
switch (s.type) {
|
|
417
453
|
case "builder.configureSdk": {
|
|
418
|
-
n.configureSdk(
|
|
454
|
+
n.configureSdk(s.data);
|
|
419
455
|
break;
|
|
420
456
|
}
|
|
421
457
|
case "builder.triggerAnimation": {
|
|
422
|
-
n.animation(
|
|
458
|
+
n.animation(s.data);
|
|
423
459
|
break;
|
|
424
460
|
}
|
|
425
461
|
case "builder.contentUpdate": {
|
|
426
|
-
const
|
|
462
|
+
const o = s.data, i = o.key || o.alias || o.entry || o.modelName, u = o.data;
|
|
427
463
|
i === t && n.contentUpdate(u);
|
|
428
464
|
break;
|
|
429
465
|
}
|
|
430
466
|
}
|
|
431
|
-
},
|
|
467
|
+
}, ae = (t, e, n) => {
|
|
432
468
|
if (!c)
|
|
433
469
|
return f.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."), () => {
|
|
434
470
|
};
|
|
435
|
-
|
|
436
|
-
const r =
|
|
471
|
+
Lt();
|
|
472
|
+
const r = Vt({
|
|
437
473
|
callbacks: {
|
|
438
474
|
contentUpdate: e,
|
|
439
475
|
animation: () => {
|
|
@@ -447,45 +483,45 @@ const Ut = (t = {}) => {
|
|
|
447
483
|
return window.addEventListener("message", r), () => {
|
|
448
484
|
window.removeEventListener("message", r);
|
|
449
485
|
};
|
|
450
|
-
},
|
|
486
|
+
}, Nt = "builder.tests", C = (t) => `${Nt}.${t}`, Ft = ({
|
|
451
487
|
contentId: t
|
|
452
|
-
}) =>
|
|
453
|
-
name:
|
|
488
|
+
}) => M({
|
|
489
|
+
name: C(t),
|
|
454
490
|
canTrack: !0
|
|
455
|
-
}),
|
|
491
|
+
}), Dt = ({
|
|
456
492
|
contentId: t
|
|
457
|
-
}) =>
|
|
458
|
-
name:
|
|
493
|
+
}) => O({
|
|
494
|
+
name: C(t),
|
|
459
495
|
canTrack: !0
|
|
460
|
-
}),
|
|
496
|
+
}), Mt = ({
|
|
461
497
|
contentId: t,
|
|
462
498
|
value: e
|
|
463
|
-
}) =>
|
|
464
|
-
name:
|
|
499
|
+
}) => P({
|
|
500
|
+
name: C(t),
|
|
465
501
|
value: e,
|
|
466
502
|
canTrack: !0
|
|
467
|
-
}),
|
|
503
|
+
}), Z = (t) => y(t.id) && y(t.variations) && Object.keys(t.variations).length > 0, Kt = ({
|
|
468
504
|
id: t,
|
|
469
505
|
variations: e
|
|
470
506
|
}) => {
|
|
471
|
-
var
|
|
507
|
+
var s;
|
|
472
508
|
let n = 0;
|
|
473
509
|
const r = Math.random();
|
|
474
|
-
for (const
|
|
475
|
-
const i = (
|
|
510
|
+
for (const o in e) {
|
|
511
|
+
const i = (s = e[o]) == null ? void 0 : s.testRatio;
|
|
476
512
|
if (n += i, r < n)
|
|
477
|
-
return
|
|
513
|
+
return o;
|
|
478
514
|
}
|
|
479
515
|
return t;
|
|
480
|
-
},
|
|
481
|
-
const e =
|
|
482
|
-
return
|
|
516
|
+
}, q = (t) => {
|
|
517
|
+
const e = Kt(t);
|
|
518
|
+
return Mt({
|
|
483
519
|
contentId: t.id,
|
|
484
520
|
value: e
|
|
485
521
|
}).catch((n) => {
|
|
486
522
|
f.error("could not store A/B test variation: ", n);
|
|
487
523
|
}), e;
|
|
488
|
-
},
|
|
524
|
+
}, tt = ({
|
|
489
525
|
item: t,
|
|
490
526
|
testGroupId: e
|
|
491
527
|
}) => {
|
|
@@ -499,7 +535,7 @@ const Ut = (t = {}) => {
|
|
|
499
535
|
testVariationId: n.id,
|
|
500
536
|
testVariationName: n.name || (n.id === t.id ? "Default" : "")
|
|
501
537
|
};
|
|
502
|
-
},
|
|
538
|
+
}, ce = ({
|
|
503
539
|
item: t,
|
|
504
540
|
canTrack: e
|
|
505
541
|
}) => {
|
|
@@ -507,14 +543,14 @@ const Ut = (t = {}) => {
|
|
|
507
543
|
return t;
|
|
508
544
|
if (!t)
|
|
509
545
|
return;
|
|
510
|
-
if (!
|
|
546
|
+
if (!Z(t))
|
|
511
547
|
return t;
|
|
512
|
-
const n =
|
|
548
|
+
const n = Dt({
|
|
513
549
|
contentId: t.id
|
|
514
|
-
}) ||
|
|
550
|
+
}) || q({
|
|
515
551
|
variations: t.variations,
|
|
516
552
|
id: t.id
|
|
517
|
-
}), r =
|
|
553
|
+
}), r = tt({
|
|
518
554
|
item: t,
|
|
519
555
|
testGroupId: n
|
|
520
556
|
});
|
|
@@ -522,125 +558,128 @@ const Ut = (t = {}) => {
|
|
|
522
558
|
...t,
|
|
523
559
|
...r
|
|
524
560
|
};
|
|
525
|
-
},
|
|
561
|
+
}, jt = async ({
|
|
526
562
|
item: t,
|
|
527
563
|
canTrack: e
|
|
528
564
|
}) => {
|
|
529
|
-
if (!e || !
|
|
565
|
+
if (!e || !Z(t))
|
|
530
566
|
return t;
|
|
531
|
-
const r = await
|
|
567
|
+
const r = await Ft({
|
|
532
568
|
contentId: t.id
|
|
533
|
-
}) ||
|
|
569
|
+
}) || q({
|
|
534
570
|
variations: t.variations,
|
|
535
571
|
id: t.id
|
|
536
|
-
}),
|
|
572
|
+
}), s = tt({
|
|
537
573
|
item: t,
|
|
538
574
|
testGroupId: r
|
|
539
575
|
});
|
|
540
576
|
return {
|
|
541
577
|
...t,
|
|
542
|
-
...
|
|
578
|
+
...s
|
|
543
579
|
};
|
|
544
|
-
},
|
|
545
|
-
|
|
580
|
+
}, Wt = (t) => {
|
|
581
|
+
const e = y(t) ? t : !0;
|
|
582
|
+
return K.setCanTrack(e), e;
|
|
583
|
+
};
|
|
584
|
+
function _t() {
|
|
546
585
|
return typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : globalThis;
|
|
547
586
|
}
|
|
548
|
-
function
|
|
549
|
-
const t =
|
|
587
|
+
function $t() {
|
|
588
|
+
const t = _t().fetch;
|
|
550
589
|
if (typeof t == "undefined")
|
|
551
590
|
throw console.warn(`Builder SDK could not find a global fetch function. Make sure you have a polyfill for fetch in your project.
|
|
552
591
|
For more information, read https://github.com/BuilderIO/this-package-uses-fetch`), new Error("Builder SDK could not find a global `fetch` function");
|
|
553
592
|
return t;
|
|
554
593
|
}
|
|
555
|
-
const
|
|
556
|
-
function
|
|
557
|
-
return Object.keys(t).reduce((r,
|
|
558
|
-
const
|
|
559
|
-
return [typeof
|
|
594
|
+
const Gt = $t();
|
|
595
|
+
function E(t, e = null, n = ".") {
|
|
596
|
+
return Object.keys(t).reduce((r, s) => {
|
|
597
|
+
const o = t[s], i = [e, s].filter(Boolean).join(n);
|
|
598
|
+
return [typeof o == "object", o !== null, !(Array.isArray(o) && o.length === 0)].every(Boolean) ? {
|
|
560
599
|
...r,
|
|
561
|
-
...
|
|
600
|
+
...E(o, i, n)
|
|
562
601
|
} : {
|
|
563
602
|
...r,
|
|
564
|
-
[i]:
|
|
603
|
+
[i]: o
|
|
565
604
|
};
|
|
566
605
|
}, {});
|
|
567
606
|
}
|
|
568
|
-
function
|
|
607
|
+
function et(t, e, n = {}) {
|
|
569
608
|
for (const r in t) {
|
|
570
|
-
const
|
|
571
|
-
|
|
609
|
+
const s = t[r], o = e ? e + "." + r : r;
|
|
610
|
+
s && typeof s == "object" && !Array.isArray(s) && !Object.keys(s).find((i) => i.startsWith("$")) ? et(s, o, n) : n[o] = s;
|
|
572
611
|
}
|
|
573
612
|
return n;
|
|
574
613
|
}
|
|
575
|
-
function
|
|
614
|
+
function Jt(t) {
|
|
576
615
|
const e = {};
|
|
577
616
|
for (const n in t) {
|
|
578
617
|
const r = n.split(".");
|
|
579
|
-
let
|
|
580
|
-
for (let
|
|
581
|
-
const i = r[
|
|
582
|
-
|
|
618
|
+
let s = e;
|
|
619
|
+
for (let o = 0; o < r.length; o++) {
|
|
620
|
+
const i = r[o];
|
|
621
|
+
o === r.length - 1 ? s[i] = t[n] : (s[i] = s[i] || {}, s = s[i]);
|
|
583
622
|
}
|
|
584
623
|
}
|
|
585
624
|
return e;
|
|
586
625
|
}
|
|
587
|
-
const
|
|
626
|
+
const Xt = "v3", D = (t) => typeof t == "number" && !isNaN(t) && t >= 0, U = (t) => {
|
|
588
627
|
const {
|
|
589
628
|
limit: e = 30,
|
|
590
629
|
userAttributes: n,
|
|
591
630
|
query: r,
|
|
592
|
-
model:
|
|
593
|
-
apiKey:
|
|
631
|
+
model: s,
|
|
632
|
+
apiKey: o,
|
|
594
633
|
enrich: i,
|
|
595
634
|
locale: u,
|
|
596
|
-
apiVersion:
|
|
635
|
+
apiVersion: b = Xt,
|
|
597
636
|
fields: p,
|
|
598
637
|
omit: k,
|
|
599
638
|
offset: l,
|
|
600
639
|
cacheSeconds: h,
|
|
601
640
|
staleCacheSeconds: g,
|
|
602
641
|
sort: S,
|
|
603
|
-
includeUnpublished:
|
|
604
|
-
apiHost:
|
|
642
|
+
includeUnpublished: T,
|
|
643
|
+
apiHost: nt
|
|
605
644
|
} = t;
|
|
606
|
-
if (!
|
|
645
|
+
if (!o)
|
|
607
646
|
throw new Error("Missing API key");
|
|
608
|
-
if (!["v3"].includes(
|
|
609
|
-
throw new Error(`Invalid apiVersion: expected 'v3', received '${
|
|
610
|
-
const
|
|
611
|
-
a.searchParams.set("apiKey",
|
|
612
|
-
const
|
|
647
|
+
if (!["v3"].includes(b))
|
|
648
|
+
throw new Error(`Invalid apiVersion: expected 'v3', received '${b}'`);
|
|
649
|
+
const rt = e !== 1, st = nt || "https://cdn.builder.io", a = new URL(`${st}/api/${b}/content/${s}`);
|
|
650
|
+
a.searchParams.set("apiKey", o), a.searchParams.set("limit", String(e)), a.searchParams.set("noTraverse", String(rt)), a.searchParams.set("includeRefs", String(!0));
|
|
651
|
+
const A = u || (n == null ? void 0 : n.locale);
|
|
613
652
|
let m = n || {};
|
|
614
|
-
if (
|
|
615
|
-
locale:
|
|
653
|
+
if (A && (a.searchParams.set("locale", A), m = {
|
|
654
|
+
locale: A,
|
|
616
655
|
...m
|
|
617
|
-
}), i && a.searchParams.set("enrich", String(i)), a.searchParams.set("omit", k || "meta.componentsUsed"), p && a.searchParams.set("fields", p), Number.isFinite(l) && l > -1 && a.searchParams.set("offset", String(Math.floor(l))), typeof
|
|
618
|
-
const d =
|
|
656
|
+
}), i && a.searchParams.set("enrich", String(i)), a.searchParams.set("omit", k || "meta.componentsUsed"), p && a.searchParams.set("fields", p), Number.isFinite(l) && l > -1 && a.searchParams.set("offset", String(Math.floor(l))), typeof T == "boolean" && a.searchParams.set("includeUnpublished", String(T)), h && D(h) && a.searchParams.set("cacheSeconds", String(h)), g && D(g) && a.searchParams.set("staleCacheSeconds", String(g)), S) {
|
|
657
|
+
const d = E({
|
|
619
658
|
sort: S
|
|
620
659
|
});
|
|
621
|
-
for (const
|
|
622
|
-
a.searchParams.set(
|
|
660
|
+
for (const w in d)
|
|
661
|
+
a.searchParams.set(w, JSON.stringify(d[w]));
|
|
623
662
|
}
|
|
624
663
|
const x = {
|
|
625
|
-
...
|
|
626
|
-
...
|
|
664
|
+
...mt(),
|
|
665
|
+
...j(t.options || {})
|
|
627
666
|
};
|
|
628
667
|
m = {
|
|
629
668
|
...m,
|
|
630
669
|
...Ht(x)
|
|
631
670
|
};
|
|
632
|
-
const
|
|
633
|
-
for (const d in
|
|
634
|
-
a.searchParams.set(d, String(
|
|
671
|
+
const B = E(x);
|
|
672
|
+
for (const d in B)
|
|
673
|
+
a.searchParams.set(d, String(B[d]));
|
|
635
674
|
if (Object.keys(m).length > 0 && a.searchParams.set("userAttributes", JSON.stringify(m)), r) {
|
|
636
|
-
const d =
|
|
675
|
+
const d = et({
|
|
637
676
|
query: r
|
|
638
677
|
});
|
|
639
|
-
for (const
|
|
640
|
-
a.searchParams.set(
|
|
678
|
+
for (const w in d)
|
|
679
|
+
a.searchParams.set(w, JSON.stringify(d[w]));
|
|
641
680
|
}
|
|
642
681
|
return a;
|
|
643
|
-
},
|
|
682
|
+
}, zt = (t) => {
|
|
644
683
|
const e = {};
|
|
645
684
|
for (const n in t)
|
|
646
685
|
n.startsWith("userAttributes.") && (e[n] = t[n], delete t[n]);
|
|
@@ -648,60 +687,60 @@ const _t = "v3", V = (t) => typeof t == "number" && !isNaN(t) && t >= 0, O = (t)
|
|
|
648
687
|
}, Ht = (t) => {
|
|
649
688
|
if (c() && t.preview === "BUILDER_STUDIO") {
|
|
650
689
|
t["userAttributes.urlPath"] = window.location.pathname, t["userAttributes.host"] = window.location.host;
|
|
651
|
-
const e =
|
|
690
|
+
const e = zt(t), {
|
|
652
691
|
userAttributes: n
|
|
653
|
-
} =
|
|
692
|
+
} = Jt(e);
|
|
654
693
|
return n;
|
|
655
694
|
}
|
|
656
695
|
return {};
|
|
657
|
-
},
|
|
658
|
-
async function
|
|
659
|
-
const e = await
|
|
696
|
+
}, Qt = (t) => "results" in t;
|
|
697
|
+
async function Yt(t) {
|
|
698
|
+
const e = await te({
|
|
660
699
|
...t,
|
|
661
700
|
limit: 1
|
|
662
701
|
});
|
|
663
702
|
return e && e[0] || null;
|
|
664
703
|
}
|
|
665
|
-
const
|
|
704
|
+
const Zt = async (t) => {
|
|
666
705
|
var i, u;
|
|
667
|
-
const e =
|
|
706
|
+
const e = U(t), n = (i = t.fetch) != null ? i : Gt, r = {
|
|
668
707
|
...t.fetchOptions,
|
|
669
708
|
headers: {
|
|
670
709
|
...(u = t.fetchOptions) == null ? void 0 : u.headers,
|
|
671
|
-
...
|
|
710
|
+
...J()
|
|
672
711
|
}
|
|
673
712
|
};
|
|
674
713
|
return await (await n(e.href, r)).json();
|
|
675
|
-
},
|
|
676
|
-
const r =
|
|
714
|
+
}, qt = async (t, e, n = U(t)) => {
|
|
715
|
+
const r = Wt(t.canTrack);
|
|
677
716
|
if (n.search.includes("preview="), !r || !(c() || v === "reactNative"))
|
|
678
717
|
return e.results;
|
|
679
718
|
try {
|
|
680
|
-
const
|
|
681
|
-
for (const
|
|
682
|
-
|
|
683
|
-
item:
|
|
719
|
+
const s = [];
|
|
720
|
+
for (const o of e.results)
|
|
721
|
+
s.push(await jt({
|
|
722
|
+
item: o,
|
|
684
723
|
canTrack: r
|
|
685
724
|
}));
|
|
686
|
-
e.results =
|
|
687
|
-
} catch (
|
|
688
|
-
f.error("Could not process A/B tests. ",
|
|
725
|
+
e.results = s;
|
|
726
|
+
} catch (s) {
|
|
727
|
+
f.error("Could not process A/B tests. ", s);
|
|
689
728
|
}
|
|
690
729
|
return e.results;
|
|
691
730
|
};
|
|
692
|
-
async function
|
|
693
|
-
const e =
|
|
694
|
-
if (!
|
|
731
|
+
async function te(t) {
|
|
732
|
+
const e = U(t), n = await Zt(t);
|
|
733
|
+
if (!Qt(n))
|
|
695
734
|
throw f.error("Error fetching data. ", {
|
|
696
735
|
url: e,
|
|
697
736
|
content: n,
|
|
698
737
|
options: t
|
|
699
738
|
}), n;
|
|
700
|
-
return
|
|
739
|
+
return qt(t, n);
|
|
701
740
|
}
|
|
702
|
-
const
|
|
703
|
-
var r,
|
|
704
|
-
const e = t.path || ((r = t.url) == null ? void 0 : r.pathname) || ((
|
|
741
|
+
const ue = async (t) => {
|
|
742
|
+
var r, s, o;
|
|
743
|
+
const e = t.path || ((r = t.url) == null ? void 0 : r.pathname) || ((s = t.userAttributes) == null ? void 0 : s.urlPath), n = {
|
|
705
744
|
...t,
|
|
706
745
|
apiKey: t.apiKey,
|
|
707
746
|
model: t.model || "page",
|
|
@@ -711,38 +750,40 @@ const se = async (t) => {
|
|
|
711
750
|
urlPath: e
|
|
712
751
|
} : {}
|
|
713
752
|
},
|
|
714
|
-
options:
|
|
753
|
+
options: $(t.searchParams || ((o = t.url) == null ? void 0 : o.searchParams) || t.options)
|
|
715
754
|
};
|
|
716
755
|
return {
|
|
717
756
|
apiKey: n.apiKey,
|
|
718
757
|
model: n.model,
|
|
719
|
-
content: await
|
|
758
|
+
content: await Yt(n)
|
|
720
759
|
};
|
|
721
760
|
};
|
|
722
761
|
export {
|
|
723
762
|
v as TARGET,
|
|
724
|
-
|
|
725
|
-
|
|
763
|
+
qt as _processContentResult,
|
|
764
|
+
Bt as _track,
|
|
726
765
|
y as checkIsDefined,
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
766
|
+
Vt as createEditorListener,
|
|
767
|
+
re as createRegisterComponentMessage,
|
|
768
|
+
ue as fetchBuilderProps,
|
|
769
|
+
te as fetchEntries,
|
|
770
|
+
Yt as fetchOneEntry,
|
|
771
|
+
$ as getBuilderSearchParams,
|
|
772
|
+
Wt as getDefaultCanTrack,
|
|
773
|
+
Ut as getUserAttributes,
|
|
774
|
+
ce as handleABTestingSync,
|
|
736
775
|
c as isBrowser,
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
776
|
+
ft as isEditing,
|
|
777
|
+
ne as isPreviewing,
|
|
778
|
+
Ot as logFetch,
|
|
740
779
|
f as logger,
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
780
|
+
gt as register,
|
|
781
|
+
ie as registerInsertMenu,
|
|
782
|
+
_ as serializeIncludingFunctions,
|
|
783
|
+
ee as setClientUserAttributes,
|
|
784
|
+
se as setEditorSettings,
|
|
785
|
+
Lt as setupBrowserForEditing,
|
|
786
|
+
ae as subscribeToEditor,
|
|
787
|
+
oe as track,
|
|
788
|
+
K as userAttributesService
|
|
748
789
|
};
|