@builder.io/sdk-react 1.0.2 → 1.0.4
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/README.md +4 -3
- package/lib/browser/blocks-exports.cjs +187 -0
- package/lib/browser/blocks-exports.mjs +3441 -0
- package/lib/browser/index.cjs +1 -187
- package/lib/browser/index.mjs +26 -3449
- package/lib/browser/{server-entry-a595b1cf.cjs → server-entry-093e302c.cjs} +1 -1
- package/lib/browser/{server-entry-f6f9bdcb.js → server-entry-7839c812.js} +1 -1
- package/lib/browser/server-entry.cjs +1 -1
- package/lib/browser/server-entry.mjs +1 -1
- package/lib/edge/blocks-0fc8e8d2.js +3385 -0
- package/lib/edge/blocks-exports.cjs +1 -0
- package/lib/edge/blocks-exports.mjs +16 -0
- package/lib/edge/blocks-f8688fcb.cjs +32 -0
- package/lib/edge/button-61181684.cjs +1 -0
- package/lib/edge/button-d9bbef90.js +29 -0
- package/lib/edge/columns-d152e266.cjs +28 -0
- package/lib/edge/columns-f7a9bca7.js +156 -0
- package/lib/edge/content-variants-cdcbcdd8.js +1711 -0
- package/lib/edge/content-variants-d2500971.cjs +133 -0
- package/lib/edge/custom-code-33b73ed1.js +44 -0
- package/lib/edge/custom-code-7390ba8b.cjs +1 -0
- package/lib/edge/dynamic-blocks-exports.cjs +39 -0
- package/lib/edge/dynamic-blocks-exports.mjs +37 -0
- package/lib/edge/dynamic-renderer-b5124984.js +9 -0
- package/lib/edge/dynamic-renderer-c00b8bcb.cjs +1 -0
- package/lib/edge/embed-11e03fa7.js +38 -0
- package/lib/edge/embed-9edce7df.cjs +1 -0
- package/lib/edge/form-ac531791.cjs +1 -0
- package/lib/edge/form-fb5fd55e.js +194 -0
- package/lib/edge/fragment-015b0912.js +8 -0
- package/lib/edge/fragment-61ef192d.cjs +1 -0
- package/lib/edge/get-class-prop-name-caee6506.cjs +1 -0
- package/lib/edge/get-class-prop-name-f22d7d53.js +18 -0
- package/lib/edge/image-6a3654d5.js +118 -0
- package/lib/edge/image-e4128296.cjs +17 -0
- package/lib/edge/img-317659e2.js +21 -0
- package/lib/edge/img-f2eeaa75.cjs +1 -0
- package/lib/edge/index.cjs +1 -207
- package/lib/edge/index.mjs +25 -5922
- package/lib/edge/input-526ea905.js +21 -0
- package/lib/edge/input-562438c4.cjs +1 -0
- package/lib/edge/section-68fbc212.js +26 -0
- package/lib/edge/section-70c8b709.cjs +1 -0
- package/lib/edge/select-17802399.js +21 -0
- package/lib/edge/select-d87a6280.cjs +1 -0
- package/lib/edge/server-entry-88f58ed4.cjs +2 -0
- package/lib/edge/{server-entry-f6f9bdcb.js → server-entry-e0830caf.js} +373 -372
- package/lib/edge/server-entry.cjs +1 -1
- package/lib/edge/server-entry.mjs +1 -1
- package/lib/edge/slot-39b50f6b.cjs +1 -0
- package/lib/edge/slot-eb244885.js +33 -0
- package/lib/edge/submit-button-13d8d5a7.cjs +1 -0
- package/lib/edge/submit-button-71dd4015.js +8 -0
- package/lib/edge/symbol-bf773f2a.js +78 -0
- package/lib/edge/symbol-ee31bb7f.cjs +1 -0
- package/lib/edge/text-15f0a6f4.js +18 -0
- package/lib/edge/text-7fdbde16.cjs +1 -0
- package/lib/edge/video-66b20833.js +106 -0
- package/lib/edge/video-702696a8.cjs +1 -0
- package/lib/node/blocks-exports.cjs +227 -0
- package/lib/node/blocks-exports.mjs +3548 -0
- package/lib/node/index.cjs +1 -227
- package/lib/node/index.mjs +27 -3556
- package/lib/node/{server-entry-31b5d683.cjs → server-entry-0e638a4f.cjs} +1 -1
- package/lib/node/{server-entry-c2b6d198.js → server-entry-e1cc0803.js} +1 -1
- package/lib/node/server-entry.cjs +1 -1
- package/lib/node/server-entry.mjs +1 -1
- package/package.json +19 -13
- package/types/blocks/button/index.d.ts +1 -0
- package/types/blocks/columns/index.d.ts +1 -0
- package/types/blocks/custom-code/index.d.ts +1 -0
- package/types/blocks/embed/index.d.ts +1 -0
- package/types/blocks/form/form/index.d.ts +1 -0
- package/types/blocks/form/input/index.d.ts +1 -0
- package/types/blocks/form/select/index.d.ts +1 -0
- package/types/blocks/form/submit-button/index.d.ts +1 -0
- package/types/blocks/fragment/index.d.ts +1 -0
- package/types/blocks/image/index.d.ts +1 -0
- package/types/blocks/img/index.d.ts +1 -0
- package/types/blocks/raw-text/index.d.ts +1 -0
- package/types/blocks/section/index.d.ts +1 -0
- package/types/blocks/slot/index.d.ts +1 -0
- package/types/blocks/symbol/index.d.ts +1 -0
- package/types/blocks/text/index.d.ts +1 -0
- package/types/blocks/textarea/index.d.ts +1 -0
- package/types/blocks/video/index.d.ts +1 -0
- package/types/components/blocks/index.d.ts +1 -0
- package/types/components/content-variants/index.d.ts +1 -0
- package/types/components/error-boundary.d.ts +11 -0
- package/types/constants/sdk-version.d.ts +1 -1
- package/types/functions/get-content/types.d.ts +1 -1
- package/types/index-helpers/blocks-exports.d.ts +10 -11
- package/lib/edge/server-entry-a595b1cf.cjs +0 -2
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
const I = "react"
|
|
2
|
-
log: (...e) => console.log(S, ...e),
|
|
3
|
-
error: (...e) => console.error(S, ...e),
|
|
4
|
-
warn: (...e) => console.warn(S, ...e),
|
|
5
|
-
debug: (...e) => console.debug(S, ...e)
|
|
6
|
-
};
|
|
1
|
+
const I = "react";
|
|
7
2
|
function c() {
|
|
8
3
|
return typeof window != "undefined" && typeof document != "undefined";
|
|
9
4
|
}
|
|
@@ -13,44 +8,84 @@ function X() {
|
|
|
13
8
|
function V() {
|
|
14
9
|
return X() && window.location.search.indexOf("builder.frameEditing=") !== -1;
|
|
15
10
|
}
|
|
16
|
-
|
|
11
|
+
function We() {
|
|
12
|
+
return !c() || V() ? !1 : location.search.indexOf("builder.preview=") !== -1;
|
|
13
|
+
}
|
|
14
|
+
const L = (e) => JSON.parse(JSON.stringify(e)), $e = (e) => ({
|
|
15
|
+
type: "builder.registerComponent",
|
|
16
|
+
data: Z(e)
|
|
17
|
+
}), Y = (e) => {
|
|
18
|
+
const t = e.toString().trim();
|
|
19
|
+
return `return (${!t.startsWith("function") && !t.startsWith("(") ? "function " : ""}${t}).apply(this, arguments)`;
|
|
20
|
+
}, Q = (e) => typeof e == "function" ? Y(e) : L(e), Z = ({
|
|
21
|
+
inputs: e,
|
|
22
|
+
...t
|
|
23
|
+
}) => ({
|
|
24
|
+
...L(t),
|
|
25
|
+
inputs: e == null ? void 0 : e.map((n) => Object.entries(n).reduce((r, [o, s]) => ({
|
|
26
|
+
...r,
|
|
27
|
+
[o]: Q(s)
|
|
28
|
+
}), {}))
|
|
29
|
+
}), x = {};
|
|
30
|
+
function ee(e, t) {
|
|
31
|
+
let n = x[e];
|
|
32
|
+
if (n || (n = x[e] = []), n.push(t), c()) {
|
|
33
|
+
const r = {
|
|
34
|
+
type: "builder.register",
|
|
35
|
+
data: {
|
|
36
|
+
type: e,
|
|
37
|
+
info: t
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
try {
|
|
41
|
+
parent.postMessage(r, "*"), parent !== window && window.postMessage(r, "*");
|
|
42
|
+
} catch (o) {
|
|
43
|
+
console.debug("Could not postmessage", o);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const T = {};
|
|
48
|
+
function Ge(e) {
|
|
17
49
|
if (c()) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
any() {
|
|
40
|
-
return t.Android() || t.BlackBerry() || t.iOS() || t.Opera() || t.Windows() || I === "reactNative";
|
|
50
|
+
Object.assign(T, e);
|
|
51
|
+
const t = {
|
|
52
|
+
type: "builder.settingsChange",
|
|
53
|
+
data: T
|
|
54
|
+
};
|
|
55
|
+
parent.postMessage(t, "*");
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const A = "builder.", te = "options.", ne = (e) => {
|
|
59
|
+
const t = {};
|
|
60
|
+
return e.forEach((n, r) => {
|
|
61
|
+
t[r] = n;
|
|
62
|
+
}), t;
|
|
63
|
+
}, U = (e) => {
|
|
64
|
+
if (!e)
|
|
65
|
+
return {};
|
|
66
|
+
const t = M(e), n = {};
|
|
67
|
+
return Object.keys(t).forEach((r) => {
|
|
68
|
+
if (r.startsWith(A)) {
|
|
69
|
+
const o = r.replace(A, "").replace(te, "");
|
|
70
|
+
n[o] = t[r];
|
|
41
71
|
}
|
|
42
|
-
}, n
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
},
|
|
72
|
+
}), n;
|
|
73
|
+
}, re = () => {
|
|
74
|
+
if (!c())
|
|
75
|
+
return {};
|
|
76
|
+
const e = new URLSearchParams(window.location.search);
|
|
77
|
+
return U(e);
|
|
78
|
+
}, M = (e) => e instanceof URLSearchParams ? ne(e) : e, S = "[Builder.io]: ", f = {
|
|
79
|
+
log: (...e) => console.log(S, ...e),
|
|
80
|
+
error: (...e) => console.error(S, ...e),
|
|
81
|
+
warn: (...e) => console.warn(S, ...e),
|
|
82
|
+
debug: (...e) => console.debug(S, ...e)
|
|
83
|
+
}, m = (e) => e != null, oe = (e) => {
|
|
49
84
|
if (e === "localhost" || e === "127.0.0.1")
|
|
50
85
|
return e;
|
|
51
86
|
const t = e.split(".");
|
|
52
87
|
return t.length > 2 ? t.slice(1).join(".") : e;
|
|
53
|
-
},
|
|
88
|
+
}, N = ({
|
|
54
89
|
name: e,
|
|
55
90
|
canTrack: t
|
|
56
91
|
}) => {
|
|
@@ -61,14 +96,14 @@ const Y = () => {
|
|
|
61
96
|
f.warn("[COOKIE] GET error: ", (r == null ? void 0 : r.message) || r);
|
|
62
97
|
return;
|
|
63
98
|
}
|
|
64
|
-
},
|
|
99
|
+
}, F = async (e) => N(e), se = (e) => e.map(([t, n]) => n ? `${t}=${n}` : t).filter(m).join("; "), ae = [["secure", ""], ["SameSite", "None"]], ie = ({
|
|
65
100
|
name: e,
|
|
66
101
|
value: t,
|
|
67
102
|
expires: n
|
|
68
103
|
}) => {
|
|
69
|
-
const o = (c() ? location.protocol === "https:" : !0) ?
|
|
70
|
-
return
|
|
71
|
-
},
|
|
104
|
+
const o = (c() ? location.protocol === "https:" : !0) ? ae : [[]], s = n ? [["expires", n.toUTCString()]] : [[]], i = [[e, t], ...s, ["path", "/"], ["domain", oe(window.location.hostname)], ...o];
|
|
105
|
+
return se(i);
|
|
106
|
+
}, j = async ({
|
|
72
107
|
name: e,
|
|
73
108
|
value: t,
|
|
74
109
|
expires: n,
|
|
@@ -77,7 +112,7 @@ const Y = () => {
|
|
|
77
112
|
try {
|
|
78
113
|
if (!r)
|
|
79
114
|
return;
|
|
80
|
-
const o =
|
|
115
|
+
const o = ie({
|
|
81
116
|
name: e,
|
|
82
117
|
value: t,
|
|
83
118
|
expires: n
|
|
@@ -86,328 +121,121 @@ const Y = () => {
|
|
|
86
121
|
} catch (o) {
|
|
87
122
|
f.warn("[COOKIE] SET error: ", (o == null ? void 0 : o.message) || o);
|
|
88
123
|
}
|
|
89
|
-
}, oe = "builder.tests", E = (e) => `${oe}.${e}`, se = ({
|
|
90
|
-
contentId: e
|
|
91
|
-
}) => M({
|
|
92
|
-
name: E(e),
|
|
93
|
-
canTrack: !0
|
|
94
|
-
}), ae = ({
|
|
95
|
-
contentId: e
|
|
96
|
-
}) => U({
|
|
97
|
-
name: E(e),
|
|
98
|
-
canTrack: !0
|
|
99
|
-
}), ie = ({
|
|
100
|
-
contentId: e,
|
|
101
|
-
value: t
|
|
102
|
-
}) => N({
|
|
103
|
-
name: E(e),
|
|
104
|
-
value: t,
|
|
105
|
-
canTrack: !0
|
|
106
|
-
}), F = (e) => m(e.id) && m(e.variations) && Object.keys(e.variations).length > 0, ce = ({
|
|
107
|
-
id: e,
|
|
108
|
-
variations: t
|
|
109
|
-
}) => {
|
|
110
|
-
var o;
|
|
111
|
-
let n = 0;
|
|
112
|
-
const r = Math.random();
|
|
113
|
-
for (const s in t) {
|
|
114
|
-
const i = (o = t[s]) == null ? void 0 : o.testRatio;
|
|
115
|
-
if (n += i, r < n)
|
|
116
|
-
return s;
|
|
117
|
-
}
|
|
118
|
-
return e;
|
|
119
|
-
}, j = (e) => {
|
|
120
|
-
const t = ce(e);
|
|
121
|
-
return ie({
|
|
122
|
-
contentId: e.id,
|
|
123
|
-
value: t
|
|
124
|
-
}).catch((n) => {
|
|
125
|
-
f.error("could not store A/B test variation: ", n);
|
|
126
|
-
}), t;
|
|
127
|
-
}, D = ({
|
|
128
|
-
item: e,
|
|
129
|
-
testGroupId: t
|
|
130
|
-
}) => {
|
|
131
|
-
const n = e.variations[t];
|
|
132
|
-
return t === e.id || // handle edge-case where `testGroupId` points to non-existing variation
|
|
133
|
-
!n ? {
|
|
134
|
-
testVariationId: e.id,
|
|
135
|
-
testVariationName: "Default"
|
|
136
|
-
} : {
|
|
137
|
-
data: n.data,
|
|
138
|
-
testVariationId: n.id,
|
|
139
|
-
testVariationName: n.name || (n.id === e.id ? "Default" : "")
|
|
140
|
-
};
|
|
141
|
-
}, We = ({
|
|
142
|
-
item: e,
|
|
143
|
-
canTrack: t
|
|
144
|
-
}) => {
|
|
145
|
-
if (!t)
|
|
146
|
-
return e;
|
|
147
|
-
if (!e)
|
|
148
|
-
return;
|
|
149
|
-
if (!F(e))
|
|
150
|
-
return e;
|
|
151
|
-
const n = ae({
|
|
152
|
-
contentId: e.id
|
|
153
|
-
}) || j({
|
|
154
|
-
variations: e.variations,
|
|
155
|
-
id: e.id
|
|
156
|
-
}), r = D({
|
|
157
|
-
item: e,
|
|
158
|
-
testGroupId: n
|
|
159
|
-
});
|
|
160
|
-
return {
|
|
161
|
-
...e,
|
|
162
|
-
...r
|
|
163
|
-
};
|
|
164
|
-
}, ue = async ({
|
|
165
|
-
item: e,
|
|
166
|
-
canTrack: t
|
|
167
|
-
}) => {
|
|
168
|
-
if (!t || !F(e))
|
|
169
|
-
return e;
|
|
170
|
-
const r = await se({
|
|
171
|
-
contentId: e.id
|
|
172
|
-
}) || j({
|
|
173
|
-
variations: e.variations,
|
|
174
|
-
id: e.id
|
|
175
|
-
}), o = D({
|
|
176
|
-
item: e,
|
|
177
|
-
testGroupId: r
|
|
178
|
-
});
|
|
179
|
-
return {
|
|
180
|
-
...e,
|
|
181
|
-
...o
|
|
182
|
-
};
|
|
183
|
-
}, de = (e) => m(e) ? e : !0, $e = (e) => ({
|
|
184
|
-
type: "builder.registerComponent",
|
|
185
|
-
data: he(e)
|
|
186
|
-
}), le = (e) => {
|
|
187
|
-
const t = e.toString().trim();
|
|
188
|
-
return `return (${!t.startsWith("function") && !t.startsWith("(") ? "function " : ""}${t}).apply(this, arguments)`;
|
|
189
|
-
}, fe = (e) => typeof e == "function" ? le(e) : L(e), he = ({
|
|
190
|
-
inputs: e,
|
|
191
|
-
...t
|
|
192
|
-
}) => ({
|
|
193
|
-
...L(t),
|
|
194
|
-
inputs: e == null ? void 0 : e.map((n) => Object.entries(n).reduce((r, [o, s]) => ({
|
|
195
|
-
...r,
|
|
196
|
-
[o]: fe(s)
|
|
197
|
-
}), {}))
|
|
198
|
-
});
|
|
199
|
-
function ge() {
|
|
200
|
-
return typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : globalThis;
|
|
201
|
-
}
|
|
202
|
-
function pe() {
|
|
203
|
-
const e = ge().fetch;
|
|
204
|
-
if (typeof e == "undefined")
|
|
205
|
-
throw console.warn(`Builder SDK could not find a global fetch function. Make sure you have a polyfill for fetch in your project.
|
|
206
|
-
For more information, read https://github.com/BuilderIO/this-package-uses-fetch`), new Error("Builder SDK could not find a global `fetch` function");
|
|
207
|
-
return e;
|
|
208
|
-
}
|
|
209
|
-
const me = pe();
|
|
210
|
-
function v(e, t = null, n = ".") {
|
|
211
|
-
return Object.keys(e).reduce((r, o) => {
|
|
212
|
-
const s = e[o], i = [t, o].filter(Boolean).join(n);
|
|
213
|
-
return [typeof s == "object", s !== null, !(Array.isArray(s) && s.length === 0)].every(Boolean) ? {
|
|
214
|
-
...r,
|
|
215
|
-
...v(s, i, n)
|
|
216
|
-
} : {
|
|
217
|
-
...r,
|
|
218
|
-
[i]: s
|
|
219
|
-
};
|
|
220
|
-
}, {});
|
|
221
|
-
}
|
|
222
|
-
const ye = "v3", x = "builder.", we = "options.", be = (e) => {
|
|
223
|
-
const t = {};
|
|
224
|
-
return e.forEach((n, r) => {
|
|
225
|
-
t[r] = n;
|
|
226
|
-
}), t;
|
|
227
|
-
}, K = (e) => {
|
|
228
|
-
if (!e)
|
|
229
|
-
return {};
|
|
230
|
-
const t = _(e), n = {};
|
|
231
|
-
return Object.keys(t).forEach((r) => {
|
|
232
|
-
if (r.startsWith(x)) {
|
|
233
|
-
const o = r.replace(x, "").replace(we, "");
|
|
234
|
-
n[o] = t[r];
|
|
235
|
-
}
|
|
236
|
-
}), n;
|
|
237
|
-
}, Se = () => {
|
|
238
|
-
if (!c())
|
|
239
|
-
return {};
|
|
240
|
-
const e = new URLSearchParams(window.location.search);
|
|
241
|
-
return K(e);
|
|
242
|
-
}, _ = (e) => e instanceof URLSearchParams ? be(e) : e, T = (e) => typeof e == "number" && !isNaN(e) && e >= 0, C = (e) => {
|
|
243
|
-
const {
|
|
244
|
-
limit: t = 30,
|
|
245
|
-
userAttributes: n,
|
|
246
|
-
query: r,
|
|
247
|
-
model: o,
|
|
248
|
-
apiKey: s,
|
|
249
|
-
enrich: i,
|
|
250
|
-
locale: d,
|
|
251
|
-
apiVersion: y = ye,
|
|
252
|
-
fields: p,
|
|
253
|
-
omit: k,
|
|
254
|
-
offset: u,
|
|
255
|
-
cacheSeconds: h,
|
|
256
|
-
staleCacheSeconds: g,
|
|
257
|
-
sort: w,
|
|
258
|
-
includeUnpublished: O
|
|
259
|
-
} = e;
|
|
260
|
-
if (!s)
|
|
261
|
-
throw new Error("Missing API key");
|
|
262
|
-
if (!["v3"].includes(y))
|
|
263
|
-
throw new Error(`Invalid apiVersion: expected 'v3', received '${y}'`);
|
|
264
|
-
const q = t !== 1, a = new URL(`https://cdn.builder.io/api/${y}/content/${o}`);
|
|
265
|
-
if (a.searchParams.set("apiKey", s), a.searchParams.set("limit", String(t)), a.searchParams.set("noTraverse", String(q)), a.searchParams.set("includeRefs", String(!0)), d && a.searchParams.set("locale", d), i && a.searchParams.set("enrich", String(i)), a.searchParams.set("omit", k || "meta.componentsUsed"), p && a.searchParams.set("fields", p), Number.isFinite(u) && u > -1 && a.searchParams.set("offset", String(Math.floor(u))), typeof O == "boolean" && a.searchParams.set("includeUnpublished", String(O)), h && T(h) && a.searchParams.set("cacheSeconds", String(h)), g && T(g) && a.searchParams.set("staleCacheSeconds", String(g)), w) {
|
|
266
|
-
const l = v({
|
|
267
|
-
sort: w
|
|
268
|
-
});
|
|
269
|
-
for (const b in l)
|
|
270
|
-
a.searchParams.set(b, JSON.stringify(l[b]));
|
|
271
|
-
}
|
|
272
|
-
const z = {
|
|
273
|
-
...Se(),
|
|
274
|
-
..._(e.options || {})
|
|
275
|
-
}, P = v(z);
|
|
276
|
-
for (const l in P)
|
|
277
|
-
a.searchParams.set(l, String(P[l]));
|
|
278
|
-
if (n && a.searchParams.set("userAttributes", JSON.stringify(n)), r) {
|
|
279
|
-
const l = v({
|
|
280
|
-
query: r
|
|
281
|
-
});
|
|
282
|
-
for (const b in l)
|
|
283
|
-
a.searchParams.set(b, JSON.stringify(l[b]));
|
|
284
|
-
}
|
|
285
|
-
return a;
|
|
286
|
-
}, ve = (e) => "results" in e;
|
|
287
|
-
async function Ie(e) {
|
|
288
|
-
const t = await Ce({
|
|
289
|
-
...e,
|
|
290
|
-
limit: 1
|
|
291
|
-
});
|
|
292
|
-
return t && t[0] || null;
|
|
293
|
-
}
|
|
294
|
-
const ke = async (e) => {
|
|
295
|
-
const t = C(e);
|
|
296
|
-
return await (await me(t.href)).json();
|
|
297
|
-
}, Ee = async (e, t, n = C(e)) => {
|
|
298
|
-
const r = de(e.canTrack);
|
|
299
|
-
if (n.search.includes("preview="), !r || !(c() || I === "reactNative"))
|
|
300
|
-
return t.results;
|
|
301
|
-
try {
|
|
302
|
-
const o = [];
|
|
303
|
-
for (const s of t.results)
|
|
304
|
-
o.push(await ue({
|
|
305
|
-
item: s,
|
|
306
|
-
canTrack: r
|
|
307
|
-
}));
|
|
308
|
-
t.results = o;
|
|
309
|
-
} catch (o) {
|
|
310
|
-
f.error("Could not process A/B tests. ", o);
|
|
311
|
-
}
|
|
312
|
-
return t.results;
|
|
313
124
|
};
|
|
314
|
-
|
|
315
|
-
try {
|
|
316
|
-
const t = C(e), n = await ke(e);
|
|
317
|
-
return ve(n) ? Ee(e, n) : (f.error("Error fetching data. ", {
|
|
318
|
-
url: t,
|
|
319
|
-
content: n,
|
|
320
|
-
options: e
|
|
321
|
-
}), null);
|
|
322
|
-
} catch (t) {
|
|
323
|
-
return f.error("Error fetching data. ", t), null;
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
function Ge() {
|
|
327
|
-
return !c() || V() ? !1 : location.search.indexOf("builder.preview=") !== -1;
|
|
328
|
-
}
|
|
329
|
-
function Oe() {
|
|
125
|
+
function ce() {
|
|
330
126
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) {
|
|
331
127
|
const t = Math.random() * 16 | 0;
|
|
332
128
|
return (e == "x" ? t : t & 3 | 8).toString(16);
|
|
333
129
|
});
|
|
334
130
|
}
|
|
335
|
-
function
|
|
336
|
-
return
|
|
131
|
+
function D() {
|
|
132
|
+
return ce().replace(/-/g, "");
|
|
337
133
|
}
|
|
338
|
-
const
|
|
134
|
+
const K = "builderSessionId", ue = async ({
|
|
339
135
|
canTrack: e
|
|
340
136
|
}) => {
|
|
341
137
|
if (!e)
|
|
342
138
|
return;
|
|
343
|
-
const t = await
|
|
344
|
-
name:
|
|
139
|
+
const t = await F({
|
|
140
|
+
name: K,
|
|
345
141
|
canTrack: e
|
|
346
142
|
});
|
|
347
143
|
if (m(t))
|
|
348
144
|
return t;
|
|
349
145
|
{
|
|
350
|
-
const n =
|
|
351
|
-
return
|
|
146
|
+
const n = de();
|
|
147
|
+
return le({
|
|
352
148
|
id: n,
|
|
353
149
|
canTrack: e
|
|
354
150
|
}), n;
|
|
355
151
|
}
|
|
356
|
-
},
|
|
152
|
+
}, de = () => D(), le = ({
|
|
357
153
|
id: e,
|
|
358
154
|
canTrack: t
|
|
359
|
-
}) =>
|
|
360
|
-
name:
|
|
155
|
+
}) => j({
|
|
156
|
+
name: K,
|
|
361
157
|
value: e,
|
|
362
158
|
canTrack: t
|
|
363
|
-
}),
|
|
159
|
+
}), _ = () => c() && typeof localStorage != "undefined" ? localStorage : void 0, fe = ({
|
|
364
160
|
key: e,
|
|
365
161
|
canTrack: t
|
|
366
162
|
}) => {
|
|
367
163
|
var n;
|
|
368
164
|
try {
|
|
369
|
-
return t ? (n =
|
|
165
|
+
return t ? (n = _()) == null ? void 0 : n.getItem(e) : void 0;
|
|
370
166
|
} catch (r) {
|
|
371
167
|
console.debug("[LocalStorage] GET error: ", r);
|
|
372
168
|
return;
|
|
373
169
|
}
|
|
374
|
-
},
|
|
170
|
+
}, he = ({
|
|
375
171
|
key: e,
|
|
376
172
|
canTrack: t,
|
|
377
173
|
value: n
|
|
378
174
|
}) => {
|
|
379
175
|
var r;
|
|
380
176
|
try {
|
|
381
|
-
t && ((r =
|
|
177
|
+
t && ((r = _()) == null || r.setItem(e, n));
|
|
382
178
|
} catch (o) {
|
|
383
179
|
console.debug("[LocalStorage] SET error: ", o);
|
|
384
180
|
}
|
|
385
|
-
},
|
|
181
|
+
}, W = "builderVisitorId", ge = ({
|
|
386
182
|
canTrack: e
|
|
387
183
|
}) => {
|
|
388
184
|
if (!e)
|
|
389
185
|
return;
|
|
390
|
-
const t =
|
|
391
|
-
key:
|
|
186
|
+
const t = fe({
|
|
187
|
+
key: W,
|
|
392
188
|
canTrack: e
|
|
393
189
|
});
|
|
394
190
|
if (m(t))
|
|
395
191
|
return t;
|
|
396
192
|
{
|
|
397
|
-
const n =
|
|
398
|
-
return
|
|
193
|
+
const n = pe();
|
|
194
|
+
return me({
|
|
399
195
|
id: n,
|
|
400
196
|
canTrack: e
|
|
401
197
|
}), n;
|
|
402
198
|
}
|
|
403
|
-
},
|
|
199
|
+
}, pe = () => D(), me = ({
|
|
404
200
|
id: e,
|
|
405
201
|
canTrack: t
|
|
406
|
-
}) =>
|
|
407
|
-
key:
|
|
202
|
+
}) => he({
|
|
203
|
+
key: W,
|
|
408
204
|
value: e,
|
|
409
205
|
canTrack: t
|
|
410
|
-
}),
|
|
206
|
+
}), ye = () => {
|
|
207
|
+
if (c()) {
|
|
208
|
+
const e = new URL(location.href);
|
|
209
|
+
return e.pathname === "" && (e.pathname = "/"), e;
|
|
210
|
+
} else
|
|
211
|
+
return console.warn("Cannot get location for tracking in non-browser environment"), null;
|
|
212
|
+
}, we = () => typeof navigator == "object" && navigator.userAgent || "", be = () => {
|
|
213
|
+
const e = we(), t = {
|
|
214
|
+
Android() {
|
|
215
|
+
return e.match(/Android/i);
|
|
216
|
+
},
|
|
217
|
+
BlackBerry() {
|
|
218
|
+
return e.match(/BlackBerry/i);
|
|
219
|
+
},
|
|
220
|
+
iOS() {
|
|
221
|
+
return e.match(/iPhone|iPod/i);
|
|
222
|
+
},
|
|
223
|
+
Opera() {
|
|
224
|
+
return e.match(/Opera Mini/i);
|
|
225
|
+
},
|
|
226
|
+
Windows() {
|
|
227
|
+
return e.match(/IEMobile/i) || e.match(/WPDesktop/i);
|
|
228
|
+
},
|
|
229
|
+
any() {
|
|
230
|
+
return t.Android() || t.BlackBerry() || t.iOS() || t.Opera() || t.Windows() || I === "reactNative";
|
|
231
|
+
}
|
|
232
|
+
}, n = e.match(/Tablet|iPad/i), r = ye();
|
|
233
|
+
return {
|
|
234
|
+
urlPath: r == null ? void 0 : r.pathname,
|
|
235
|
+
host: (r == null ? void 0 : r.host) || (r == null ? void 0 : r.hostname),
|
|
236
|
+
device: n ? "tablet" : t.any() ? "mobile" : "desktop"
|
|
237
|
+
};
|
|
238
|
+
}, Se = async ({
|
|
411
239
|
canTrack: e
|
|
412
240
|
}) => {
|
|
413
241
|
if (!e)
|
|
@@ -415,16 +243,16 @@ const $ = "builderSessionId", Pe = async ({
|
|
|
415
243
|
visitorId: void 0,
|
|
416
244
|
sessionId: void 0
|
|
417
245
|
};
|
|
418
|
-
const t = await
|
|
246
|
+
const t = await ue({
|
|
419
247
|
canTrack: e
|
|
420
|
-
}), n =
|
|
248
|
+
}), n = ge({
|
|
421
249
|
canTrack: e
|
|
422
250
|
});
|
|
423
251
|
return {
|
|
424
252
|
sessionId: t,
|
|
425
253
|
visitorId: n
|
|
426
254
|
};
|
|
427
|
-
},
|
|
255
|
+
}, ve = async ({
|
|
428
256
|
type: e,
|
|
429
257
|
canTrack: t,
|
|
430
258
|
apiKey: n,
|
|
@@ -438,14 +266,14 @@ const $ = "builderSessionId", Pe = async ({
|
|
|
438
266
|
url: location.href,
|
|
439
267
|
...r
|
|
440
268
|
},
|
|
441
|
-
...await
|
|
269
|
+
...await Se({
|
|
442
270
|
canTrack: t
|
|
443
271
|
}),
|
|
444
|
-
userAttributes:
|
|
272
|
+
userAttributes: be(),
|
|
445
273
|
ownerId: n
|
|
446
274
|
}
|
|
447
275
|
});
|
|
448
|
-
async function
|
|
276
|
+
async function Ie(e) {
|
|
449
277
|
if (!e.apiKey) {
|
|
450
278
|
f.error("Missing API key for track call. Please provide your API key.");
|
|
451
279
|
return;
|
|
@@ -454,7 +282,7 @@ async function Ne(e) {
|
|
|
454
282
|
return fetch("https://cdn.builder.io/api/v1/track", {
|
|
455
283
|
method: "POST",
|
|
456
284
|
body: JSON.stringify({
|
|
457
|
-
events: [await
|
|
285
|
+
events: [await ve(e)]
|
|
458
286
|
}),
|
|
459
287
|
headers: {
|
|
460
288
|
"content-type": "application/json"
|
|
@@ -464,34 +292,16 @@ async function Ne(e) {
|
|
|
464
292
|
console.error("Failed to track: ", t);
|
|
465
293
|
});
|
|
466
294
|
}
|
|
467
|
-
const Je = (e) =>
|
|
295
|
+
const Je = (e) => Ie({
|
|
468
296
|
...e,
|
|
469
297
|
canTrack: !0
|
|
470
|
-
}),
|
|
471
|
-
function
|
|
298
|
+
}), ke = ["*.beta.builder.io", "beta.builder.io", "builder.io", "localhost", "qa.builder.io"];
|
|
299
|
+
function $(e, t) {
|
|
472
300
|
const n = new URL(t.origin), r = n.hostname;
|
|
473
|
-
return (e ||
|
|
474
|
-
}
|
|
475
|
-
const je = "1.0.2", A = {};
|
|
476
|
-
function De(e, t) {
|
|
477
|
-
let n = A[e];
|
|
478
|
-
if (n || (n = A[e] = []), n.push(t), c()) {
|
|
479
|
-
const r = {
|
|
480
|
-
type: "builder.register",
|
|
481
|
-
data: {
|
|
482
|
-
type: e,
|
|
483
|
-
info: t
|
|
484
|
-
}
|
|
485
|
-
};
|
|
486
|
-
try {
|
|
487
|
-
parent.postMessage(r, "*"), parent !== window && window.postMessage(r, "*");
|
|
488
|
-
} catch (o) {
|
|
489
|
-
console.debug("Could not postmessage", o);
|
|
490
|
-
}
|
|
491
|
-
}
|
|
301
|
+
return (e || ke).findIndex((o) => o.startsWith("*.") ? r.endsWith(o.slice(1)) : o === r) > -1;
|
|
492
302
|
}
|
|
493
|
-
const He = () => {
|
|
494
|
-
|
|
303
|
+
const Ee = "1.0.4", He = () => {
|
|
304
|
+
ee("insertMenu", {
|
|
495
305
|
name: "_default",
|
|
496
306
|
default: !0,
|
|
497
307
|
items: [{
|
|
@@ -514,13 +324,13 @@ const He = () => {
|
|
|
514
324
|
});
|
|
515
325
|
};
|
|
516
326
|
let R = !1;
|
|
517
|
-
const
|
|
327
|
+
const Ce = (e = {}) => {
|
|
518
328
|
var t, n;
|
|
519
329
|
R || (R = !0, c() && ((t = window.parent) == null || t.postMessage({
|
|
520
330
|
type: "builder.sdkInfo",
|
|
521
331
|
data: {
|
|
522
332
|
target: I,
|
|
523
|
-
version:
|
|
333
|
+
version: Ee,
|
|
524
334
|
supportsPatchUpdates: !1,
|
|
525
335
|
// Supports builder-model="..." attribute which is needed to
|
|
526
336
|
// scope our '+ add block' button styling
|
|
@@ -534,7 +344,7 @@ const Ke = (e = {}) => {
|
|
|
534
344
|
}
|
|
535
345
|
}, "*"), window.addEventListener("message", (r) => {
|
|
536
346
|
var s, i;
|
|
537
|
-
if (
|
|
347
|
+
if (!$(e.trustedHosts, r))
|
|
538
348
|
return;
|
|
539
349
|
const {
|
|
540
350
|
data: o
|
|
@@ -575,12 +385,12 @@ const Ke = (e = {}) => {
|
|
|
575
385
|
}
|
|
576
386
|
}
|
|
577
387
|
})));
|
|
578
|
-
},
|
|
388
|
+
}, Oe = ({
|
|
579
389
|
model: e,
|
|
580
390
|
trustedHosts: t,
|
|
581
391
|
callbacks: n
|
|
582
392
|
}) => (r) => {
|
|
583
|
-
if (
|
|
393
|
+
if (!$(t, r))
|
|
584
394
|
return;
|
|
585
395
|
const {
|
|
586
396
|
data: o
|
|
@@ -605,8 +415,8 @@ const Ke = (e = {}) => {
|
|
|
605
415
|
if (!c)
|
|
606
416
|
return f.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."), () => {
|
|
607
417
|
};
|
|
608
|
-
|
|
609
|
-
const r =
|
|
418
|
+
Ce();
|
|
419
|
+
const r = Oe({
|
|
610
420
|
callbacks: {
|
|
611
421
|
contentUpdate: t,
|
|
612
422
|
animation: () => {
|
|
@@ -620,15 +430,206 @@ const Ke = (e = {}) => {
|
|
|
620
430
|
return window.addEventListener("message", r), () => {
|
|
621
431
|
window.removeEventListener("message", r);
|
|
622
432
|
};
|
|
623
|
-
},
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
433
|
+
}, Pe = "builder.tests", E = (e) => `${Pe}.${e}`, xe = ({
|
|
434
|
+
contentId: e
|
|
435
|
+
}) => F({
|
|
436
|
+
name: E(e),
|
|
437
|
+
canTrack: !0
|
|
438
|
+
}), Te = ({
|
|
439
|
+
contentId: e
|
|
440
|
+
}) => N({
|
|
441
|
+
name: E(e),
|
|
442
|
+
canTrack: !0
|
|
443
|
+
}), Ae = ({
|
|
444
|
+
contentId: e,
|
|
445
|
+
value: t
|
|
446
|
+
}) => j({
|
|
447
|
+
name: E(e),
|
|
448
|
+
value: t,
|
|
449
|
+
canTrack: !0
|
|
450
|
+
}), G = (e) => m(e.id) && m(e.variations) && Object.keys(e.variations).length > 0, Re = ({
|
|
451
|
+
id: e,
|
|
452
|
+
variations: t
|
|
453
|
+
}) => {
|
|
454
|
+
var o;
|
|
455
|
+
let n = 0;
|
|
456
|
+
const r = Math.random();
|
|
457
|
+
for (const s in t) {
|
|
458
|
+
const i = (o = t[s]) == null ? void 0 : o.testRatio;
|
|
459
|
+
if (n += i, r < n)
|
|
460
|
+
return s;
|
|
461
|
+
}
|
|
462
|
+
return e;
|
|
463
|
+
}, J = (e) => {
|
|
464
|
+
const t = Re(e);
|
|
465
|
+
return Ae({
|
|
466
|
+
contentId: e.id,
|
|
467
|
+
value: t
|
|
468
|
+
}).catch((n) => {
|
|
469
|
+
f.error("could not store A/B test variation: ", n);
|
|
470
|
+
}), t;
|
|
471
|
+
}, H = ({
|
|
472
|
+
item: e,
|
|
473
|
+
testGroupId: t
|
|
474
|
+
}) => {
|
|
475
|
+
const n = e.variations[t];
|
|
476
|
+
return t === e.id || // handle edge-case where `testGroupId` points to non-existing variation
|
|
477
|
+
!n ? {
|
|
478
|
+
testVariationId: e.id,
|
|
479
|
+
testVariationName: "Default"
|
|
480
|
+
} : {
|
|
481
|
+
data: n.data,
|
|
482
|
+
testVariationId: n.id,
|
|
483
|
+
testVariationName: n.name || (n.id === e.id ? "Default" : "")
|
|
484
|
+
};
|
|
485
|
+
}, ze = ({
|
|
486
|
+
item: e,
|
|
487
|
+
canTrack: t
|
|
488
|
+
}) => {
|
|
489
|
+
if (!t)
|
|
490
|
+
return e;
|
|
491
|
+
if (!e)
|
|
492
|
+
return;
|
|
493
|
+
if (!G(e))
|
|
494
|
+
return e;
|
|
495
|
+
const n = Te({
|
|
496
|
+
contentId: e.id
|
|
497
|
+
}) || J({
|
|
498
|
+
variations: e.variations,
|
|
499
|
+
id: e.id
|
|
500
|
+
}), r = H({
|
|
501
|
+
item: e,
|
|
502
|
+
testGroupId: n
|
|
503
|
+
});
|
|
504
|
+
return {
|
|
505
|
+
...e,
|
|
506
|
+
...r
|
|
507
|
+
};
|
|
508
|
+
}, Be = async ({
|
|
509
|
+
item: e,
|
|
510
|
+
canTrack: t
|
|
511
|
+
}) => {
|
|
512
|
+
if (!t || !G(e))
|
|
513
|
+
return e;
|
|
514
|
+
const r = await xe({
|
|
515
|
+
contentId: e.id
|
|
516
|
+
}) || J({
|
|
517
|
+
variations: e.variations,
|
|
518
|
+
id: e.id
|
|
519
|
+
}), o = H({
|
|
520
|
+
item: e,
|
|
521
|
+
testGroupId: r
|
|
522
|
+
});
|
|
523
|
+
return {
|
|
524
|
+
...e,
|
|
525
|
+
...o
|
|
526
|
+
};
|
|
527
|
+
}, Ve = (e) => m(e) ? e : !0;
|
|
528
|
+
function Le() {
|
|
529
|
+
return typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : globalThis;
|
|
530
|
+
}
|
|
531
|
+
function Ue() {
|
|
532
|
+
const e = Le().fetch;
|
|
533
|
+
if (typeof e == "undefined")
|
|
534
|
+
throw console.warn(`Builder SDK could not find a global fetch function. Make sure you have a polyfill for fetch in your project.
|
|
535
|
+
For more information, read https://github.com/BuilderIO/this-package-uses-fetch`), new Error("Builder SDK could not find a global `fetch` function");
|
|
536
|
+
return e;
|
|
537
|
+
}
|
|
538
|
+
const Me = Ue();
|
|
539
|
+
function v(e, t = null, n = ".") {
|
|
540
|
+
return Object.keys(e).reduce((r, o) => {
|
|
541
|
+
const s = e[o], i = [t, o].filter(Boolean).join(n);
|
|
542
|
+
return [typeof s == "object", s !== null, !(Array.isArray(s) && s.length === 0)].every(Boolean) ? {
|
|
543
|
+
...r,
|
|
544
|
+
...v(s, i, n)
|
|
545
|
+
} : {
|
|
546
|
+
...r,
|
|
547
|
+
[i]: s
|
|
630
548
|
};
|
|
631
|
-
|
|
549
|
+
}, {});
|
|
550
|
+
}
|
|
551
|
+
const Ne = "v3", B = (e) => typeof e == "number" && !isNaN(e) && e >= 0, C = (e) => {
|
|
552
|
+
const {
|
|
553
|
+
limit: t = 30,
|
|
554
|
+
userAttributes: n,
|
|
555
|
+
query: r,
|
|
556
|
+
model: o,
|
|
557
|
+
apiKey: s,
|
|
558
|
+
enrich: i,
|
|
559
|
+
locale: d,
|
|
560
|
+
apiVersion: y = Ne,
|
|
561
|
+
fields: p,
|
|
562
|
+
omit: k,
|
|
563
|
+
offset: u,
|
|
564
|
+
cacheSeconds: h,
|
|
565
|
+
staleCacheSeconds: g,
|
|
566
|
+
sort: w,
|
|
567
|
+
includeUnpublished: O
|
|
568
|
+
} = e;
|
|
569
|
+
if (!s)
|
|
570
|
+
throw new Error("Missing API key");
|
|
571
|
+
if (!["v3"].includes(y))
|
|
572
|
+
throw new Error(`Invalid apiVersion: expected 'v3', received '${y}'`);
|
|
573
|
+
const q = t !== 1, a = new URL(`https://cdn.builder.io/api/${y}/content/${o}`);
|
|
574
|
+
if (a.searchParams.set("apiKey", s), a.searchParams.set("limit", String(t)), a.searchParams.set("noTraverse", String(q)), a.searchParams.set("includeRefs", String(!0)), d && a.searchParams.set("locale", d), i && a.searchParams.set("enrich", String(i)), a.searchParams.set("omit", k || "meta.componentsUsed"), p && a.searchParams.set("fields", p), Number.isFinite(u) && u > -1 && a.searchParams.set("offset", String(Math.floor(u))), typeof O == "boolean" && a.searchParams.set("includeUnpublished", String(O)), h && B(h) && a.searchParams.set("cacheSeconds", String(h)), g && B(g) && a.searchParams.set("staleCacheSeconds", String(g)), w) {
|
|
575
|
+
const l = v({
|
|
576
|
+
sort: w
|
|
577
|
+
});
|
|
578
|
+
for (const b in l)
|
|
579
|
+
a.searchParams.set(b, JSON.stringify(l[b]));
|
|
580
|
+
}
|
|
581
|
+
const z = {
|
|
582
|
+
...re(),
|
|
583
|
+
...M(e.options || {})
|
|
584
|
+
}, P = v(z);
|
|
585
|
+
for (const l in P)
|
|
586
|
+
a.searchParams.set(l, String(P[l]));
|
|
587
|
+
if (n && a.searchParams.set("userAttributes", JSON.stringify(n)), r) {
|
|
588
|
+
const l = v({
|
|
589
|
+
query: r
|
|
590
|
+
});
|
|
591
|
+
for (const b in l)
|
|
592
|
+
a.searchParams.set(b, JSON.stringify(l[b]));
|
|
593
|
+
}
|
|
594
|
+
return a;
|
|
595
|
+
}, Fe = (e) => "results" in e;
|
|
596
|
+
async function je(e) {
|
|
597
|
+
const t = await _e({
|
|
598
|
+
...e,
|
|
599
|
+
limit: 1
|
|
600
|
+
});
|
|
601
|
+
return t && t[0] || null;
|
|
602
|
+
}
|
|
603
|
+
const De = async (e) => {
|
|
604
|
+
const t = C(e);
|
|
605
|
+
return await (await Me(t.href)).json();
|
|
606
|
+
}, Ke = async (e, t, n = C(e)) => {
|
|
607
|
+
const r = Ve(e.canTrack);
|
|
608
|
+
if (n.search.includes("preview="), !r || !(c() || I === "reactNative"))
|
|
609
|
+
return t.results;
|
|
610
|
+
try {
|
|
611
|
+
const o = [];
|
|
612
|
+
for (const s of t.results)
|
|
613
|
+
o.push(await Be({
|
|
614
|
+
item: s,
|
|
615
|
+
canTrack: r
|
|
616
|
+
}));
|
|
617
|
+
t.results = o;
|
|
618
|
+
} catch (o) {
|
|
619
|
+
f.error("Could not process A/B tests. ", o);
|
|
620
|
+
}
|
|
621
|
+
return t.results;
|
|
622
|
+
};
|
|
623
|
+
async function _e(e) {
|
|
624
|
+
try {
|
|
625
|
+
const t = C(e), n = await De(e);
|
|
626
|
+
return Fe(n) ? Ke(e, n) : (f.error("Error fetching data. ", {
|
|
627
|
+
url: t,
|
|
628
|
+
content: n,
|
|
629
|
+
options: e
|
|
630
|
+
}), null);
|
|
631
|
+
} catch (t) {
|
|
632
|
+
return f.error("Error fetching data. ", t), null;
|
|
632
633
|
}
|
|
633
634
|
}
|
|
634
635
|
const Xe = async (e) => {
|
|
@@ -643,39 +644,39 @@ const Xe = async (e) => {
|
|
|
643
644
|
urlPath: t
|
|
644
645
|
} : {}
|
|
645
646
|
},
|
|
646
|
-
options:
|
|
647
|
+
options: U(e.searchParams || ((s = e.url) == null ? void 0 : s.searchParams) || e.options)
|
|
647
648
|
};
|
|
648
649
|
return {
|
|
649
650
|
apiKey: n.apiKey,
|
|
650
651
|
model: n.model,
|
|
651
|
-
content: await
|
|
652
|
+
content: await je(n)
|
|
652
653
|
};
|
|
653
654
|
};
|
|
654
655
|
export {
|
|
655
656
|
I as T,
|
|
656
|
-
|
|
657
|
-
|
|
657
|
+
Ke as _,
|
|
658
|
+
We as a,
|
|
658
659
|
qe as b,
|
|
659
660
|
$e as c,
|
|
660
|
-
|
|
661
|
-
|
|
661
|
+
_e as d,
|
|
662
|
+
je as e,
|
|
662
663
|
Xe as f,
|
|
663
|
-
|
|
664
|
+
U as g,
|
|
664
665
|
c as h,
|
|
665
666
|
V as i,
|
|
666
|
-
|
|
667
|
-
|
|
667
|
+
Ve as j,
|
|
668
|
+
Ie as k,
|
|
668
669
|
f as l,
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
670
|
+
Oe as m,
|
|
671
|
+
L as n,
|
|
672
|
+
He as o,
|
|
673
|
+
Ce as p,
|
|
674
|
+
Me as q,
|
|
675
|
+
ee as r,
|
|
676
|
+
Ge as s,
|
|
676
677
|
Je as t,
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
678
|
+
Z as u,
|
|
679
|
+
ze as v,
|
|
680
|
+
be as w,
|
|
681
|
+
m as x
|
|
681
682
|
};
|