@builder.io/sdk-react 4.1.1 → 4.1.2
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 +2 -2
- package/lib/browser/blocks-exports.mjs +246 -246
- package/lib/browser/index.cjs +1 -1
- package/lib/browser/index.mjs +1 -1
- package/lib/browser/{server-entry-7fc3706d.js → server-entry-275748e0.js} +120 -144
- package/lib/browser/server-entry-d2f19ab1.cjs +2 -0
- package/lib/browser/server-entry.cjs +1 -1
- package/lib/browser/server-entry.mjs +1 -1
- package/lib/edge/{accordion-97979a98.cjs → accordion-59377bdf.cjs} +1 -1
- package/lib/edge/{accordion-52165801.js → accordion-59685072.js} +1 -1
- package/lib/edge/{blocks-f69d48c0.js → blocks-803a3669.js} +2 -2
- package/lib/edge/{blocks-b38b39ff.cjs → blocks-ab4caea4.cjs} +1 -1
- package/lib/edge/blocks-exports.cjs +1 -1
- package/lib/edge/blocks-exports.mjs +2 -2
- package/lib/edge/{button-3acce335.js → button-244756d9.js} +2 -2
- package/lib/edge/{button-c2b48e86.cjs → button-d9ead397.cjs} +1 -1
- package/lib/edge/{columns-600ece77.cjs → columns-88904faf.cjs} +1 -1
- package/lib/edge/{columns-301795ee.js → columns-ac088b45.js} +3 -3
- package/lib/edge/{content-variants-d80a626a.js → content-variants-7ba31977.js} +133 -133
- package/lib/edge/{content-variants-cb452ad4.cjs → content-variants-d0558de3.cjs} +5 -5
- package/lib/edge/{custom-code-38a0e487.js → custom-code-3d893bd2.js} +1 -1
- package/lib/edge/{custom-code-381f399e.cjs → custom-code-e2904013.cjs} +1 -1
- package/lib/edge/{embed-57e9672d.cjs → embed-7710e674.cjs} +1 -1
- package/lib/edge/{embed-3e62c6c0.js → embed-7c2fe6ce.js} +1 -1
- package/lib/edge/{form-01ee1ef4.js → form-a5b57678.js} +3 -3
- package/lib/edge/{form-dfb33605.cjs → form-ec1cd318.cjs} +1 -1
- package/lib/edge/{get-class-prop-name-7a52ddda.cjs → get-class-prop-name-31bfc4d6.cjs} +1 -1
- package/lib/edge/{get-class-prop-name-ca3fff6a.js → get-class-prop-name-4ca8bda9.js} +1 -1
- package/lib/edge/{img-35c030d0.js → img-1b034d45.js} +1 -1
- package/lib/edge/{img-ff08ac3a.cjs → img-f00b7db5.cjs} +1 -1
- package/lib/edge/index.cjs +1 -1
- package/lib/edge/index.mjs +1 -1
- package/lib/edge/{input-bd84e8ab.cjs → input-19390442.cjs} +1 -1
- package/lib/edge/{input-d466ec13.js → input-dfd8b37e.js} +1 -1
- package/lib/edge/{personalization-container-8b04de3e.cjs → personalization-container-40c62fee.cjs} +1 -1
- package/lib/edge/{personalization-container-87ff6375.js → personalization-container-660938a9.js} +4 -4
- package/lib/edge/{select-5d4ffe3b.js → select-155fc504.js} +1 -1
- package/lib/edge/{select-ef4ce171.cjs → select-9839622b.cjs} +1 -1
- package/lib/edge/{server-entry-db512751.js → server-entry-75006b6f.js} +119 -143
- package/lib/edge/server-entry-bdf7aa30.cjs +2 -0
- package/lib/edge/server-entry.cjs +1 -1
- package/lib/edge/server-entry.mjs +1 -1
- package/lib/edge/{slot-78b8ee2b.cjs → slot-28225152.cjs} +1 -1
- package/lib/edge/{slot-d0cbcacf.js → slot-c14c2de1.js} +3 -3
- package/lib/edge/{symbol-2e54d716.js → symbol-2419b184.js} +2 -2
- package/lib/edge/{symbol-6d9bb0a7.cjs → symbol-e5dc7a91.cjs} +1 -1
- package/lib/edge/{tabs-b8c2b851.js → tabs-c7011fa2.js} +3 -3
- package/lib/edge/{tabs-3f775737.cjs → tabs-d7aa6ac2.cjs} +1 -1
- package/lib/node/blocks-exports.cjs +2 -2
- package/lib/node/blocks-exports.mjs +244 -244
- 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/node/{server-entry-b0a12b94.js → server-entry-0cf21855.js} +120 -144
- package/lib/node/server-entry-7a611f62.cjs +2 -0
- package/lib/node/server-entry.cjs +1 -1
- package/lib/node/server-entry.mjs +1 -1
- package/lib/node/{setIvm-f591fbda.js → setIvm-4171d613.js} +1 -1
- package/lib/node/{setIvm-513e193d.cjs → setIvm-68685828.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-0fb1bbdd.cjs → should-force-browser-runtime-in-node-88656beb.cjs} +1 -1
- package/lib/node/{should-force-browser-runtime-in-node-da05f5c3.js → should-force-browser-runtime-in-node-9fe42073.js} +1 -1
- package/package.json +1 -1
- package/types/constants/sdk-version.d.ts +1 -1
- package/types/scripts/init-editing.d.ts +0 -1
- package/lib/browser/server-entry-7291b0a0.cjs +0 -2
- package/lib/edge/server-entry-afc62633.cjs +0 -2
- package/lib/node/server-entry-47ceca47.cjs +0 -2
package/lib/browser/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./blocks-exports.cjs"),e=require("./server-entry-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./blocks-exports.cjs"),e=require("./server-entry-d2f19ab1.cjs");require("react/jsx-runtime");require("react");exports.Blocks=t.Blocks;exports.BuilderContext=t.BuilderContext;exports.Button=t.Button;exports.Columns=t.Columns;exports.Content=t.Content;exports.Fragment=t.Fragment;exports.Image=t.Image;exports.Section=t.Section;exports.Symbol=t.Symbol;exports.Text=t.Text;exports.Video=t.Video;exports._processContentResult=e._processContentResult;exports.createRegisterComponentMessage=e.createRegisterComponentMessage;exports.fetchBuilderProps=e.fetchBuilderProps;exports.fetchEntries=e.fetchEntries;exports.fetchOneEntry=e.fetchOneEntry;exports.getBuilderSearchParams=e.getBuilderSearchParams;exports.isEditing=e.isEditing;exports.isPreviewing=e.isPreviewing;exports.register=e.register;exports.setClientUserAttributes=e.setClientUserAttributes;exports.setEditorSettings=e.setEditorSettings;exports.subscribeToEditor=e.subscribeToEditor;exports.track=e.track;
|
package/lib/browser/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Blocks as o, BuilderContext as s, Button as n, Columns as c, Content as m, Fragment as g, Image as a, Section as l, Symbol as u, Text as d, Video as p } from "./blocks-exports.mjs";
|
|
2
|
-
import { _processContentResult as f, createRegisterComponentMessage as B, fetchBuilderProps as E, fetchEntries as b, fetchOneEntry as h, getBuilderSearchParams as x, isEditing as S, isPreviewing as P, register as k, setClientUserAttributes as y, setEditorSettings as R, subscribeToEditor as T, track as v } from "./server-entry-
|
|
2
|
+
import { _processContentResult as f, createRegisterComponentMessage as B, fetchBuilderProps as E, fetchEntries as b, fetchOneEntry as h, getBuilderSearchParams as x, isEditing as S, isPreviewing as P, register as k, setClientUserAttributes as y, setEditorSettings as R, subscribeToEditor as T, track as v } from "./server-entry-275748e0.js";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "react";
|
|
5
5
|
export {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const b = "react", v = "[Builder.io]: ", f = {
|
|
2
2
|
log: (...t) => console.log(v, ...t),
|
|
3
3
|
error: (...t) => console.error(v, ...t),
|
|
4
4
|
warn: (...t) => console.warn(v, ...t),
|
|
@@ -12,7 +12,7 @@ const at = (t) => {
|
|
|
12
12
|
return t.forEach((n, r) => {
|
|
13
13
|
e[r] = n;
|
|
14
14
|
}), e;
|
|
15
|
-
},
|
|
15
|
+
}, M = (t) => t instanceof URLSearchParams ? at(t) : t, W = (t) => typeof t == "string" ? t : t instanceof URLSearchParams ? t.toString() : new URLSearchParams(t).toString();
|
|
16
16
|
function ct() {
|
|
17
17
|
return c() && window.self !== window.top;
|
|
18
18
|
}
|
|
@@ -44,7 +44,7 @@ const lt = () => {
|
|
|
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() || b === "reactNative";
|
|
48
48
|
}
|
|
49
49
|
}, n = t.match(/Tablet|iPad/i), r = lt();
|
|
50
50
|
return {
|
|
@@ -52,12 +52,12 @@ const lt = () => {
|
|
|
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
|
+
}, y = (t) => t != null;
|
|
56
|
+
function ee(t) {
|
|
57
57
|
const e = t || (c() ? window.location.search : void 0);
|
|
58
58
|
return e ? W(e).indexOf("builder.preview=") !== -1 : !1;
|
|
59
59
|
}
|
|
60
|
-
const
|
|
60
|
+
const ne = (t) => ({
|
|
61
61
|
type: "builder.registerComponent",
|
|
62
62
|
data: j(t)
|
|
63
63
|
}), ht = (t) => {
|
|
@@ -68,7 +68,7 @@ function j(t) {
|
|
|
68
68
|
return JSON.parse(JSON.stringify(t, (e, n) => typeof n == "function" ? ht(n) : n));
|
|
69
69
|
}
|
|
70
70
|
const _ = {};
|
|
71
|
-
function
|
|
71
|
+
function re(t, e) {
|
|
72
72
|
t === "plugin" && (e = j(e));
|
|
73
73
|
let n = _[t];
|
|
74
74
|
if (n || (n = _[t] = []), n.push(e), c()) {
|
|
@@ -97,23 +97,23 @@ function se(t) {
|
|
|
97
97
|
parent.postMessage(e, "*");
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
|
-
const N = "builder.",
|
|
100
|
+
const N = "builder.", gt = "options.", $ = (t) => {
|
|
101
101
|
if (!t)
|
|
102
102
|
return {};
|
|
103
|
-
const e =
|
|
103
|
+
const e = M(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(gt, "");
|
|
107
107
|
n[s] = e[r];
|
|
108
108
|
}
|
|
109
109
|
}), n;
|
|
110
|
-
},
|
|
110
|
+
}, pt = () => {
|
|
111
111
|
if (!c())
|
|
112
112
|
return {};
|
|
113
113
|
const t = new URLSearchParams(window.location.search);
|
|
114
114
|
return $(t);
|
|
115
|
-
}, G = "4.1.
|
|
116
|
-
"X-Builder-SDK":
|
|
115
|
+
}, G = "4.1.2", J = () => ({
|
|
116
|
+
"X-Builder-SDK": b,
|
|
117
117
|
"X-Builder-SDK-GEN": "2",
|
|
118
118
|
"X-Builder-SDK-Version": G
|
|
119
119
|
}), St = (t) => {
|
|
@@ -132,7 +132,7 @@ const N = "builder.", pt = "options.", $ = (t) => {
|
|
|
132
132
|
f.warn("[COOKIE] GET error: ", (r == null ? void 0 : r.message) || r);
|
|
133
133
|
return;
|
|
134
134
|
}
|
|
135
|
-
}, z = async (t) => O(t), yt = (t) => t.map(([e, n]) => n ? `${e}=${n}` : e).filter(
|
|
135
|
+
}, z = async (t) => O(t), yt = (t) => t.map(([e, n]) => n ? `${e}=${n}` : e).filter(y).join("; "), bt = [["secure", ""], ["SameSite", "None"]], mt = ({
|
|
136
136
|
name: t,
|
|
137
137
|
value: e,
|
|
138
138
|
expires: n
|
|
@@ -148,7 +148,7 @@ const N = "builder.", pt = "options.", $ = (t) => {
|
|
|
148
148
|
try {
|
|
149
149
|
if (!r)
|
|
150
150
|
return;
|
|
151
|
-
const s =
|
|
151
|
+
const s = mt({
|
|
152
152
|
name: t,
|
|
153
153
|
value: e,
|
|
154
154
|
expires: n
|
|
@@ -158,16 +158,16 @@ const N = "builder.", pt = "options.", $ = (t) => {
|
|
|
158
158
|
f.warn("[COOKIE] SET error: ", (s == null ? void 0 : s.message) || s);
|
|
159
159
|
}
|
|
160
160
|
};
|
|
161
|
-
function
|
|
161
|
+
function wt() {
|
|
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
167
|
function X() {
|
|
168
|
-
return
|
|
168
|
+
return wt().replace(/-/g, "");
|
|
169
169
|
}
|
|
170
|
-
const H = "builderSessionId",
|
|
170
|
+
const H = "builderSessionId", Et = async ({
|
|
171
171
|
canTrack: t
|
|
172
172
|
}) => {
|
|
173
173
|
if (!t)
|
|
@@ -176,23 +176,23 @@ const H = "builderSessionId", It = async ({
|
|
|
176
176
|
name: H,
|
|
177
177
|
canTrack: t
|
|
178
178
|
});
|
|
179
|
-
if (
|
|
179
|
+
if (y(e))
|
|
180
180
|
return e;
|
|
181
181
|
{
|
|
182
|
-
const n =
|
|
183
|
-
return
|
|
182
|
+
const n = It();
|
|
183
|
+
return vt({
|
|
184
184
|
id: n,
|
|
185
185
|
canTrack: t
|
|
186
186
|
}), n;
|
|
187
187
|
}
|
|
188
|
-
},
|
|
188
|
+
}, It = () => X(), vt = ({
|
|
189
189
|
id: t,
|
|
190
190
|
canTrack: e
|
|
191
191
|
}) => T({
|
|
192
192
|
name: H,
|
|
193
193
|
value: t,
|
|
194
194
|
canTrack: e
|
|
195
|
-
}), Q = () => c() && typeof localStorage != "undefined" ? localStorage : void 0,
|
|
195
|
+
}), Q = () => c() && typeof localStorage != "undefined" ? localStorage : void 0, At = ({
|
|
196
196
|
key: t,
|
|
197
197
|
canTrack: e
|
|
198
198
|
}) => {
|
|
@@ -203,7 +203,7 @@ const H = "builderSessionId", It = async ({
|
|
|
203
203
|
console.debug("[LocalStorage] GET error: ", r);
|
|
204
204
|
return;
|
|
205
205
|
}
|
|
206
|
-
},
|
|
206
|
+
}, kt = ({
|
|
207
207
|
key: t,
|
|
208
208
|
canTrack: e,
|
|
209
209
|
value: n
|
|
@@ -214,28 +214,28 @@ const H = "builderSessionId", It = async ({
|
|
|
214
214
|
} catch (s) {
|
|
215
215
|
console.debug("[LocalStorage] SET error: ", s);
|
|
216
216
|
}
|
|
217
|
-
}, Y = "builderVisitorId",
|
|
217
|
+
}, Y = "builderVisitorId", Ut = ({
|
|
218
218
|
canTrack: t
|
|
219
219
|
}) => {
|
|
220
220
|
if (!t)
|
|
221
221
|
return;
|
|
222
|
-
const e =
|
|
222
|
+
const e = At({
|
|
223
223
|
key: Y,
|
|
224
224
|
canTrack: t
|
|
225
225
|
});
|
|
226
|
-
if (
|
|
226
|
+
if (y(e))
|
|
227
227
|
return e;
|
|
228
228
|
{
|
|
229
|
-
const n =
|
|
230
|
-
return
|
|
229
|
+
const n = Ot();
|
|
230
|
+
return Tt({
|
|
231
231
|
id: n,
|
|
232
232
|
canTrack: t
|
|
233
233
|
}), n;
|
|
234
234
|
}
|
|
235
|
-
},
|
|
235
|
+
}, Ot = () => X(), Tt = ({
|
|
236
236
|
id: t,
|
|
237
237
|
canTrack: e
|
|
238
|
-
}) =>
|
|
238
|
+
}) => kt({
|
|
239
239
|
key: Y,
|
|
240
240
|
value: t,
|
|
241
241
|
canTrack: e
|
|
@@ -252,16 +252,16 @@ const Rt = async ({
|
|
|
252
252
|
visitorId: void 0,
|
|
253
253
|
sessionId: void 0
|
|
254
254
|
};
|
|
255
|
-
const e = await
|
|
255
|
+
const e = await Et({
|
|
256
256
|
canTrack: t
|
|
257
|
-
}), n =
|
|
257
|
+
}), n = Ut({
|
|
258
258
|
canTrack: t
|
|
259
259
|
});
|
|
260
260
|
return {
|
|
261
261
|
sessionId: e,
|
|
262
262
|
visitorId: n
|
|
263
263
|
};
|
|
264
|
-
},
|
|
264
|
+
}, Ct = async ({
|
|
265
265
|
type: t,
|
|
266
266
|
canTrack: e,
|
|
267
267
|
apiKey: n,
|
|
@@ -282,7 +282,7 @@ const Rt = async ({
|
|
|
282
282
|
ownerId: n
|
|
283
283
|
}
|
|
284
284
|
});
|
|
285
|
-
async function
|
|
285
|
+
async function Bt({
|
|
286
286
|
apiHost: t,
|
|
287
287
|
...e
|
|
288
288
|
}) {
|
|
@@ -290,13 +290,13 @@ 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 || ut() || !(c() ||
|
|
293
|
+
if (!e.canTrack || ut() || !(c() || b === "reactNative"))
|
|
294
294
|
return;
|
|
295
295
|
const r = `${t || "https://cdn.builder.io"}/api/v1/track`;
|
|
296
296
|
return Pt(r), fetch(r, {
|
|
297
297
|
method: "POST",
|
|
298
298
|
body: JSON.stringify({
|
|
299
|
-
events: [await
|
|
299
|
+
events: [await Ct(e)]
|
|
300
300
|
}),
|
|
301
301
|
headers: {
|
|
302
302
|
"content-type": "application/json",
|
|
@@ -307,46 +307,23 @@ async function xt({
|
|
|
307
307
|
console.error("Failed to track: ", s);
|
|
308
308
|
});
|
|
309
309
|
}
|
|
310
|
-
const oe = (t) =>
|
|
310
|
+
const oe = (t) => Bt({
|
|
311
311
|
...t,
|
|
312
312
|
canTrack: !0
|
|
313
|
-
}),
|
|
313
|
+
}), xt = ["*.beta.builder.io", "beta.builder.io", "builder.io", "localhost", "qa.builder.io"];
|
|
314
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 || xt).findIndex((s) => s.startsWith("*.") ? r.endsWith(s.slice(1)) : s === r) > -1;
|
|
319
319
|
}
|
|
320
|
-
const ie = () => {
|
|
321
|
-
gt("insertMenu", {
|
|
322
|
-
name: "_default",
|
|
323
|
-
default: !0,
|
|
324
|
-
items: [{
|
|
325
|
-
name: "Box"
|
|
326
|
-
}, {
|
|
327
|
-
name: "Text"
|
|
328
|
-
}, {
|
|
329
|
-
name: "Image"
|
|
330
|
-
}, {
|
|
331
|
-
name: "Columns"
|
|
332
|
-
}, {
|
|
333
|
-
name: "Core:Section"
|
|
334
|
-
}, {
|
|
335
|
-
name: "Core:Button"
|
|
336
|
-
}, {
|
|
337
|
-
name: "Embed"
|
|
338
|
-
}, {
|
|
339
|
-
name: "Custom Code"
|
|
340
|
-
}]
|
|
341
|
-
});
|
|
342
|
-
};
|
|
343
320
|
let V = !1;
|
|
344
|
-
const
|
|
321
|
+
const _t = (t) => {
|
|
345
322
|
var e, n;
|
|
346
323
|
V || (V = !0, c() && ((e = window.parent) == null || e.postMessage({
|
|
347
324
|
type: "builder.sdkInfo",
|
|
348
325
|
data: {
|
|
349
|
-
target:
|
|
326
|
+
target: b,
|
|
350
327
|
version: G,
|
|
351
328
|
supportsPatchUpdates: !1,
|
|
352
329
|
// Supports builder-model="..." attribute which is needed to
|
|
@@ -373,10 +350,10 @@ const Lt = (t) => {
|
|
|
373
350
|
if (s != null && s.type)
|
|
374
351
|
switch (s.type) {
|
|
375
352
|
case "builder.evaluate": {
|
|
376
|
-
const u = s.data.text,
|
|
353
|
+
const u = s.data.text, m = s.data.arguments || [], p = s.data.id, w = new Function(u);
|
|
377
354
|
let l, h = null;
|
|
378
355
|
try {
|
|
379
|
-
l = w.apply(null,
|
|
356
|
+
l = w.apply(null, m);
|
|
380
357
|
} catch (g) {
|
|
381
358
|
h = g;
|
|
382
359
|
}
|
|
@@ -406,7 +383,7 @@ const Lt = (t) => {
|
|
|
406
383
|
}
|
|
407
384
|
}
|
|
408
385
|
})));
|
|
409
|
-
},
|
|
386
|
+
}, Lt = ({
|
|
410
387
|
model: t,
|
|
411
388
|
trustedHosts: e,
|
|
412
389
|
callbacks: n
|
|
@@ -437,7 +414,7 @@ const Lt = (t) => {
|
|
|
437
414
|
break;
|
|
438
415
|
}
|
|
439
416
|
}
|
|
440
|
-
},
|
|
417
|
+
}, ie = ({
|
|
441
418
|
model: t,
|
|
442
419
|
apiKey: e,
|
|
443
420
|
callback: n,
|
|
@@ -446,11 +423,11 @@ const Lt = (t) => {
|
|
|
446
423
|
if (!c)
|
|
447
424
|
return f.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."), () => {
|
|
448
425
|
};
|
|
449
|
-
|
|
426
|
+
_t({
|
|
450
427
|
modelName: t,
|
|
451
428
|
apiKey: e
|
|
452
429
|
});
|
|
453
|
-
const s =
|
|
430
|
+
const s = Lt({
|
|
454
431
|
callbacks: {
|
|
455
432
|
contentUpdate: n,
|
|
456
433
|
animation: () => {
|
|
@@ -466,24 +443,24 @@ const Lt = (t) => {
|
|
|
466
443
|
return window.addEventListener("message", s), () => {
|
|
467
444
|
window.removeEventListener("message", s);
|
|
468
445
|
};
|
|
469
|
-
},
|
|
446
|
+
}, Nt = "builder.tests", P = (t) => `${Nt}.${t}`, Vt = ({
|
|
470
447
|
contentId: t
|
|
471
448
|
}) => z({
|
|
472
|
-
name:
|
|
449
|
+
name: P(t),
|
|
473
450
|
canTrack: !0
|
|
474
|
-
}),
|
|
451
|
+
}), Dt = ({
|
|
475
452
|
contentId: t
|
|
476
453
|
}) => O({
|
|
477
|
-
name:
|
|
454
|
+
name: P(t),
|
|
478
455
|
canTrack: !0
|
|
479
|
-
}),
|
|
456
|
+
}), Ft = ({
|
|
480
457
|
contentId: t,
|
|
481
458
|
value: e
|
|
482
459
|
}) => T({
|
|
483
|
-
name:
|
|
460
|
+
name: P(t),
|
|
484
461
|
value: e,
|
|
485
462
|
canTrack: !0
|
|
486
|
-
}), q = (t) =>
|
|
463
|
+
}), q = (t) => y(t.id) && y(t.variations) && Object.keys(t.variations).length > 0, Kt = ({
|
|
487
464
|
id: t,
|
|
488
465
|
variations: e
|
|
489
466
|
}) => {
|
|
@@ -498,7 +475,7 @@ const Lt = (t) => {
|
|
|
498
475
|
return t;
|
|
499
476
|
}, tt = (t) => {
|
|
500
477
|
const e = Kt(t);
|
|
501
|
-
return
|
|
478
|
+
return Ft({
|
|
502
479
|
contentId: t.id,
|
|
503
480
|
value: e
|
|
504
481
|
}).catch((n) => {
|
|
@@ -518,7 +495,7 @@ const Lt = (t) => {
|
|
|
518
495
|
testVariationId: n.id,
|
|
519
496
|
testVariationName: n.name || (n.id === t.id ? "Default" : "")
|
|
520
497
|
};
|
|
521
|
-
},
|
|
498
|
+
}, ae = ({
|
|
522
499
|
item: t,
|
|
523
500
|
canTrack: e
|
|
524
501
|
}) => {
|
|
@@ -528,7 +505,7 @@ const Lt = (t) => {
|
|
|
528
505
|
return;
|
|
529
506
|
if (!q(t))
|
|
530
507
|
return t;
|
|
531
|
-
const n =
|
|
508
|
+
const n = Dt({
|
|
532
509
|
contentId: t.id
|
|
533
510
|
}) || tt({
|
|
534
511
|
variations: t.variations,
|
|
@@ -541,13 +518,13 @@ const Lt = (t) => {
|
|
|
541
518
|
...t,
|
|
542
519
|
...r
|
|
543
520
|
};
|
|
544
|
-
},
|
|
521
|
+
}, Mt = async ({
|
|
545
522
|
item: t,
|
|
546
523
|
canTrack: e
|
|
547
524
|
}) => {
|
|
548
525
|
if (!e || !q(t))
|
|
549
526
|
return t;
|
|
550
|
-
const r = await
|
|
527
|
+
const r = await Vt({
|
|
551
528
|
contentId: t.id
|
|
552
529
|
}) || tt({
|
|
553
530
|
variations: t.variations,
|
|
@@ -598,24 +575,24 @@ function F() {
|
|
|
598
575
|
};
|
|
599
576
|
}
|
|
600
577
|
let k;
|
|
601
|
-
c() &&
|
|
602
|
-
const nt = k,
|
|
578
|
+
c() && b === "qwik" ? (window.__BUILDER_USER_ATTRIBUTES_SERVICE__ || (window.__BUILDER_USER_ATTRIBUTES_SERVICE__ = F()), k = window.__BUILDER_USER_ATTRIBUTES_SERVICE__) : k = F();
|
|
579
|
+
const nt = k, ce = (t) => {
|
|
603
580
|
nt.setUserAttributes(t);
|
|
604
|
-
},
|
|
605
|
-
const e =
|
|
581
|
+
}, Wt = (t) => {
|
|
582
|
+
const e = y(t) ? t : !0;
|
|
606
583
|
return nt.setCanTrack(e), e;
|
|
607
584
|
};
|
|
608
|
-
function
|
|
585
|
+
function jt() {
|
|
609
586
|
return typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : globalThis;
|
|
610
587
|
}
|
|
611
|
-
function
|
|
612
|
-
const t =
|
|
588
|
+
function $t() {
|
|
589
|
+
const t = jt().fetch;
|
|
613
590
|
if (typeof t == "undefined")
|
|
614
591
|
throw console.warn(`Builder SDK could not find a global fetch function. Make sure you have a polyfill for fetch in your project.
|
|
615
592
|
For more information, read https://github.com/BuilderIO/this-package-uses-fetch`), new Error("Builder SDK could not find a global `fetch` function");
|
|
616
593
|
return t;
|
|
617
594
|
}
|
|
618
|
-
const
|
|
595
|
+
const Gt = $t();
|
|
619
596
|
function U(t, e = null, n = ".") {
|
|
620
597
|
return Object.keys(t).reduce((r, s) => {
|
|
621
598
|
const o = t[s], i = [e, s].filter(Boolean).join(n);
|
|
@@ -635,7 +612,7 @@ function rt(t, e, n = {}) {
|
|
|
635
612
|
}
|
|
636
613
|
return n;
|
|
637
614
|
}
|
|
638
|
-
function
|
|
615
|
+
function Jt(t) {
|
|
639
616
|
const e = {};
|
|
640
617
|
for (const n in t) {
|
|
641
618
|
const r = n.split(".");
|
|
@@ -647,7 +624,7 @@ function zt(t) {
|
|
|
647
624
|
}
|
|
648
625
|
return e;
|
|
649
626
|
}
|
|
650
|
-
const
|
|
627
|
+
const zt = "v3", K = (t) => typeof t == "number" && !isNaN(t) && t >= 0, R = (t) => {
|
|
651
628
|
const {
|
|
652
629
|
limit: e = 30,
|
|
653
630
|
userAttributes: n,
|
|
@@ -656,28 +633,28 @@ const Xt = "v3", M = (t) => typeof t == "number" && !isNaN(t) && t >= 0, P = (t)
|
|
|
656
633
|
apiKey: o,
|
|
657
634
|
enrich: i,
|
|
658
635
|
locale: u,
|
|
659
|
-
apiVersion:
|
|
636
|
+
apiVersion: m = zt,
|
|
660
637
|
fields: p,
|
|
661
638
|
omit: w,
|
|
662
639
|
offset: l,
|
|
663
640
|
cacheSeconds: h,
|
|
664
641
|
staleCacheSeconds: g,
|
|
665
642
|
sort: E,
|
|
666
|
-
includeUnpublished:
|
|
643
|
+
includeUnpublished: C,
|
|
667
644
|
apiHost: st
|
|
668
645
|
} = t;
|
|
669
646
|
if (!o)
|
|
670
647
|
throw new Error("Missing API key");
|
|
671
|
-
if (!["v3"].includes(
|
|
672
|
-
throw new Error(`Invalid apiVersion: expected 'v3', received '${
|
|
673
|
-
const ot = e !== 1, it = st || "https://cdn.builder.io", a = new URL(`${it}/api/${
|
|
648
|
+
if (!["v3"].includes(m))
|
|
649
|
+
throw new Error(`Invalid apiVersion: expected 'v3', received '${m}'`);
|
|
650
|
+
const ot = e !== 1, it = st || "https://cdn.builder.io", a = new URL(`${it}/api/${m}/content/${s}`);
|
|
674
651
|
a.searchParams.set("apiKey", o), a.searchParams.set("limit", String(e)), a.searchParams.set("noTraverse", String(ot)), a.searchParams.set("includeRefs", String(!0));
|
|
675
652
|
const A = u || (n == null ? void 0 : n.locale);
|
|
676
|
-
let
|
|
677
|
-
if (A && (a.searchParams.set("locale", A),
|
|
653
|
+
let S = n || {};
|
|
654
|
+
if (A && (a.searchParams.set("locale", A), S = {
|
|
678
655
|
locale: A,
|
|
679
|
-
...
|
|
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
|
|
656
|
+
...S
|
|
657
|
+
}), 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 C == "boolean" && a.searchParams.set("includeUnpublished", String(C)), h && K(h) && a.searchParams.set("cacheSeconds", String(h)), g && K(g) && a.searchParams.set("staleCacheSeconds", String(g)), E) {
|
|
681
658
|
const d = U({
|
|
682
659
|
sort: E
|
|
683
660
|
});
|
|
@@ -685,17 +662,17 @@ const Xt = "v3", M = (t) => typeof t == "number" && !isNaN(t) && t >= 0, P = (t)
|
|
|
685
662
|
a.searchParams.set(I, JSON.stringify(d[I]));
|
|
686
663
|
}
|
|
687
664
|
const B = {
|
|
688
|
-
...
|
|
689
|
-
...
|
|
665
|
+
...pt(),
|
|
666
|
+
...M(t.options || {})
|
|
690
667
|
};
|
|
691
|
-
|
|
692
|
-
...
|
|
693
|
-
...
|
|
668
|
+
S = {
|
|
669
|
+
...S,
|
|
670
|
+
...Ht(B)
|
|
694
671
|
};
|
|
695
672
|
const x = U(B);
|
|
696
673
|
for (const d in x)
|
|
697
674
|
a.searchParams.set(d, String(x[d]));
|
|
698
|
-
if (Object.keys(
|
|
675
|
+
if (Object.keys(S).length > 0 && a.searchParams.set("userAttributes", JSON.stringify(S)), r) {
|
|
699
676
|
const d = rt({
|
|
700
677
|
query: r
|
|
701
678
|
});
|
|
@@ -703,31 +680,31 @@ const Xt = "v3", M = (t) => typeof t == "number" && !isNaN(t) && t >= 0, P = (t)
|
|
|
703
680
|
a.searchParams.set(I, JSON.stringify(d[I]));
|
|
704
681
|
}
|
|
705
682
|
return a;
|
|
706
|
-
},
|
|
683
|
+
}, Xt = (t) => {
|
|
707
684
|
const e = {};
|
|
708
685
|
for (const n in t)
|
|
709
686
|
n.startsWith("userAttributes.") && (e[n] = t[n], delete t[n]);
|
|
710
687
|
return e;
|
|
711
|
-
},
|
|
688
|
+
}, Ht = (t) => {
|
|
712
689
|
if (c() && t.preview === "BUILDER_STUDIO") {
|
|
713
690
|
t["userAttributes.urlPath"] = window.location.pathname, t["userAttributes.host"] = window.location.host;
|
|
714
|
-
const e =
|
|
691
|
+
const e = Xt(t), {
|
|
715
692
|
userAttributes: n
|
|
716
|
-
} =
|
|
693
|
+
} = Jt(e);
|
|
717
694
|
return n;
|
|
718
695
|
}
|
|
719
696
|
return {};
|
|
720
|
-
},
|
|
721
|
-
async function
|
|
722
|
-
const e = await
|
|
697
|
+
}, Qt = (t) => "results" in t;
|
|
698
|
+
async function Yt(t) {
|
|
699
|
+
const e = await te({
|
|
723
700
|
...t,
|
|
724
701
|
limit: 1
|
|
725
702
|
});
|
|
726
703
|
return e && e[0] || null;
|
|
727
704
|
}
|
|
728
|
-
const
|
|
705
|
+
const Zt = async (t) => {
|
|
729
706
|
var i, u;
|
|
730
|
-
const e =
|
|
707
|
+
const e = R(t), n = (i = t.fetch) != null ? i : Gt, r = {
|
|
731
708
|
...t.fetchOptions,
|
|
732
709
|
headers: {
|
|
733
710
|
...(u = t.fetchOptions) == null ? void 0 : u.headers,
|
|
@@ -735,14 +712,14 @@ const qt = async (t) => {
|
|
|
735
712
|
}
|
|
736
713
|
};
|
|
737
714
|
return await (await n(e.href, r)).json();
|
|
738
|
-
},
|
|
739
|
-
const r =
|
|
740
|
-
if (n.search.includes("preview="), !r || !(c() ||
|
|
715
|
+
}, qt = async (t, e, n = R(t)) => {
|
|
716
|
+
const r = Wt(t.canTrack);
|
|
717
|
+
if (n.search.includes("preview="), !r || !(c() || b === "reactNative"))
|
|
741
718
|
return e.results;
|
|
742
719
|
try {
|
|
743
720
|
const s = [];
|
|
744
721
|
for (const o of e.results)
|
|
745
|
-
s.push(await
|
|
722
|
+
s.push(await Mt({
|
|
746
723
|
item: o,
|
|
747
724
|
canTrack: r
|
|
748
725
|
}));
|
|
@@ -752,17 +729,17 @@ const qt = async (t) => {
|
|
|
752
729
|
}
|
|
753
730
|
return e.results;
|
|
754
731
|
};
|
|
755
|
-
async function
|
|
756
|
-
const e =
|
|
757
|
-
if (!
|
|
732
|
+
async function te(t) {
|
|
733
|
+
const e = R(t), n = await Zt(t);
|
|
734
|
+
if (!Qt(n))
|
|
758
735
|
throw f.error("Error fetching data. ", {
|
|
759
736
|
url: e,
|
|
760
737
|
content: n,
|
|
761
738
|
options: t
|
|
762
739
|
}), n;
|
|
763
|
-
return
|
|
740
|
+
return qt(t, n);
|
|
764
741
|
}
|
|
765
|
-
const
|
|
742
|
+
const ue = async (t) => {
|
|
766
743
|
var r, s, o;
|
|
767
744
|
const e = t.path || ((r = t.url) == null ? void 0 : r.pathname) || ((s = t.userAttributes) == null ? void 0 : s.urlPath), n = {
|
|
768
745
|
...t,
|
|
@@ -779,36 +756,35 @@ const le = async (t) => {
|
|
|
779
756
|
return {
|
|
780
757
|
apiKey: n.apiKey,
|
|
781
758
|
model: n.model,
|
|
782
|
-
content: await
|
|
759
|
+
content: await Yt(n)
|
|
783
760
|
};
|
|
784
761
|
};
|
|
785
762
|
export {
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
763
|
+
b as TARGET,
|
|
764
|
+
qt as _processContentResult,
|
|
765
|
+
Bt as _track,
|
|
766
|
+
y as checkIsDefined,
|
|
767
|
+
Lt as createEditorListener,
|
|
768
|
+
ne as createRegisterComponentMessage,
|
|
769
|
+
ue as fetchBuilderProps,
|
|
770
|
+
te as fetchEntries,
|
|
771
|
+
Yt as fetchOneEntry,
|
|
795
772
|
$ as getBuilderSearchParams,
|
|
796
773
|
O as getCookieSync,
|
|
797
|
-
|
|
774
|
+
Wt as getDefaultCanTrack,
|
|
798
775
|
ft as getUserAttributes,
|
|
799
|
-
|
|
776
|
+
ae as handleABTestingSync,
|
|
800
777
|
c as isBrowser,
|
|
801
778
|
ut as isEditing,
|
|
802
|
-
|
|
779
|
+
ee as isPreviewing,
|
|
803
780
|
Pt as logFetch,
|
|
804
781
|
f as logger,
|
|
805
|
-
|
|
806
|
-
ie as registerInsertMenu,
|
|
782
|
+
re as register,
|
|
807
783
|
j as serializeIncludingFunctions,
|
|
808
|
-
|
|
784
|
+
ce as setClientUserAttributes,
|
|
809
785
|
se as setEditorSettings,
|
|
810
|
-
|
|
811
|
-
|
|
786
|
+
_t as setupBrowserForEditing,
|
|
787
|
+
ie as subscribeToEditor,
|
|
812
788
|
oe as track,
|
|
813
789
|
nt as userAttributesService
|
|
814
790
|
};
|