@builder.io/sdk-react 2.0.2 → 2.0.3

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.
Files changed (68) hide show
  1. package/lib/browser/blocks-exports.cjs +25 -25
  2. package/lib/browser/blocks-exports.mjs +120 -119
  3. package/lib/browser/index.cjs +1 -1
  4. package/lib/browser/index.mjs +1 -1
  5. package/lib/browser/init.cjs +1 -1
  6. package/lib/browser/init.mjs +1 -1
  7. package/lib/browser/server-entry-02cecfb7.cjs +2 -0
  8. package/lib/browser/server-entry-0687830a.js +688 -0
  9. package/lib/browser/server-entry.cjs +1 -1
  10. package/lib/browser/server-entry.mjs +1 -1
  11. package/lib/edge/{accordion-ca081054.js → accordion-0eca9b08.js} +1 -1
  12. package/lib/edge/{accordion-4f96554c.cjs → accordion-368a2cf8.cjs} +1 -1
  13. package/lib/edge/{blocks-f55c7d3e.js → blocks-db3cfcac.js} +130 -129
  14. package/lib/edge/blocks-exports.cjs +1 -1
  15. package/lib/edge/blocks-exports.mjs +2 -2
  16. package/lib/edge/{blocks-078044bc.cjs → blocks-f524a758.cjs} +13 -13
  17. package/lib/edge/{button-5d140f8e.cjs → button-3ed29654.cjs} +1 -1
  18. package/lib/edge/{button-41169061.js → button-e852700f.js} +2 -2
  19. package/lib/edge/columns-1f84e26e.cjs +28 -0
  20. package/lib/edge/{columns-f8916a18.js → columns-ee464f6c.js} +49 -48
  21. package/lib/edge/{content-variants-89a9389a.cjs → content-variants-42f2495b.cjs} +4 -4
  22. package/lib/edge/{content-variants-71ee0c76.js → content-variants-c0257a99.js} +23 -23
  23. package/lib/edge/{form-f2d2c2bf.cjs → form-4444faf2.cjs} +1 -1
  24. package/lib/edge/{form-ac2f2a0e.js → form-8191004e.js} +3 -3
  25. package/lib/edge/{get-class-prop-name-a9b4959e.cjs → get-class-prop-name-5fc98fcc.cjs} +1 -1
  26. package/lib/edge/{get-class-prop-name-a677d7a5.js → get-class-prop-name-d18337d2.js} +1 -1
  27. package/lib/edge/{img-b91cb4fd.cjs → img-10ef20a5.cjs} +1 -1
  28. package/lib/edge/{img-8fc26395.js → img-a24ed75f.js} +1 -1
  29. package/lib/edge/index.cjs +1 -1
  30. package/lib/edge/index.mjs +1 -1
  31. package/lib/edge/init.cjs +1 -1
  32. package/lib/edge/init.mjs +1 -1
  33. package/lib/edge/{input-549f090e.js → input-3876429d.js} +1 -1
  34. package/lib/edge/{input-ec7c695a.cjs → input-6325bfc0.cjs} +1 -1
  35. package/lib/edge/{select-3ffa9294.cjs → select-3f0f00f3.cjs} +1 -1
  36. package/lib/edge/{select-6a5a28ac.js → select-5dc1c7d1.js} +1 -1
  37. package/lib/edge/server-entry-805b9266.cjs +2 -0
  38. package/lib/edge/server-entry-ff728468.js +689 -0
  39. package/lib/edge/server-entry.cjs +1 -1
  40. package/lib/edge/server-entry.mjs +1 -1
  41. package/lib/edge/{slot-40de071b.js → slot-20fe5e4f.js} +3 -3
  42. package/lib/edge/{slot-8b27e15e.cjs → slot-a64b535f.cjs} +1 -1
  43. package/lib/edge/{symbol-76e76298.cjs → symbol-5012ed02.cjs} +1 -1
  44. package/lib/edge/{symbol-e6515a5f.js → symbol-e95082e1.js} +2 -2
  45. package/lib/edge/{tabs-b75be82d.js → tabs-261e8cd4.js} +3 -3
  46. package/lib/edge/{tabs-9c5af0ec.cjs → tabs-d672f816.cjs} +1 -1
  47. package/lib/node/blocks-exports.cjs +11 -11
  48. package/lib/node/blocks-exports.mjs +74 -73
  49. package/lib/node/index.cjs +1 -1
  50. package/lib/node/index.mjs +2 -2
  51. package/lib/node/init.cjs +1 -1
  52. package/lib/node/init.mjs +2 -2
  53. package/lib/node/{node-runtime-0e37d6f7.cjs → node-runtime-160b6846.cjs} +2 -2
  54. package/lib/node/{node-runtime-0f3a5df1.js → node-runtime-405effc5.js} +3 -2
  55. package/lib/node/server-entry-02cecfb7.cjs +2 -0
  56. package/lib/node/server-entry-0687830a.js +688 -0
  57. package/lib/node/server-entry.cjs +1 -1
  58. package/lib/node/server-entry.mjs +1 -1
  59. package/package.json +1 -1
  60. package/types/constants/sdk-version.d.ts +1 -1
  61. package/types/functions/register-component.d.ts +2 -2
  62. package/lib/browser/server-entry-419c051e.cjs +0 -2
  63. package/lib/browser/server-entry-825b4408.js +0 -695
  64. package/lib/edge/columns-354bf349.cjs +0 -28
  65. package/lib/edge/server-entry-966ac144.cjs +0 -2
  66. package/lib/edge/server-entry-d2020acf.js +0 -695
  67. package/lib/node/server-entry-5ebd1c9b.js +0 -695
  68. package/lib/node/server-entry-8002325b.cjs +0 -2
@@ -0,0 +1,688 @@
1
+ const v = "react", b = "[Builder.io]: ", f = {
2
+ log: (...t) => console.log(b, ...t),
3
+ error: (...t) => console.error(b, ...t),
4
+ warn: (...t) => console.warn(b, ...t),
5
+ debug: (...t) => console.debug(b, ...t)
6
+ };
7
+ function c() {
8
+ return typeof window != "undefined" && typeof document != "undefined";
9
+ }
10
+ const q = (t) => {
11
+ const e = {};
12
+ return t.forEach((n, r) => {
13
+ e[r] = n;
14
+ }), e;
15
+ }, L = (t) => t instanceof URLSearchParams ? q(t) : t, V = (t) => typeof t == "string" ? t : t instanceof URLSearchParams ? t.toString() : new URLSearchParams(t).toString();
16
+ function Q() {
17
+ return c() && window.self !== window.top;
18
+ }
19
+ function Y(t) {
20
+ return Q() && // accessing window.location.search is safe here because `isIframe()` is only `true` if we're in a browser.
21
+ V(t || window.location.search).indexOf("builder.frameEditing=") !== -1;
22
+ }
23
+ const Z = () => {
24
+ if (c()) {
25
+ const t = new URL(location.href);
26
+ return t.pathname === "" && (t.pathname = "/"), t;
27
+ } else
28
+ return console.warn("Cannot get location for tracking in non-browser environment"), null;
29
+ }, tt = () => typeof navigator == "object" && navigator.userAgent || "", et = () => {
30
+ const t = tt(), e = {
31
+ Android() {
32
+ return t.match(/Android/i);
33
+ },
34
+ BlackBerry() {
35
+ return t.match(/BlackBerry/i);
36
+ },
37
+ iOS() {
38
+ return t.match(/iPhone|iPod/i);
39
+ },
40
+ Opera() {
41
+ return t.match(/Opera Mini/i);
42
+ },
43
+ Windows() {
44
+ return t.match(/IEMobile/i) || t.match(/WPDesktop/i);
45
+ },
46
+ any() {
47
+ return e.Android() || e.BlackBerry() || e.iOS() || e.Opera() || e.Windows() || v === "reactNative";
48
+ }
49
+ }, n = t.match(/Tablet|iPad/i), r = Z();
50
+ return {
51
+ urlPath: r == null ? void 0 : r.pathname,
52
+ host: (r == null ? void 0 : r.host) || (r == null ? void 0 : r.hostname),
53
+ device: n ? "tablet" : e.any() ? "mobile" : "desktop"
54
+ };
55
+ }, m = (t) => t != null, nt = (t) => {
56
+ if (t === "localhost" || t === "127.0.0.1")
57
+ return t;
58
+ const e = t.split(".");
59
+ return e.length > 2 ? e.slice(1).join(".") : t;
60
+ }, U = ({
61
+ name: t,
62
+ canTrack: e
63
+ }) => {
64
+ var n;
65
+ try {
66
+ return e ? (n = document.cookie.split("; ").find((r) => r.startsWith(`${t}=`))) == null ? void 0 : n.split("=")[1] : void 0;
67
+ } catch (r) {
68
+ f.warn("[COOKIE] GET error: ", (r == null ? void 0 : r.message) || r);
69
+ return;
70
+ }
71
+ }, M = async (t) => U(t), rt = (t) => t.map(([e, n]) => n ? `${e}=${n}` : e).filter(m).join("; "), ot = [["secure", ""], ["SameSite", "None"]], st = ({
72
+ name: t,
73
+ value: e,
74
+ expires: n
75
+ }) => {
76
+ const o = (c() ? location.protocol === "https:" : !0) ? ot : [[]], s = n ? [["expires", n.toUTCString()]] : [[]], a = [[t, e], ...s, ["path", "/"], ["domain", nt(window.location.hostname)], ...o];
77
+ return rt(a);
78
+ }, N = async ({
79
+ name: t,
80
+ value: e,
81
+ expires: n,
82
+ canTrack: r
83
+ }) => {
84
+ try {
85
+ if (!r)
86
+ return;
87
+ const o = st({
88
+ name: t,
89
+ value: e,
90
+ expires: n
91
+ });
92
+ document.cookie = o;
93
+ } catch (o) {
94
+ f.warn("[COOKIE] SET error: ", (o == null ? void 0 : o.message) || o);
95
+ }
96
+ }, it = "builder.tests", E = (t) => `${it}.${t}`, at = ({
97
+ contentId: t
98
+ }) => M({
99
+ name: E(t),
100
+ canTrack: !0
101
+ }), ct = ({
102
+ contentId: t
103
+ }) => U({
104
+ name: E(t),
105
+ canTrack: !0
106
+ }), ut = ({
107
+ contentId: t,
108
+ value: e
109
+ }) => N({
110
+ name: E(t),
111
+ value: e,
112
+ canTrack: !0
113
+ }), F = (t) => m(t.id) && m(t.variations) && Object.keys(t.variations).length > 0, dt = ({
114
+ id: t,
115
+ variations: e
116
+ }) => {
117
+ var o;
118
+ let n = 0;
119
+ const r = Math.random();
120
+ for (const s in e) {
121
+ const a = (o = e[s]) == null ? void 0 : o.testRatio;
122
+ if (n += a, r < n)
123
+ return s;
124
+ }
125
+ return t;
126
+ }, j = (t) => {
127
+ const e = dt(t);
128
+ return ut({
129
+ contentId: t.id,
130
+ value: e
131
+ }).catch((n) => {
132
+ f.error("could not store A/B test variation: ", n);
133
+ }), e;
134
+ }, D = ({
135
+ item: t,
136
+ testGroupId: e
137
+ }) => {
138
+ const n = t.variations[e];
139
+ return e === t.id || // handle edge-case where `testGroupId` points to non-existing variation
140
+ !n ? {
141
+ testVariationId: t.id,
142
+ testVariationName: "Default"
143
+ } : {
144
+ data: n.data,
145
+ testVariationId: n.id,
146
+ testVariationName: n.name || (n.id === t.id ? "Default" : "")
147
+ };
148
+ }, _t = ({
149
+ item: t,
150
+ canTrack: e
151
+ }) => {
152
+ if (!e)
153
+ return t;
154
+ if (!t)
155
+ return;
156
+ if (!F(t))
157
+ return t;
158
+ const n = ct({
159
+ contentId: t.id
160
+ }) || j({
161
+ variations: t.variations,
162
+ id: t.id
163
+ }), r = D({
164
+ item: t,
165
+ testGroupId: n
166
+ });
167
+ return {
168
+ ...t,
169
+ ...r
170
+ };
171
+ }, lt = async ({
172
+ item: t,
173
+ canTrack: e
174
+ }) => {
175
+ if (!e || !F(t))
176
+ return t;
177
+ const r = await at({
178
+ contentId: t.id
179
+ }) || j({
180
+ variations: t.variations,
181
+ id: t.id
182
+ }), o = D({
183
+ item: t,
184
+ testGroupId: r
185
+ });
186
+ return {
187
+ ...t,
188
+ ...o
189
+ };
190
+ }, ft = (t) => m(t) ? t : !0, $t = (t) => ({
191
+ type: "builder.registerComponent",
192
+ data: gt(t)
193
+ }), ht = (t) => {
194
+ const e = t.toString().trim();
195
+ return `return (${!e.startsWith("function") && !e.startsWith("(") ? "function " : ""}${e}).apply(this, arguments)`;
196
+ };
197
+ function gt(t) {
198
+ return JSON.parse(JSON.stringify(t, (e, n) => typeof n == "function" ? ht(n) : n));
199
+ }
200
+ function pt() {
201
+ return typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : globalThis;
202
+ }
203
+ function mt() {
204
+ const t = pt().fetch;
205
+ if (typeof t == "undefined")
206
+ throw console.warn(`Builder SDK could not find a global fetch function. Make sure you have a polyfill for fetch in your project.
207
+ For more information, read https://github.com/BuilderIO/this-package-uses-fetch`), new Error("Builder SDK could not find a global `fetch` function");
208
+ return t;
209
+ }
210
+ const yt = mt();
211
+ function k(t, e = null, n = ".") {
212
+ return Object.keys(t).reduce((r, o) => {
213
+ const s = t[o], a = [e, o].filter(Boolean).join(n);
214
+ return [typeof s == "object", s !== null, !(Array.isArray(s) && s.length === 0)].every(Boolean) ? {
215
+ ...r,
216
+ ...k(s, a, n)
217
+ } : {
218
+ ...r,
219
+ [a]: s
220
+ };
221
+ }, {});
222
+ }
223
+ function K(t, e, n = {}) {
224
+ for (const r in t) {
225
+ const o = t[r], s = e ? e + "." + r : r;
226
+ o && typeof o == "object" && !Array.isArray(o) && !Object.keys(o).find((a) => a.startsWith("$")) ? K(o, s, n) : n[s] = o;
227
+ }
228
+ return n;
229
+ }
230
+ const wt = "v3", x = "builder.", St = "options.", W = (t) => {
231
+ if (!t)
232
+ return {};
233
+ const e = L(t), n = {};
234
+ return Object.keys(e).forEach((r) => {
235
+ if (r.startsWith(x)) {
236
+ const o = r.replace(x, "").replace(St, "");
237
+ n[o] = e[r];
238
+ }
239
+ }), n;
240
+ }, bt = () => {
241
+ if (!c())
242
+ return {};
243
+ const t = new URLSearchParams(window.location.search);
244
+ return W(t);
245
+ }, A = (t) => typeof t == "number" && !isNaN(t) && t >= 0, P = (t) => {
246
+ const {
247
+ limit: e = 30,
248
+ userAttributes: n,
249
+ query: r,
250
+ model: o,
251
+ apiKey: s,
252
+ enrich: a,
253
+ locale: d,
254
+ apiVersion: y = wt,
255
+ fields: p,
256
+ omit: I,
257
+ offset: u,
258
+ cacheSeconds: h,
259
+ staleCacheSeconds: g,
260
+ sort: w,
261
+ includeUnpublished: O
262
+ } = t;
263
+ if (!s)
264
+ throw new Error("Missing API key");
265
+ if (!["v3"].includes(y))
266
+ throw new Error(`Invalid apiVersion: expected 'v3', received '${y}'`);
267
+ const H = e !== 1, i = new URL(`https://cdn.builder.io/api/${y}/content/${o}`);
268
+ if (i.searchParams.set("apiKey", s), i.searchParams.set("limit", String(e)), i.searchParams.set("noTraverse", String(H)), i.searchParams.set("includeRefs", String(!0)), d && i.searchParams.set("locale", d), a && i.searchParams.set("enrich", String(a)), i.searchParams.set("omit", I || "meta.componentsUsed"), p && i.searchParams.set("fields", p), Number.isFinite(u) && u > -1 && i.searchParams.set("offset", String(Math.floor(u))), typeof O == "boolean" && i.searchParams.set("includeUnpublished", String(O)), h && A(h) && i.searchParams.set("cacheSeconds", String(h)), g && A(g) && i.searchParams.set("staleCacheSeconds", String(g)), w) {
269
+ const l = k({
270
+ sort: w
271
+ });
272
+ for (const S in l)
273
+ i.searchParams.set(S, JSON.stringify(l[S]));
274
+ }
275
+ const X = {
276
+ ...bt(),
277
+ ...L(t.options || {})
278
+ }, C = k(X);
279
+ for (const l in C)
280
+ i.searchParams.set(l, String(C[l]));
281
+ if (n && i.searchParams.set("userAttributes", JSON.stringify(n)), r) {
282
+ const l = K({
283
+ query: r
284
+ });
285
+ for (const S in l)
286
+ i.searchParams.set(S, JSON.stringify(l[S]));
287
+ }
288
+ return i;
289
+ }, vt = (t) => "results" in t;
290
+ async function It(t) {
291
+ const e = await Pt({
292
+ ...t,
293
+ limit: 1
294
+ });
295
+ return e && e[0] || null;
296
+ }
297
+ const kt = async (t) => {
298
+ var s;
299
+ const e = P(t);
300
+ return await (await ((s = t.fetch) != null ? s : yt)(e.href, t.fetchOptions)).json();
301
+ }, Et = async (t, e, n = P(t)) => {
302
+ const r = ft(t.canTrack);
303
+ if (n.search.includes("preview="), !r || !(c() || v === "reactNative"))
304
+ return e.results;
305
+ try {
306
+ const o = [];
307
+ for (const s of e.results)
308
+ o.push(await lt({
309
+ item: s,
310
+ canTrack: r
311
+ }));
312
+ e.results = o;
313
+ } catch (o) {
314
+ f.error("Could not process A/B tests. ", o);
315
+ }
316
+ return e.results;
317
+ };
318
+ async function Pt(t) {
319
+ try {
320
+ const e = P(t), n = await kt(t);
321
+ return vt(n) ? Et(t, n) : (f.error("Error fetching data. ", {
322
+ url: e,
323
+ content: n,
324
+ options: t
325
+ }), null);
326
+ } catch (e) {
327
+ return f.error("Error fetching data. ", e), null;
328
+ }
329
+ }
330
+ function Gt(t) {
331
+ const e = t || (c() ? window.location.search : void 0);
332
+ return e ? V(e).indexOf("builder.preview=") !== -1 : !1;
333
+ }
334
+ function Ot() {
335
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(t) {
336
+ const e = Math.random() * 16 | 0;
337
+ return (t == "x" ? e : e & 3 | 8).toString(16);
338
+ });
339
+ }
340
+ function _() {
341
+ return Ot().replace(/-/g, "");
342
+ }
343
+ const $ = "builderSessionId", Ct = async ({
344
+ canTrack: t
345
+ }) => {
346
+ if (!t)
347
+ return;
348
+ const e = await M({
349
+ name: $,
350
+ canTrack: t
351
+ });
352
+ if (m(e))
353
+ return e;
354
+ {
355
+ const n = xt();
356
+ return At({
357
+ id: n,
358
+ canTrack: t
359
+ }), n;
360
+ }
361
+ }, xt = () => _(), At = ({
362
+ id: t,
363
+ canTrack: e
364
+ }) => N({
365
+ name: $,
366
+ value: t,
367
+ canTrack: e
368
+ }), G = () => c() && typeof localStorage != "undefined" ? localStorage : void 0, Tt = ({
369
+ key: t,
370
+ canTrack: e
371
+ }) => {
372
+ var n;
373
+ try {
374
+ return e ? (n = G()) == null ? void 0 : n.getItem(t) : void 0;
375
+ } catch (r) {
376
+ console.debug("[LocalStorage] GET error: ", r);
377
+ return;
378
+ }
379
+ }, Rt = ({
380
+ key: t,
381
+ canTrack: e,
382
+ value: n
383
+ }) => {
384
+ var r;
385
+ try {
386
+ e && ((r = G()) == null || r.setItem(t, n));
387
+ } catch (o) {
388
+ console.debug("[LocalStorage] SET error: ", o);
389
+ }
390
+ }, J = "builderVisitorId", Bt = ({
391
+ canTrack: t
392
+ }) => {
393
+ if (!t)
394
+ return;
395
+ const e = Tt({
396
+ key: J,
397
+ canTrack: t
398
+ });
399
+ if (m(e))
400
+ return e;
401
+ {
402
+ const n = Lt();
403
+ return Vt({
404
+ id: n,
405
+ canTrack: t
406
+ }), n;
407
+ }
408
+ }, Lt = () => _(), Vt = ({
409
+ id: t,
410
+ canTrack: e
411
+ }) => Rt({
412
+ key: J,
413
+ value: t,
414
+ canTrack: e
415
+ }), Ut = async ({
416
+ canTrack: t
417
+ }) => {
418
+ if (!t)
419
+ return {
420
+ visitorId: void 0,
421
+ sessionId: void 0
422
+ };
423
+ const e = await Ct({
424
+ canTrack: t
425
+ }), n = Bt({
426
+ canTrack: t
427
+ });
428
+ return {
429
+ sessionId: e,
430
+ visitorId: n
431
+ };
432
+ }, Mt = async ({
433
+ type: t,
434
+ canTrack: e,
435
+ apiKey: n,
436
+ metadata: r,
437
+ ...o
438
+ }) => ({
439
+ type: t,
440
+ data: {
441
+ ...o,
442
+ metadata: {
443
+ url: location.href,
444
+ ...r
445
+ },
446
+ ...await Ut({
447
+ canTrack: e
448
+ }),
449
+ userAttributes: et(),
450
+ ownerId: n
451
+ }
452
+ });
453
+ async function Nt(t) {
454
+ if (!t.apiKey) {
455
+ f.error("Missing API key for track call. Please provide your API key.");
456
+ return;
457
+ }
458
+ if (t.canTrack && !Y() && (c() || v === "reactNative"))
459
+ return fetch("https://cdn.builder.io/api/v1/track", {
460
+ method: "POST",
461
+ body: JSON.stringify({
462
+ events: [await Mt(t)]
463
+ }),
464
+ headers: {
465
+ "content-type": "application/json"
466
+ },
467
+ mode: "cors"
468
+ }).catch((e) => {
469
+ console.error("Failed to track: ", e);
470
+ });
471
+ }
472
+ const Jt = (t) => Nt({
473
+ ...t,
474
+ canTrack: !0
475
+ }), Ft = ["*.beta.builder.io", "beta.builder.io", "builder.io", "localhost", "qa.builder.io"];
476
+ function z(t, e) {
477
+ if (!e.origin.startsWith("http") && !e.origin.startsWith("https"))
478
+ return !1;
479
+ const n = new URL(e.origin), r = n.hostname;
480
+ return (t || Ft).findIndex((o) => o.startsWith("*.") ? r.endsWith(o.slice(1)) : o === r) > -1;
481
+ }
482
+ const jt = "2.0.3", T = {};
483
+ function Dt(t, e) {
484
+ let n = T[t];
485
+ if (n || (n = T[t] = []), n.push(e), c()) {
486
+ const r = {
487
+ type: "builder.register",
488
+ data: {
489
+ type: t,
490
+ info: e
491
+ }
492
+ };
493
+ try {
494
+ parent.postMessage(r, "*"), parent !== window && window.postMessage(r, "*");
495
+ } catch (o) {
496
+ console.debug("Could not postmessage", o);
497
+ }
498
+ }
499
+ }
500
+ const zt = () => {
501
+ Dt("insertMenu", {
502
+ name: "_default",
503
+ default: !0,
504
+ items: [{
505
+ name: "Box"
506
+ }, {
507
+ name: "Text"
508
+ }, {
509
+ name: "Image"
510
+ }, {
511
+ name: "Columns"
512
+ }, {
513
+ name: "Core:Section"
514
+ }, {
515
+ name: "Core:Button"
516
+ }, {
517
+ name: "Embed"
518
+ }, {
519
+ name: "Custom Code"
520
+ }]
521
+ });
522
+ };
523
+ let R = !1;
524
+ const Kt = (t = {}) => {
525
+ var e, n;
526
+ R || (R = !0, c() && ((e = window.parent) == null || e.postMessage({
527
+ type: "builder.sdkInfo",
528
+ data: {
529
+ target: v,
530
+ version: jt,
531
+ supportsPatchUpdates: !1,
532
+ // Supports builder-model="..." attribute which is needed to
533
+ // scope our '+ add block' button styling
534
+ supportsAddBlockScoping: !0,
535
+ supportsCustomBreakpoints: !0
536
+ }
537
+ }, "*"), (n = window.parent) == null || n.postMessage({
538
+ type: "builder.updateContent",
539
+ data: {
540
+ options: t
541
+ }
542
+ }, "*"), window.addEventListener("message", (r) => {
543
+ var s, a;
544
+ if (!z(t.trustedHosts, r))
545
+ return;
546
+ const {
547
+ data: o
548
+ } = r;
549
+ if (o != null && o.type)
550
+ switch (o.type) {
551
+ case "builder.evaluate": {
552
+ const d = o.data.text, y = o.data.arguments || [], p = o.data.id, I = new Function(d);
553
+ let u, h = null;
554
+ try {
555
+ u = I.apply(null, y);
556
+ } catch (g) {
557
+ h = g;
558
+ }
559
+ h ? (s = window.parent) == null || s.postMessage({
560
+ type: "builder.evaluateError",
561
+ data: {
562
+ id: p,
563
+ error: h.message
564
+ }
565
+ }, "*") : u && typeof u.then == "function" ? u.then((g) => {
566
+ var w;
567
+ (w = window.parent) == null || w.postMessage({
568
+ type: "builder.evaluateResult",
569
+ data: {
570
+ id: p,
571
+ result: g
572
+ }
573
+ }, "*");
574
+ }).catch(console.error) : (a = window.parent) == null || a.postMessage({
575
+ type: "builder.evaluateResult",
576
+ data: {
577
+ result: u,
578
+ id: p
579
+ }
580
+ }, "*");
581
+ break;
582
+ }
583
+ }
584
+ })));
585
+ }, Wt = ({
586
+ model: t,
587
+ trustedHosts: e,
588
+ callbacks: n
589
+ }) => (r) => {
590
+ if (!z(e, r))
591
+ return;
592
+ const {
593
+ data: o
594
+ } = r;
595
+ if (o)
596
+ switch (o.type) {
597
+ case "builder.configureSdk": {
598
+ n.configureSdk(o.data);
599
+ break;
600
+ }
601
+ case "builder.triggerAnimation": {
602
+ n.animation(o.data);
603
+ break;
604
+ }
605
+ case "builder.contentUpdate": {
606
+ const s = o.data, a = s.key || s.alias || s.entry || s.modelName, d = s.data;
607
+ a === t && n.contentUpdate(d);
608
+ break;
609
+ }
610
+ }
611
+ }, Ht = (t, e, n) => {
612
+ if (!c)
613
+ return f.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."), () => {
614
+ };
615
+ Kt();
616
+ const r = Wt({
617
+ callbacks: {
618
+ contentUpdate: e,
619
+ animation: () => {
620
+ },
621
+ configureSdk: () => {
622
+ }
623
+ },
624
+ model: t,
625
+ trustedHosts: n == null ? void 0 : n.trustedHosts
626
+ });
627
+ return window.addEventListener("message", r), () => {
628
+ window.removeEventListener("message", r);
629
+ };
630
+ }, B = {};
631
+ function Xt(t) {
632
+ if (c()) {
633
+ Object.assign(B, t);
634
+ const e = {
635
+ type: "builder.settingsChange",
636
+ data: B
637
+ };
638
+ parent.postMessage(e, "*");
639
+ }
640
+ }
641
+ const qt = async (t) => {
642
+ var r, o, s;
643
+ const e = t.path || ((r = t.url) == null ? void 0 : r.pathname) || ((o = t.userAttributes) == null ? void 0 : o.urlPath), n = {
644
+ ...t,
645
+ apiKey: t.apiKey,
646
+ model: t.model || "page",
647
+ userAttributes: {
648
+ ...t.userAttributes,
649
+ ...e ? {
650
+ urlPath: e
651
+ } : {}
652
+ },
653
+ options: W(t.searchParams || ((s = t.url) == null ? void 0 : s.searchParams) || t.options)
654
+ };
655
+ return {
656
+ apiKey: n.apiKey,
657
+ model: n.model,
658
+ content: await It(n)
659
+ };
660
+ };
661
+ export {
662
+ b as MSG_PREFIX,
663
+ v as TARGET,
664
+ Et as _processContentResult,
665
+ Nt as _track,
666
+ m as checkIsDefined,
667
+ Wt as createEditorListener,
668
+ $t as createRegisterComponentMessage,
669
+ yt as fetch,
670
+ qt as fetchBuilderProps,
671
+ Pt as fetchEntries,
672
+ It as fetchOneEntry,
673
+ W as getBuilderSearchParams,
674
+ ft as getDefaultCanTrack,
675
+ et as getUserAttributes,
676
+ _t as handleABTestingSync,
677
+ c as isBrowser,
678
+ Y as isEditing,
679
+ Gt as isPreviewing,
680
+ f as logger,
681
+ Dt as register,
682
+ zt as registerInsertMenu,
683
+ gt as serializeComponentInfo,
684
+ Xt as setEditorSettings,
685
+ Kt as setupBrowserForEditing,
686
+ Ht as subscribeToEditor,
687
+ Jt as track
688
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./server-entry-419c051e.cjs");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.setEditorSettings=e.setEditorSettings;exports.subscribeToEditor=e.subscribeToEditor;exports.track=e.track;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./server-entry-02cecfb7.cjs");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.setEditorSettings=e.setEditorSettings;exports.subscribeToEditor=e.subscribeToEditor;exports.track=e.track;
@@ -1,4 +1,4 @@
1
- import { _processContentResult as r, createRegisterComponentMessage as s, fetchBuilderProps as i, fetchEntries as n, fetchOneEntry as o, getBuilderSearchParams as c, isEditing as g, isPreviewing as a, register as d, setEditorSettings as E, subscribeToEditor as f, track as h } from "./server-entry-825b4408.js";
1
+ import { _processContentResult as r, createRegisterComponentMessage as s, fetchBuilderProps as i, fetchEntries as n, fetchOneEntry as o, getBuilderSearchParams as c, isEditing as g, isPreviewing as a, register as d, setEditorSettings as E, subscribeToEditor as f, track as h } from "./server-entry-0687830a.js";
2
2
  export {
3
3
  r as _processContentResult,
4
4
  s as createRegisterComponentMessage,
@@ -1,7 +1,7 @@
1
1
  import { jsx as r, jsxs as x, Fragment as j } from "react/jsx-runtime";
2
2
  import { useState as A } from "react";
3
3
  import { Blocks as g } from "./blocks-exports.mjs";
4
- import "./server-entry-d2020acf.js";
4
+ import "./server-entry-ff728468.js";
5
5
  const y = (t) => t.toString();
6
6
  function B(t) {
7
7
  var a;