@builder.io/sdk-qwik 0.18.2 → 0.18.8
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/blocks/custom-code/custom-code.qwik.cjs +49 -31
- package/lib/browser/blocks/custom-code/custom-code.qwik.mjs +51 -33
- package/lib/browser/blocks/embed/embed.qwik.cjs +2 -1
- package/lib/browser/blocks/embed/embed.qwik.mjs +2 -1
- package/lib/browser/blocks/image/component-info.qwik.cjs +5 -0
- package/lib/browser/blocks/image/component-info.qwik.mjs +5 -0
- package/lib/browser/blocks/image/image.qwik.cjs +4 -1
- package/lib/browser/blocks/image/image.qwik.mjs +4 -1
- package/lib/browser/components/blocks/blocks-wrapper.qwik.cjs +9 -1
- package/lib/browser/components/blocks/blocks-wrapper.qwik.mjs +10 -2
- package/lib/browser/components/content-variants/helpers.qwik.cjs +2 -1
- package/lib/browser/components/content-variants/helpers.qwik.mjs +2 -1
- package/lib/browser/components/content-variants/inlined-fns.qwik.cjs +1 -1
- package/lib/browser/components/content-variants/inlined-fns.qwik.mjs +1 -1
- package/lib/browser/constants/sdk-version.qwik.cjs +1 -1
- package/lib/browser/constants/sdk-version.qwik.mjs +1 -1
- package/lib/edge/blocks/custom-code/custom-code.qwik.cjs +49 -31
- package/lib/edge/blocks/custom-code/custom-code.qwik.mjs +51 -33
- package/lib/edge/blocks/embed/embed.qwik.cjs +2 -1
- package/lib/edge/blocks/embed/embed.qwik.mjs +2 -1
- package/lib/edge/blocks/image/component-info.qwik.cjs +5 -0
- package/lib/edge/blocks/image/component-info.qwik.mjs +5 -0
- package/lib/edge/blocks/image/image.qwik.cjs +4 -1
- package/lib/edge/blocks/image/image.qwik.mjs +4 -1
- package/lib/edge/components/blocks/blocks-wrapper.qwik.cjs +9 -1
- package/lib/edge/components/blocks/blocks-wrapper.qwik.mjs +10 -2
- package/lib/edge/components/content-variants/helpers.qwik.cjs +2 -1
- package/lib/edge/components/content-variants/helpers.qwik.mjs +2 -1
- package/lib/edge/components/content-variants/inlined-fns.qwik.cjs +1 -1
- package/lib/edge/components/content-variants/inlined-fns.qwik.mjs +1 -1
- package/lib/edge/constants/sdk-version.qwik.cjs +1 -1
- package/lib/edge/constants/sdk-version.qwik.mjs +1 -1
- package/lib/node/blocks/custom-code/custom-code.qwik.cjs +49 -31
- package/lib/node/blocks/custom-code/custom-code.qwik.mjs +51 -33
- package/lib/node/blocks/embed/embed.qwik.cjs +2 -1
- package/lib/node/blocks/embed/embed.qwik.mjs +2 -1
- package/lib/node/blocks/image/component-info.qwik.cjs +5 -0
- package/lib/node/blocks/image/component-info.qwik.mjs +5 -0
- package/lib/node/blocks/image/image.qwik.cjs +4 -1
- package/lib/node/blocks/image/image.qwik.mjs +4 -1
- package/lib/node/components/blocks/blocks-wrapper.qwik.cjs +9 -1
- package/lib/node/components/blocks/blocks-wrapper.qwik.mjs +10 -2
- package/lib/node/components/content-variants/helpers.qwik.cjs +2 -1
- package/lib/node/components/content-variants/helpers.qwik.mjs +2 -1
- package/lib/node/components/content-variants/inlined-fns.qwik.cjs +1 -1
- package/lib/node/components/content-variants/inlined-fns.qwik.mjs +1 -1
- package/lib/node/constants/sdk-version.qwik.cjs +1 -1
- package/lib/node/constants/sdk-version.qwik.mjs +1 -1
- package/package.json +1 -1
- package/types/src/blocks/custom-code/custom-code.d.ts +1 -0
- package/types/src/blocks/image/image.types.d.ts +1 -0
- package/types/src/components/content-variants/inlined-fns.d.ts +1 -1
- package/types/src/constants/sdk-version.d.ts +1 -1
|
@@ -1,43 +1,60 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
3
|
const qwik = require("@builder.io/qwik");
|
|
4
|
+
const isEditing = require("../../functions/is-editing.qwik.cjs");
|
|
5
|
+
const logger = require("../../helpers/logger.qwik.cjs");
|
|
6
|
+
const runScripts = function runScripts2(props, state, elementRef) {
|
|
7
|
+
if (!elementRef.value || !elementRef.value.getElementsByTagName || typeof window === "undefined")
|
|
8
|
+
return;
|
|
9
|
+
const scripts = elementRef.value.getElementsByTagName("script");
|
|
10
|
+
for (let i = 0; i < scripts.length; i++) {
|
|
11
|
+
const script = scripts[i];
|
|
12
|
+
if (script.src) {
|
|
13
|
+
if (state.scriptsInserted.includes(script.src))
|
|
14
|
+
continue;
|
|
15
|
+
state.scriptsInserted.push(script.src);
|
|
16
|
+
const newScript = document.createElement("script");
|
|
17
|
+
newScript.async = true;
|
|
18
|
+
newScript.src = script.src;
|
|
19
|
+
document.head.appendChild(newScript);
|
|
20
|
+
} else if (!script.type || [
|
|
21
|
+
"text/javascript",
|
|
22
|
+
"application/javascript",
|
|
23
|
+
"application/ecmascript"
|
|
24
|
+
].includes(script.type)) {
|
|
25
|
+
if (state.scriptsRun.includes(script.innerText))
|
|
26
|
+
continue;
|
|
27
|
+
try {
|
|
28
|
+
state.scriptsRun.push(script.innerText);
|
|
29
|
+
new Function(script.innerText)();
|
|
30
|
+
} catch (error) {
|
|
31
|
+
logger.logger.warn("[BUILDER.IO] `CustomCode`: Error running script:", error);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
4
36
|
const CustomCode = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl((props) => {
|
|
5
37
|
const elementRef = qwik.useSignal();
|
|
6
38
|
const state = qwik.useStore({
|
|
7
39
|
scriptsInserted: [],
|
|
8
40
|
scriptsRun: []
|
|
9
41
|
});
|
|
10
|
-
qwik.
|
|
11
|
-
const [state2] = qwik.useLexicalScope();
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"text/javascript",
|
|
27
|
-
"application/javascript",
|
|
28
|
-
"application/ecmascript"
|
|
29
|
-
].includes(script.type)) {
|
|
30
|
-
if (state2.scriptsRun.includes(script.innerText))
|
|
31
|
-
continue;
|
|
32
|
-
try {
|
|
33
|
-
state2.scriptsRun.push(script.innerText);
|
|
34
|
-
new Function(script.innerText)();
|
|
35
|
-
} catch (error) {
|
|
36
|
-
console.warn("`CustomCode`: Error running script:", error);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}, "CustomCode_component_useOn_zjAgBhFOiCs", [
|
|
42
|
+
qwik.useVisibleTaskQrl(/* @__PURE__ */ qwik.inlinedQrl(() => {
|
|
43
|
+
const [elementRef2, props2, state2] = qwik.useLexicalScope();
|
|
44
|
+
runScripts(props2, state2, elementRef2);
|
|
45
|
+
}, "CustomCode_component_useVisibleTask_S5QgEQZj6YE", [
|
|
46
|
+
elementRef,
|
|
47
|
+
props,
|
|
48
|
+
state
|
|
49
|
+
]));
|
|
50
|
+
qwik.useVisibleTaskQrl(/* @__PURE__ */ qwik.inlinedQrl(({ track }) => {
|
|
51
|
+
const [elementRef2, props2, state2] = qwik.useLexicalScope();
|
|
52
|
+
track(() => props2.code);
|
|
53
|
+
if (isEditing.isEditing())
|
|
54
|
+
runScripts(props2, state2, elementRef2);
|
|
55
|
+
}, "CustomCode_component_useVisibleTask_1_Re102EQisCE", [
|
|
56
|
+
elementRef,
|
|
57
|
+
props,
|
|
41
58
|
state
|
|
42
59
|
]));
|
|
43
60
|
return /* @__PURE__ */ qwik._jsxQ("div", {
|
|
@@ -53,3 +70,4 @@ const CustomCode = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inline
|
|
|
53
70
|
}, "CustomCode_component_uYOSy7w7Zqw"));
|
|
54
71
|
exports.CustomCode = CustomCode;
|
|
55
72
|
exports.default = CustomCode;
|
|
73
|
+
exports.runScripts = runScripts;
|
|
@@ -1,41 +1,58 @@
|
|
|
1
|
-
import { componentQrl, inlinedQrl, useSignal, useStore,
|
|
1
|
+
import { componentQrl, inlinedQrl, useSignal, useStore, useVisibleTaskQrl, useLexicalScope, _jsxQ, _fnSignal } from "@builder.io/qwik";
|
|
2
|
+
import { isEditing } from "../../functions/is-editing.qwik.mjs";
|
|
3
|
+
import { logger } from "../../helpers/logger.qwik.mjs";
|
|
4
|
+
const runScripts = function runScripts2(props, state, elementRef) {
|
|
5
|
+
if (!elementRef.value || !elementRef.value.getElementsByTagName || typeof window === "undefined")
|
|
6
|
+
return;
|
|
7
|
+
const scripts = elementRef.value.getElementsByTagName("script");
|
|
8
|
+
for (let i = 0; i < scripts.length; i++) {
|
|
9
|
+
const script = scripts[i];
|
|
10
|
+
if (script.src) {
|
|
11
|
+
if (state.scriptsInserted.includes(script.src))
|
|
12
|
+
continue;
|
|
13
|
+
state.scriptsInserted.push(script.src);
|
|
14
|
+
const newScript = document.createElement("script");
|
|
15
|
+
newScript.async = true;
|
|
16
|
+
newScript.src = script.src;
|
|
17
|
+
document.head.appendChild(newScript);
|
|
18
|
+
} else if (!script.type || [
|
|
19
|
+
"text/javascript",
|
|
20
|
+
"application/javascript",
|
|
21
|
+
"application/ecmascript"
|
|
22
|
+
].includes(script.type)) {
|
|
23
|
+
if (state.scriptsRun.includes(script.innerText))
|
|
24
|
+
continue;
|
|
25
|
+
try {
|
|
26
|
+
state.scriptsRun.push(script.innerText);
|
|
27
|
+
new Function(script.innerText)();
|
|
28
|
+
} catch (error) {
|
|
29
|
+
logger.warn("[BUILDER.IO] `CustomCode`: Error running script:", error);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
2
34
|
const CustomCode = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
3
35
|
const elementRef = useSignal();
|
|
4
36
|
const state = useStore({
|
|
5
37
|
scriptsInserted: [],
|
|
6
38
|
scriptsRun: []
|
|
7
39
|
});
|
|
8
|
-
|
|
9
|
-
const [state2] = useLexicalScope();
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"text/javascript",
|
|
25
|
-
"application/javascript",
|
|
26
|
-
"application/ecmascript"
|
|
27
|
-
].includes(script.type)) {
|
|
28
|
-
if (state2.scriptsRun.includes(script.innerText))
|
|
29
|
-
continue;
|
|
30
|
-
try {
|
|
31
|
-
state2.scriptsRun.push(script.innerText);
|
|
32
|
-
new Function(script.innerText)();
|
|
33
|
-
} catch (error) {
|
|
34
|
-
console.warn("`CustomCode`: Error running script:", error);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}, "CustomCode_component_useOn_zjAgBhFOiCs", [
|
|
40
|
+
useVisibleTaskQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
41
|
+
const [elementRef2, props2, state2] = useLexicalScope();
|
|
42
|
+
runScripts(props2, state2, elementRef2);
|
|
43
|
+
}, "CustomCode_component_useVisibleTask_S5QgEQZj6YE", [
|
|
44
|
+
elementRef,
|
|
45
|
+
props,
|
|
46
|
+
state
|
|
47
|
+
]));
|
|
48
|
+
useVisibleTaskQrl(/* @__PURE__ */ inlinedQrl(({ track }) => {
|
|
49
|
+
const [elementRef2, props2, state2] = useLexicalScope();
|
|
50
|
+
track(() => props2.code);
|
|
51
|
+
if (isEditing())
|
|
52
|
+
runScripts(props2, state2, elementRef2);
|
|
53
|
+
}, "CustomCode_component_useVisibleTask_1_Re102EQisCE", [
|
|
54
|
+
elementRef,
|
|
55
|
+
props,
|
|
39
56
|
state
|
|
40
57
|
]));
|
|
41
58
|
return /* @__PURE__ */ _jsxQ("div", {
|
|
@@ -51,5 +68,6 @@ const CustomCode = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((prop
|
|
|
51
68
|
}, "CustomCode_component_uYOSy7w7Zqw"));
|
|
52
69
|
export {
|
|
53
70
|
CustomCode,
|
|
54
|
-
CustomCode as default
|
|
71
|
+
CustomCode as default,
|
|
72
|
+
runScripts
|
|
55
73
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
3
|
const qwik = require("@builder.io/qwik");
|
|
4
|
+
const logger = require("../../helpers/logger.qwik.cjs");
|
|
4
5
|
const helpers = require("./helpers.qwik.cjs");
|
|
5
6
|
const findAndRunScripts = function findAndRunScripts2(props, state, elem) {
|
|
6
7
|
if (!elem.value || !elem.value.getElementsByTagName)
|
|
@@ -19,7 +20,7 @@ const findAndRunScripts = function findAndRunScripts2(props, state, elem) {
|
|
|
19
20
|
state.scriptsRun.push(script.innerText);
|
|
20
21
|
new Function(script.innerText)();
|
|
21
22
|
} catch (error) {
|
|
22
|
-
|
|
23
|
+
logger.logger.warn("[BUILDER.IO] `Embed`: Error running script:", error);
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { componentQrl, inlinedQrl, useSignal, useStore, useTaskQrl, useLexicalScope, _jsxQ, _fnSignal } from "@builder.io/qwik";
|
|
2
|
+
import { logger } from "../../helpers/logger.qwik.mjs";
|
|
2
3
|
import { isJsScript } from "./helpers.qwik.mjs";
|
|
3
4
|
const findAndRunScripts = function findAndRunScripts2(props, state, elem) {
|
|
4
5
|
if (!elem.value || !elem.value.getElementsByTagName)
|
|
@@ -17,7 +18,7 @@ const findAndRunScripts = function findAndRunScripts2(props, state, elem) {
|
|
|
17
18
|
state.scriptsRun.push(script.innerText);
|
|
18
19
|
new Function(script.innerText)();
|
|
19
20
|
} catch (error) {
|
|
20
|
-
|
|
21
|
+
logger.warn("[BUILDER.IO] `Embed`: Error running script:", error);
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
24
|
};
|
|
@@ -103,6 +103,11 @@ const componentInfo = {
|
|
|
103
103
|
type: "string",
|
|
104
104
|
helperText: "Text to display when the user has images off"
|
|
105
105
|
},
|
|
106
|
+
{
|
|
107
|
+
name: "title",
|
|
108
|
+
type: "string",
|
|
109
|
+
helperText: "Text to display when hovering over the asset"
|
|
110
|
+
},
|
|
106
111
|
{
|
|
107
112
|
name: "height",
|
|
108
113
|
type: "number",
|
|
@@ -101,6 +101,11 @@ const componentInfo = {
|
|
|
101
101
|
type: "string",
|
|
102
102
|
helperText: "Text to display when the user has images off"
|
|
103
103
|
},
|
|
104
|
+
{
|
|
105
|
+
name: "title",
|
|
106
|
+
type: "string",
|
|
107
|
+
helperText: "Text to display when hovering over the asset"
|
|
108
|
+
},
|
|
104
109
|
{
|
|
105
110
|
name: "height",
|
|
106
111
|
type: "number",
|
|
@@ -94,7 +94,10 @@ const Image = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(
|
|
|
94
94
|
}), [
|
|
95
95
|
aspectRatioCss,
|
|
96
96
|
props
|
|
97
|
-
], '{objectPosition:p1.backgroundPosition||"center",objectFit:p1.backgroundSize||"cover",...p0.value}')
|
|
97
|
+
], '{objectPosition:p1.backgroundPosition||"center",objectFit:p1.backgroundSize||"cover",...p0.value}'),
|
|
98
|
+
title: qwik._fnSignal((p0) => p0.title, [
|
|
99
|
+
props
|
|
100
|
+
], "p0.title")
|
|
98
101
|
}, null, 3, null)
|
|
99
102
|
], 1, null),
|
|
100
103
|
props.aspectRatio && !(((_b = (_a = props.builderBlock) == null ? void 0 : _a.children) == null ? void 0 : _b.length) && props.fitContent) ? /* @__PURE__ */ qwik._jsxQ("div", null, {
|
|
@@ -92,7 +92,10 @@ const Image = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
|
|
|
92
92
|
}), [
|
|
93
93
|
aspectRatioCss,
|
|
94
94
|
props
|
|
95
|
-
], '{objectPosition:p1.backgroundPosition||"center",objectFit:p1.backgroundSize||"cover",...p0.value}')
|
|
95
|
+
], '{objectPosition:p1.backgroundPosition||"center",objectFit:p1.backgroundSize||"cover",...p0.value}'),
|
|
96
|
+
title: _fnSignal((p0) => p0.title, [
|
|
97
|
+
props
|
|
98
|
+
], "p0.title")
|
|
96
99
|
}, null, 3, null)
|
|
97
100
|
], 1, null),
|
|
98
101
|
props.aspectRatio && !(((_b = (_a = props.builderBlock) == null ? void 0 : _a.children) == null ? void 0 : _b.length) && props.fitContent) ? /* @__PURE__ */ _jsxQ("div", null, {
|
|
@@ -48,9 +48,17 @@ const BlocksWrapper = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inl
|
|
|
48
48
|
props
|
|
49
49
|
]));
|
|
50
50
|
const blocksWrapperRef = qwik.useSignal();
|
|
51
|
-
const state = {
|
|
51
|
+
const state = qwik.useStore({
|
|
52
|
+
shouldUpdate: false
|
|
53
|
+
});
|
|
52
54
|
qwik.useVisibleTaskQrl(/* @__PURE__ */ qwik.inlinedQrl(() => {
|
|
53
55
|
}, "BlocksWrapper_component_useVisibleTask_Z6vLhpCjVno"));
|
|
56
|
+
qwik.useTaskQrl(/* @__PURE__ */ qwik.inlinedQrl(({ track }) => {
|
|
57
|
+
const [props2] = qwik.useLexicalScope();
|
|
58
|
+
track(() => props2.blocks);
|
|
59
|
+
}, "BlocksWrapper_component_useTask_MRcgThpiGRc", [
|
|
60
|
+
props
|
|
61
|
+
]));
|
|
54
62
|
return /* @__PURE__ */ qwik._jsxC(props.BlocksWrapper, {
|
|
55
63
|
ref: blocksWrapperRef,
|
|
56
64
|
get class() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { componentQrl, inlinedQrl, useStylesScopedQrl, useComputedQrl, useLexicalScope, useSignal, useVisibleTaskQrl, _jsxC, Slot, _IMMUTABLE, _fnSignal } from "@builder.io/qwik";
|
|
1
|
+
import { componentQrl, inlinedQrl, useStylesScopedQrl, useComputedQrl, useLexicalScope, useSignal, useStore, useVisibleTaskQrl, useTaskQrl, _jsxC, Slot, _IMMUTABLE, _fnSignal } from "@builder.io/qwik";
|
|
2
2
|
import { isEditing } from "../../functions/is-editing.qwik.mjs";
|
|
3
3
|
const onClick = function onClick2(props, state, className, dataPath, blocksWrapperRef) {
|
|
4
4
|
var _a, _b;
|
|
@@ -46,9 +46,17 @@ const BlocksWrapper = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((p
|
|
|
46
46
|
props
|
|
47
47
|
]));
|
|
48
48
|
const blocksWrapperRef = useSignal();
|
|
49
|
-
const state = {
|
|
49
|
+
const state = useStore({
|
|
50
|
+
shouldUpdate: false
|
|
51
|
+
});
|
|
50
52
|
useVisibleTaskQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
51
53
|
}, "BlocksWrapper_component_useVisibleTask_Z6vLhpCjVno"));
|
|
54
|
+
useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track }) => {
|
|
55
|
+
const [props2] = useLexicalScope();
|
|
56
|
+
track(() => props2.blocks);
|
|
57
|
+
}, "BlocksWrapper_component_useTask_MRcgThpiGRc", [
|
|
58
|
+
props
|
|
59
|
+
]));
|
|
52
60
|
return /* @__PURE__ */ _jsxC(props.BlocksWrapper, {
|
|
53
61
|
ref: blocksWrapperRef,
|
|
54
62
|
get class() {
|
|
@@ -21,6 +21,7 @@ const checkShouldRenderVariants = ({ canTrack, content }) => {
|
|
|
21
21
|
return true;
|
|
22
22
|
};
|
|
23
23
|
const getIsHydrationTarget = (target2) => target2 === "react" || target2 === "reactNative";
|
|
24
|
+
const isAngularSDK = target.TARGET === "angular";
|
|
24
25
|
const isHydrationTarget = getIsHydrationTarget(target.TARGET);
|
|
25
26
|
const getInitVariantsFnsScriptString = () => `
|
|
26
27
|
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${inlinedFns.UPDATE_COOKIES_AND_STYLES_SCRIPT}
|
|
@@ -28,7 +29,7 @@ const getInitVariantsFnsScriptString = () => `
|
|
|
28
29
|
`;
|
|
29
30
|
const getUpdateCookieAndStylesScript = (variants, contentId) => `
|
|
30
31
|
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME}(
|
|
31
|
-
"${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget}
|
|
32
|
+
"${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget}, ${isAngularSDK}
|
|
32
33
|
)`;
|
|
33
34
|
const getUpdateVariantVisibilityScript = ({ contentId, variationId }) => `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME}(
|
|
34
35
|
"${variationId}", "${contentId}", ${isHydrationTarget}
|
|
@@ -19,6 +19,7 @@ const checkShouldRenderVariants = ({ canTrack, content }) => {
|
|
|
19
19
|
return true;
|
|
20
20
|
};
|
|
21
21
|
const getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
|
|
22
|
+
const isAngularSDK = TARGET === "angular";
|
|
22
23
|
const isHydrationTarget = getIsHydrationTarget(TARGET);
|
|
23
24
|
const getInitVariantsFnsScriptString = () => `
|
|
24
25
|
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
|
|
@@ -26,7 +27,7 @@ const getInitVariantsFnsScriptString = () => `
|
|
|
26
27
|
`;
|
|
27
28
|
const getUpdateCookieAndStylesScript = (variants, contentId) => `
|
|
28
29
|
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME}(
|
|
29
|
-
"${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget}
|
|
30
|
+
"${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget}, ${isAngularSDK}
|
|
30
31
|
)`;
|
|
31
32
|
const getUpdateVariantVisibilityScript = ({ contentId, variationId }) => `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME}(
|
|
32
33
|
"${variationId}", "${contentId}", ${isHydrationTarget}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const UPDATE_COOKIES_AND_STYLES_SCRIPT = "function updateCookiesAndStyles(contentId, variants, isHydrationTarget) {\n function getAndSetVariantId() {\n function setCookie(name, value, days) {\n let expires = '';\n if (days) {\n const date = new Date();\n date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);\n expires = '; expires=' + date.toUTCString();\n }\n document.cookie = name + '=' + (value || '') + expires + '; path=/' + '; Secure; SameSite=None';\n }\n function getCookie(name) {\n const nameEQ = name + '=';\n const ca = document.cookie.split(';');\n for (let i = 0; i < ca.length; i++) {\n let c = ca[i];\n while (c.charAt(0) === ' ') c = c.substring(1, c.length);\n if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);\n }\n return null;\n }\n const cookieName = `builder.tests.${contentId}`;\n const variantInCookie = getCookie(cookieName);\n const availableIDs = variants.map(vr => vr.id).concat(contentId);\n if (variantInCookie && availableIDs.includes(variantInCookie)) {\n return variantInCookie;\n }\n let n = 0;\n const random = Math.random();\n for (let i = 0; i < variants.length; i++) {\n const variant = variants[i];\n const testRatio = variant.testRatio;\n n += testRatio;\n if (random < n) {\n setCookie(cookieName, variant.id);\n return variant.id;\n }\n }\n setCookie(cookieName, contentId);\n return contentId;\n }\n const winningVariantId = getAndSetVariantId();\n
|
|
3
|
+
const UPDATE_COOKIES_AND_STYLES_SCRIPT = "function updateCookiesAndStyles(contentId, variants, isHydrationTarget, isAngularSDK) {\n function getAndSetVariantId() {\n function setCookie(name, value, days) {\n let expires = '';\n if (days) {\n const date = new Date();\n date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);\n expires = '; expires=' + date.toUTCString();\n }\n document.cookie = name + '=' + (value || '') + expires + '; path=/' + '; Secure; SameSite=None';\n }\n function getCookie(name) {\n const nameEQ = name + '=';\n const ca = document.cookie.split(';');\n for (let i = 0; i < ca.length; i++) {\n let c = ca[i];\n while (c.charAt(0) === ' ') c = c.substring(1, c.length);\n if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);\n }\n return null;\n }\n const cookieName = `builder.tests.${contentId}`;\n const variantInCookie = getCookie(cookieName);\n const availableIDs = variants.map(vr => vr.id).concat(contentId);\n if (variantInCookie && availableIDs.includes(variantInCookie)) {\n return variantInCookie;\n }\n let n = 0;\n const random = Math.random();\n for (let i = 0; i < variants.length; i++) {\n const variant = variants[i];\n const testRatio = variant.testRatio;\n n += testRatio;\n if (random < n) {\n setCookie(cookieName, variant.id);\n return variant.id;\n }\n }\n setCookie(cookieName, contentId);\n return contentId;\n }\n const winningVariantId = getAndSetVariantId();\n let styleEl = document.currentScript?.previousElementSibling;\n if (isAngularSDK) {\n styleEl = document.currentScript?.parentElement?.previousElementSibling?.querySelector('style');\n }\n if (isHydrationTarget) {\n styleEl.remove();\n const thisScriptEl = document.currentScript;\n thisScriptEl?.remove();\n } else {\n const newStyleStr = variants.concat({\n id: contentId\n }).filter(variant => variant.id !== winningVariantId).map(value => {\n return `.variant-${value.id} { display: none; }\n `;\n }).join('');\n styleEl.innerHTML = newStyleStr;\n }\n}";
|
|
4
4
|
const UPDATE_VARIANT_VISIBILITY_SCRIPT = "function updateVariantVisibility(variantContentId, defaultContentId, isHydrationTarget) {\n if (!navigator.cookieEnabled) {\n return;\n }\n function getCookie(name) {\n const nameEQ = name + '=';\n const ca = document.cookie.split(';');\n for (let i = 0; i < ca.length; i++) {\n let c = ca[i];\n while (c.charAt(0) === ' ') c = c.substring(1, c.length);\n if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);\n }\n return null;\n }\n const cookieName = `builder.tests.${defaultContentId}`;\n const winningVariant = getCookie(cookieName);\n const parentDiv = document.currentScript?.parentElement;\n const isDefaultContent = variantContentId === defaultContentId;\n const isWinningVariant = winningVariant === variantContentId;\n if (isWinningVariant && !isDefaultContent) {\n parentDiv?.removeAttribute('hidden');\n parentDiv?.removeAttribute('aria-hidden');\n } else if (!isWinningVariant && isDefaultContent) {\n parentDiv?.setAttribute('hidden', 'true');\n parentDiv?.setAttribute('aria-hidden', 'true');\n }\n if (isHydrationTarget) {\n if (!isWinningVariant) {\n parentDiv?.remove();\n }\n const thisScriptEl = document.currentScript;\n thisScriptEl?.remove();\n }\n return;\n}";
|
|
5
5
|
exports.UPDATE_COOKIES_AND_STYLES_SCRIPT = UPDATE_COOKIES_AND_STYLES_SCRIPT;
|
|
6
6
|
exports.UPDATE_VARIANT_VISIBILITY_SCRIPT = UPDATE_VARIANT_VISIBILITY_SCRIPT;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const UPDATE_COOKIES_AND_STYLES_SCRIPT = "function updateCookiesAndStyles(contentId, variants, isHydrationTarget) {\n function getAndSetVariantId() {\n function setCookie(name, value, days) {\n let expires = '';\n if (days) {\n const date = new Date();\n date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);\n expires = '; expires=' + date.toUTCString();\n }\n document.cookie = name + '=' + (value || '') + expires + '; path=/' + '; Secure; SameSite=None';\n }\n function getCookie(name) {\n const nameEQ = name + '=';\n const ca = document.cookie.split(';');\n for (let i = 0; i < ca.length; i++) {\n let c = ca[i];\n while (c.charAt(0) === ' ') c = c.substring(1, c.length);\n if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);\n }\n return null;\n }\n const cookieName = `builder.tests.${contentId}`;\n const variantInCookie = getCookie(cookieName);\n const availableIDs = variants.map(vr => vr.id).concat(contentId);\n if (variantInCookie && availableIDs.includes(variantInCookie)) {\n return variantInCookie;\n }\n let n = 0;\n const random = Math.random();\n for (let i = 0; i < variants.length; i++) {\n const variant = variants[i];\n const testRatio = variant.testRatio;\n n += testRatio;\n if (random < n) {\n setCookie(cookieName, variant.id);\n return variant.id;\n }\n }\n setCookie(cookieName, contentId);\n return contentId;\n }\n const winningVariantId = getAndSetVariantId();\n
|
|
1
|
+
const UPDATE_COOKIES_AND_STYLES_SCRIPT = "function updateCookiesAndStyles(contentId, variants, isHydrationTarget, isAngularSDK) {\n function getAndSetVariantId() {\n function setCookie(name, value, days) {\n let expires = '';\n if (days) {\n const date = new Date();\n date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);\n expires = '; expires=' + date.toUTCString();\n }\n document.cookie = name + '=' + (value || '') + expires + '; path=/' + '; Secure; SameSite=None';\n }\n function getCookie(name) {\n const nameEQ = name + '=';\n const ca = document.cookie.split(';');\n for (let i = 0; i < ca.length; i++) {\n let c = ca[i];\n while (c.charAt(0) === ' ') c = c.substring(1, c.length);\n if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);\n }\n return null;\n }\n const cookieName = `builder.tests.${contentId}`;\n const variantInCookie = getCookie(cookieName);\n const availableIDs = variants.map(vr => vr.id).concat(contentId);\n if (variantInCookie && availableIDs.includes(variantInCookie)) {\n return variantInCookie;\n }\n let n = 0;\n const random = Math.random();\n for (let i = 0; i < variants.length; i++) {\n const variant = variants[i];\n const testRatio = variant.testRatio;\n n += testRatio;\n if (random < n) {\n setCookie(cookieName, variant.id);\n return variant.id;\n }\n }\n setCookie(cookieName, contentId);\n return contentId;\n }\n const winningVariantId = getAndSetVariantId();\n let styleEl = document.currentScript?.previousElementSibling;\n if (isAngularSDK) {\n styleEl = document.currentScript?.parentElement?.previousElementSibling?.querySelector('style');\n }\n if (isHydrationTarget) {\n styleEl.remove();\n const thisScriptEl = document.currentScript;\n thisScriptEl?.remove();\n } else {\n const newStyleStr = variants.concat({\n id: contentId\n }).filter(variant => variant.id !== winningVariantId).map(value => {\n return `.variant-${value.id} { display: none; }\n `;\n }).join('');\n styleEl.innerHTML = newStyleStr;\n }\n}";
|
|
2
2
|
const UPDATE_VARIANT_VISIBILITY_SCRIPT = "function updateVariantVisibility(variantContentId, defaultContentId, isHydrationTarget) {\n if (!navigator.cookieEnabled) {\n return;\n }\n function getCookie(name) {\n const nameEQ = name + '=';\n const ca = document.cookie.split(';');\n for (let i = 0; i < ca.length; i++) {\n let c = ca[i];\n while (c.charAt(0) === ' ') c = c.substring(1, c.length);\n if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);\n }\n return null;\n }\n const cookieName = `builder.tests.${defaultContentId}`;\n const winningVariant = getCookie(cookieName);\n const parentDiv = document.currentScript?.parentElement;\n const isDefaultContent = variantContentId === defaultContentId;\n const isWinningVariant = winningVariant === variantContentId;\n if (isWinningVariant && !isDefaultContent) {\n parentDiv?.removeAttribute('hidden');\n parentDiv?.removeAttribute('aria-hidden');\n } else if (!isWinningVariant && isDefaultContent) {\n parentDiv?.setAttribute('hidden', 'true');\n parentDiv?.setAttribute('aria-hidden', 'true');\n }\n if (isHydrationTarget) {\n if (!isWinningVariant) {\n parentDiv?.remove();\n }\n const thisScriptEl = document.currentScript;\n thisScriptEl?.remove();\n }\n return;\n}";
|
|
3
3
|
export {
|
|
4
4
|
UPDATE_COOKIES_AND_STYLES_SCRIPT,
|
|
@@ -1,43 +1,60 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
3
|
const qwik = require("@builder.io/qwik");
|
|
4
|
+
const isEditing = require("../../functions/is-editing.qwik.cjs");
|
|
5
|
+
const logger = require("../../helpers/logger.qwik.cjs");
|
|
6
|
+
const runScripts = function runScripts2(props, state, elementRef) {
|
|
7
|
+
if (!elementRef.value || !elementRef.value.getElementsByTagName || typeof window === "undefined")
|
|
8
|
+
return;
|
|
9
|
+
const scripts = elementRef.value.getElementsByTagName("script");
|
|
10
|
+
for (let i = 0; i < scripts.length; i++) {
|
|
11
|
+
const script = scripts[i];
|
|
12
|
+
if (script.src) {
|
|
13
|
+
if (state.scriptsInserted.includes(script.src))
|
|
14
|
+
continue;
|
|
15
|
+
state.scriptsInserted.push(script.src);
|
|
16
|
+
const newScript = document.createElement("script");
|
|
17
|
+
newScript.async = true;
|
|
18
|
+
newScript.src = script.src;
|
|
19
|
+
document.head.appendChild(newScript);
|
|
20
|
+
} else if (!script.type || [
|
|
21
|
+
"text/javascript",
|
|
22
|
+
"application/javascript",
|
|
23
|
+
"application/ecmascript"
|
|
24
|
+
].includes(script.type)) {
|
|
25
|
+
if (state.scriptsRun.includes(script.innerText))
|
|
26
|
+
continue;
|
|
27
|
+
try {
|
|
28
|
+
state.scriptsRun.push(script.innerText);
|
|
29
|
+
new Function(script.innerText)();
|
|
30
|
+
} catch (error) {
|
|
31
|
+
logger.logger.warn("[BUILDER.IO] `CustomCode`: Error running script:", error);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
4
36
|
const CustomCode = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl((props) => {
|
|
5
37
|
const elementRef = qwik.useSignal();
|
|
6
38
|
const state = qwik.useStore({
|
|
7
39
|
scriptsInserted: [],
|
|
8
40
|
scriptsRun: []
|
|
9
41
|
});
|
|
10
|
-
qwik.
|
|
11
|
-
const [state2] = qwik.useLexicalScope();
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"text/javascript",
|
|
27
|
-
"application/javascript",
|
|
28
|
-
"application/ecmascript"
|
|
29
|
-
].includes(script.type)) {
|
|
30
|
-
if (state2.scriptsRun.includes(script.innerText))
|
|
31
|
-
continue;
|
|
32
|
-
try {
|
|
33
|
-
state2.scriptsRun.push(script.innerText);
|
|
34
|
-
new Function(script.innerText)();
|
|
35
|
-
} catch (error) {
|
|
36
|
-
console.warn("`CustomCode`: Error running script:", error);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}, "CustomCode_component_useOn_zjAgBhFOiCs", [
|
|
42
|
+
qwik.useVisibleTaskQrl(/* @__PURE__ */ qwik.inlinedQrl(() => {
|
|
43
|
+
const [elementRef2, props2, state2] = qwik.useLexicalScope();
|
|
44
|
+
runScripts(props2, state2, elementRef2);
|
|
45
|
+
}, "CustomCode_component_useVisibleTask_S5QgEQZj6YE", [
|
|
46
|
+
elementRef,
|
|
47
|
+
props,
|
|
48
|
+
state
|
|
49
|
+
]));
|
|
50
|
+
qwik.useVisibleTaskQrl(/* @__PURE__ */ qwik.inlinedQrl(({ track }) => {
|
|
51
|
+
const [elementRef2, props2, state2] = qwik.useLexicalScope();
|
|
52
|
+
track(() => props2.code);
|
|
53
|
+
if (isEditing.isEditing())
|
|
54
|
+
runScripts(props2, state2, elementRef2);
|
|
55
|
+
}, "CustomCode_component_useVisibleTask_1_Re102EQisCE", [
|
|
56
|
+
elementRef,
|
|
57
|
+
props,
|
|
41
58
|
state
|
|
42
59
|
]));
|
|
43
60
|
return /* @__PURE__ */ qwik._jsxQ("div", {
|
|
@@ -53,3 +70,4 @@ const CustomCode = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inline
|
|
|
53
70
|
}, "CustomCode_component_uYOSy7w7Zqw"));
|
|
54
71
|
exports.CustomCode = CustomCode;
|
|
55
72
|
exports.default = CustomCode;
|
|
73
|
+
exports.runScripts = runScripts;
|
|
@@ -1,41 +1,58 @@
|
|
|
1
|
-
import { componentQrl, inlinedQrl, useSignal, useStore,
|
|
1
|
+
import { componentQrl, inlinedQrl, useSignal, useStore, useVisibleTaskQrl, useLexicalScope, _jsxQ, _fnSignal } from "@builder.io/qwik";
|
|
2
|
+
import { isEditing } from "../../functions/is-editing.qwik.mjs";
|
|
3
|
+
import { logger } from "../../helpers/logger.qwik.mjs";
|
|
4
|
+
const runScripts = function runScripts2(props, state, elementRef) {
|
|
5
|
+
if (!elementRef.value || !elementRef.value.getElementsByTagName || typeof window === "undefined")
|
|
6
|
+
return;
|
|
7
|
+
const scripts = elementRef.value.getElementsByTagName("script");
|
|
8
|
+
for (let i = 0; i < scripts.length; i++) {
|
|
9
|
+
const script = scripts[i];
|
|
10
|
+
if (script.src) {
|
|
11
|
+
if (state.scriptsInserted.includes(script.src))
|
|
12
|
+
continue;
|
|
13
|
+
state.scriptsInserted.push(script.src);
|
|
14
|
+
const newScript = document.createElement("script");
|
|
15
|
+
newScript.async = true;
|
|
16
|
+
newScript.src = script.src;
|
|
17
|
+
document.head.appendChild(newScript);
|
|
18
|
+
} else if (!script.type || [
|
|
19
|
+
"text/javascript",
|
|
20
|
+
"application/javascript",
|
|
21
|
+
"application/ecmascript"
|
|
22
|
+
].includes(script.type)) {
|
|
23
|
+
if (state.scriptsRun.includes(script.innerText))
|
|
24
|
+
continue;
|
|
25
|
+
try {
|
|
26
|
+
state.scriptsRun.push(script.innerText);
|
|
27
|
+
new Function(script.innerText)();
|
|
28
|
+
} catch (error) {
|
|
29
|
+
logger.warn("[BUILDER.IO] `CustomCode`: Error running script:", error);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
2
34
|
const CustomCode = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
3
35
|
const elementRef = useSignal();
|
|
4
36
|
const state = useStore({
|
|
5
37
|
scriptsInserted: [],
|
|
6
38
|
scriptsRun: []
|
|
7
39
|
});
|
|
8
|
-
|
|
9
|
-
const [state2] = useLexicalScope();
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"text/javascript",
|
|
25
|
-
"application/javascript",
|
|
26
|
-
"application/ecmascript"
|
|
27
|
-
].includes(script.type)) {
|
|
28
|
-
if (state2.scriptsRun.includes(script.innerText))
|
|
29
|
-
continue;
|
|
30
|
-
try {
|
|
31
|
-
state2.scriptsRun.push(script.innerText);
|
|
32
|
-
new Function(script.innerText)();
|
|
33
|
-
} catch (error) {
|
|
34
|
-
console.warn("`CustomCode`: Error running script:", error);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}, "CustomCode_component_useOn_zjAgBhFOiCs", [
|
|
40
|
+
useVisibleTaskQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
41
|
+
const [elementRef2, props2, state2] = useLexicalScope();
|
|
42
|
+
runScripts(props2, state2, elementRef2);
|
|
43
|
+
}, "CustomCode_component_useVisibleTask_S5QgEQZj6YE", [
|
|
44
|
+
elementRef,
|
|
45
|
+
props,
|
|
46
|
+
state
|
|
47
|
+
]));
|
|
48
|
+
useVisibleTaskQrl(/* @__PURE__ */ inlinedQrl(({ track }) => {
|
|
49
|
+
const [elementRef2, props2, state2] = useLexicalScope();
|
|
50
|
+
track(() => props2.code);
|
|
51
|
+
if (isEditing())
|
|
52
|
+
runScripts(props2, state2, elementRef2);
|
|
53
|
+
}, "CustomCode_component_useVisibleTask_1_Re102EQisCE", [
|
|
54
|
+
elementRef,
|
|
55
|
+
props,
|
|
39
56
|
state
|
|
40
57
|
]));
|
|
41
58
|
return /* @__PURE__ */ _jsxQ("div", {
|
|
@@ -51,5 +68,6 @@ const CustomCode = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((prop
|
|
|
51
68
|
}, "CustomCode_component_uYOSy7w7Zqw"));
|
|
52
69
|
export {
|
|
53
70
|
CustomCode,
|
|
54
|
-
CustomCode as default
|
|
71
|
+
CustomCode as default,
|
|
72
|
+
runScripts
|
|
55
73
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
3
|
const qwik = require("@builder.io/qwik");
|
|
4
|
+
const logger = require("../../helpers/logger.qwik.cjs");
|
|
4
5
|
const helpers = require("./helpers.qwik.cjs");
|
|
5
6
|
const findAndRunScripts = function findAndRunScripts2(props, state, elem) {
|
|
6
7
|
if (!elem.value || !elem.value.getElementsByTagName)
|
|
@@ -19,7 +20,7 @@ const findAndRunScripts = function findAndRunScripts2(props, state, elem) {
|
|
|
19
20
|
state.scriptsRun.push(script.innerText);
|
|
20
21
|
new Function(script.innerText)();
|
|
21
22
|
} catch (error) {
|
|
22
|
-
|
|
23
|
+
logger.logger.warn("[BUILDER.IO] `Embed`: Error running script:", error);
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { componentQrl, inlinedQrl, useSignal, useStore, useTaskQrl, useLexicalScope, _jsxQ, _fnSignal } from "@builder.io/qwik";
|
|
2
|
+
import { logger } from "../../helpers/logger.qwik.mjs";
|
|
2
3
|
import { isJsScript } from "./helpers.qwik.mjs";
|
|
3
4
|
const findAndRunScripts = function findAndRunScripts2(props, state, elem) {
|
|
4
5
|
if (!elem.value || !elem.value.getElementsByTagName)
|
|
@@ -17,7 +18,7 @@ const findAndRunScripts = function findAndRunScripts2(props, state, elem) {
|
|
|
17
18
|
state.scriptsRun.push(script.innerText);
|
|
18
19
|
new Function(script.innerText)();
|
|
19
20
|
} catch (error) {
|
|
20
|
-
|
|
21
|
+
logger.warn("[BUILDER.IO] `Embed`: Error running script:", error);
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
24
|
};
|