@builder.io/sdk-solid 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/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/browser/dev.jsx
CHANGED
|
@@ -791,7 +791,7 @@ function BlockStyles(props) {
|
|
|
791
791
|
}
|
|
792
792
|
return true;
|
|
793
793
|
}
|
|
794
|
-
function
|
|
794
|
+
function css5() {
|
|
795
795
|
const processedBlock = getProcessedBlock({
|
|
796
796
|
block: props.block,
|
|
797
797
|
localState: props.context.localState,
|
|
@@ -834,7 +834,7 @@ function BlockStyles(props) {
|
|
|
834
834
|
}) : "";
|
|
835
835
|
return [largeStylesClass, mediumStylesClass, smallStylesClass].join(" ");
|
|
836
836
|
}
|
|
837
|
-
return <Show2 when={TARGET !== "reactNative" &&
|
|
837
|
+
return <Show2 when={TARGET !== "reactNative" && css5() && canShowBlock()}><Inlined_styles_default styles={css5()} /></Show2>;
|
|
838
838
|
}
|
|
839
839
|
var Block_styles_default = BlockStyles;
|
|
840
840
|
|
|
@@ -1123,10 +1123,10 @@ function Block(props) {
|
|
|
1123
1123
|
componentOptions: {
|
|
1124
1124
|
...getBlockComponentOptions(processedBlock()),
|
|
1125
1125
|
builderContext: props.context,
|
|
1126
|
-
...blockComponent()?.name === "Core:Button" || blockComponent()?.name === "Symbol" || blockComponent()?.name === "Columns" ? {
|
|
1126
|
+
...blockComponent()?.name === "Core:Button" || blockComponent()?.name === "Symbol" || blockComponent()?.name === "Columns" || blockComponent()?.name === "Form:Form" ? {
|
|
1127
1127
|
builderLinkComponent: props.linkComponent
|
|
1128
1128
|
} : {},
|
|
1129
|
-
...blockComponent()?.name === "Symbol" || blockComponent()?.name === "Columns" ? {
|
|
1129
|
+
...blockComponent()?.name === "Symbol" || blockComponent()?.name === "Columns" || blockComponent()?.name === "Form:Form" ? {
|
|
1130
1130
|
builderComponents: props.registeredComponents
|
|
1131
1131
|
} : {}
|
|
1132
1132
|
},
|
|
@@ -1598,10 +1598,10 @@ function SectionComponent(props) {
|
|
|
1598
1598
|
var section_default = SectionComponent;
|
|
1599
1599
|
|
|
1600
1600
|
// src/blocks/symbol/symbol.tsx
|
|
1601
|
-
import { onMount as onMount5, on as on3, createEffect as createEffect3, createSignal as
|
|
1601
|
+
import { onMount as onMount5, on as on3, createEffect as createEffect3, createSignal as createSignal15 } from "solid-js";
|
|
1602
1602
|
|
|
1603
1603
|
// src/components/content-variants/content-variants.tsx
|
|
1604
|
-
import { Show as
|
|
1604
|
+
import { Show as Show12, For as For7, onMount as onMount4, createSignal as createSignal14 } from "solid-js";
|
|
1605
1605
|
|
|
1606
1606
|
// src/helpers/url.ts
|
|
1607
1607
|
var getTopLevelDomain = (host) => {
|
|
@@ -1795,7 +1795,7 @@ var handleABTesting = async ({
|
|
|
1795
1795
|
var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
|
|
1796
1796
|
|
|
1797
1797
|
// src/components/content/content.tsx
|
|
1798
|
-
import { Show as
|
|
1798
|
+
import { Show as Show11, createSignal as createSignal13 } from "solid-js";
|
|
1799
1799
|
|
|
1800
1800
|
// src/blocks/button/component-info.ts
|
|
1801
1801
|
var componentInfo = {
|
|
@@ -2053,164 +2053,8 @@ var componentInfo2 = {
|
|
|
2053
2053
|
}]
|
|
2054
2054
|
};
|
|
2055
2055
|
|
|
2056
|
-
// src/blocks/custom-code/component-info.ts
|
|
2057
|
-
var componentInfo3 = {
|
|
2058
|
-
name: "Custom Code",
|
|
2059
|
-
static: true,
|
|
2060
|
-
requiredPermissions: ["editCode"],
|
|
2061
|
-
inputs: [{
|
|
2062
|
-
name: "code",
|
|
2063
|
-
type: "html",
|
|
2064
|
-
required: true,
|
|
2065
|
-
defaultValue: "<p>Hello there, I am custom HTML code!</p>",
|
|
2066
|
-
code: true
|
|
2067
|
-
}, {
|
|
2068
|
-
name: "replaceNodes",
|
|
2069
|
-
type: "boolean",
|
|
2070
|
-
helperText: "Preserve server rendered dom nodes",
|
|
2071
|
-
advanced: true
|
|
2072
|
-
}, {
|
|
2073
|
-
name: "scriptsClientOnly",
|
|
2074
|
-
type: "boolean",
|
|
2075
|
-
defaultValue: false,
|
|
2076
|
-
helperText: "Only print and run scripts on the client. Important when scripts influence DOM that could be replaced when client loads",
|
|
2077
|
-
advanced: true
|
|
2078
|
-
}]
|
|
2079
|
-
};
|
|
2080
|
-
|
|
2081
|
-
// src/blocks/custom-code/custom-code.tsx
|
|
2082
|
-
import { onMount as onMount2, createSignal as createSignal7 } from "solid-js";
|
|
2083
|
-
function CustomCode(props) {
|
|
2084
|
-
const [scriptsInserted, setScriptsInserted] = createSignal7([]);
|
|
2085
|
-
const [scriptsRun, setScriptsRun] = createSignal7([]);
|
|
2086
|
-
let elementRef;
|
|
2087
|
-
onMount2(() => {
|
|
2088
|
-
if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
|
|
2089
|
-
return;
|
|
2090
|
-
}
|
|
2091
|
-
const scripts = elementRef.getElementsByTagName("script");
|
|
2092
|
-
for (let i = 0; i < scripts.length; i++) {
|
|
2093
|
-
const script = scripts[i];
|
|
2094
|
-
if (script.src) {
|
|
2095
|
-
if (scriptsInserted().includes(script.src)) {
|
|
2096
|
-
continue;
|
|
2097
|
-
}
|
|
2098
|
-
scriptsInserted().push(script.src);
|
|
2099
|
-
const newScript = document.createElement("script");
|
|
2100
|
-
newScript.async = true;
|
|
2101
|
-
newScript.src = script.src;
|
|
2102
|
-
document.head.appendChild(newScript);
|
|
2103
|
-
} else if (!script.type || [
|
|
2104
|
-
"text/javascript",
|
|
2105
|
-
"application/javascript",
|
|
2106
|
-
"application/ecmascript"
|
|
2107
|
-
].includes(script.type)) {
|
|
2108
|
-
if (scriptsRun().includes(script.innerText)) {
|
|
2109
|
-
continue;
|
|
2110
|
-
}
|
|
2111
|
-
try {
|
|
2112
|
-
scriptsRun().push(script.innerText);
|
|
2113
|
-
new Function(script.innerText)();
|
|
2114
|
-
} catch (error) {
|
|
2115
|
-
console.warn("`CustomCode`: Error running script:", error);
|
|
2116
|
-
}
|
|
2117
|
-
}
|
|
2118
|
-
}
|
|
2119
|
-
});
|
|
2120
|
-
return <div
|
|
2121
|
-
class={"builder-custom-code" + (props.replaceNodes ? " replace-nodes" : "")}
|
|
2122
|
-
ref={elementRef}
|
|
2123
|
-
innerHTML={props.code}
|
|
2124
|
-
/>;
|
|
2125
|
-
}
|
|
2126
|
-
var custom_code_default = CustomCode;
|
|
2127
|
-
|
|
2128
|
-
// src/blocks/embed/component-info.ts
|
|
2129
|
-
var componentInfo4 = {
|
|
2130
|
-
name: "Embed",
|
|
2131
|
-
static: true,
|
|
2132
|
-
inputs: [{
|
|
2133
|
-
name: "url",
|
|
2134
|
-
type: "url",
|
|
2135
|
-
required: true,
|
|
2136
|
-
defaultValue: "",
|
|
2137
|
-
helperText: "e.g. enter a youtube url, google map, etc",
|
|
2138
|
-
onChange: (options) => {
|
|
2139
|
-
const url = options.get("url");
|
|
2140
|
-
if (url) {
|
|
2141
|
-
options.set("content", "Loading...");
|
|
2142
|
-
const apiKey = "ae0e60e78201a3f2b0de4b";
|
|
2143
|
-
return fetch(`https://iframe.ly/api/iframely?url=${url}&api_key=${apiKey}`).then((res) => res.json()).then((data) => {
|
|
2144
|
-
if (options.get("url") === url) {
|
|
2145
|
-
if (data.html) {
|
|
2146
|
-
options.set("content", data.html);
|
|
2147
|
-
} else {
|
|
2148
|
-
options.set("content", "Invalid url, please try another");
|
|
2149
|
-
}
|
|
2150
|
-
}
|
|
2151
|
-
}).catch((_err) => {
|
|
2152
|
-
options.set("content", "There was an error embedding this URL, please try again or another URL");
|
|
2153
|
-
});
|
|
2154
|
-
} else {
|
|
2155
|
-
options.delete("content");
|
|
2156
|
-
}
|
|
2157
|
-
}
|
|
2158
|
-
}, {
|
|
2159
|
-
name: "content",
|
|
2160
|
-
type: "html",
|
|
2161
|
-
defaultValue: '<div style="padding: 20px; text-align: center">(Choose an embed URL)<div>',
|
|
2162
|
-
hideFromUI: true
|
|
2163
|
-
}]
|
|
2164
|
-
};
|
|
2165
|
-
|
|
2166
|
-
// src/blocks/embed/embed.tsx
|
|
2167
|
-
import { on, createEffect, createSignal as createSignal8 } from "solid-js";
|
|
2168
|
-
|
|
2169
|
-
// src/blocks/embed/helpers.ts
|
|
2170
|
-
var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
|
|
2171
|
-
var isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
|
|
2172
|
-
|
|
2173
|
-
// src/blocks/embed/embed.tsx
|
|
2174
|
-
function Embed(props) {
|
|
2175
|
-
const [scriptsInserted, setScriptsInserted] = createSignal8([]);
|
|
2176
|
-
const [scriptsRun, setScriptsRun] = createSignal8([]);
|
|
2177
|
-
const [ranInitFn, setRanInitFn] = createSignal8(false);
|
|
2178
|
-
function findAndRunScripts() {
|
|
2179
|
-
if (!elem || !elem.getElementsByTagName)
|
|
2180
|
-
return;
|
|
2181
|
-
const scripts = elem.getElementsByTagName("script");
|
|
2182
|
-
for (let i = 0; i < scripts.length; i++) {
|
|
2183
|
-
const script = scripts[i];
|
|
2184
|
-
if (script.src && !scriptsInserted().includes(script.src)) {
|
|
2185
|
-
scriptsInserted().push(script.src);
|
|
2186
|
-
const newScript = document.createElement("script");
|
|
2187
|
-
newScript.async = true;
|
|
2188
|
-
newScript.src = script.src;
|
|
2189
|
-
document.head.appendChild(newScript);
|
|
2190
|
-
} else if (isJsScript(script) && !scriptsRun().includes(script.innerText)) {
|
|
2191
|
-
try {
|
|
2192
|
-
scriptsRun().push(script.innerText);
|
|
2193
|
-
new Function(script.innerText)();
|
|
2194
|
-
} catch (error) {
|
|
2195
|
-
console.warn("`Embed`: Error running script:", error);
|
|
2196
|
-
}
|
|
2197
|
-
}
|
|
2198
|
-
}
|
|
2199
|
-
}
|
|
2200
|
-
let elem;
|
|
2201
|
-
function onUpdateFn_0() {
|
|
2202
|
-
if (elem && !ranInitFn()) {
|
|
2203
|
-
setRanInitFn(true);
|
|
2204
|
-
findAndRunScripts();
|
|
2205
|
-
}
|
|
2206
|
-
}
|
|
2207
|
-
createEffect(on(() => [elem, ranInitFn()], onUpdateFn_0));
|
|
2208
|
-
return <div class="builder-embed" ref={elem} innerHTML={props.content} />;
|
|
2209
|
-
}
|
|
2210
|
-
var embed_default = Embed;
|
|
2211
|
-
|
|
2212
2056
|
// src/blocks/fragment/component-info.ts
|
|
2213
|
-
var
|
|
2057
|
+
var componentInfo3 = {
|
|
2214
2058
|
name: "Fragment",
|
|
2215
2059
|
static: true,
|
|
2216
2060
|
hidden: true,
|
|
@@ -2219,7 +2063,7 @@ var componentInfo5 = {
|
|
|
2219
2063
|
};
|
|
2220
2064
|
|
|
2221
2065
|
// src/blocks/image/component-info.ts
|
|
2222
|
-
var
|
|
2066
|
+
var componentInfo4 = {
|
|
2223
2067
|
name: "Image",
|
|
2224
2068
|
static: true,
|
|
2225
2069
|
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",
|
|
@@ -2341,41 +2185,8 @@ var componentInfo6 = {
|
|
|
2341
2185
|
}]
|
|
2342
2186
|
};
|
|
2343
2187
|
|
|
2344
|
-
// src/blocks/img/component-info.ts
|
|
2345
|
-
var componentInfo7 = {
|
|
2346
|
-
// friendlyName?
|
|
2347
|
-
name: "Raw:Img",
|
|
2348
|
-
hideFromInsertMenu: true,
|
|
2349
|
-
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",
|
|
2350
|
-
inputs: [{
|
|
2351
|
-
name: "image",
|
|
2352
|
-
bubble: true,
|
|
2353
|
-
type: "file",
|
|
2354
|
-
allowedFileTypes: ["jpeg", "jpg", "png", "svg", "gif", "webp"],
|
|
2355
|
-
required: true
|
|
2356
|
-
}],
|
|
2357
|
-
noWrap: true,
|
|
2358
|
-
static: true
|
|
2359
|
-
};
|
|
2360
|
-
|
|
2361
|
-
// src/blocks/img/img.tsx
|
|
2362
|
-
function ImgComponent(props) {
|
|
2363
|
-
return <img
|
|
2364
|
-
style={{
|
|
2365
|
-
"object-fit": props.backgroundSize || "cover",
|
|
2366
|
-
"object-position": props.backgroundPosition || "center"
|
|
2367
|
-
}}
|
|
2368
|
-
key={isEditing() && props.imgSrc || "default-key"}
|
|
2369
|
-
alt={props.altText}
|
|
2370
|
-
src={props.imgSrc || props.image}
|
|
2371
|
-
{...{}}
|
|
2372
|
-
{...props.attributes}
|
|
2373
|
-
/>;
|
|
2374
|
-
}
|
|
2375
|
-
var img_default = ImgComponent;
|
|
2376
|
-
|
|
2377
2188
|
// src/blocks/section/component-info.ts
|
|
2378
|
-
var
|
|
2189
|
+
var componentInfo5 = {
|
|
2379
2190
|
name: "Core:Section",
|
|
2380
2191
|
static: true,
|
|
2381
2192
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",
|
|
@@ -2417,7 +2228,7 @@ var componentInfo8 = {
|
|
|
2417
2228
|
};
|
|
2418
2229
|
|
|
2419
2230
|
// src/blocks/slot/component-info.ts
|
|
2420
|
-
var
|
|
2231
|
+
var componentInfo6 = {
|
|
2421
2232
|
name: "Slot",
|
|
2422
2233
|
isRSC: true,
|
|
2423
2234
|
description: "Allow child blocks to be inserted into this content when used as a Symbol",
|
|
@@ -2451,7 +2262,7 @@ function Slot(props) {
|
|
|
2451
2262
|
var slot_default = Slot;
|
|
2452
2263
|
|
|
2453
2264
|
// src/blocks/symbol/component-info.ts
|
|
2454
|
-
var
|
|
2265
|
+
var componentInfo7 = {
|
|
2455
2266
|
name: "Symbol",
|
|
2456
2267
|
noWrap: true,
|
|
2457
2268
|
static: true,
|
|
@@ -2487,7 +2298,7 @@ var componentInfo10 = {
|
|
|
2487
2298
|
};
|
|
2488
2299
|
|
|
2489
2300
|
// src/blocks/text/component-info.ts
|
|
2490
|
-
var
|
|
2301
|
+
var componentInfo8 = {
|
|
2491
2302
|
name: "Text",
|
|
2492
2303
|
static: true,
|
|
2493
2304
|
isRSC: true,
|
|
@@ -2519,52 +2330,894 @@ function Text(props) {
|
|
|
2519
2330
|
}
|
|
2520
2331
|
var text_default = Text;
|
|
2521
2332
|
|
|
2522
|
-
// src/blocks/
|
|
2523
|
-
var
|
|
2524
|
-
name: "
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
minHeight: "20px",
|
|
2528
|
-
minWidth: "20px"
|
|
2529
|
-
},
|
|
2530
|
-
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",
|
|
2333
|
+
// src/blocks/custom-code/component-info.ts
|
|
2334
|
+
var componentInfo9 = {
|
|
2335
|
+
name: "Custom Code",
|
|
2336
|
+
static: true,
|
|
2337
|
+
requiredPermissions: ["editCode"],
|
|
2531
2338
|
inputs: [{
|
|
2532
|
-
name: "
|
|
2533
|
-
type: "
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
required: true
|
|
2538
|
-
}, {
|
|
2539
|
-
name: "posterImage",
|
|
2540
|
-
type: "file",
|
|
2541
|
-
allowedFileTypes: ["jpeg", "png"],
|
|
2542
|
-
helperText: "Image to show before the video plays"
|
|
2543
|
-
}, {
|
|
2544
|
-
name: "autoPlay",
|
|
2545
|
-
type: "boolean",
|
|
2546
|
-
defaultValue: true
|
|
2547
|
-
}, {
|
|
2548
|
-
name: "controls",
|
|
2549
|
-
type: "boolean",
|
|
2550
|
-
defaultValue: false
|
|
2551
|
-
}, {
|
|
2552
|
-
name: "muted",
|
|
2553
|
-
type: "boolean",
|
|
2554
|
-
defaultValue: true
|
|
2339
|
+
name: "code",
|
|
2340
|
+
type: "html",
|
|
2341
|
+
required: true,
|
|
2342
|
+
defaultValue: "<p>Hello there, I am custom HTML code!</p>",
|
|
2343
|
+
code: true
|
|
2555
2344
|
}, {
|
|
2556
|
-
name: "
|
|
2345
|
+
name: "replaceNodes",
|
|
2557
2346
|
type: "boolean",
|
|
2558
|
-
|
|
2347
|
+
helperText: "Preserve server rendered dom nodes",
|
|
2348
|
+
advanced: true
|
|
2559
2349
|
}, {
|
|
2560
|
-
name: "
|
|
2350
|
+
name: "scriptsClientOnly",
|
|
2561
2351
|
type: "boolean",
|
|
2562
|
-
defaultValue:
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2352
|
+
defaultValue: false,
|
|
2353
|
+
helperText: "Only print and run scripts on the client. Important when scripts influence DOM that could be replaced when client loads",
|
|
2354
|
+
advanced: true
|
|
2355
|
+
}]
|
|
2356
|
+
};
|
|
2357
|
+
|
|
2358
|
+
// src/blocks/custom-code/custom-code.tsx
|
|
2359
|
+
import { onMount as onMount2, createSignal as createSignal7 } from "solid-js";
|
|
2360
|
+
function CustomCode(props) {
|
|
2361
|
+
const [scriptsInserted, setScriptsInserted] = createSignal7([]);
|
|
2362
|
+
const [scriptsRun, setScriptsRun] = createSignal7([]);
|
|
2363
|
+
let elementRef;
|
|
2364
|
+
onMount2(() => {
|
|
2365
|
+
if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
|
|
2366
|
+
return;
|
|
2367
|
+
}
|
|
2368
|
+
const scripts = elementRef.getElementsByTagName("script");
|
|
2369
|
+
for (let i = 0; i < scripts.length; i++) {
|
|
2370
|
+
const script = scripts[i];
|
|
2371
|
+
if (script.src) {
|
|
2372
|
+
if (scriptsInserted().includes(script.src)) {
|
|
2373
|
+
continue;
|
|
2374
|
+
}
|
|
2375
|
+
scriptsInserted().push(script.src);
|
|
2376
|
+
const newScript = document.createElement("script");
|
|
2377
|
+
newScript.async = true;
|
|
2378
|
+
newScript.src = script.src;
|
|
2379
|
+
document.head.appendChild(newScript);
|
|
2380
|
+
} else if (!script.type || [
|
|
2381
|
+
"text/javascript",
|
|
2382
|
+
"application/javascript",
|
|
2383
|
+
"application/ecmascript"
|
|
2384
|
+
].includes(script.type)) {
|
|
2385
|
+
if (scriptsRun().includes(script.innerText)) {
|
|
2386
|
+
continue;
|
|
2387
|
+
}
|
|
2388
|
+
try {
|
|
2389
|
+
scriptsRun().push(script.innerText);
|
|
2390
|
+
new Function(script.innerText)();
|
|
2391
|
+
} catch (error) {
|
|
2392
|
+
console.warn("`CustomCode`: Error running script:", error);
|
|
2393
|
+
}
|
|
2394
|
+
}
|
|
2395
|
+
}
|
|
2396
|
+
});
|
|
2397
|
+
return <div
|
|
2398
|
+
class={"builder-custom-code" + (props.replaceNodes ? " replace-nodes" : "")}
|
|
2399
|
+
ref={elementRef}
|
|
2400
|
+
innerHTML={props.code}
|
|
2401
|
+
/>;
|
|
2402
|
+
}
|
|
2403
|
+
var custom_code_default = CustomCode;
|
|
2404
|
+
|
|
2405
|
+
// src/blocks/embed/component-info.ts
|
|
2406
|
+
var componentInfo10 = {
|
|
2407
|
+
name: "Embed",
|
|
2408
|
+
static: true,
|
|
2409
|
+
inputs: [{
|
|
2410
|
+
name: "url",
|
|
2411
|
+
type: "url",
|
|
2412
|
+
required: true,
|
|
2413
|
+
defaultValue: "",
|
|
2414
|
+
helperText: "e.g. enter a youtube url, google map, etc",
|
|
2415
|
+
onChange: (options) => {
|
|
2416
|
+
const url = options.get("url");
|
|
2417
|
+
if (url) {
|
|
2418
|
+
options.set("content", "Loading...");
|
|
2419
|
+
const apiKey = "ae0e60e78201a3f2b0de4b";
|
|
2420
|
+
return fetch(`https://iframe.ly/api/iframely?url=${url}&api_key=${apiKey}`).then((res) => res.json()).then((data) => {
|
|
2421
|
+
if (options.get("url") === url) {
|
|
2422
|
+
if (data.html) {
|
|
2423
|
+
options.set("content", data.html);
|
|
2424
|
+
} else {
|
|
2425
|
+
options.set("content", "Invalid url, please try another");
|
|
2426
|
+
}
|
|
2427
|
+
}
|
|
2428
|
+
}).catch((_err) => {
|
|
2429
|
+
options.set("content", "There was an error embedding this URL, please try again or another URL");
|
|
2430
|
+
});
|
|
2431
|
+
} else {
|
|
2432
|
+
options.delete("content");
|
|
2433
|
+
}
|
|
2434
|
+
}
|
|
2435
|
+
}, {
|
|
2436
|
+
name: "content",
|
|
2437
|
+
type: "html",
|
|
2438
|
+
defaultValue: '<div style="padding: 20px; text-align: center">(Choose an embed URL)<div>',
|
|
2439
|
+
hideFromUI: true
|
|
2440
|
+
}]
|
|
2441
|
+
};
|
|
2442
|
+
|
|
2443
|
+
// src/blocks/embed/embed.tsx
|
|
2444
|
+
import { on, createEffect, createSignal as createSignal8 } from "solid-js";
|
|
2445
|
+
|
|
2446
|
+
// src/blocks/embed/helpers.ts
|
|
2447
|
+
var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
|
|
2448
|
+
var isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
|
|
2449
|
+
|
|
2450
|
+
// src/blocks/embed/embed.tsx
|
|
2451
|
+
function Embed(props) {
|
|
2452
|
+
const [scriptsInserted, setScriptsInserted] = createSignal8([]);
|
|
2453
|
+
const [scriptsRun, setScriptsRun] = createSignal8([]);
|
|
2454
|
+
const [ranInitFn, setRanInitFn] = createSignal8(false);
|
|
2455
|
+
function findAndRunScripts() {
|
|
2456
|
+
if (!elem || !elem.getElementsByTagName)
|
|
2457
|
+
return;
|
|
2458
|
+
const scripts = elem.getElementsByTagName("script");
|
|
2459
|
+
for (let i = 0; i < scripts.length; i++) {
|
|
2460
|
+
const script = scripts[i];
|
|
2461
|
+
if (script.src && !scriptsInserted().includes(script.src)) {
|
|
2462
|
+
scriptsInserted().push(script.src);
|
|
2463
|
+
const newScript = document.createElement("script");
|
|
2464
|
+
newScript.async = true;
|
|
2465
|
+
newScript.src = script.src;
|
|
2466
|
+
document.head.appendChild(newScript);
|
|
2467
|
+
} else if (isJsScript(script) && !scriptsRun().includes(script.innerText)) {
|
|
2468
|
+
try {
|
|
2469
|
+
scriptsRun().push(script.innerText);
|
|
2470
|
+
new Function(script.innerText)();
|
|
2471
|
+
} catch (error) {
|
|
2472
|
+
console.warn("`Embed`: Error running script:", error);
|
|
2473
|
+
}
|
|
2474
|
+
}
|
|
2475
|
+
}
|
|
2476
|
+
}
|
|
2477
|
+
let elem;
|
|
2478
|
+
function onUpdateFn_0() {
|
|
2479
|
+
if (elem && !ranInitFn()) {
|
|
2480
|
+
setRanInitFn(true);
|
|
2481
|
+
findAndRunScripts();
|
|
2482
|
+
}
|
|
2483
|
+
}
|
|
2484
|
+
createEffect(on(() => [elem, ranInitFn()], onUpdateFn_0));
|
|
2485
|
+
return <div class="builder-embed" ref={elem} innerHTML={props.content} />;
|
|
2486
|
+
}
|
|
2487
|
+
var embed_default = Embed;
|
|
2488
|
+
|
|
2489
|
+
// src/blocks/form/form/component-info.ts
|
|
2490
|
+
var componentInfo11 = {
|
|
2491
|
+
name: "Form:Form",
|
|
2492
|
+
// editableTags: ['builder-form-error']
|
|
2493
|
+
defaults: {
|
|
2494
|
+
responsiveStyles: {
|
|
2495
|
+
large: {
|
|
2496
|
+
marginTop: "15px",
|
|
2497
|
+
paddingBottom: "15px"
|
|
2498
|
+
}
|
|
2499
|
+
}
|
|
2500
|
+
},
|
|
2501
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fef36d2a846134910b64b88e6d18c5ca5",
|
|
2502
|
+
inputs: [{
|
|
2503
|
+
name: "sendSubmissionsTo",
|
|
2504
|
+
type: "string",
|
|
2505
|
+
// TODO: save to builder data and user can download as csv
|
|
2506
|
+
// TODO: easy for mode too or computed add/remove fields form mode
|
|
2507
|
+
// so you can edit details and high level mode at same time...
|
|
2508
|
+
// Later - more integrations like mailchimp
|
|
2509
|
+
// /api/v1/form-submit?to=mailchimp
|
|
2510
|
+
enum: [{
|
|
2511
|
+
label: "Send to email",
|
|
2512
|
+
value: "email",
|
|
2513
|
+
helperText: "Send form submissions to the email address of your choosing"
|
|
2514
|
+
}, {
|
|
2515
|
+
label: "Custom",
|
|
2516
|
+
value: "custom",
|
|
2517
|
+
helperText: "Handle where the form requests go manually with a little code, e.g. to your own custom backend"
|
|
2518
|
+
}],
|
|
2519
|
+
defaultValue: "email"
|
|
2520
|
+
}, {
|
|
2521
|
+
name: "sendSubmissionsToEmail",
|
|
2522
|
+
type: "string",
|
|
2523
|
+
required: true,
|
|
2524
|
+
// TODO: required: () => options.get("sendSubmissionsTo") === "email"
|
|
2525
|
+
defaultValue: "your@email.com",
|
|
2526
|
+
showIf: 'options.get("sendSubmissionsTo") === "email"'
|
|
2527
|
+
}, {
|
|
2528
|
+
name: "sendWithJs",
|
|
2529
|
+
type: "boolean",
|
|
2530
|
+
helperText: "Set to false to use basic html form action",
|
|
2531
|
+
defaultValue: true,
|
|
2532
|
+
showIf: 'options.get("sendSubmissionsTo") === "custom"'
|
|
2533
|
+
}, {
|
|
2534
|
+
name: "name",
|
|
2535
|
+
type: "string",
|
|
2536
|
+
defaultValue: "My form"
|
|
2537
|
+
// advanced: true
|
|
2538
|
+
}, {
|
|
2539
|
+
name: "action",
|
|
2540
|
+
type: "string",
|
|
2541
|
+
helperText: "URL to send the form data to",
|
|
2542
|
+
showIf: 'options.get("sendSubmissionsTo") === "custom"'
|
|
2543
|
+
}, {
|
|
2544
|
+
name: "contentType",
|
|
2545
|
+
type: "string",
|
|
2546
|
+
defaultValue: "application/json",
|
|
2547
|
+
advanced: true,
|
|
2548
|
+
// TODO: do automatically if file input
|
|
2549
|
+
enum: ["application/json", "multipart/form-data", "application/x-www-form-urlencoded"],
|
|
2550
|
+
showIf: 'options.get("sendSubmissionsTo") === "custom" && options.get("sendWithJs") === true'
|
|
2551
|
+
}, {
|
|
2552
|
+
name: "method",
|
|
2553
|
+
type: "string",
|
|
2554
|
+
showIf: 'options.get("sendSubmissionsTo") === "custom"',
|
|
2555
|
+
defaultValue: "POST",
|
|
2556
|
+
advanced: true
|
|
2557
|
+
}, {
|
|
2558
|
+
name: "previewState",
|
|
2559
|
+
type: "string",
|
|
2560
|
+
// TODO: persist: false flag
|
|
2561
|
+
enum: ["unsubmitted", "sending", "success", "error"],
|
|
2562
|
+
defaultValue: "unsubmitted",
|
|
2563
|
+
helperText: 'Choose a state to edit, e.g. choose "success" to show what users see on success and edit the message',
|
|
2564
|
+
showIf: 'options.get("sendSubmissionsTo") !== "zapier" && options.get("sendWithJs") === true'
|
|
2565
|
+
}, {
|
|
2566
|
+
name: "successUrl",
|
|
2567
|
+
type: "url",
|
|
2568
|
+
helperText: "Optional URL to redirect the user to on form submission success",
|
|
2569
|
+
showIf: 'options.get("sendSubmissionsTo") !== "zapier" && options.get("sendWithJs") === true'
|
|
2570
|
+
}, {
|
|
2571
|
+
name: "resetFormOnSubmit",
|
|
2572
|
+
type: "boolean",
|
|
2573
|
+
showIf: "options.get('sendSubmissionsTo') === 'custom' && options.get('sendWithJs') === true",
|
|
2574
|
+
advanced: true
|
|
2575
|
+
}, {
|
|
2576
|
+
name: "successMessage",
|
|
2577
|
+
type: "uiBlocks",
|
|
2578
|
+
hideFromUI: true,
|
|
2579
|
+
defaultValue: [{
|
|
2580
|
+
"@type": "@builder.io/sdk:Element",
|
|
2581
|
+
responsiveStyles: {
|
|
2582
|
+
large: {
|
|
2583
|
+
marginTop: "10px"
|
|
2584
|
+
}
|
|
2585
|
+
},
|
|
2586
|
+
component: {
|
|
2587
|
+
name: "Text",
|
|
2588
|
+
options: {
|
|
2589
|
+
text: "<span>Thanks!</span>"
|
|
2590
|
+
}
|
|
2591
|
+
}
|
|
2592
|
+
}]
|
|
2593
|
+
}, {
|
|
2594
|
+
name: "validate",
|
|
2595
|
+
type: "boolean",
|
|
2596
|
+
defaultValue: true,
|
|
2597
|
+
advanced: true
|
|
2598
|
+
}, {
|
|
2599
|
+
name: "errorMessagePath",
|
|
2600
|
+
type: "text",
|
|
2601
|
+
advanced: true,
|
|
2602
|
+
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" }}'
|
|
2603
|
+
}, {
|
|
2604
|
+
name: "errorMessage",
|
|
2605
|
+
type: "uiBlocks",
|
|
2606
|
+
hideFromUI: true,
|
|
2607
|
+
defaultValue: [{
|
|
2608
|
+
"@type": "@builder.io/sdk:Element",
|
|
2609
|
+
responsiveStyles: {
|
|
2610
|
+
large: {
|
|
2611
|
+
marginTop: "10px"
|
|
2612
|
+
}
|
|
2613
|
+
},
|
|
2614
|
+
bindings: {
|
|
2615
|
+
"component.options.text": "state.formErrorMessage || block.component.options.text"
|
|
2616
|
+
},
|
|
2617
|
+
component: {
|
|
2618
|
+
name: "Text",
|
|
2619
|
+
options: {
|
|
2620
|
+
text: "<span>Form submission error :( Please check your answers and try again</span>"
|
|
2621
|
+
}
|
|
2622
|
+
}
|
|
2623
|
+
}]
|
|
2624
|
+
}, {
|
|
2625
|
+
name: "sendingMessage",
|
|
2626
|
+
type: "uiBlocks",
|
|
2627
|
+
hideFromUI: true,
|
|
2628
|
+
defaultValue: [{
|
|
2629
|
+
"@type": "@builder.io/sdk:Element",
|
|
2630
|
+
responsiveStyles: {
|
|
2631
|
+
large: {
|
|
2632
|
+
marginTop: "10px"
|
|
2633
|
+
}
|
|
2634
|
+
},
|
|
2635
|
+
component: {
|
|
2636
|
+
name: "Text",
|
|
2637
|
+
options: {
|
|
2638
|
+
text: "<span>Sending...</span>"
|
|
2639
|
+
}
|
|
2640
|
+
}
|
|
2641
|
+
}]
|
|
2642
|
+
}, {
|
|
2643
|
+
name: "customHeaders",
|
|
2644
|
+
type: "map",
|
|
2645
|
+
valueType: {
|
|
2646
|
+
type: "string"
|
|
2647
|
+
},
|
|
2648
|
+
advanced: true,
|
|
2649
|
+
showIf: 'options.get("sendSubmissionsTo") === "custom" && options.get("sendWithJs") === true'
|
|
2650
|
+
}],
|
|
2651
|
+
noWrap: true,
|
|
2652
|
+
canHaveChildren: true,
|
|
2653
|
+
defaultChildren: [{
|
|
2654
|
+
"@type": "@builder.io/sdk:Element",
|
|
2655
|
+
responsiveStyles: {
|
|
2656
|
+
large: {
|
|
2657
|
+
marginTop: "10px"
|
|
2658
|
+
}
|
|
2659
|
+
},
|
|
2660
|
+
component: {
|
|
2661
|
+
name: "Text",
|
|
2662
|
+
options: {
|
|
2663
|
+
text: "<span>Enter your name</span>"
|
|
2664
|
+
}
|
|
2665
|
+
}
|
|
2666
|
+
}, {
|
|
2667
|
+
"@type": "@builder.io/sdk:Element",
|
|
2668
|
+
responsiveStyles: {
|
|
2669
|
+
large: {
|
|
2670
|
+
marginTop: "10px"
|
|
2671
|
+
}
|
|
2672
|
+
},
|
|
2673
|
+
component: {
|
|
2674
|
+
name: "Form:Input",
|
|
2675
|
+
options: {
|
|
2676
|
+
name: "name",
|
|
2677
|
+
placeholder: "Jane Doe"
|
|
2678
|
+
}
|
|
2679
|
+
}
|
|
2680
|
+
}, {
|
|
2681
|
+
"@type": "@builder.io/sdk:Element",
|
|
2682
|
+
responsiveStyles: {
|
|
2683
|
+
large: {
|
|
2684
|
+
marginTop: "10px"
|
|
2685
|
+
}
|
|
2686
|
+
},
|
|
2687
|
+
component: {
|
|
2688
|
+
name: "Text",
|
|
2689
|
+
options: {
|
|
2690
|
+
text: "<span>Enter your email</span>"
|
|
2691
|
+
}
|
|
2692
|
+
}
|
|
2693
|
+
}, {
|
|
2694
|
+
"@type": "@builder.io/sdk:Element",
|
|
2695
|
+
responsiveStyles: {
|
|
2696
|
+
large: {
|
|
2697
|
+
marginTop: "10px"
|
|
2698
|
+
}
|
|
2699
|
+
},
|
|
2700
|
+
component: {
|
|
2701
|
+
name: "Form:Input",
|
|
2702
|
+
options: {
|
|
2703
|
+
name: "email",
|
|
2704
|
+
placeholder: "jane@doe.com"
|
|
2705
|
+
}
|
|
2706
|
+
}
|
|
2707
|
+
}, {
|
|
2708
|
+
"@type": "@builder.io/sdk:Element",
|
|
2709
|
+
responsiveStyles: {
|
|
2710
|
+
large: {
|
|
2711
|
+
marginTop: "10px"
|
|
2712
|
+
}
|
|
2713
|
+
},
|
|
2714
|
+
component: {
|
|
2715
|
+
name: "Form:SubmitButton",
|
|
2716
|
+
options: {
|
|
2717
|
+
text: "Submit"
|
|
2718
|
+
}
|
|
2719
|
+
}
|
|
2720
|
+
}]
|
|
2721
|
+
};
|
|
2722
|
+
|
|
2723
|
+
// src/blocks/form/form/form.tsx
|
|
2724
|
+
import { Show as Show8, For as For5, createSignal as createSignal9 } from "solid-js";
|
|
2725
|
+
import { css as css4 } from "solid-styled-components";
|
|
2726
|
+
|
|
2727
|
+
// src/functions/get-env.ts
|
|
2728
|
+
var validEnvList = ["production", "qa", "test", "development", "dev", "cdn-qa", "cloud", "fast", "cdn2", "cdn-prod"];
|
|
2729
|
+
var getEnv = () => {
|
|
2730
|
+
const env = "development";
|
|
2731
|
+
return validEnvList.includes(env) ? env : "production";
|
|
2732
|
+
};
|
|
2733
|
+
|
|
2734
|
+
// src/functions/get.ts
|
|
2735
|
+
var get = (obj, path, defaultValue) => {
|
|
2736
|
+
const result = String.prototype.split.call(path, /[,[\].]+?/).filter(Boolean).reduce((res, key) => res !== null && res !== void 0 ? res[key] : res, obj);
|
|
2737
|
+
return result === void 0 || result === obj ? defaultValue : result;
|
|
2738
|
+
};
|
|
2739
|
+
|
|
2740
|
+
// src/blocks/form/form/form.tsx
|
|
2741
|
+
function FormComponent(props) {
|
|
2742
|
+
const [formState, setFormState] = createSignal9("unsubmitted");
|
|
2743
|
+
const [responseData, setResponseData] = createSignal9(null);
|
|
2744
|
+
const [formErrorMessage, setFormErrorMessage] = createSignal9("");
|
|
2745
|
+
function mergeNewRootState(newData) {
|
|
2746
|
+
const combinedState = {
|
|
2747
|
+
...props.builderContext.rootState,
|
|
2748
|
+
...newData
|
|
2749
|
+
};
|
|
2750
|
+
if (props.builderContext.rootSetState) {
|
|
2751
|
+
props.builderContext.rootSetState?.(combinedState);
|
|
2752
|
+
} else {
|
|
2753
|
+
props.builderContext.rootState = combinedState;
|
|
2754
|
+
}
|
|
2755
|
+
}
|
|
2756
|
+
function submissionState() {
|
|
2757
|
+
return isEditing() && props.previewState || formState();
|
|
2758
|
+
}
|
|
2759
|
+
function onSubmit(event) {
|
|
2760
|
+
const sendWithJsProp = props.sendWithJs || props.sendSubmissionsTo === "email";
|
|
2761
|
+
if (props.sendSubmissionsTo === "zapier") {
|
|
2762
|
+
event.preventDefault();
|
|
2763
|
+
} else if (sendWithJsProp) {
|
|
2764
|
+
if (!(props.action || props.sendSubmissionsTo === "email")) {
|
|
2765
|
+
event.preventDefault();
|
|
2766
|
+
return;
|
|
2767
|
+
}
|
|
2768
|
+
event.preventDefault();
|
|
2769
|
+
const el = event.currentTarget;
|
|
2770
|
+
const headers = props.customHeaders || {};
|
|
2771
|
+
let body;
|
|
2772
|
+
const formData = new FormData(el);
|
|
2773
|
+
const formPairs = Array.from(
|
|
2774
|
+
event.currentTarget.querySelectorAll("input,select,textarea")
|
|
2775
|
+
).filter((el2) => !!el2.name).map((el2) => {
|
|
2776
|
+
let value;
|
|
2777
|
+
const key = el2.name;
|
|
2778
|
+
if (el2 instanceof HTMLInputElement) {
|
|
2779
|
+
if (el2.type === "radio") {
|
|
2780
|
+
if (el2.checked) {
|
|
2781
|
+
value = el2.name;
|
|
2782
|
+
return {
|
|
2783
|
+
key,
|
|
2784
|
+
value
|
|
2785
|
+
};
|
|
2786
|
+
}
|
|
2787
|
+
} else if (el2.type === "checkbox") {
|
|
2788
|
+
value = el2.checked;
|
|
2789
|
+
} else if (el2.type === "number" || el2.type === "range") {
|
|
2790
|
+
const num = el2.valueAsNumber;
|
|
2791
|
+
if (!isNaN(num)) {
|
|
2792
|
+
value = num;
|
|
2793
|
+
}
|
|
2794
|
+
} else if (el2.type === "file") {
|
|
2795
|
+
value = el2.files;
|
|
2796
|
+
} else {
|
|
2797
|
+
value = el2.value;
|
|
2798
|
+
}
|
|
2799
|
+
} else {
|
|
2800
|
+
value = el2.value;
|
|
2801
|
+
}
|
|
2802
|
+
return {
|
|
2803
|
+
key,
|
|
2804
|
+
value
|
|
2805
|
+
};
|
|
2806
|
+
});
|
|
2807
|
+
let formContentType = props.contentType;
|
|
2808
|
+
if (props.sendSubmissionsTo === "email") {
|
|
2809
|
+
formContentType = "multipart/form-data";
|
|
2810
|
+
}
|
|
2811
|
+
Array.from(formPairs).forEach(({ value }) => {
|
|
2812
|
+
if (value instanceof File || Array.isArray(value) && value[0] instanceof File || value instanceof FileList) {
|
|
2813
|
+
formContentType = "multipart/form-data";
|
|
2814
|
+
}
|
|
2815
|
+
});
|
|
2816
|
+
if (formContentType !== "application/json") {
|
|
2817
|
+
body = formData;
|
|
2818
|
+
} else {
|
|
2819
|
+
const json = {};
|
|
2820
|
+
Array.from(formPairs).forEach(({ value, key }) => {
|
|
2821
|
+
set(json, key, value);
|
|
2822
|
+
});
|
|
2823
|
+
body = JSON.stringify(json);
|
|
2824
|
+
}
|
|
2825
|
+
if (formContentType && formContentType !== "multipart/form-data") {
|
|
2826
|
+
if (
|
|
2827
|
+
/* Zapier doesn't allow content-type header to be sent from browsers */
|
|
2828
|
+
!(sendWithJsProp && props.action?.includes("zapier.com"))
|
|
2829
|
+
) {
|
|
2830
|
+
headers["content-type"] = formContentType;
|
|
2831
|
+
}
|
|
2832
|
+
}
|
|
2833
|
+
const presubmitEvent = new CustomEvent("presubmit", {
|
|
2834
|
+
detail: {
|
|
2835
|
+
body
|
|
2836
|
+
}
|
|
2837
|
+
});
|
|
2838
|
+
if (formRef) {
|
|
2839
|
+
formRef.dispatchEvent(presubmitEvent);
|
|
2840
|
+
if (presubmitEvent.defaultPrevented) {
|
|
2841
|
+
return;
|
|
2842
|
+
}
|
|
2843
|
+
}
|
|
2844
|
+
setFormState("sending");
|
|
2845
|
+
const formUrl = `${getEnv() === "dev" ? "http://localhost:5000" : "https://builder.io"}/api/v1/form-submit?apiKey=${props.builderContext.apiKey}&to=${btoa(
|
|
2846
|
+
props.sendSubmissionsToEmail || ""
|
|
2847
|
+
)}&name=${encodeURIComponent(props.name || "")}`;
|
|
2848
|
+
fetch(
|
|
2849
|
+
props.sendSubmissionsTo === "email" ? formUrl : props.action,
|
|
2850
|
+
{
|
|
2851
|
+
body,
|
|
2852
|
+
headers,
|
|
2853
|
+
method: props.method || "post"
|
|
2854
|
+
}
|
|
2855
|
+
).then(
|
|
2856
|
+
async (res) => {
|
|
2857
|
+
let body2;
|
|
2858
|
+
const contentType = res.headers.get("content-type");
|
|
2859
|
+
if (contentType && contentType.indexOf("application/json") !== -1) {
|
|
2860
|
+
body2 = await res.json();
|
|
2861
|
+
} else {
|
|
2862
|
+
body2 = await res.text();
|
|
2863
|
+
}
|
|
2864
|
+
if (!res.ok && props.errorMessagePath) {
|
|
2865
|
+
let message = get(body2, props.errorMessagePath);
|
|
2866
|
+
if (message) {
|
|
2867
|
+
if (typeof message !== "string") {
|
|
2868
|
+
message = JSON.stringify(message);
|
|
2869
|
+
}
|
|
2870
|
+
setFormErrorMessage(message);
|
|
2871
|
+
mergeNewRootState({
|
|
2872
|
+
formErrorMessage: message
|
|
2873
|
+
});
|
|
2874
|
+
}
|
|
2875
|
+
}
|
|
2876
|
+
setResponseData(body2);
|
|
2877
|
+
setFormState(res.ok ? "success" : "error");
|
|
2878
|
+
if (res.ok) {
|
|
2879
|
+
const submitSuccessEvent = new CustomEvent("submit:success", {
|
|
2880
|
+
detail: {
|
|
2881
|
+
res,
|
|
2882
|
+
body: body2
|
|
2883
|
+
}
|
|
2884
|
+
});
|
|
2885
|
+
if (formRef) {
|
|
2886
|
+
formRef.dispatchEvent(submitSuccessEvent);
|
|
2887
|
+
if (submitSuccessEvent.defaultPrevented) {
|
|
2888
|
+
return;
|
|
2889
|
+
}
|
|
2890
|
+
if (props.resetFormOnSubmit !== false) {
|
|
2891
|
+
formRef.reset();
|
|
2892
|
+
}
|
|
2893
|
+
}
|
|
2894
|
+
if (props.successUrl) {
|
|
2895
|
+
if (formRef) {
|
|
2896
|
+
const event2 = new CustomEvent("route", {
|
|
2897
|
+
detail: {
|
|
2898
|
+
url: props.successUrl
|
|
2899
|
+
}
|
|
2900
|
+
});
|
|
2901
|
+
formRef.dispatchEvent(event2);
|
|
2902
|
+
if (!event2.defaultPrevented) {
|
|
2903
|
+
location.href = props.successUrl;
|
|
2904
|
+
}
|
|
2905
|
+
} else {
|
|
2906
|
+
location.href = props.successUrl;
|
|
2907
|
+
}
|
|
2908
|
+
}
|
|
2909
|
+
}
|
|
2910
|
+
},
|
|
2911
|
+
(err) => {
|
|
2912
|
+
const submitErrorEvent = new CustomEvent("submit:error", {
|
|
2913
|
+
detail: {
|
|
2914
|
+
error: err
|
|
2915
|
+
}
|
|
2916
|
+
});
|
|
2917
|
+
if (formRef) {
|
|
2918
|
+
formRef.dispatchEvent(submitErrorEvent);
|
|
2919
|
+
if (submitErrorEvent.defaultPrevented) {
|
|
2920
|
+
return;
|
|
2921
|
+
}
|
|
2922
|
+
}
|
|
2923
|
+
setResponseData(err);
|
|
2924
|
+
setFormState("error");
|
|
2925
|
+
}
|
|
2926
|
+
);
|
|
2927
|
+
}
|
|
2928
|
+
}
|
|
2929
|
+
let formRef;
|
|
2930
|
+
return <form
|
|
2931
|
+
validate={props.validate}
|
|
2932
|
+
ref={formRef}
|
|
2933
|
+
action={!props.sendWithJs && props.action}
|
|
2934
|
+
method={props.method}
|
|
2935
|
+
name={props.name}
|
|
2936
|
+
onSubmit={(event) => onSubmit(event)}
|
|
2937
|
+
{...{}}
|
|
2938
|
+
{...props.attributes}
|
|
2939
|
+
>
|
|
2940
|
+
<Show8 when={props.builderBlock && props.builderBlock.children}><For5 each={props.builderBlock?.children}>{(block, _index) => {
|
|
2941
|
+
const idx = _index();
|
|
2942
|
+
return <Block_default
|
|
2943
|
+
key={`form-block-${idx}`}
|
|
2944
|
+
block={block}
|
|
2945
|
+
context={props.builderContext}
|
|
2946
|
+
registeredComponents={props.builderComponents}
|
|
2947
|
+
linkComponent={props.builderLinkComponent}
|
|
2948
|
+
/>;
|
|
2949
|
+
}}</For5></Show8>
|
|
2950
|
+
<Show8 when={submissionState() === "error"}><Blocks_default
|
|
2951
|
+
path="errorMessage"
|
|
2952
|
+
blocks={props.errorMessage}
|
|
2953
|
+
context={props.builderContext}
|
|
2954
|
+
/></Show8>
|
|
2955
|
+
<Show8 when={submissionState() === "sending"}><Blocks_default
|
|
2956
|
+
path="sendingMessage"
|
|
2957
|
+
blocks={props.sendingMessage}
|
|
2958
|
+
context={props.builderContext}
|
|
2959
|
+
/></Show8>
|
|
2960
|
+
<Show8 when={submissionState() === "error" && responseData()}><pre
|
|
2961
|
+
class={"builder-form-error-text " + css4({
|
|
2962
|
+
padding: "10px",
|
|
2963
|
+
color: "red",
|
|
2964
|
+
textAlign: "center"
|
|
2965
|
+
})}
|
|
2966
|
+
>{JSON.stringify(responseData(), null, 2)}</pre></Show8>
|
|
2967
|
+
<Show8 when={submissionState() === "success"}><Blocks_default
|
|
2968
|
+
path="successMessage"
|
|
2969
|
+
blocks={props.successMessage}
|
|
2970
|
+
context={props.builderContext}
|
|
2971
|
+
/></Show8>
|
|
2972
|
+
</form>;
|
|
2973
|
+
}
|
|
2974
|
+
var form_default = FormComponent;
|
|
2975
|
+
|
|
2976
|
+
// src/blocks/form/input/component-info.ts
|
|
2977
|
+
var componentInfo12 = {
|
|
2978
|
+
name: "Form:Input",
|
|
2979
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fad6f37889d9e40bbbbc72cdb5875d6ca",
|
|
2980
|
+
inputs: [
|
|
2981
|
+
{
|
|
2982
|
+
name: "type",
|
|
2983
|
+
type: "text",
|
|
2984
|
+
enum: ["text", "number", "email", "url", "checkbox", "radio", "range", "date", "datetime-local", "search", "tel", "time", "file", "month", "week", "password", "color", "hidden"],
|
|
2985
|
+
defaultValue: "text"
|
|
2986
|
+
},
|
|
2987
|
+
{
|
|
2988
|
+
name: "name",
|
|
2989
|
+
type: "string",
|
|
2990
|
+
required: true,
|
|
2991
|
+
helperText: 'Every input in a form needs a unique name describing what it takes, e.g. "email"'
|
|
2992
|
+
},
|
|
2993
|
+
{
|
|
2994
|
+
name: "placeholder",
|
|
2995
|
+
type: "string",
|
|
2996
|
+
defaultValue: "Hello there",
|
|
2997
|
+
helperText: "Text to display when there is no value"
|
|
2998
|
+
},
|
|
2999
|
+
// TODO: handle value vs default value automatically like ng-model
|
|
3000
|
+
{
|
|
3001
|
+
name: "defaultValue",
|
|
3002
|
+
type: "string"
|
|
3003
|
+
},
|
|
3004
|
+
{
|
|
3005
|
+
name: "value",
|
|
3006
|
+
type: "string",
|
|
3007
|
+
advanced: true
|
|
3008
|
+
},
|
|
3009
|
+
{
|
|
3010
|
+
name: "required",
|
|
3011
|
+
type: "boolean",
|
|
3012
|
+
helperText: "Is this input required to be filled out to submit a form",
|
|
3013
|
+
defaultValue: false
|
|
3014
|
+
}
|
|
3015
|
+
],
|
|
3016
|
+
noWrap: true,
|
|
3017
|
+
static: true,
|
|
3018
|
+
defaultStyles: {
|
|
3019
|
+
paddingTop: "10px",
|
|
3020
|
+
paddingBottom: "10px",
|
|
3021
|
+
paddingLeft: "10px",
|
|
3022
|
+
paddingRight: "10px",
|
|
3023
|
+
borderRadius: "3px",
|
|
3024
|
+
borderWidth: "1px",
|
|
3025
|
+
borderStyle: "solid",
|
|
3026
|
+
borderColor: "#ccc"
|
|
3027
|
+
}
|
|
3028
|
+
};
|
|
3029
|
+
|
|
3030
|
+
// src/blocks/form/input/input.tsx
|
|
3031
|
+
function FormInputComponent(props) {
|
|
3032
|
+
return <input
|
|
3033
|
+
{...{}}
|
|
3034
|
+
{...props.attributes}
|
|
3035
|
+
key={isEditing() && props.defaultValue ? props.defaultValue : "default-key"}
|
|
3036
|
+
placeholder={props.placeholder}
|
|
3037
|
+
type={props.type}
|
|
3038
|
+
name={props.name}
|
|
3039
|
+
value={props.value}
|
|
3040
|
+
defaultValue={props.defaultValue}
|
|
3041
|
+
required={props.required}
|
|
3042
|
+
/>;
|
|
3043
|
+
}
|
|
3044
|
+
var input_default = FormInputComponent;
|
|
3045
|
+
|
|
3046
|
+
// src/blocks/form/select/component-info.ts
|
|
3047
|
+
var componentInfo13 = {
|
|
3048
|
+
name: "Form:Select",
|
|
3049
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F83acca093fb24aaf94dee136e9a4b045",
|
|
3050
|
+
defaultStyles: {
|
|
3051
|
+
alignSelf: "flex-start"
|
|
3052
|
+
},
|
|
3053
|
+
inputs: [{
|
|
3054
|
+
name: "options",
|
|
3055
|
+
type: "list",
|
|
3056
|
+
required: true,
|
|
3057
|
+
subFields: [{
|
|
3058
|
+
name: "value",
|
|
3059
|
+
type: "text",
|
|
3060
|
+
required: true
|
|
3061
|
+
}, {
|
|
3062
|
+
name: "name",
|
|
3063
|
+
type: "text"
|
|
3064
|
+
}],
|
|
3065
|
+
defaultValue: [{
|
|
3066
|
+
value: "option 1"
|
|
3067
|
+
}, {
|
|
3068
|
+
value: "option 2"
|
|
3069
|
+
}]
|
|
3070
|
+
}, {
|
|
3071
|
+
name: "name",
|
|
3072
|
+
type: "string",
|
|
3073
|
+
required: true,
|
|
3074
|
+
helperText: 'Every select in a form needs a unique name describing what it gets, e.g. "email"'
|
|
3075
|
+
}, {
|
|
3076
|
+
name: "defaultValue",
|
|
3077
|
+
type: "string"
|
|
3078
|
+
}, {
|
|
3079
|
+
name: "value",
|
|
3080
|
+
type: "string",
|
|
3081
|
+
advanced: true
|
|
3082
|
+
}, {
|
|
3083
|
+
name: "required",
|
|
3084
|
+
type: "boolean",
|
|
3085
|
+
defaultValue: false
|
|
3086
|
+
}],
|
|
3087
|
+
static: true,
|
|
3088
|
+
noWrap: true
|
|
3089
|
+
};
|
|
3090
|
+
|
|
3091
|
+
// src/blocks/form/select/select.tsx
|
|
3092
|
+
import { For as For6 } from "solid-js";
|
|
3093
|
+
function SelectComponent(props) {
|
|
3094
|
+
return <select
|
|
3095
|
+
{...{}}
|
|
3096
|
+
{...props.attributes}
|
|
3097
|
+
value={props.value}
|
|
3098
|
+
key={isEditing() && props.defaultValue ? props.defaultValue : "default-key"}
|
|
3099
|
+
defaultValue={props.defaultValue}
|
|
3100
|
+
name={props.name}
|
|
3101
|
+
><For6 each={props.options}>{(option, _index) => {
|
|
3102
|
+
const index = _index();
|
|
3103
|
+
return <option value={option.value}>{option.name || option.value}</option>;
|
|
3104
|
+
}}</For6></select>;
|
|
3105
|
+
}
|
|
3106
|
+
var select_default = SelectComponent;
|
|
3107
|
+
|
|
3108
|
+
// src/blocks/form/submit-button/component-info.ts
|
|
3109
|
+
var componentInfo14 = {
|
|
3110
|
+
name: "Form:SubmitButton",
|
|
3111
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fdf2820ffed1f4349a94c40b3221f5b98",
|
|
3112
|
+
defaultStyles: {
|
|
3113
|
+
appearance: "none",
|
|
3114
|
+
paddingTop: "15px",
|
|
3115
|
+
paddingBottom: "15px",
|
|
3116
|
+
paddingLeft: "25px",
|
|
3117
|
+
paddingRight: "25px",
|
|
3118
|
+
backgroundColor: "#3898EC",
|
|
3119
|
+
color: "white",
|
|
3120
|
+
borderRadius: "4px",
|
|
3121
|
+
cursor: "pointer"
|
|
3122
|
+
},
|
|
3123
|
+
inputs: [{
|
|
3124
|
+
name: "text",
|
|
3125
|
+
type: "text",
|
|
3126
|
+
defaultValue: "Click me"
|
|
3127
|
+
}],
|
|
3128
|
+
static: true,
|
|
3129
|
+
noWrap: true
|
|
3130
|
+
// TODO: optional children? maybe as optional form input
|
|
3131
|
+
// that only shows if advanced setting is flipped
|
|
3132
|
+
// TODO: defaultChildren
|
|
3133
|
+
// canHaveChildren: true,
|
|
3134
|
+
};
|
|
3135
|
+
|
|
3136
|
+
// src/blocks/form/submit-button/submit-button.tsx
|
|
3137
|
+
function SubmitButton(props) {
|
|
3138
|
+
return <button type="submit" {...{}} {...props.attributes}>{props.text}</button>;
|
|
3139
|
+
}
|
|
3140
|
+
var submit_button_default = SubmitButton;
|
|
3141
|
+
|
|
3142
|
+
// src/blocks/img/component-info.ts
|
|
3143
|
+
var componentInfo15 = {
|
|
3144
|
+
// friendlyName?
|
|
3145
|
+
name: "Raw:Img",
|
|
3146
|
+
hideFromInsertMenu: true,
|
|
3147
|
+
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",
|
|
3148
|
+
inputs: [{
|
|
3149
|
+
name: "image",
|
|
3150
|
+
bubble: true,
|
|
3151
|
+
type: "file",
|
|
3152
|
+
allowedFileTypes: ["jpeg", "jpg", "png", "svg", "gif", "webp"],
|
|
3153
|
+
required: true
|
|
3154
|
+
}],
|
|
3155
|
+
noWrap: true,
|
|
3156
|
+
static: true
|
|
3157
|
+
};
|
|
3158
|
+
|
|
3159
|
+
// src/blocks/img/img.tsx
|
|
3160
|
+
function ImgComponent(props) {
|
|
3161
|
+
return <img
|
|
3162
|
+
style={{
|
|
3163
|
+
"object-fit": props.backgroundSize || "cover",
|
|
3164
|
+
"object-position": props.backgroundPosition || "center"
|
|
3165
|
+
}}
|
|
3166
|
+
key={isEditing() && props.imgSrc || "default-key"}
|
|
3167
|
+
alt={props.altText}
|
|
3168
|
+
src={props.imgSrc || props.image}
|
|
3169
|
+
{...{}}
|
|
3170
|
+
{...props.attributes}
|
|
3171
|
+
/>;
|
|
3172
|
+
}
|
|
3173
|
+
var img_default = ImgComponent;
|
|
3174
|
+
|
|
3175
|
+
// src/blocks/video/component-info.ts
|
|
3176
|
+
var componentInfo16 = {
|
|
3177
|
+
name: "Video",
|
|
3178
|
+
canHaveChildren: true,
|
|
3179
|
+
defaultStyles: {
|
|
3180
|
+
minHeight: "20px",
|
|
3181
|
+
minWidth: "20px"
|
|
3182
|
+
},
|
|
3183
|
+
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",
|
|
3184
|
+
inputs: [{
|
|
3185
|
+
name: "video",
|
|
3186
|
+
type: "file",
|
|
3187
|
+
allowedFileTypes: ["mp4"],
|
|
3188
|
+
bubble: true,
|
|
3189
|
+
defaultValue: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/assets%2FKQlEmWDxA0coC3PK6UvkrjwkIGI2%2F28cb070609f546cdbe5efa20e931aa4b?alt=media&token=912e9551-7a7c-4dfb-86b6-3da1537d1a7f",
|
|
3190
|
+
required: true
|
|
3191
|
+
}, {
|
|
3192
|
+
name: "posterImage",
|
|
3193
|
+
type: "file",
|
|
3194
|
+
allowedFileTypes: ["jpeg", "png"],
|
|
3195
|
+
helperText: "Image to show before the video plays"
|
|
3196
|
+
}, {
|
|
3197
|
+
name: "autoPlay",
|
|
3198
|
+
type: "boolean",
|
|
3199
|
+
defaultValue: true
|
|
3200
|
+
}, {
|
|
3201
|
+
name: "controls",
|
|
3202
|
+
type: "boolean",
|
|
3203
|
+
defaultValue: false
|
|
3204
|
+
}, {
|
|
3205
|
+
name: "muted",
|
|
3206
|
+
type: "boolean",
|
|
3207
|
+
defaultValue: true
|
|
3208
|
+
}, {
|
|
3209
|
+
name: "loop",
|
|
3210
|
+
type: "boolean",
|
|
3211
|
+
defaultValue: true
|
|
3212
|
+
}, {
|
|
3213
|
+
name: "playsInline",
|
|
3214
|
+
type: "boolean",
|
|
3215
|
+
defaultValue: true
|
|
3216
|
+
}, {
|
|
3217
|
+
name: "fit",
|
|
3218
|
+
type: "text",
|
|
3219
|
+
defaultValue: "cover",
|
|
3220
|
+
enum: ["contain", "cover", "fill", "auto"]
|
|
2568
3221
|
}, {
|
|
2569
3222
|
name: "preload",
|
|
2570
3223
|
type: "text",
|
|
@@ -2604,7 +3257,7 @@ var componentInfo12 = {
|
|
|
2604
3257
|
};
|
|
2605
3258
|
|
|
2606
3259
|
// src/blocks/video/video.tsx
|
|
2607
|
-
import { Show as
|
|
3260
|
+
import { Show as Show9 } from "solid-js";
|
|
2608
3261
|
function Video(props) {
|
|
2609
3262
|
function videoProps() {
|
|
2610
3263
|
return {
|
|
@@ -2655,8 +3308,8 @@ function Video(props) {
|
|
|
2655
3308
|
}}
|
|
2656
3309
|
src={props.video || "no-src"}
|
|
2657
3310
|
poster={props.posterImage}
|
|
2658
|
-
><
|
|
2659
|
-
<
|
|
3311
|
+
><Show9 when={!props.lazyLoad}><source type="video/mp4" src={props.video} /></Show9></video>
|
|
3312
|
+
<Show9
|
|
2660
3313
|
when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}
|
|
2661
3314
|
><div
|
|
2662
3315
|
style={{
|
|
@@ -2665,15 +3318,15 @@ function Video(props) {
|
|
|
2665
3318
|
"pointer-events": "none",
|
|
2666
3319
|
"font-size": "0px"
|
|
2667
3320
|
}}
|
|
2668
|
-
/></
|
|
2669
|
-
<
|
|
3321
|
+
/></Show9>
|
|
3322
|
+
<Show9 when={props.builderBlock?.children?.length && props.fitContent}><div
|
|
2670
3323
|
style={{
|
|
2671
3324
|
display: "flex",
|
|
2672
3325
|
"flex-direction": "column",
|
|
2673
3326
|
"align-items": "stretch"
|
|
2674
3327
|
}}
|
|
2675
|
-
>{props.children}</div></
|
|
2676
|
-
<
|
|
3328
|
+
>{props.children}</div></Show9>
|
|
3329
|
+
<Show9 when={props.builderBlock?.children?.length && !props.fitContent}><div
|
|
2677
3330
|
style={{
|
|
2678
3331
|
"pointer-events": "none",
|
|
2679
3332
|
display: "flex",
|
|
@@ -2685,11 +3338,38 @@ function Video(props) {
|
|
|
2685
3338
|
width: "100%",
|
|
2686
3339
|
height: "100%"
|
|
2687
3340
|
}}
|
|
2688
|
-
>{props.children}</div></
|
|
3341
|
+
>{props.children}</div></Show9>
|
|
2689
3342
|
</div>;
|
|
2690
3343
|
}
|
|
2691
3344
|
var video_default = Video;
|
|
2692
3345
|
|
|
3346
|
+
// src/constants/extra-components.ts
|
|
3347
|
+
var getExtraComponents = () => [{
|
|
3348
|
+
component: custom_code_default,
|
|
3349
|
+
...componentInfo9
|
|
3350
|
+
}, {
|
|
3351
|
+
component: embed_default,
|
|
3352
|
+
...componentInfo10
|
|
3353
|
+
}, ...TARGET === "rsc" ? [] : [{
|
|
3354
|
+
component: form_default,
|
|
3355
|
+
...componentInfo11
|
|
3356
|
+
}, {
|
|
3357
|
+
component: input_default,
|
|
3358
|
+
...componentInfo12
|
|
3359
|
+
}, {
|
|
3360
|
+
component: submit_button_default,
|
|
3361
|
+
...componentInfo14
|
|
3362
|
+
}, {
|
|
3363
|
+
component: select_default,
|
|
3364
|
+
...componentInfo13
|
|
3365
|
+
}], {
|
|
3366
|
+
component: img_default,
|
|
3367
|
+
...componentInfo15
|
|
3368
|
+
}, {
|
|
3369
|
+
component: video_default,
|
|
3370
|
+
...componentInfo16
|
|
3371
|
+
}];
|
|
3372
|
+
|
|
2693
3373
|
// src/constants/builder-registered-components.ts
|
|
2694
3374
|
var getDefaultRegisteredComponents = () => [{
|
|
2695
3375
|
component: button_default,
|
|
@@ -2698,36 +3378,24 @@ var getDefaultRegisteredComponents = () => [{
|
|
|
2698
3378
|
component: columns_default,
|
|
2699
3379
|
...componentInfo2
|
|
2700
3380
|
}, {
|
|
2701
|
-
component:
|
|
3381
|
+
component: fragment_default,
|
|
2702
3382
|
...componentInfo3
|
|
2703
3383
|
}, {
|
|
2704
|
-
component:
|
|
3384
|
+
component: image_default,
|
|
2705
3385
|
...componentInfo4
|
|
2706
3386
|
}, {
|
|
2707
|
-
component:
|
|
3387
|
+
component: section_default,
|
|
2708
3388
|
...componentInfo5
|
|
2709
3389
|
}, {
|
|
2710
|
-
component:
|
|
3390
|
+
component: slot_default,
|
|
2711
3391
|
...componentInfo6
|
|
2712
|
-
}, {
|
|
2713
|
-
component: img_default,
|
|
2714
|
-
...componentInfo7
|
|
2715
|
-
}, {
|
|
2716
|
-
component: section_default,
|
|
2717
|
-
...componentInfo8
|
|
2718
3392
|
}, {
|
|
2719
3393
|
component: symbol_default,
|
|
2720
|
-
...
|
|
3394
|
+
...componentInfo7
|
|
2721
3395
|
}, {
|
|
2722
3396
|
component: text_default,
|
|
2723
|
-
...
|
|
2724
|
-
},
|
|
2725
|
-
component: video_default,
|
|
2726
|
-
...componentInfo12
|
|
2727
|
-
}, {
|
|
2728
|
-
component: slot_default,
|
|
2729
|
-
...componentInfo9
|
|
2730
|
-
}];
|
|
3397
|
+
...componentInfo8
|
|
3398
|
+
}, ...getExtraComponents()];
|
|
2731
3399
|
|
|
2732
3400
|
// src/functions/register-component.ts
|
|
2733
3401
|
var components = [];
|
|
@@ -2805,7 +3473,7 @@ function InlinedScript(props) {
|
|
|
2805
3473
|
var Inlined_script_default = InlinedScript;
|
|
2806
3474
|
|
|
2807
3475
|
// src/components/content/components/enable-editor.tsx
|
|
2808
|
-
import { Show as
|
|
3476
|
+
import { Show as Show10, onMount as onMount3, on as on2, createEffect as createEffect2, createSignal as createSignal11 } from "solid-js";
|
|
2809
3477
|
import { Dynamic as Dynamic5 } from "solid-js/web";
|
|
2810
3478
|
|
|
2811
3479
|
// src/helpers/preview-lru-cache/get.ts
|
|
@@ -3300,7 +3968,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
3300
3968
|
}
|
|
3301
3969
|
|
|
3302
3970
|
// src/constants/sdk-version.ts
|
|
3303
|
-
var SDK_VERSION = "0.13.
|
|
3971
|
+
var SDK_VERSION = "0.13.2";
|
|
3304
3972
|
|
|
3305
3973
|
// src/functions/register.ts
|
|
3306
3974
|
var registry = {};
|
|
@@ -3499,15 +4167,15 @@ var subscribeToEditor = (model, callback, options) => {
|
|
|
3499
4167
|
|
|
3500
4168
|
// src/components/content/components/enable-editor.tsx
|
|
3501
4169
|
function EnableEditor(props) {
|
|
3502
|
-
const [forceReRenderCount, setForceReRenderCount] =
|
|
3503
|
-
const [firstRender, setFirstRender] =
|
|
3504
|
-
const [lastUpdated, setLastUpdated] =
|
|
3505
|
-
const [shouldSendResetCookie, setShouldSendResetCookie] =
|
|
3506
|
-
const [ContentWrapper, setContentWrapper] =
|
|
4170
|
+
const [forceReRenderCount, setForceReRenderCount] = createSignal11(0);
|
|
4171
|
+
const [firstRender, setFirstRender] = createSignal11(true);
|
|
4172
|
+
const [lastUpdated, setLastUpdated] = createSignal11(0);
|
|
4173
|
+
const [shouldSendResetCookie, setShouldSendResetCookie] = createSignal11(false);
|
|
4174
|
+
const [ContentWrapper, setContentWrapper] = createSignal11(
|
|
3507
4175
|
props.contentWrapper || "div"
|
|
3508
4176
|
);
|
|
3509
|
-
const [httpReqsData, setHttpReqsData] =
|
|
3510
|
-
const [clicked, setClicked] =
|
|
4177
|
+
const [httpReqsData, setHttpReqsData] = createSignal11({});
|
|
4178
|
+
const [clicked, setClicked] = createSignal11(false);
|
|
3511
4179
|
function mergeNewRootState(newData) {
|
|
3512
4180
|
const combinedState = {
|
|
3513
4181
|
...props.builderContextSignal.rootState,
|
|
@@ -3771,7 +4439,7 @@ function EnableEditor(props) {
|
|
|
3771
4439
|
}
|
|
3772
4440
|
}
|
|
3773
4441
|
createEffect2(on2(() => [props.locale], onUpdateFn_6));
|
|
3774
|
-
return <builder_context_default.Provider value={props.builderContextSignal}><
|
|
4442
|
+
return <builder_context_default.Provider value={props.builderContextSignal}><Show10 when={props.builderContextSignal.content}><Dynamic5
|
|
3775
4443
|
class={`variant-${props.content?.testVariationId || props.content?.id}`}
|
|
3776
4444
|
{...{}}
|
|
3777
4445
|
key={forceReRenderCount()}
|
|
@@ -3786,12 +4454,12 @@ function EnableEditor(props) {
|
|
|
3786
4454
|
}}
|
|
3787
4455
|
{...props.contentWrapperProps}
|
|
3788
4456
|
component={ContentWrapper()}
|
|
3789
|
-
>{props.children}</Dynamic5></
|
|
4457
|
+
>{props.children}</Dynamic5></Show10></builder_context_default.Provider>;
|
|
3790
4458
|
}
|
|
3791
4459
|
var Enable_editor_default = EnableEditor;
|
|
3792
4460
|
|
|
3793
4461
|
// src/components/content/components/styles.tsx
|
|
3794
|
-
import { createSignal as
|
|
4462
|
+
import { createSignal as createSignal12 } from "solid-js";
|
|
3795
4463
|
|
|
3796
4464
|
// src/components/content/components/styles.helpers.ts
|
|
3797
4465
|
var getCssFromFont = (font) => {
|
|
@@ -3850,7 +4518,7 @@ var getCss = ({
|
|
|
3850
4518
|
|
|
3851
4519
|
// src/components/content/components/styles.tsx
|
|
3852
4520
|
function ContentStyles(props) {
|
|
3853
|
-
const [injectedStyles, setInjectedStyles] =
|
|
4521
|
+
const [injectedStyles, setInjectedStyles] = createSignal12(
|
|
3854
4522
|
`
|
|
3855
4523
|
${getCss({
|
|
3856
4524
|
cssCode: props.cssCode,
|
|
@@ -3920,7 +4588,7 @@ var getContentInitialValue = ({
|
|
|
3920
4588
|
|
|
3921
4589
|
// src/components/content/content.tsx
|
|
3922
4590
|
function ContentComponent(props) {
|
|
3923
|
-
const [scriptStr, setScriptStr] =
|
|
4591
|
+
const [scriptStr, setScriptStr] = createSignal13(
|
|
3924
4592
|
getUpdateVariantVisibilityScript({
|
|
3925
4593
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
3926
4594
|
variationId: props.content?.testVariationId,
|
|
@@ -3928,7 +4596,7 @@ function ContentComponent(props) {
|
|
|
3928
4596
|
contentId: props.content?.id
|
|
3929
4597
|
})
|
|
3930
4598
|
);
|
|
3931
|
-
const [registeredComponents, setRegisteredComponents] =
|
|
4599
|
+
const [registeredComponents, setRegisteredComponents] = createSignal13(
|
|
3932
4600
|
[
|
|
3933
4601
|
...getDefaultRegisteredComponents(),
|
|
3934
4602
|
// While this `components` object is deprecated, we must maintain support for it.
|
|
@@ -3949,7 +4617,7 @@ function ContentComponent(props) {
|
|
|
3949
4617
|
{}
|
|
3950
4618
|
)
|
|
3951
4619
|
);
|
|
3952
|
-
const [builderContextSignal, setBuilderContextSignal] =
|
|
4620
|
+
const [builderContextSignal, setBuilderContextSignal] = createSignal13({
|
|
3953
4621
|
content: getContentInitialValue({
|
|
3954
4622
|
content: props.content,
|
|
3955
4623
|
data: props.data
|
|
@@ -4014,12 +4682,12 @@ function ContentComponent(props) {
|
|
|
4014
4682
|
setBuilderContextSignal
|
|
4015
4683
|
}}
|
|
4016
4684
|
>
|
|
4017
|
-
<
|
|
4018
|
-
<
|
|
4685
|
+
<Show11 when={props.isSsrAbTest}><Inlined_script_default scriptStr={scriptStr()} /></Show11>
|
|
4686
|
+
<Show11 when={TARGET !== "reactNative"}><Styles_default
|
|
4019
4687
|
contentId={builderContextSignal().content?.id}
|
|
4020
4688
|
cssCode={builderContextSignal().content?.data?.cssCode}
|
|
4021
4689
|
customFonts={builderContextSignal().content?.data?.customFonts}
|
|
4022
|
-
/></
|
|
4690
|
+
/></Show11>
|
|
4023
4691
|
<Blocks_default
|
|
4024
4692
|
blocks={builderContextSignal().content?.data?.blocks}
|
|
4025
4693
|
context={builderContextSignal()}
|
|
@@ -4032,7 +4700,7 @@ var Content_default = ContentComponent;
|
|
|
4032
4700
|
|
|
4033
4701
|
// src/components/content-variants/content-variants.tsx
|
|
4034
4702
|
function ContentVariants(props) {
|
|
4035
|
-
const [shouldRenderVariants, setShouldRenderVariants] =
|
|
4703
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal14(
|
|
4036
4704
|
checkShouldRenderVariants({
|
|
4037
4705
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
4038
4706
|
content: props.content
|
|
@@ -4063,8 +4731,8 @@ function ContentVariants(props) {
|
|
|
4063
4731
|
setShouldRenderVariants(false);
|
|
4064
4732
|
});
|
|
4065
4733
|
return <>
|
|
4066
|
-
<
|
|
4067
|
-
<
|
|
4734
|
+
<Show12 when={!props.__isNestedRender && TARGET !== "reactNative"}><Inlined_script_default scriptStr={getScriptString()} /></Show12>
|
|
4735
|
+
<Show12 when={shouldRenderVariants()}>
|
|
4068
4736
|
<Inlined_styles_default
|
|
4069
4737
|
id={`variants-styles-${props.content?.id}`}
|
|
4070
4738
|
styles={hideVariantsStyleString()}
|
|
@@ -4072,7 +4740,7 @@ function ContentVariants(props) {
|
|
|
4072
4740
|
<Inlined_script_default
|
|
4073
4741
|
scriptStr={updateCookieAndStylesScriptStr()}
|
|
4074
4742
|
/>
|
|
4075
|
-
<
|
|
4743
|
+
<For7 each={getVariants(props.content)}>{(variant, _index) => {
|
|
4076
4744
|
const index = _index();
|
|
4077
4745
|
return <Content_default
|
|
4078
4746
|
key={variant.testVariationId}
|
|
@@ -4096,8 +4764,8 @@ function ContentVariants(props) {
|
|
|
4096
4764
|
contentWrapperProps={props.contentWrapperProps}
|
|
4097
4765
|
trustedHosts={props.trustedHosts}
|
|
4098
4766
|
/>;
|
|
4099
|
-
}}</
|
|
4100
|
-
</
|
|
4767
|
+
}}</For7>
|
|
4768
|
+
</Show12>
|
|
4101
4769
|
<Content_default
|
|
4102
4770
|
{...{}}
|
|
4103
4771
|
content={defaultContent()}
|
|
@@ -4150,7 +4818,7 @@ var fetchSymbolContent = async ({
|
|
|
4150
4818
|
|
|
4151
4819
|
// src/blocks/symbol/symbol.tsx
|
|
4152
4820
|
function Symbol(props) {
|
|
4153
|
-
const [contentToUse, setContentToUse] =
|
|
4821
|
+
const [contentToUse, setContentToUse] = createSignal15(props.symbol?.content);
|
|
4154
4822
|
function className() {
|
|
4155
4823
|
return [
|
|
4156
4824
|
...[props.attributes[getClassPropName()]],
|