@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/browser/index.jsx
CHANGED
|
@@ -785,7 +785,7 @@ function BlockStyles(props) {
|
|
|
785
785
|
}
|
|
786
786
|
return true;
|
|
787
787
|
}
|
|
788
|
-
function
|
|
788
|
+
function css5() {
|
|
789
789
|
const processedBlock = getProcessedBlock({
|
|
790
790
|
block: props.block,
|
|
791
791
|
localState: props.context.localState,
|
|
@@ -828,7 +828,7 @@ function BlockStyles(props) {
|
|
|
828
828
|
}) : "";
|
|
829
829
|
return [largeStylesClass, mediumStylesClass, smallStylesClass].join(" ");
|
|
830
830
|
}
|
|
831
|
-
return <Show2 when={TARGET !== "reactNative" &&
|
|
831
|
+
return <Show2 when={TARGET !== "reactNative" && css5() && canShowBlock()}><Inlined_styles_default styles={css5()} /></Show2>;
|
|
832
832
|
}
|
|
833
833
|
var Block_styles_default = BlockStyles;
|
|
834
834
|
|
|
@@ -1117,10 +1117,10 @@ function Block(props) {
|
|
|
1117
1117
|
componentOptions: {
|
|
1118
1118
|
...getBlockComponentOptions(processedBlock()),
|
|
1119
1119
|
builderContext: props.context,
|
|
1120
|
-
...blockComponent()?.name === "Core:Button" || blockComponent()?.name === "Symbol" || blockComponent()?.name === "Columns" ? {
|
|
1120
|
+
...blockComponent()?.name === "Core:Button" || blockComponent()?.name === "Symbol" || blockComponent()?.name === "Columns" || blockComponent()?.name === "Form:Form" ? {
|
|
1121
1121
|
builderLinkComponent: props.linkComponent
|
|
1122
1122
|
} : {},
|
|
1123
|
-
...blockComponent()?.name === "Symbol" || blockComponent()?.name === "Columns" ? {
|
|
1123
|
+
...blockComponent()?.name === "Symbol" || blockComponent()?.name === "Columns" || blockComponent()?.name === "Form:Form" ? {
|
|
1124
1124
|
builderComponents: props.registeredComponents
|
|
1125
1125
|
} : {}
|
|
1126
1126
|
},
|
|
@@ -1591,10 +1591,10 @@ function SectionComponent(props) {
|
|
|
1591
1591
|
var section_default = SectionComponent;
|
|
1592
1592
|
|
|
1593
1593
|
// src/blocks/symbol/symbol.tsx
|
|
1594
|
-
import { onMount as onMount5, on as on3, createEffect as createEffect3, createSignal as
|
|
1594
|
+
import { onMount as onMount5, on as on3, createEffect as createEffect3, createSignal as createSignal15 } from "solid-js";
|
|
1595
1595
|
|
|
1596
1596
|
// src/components/content-variants/content-variants.tsx
|
|
1597
|
-
import { Show as
|
|
1597
|
+
import { Show as Show12, For as For7, onMount as onMount4, createSignal as createSignal14 } from "solid-js";
|
|
1598
1598
|
|
|
1599
1599
|
// src/helpers/url.ts
|
|
1600
1600
|
var getTopLevelDomain = (host) => {
|
|
@@ -1788,7 +1788,7 @@ var handleABTesting = async ({
|
|
|
1788
1788
|
var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
|
|
1789
1789
|
|
|
1790
1790
|
// src/components/content/content.tsx
|
|
1791
|
-
import { Show as
|
|
1791
|
+
import { Show as Show11, createSignal as createSignal13 } from "solid-js";
|
|
1792
1792
|
|
|
1793
1793
|
// src/blocks/button/component-info.ts
|
|
1794
1794
|
var componentInfo = {
|
|
@@ -2046,162 +2046,8 @@ var componentInfo2 = {
|
|
|
2046
2046
|
}]
|
|
2047
2047
|
};
|
|
2048
2048
|
|
|
2049
|
-
// src/blocks/custom-code/component-info.ts
|
|
2050
|
-
var componentInfo3 = {
|
|
2051
|
-
name: "Custom Code",
|
|
2052
|
-
static: true,
|
|
2053
|
-
requiredPermissions: ["editCode"],
|
|
2054
|
-
inputs: [{
|
|
2055
|
-
name: "code",
|
|
2056
|
-
type: "html",
|
|
2057
|
-
required: true,
|
|
2058
|
-
defaultValue: "<p>Hello there, I am custom HTML code!</p>",
|
|
2059
|
-
code: true
|
|
2060
|
-
}, {
|
|
2061
|
-
name: "replaceNodes",
|
|
2062
|
-
type: "boolean",
|
|
2063
|
-
helperText: "Preserve server rendered dom nodes",
|
|
2064
|
-
advanced: true
|
|
2065
|
-
}, {
|
|
2066
|
-
name: "scriptsClientOnly",
|
|
2067
|
-
type: "boolean",
|
|
2068
|
-
defaultValue: false,
|
|
2069
|
-
helperText: "Only print and run scripts on the client. Important when scripts influence DOM that could be replaced when client loads",
|
|
2070
|
-
advanced: true
|
|
2071
|
-
}]
|
|
2072
|
-
};
|
|
2073
|
-
|
|
2074
|
-
// src/blocks/custom-code/custom-code.tsx
|
|
2075
|
-
import { onMount as onMount2, createSignal as createSignal7 } from "solid-js";
|
|
2076
|
-
function CustomCode(props) {
|
|
2077
|
-
const [scriptsInserted, setScriptsInserted] = createSignal7([]);
|
|
2078
|
-
const [scriptsRun, setScriptsRun] = createSignal7([]);
|
|
2079
|
-
let elementRef;
|
|
2080
|
-
onMount2(() => {
|
|
2081
|
-
if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
|
|
2082
|
-
return;
|
|
2083
|
-
}
|
|
2084
|
-
const scripts = elementRef.getElementsByTagName("script");
|
|
2085
|
-
for (let i = 0; i < scripts.length; i++) {
|
|
2086
|
-
const script = scripts[i];
|
|
2087
|
-
if (script.src) {
|
|
2088
|
-
if (scriptsInserted().includes(script.src)) {
|
|
2089
|
-
continue;
|
|
2090
|
-
}
|
|
2091
|
-
scriptsInserted().push(script.src);
|
|
2092
|
-
const newScript = document.createElement("script");
|
|
2093
|
-
newScript.async = true;
|
|
2094
|
-
newScript.src = script.src;
|
|
2095
|
-
document.head.appendChild(newScript);
|
|
2096
|
-
} else if (!script.type || [
|
|
2097
|
-
"text/javascript",
|
|
2098
|
-
"application/javascript",
|
|
2099
|
-
"application/ecmascript"
|
|
2100
|
-
].includes(script.type)) {
|
|
2101
|
-
if (scriptsRun().includes(script.innerText)) {
|
|
2102
|
-
continue;
|
|
2103
|
-
}
|
|
2104
|
-
try {
|
|
2105
|
-
scriptsRun().push(script.innerText);
|
|
2106
|
-
new Function(script.innerText)();
|
|
2107
|
-
} catch (error) {
|
|
2108
|
-
}
|
|
2109
|
-
}
|
|
2110
|
-
}
|
|
2111
|
-
});
|
|
2112
|
-
return <div
|
|
2113
|
-
class={"builder-custom-code" + (props.replaceNodes ? " replace-nodes" : "")}
|
|
2114
|
-
ref={elementRef}
|
|
2115
|
-
innerHTML={props.code}
|
|
2116
|
-
/>;
|
|
2117
|
-
}
|
|
2118
|
-
var custom_code_default = CustomCode;
|
|
2119
|
-
|
|
2120
|
-
// src/blocks/embed/component-info.ts
|
|
2121
|
-
var componentInfo4 = {
|
|
2122
|
-
name: "Embed",
|
|
2123
|
-
static: true,
|
|
2124
|
-
inputs: [{
|
|
2125
|
-
name: "url",
|
|
2126
|
-
type: "url",
|
|
2127
|
-
required: true,
|
|
2128
|
-
defaultValue: "",
|
|
2129
|
-
helperText: "e.g. enter a youtube url, google map, etc",
|
|
2130
|
-
onChange: (options) => {
|
|
2131
|
-
const url = options.get("url");
|
|
2132
|
-
if (url) {
|
|
2133
|
-
options.set("content", "Loading...");
|
|
2134
|
-
const apiKey = "ae0e60e78201a3f2b0de4b";
|
|
2135
|
-
return fetch(`https://iframe.ly/api/iframely?url=${url}&api_key=${apiKey}`).then((res) => res.json()).then((data) => {
|
|
2136
|
-
if (options.get("url") === url) {
|
|
2137
|
-
if (data.html) {
|
|
2138
|
-
options.set("content", data.html);
|
|
2139
|
-
} else {
|
|
2140
|
-
options.set("content", "Invalid url, please try another");
|
|
2141
|
-
}
|
|
2142
|
-
}
|
|
2143
|
-
}).catch((_err) => {
|
|
2144
|
-
options.set("content", "There was an error embedding this URL, please try again or another URL");
|
|
2145
|
-
});
|
|
2146
|
-
} else {
|
|
2147
|
-
options.delete("content");
|
|
2148
|
-
}
|
|
2149
|
-
}
|
|
2150
|
-
}, {
|
|
2151
|
-
name: "content",
|
|
2152
|
-
type: "html",
|
|
2153
|
-
defaultValue: '<div style="padding: 20px; text-align: center">(Choose an embed URL)<div>',
|
|
2154
|
-
hideFromUI: true
|
|
2155
|
-
}]
|
|
2156
|
-
};
|
|
2157
|
-
|
|
2158
|
-
// src/blocks/embed/embed.tsx
|
|
2159
|
-
import { on, createEffect, createSignal as createSignal8 } from "solid-js";
|
|
2160
|
-
|
|
2161
|
-
// src/blocks/embed/helpers.ts
|
|
2162
|
-
var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
|
|
2163
|
-
var isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
|
|
2164
|
-
|
|
2165
|
-
// src/blocks/embed/embed.tsx
|
|
2166
|
-
function Embed(props) {
|
|
2167
|
-
const [scriptsInserted, setScriptsInserted] = createSignal8([]);
|
|
2168
|
-
const [scriptsRun, setScriptsRun] = createSignal8([]);
|
|
2169
|
-
const [ranInitFn, setRanInitFn] = createSignal8(false);
|
|
2170
|
-
function findAndRunScripts() {
|
|
2171
|
-
if (!elem || !elem.getElementsByTagName)
|
|
2172
|
-
return;
|
|
2173
|
-
const scripts = elem.getElementsByTagName("script");
|
|
2174
|
-
for (let i = 0; i < scripts.length; i++) {
|
|
2175
|
-
const script = scripts[i];
|
|
2176
|
-
if (script.src && !scriptsInserted().includes(script.src)) {
|
|
2177
|
-
scriptsInserted().push(script.src);
|
|
2178
|
-
const newScript = document.createElement("script");
|
|
2179
|
-
newScript.async = true;
|
|
2180
|
-
newScript.src = script.src;
|
|
2181
|
-
document.head.appendChild(newScript);
|
|
2182
|
-
} else if (isJsScript(script) && !scriptsRun().includes(script.innerText)) {
|
|
2183
|
-
try {
|
|
2184
|
-
scriptsRun().push(script.innerText);
|
|
2185
|
-
new Function(script.innerText)();
|
|
2186
|
-
} catch (error) {
|
|
2187
|
-
}
|
|
2188
|
-
}
|
|
2189
|
-
}
|
|
2190
|
-
}
|
|
2191
|
-
let elem;
|
|
2192
|
-
function onUpdateFn_0() {
|
|
2193
|
-
if (elem && !ranInitFn()) {
|
|
2194
|
-
setRanInitFn(true);
|
|
2195
|
-
findAndRunScripts();
|
|
2196
|
-
}
|
|
2197
|
-
}
|
|
2198
|
-
createEffect(on(() => [elem, ranInitFn()], onUpdateFn_0));
|
|
2199
|
-
return <div class="builder-embed" ref={elem} innerHTML={props.content} />;
|
|
2200
|
-
}
|
|
2201
|
-
var embed_default = Embed;
|
|
2202
|
-
|
|
2203
2049
|
// src/blocks/fragment/component-info.ts
|
|
2204
|
-
var
|
|
2050
|
+
var componentInfo3 = {
|
|
2205
2051
|
name: "Fragment",
|
|
2206
2052
|
static: true,
|
|
2207
2053
|
hidden: true,
|
|
@@ -2210,7 +2056,7 @@ var componentInfo5 = {
|
|
|
2210
2056
|
};
|
|
2211
2057
|
|
|
2212
2058
|
// src/blocks/image/component-info.ts
|
|
2213
|
-
var
|
|
2059
|
+
var componentInfo4 = {
|
|
2214
2060
|
name: "Image",
|
|
2215
2061
|
static: true,
|
|
2216
2062
|
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",
|
|
@@ -2331,41 +2177,8 @@ var componentInfo6 = {
|
|
|
2331
2177
|
}]
|
|
2332
2178
|
};
|
|
2333
2179
|
|
|
2334
|
-
// src/blocks/img/component-info.ts
|
|
2335
|
-
var componentInfo7 = {
|
|
2336
|
-
// friendlyName?
|
|
2337
|
-
name: "Raw:Img",
|
|
2338
|
-
hideFromInsertMenu: true,
|
|
2339
|
-
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",
|
|
2340
|
-
inputs: [{
|
|
2341
|
-
name: "image",
|
|
2342
|
-
bubble: true,
|
|
2343
|
-
type: "file",
|
|
2344
|
-
allowedFileTypes: ["jpeg", "jpg", "png", "svg", "gif", "webp"],
|
|
2345
|
-
required: true
|
|
2346
|
-
}],
|
|
2347
|
-
noWrap: true,
|
|
2348
|
-
static: true
|
|
2349
|
-
};
|
|
2350
|
-
|
|
2351
|
-
// src/blocks/img/img.tsx
|
|
2352
|
-
function ImgComponent(props) {
|
|
2353
|
-
return <img
|
|
2354
|
-
style={{
|
|
2355
|
-
"object-fit": props.backgroundSize || "cover",
|
|
2356
|
-
"object-position": props.backgroundPosition || "center"
|
|
2357
|
-
}}
|
|
2358
|
-
key={isEditing() && props.imgSrc || "default-key"}
|
|
2359
|
-
alt={props.altText}
|
|
2360
|
-
src={props.imgSrc || props.image}
|
|
2361
|
-
{...{}}
|
|
2362
|
-
{...props.attributes}
|
|
2363
|
-
/>;
|
|
2364
|
-
}
|
|
2365
|
-
var img_default = ImgComponent;
|
|
2366
|
-
|
|
2367
2180
|
// src/blocks/section/component-info.ts
|
|
2368
|
-
var
|
|
2181
|
+
var componentInfo5 = {
|
|
2369
2182
|
name: "Core:Section",
|
|
2370
2183
|
static: true,
|
|
2371
2184
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",
|
|
@@ -2407,7 +2220,7 @@ var componentInfo8 = {
|
|
|
2407
2220
|
};
|
|
2408
2221
|
|
|
2409
2222
|
// src/blocks/slot/component-info.ts
|
|
2410
|
-
var
|
|
2223
|
+
var componentInfo6 = {
|
|
2411
2224
|
name: "Slot",
|
|
2412
2225
|
isRSC: true,
|
|
2413
2226
|
description: "Allow child blocks to be inserted into this content when used as a Symbol",
|
|
@@ -2441,7 +2254,7 @@ function Slot(props) {
|
|
|
2441
2254
|
var slot_default = Slot;
|
|
2442
2255
|
|
|
2443
2256
|
// src/blocks/symbol/component-info.ts
|
|
2444
|
-
var
|
|
2257
|
+
var componentInfo7 = {
|
|
2445
2258
|
name: "Symbol",
|
|
2446
2259
|
noWrap: true,
|
|
2447
2260
|
static: true,
|
|
@@ -2477,7 +2290,7 @@ var componentInfo10 = {
|
|
|
2477
2290
|
};
|
|
2478
2291
|
|
|
2479
2292
|
// src/blocks/text/component-info.ts
|
|
2480
|
-
var
|
|
2293
|
+
var componentInfo8 = {
|
|
2481
2294
|
name: "Text",
|
|
2482
2295
|
static: true,
|
|
2483
2296
|
isRSC: true,
|
|
@@ -2509,54 +2322,894 @@ function Text(props) {
|
|
|
2509
2322
|
}
|
|
2510
2323
|
var text_default = Text;
|
|
2511
2324
|
|
|
2512
|
-
// src/blocks/
|
|
2513
|
-
var
|
|
2514
|
-
name: "
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
minHeight: "20px",
|
|
2518
|
-
minWidth: "20px"
|
|
2519
|
-
},
|
|
2520
|
-
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",
|
|
2325
|
+
// src/blocks/custom-code/component-info.ts
|
|
2326
|
+
var componentInfo9 = {
|
|
2327
|
+
name: "Custom Code",
|
|
2328
|
+
static: true,
|
|
2329
|
+
requiredPermissions: ["editCode"],
|
|
2521
2330
|
inputs: [{
|
|
2522
|
-
name: "
|
|
2523
|
-
type: "
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
required: true
|
|
2528
|
-
}, {
|
|
2529
|
-
name: "posterImage",
|
|
2530
|
-
type: "file",
|
|
2531
|
-
allowedFileTypes: ["jpeg", "png"],
|
|
2532
|
-
helperText: "Image to show before the video plays"
|
|
2533
|
-
}, {
|
|
2534
|
-
name: "autoPlay",
|
|
2535
|
-
type: "boolean",
|
|
2536
|
-
defaultValue: true
|
|
2537
|
-
}, {
|
|
2538
|
-
name: "controls",
|
|
2539
|
-
type: "boolean",
|
|
2540
|
-
defaultValue: false
|
|
2541
|
-
}, {
|
|
2542
|
-
name: "muted",
|
|
2543
|
-
type: "boolean",
|
|
2544
|
-
defaultValue: true
|
|
2331
|
+
name: "code",
|
|
2332
|
+
type: "html",
|
|
2333
|
+
required: true,
|
|
2334
|
+
defaultValue: "<p>Hello there, I am custom HTML code!</p>",
|
|
2335
|
+
code: true
|
|
2545
2336
|
}, {
|
|
2546
|
-
name: "
|
|
2337
|
+
name: "replaceNodes",
|
|
2547
2338
|
type: "boolean",
|
|
2548
|
-
|
|
2339
|
+
helperText: "Preserve server rendered dom nodes",
|
|
2340
|
+
advanced: true
|
|
2549
2341
|
}, {
|
|
2550
|
-
name: "
|
|
2342
|
+
name: "scriptsClientOnly",
|
|
2551
2343
|
type: "boolean",
|
|
2552
|
-
defaultValue:
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2344
|
+
defaultValue: false,
|
|
2345
|
+
helperText: "Only print and run scripts on the client. Important when scripts influence DOM that could be replaced when client loads",
|
|
2346
|
+
advanced: true
|
|
2347
|
+
}]
|
|
2348
|
+
};
|
|
2349
|
+
|
|
2350
|
+
// src/blocks/custom-code/custom-code.tsx
|
|
2351
|
+
import { onMount as onMount2, createSignal as createSignal7 } from "solid-js";
|
|
2352
|
+
function CustomCode(props) {
|
|
2353
|
+
const [scriptsInserted, setScriptsInserted] = createSignal7([]);
|
|
2354
|
+
const [scriptsRun, setScriptsRun] = createSignal7([]);
|
|
2355
|
+
let elementRef;
|
|
2356
|
+
onMount2(() => {
|
|
2357
|
+
if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
|
|
2358
|
+
return;
|
|
2359
|
+
}
|
|
2360
|
+
const scripts = elementRef.getElementsByTagName("script");
|
|
2361
|
+
for (let i = 0; i < scripts.length; i++) {
|
|
2362
|
+
const script = scripts[i];
|
|
2363
|
+
if (script.src) {
|
|
2364
|
+
if (scriptsInserted().includes(script.src)) {
|
|
2365
|
+
continue;
|
|
2366
|
+
}
|
|
2367
|
+
scriptsInserted().push(script.src);
|
|
2368
|
+
const newScript = document.createElement("script");
|
|
2369
|
+
newScript.async = true;
|
|
2370
|
+
newScript.src = script.src;
|
|
2371
|
+
document.head.appendChild(newScript);
|
|
2372
|
+
} else if (!script.type || [
|
|
2373
|
+
"text/javascript",
|
|
2374
|
+
"application/javascript",
|
|
2375
|
+
"application/ecmascript"
|
|
2376
|
+
].includes(script.type)) {
|
|
2377
|
+
if (scriptsRun().includes(script.innerText)) {
|
|
2378
|
+
continue;
|
|
2379
|
+
}
|
|
2380
|
+
try {
|
|
2381
|
+
scriptsRun().push(script.innerText);
|
|
2382
|
+
new Function(script.innerText)();
|
|
2383
|
+
} catch (error) {
|
|
2384
|
+
}
|
|
2385
|
+
}
|
|
2386
|
+
}
|
|
2387
|
+
});
|
|
2388
|
+
return <div
|
|
2389
|
+
class={"builder-custom-code" + (props.replaceNodes ? " replace-nodes" : "")}
|
|
2390
|
+
ref={elementRef}
|
|
2391
|
+
innerHTML={props.code}
|
|
2392
|
+
/>;
|
|
2393
|
+
}
|
|
2394
|
+
var custom_code_default = CustomCode;
|
|
2395
|
+
|
|
2396
|
+
// src/blocks/embed/component-info.ts
|
|
2397
|
+
var componentInfo10 = {
|
|
2398
|
+
name: "Embed",
|
|
2399
|
+
static: true,
|
|
2400
|
+
inputs: [{
|
|
2401
|
+
name: "url",
|
|
2402
|
+
type: "url",
|
|
2403
|
+
required: true,
|
|
2404
|
+
defaultValue: "",
|
|
2405
|
+
helperText: "e.g. enter a youtube url, google map, etc",
|
|
2406
|
+
onChange: (options) => {
|
|
2407
|
+
const url = options.get("url");
|
|
2408
|
+
if (url) {
|
|
2409
|
+
options.set("content", "Loading...");
|
|
2410
|
+
const apiKey = "ae0e60e78201a3f2b0de4b";
|
|
2411
|
+
return fetch(`https://iframe.ly/api/iframely?url=${url}&api_key=${apiKey}`).then((res) => res.json()).then((data) => {
|
|
2412
|
+
if (options.get("url") === url) {
|
|
2413
|
+
if (data.html) {
|
|
2414
|
+
options.set("content", data.html);
|
|
2415
|
+
} else {
|
|
2416
|
+
options.set("content", "Invalid url, please try another");
|
|
2417
|
+
}
|
|
2418
|
+
}
|
|
2419
|
+
}).catch((_err) => {
|
|
2420
|
+
options.set("content", "There was an error embedding this URL, please try again or another URL");
|
|
2421
|
+
});
|
|
2422
|
+
} else {
|
|
2423
|
+
options.delete("content");
|
|
2424
|
+
}
|
|
2425
|
+
}
|
|
2426
|
+
}, {
|
|
2427
|
+
name: "content",
|
|
2428
|
+
type: "html",
|
|
2429
|
+
defaultValue: '<div style="padding: 20px; text-align: center">(Choose an embed URL)<div>',
|
|
2430
|
+
hideFromUI: true
|
|
2431
|
+
}]
|
|
2432
|
+
};
|
|
2433
|
+
|
|
2434
|
+
// src/blocks/embed/embed.tsx
|
|
2435
|
+
import { on, createEffect, createSignal as createSignal8 } from "solid-js";
|
|
2436
|
+
|
|
2437
|
+
// src/blocks/embed/helpers.ts
|
|
2438
|
+
var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
|
|
2439
|
+
var isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
|
|
2440
|
+
|
|
2441
|
+
// src/blocks/embed/embed.tsx
|
|
2442
|
+
function Embed(props) {
|
|
2443
|
+
const [scriptsInserted, setScriptsInserted] = createSignal8([]);
|
|
2444
|
+
const [scriptsRun, setScriptsRun] = createSignal8([]);
|
|
2445
|
+
const [ranInitFn, setRanInitFn] = createSignal8(false);
|
|
2446
|
+
function findAndRunScripts() {
|
|
2447
|
+
if (!elem || !elem.getElementsByTagName)
|
|
2448
|
+
return;
|
|
2449
|
+
const scripts = elem.getElementsByTagName("script");
|
|
2450
|
+
for (let i = 0; i < scripts.length; i++) {
|
|
2451
|
+
const script = scripts[i];
|
|
2452
|
+
if (script.src && !scriptsInserted().includes(script.src)) {
|
|
2453
|
+
scriptsInserted().push(script.src);
|
|
2454
|
+
const newScript = document.createElement("script");
|
|
2455
|
+
newScript.async = true;
|
|
2456
|
+
newScript.src = script.src;
|
|
2457
|
+
document.head.appendChild(newScript);
|
|
2458
|
+
} else if (isJsScript(script) && !scriptsRun().includes(script.innerText)) {
|
|
2459
|
+
try {
|
|
2460
|
+
scriptsRun().push(script.innerText);
|
|
2461
|
+
new Function(script.innerText)();
|
|
2462
|
+
} catch (error) {
|
|
2463
|
+
}
|
|
2464
|
+
}
|
|
2465
|
+
}
|
|
2466
|
+
}
|
|
2467
|
+
let elem;
|
|
2468
|
+
function onUpdateFn_0() {
|
|
2469
|
+
if (elem && !ranInitFn()) {
|
|
2470
|
+
setRanInitFn(true);
|
|
2471
|
+
findAndRunScripts();
|
|
2472
|
+
}
|
|
2473
|
+
}
|
|
2474
|
+
createEffect(on(() => [elem, ranInitFn()], onUpdateFn_0));
|
|
2475
|
+
return <div class="builder-embed" ref={elem} innerHTML={props.content} />;
|
|
2476
|
+
}
|
|
2477
|
+
var embed_default = Embed;
|
|
2478
|
+
|
|
2479
|
+
// src/blocks/form/form/component-info.ts
|
|
2480
|
+
var componentInfo11 = {
|
|
2481
|
+
name: "Form:Form",
|
|
2482
|
+
// editableTags: ['builder-form-error']
|
|
2483
|
+
defaults: {
|
|
2484
|
+
responsiveStyles: {
|
|
2485
|
+
large: {
|
|
2486
|
+
marginTop: "15px",
|
|
2487
|
+
paddingBottom: "15px"
|
|
2488
|
+
}
|
|
2489
|
+
}
|
|
2490
|
+
},
|
|
2491
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fef36d2a846134910b64b88e6d18c5ca5",
|
|
2492
|
+
inputs: [{
|
|
2493
|
+
name: "sendSubmissionsTo",
|
|
2494
|
+
type: "string",
|
|
2495
|
+
// TODO: save to builder data and user can download as csv
|
|
2496
|
+
// TODO: easy for mode too or computed add/remove fields form mode
|
|
2497
|
+
// so you can edit details and high level mode at same time...
|
|
2498
|
+
// Later - more integrations like mailchimp
|
|
2499
|
+
// /api/v1/form-submit?to=mailchimp
|
|
2500
|
+
enum: [{
|
|
2501
|
+
label: "Send to email",
|
|
2502
|
+
value: "email",
|
|
2503
|
+
helperText: "Send form submissions to the email address of your choosing"
|
|
2504
|
+
}, {
|
|
2505
|
+
label: "Custom",
|
|
2506
|
+
value: "custom",
|
|
2507
|
+
helperText: "Handle where the form requests go manually with a little code, e.g. to your own custom backend"
|
|
2508
|
+
}],
|
|
2509
|
+
defaultValue: "email"
|
|
2510
|
+
}, {
|
|
2511
|
+
name: "sendSubmissionsToEmail",
|
|
2512
|
+
type: "string",
|
|
2513
|
+
required: true,
|
|
2514
|
+
// TODO: required: () => options.get("sendSubmissionsTo") === "email"
|
|
2515
|
+
defaultValue: "your@email.com",
|
|
2516
|
+
showIf: 'options.get("sendSubmissionsTo") === "email"'
|
|
2517
|
+
}, {
|
|
2518
|
+
name: "sendWithJs",
|
|
2519
|
+
type: "boolean",
|
|
2520
|
+
helperText: "Set to false to use basic html form action",
|
|
2521
|
+
defaultValue: true,
|
|
2522
|
+
showIf: 'options.get("sendSubmissionsTo") === "custom"'
|
|
2523
|
+
}, {
|
|
2524
|
+
name: "name",
|
|
2525
|
+
type: "string",
|
|
2526
|
+
defaultValue: "My form"
|
|
2527
|
+
// advanced: true
|
|
2528
|
+
}, {
|
|
2529
|
+
name: "action",
|
|
2530
|
+
type: "string",
|
|
2531
|
+
helperText: "URL to send the form data to",
|
|
2532
|
+
showIf: 'options.get("sendSubmissionsTo") === "custom"'
|
|
2533
|
+
}, {
|
|
2534
|
+
name: "contentType",
|
|
2535
|
+
type: "string",
|
|
2536
|
+
defaultValue: "application/json",
|
|
2537
|
+
advanced: true,
|
|
2538
|
+
// TODO: do automatically if file input
|
|
2539
|
+
enum: ["application/json", "multipart/form-data", "application/x-www-form-urlencoded"],
|
|
2540
|
+
showIf: 'options.get("sendSubmissionsTo") === "custom" && options.get("sendWithJs") === true'
|
|
2541
|
+
}, {
|
|
2542
|
+
name: "method",
|
|
2543
|
+
type: "string",
|
|
2544
|
+
showIf: 'options.get("sendSubmissionsTo") === "custom"',
|
|
2545
|
+
defaultValue: "POST",
|
|
2546
|
+
advanced: true
|
|
2547
|
+
}, {
|
|
2548
|
+
name: "previewState",
|
|
2549
|
+
type: "string",
|
|
2550
|
+
// TODO: persist: false flag
|
|
2551
|
+
enum: ["unsubmitted", "sending", "success", "error"],
|
|
2552
|
+
defaultValue: "unsubmitted",
|
|
2553
|
+
helperText: 'Choose a state to edit, e.g. choose "success" to show what users see on success and edit the message',
|
|
2554
|
+
showIf: 'options.get("sendSubmissionsTo") !== "zapier" && options.get("sendWithJs") === true'
|
|
2555
|
+
}, {
|
|
2556
|
+
name: "successUrl",
|
|
2557
|
+
type: "url",
|
|
2558
|
+
helperText: "Optional URL to redirect the user to on form submission success",
|
|
2559
|
+
showIf: 'options.get("sendSubmissionsTo") !== "zapier" && options.get("sendWithJs") === true'
|
|
2560
|
+
}, {
|
|
2561
|
+
name: "resetFormOnSubmit",
|
|
2562
|
+
type: "boolean",
|
|
2563
|
+
showIf: "options.get('sendSubmissionsTo') === 'custom' && options.get('sendWithJs') === true",
|
|
2564
|
+
advanced: true
|
|
2565
|
+
}, {
|
|
2566
|
+
name: "successMessage",
|
|
2567
|
+
type: "uiBlocks",
|
|
2568
|
+
hideFromUI: true,
|
|
2569
|
+
defaultValue: [{
|
|
2570
|
+
"@type": "@builder.io/sdk:Element",
|
|
2571
|
+
responsiveStyles: {
|
|
2572
|
+
large: {
|
|
2573
|
+
marginTop: "10px"
|
|
2574
|
+
}
|
|
2575
|
+
},
|
|
2576
|
+
component: {
|
|
2577
|
+
name: "Text",
|
|
2578
|
+
options: {
|
|
2579
|
+
text: "<span>Thanks!</span>"
|
|
2580
|
+
}
|
|
2581
|
+
}
|
|
2582
|
+
}]
|
|
2583
|
+
}, {
|
|
2584
|
+
name: "validate",
|
|
2585
|
+
type: "boolean",
|
|
2586
|
+
defaultValue: true,
|
|
2587
|
+
advanced: true
|
|
2588
|
+
}, {
|
|
2589
|
+
name: "errorMessagePath",
|
|
2590
|
+
type: "text",
|
|
2591
|
+
advanced: true,
|
|
2592
|
+
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" }}'
|
|
2593
|
+
}, {
|
|
2594
|
+
name: "errorMessage",
|
|
2595
|
+
type: "uiBlocks",
|
|
2596
|
+
hideFromUI: true,
|
|
2597
|
+
defaultValue: [{
|
|
2598
|
+
"@type": "@builder.io/sdk:Element",
|
|
2599
|
+
responsiveStyles: {
|
|
2600
|
+
large: {
|
|
2601
|
+
marginTop: "10px"
|
|
2602
|
+
}
|
|
2603
|
+
},
|
|
2604
|
+
bindings: {
|
|
2605
|
+
"component.options.text": "state.formErrorMessage || block.component.options.text"
|
|
2606
|
+
},
|
|
2607
|
+
component: {
|
|
2608
|
+
name: "Text",
|
|
2609
|
+
options: {
|
|
2610
|
+
text: "<span>Form submission error :( Please check your answers and try again</span>"
|
|
2611
|
+
}
|
|
2612
|
+
}
|
|
2613
|
+
}]
|
|
2614
|
+
}, {
|
|
2615
|
+
name: "sendingMessage",
|
|
2616
|
+
type: "uiBlocks",
|
|
2617
|
+
hideFromUI: true,
|
|
2618
|
+
defaultValue: [{
|
|
2619
|
+
"@type": "@builder.io/sdk:Element",
|
|
2620
|
+
responsiveStyles: {
|
|
2621
|
+
large: {
|
|
2622
|
+
marginTop: "10px"
|
|
2623
|
+
}
|
|
2624
|
+
},
|
|
2625
|
+
component: {
|
|
2626
|
+
name: "Text",
|
|
2627
|
+
options: {
|
|
2628
|
+
text: "<span>Sending...</span>"
|
|
2629
|
+
}
|
|
2630
|
+
}
|
|
2631
|
+
}]
|
|
2632
|
+
}, {
|
|
2633
|
+
name: "customHeaders",
|
|
2634
|
+
type: "map",
|
|
2635
|
+
valueType: {
|
|
2636
|
+
type: "string"
|
|
2637
|
+
},
|
|
2638
|
+
advanced: true,
|
|
2639
|
+
showIf: 'options.get("sendSubmissionsTo") === "custom" && options.get("sendWithJs") === true'
|
|
2640
|
+
}],
|
|
2641
|
+
noWrap: true,
|
|
2642
|
+
canHaveChildren: true,
|
|
2643
|
+
defaultChildren: [{
|
|
2644
|
+
"@type": "@builder.io/sdk:Element",
|
|
2645
|
+
responsiveStyles: {
|
|
2646
|
+
large: {
|
|
2647
|
+
marginTop: "10px"
|
|
2648
|
+
}
|
|
2649
|
+
},
|
|
2650
|
+
component: {
|
|
2651
|
+
name: "Text",
|
|
2652
|
+
options: {
|
|
2653
|
+
text: "<span>Enter your name</span>"
|
|
2654
|
+
}
|
|
2655
|
+
}
|
|
2656
|
+
}, {
|
|
2657
|
+
"@type": "@builder.io/sdk:Element",
|
|
2658
|
+
responsiveStyles: {
|
|
2659
|
+
large: {
|
|
2660
|
+
marginTop: "10px"
|
|
2661
|
+
}
|
|
2662
|
+
},
|
|
2663
|
+
component: {
|
|
2664
|
+
name: "Form:Input",
|
|
2665
|
+
options: {
|
|
2666
|
+
name: "name",
|
|
2667
|
+
placeholder: "Jane Doe"
|
|
2668
|
+
}
|
|
2669
|
+
}
|
|
2670
|
+
}, {
|
|
2671
|
+
"@type": "@builder.io/sdk:Element",
|
|
2672
|
+
responsiveStyles: {
|
|
2673
|
+
large: {
|
|
2674
|
+
marginTop: "10px"
|
|
2675
|
+
}
|
|
2676
|
+
},
|
|
2677
|
+
component: {
|
|
2678
|
+
name: "Text",
|
|
2679
|
+
options: {
|
|
2680
|
+
text: "<span>Enter your email</span>"
|
|
2681
|
+
}
|
|
2682
|
+
}
|
|
2683
|
+
}, {
|
|
2684
|
+
"@type": "@builder.io/sdk:Element",
|
|
2685
|
+
responsiveStyles: {
|
|
2686
|
+
large: {
|
|
2687
|
+
marginTop: "10px"
|
|
2688
|
+
}
|
|
2689
|
+
},
|
|
2690
|
+
component: {
|
|
2691
|
+
name: "Form:Input",
|
|
2692
|
+
options: {
|
|
2693
|
+
name: "email",
|
|
2694
|
+
placeholder: "jane@doe.com"
|
|
2695
|
+
}
|
|
2696
|
+
}
|
|
2697
|
+
}, {
|
|
2698
|
+
"@type": "@builder.io/sdk:Element",
|
|
2699
|
+
responsiveStyles: {
|
|
2700
|
+
large: {
|
|
2701
|
+
marginTop: "10px"
|
|
2702
|
+
}
|
|
2703
|
+
},
|
|
2704
|
+
component: {
|
|
2705
|
+
name: "Form:SubmitButton",
|
|
2706
|
+
options: {
|
|
2707
|
+
text: "Submit"
|
|
2708
|
+
}
|
|
2709
|
+
}
|
|
2710
|
+
}]
|
|
2711
|
+
};
|
|
2712
|
+
|
|
2713
|
+
// src/blocks/form/form/form.tsx
|
|
2714
|
+
import { Show as Show8, For as For5, createSignal as createSignal9 } from "solid-js";
|
|
2715
|
+
import { css as css4 } from "solid-styled-components";
|
|
2716
|
+
|
|
2717
|
+
// src/functions/get-env.ts
|
|
2718
|
+
var validEnvList = ["production", "qa", "test", "development", "dev", "cdn-qa", "cloud", "fast", "cdn2", "cdn-prod"];
|
|
2719
|
+
var getEnv = () => {
|
|
2720
|
+
const env = "production";
|
|
2721
|
+
return validEnvList.includes(env) ? env : "production";
|
|
2722
|
+
};
|
|
2723
|
+
|
|
2724
|
+
// src/functions/get.ts
|
|
2725
|
+
var get = (obj, path, defaultValue) => {
|
|
2726
|
+
const result = String.prototype.split.call(path, /[,[\].]+?/).filter(Boolean).reduce((res, key) => res !== null && res !== void 0 ? res[key] : res, obj);
|
|
2727
|
+
return result === void 0 || result === obj ? defaultValue : result;
|
|
2728
|
+
};
|
|
2729
|
+
|
|
2730
|
+
// src/blocks/form/form/form.tsx
|
|
2731
|
+
function FormComponent(props) {
|
|
2732
|
+
const [formState, setFormState] = createSignal9("unsubmitted");
|
|
2733
|
+
const [responseData, setResponseData] = createSignal9(null);
|
|
2734
|
+
const [formErrorMessage, setFormErrorMessage] = createSignal9("");
|
|
2735
|
+
function mergeNewRootState(newData) {
|
|
2736
|
+
const combinedState = {
|
|
2737
|
+
...props.builderContext.rootState,
|
|
2738
|
+
...newData
|
|
2739
|
+
};
|
|
2740
|
+
if (props.builderContext.rootSetState) {
|
|
2741
|
+
props.builderContext.rootSetState?.(combinedState);
|
|
2742
|
+
} else {
|
|
2743
|
+
props.builderContext.rootState = combinedState;
|
|
2744
|
+
}
|
|
2745
|
+
}
|
|
2746
|
+
function submissionState() {
|
|
2747
|
+
return isEditing() && props.previewState || formState();
|
|
2748
|
+
}
|
|
2749
|
+
function onSubmit(event) {
|
|
2750
|
+
const sendWithJsProp = props.sendWithJs || props.sendSubmissionsTo === "email";
|
|
2751
|
+
if (props.sendSubmissionsTo === "zapier") {
|
|
2752
|
+
event.preventDefault();
|
|
2753
|
+
} else if (sendWithJsProp) {
|
|
2754
|
+
if (!(props.action || props.sendSubmissionsTo === "email")) {
|
|
2755
|
+
event.preventDefault();
|
|
2756
|
+
return;
|
|
2757
|
+
}
|
|
2758
|
+
event.preventDefault();
|
|
2759
|
+
const el = event.currentTarget;
|
|
2760
|
+
const headers = props.customHeaders || {};
|
|
2761
|
+
let body;
|
|
2762
|
+
const formData = new FormData(el);
|
|
2763
|
+
const formPairs = Array.from(
|
|
2764
|
+
event.currentTarget.querySelectorAll("input,select,textarea")
|
|
2765
|
+
).filter((el2) => !!el2.name).map((el2) => {
|
|
2766
|
+
let value;
|
|
2767
|
+
const key = el2.name;
|
|
2768
|
+
if (el2 instanceof HTMLInputElement) {
|
|
2769
|
+
if (el2.type === "radio") {
|
|
2770
|
+
if (el2.checked) {
|
|
2771
|
+
value = el2.name;
|
|
2772
|
+
return {
|
|
2773
|
+
key,
|
|
2774
|
+
value
|
|
2775
|
+
};
|
|
2776
|
+
}
|
|
2777
|
+
} else if (el2.type === "checkbox") {
|
|
2778
|
+
value = el2.checked;
|
|
2779
|
+
} else if (el2.type === "number" || el2.type === "range") {
|
|
2780
|
+
const num = el2.valueAsNumber;
|
|
2781
|
+
if (!isNaN(num)) {
|
|
2782
|
+
value = num;
|
|
2783
|
+
}
|
|
2784
|
+
} else if (el2.type === "file") {
|
|
2785
|
+
value = el2.files;
|
|
2786
|
+
} else {
|
|
2787
|
+
value = el2.value;
|
|
2788
|
+
}
|
|
2789
|
+
} else {
|
|
2790
|
+
value = el2.value;
|
|
2791
|
+
}
|
|
2792
|
+
return {
|
|
2793
|
+
key,
|
|
2794
|
+
value
|
|
2795
|
+
};
|
|
2796
|
+
});
|
|
2797
|
+
let formContentType = props.contentType;
|
|
2798
|
+
if (props.sendSubmissionsTo === "email") {
|
|
2799
|
+
formContentType = "multipart/form-data";
|
|
2800
|
+
}
|
|
2801
|
+
Array.from(formPairs).forEach(({ value }) => {
|
|
2802
|
+
if (value instanceof File || Array.isArray(value) && value[0] instanceof File || value instanceof FileList) {
|
|
2803
|
+
formContentType = "multipart/form-data";
|
|
2804
|
+
}
|
|
2805
|
+
});
|
|
2806
|
+
if (formContentType !== "application/json") {
|
|
2807
|
+
body = formData;
|
|
2808
|
+
} else {
|
|
2809
|
+
const json = {};
|
|
2810
|
+
Array.from(formPairs).forEach(({ value, key }) => {
|
|
2811
|
+
set(json, key, value);
|
|
2812
|
+
});
|
|
2813
|
+
body = JSON.stringify(json);
|
|
2814
|
+
}
|
|
2815
|
+
if (formContentType && formContentType !== "multipart/form-data") {
|
|
2816
|
+
if (
|
|
2817
|
+
/* Zapier doesn't allow content-type header to be sent from browsers */
|
|
2818
|
+
!(sendWithJsProp && props.action?.includes("zapier.com"))
|
|
2819
|
+
) {
|
|
2820
|
+
headers["content-type"] = formContentType;
|
|
2821
|
+
}
|
|
2822
|
+
}
|
|
2823
|
+
const presubmitEvent = new CustomEvent("presubmit", {
|
|
2824
|
+
detail: {
|
|
2825
|
+
body
|
|
2826
|
+
}
|
|
2827
|
+
});
|
|
2828
|
+
if (formRef) {
|
|
2829
|
+
formRef.dispatchEvent(presubmitEvent);
|
|
2830
|
+
if (presubmitEvent.defaultPrevented) {
|
|
2831
|
+
return;
|
|
2832
|
+
}
|
|
2833
|
+
}
|
|
2834
|
+
setFormState("sending");
|
|
2835
|
+
const formUrl = `${getEnv() === "dev" ? "http://localhost:5000" : "https://builder.io"}/api/v1/form-submit?apiKey=${props.builderContext.apiKey}&to=${btoa(
|
|
2836
|
+
props.sendSubmissionsToEmail || ""
|
|
2837
|
+
)}&name=${encodeURIComponent(props.name || "")}`;
|
|
2838
|
+
fetch(
|
|
2839
|
+
props.sendSubmissionsTo === "email" ? formUrl : props.action,
|
|
2840
|
+
{
|
|
2841
|
+
body,
|
|
2842
|
+
headers,
|
|
2843
|
+
method: props.method || "post"
|
|
2844
|
+
}
|
|
2845
|
+
).then(
|
|
2846
|
+
async (res) => {
|
|
2847
|
+
let body2;
|
|
2848
|
+
const contentType = res.headers.get("content-type");
|
|
2849
|
+
if (contentType && contentType.indexOf("application/json") !== -1) {
|
|
2850
|
+
body2 = await res.json();
|
|
2851
|
+
} else {
|
|
2852
|
+
body2 = await res.text();
|
|
2853
|
+
}
|
|
2854
|
+
if (!res.ok && props.errorMessagePath) {
|
|
2855
|
+
let message = get(body2, props.errorMessagePath);
|
|
2856
|
+
if (message) {
|
|
2857
|
+
if (typeof message !== "string") {
|
|
2858
|
+
message = JSON.stringify(message);
|
|
2859
|
+
}
|
|
2860
|
+
setFormErrorMessage(message);
|
|
2861
|
+
mergeNewRootState({
|
|
2862
|
+
formErrorMessage: message
|
|
2863
|
+
});
|
|
2864
|
+
}
|
|
2865
|
+
}
|
|
2866
|
+
setResponseData(body2);
|
|
2867
|
+
setFormState(res.ok ? "success" : "error");
|
|
2868
|
+
if (res.ok) {
|
|
2869
|
+
const submitSuccessEvent = new CustomEvent("submit:success", {
|
|
2870
|
+
detail: {
|
|
2871
|
+
res,
|
|
2872
|
+
body: body2
|
|
2873
|
+
}
|
|
2874
|
+
});
|
|
2875
|
+
if (formRef) {
|
|
2876
|
+
formRef.dispatchEvent(submitSuccessEvent);
|
|
2877
|
+
if (submitSuccessEvent.defaultPrevented) {
|
|
2878
|
+
return;
|
|
2879
|
+
}
|
|
2880
|
+
if (props.resetFormOnSubmit !== false) {
|
|
2881
|
+
formRef.reset();
|
|
2882
|
+
}
|
|
2883
|
+
}
|
|
2884
|
+
if (props.successUrl) {
|
|
2885
|
+
if (formRef) {
|
|
2886
|
+
const event2 = new CustomEvent("route", {
|
|
2887
|
+
detail: {
|
|
2888
|
+
url: props.successUrl
|
|
2889
|
+
}
|
|
2890
|
+
});
|
|
2891
|
+
formRef.dispatchEvent(event2);
|
|
2892
|
+
if (!event2.defaultPrevented) {
|
|
2893
|
+
location.href = props.successUrl;
|
|
2894
|
+
}
|
|
2895
|
+
} else {
|
|
2896
|
+
location.href = props.successUrl;
|
|
2897
|
+
}
|
|
2898
|
+
}
|
|
2899
|
+
}
|
|
2900
|
+
},
|
|
2901
|
+
(err) => {
|
|
2902
|
+
const submitErrorEvent = new CustomEvent("submit:error", {
|
|
2903
|
+
detail: {
|
|
2904
|
+
error: err
|
|
2905
|
+
}
|
|
2906
|
+
});
|
|
2907
|
+
if (formRef) {
|
|
2908
|
+
formRef.dispatchEvent(submitErrorEvent);
|
|
2909
|
+
if (submitErrorEvent.defaultPrevented) {
|
|
2910
|
+
return;
|
|
2911
|
+
}
|
|
2912
|
+
}
|
|
2913
|
+
setResponseData(err);
|
|
2914
|
+
setFormState("error");
|
|
2915
|
+
}
|
|
2916
|
+
);
|
|
2917
|
+
}
|
|
2918
|
+
}
|
|
2919
|
+
let formRef;
|
|
2920
|
+
return <form
|
|
2921
|
+
validate={props.validate}
|
|
2922
|
+
ref={formRef}
|
|
2923
|
+
action={!props.sendWithJs && props.action}
|
|
2924
|
+
method={props.method}
|
|
2925
|
+
name={props.name}
|
|
2926
|
+
onSubmit={(event) => onSubmit(event)}
|
|
2927
|
+
{...{}}
|
|
2928
|
+
{...props.attributes}
|
|
2929
|
+
>
|
|
2930
|
+
<Show8 when={props.builderBlock && props.builderBlock.children}><For5 each={props.builderBlock?.children}>{(block, _index) => {
|
|
2931
|
+
const idx = _index();
|
|
2932
|
+
return <Block_default
|
|
2933
|
+
key={`form-block-${idx}`}
|
|
2934
|
+
block={block}
|
|
2935
|
+
context={props.builderContext}
|
|
2936
|
+
registeredComponents={props.builderComponents}
|
|
2937
|
+
linkComponent={props.builderLinkComponent}
|
|
2938
|
+
/>;
|
|
2939
|
+
}}</For5></Show8>
|
|
2940
|
+
<Show8 when={submissionState() === "error"}><Blocks_default
|
|
2941
|
+
path="errorMessage"
|
|
2942
|
+
blocks={props.errorMessage}
|
|
2943
|
+
context={props.builderContext}
|
|
2944
|
+
/></Show8>
|
|
2945
|
+
<Show8 when={submissionState() === "sending"}><Blocks_default
|
|
2946
|
+
path="sendingMessage"
|
|
2947
|
+
blocks={props.sendingMessage}
|
|
2948
|
+
context={props.builderContext}
|
|
2949
|
+
/></Show8>
|
|
2950
|
+
<Show8 when={submissionState() === "error" && responseData()}><pre
|
|
2951
|
+
class={"builder-form-error-text " + css4({
|
|
2952
|
+
padding: "10px",
|
|
2953
|
+
color: "red",
|
|
2954
|
+
textAlign: "center"
|
|
2955
|
+
})}
|
|
2956
|
+
>{JSON.stringify(responseData(), null, 2)}</pre></Show8>
|
|
2957
|
+
<Show8 when={submissionState() === "success"}><Blocks_default
|
|
2958
|
+
path="successMessage"
|
|
2959
|
+
blocks={props.successMessage}
|
|
2960
|
+
context={props.builderContext}
|
|
2961
|
+
/></Show8>
|
|
2962
|
+
</form>;
|
|
2963
|
+
}
|
|
2964
|
+
var form_default = FormComponent;
|
|
2965
|
+
|
|
2966
|
+
// src/blocks/form/input/component-info.ts
|
|
2967
|
+
var componentInfo12 = {
|
|
2968
|
+
name: "Form:Input",
|
|
2969
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fad6f37889d9e40bbbbc72cdb5875d6ca",
|
|
2970
|
+
inputs: [
|
|
2971
|
+
{
|
|
2972
|
+
name: "type",
|
|
2973
|
+
type: "text",
|
|
2974
|
+
enum: ["text", "number", "email", "url", "checkbox", "radio", "range", "date", "datetime-local", "search", "tel", "time", "file", "month", "week", "password", "color", "hidden"],
|
|
2975
|
+
defaultValue: "text"
|
|
2976
|
+
},
|
|
2977
|
+
{
|
|
2978
|
+
name: "name",
|
|
2979
|
+
type: "string",
|
|
2980
|
+
required: true,
|
|
2981
|
+
helperText: 'Every input in a form needs a unique name describing what it takes, e.g. "email"'
|
|
2982
|
+
},
|
|
2983
|
+
{
|
|
2984
|
+
name: "placeholder",
|
|
2985
|
+
type: "string",
|
|
2986
|
+
defaultValue: "Hello there",
|
|
2987
|
+
helperText: "Text to display when there is no value"
|
|
2988
|
+
},
|
|
2989
|
+
// TODO: handle value vs default value automatically like ng-model
|
|
2990
|
+
{
|
|
2991
|
+
name: "defaultValue",
|
|
2992
|
+
type: "string"
|
|
2993
|
+
},
|
|
2994
|
+
{
|
|
2995
|
+
name: "value",
|
|
2996
|
+
type: "string",
|
|
2997
|
+
advanced: true
|
|
2998
|
+
},
|
|
2999
|
+
{
|
|
3000
|
+
name: "required",
|
|
3001
|
+
type: "boolean",
|
|
3002
|
+
helperText: "Is this input required to be filled out to submit a form",
|
|
3003
|
+
defaultValue: false
|
|
3004
|
+
}
|
|
3005
|
+
],
|
|
3006
|
+
noWrap: true,
|
|
3007
|
+
static: true,
|
|
3008
|
+
defaultStyles: {
|
|
3009
|
+
paddingTop: "10px",
|
|
3010
|
+
paddingBottom: "10px",
|
|
3011
|
+
paddingLeft: "10px",
|
|
3012
|
+
paddingRight: "10px",
|
|
3013
|
+
borderRadius: "3px",
|
|
3014
|
+
borderWidth: "1px",
|
|
3015
|
+
borderStyle: "solid",
|
|
3016
|
+
borderColor: "#ccc"
|
|
3017
|
+
}
|
|
3018
|
+
};
|
|
3019
|
+
|
|
3020
|
+
// src/blocks/form/input/input.tsx
|
|
3021
|
+
function FormInputComponent(props) {
|
|
3022
|
+
return <input
|
|
3023
|
+
{...{}}
|
|
3024
|
+
{...props.attributes}
|
|
3025
|
+
key={isEditing() && props.defaultValue ? props.defaultValue : "default-key"}
|
|
3026
|
+
placeholder={props.placeholder}
|
|
3027
|
+
type={props.type}
|
|
3028
|
+
name={props.name}
|
|
3029
|
+
value={props.value}
|
|
3030
|
+
defaultValue={props.defaultValue}
|
|
3031
|
+
required={props.required}
|
|
3032
|
+
/>;
|
|
3033
|
+
}
|
|
3034
|
+
var input_default = FormInputComponent;
|
|
3035
|
+
|
|
3036
|
+
// src/blocks/form/select/component-info.ts
|
|
3037
|
+
var componentInfo13 = {
|
|
3038
|
+
name: "Form:Select",
|
|
3039
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F83acca093fb24aaf94dee136e9a4b045",
|
|
3040
|
+
defaultStyles: {
|
|
3041
|
+
alignSelf: "flex-start"
|
|
3042
|
+
},
|
|
3043
|
+
inputs: [{
|
|
3044
|
+
name: "options",
|
|
3045
|
+
type: "list",
|
|
3046
|
+
required: true,
|
|
3047
|
+
subFields: [{
|
|
3048
|
+
name: "value",
|
|
3049
|
+
type: "text",
|
|
3050
|
+
required: true
|
|
3051
|
+
}, {
|
|
3052
|
+
name: "name",
|
|
3053
|
+
type: "text"
|
|
3054
|
+
}],
|
|
3055
|
+
defaultValue: [{
|
|
3056
|
+
value: "option 1"
|
|
3057
|
+
}, {
|
|
3058
|
+
value: "option 2"
|
|
3059
|
+
}]
|
|
3060
|
+
}, {
|
|
3061
|
+
name: "name",
|
|
3062
|
+
type: "string",
|
|
3063
|
+
required: true,
|
|
3064
|
+
helperText: 'Every select in a form needs a unique name describing what it gets, e.g. "email"'
|
|
3065
|
+
}, {
|
|
3066
|
+
name: "defaultValue",
|
|
3067
|
+
type: "string"
|
|
3068
|
+
}, {
|
|
3069
|
+
name: "value",
|
|
3070
|
+
type: "string",
|
|
3071
|
+
advanced: true
|
|
3072
|
+
}, {
|
|
3073
|
+
name: "required",
|
|
3074
|
+
type: "boolean",
|
|
3075
|
+
defaultValue: false
|
|
3076
|
+
}],
|
|
3077
|
+
static: true,
|
|
3078
|
+
noWrap: true
|
|
3079
|
+
};
|
|
3080
|
+
|
|
3081
|
+
// src/blocks/form/select/select.tsx
|
|
3082
|
+
import { For as For6 } from "solid-js";
|
|
3083
|
+
function SelectComponent(props) {
|
|
3084
|
+
return <select
|
|
3085
|
+
{...{}}
|
|
3086
|
+
{...props.attributes}
|
|
3087
|
+
value={props.value}
|
|
3088
|
+
key={isEditing() && props.defaultValue ? props.defaultValue : "default-key"}
|
|
3089
|
+
defaultValue={props.defaultValue}
|
|
3090
|
+
name={props.name}
|
|
3091
|
+
><For6 each={props.options}>{(option, _index) => {
|
|
3092
|
+
const index = _index();
|
|
3093
|
+
return <option value={option.value}>{option.name || option.value}</option>;
|
|
3094
|
+
}}</For6></select>;
|
|
3095
|
+
}
|
|
3096
|
+
var select_default = SelectComponent;
|
|
3097
|
+
|
|
3098
|
+
// src/blocks/form/submit-button/component-info.ts
|
|
3099
|
+
var componentInfo14 = {
|
|
3100
|
+
name: "Form:SubmitButton",
|
|
3101
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fdf2820ffed1f4349a94c40b3221f5b98",
|
|
3102
|
+
defaultStyles: {
|
|
3103
|
+
appearance: "none",
|
|
3104
|
+
paddingTop: "15px",
|
|
3105
|
+
paddingBottom: "15px",
|
|
3106
|
+
paddingLeft: "25px",
|
|
3107
|
+
paddingRight: "25px",
|
|
3108
|
+
backgroundColor: "#3898EC",
|
|
3109
|
+
color: "white",
|
|
3110
|
+
borderRadius: "4px",
|
|
3111
|
+
cursor: "pointer"
|
|
3112
|
+
},
|
|
3113
|
+
inputs: [{
|
|
3114
|
+
name: "text",
|
|
3115
|
+
type: "text",
|
|
3116
|
+
defaultValue: "Click me"
|
|
3117
|
+
}],
|
|
3118
|
+
static: true,
|
|
3119
|
+
noWrap: true
|
|
3120
|
+
// TODO: optional children? maybe as optional form input
|
|
3121
|
+
// that only shows if advanced setting is flipped
|
|
3122
|
+
// TODO: defaultChildren
|
|
3123
|
+
// canHaveChildren: true,
|
|
3124
|
+
};
|
|
3125
|
+
|
|
3126
|
+
// src/blocks/form/submit-button/submit-button.tsx
|
|
3127
|
+
function SubmitButton(props) {
|
|
3128
|
+
return <button type="submit" {...{}} {...props.attributes}>{props.text}</button>;
|
|
3129
|
+
}
|
|
3130
|
+
var submit_button_default = SubmitButton;
|
|
3131
|
+
|
|
3132
|
+
// src/blocks/img/component-info.ts
|
|
3133
|
+
var componentInfo15 = {
|
|
3134
|
+
// friendlyName?
|
|
3135
|
+
name: "Raw:Img",
|
|
3136
|
+
hideFromInsertMenu: true,
|
|
3137
|
+
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",
|
|
3138
|
+
inputs: [{
|
|
3139
|
+
name: "image",
|
|
3140
|
+
bubble: true,
|
|
3141
|
+
type: "file",
|
|
3142
|
+
allowedFileTypes: ["jpeg", "jpg", "png", "svg", "gif", "webp"],
|
|
3143
|
+
required: true
|
|
3144
|
+
}],
|
|
3145
|
+
noWrap: true,
|
|
3146
|
+
static: true
|
|
3147
|
+
};
|
|
3148
|
+
|
|
3149
|
+
// src/blocks/img/img.tsx
|
|
3150
|
+
function ImgComponent(props) {
|
|
3151
|
+
return <img
|
|
3152
|
+
style={{
|
|
3153
|
+
"object-fit": props.backgroundSize || "cover",
|
|
3154
|
+
"object-position": props.backgroundPosition || "center"
|
|
3155
|
+
}}
|
|
3156
|
+
key={isEditing() && props.imgSrc || "default-key"}
|
|
3157
|
+
alt={props.altText}
|
|
3158
|
+
src={props.imgSrc || props.image}
|
|
3159
|
+
{...{}}
|
|
3160
|
+
{...props.attributes}
|
|
3161
|
+
/>;
|
|
3162
|
+
}
|
|
3163
|
+
var img_default = ImgComponent;
|
|
3164
|
+
|
|
3165
|
+
// src/blocks/video/component-info.ts
|
|
3166
|
+
var componentInfo16 = {
|
|
3167
|
+
name: "Video",
|
|
3168
|
+
canHaveChildren: true,
|
|
3169
|
+
defaultStyles: {
|
|
3170
|
+
minHeight: "20px",
|
|
3171
|
+
minWidth: "20px"
|
|
3172
|
+
},
|
|
3173
|
+
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",
|
|
3174
|
+
inputs: [{
|
|
3175
|
+
name: "video",
|
|
3176
|
+
type: "file",
|
|
3177
|
+
allowedFileTypes: ["mp4"],
|
|
3178
|
+
bubble: true,
|
|
3179
|
+
defaultValue: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/assets%2FKQlEmWDxA0coC3PK6UvkrjwkIGI2%2F28cb070609f546cdbe5efa20e931aa4b?alt=media&token=912e9551-7a7c-4dfb-86b6-3da1537d1a7f",
|
|
3180
|
+
required: true
|
|
3181
|
+
}, {
|
|
3182
|
+
name: "posterImage",
|
|
3183
|
+
type: "file",
|
|
3184
|
+
allowedFileTypes: ["jpeg", "png"],
|
|
3185
|
+
helperText: "Image to show before the video plays"
|
|
3186
|
+
}, {
|
|
3187
|
+
name: "autoPlay",
|
|
3188
|
+
type: "boolean",
|
|
3189
|
+
defaultValue: true
|
|
3190
|
+
}, {
|
|
3191
|
+
name: "controls",
|
|
3192
|
+
type: "boolean",
|
|
3193
|
+
defaultValue: false
|
|
3194
|
+
}, {
|
|
3195
|
+
name: "muted",
|
|
3196
|
+
type: "boolean",
|
|
3197
|
+
defaultValue: true
|
|
3198
|
+
}, {
|
|
3199
|
+
name: "loop",
|
|
3200
|
+
type: "boolean",
|
|
3201
|
+
defaultValue: true
|
|
3202
|
+
}, {
|
|
3203
|
+
name: "playsInline",
|
|
3204
|
+
type: "boolean",
|
|
3205
|
+
defaultValue: true
|
|
3206
|
+
}, {
|
|
3207
|
+
name: "fit",
|
|
3208
|
+
type: "text",
|
|
3209
|
+
defaultValue: "cover",
|
|
3210
|
+
enum: ["contain", "cover", "fill", "auto"]
|
|
3211
|
+
}, {
|
|
3212
|
+
name: "preload",
|
|
2560
3213
|
type: "text",
|
|
2561
3214
|
defaultValue: "metadata",
|
|
2562
3215
|
enum: ["auto", "metadata", "none"]
|
|
@@ -2594,7 +3247,7 @@ var componentInfo12 = {
|
|
|
2594
3247
|
};
|
|
2595
3248
|
|
|
2596
3249
|
// src/blocks/video/video.tsx
|
|
2597
|
-
import { Show as
|
|
3250
|
+
import { Show as Show9 } from "solid-js";
|
|
2598
3251
|
function Video(props) {
|
|
2599
3252
|
function videoProps() {
|
|
2600
3253
|
return {
|
|
@@ -2645,8 +3298,8 @@ function Video(props) {
|
|
|
2645
3298
|
}}
|
|
2646
3299
|
src={props.video || "no-src"}
|
|
2647
3300
|
poster={props.posterImage}
|
|
2648
|
-
><
|
|
2649
|
-
<
|
|
3301
|
+
><Show9 when={!props.lazyLoad}><source type="video/mp4" src={props.video} /></Show9></video>
|
|
3302
|
+
<Show9
|
|
2650
3303
|
when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}
|
|
2651
3304
|
><div
|
|
2652
3305
|
style={{
|
|
@@ -2655,15 +3308,15 @@ function Video(props) {
|
|
|
2655
3308
|
"pointer-events": "none",
|
|
2656
3309
|
"font-size": "0px"
|
|
2657
3310
|
}}
|
|
2658
|
-
/></
|
|
2659
|
-
<
|
|
3311
|
+
/></Show9>
|
|
3312
|
+
<Show9 when={props.builderBlock?.children?.length && props.fitContent}><div
|
|
2660
3313
|
style={{
|
|
2661
3314
|
display: "flex",
|
|
2662
3315
|
"flex-direction": "column",
|
|
2663
3316
|
"align-items": "stretch"
|
|
2664
3317
|
}}
|
|
2665
|
-
>{props.children}</div></
|
|
2666
|
-
<
|
|
3318
|
+
>{props.children}</div></Show9>
|
|
3319
|
+
<Show9 when={props.builderBlock?.children?.length && !props.fitContent}><div
|
|
2667
3320
|
style={{
|
|
2668
3321
|
"pointer-events": "none",
|
|
2669
3322
|
display: "flex",
|
|
@@ -2675,11 +3328,38 @@ function Video(props) {
|
|
|
2675
3328
|
width: "100%",
|
|
2676
3329
|
height: "100%"
|
|
2677
3330
|
}}
|
|
2678
|
-
>{props.children}</div></
|
|
3331
|
+
>{props.children}</div></Show9>
|
|
2679
3332
|
</div>;
|
|
2680
3333
|
}
|
|
2681
3334
|
var video_default = Video;
|
|
2682
3335
|
|
|
3336
|
+
// src/constants/extra-components.ts
|
|
3337
|
+
var getExtraComponents = () => [{
|
|
3338
|
+
component: custom_code_default,
|
|
3339
|
+
...componentInfo9
|
|
3340
|
+
}, {
|
|
3341
|
+
component: embed_default,
|
|
3342
|
+
...componentInfo10
|
|
3343
|
+
}, ...TARGET === "rsc" ? [] : [{
|
|
3344
|
+
component: form_default,
|
|
3345
|
+
...componentInfo11
|
|
3346
|
+
}, {
|
|
3347
|
+
component: input_default,
|
|
3348
|
+
...componentInfo12
|
|
3349
|
+
}, {
|
|
3350
|
+
component: submit_button_default,
|
|
3351
|
+
...componentInfo14
|
|
3352
|
+
}, {
|
|
3353
|
+
component: select_default,
|
|
3354
|
+
...componentInfo13
|
|
3355
|
+
}], {
|
|
3356
|
+
component: img_default,
|
|
3357
|
+
...componentInfo15
|
|
3358
|
+
}, {
|
|
3359
|
+
component: video_default,
|
|
3360
|
+
...componentInfo16
|
|
3361
|
+
}];
|
|
3362
|
+
|
|
2683
3363
|
// src/constants/builder-registered-components.ts
|
|
2684
3364
|
var getDefaultRegisteredComponents = () => [{
|
|
2685
3365
|
component: button_default,
|
|
@@ -2688,36 +3368,24 @@ var getDefaultRegisteredComponents = () => [{
|
|
|
2688
3368
|
component: columns_default,
|
|
2689
3369
|
...componentInfo2
|
|
2690
3370
|
}, {
|
|
2691
|
-
component:
|
|
3371
|
+
component: fragment_default,
|
|
2692
3372
|
...componentInfo3
|
|
2693
3373
|
}, {
|
|
2694
|
-
component:
|
|
3374
|
+
component: image_default,
|
|
2695
3375
|
...componentInfo4
|
|
2696
3376
|
}, {
|
|
2697
|
-
component:
|
|
3377
|
+
component: section_default,
|
|
2698
3378
|
...componentInfo5
|
|
2699
3379
|
}, {
|
|
2700
|
-
component:
|
|
3380
|
+
component: slot_default,
|
|
2701
3381
|
...componentInfo6
|
|
2702
|
-
}, {
|
|
2703
|
-
component: img_default,
|
|
2704
|
-
...componentInfo7
|
|
2705
|
-
}, {
|
|
2706
|
-
component: section_default,
|
|
2707
|
-
...componentInfo8
|
|
2708
3382
|
}, {
|
|
2709
3383
|
component: symbol_default,
|
|
2710
|
-
...
|
|
3384
|
+
...componentInfo7
|
|
2711
3385
|
}, {
|
|
2712
3386
|
component: text_default,
|
|
2713
|
-
...
|
|
2714
|
-
},
|
|
2715
|
-
component: video_default,
|
|
2716
|
-
...componentInfo12
|
|
2717
|
-
}, {
|
|
2718
|
-
component: slot_default,
|
|
2719
|
-
...componentInfo9
|
|
2720
|
-
}];
|
|
3387
|
+
...componentInfo8
|
|
3388
|
+
}, ...getExtraComponents()];
|
|
2721
3389
|
|
|
2722
3390
|
// src/functions/register-component.ts
|
|
2723
3391
|
var components = [];
|
|
@@ -2795,7 +3463,7 @@ function InlinedScript(props) {
|
|
|
2795
3463
|
var Inlined_script_default = InlinedScript;
|
|
2796
3464
|
|
|
2797
3465
|
// src/components/content/components/enable-editor.tsx
|
|
2798
|
-
import { Show as
|
|
3466
|
+
import { Show as Show10, onMount as onMount3, on as on2, createEffect as createEffect2, createSignal as createSignal11 } from "solid-js";
|
|
2799
3467
|
import { Dynamic as Dynamic5 } from "solid-js/web";
|
|
2800
3468
|
|
|
2801
3469
|
// src/helpers/preview-lru-cache/get.ts
|
|
@@ -3285,7 +3953,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
3285
3953
|
}
|
|
3286
3954
|
|
|
3287
3955
|
// src/constants/sdk-version.ts
|
|
3288
|
-
var SDK_VERSION = "0.13.
|
|
3956
|
+
var SDK_VERSION = "0.13.3";
|
|
3289
3957
|
|
|
3290
3958
|
// src/functions/register.ts
|
|
3291
3959
|
var registry = {};
|
|
@@ -3483,15 +4151,15 @@ var subscribeToEditor = (model, callback, options) => {
|
|
|
3483
4151
|
|
|
3484
4152
|
// src/components/content/components/enable-editor.tsx
|
|
3485
4153
|
function EnableEditor(props) {
|
|
3486
|
-
const [forceReRenderCount, setForceReRenderCount] =
|
|
3487
|
-
const [firstRender, setFirstRender] =
|
|
3488
|
-
const [lastUpdated, setLastUpdated] =
|
|
3489
|
-
const [shouldSendResetCookie, setShouldSendResetCookie] =
|
|
3490
|
-
const [ContentWrapper, setContentWrapper] =
|
|
4154
|
+
const [forceReRenderCount, setForceReRenderCount] = createSignal11(0);
|
|
4155
|
+
const [firstRender, setFirstRender] = createSignal11(true);
|
|
4156
|
+
const [lastUpdated, setLastUpdated] = createSignal11(0);
|
|
4157
|
+
const [shouldSendResetCookie, setShouldSendResetCookie] = createSignal11(false);
|
|
4158
|
+
const [ContentWrapper, setContentWrapper] = createSignal11(
|
|
3491
4159
|
props.contentWrapper || "div"
|
|
3492
4160
|
);
|
|
3493
|
-
const [httpReqsData, setHttpReqsData] =
|
|
3494
|
-
const [clicked, setClicked] =
|
|
4161
|
+
const [httpReqsData, setHttpReqsData] = createSignal11({});
|
|
4162
|
+
const [clicked, setClicked] = createSignal11(false);
|
|
3495
4163
|
function mergeNewRootState(newData) {
|
|
3496
4164
|
const combinedState = {
|
|
3497
4165
|
...props.builderContextSignal.rootState,
|
|
@@ -3754,7 +4422,7 @@ function EnableEditor(props) {
|
|
|
3754
4422
|
}
|
|
3755
4423
|
}
|
|
3756
4424
|
createEffect2(on2(() => [props.locale], onUpdateFn_6));
|
|
3757
|
-
return <builder_context_default.Provider value={props.builderContextSignal}><
|
|
4425
|
+
return <builder_context_default.Provider value={props.builderContextSignal}><Show10 when={props.builderContextSignal.content}><Dynamic5
|
|
3758
4426
|
class={`variant-${props.content?.testVariationId || props.content?.id}`}
|
|
3759
4427
|
{...{}}
|
|
3760
4428
|
key={forceReRenderCount()}
|
|
@@ -3769,12 +4437,12 @@ function EnableEditor(props) {
|
|
|
3769
4437
|
}}
|
|
3770
4438
|
{...props.contentWrapperProps}
|
|
3771
4439
|
component={ContentWrapper()}
|
|
3772
|
-
>{props.children}</Dynamic5></
|
|
4440
|
+
>{props.children}</Dynamic5></Show10></builder_context_default.Provider>;
|
|
3773
4441
|
}
|
|
3774
4442
|
var Enable_editor_default = EnableEditor;
|
|
3775
4443
|
|
|
3776
4444
|
// src/components/content/components/styles.tsx
|
|
3777
|
-
import { createSignal as
|
|
4445
|
+
import { createSignal as createSignal12 } from "solid-js";
|
|
3778
4446
|
|
|
3779
4447
|
// src/components/content/components/styles.helpers.ts
|
|
3780
4448
|
var getCssFromFont = (font) => {
|
|
@@ -3833,7 +4501,7 @@ var getCss = ({
|
|
|
3833
4501
|
|
|
3834
4502
|
// src/components/content/components/styles.tsx
|
|
3835
4503
|
function ContentStyles(props) {
|
|
3836
|
-
const [injectedStyles, setInjectedStyles] =
|
|
4504
|
+
const [injectedStyles, setInjectedStyles] = createSignal12(
|
|
3837
4505
|
`
|
|
3838
4506
|
${getCss({
|
|
3839
4507
|
cssCode: props.cssCode,
|
|
@@ -3903,7 +4571,7 @@ var getContentInitialValue = ({
|
|
|
3903
4571
|
|
|
3904
4572
|
// src/components/content/content.tsx
|
|
3905
4573
|
function ContentComponent(props) {
|
|
3906
|
-
const [scriptStr, setScriptStr] =
|
|
4574
|
+
const [scriptStr, setScriptStr] = createSignal13(
|
|
3907
4575
|
getUpdateVariantVisibilityScript({
|
|
3908
4576
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
3909
4577
|
variationId: props.content?.testVariationId,
|
|
@@ -3911,7 +4579,7 @@ function ContentComponent(props) {
|
|
|
3911
4579
|
contentId: props.content?.id
|
|
3912
4580
|
})
|
|
3913
4581
|
);
|
|
3914
|
-
const [registeredComponents, setRegisteredComponents] =
|
|
4582
|
+
const [registeredComponents, setRegisteredComponents] = createSignal13(
|
|
3915
4583
|
[
|
|
3916
4584
|
...getDefaultRegisteredComponents(),
|
|
3917
4585
|
// While this `components` object is deprecated, we must maintain support for it.
|
|
@@ -3932,7 +4600,7 @@ function ContentComponent(props) {
|
|
|
3932
4600
|
{}
|
|
3933
4601
|
)
|
|
3934
4602
|
);
|
|
3935
|
-
const [builderContextSignal, setBuilderContextSignal] =
|
|
4603
|
+
const [builderContextSignal, setBuilderContextSignal] = createSignal13({
|
|
3936
4604
|
content: getContentInitialValue({
|
|
3937
4605
|
content: props.content,
|
|
3938
4606
|
data: props.data
|
|
@@ -3997,12 +4665,12 @@ function ContentComponent(props) {
|
|
|
3997
4665
|
setBuilderContextSignal
|
|
3998
4666
|
}}
|
|
3999
4667
|
>
|
|
4000
|
-
<
|
|
4001
|
-
<
|
|
4668
|
+
<Show11 when={props.isSsrAbTest}><Inlined_script_default scriptStr={scriptStr()} /></Show11>
|
|
4669
|
+
<Show11 when={TARGET !== "reactNative"}><Styles_default
|
|
4002
4670
|
contentId={builderContextSignal().content?.id}
|
|
4003
4671
|
cssCode={builderContextSignal().content?.data?.cssCode}
|
|
4004
4672
|
customFonts={builderContextSignal().content?.data?.customFonts}
|
|
4005
|
-
/></
|
|
4673
|
+
/></Show11>
|
|
4006
4674
|
<Blocks_default
|
|
4007
4675
|
blocks={builderContextSignal().content?.data?.blocks}
|
|
4008
4676
|
context={builderContextSignal()}
|
|
@@ -4015,7 +4683,7 @@ var Content_default = ContentComponent;
|
|
|
4015
4683
|
|
|
4016
4684
|
// src/components/content-variants/content-variants.tsx
|
|
4017
4685
|
function ContentVariants(props) {
|
|
4018
|
-
const [shouldRenderVariants, setShouldRenderVariants] =
|
|
4686
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal14(
|
|
4019
4687
|
checkShouldRenderVariants({
|
|
4020
4688
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
4021
4689
|
content: props.content
|
|
@@ -4046,8 +4714,8 @@ function ContentVariants(props) {
|
|
|
4046
4714
|
setShouldRenderVariants(false);
|
|
4047
4715
|
});
|
|
4048
4716
|
return <>
|
|
4049
|
-
<
|
|
4050
|
-
<
|
|
4717
|
+
<Show12 when={!props.__isNestedRender && TARGET !== "reactNative"}><Inlined_script_default scriptStr={getScriptString()} /></Show12>
|
|
4718
|
+
<Show12 when={shouldRenderVariants()}>
|
|
4051
4719
|
<Inlined_styles_default
|
|
4052
4720
|
id={`variants-styles-${props.content?.id}`}
|
|
4053
4721
|
styles={hideVariantsStyleString()}
|
|
@@ -4055,7 +4723,7 @@ function ContentVariants(props) {
|
|
|
4055
4723
|
<Inlined_script_default
|
|
4056
4724
|
scriptStr={updateCookieAndStylesScriptStr()}
|
|
4057
4725
|
/>
|
|
4058
|
-
<
|
|
4726
|
+
<For7 each={getVariants(props.content)}>{(variant, _index) => {
|
|
4059
4727
|
const index = _index();
|
|
4060
4728
|
return <Content_default
|
|
4061
4729
|
key={variant.testVariationId}
|
|
@@ -4079,8 +4747,8 @@ function ContentVariants(props) {
|
|
|
4079
4747
|
contentWrapperProps={props.contentWrapperProps}
|
|
4080
4748
|
trustedHosts={props.trustedHosts}
|
|
4081
4749
|
/>;
|
|
4082
|
-
}}</
|
|
4083
|
-
</
|
|
4750
|
+
}}</For7>
|
|
4751
|
+
</Show12>
|
|
4084
4752
|
<Content_default
|
|
4085
4753
|
{...{}}
|
|
4086
4754
|
content={defaultContent()}
|
|
@@ -4133,7 +4801,7 @@ var fetchSymbolContent = async ({
|
|
|
4133
4801
|
|
|
4134
4802
|
// src/blocks/symbol/symbol.tsx
|
|
4135
4803
|
function Symbol(props) {
|
|
4136
|
-
const [contentToUse, setContentToUse] =
|
|
4804
|
+
const [contentToUse, setContentToUse] = createSignal15(props.symbol?.content);
|
|
4137
4805
|
function className() {
|
|
4138
4806
|
return [
|
|
4139
4807
|
...[props.attributes[getClassPropName()]],
|