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