@builder.io/sdk-solid 0.12.1 → 0.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +4 -0
- package/lib/browser/dev.js +93 -62
- package/lib/browser/dev.jsx +90 -68
- package/lib/browser/index.js +93 -62
- package/lib/browser/index.jsx +90 -68
- package/lib/edge/dev.js +93 -62
- package/lib/edge/dev.jsx +90 -68
- package/lib/edge/index.js +93 -62
- package/lib/edge/index.jsx +90 -68
- package/lib/node/dev.js +93 -62
- package/lib/node/dev.jsx +90 -68
- package/lib/node/index.js +93 -62
- package/lib/node/index.jsx +90 -68
- package/package.json +1 -1
package/lib/browser/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createComponent, spread, mergeProps, insert, effect, setAttribute, className, style, template,
|
|
1
|
+
import { createComponent, spread, mergeProps, insert, effect, setAttribute, className, style, template, Dynamic, memo, use } from 'solid-js/web';
|
|
2
2
|
import { createContext, Show, useContext, For, createSignal, onMount, createEffect, on } from 'solid-js';
|
|
3
3
|
import { css } from 'solid-styled-components';
|
|
4
4
|
|
|
@@ -331,10 +331,6 @@ function getProcessedBlock({
|
|
|
331
331
|
}
|
|
332
332
|
|
|
333
333
|
// src/components/block/block.helpers.ts
|
|
334
|
-
var EMPTY_HTML_ELEMENTS = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"];
|
|
335
|
-
var isEmptyHtmlElement = (tagName) => {
|
|
336
|
-
return typeof tagName === "string" && EMPTY_HTML_ELEMENTS.includes(tagName.toLowerCase());
|
|
337
|
-
};
|
|
338
334
|
var getComponent = ({
|
|
339
335
|
block,
|
|
340
336
|
context,
|
|
@@ -653,48 +649,80 @@ function getStyleAttribute(style) {
|
|
|
653
649
|
}
|
|
654
650
|
}
|
|
655
651
|
|
|
656
|
-
// src/components/
|
|
657
|
-
|
|
652
|
+
// src/components/dynamic-renderer/dynamic-renderer.helpers.ts
|
|
653
|
+
var EMPTY_HTML_ELEMENTS = /* @__PURE__ */ new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"]);
|
|
654
|
+
var isEmptyElement = (tagName) => {
|
|
655
|
+
return typeof tagName === "string" && EMPTY_HTML_ELEMENTS.has(tagName.toLowerCase());
|
|
656
|
+
};
|
|
657
|
+
|
|
658
|
+
// src/components/dynamic-renderer/dynamic-renderer.tsx
|
|
659
|
+
function DynamicRenderer(props) {
|
|
658
660
|
return createComponent(Show, {
|
|
659
661
|
get fallback() {
|
|
660
|
-
return createComponent(Dynamic, mergeProps(() =>
|
|
661
|
-
block: props.block,
|
|
662
|
-
context: props.context
|
|
663
|
-
}), () => getBlockActions({
|
|
664
|
-
block: props.block,
|
|
665
|
-
rootState: props.context.rootState,
|
|
666
|
-
rootSetState: props.context.rootSetState,
|
|
667
|
-
localState: props.context.localState,
|
|
668
|
-
context: props.context.context,
|
|
669
|
-
stripPrefix: true
|
|
670
|
-
}), {
|
|
662
|
+
return createComponent(Dynamic, mergeProps(() => props.attributes, () => props.actionAttributes, {
|
|
671
663
|
get component() {
|
|
672
|
-
return props.
|
|
664
|
+
return props.TagName;
|
|
673
665
|
}
|
|
674
666
|
}));
|
|
675
667
|
},
|
|
676
668
|
get when() {
|
|
677
|
-
return props.
|
|
669
|
+
return !isEmptyElement(props.TagName);
|
|
678
670
|
},
|
|
679
671
|
get children() {
|
|
680
|
-
return createComponent(
|
|
672
|
+
return createComponent(Show, {
|
|
673
|
+
get fallback() {
|
|
674
|
+
return createComponent(Dynamic, mergeProps(() => props.attributes, () => props.actionAttributes, {
|
|
675
|
+
get component() {
|
|
676
|
+
return props.TagName;
|
|
677
|
+
},
|
|
678
|
+
get children() {
|
|
679
|
+
return props.children;
|
|
680
|
+
}
|
|
681
|
+
}));
|
|
682
|
+
},
|
|
683
|
+
get when() {
|
|
684
|
+
return typeof props.TagName === "string";
|
|
685
|
+
},
|
|
686
|
+
get children() {
|
|
687
|
+
return createComponent(Dynamic, mergeProps(() => props.attributes, () => props.actionAttributes, {
|
|
688
|
+
get component() {
|
|
689
|
+
return props.TagName;
|
|
690
|
+
},
|
|
691
|
+
get children() {
|
|
692
|
+
return props.children;
|
|
693
|
+
}
|
|
694
|
+
}));
|
|
695
|
+
}
|
|
696
|
+
});
|
|
697
|
+
}
|
|
698
|
+
});
|
|
699
|
+
}
|
|
700
|
+
var dynamic_renderer_default = DynamicRenderer;
|
|
701
|
+
|
|
702
|
+
// src/components/block/components/block-wrapper.tsx
|
|
703
|
+
function BlockWrapper(props) {
|
|
704
|
+
return createComponent(dynamic_renderer_default, {
|
|
705
|
+
get TagName() {
|
|
706
|
+
return props.Wrapper;
|
|
707
|
+
},
|
|
708
|
+
get attributes() {
|
|
709
|
+
return getBlockProperties({
|
|
681
710
|
block: props.block,
|
|
682
711
|
context: props.context
|
|
683
|
-
})
|
|
712
|
+
});
|
|
713
|
+
},
|
|
714
|
+
get actionAttributes() {
|
|
715
|
+
return getBlockActions({
|
|
684
716
|
block: props.block,
|
|
685
717
|
rootState: props.context.rootState,
|
|
686
718
|
rootSetState: props.context.rootSetState,
|
|
687
719
|
localState: props.context.localState,
|
|
688
720
|
context: props.context.context,
|
|
689
721
|
stripPrefix: true
|
|
690
|
-
})
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
get children() {
|
|
695
|
-
return props.children;
|
|
696
|
-
}
|
|
697
|
-
}));
|
|
722
|
+
});
|
|
723
|
+
},
|
|
724
|
+
get children() {
|
|
725
|
+
return props.children;
|
|
698
726
|
}
|
|
699
727
|
});
|
|
700
728
|
}
|
|
@@ -935,29 +963,8 @@ function Block(props) {
|
|
|
935
963
|
return !blockComponent()?.noWrap;
|
|
936
964
|
},
|
|
937
965
|
get children() {
|
|
938
|
-
return
|
|
939
|
-
get
|
|
940
|
-
return isEmptyHtmlElement(Tag());
|
|
941
|
-
},
|
|
942
|
-
get children() {
|
|
943
|
-
return createComponent(block_wrapper_default, {
|
|
944
|
-
get Wrapper() {
|
|
945
|
-
return Tag();
|
|
946
|
-
},
|
|
947
|
-
get block() {
|
|
948
|
-
return processedBlock();
|
|
949
|
-
},
|
|
950
|
-
get context() {
|
|
951
|
-
return props.context;
|
|
952
|
-
},
|
|
953
|
-
hasChildren: false
|
|
954
|
-
});
|
|
955
|
-
}
|
|
956
|
-
}), createComponent(Show, {
|
|
957
|
-
get when() {
|
|
958
|
-
return memo(() => !!!isEmptyHtmlElement(Tag()))() && repeatItem();
|
|
959
|
-
},
|
|
960
|
-
get children() {
|
|
966
|
+
return createComponent(Show, {
|
|
967
|
+
get fallback() {
|
|
961
968
|
return createComponent(For, {
|
|
962
969
|
get each() {
|
|
963
970
|
return repeatItem();
|
|
@@ -978,10 +985,9 @@ function Block(props) {
|
|
|
978
985
|
});
|
|
979
986
|
}
|
|
980
987
|
});
|
|
981
|
-
}
|
|
982
|
-
}), createComponent(Show, {
|
|
988
|
+
},
|
|
983
989
|
get when() {
|
|
984
|
-
return
|
|
990
|
+
return !repeatItem();
|
|
985
991
|
},
|
|
986
992
|
get children() {
|
|
987
993
|
return createComponent(block_wrapper_default, {
|
|
@@ -994,7 +1000,6 @@ function Block(props) {
|
|
|
994
1000
|
get context() {
|
|
995
1001
|
return props.context;
|
|
996
1002
|
},
|
|
997
|
-
hasChildren: true,
|
|
998
1003
|
get children() {
|
|
999
1004
|
return [createComponent(component_ref_default, {
|
|
1000
1005
|
get componentRef() {
|
|
@@ -1044,7 +1049,7 @@ function Block(props) {
|
|
|
1044
1049
|
}
|
|
1045
1050
|
});
|
|
1046
1051
|
}
|
|
1047
|
-
})
|
|
1052
|
+
});
|
|
1048
1053
|
}
|
|
1049
1054
|
})];
|
|
1050
1055
|
}
|
|
@@ -3033,6 +3038,13 @@ async function fetchEntries(options) {
|
|
|
3033
3038
|
}
|
|
3034
3039
|
var getAllContent = fetchEntries;
|
|
3035
3040
|
|
|
3041
|
+
// src/functions/is-from-trusted-host.ts
|
|
3042
|
+
var DEFAULT_TRUSTED_HOSTS = ["*.beta.builder.io", "beta.builder.io", "builder.io", "localhost", "qa.builder.io"];
|
|
3043
|
+
function isFromTrustedHost(trustedHosts, e) {
|
|
3044
|
+
const url = new URL(e.origin), hostname = url.hostname;
|
|
3045
|
+
return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
|
|
3046
|
+
}
|
|
3047
|
+
|
|
3036
3048
|
// src/functions/is-previewing.ts
|
|
3037
3049
|
function isPreviewing() {
|
|
3038
3050
|
if (!isBrowser()) {
|
|
@@ -3281,7 +3293,7 @@ var getInteractionPropertiesForEvent = (event) => {
|
|
|
3281
3293
|
};
|
|
3282
3294
|
|
|
3283
3295
|
// src/constants/sdk-version.ts
|
|
3284
|
-
var SDK_VERSION = "0.12.
|
|
3296
|
+
var SDK_VERSION = "0.12.2";
|
|
3285
3297
|
|
|
3286
3298
|
// src/functions/register.ts
|
|
3287
3299
|
var registry = {};
|
|
@@ -3358,9 +3370,13 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
3358
3370
|
options
|
|
3359
3371
|
}
|
|
3360
3372
|
}, "*");
|
|
3361
|
-
window.addEventListener("message", ({
|
|
3362
|
-
|
|
3363
|
-
|
|
3373
|
+
window.addEventListener("message", (event) => {
|
|
3374
|
+
if (!isFromTrustedHost(options.trustedHosts, event)) {
|
|
3375
|
+
return;
|
|
3376
|
+
}
|
|
3377
|
+
const {
|
|
3378
|
+
data
|
|
3379
|
+
} = event;
|
|
3364
3380
|
if (!data?.type) {
|
|
3365
3381
|
return;
|
|
3366
3382
|
}
|
|
@@ -3456,6 +3472,9 @@ function EnableEditor(props) {
|
|
|
3456
3472
|
}));
|
|
3457
3473
|
}
|
|
3458
3474
|
function processMessage(event) {
|
|
3475
|
+
if (!isFromTrustedHost(props.trustedHosts, event)) {
|
|
3476
|
+
return;
|
|
3477
|
+
}
|
|
3459
3478
|
const {
|
|
3460
3479
|
data
|
|
3461
3480
|
} = event;
|
|
@@ -3586,6 +3605,9 @@ function EnableEditor(props) {
|
|
|
3586
3605
|
} : {},
|
|
3587
3606
|
...props.enrich ? {
|
|
3588
3607
|
enrich: props.enrich
|
|
3608
|
+
} : {},
|
|
3609
|
+
...props.trustedHosts ? {
|
|
3610
|
+
trustedHosts: props.trustedHosts
|
|
3589
3611
|
} : {}
|
|
3590
3612
|
});
|
|
3591
3613
|
Object.values(props.builderContextSignal.componentInfos).forEach((registeredComponent) => {
|
|
@@ -3953,6 +3975,9 @@ function ContentComponent(props) {
|
|
|
3953
3975
|
},
|
|
3954
3976
|
get contentWrapperProps() {
|
|
3955
3977
|
return props.contentWrapperProps;
|
|
3978
|
+
},
|
|
3979
|
+
get trustedHosts() {
|
|
3980
|
+
return props.trustedHosts;
|
|
3956
3981
|
}
|
|
3957
3982
|
}, {
|
|
3958
3983
|
setBuilderContextSignal
|
|
@@ -4112,6 +4137,9 @@ function ContentVariants(props) {
|
|
|
4112
4137
|
},
|
|
4113
4138
|
get contentWrapperProps() {
|
|
4114
4139
|
return props.contentWrapperProps;
|
|
4140
|
+
},
|
|
4141
|
+
get trustedHosts() {
|
|
4142
|
+
return props.trustedHosts;
|
|
4115
4143
|
}
|
|
4116
4144
|
});
|
|
4117
4145
|
}
|
|
@@ -4166,6 +4194,9 @@ function ContentVariants(props) {
|
|
|
4166
4194
|
},
|
|
4167
4195
|
get contentWrapperProps() {
|
|
4168
4196
|
return props.contentWrapperProps;
|
|
4197
|
+
},
|
|
4198
|
+
get trustedHosts() {
|
|
4199
|
+
return props.trustedHosts;
|
|
4169
4200
|
}
|
|
4170
4201
|
}))];
|
|
4171
4202
|
}
|
package/lib/browser/index.jsx
CHANGED
|
@@ -323,10 +323,6 @@ function getProcessedBlock({
|
|
|
323
323
|
}
|
|
324
324
|
|
|
325
325
|
// src/components/block/block.helpers.ts
|
|
326
|
-
var EMPTY_HTML_ELEMENTS = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"];
|
|
327
|
-
var isEmptyHtmlElement = (tagName) => {
|
|
328
|
-
return typeof tagName === "string" && EMPTY_HTML_ELEMENTS.includes(tagName.toLowerCase());
|
|
329
|
-
};
|
|
330
326
|
var getComponent = ({
|
|
331
327
|
block,
|
|
332
328
|
context,
|
|
@@ -548,10 +544,6 @@ function BlockStyles(props) {
|
|
|
548
544
|
}
|
|
549
545
|
var Block_styles_default = BlockStyles;
|
|
550
546
|
|
|
551
|
-
// src/components/block/components/block-wrapper.tsx
|
|
552
|
-
import { Show as Show3 } from "solid-js";
|
|
553
|
-
import { Dynamic } from "solid-js/web";
|
|
554
|
-
|
|
555
547
|
// src/functions/event-handler-name.ts
|
|
556
548
|
function capitalizeFirstLetter(string) {
|
|
557
549
|
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
@@ -638,31 +630,49 @@ function getStyleAttribute(style) {
|
|
|
638
630
|
}
|
|
639
631
|
}
|
|
640
632
|
|
|
641
|
-
// src/components/
|
|
642
|
-
|
|
633
|
+
// src/components/dynamic-renderer/dynamic-renderer.tsx
|
|
634
|
+
import { Show as Show3 } from "solid-js";
|
|
635
|
+
import { Dynamic } from "solid-js/web";
|
|
636
|
+
|
|
637
|
+
// src/components/dynamic-renderer/dynamic-renderer.helpers.ts
|
|
638
|
+
var EMPTY_HTML_ELEMENTS = /* @__PURE__ */ new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"]);
|
|
639
|
+
var isEmptyElement = (tagName) => {
|
|
640
|
+
return typeof tagName === "string" && EMPTY_HTML_ELEMENTS.has(tagName.toLowerCase());
|
|
641
|
+
};
|
|
642
|
+
|
|
643
|
+
// src/components/dynamic-renderer/dynamic-renderer.tsx
|
|
644
|
+
function DynamicRenderer(props) {
|
|
643
645
|
return <Show3
|
|
644
646
|
fallback={<Dynamic
|
|
645
|
-
{...
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
})}
|
|
649
|
-
{...getBlockActions({
|
|
650
|
-
block: props.block,
|
|
651
|
-
rootState: props.context.rootState,
|
|
652
|
-
rootSetState: props.context.rootSetState,
|
|
653
|
-
localState: props.context.localState,
|
|
654
|
-
context: props.context.context,
|
|
655
|
-
stripPrefix: true
|
|
656
|
-
})}
|
|
657
|
-
component={props.Wrapper}
|
|
647
|
+
{...props.attributes}
|
|
648
|
+
{...props.actionAttributes}
|
|
649
|
+
component={props.TagName}
|
|
658
650
|
/>}
|
|
659
|
-
when={props.
|
|
651
|
+
when={!isEmptyElement(props.TagName)}
|
|
652
|
+
><Show3
|
|
653
|
+
fallback={<Dynamic
|
|
654
|
+
{...props.attributes}
|
|
655
|
+
{...props.actionAttributes}
|
|
656
|
+
component={props.TagName}
|
|
657
|
+
>{props.children}</Dynamic>}
|
|
658
|
+
when={typeof props.TagName === "string"}
|
|
660
659
|
><Dynamic
|
|
661
|
-
{...
|
|
660
|
+
{...props.attributes}
|
|
661
|
+
{...props.actionAttributes}
|
|
662
|
+
component={props.TagName}
|
|
663
|
+
>{props.children}</Dynamic></Show3></Show3>;
|
|
664
|
+
}
|
|
665
|
+
var Dynamic_renderer_default = DynamicRenderer;
|
|
666
|
+
|
|
667
|
+
// src/components/block/components/block-wrapper.tsx
|
|
668
|
+
function BlockWrapper(props) {
|
|
669
|
+
return <Dynamic_renderer_default
|
|
670
|
+
TagName={props.Wrapper}
|
|
671
|
+
attributes={getBlockProperties({
|
|
662
672
|
block: props.block,
|
|
663
673
|
context: props.context
|
|
664
674
|
})}
|
|
665
|
-
{
|
|
675
|
+
actionAttributes={getBlockActions({
|
|
666
676
|
block: props.block,
|
|
667
677
|
rootState: props.context.rootState,
|
|
668
678
|
rootSetState: props.context.rootSetState,
|
|
@@ -670,8 +680,7 @@ function BlockWrapper(props) {
|
|
|
670
680
|
context: props.context.context,
|
|
671
681
|
stripPrefix: true
|
|
672
682
|
})}
|
|
673
|
-
|
|
674
|
-
>{props.children}</Dynamic></Show3>;
|
|
683
|
+
>{props.children}</Dynamic_renderer_default>;
|
|
675
684
|
}
|
|
676
685
|
var Block_wrapper_default = BlockWrapper;
|
|
677
686
|
|
|
@@ -850,14 +859,8 @@ function Block(props) {
|
|
|
850
859
|
isInteractive={componentRefProps().isInteractive}
|
|
851
860
|
/>}
|
|
852
861
|
when={!blockComponent()?.noWrap}
|
|
853
|
-
|
|
854
|
-
<
|
|
855
|
-
Wrapper={Tag()}
|
|
856
|
-
block={processedBlock()}
|
|
857
|
-
context={props.context}
|
|
858
|
-
hasChildren={false}
|
|
859
|
-
/></Show5>
|
|
860
|
-
<Show5 when={!isEmptyHtmlElement(Tag()) && repeatItem()}><For2 each={repeatItem()}>{(data, _index) => {
|
|
862
|
+
><Show5
|
|
863
|
+
fallback={<For2 each={repeatItem()}>{(data, _index) => {
|
|
861
864
|
const index = _index();
|
|
862
865
|
return <Repeated_block_default
|
|
863
866
|
key={index}
|
|
@@ -865,34 +868,33 @@ function Block(props) {
|
|
|
865
868
|
block={data.block}
|
|
866
869
|
registeredComponents={props.registeredComponents}
|
|
867
870
|
/>;
|
|
868
|
-
}}</For2
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
</Show5>
|
|
871
|
+
}}</For2>}
|
|
872
|
+
when={!repeatItem()}
|
|
873
|
+
><Block_wrapper_default
|
|
874
|
+
Wrapper={Tag()}
|
|
875
|
+
block={processedBlock()}
|
|
876
|
+
context={props.context}
|
|
877
|
+
>
|
|
878
|
+
<Component_ref_default
|
|
879
|
+
componentRef={componentRefProps().componentRef}
|
|
880
|
+
componentOptions={componentRefProps().componentOptions}
|
|
881
|
+
blockChildren={componentRefProps().blockChildren}
|
|
882
|
+
context={componentRefProps().context}
|
|
883
|
+
registeredComponents={componentRefProps().registeredComponents}
|
|
884
|
+
builderBlock={componentRefProps().builderBlock}
|
|
885
|
+
includeBlockProps={componentRefProps().includeBlockProps}
|
|
886
|
+
isInteractive={componentRefProps().isInteractive}
|
|
887
|
+
/>
|
|
888
|
+
<For2 each={childrenWithoutParentComponent()}>{(child, _index) => {
|
|
889
|
+
const index = _index();
|
|
890
|
+
return <Block
|
|
891
|
+
key={child.id}
|
|
892
|
+
block={child}
|
|
893
|
+
context={childrenContext()}
|
|
894
|
+
registeredComponents={props.registeredComponents}
|
|
895
|
+
/>;
|
|
896
|
+
}}</For2>
|
|
897
|
+
</Block_wrapper_default></Show5></Show5>
|
|
896
898
|
</Show5>;
|
|
897
899
|
}
|
|
898
900
|
var Block_default = Block;
|
|
@@ -2713,6 +2715,13 @@ async function fetchEntries(options) {
|
|
|
2713
2715
|
}
|
|
2714
2716
|
var getAllContent = fetchEntries;
|
|
2715
2717
|
|
|
2718
|
+
// src/functions/is-from-trusted-host.ts
|
|
2719
|
+
var DEFAULT_TRUSTED_HOSTS = ["*.beta.builder.io", "beta.builder.io", "builder.io", "localhost", "qa.builder.io"];
|
|
2720
|
+
function isFromTrustedHost(trustedHosts, e) {
|
|
2721
|
+
const url = new URL(e.origin), hostname = url.hostname;
|
|
2722
|
+
return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
|
|
2723
|
+
}
|
|
2724
|
+
|
|
2716
2725
|
// src/functions/is-previewing.ts
|
|
2717
2726
|
function isPreviewing() {
|
|
2718
2727
|
if (!isBrowser()) {
|
|
@@ -2961,7 +2970,7 @@ var getInteractionPropertiesForEvent = (event) => {
|
|
|
2961
2970
|
};
|
|
2962
2971
|
|
|
2963
2972
|
// src/constants/sdk-version.ts
|
|
2964
|
-
var SDK_VERSION = "0.12.
|
|
2973
|
+
var SDK_VERSION = "0.12.2";
|
|
2965
2974
|
|
|
2966
2975
|
// src/functions/register.ts
|
|
2967
2976
|
var registry = {};
|
|
@@ -3038,9 +3047,13 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
3038
3047
|
options
|
|
3039
3048
|
}
|
|
3040
3049
|
}, "*");
|
|
3041
|
-
window.addEventListener("message", ({
|
|
3042
|
-
|
|
3043
|
-
|
|
3050
|
+
window.addEventListener("message", (event) => {
|
|
3051
|
+
if (!isFromTrustedHost(options.trustedHosts, event)) {
|
|
3052
|
+
return;
|
|
3053
|
+
}
|
|
3054
|
+
const {
|
|
3055
|
+
data
|
|
3056
|
+
} = event;
|
|
3044
3057
|
if (!data?.type) {
|
|
3045
3058
|
return;
|
|
3046
3059
|
}
|
|
@@ -3138,6 +3151,9 @@ function EnableEditor(props) {
|
|
|
3138
3151
|
}));
|
|
3139
3152
|
}
|
|
3140
3153
|
function processMessage(event) {
|
|
3154
|
+
if (!isFromTrustedHost(props.trustedHosts, event)) {
|
|
3155
|
+
return;
|
|
3156
|
+
}
|
|
3141
3157
|
const { data } = event;
|
|
3142
3158
|
if (data) {
|
|
3143
3159
|
switch (data.type) {
|
|
@@ -3268,6 +3284,9 @@ function EnableEditor(props) {
|
|
|
3268
3284
|
} : {},
|
|
3269
3285
|
...props.enrich ? {
|
|
3270
3286
|
enrich: props.enrich
|
|
3287
|
+
} : {},
|
|
3288
|
+
...props.trustedHosts ? {
|
|
3289
|
+
trustedHosts: props.trustedHosts
|
|
3271
3290
|
} : {}
|
|
3272
3291
|
});
|
|
3273
3292
|
Object.values(
|
|
@@ -3606,6 +3625,7 @@ function ContentComponent(props) {
|
|
|
3606
3625
|
builderContextSignal={builderContextSignal()}
|
|
3607
3626
|
contentWrapper={props.contentWrapper}
|
|
3608
3627
|
contentWrapperProps={props.contentWrapperProps}
|
|
3628
|
+
trustedHosts={props.trustedHosts}
|
|
3609
3629
|
{...{
|
|
3610
3630
|
setBuilderContextSignal
|
|
3611
3631
|
}}
|
|
@@ -3688,6 +3708,7 @@ function ContentVariants(props) {
|
|
|
3688
3708
|
blocksWrapperProps={props.blocksWrapperProps}
|
|
3689
3709
|
contentWrapper={props.contentWrapper}
|
|
3690
3710
|
contentWrapperProps={props.contentWrapperProps}
|
|
3711
|
+
trustedHosts={props.trustedHosts}
|
|
3691
3712
|
/>;
|
|
3692
3713
|
}}</For5>
|
|
3693
3714
|
</Show12>
|
|
@@ -3710,6 +3731,7 @@ function ContentVariants(props) {
|
|
|
3710
3731
|
blocksWrapperProps={props.blocksWrapperProps}
|
|
3711
3732
|
contentWrapper={props.contentWrapper}
|
|
3712
3733
|
contentWrapperProps={props.contentWrapperProps}
|
|
3734
|
+
trustedHosts={props.trustedHosts}
|
|
3713
3735
|
/>
|
|
3714
3736
|
</>;
|
|
3715
3737
|
}
|