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