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