@builder.io/sdk-solid 0.13.1 → 0.13.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +12 -10
- package/lib/browser/dev.js +1140 -371
- package/lib/browser/dev.jsx +964 -296
- package/lib/browser/index.js +1138 -369
- package/lib/browser/index.jsx +964 -296
- package/lib/edge/dev.js +1142 -373
- package/lib/edge/dev.jsx +964 -296
- package/lib/edge/index.js +1140 -371
- package/lib/edge/index.jsx +964 -296
- package/lib/node/dev.js +1140 -371
- package/lib/node/dev.jsx +964 -296
- package/lib/node/index.js +1138 -369
- package/lib/node/index.jsx +964 -296
- package/package.json +1 -1
package/lib/node/index.jsx
CHANGED
|
@@ -910,7 +910,7 @@ function BlockStyles(props) {
|
|
|
910
910
|
}
|
|
911
911
|
return true;
|
|
912
912
|
}
|
|
913
|
-
function
|
|
913
|
+
function css5() {
|
|
914
914
|
const processedBlock = getProcessedBlock({
|
|
915
915
|
block: props.block,
|
|
916
916
|
localState: props.context.localState,
|
|
@@ -953,7 +953,7 @@ function BlockStyles(props) {
|
|
|
953
953
|
}) : "";
|
|
954
954
|
return [largeStylesClass, mediumStylesClass, smallStylesClass].join(" ");
|
|
955
955
|
}
|
|
956
|
-
return <Show2 when={TARGET !== "reactNative" &&
|
|
956
|
+
return <Show2 when={TARGET !== "reactNative" && css5() && canShowBlock()}><Inlined_styles_default styles={css5()} /></Show2>;
|
|
957
957
|
}
|
|
958
958
|
var Block_styles_default = BlockStyles;
|
|
959
959
|
|
|
@@ -1242,10 +1242,10 @@ function Block(props) {
|
|
|
1242
1242
|
componentOptions: {
|
|
1243
1243
|
...getBlockComponentOptions(processedBlock()),
|
|
1244
1244
|
builderContext: props.context,
|
|
1245
|
-
...blockComponent()?.name === "Core:Button" || blockComponent()?.name === "Symbol" || blockComponent()?.name === "Columns" ? {
|
|
1245
|
+
...blockComponent()?.name === "Core:Button" || blockComponent()?.name === "Symbol" || blockComponent()?.name === "Columns" || blockComponent()?.name === "Form:Form" ? {
|
|
1246
1246
|
builderLinkComponent: props.linkComponent
|
|
1247
1247
|
} : {},
|
|
1248
|
-
...blockComponent()?.name === "Symbol" || blockComponent()?.name === "Columns" ? {
|
|
1248
|
+
...blockComponent()?.name === "Symbol" || blockComponent()?.name === "Columns" || blockComponent()?.name === "Form:Form" ? {
|
|
1249
1249
|
builderComponents: props.registeredComponents
|
|
1250
1250
|
} : {}
|
|
1251
1251
|
},
|
|
@@ -1716,10 +1716,10 @@ function SectionComponent(props) {
|
|
|
1716
1716
|
var section_default = SectionComponent;
|
|
1717
1717
|
|
|
1718
1718
|
// src/blocks/symbol/symbol.tsx
|
|
1719
|
-
import { onMount as onMount5, on as on3, createEffect as createEffect3, createSignal as
|
|
1719
|
+
import { onMount as onMount5, on as on3, createEffect as createEffect3, createSignal as createSignal15 } from "solid-js";
|
|
1720
1720
|
|
|
1721
1721
|
// src/components/content-variants/content-variants.tsx
|
|
1722
|
-
import { Show as
|
|
1722
|
+
import { Show as Show12, For as For7, onMount as onMount4, createSignal as createSignal14 } from "solid-js";
|
|
1723
1723
|
|
|
1724
1724
|
// src/helpers/url.ts
|
|
1725
1725
|
var getTopLevelDomain = (host) => {
|
|
@@ -1913,7 +1913,7 @@ var handleABTesting = async ({
|
|
|
1913
1913
|
var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
|
|
1914
1914
|
|
|
1915
1915
|
// src/components/content/content.tsx
|
|
1916
|
-
import { Show as
|
|
1916
|
+
import { Show as Show11, createSignal as createSignal13 } from "solid-js";
|
|
1917
1917
|
|
|
1918
1918
|
// src/blocks/button/component-info.ts
|
|
1919
1919
|
var componentInfo = {
|
|
@@ -2171,162 +2171,8 @@ var componentInfo2 = {
|
|
|
2171
2171
|
}]
|
|
2172
2172
|
};
|
|
2173
2173
|
|
|
2174
|
-
// src/blocks/custom-code/component-info.ts
|
|
2175
|
-
var componentInfo3 = {
|
|
2176
|
-
name: "Custom Code",
|
|
2177
|
-
static: true,
|
|
2178
|
-
requiredPermissions: ["editCode"],
|
|
2179
|
-
inputs: [{
|
|
2180
|
-
name: "code",
|
|
2181
|
-
type: "html",
|
|
2182
|
-
required: true,
|
|
2183
|
-
defaultValue: "<p>Hello there, I am custom HTML code!</p>",
|
|
2184
|
-
code: true
|
|
2185
|
-
}, {
|
|
2186
|
-
name: "replaceNodes",
|
|
2187
|
-
type: "boolean",
|
|
2188
|
-
helperText: "Preserve server rendered dom nodes",
|
|
2189
|
-
advanced: true
|
|
2190
|
-
}, {
|
|
2191
|
-
name: "scriptsClientOnly",
|
|
2192
|
-
type: "boolean",
|
|
2193
|
-
defaultValue: false,
|
|
2194
|
-
helperText: "Only print and run scripts on the client. Important when scripts influence DOM that could be replaced when client loads",
|
|
2195
|
-
advanced: true
|
|
2196
|
-
}]
|
|
2197
|
-
};
|
|
2198
|
-
|
|
2199
|
-
// src/blocks/custom-code/custom-code.tsx
|
|
2200
|
-
import { onMount as onMount2, createSignal as createSignal7 } from "solid-js";
|
|
2201
|
-
function CustomCode(props) {
|
|
2202
|
-
const [scriptsInserted, setScriptsInserted] = createSignal7([]);
|
|
2203
|
-
const [scriptsRun, setScriptsRun] = createSignal7([]);
|
|
2204
|
-
let elementRef;
|
|
2205
|
-
onMount2(() => {
|
|
2206
|
-
if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
|
|
2207
|
-
return;
|
|
2208
|
-
}
|
|
2209
|
-
const scripts = elementRef.getElementsByTagName("script");
|
|
2210
|
-
for (let i = 0; i < scripts.length; i++) {
|
|
2211
|
-
const script = scripts[i];
|
|
2212
|
-
if (script.src) {
|
|
2213
|
-
if (scriptsInserted().includes(script.src)) {
|
|
2214
|
-
continue;
|
|
2215
|
-
}
|
|
2216
|
-
scriptsInserted().push(script.src);
|
|
2217
|
-
const newScript = document.createElement("script");
|
|
2218
|
-
newScript.async = true;
|
|
2219
|
-
newScript.src = script.src;
|
|
2220
|
-
document.head.appendChild(newScript);
|
|
2221
|
-
} else if (!script.type || [
|
|
2222
|
-
"text/javascript",
|
|
2223
|
-
"application/javascript",
|
|
2224
|
-
"application/ecmascript"
|
|
2225
|
-
].includes(script.type)) {
|
|
2226
|
-
if (scriptsRun().includes(script.innerText)) {
|
|
2227
|
-
continue;
|
|
2228
|
-
}
|
|
2229
|
-
try {
|
|
2230
|
-
scriptsRun().push(script.innerText);
|
|
2231
|
-
new Function(script.innerText)();
|
|
2232
|
-
} catch (error2) {
|
|
2233
|
-
}
|
|
2234
|
-
}
|
|
2235
|
-
}
|
|
2236
|
-
});
|
|
2237
|
-
return <div
|
|
2238
|
-
class={"builder-custom-code" + (props.replaceNodes ? " replace-nodes" : "")}
|
|
2239
|
-
ref={elementRef}
|
|
2240
|
-
innerHTML={props.code}
|
|
2241
|
-
/>;
|
|
2242
|
-
}
|
|
2243
|
-
var custom_code_default = CustomCode;
|
|
2244
|
-
|
|
2245
|
-
// src/blocks/embed/component-info.ts
|
|
2246
|
-
var componentInfo4 = {
|
|
2247
|
-
name: "Embed",
|
|
2248
|
-
static: true,
|
|
2249
|
-
inputs: [{
|
|
2250
|
-
name: "url",
|
|
2251
|
-
type: "url",
|
|
2252
|
-
required: true,
|
|
2253
|
-
defaultValue: "",
|
|
2254
|
-
helperText: "e.g. enter a youtube url, google map, etc",
|
|
2255
|
-
onChange: (options) => {
|
|
2256
|
-
const url = options.get("url");
|
|
2257
|
-
if (url) {
|
|
2258
|
-
options.set("content", "Loading...");
|
|
2259
|
-
const apiKey = "ae0e60e78201a3f2b0de4b";
|
|
2260
|
-
return fetch(`https://iframe.ly/api/iframely?url=${url}&api_key=${apiKey}`).then((res) => res.json()).then((data) => {
|
|
2261
|
-
if (options.get("url") === url) {
|
|
2262
|
-
if (data.html) {
|
|
2263
|
-
options.set("content", data.html);
|
|
2264
|
-
} else {
|
|
2265
|
-
options.set("content", "Invalid url, please try another");
|
|
2266
|
-
}
|
|
2267
|
-
}
|
|
2268
|
-
}).catch((_err) => {
|
|
2269
|
-
options.set("content", "There was an error embedding this URL, please try again or another URL");
|
|
2270
|
-
});
|
|
2271
|
-
} else {
|
|
2272
|
-
options.delete("content");
|
|
2273
|
-
}
|
|
2274
|
-
}
|
|
2275
|
-
}, {
|
|
2276
|
-
name: "content",
|
|
2277
|
-
type: "html",
|
|
2278
|
-
defaultValue: '<div style="padding: 20px; text-align: center">(Choose an embed URL)<div>',
|
|
2279
|
-
hideFromUI: true
|
|
2280
|
-
}]
|
|
2281
|
-
};
|
|
2282
|
-
|
|
2283
|
-
// src/blocks/embed/embed.tsx
|
|
2284
|
-
import { on, createEffect, createSignal as createSignal8 } from "solid-js";
|
|
2285
|
-
|
|
2286
|
-
// src/blocks/embed/helpers.ts
|
|
2287
|
-
var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
|
|
2288
|
-
var isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
|
|
2289
|
-
|
|
2290
|
-
// src/blocks/embed/embed.tsx
|
|
2291
|
-
function Embed(props) {
|
|
2292
|
-
const [scriptsInserted, setScriptsInserted] = createSignal8([]);
|
|
2293
|
-
const [scriptsRun, setScriptsRun] = createSignal8([]);
|
|
2294
|
-
const [ranInitFn, setRanInitFn] = createSignal8(false);
|
|
2295
|
-
function findAndRunScripts() {
|
|
2296
|
-
if (!elem || !elem.getElementsByTagName)
|
|
2297
|
-
return;
|
|
2298
|
-
const scripts = elem.getElementsByTagName("script");
|
|
2299
|
-
for (let i = 0; i < scripts.length; i++) {
|
|
2300
|
-
const script = scripts[i];
|
|
2301
|
-
if (script.src && !scriptsInserted().includes(script.src)) {
|
|
2302
|
-
scriptsInserted().push(script.src);
|
|
2303
|
-
const newScript = document.createElement("script");
|
|
2304
|
-
newScript.async = true;
|
|
2305
|
-
newScript.src = script.src;
|
|
2306
|
-
document.head.appendChild(newScript);
|
|
2307
|
-
} else if (isJsScript(script) && !scriptsRun().includes(script.innerText)) {
|
|
2308
|
-
try {
|
|
2309
|
-
scriptsRun().push(script.innerText);
|
|
2310
|
-
new Function(script.innerText)();
|
|
2311
|
-
} catch (error2) {
|
|
2312
|
-
}
|
|
2313
|
-
}
|
|
2314
|
-
}
|
|
2315
|
-
}
|
|
2316
|
-
let elem;
|
|
2317
|
-
function onUpdateFn_0() {
|
|
2318
|
-
if (elem && !ranInitFn()) {
|
|
2319
|
-
setRanInitFn(true);
|
|
2320
|
-
findAndRunScripts();
|
|
2321
|
-
}
|
|
2322
|
-
}
|
|
2323
|
-
createEffect(on(() => [elem, ranInitFn()], onUpdateFn_0));
|
|
2324
|
-
return <div class="builder-embed" ref={elem} innerHTML={props.content} />;
|
|
2325
|
-
}
|
|
2326
|
-
var embed_default = Embed;
|
|
2327
|
-
|
|
2328
2174
|
// src/blocks/fragment/component-info.ts
|
|
2329
|
-
var
|
|
2175
|
+
var componentInfo3 = {
|
|
2330
2176
|
name: "Fragment",
|
|
2331
2177
|
static: true,
|
|
2332
2178
|
hidden: true,
|
|
@@ -2335,7 +2181,7 @@ var componentInfo5 = {
|
|
|
2335
2181
|
};
|
|
2336
2182
|
|
|
2337
2183
|
// src/blocks/image/component-info.ts
|
|
2338
|
-
var
|
|
2184
|
+
var componentInfo4 = {
|
|
2339
2185
|
name: "Image",
|
|
2340
2186
|
static: true,
|
|
2341
2187
|
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",
|
|
@@ -2456,41 +2302,8 @@ var componentInfo6 = {
|
|
|
2456
2302
|
}]
|
|
2457
2303
|
};
|
|
2458
2304
|
|
|
2459
|
-
// src/blocks/img/component-info.ts
|
|
2460
|
-
var componentInfo7 = {
|
|
2461
|
-
// friendlyName?
|
|
2462
|
-
name: "Raw:Img",
|
|
2463
|
-
hideFromInsertMenu: true,
|
|
2464
|
-
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",
|
|
2465
|
-
inputs: [{
|
|
2466
|
-
name: "image",
|
|
2467
|
-
bubble: true,
|
|
2468
|
-
type: "file",
|
|
2469
|
-
allowedFileTypes: ["jpeg", "jpg", "png", "svg", "gif", "webp"],
|
|
2470
|
-
required: true
|
|
2471
|
-
}],
|
|
2472
|
-
noWrap: true,
|
|
2473
|
-
static: true
|
|
2474
|
-
};
|
|
2475
|
-
|
|
2476
|
-
// src/blocks/img/img.tsx
|
|
2477
|
-
function ImgComponent(props) {
|
|
2478
|
-
return <img
|
|
2479
|
-
style={{
|
|
2480
|
-
"object-fit": props.backgroundSize || "cover",
|
|
2481
|
-
"object-position": props.backgroundPosition || "center"
|
|
2482
|
-
}}
|
|
2483
|
-
key={isEditing() && props.imgSrc || "default-key"}
|
|
2484
|
-
alt={props.altText}
|
|
2485
|
-
src={props.imgSrc || props.image}
|
|
2486
|
-
{...{}}
|
|
2487
|
-
{...props.attributes}
|
|
2488
|
-
/>;
|
|
2489
|
-
}
|
|
2490
|
-
var img_default = ImgComponent;
|
|
2491
|
-
|
|
2492
2305
|
// src/blocks/section/component-info.ts
|
|
2493
|
-
var
|
|
2306
|
+
var componentInfo5 = {
|
|
2494
2307
|
name: "Core:Section",
|
|
2495
2308
|
static: true,
|
|
2496
2309
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",
|
|
@@ -2532,7 +2345,7 @@ var componentInfo8 = {
|
|
|
2532
2345
|
};
|
|
2533
2346
|
|
|
2534
2347
|
// src/blocks/slot/component-info.ts
|
|
2535
|
-
var
|
|
2348
|
+
var componentInfo6 = {
|
|
2536
2349
|
name: "Slot",
|
|
2537
2350
|
isRSC: true,
|
|
2538
2351
|
description: "Allow child blocks to be inserted into this content when used as a Symbol",
|
|
@@ -2566,7 +2379,7 @@ function Slot(props) {
|
|
|
2566
2379
|
var slot_default = Slot;
|
|
2567
2380
|
|
|
2568
2381
|
// src/blocks/symbol/component-info.ts
|
|
2569
|
-
var
|
|
2382
|
+
var componentInfo7 = {
|
|
2570
2383
|
name: "Symbol",
|
|
2571
2384
|
noWrap: true,
|
|
2572
2385
|
static: true,
|
|
@@ -2602,7 +2415,7 @@ var componentInfo10 = {
|
|
|
2602
2415
|
};
|
|
2603
2416
|
|
|
2604
2417
|
// src/blocks/text/component-info.ts
|
|
2605
|
-
var
|
|
2418
|
+
var componentInfo8 = {
|
|
2606
2419
|
name: "Text",
|
|
2607
2420
|
static: true,
|
|
2608
2421
|
isRSC: true,
|
|
@@ -2634,54 +2447,894 @@ function Text(props) {
|
|
|
2634
2447
|
}
|
|
2635
2448
|
var text_default = Text;
|
|
2636
2449
|
|
|
2637
|
-
// src/blocks/
|
|
2638
|
-
var
|
|
2639
|
-
name: "
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
minHeight: "20px",
|
|
2643
|
-
minWidth: "20px"
|
|
2644
|
-
},
|
|
2645
|
-
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",
|
|
2450
|
+
// src/blocks/custom-code/component-info.ts
|
|
2451
|
+
var componentInfo9 = {
|
|
2452
|
+
name: "Custom Code",
|
|
2453
|
+
static: true,
|
|
2454
|
+
requiredPermissions: ["editCode"],
|
|
2646
2455
|
inputs: [{
|
|
2647
|
-
name: "
|
|
2648
|
-
type: "
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
required: true
|
|
2653
|
-
}, {
|
|
2654
|
-
name: "posterImage",
|
|
2655
|
-
type: "file",
|
|
2656
|
-
allowedFileTypes: ["jpeg", "png"],
|
|
2657
|
-
helperText: "Image to show before the video plays"
|
|
2658
|
-
}, {
|
|
2659
|
-
name: "autoPlay",
|
|
2660
|
-
type: "boolean",
|
|
2661
|
-
defaultValue: true
|
|
2662
|
-
}, {
|
|
2663
|
-
name: "controls",
|
|
2664
|
-
type: "boolean",
|
|
2665
|
-
defaultValue: false
|
|
2666
|
-
}, {
|
|
2667
|
-
name: "muted",
|
|
2668
|
-
type: "boolean",
|
|
2669
|
-
defaultValue: true
|
|
2456
|
+
name: "code",
|
|
2457
|
+
type: "html",
|
|
2458
|
+
required: true,
|
|
2459
|
+
defaultValue: "<p>Hello there, I am custom HTML code!</p>",
|
|
2460
|
+
code: true
|
|
2670
2461
|
}, {
|
|
2671
|
-
name: "
|
|
2462
|
+
name: "replaceNodes",
|
|
2672
2463
|
type: "boolean",
|
|
2673
|
-
|
|
2464
|
+
helperText: "Preserve server rendered dom nodes",
|
|
2465
|
+
advanced: true
|
|
2674
2466
|
}, {
|
|
2675
|
-
name: "
|
|
2467
|
+
name: "scriptsClientOnly",
|
|
2676
2468
|
type: "boolean",
|
|
2677
|
-
defaultValue:
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2469
|
+
defaultValue: false,
|
|
2470
|
+
helperText: "Only print and run scripts on the client. Important when scripts influence DOM that could be replaced when client loads",
|
|
2471
|
+
advanced: true
|
|
2472
|
+
}]
|
|
2473
|
+
};
|
|
2474
|
+
|
|
2475
|
+
// src/blocks/custom-code/custom-code.tsx
|
|
2476
|
+
import { onMount as onMount2, createSignal as createSignal7 } from "solid-js";
|
|
2477
|
+
function CustomCode(props) {
|
|
2478
|
+
const [scriptsInserted, setScriptsInserted] = createSignal7([]);
|
|
2479
|
+
const [scriptsRun, setScriptsRun] = createSignal7([]);
|
|
2480
|
+
let elementRef;
|
|
2481
|
+
onMount2(() => {
|
|
2482
|
+
if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
|
|
2483
|
+
return;
|
|
2484
|
+
}
|
|
2485
|
+
const scripts = elementRef.getElementsByTagName("script");
|
|
2486
|
+
for (let i = 0; i < scripts.length; i++) {
|
|
2487
|
+
const script = scripts[i];
|
|
2488
|
+
if (script.src) {
|
|
2489
|
+
if (scriptsInserted().includes(script.src)) {
|
|
2490
|
+
continue;
|
|
2491
|
+
}
|
|
2492
|
+
scriptsInserted().push(script.src);
|
|
2493
|
+
const newScript = document.createElement("script");
|
|
2494
|
+
newScript.async = true;
|
|
2495
|
+
newScript.src = script.src;
|
|
2496
|
+
document.head.appendChild(newScript);
|
|
2497
|
+
} else if (!script.type || [
|
|
2498
|
+
"text/javascript",
|
|
2499
|
+
"application/javascript",
|
|
2500
|
+
"application/ecmascript"
|
|
2501
|
+
].includes(script.type)) {
|
|
2502
|
+
if (scriptsRun().includes(script.innerText)) {
|
|
2503
|
+
continue;
|
|
2504
|
+
}
|
|
2505
|
+
try {
|
|
2506
|
+
scriptsRun().push(script.innerText);
|
|
2507
|
+
new Function(script.innerText)();
|
|
2508
|
+
} catch (error2) {
|
|
2509
|
+
}
|
|
2510
|
+
}
|
|
2511
|
+
}
|
|
2512
|
+
});
|
|
2513
|
+
return <div
|
|
2514
|
+
class={"builder-custom-code" + (props.replaceNodes ? " replace-nodes" : "")}
|
|
2515
|
+
ref={elementRef}
|
|
2516
|
+
innerHTML={props.code}
|
|
2517
|
+
/>;
|
|
2518
|
+
}
|
|
2519
|
+
var custom_code_default = CustomCode;
|
|
2520
|
+
|
|
2521
|
+
// src/blocks/embed/component-info.ts
|
|
2522
|
+
var componentInfo10 = {
|
|
2523
|
+
name: "Embed",
|
|
2524
|
+
static: true,
|
|
2525
|
+
inputs: [{
|
|
2526
|
+
name: "url",
|
|
2527
|
+
type: "url",
|
|
2528
|
+
required: true,
|
|
2529
|
+
defaultValue: "",
|
|
2530
|
+
helperText: "e.g. enter a youtube url, google map, etc",
|
|
2531
|
+
onChange: (options) => {
|
|
2532
|
+
const url = options.get("url");
|
|
2533
|
+
if (url) {
|
|
2534
|
+
options.set("content", "Loading...");
|
|
2535
|
+
const apiKey = "ae0e60e78201a3f2b0de4b";
|
|
2536
|
+
return fetch(`https://iframe.ly/api/iframely?url=${url}&api_key=${apiKey}`).then((res) => res.json()).then((data) => {
|
|
2537
|
+
if (options.get("url") === url) {
|
|
2538
|
+
if (data.html) {
|
|
2539
|
+
options.set("content", data.html);
|
|
2540
|
+
} else {
|
|
2541
|
+
options.set("content", "Invalid url, please try another");
|
|
2542
|
+
}
|
|
2543
|
+
}
|
|
2544
|
+
}).catch((_err) => {
|
|
2545
|
+
options.set("content", "There was an error embedding this URL, please try again or another URL");
|
|
2546
|
+
});
|
|
2547
|
+
} else {
|
|
2548
|
+
options.delete("content");
|
|
2549
|
+
}
|
|
2550
|
+
}
|
|
2551
|
+
}, {
|
|
2552
|
+
name: "content",
|
|
2553
|
+
type: "html",
|
|
2554
|
+
defaultValue: '<div style="padding: 20px; text-align: center">(Choose an embed URL)<div>',
|
|
2555
|
+
hideFromUI: true
|
|
2556
|
+
}]
|
|
2557
|
+
};
|
|
2558
|
+
|
|
2559
|
+
// src/blocks/embed/embed.tsx
|
|
2560
|
+
import { on, createEffect, createSignal as createSignal8 } from "solid-js";
|
|
2561
|
+
|
|
2562
|
+
// src/blocks/embed/helpers.ts
|
|
2563
|
+
var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
|
|
2564
|
+
var isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
|
|
2565
|
+
|
|
2566
|
+
// src/blocks/embed/embed.tsx
|
|
2567
|
+
function Embed(props) {
|
|
2568
|
+
const [scriptsInserted, setScriptsInserted] = createSignal8([]);
|
|
2569
|
+
const [scriptsRun, setScriptsRun] = createSignal8([]);
|
|
2570
|
+
const [ranInitFn, setRanInitFn] = createSignal8(false);
|
|
2571
|
+
function findAndRunScripts() {
|
|
2572
|
+
if (!elem || !elem.getElementsByTagName)
|
|
2573
|
+
return;
|
|
2574
|
+
const scripts = elem.getElementsByTagName("script");
|
|
2575
|
+
for (let i = 0; i < scripts.length; i++) {
|
|
2576
|
+
const script = scripts[i];
|
|
2577
|
+
if (script.src && !scriptsInserted().includes(script.src)) {
|
|
2578
|
+
scriptsInserted().push(script.src);
|
|
2579
|
+
const newScript = document.createElement("script");
|
|
2580
|
+
newScript.async = true;
|
|
2581
|
+
newScript.src = script.src;
|
|
2582
|
+
document.head.appendChild(newScript);
|
|
2583
|
+
} else if (isJsScript(script) && !scriptsRun().includes(script.innerText)) {
|
|
2584
|
+
try {
|
|
2585
|
+
scriptsRun().push(script.innerText);
|
|
2586
|
+
new Function(script.innerText)();
|
|
2587
|
+
} catch (error2) {
|
|
2588
|
+
}
|
|
2589
|
+
}
|
|
2590
|
+
}
|
|
2591
|
+
}
|
|
2592
|
+
let elem;
|
|
2593
|
+
function onUpdateFn_0() {
|
|
2594
|
+
if (elem && !ranInitFn()) {
|
|
2595
|
+
setRanInitFn(true);
|
|
2596
|
+
findAndRunScripts();
|
|
2597
|
+
}
|
|
2598
|
+
}
|
|
2599
|
+
createEffect(on(() => [elem, ranInitFn()], onUpdateFn_0));
|
|
2600
|
+
return <div class="builder-embed" ref={elem} innerHTML={props.content} />;
|
|
2601
|
+
}
|
|
2602
|
+
var embed_default = Embed;
|
|
2603
|
+
|
|
2604
|
+
// src/blocks/form/form/component-info.ts
|
|
2605
|
+
var componentInfo11 = {
|
|
2606
|
+
name: "Form:Form",
|
|
2607
|
+
// editableTags: ['builder-form-error']
|
|
2608
|
+
defaults: {
|
|
2609
|
+
responsiveStyles: {
|
|
2610
|
+
large: {
|
|
2611
|
+
marginTop: "15px",
|
|
2612
|
+
paddingBottom: "15px"
|
|
2613
|
+
}
|
|
2614
|
+
}
|
|
2615
|
+
},
|
|
2616
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fef36d2a846134910b64b88e6d18c5ca5",
|
|
2617
|
+
inputs: [{
|
|
2618
|
+
name: "sendSubmissionsTo",
|
|
2619
|
+
type: "string",
|
|
2620
|
+
// TODO: save to builder data and user can download as csv
|
|
2621
|
+
// TODO: easy for mode too or computed add/remove fields form mode
|
|
2622
|
+
// so you can edit details and high level mode at same time...
|
|
2623
|
+
// Later - more integrations like mailchimp
|
|
2624
|
+
// /api/v1/form-submit?to=mailchimp
|
|
2625
|
+
enum: [{
|
|
2626
|
+
label: "Send to email",
|
|
2627
|
+
value: "email",
|
|
2628
|
+
helperText: "Send form submissions to the email address of your choosing"
|
|
2629
|
+
}, {
|
|
2630
|
+
label: "Custom",
|
|
2631
|
+
value: "custom",
|
|
2632
|
+
helperText: "Handle where the form requests go manually with a little code, e.g. to your own custom backend"
|
|
2633
|
+
}],
|
|
2634
|
+
defaultValue: "email"
|
|
2635
|
+
}, {
|
|
2636
|
+
name: "sendSubmissionsToEmail",
|
|
2637
|
+
type: "string",
|
|
2638
|
+
required: true,
|
|
2639
|
+
// TODO: required: () => options.get("sendSubmissionsTo") === "email"
|
|
2640
|
+
defaultValue: "your@email.com",
|
|
2641
|
+
showIf: 'options.get("sendSubmissionsTo") === "email"'
|
|
2642
|
+
}, {
|
|
2643
|
+
name: "sendWithJs",
|
|
2644
|
+
type: "boolean",
|
|
2645
|
+
helperText: "Set to false to use basic html form action",
|
|
2646
|
+
defaultValue: true,
|
|
2647
|
+
showIf: 'options.get("sendSubmissionsTo") === "custom"'
|
|
2648
|
+
}, {
|
|
2649
|
+
name: "name",
|
|
2650
|
+
type: "string",
|
|
2651
|
+
defaultValue: "My form"
|
|
2652
|
+
// advanced: true
|
|
2653
|
+
}, {
|
|
2654
|
+
name: "action",
|
|
2655
|
+
type: "string",
|
|
2656
|
+
helperText: "URL to send the form data to",
|
|
2657
|
+
showIf: 'options.get("sendSubmissionsTo") === "custom"'
|
|
2658
|
+
}, {
|
|
2659
|
+
name: "contentType",
|
|
2660
|
+
type: "string",
|
|
2661
|
+
defaultValue: "application/json",
|
|
2662
|
+
advanced: true,
|
|
2663
|
+
// TODO: do automatically if file input
|
|
2664
|
+
enum: ["application/json", "multipart/form-data", "application/x-www-form-urlencoded"],
|
|
2665
|
+
showIf: 'options.get("sendSubmissionsTo") === "custom" && options.get("sendWithJs") === true'
|
|
2666
|
+
}, {
|
|
2667
|
+
name: "method",
|
|
2668
|
+
type: "string",
|
|
2669
|
+
showIf: 'options.get("sendSubmissionsTo") === "custom"',
|
|
2670
|
+
defaultValue: "POST",
|
|
2671
|
+
advanced: true
|
|
2672
|
+
}, {
|
|
2673
|
+
name: "previewState",
|
|
2674
|
+
type: "string",
|
|
2675
|
+
// TODO: persist: false flag
|
|
2676
|
+
enum: ["unsubmitted", "sending", "success", "error"],
|
|
2677
|
+
defaultValue: "unsubmitted",
|
|
2678
|
+
helperText: 'Choose a state to edit, e.g. choose "success" to show what users see on success and edit the message',
|
|
2679
|
+
showIf: 'options.get("sendSubmissionsTo") !== "zapier" && options.get("sendWithJs") === true'
|
|
2680
|
+
}, {
|
|
2681
|
+
name: "successUrl",
|
|
2682
|
+
type: "url",
|
|
2683
|
+
helperText: "Optional URL to redirect the user to on form submission success",
|
|
2684
|
+
showIf: 'options.get("sendSubmissionsTo") !== "zapier" && options.get("sendWithJs") === true'
|
|
2685
|
+
}, {
|
|
2686
|
+
name: "resetFormOnSubmit",
|
|
2687
|
+
type: "boolean",
|
|
2688
|
+
showIf: "options.get('sendSubmissionsTo') === 'custom' && options.get('sendWithJs') === true",
|
|
2689
|
+
advanced: true
|
|
2690
|
+
}, {
|
|
2691
|
+
name: "successMessage",
|
|
2692
|
+
type: "uiBlocks",
|
|
2693
|
+
hideFromUI: true,
|
|
2694
|
+
defaultValue: [{
|
|
2695
|
+
"@type": "@builder.io/sdk:Element",
|
|
2696
|
+
responsiveStyles: {
|
|
2697
|
+
large: {
|
|
2698
|
+
marginTop: "10px"
|
|
2699
|
+
}
|
|
2700
|
+
},
|
|
2701
|
+
component: {
|
|
2702
|
+
name: "Text",
|
|
2703
|
+
options: {
|
|
2704
|
+
text: "<span>Thanks!</span>"
|
|
2705
|
+
}
|
|
2706
|
+
}
|
|
2707
|
+
}]
|
|
2708
|
+
}, {
|
|
2709
|
+
name: "validate",
|
|
2710
|
+
type: "boolean",
|
|
2711
|
+
defaultValue: true,
|
|
2712
|
+
advanced: true
|
|
2713
|
+
}, {
|
|
2714
|
+
name: "errorMessagePath",
|
|
2715
|
+
type: "text",
|
|
2716
|
+
advanced: true,
|
|
2717
|
+
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" }}'
|
|
2718
|
+
}, {
|
|
2719
|
+
name: "errorMessage",
|
|
2720
|
+
type: "uiBlocks",
|
|
2721
|
+
hideFromUI: true,
|
|
2722
|
+
defaultValue: [{
|
|
2723
|
+
"@type": "@builder.io/sdk:Element",
|
|
2724
|
+
responsiveStyles: {
|
|
2725
|
+
large: {
|
|
2726
|
+
marginTop: "10px"
|
|
2727
|
+
}
|
|
2728
|
+
},
|
|
2729
|
+
bindings: {
|
|
2730
|
+
"component.options.text": "state.formErrorMessage || block.component.options.text"
|
|
2731
|
+
},
|
|
2732
|
+
component: {
|
|
2733
|
+
name: "Text",
|
|
2734
|
+
options: {
|
|
2735
|
+
text: "<span>Form submission error :( Please check your answers and try again</span>"
|
|
2736
|
+
}
|
|
2737
|
+
}
|
|
2738
|
+
}]
|
|
2739
|
+
}, {
|
|
2740
|
+
name: "sendingMessage",
|
|
2741
|
+
type: "uiBlocks",
|
|
2742
|
+
hideFromUI: true,
|
|
2743
|
+
defaultValue: [{
|
|
2744
|
+
"@type": "@builder.io/sdk:Element",
|
|
2745
|
+
responsiveStyles: {
|
|
2746
|
+
large: {
|
|
2747
|
+
marginTop: "10px"
|
|
2748
|
+
}
|
|
2749
|
+
},
|
|
2750
|
+
component: {
|
|
2751
|
+
name: "Text",
|
|
2752
|
+
options: {
|
|
2753
|
+
text: "<span>Sending...</span>"
|
|
2754
|
+
}
|
|
2755
|
+
}
|
|
2756
|
+
}]
|
|
2757
|
+
}, {
|
|
2758
|
+
name: "customHeaders",
|
|
2759
|
+
type: "map",
|
|
2760
|
+
valueType: {
|
|
2761
|
+
type: "string"
|
|
2762
|
+
},
|
|
2763
|
+
advanced: true,
|
|
2764
|
+
showIf: 'options.get("sendSubmissionsTo") === "custom" && options.get("sendWithJs") === true'
|
|
2765
|
+
}],
|
|
2766
|
+
noWrap: true,
|
|
2767
|
+
canHaveChildren: true,
|
|
2768
|
+
defaultChildren: [{
|
|
2769
|
+
"@type": "@builder.io/sdk:Element",
|
|
2770
|
+
responsiveStyles: {
|
|
2771
|
+
large: {
|
|
2772
|
+
marginTop: "10px"
|
|
2773
|
+
}
|
|
2774
|
+
},
|
|
2775
|
+
component: {
|
|
2776
|
+
name: "Text",
|
|
2777
|
+
options: {
|
|
2778
|
+
text: "<span>Enter your name</span>"
|
|
2779
|
+
}
|
|
2780
|
+
}
|
|
2781
|
+
}, {
|
|
2782
|
+
"@type": "@builder.io/sdk:Element",
|
|
2783
|
+
responsiveStyles: {
|
|
2784
|
+
large: {
|
|
2785
|
+
marginTop: "10px"
|
|
2786
|
+
}
|
|
2787
|
+
},
|
|
2788
|
+
component: {
|
|
2789
|
+
name: "Form:Input",
|
|
2790
|
+
options: {
|
|
2791
|
+
name: "name",
|
|
2792
|
+
placeholder: "Jane Doe"
|
|
2793
|
+
}
|
|
2794
|
+
}
|
|
2795
|
+
}, {
|
|
2796
|
+
"@type": "@builder.io/sdk:Element",
|
|
2797
|
+
responsiveStyles: {
|
|
2798
|
+
large: {
|
|
2799
|
+
marginTop: "10px"
|
|
2800
|
+
}
|
|
2801
|
+
},
|
|
2802
|
+
component: {
|
|
2803
|
+
name: "Text",
|
|
2804
|
+
options: {
|
|
2805
|
+
text: "<span>Enter your email</span>"
|
|
2806
|
+
}
|
|
2807
|
+
}
|
|
2808
|
+
}, {
|
|
2809
|
+
"@type": "@builder.io/sdk:Element",
|
|
2810
|
+
responsiveStyles: {
|
|
2811
|
+
large: {
|
|
2812
|
+
marginTop: "10px"
|
|
2813
|
+
}
|
|
2814
|
+
},
|
|
2815
|
+
component: {
|
|
2816
|
+
name: "Form:Input",
|
|
2817
|
+
options: {
|
|
2818
|
+
name: "email",
|
|
2819
|
+
placeholder: "jane@doe.com"
|
|
2820
|
+
}
|
|
2821
|
+
}
|
|
2822
|
+
}, {
|
|
2823
|
+
"@type": "@builder.io/sdk:Element",
|
|
2824
|
+
responsiveStyles: {
|
|
2825
|
+
large: {
|
|
2826
|
+
marginTop: "10px"
|
|
2827
|
+
}
|
|
2828
|
+
},
|
|
2829
|
+
component: {
|
|
2830
|
+
name: "Form:SubmitButton",
|
|
2831
|
+
options: {
|
|
2832
|
+
text: "Submit"
|
|
2833
|
+
}
|
|
2834
|
+
}
|
|
2835
|
+
}]
|
|
2836
|
+
};
|
|
2837
|
+
|
|
2838
|
+
// src/blocks/form/form/form.tsx
|
|
2839
|
+
import { Show as Show8, For as For5, createSignal as createSignal9 } from "solid-js";
|
|
2840
|
+
import { css as css4 } from "solid-styled-components";
|
|
2841
|
+
|
|
2842
|
+
// src/functions/get-env.ts
|
|
2843
|
+
var validEnvList = ["production", "qa", "test", "development", "dev", "cdn-qa", "cloud", "fast", "cdn2", "cdn-prod"];
|
|
2844
|
+
var getEnv = () => {
|
|
2845
|
+
const env = "production";
|
|
2846
|
+
return validEnvList.includes(env) ? env : "production";
|
|
2847
|
+
};
|
|
2848
|
+
|
|
2849
|
+
// src/functions/get.ts
|
|
2850
|
+
var get = (obj, path, defaultValue) => {
|
|
2851
|
+
const result = String.prototype.split.call(path, /[,[\].]+?/).filter(Boolean).reduce((res, key) => res !== null && res !== void 0 ? res[key] : res, obj);
|
|
2852
|
+
return result === void 0 || result === obj ? defaultValue : result;
|
|
2853
|
+
};
|
|
2854
|
+
|
|
2855
|
+
// src/blocks/form/form/form.tsx
|
|
2856
|
+
function FormComponent(props) {
|
|
2857
|
+
const [formState, setFormState] = createSignal9("unsubmitted");
|
|
2858
|
+
const [responseData, setResponseData] = createSignal9(null);
|
|
2859
|
+
const [formErrorMessage, setFormErrorMessage] = createSignal9("");
|
|
2860
|
+
function mergeNewRootState(newData) {
|
|
2861
|
+
const combinedState = {
|
|
2862
|
+
...props.builderContext.rootState,
|
|
2863
|
+
...newData
|
|
2864
|
+
};
|
|
2865
|
+
if (props.builderContext.rootSetState) {
|
|
2866
|
+
props.builderContext.rootSetState?.(combinedState);
|
|
2867
|
+
} else {
|
|
2868
|
+
props.builderContext.rootState = combinedState;
|
|
2869
|
+
}
|
|
2870
|
+
}
|
|
2871
|
+
function submissionState() {
|
|
2872
|
+
return isEditing() && props.previewState || formState();
|
|
2873
|
+
}
|
|
2874
|
+
function onSubmit(event) {
|
|
2875
|
+
const sendWithJsProp = props.sendWithJs || props.sendSubmissionsTo === "email";
|
|
2876
|
+
if (props.sendSubmissionsTo === "zapier") {
|
|
2877
|
+
event.preventDefault();
|
|
2878
|
+
} else if (sendWithJsProp) {
|
|
2879
|
+
if (!(props.action || props.sendSubmissionsTo === "email")) {
|
|
2880
|
+
event.preventDefault();
|
|
2881
|
+
return;
|
|
2882
|
+
}
|
|
2883
|
+
event.preventDefault();
|
|
2884
|
+
const el = event.currentTarget;
|
|
2885
|
+
const headers = props.customHeaders || {};
|
|
2886
|
+
let body;
|
|
2887
|
+
const formData = new FormData(el);
|
|
2888
|
+
const formPairs = Array.from(
|
|
2889
|
+
event.currentTarget.querySelectorAll("input,select,textarea")
|
|
2890
|
+
).filter((el2) => !!el2.name).map((el2) => {
|
|
2891
|
+
let value;
|
|
2892
|
+
const key = el2.name;
|
|
2893
|
+
if (el2 instanceof HTMLInputElement) {
|
|
2894
|
+
if (el2.type === "radio") {
|
|
2895
|
+
if (el2.checked) {
|
|
2896
|
+
value = el2.name;
|
|
2897
|
+
return {
|
|
2898
|
+
key,
|
|
2899
|
+
value
|
|
2900
|
+
};
|
|
2901
|
+
}
|
|
2902
|
+
} else if (el2.type === "checkbox") {
|
|
2903
|
+
value = el2.checked;
|
|
2904
|
+
} else if (el2.type === "number" || el2.type === "range") {
|
|
2905
|
+
const num = el2.valueAsNumber;
|
|
2906
|
+
if (!isNaN(num)) {
|
|
2907
|
+
value = num;
|
|
2908
|
+
}
|
|
2909
|
+
} else if (el2.type === "file") {
|
|
2910
|
+
value = el2.files;
|
|
2911
|
+
} else {
|
|
2912
|
+
value = el2.value;
|
|
2913
|
+
}
|
|
2914
|
+
} else {
|
|
2915
|
+
value = el2.value;
|
|
2916
|
+
}
|
|
2917
|
+
return {
|
|
2918
|
+
key,
|
|
2919
|
+
value
|
|
2920
|
+
};
|
|
2921
|
+
});
|
|
2922
|
+
let formContentType = props.contentType;
|
|
2923
|
+
if (props.sendSubmissionsTo === "email") {
|
|
2924
|
+
formContentType = "multipart/form-data";
|
|
2925
|
+
}
|
|
2926
|
+
Array.from(formPairs).forEach(({ value }) => {
|
|
2927
|
+
if (value instanceof File || Array.isArray(value) && value[0] instanceof File || value instanceof FileList) {
|
|
2928
|
+
formContentType = "multipart/form-data";
|
|
2929
|
+
}
|
|
2930
|
+
});
|
|
2931
|
+
if (formContentType !== "application/json") {
|
|
2932
|
+
body = formData;
|
|
2933
|
+
} else {
|
|
2934
|
+
const json = {};
|
|
2935
|
+
Array.from(formPairs).forEach(({ value, key }) => {
|
|
2936
|
+
set(json, key, value);
|
|
2937
|
+
});
|
|
2938
|
+
body = JSON.stringify(json);
|
|
2939
|
+
}
|
|
2940
|
+
if (formContentType && formContentType !== "multipart/form-data") {
|
|
2941
|
+
if (
|
|
2942
|
+
/* Zapier doesn't allow content-type header to be sent from browsers */
|
|
2943
|
+
!(sendWithJsProp && props.action?.includes("zapier.com"))
|
|
2944
|
+
) {
|
|
2945
|
+
headers["content-type"] = formContentType;
|
|
2946
|
+
}
|
|
2947
|
+
}
|
|
2948
|
+
const presubmitEvent = new CustomEvent("presubmit", {
|
|
2949
|
+
detail: {
|
|
2950
|
+
body
|
|
2951
|
+
}
|
|
2952
|
+
});
|
|
2953
|
+
if (formRef) {
|
|
2954
|
+
formRef.dispatchEvent(presubmitEvent);
|
|
2955
|
+
if (presubmitEvent.defaultPrevented) {
|
|
2956
|
+
return;
|
|
2957
|
+
}
|
|
2958
|
+
}
|
|
2959
|
+
setFormState("sending");
|
|
2960
|
+
const formUrl = `${getEnv() === "dev" ? "http://localhost:5000" : "https://builder.io"}/api/v1/form-submit?apiKey=${props.builderContext.apiKey}&to=${btoa(
|
|
2961
|
+
props.sendSubmissionsToEmail || ""
|
|
2962
|
+
)}&name=${encodeURIComponent(props.name || "")}`;
|
|
2963
|
+
fetch(
|
|
2964
|
+
props.sendSubmissionsTo === "email" ? formUrl : props.action,
|
|
2965
|
+
{
|
|
2966
|
+
body,
|
|
2967
|
+
headers,
|
|
2968
|
+
method: props.method || "post"
|
|
2969
|
+
}
|
|
2970
|
+
).then(
|
|
2971
|
+
async (res) => {
|
|
2972
|
+
let body2;
|
|
2973
|
+
const contentType = res.headers.get("content-type");
|
|
2974
|
+
if (contentType && contentType.indexOf("application/json") !== -1) {
|
|
2975
|
+
body2 = await res.json();
|
|
2976
|
+
} else {
|
|
2977
|
+
body2 = await res.text();
|
|
2978
|
+
}
|
|
2979
|
+
if (!res.ok && props.errorMessagePath) {
|
|
2980
|
+
let message = get(body2, props.errorMessagePath);
|
|
2981
|
+
if (message) {
|
|
2982
|
+
if (typeof message !== "string") {
|
|
2983
|
+
message = JSON.stringify(message);
|
|
2984
|
+
}
|
|
2985
|
+
setFormErrorMessage(message);
|
|
2986
|
+
mergeNewRootState({
|
|
2987
|
+
formErrorMessage: message
|
|
2988
|
+
});
|
|
2989
|
+
}
|
|
2990
|
+
}
|
|
2991
|
+
setResponseData(body2);
|
|
2992
|
+
setFormState(res.ok ? "success" : "error");
|
|
2993
|
+
if (res.ok) {
|
|
2994
|
+
const submitSuccessEvent = new CustomEvent("submit:success", {
|
|
2995
|
+
detail: {
|
|
2996
|
+
res,
|
|
2997
|
+
body: body2
|
|
2998
|
+
}
|
|
2999
|
+
});
|
|
3000
|
+
if (formRef) {
|
|
3001
|
+
formRef.dispatchEvent(submitSuccessEvent);
|
|
3002
|
+
if (submitSuccessEvent.defaultPrevented) {
|
|
3003
|
+
return;
|
|
3004
|
+
}
|
|
3005
|
+
if (props.resetFormOnSubmit !== false) {
|
|
3006
|
+
formRef.reset();
|
|
3007
|
+
}
|
|
3008
|
+
}
|
|
3009
|
+
if (props.successUrl) {
|
|
3010
|
+
if (formRef) {
|
|
3011
|
+
const event2 = new CustomEvent("route", {
|
|
3012
|
+
detail: {
|
|
3013
|
+
url: props.successUrl
|
|
3014
|
+
}
|
|
3015
|
+
});
|
|
3016
|
+
formRef.dispatchEvent(event2);
|
|
3017
|
+
if (!event2.defaultPrevented) {
|
|
3018
|
+
location.href = props.successUrl;
|
|
3019
|
+
}
|
|
3020
|
+
} else {
|
|
3021
|
+
location.href = props.successUrl;
|
|
3022
|
+
}
|
|
3023
|
+
}
|
|
3024
|
+
}
|
|
3025
|
+
},
|
|
3026
|
+
(err) => {
|
|
3027
|
+
const submitErrorEvent = new CustomEvent("submit:error", {
|
|
3028
|
+
detail: {
|
|
3029
|
+
error: err
|
|
3030
|
+
}
|
|
3031
|
+
});
|
|
3032
|
+
if (formRef) {
|
|
3033
|
+
formRef.dispatchEvent(submitErrorEvent);
|
|
3034
|
+
if (submitErrorEvent.defaultPrevented) {
|
|
3035
|
+
return;
|
|
3036
|
+
}
|
|
3037
|
+
}
|
|
3038
|
+
setResponseData(err);
|
|
3039
|
+
setFormState("error");
|
|
3040
|
+
}
|
|
3041
|
+
);
|
|
3042
|
+
}
|
|
3043
|
+
}
|
|
3044
|
+
let formRef;
|
|
3045
|
+
return <form
|
|
3046
|
+
validate={props.validate}
|
|
3047
|
+
ref={formRef}
|
|
3048
|
+
action={!props.sendWithJs && props.action}
|
|
3049
|
+
method={props.method}
|
|
3050
|
+
name={props.name}
|
|
3051
|
+
onSubmit={(event) => onSubmit(event)}
|
|
3052
|
+
{...{}}
|
|
3053
|
+
{...props.attributes}
|
|
3054
|
+
>
|
|
3055
|
+
<Show8 when={props.builderBlock && props.builderBlock.children}><For5 each={props.builderBlock?.children}>{(block, _index) => {
|
|
3056
|
+
const idx = _index();
|
|
3057
|
+
return <Block_default
|
|
3058
|
+
key={`form-block-${idx}`}
|
|
3059
|
+
block={block}
|
|
3060
|
+
context={props.builderContext}
|
|
3061
|
+
registeredComponents={props.builderComponents}
|
|
3062
|
+
linkComponent={props.builderLinkComponent}
|
|
3063
|
+
/>;
|
|
3064
|
+
}}</For5></Show8>
|
|
3065
|
+
<Show8 when={submissionState() === "error"}><Blocks_default
|
|
3066
|
+
path="errorMessage"
|
|
3067
|
+
blocks={props.errorMessage}
|
|
3068
|
+
context={props.builderContext}
|
|
3069
|
+
/></Show8>
|
|
3070
|
+
<Show8 when={submissionState() === "sending"}><Blocks_default
|
|
3071
|
+
path="sendingMessage"
|
|
3072
|
+
blocks={props.sendingMessage}
|
|
3073
|
+
context={props.builderContext}
|
|
3074
|
+
/></Show8>
|
|
3075
|
+
<Show8 when={submissionState() === "error" && responseData()}><pre
|
|
3076
|
+
class={"builder-form-error-text " + css4({
|
|
3077
|
+
padding: "10px",
|
|
3078
|
+
color: "red",
|
|
3079
|
+
textAlign: "center"
|
|
3080
|
+
})}
|
|
3081
|
+
>{JSON.stringify(responseData(), null, 2)}</pre></Show8>
|
|
3082
|
+
<Show8 when={submissionState() === "success"}><Blocks_default
|
|
3083
|
+
path="successMessage"
|
|
3084
|
+
blocks={props.successMessage}
|
|
3085
|
+
context={props.builderContext}
|
|
3086
|
+
/></Show8>
|
|
3087
|
+
</form>;
|
|
3088
|
+
}
|
|
3089
|
+
var form_default = FormComponent;
|
|
3090
|
+
|
|
3091
|
+
// src/blocks/form/input/component-info.ts
|
|
3092
|
+
var componentInfo12 = {
|
|
3093
|
+
name: "Form:Input",
|
|
3094
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fad6f37889d9e40bbbbc72cdb5875d6ca",
|
|
3095
|
+
inputs: [
|
|
3096
|
+
{
|
|
3097
|
+
name: "type",
|
|
3098
|
+
type: "text",
|
|
3099
|
+
enum: ["text", "number", "email", "url", "checkbox", "radio", "range", "date", "datetime-local", "search", "tel", "time", "file", "month", "week", "password", "color", "hidden"],
|
|
3100
|
+
defaultValue: "text"
|
|
3101
|
+
},
|
|
3102
|
+
{
|
|
3103
|
+
name: "name",
|
|
3104
|
+
type: "string",
|
|
3105
|
+
required: true,
|
|
3106
|
+
helperText: 'Every input in a form needs a unique name describing what it takes, e.g. "email"'
|
|
3107
|
+
},
|
|
3108
|
+
{
|
|
3109
|
+
name: "placeholder",
|
|
3110
|
+
type: "string",
|
|
3111
|
+
defaultValue: "Hello there",
|
|
3112
|
+
helperText: "Text to display when there is no value"
|
|
3113
|
+
},
|
|
3114
|
+
// TODO: handle value vs default value automatically like ng-model
|
|
3115
|
+
{
|
|
3116
|
+
name: "defaultValue",
|
|
3117
|
+
type: "string"
|
|
3118
|
+
},
|
|
3119
|
+
{
|
|
3120
|
+
name: "value",
|
|
3121
|
+
type: "string",
|
|
3122
|
+
advanced: true
|
|
3123
|
+
},
|
|
3124
|
+
{
|
|
3125
|
+
name: "required",
|
|
3126
|
+
type: "boolean",
|
|
3127
|
+
helperText: "Is this input required to be filled out to submit a form",
|
|
3128
|
+
defaultValue: false
|
|
3129
|
+
}
|
|
3130
|
+
],
|
|
3131
|
+
noWrap: true,
|
|
3132
|
+
static: true,
|
|
3133
|
+
defaultStyles: {
|
|
3134
|
+
paddingTop: "10px",
|
|
3135
|
+
paddingBottom: "10px",
|
|
3136
|
+
paddingLeft: "10px",
|
|
3137
|
+
paddingRight: "10px",
|
|
3138
|
+
borderRadius: "3px",
|
|
3139
|
+
borderWidth: "1px",
|
|
3140
|
+
borderStyle: "solid",
|
|
3141
|
+
borderColor: "#ccc"
|
|
3142
|
+
}
|
|
3143
|
+
};
|
|
3144
|
+
|
|
3145
|
+
// src/blocks/form/input/input.tsx
|
|
3146
|
+
function FormInputComponent(props) {
|
|
3147
|
+
return <input
|
|
3148
|
+
{...{}}
|
|
3149
|
+
{...props.attributes}
|
|
3150
|
+
key={isEditing() && props.defaultValue ? props.defaultValue : "default-key"}
|
|
3151
|
+
placeholder={props.placeholder}
|
|
3152
|
+
type={props.type}
|
|
3153
|
+
name={props.name}
|
|
3154
|
+
value={props.value}
|
|
3155
|
+
defaultValue={props.defaultValue}
|
|
3156
|
+
required={props.required}
|
|
3157
|
+
/>;
|
|
3158
|
+
}
|
|
3159
|
+
var input_default = FormInputComponent;
|
|
3160
|
+
|
|
3161
|
+
// src/blocks/form/select/component-info.ts
|
|
3162
|
+
var componentInfo13 = {
|
|
3163
|
+
name: "Form:Select",
|
|
3164
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F83acca093fb24aaf94dee136e9a4b045",
|
|
3165
|
+
defaultStyles: {
|
|
3166
|
+
alignSelf: "flex-start"
|
|
3167
|
+
},
|
|
3168
|
+
inputs: [{
|
|
3169
|
+
name: "options",
|
|
3170
|
+
type: "list",
|
|
3171
|
+
required: true,
|
|
3172
|
+
subFields: [{
|
|
3173
|
+
name: "value",
|
|
3174
|
+
type: "text",
|
|
3175
|
+
required: true
|
|
3176
|
+
}, {
|
|
3177
|
+
name: "name",
|
|
3178
|
+
type: "text"
|
|
3179
|
+
}],
|
|
3180
|
+
defaultValue: [{
|
|
3181
|
+
value: "option 1"
|
|
3182
|
+
}, {
|
|
3183
|
+
value: "option 2"
|
|
3184
|
+
}]
|
|
3185
|
+
}, {
|
|
3186
|
+
name: "name",
|
|
3187
|
+
type: "string",
|
|
3188
|
+
required: true,
|
|
3189
|
+
helperText: 'Every select in a form needs a unique name describing what it gets, e.g. "email"'
|
|
3190
|
+
}, {
|
|
3191
|
+
name: "defaultValue",
|
|
3192
|
+
type: "string"
|
|
3193
|
+
}, {
|
|
3194
|
+
name: "value",
|
|
3195
|
+
type: "string",
|
|
3196
|
+
advanced: true
|
|
3197
|
+
}, {
|
|
3198
|
+
name: "required",
|
|
3199
|
+
type: "boolean",
|
|
3200
|
+
defaultValue: false
|
|
3201
|
+
}],
|
|
3202
|
+
static: true,
|
|
3203
|
+
noWrap: true
|
|
3204
|
+
};
|
|
3205
|
+
|
|
3206
|
+
// src/blocks/form/select/select.tsx
|
|
3207
|
+
import { For as For6 } from "solid-js";
|
|
3208
|
+
function SelectComponent(props) {
|
|
3209
|
+
return <select
|
|
3210
|
+
{...{}}
|
|
3211
|
+
{...props.attributes}
|
|
3212
|
+
value={props.value}
|
|
3213
|
+
key={isEditing() && props.defaultValue ? props.defaultValue : "default-key"}
|
|
3214
|
+
defaultValue={props.defaultValue}
|
|
3215
|
+
name={props.name}
|
|
3216
|
+
><For6 each={props.options}>{(option, _index) => {
|
|
3217
|
+
const index = _index();
|
|
3218
|
+
return <option value={option.value}>{option.name || option.value}</option>;
|
|
3219
|
+
}}</For6></select>;
|
|
3220
|
+
}
|
|
3221
|
+
var select_default = SelectComponent;
|
|
3222
|
+
|
|
3223
|
+
// src/blocks/form/submit-button/component-info.ts
|
|
3224
|
+
var componentInfo14 = {
|
|
3225
|
+
name: "Form:SubmitButton",
|
|
3226
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fdf2820ffed1f4349a94c40b3221f5b98",
|
|
3227
|
+
defaultStyles: {
|
|
3228
|
+
appearance: "none",
|
|
3229
|
+
paddingTop: "15px",
|
|
3230
|
+
paddingBottom: "15px",
|
|
3231
|
+
paddingLeft: "25px",
|
|
3232
|
+
paddingRight: "25px",
|
|
3233
|
+
backgroundColor: "#3898EC",
|
|
3234
|
+
color: "white",
|
|
3235
|
+
borderRadius: "4px",
|
|
3236
|
+
cursor: "pointer"
|
|
3237
|
+
},
|
|
3238
|
+
inputs: [{
|
|
3239
|
+
name: "text",
|
|
3240
|
+
type: "text",
|
|
3241
|
+
defaultValue: "Click me"
|
|
3242
|
+
}],
|
|
3243
|
+
static: true,
|
|
3244
|
+
noWrap: true
|
|
3245
|
+
// TODO: optional children? maybe as optional form input
|
|
3246
|
+
// that only shows if advanced setting is flipped
|
|
3247
|
+
// TODO: defaultChildren
|
|
3248
|
+
// canHaveChildren: true,
|
|
3249
|
+
};
|
|
3250
|
+
|
|
3251
|
+
// src/blocks/form/submit-button/submit-button.tsx
|
|
3252
|
+
function SubmitButton(props) {
|
|
3253
|
+
return <button type="submit" {...{}} {...props.attributes}>{props.text}</button>;
|
|
3254
|
+
}
|
|
3255
|
+
var submit_button_default = SubmitButton;
|
|
3256
|
+
|
|
3257
|
+
// src/blocks/img/component-info.ts
|
|
3258
|
+
var componentInfo15 = {
|
|
3259
|
+
// friendlyName?
|
|
3260
|
+
name: "Raw:Img",
|
|
3261
|
+
hideFromInsertMenu: true,
|
|
3262
|
+
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",
|
|
3263
|
+
inputs: [{
|
|
3264
|
+
name: "image",
|
|
3265
|
+
bubble: true,
|
|
3266
|
+
type: "file",
|
|
3267
|
+
allowedFileTypes: ["jpeg", "jpg", "png", "svg", "gif", "webp"],
|
|
3268
|
+
required: true
|
|
3269
|
+
}],
|
|
3270
|
+
noWrap: true,
|
|
3271
|
+
static: true
|
|
3272
|
+
};
|
|
3273
|
+
|
|
3274
|
+
// src/blocks/img/img.tsx
|
|
3275
|
+
function ImgComponent(props) {
|
|
3276
|
+
return <img
|
|
3277
|
+
style={{
|
|
3278
|
+
"object-fit": props.backgroundSize || "cover",
|
|
3279
|
+
"object-position": props.backgroundPosition || "center"
|
|
3280
|
+
}}
|
|
3281
|
+
key={isEditing() && props.imgSrc || "default-key"}
|
|
3282
|
+
alt={props.altText}
|
|
3283
|
+
src={props.imgSrc || props.image}
|
|
3284
|
+
{...{}}
|
|
3285
|
+
{...props.attributes}
|
|
3286
|
+
/>;
|
|
3287
|
+
}
|
|
3288
|
+
var img_default = ImgComponent;
|
|
3289
|
+
|
|
3290
|
+
// src/blocks/video/component-info.ts
|
|
3291
|
+
var componentInfo16 = {
|
|
3292
|
+
name: "Video",
|
|
3293
|
+
canHaveChildren: true,
|
|
3294
|
+
defaultStyles: {
|
|
3295
|
+
minHeight: "20px",
|
|
3296
|
+
minWidth: "20px"
|
|
3297
|
+
},
|
|
3298
|
+
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",
|
|
3299
|
+
inputs: [{
|
|
3300
|
+
name: "video",
|
|
3301
|
+
type: "file",
|
|
3302
|
+
allowedFileTypes: ["mp4"],
|
|
3303
|
+
bubble: true,
|
|
3304
|
+
defaultValue: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/assets%2FKQlEmWDxA0coC3PK6UvkrjwkIGI2%2F28cb070609f546cdbe5efa20e931aa4b?alt=media&token=912e9551-7a7c-4dfb-86b6-3da1537d1a7f",
|
|
3305
|
+
required: true
|
|
3306
|
+
}, {
|
|
3307
|
+
name: "posterImage",
|
|
3308
|
+
type: "file",
|
|
3309
|
+
allowedFileTypes: ["jpeg", "png"],
|
|
3310
|
+
helperText: "Image to show before the video plays"
|
|
3311
|
+
}, {
|
|
3312
|
+
name: "autoPlay",
|
|
3313
|
+
type: "boolean",
|
|
3314
|
+
defaultValue: true
|
|
3315
|
+
}, {
|
|
3316
|
+
name: "controls",
|
|
3317
|
+
type: "boolean",
|
|
3318
|
+
defaultValue: false
|
|
3319
|
+
}, {
|
|
3320
|
+
name: "muted",
|
|
3321
|
+
type: "boolean",
|
|
3322
|
+
defaultValue: true
|
|
3323
|
+
}, {
|
|
3324
|
+
name: "loop",
|
|
3325
|
+
type: "boolean",
|
|
3326
|
+
defaultValue: true
|
|
3327
|
+
}, {
|
|
3328
|
+
name: "playsInline",
|
|
3329
|
+
type: "boolean",
|
|
3330
|
+
defaultValue: true
|
|
3331
|
+
}, {
|
|
3332
|
+
name: "fit",
|
|
3333
|
+
type: "text",
|
|
3334
|
+
defaultValue: "cover",
|
|
3335
|
+
enum: ["contain", "cover", "fill", "auto"]
|
|
3336
|
+
}, {
|
|
3337
|
+
name: "preload",
|
|
2685
3338
|
type: "text",
|
|
2686
3339
|
defaultValue: "metadata",
|
|
2687
3340
|
enum: ["auto", "metadata", "none"]
|
|
@@ -2719,7 +3372,7 @@ var componentInfo12 = {
|
|
|
2719
3372
|
};
|
|
2720
3373
|
|
|
2721
3374
|
// src/blocks/video/video.tsx
|
|
2722
|
-
import { Show as
|
|
3375
|
+
import { Show as Show9 } from "solid-js";
|
|
2723
3376
|
function Video(props) {
|
|
2724
3377
|
function videoProps() {
|
|
2725
3378
|
return {
|
|
@@ -2770,8 +3423,8 @@ function Video(props) {
|
|
|
2770
3423
|
}}
|
|
2771
3424
|
src={props.video || "no-src"}
|
|
2772
3425
|
poster={props.posterImage}
|
|
2773
|
-
><
|
|
2774
|
-
<
|
|
3426
|
+
><Show9 when={!props.lazyLoad}><source type="video/mp4" src={props.video} /></Show9></video>
|
|
3427
|
+
<Show9
|
|
2775
3428
|
when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}
|
|
2776
3429
|
><div
|
|
2777
3430
|
style={{
|
|
@@ -2780,15 +3433,15 @@ function Video(props) {
|
|
|
2780
3433
|
"pointer-events": "none",
|
|
2781
3434
|
"font-size": "0px"
|
|
2782
3435
|
}}
|
|
2783
|
-
/></
|
|
2784
|
-
<
|
|
3436
|
+
/></Show9>
|
|
3437
|
+
<Show9 when={props.builderBlock?.children?.length && props.fitContent}><div
|
|
2785
3438
|
style={{
|
|
2786
3439
|
display: "flex",
|
|
2787
3440
|
"flex-direction": "column",
|
|
2788
3441
|
"align-items": "stretch"
|
|
2789
3442
|
}}
|
|
2790
|
-
>{props.children}</div></
|
|
2791
|
-
<
|
|
3443
|
+
>{props.children}</div></Show9>
|
|
3444
|
+
<Show9 when={props.builderBlock?.children?.length && !props.fitContent}><div
|
|
2792
3445
|
style={{
|
|
2793
3446
|
"pointer-events": "none",
|
|
2794
3447
|
display: "flex",
|
|
@@ -2800,11 +3453,38 @@ function Video(props) {
|
|
|
2800
3453
|
width: "100%",
|
|
2801
3454
|
height: "100%"
|
|
2802
3455
|
}}
|
|
2803
|
-
>{props.children}</div></
|
|
3456
|
+
>{props.children}</div></Show9>
|
|
2804
3457
|
</div>;
|
|
2805
3458
|
}
|
|
2806
3459
|
var video_default = Video;
|
|
2807
3460
|
|
|
3461
|
+
// src/constants/extra-components.ts
|
|
3462
|
+
var getExtraComponents = () => [{
|
|
3463
|
+
component: custom_code_default,
|
|
3464
|
+
...componentInfo9
|
|
3465
|
+
}, {
|
|
3466
|
+
component: embed_default,
|
|
3467
|
+
...componentInfo10
|
|
3468
|
+
}, ...TARGET === "rsc" ? [] : [{
|
|
3469
|
+
component: form_default,
|
|
3470
|
+
...componentInfo11
|
|
3471
|
+
}, {
|
|
3472
|
+
component: input_default,
|
|
3473
|
+
...componentInfo12
|
|
3474
|
+
}, {
|
|
3475
|
+
component: submit_button_default,
|
|
3476
|
+
...componentInfo14
|
|
3477
|
+
}, {
|
|
3478
|
+
component: select_default,
|
|
3479
|
+
...componentInfo13
|
|
3480
|
+
}], {
|
|
3481
|
+
component: img_default,
|
|
3482
|
+
...componentInfo15
|
|
3483
|
+
}, {
|
|
3484
|
+
component: video_default,
|
|
3485
|
+
...componentInfo16
|
|
3486
|
+
}];
|
|
3487
|
+
|
|
2808
3488
|
// src/constants/builder-registered-components.ts
|
|
2809
3489
|
var getDefaultRegisteredComponents = () => [{
|
|
2810
3490
|
component: button_default,
|
|
@@ -2813,36 +3493,24 @@ var getDefaultRegisteredComponents = () => [{
|
|
|
2813
3493
|
component: columns_default,
|
|
2814
3494
|
...componentInfo2
|
|
2815
3495
|
}, {
|
|
2816
|
-
component:
|
|
3496
|
+
component: fragment_default,
|
|
2817
3497
|
...componentInfo3
|
|
2818
3498
|
}, {
|
|
2819
|
-
component:
|
|
3499
|
+
component: image_default,
|
|
2820
3500
|
...componentInfo4
|
|
2821
3501
|
}, {
|
|
2822
|
-
component:
|
|
3502
|
+
component: section_default,
|
|
2823
3503
|
...componentInfo5
|
|
2824
3504
|
}, {
|
|
2825
|
-
component:
|
|
3505
|
+
component: slot_default,
|
|
2826
3506
|
...componentInfo6
|
|
2827
|
-
}, {
|
|
2828
|
-
component: img_default,
|
|
2829
|
-
...componentInfo7
|
|
2830
|
-
}, {
|
|
2831
|
-
component: section_default,
|
|
2832
|
-
...componentInfo8
|
|
2833
3507
|
}, {
|
|
2834
3508
|
component: symbol_default,
|
|
2835
|
-
...
|
|
3509
|
+
...componentInfo7
|
|
2836
3510
|
}, {
|
|
2837
3511
|
component: text_default,
|
|
2838
|
-
...
|
|
2839
|
-
},
|
|
2840
|
-
component: video_default,
|
|
2841
|
-
...componentInfo12
|
|
2842
|
-
}, {
|
|
2843
|
-
component: slot_default,
|
|
2844
|
-
...componentInfo9
|
|
2845
|
-
}];
|
|
3512
|
+
...componentInfo8
|
|
3513
|
+
}, ...getExtraComponents()];
|
|
2846
3514
|
|
|
2847
3515
|
// src/functions/register-component.ts
|
|
2848
3516
|
var components = [];
|
|
@@ -2920,7 +3588,7 @@ function InlinedScript(props) {
|
|
|
2920
3588
|
var Inlined_script_default = InlinedScript;
|
|
2921
3589
|
|
|
2922
3590
|
// src/components/content/components/enable-editor.tsx
|
|
2923
|
-
import { Show as
|
|
3591
|
+
import { Show as Show10, onMount as onMount3, on as on2, createEffect as createEffect2, createSignal as createSignal11 } from "solid-js";
|
|
2924
3592
|
import { Dynamic as Dynamic5 } from "solid-js/web";
|
|
2925
3593
|
|
|
2926
3594
|
// src/helpers/preview-lru-cache/get.ts
|
|
@@ -3410,7 +4078,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
3410
4078
|
}
|
|
3411
4079
|
|
|
3412
4080
|
// src/constants/sdk-version.ts
|
|
3413
|
-
var SDK_VERSION = "0.13.
|
|
4081
|
+
var SDK_VERSION = "0.13.3";
|
|
3414
4082
|
|
|
3415
4083
|
// src/functions/register.ts
|
|
3416
4084
|
var registry = {};
|
|
@@ -3608,15 +4276,15 @@ var subscribeToEditor = (model, callback, options) => {
|
|
|
3608
4276
|
|
|
3609
4277
|
// src/components/content/components/enable-editor.tsx
|
|
3610
4278
|
function EnableEditor(props) {
|
|
3611
|
-
const [forceReRenderCount, setForceReRenderCount] =
|
|
3612
|
-
const [firstRender, setFirstRender] =
|
|
3613
|
-
const [lastUpdated, setLastUpdated] =
|
|
3614
|
-
const [shouldSendResetCookie, setShouldSendResetCookie] =
|
|
3615
|
-
const [ContentWrapper, setContentWrapper] =
|
|
4279
|
+
const [forceReRenderCount, setForceReRenderCount] = createSignal11(0);
|
|
4280
|
+
const [firstRender, setFirstRender] = createSignal11(true);
|
|
4281
|
+
const [lastUpdated, setLastUpdated] = createSignal11(0);
|
|
4282
|
+
const [shouldSendResetCookie, setShouldSendResetCookie] = createSignal11(false);
|
|
4283
|
+
const [ContentWrapper, setContentWrapper] = createSignal11(
|
|
3616
4284
|
props.contentWrapper || "div"
|
|
3617
4285
|
);
|
|
3618
|
-
const [httpReqsData, setHttpReqsData] =
|
|
3619
|
-
const [clicked, setClicked] =
|
|
4286
|
+
const [httpReqsData, setHttpReqsData] = createSignal11({});
|
|
4287
|
+
const [clicked, setClicked] = createSignal11(false);
|
|
3620
4288
|
function mergeNewRootState(newData) {
|
|
3621
4289
|
const combinedState = {
|
|
3622
4290
|
...props.builderContextSignal.rootState,
|
|
@@ -3879,7 +4547,7 @@ function EnableEditor(props) {
|
|
|
3879
4547
|
}
|
|
3880
4548
|
}
|
|
3881
4549
|
createEffect2(on2(() => [props.locale], onUpdateFn_6));
|
|
3882
|
-
return <builder_context_default.Provider value={props.builderContextSignal}><
|
|
4550
|
+
return <builder_context_default.Provider value={props.builderContextSignal}><Show10 when={props.builderContextSignal.content}><Dynamic5
|
|
3883
4551
|
class={`variant-${props.content?.testVariationId || props.content?.id}`}
|
|
3884
4552
|
{...{}}
|
|
3885
4553
|
key={forceReRenderCount()}
|
|
@@ -3894,12 +4562,12 @@ function EnableEditor(props) {
|
|
|
3894
4562
|
}}
|
|
3895
4563
|
{...props.contentWrapperProps}
|
|
3896
4564
|
component={ContentWrapper()}
|
|
3897
|
-
>{props.children}</Dynamic5></
|
|
4565
|
+
>{props.children}</Dynamic5></Show10></builder_context_default.Provider>;
|
|
3898
4566
|
}
|
|
3899
4567
|
var Enable_editor_default = EnableEditor;
|
|
3900
4568
|
|
|
3901
4569
|
// src/components/content/components/styles.tsx
|
|
3902
|
-
import { createSignal as
|
|
4570
|
+
import { createSignal as createSignal12 } from "solid-js";
|
|
3903
4571
|
|
|
3904
4572
|
// src/components/content/components/styles.helpers.ts
|
|
3905
4573
|
var getCssFromFont = (font) => {
|
|
@@ -3958,7 +4626,7 @@ var getCss = ({
|
|
|
3958
4626
|
|
|
3959
4627
|
// src/components/content/components/styles.tsx
|
|
3960
4628
|
function ContentStyles(props) {
|
|
3961
|
-
const [injectedStyles, setInjectedStyles] =
|
|
4629
|
+
const [injectedStyles, setInjectedStyles] = createSignal12(
|
|
3962
4630
|
`
|
|
3963
4631
|
${getCss({
|
|
3964
4632
|
cssCode: props.cssCode,
|
|
@@ -4028,7 +4696,7 @@ var getContentInitialValue = ({
|
|
|
4028
4696
|
|
|
4029
4697
|
// src/components/content/content.tsx
|
|
4030
4698
|
function ContentComponent(props) {
|
|
4031
|
-
const [scriptStr, setScriptStr] =
|
|
4699
|
+
const [scriptStr, setScriptStr] = createSignal13(
|
|
4032
4700
|
getUpdateVariantVisibilityScript({
|
|
4033
4701
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
4034
4702
|
variationId: props.content?.testVariationId,
|
|
@@ -4036,7 +4704,7 @@ function ContentComponent(props) {
|
|
|
4036
4704
|
contentId: props.content?.id
|
|
4037
4705
|
})
|
|
4038
4706
|
);
|
|
4039
|
-
const [registeredComponents, setRegisteredComponents] =
|
|
4707
|
+
const [registeredComponents, setRegisteredComponents] = createSignal13(
|
|
4040
4708
|
[
|
|
4041
4709
|
...getDefaultRegisteredComponents(),
|
|
4042
4710
|
// While this `components` object is deprecated, we must maintain support for it.
|
|
@@ -4057,7 +4725,7 @@ function ContentComponent(props) {
|
|
|
4057
4725
|
{}
|
|
4058
4726
|
)
|
|
4059
4727
|
);
|
|
4060
|
-
const [builderContextSignal, setBuilderContextSignal] =
|
|
4728
|
+
const [builderContextSignal, setBuilderContextSignal] = createSignal13({
|
|
4061
4729
|
content: getContentInitialValue({
|
|
4062
4730
|
content: props.content,
|
|
4063
4731
|
data: props.data
|
|
@@ -4122,12 +4790,12 @@ function ContentComponent(props) {
|
|
|
4122
4790
|
setBuilderContextSignal
|
|
4123
4791
|
}}
|
|
4124
4792
|
>
|
|
4125
|
-
<
|
|
4126
|
-
<
|
|
4793
|
+
<Show11 when={props.isSsrAbTest}><Inlined_script_default scriptStr={scriptStr()} /></Show11>
|
|
4794
|
+
<Show11 when={TARGET !== "reactNative"}><Styles_default
|
|
4127
4795
|
contentId={builderContextSignal().content?.id}
|
|
4128
4796
|
cssCode={builderContextSignal().content?.data?.cssCode}
|
|
4129
4797
|
customFonts={builderContextSignal().content?.data?.customFonts}
|
|
4130
|
-
/></
|
|
4798
|
+
/></Show11>
|
|
4131
4799
|
<Blocks_default
|
|
4132
4800
|
blocks={builderContextSignal().content?.data?.blocks}
|
|
4133
4801
|
context={builderContextSignal()}
|
|
@@ -4140,7 +4808,7 @@ var Content_default = ContentComponent;
|
|
|
4140
4808
|
|
|
4141
4809
|
// src/components/content-variants/content-variants.tsx
|
|
4142
4810
|
function ContentVariants(props) {
|
|
4143
|
-
const [shouldRenderVariants, setShouldRenderVariants] =
|
|
4811
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal14(
|
|
4144
4812
|
checkShouldRenderVariants({
|
|
4145
4813
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
4146
4814
|
content: props.content
|
|
@@ -4171,8 +4839,8 @@ function ContentVariants(props) {
|
|
|
4171
4839
|
setShouldRenderVariants(false);
|
|
4172
4840
|
});
|
|
4173
4841
|
return <>
|
|
4174
|
-
<
|
|
4175
|
-
<
|
|
4842
|
+
<Show12 when={!props.__isNestedRender && TARGET !== "reactNative"}><Inlined_script_default scriptStr={getScriptString()} /></Show12>
|
|
4843
|
+
<Show12 when={shouldRenderVariants()}>
|
|
4176
4844
|
<Inlined_styles_default
|
|
4177
4845
|
id={`variants-styles-${props.content?.id}`}
|
|
4178
4846
|
styles={hideVariantsStyleString()}
|
|
@@ -4180,7 +4848,7 @@ function ContentVariants(props) {
|
|
|
4180
4848
|
<Inlined_script_default
|
|
4181
4849
|
scriptStr={updateCookieAndStylesScriptStr()}
|
|
4182
4850
|
/>
|
|
4183
|
-
<
|
|
4851
|
+
<For7 each={getVariants(props.content)}>{(variant, _index) => {
|
|
4184
4852
|
const index = _index();
|
|
4185
4853
|
return <Content_default
|
|
4186
4854
|
key={variant.testVariationId}
|
|
@@ -4204,8 +4872,8 @@ function ContentVariants(props) {
|
|
|
4204
4872
|
contentWrapperProps={props.contentWrapperProps}
|
|
4205
4873
|
trustedHosts={props.trustedHosts}
|
|
4206
4874
|
/>;
|
|
4207
|
-
}}</
|
|
4208
|
-
</
|
|
4875
|
+
}}</For7>
|
|
4876
|
+
</Show12>
|
|
4209
4877
|
<Content_default
|
|
4210
4878
|
{...{}}
|
|
4211
4879
|
content={defaultContent()}
|
|
@@ -4258,7 +4926,7 @@ var fetchSymbolContent = async ({
|
|
|
4258
4926
|
|
|
4259
4927
|
// src/blocks/symbol/symbol.tsx
|
|
4260
4928
|
function Symbol(props) {
|
|
4261
|
-
const [contentToUse, setContentToUse] =
|
|
4929
|
+
const [contentToUse, setContentToUse] = createSignal15(props.symbol?.content);
|
|
4262
4930
|
function className() {
|
|
4263
4931
|
return [
|
|
4264
4932
|
...[props.attributes[getClassPropName()]],
|