@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/node/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
|
import { createRequire } from 'node:module';
|
|
@@ -454,10 +454,6 @@ function getProcessedBlock({
|
|
|
454
454
|
}
|
|
455
455
|
|
|
456
456
|
// src/components/block/block.helpers.ts
|
|
457
|
-
var EMPTY_HTML_ELEMENTS = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"];
|
|
458
|
-
var isEmptyHtmlElement = (tagName) => {
|
|
459
|
-
return typeof tagName === "string" && EMPTY_HTML_ELEMENTS.includes(tagName.toLowerCase());
|
|
460
|
-
};
|
|
461
457
|
var getComponent = ({
|
|
462
458
|
block,
|
|
463
459
|
context,
|
|
@@ -776,48 +772,80 @@ function getStyleAttribute(style) {
|
|
|
776
772
|
}
|
|
777
773
|
}
|
|
778
774
|
|
|
779
|
-
// src/components/
|
|
780
|
-
|
|
775
|
+
// src/components/dynamic-renderer/dynamic-renderer.helpers.ts
|
|
776
|
+
var EMPTY_HTML_ELEMENTS = /* @__PURE__ */ new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"]);
|
|
777
|
+
var isEmptyElement = (tagName) => {
|
|
778
|
+
return typeof tagName === "string" && EMPTY_HTML_ELEMENTS.has(tagName.toLowerCase());
|
|
779
|
+
};
|
|
780
|
+
|
|
781
|
+
// src/components/dynamic-renderer/dynamic-renderer.tsx
|
|
782
|
+
function DynamicRenderer(props) {
|
|
781
783
|
return createComponent(Show, {
|
|
782
784
|
get fallback() {
|
|
783
|
-
return createComponent(Dynamic, mergeProps(() =>
|
|
784
|
-
block: props.block,
|
|
785
|
-
context: props.context
|
|
786
|
-
}), () => getBlockActions({
|
|
787
|
-
block: props.block,
|
|
788
|
-
rootState: props.context.rootState,
|
|
789
|
-
rootSetState: props.context.rootSetState,
|
|
790
|
-
localState: props.context.localState,
|
|
791
|
-
context: props.context.context,
|
|
792
|
-
stripPrefix: true
|
|
793
|
-
}), {
|
|
785
|
+
return createComponent(Dynamic, mergeProps(() => props.attributes, () => props.actionAttributes, {
|
|
794
786
|
get component() {
|
|
795
|
-
return props.
|
|
787
|
+
return props.TagName;
|
|
796
788
|
}
|
|
797
789
|
}));
|
|
798
790
|
},
|
|
799
791
|
get when() {
|
|
800
|
-
return props.
|
|
792
|
+
return !isEmptyElement(props.TagName);
|
|
801
793
|
},
|
|
802
794
|
get children() {
|
|
803
|
-
return createComponent(
|
|
795
|
+
return createComponent(Show, {
|
|
796
|
+
get fallback() {
|
|
797
|
+
return createComponent(Dynamic, mergeProps(() => props.attributes, () => props.actionAttributes, {
|
|
798
|
+
get component() {
|
|
799
|
+
return props.TagName;
|
|
800
|
+
},
|
|
801
|
+
get children() {
|
|
802
|
+
return props.children;
|
|
803
|
+
}
|
|
804
|
+
}));
|
|
805
|
+
},
|
|
806
|
+
get when() {
|
|
807
|
+
return typeof props.TagName === "string";
|
|
808
|
+
},
|
|
809
|
+
get children() {
|
|
810
|
+
return createComponent(Dynamic, mergeProps(() => props.attributes, () => props.actionAttributes, {
|
|
811
|
+
get component() {
|
|
812
|
+
return props.TagName;
|
|
813
|
+
},
|
|
814
|
+
get children() {
|
|
815
|
+
return props.children;
|
|
816
|
+
}
|
|
817
|
+
}));
|
|
818
|
+
}
|
|
819
|
+
});
|
|
820
|
+
}
|
|
821
|
+
});
|
|
822
|
+
}
|
|
823
|
+
var dynamic_renderer_default = DynamicRenderer;
|
|
824
|
+
|
|
825
|
+
// src/components/block/components/block-wrapper.tsx
|
|
826
|
+
function BlockWrapper(props) {
|
|
827
|
+
return createComponent(dynamic_renderer_default, {
|
|
828
|
+
get TagName() {
|
|
829
|
+
return props.Wrapper;
|
|
830
|
+
},
|
|
831
|
+
get attributes() {
|
|
832
|
+
return getBlockProperties({
|
|
804
833
|
block: props.block,
|
|
805
834
|
context: props.context
|
|
806
|
-
})
|
|
835
|
+
});
|
|
836
|
+
},
|
|
837
|
+
get actionAttributes() {
|
|
838
|
+
return getBlockActions({
|
|
807
839
|
block: props.block,
|
|
808
840
|
rootState: props.context.rootState,
|
|
809
841
|
rootSetState: props.context.rootSetState,
|
|
810
842
|
localState: props.context.localState,
|
|
811
843
|
context: props.context.context,
|
|
812
844
|
stripPrefix: true
|
|
813
|
-
})
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
get children() {
|
|
818
|
-
return props.children;
|
|
819
|
-
}
|
|
820
|
-
}));
|
|
845
|
+
});
|
|
846
|
+
},
|
|
847
|
+
get children() {
|
|
848
|
+
return props.children;
|
|
821
849
|
}
|
|
822
850
|
});
|
|
823
851
|
}
|
|
@@ -1058,29 +1086,8 @@ function Block(props) {
|
|
|
1058
1086
|
return !blockComponent()?.noWrap;
|
|
1059
1087
|
},
|
|
1060
1088
|
get children() {
|
|
1061
|
-
return
|
|
1062
|
-
get
|
|
1063
|
-
return isEmptyHtmlElement(Tag());
|
|
1064
|
-
},
|
|
1065
|
-
get children() {
|
|
1066
|
-
return createComponent(block_wrapper_default, {
|
|
1067
|
-
get Wrapper() {
|
|
1068
|
-
return Tag();
|
|
1069
|
-
},
|
|
1070
|
-
get block() {
|
|
1071
|
-
return processedBlock();
|
|
1072
|
-
},
|
|
1073
|
-
get context() {
|
|
1074
|
-
return props.context;
|
|
1075
|
-
},
|
|
1076
|
-
hasChildren: false
|
|
1077
|
-
});
|
|
1078
|
-
}
|
|
1079
|
-
}), createComponent(Show, {
|
|
1080
|
-
get when() {
|
|
1081
|
-
return memo(() => !!!isEmptyHtmlElement(Tag()))() && repeatItem();
|
|
1082
|
-
},
|
|
1083
|
-
get children() {
|
|
1089
|
+
return createComponent(Show, {
|
|
1090
|
+
get fallback() {
|
|
1084
1091
|
return createComponent(For, {
|
|
1085
1092
|
get each() {
|
|
1086
1093
|
return repeatItem();
|
|
@@ -1101,10 +1108,9 @@ function Block(props) {
|
|
|
1101
1108
|
});
|
|
1102
1109
|
}
|
|
1103
1110
|
});
|
|
1104
|
-
}
|
|
1105
|
-
}), createComponent(Show, {
|
|
1111
|
+
},
|
|
1106
1112
|
get when() {
|
|
1107
|
-
return
|
|
1113
|
+
return !repeatItem();
|
|
1108
1114
|
},
|
|
1109
1115
|
get children() {
|
|
1110
1116
|
return createComponent(block_wrapper_default, {
|
|
@@ -1117,7 +1123,6 @@ function Block(props) {
|
|
|
1117
1123
|
get context() {
|
|
1118
1124
|
return props.context;
|
|
1119
1125
|
},
|
|
1120
|
-
hasChildren: true,
|
|
1121
1126
|
get children() {
|
|
1122
1127
|
return [createComponent(component_ref_default, {
|
|
1123
1128
|
get componentRef() {
|
|
@@ -1167,7 +1172,7 @@ function Block(props) {
|
|
|
1167
1172
|
}
|
|
1168
1173
|
});
|
|
1169
1174
|
}
|
|
1170
|
-
})
|
|
1175
|
+
});
|
|
1171
1176
|
}
|
|
1172
1177
|
})];
|
|
1173
1178
|
}
|
|
@@ -3156,6 +3161,13 @@ async function fetchEntries(options) {
|
|
|
3156
3161
|
}
|
|
3157
3162
|
var getAllContent = fetchEntries;
|
|
3158
3163
|
|
|
3164
|
+
// src/functions/is-from-trusted-host.ts
|
|
3165
|
+
var DEFAULT_TRUSTED_HOSTS = ["*.beta.builder.io", "beta.builder.io", "builder.io", "localhost", "qa.builder.io"];
|
|
3166
|
+
function isFromTrustedHost(trustedHosts, e) {
|
|
3167
|
+
const url = new URL(e.origin), hostname = url.hostname;
|
|
3168
|
+
return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
|
|
3169
|
+
}
|
|
3170
|
+
|
|
3159
3171
|
// src/functions/is-previewing.ts
|
|
3160
3172
|
function isPreviewing() {
|
|
3161
3173
|
if (!isBrowser()) {
|
|
@@ -3404,7 +3416,7 @@ var getInteractionPropertiesForEvent = (event) => {
|
|
|
3404
3416
|
};
|
|
3405
3417
|
|
|
3406
3418
|
// src/constants/sdk-version.ts
|
|
3407
|
-
var SDK_VERSION = "0.12.
|
|
3419
|
+
var SDK_VERSION = "0.12.2";
|
|
3408
3420
|
|
|
3409
3421
|
// src/functions/register.ts
|
|
3410
3422
|
var registry = {};
|
|
@@ -3481,9 +3493,13 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
3481
3493
|
options
|
|
3482
3494
|
}
|
|
3483
3495
|
}, "*");
|
|
3484
|
-
window.addEventListener("message", ({
|
|
3485
|
-
|
|
3486
|
-
|
|
3496
|
+
window.addEventListener("message", (event) => {
|
|
3497
|
+
if (!isFromTrustedHost(options.trustedHosts, event)) {
|
|
3498
|
+
return;
|
|
3499
|
+
}
|
|
3500
|
+
const {
|
|
3501
|
+
data
|
|
3502
|
+
} = event;
|
|
3487
3503
|
if (!data?.type) {
|
|
3488
3504
|
return;
|
|
3489
3505
|
}
|
|
@@ -3579,6 +3595,9 @@ function EnableEditor(props) {
|
|
|
3579
3595
|
}));
|
|
3580
3596
|
}
|
|
3581
3597
|
function processMessage(event) {
|
|
3598
|
+
if (!isFromTrustedHost(props.trustedHosts, event)) {
|
|
3599
|
+
return;
|
|
3600
|
+
}
|
|
3582
3601
|
const {
|
|
3583
3602
|
data
|
|
3584
3603
|
} = event;
|
|
@@ -3709,6 +3728,9 @@ function EnableEditor(props) {
|
|
|
3709
3728
|
} : {},
|
|
3710
3729
|
...props.enrich ? {
|
|
3711
3730
|
enrich: props.enrich
|
|
3731
|
+
} : {},
|
|
3732
|
+
...props.trustedHosts ? {
|
|
3733
|
+
trustedHosts: props.trustedHosts
|
|
3712
3734
|
} : {}
|
|
3713
3735
|
});
|
|
3714
3736
|
Object.values(props.builderContextSignal.componentInfos).forEach((registeredComponent) => {
|
|
@@ -4076,6 +4098,9 @@ function ContentComponent(props) {
|
|
|
4076
4098
|
},
|
|
4077
4099
|
get contentWrapperProps() {
|
|
4078
4100
|
return props.contentWrapperProps;
|
|
4101
|
+
},
|
|
4102
|
+
get trustedHosts() {
|
|
4103
|
+
return props.trustedHosts;
|
|
4079
4104
|
}
|
|
4080
4105
|
}, {
|
|
4081
4106
|
setBuilderContextSignal
|
|
@@ -4235,6 +4260,9 @@ function ContentVariants(props) {
|
|
|
4235
4260
|
},
|
|
4236
4261
|
get contentWrapperProps() {
|
|
4237
4262
|
return props.contentWrapperProps;
|
|
4263
|
+
},
|
|
4264
|
+
get trustedHosts() {
|
|
4265
|
+
return props.trustedHosts;
|
|
4238
4266
|
}
|
|
4239
4267
|
});
|
|
4240
4268
|
}
|
|
@@ -4289,6 +4317,9 @@ function ContentVariants(props) {
|
|
|
4289
4317
|
},
|
|
4290
4318
|
get contentWrapperProps() {
|
|
4291
4319
|
return props.contentWrapperProps;
|
|
4320
|
+
},
|
|
4321
|
+
get trustedHosts() {
|
|
4322
|
+
return props.trustedHosts;
|
|
4292
4323
|
}
|
|
4293
4324
|
}))];
|
|
4294
4325
|
}
|
package/lib/node/index.jsx
CHANGED
|
@@ -448,10 +448,6 @@ function getProcessedBlock({
|
|
|
448
448
|
}
|
|
449
449
|
|
|
450
450
|
// src/components/block/block.helpers.ts
|
|
451
|
-
var EMPTY_HTML_ELEMENTS = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"];
|
|
452
|
-
var isEmptyHtmlElement = (tagName) => {
|
|
453
|
-
return typeof tagName === "string" && EMPTY_HTML_ELEMENTS.includes(tagName.toLowerCase());
|
|
454
|
-
};
|
|
455
451
|
var getComponent = ({
|
|
456
452
|
block,
|
|
457
453
|
context,
|
|
@@ -673,10 +669,6 @@ function BlockStyles(props) {
|
|
|
673
669
|
}
|
|
674
670
|
var Block_styles_default = BlockStyles;
|
|
675
671
|
|
|
676
|
-
// src/components/block/components/block-wrapper.tsx
|
|
677
|
-
import { Show as Show3 } from "solid-js";
|
|
678
|
-
import { Dynamic } from "solid-js/web";
|
|
679
|
-
|
|
680
672
|
// src/functions/event-handler-name.ts
|
|
681
673
|
function capitalizeFirstLetter(string) {
|
|
682
674
|
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
@@ -763,31 +755,49 @@ function getStyleAttribute(style) {
|
|
|
763
755
|
}
|
|
764
756
|
}
|
|
765
757
|
|
|
766
|
-
// src/components/
|
|
767
|
-
|
|
758
|
+
// src/components/dynamic-renderer/dynamic-renderer.tsx
|
|
759
|
+
import { Show as Show3 } from "solid-js";
|
|
760
|
+
import { Dynamic } from "solid-js/web";
|
|
761
|
+
|
|
762
|
+
// src/components/dynamic-renderer/dynamic-renderer.helpers.ts
|
|
763
|
+
var EMPTY_HTML_ELEMENTS = /* @__PURE__ */ new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"]);
|
|
764
|
+
var isEmptyElement = (tagName) => {
|
|
765
|
+
return typeof tagName === "string" && EMPTY_HTML_ELEMENTS.has(tagName.toLowerCase());
|
|
766
|
+
};
|
|
767
|
+
|
|
768
|
+
// src/components/dynamic-renderer/dynamic-renderer.tsx
|
|
769
|
+
function DynamicRenderer(props) {
|
|
768
770
|
return <Show3
|
|
769
771
|
fallback={<Dynamic
|
|
770
|
-
{...
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
})}
|
|
774
|
-
{...getBlockActions({
|
|
775
|
-
block: props.block,
|
|
776
|
-
rootState: props.context.rootState,
|
|
777
|
-
rootSetState: props.context.rootSetState,
|
|
778
|
-
localState: props.context.localState,
|
|
779
|
-
context: props.context.context,
|
|
780
|
-
stripPrefix: true
|
|
781
|
-
})}
|
|
782
|
-
component={props.Wrapper}
|
|
772
|
+
{...props.attributes}
|
|
773
|
+
{...props.actionAttributes}
|
|
774
|
+
component={props.TagName}
|
|
783
775
|
/>}
|
|
784
|
-
when={props.
|
|
776
|
+
when={!isEmptyElement(props.TagName)}
|
|
777
|
+
><Show3
|
|
778
|
+
fallback={<Dynamic
|
|
779
|
+
{...props.attributes}
|
|
780
|
+
{...props.actionAttributes}
|
|
781
|
+
component={props.TagName}
|
|
782
|
+
>{props.children}</Dynamic>}
|
|
783
|
+
when={typeof props.TagName === "string"}
|
|
785
784
|
><Dynamic
|
|
786
|
-
{...
|
|
785
|
+
{...props.attributes}
|
|
786
|
+
{...props.actionAttributes}
|
|
787
|
+
component={props.TagName}
|
|
788
|
+
>{props.children}</Dynamic></Show3></Show3>;
|
|
789
|
+
}
|
|
790
|
+
var Dynamic_renderer_default = DynamicRenderer;
|
|
791
|
+
|
|
792
|
+
// src/components/block/components/block-wrapper.tsx
|
|
793
|
+
function BlockWrapper(props) {
|
|
794
|
+
return <Dynamic_renderer_default
|
|
795
|
+
TagName={props.Wrapper}
|
|
796
|
+
attributes={getBlockProperties({
|
|
787
797
|
block: props.block,
|
|
788
798
|
context: props.context
|
|
789
799
|
})}
|
|
790
|
-
{
|
|
800
|
+
actionAttributes={getBlockActions({
|
|
791
801
|
block: props.block,
|
|
792
802
|
rootState: props.context.rootState,
|
|
793
803
|
rootSetState: props.context.rootSetState,
|
|
@@ -795,8 +805,7 @@ function BlockWrapper(props) {
|
|
|
795
805
|
context: props.context.context,
|
|
796
806
|
stripPrefix: true
|
|
797
807
|
})}
|
|
798
|
-
|
|
799
|
-
>{props.children}</Dynamic></Show3>;
|
|
808
|
+
>{props.children}</Dynamic_renderer_default>;
|
|
800
809
|
}
|
|
801
810
|
var Block_wrapper_default = BlockWrapper;
|
|
802
811
|
|
|
@@ -975,14 +984,8 @@ function Block(props) {
|
|
|
975
984
|
isInteractive={componentRefProps().isInteractive}
|
|
976
985
|
/>}
|
|
977
986
|
when={!blockComponent()?.noWrap}
|
|
978
|
-
|
|
979
|
-
<
|
|
980
|
-
Wrapper={Tag()}
|
|
981
|
-
block={processedBlock()}
|
|
982
|
-
context={props.context}
|
|
983
|
-
hasChildren={false}
|
|
984
|
-
/></Show5>
|
|
985
|
-
<Show5 when={!isEmptyHtmlElement(Tag()) && repeatItem()}><For2 each={repeatItem()}>{(data, _index) => {
|
|
987
|
+
><Show5
|
|
988
|
+
fallback={<For2 each={repeatItem()}>{(data, _index) => {
|
|
986
989
|
const index = _index();
|
|
987
990
|
return <Repeated_block_default
|
|
988
991
|
key={index}
|
|
@@ -990,34 +993,33 @@ function Block(props) {
|
|
|
990
993
|
block={data.block}
|
|
991
994
|
registeredComponents={props.registeredComponents}
|
|
992
995
|
/>;
|
|
993
|
-
}}</For2
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
</Show5>
|
|
996
|
+
}}</For2>}
|
|
997
|
+
when={!repeatItem()}
|
|
998
|
+
><Block_wrapper_default
|
|
999
|
+
Wrapper={Tag()}
|
|
1000
|
+
block={processedBlock()}
|
|
1001
|
+
context={props.context}
|
|
1002
|
+
>
|
|
1003
|
+
<Component_ref_default
|
|
1004
|
+
componentRef={componentRefProps().componentRef}
|
|
1005
|
+
componentOptions={componentRefProps().componentOptions}
|
|
1006
|
+
blockChildren={componentRefProps().blockChildren}
|
|
1007
|
+
context={componentRefProps().context}
|
|
1008
|
+
registeredComponents={componentRefProps().registeredComponents}
|
|
1009
|
+
builderBlock={componentRefProps().builderBlock}
|
|
1010
|
+
includeBlockProps={componentRefProps().includeBlockProps}
|
|
1011
|
+
isInteractive={componentRefProps().isInteractive}
|
|
1012
|
+
/>
|
|
1013
|
+
<For2 each={childrenWithoutParentComponent()}>{(child, _index) => {
|
|
1014
|
+
const index = _index();
|
|
1015
|
+
return <Block
|
|
1016
|
+
key={child.id}
|
|
1017
|
+
block={child}
|
|
1018
|
+
context={childrenContext()}
|
|
1019
|
+
registeredComponents={props.registeredComponents}
|
|
1020
|
+
/>;
|
|
1021
|
+
}}</For2>
|
|
1022
|
+
</Block_wrapper_default></Show5></Show5>
|
|
1021
1023
|
</Show5>;
|
|
1022
1024
|
}
|
|
1023
1025
|
var Block_default = Block;
|
|
@@ -2838,6 +2840,13 @@ async function fetchEntries(options) {
|
|
|
2838
2840
|
}
|
|
2839
2841
|
var getAllContent = fetchEntries;
|
|
2840
2842
|
|
|
2843
|
+
// src/functions/is-from-trusted-host.ts
|
|
2844
|
+
var DEFAULT_TRUSTED_HOSTS = ["*.beta.builder.io", "beta.builder.io", "builder.io", "localhost", "qa.builder.io"];
|
|
2845
|
+
function isFromTrustedHost(trustedHosts, e) {
|
|
2846
|
+
const url = new URL(e.origin), hostname = url.hostname;
|
|
2847
|
+
return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
|
|
2848
|
+
}
|
|
2849
|
+
|
|
2841
2850
|
// src/functions/is-previewing.ts
|
|
2842
2851
|
function isPreviewing() {
|
|
2843
2852
|
if (!isBrowser()) {
|
|
@@ -3086,7 +3095,7 @@ var getInteractionPropertiesForEvent = (event) => {
|
|
|
3086
3095
|
};
|
|
3087
3096
|
|
|
3088
3097
|
// src/constants/sdk-version.ts
|
|
3089
|
-
var SDK_VERSION = "0.12.
|
|
3098
|
+
var SDK_VERSION = "0.12.2";
|
|
3090
3099
|
|
|
3091
3100
|
// src/functions/register.ts
|
|
3092
3101
|
var registry = {};
|
|
@@ -3163,9 +3172,13 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
3163
3172
|
options
|
|
3164
3173
|
}
|
|
3165
3174
|
}, "*");
|
|
3166
|
-
window.addEventListener("message", ({
|
|
3167
|
-
|
|
3168
|
-
|
|
3175
|
+
window.addEventListener("message", (event) => {
|
|
3176
|
+
if (!isFromTrustedHost(options.trustedHosts, event)) {
|
|
3177
|
+
return;
|
|
3178
|
+
}
|
|
3179
|
+
const {
|
|
3180
|
+
data
|
|
3181
|
+
} = event;
|
|
3169
3182
|
if (!data?.type) {
|
|
3170
3183
|
return;
|
|
3171
3184
|
}
|
|
@@ -3263,6 +3276,9 @@ function EnableEditor(props) {
|
|
|
3263
3276
|
}));
|
|
3264
3277
|
}
|
|
3265
3278
|
function processMessage(event) {
|
|
3279
|
+
if (!isFromTrustedHost(props.trustedHosts, event)) {
|
|
3280
|
+
return;
|
|
3281
|
+
}
|
|
3266
3282
|
const { data } = event;
|
|
3267
3283
|
if (data) {
|
|
3268
3284
|
switch (data.type) {
|
|
@@ -3393,6 +3409,9 @@ function EnableEditor(props) {
|
|
|
3393
3409
|
} : {},
|
|
3394
3410
|
...props.enrich ? {
|
|
3395
3411
|
enrich: props.enrich
|
|
3412
|
+
} : {},
|
|
3413
|
+
...props.trustedHosts ? {
|
|
3414
|
+
trustedHosts: props.trustedHosts
|
|
3396
3415
|
} : {}
|
|
3397
3416
|
});
|
|
3398
3417
|
Object.values(
|
|
@@ -3731,6 +3750,7 @@ function ContentComponent(props) {
|
|
|
3731
3750
|
builderContextSignal={builderContextSignal()}
|
|
3732
3751
|
contentWrapper={props.contentWrapper}
|
|
3733
3752
|
contentWrapperProps={props.contentWrapperProps}
|
|
3753
|
+
trustedHosts={props.trustedHosts}
|
|
3734
3754
|
{...{
|
|
3735
3755
|
setBuilderContextSignal
|
|
3736
3756
|
}}
|
|
@@ -3813,6 +3833,7 @@ function ContentVariants(props) {
|
|
|
3813
3833
|
blocksWrapperProps={props.blocksWrapperProps}
|
|
3814
3834
|
contentWrapper={props.contentWrapper}
|
|
3815
3835
|
contentWrapperProps={props.contentWrapperProps}
|
|
3836
|
+
trustedHosts={props.trustedHosts}
|
|
3816
3837
|
/>;
|
|
3817
3838
|
}}</For5>
|
|
3818
3839
|
</Show12>
|
|
@@ -3835,6 +3856,7 @@ function ContentVariants(props) {
|
|
|
3835
3856
|
blocksWrapperProps={props.blocksWrapperProps}
|
|
3836
3857
|
contentWrapper={props.contentWrapper}
|
|
3837
3858
|
contentWrapperProps={props.contentWrapperProps}
|
|
3859
|
+
trustedHosts={props.trustedHosts}
|
|
3838
3860
|
/>
|
|
3839
3861
|
</>;
|
|
3840
3862
|
}
|