@builder.io/sdk-qwik 0.0.9 → 0.0.10
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/index.qwik.cjs +151 -207
- package/lib/index.qwik.mjs +152 -208
- package/package.json +3 -3
- package/src/blocks/button/button.jsx +0 -175
- package/src/blocks/columns/columns.jsx +27 -197
- package/src/blocks/custom-code/custom-code.jsx +16 -75
- package/src/blocks/embed/embed.jsx +20 -87
- package/src/blocks/form/builder-blocks.jsx +0 -75
- package/src/blocks/form/form.jsx +57 -536
- package/src/blocks/fragment/fragment.jsx +8 -56
- package/src/blocks/image/image.jsx +49 -493
- package/src/blocks/img/img.jsx +15 -72
- package/src/blocks/input/input.jsx +17 -83
- package/src/blocks/raw-text/raw-text.jsx +9 -50
- package/src/blocks/section/section.jsx +17 -94
- package/src/blocks/select/select.jsx +20 -145
- package/src/blocks/submit-button/submit-button.jsx +8 -84
- package/src/blocks/symbol/symbol.jsx +60 -194
- package/src/blocks/text/text.jsx +4 -43
- package/src/blocks/textarea/textarea.jsx +12 -62
- package/src/blocks/video/video.jsx +21 -71
- package/src/components/render-block/block-styles.jsx +0 -114
- package/src/components/render-block/render-block.jsx +0 -514
- package/src/components/render-block/render-component.jsx +0 -211
- package/src/components/render-block/render-repeated-block.jsx +0 -67
- package/src/components/render-blocks.jsx +40 -334
- package/src/components/render-content/components/render-styles.jsx +0 -50
- package/src/components/render-content/render-content.jsx +86 -385
- package/src/components/render-inlined-styles.jsx +0 -116
package/lib/index.qwik.cjs
CHANGED
|
@@ -169,10 +169,7 @@ const set = (obj, _path, value) => {
|
|
|
169
169
|
if (Object(obj) !== obj)
|
|
170
170
|
return obj;
|
|
171
171
|
const path = Array.isArray(_path) ? _path : _path.toString().match(/[^.[\]]+/g);
|
|
172
|
-
path.slice(0, -1).reduce(
|
|
173
|
-
(a, c, i) => Object(a[c]) === a[c] ? a[c] : a[c] = Math.abs(Number(path[i + 1])) >> 0 === +path[i + 1] ? [] : {},
|
|
174
|
-
obj
|
|
175
|
-
)[path[path.length - 1]] = value;
|
|
172
|
+
path.slice(0, -1).reduce((a, c, i) => Object(a[c]) === a[c] ? a[c] : a[c] = Math.abs(Number(path[i + 1])) >> 0 === +path[i + 1] ? [] : {}, obj)[path[path.length - 1]] = value;
|
|
176
173
|
return obj;
|
|
177
174
|
};
|
|
178
175
|
function transformBlock(block) {
|
|
@@ -560,21 +557,19 @@ const repeatItemData = function repeatItemData2(props, state) {
|
|
|
560
557
|
return void 0;
|
|
561
558
|
const collectionName = repeat.collection.split(".").pop();
|
|
562
559
|
const itemNameToUse = repeat.itemName || (collectionName ? collectionName + "Item" : "item");
|
|
563
|
-
const repeatArray = itemsArray.map(
|
|
564
|
-
|
|
565
|
-
context
|
|
566
|
-
|
|
567
|
-
state
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
})
|
|
577
|
-
);
|
|
560
|
+
const repeatArray = itemsArray.map((item, index) => ({
|
|
561
|
+
context: {
|
|
562
|
+
...props.context,
|
|
563
|
+
state: {
|
|
564
|
+
...props.context.state,
|
|
565
|
+
$index: index,
|
|
566
|
+
$item: item,
|
|
567
|
+
[itemNameToUse]: item,
|
|
568
|
+
[`$${itemNameToUse}Index`]: index
|
|
569
|
+
}
|
|
570
|
+
},
|
|
571
|
+
block: blockWithoutRepeat
|
|
572
|
+
}));
|
|
578
573
|
return repeatArray;
|
|
579
574
|
};
|
|
580
575
|
const RenderBlock = (props) => {
|
|
@@ -642,7 +637,7 @@ const RenderBlocks = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) =
|
|
|
642
637
|
qwik.useStylesScopedQrl(qwik.inlinedQrl(STYLES$2, "RenderBlocks_component_useStylesScoped_QNti2s7juQc"));
|
|
643
638
|
const builderContext = qwik.useContext(stdin_default);
|
|
644
639
|
const state = {};
|
|
645
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
640
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
646
641
|
class: className(props) + " div-RenderBlocks",
|
|
647
642
|
"builder-path": props.path,
|
|
648
643
|
"builder-parent-id": props.parent,
|
|
@@ -652,7 +647,7 @@ const RenderBlocks = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) =
|
|
|
652
647
|
onClick$: qwik.inlinedQrl((event) => {
|
|
653
648
|
const [builderContext2, props2, state2] = qwik.useLexicalScope();
|
|
654
649
|
return onClick$1(props2);
|
|
655
|
-
}, "
|
|
650
|
+
}, "RenderBlocks_component_div_onClick_IHSfVTIKyxE", [
|
|
656
651
|
builderContext,
|
|
657
652
|
props,
|
|
658
653
|
state
|
|
@@ -660,31 +655,27 @@ const RenderBlocks = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) =
|
|
|
660
655
|
onMouseEnter$: qwik.inlinedQrl((event) => {
|
|
661
656
|
const [builderContext2, props2, state2] = qwik.useLexicalScope();
|
|
662
657
|
return onMouseEnter(props2);
|
|
663
|
-
}, "
|
|
658
|
+
}, "RenderBlocks_component_div_onMouseEnter_qLiEh4n9ugw", [
|
|
664
659
|
builderContext,
|
|
665
660
|
props,
|
|
666
661
|
state
|
|
667
662
|
]),
|
|
668
|
-
children:
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
]
|
|
683
|
-
})
|
|
663
|
+
children: [
|
|
664
|
+
props.blocks ? (props.blocks || []).map((block) => {
|
|
665
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RenderBlock$1, {
|
|
666
|
+
block,
|
|
667
|
+
context: builderContext
|
|
668
|
+
}, "render-block-" + block.id);
|
|
669
|
+
}) : null,
|
|
670
|
+
props.blocks ? (props.blocks || []).map((block) => {
|
|
671
|
+
return /* @__PURE__ */ jsxRuntime.jsx(BlockStyles$1, {
|
|
672
|
+
block,
|
|
673
|
+
context: builderContext
|
|
674
|
+
}, "block-style-" + block.id);
|
|
675
|
+
}) : null
|
|
676
|
+
]
|
|
684
677
|
});
|
|
685
|
-
}, "RenderBlocks_component_SXGwmVyEM0s")
|
|
686
|
-
tagName: "div"
|
|
687
|
-
});
|
|
678
|
+
}, "RenderBlocks_component_SXGwmVyEM0s"));
|
|
688
679
|
const RenderBlocks$1 = RenderBlocks;
|
|
689
680
|
const STYLES$2 = `.div-RenderBlocks {
|
|
690
681
|
display: flex;
|
|
@@ -730,7 +721,7 @@ const columnCssVars = function columnCssVars2(props, state) {
|
|
|
730
721
|
const Columns = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) => {
|
|
731
722
|
qwik.useStylesScopedQrl(qwik.inlinedQrl(STYLES$1, "Columns_component_useStylesScoped_704fWXyHORo"));
|
|
732
723
|
const state = {};
|
|
733
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
724
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
734
725
|
class: "builder-columns div-Columns",
|
|
735
726
|
style: columnsCssVars(props, state),
|
|
736
727
|
children: (props.columns || []).map((column, index) => {
|
|
@@ -747,9 +738,7 @@ const Columns = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) => {
|
|
|
747
738
|
}, index);
|
|
748
739
|
})
|
|
749
740
|
});
|
|
750
|
-
}, "Columns_component_0PeVQGTMczc")
|
|
751
|
-
tagName: "div"
|
|
752
|
-
});
|
|
741
|
+
}, "Columns_component_0PeVQGTMczc"));
|
|
753
742
|
const Columns$1 = Columns;
|
|
754
743
|
const STYLES$1 = `.div-Columns {
|
|
755
744
|
display: flex;
|
|
@@ -803,25 +792,15 @@ function getSrcSet(url) {
|
|
|
803
792
|
const widthInSrc = Number(url.split("?width=")[1]);
|
|
804
793
|
if (!isNaN(widthInSrc))
|
|
805
794
|
srcUrl = `${srcUrl} ${widthInSrc}w`;
|
|
806
|
-
return sizes.filter(
|
|
807
|
-
(size) => size !== widthInSrc
|
|
808
|
-
).map(
|
|
809
|
-
(size) => `${updateQueryParam(url, "width", size)} ${size}w`
|
|
810
|
-
).concat([
|
|
795
|
+
return sizes.filter((size) => size !== widthInSrc).map((size) => `${updateQueryParam(url, "width", size)} ${size}w`).concat([
|
|
811
796
|
srcUrl
|
|
812
797
|
]).join(", ");
|
|
813
798
|
}
|
|
814
799
|
if (url.match(/cdn\.shopify\.com/))
|
|
815
|
-
return sizes.map(
|
|
816
|
-
(size)
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
]
|
|
820
|
-
).filter(
|
|
821
|
-
([sizeUrl]) => !!sizeUrl
|
|
822
|
-
).map(
|
|
823
|
-
([sizeUrl, size]) => `${sizeUrl} ${size}w`
|
|
824
|
-
).concat([
|
|
800
|
+
return sizes.map((size) => [
|
|
801
|
+
getShopifyImageUrl(url, `${size}x${size}`),
|
|
802
|
+
size
|
|
803
|
+
]).filter(([sizeUrl]) => !!sizeUrl).map(([sizeUrl, size]) => `${sizeUrl} ${size}w`).concat([
|
|
825
804
|
url
|
|
826
805
|
]).join(", ");
|
|
827
806
|
return url;
|
|
@@ -848,51 +827,47 @@ const webpSrcSet = function webpSrcSet2(props, state) {
|
|
|
848
827
|
};
|
|
849
828
|
const Image = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) => {
|
|
850
829
|
qwik.useStylesScopedQrl(qwik.inlinedQrl(STYLES, "Image_component_useStylesScoped_gRbO7w7SeZA"));
|
|
851
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
830
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
852
831
|
class: "div-Image",
|
|
853
|
-
children:
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
]
|
|
891
|
-
})
|
|
832
|
+
children: [
|
|
833
|
+
/* @__PURE__ */ jsxRuntime.jsxs("picture", {
|
|
834
|
+
children: [
|
|
835
|
+
webpSrcSet(props) ? /* @__PURE__ */ jsxRuntime.jsx("source", {
|
|
836
|
+
type: "image/webp",
|
|
837
|
+
srcset: webpSrcSet(props)
|
|
838
|
+
}) : null,
|
|
839
|
+
/* @__PURE__ */ jsxRuntime.jsx("img", {
|
|
840
|
+
loading: "lazy",
|
|
841
|
+
alt: props.altText,
|
|
842
|
+
role: props.altText ? "presentation" : void 0,
|
|
843
|
+
style: {
|
|
844
|
+
objectPosition: props.backgroundSize || "center",
|
|
845
|
+
objectFit: props.backgroundSize || "cover"
|
|
846
|
+
},
|
|
847
|
+
class: "builder-image" + (props.className ? " " + props.className : "") + " img-Image",
|
|
848
|
+
src: props.image,
|
|
849
|
+
srcset: srcSetToUse(props),
|
|
850
|
+
sizes: props.sizes
|
|
851
|
+
}),
|
|
852
|
+
/* @__PURE__ */ jsxRuntime.jsx("source", {
|
|
853
|
+
srcset: srcSetToUse(props)
|
|
854
|
+
})
|
|
855
|
+
]
|
|
856
|
+
}),
|
|
857
|
+
props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length) ? /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
858
|
+
class: "builder-image-sizer div-Image-2",
|
|
859
|
+
style: {
|
|
860
|
+
paddingTop: props.aspectRatio * 100 + "%"
|
|
861
|
+
}
|
|
862
|
+
}) : null,
|
|
863
|
+
props.builderBlock?.children?.length && props.fitContent ? /* @__PURE__ */ jsxRuntime.jsx(qwik.Slot, {}) : null,
|
|
864
|
+
!props.fitContent ? /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
865
|
+
class: "div-Image-3",
|
|
866
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(qwik.Slot, {})
|
|
867
|
+
}) : null
|
|
868
|
+
]
|
|
892
869
|
});
|
|
893
|
-
}, "Image_component_y3S3Zox9wEo")
|
|
894
|
-
tagName: "div"
|
|
895
|
-
});
|
|
870
|
+
}, "Image_component_y3S3Zox9wEo"));
|
|
896
871
|
const Image$1 = Image;
|
|
897
872
|
const STYLES = `.div-Image {
|
|
898
873
|
position: relative; }.img-Image {
|
|
@@ -915,13 +890,11 @@ left: 0;
|
|
|
915
890
|
width: 100%;
|
|
916
891
|
height: 100%; }`;
|
|
917
892
|
const Text = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) => {
|
|
918
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
893
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
919
894
|
class: "builder-text",
|
|
920
895
|
dangerouslySetInnerHTML: props.text
|
|
921
896
|
});
|
|
922
|
-
}, "Text_component_ci0NVEdoK0Q")
|
|
923
|
-
tagName: "div"
|
|
924
|
-
});
|
|
897
|
+
}, "Text_component_ci0NVEdoK0Q"));
|
|
925
898
|
const Text$1 = Text;
|
|
926
899
|
const videoProps = function videoProps2(props, state) {
|
|
927
900
|
return {
|
|
@@ -943,7 +916,7 @@ const videoProps = function videoProps2(props, state) {
|
|
|
943
916
|
};
|
|
944
917
|
};
|
|
945
918
|
const Video = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) => {
|
|
946
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
919
|
+
return /* @__PURE__ */ jsxRuntime.jsx("video", {
|
|
947
920
|
...videoProps(props),
|
|
948
921
|
style: {
|
|
949
922
|
width: "100%",
|
|
@@ -956,9 +929,7 @@ const Video = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) => {
|
|
|
956
929
|
src: props.video || "no-src",
|
|
957
930
|
poster: props.posterImage
|
|
958
931
|
});
|
|
959
|
-
}, "Video_component_O5sPuWlrTvk")
|
|
960
|
-
tagName: "video"
|
|
961
|
-
});
|
|
932
|
+
}, "Video_component_O5sPuWlrTvk"));
|
|
962
933
|
const Video$1 = Video;
|
|
963
934
|
const Button = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) => {
|
|
964
935
|
return /* @__PURE__ */ jsxRuntime.jsx(qwik.Fragment, {
|
|
@@ -1213,13 +1184,9 @@ const componentInfo$7 = {
|
|
|
1213
1184
|
}
|
|
1214
1185
|
const columns = options.get("columns");
|
|
1215
1186
|
if (Array.isArray(columns)) {
|
|
1216
|
-
const containsColumnWithWidth = !!columns.find(
|
|
1217
|
-
(col) => col.get("width")
|
|
1218
|
-
);
|
|
1187
|
+
const containsColumnWithWidth = !!columns.find((col) => col.get("width"));
|
|
1219
1188
|
if (containsColumnWithWidth) {
|
|
1220
|
-
const containsColumnWithoutWidth = !!columns.find(
|
|
1221
|
-
(col) => !col.get("width")
|
|
1222
|
-
);
|
|
1189
|
+
const containsColumnWithoutWidth = !!columns.find((col) => !col.get("width"));
|
|
1223
1190
|
if (containsColumnWithoutWidth)
|
|
1224
1191
|
clearWidths();
|
|
1225
1192
|
else {
|
|
@@ -1271,12 +1238,10 @@ const componentInfo$6 = {
|
|
|
1271
1238
|
noWrap: true
|
|
1272
1239
|
};
|
|
1273
1240
|
const FragmentComponent = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) => {
|
|
1274
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1241
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", {
|
|
1275
1242
|
children: /* @__PURE__ */ jsxRuntime.jsx(qwik.Slot, {})
|
|
1276
1243
|
});
|
|
1277
|
-
}, "FragmentComponent_component_FJmqlA66Rjg")
|
|
1278
|
-
tagName: "span"
|
|
1279
|
-
});
|
|
1244
|
+
}, "FragmentComponent_component_FJmqlA66Rjg"));
|
|
1280
1245
|
const Fragment = FragmentComponent;
|
|
1281
1246
|
const componentInfo$5 = {
|
|
1282
1247
|
name: "Image",
|
|
@@ -1331,9 +1296,7 @@ const componentInfo$5 = {
|
|
|
1331
1296
|
}
|
|
1332
1297
|
const value = options.get("image");
|
|
1333
1298
|
const aspectRatio = options.get("aspectRatio");
|
|
1334
|
-
fetch(value).then(
|
|
1335
|
-
(res) => res.blob()
|
|
1336
|
-
).then((blob) => {
|
|
1299
|
+
fetch(value).then((res) => res.blob()).then((blob) => {
|
|
1337
1300
|
if (blob.type.includes("svg"))
|
|
1338
1301
|
options.set("noWebp", true);
|
|
1339
1302
|
});
|
|
@@ -1476,16 +1439,14 @@ const componentInfo$4 = {
|
|
|
1476
1439
|
]
|
|
1477
1440
|
};
|
|
1478
1441
|
const SectionComponent = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) => {
|
|
1479
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1442
|
+
return /* @__PURE__ */ jsxRuntime.jsx("section", {
|
|
1480
1443
|
...props.attributes,
|
|
1481
1444
|
style: (() => {
|
|
1482
1445
|
props.maxWidth && typeof props.maxWidth === "number" ? props.maxWidth : void 0;
|
|
1483
1446
|
})(),
|
|
1484
1447
|
children: /* @__PURE__ */ jsxRuntime.jsx(qwik.Slot, {})
|
|
1485
1448
|
});
|
|
1486
|
-
}, "SectionComponent_component_m1CcjCwgHug")
|
|
1487
|
-
tagName: "section"
|
|
1488
|
-
});
|
|
1449
|
+
}, "SectionComponent_component_m1CcjCwgHug"));
|
|
1489
1450
|
const Section = SectionComponent;
|
|
1490
1451
|
const componentInfo$3 = {
|
|
1491
1452
|
name: "Symbol",
|
|
@@ -1677,9 +1638,7 @@ const componentInfo2 = {
|
|
|
1677
1638
|
if (url) {
|
|
1678
1639
|
options.set("content", "Loading...");
|
|
1679
1640
|
const apiKey = "ae0e60e78201a3f2b0de4b";
|
|
1680
|
-
return fetch(`https://iframe.ly/api/iframely?url=${url}&api_key=${apiKey}`).then(
|
|
1681
|
-
(res) => res.json()
|
|
1682
|
-
).then((data) => {
|
|
1641
|
+
return fetch(`https://iframe.ly/api/iframely?url=${url}&api_key=${apiKey}`).then((res) => res.json()).then((data) => {
|
|
1683
1642
|
if (options.get("url") === url) {
|
|
1684
1643
|
if (data.html)
|
|
1685
1644
|
options.set("content", data.html);
|
|
@@ -1745,14 +1704,12 @@ const Embed = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) => {
|
|
|
1745
1704
|
props,
|
|
1746
1705
|
state
|
|
1747
1706
|
]));
|
|
1748
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1707
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
1749
1708
|
class: "builder-embed",
|
|
1750
1709
|
ref: elem,
|
|
1751
1710
|
dangerouslySetInnerHTML: props.content
|
|
1752
1711
|
});
|
|
1753
|
-
}, "Embed_component_CP6B8Y76ylw")
|
|
1754
|
-
tagName: "div"
|
|
1755
|
-
});
|
|
1712
|
+
}, "Embed_component_CP6B8Y76ylw"));
|
|
1756
1713
|
const embed = Embed;
|
|
1757
1714
|
var __defProp$3 = Object.defineProperty;
|
|
1758
1715
|
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
|
|
@@ -1905,9 +1862,7 @@ function getFetch() {
|
|
|
1905
1862
|
return __async$1(this, null, function* () {
|
|
1906
1863
|
const globalFetch = getGlobalThis().fetch;
|
|
1907
1864
|
if (typeof globalFetch === "undefined" && typeof global !== "undefined") {
|
|
1908
|
-
const nodeFetch = Promise.resolve().then(() => require("./index.d8c1e37f.cjs")).then(
|
|
1909
|
-
(d) => d.default
|
|
1910
|
-
);
|
|
1865
|
+
const nodeFetch = Promise.resolve().then(() => require("./index.d8c1e37f.cjs")).then((d) => d.default);
|
|
1911
1866
|
return nodeFetch.default || nodeFetch;
|
|
1912
1867
|
}
|
|
1913
1868
|
return globalFetch.default || globalFetch;
|
|
@@ -2012,8 +1967,8 @@ const generateContentUrl = (options) => {
|
|
|
2012
1967
|
const flattened2 = flatten({
|
|
2013
1968
|
query
|
|
2014
1969
|
});
|
|
2015
|
-
for (const
|
|
2016
|
-
url.searchParams.set(
|
|
1970
|
+
for (const key1 in flattened2)
|
|
1971
|
+
url.searchParams.set(key1, JSON.stringify(flattened2[key1]));
|
|
2017
1972
|
}
|
|
2018
1973
|
return url;
|
|
2019
1974
|
};
|
|
@@ -2021,9 +1976,7 @@ function getAllContent(options) {
|
|
|
2021
1976
|
return __async(this, null, function* () {
|
|
2022
1977
|
const url = generateContentUrl(options);
|
|
2023
1978
|
const fetch2 = yield fetch$;
|
|
2024
|
-
const content = yield fetch2(url.href).then(
|
|
2025
|
-
(res) => res.json()
|
|
2026
|
-
);
|
|
1979
|
+
const content = yield fetch2(url.href).then((res) => res.json());
|
|
2027
1980
|
if (options.testGroups)
|
|
2028
1981
|
for (const item of content.results)
|
|
2029
1982
|
handleABTesting(item, options.testGroups);
|
|
@@ -2102,14 +2055,9 @@ const prepareComponentInfoToSend = (_c) => {
|
|
|
2102
2055
|
"inputs"
|
|
2103
2056
|
]);
|
|
2104
2057
|
return __spreadProps(__spreadValues({}, fastClone(info)), {
|
|
2105
|
-
inputs: inputs == null ? void 0 : inputs.map(
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
[key]: serializeValue(value)
|
|
2109
|
-
}),
|
|
2110
|
-
{}
|
|
2111
|
-
)
|
|
2112
|
-
)
|
|
2058
|
+
inputs: inputs == null ? void 0 : inputs.map((input) => Object.entries(input).reduce((acc, [key, value]) => __spreadProps(__spreadValues({}, acc), {
|
|
2059
|
+
[key]: serializeValue(value)
|
|
2060
|
+
}), {}))
|
|
2113
2061
|
});
|
|
2114
2062
|
};
|
|
2115
2063
|
function track(event, properties) {
|
|
@@ -2166,9 +2114,7 @@ const getCssFromFont = function getCssFromFont2(props, state, font) {
|
|
|
2166
2114
|
return str;
|
|
2167
2115
|
};
|
|
2168
2116
|
const getFontCss = function getFontCss2(props, state, { customFonts }) {
|
|
2169
|
-
return customFonts?.map(
|
|
2170
|
-
(font) => getCssFromFont(props, state, font)
|
|
2171
|
-
)?.join(" ") || "";
|
|
2117
|
+
return customFonts?.map((font) => getCssFromFont(props, state, font))?.join(" ") || "";
|
|
2172
2118
|
};
|
|
2173
2119
|
const injectedStyles = function injectedStyles2(props, state) {
|
|
2174
2120
|
return `
|
|
@@ -2184,7 +2130,7 @@ const RenderContentStyles = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((p
|
|
|
2184
2130
|
});
|
|
2185
2131
|
}, "RenderContentStyles_component_32XAr483K2o"));
|
|
2186
2132
|
const RenderContentStyles$1 = RenderContentStyles;
|
|
2187
|
-
const useContent = function useContent2(props, state) {
|
|
2133
|
+
const useContent = function useContent2(props, state, elementRef) {
|
|
2188
2134
|
const mergedContent = {
|
|
2189
2135
|
...props.content,
|
|
2190
2136
|
...state.overrideContent,
|
|
@@ -2196,32 +2142,29 @@ const useContent = function useContent2(props, state) {
|
|
|
2196
2142
|
};
|
|
2197
2143
|
return mergedContent;
|
|
2198
2144
|
};
|
|
2199
|
-
const contentState = function contentState2(props, state) {
|
|
2145
|
+
const contentState = function contentState2(props, state, elementRef) {
|
|
2200
2146
|
return {
|
|
2201
2147
|
...props.content?.data?.state,
|
|
2202
2148
|
...props.data,
|
|
2203
2149
|
...state.overrideState
|
|
2204
2150
|
};
|
|
2205
2151
|
};
|
|
2206
|
-
const contextContext = function contextContext2(props, state) {
|
|
2152
|
+
const contextContext = function contextContext2(props, state, elementRef) {
|
|
2207
2153
|
return props.context || {};
|
|
2208
2154
|
};
|
|
2209
|
-
const allRegisteredComponents = function allRegisteredComponents2(props, state) {
|
|
2155
|
+
const allRegisteredComponents = function allRegisteredComponents2(props, state, elementRef) {
|
|
2210
2156
|
const allComponentsArray = [
|
|
2211
2157
|
...getDefaultRegisteredComponents(),
|
|
2212
2158
|
...components,
|
|
2213
2159
|
...props.customComponents || []
|
|
2214
2160
|
];
|
|
2215
|
-
const allComponents = allComponentsArray.reduce(
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
}),
|
|
2220
|
-
{}
|
|
2221
|
-
);
|
|
2161
|
+
const allComponents = allComponentsArray.reduce((acc, curr) => ({
|
|
2162
|
+
...acc,
|
|
2163
|
+
[curr.name]: curr
|
|
2164
|
+
}), {});
|
|
2222
2165
|
return allComponents;
|
|
2223
2166
|
};
|
|
2224
|
-
const processMessage = function processMessage2(props, state, event) {
|
|
2167
|
+
const processMessage = function processMessage2(props, state, elementRef, event) {
|
|
2225
2168
|
const { data } = event;
|
|
2226
2169
|
if (data)
|
|
2227
2170
|
switch (data.type) {
|
|
@@ -2235,7 +2178,7 @@ const processMessage = function processMessage2(props, state, event) {
|
|
|
2235
2178
|
}
|
|
2236
2179
|
}
|
|
2237
2180
|
};
|
|
2238
|
-
const evaluateJsCode = function evaluateJsCode2(props, state) {
|
|
2181
|
+
const evaluateJsCode = function evaluateJsCode2(props, state, elementRef) {
|
|
2239
2182
|
const jsCode = useContent(props, state)?.data?.jsCode;
|
|
2240
2183
|
if (jsCode)
|
|
2241
2184
|
evaluate({
|
|
@@ -2244,26 +2187,23 @@ const evaluateJsCode = function evaluateJsCode2(props, state) {
|
|
|
2244
2187
|
state: contentState(props, state)
|
|
2245
2188
|
});
|
|
2246
2189
|
};
|
|
2247
|
-
const httpReqsData = function httpReqsData2(props, state) {
|
|
2190
|
+
const httpReqsData = function httpReqsData2(props, state, elementRef) {
|
|
2248
2191
|
return {};
|
|
2249
2192
|
};
|
|
2250
|
-
const onClick2 = function onClick3(props, state, _event) {
|
|
2193
|
+
const onClick2 = function onClick3(props, state, elementRef, _event) {
|
|
2251
2194
|
if (useContent(props, state) && props.canTrack !== false)
|
|
2252
2195
|
track("click", {
|
|
2253
2196
|
contentId: useContent(props, state).id
|
|
2254
2197
|
});
|
|
2255
2198
|
};
|
|
2256
|
-
const evalExpression = function evalExpression2(props, state, expression) {
|
|
2257
|
-
return expression.replace(
|
|
2258
|
-
|
|
2259
|
-
(
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
state: contentState(props, state)
|
|
2263
|
-
})
|
|
2264
|
-
);
|
|
2199
|
+
const evalExpression = function evalExpression2(props, state, elementRef, expression) {
|
|
2200
|
+
return expression.replace(/{{([^}]+)}}/g, (_match, group) => evaluate({
|
|
2201
|
+
code: group,
|
|
2202
|
+
context: contextContext(props),
|
|
2203
|
+
state: contentState(props, state)
|
|
2204
|
+
}));
|
|
2265
2205
|
};
|
|
2266
|
-
const handleRequest = function handleRequest2(props, state, { url, key }) {
|
|
2206
|
+
const handleRequest = function handleRequest2(props, state, elementRef, { url, key }) {
|
|
2267
2207
|
const fetchAndSetState = async () => {
|
|
2268
2208
|
const fetch2 = await getFetch();
|
|
2269
2209
|
const response = await fetch2(url);
|
|
@@ -2276,19 +2216,19 @@ const handleRequest = function handleRequest2(props, state, { url, key }) {
|
|
|
2276
2216
|
};
|
|
2277
2217
|
fetchAndSetState();
|
|
2278
2218
|
};
|
|
2279
|
-
const runHttpRequests = function runHttpRequests2(props, state) {
|
|
2219
|
+
const runHttpRequests = function runHttpRequests2(props, state, elementRef) {
|
|
2280
2220
|
const requests = useContent(props, state)?.data?.httpRequests ?? {};
|
|
2281
2221
|
Object.entries(requests).forEach(([key, url]) => {
|
|
2282
2222
|
if (url && (!httpReqsData()[key] || isEditing())) {
|
|
2283
|
-
const evaluatedUrl = evalExpression(props, state, url);
|
|
2284
|
-
handleRequest(props, state, {
|
|
2223
|
+
const evaluatedUrl = evalExpression(props, state, elementRef, url);
|
|
2224
|
+
handleRequest(props, state, elementRef, {
|
|
2285
2225
|
url: evaluatedUrl,
|
|
2286
2226
|
key
|
|
2287
2227
|
});
|
|
2288
2228
|
}
|
|
2289
2229
|
});
|
|
2290
2230
|
};
|
|
2291
|
-
const emitStateUpdate = function emitStateUpdate2(props, state) {
|
|
2231
|
+
const emitStateUpdate = function emitStateUpdate2(props, state, elementRef) {
|
|
2292
2232
|
if (isEditing())
|
|
2293
2233
|
window.dispatchEvent(new CustomEvent("builder:component:stateChange", {
|
|
2294
2234
|
detail: {
|
|
@@ -2299,11 +2239,11 @@ const emitStateUpdate = function emitStateUpdate2(props, state) {
|
|
|
2299
2239
|
}
|
|
2300
2240
|
}));
|
|
2301
2241
|
};
|
|
2302
|
-
const shouldRenderContentStyles = function shouldRenderContentStyles2(props, state) {
|
|
2242
|
+
const shouldRenderContentStyles = function shouldRenderContentStyles2(props, state, elementRef) {
|
|
2303
2243
|
return Boolean((useContent(props, state)?.data?.cssCode || useContent(props, state)?.data?.customFonts?.length) && TARGET !== "reactNative");
|
|
2304
2244
|
};
|
|
2305
2245
|
const RenderContent = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) => {
|
|
2306
|
-
const
|
|
2246
|
+
const elementRef = qwik.useRef();
|
|
2307
2247
|
const state = qwik.useStore({
|
|
2308
2248
|
forceReRenderCount: 0,
|
|
2309
2249
|
overrideContent: null,
|
|
@@ -2328,19 +2268,19 @@ const RenderContent = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props)
|
|
|
2328
2268
|
})()
|
|
2329
2269
|
}));
|
|
2330
2270
|
qwik.useClientEffectQrl(qwik.inlinedQrl(() => {
|
|
2331
|
-
const [
|
|
2271
|
+
const [elementRef2, props2, state2] = qwik.useLexicalScope();
|
|
2332
2272
|
if (isBrowser()) {
|
|
2333
2273
|
if (isEditing()) {
|
|
2334
2274
|
state2.forceReRenderCount++;
|
|
2335
|
-
qwik._useMutableProps(
|
|
2275
|
+
qwik._useMutableProps(elementRef2.current, true);
|
|
2336
2276
|
registerInsertMenu();
|
|
2337
2277
|
setupBrowserForEditing();
|
|
2338
2278
|
Object.values(allRegisteredComponents(props2)).forEach((registeredComponent) => {
|
|
2339
2279
|
const message = createRegisterComponentMessage(registeredComponent);
|
|
2340
2280
|
window.parent?.postMessage(message, "*");
|
|
2341
2281
|
});
|
|
2342
|
-
window.addEventListener("message", processMessage.bind(null, props2, state2));
|
|
2343
|
-
window.addEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate.bind(null, props2, state2));
|
|
2282
|
+
window.addEventListener("message", processMessage.bind(null, props2, state2, elementRef2));
|
|
2283
|
+
window.addEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate.bind(null, props2, state2, elementRef2));
|
|
2344
2284
|
}
|
|
2345
2285
|
if (useContent(props2, state2) && props2.canTrack !== false)
|
|
2346
2286
|
track("impression", {
|
|
@@ -2361,54 +2301,60 @@ const RenderContent = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props)
|
|
|
2361
2301
|
}
|
|
2362
2302
|
}
|
|
2363
2303
|
evaluateJsCode(props2, state2);
|
|
2364
|
-
runHttpRequests(props2, state2);
|
|
2304
|
+
runHttpRequests(props2, state2, elementRef2);
|
|
2365
2305
|
emitStateUpdate(props2, state2);
|
|
2366
2306
|
}
|
|
2367
2307
|
}, "RenderContent_component_useClientEffect_ntruwSC9lSo", [
|
|
2368
|
-
|
|
2308
|
+
elementRef,
|
|
2369
2309
|
props,
|
|
2370
2310
|
state
|
|
2371
2311
|
]));
|
|
2372
|
-
qwik.useWatchQrl(qwik.inlinedQrl(({ track:
|
|
2373
|
-
const [props2, state2] = qwik.useLexicalScope();
|
|
2374
|
-
state2.useContent?.data &&
|
|
2312
|
+
qwik.useWatchQrl(qwik.inlinedQrl(({ track: track2 }) => {
|
|
2313
|
+
const [elementRef2, props2, state2] = qwik.useLexicalScope();
|
|
2314
|
+
state2.useContent?.data && track2(state2.useContent?.data, "jsCode");
|
|
2375
2315
|
evaluateJsCode(props2, state2);
|
|
2376
2316
|
}, "RenderContent_component_useWatch_1P0ujLQOmzc", [
|
|
2317
|
+
elementRef,
|
|
2377
2318
|
props,
|
|
2378
2319
|
state
|
|
2379
2320
|
]));
|
|
2380
2321
|
qwik.useWatchQrl(qwik.inlinedQrl(({ track: track2 }) => {
|
|
2381
|
-
const [props2, state2] = qwik.useLexicalScope();
|
|
2322
|
+
const [elementRef2, props2, state2] = qwik.useLexicalScope();
|
|
2382
2323
|
state2.useContent?.data && track2(state2.useContent?.data, "httpRequests");
|
|
2383
|
-
runHttpRequests(props2, state2);
|
|
2324
|
+
runHttpRequests(props2, state2, elementRef2);
|
|
2384
2325
|
}, "RenderContent_component_useWatch_1_0hAcn4V2AZw", [
|
|
2326
|
+
elementRef,
|
|
2385
2327
|
props,
|
|
2386
2328
|
state
|
|
2387
2329
|
]));
|
|
2388
|
-
qwik.useWatchQrl(qwik.inlinedQrl(({ track:
|
|
2389
|
-
const [props2, state2] = qwik.useLexicalScope();
|
|
2390
|
-
state2 &&
|
|
2330
|
+
qwik.useWatchQrl(qwik.inlinedQrl(({ track: track2 }) => {
|
|
2331
|
+
const [elementRef2, props2, state2] = qwik.useLexicalScope();
|
|
2332
|
+
state2 && track2(state2, "contentState");
|
|
2391
2333
|
emitStateUpdate(props2, state2);
|
|
2392
2334
|
}, "RenderContent_component_useWatch_2_t2n8zpl4mRs", [
|
|
2335
|
+
elementRef,
|
|
2393
2336
|
props,
|
|
2394
2337
|
state
|
|
2395
2338
|
]));
|
|
2396
2339
|
qwik.useCleanupQrl(qwik.inlinedQrl(() => {
|
|
2397
|
-
const [props2, state2] = qwik.useLexicalScope();
|
|
2340
|
+
const [elementRef2, props2, state2] = qwik.useLexicalScope();
|
|
2398
2341
|
if (isBrowser()) {
|
|
2399
|
-
window.removeEventListener("message", processMessage.bind(null, props2, state2));
|
|
2400
|
-
window.removeEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate.bind(null, props2, state2));
|
|
2342
|
+
window.removeEventListener("message", processMessage.bind(null, props2, state2, elementRef2));
|
|
2343
|
+
window.removeEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate.bind(null, props2, state2, elementRef2));
|
|
2401
2344
|
}
|
|
2402
2345
|
}, "RenderContent_component_useCleanup_sGf1npb03WA", [
|
|
2346
|
+
elementRef,
|
|
2403
2347
|
props,
|
|
2404
2348
|
state
|
|
2405
2349
|
]));
|
|
2406
2350
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
2407
2351
|
children: useContent(props, state) ? /* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
2352
|
+
ref: elementRef,
|
|
2408
2353
|
onClick$: qwik.inlinedQrl((event) => {
|
|
2409
|
-
const [props2, state2] = qwik.useLexicalScope();
|
|
2354
|
+
const [elementRef2, props2, state2] = qwik.useLexicalScope();
|
|
2410
2355
|
return onClick2(props2, state2);
|
|
2411
2356
|
}, "RenderContent_component__Fragment_div_onClick_76e3rL00UYE", [
|
|
2357
|
+
elementRef,
|
|
2412
2358
|
props,
|
|
2413
2359
|
state
|
|
2414
2360
|
]),
|
|
@@ -2461,7 +2407,7 @@ const Symbol$1 = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) => {
|
|
|
2461
2407
|
props,
|
|
2462
2408
|
state
|
|
2463
2409
|
]));
|
|
2464
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2410
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
2465
2411
|
...props.attributes,
|
|
2466
2412
|
dataSet: {
|
|
2467
2413
|
class: state.className
|
|
@@ -2480,9 +2426,7 @@ const Symbol$1 = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) => {
|
|
|
2480
2426
|
content: state.content
|
|
2481
2427
|
})
|
|
2482
2428
|
});
|
|
2483
|
-
}, "Symbol_component_Dn8mGpai87I")
|
|
2484
|
-
tagName: "div"
|
|
2485
|
-
});
|
|
2429
|
+
}, "Symbol_component_Dn8mGpai87I"));
|
|
2486
2430
|
const Symbol$2 = Symbol$1;
|
|
2487
2431
|
const settings = {};
|
|
2488
2432
|
function setEditorSettings(newSettings) {
|