@builder.io/sdk-react 0.13.0 → 0.13.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/index.cjs +27 -27
- package/lib/browser/index.mjs +1424 -844
- package/lib/browser/{server-entry-f1003541.cjs → server-entry-af9b0dd3.cjs} +1 -1
- package/lib/browser/{server-entry-a7214151.js → server-entry-be000726.js} +1 -1
- package/lib/browser/server-entry.cjs +1 -1
- package/lib/browser/server-entry.mjs +1 -1
- package/lib/edge/index.cjs +37 -37
- package/lib/edge/index.mjs +2375 -1795
- package/lib/edge/{server-entry-f1003541.cjs → server-entry-af9b0dd3.cjs} +1 -1
- package/lib/edge/{server-entry-12a6f428.js → server-entry-b02b5197.js} +1 -1
- package/lib/edge/server-entry.cjs +1 -1
- package/lib/edge/server-entry.mjs +1 -1
- package/lib/node/index.cjs +15 -15
- package/lib/node/index.mjs +1253 -673
- package/lib/node/{server-entry-3743f8cd.cjs → server-entry-6e7475d7.cjs} +1 -1
- package/lib/node/{server-entry-3f9209d6.js → server-entry-9969d641.js} +1 -1
- package/lib/node/server-entry.cjs +1 -1
- package/lib/node/server-entry.mjs +1 -1
- package/package.json +1 -1
- package/types/blocks/form/form/component-info.d.ts +2 -0
- package/types/blocks/form/form/form.d.ts +33 -0
- package/types/blocks/form/input/component-info.d.ts +2 -0
- package/types/blocks/form/select/component-info.d.ts +2 -0
- package/types/blocks/form/submit-button/component-info.d.ts +2 -0
- package/types/blocks/slot/slot.d.ts +3 -6
- package/types/constants/extra-components.d.ts +7 -0
- package/types/constants/sdk-version.d.ts +1 -1
- package/types/functions/get-env.d.ts +2 -0
- package/types/functions/get.d.ts +1 -0
- package/types/helpers/preview-lru-cache/helpers.d.ts +1 -0
- package/types/helpers/preview-lru-cache/types.d.ts +1 -0
- package/types/blocks/form/component-info.d.ts +0 -2
- package/types/blocks/form/form.d.ts +0 -3
- package/types/blocks/input/component-info.d.ts +0 -2
- package/types/blocks/select/component-info.d.ts +0 -2
- package/types/blocks/submit-button/component-info.d.ts +0 -2
- /package/types/blocks/{input → form/input}/input.d.ts +0 -0
- /package/types/blocks/{select → form/select}/select.d.ts +0 -0
- /package/types/blocks/{submit-button → form/submit-button}/submit-button.d.ts +0 -0
package/lib/node/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { createContext, useState, useEffect, useContext, useRef, createElement } from "react";
|
|
4
|
-
import { T as TARGET, i as isEditing, k as isBrowser, l as getUserAttributes, m as fastClone, n as checkIsDefined, o as logger, p as getDefaultCanTrack, q as _track, a as isPreviewing, u as createEditorListener, v as registerInsertMenu, w as setupBrowserForEditing, c as createRegisterComponentMessage, e as fetchOneEntry, x as fetch$1, y as components, z as serializeComponentInfo, A as handleABTestingSync } from "./server-entry-
|
|
5
|
-
import { _ as H, f as K, d as
|
|
4
|
+
import { T as TARGET, i as isEditing, k as isBrowser, l as getUserAttributes, m as fastClone, n as checkIsDefined, o as logger, p as getDefaultCanTrack, q as _track, a as isPreviewing, u as createEditorListener, v as registerInsertMenu, w as setupBrowserForEditing, c as createRegisterComponentMessage, e as fetchOneEntry, x as fetch$1, y as components, z as serializeComponentInfo, A as handleABTestingSync } from "./server-entry-9969d641.js";
|
|
5
|
+
import { _ as H, f as K, d as q, h as z, g as J, j as Y, r as G, s as Q, b as X, t as Z } from "./server-entry-9969d641.js";
|
|
6
6
|
import { createRequire } from "node:module";
|
|
7
7
|
const EMPTY_HTML_ELEMENTS = /* @__PURE__ */ new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"]), isEmptyElement = (e) => typeof e == "string" && EMPTY_HTML_ELEMENTS.has(e.toLowerCase());
|
|
8
8
|
function DynamicRenderer(e) {
|
|
@@ -71,9 +71,9 @@ const getFunctionArguments = ({
|
|
|
71
71
|
builder: e,
|
|
72
72
|
context: t,
|
|
73
73
|
event: n,
|
|
74
|
-
state:
|
|
74
|
+
state: o
|
|
75
75
|
}) => Object.entries({
|
|
76
|
-
state:
|
|
76
|
+
state: o,
|
|
77
77
|
Builder: e,
|
|
78
78
|
// legacy
|
|
79
79
|
builder: e,
|
|
@@ -90,18 +90,18 @@ const getFunctionArguments = ({
|
|
|
90
90
|
code: e,
|
|
91
91
|
builder: t,
|
|
92
92
|
context: n,
|
|
93
|
-
event:
|
|
94
|
-
localState:
|
|
93
|
+
event: o,
|
|
94
|
+
localState: i,
|
|
95
95
|
rootSetState: a,
|
|
96
96
|
rootState: r
|
|
97
97
|
}) => {
|
|
98
98
|
const s = getFunctionArguments({
|
|
99
99
|
builder: t,
|
|
100
100
|
context: n,
|
|
101
|
-
event:
|
|
101
|
+
event: o,
|
|
102
102
|
state: flattenState({
|
|
103
103
|
rootState: r,
|
|
104
|
-
localState:
|
|
104
|
+
localState: i,
|
|
105
105
|
rootSetState: a
|
|
106
106
|
})
|
|
107
107
|
});
|
|
@@ -113,30 +113,30 @@ function flattenState({
|
|
|
113
113
|
rootSetState: n
|
|
114
114
|
}) {
|
|
115
115
|
return new Proxy(e, {
|
|
116
|
-
get: (
|
|
117
|
-
if (t &&
|
|
118
|
-
return t[
|
|
119
|
-
const a = i
|
|
116
|
+
get: (o, i) => {
|
|
117
|
+
if (t && i in t)
|
|
118
|
+
return t[i];
|
|
119
|
+
const a = o[i];
|
|
120
120
|
return typeof a == "object" ? flattenState({
|
|
121
121
|
rootState: a,
|
|
122
122
|
localState: void 0,
|
|
123
123
|
rootSetState: n ? (r) => {
|
|
124
|
-
i
|
|
124
|
+
o[i] = r, n(o);
|
|
125
125
|
} : void 0
|
|
126
126
|
}) : a;
|
|
127
127
|
},
|
|
128
|
-
set: (
|
|
129
|
-
if (t &&
|
|
128
|
+
set: (o, i, a) => {
|
|
129
|
+
if (t && i in t)
|
|
130
130
|
throw new Error("Writing to local state is not allowed as it is read-only.");
|
|
131
|
-
return i
|
|
131
|
+
return o[i] = a, n == null || n(o), !0;
|
|
132
132
|
}
|
|
133
133
|
});
|
|
134
134
|
}
|
|
135
135
|
const set = (e, t, n) => {
|
|
136
136
|
if (Object(e) !== e)
|
|
137
137
|
return e;
|
|
138
|
-
const
|
|
139
|
-
return
|
|
138
|
+
const o = Array.isArray(t) ? t : t.toString().match(/[^.[\]]+/g);
|
|
139
|
+
return o.slice(0, -1).reduce((i, a, r) => Object(i[a]) === i[a] ? i[a] : i[a] = Math.abs(Number(o[r + 1])) >> 0 === +o[r + 1] ? [] : {}, e)[o[o.length - 1]] = n, e;
|
|
140
140
|
}, noop = () => {
|
|
141
141
|
};
|
|
142
142
|
let safeDynamicRequire = noop;
|
|
@@ -178,7 +178,7 @@ var refToProxy = (obj) => {
|
|
|
178
178
|
code: e,
|
|
179
179
|
args: t
|
|
180
180
|
}) => {
|
|
181
|
-
const n = t.map(([
|
|
181
|
+
const n = t.map(([o]) => `var ${o} = refToProxy(${getSyncValName(o)}); `).join("");
|
|
182
182
|
return `
|
|
183
183
|
${REF_TO_PROXY_FN}
|
|
184
184
|
${n}
|
|
@@ -200,42 +200,42 @@ output;
|
|
|
200
200
|
code: e,
|
|
201
201
|
builder: t,
|
|
202
202
|
context: n,
|
|
203
|
-
event:
|
|
204
|
-
localState:
|
|
203
|
+
event: o,
|
|
204
|
+
localState: i,
|
|
205
205
|
rootSetState: a,
|
|
206
206
|
rootState: r
|
|
207
207
|
}) => {
|
|
208
208
|
const s = fastClone({
|
|
209
209
|
...r,
|
|
210
|
-
...
|
|
210
|
+
...i
|
|
211
211
|
}), l = getFunctionArguments({
|
|
212
212
|
builder: t,
|
|
213
213
|
context: n,
|
|
214
|
-
event:
|
|
214
|
+
event: o,
|
|
215
215
|
state: s
|
|
216
|
-
}), c = getIsolateContext(),
|
|
217
|
-
|
|
218
|
-
console.log(...
|
|
219
|
-
}),
|
|
220
|
-
set(r,
|
|
221
|
-
}), l.forEach(([
|
|
222
|
-
const
|
|
216
|
+
}), c = getIsolateContext(), u = c.global;
|
|
217
|
+
u.setSync("global", u.derefInto()), u.setSync("log", function(...d) {
|
|
218
|
+
console.log(...d);
|
|
219
|
+
}), u.setSync(BUILDER_SET_STATE_NAME, function(d, m) {
|
|
220
|
+
set(r, d, m), a == null || a(r);
|
|
221
|
+
}), l.forEach(([d, m]) => {
|
|
222
|
+
const b = typeof m == "object" ? new ivm.Reference(
|
|
223
223
|
// workaround: methods with default values for arguments is not being cloned over
|
|
224
|
-
|
|
225
|
-
...
|
|
226
|
-
getUserAttributes: () =>
|
|
227
|
-
} :
|
|
224
|
+
d === "builder" ? {
|
|
225
|
+
...m,
|
|
226
|
+
getUserAttributes: () => m.getUserAttributes()
|
|
227
|
+
} : m
|
|
228
228
|
) : null;
|
|
229
|
-
|
|
230
|
-
}),
|
|
231
|
-
const
|
|
229
|
+
u.setSync(getSyncValName(d), b);
|
|
230
|
+
}), u.setSync(INJECTED_IVM_GLOBAL, ivm);
|
|
231
|
+
const y = processCode({
|
|
232
232
|
code: e,
|
|
233
233
|
args: l
|
|
234
|
-
}),
|
|
234
|
+
}), x = c.evalSync(y);
|
|
235
235
|
try {
|
|
236
|
-
return JSON.parse(
|
|
236
|
+
return JSON.parse(x);
|
|
237
237
|
} catch {
|
|
238
|
-
return
|
|
238
|
+
return x;
|
|
239
239
|
}
|
|
240
240
|
};
|
|
241
241
|
function isNodeRuntime() {
|
|
@@ -243,18 +243,18 @@ function isNodeRuntime() {
|
|
|
243
243
|
return typeof process != "undefined" && checkIsDefined((e = process == null ? void 0 : process.versions) == null ? void 0 : e.node);
|
|
244
244
|
}
|
|
245
245
|
const shouldForceBrowserRuntimeInNode = () => {
|
|
246
|
-
var
|
|
246
|
+
var o;
|
|
247
247
|
if (!isNodeRuntime())
|
|
248
248
|
return !1;
|
|
249
|
-
const e = process.arch === "arm64", t = process.version.startsWith("v20"), n = (
|
|
249
|
+
const e = process.arch === "arm64", t = process.version.startsWith("v20"), n = (o = process.env.NODE_OPTIONS) == null ? void 0 : o.includes("--no-node-snapshot");
|
|
250
250
|
return e && t && !n ? (logger.log("Skipping usage of `isolated-vm` to avoid crashes in Node v20 on an arm64 machine.\n If you would like to use the `isolated-vm` package on this machine, please provide the `NODE_OPTIONS=--no-node-snapshot` config to your Node process.\n See https://github.com/BuilderIO/builder/blob/main/packages/sdks/README.md#node-v20--m1-macs-apple-silicon-support for more information.\n "), !0) : !1;
|
|
251
251
|
}, chooseBrowserOrServerEval = (e) => isBrowser() || shouldForceBrowserRuntimeInNode() ? runInBrowser(e) : runInNode(e);
|
|
252
252
|
function evaluate({
|
|
253
253
|
code: e,
|
|
254
254
|
context: t,
|
|
255
255
|
localState: n,
|
|
256
|
-
rootState:
|
|
257
|
-
rootSetState:
|
|
256
|
+
rootState: o,
|
|
257
|
+
rootSetState: i,
|
|
258
258
|
event: a,
|
|
259
259
|
isExpression: r = !0
|
|
260
260
|
}) {
|
|
@@ -269,8 +269,8 @@ function evaluate({
|
|
|
269
269
|
builder: getBuilderGlobals(),
|
|
270
270
|
context: t,
|
|
271
271
|
event: a,
|
|
272
|
-
rootSetState:
|
|
273
|
-
rootState:
|
|
272
|
+
rootSetState: i,
|
|
273
|
+
rootState: o,
|
|
274
274
|
localState: n
|
|
275
275
|
};
|
|
276
276
|
try {
|
|
@@ -289,8 +289,8 @@ const evaluateBindings = ({
|
|
|
289
289
|
block: e,
|
|
290
290
|
context: t,
|
|
291
291
|
localState: n,
|
|
292
|
-
rootState:
|
|
293
|
-
rootSetState:
|
|
292
|
+
rootState: o,
|
|
293
|
+
rootSetState: i
|
|
294
294
|
}) => {
|
|
295
295
|
if (!e.bindings)
|
|
296
296
|
return e;
|
|
@@ -307,8 +307,8 @@ const evaluateBindings = ({
|
|
|
307
307
|
const l = e.bindings[s], c = evaluate({
|
|
308
308
|
code: l,
|
|
309
309
|
localState: n,
|
|
310
|
-
rootState:
|
|
311
|
-
rootSetState:
|
|
310
|
+
rootState: o,
|
|
311
|
+
rootSetState: i,
|
|
312
312
|
context: t
|
|
313
313
|
});
|
|
314
314
|
set(r, s, c);
|
|
@@ -319,38 +319,38 @@ function getProcessedBlock({
|
|
|
319
319
|
block: e,
|
|
320
320
|
context: t,
|
|
321
321
|
shouldEvaluateBindings: n,
|
|
322
|
-
localState:
|
|
323
|
-
rootState:
|
|
322
|
+
localState: o,
|
|
323
|
+
rootState: i,
|
|
324
324
|
rootSetState: a
|
|
325
325
|
}) {
|
|
326
326
|
const r = e;
|
|
327
327
|
return n ? evaluateBindings({
|
|
328
328
|
block: r,
|
|
329
|
-
localState:
|
|
330
|
-
rootState:
|
|
329
|
+
localState: o,
|
|
330
|
+
rootState: i,
|
|
331
331
|
rootSetState: a,
|
|
332
332
|
context: t
|
|
333
333
|
}) : r;
|
|
334
334
|
}
|
|
335
335
|
function throttle(e, t, n = {}) {
|
|
336
|
-
let
|
|
336
|
+
let o, i, a, r = null, s = 0;
|
|
337
337
|
const l = function() {
|
|
338
|
-
s = n.leading === !1 ? 0 : Date.now(), r = null, a = e.apply(
|
|
338
|
+
s = n.leading === !1 ? 0 : Date.now(), r = null, a = e.apply(o, i), r || (o = i = null);
|
|
339
339
|
};
|
|
340
340
|
return function() {
|
|
341
341
|
const c = Date.now();
|
|
342
342
|
!s && n.leading === !1 && (s = c);
|
|
343
|
-
const
|
|
344
|
-
return
|
|
343
|
+
const u = t - (c - s);
|
|
344
|
+
return o = this, i = arguments, u <= 0 || u > t ? (r && (clearTimeout(r), r = null), s = c, a = e.apply(o, i), r || (o = i = null)) : !r && n.trailing !== !1 && (r = setTimeout(l, u)), a;
|
|
345
345
|
};
|
|
346
346
|
}
|
|
347
347
|
function assign(e, ...t) {
|
|
348
348
|
const n = Object(e);
|
|
349
|
-
for (let
|
|
350
|
-
const
|
|
351
|
-
if (
|
|
352
|
-
for (const a in
|
|
353
|
-
Object.prototype.hasOwnProperty.call(
|
|
349
|
+
for (let o = 1; o < arguments.length; o++) {
|
|
350
|
+
const i = arguments[o];
|
|
351
|
+
if (i != null)
|
|
352
|
+
for (const a in i)
|
|
353
|
+
Object.prototype.hasOwnProperty.call(i, a) && (n[a] = i[a]);
|
|
354
354
|
}
|
|
355
355
|
return n;
|
|
356
356
|
}
|
|
@@ -373,16 +373,16 @@ function warnElementNotPresent(e) {
|
|
|
373
373
|
console.warn(`Cannot animate element: element with ID ${e} not found!`);
|
|
374
374
|
}
|
|
375
375
|
function augmentAnimation(e, t) {
|
|
376
|
-
const n = getAllStylesUsed(e),
|
|
376
|
+
const n = getAllStylesUsed(e), o = getComputedStyle(t), i = e.steps[0].styles, a = e.steps[e.steps.length - 1].styles, r = [i, a];
|
|
377
377
|
for (const s of r)
|
|
378
378
|
for (const l of n)
|
|
379
|
-
l in s || (s[l] =
|
|
379
|
+
l in s || (s[l] = o[l]);
|
|
380
380
|
}
|
|
381
381
|
function getAllStylesUsed(e) {
|
|
382
382
|
const t = [];
|
|
383
383
|
for (const n of e.steps)
|
|
384
|
-
for (const
|
|
385
|
-
t.indexOf(
|
|
384
|
+
for (const o in n.styles)
|
|
385
|
+
t.indexOf(o) === -1 && t.push(o);
|
|
386
386
|
return t;
|
|
387
387
|
}
|
|
388
388
|
function triggerAnimation(e) {
|
|
@@ -407,12 +407,12 @@ function bindHoverAnimation(e) {
|
|
|
407
407
|
}
|
|
408
408
|
Array.from(t).forEach((n) => {
|
|
409
409
|
augmentAnimation(e, n);
|
|
410
|
-
const
|
|
410
|
+
const o = e.steps[0].styles, i = e.steps[1].styles;
|
|
411
411
|
function a() {
|
|
412
|
-
assign(n.style,
|
|
412
|
+
assign(n.style, o);
|
|
413
413
|
}
|
|
414
414
|
function r() {
|
|
415
|
-
assign(n.style,
|
|
415
|
+
assign(n.style, i);
|
|
416
416
|
}
|
|
417
417
|
a(), n.addEventListener("mouseenter", r), n.addEventListener("mouseleave", a), setTimeout(() => {
|
|
418
418
|
n.style.transition = `all ${e.duration}s ${camelCaseToKebabCase(e.easing)}`, e.delay && (n.style.transitionDelay = e.delay + "s");
|
|
@@ -427,20 +427,20 @@ function bindScrollInViewAnimation(e) {
|
|
|
427
427
|
}
|
|
428
428
|
Array.from(t).forEach((n) => {
|
|
429
429
|
augmentAnimation(e, n);
|
|
430
|
-
let
|
|
430
|
+
let o = !1, i = !1;
|
|
431
431
|
function a() {
|
|
432
|
-
!
|
|
432
|
+
!o && s(n) ? (o = !0, i = !0, setTimeout(() => {
|
|
433
433
|
assign(n.style, e.steps[1].styles), e.repeat || document.removeEventListener("scroll", r), setTimeout(() => {
|
|
434
|
-
|
|
434
|
+
i = !1, e.repeat || (n.style.transition = "", n.style.transitionDelay = "");
|
|
435
435
|
}, (e.duration + (e.delay || 0)) * 1e3 + 100);
|
|
436
|
-
})) : e.repeat &&
|
|
436
|
+
})) : e.repeat && o && !i && !s(n) && (o = !1, assign(n.style, e.steps[0].styles));
|
|
437
437
|
}
|
|
438
438
|
const r = throttle(a, 200, {
|
|
439
439
|
leading: !1
|
|
440
440
|
});
|
|
441
|
-
function s(
|
|
442
|
-
const
|
|
443
|
-
return
|
|
441
|
+
function s(u) {
|
|
442
|
+
const y = u.getBoundingClientRect(), x = window.innerHeight, m = (e.thresholdPercent || 0) / 100 * x;
|
|
443
|
+
return y.bottom > m && y.top < x - m;
|
|
444
444
|
}
|
|
445
445
|
const l = e.steps[0].styles;
|
|
446
446
|
function c() {
|
|
@@ -460,7 +460,7 @@ const getComponent = ({
|
|
|
460
460
|
registeredComponents: n
|
|
461
461
|
}) => {
|
|
462
462
|
var a;
|
|
463
|
-
const
|
|
463
|
+
const o = (a = getProcessedBlock({
|
|
464
464
|
block: e,
|
|
465
465
|
localState: t.localState,
|
|
466
466
|
rootState: t.rootState,
|
|
@@ -468,13 +468,13 @@ const getComponent = ({
|
|
|
468
468
|
context: t.context,
|
|
469
469
|
shouldEvaluateBindings: !1
|
|
470
470
|
}).component) == null ? void 0 : a.name;
|
|
471
|
-
if (!
|
|
471
|
+
if (!o)
|
|
472
472
|
return null;
|
|
473
|
-
const
|
|
474
|
-
if (
|
|
475
|
-
return
|
|
473
|
+
const i = n[o];
|
|
474
|
+
if (i)
|
|
475
|
+
return i;
|
|
476
476
|
console.warn(`
|
|
477
|
-
Could not find a registered component named "${
|
|
477
|
+
Could not find a registered component named "${o}".
|
|
478
478
|
If you registered it, is the file that registered it imported by the file that needs to render it?`);
|
|
479
479
|
}, getRepeatItemData = ({
|
|
480
480
|
block: e,
|
|
@@ -482,21 +482,21 @@ const getComponent = ({
|
|
|
482
482
|
}) => {
|
|
483
483
|
const {
|
|
484
484
|
repeat: n,
|
|
485
|
-
...
|
|
485
|
+
...o
|
|
486
486
|
} = e;
|
|
487
487
|
if (!(n != null && n.collection))
|
|
488
488
|
return;
|
|
489
|
-
const
|
|
489
|
+
const i = evaluate({
|
|
490
490
|
code: n.collection,
|
|
491
491
|
localState: t.localState,
|
|
492
492
|
rootState: t.rootState,
|
|
493
493
|
rootSetState: t.rootSetState,
|
|
494
494
|
context: t.context
|
|
495
495
|
});
|
|
496
|
-
if (!Array.isArray(
|
|
496
|
+
if (!Array.isArray(i))
|
|
497
497
|
return;
|
|
498
498
|
const a = n.collection.split(".").pop(), r = n.itemName || (a ? a + "Item" : "item");
|
|
499
|
-
return
|
|
499
|
+
return i.map((l, c) => ({
|
|
500
500
|
context: {
|
|
501
501
|
...t,
|
|
502
502
|
localState: {
|
|
@@ -507,7 +507,7 @@ const getComponent = ({
|
|
|
507
507
|
[`$${r}Index`]: c
|
|
508
508
|
}
|
|
509
509
|
},
|
|
510
|
-
block:
|
|
510
|
+
block: o
|
|
511
511
|
}));
|
|
512
512
|
}, SIZES = {
|
|
513
513
|
small: {
|
|
@@ -532,17 +532,17 @@ const getComponent = ({
|
|
|
532
532
|
const n = fastClone(SIZES);
|
|
533
533
|
if (!e || !t)
|
|
534
534
|
return n;
|
|
535
|
-
const
|
|
535
|
+
const o = Math.floor(e / 2);
|
|
536
536
|
n.small = {
|
|
537
537
|
max: e,
|
|
538
|
-
min:
|
|
539
|
-
default:
|
|
538
|
+
min: o,
|
|
539
|
+
default: o + 1
|
|
540
540
|
};
|
|
541
|
-
const
|
|
541
|
+
const i = n.small.max + 1;
|
|
542
542
|
n.medium = {
|
|
543
543
|
max: t,
|
|
544
|
-
min:
|
|
545
|
-
default:
|
|
544
|
+
min: i,
|
|
545
|
+
default: i + 1
|
|
546
546
|
};
|
|
547
547
|
const a = n.medium.max + 1;
|
|
548
548
|
return n.large = {
|
|
@@ -551,28 +551,28 @@ const getComponent = ({
|
|
|
551
551
|
min: a,
|
|
552
552
|
default: a + 1
|
|
553
553
|
}, n;
|
|
554
|
-
}, camelToKebabCase = (e) => e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase(), convertStyleMapToCSSArray = (e) => Object.entries(e).map(([n,
|
|
555
|
-
if (typeof
|
|
556
|
-
return `${camelToKebabCase(n)}: ${
|
|
554
|
+
}, camelToKebabCase = (e) => e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase(), convertStyleMapToCSSArray = (e) => Object.entries(e).map(([n, o]) => {
|
|
555
|
+
if (typeof o == "string")
|
|
556
|
+
return `${camelToKebabCase(n)}: ${o};`;
|
|
557
557
|
}).filter(checkIsDefined), convertStyleMapToCSS = (e) => convertStyleMapToCSSArray(e).join(`
|
|
558
558
|
`), createCssClass = ({
|
|
559
559
|
mediaQuery: e,
|
|
560
560
|
className: t,
|
|
561
561
|
styles: n
|
|
562
562
|
}) => {
|
|
563
|
-
const
|
|
563
|
+
const o = `.${t} {
|
|
564
564
|
${convertStyleMapToCSS(n)}
|
|
565
565
|
}`;
|
|
566
566
|
return e ? `${e} {
|
|
567
|
-
${
|
|
568
|
-
}` :
|
|
567
|
+
${o}
|
|
568
|
+
}` : o;
|
|
569
569
|
};
|
|
570
570
|
function InlinedStyles(e) {
|
|
571
571
|
return /* @__PURE__ */ jsx("style", { dangerouslySetInnerHTML: { __html: e.styles }, id: e.id });
|
|
572
572
|
}
|
|
573
573
|
function BlockStyles(e) {
|
|
574
574
|
function t() {
|
|
575
|
-
const
|
|
575
|
+
const o = getProcessedBlock({
|
|
576
576
|
block: e.block,
|
|
577
577
|
localState: e.context.localState,
|
|
578
578
|
rootState: e.context.rootState,
|
|
@@ -580,41 +580,41 @@ function BlockStyles(e) {
|
|
|
580
580
|
context: e.context.context,
|
|
581
581
|
shouldEvaluateBindings: !0
|
|
582
582
|
});
|
|
583
|
-
return checkIsDefined(
|
|
583
|
+
return checkIsDefined(o.hide) ? !o.hide : checkIsDefined(o.show) ? o.show : !0;
|
|
584
584
|
}
|
|
585
585
|
function n() {
|
|
586
|
-
var
|
|
587
|
-
const
|
|
586
|
+
var m;
|
|
587
|
+
const o = getProcessedBlock({
|
|
588
588
|
block: e.block,
|
|
589
589
|
localState: e.context.localState,
|
|
590
590
|
rootState: e.context.rootState,
|
|
591
591
|
rootSetState: e.context.rootSetState,
|
|
592
592
|
context: e.context.context,
|
|
593
593
|
shouldEvaluateBindings: !0
|
|
594
|
-
}),
|
|
595
|
-
((
|
|
596
|
-
), s =
|
|
597
|
-
if (!
|
|
594
|
+
}), i = o.responsiveStyles, a = e.context.content, r = getSizesForBreakpoints(
|
|
595
|
+
((m = a == null ? void 0 : a.meta) == null ? void 0 : m.breakpoints) || {}
|
|
596
|
+
), s = i == null ? void 0 : i.large, l = i == null ? void 0 : i.medium, c = i == null ? void 0 : i.small, u = o.id;
|
|
597
|
+
if (!u)
|
|
598
598
|
return "";
|
|
599
|
-
const
|
|
600
|
-
className:
|
|
599
|
+
const y = s ? createCssClass({
|
|
600
|
+
className: u,
|
|
601
601
|
styles: s
|
|
602
|
-
}) : "",
|
|
603
|
-
className:
|
|
602
|
+
}) : "", x = l ? createCssClass({
|
|
603
|
+
className: u,
|
|
604
604
|
styles: l,
|
|
605
605
|
mediaQuery: getMaxWidthQueryForSize(
|
|
606
606
|
"medium",
|
|
607
607
|
r
|
|
608
608
|
)
|
|
609
|
-
}) : "",
|
|
610
|
-
className:
|
|
609
|
+
}) : "", d = c ? createCssClass({
|
|
610
|
+
className: u,
|
|
611
611
|
styles: c,
|
|
612
612
|
mediaQuery: getMaxWidthQueryForSize(
|
|
613
613
|
"small",
|
|
614
614
|
r
|
|
615
615
|
)
|
|
616
616
|
}) : "";
|
|
617
|
-
return [
|
|
617
|
+
return [y, x, d].join(" ");
|
|
618
618
|
}
|
|
619
619
|
return /* @__PURE__ */ jsx(Fragment, { children: n() && t() ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(InlinedStyles, { styles: n() }) }) : null });
|
|
620
620
|
}
|
|
@@ -631,13 +631,13 @@ const getEventHandlerName = (e) => `on${capitalizeFirstLetter(e)}`, createEventH
|
|
|
631
631
|
isExpression: !1
|
|
632
632
|
});
|
|
633
633
|
function getBlockActions(e) {
|
|
634
|
-
var
|
|
635
|
-
const t = {}, n = (
|
|
636
|
-
for (const
|
|
637
|
-
if (!n.hasOwnProperty(
|
|
634
|
+
var o;
|
|
635
|
+
const t = {}, n = (o = e.block.actions) != null ? o : {};
|
|
636
|
+
for (const i in n) {
|
|
637
|
+
if (!n.hasOwnProperty(i))
|
|
638
638
|
continue;
|
|
639
|
-
const a = n[
|
|
640
|
-
let r = getEventHandlerName(
|
|
639
|
+
const a = n[i];
|
|
640
|
+
let r = getEventHandlerName(i);
|
|
641
641
|
if (e.stripPrefix)
|
|
642
642
|
switch (TARGET) {
|
|
643
643
|
case "vue":
|
|
@@ -689,7 +689,7 @@ function getBlockProperties({
|
|
|
689
689
|
block: e,
|
|
690
690
|
context: t
|
|
691
691
|
}) {
|
|
692
|
-
var
|
|
692
|
+
var o;
|
|
693
693
|
const n = {
|
|
694
694
|
...extractRelevantRootBlockProperties(e),
|
|
695
695
|
...e.properties,
|
|
@@ -698,7 +698,7 @@ function getBlockProperties({
|
|
|
698
698
|
block: e,
|
|
699
699
|
context: t
|
|
700
700
|
}),
|
|
701
|
-
[getClassPropName()]: [e.id, "builder-block", e.class, (
|
|
701
|
+
[getClassPropName()]: [e.id, "builder-block", e.class, (o = e.properties) == null ? void 0 : o.class].filter(Boolean).join(" ")
|
|
702
702
|
};
|
|
703
703
|
return transformBlockProperties({
|
|
704
704
|
properties: n,
|
|
@@ -753,8 +753,8 @@ const getWrapperProps = ({
|
|
|
753
753
|
componentOptions: e,
|
|
754
754
|
builderBlock: t,
|
|
755
755
|
context: n,
|
|
756
|
-
componentRef:
|
|
757
|
-
includeBlockProps:
|
|
756
|
+
componentRef: o,
|
|
757
|
+
includeBlockProps: i,
|
|
758
758
|
isInteractive: a,
|
|
759
759
|
contextValue: r
|
|
760
760
|
}) => {
|
|
@@ -764,7 +764,7 @@ const getWrapperProps = ({
|
|
|
764
764
|
* If `noWrap` is set to `true`, then the block's props/attributes are provided to the
|
|
765
765
|
* component itself directly. Otherwise, they are provided to the wrapper element.
|
|
766
766
|
*/
|
|
767
|
-
...
|
|
767
|
+
...i ? {
|
|
768
768
|
attributes: getBlockProperties({
|
|
769
769
|
block: t,
|
|
770
770
|
context: r
|
|
@@ -772,15 +772,15 @@ const getWrapperProps = ({
|
|
|
772
772
|
} : {}
|
|
773
773
|
};
|
|
774
774
|
return a ? {
|
|
775
|
-
Wrapper:
|
|
775
|
+
Wrapper: o,
|
|
776
776
|
block: t,
|
|
777
777
|
context: n,
|
|
778
778
|
wrapperProps: e,
|
|
779
|
-
includeBlockProps:
|
|
779
|
+
includeBlockProps: i
|
|
780
780
|
} : s;
|
|
781
781
|
};
|
|
782
782
|
function ComponentRef(e) {
|
|
783
|
-
var
|
|
783
|
+
var o;
|
|
784
784
|
const [t, n] = useState(
|
|
785
785
|
() => e.isInteractive ? InteractiveElement : e.componentRef
|
|
786
786
|
);
|
|
@@ -797,15 +797,15 @@ function ComponentRef(e) {
|
|
|
797
797
|
isInteractive: e.isInteractive,
|
|
798
798
|
contextValue: e.context
|
|
799
799
|
}),
|
|
800
|
-
children: (
|
|
800
|
+
children: (o = e.blockChildren) == null ? void 0 : o.map((i) => /* @__PURE__ */ jsx(
|
|
801
801
|
Block,
|
|
802
802
|
{
|
|
803
|
-
block:
|
|
803
|
+
block: i,
|
|
804
804
|
context: e.context,
|
|
805
805
|
registeredComponents: e.registeredComponents,
|
|
806
806
|
linkComponent: e.linkComponent
|
|
807
807
|
},
|
|
808
|
-
|
|
808
|
+
i.id
|
|
809
809
|
))
|
|
810
810
|
}
|
|
811
811
|
) }) : null });
|
|
@@ -823,7 +823,7 @@ function RepeatedBlock(e) {
|
|
|
823
823
|
) });
|
|
824
824
|
}
|
|
825
825
|
function Block(e) {
|
|
826
|
-
var
|
|
826
|
+
var u, y, x;
|
|
827
827
|
function t() {
|
|
828
828
|
return getComponent({
|
|
829
829
|
block: e.block,
|
|
@@ -837,9 +837,9 @@ function Block(e) {
|
|
|
837
837
|
context: e.context
|
|
838
838
|
});
|
|
839
839
|
}
|
|
840
|
-
function
|
|
841
|
-
var
|
|
842
|
-
return (
|
|
840
|
+
function o() {
|
|
841
|
+
var d;
|
|
842
|
+
return (d = e.block.repeat) != null && d.collection ? e.block : getProcessedBlock({
|
|
843
843
|
block: e.block,
|
|
844
844
|
localState: e.context.localState,
|
|
845
845
|
rootState: e.context.rootState,
|
|
@@ -848,56 +848,56 @@ function Block(e) {
|
|
|
848
848
|
shouldEvaluateBindings: !0
|
|
849
849
|
});
|
|
850
850
|
}
|
|
851
|
-
function
|
|
852
|
-
var
|
|
853
|
-
return e.block.tagName === "a" || ((
|
|
851
|
+
function i() {
|
|
852
|
+
var m;
|
|
853
|
+
return e.block.tagName === "a" || ((m = o().properties) == null ? void 0 : m.href) || o().href ? e.linkComponent || "a" : e.block.tagName || "div";
|
|
854
854
|
}
|
|
855
855
|
function a() {
|
|
856
|
-
var
|
|
857
|
-
if ((
|
|
858
|
-
return !!((
|
|
859
|
-
const
|
|
860
|
-
return ("show" in
|
|
856
|
+
var b, I;
|
|
857
|
+
if ((b = e.block.repeat) != null && b.collection)
|
|
858
|
+
return !!((I = n == null ? void 0 : n()) != null && I.length);
|
|
859
|
+
const d = "hide" in o() ? o().hide : !1;
|
|
860
|
+
return ("show" in o() ? o().show : !0) && !d;
|
|
861
861
|
}
|
|
862
862
|
function r() {
|
|
863
|
-
var
|
|
864
|
-
return !((
|
|
863
|
+
var m, b;
|
|
864
|
+
return !((m = t == null ? void 0 : t()) != null && m.component) && !n() ? (b = o().children) != null ? b : [] : [];
|
|
865
865
|
}
|
|
866
866
|
function s() {
|
|
867
|
-
var
|
|
867
|
+
var d, m, b, I, R, S, k, w, E, B, A;
|
|
868
868
|
return {
|
|
869
|
-
blockChildren: (
|
|
870
|
-
componentRef: (
|
|
869
|
+
blockChildren: (d = o().children) != null ? d : [],
|
|
870
|
+
componentRef: (m = t == null ? void 0 : t()) == null ? void 0 : m.component,
|
|
871
871
|
componentOptions: {
|
|
872
|
-
...getBlockComponentOptions(
|
|
872
|
+
...getBlockComponentOptions(o()),
|
|
873
873
|
builderContext: e.context,
|
|
874
|
-
...((
|
|
874
|
+
...((b = t == null ? void 0 : t()) == null ? void 0 : b.name) === "Core:Button" || ((I = t == null ? void 0 : t()) == null ? void 0 : I.name) === "Symbol" || ((R = t == null ? void 0 : t()) == null ? void 0 : R.name) === "Columns" || ((S = t == null ? void 0 : t()) == null ? void 0 : S.name) === "Form:Form" ? {
|
|
875
875
|
builderLinkComponent: e.linkComponent
|
|
876
876
|
} : {},
|
|
877
|
-
...((
|
|
877
|
+
...((k = t == null ? void 0 : t()) == null ? void 0 : k.name) === "Symbol" || ((w = t == null ? void 0 : t()) == null ? void 0 : w.name) === "Columns" || ((E = t == null ? void 0 : t()) == null ? void 0 : E.name) === "Form:Form" ? {
|
|
878
878
|
builderComponents: e.registeredComponents
|
|
879
879
|
} : {}
|
|
880
880
|
},
|
|
881
881
|
context: l,
|
|
882
882
|
linkComponent: e.linkComponent,
|
|
883
883
|
registeredComponents: e.registeredComponents,
|
|
884
|
-
builderBlock:
|
|
885
|
-
includeBlockProps: ((
|
|
886
|
-
isInteractive: !((
|
|
884
|
+
builderBlock: o(),
|
|
885
|
+
includeBlockProps: ((B = t == null ? void 0 : t()) == null ? void 0 : B.noWrap) === !0,
|
|
886
|
+
isInteractive: !((A = t == null ? void 0 : t()) != null && A.isRSC)
|
|
887
887
|
};
|
|
888
888
|
}
|
|
889
889
|
const [l, c] = useState(() => e.context);
|
|
890
890
|
return useEffect(() => {
|
|
891
|
-
const
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
...
|
|
895
|
-
elementId:
|
|
891
|
+
const d = o().id, m = o().animations;
|
|
892
|
+
m && d && bindAnimations(
|
|
893
|
+
m.filter((b) => b.trigger !== "hover").map((b) => ({
|
|
894
|
+
...b,
|
|
895
|
+
elementId: d
|
|
896
896
|
}))
|
|
897
897
|
);
|
|
898
898
|
}, []), /* @__PURE__ */ jsx(Fragment, { children: a() ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
899
899
|
/* @__PURE__ */ jsx(BlockStyles, { block: e.block, context: e.context }),
|
|
900
|
-
(
|
|
900
|
+
(u = t == null ? void 0 : t()) != null && u.noWrap ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
901
901
|
ComponentRef,
|
|
902
902
|
{
|
|
903
903
|
componentRef: s().componentRef,
|
|
@@ -910,20 +910,20 @@ function Block(e) {
|
|
|
910
910
|
includeBlockProps: s().includeBlockProps,
|
|
911
911
|
isInteractive: s().isInteractive
|
|
912
912
|
}
|
|
913
|
-
) }) : /* @__PURE__ */ jsx(Fragment, { children: n() ? /* @__PURE__ */ jsx(Fragment, { children: (
|
|
913
|
+
) }) : /* @__PURE__ */ jsx(Fragment, { children: n() ? /* @__PURE__ */ jsx(Fragment, { children: (x = n()) == null ? void 0 : x.map((d, m) => /* @__PURE__ */ jsx(
|
|
914
914
|
RepeatedBlock,
|
|
915
915
|
{
|
|
916
|
-
repeatContext:
|
|
917
|
-
block:
|
|
916
|
+
repeatContext: d.context,
|
|
917
|
+
block: d.block,
|
|
918
918
|
registeredComponents: e.registeredComponents,
|
|
919
919
|
linkComponent: e.linkComponent
|
|
920
920
|
},
|
|
921
|
-
|
|
921
|
+
m
|
|
922
922
|
)) }) : /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
|
|
923
923
|
BlockWrapper,
|
|
924
924
|
{
|
|
925
|
-
Wrapper:
|
|
926
|
-
block:
|
|
925
|
+
Wrapper: i(),
|
|
926
|
+
block: o(),
|
|
927
927
|
context: e.context,
|
|
928
928
|
linkComponent: e.linkComponent,
|
|
929
929
|
children: [
|
|
@@ -941,15 +941,15 @@ function Block(e) {
|
|
|
941
941
|
isInteractive: s().isInteractive
|
|
942
942
|
}
|
|
943
943
|
),
|
|
944
|
-
(
|
|
944
|
+
(y = r()) == null ? void 0 : y.map((d) => /* @__PURE__ */ jsx(
|
|
945
945
|
Block,
|
|
946
946
|
{
|
|
947
|
-
block:
|
|
947
|
+
block: d,
|
|
948
948
|
context: l,
|
|
949
949
|
registeredComponents: e.registeredComponents,
|
|
950
950
|
linkComponent: e.linkComponent
|
|
951
951
|
},
|
|
952
|
-
|
|
952
|
+
d.id
|
|
953
953
|
))
|
|
954
954
|
]
|
|
955
955
|
}
|
|
@@ -958,12 +958,12 @@ function Block(e) {
|
|
|
958
958
|
}
|
|
959
959
|
function BlocksWrapper(e) {
|
|
960
960
|
function t() {
|
|
961
|
-
var
|
|
962
|
-
return "builder-blocks" + ((
|
|
961
|
+
var i;
|
|
962
|
+
return "builder-blocks" + ((i = e.blocks) != null && i.length ? "" : " no-blocks");
|
|
963
963
|
}
|
|
964
964
|
function n() {
|
|
965
|
-
var
|
|
966
|
-
isEditing() && !((
|
|
965
|
+
var i, a;
|
|
966
|
+
isEditing() && !((i = e.blocks) != null && i.length) && ((a = window.parent) == null || a.postMessage(
|
|
967
967
|
{
|
|
968
968
|
type: "builder.clickEmptyBlocks",
|
|
969
969
|
data: {
|
|
@@ -974,9 +974,9 @@ function BlocksWrapper(e) {
|
|
|
974
974
|
"*"
|
|
975
975
|
));
|
|
976
976
|
}
|
|
977
|
-
function
|
|
978
|
-
var
|
|
979
|
-
isEditing() && !((
|
|
977
|
+
function o() {
|
|
978
|
+
var i, a;
|
|
979
|
+
isEditing() && !((i = e.blocks) != null && i.length) && ((a = window.parent) == null || a.postMessage(
|
|
980
980
|
{
|
|
981
981
|
type: "builder.hoverEmptyBlocks",
|
|
982
982
|
data: {
|
|
@@ -995,9 +995,9 @@ function BlocksWrapper(e) {
|
|
|
995
995
|
"builder-path": e.path,
|
|
996
996
|
"builder-parent-id": e.parent,
|
|
997
997
|
style: e.styleProp,
|
|
998
|
-
onClick: (
|
|
999
|
-
onMouseEnter: (
|
|
1000
|
-
onKeyPress: (
|
|
998
|
+
onClick: (i) => n(),
|
|
999
|
+
onMouseEnter: (i) => o(),
|
|
1000
|
+
onKeyPress: (i) => n(),
|
|
1001
1001
|
...e.BlocksWrapperProps,
|
|
1002
1002
|
children: e.children
|
|
1003
1003
|
}
|
|
@@ -1010,7 +1010,7 @@ function BlocksWrapper(e) {
|
|
|
1010
1010
|
] });
|
|
1011
1011
|
}
|
|
1012
1012
|
function Blocks(e) {
|
|
1013
|
-
var
|
|
1013
|
+
var o, i, a;
|
|
1014
1014
|
const t = useContext(builderContext), n = useContext(ComponentsContext);
|
|
1015
1015
|
return /* @__PURE__ */ jsx(
|
|
1016
1016
|
BlocksWrapper,
|
|
@@ -1019,8 +1019,8 @@ function Blocks(e) {
|
|
|
1019
1019
|
parent: e.parent,
|
|
1020
1020
|
path: e.path,
|
|
1021
1021
|
styleProp: e.styleProp,
|
|
1022
|
-
BlocksWrapper: (
|
|
1023
|
-
BlocksWrapperProps: (
|
|
1022
|
+
BlocksWrapper: (o = e.context) == null ? void 0 : o.BlocksWrapper,
|
|
1023
|
+
BlocksWrapperProps: (i = e.context) == null ? void 0 : i.BlocksWrapperProps,
|
|
1024
1024
|
children: e.blocks ? /* @__PURE__ */ jsx(Fragment, { children: (a = e.blocks) == null ? void 0 : a.map((r) => /* @__PURE__ */ jsx(
|
|
1025
1025
|
Block,
|
|
1026
1026
|
{
|
|
@@ -1035,81 +1035,81 @@ function Blocks(e) {
|
|
|
1035
1035
|
);
|
|
1036
1036
|
}
|
|
1037
1037
|
function Columns(e) {
|
|
1038
|
-
var
|
|
1038
|
+
var R;
|
|
1039
1039
|
const [t, n] = useState(
|
|
1040
1040
|
() => typeof e.space == "number" ? e.space || 0 : 20
|
|
1041
|
-
), [
|
|
1041
|
+
), [o, i] = useState(() => e.columns || []), [a, r] = useState(
|
|
1042
1042
|
() => e.stackColumnsAt || "tablet"
|
|
1043
1043
|
);
|
|
1044
|
-
function s(
|
|
1045
|
-
var
|
|
1046
|
-
return ((
|
|
1044
|
+
function s(S) {
|
|
1045
|
+
var k;
|
|
1046
|
+
return ((k = o[S]) == null ? void 0 : k.width) || 100 / o.length;
|
|
1047
1047
|
}
|
|
1048
|
-
function l(
|
|
1049
|
-
const
|
|
1050
|
-
return `calc(${s(
|
|
1048
|
+
function l(S) {
|
|
1049
|
+
const k = t * (o.length - 1) / o.length;
|
|
1050
|
+
return `calc(${s(S)}% - ${k}px)`;
|
|
1051
1051
|
}
|
|
1052
1052
|
function c({
|
|
1053
|
-
stackedStyle:
|
|
1054
|
-
desktopStyle:
|
|
1053
|
+
stackedStyle: S,
|
|
1054
|
+
desktopStyle: k
|
|
1055
1055
|
}) {
|
|
1056
|
-
return a === "tablet" ?
|
|
1056
|
+
return a === "tablet" ? S : k;
|
|
1057
1057
|
}
|
|
1058
|
-
function
|
|
1059
|
-
stackedStyle:
|
|
1060
|
-
desktopStyle:
|
|
1058
|
+
function u({
|
|
1059
|
+
stackedStyle: S,
|
|
1060
|
+
desktopStyle: k
|
|
1061
1061
|
}) {
|
|
1062
|
-
return a === "never" ?
|
|
1062
|
+
return a === "never" ? k : S;
|
|
1063
1063
|
}
|
|
1064
|
-
const [
|
|
1064
|
+
const [y, x] = useState(
|
|
1065
1065
|
() => e.stackColumnsAt === "never" ? "row" : e.reverseColumnsWhenStacked ? "column-reverse" : "column"
|
|
1066
1066
|
);
|
|
1067
|
-
function
|
|
1067
|
+
function d() {
|
|
1068
1068
|
return {
|
|
1069
|
-
"--flex-dir":
|
|
1069
|
+
"--flex-dir": y,
|
|
1070
1070
|
"--flex-dir-tablet": c({
|
|
1071
|
-
stackedStyle:
|
|
1071
|
+
stackedStyle: y,
|
|
1072
1072
|
desktopStyle: "row"
|
|
1073
1073
|
})
|
|
1074
1074
|
};
|
|
1075
1075
|
}
|
|
1076
|
-
function
|
|
1077
|
-
const
|
|
1076
|
+
function m(S) {
|
|
1077
|
+
const k = S === 0 ? 0 : t, w = l(S), E = `${k}px`, B = "100%", A = 0;
|
|
1078
1078
|
return {
|
|
1079
1079
|
...{
|
|
1080
1080
|
display: "flex",
|
|
1081
1081
|
flexDirection: "column",
|
|
1082
1082
|
alignItems: "stretch"
|
|
1083
1083
|
},
|
|
1084
|
-
width:
|
|
1085
|
-
["marginLeft"]:
|
|
1086
|
-
"--column-width-mobile":
|
|
1087
|
-
stackedStyle:
|
|
1088
|
-
desktopStyle: I
|
|
1089
|
-
}),
|
|
1090
|
-
"--column-margin-left-mobile": d({
|
|
1091
|
-
stackedStyle: j,
|
|
1084
|
+
width: w,
|
|
1085
|
+
["marginLeft"]: E,
|
|
1086
|
+
"--column-width-mobile": u({
|
|
1087
|
+
stackedStyle: B,
|
|
1092
1088
|
desktopStyle: w
|
|
1093
1089
|
}),
|
|
1090
|
+
"--column-margin-left-mobile": u({
|
|
1091
|
+
stackedStyle: A,
|
|
1092
|
+
desktopStyle: E
|
|
1093
|
+
}),
|
|
1094
1094
|
"--column-width-tablet": c({
|
|
1095
|
-
stackedStyle:
|
|
1096
|
-
desktopStyle:
|
|
1095
|
+
stackedStyle: B,
|
|
1096
|
+
desktopStyle: w
|
|
1097
1097
|
}),
|
|
1098
1098
|
"--column-margin-left-tablet": c({
|
|
1099
|
-
stackedStyle:
|
|
1100
|
-
desktopStyle:
|
|
1099
|
+
stackedStyle: A,
|
|
1100
|
+
desktopStyle: E
|
|
1101
1101
|
})
|
|
1102
1102
|
};
|
|
1103
1103
|
}
|
|
1104
|
-
function
|
|
1105
|
-
var
|
|
1104
|
+
function b(S) {
|
|
1105
|
+
var w, E;
|
|
1106
1106
|
return getSizesForBreakpoints(
|
|
1107
|
-
((
|
|
1108
|
-
)[
|
|
1107
|
+
((E = (w = e.builderContext.content) == null ? void 0 : w.meta) == null ? void 0 : E.breakpoints) || {}
|
|
1108
|
+
)[S].max;
|
|
1109
1109
|
}
|
|
1110
|
-
function
|
|
1110
|
+
function I() {
|
|
1111
1111
|
return `
|
|
1112
|
-
@media (max-width: ${
|
|
1112
|
+
@media (max-width: ${b("medium")}px) {
|
|
1113
1113
|
.${e.builderBlock.id}-breakpoints {
|
|
1114
1114
|
flex-direction: var(--flex-dir-tablet);
|
|
1115
1115
|
align-items: stretch;
|
|
@@ -1121,7 +1121,7 @@ function Columns(e) {
|
|
|
1121
1121
|
}
|
|
1122
1122
|
}
|
|
1123
1123
|
|
|
1124
|
-
@media (max-width: ${
|
|
1124
|
+
@media (max-width: ${b("small")}px) {
|
|
1125
1125
|
.${e.builderBlock.id}-breakpoints {
|
|
1126
1126
|
flex-direction: var(--flex-dir);
|
|
1127
1127
|
align-items: stretch;
|
|
@@ -1138,26 +1138,26 @@ function Columns(e) {
|
|
|
1138
1138
|
/* @__PURE__ */ jsxs(
|
|
1139
1139
|
"div",
|
|
1140
1140
|
{
|
|
1141
|
-
className: `builder-columns ${e.builderBlock.id}-breakpoints div-
|
|
1142
|
-
style:
|
|
1141
|
+
className: `builder-columns ${e.builderBlock.id}-breakpoints div-002fb3ba`,
|
|
1142
|
+
style: d(),
|
|
1143
1143
|
children: [
|
|
1144
|
-
/* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(InlinedStyles, { styles:
|
|
1145
|
-
(
|
|
1144
|
+
/* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(InlinedStyles, { styles: I() }) }),
|
|
1145
|
+
(R = e.columns) == null ? void 0 : R.map((S, k) => /* @__PURE__ */ jsx(
|
|
1146
1146
|
DynamicRenderer,
|
|
1147
1147
|
{
|
|
1148
|
-
TagName:
|
|
1148
|
+
TagName: S.link ? e.builderLinkComponent || "a" : "div",
|
|
1149
1149
|
actionAttributes: {},
|
|
1150
1150
|
attributes: {
|
|
1151
|
-
...
|
|
1152
|
-
href:
|
|
1151
|
+
...S.link ? {
|
|
1152
|
+
href: S.link
|
|
1153
1153
|
} : {},
|
|
1154
1154
|
[getClassPropName()]: "builder-column",
|
|
1155
|
-
style: mapStyleObjToStrIfNeeded(
|
|
1155
|
+
style: mapStyleObjToStrIfNeeded(m(k))
|
|
1156
1156
|
},
|
|
1157
1157
|
children: /* @__PURE__ */ jsx(
|
|
1158
1158
|
Blocks,
|
|
1159
1159
|
{
|
|
1160
|
-
path: `component.options.columns.${
|
|
1160
|
+
path: `component.options.columns.${k}.blocks`,
|
|
1161
1161
|
parent: e.builderBlock.id,
|
|
1162
1162
|
styleProp: {
|
|
1163
1163
|
flexGrow: "1"
|
|
@@ -1165,16 +1165,16 @@ function Columns(e) {
|
|
|
1165
1165
|
context: e.builderContext,
|
|
1166
1166
|
registeredComponents: e.builderComponents,
|
|
1167
1167
|
linkComponent: e.builderLinkComponent,
|
|
1168
|
-
blocks:
|
|
1168
|
+
blocks: S.blocks
|
|
1169
1169
|
}
|
|
1170
1170
|
)
|
|
1171
1171
|
},
|
|
1172
|
-
|
|
1172
|
+
k
|
|
1173
1173
|
))
|
|
1174
1174
|
]
|
|
1175
1175
|
}
|
|
1176
1176
|
),
|
|
1177
|
-
/* @__PURE__ */ jsx("style", { children: `.div-
|
|
1177
|
+
/* @__PURE__ */ jsx("style", { children: `.div-002fb3ba {
|
|
1178
1178
|
display: flex;
|
|
1179
1179
|
line-height: normal;
|
|
1180
1180
|
}` })
|
|
@@ -1187,8 +1187,8 @@ function removeProtocol(e) {
|
|
|
1187
1187
|
return e.replace(/http(s)?:/, "");
|
|
1188
1188
|
}
|
|
1189
1189
|
function updateQueryParam(e = "", t, n) {
|
|
1190
|
-
const
|
|
1191
|
-
return e.match(
|
|
1190
|
+
const o = new RegExp("([?&])" + t + "=.*?(&|$)", "i"), i = e.indexOf("?") !== -1 ? "&" : "?";
|
|
1191
|
+
return e.match(o) ? e.replace(o, "$1" + t + "=" + encodeURIComponent(n) + "$2") : e + i + t + "=" + encodeURIComponent(n);
|
|
1192
1192
|
}
|
|
1193
1193
|
function getShopifyImageUrl(e, t) {
|
|
1194
1194
|
if (!e || !(e != null && e.match(/cdn\.shopify\.com/)) || !t)
|
|
@@ -1197,8 +1197,8 @@ function getShopifyImageUrl(e, t) {
|
|
|
1197
1197
|
return removeProtocol(e);
|
|
1198
1198
|
const n = e.match(/(_\d+x(\d+)?)?(\.(jpg|jpeg|gif|png|bmp|bitmap|tiff|tif)(\?v=\d+)?)/i);
|
|
1199
1199
|
if (n) {
|
|
1200
|
-
const
|
|
1201
|
-
return removeProtocol(`${
|
|
1200
|
+
const o = e.split(n[0]), i = n[3], a = t.match("x") ? t : `${t}x`;
|
|
1201
|
+
return removeProtocol(`${o[0]}_${a}${i}`);
|
|
1202
1202
|
}
|
|
1203
1203
|
return null;
|
|
1204
1204
|
}
|
|
@@ -1208,21 +1208,21 @@ function getSrcSet(e) {
|
|
|
1208
1208
|
const t = [100, 200, 400, 800, 1200, 1600, 2e3];
|
|
1209
1209
|
if (e.match(/builder\.io/)) {
|
|
1210
1210
|
let n = e;
|
|
1211
|
-
const
|
|
1212
|
-
return isNaN(
|
|
1211
|
+
const o = Number(e.split("?width=")[1]);
|
|
1212
|
+
return isNaN(o) || (n = `${n} ${o}w`), t.filter((i) => i !== o).map((i) => `${updateQueryParam(e, "width", i)} ${i}w`).concat([n]).join(", ");
|
|
1213
1213
|
}
|
|
1214
|
-
return e.match(/cdn\.shopify\.com/) ? t.map((n) => [getShopifyImageUrl(e, `${n}x${n}`), n]).filter(([n]) => !!n).map(([n,
|
|
1214
|
+
return e.match(/cdn\.shopify\.com/) ? t.map((n) => [getShopifyImageUrl(e, `${n}x${n}`), n]).filter(([n]) => !!n).map(([n, o]) => `${n} ${o}w`).concat([e]).join(", ") : e;
|
|
1215
1215
|
}
|
|
1216
1216
|
function Image(e) {
|
|
1217
|
-
var
|
|
1217
|
+
var i, a, r, s;
|
|
1218
1218
|
function t() {
|
|
1219
|
-
var
|
|
1219
|
+
var u;
|
|
1220
1220
|
const c = e.image || e.src;
|
|
1221
1221
|
if (!c || // We can auto add srcset for cdn.builder.io and shopify
|
|
1222
1222
|
// images, otherwise you can supply this prop manually
|
|
1223
1223
|
!(c.match(/builder\.io/) || c.match(/cdn\.shopify\.com/)))
|
|
1224
1224
|
return e.srcset;
|
|
1225
|
-
if (e.srcset && ((
|
|
1225
|
+
if (e.srcset && ((u = e.image) != null && u.includes("builder.io/api/v1/image"))) {
|
|
1226
1226
|
if (!e.srcset.includes(e.image.split("?")[0]))
|
|
1227
1227
|
return console.debug("Removed given srcset"), getSrcSet(c);
|
|
1228
1228
|
} else if (e.image && !e.srcset)
|
|
@@ -1233,7 +1233,7 @@ function Image(e) {
|
|
|
1233
1233
|
var l;
|
|
1234
1234
|
return (l = t == null ? void 0 : t()) != null && l.match(/builder\.io/) && !e.noWebp ? t().replace(/\?/g, "?format=webp&") : "";
|
|
1235
1235
|
}
|
|
1236
|
-
function
|
|
1236
|
+
function o() {
|
|
1237
1237
|
const l = {
|
|
1238
1238
|
position: "absolute",
|
|
1239
1239
|
height: "100%",
|
|
@@ -1256,7 +1256,7 @@ function Image(e) {
|
|
|
1256
1256
|
style: {
|
|
1257
1257
|
objectPosition: e.backgroundPosition || "center",
|
|
1258
1258
|
objectFit: e.backgroundSize || "cover",
|
|
1259
|
-
...
|
|
1259
|
+
...o()
|
|
1260
1260
|
},
|
|
1261
1261
|
className: "builder-image" + (e.className ? " " + e.className : "") + " img-40c70c9b",
|
|
1262
1262
|
src: e.image,
|
|
@@ -1265,7 +1265,7 @@ function Image(e) {
|
|
|
1265
1265
|
}
|
|
1266
1266
|
)
|
|
1267
1267
|
] }),
|
|
1268
|
-
e.aspectRatio && !((a = (
|
|
1268
|
+
e.aspectRatio && !((a = (i = e.builderBlock) == null ? void 0 : i.children) != null && a.length && e.fitContent) ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
1269
1269
|
"div",
|
|
1270
1270
|
{
|
|
1271
1271
|
className: "builder-image-sizer div-40c70c9b",
|
|
@@ -1317,7 +1317,7 @@ function SectionComponent(e) {
|
|
|
1317
1317
|
}
|
|
1318
1318
|
);
|
|
1319
1319
|
}
|
|
1320
|
-
const componentInfo$
|
|
1320
|
+
const componentInfo$f = {
|
|
1321
1321
|
name: "Core:Button",
|
|
1322
1322
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13",
|
|
1323
1323
|
defaultStyles: {
|
|
@@ -1350,7 +1350,7 @@ const componentInfo$b = {
|
|
|
1350
1350
|
}],
|
|
1351
1351
|
static: !0,
|
|
1352
1352
|
noWrap: !0
|
|
1353
|
-
}, componentInfo$
|
|
1353
|
+
}, componentInfo$e = {
|
|
1354
1354
|
// TODO: ways to statically preprocess JSON for references, functions, etc
|
|
1355
1355
|
name: "Columns",
|
|
1356
1356
|
isRSC: !0,
|
|
@@ -1524,12 +1524,12 @@ const componentInfo$b = {
|
|
|
1524
1524
|
}],
|
|
1525
1525
|
onChange: (e) => {
|
|
1526
1526
|
function t() {
|
|
1527
|
-
n.forEach((
|
|
1528
|
-
|
|
1527
|
+
n.forEach((o) => {
|
|
1528
|
+
o.delete("width");
|
|
1529
1529
|
});
|
|
1530
1530
|
}
|
|
1531
1531
|
const n = e.get("columns");
|
|
1532
|
-
Array.isArray(n) && n.find((
|
|
1532
|
+
Array.isArray(n) && n.find((i) => i.get("width")) && (n.find((a) => !a.get("width")) || n.reduce((s, l) => s + l.get("width"), 0) !== 100) && t();
|
|
1533
1533
|
}
|
|
1534
1534
|
}, {
|
|
1535
1535
|
name: "space",
|
|
@@ -1551,131 +1551,13 @@ const componentInfo$b = {
|
|
|
1551
1551
|
helperText: "When stacking columns for mobile devices, reverse the ordering",
|
|
1552
1552
|
advanced: !0
|
|
1553
1553
|
}]
|
|
1554
|
-
}, componentInfo$
|
|
1555
|
-
name: "Custom Code",
|
|
1556
|
-
static: !0,
|
|
1557
|
-
requiredPermissions: ["editCode"],
|
|
1558
|
-
inputs: [{
|
|
1559
|
-
name: "code",
|
|
1560
|
-
type: "html",
|
|
1561
|
-
required: !0,
|
|
1562
|
-
defaultValue: "<p>Hello there, I am custom HTML code!</p>",
|
|
1563
|
-
code: !0
|
|
1564
|
-
}, {
|
|
1565
|
-
name: "replaceNodes",
|
|
1566
|
-
type: "boolean",
|
|
1567
|
-
helperText: "Preserve server rendered dom nodes",
|
|
1568
|
-
advanced: !0
|
|
1569
|
-
}, {
|
|
1570
|
-
name: "scriptsClientOnly",
|
|
1571
|
-
type: "boolean",
|
|
1572
|
-
defaultValue: !1,
|
|
1573
|
-
helperText: "Only print and run scripts on the client. Important when scripts influence DOM that could be replaced when client loads",
|
|
1574
|
-
advanced: !0
|
|
1575
|
-
}]
|
|
1576
|
-
};
|
|
1577
|
-
function CustomCode(e) {
|
|
1578
|
-
const t = useRef(null), [n, i] = useState(() => []), [o, a] = useState(() => []);
|
|
1579
|
-
return useEffect(() => {
|
|
1580
|
-
var s;
|
|
1581
|
-
if (!((s = t.current) != null && s.getElementsByTagName) || typeof window == "undefined")
|
|
1582
|
-
return;
|
|
1583
|
-
const r = t.current.getElementsByTagName("script");
|
|
1584
|
-
for (let l = 0; l < r.length; l++) {
|
|
1585
|
-
const c = r[l];
|
|
1586
|
-
if (c.src) {
|
|
1587
|
-
if (n.includes(c.src))
|
|
1588
|
-
continue;
|
|
1589
|
-
n.push(c.src);
|
|
1590
|
-
const d = document.createElement("script");
|
|
1591
|
-
d.async = !0, d.src = c.src, document.head.appendChild(d);
|
|
1592
|
-
} else if (!c.type || [
|
|
1593
|
-
"text/javascript",
|
|
1594
|
-
"application/javascript",
|
|
1595
|
-
"application/ecmascript"
|
|
1596
|
-
].includes(c.type)) {
|
|
1597
|
-
if (o.includes(c.innerText))
|
|
1598
|
-
continue;
|
|
1599
|
-
try {
|
|
1600
|
-
o.push(c.innerText), new Function(c.innerText)();
|
|
1601
|
-
} catch (d) {
|
|
1602
|
-
console.warn("`CustomCode`: Error running script:", d);
|
|
1603
|
-
}
|
|
1604
|
-
}
|
|
1605
|
-
}
|
|
1606
|
-
}, []), /* @__PURE__ */ jsx(
|
|
1607
|
-
"div",
|
|
1608
|
-
{
|
|
1609
|
-
ref: t,
|
|
1610
|
-
className: "builder-custom-code" + (e.replaceNodes ? " replace-nodes" : ""),
|
|
1611
|
-
dangerouslySetInnerHTML: { __html: e.code }
|
|
1612
|
-
}
|
|
1613
|
-
);
|
|
1614
|
-
}
|
|
1615
|
-
const componentInfo$8 = {
|
|
1616
|
-
name: "Embed",
|
|
1617
|
-
static: !0,
|
|
1618
|
-
inputs: [{
|
|
1619
|
-
name: "url",
|
|
1620
|
-
type: "url",
|
|
1621
|
-
required: !0,
|
|
1622
|
-
defaultValue: "",
|
|
1623
|
-
helperText: "e.g. enter a youtube url, google map, etc",
|
|
1624
|
-
onChange: (e) => {
|
|
1625
|
-
const t = e.get("url");
|
|
1626
|
-
if (t)
|
|
1627
|
-
return e.set("content", "Loading..."), fetch(`https://iframe.ly/api/iframely?url=${t}&api_key=ae0e60e78201a3f2b0de4b`).then((i) => i.json()).then((i) => {
|
|
1628
|
-
e.get("url") === t && (i.html ? e.set("content", i.html) : e.set("content", "Invalid url, please try another"));
|
|
1629
|
-
}).catch((i) => {
|
|
1630
|
-
e.set("content", "There was an error embedding this URL, please try again or another URL");
|
|
1631
|
-
});
|
|
1632
|
-
e.delete("content");
|
|
1633
|
-
}
|
|
1634
|
-
}, {
|
|
1635
|
-
name: "content",
|
|
1636
|
-
type: "html",
|
|
1637
|
-
defaultValue: '<div style="padding: 20px; text-align: center">(Choose an embed URL)<div>',
|
|
1638
|
-
hideFromUI: !0
|
|
1639
|
-
}]
|
|
1640
|
-
}, SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"], isJsScript = (e) => SCRIPT_MIME_TYPES.includes(e.type);
|
|
1641
|
-
function Embed(e) {
|
|
1642
|
-
const t = useRef(null), [n, i] = useState(() => []), [o, a] = useState(() => []), [r, s] = useState(() => !1);
|
|
1643
|
-
function l() {
|
|
1644
|
-
if (!t.current || !t.current.getElementsByTagName)
|
|
1645
|
-
return;
|
|
1646
|
-
const c = t.current.getElementsByTagName("script");
|
|
1647
|
-
for (let d = 0; d < c.length; d++) {
|
|
1648
|
-
const b = c[d];
|
|
1649
|
-
if (b.src && !n.includes(b.src)) {
|
|
1650
|
-
n.push(b.src);
|
|
1651
|
-
const S = document.createElement("script");
|
|
1652
|
-
S.async = !0, S.src = b.src, document.head.appendChild(S);
|
|
1653
|
-
} else if (isJsScript(b) && !o.includes(b.innerText))
|
|
1654
|
-
try {
|
|
1655
|
-
o.push(b.innerText), new Function(b.innerText)();
|
|
1656
|
-
} catch (S) {
|
|
1657
|
-
console.warn("`Embed`: Error running script:", S);
|
|
1658
|
-
}
|
|
1659
|
-
}
|
|
1660
|
-
}
|
|
1661
|
-
return useEffect(() => {
|
|
1662
|
-
t.current && !r && (s(!0), l());
|
|
1663
|
-
}, [t.current, r]), /* @__PURE__ */ jsx(
|
|
1664
|
-
"div",
|
|
1665
|
-
{
|
|
1666
|
-
className: "builder-embed",
|
|
1667
|
-
ref: t,
|
|
1668
|
-
dangerouslySetInnerHTML: { __html: e.content }
|
|
1669
|
-
}
|
|
1670
|
-
);
|
|
1671
|
-
}
|
|
1672
|
-
const componentInfo$7 = {
|
|
1554
|
+
}, componentInfo$d = {
|
|
1673
1555
|
name: "Fragment",
|
|
1674
1556
|
static: !0,
|
|
1675
1557
|
hidden: !0,
|
|
1676
1558
|
canHaveChildren: !0,
|
|
1677
1559
|
noWrap: !0
|
|
1678
|
-
}, componentInfo$
|
|
1560
|
+
}, componentInfo$c = {
|
|
1679
1561
|
name: "Image",
|
|
1680
1562
|
static: !0,
|
|
1681
1563
|
image: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4",
|
|
@@ -1697,27 +1579,27 @@ const componentInfo$7 = {
|
|
|
1697
1579
|
e.delete("srcset"), e.delete("noWebp");
|
|
1698
1580
|
function n(r, s = 6e4) {
|
|
1699
1581
|
return new Promise((l, c) => {
|
|
1700
|
-
const
|
|
1701
|
-
let
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
},
|
|
1705
|
-
console.warn("Image load failed",
|
|
1706
|
-
}),
|
|
1707
|
-
|
|
1582
|
+
const u = document.createElement("img");
|
|
1583
|
+
let y = !1;
|
|
1584
|
+
u.onload = () => {
|
|
1585
|
+
y = !0, l(u);
|
|
1586
|
+
}, u.addEventListener("error", (x) => {
|
|
1587
|
+
console.warn("Image load failed", x.error), c(x.error);
|
|
1588
|
+
}), u.src = r, setTimeout(() => {
|
|
1589
|
+
y || c(new Error("Image load timed out"));
|
|
1708
1590
|
}, s);
|
|
1709
1591
|
});
|
|
1710
1592
|
}
|
|
1711
|
-
function
|
|
1593
|
+
function o(r) {
|
|
1712
1594
|
return Math.round(r * 1e3) / 1e3;
|
|
1713
1595
|
}
|
|
1714
|
-
const
|
|
1715
|
-
if (fetch(
|
|
1596
|
+
const i = e.get("image"), a = e.get("aspectRatio");
|
|
1597
|
+
if (fetch(i).then((r) => r.blob()).then((r) => {
|
|
1716
1598
|
r.type.includes("svg") && e.set("noWebp", !0);
|
|
1717
|
-
}),
|
|
1718
|
-
return n(
|
|
1599
|
+
}), i && (!a || a === 0.7041))
|
|
1600
|
+
return n(i).then((r) => {
|
|
1719
1601
|
const s = e.get("aspectRatio");
|
|
1720
|
-
e.get("image") ===
|
|
1602
|
+
e.get("image") === i && (!s || s === 0.7041) && r.width && r.height && (e.set("aspectRatio", o(r.height / r.width)), e.set("height", r.height), e.set("width", r.width));
|
|
1721
1603
|
});
|
|
1722
1604
|
}
|
|
1723
1605
|
}, {
|
|
@@ -1775,37 +1657,7 @@ const componentInfo$7 = {
|
|
|
1775
1657
|
advanced: !0,
|
|
1776
1658
|
defaultValue: 0.7041
|
|
1777
1659
|
}]
|
|
1778
|
-
}, componentInfo$
|
|
1779
|
-
// friendlyName?
|
|
1780
|
-
name: "Raw:Img",
|
|
1781
|
-
hideFromInsertMenu: !0,
|
|
1782
|
-
image: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4",
|
|
1783
|
-
inputs: [{
|
|
1784
|
-
name: "image",
|
|
1785
|
-
bubble: !0,
|
|
1786
|
-
type: "file",
|
|
1787
|
-
allowedFileTypes: ["jpeg", "jpg", "png", "svg", "gif", "webp"],
|
|
1788
|
-
required: !0
|
|
1789
|
-
}],
|
|
1790
|
-
noWrap: !0,
|
|
1791
|
-
static: !0
|
|
1792
|
-
};
|
|
1793
|
-
function ImgComponent(e) {
|
|
1794
|
-
return /* @__PURE__ */ jsx(
|
|
1795
|
-
"img",
|
|
1796
|
-
{
|
|
1797
|
-
style: {
|
|
1798
|
-
objectFit: e.backgroundSize || "cover",
|
|
1799
|
-
objectPosition: e.backgroundPosition || "center"
|
|
1800
|
-
},
|
|
1801
|
-
alt: e.altText,
|
|
1802
|
-
src: e.imgSrc || e.image,
|
|
1803
|
-
...e.attributes
|
|
1804
|
-
},
|
|
1805
|
-
isEditing() && e.imgSrc || "default-key"
|
|
1806
|
-
);
|
|
1807
|
-
}
|
|
1808
|
-
const componentInfo$4 = {
|
|
1660
|
+
}, componentInfo$b = {
|
|
1809
1661
|
name: "Core:Section",
|
|
1810
1662
|
static: !0,
|
|
1811
1663
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",
|
|
@@ -1844,7 +1696,7 @@ const componentInfo$4 = {
|
|
|
1844
1696
|
}
|
|
1845
1697
|
}
|
|
1846
1698
|
}]
|
|
1847
|
-
}, componentInfo$
|
|
1699
|
+
}, componentInfo$a = {
|
|
1848
1700
|
name: "Slot",
|
|
1849
1701
|
isRSC: !0,
|
|
1850
1702
|
description: "Allow child blocks to be inserted into this content when used as a Symbol",
|
|
@@ -1859,7 +1711,7 @@ const componentInfo$4 = {
|
|
|
1859
1711
|
}]
|
|
1860
1712
|
};
|
|
1861
1713
|
function Slot(e) {
|
|
1862
|
-
var t, n,
|
|
1714
|
+
var t, n, o;
|
|
1863
1715
|
return /* @__PURE__ */ jsx(
|
|
1864
1716
|
"div",
|
|
1865
1717
|
{
|
|
@@ -1875,13 +1727,13 @@ function Slot(e) {
|
|
|
1875
1727
|
parent: (n = e.builderContext.context) == null ? void 0 : n.symbolId,
|
|
1876
1728
|
path: `symbol.data.${e.name}`,
|
|
1877
1729
|
context: e.builderContext,
|
|
1878
|
-
blocks: (
|
|
1730
|
+
blocks: (o = e.builderContext.rootState) == null ? void 0 : o[e.name]
|
|
1879
1731
|
}
|
|
1880
1732
|
)
|
|
1881
1733
|
}
|
|
1882
1734
|
);
|
|
1883
1735
|
}
|
|
1884
|
-
const componentInfo$
|
|
1736
|
+
const componentInfo$9 = {
|
|
1885
1737
|
name: "Symbol",
|
|
1886
1738
|
noWrap: !0,
|
|
1887
1739
|
static: !0,
|
|
@@ -1914,7 +1766,7 @@ const componentInfo$2 = {
|
|
|
1914
1766
|
hideFromUI: !0,
|
|
1915
1767
|
type: "boolean"
|
|
1916
1768
|
}]
|
|
1917
|
-
}, componentInfo$
|
|
1769
|
+
}, componentInfo$8 = {
|
|
1918
1770
|
name: "Text",
|
|
1919
1771
|
static: !0,
|
|
1920
1772
|
isRSC: !0,
|
|
@@ -1946,70 +1798,786 @@ function Text(e) {
|
|
|
1946
1798
|
}
|
|
1947
1799
|
);
|
|
1948
1800
|
}
|
|
1949
|
-
const componentInfo = {
|
|
1950
|
-
name: "
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
minHeight: "20px",
|
|
1954
|
-
minWidth: "20px"
|
|
1955
|
-
},
|
|
1956
|
-
image: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-videocam-24px%20(1).svg?alt=media&token=49a84e4a-b20e-4977-a650-047f986874bb",
|
|
1801
|
+
const componentInfo$7 = {
|
|
1802
|
+
name: "Custom Code",
|
|
1803
|
+
static: !0,
|
|
1804
|
+
requiredPermissions: ["editCode"],
|
|
1957
1805
|
inputs: [{
|
|
1958
|
-
name: "
|
|
1959
|
-
type: "
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
required: !0
|
|
1964
|
-
}, {
|
|
1965
|
-
name: "posterImage",
|
|
1966
|
-
type: "file",
|
|
1967
|
-
allowedFileTypes: ["jpeg", "png"],
|
|
1968
|
-
helperText: "Image to show before the video plays"
|
|
1969
|
-
}, {
|
|
1970
|
-
name: "autoPlay",
|
|
1971
|
-
type: "boolean",
|
|
1972
|
-
defaultValue: !0
|
|
1973
|
-
}, {
|
|
1974
|
-
name: "controls",
|
|
1975
|
-
type: "boolean",
|
|
1976
|
-
defaultValue: !1
|
|
1977
|
-
}, {
|
|
1978
|
-
name: "muted",
|
|
1979
|
-
type: "boolean",
|
|
1980
|
-
defaultValue: !0
|
|
1981
|
-
}, {
|
|
1982
|
-
name: "loop",
|
|
1983
|
-
type: "boolean",
|
|
1984
|
-
defaultValue: !0
|
|
1985
|
-
}, {
|
|
1986
|
-
name: "playsInline",
|
|
1987
|
-
type: "boolean",
|
|
1988
|
-
defaultValue: !0
|
|
1989
|
-
}, {
|
|
1990
|
-
name: "fit",
|
|
1991
|
-
type: "text",
|
|
1992
|
-
defaultValue: "cover",
|
|
1993
|
-
enum: ["contain", "cover", "fill", "auto"]
|
|
1994
|
-
}, {
|
|
1995
|
-
name: "preload",
|
|
1996
|
-
type: "text",
|
|
1997
|
-
defaultValue: "metadata",
|
|
1998
|
-
enum: ["auto", "metadata", "none"]
|
|
1806
|
+
name: "code",
|
|
1807
|
+
type: "html",
|
|
1808
|
+
required: !0,
|
|
1809
|
+
defaultValue: "<p>Hello there, I am custom HTML code!</p>",
|
|
1810
|
+
code: !0
|
|
1999
1811
|
}, {
|
|
2000
|
-
name: "
|
|
1812
|
+
name: "replaceNodes",
|
|
2001
1813
|
type: "boolean",
|
|
2002
|
-
helperText: "
|
|
2003
|
-
defaultValue: !0,
|
|
1814
|
+
helperText: "Preserve server rendered dom nodes",
|
|
2004
1815
|
advanced: !0
|
|
2005
1816
|
}, {
|
|
2006
|
-
name: "
|
|
2007
|
-
type: "
|
|
2008
|
-
defaultValue:
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
1817
|
+
name: "scriptsClientOnly",
|
|
1818
|
+
type: "boolean",
|
|
1819
|
+
defaultValue: !1,
|
|
1820
|
+
helperText: "Only print and run scripts on the client. Important when scripts influence DOM that could be replaced when client loads",
|
|
1821
|
+
advanced: !0
|
|
1822
|
+
}]
|
|
1823
|
+
};
|
|
1824
|
+
function CustomCode(e) {
|
|
1825
|
+
const t = useRef(null), [n, o] = useState(() => []), [i, a] = useState(() => []);
|
|
1826
|
+
return useEffect(() => {
|
|
1827
|
+
var s;
|
|
1828
|
+
if (!((s = t.current) != null && s.getElementsByTagName) || typeof window == "undefined")
|
|
1829
|
+
return;
|
|
1830
|
+
const r = t.current.getElementsByTagName("script");
|
|
1831
|
+
for (let l = 0; l < r.length; l++) {
|
|
1832
|
+
const c = r[l];
|
|
1833
|
+
if (c.src) {
|
|
1834
|
+
if (n.includes(c.src))
|
|
1835
|
+
continue;
|
|
1836
|
+
n.push(c.src);
|
|
1837
|
+
const u = document.createElement("script");
|
|
1838
|
+
u.async = !0, u.src = c.src, document.head.appendChild(u);
|
|
1839
|
+
} else if (!c.type || [
|
|
1840
|
+
"text/javascript",
|
|
1841
|
+
"application/javascript",
|
|
1842
|
+
"application/ecmascript"
|
|
1843
|
+
].includes(c.type)) {
|
|
1844
|
+
if (i.includes(c.innerText))
|
|
1845
|
+
continue;
|
|
1846
|
+
try {
|
|
1847
|
+
i.push(c.innerText), new Function(c.innerText)();
|
|
1848
|
+
} catch (u) {
|
|
1849
|
+
console.warn("`CustomCode`: Error running script:", u);
|
|
1850
|
+
}
|
|
1851
|
+
}
|
|
1852
|
+
}
|
|
1853
|
+
}, []), /* @__PURE__ */ jsx(
|
|
1854
|
+
"div",
|
|
1855
|
+
{
|
|
1856
|
+
ref: t,
|
|
1857
|
+
className: "builder-custom-code" + (e.replaceNodes ? " replace-nodes" : ""),
|
|
1858
|
+
dangerouslySetInnerHTML: { __html: e.code }
|
|
1859
|
+
}
|
|
1860
|
+
);
|
|
1861
|
+
}
|
|
1862
|
+
const componentInfo$6 = {
|
|
1863
|
+
name: "Embed",
|
|
1864
|
+
static: !0,
|
|
1865
|
+
inputs: [{
|
|
1866
|
+
name: "url",
|
|
1867
|
+
type: "url",
|
|
1868
|
+
required: !0,
|
|
1869
|
+
defaultValue: "",
|
|
1870
|
+
helperText: "e.g. enter a youtube url, google map, etc",
|
|
1871
|
+
onChange: (e) => {
|
|
1872
|
+
const t = e.get("url");
|
|
1873
|
+
if (t)
|
|
1874
|
+
return e.set("content", "Loading..."), fetch(`https://iframe.ly/api/iframely?url=${t}&api_key=ae0e60e78201a3f2b0de4b`).then((o) => o.json()).then((o) => {
|
|
1875
|
+
e.get("url") === t && (o.html ? e.set("content", o.html) : e.set("content", "Invalid url, please try another"));
|
|
1876
|
+
}).catch((o) => {
|
|
1877
|
+
e.set("content", "There was an error embedding this URL, please try again or another URL");
|
|
1878
|
+
});
|
|
1879
|
+
e.delete("content");
|
|
1880
|
+
}
|
|
1881
|
+
}, {
|
|
1882
|
+
name: "content",
|
|
1883
|
+
type: "html",
|
|
1884
|
+
defaultValue: '<div style="padding: 20px; text-align: center">(Choose an embed URL)<div>',
|
|
1885
|
+
hideFromUI: !0
|
|
1886
|
+
}]
|
|
1887
|
+
}, SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"], isJsScript = (e) => SCRIPT_MIME_TYPES.includes(e.type);
|
|
1888
|
+
function Embed(e) {
|
|
1889
|
+
const t = useRef(null), [n, o] = useState(() => []), [i, a] = useState(() => []), [r, s] = useState(() => !1);
|
|
1890
|
+
function l() {
|
|
1891
|
+
if (!t.current || !t.current.getElementsByTagName)
|
|
1892
|
+
return;
|
|
1893
|
+
const c = t.current.getElementsByTagName("script");
|
|
1894
|
+
for (let u = 0; u < c.length; u++) {
|
|
1895
|
+
const y = c[u];
|
|
1896
|
+
if (y.src && !n.includes(y.src)) {
|
|
1897
|
+
n.push(y.src);
|
|
1898
|
+
const x = document.createElement("script");
|
|
1899
|
+
x.async = !0, x.src = y.src, document.head.appendChild(x);
|
|
1900
|
+
} else if (isJsScript(y) && !i.includes(y.innerText))
|
|
1901
|
+
try {
|
|
1902
|
+
i.push(y.innerText), new Function(y.innerText)();
|
|
1903
|
+
} catch (x) {
|
|
1904
|
+
console.warn("`Embed`: Error running script:", x);
|
|
1905
|
+
}
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
return useEffect(() => {
|
|
1909
|
+
t.current && !r && (s(!0), l());
|
|
1910
|
+
}, [t.current, r]), /* @__PURE__ */ jsx(
|
|
1911
|
+
"div",
|
|
1912
|
+
{
|
|
1913
|
+
className: "builder-embed",
|
|
1914
|
+
ref: t,
|
|
1915
|
+
dangerouslySetInnerHTML: { __html: e.content }
|
|
1916
|
+
}
|
|
1917
|
+
);
|
|
1918
|
+
}
|
|
1919
|
+
const componentInfo$5 = {
|
|
1920
|
+
name: "Form:Form",
|
|
1921
|
+
// editableTags: ['builder-form-error']
|
|
1922
|
+
defaults: {
|
|
1923
|
+
responsiveStyles: {
|
|
1924
|
+
large: {
|
|
1925
|
+
marginTop: "15px",
|
|
1926
|
+
paddingBottom: "15px"
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1929
|
+
},
|
|
1930
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fef36d2a846134910b64b88e6d18c5ca5",
|
|
1931
|
+
inputs: [{
|
|
1932
|
+
name: "sendSubmissionsTo",
|
|
1933
|
+
type: "string",
|
|
1934
|
+
// TODO: save to builder data and user can download as csv
|
|
1935
|
+
// TODO: easy for mode too or computed add/remove fields form mode
|
|
1936
|
+
// so you can edit details and high level mode at same time...
|
|
1937
|
+
// Later - more integrations like mailchimp
|
|
1938
|
+
// /api/v1/form-submit?to=mailchimp
|
|
1939
|
+
enum: [{
|
|
1940
|
+
label: "Send to email",
|
|
1941
|
+
value: "email",
|
|
1942
|
+
helperText: "Send form submissions to the email address of your choosing"
|
|
1943
|
+
}, {
|
|
1944
|
+
label: "Custom",
|
|
1945
|
+
value: "custom",
|
|
1946
|
+
helperText: "Handle where the form requests go manually with a little code, e.g. to your own custom backend"
|
|
1947
|
+
}],
|
|
1948
|
+
defaultValue: "email"
|
|
1949
|
+
}, {
|
|
1950
|
+
name: "sendSubmissionsToEmail",
|
|
1951
|
+
type: "string",
|
|
1952
|
+
required: !0,
|
|
1953
|
+
// TODO: required: () => options.get("sendSubmissionsTo") === "email"
|
|
1954
|
+
defaultValue: "your@email.com",
|
|
1955
|
+
showIf: 'options.get("sendSubmissionsTo") === "email"'
|
|
1956
|
+
}, {
|
|
1957
|
+
name: "sendWithJs",
|
|
1958
|
+
type: "boolean",
|
|
1959
|
+
helperText: "Set to false to use basic html form action",
|
|
1960
|
+
defaultValue: !0,
|
|
1961
|
+
showIf: 'options.get("sendSubmissionsTo") === "custom"'
|
|
1962
|
+
}, {
|
|
1963
|
+
name: "name",
|
|
1964
|
+
type: "string",
|
|
1965
|
+
defaultValue: "My form"
|
|
1966
|
+
// advanced: true
|
|
1967
|
+
}, {
|
|
1968
|
+
name: "action",
|
|
1969
|
+
type: "string",
|
|
1970
|
+
helperText: "URL to send the form data to",
|
|
1971
|
+
showIf: 'options.get("sendSubmissionsTo") === "custom"'
|
|
1972
|
+
}, {
|
|
1973
|
+
name: "contentType",
|
|
1974
|
+
type: "string",
|
|
1975
|
+
defaultValue: "application/json",
|
|
1976
|
+
advanced: !0,
|
|
1977
|
+
// TODO: do automatically if file input
|
|
1978
|
+
enum: ["application/json", "multipart/form-data", "application/x-www-form-urlencoded"],
|
|
1979
|
+
showIf: 'options.get("sendSubmissionsTo") === "custom" && options.get("sendWithJs") === true'
|
|
1980
|
+
}, {
|
|
1981
|
+
name: "method",
|
|
1982
|
+
type: "string",
|
|
1983
|
+
showIf: 'options.get("sendSubmissionsTo") === "custom"',
|
|
1984
|
+
defaultValue: "POST",
|
|
1985
|
+
advanced: !0
|
|
1986
|
+
}, {
|
|
1987
|
+
name: "previewState",
|
|
1988
|
+
type: "string",
|
|
1989
|
+
// TODO: persist: false flag
|
|
1990
|
+
enum: ["unsubmitted", "sending", "success", "error"],
|
|
1991
|
+
defaultValue: "unsubmitted",
|
|
1992
|
+
helperText: 'Choose a state to edit, e.g. choose "success" to show what users see on success and edit the message',
|
|
1993
|
+
showIf: 'options.get("sendSubmissionsTo") !== "zapier" && options.get("sendWithJs") === true'
|
|
1994
|
+
}, {
|
|
1995
|
+
name: "successUrl",
|
|
1996
|
+
type: "url",
|
|
1997
|
+
helperText: "Optional URL to redirect the user to on form submission success",
|
|
1998
|
+
showIf: 'options.get("sendSubmissionsTo") !== "zapier" && options.get("sendWithJs") === true'
|
|
1999
|
+
}, {
|
|
2000
|
+
name: "resetFormOnSubmit",
|
|
2001
|
+
type: "boolean",
|
|
2002
|
+
showIf: "options.get('sendSubmissionsTo') === 'custom' && options.get('sendWithJs') === true",
|
|
2003
|
+
advanced: !0
|
|
2004
|
+
}, {
|
|
2005
|
+
name: "successMessage",
|
|
2006
|
+
type: "uiBlocks",
|
|
2007
|
+
hideFromUI: !0,
|
|
2008
|
+
defaultValue: [{
|
|
2009
|
+
"@type": "@builder.io/sdk:Element",
|
|
2010
|
+
responsiveStyles: {
|
|
2011
|
+
large: {
|
|
2012
|
+
marginTop: "10px"
|
|
2013
|
+
}
|
|
2014
|
+
},
|
|
2015
|
+
component: {
|
|
2016
|
+
name: "Text",
|
|
2017
|
+
options: {
|
|
2018
|
+
text: "<span>Thanks!</span>"
|
|
2019
|
+
}
|
|
2020
|
+
}
|
|
2021
|
+
}]
|
|
2022
|
+
}, {
|
|
2023
|
+
name: "validate",
|
|
2024
|
+
type: "boolean",
|
|
2025
|
+
defaultValue: !0,
|
|
2026
|
+
advanced: !0
|
|
2027
|
+
}, {
|
|
2028
|
+
name: "errorMessagePath",
|
|
2029
|
+
type: "text",
|
|
2030
|
+
advanced: !0,
|
|
2031
|
+
helperText: 'Path to where to get the error message from in a JSON response to display to the user, e.g. "error.message" for a response like { "error": { "message": "this username is taken" }}'
|
|
2032
|
+
}, {
|
|
2033
|
+
name: "errorMessage",
|
|
2034
|
+
type: "uiBlocks",
|
|
2035
|
+
hideFromUI: !0,
|
|
2036
|
+
defaultValue: [{
|
|
2037
|
+
"@type": "@builder.io/sdk:Element",
|
|
2038
|
+
responsiveStyles: {
|
|
2039
|
+
large: {
|
|
2040
|
+
marginTop: "10px"
|
|
2041
|
+
}
|
|
2042
|
+
},
|
|
2043
|
+
bindings: {
|
|
2044
|
+
"component.options.text": "state.formErrorMessage || block.component.options.text"
|
|
2045
|
+
},
|
|
2046
|
+
component: {
|
|
2047
|
+
name: "Text",
|
|
2048
|
+
options: {
|
|
2049
|
+
text: "<span>Form submission error :( Please check your answers and try again</span>"
|
|
2050
|
+
}
|
|
2051
|
+
}
|
|
2052
|
+
}]
|
|
2053
|
+
}, {
|
|
2054
|
+
name: "sendingMessage",
|
|
2055
|
+
type: "uiBlocks",
|
|
2056
|
+
hideFromUI: !0,
|
|
2057
|
+
defaultValue: [{
|
|
2058
|
+
"@type": "@builder.io/sdk:Element",
|
|
2059
|
+
responsiveStyles: {
|
|
2060
|
+
large: {
|
|
2061
|
+
marginTop: "10px"
|
|
2062
|
+
}
|
|
2063
|
+
},
|
|
2064
|
+
component: {
|
|
2065
|
+
name: "Text",
|
|
2066
|
+
options: {
|
|
2067
|
+
text: "<span>Sending...</span>"
|
|
2068
|
+
}
|
|
2069
|
+
}
|
|
2070
|
+
}]
|
|
2071
|
+
}, {
|
|
2072
|
+
name: "customHeaders",
|
|
2073
|
+
type: "map",
|
|
2074
|
+
valueType: {
|
|
2075
|
+
type: "string"
|
|
2076
|
+
},
|
|
2077
|
+
advanced: !0,
|
|
2078
|
+
showIf: 'options.get("sendSubmissionsTo") === "custom" && options.get("sendWithJs") === true'
|
|
2079
|
+
}],
|
|
2080
|
+
noWrap: !0,
|
|
2081
|
+
canHaveChildren: !0,
|
|
2082
|
+
defaultChildren: [{
|
|
2083
|
+
"@type": "@builder.io/sdk:Element",
|
|
2084
|
+
responsiveStyles: {
|
|
2085
|
+
large: {
|
|
2086
|
+
marginTop: "10px"
|
|
2087
|
+
}
|
|
2088
|
+
},
|
|
2089
|
+
component: {
|
|
2090
|
+
name: "Text",
|
|
2091
|
+
options: {
|
|
2092
|
+
text: "<span>Enter your name</span>"
|
|
2093
|
+
}
|
|
2094
|
+
}
|
|
2095
|
+
}, {
|
|
2096
|
+
"@type": "@builder.io/sdk:Element",
|
|
2097
|
+
responsiveStyles: {
|
|
2098
|
+
large: {
|
|
2099
|
+
marginTop: "10px"
|
|
2100
|
+
}
|
|
2101
|
+
},
|
|
2102
|
+
component: {
|
|
2103
|
+
name: "Form:Input",
|
|
2104
|
+
options: {
|
|
2105
|
+
name: "name",
|
|
2106
|
+
placeholder: "Jane Doe"
|
|
2107
|
+
}
|
|
2108
|
+
}
|
|
2109
|
+
}, {
|
|
2110
|
+
"@type": "@builder.io/sdk:Element",
|
|
2111
|
+
responsiveStyles: {
|
|
2112
|
+
large: {
|
|
2113
|
+
marginTop: "10px"
|
|
2114
|
+
}
|
|
2115
|
+
},
|
|
2116
|
+
component: {
|
|
2117
|
+
name: "Text",
|
|
2118
|
+
options: {
|
|
2119
|
+
text: "<span>Enter your email</span>"
|
|
2120
|
+
}
|
|
2121
|
+
}
|
|
2122
|
+
}, {
|
|
2123
|
+
"@type": "@builder.io/sdk:Element",
|
|
2124
|
+
responsiveStyles: {
|
|
2125
|
+
large: {
|
|
2126
|
+
marginTop: "10px"
|
|
2127
|
+
}
|
|
2128
|
+
},
|
|
2129
|
+
component: {
|
|
2130
|
+
name: "Form:Input",
|
|
2131
|
+
options: {
|
|
2132
|
+
name: "email",
|
|
2133
|
+
placeholder: "jane@doe.com"
|
|
2134
|
+
}
|
|
2135
|
+
}
|
|
2136
|
+
}, {
|
|
2137
|
+
"@type": "@builder.io/sdk:Element",
|
|
2138
|
+
responsiveStyles: {
|
|
2139
|
+
large: {
|
|
2140
|
+
marginTop: "10px"
|
|
2141
|
+
}
|
|
2142
|
+
},
|
|
2143
|
+
component: {
|
|
2144
|
+
name: "Form:SubmitButton",
|
|
2145
|
+
options: {
|
|
2146
|
+
text: "Submit"
|
|
2147
|
+
}
|
|
2148
|
+
}
|
|
2149
|
+
}]
|
|
2150
|
+
}, validEnvList = ["production", "qa", "test", "development", "dev", "cdn-qa", "cloud", "fast", "cdn2", "cdn-prod"], getEnv = () => {
|
|
2151
|
+
const e = process.env.NODE_ENV || "production";
|
|
2152
|
+
return validEnvList.includes(e) ? e : "production";
|
|
2153
|
+
}, get = (e, t, n) => {
|
|
2154
|
+
const o = String.prototype.split.call(t, /[,[\].]+?/).filter(Boolean).reduce((i, a) => i != null ? i[a] : i, e);
|
|
2155
|
+
return o === void 0 || o === e ? n : o;
|
|
2156
|
+
};
|
|
2157
|
+
function FormComponent(e) {
|
|
2158
|
+
var y, x;
|
|
2159
|
+
const t = useRef(null), [n, o] = useState(() => "unsubmitted"), [i, a] = useState(() => null), [r, s] = useState(() => "");
|
|
2160
|
+
function l(d) {
|
|
2161
|
+
var b, I;
|
|
2162
|
+
const m = {
|
|
2163
|
+
...e.builderContext.rootState,
|
|
2164
|
+
...d
|
|
2165
|
+
};
|
|
2166
|
+
e.builderContext.rootSetState ? (I = (b = e.builderContext).rootSetState) == null || I.call(b, m) : e.builderContext.rootState = m;
|
|
2167
|
+
}
|
|
2168
|
+
function c() {
|
|
2169
|
+
return isEditing() && e.previewState || n;
|
|
2170
|
+
}
|
|
2171
|
+
function u(d) {
|
|
2172
|
+
var b;
|
|
2173
|
+
const m = e.sendWithJs || e.sendSubmissionsTo === "email";
|
|
2174
|
+
if (e.sendSubmissionsTo === "zapier")
|
|
2175
|
+
d.preventDefault();
|
|
2176
|
+
else if (m) {
|
|
2177
|
+
if (!(e.action || e.sendSubmissionsTo === "email")) {
|
|
2178
|
+
d.preventDefault();
|
|
2179
|
+
return;
|
|
2180
|
+
}
|
|
2181
|
+
d.preventDefault();
|
|
2182
|
+
const I = d.currentTarget, R = e.customHeaders || {};
|
|
2183
|
+
let S;
|
|
2184
|
+
const k = new FormData(I), w = Array.from(
|
|
2185
|
+
d.currentTarget.querySelectorAll("input,select,textarea")
|
|
2186
|
+
).filter((f) => !!f.name).map((f) => {
|
|
2187
|
+
let C;
|
|
2188
|
+
const F = f.name;
|
|
2189
|
+
if (f instanceof HTMLInputElement)
|
|
2190
|
+
if (f.type === "radio") {
|
|
2191
|
+
if (f.checked)
|
|
2192
|
+
return C = f.name, {
|
|
2193
|
+
key: F,
|
|
2194
|
+
value: C
|
|
2195
|
+
};
|
|
2196
|
+
} else if (f.type === "checkbox")
|
|
2197
|
+
C = f.checked;
|
|
2198
|
+
else if (f.type === "number" || f.type === "range") {
|
|
2199
|
+
const j = f.valueAsNumber;
|
|
2200
|
+
isNaN(j) || (C = j);
|
|
2201
|
+
} else
|
|
2202
|
+
f.type === "file" ? C = f.files : C = f.value;
|
|
2203
|
+
else
|
|
2204
|
+
C = f.value;
|
|
2205
|
+
return {
|
|
2206
|
+
key: F,
|
|
2207
|
+
value: C
|
|
2208
|
+
};
|
|
2209
|
+
});
|
|
2210
|
+
let E = e.contentType;
|
|
2211
|
+
if (e.sendSubmissionsTo === "email" && (E = "multipart/form-data"), Array.from(w).forEach(({ value: f }) => {
|
|
2212
|
+
(f instanceof File || Array.isArray(f) && f[0] instanceof File || f instanceof FileList) && (E = "multipart/form-data");
|
|
2213
|
+
}), E !== "application/json")
|
|
2214
|
+
S = k;
|
|
2215
|
+
else {
|
|
2216
|
+
const f = {};
|
|
2217
|
+
Array.from(w).forEach(({ value: C, key: F }) => {
|
|
2218
|
+
set(f, F, C);
|
|
2219
|
+
}), S = JSON.stringify(f);
|
|
2220
|
+
}
|
|
2221
|
+
E && E !== "multipart/form-data" && (m && ((b = e.action) != null && b.includes("zapier.com")) || (R["content-type"] = E));
|
|
2222
|
+
const B = new CustomEvent("presubmit", { detail: { body: S } });
|
|
2223
|
+
if (t.current && (t.current.dispatchEvent(B), B.defaultPrevented))
|
|
2224
|
+
return;
|
|
2225
|
+
o("sending");
|
|
2226
|
+
const A = `${getEnv() === "dev" ? "http://localhost:5000" : "https://builder.io"}/api/v1/form-submit?apiKey=${e.builderContext.apiKey}&to=${btoa(
|
|
2227
|
+
e.sendSubmissionsToEmail || ""
|
|
2228
|
+
)}&name=${encodeURIComponent(e.name || "")}`;
|
|
2229
|
+
fetch(
|
|
2230
|
+
e.sendSubmissionsTo === "email" ? A : e.action,
|
|
2231
|
+
{ body: S, headers: R, method: e.method || "post" }
|
|
2232
|
+
).then(
|
|
2233
|
+
async (f) => {
|
|
2234
|
+
let C;
|
|
2235
|
+
const F = f.headers.get("content-type");
|
|
2236
|
+
if (F && F.indexOf("application/json") !== -1 ? C = await f.json() : C = await f.text(), !f.ok && e.errorMessagePath) {
|
|
2237
|
+
let j = get(C, e.errorMessagePath);
|
|
2238
|
+
j && (typeof j != "string" && (j = JSON.stringify(j)), s(j), l({ formErrorMessage: j }));
|
|
2239
|
+
}
|
|
2240
|
+
if (a(C), o(f.ok ? "success" : "error"), f.ok) {
|
|
2241
|
+
const j = new CustomEvent("submit:success", {
|
|
2242
|
+
detail: { res: f, body: C }
|
|
2243
|
+
});
|
|
2244
|
+
if (t.current) {
|
|
2245
|
+
if (t.current.dispatchEvent(j), j.defaultPrevented)
|
|
2246
|
+
return;
|
|
2247
|
+
e.resetFormOnSubmit !== !1 && t.current.reset();
|
|
2248
|
+
}
|
|
2249
|
+
if (e.successUrl)
|
|
2250
|
+
if (t.current) {
|
|
2251
|
+
const V = new CustomEvent("route", {
|
|
2252
|
+
detail: { url: e.successUrl }
|
|
2253
|
+
});
|
|
2254
|
+
t.current.dispatchEvent(V), V.defaultPrevented || (location.href = e.successUrl);
|
|
2255
|
+
} else
|
|
2256
|
+
location.href = e.successUrl;
|
|
2257
|
+
}
|
|
2258
|
+
},
|
|
2259
|
+
(f) => {
|
|
2260
|
+
const C = new CustomEvent("submit:error", {
|
|
2261
|
+
detail: { error: f }
|
|
2262
|
+
});
|
|
2263
|
+
t.current && (t.current.dispatchEvent(C), C.defaultPrevented) || (a(f), o("error"));
|
|
2264
|
+
}
|
|
2265
|
+
);
|
|
2266
|
+
}
|
|
2267
|
+
}
|
|
2268
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2269
|
+
" ",
|
|
2270
|
+
/* @__PURE__ */ jsxs(
|
|
2271
|
+
"form",
|
|
2272
|
+
{
|
|
2273
|
+
validate: e.validate,
|
|
2274
|
+
ref: t,
|
|
2275
|
+
action: !e.sendWithJs && e.action,
|
|
2276
|
+
method: e.method,
|
|
2277
|
+
name: e.name,
|
|
2278
|
+
onSubmit: (d) => u(d),
|
|
2279
|
+
...e.attributes,
|
|
2280
|
+
children: [
|
|
2281
|
+
" ",
|
|
2282
|
+
e.builderBlock && e.builderBlock.children ? /* @__PURE__ */ jsx(Fragment, { children: (x = (y = e.builderBlock) == null ? void 0 : y.children) == null ? void 0 : x.map((d, m) => /* @__PURE__ */ jsx(
|
|
2283
|
+
Block,
|
|
2284
|
+
{
|
|
2285
|
+
block: d,
|
|
2286
|
+
context: e.builderContext,
|
|
2287
|
+
registeredComponents: e.builderComponents,
|
|
2288
|
+
linkComponent: e.builderLinkComponent
|
|
2289
|
+
},
|
|
2290
|
+
`form-block-${m}`
|
|
2291
|
+
)) }) : null,
|
|
2292
|
+
" ",
|
|
2293
|
+
c() === "error" ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
2294
|
+
Blocks,
|
|
2295
|
+
{
|
|
2296
|
+
path: "errorMessage",
|
|
2297
|
+
blocks: e.errorMessage,
|
|
2298
|
+
context: e.builderContext
|
|
2299
|
+
}
|
|
2300
|
+
) }) : null,
|
|
2301
|
+
" ",
|
|
2302
|
+
c() === "sending" ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
2303
|
+
Blocks,
|
|
2304
|
+
{
|
|
2305
|
+
path: "sendingMessage",
|
|
2306
|
+
blocks: e.sendingMessage,
|
|
2307
|
+
context: e.builderContext
|
|
2308
|
+
}
|
|
2309
|
+
) }) : null,
|
|
2310
|
+
" ",
|
|
2311
|
+
c() === "error" && i ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("pre", { className: "builder-form-error-text pre-8fbb5280", children: [
|
|
2312
|
+
" ",
|
|
2313
|
+
JSON.stringify(i, null, 2),
|
|
2314
|
+
" "
|
|
2315
|
+
] }) }) : null,
|
|
2316
|
+
" ",
|
|
2317
|
+
c() === "success" ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
2318
|
+
Blocks,
|
|
2319
|
+
{
|
|
2320
|
+
path: "successMessage",
|
|
2321
|
+
blocks: e.successMessage,
|
|
2322
|
+
context: e.builderContext
|
|
2323
|
+
}
|
|
2324
|
+
) }) : null,
|
|
2325
|
+
" "
|
|
2326
|
+
]
|
|
2327
|
+
}
|
|
2328
|
+
),
|
|
2329
|
+
" ",
|
|
2330
|
+
/* @__PURE__ */ jsx("style", { children: ".pre-8fbb5280 { padding: 10px; color: red; text-align: center; }" }),
|
|
2331
|
+
" "
|
|
2332
|
+
] });
|
|
2333
|
+
}
|
|
2334
|
+
const componentInfo$4 = {
|
|
2335
|
+
name: "Form:Input",
|
|
2336
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fad6f37889d9e40bbbbc72cdb5875d6ca",
|
|
2337
|
+
inputs: [
|
|
2338
|
+
{
|
|
2339
|
+
name: "type",
|
|
2340
|
+
type: "text",
|
|
2341
|
+
enum: ["text", "number", "email", "url", "checkbox", "radio", "range", "date", "datetime-local", "search", "tel", "time", "file", "month", "week", "password", "color", "hidden"],
|
|
2342
|
+
defaultValue: "text"
|
|
2343
|
+
},
|
|
2344
|
+
{
|
|
2345
|
+
name: "name",
|
|
2346
|
+
type: "string",
|
|
2347
|
+
required: !0,
|
|
2348
|
+
helperText: 'Every input in a form needs a unique name describing what it takes, e.g. "email"'
|
|
2349
|
+
},
|
|
2350
|
+
{
|
|
2351
|
+
name: "placeholder",
|
|
2352
|
+
type: "string",
|
|
2353
|
+
defaultValue: "Hello there",
|
|
2354
|
+
helperText: "Text to display when there is no value"
|
|
2355
|
+
},
|
|
2356
|
+
// TODO: handle value vs default value automatically like ng-model
|
|
2357
|
+
{
|
|
2358
|
+
name: "defaultValue",
|
|
2359
|
+
type: "string"
|
|
2360
|
+
},
|
|
2361
|
+
{
|
|
2362
|
+
name: "value",
|
|
2363
|
+
type: "string",
|
|
2364
|
+
advanced: !0
|
|
2365
|
+
},
|
|
2366
|
+
{
|
|
2367
|
+
name: "required",
|
|
2368
|
+
type: "boolean",
|
|
2369
|
+
helperText: "Is this input required to be filled out to submit a form",
|
|
2370
|
+
defaultValue: !1
|
|
2371
|
+
}
|
|
2372
|
+
],
|
|
2373
|
+
noWrap: !0,
|
|
2374
|
+
static: !0,
|
|
2375
|
+
defaultStyles: {
|
|
2376
|
+
paddingTop: "10px",
|
|
2377
|
+
paddingBottom: "10px",
|
|
2378
|
+
paddingLeft: "10px",
|
|
2379
|
+
paddingRight: "10px",
|
|
2380
|
+
borderRadius: "3px",
|
|
2381
|
+
borderWidth: "1px",
|
|
2382
|
+
borderStyle: "solid",
|
|
2383
|
+
borderColor: "#ccc"
|
|
2384
|
+
}
|
|
2385
|
+
};
|
|
2386
|
+
function FormInputComponent(e) {
|
|
2387
|
+
return /* @__PURE__ */ createElement(
|
|
2388
|
+
"input",
|
|
2389
|
+
{
|
|
2390
|
+
...e.attributes,
|
|
2391
|
+
key: isEditing() && e.defaultValue ? e.defaultValue : "default-key",
|
|
2392
|
+
placeholder: e.placeholder,
|
|
2393
|
+
type: e.type,
|
|
2394
|
+
name: e.name,
|
|
2395
|
+
value: e.value,
|
|
2396
|
+
defaultValue: e.defaultValue,
|
|
2397
|
+
required: e.required
|
|
2398
|
+
}
|
|
2399
|
+
);
|
|
2400
|
+
}
|
|
2401
|
+
const componentInfo$3 = {
|
|
2402
|
+
name: "Form:Select",
|
|
2403
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F83acca093fb24aaf94dee136e9a4b045",
|
|
2404
|
+
defaultStyles: {
|
|
2405
|
+
alignSelf: "flex-start"
|
|
2406
|
+
},
|
|
2407
|
+
inputs: [{
|
|
2408
|
+
name: "options",
|
|
2409
|
+
type: "list",
|
|
2410
|
+
required: !0,
|
|
2411
|
+
subFields: [{
|
|
2412
|
+
name: "value",
|
|
2413
|
+
type: "text",
|
|
2414
|
+
required: !0
|
|
2415
|
+
}, {
|
|
2416
|
+
name: "name",
|
|
2417
|
+
type: "text"
|
|
2418
|
+
}],
|
|
2419
|
+
defaultValue: [{
|
|
2420
|
+
value: "option 1"
|
|
2421
|
+
}, {
|
|
2422
|
+
value: "option 2"
|
|
2423
|
+
}]
|
|
2424
|
+
}, {
|
|
2425
|
+
name: "name",
|
|
2426
|
+
type: "string",
|
|
2427
|
+
required: !0,
|
|
2428
|
+
helperText: 'Every select in a form needs a unique name describing what it gets, e.g. "email"'
|
|
2429
|
+
}, {
|
|
2430
|
+
name: "defaultValue",
|
|
2431
|
+
type: "string"
|
|
2432
|
+
}, {
|
|
2433
|
+
name: "value",
|
|
2434
|
+
type: "string",
|
|
2435
|
+
advanced: !0
|
|
2436
|
+
}, {
|
|
2437
|
+
name: "required",
|
|
2438
|
+
type: "boolean",
|
|
2439
|
+
defaultValue: !1
|
|
2440
|
+
}],
|
|
2441
|
+
static: !0,
|
|
2442
|
+
noWrap: !0
|
|
2443
|
+
};
|
|
2444
|
+
function SelectComponent(e) {
|
|
2445
|
+
var t;
|
|
2446
|
+
return /* @__PURE__ */ createElement(
|
|
2447
|
+
"select",
|
|
2448
|
+
{
|
|
2449
|
+
...e.attributes,
|
|
2450
|
+
value: e.value,
|
|
2451
|
+
key: isEditing() && e.defaultValue ? e.defaultValue : "default-key",
|
|
2452
|
+
defaultValue: e.defaultValue,
|
|
2453
|
+
name: e.name
|
|
2454
|
+
},
|
|
2455
|
+
(t = e.options) == null ? void 0 : t.map((n) => /* @__PURE__ */ jsx("option", { value: n.value, children: n.name || n.value }))
|
|
2456
|
+
);
|
|
2457
|
+
}
|
|
2458
|
+
const componentInfo$2 = {
|
|
2459
|
+
name: "Form:SubmitButton",
|
|
2460
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fdf2820ffed1f4349a94c40b3221f5b98",
|
|
2461
|
+
defaultStyles: {
|
|
2462
|
+
appearance: "none",
|
|
2463
|
+
paddingTop: "15px",
|
|
2464
|
+
paddingBottom: "15px",
|
|
2465
|
+
paddingLeft: "25px",
|
|
2466
|
+
paddingRight: "25px",
|
|
2467
|
+
backgroundColor: "#3898EC",
|
|
2468
|
+
color: "white",
|
|
2469
|
+
borderRadius: "4px",
|
|
2470
|
+
cursor: "pointer"
|
|
2471
|
+
},
|
|
2472
|
+
inputs: [{
|
|
2473
|
+
name: "text",
|
|
2474
|
+
type: "text",
|
|
2475
|
+
defaultValue: "Click me"
|
|
2476
|
+
}],
|
|
2477
|
+
static: !0,
|
|
2478
|
+
noWrap: !0
|
|
2479
|
+
// TODO: optional children? maybe as optional form input
|
|
2480
|
+
// that only shows if advanced setting is flipped
|
|
2481
|
+
// TODO: defaultChildren
|
|
2482
|
+
// canHaveChildren: true,
|
|
2483
|
+
};
|
|
2484
|
+
function SubmitButton(e) {
|
|
2485
|
+
return /* @__PURE__ */ jsx("button", { type: "submit", ...e.attributes, children: e.text });
|
|
2486
|
+
}
|
|
2487
|
+
const componentInfo$1 = {
|
|
2488
|
+
// friendlyName?
|
|
2489
|
+
name: "Raw:Img",
|
|
2490
|
+
hideFromInsertMenu: !0,
|
|
2491
|
+
image: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4",
|
|
2492
|
+
inputs: [{
|
|
2493
|
+
name: "image",
|
|
2494
|
+
bubble: !0,
|
|
2495
|
+
type: "file",
|
|
2496
|
+
allowedFileTypes: ["jpeg", "jpg", "png", "svg", "gif", "webp"],
|
|
2497
|
+
required: !0
|
|
2498
|
+
}],
|
|
2499
|
+
noWrap: !0,
|
|
2500
|
+
static: !0
|
|
2501
|
+
};
|
|
2502
|
+
function ImgComponent(e) {
|
|
2503
|
+
return /* @__PURE__ */ jsx(
|
|
2504
|
+
"img",
|
|
2505
|
+
{
|
|
2506
|
+
style: {
|
|
2507
|
+
objectFit: e.backgroundSize || "cover",
|
|
2508
|
+
objectPosition: e.backgroundPosition || "center"
|
|
2509
|
+
},
|
|
2510
|
+
alt: e.altText,
|
|
2511
|
+
src: e.imgSrc || e.image,
|
|
2512
|
+
...e.attributes
|
|
2513
|
+
},
|
|
2514
|
+
isEditing() && e.imgSrc || "default-key"
|
|
2515
|
+
);
|
|
2516
|
+
}
|
|
2517
|
+
const componentInfo = {
|
|
2518
|
+
name: "Video",
|
|
2519
|
+
canHaveChildren: !0,
|
|
2520
|
+
defaultStyles: {
|
|
2521
|
+
minHeight: "20px",
|
|
2522
|
+
minWidth: "20px"
|
|
2523
|
+
},
|
|
2524
|
+
image: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-videocam-24px%20(1).svg?alt=media&token=49a84e4a-b20e-4977-a650-047f986874bb",
|
|
2525
|
+
inputs: [{
|
|
2526
|
+
name: "video",
|
|
2527
|
+
type: "file",
|
|
2528
|
+
allowedFileTypes: ["mp4"],
|
|
2529
|
+
bubble: !0,
|
|
2530
|
+
defaultValue: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/assets%2FKQlEmWDxA0coC3PK6UvkrjwkIGI2%2F28cb070609f546cdbe5efa20e931aa4b?alt=media&token=912e9551-7a7c-4dfb-86b6-3da1537d1a7f",
|
|
2531
|
+
required: !0
|
|
2532
|
+
}, {
|
|
2533
|
+
name: "posterImage",
|
|
2534
|
+
type: "file",
|
|
2535
|
+
allowedFileTypes: ["jpeg", "png"],
|
|
2536
|
+
helperText: "Image to show before the video plays"
|
|
2537
|
+
}, {
|
|
2538
|
+
name: "autoPlay",
|
|
2539
|
+
type: "boolean",
|
|
2540
|
+
defaultValue: !0
|
|
2541
|
+
}, {
|
|
2542
|
+
name: "controls",
|
|
2543
|
+
type: "boolean",
|
|
2544
|
+
defaultValue: !1
|
|
2545
|
+
}, {
|
|
2546
|
+
name: "muted",
|
|
2547
|
+
type: "boolean",
|
|
2548
|
+
defaultValue: !0
|
|
2549
|
+
}, {
|
|
2550
|
+
name: "loop",
|
|
2551
|
+
type: "boolean",
|
|
2552
|
+
defaultValue: !0
|
|
2553
|
+
}, {
|
|
2554
|
+
name: "playsInline",
|
|
2555
|
+
type: "boolean",
|
|
2556
|
+
defaultValue: !0
|
|
2557
|
+
}, {
|
|
2558
|
+
name: "fit",
|
|
2559
|
+
type: "text",
|
|
2560
|
+
defaultValue: "cover",
|
|
2561
|
+
enum: ["contain", "cover", "fill", "auto"]
|
|
2562
|
+
}, {
|
|
2563
|
+
name: "preload",
|
|
2564
|
+
type: "text",
|
|
2565
|
+
defaultValue: "metadata",
|
|
2566
|
+
enum: ["auto", "metadata", "none"]
|
|
2567
|
+
}, {
|
|
2568
|
+
name: "fitContent",
|
|
2569
|
+
type: "boolean",
|
|
2570
|
+
helperText: "When child blocks are provided, fit to them instead of using the aspect ratio",
|
|
2571
|
+
defaultValue: !0,
|
|
2572
|
+
advanced: !0
|
|
2573
|
+
}, {
|
|
2574
|
+
name: "position",
|
|
2575
|
+
type: "text",
|
|
2576
|
+
defaultValue: "center",
|
|
2577
|
+
enum: ["center", "top", "left", "right", "bottom", "top left", "top right", "bottom left", "bottom right"]
|
|
2578
|
+
}, {
|
|
2579
|
+
name: "height",
|
|
2580
|
+
type: "number",
|
|
2013
2581
|
advanced: !0
|
|
2014
2582
|
}, {
|
|
2015
2583
|
name: "width",
|
|
@@ -2029,7 +2597,7 @@ const componentInfo = {
|
|
|
2029
2597
|
}]
|
|
2030
2598
|
};
|
|
2031
2599
|
function Video(e) {
|
|
2032
|
-
var
|
|
2600
|
+
var o, i, a, r, s, l, c;
|
|
2033
2601
|
function t() {
|
|
2034
2602
|
return {
|
|
2035
2603
|
...e.autoPlay === !0 ? {
|
|
@@ -2070,7 +2638,7 @@ function Video(e) {
|
|
|
2070
2638
|
style: {
|
|
2071
2639
|
width: "100%",
|
|
2072
2640
|
height: "100%",
|
|
2073
|
-
...(
|
|
2641
|
+
...(o = e.attributes) == null ? void 0 : o.style,
|
|
2074
2642
|
objectFit: e.fit,
|
|
2075
2643
|
objectPosition: e.position,
|
|
2076
2644
|
// Hack to get object fit to work as expected and
|
|
@@ -2086,7 +2654,7 @@ function Video(e) {
|
|
|
2086
2654
|
children: e.lazyLoad ? null : /* @__PURE__ */ jsx("source", { type: "video/mp4", src: e.video })
|
|
2087
2655
|
}
|
|
2088
2656
|
),
|
|
2089
|
-
e.aspectRatio && !(e.fitContent && ((a = (
|
|
2657
|
+
e.aspectRatio && !(e.fitContent && ((a = (i = e.builderBlock) == null ? void 0 : i.children) != null && a.length)) ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
2090
2658
|
"div",
|
|
2091
2659
|
{
|
|
2092
2660
|
style: {
|
|
@@ -2129,43 +2697,55 @@ function Video(e) {
|
|
|
2129
2697
|
}
|
|
2130
2698
|
);
|
|
2131
2699
|
}
|
|
2132
|
-
const
|
|
2133
|
-
component: Button,
|
|
2134
|
-
...componentInfo$b
|
|
2135
|
-
}, {
|
|
2136
|
-
component: Columns,
|
|
2137
|
-
...componentInfo$a
|
|
2138
|
-
}, {
|
|
2700
|
+
const getExtraComponents = () => [{
|
|
2139
2701
|
component: CustomCode,
|
|
2140
|
-
...componentInfo$9
|
|
2141
|
-
}, {
|
|
2142
|
-
component: Embed,
|
|
2143
|
-
...componentInfo$8
|
|
2144
|
-
}, {
|
|
2145
|
-
component: FragmentComponent,
|
|
2146
2702
|
...componentInfo$7
|
|
2147
2703
|
}, {
|
|
2148
|
-
component:
|
|
2704
|
+
component: Embed,
|
|
2149
2705
|
...componentInfo$6
|
|
2150
2706
|
}, {
|
|
2151
|
-
component:
|
|
2707
|
+
component: FormComponent,
|
|
2152
2708
|
...componentInfo$5
|
|
2153
2709
|
}, {
|
|
2154
|
-
component:
|
|
2710
|
+
component: FormInputComponent,
|
|
2155
2711
|
...componentInfo$4
|
|
2156
2712
|
}, {
|
|
2157
|
-
component:
|
|
2713
|
+
component: SubmitButton,
|
|
2158
2714
|
...componentInfo$2
|
|
2159
2715
|
}, {
|
|
2160
|
-
component:
|
|
2716
|
+
component: SelectComponent,
|
|
2717
|
+
...componentInfo$3
|
|
2718
|
+
}, {
|
|
2719
|
+
component: ImgComponent,
|
|
2161
2720
|
...componentInfo$1
|
|
2162
2721
|
}, {
|
|
2163
2722
|
component: Video,
|
|
2164
2723
|
...componentInfo
|
|
2724
|
+
}], getDefaultRegisteredComponents = () => [{
|
|
2725
|
+
component: Button,
|
|
2726
|
+
...componentInfo$f
|
|
2727
|
+
}, {
|
|
2728
|
+
component: Columns,
|
|
2729
|
+
...componentInfo$e
|
|
2730
|
+
}, {
|
|
2731
|
+
component: FragmentComponent,
|
|
2732
|
+
...componentInfo$d
|
|
2733
|
+
}, {
|
|
2734
|
+
component: Image,
|
|
2735
|
+
...componentInfo$c
|
|
2736
|
+
}, {
|
|
2737
|
+
component: SectionComponent,
|
|
2738
|
+
...componentInfo$b
|
|
2165
2739
|
}, {
|
|
2166
2740
|
component: Slot,
|
|
2167
|
-
...componentInfo$
|
|
2168
|
-
}
|
|
2741
|
+
...componentInfo$a
|
|
2742
|
+
}, {
|
|
2743
|
+
component: Symbol$1,
|
|
2744
|
+
...componentInfo$9
|
|
2745
|
+
}, {
|
|
2746
|
+
component: Text,
|
|
2747
|
+
...componentInfo$8
|
|
2748
|
+
}, ...getExtraComponents()], UPDATE_COOKIES_AND_STYLES_SCRIPT = `function updateCookiesAndStyles(contentId, variants, isHydrationTarget) {
|
|
2169
2749
|
function getAndSetVariantId() {
|
|
2170
2750
|
function setCookie(name, value, days) {
|
|
2171
2751
|
let expires = '';
|
|
@@ -2289,13 +2869,13 @@ function round(e) {
|
|
|
2289
2869
|
const findParentElement = (e, t, n = !0) => {
|
|
2290
2870
|
if (!(e instanceof HTMLElement))
|
|
2291
2871
|
return null;
|
|
2292
|
-
let
|
|
2872
|
+
let o = n ? e : e.parentElement;
|
|
2293
2873
|
do {
|
|
2294
|
-
if (!
|
|
2874
|
+
if (!o)
|
|
2295
2875
|
return null;
|
|
2296
|
-
if (t(
|
|
2297
|
-
return
|
|
2298
|
-
} while (
|
|
2876
|
+
if (t(o))
|
|
2877
|
+
return o;
|
|
2878
|
+
} while (o = o.parentElement);
|
|
2299
2879
|
return null;
|
|
2300
2880
|
}, findBuilderParent = (e) => findParentElement(e, (t) => {
|
|
2301
2881
|
const n = t.getAttribute("builder-id") || t.id;
|
|
@@ -2304,15 +2884,15 @@ const findParentElement = (e, t, n = !0) => {
|
|
|
2304
2884
|
event: e,
|
|
2305
2885
|
target: t
|
|
2306
2886
|
}) => {
|
|
2307
|
-
const n = t.getBoundingClientRect(),
|
|
2887
|
+
const n = t.getBoundingClientRect(), o = e.clientX - n.left, i = e.clientY - n.top, a = round(o / n.width), r = round(i / n.height);
|
|
2308
2888
|
return {
|
|
2309
2889
|
x: a,
|
|
2310
2890
|
y: r
|
|
2311
2891
|
};
|
|
2312
2892
|
}, getInteractionPropertiesForEvent = (e) => {
|
|
2313
|
-
const t = e.target, n = t && findBuilderParent(t),
|
|
2893
|
+
const t = e.target, n = t && findBuilderParent(t), o = (n == null ? void 0 : n.getAttribute("builder-id")) || (n == null ? void 0 : n.id);
|
|
2314
2894
|
return {
|
|
2315
|
-
targetBuilderElement:
|
|
2895
|
+
targetBuilderElement: o || void 0,
|
|
2316
2896
|
metadata: {
|
|
2317
2897
|
targetOffset: t ? computeOffset({
|
|
2318
2898
|
event: e,
|
|
@@ -2322,43 +2902,43 @@ const findParentElement = (e, t, n = !0) => {
|
|
|
2322
2902
|
event: e,
|
|
2323
2903
|
target: n
|
|
2324
2904
|
}) : void 0,
|
|
2325
|
-
builderElementIndex: n &&
|
|
2905
|
+
builderElementIndex: n && o ? [].slice.call(document.getElementsByClassName(o)).indexOf(n) : void 0
|
|
2326
2906
|
}
|
|
2327
2907
|
};
|
|
2328
2908
|
};
|
|
2329
2909
|
function EnableEditor(e) {
|
|
2330
|
-
var
|
|
2331
|
-
const t = useRef(null), [n,
|
|
2910
|
+
var A, f, C, F, j, V, $;
|
|
2911
|
+
const t = useRef(null), [n, o] = useState(() => 0);
|
|
2332
2912
|
useState(() => !0);
|
|
2333
|
-
function
|
|
2334
|
-
var
|
|
2335
|
-
const
|
|
2913
|
+
function i(g) {
|
|
2914
|
+
var p, v;
|
|
2915
|
+
const h = {
|
|
2336
2916
|
...e.builderContextSignal.rootState,
|
|
2337
|
-
...
|
|
2917
|
+
...g
|
|
2338
2918
|
};
|
|
2339
|
-
e.builderContextSignal.rootSetState ? (
|
|
2340
|
-
...
|
|
2341
|
-
rootState:
|
|
2919
|
+
e.builderContextSignal.rootSetState ? (v = (p = e.builderContextSignal).rootSetState) == null || v.call(p, h) : e.setBuilderContextSignal((T) => ({
|
|
2920
|
+
...T,
|
|
2921
|
+
rootState: h
|
|
2342
2922
|
}));
|
|
2343
2923
|
}
|
|
2344
|
-
function a(
|
|
2345
|
-
var
|
|
2346
|
-
const
|
|
2924
|
+
function a(g) {
|
|
2925
|
+
var p, v, T, P, N;
|
|
2926
|
+
const h = {
|
|
2347
2927
|
...e.builderContextSignal.content,
|
|
2348
|
-
...
|
|
2928
|
+
...g,
|
|
2349
2929
|
data: {
|
|
2350
|
-
...(
|
|
2351
|
-
...
|
|
2930
|
+
...(p = e.builderContextSignal.content) == null ? void 0 : p.data,
|
|
2931
|
+
...g == null ? void 0 : g.data
|
|
2352
2932
|
},
|
|
2353
2933
|
meta: {
|
|
2354
|
-
...(
|
|
2355
|
-
...
|
|
2356
|
-
breakpoints: ((
|
|
2934
|
+
...(v = e.builderContextSignal.content) == null ? void 0 : v.meta,
|
|
2935
|
+
...g == null ? void 0 : g.meta,
|
|
2936
|
+
breakpoints: ((T = g == null ? void 0 : g.meta) == null ? void 0 : T.breakpoints) || ((N = (P = e.builderContextSignal.content) == null ? void 0 : P.meta) == null ? void 0 : N.breakpoints)
|
|
2357
2937
|
}
|
|
2358
2938
|
};
|
|
2359
|
-
e.setBuilderContextSignal((
|
|
2360
|
-
...
|
|
2361
|
-
content:
|
|
2939
|
+
e.setBuilderContextSignal((W) => ({
|
|
2940
|
+
...W,
|
|
2941
|
+
content: h
|
|
2362
2942
|
}));
|
|
2363
2943
|
}
|
|
2364
2944
|
useState(() => 0);
|
|
@@ -2367,62 +2947,62 @@ function EnableEditor(e) {
|
|
|
2367
2947
|
), [l, c] = useState(
|
|
2368
2948
|
() => e.contentWrapper || "div"
|
|
2369
2949
|
);
|
|
2370
|
-
function
|
|
2950
|
+
function u(g) {
|
|
2371
2951
|
return createEditorListener({
|
|
2372
2952
|
model: e.model,
|
|
2373
2953
|
trustedHosts: e.trustedHosts,
|
|
2374
2954
|
callbacks: {
|
|
2375
|
-
configureSdk: (
|
|
2376
|
-
var
|
|
2377
|
-
const { breakpoints:
|
|
2378
|
-
!
|
|
2955
|
+
configureSdk: (h) => {
|
|
2956
|
+
var T;
|
|
2957
|
+
const { breakpoints: p, contentId: v } = h;
|
|
2958
|
+
!v || v !== ((T = e.builderContextSignal.content) == null ? void 0 : T.id) || p && (a({
|
|
2379
2959
|
meta: {
|
|
2380
|
-
breakpoints:
|
|
2960
|
+
breakpoints: p
|
|
2381
2961
|
}
|
|
2382
|
-
}),
|
|
2962
|
+
}), o(n + 1));
|
|
2383
2963
|
},
|
|
2384
|
-
animation: (
|
|
2385
|
-
triggerAnimation(
|
|
2964
|
+
animation: (h) => {
|
|
2965
|
+
triggerAnimation(h);
|
|
2386
2966
|
},
|
|
2387
|
-
contentUpdate: (
|
|
2388
|
-
a(
|
|
2967
|
+
contentUpdate: (h) => {
|
|
2968
|
+
a(h), o(n + 1);
|
|
2389
2969
|
}
|
|
2390
2970
|
}
|
|
2391
|
-
})(
|
|
2971
|
+
})(g);
|
|
2392
2972
|
}
|
|
2393
|
-
function
|
|
2394
|
-
var
|
|
2395
|
-
const
|
|
2396
|
-
|
|
2397
|
-
code:
|
|
2973
|
+
function y() {
|
|
2974
|
+
var h, p;
|
|
2975
|
+
const g = (p = (h = e.builderContextSignal.content) == null ? void 0 : h.data) == null ? void 0 : p.jsCode;
|
|
2976
|
+
g && evaluate({
|
|
2977
|
+
code: g,
|
|
2398
2978
|
context: e.context || {},
|
|
2399
2979
|
localState: void 0,
|
|
2400
2980
|
rootState: e.builderContextSignal.rootState,
|
|
2401
2981
|
rootSetState: e.builderContextSignal.rootSetState
|
|
2402
2982
|
});
|
|
2403
2983
|
}
|
|
2404
|
-
const [
|
|
2405
|
-
function
|
|
2406
|
-
var
|
|
2984
|
+
const [x, d] = useState(() => ({})), [m, b] = useState(() => !1);
|
|
2985
|
+
function I(g) {
|
|
2986
|
+
var h, p;
|
|
2407
2987
|
if (e.builderContextSignal.content) {
|
|
2408
|
-
const
|
|
2988
|
+
const v = (h = e.builderContextSignal.content) == null ? void 0 : h.testVariationId, T = (p = e.builderContextSignal.content) == null ? void 0 : p.id;
|
|
2409
2989
|
_track({
|
|
2410
2990
|
type: "click",
|
|
2411
2991
|
canTrack: getDefaultCanTrack(e.canTrack),
|
|
2412
|
-
contentId:
|
|
2992
|
+
contentId: T,
|
|
2413
2993
|
apiKey: e.apiKey,
|
|
2414
|
-
variationId:
|
|
2415
|
-
...getInteractionPropertiesForEvent(
|
|
2416
|
-
unique: !
|
|
2994
|
+
variationId: v !== T ? v : void 0,
|
|
2995
|
+
...getInteractionPropertiesForEvent(g),
|
|
2996
|
+
unique: !m
|
|
2417
2997
|
});
|
|
2418
2998
|
}
|
|
2419
|
-
|
|
2999
|
+
m || b(!0);
|
|
2420
3000
|
}
|
|
2421
|
-
function
|
|
2422
|
-
return
|
|
3001
|
+
function R(g) {
|
|
3002
|
+
return g.replace(
|
|
2423
3003
|
/{{([^}]+)}}/g,
|
|
2424
|
-
(
|
|
2425
|
-
code:
|
|
3004
|
+
(h, p) => evaluate({
|
|
3005
|
+
code: p,
|
|
2426
3006
|
context: e.context || {},
|
|
2427
3007
|
localState: void 0,
|
|
2428
3008
|
rootState: e.builderContextSignal.rootState,
|
|
@@ -2430,32 +3010,32 @@ function EnableEditor(e) {
|
|
|
2430
3010
|
})
|
|
2431
3011
|
);
|
|
2432
3012
|
}
|
|
2433
|
-
function
|
|
2434
|
-
fetch$1(
|
|
2435
|
-
var
|
|
2436
|
-
const
|
|
3013
|
+
function S({ url: g, key: h }) {
|
|
3014
|
+
fetch$1(g).then((p) => p.json()).then((p) => {
|
|
3015
|
+
var T, P;
|
|
3016
|
+
const v = {
|
|
2437
3017
|
...e.builderContextSignal.rootState,
|
|
2438
|
-
[
|
|
3018
|
+
[h]: p
|
|
2439
3019
|
};
|
|
2440
|
-
(
|
|
2441
|
-
}).catch((
|
|
2442
|
-
console.error("error fetching dynamic data",
|
|
3020
|
+
(P = (T = e.builderContextSignal).rootSetState) == null || P.call(T, v), x[h] = !0;
|
|
3021
|
+
}).catch((p) => {
|
|
3022
|
+
console.error("error fetching dynamic data", g, p);
|
|
2443
3023
|
});
|
|
2444
3024
|
}
|
|
2445
|
-
function
|
|
2446
|
-
var
|
|
2447
|
-
const
|
|
2448
|
-
Object.entries(
|
|
2449
|
-
if (
|
|
2450
|
-
const
|
|
2451
|
-
|
|
2452
|
-
url:
|
|
2453
|
-
key:
|
|
3025
|
+
function k() {
|
|
3026
|
+
var h, p, v;
|
|
3027
|
+
const g = (v = (p = (h = e.builderContextSignal.content) == null ? void 0 : h.data) == null ? void 0 : p.httpRequests) != null ? v : {};
|
|
3028
|
+
Object.entries(g).forEach(([T, P]) => {
|
|
3029
|
+
if (P && (!x[T] || isEditing())) {
|
|
3030
|
+
const N = R(P);
|
|
3031
|
+
S({
|
|
3032
|
+
url: N,
|
|
3033
|
+
key: T
|
|
2454
3034
|
});
|
|
2455
3035
|
}
|
|
2456
3036
|
});
|
|
2457
3037
|
}
|
|
2458
|
-
function
|
|
3038
|
+
function w() {
|
|
2459
3039
|
isEditing() && window.dispatchEvent(
|
|
2460
3040
|
new CustomEvent(
|
|
2461
3041
|
"builder:component:stateChange",
|
|
@@ -2470,8 +3050,8 @@ function EnableEditor(e) {
|
|
|
2470
3050
|
)
|
|
2471
3051
|
);
|
|
2472
3052
|
}
|
|
2473
|
-
function
|
|
2474
|
-
|
|
3053
|
+
function E(g) {
|
|
3054
|
+
o(n + 1), window.addEventListener("message", u), registerInsertMenu(), setupBrowserForEditing({
|
|
2475
3055
|
...e.locale ? {
|
|
2476
3056
|
locale: e.locale
|
|
2477
3057
|
} : {},
|
|
@@ -2486,62 +3066,62 @@ function EnableEditor(e) {
|
|
|
2486
3066
|
} : {}
|
|
2487
3067
|
}), Object.values(
|
|
2488
3068
|
e.builderContextSignal.componentInfos
|
|
2489
|
-
).forEach((
|
|
2490
|
-
var
|
|
2491
|
-
const
|
|
2492
|
-
(
|
|
3069
|
+
).forEach((h) => {
|
|
3070
|
+
var v;
|
|
3071
|
+
const p = createRegisterComponentMessage(h);
|
|
3072
|
+
(v = window.parent) == null || v.postMessage(p, "*");
|
|
2493
3073
|
}), window.addEventListener(
|
|
2494
3074
|
"builder:component:stateChangeListenerActivated",
|
|
2495
|
-
|
|
3075
|
+
w
|
|
2496
3076
|
);
|
|
2497
3077
|
}
|
|
2498
|
-
function
|
|
2499
|
-
const
|
|
2500
|
-
`builder.preview.${
|
|
2501
|
-
),
|
|
2502
|
-
|
|
3078
|
+
function B(g) {
|
|
3079
|
+
const h = new URL(location.href).searchParams, p = h.get("builder.preview"), v = h.get(
|
|
3080
|
+
`builder.preview.${p}`
|
|
3081
|
+
), T = h.get("apiKey") || h.get("builder.space");
|
|
3082
|
+
p === e.model && T === e.apiKey && (!e.content || v === e.content.id) && fetchOneEntry({
|
|
2503
3083
|
model: e.model,
|
|
2504
3084
|
apiKey: e.apiKey,
|
|
2505
3085
|
apiVersion: e.builderContextSignal.apiVersion
|
|
2506
|
-
}).then((
|
|
2507
|
-
|
|
3086
|
+
}).then((P) => {
|
|
3087
|
+
P && a(P);
|
|
2508
3088
|
});
|
|
2509
3089
|
}
|
|
2510
3090
|
return useEffect(() => {
|
|
2511
|
-
var
|
|
2512
|
-
return (
|
|
3091
|
+
var g;
|
|
3092
|
+
return (g = t.current) == null || g.addEventListener(
|
|
2513
3093
|
"initeditingbldr",
|
|
2514
|
-
|
|
3094
|
+
E
|
|
2515
3095
|
), () => {
|
|
2516
|
-
var
|
|
2517
|
-
return (
|
|
3096
|
+
var h;
|
|
3097
|
+
return (h = t.current) == null ? void 0 : h.removeEventListener(
|
|
2518
3098
|
"initeditingbldr",
|
|
2519
|
-
|
|
3099
|
+
E
|
|
2520
3100
|
);
|
|
2521
3101
|
};
|
|
2522
3102
|
}, []), useEffect(() => {
|
|
2523
|
-
var
|
|
2524
|
-
return (
|
|
3103
|
+
var g;
|
|
3104
|
+
return (g = t.current) == null || g.addEventListener(
|
|
2525
3105
|
"initpreviewingbldr",
|
|
2526
|
-
|
|
3106
|
+
B
|
|
2527
3107
|
), () => {
|
|
2528
|
-
var
|
|
2529
|
-
return (
|
|
3108
|
+
var h;
|
|
3109
|
+
return (h = t.current) == null ? void 0 : h.removeEventListener(
|
|
2530
3110
|
"initpreviewingbldr",
|
|
2531
|
-
|
|
3111
|
+
B
|
|
2532
3112
|
);
|
|
2533
3113
|
};
|
|
2534
3114
|
}, []), useEffect(() => {
|
|
2535
|
-
var
|
|
3115
|
+
var g, h;
|
|
2536
3116
|
if (isBrowser()) {
|
|
2537
3117
|
if (isEditing() && t.current && t.current.dispatchEvent(new CustomEvent("initeditingbldr")), e.builderContextSignal.content && getDefaultCanTrack(e.canTrack)) {
|
|
2538
|
-
const
|
|
3118
|
+
const v = (g = e.builderContextSignal.content) == null ? void 0 : g.testVariationId, T = (h = e.builderContextSignal.content) == null ? void 0 : h.id, P = e.apiKey;
|
|
2539
3119
|
_track({
|
|
2540
3120
|
type: "impression",
|
|
2541
3121
|
canTrack: !0,
|
|
2542
|
-
contentId:
|
|
2543
|
-
apiKey:
|
|
2544
|
-
variationId:
|
|
3122
|
+
contentId: T,
|
|
3123
|
+
apiKey: P,
|
|
3124
|
+
variationId: v !== T ? v : void 0
|
|
2545
3125
|
});
|
|
2546
3126
|
}
|
|
2547
3127
|
isPreviewing() && t.current && t.current.dispatchEvent(new CustomEvent("initpreviewingbldr"));
|
|
@@ -2549,34 +3129,34 @@ function EnableEditor(e) {
|
|
|
2549
3129
|
}, []), useEffect(() => {
|
|
2550
3130
|
e.apiKey || logger.error(
|
|
2551
3131
|
"No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."
|
|
2552
|
-
),
|
|
3132
|
+
), y(), k(), w();
|
|
2553
3133
|
}, []), useEffect(() => {
|
|
2554
3134
|
e.content && a(e.content);
|
|
2555
3135
|
}, [e.content]), useEffect(() => {
|
|
2556
3136
|
}, [r]), useEffect(() => {
|
|
2557
|
-
|
|
2558
|
-
}, [(
|
|
2559
|
-
|
|
2560
|
-
}, [(
|
|
2561
|
-
|
|
3137
|
+
y();
|
|
3138
|
+
}, [(f = (A = e.builderContextSignal.content) == null ? void 0 : A.data) == null ? void 0 : f.jsCode]), useEffect(() => {
|
|
3139
|
+
k();
|
|
3140
|
+
}, [(F = (C = e.builderContextSignal.content) == null ? void 0 : C.data) == null ? void 0 : F.httpRequests]), useEffect(() => {
|
|
3141
|
+
w();
|
|
2562
3142
|
}, [e.builderContextSignal.rootState]), useEffect(() => {
|
|
2563
|
-
e.data &&
|
|
3143
|
+
e.data && i(e.data);
|
|
2564
3144
|
}, [e.data]), useEffect(() => {
|
|
2565
|
-
e.locale &&
|
|
3145
|
+
e.locale && i({
|
|
2566
3146
|
locale: e.locale
|
|
2567
3147
|
});
|
|
2568
3148
|
}, [e.locale]), useEffect(() => () => {
|
|
2569
|
-
isBrowser() && (window.removeEventListener("message",
|
|
3149
|
+
isBrowser() && (window.removeEventListener("message", u), window.removeEventListener(
|
|
2570
3150
|
"builder:component:stateChangeListenerActivated",
|
|
2571
|
-
|
|
3151
|
+
w
|
|
2572
3152
|
));
|
|
2573
3153
|
}, []), /* @__PURE__ */ jsx(builderContext.Provider, { value: e.builderContextSignal, children: e.builderContextSignal.content ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ createElement(
|
|
2574
3154
|
l,
|
|
2575
3155
|
{
|
|
2576
3156
|
key: n,
|
|
2577
3157
|
ref: t,
|
|
2578
|
-
onClick: (
|
|
2579
|
-
"builder-content-id": (
|
|
3158
|
+
onClick: (g) => I(g),
|
|
3159
|
+
"builder-content-id": (j = e.builderContextSignal.content) == null ? void 0 : j.id,
|
|
2580
3160
|
"builder-model": e.model,
|
|
2581
3161
|
...e.showContent ? {} : {
|
|
2582
3162
|
hidden: !0,
|
|
@@ -2590,12 +3170,12 @@ function EnableEditor(e) {
|
|
|
2590
3170
|
}
|
|
2591
3171
|
const getCssFromFont = (e) => {
|
|
2592
3172
|
var a, r;
|
|
2593
|
-
const t = e.family + (e.kind && !e.kind.includes("#") ? ", " + e.kind : ""), n = t.split(",")[0],
|
|
2594
|
-
let
|
|
2595
|
-
if (
|
|
3173
|
+
const t = e.family + (e.kind && !e.kind.includes("#") ? ", " + e.kind : ""), n = t.split(",")[0], o = (r = e.fileUrl) != null ? r : (a = e == null ? void 0 : e.files) == null ? void 0 : a.regular;
|
|
3174
|
+
let i = "";
|
|
3175
|
+
if (o && t && n && (i += `
|
|
2596
3176
|
@font-face {
|
|
2597
3177
|
font-family: "${t}";
|
|
2598
|
-
src: local("${n}"), url('${
|
|
3178
|
+
src: local("${n}"), url('${o}') format('woff2');
|
|
2599
3179
|
font-display: fallback;
|
|
2600
3180
|
font-weight: 400;
|
|
2601
3181
|
}
|
|
@@ -2604,7 +3184,7 @@ font-weight: 400;
|
|
|
2604
3184
|
if (!(String(Number(s)) === s))
|
|
2605
3185
|
continue;
|
|
2606
3186
|
const c = e.files[s];
|
|
2607
|
-
c && c !==
|
|
3187
|
+
c && c !== o && (i += `
|
|
2608
3188
|
@font-face {
|
|
2609
3189
|
font-family: "${t}";
|
|
2610
3190
|
src: url('${c}') format('woff2');
|
|
@@ -2613,7 +3193,7 @@ font-weight: ${s};
|
|
|
2613
3193
|
}
|
|
2614
3194
|
`.trim());
|
|
2615
3195
|
}
|
|
2616
|
-
return
|
|
3196
|
+
return i;
|
|
2617
3197
|
}, getFontCss = ({
|
|
2618
3198
|
customFonts: e
|
|
2619
3199
|
}) => {
|
|
@@ -2660,12 +3240,12 @@ const getRootStateInitialValue = ({
|
|
|
2660
3240
|
locale: n
|
|
2661
3241
|
}) => {
|
|
2662
3242
|
var a, r, s;
|
|
2663
|
-
const
|
|
3243
|
+
const o = {}, i = ((a = e == null ? void 0 : e.data) == null ? void 0 : a.state) || {};
|
|
2664
3244
|
return (s = (r = e == null ? void 0 : e.data) == null ? void 0 : r.inputs) == null || s.forEach((l) => {
|
|
2665
|
-
l.name && l.defaultValue !== void 0 && (
|
|
3245
|
+
l.name && l.defaultValue !== void 0 && (o[l.name] = l.defaultValue);
|
|
2666
3246
|
}), {
|
|
2667
|
-
...i,
|
|
2668
3247
|
...o,
|
|
3248
|
+
...i,
|
|
2669
3249
|
...t,
|
|
2670
3250
|
...n ? {
|
|
2671
3251
|
locale: n
|
|
@@ -2683,25 +3263,25 @@ const getRootStateInitialValue = ({
|
|
|
2683
3263
|
meta: e == null ? void 0 : e.meta
|
|
2684
3264
|
} : void 0;
|
|
2685
3265
|
function ContentComponent(e) {
|
|
2686
|
-
var l, c,
|
|
3266
|
+
var l, c, u, y, x, d, m;
|
|
2687
3267
|
const [t, n] = useState(
|
|
2688
3268
|
() => {
|
|
2689
|
-
var
|
|
3269
|
+
var b, I;
|
|
2690
3270
|
return getUpdateVariantVisibilityScript({
|
|
2691
3271
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
2692
|
-
variationId: (
|
|
3272
|
+
variationId: (b = e.content) == null ? void 0 : b.testVariationId,
|
|
2693
3273
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
2694
|
-
contentId: (
|
|
3274
|
+
contentId: (I = e.content) == null ? void 0 : I.id
|
|
2695
3275
|
});
|
|
2696
3276
|
}
|
|
2697
3277
|
);
|
|
2698
|
-
function
|
|
2699
|
-
s((
|
|
2700
|
-
...
|
|
2701
|
-
rootState:
|
|
3278
|
+
function o(b) {
|
|
3279
|
+
s((I) => ({
|
|
3280
|
+
...I,
|
|
3281
|
+
rootState: b
|
|
2702
3282
|
}));
|
|
2703
3283
|
}
|
|
2704
|
-
const [
|
|
3284
|
+
const [i, a] = useState(
|
|
2705
3285
|
() => [
|
|
2706
3286
|
...getDefaultRegisteredComponents(),
|
|
2707
3287
|
// While this `components` object is deprecated, we must maintain support for it.
|
|
@@ -2712,11 +3292,11 @@ function ContentComponent(e) {
|
|
|
2712
3292
|
...components,
|
|
2713
3293
|
...e.customComponents || []
|
|
2714
3294
|
].reduce(
|
|
2715
|
-
(
|
|
2716
|
-
...
|
|
2717
|
-
[
|
|
2718
|
-
component:
|
|
2719
|
-
...serializeComponentInfo(
|
|
3295
|
+
(b, { component: I, ...R }) => ({
|
|
3296
|
+
...b,
|
|
3297
|
+
[R.name]: {
|
|
3298
|
+
component: I,
|
|
3299
|
+
...serializeComponentInfo(R)
|
|
2720
3300
|
}
|
|
2721
3301
|
}),
|
|
2722
3302
|
{}
|
|
@@ -2732,7 +3312,7 @@ function ContentComponent(e) {
|
|
|
2732
3312
|
data: e.data,
|
|
2733
3313
|
locale: e.locale
|
|
2734
3314
|
}),
|
|
2735
|
-
rootSetState:
|
|
3315
|
+
rootSetState: o,
|
|
2736
3316
|
context: e.context || {},
|
|
2737
3317
|
apiKey: e.apiKey,
|
|
2738
3318
|
apiVersion: e.apiVersion,
|
|
@@ -2746,9 +3326,9 @@ function ContentComponent(e) {
|
|
|
2746
3326
|
...components,
|
|
2747
3327
|
...e.customComponents || []
|
|
2748
3328
|
].reduce(
|
|
2749
|
-
(
|
|
2750
|
-
...
|
|
2751
|
-
[
|
|
3329
|
+
(b, { component: I, ...R }) => ({
|
|
3330
|
+
...b,
|
|
3331
|
+
[R.name]: serializeComponentInfo(R)
|
|
2752
3332
|
}),
|
|
2753
3333
|
{}
|
|
2754
3334
|
),
|
|
@@ -2760,7 +3340,7 @@ function ContentComponent(e) {
|
|
|
2760
3340
|
ComponentsContext.Provider,
|
|
2761
3341
|
{
|
|
2762
3342
|
value: {
|
|
2763
|
-
registeredComponents:
|
|
3343
|
+
registeredComponents: i
|
|
2764
3344
|
},
|
|
2765
3345
|
children: /* @__PURE__ */ jsxs(
|
|
2766
3346
|
EnableEditor,
|
|
@@ -2787,16 +3367,16 @@ function ContentComponent(e) {
|
|
|
2787
3367
|
ContentStyles,
|
|
2788
3368
|
{
|
|
2789
3369
|
contentId: (l = r.content) == null ? void 0 : l.id,
|
|
2790
|
-
cssCode: (
|
|
2791
|
-
customFonts: (
|
|
3370
|
+
cssCode: (u = (c = r.content) == null ? void 0 : c.data) == null ? void 0 : u.cssCode,
|
|
3371
|
+
customFonts: (x = (y = r.content) == null ? void 0 : y.data) == null ? void 0 : x.customFonts
|
|
2792
3372
|
}
|
|
2793
3373
|
) }),
|
|
2794
3374
|
/* @__PURE__ */ jsx(
|
|
2795
3375
|
Blocks,
|
|
2796
3376
|
{
|
|
2797
|
-
blocks: (
|
|
3377
|
+
blocks: (m = (d = r.content) == null ? void 0 : d.data) == null ? void 0 : m.blocks,
|
|
2798
3378
|
context: r,
|
|
2799
|
-
registeredComponents:
|
|
3379
|
+
registeredComponents: i,
|
|
2800
3380
|
linkComponent: e.linkComponent
|
|
2801
3381
|
}
|
|
2802
3382
|
)
|
|
@@ -2814,7 +3394,7 @@ function ContentVariants(e) {
|
|
|
2814
3394
|
content: e.content
|
|
2815
3395
|
})
|
|
2816
3396
|
);
|
|
2817
|
-
function
|
|
3397
|
+
function o() {
|
|
2818
3398
|
var l;
|
|
2819
3399
|
return getUpdateCookieAndStylesScript(
|
|
2820
3400
|
getVariants(e.content).map((c) => ({
|
|
@@ -2824,7 +3404,7 @@ function ContentVariants(e) {
|
|
|
2824
3404
|
((l = e.content) == null ? void 0 : l.id) || ""
|
|
2825
3405
|
);
|
|
2826
3406
|
}
|
|
2827
|
-
function
|
|
3407
|
+
function i() {
|
|
2828
3408
|
return getVariants(e.content).map((l) => `.variant-${l.testVariationId} { display: none; } `).join("");
|
|
2829
3409
|
}
|
|
2830
3410
|
function a() {
|
|
@@ -2845,10 +3425,10 @@ function ContentVariants(e) {
|
|
|
2845
3425
|
InlinedStyles,
|
|
2846
3426
|
{
|
|
2847
3427
|
id: `variants-styles-${(r = e.content) == null ? void 0 : r.id}`,
|
|
2848
|
-
styles:
|
|
3428
|
+
styles: i()
|
|
2849
3429
|
}
|
|
2850
3430
|
),
|
|
2851
|
-
/* @__PURE__ */ jsx(InlinedScript, { scriptStr:
|
|
3431
|
+
/* @__PURE__ */ jsx(InlinedScript, { scriptStr: o() }),
|
|
2852
3432
|
(s = getVariants(e.content)) == null ? void 0 : s.map((l) => /* @__PURE__ */ jsx(
|
|
2853
3433
|
ContentComponent,
|
|
2854
3434
|
{
|
|
@@ -2923,29 +3503,29 @@ const fetchSymbolContent = async ({
|
|
|
2923
3503
|
function Symbol$1(e) {
|
|
2924
3504
|
var a, r, s, l;
|
|
2925
3505
|
function t() {
|
|
2926
|
-
var c,
|
|
3506
|
+
var c, u;
|
|
2927
3507
|
return [
|
|
2928
3508
|
e.attributes[getClassPropName()],
|
|
2929
3509
|
"builder-symbol",
|
|
2930
3510
|
(c = e.symbol) != null && c.inline ? "builder-inline-symbol" : void 0,
|
|
2931
|
-
(
|
|
3511
|
+
(u = e.symbol) != null && u.dynamic || e.dynamic ? "builder-dynamic-symbol" : void 0
|
|
2932
3512
|
].filter(Boolean).join(" ");
|
|
2933
3513
|
}
|
|
2934
|
-
const [n,
|
|
3514
|
+
const [n, o] = useState(() => {
|
|
2935
3515
|
var c;
|
|
2936
3516
|
return (c = e.symbol) == null ? void 0 : c.content;
|
|
2937
3517
|
});
|
|
2938
|
-
function
|
|
3518
|
+
function i() {
|
|
2939
3519
|
n || fetchSymbolContent({
|
|
2940
3520
|
symbol: e.symbol,
|
|
2941
3521
|
builderContextValue: e.builderContext
|
|
2942
3522
|
}).then((c) => {
|
|
2943
|
-
c &&
|
|
3523
|
+
c && o(c);
|
|
2944
3524
|
});
|
|
2945
3525
|
}
|
|
2946
3526
|
return useEffect(() => {
|
|
2947
3527
|
}, []), useEffect(() => {
|
|
2948
|
-
|
|
3528
|
+
i();
|
|
2949
3529
|
}, [e.symbol]), /* @__PURE__ */ jsx("div", { ...e.attributes, className: t(), children: /* @__PURE__ */ jsx(
|
|
2950
3530
|
ContentVariants,
|
|
2951
3531
|
{
|
|
@@ -2985,14 +3565,14 @@ export {
|
|
|
2985
3565
|
H as _processContentResult,
|
|
2986
3566
|
createRegisterComponentMessage,
|
|
2987
3567
|
K as fetchBuilderProps,
|
|
2988
|
-
|
|
3568
|
+
q as fetchEntries,
|
|
2989
3569
|
fetchOneEntry,
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
3570
|
+
z as getAllContent,
|
|
3571
|
+
J as getBuilderSearchParams,
|
|
3572
|
+
Y as getContent,
|
|
2993
3573
|
isEditing,
|
|
2994
3574
|
isPreviewing,
|
|
2995
|
-
|
|
3575
|
+
G as register,
|
|
2996
3576
|
Q as setEditorSettings,
|
|
2997
3577
|
X as subscribeToEditor,
|
|
2998
3578
|
Z as track
|