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