@builder.io/sdk-solid 0.8.1 → 0.10.0
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 +50 -21
- package/lib/browser/dev.js +122 -153
- package/lib/browser/dev.jsx +44 -97
- package/lib/browser/index.js +122 -146
- package/lib/browser/index.jsx +44 -95
- package/lib/edge/dev.js +122 -153
- package/lib/edge/dev.jsx +44 -97
- package/lib/edge/index.js +122 -146
- package/lib/edge/index.jsx +44 -95
- package/lib/node/dev.js +122 -153
- package/lib/node/dev.jsx +44 -97
- package/lib/node/index.js +122 -146
- package/lib/node/index.jsx +44 -95
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -77,6 +77,29 @@ interface BuilderBlock {
|
|
|
77
77
|
show?: boolean;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
+
type Nullable<T> = T | null | undefined;
|
|
81
|
+
type Dictionary<T> = {
|
|
82
|
+
[key: string]: T;
|
|
83
|
+
};
|
|
84
|
+
type Prettify<T> = {
|
|
85
|
+
[K in keyof T]: T[K];
|
|
86
|
+
} & {};
|
|
87
|
+
|
|
88
|
+
type BlocksWrapperProps = {
|
|
89
|
+
blocks: BuilderBlock[] | undefined;
|
|
90
|
+
parent: string | undefined;
|
|
91
|
+
path: string | undefined;
|
|
92
|
+
styleProp: Record<string, any> | undefined;
|
|
93
|
+
/**
|
|
94
|
+
* The element that wraps each list of blocks. Defaults to a `div` element ('ScrollView' in React Native).
|
|
95
|
+
*/
|
|
96
|
+
BlocksWrapper: any;
|
|
97
|
+
/**
|
|
98
|
+
* Additonal props to pass to `blocksWrapper`. Defaults to `{}`.
|
|
99
|
+
*/
|
|
100
|
+
BlocksWrapperProps: any;
|
|
101
|
+
};
|
|
102
|
+
|
|
80
103
|
type ApiVersion = 'v2' | 'v3';
|
|
81
104
|
|
|
82
105
|
interface Input {
|
|
@@ -201,14 +224,6 @@ interface Input {
|
|
|
201
224
|
onChange?: ((options: Map<string, any>) => void | Promise<void>) | string;
|
|
202
225
|
}
|
|
203
226
|
|
|
204
|
-
type Nullable<T> = T | null | undefined;
|
|
205
|
-
type Dictionary<T> = {
|
|
206
|
-
[key: string]: T;
|
|
207
|
-
};
|
|
208
|
-
type Prettify<T> = {
|
|
209
|
-
[K in keyof T]: T[K];
|
|
210
|
-
} & {};
|
|
211
|
-
|
|
212
227
|
interface Breakpoints {
|
|
213
228
|
small: number;
|
|
214
229
|
medium: number;
|
|
@@ -424,7 +439,7 @@ type RegisteredComponent = ComponentInfo & {
|
|
|
424
439
|
type RegisteredComponents = Dictionary<RegisteredComponent>;
|
|
425
440
|
type BuilderRenderState = Record<string, unknown>;
|
|
426
441
|
type BuilderRenderContext = Record<string, unknown>;
|
|
427
|
-
interface BuilderContextInterface {
|
|
442
|
+
interface BuilderContextInterface extends Pick<BlocksWrapperProps, 'BlocksWrapper' | 'BlocksWrapperProps'> {
|
|
428
443
|
content: Nullable<BuilderContent>;
|
|
429
444
|
context: BuilderRenderContext;
|
|
430
445
|
/**
|
|
@@ -564,14 +579,7 @@ interface VideoProps {
|
|
|
564
579
|
|
|
565
580
|
declare function Video(props: VideoProps): solid_js.JSX.Element;
|
|
566
581
|
|
|
567
|
-
type
|
|
568
|
-
blocks: BuilderBlock[] | undefined;
|
|
569
|
-
parent: string | undefined;
|
|
570
|
-
path: string | undefined;
|
|
571
|
-
styleProp: Record<string, any> | undefined;
|
|
572
|
-
};
|
|
573
|
-
|
|
574
|
-
type BlocksProps = Partial<BlocksWrapperProps> & {
|
|
582
|
+
type BlocksProps = Partial<Omit<BlocksWrapperProps, "BlocksWrapper" | "BlocksWrapperProps">> & {
|
|
575
583
|
context?: BuilderContextInterface;
|
|
576
584
|
registeredComponents?: RegisteredComponents;
|
|
577
585
|
};
|
|
@@ -593,6 +601,22 @@ interface ContentVariantsPrps {
|
|
|
593
601
|
/** @deprecated use `enrich` instead **/
|
|
594
602
|
includeRefs?: boolean;
|
|
595
603
|
enrich?: boolean;
|
|
604
|
+
/**
|
|
605
|
+
* The element that wraps your content. Defaults to `div` ('ScrollView' in React Native).
|
|
606
|
+
*/
|
|
607
|
+
contentWrapper?: any;
|
|
608
|
+
/**
|
|
609
|
+
* Additonal props to pass to `contentWrapper`. Defaults to `{}`.
|
|
610
|
+
*/
|
|
611
|
+
contentWrapperProps?: any;
|
|
612
|
+
/**
|
|
613
|
+
* The element that wraps your blocks. Defaults to `div` ('ScrollView' in React Native).
|
|
614
|
+
*/
|
|
615
|
+
blocksWrapper?: any;
|
|
616
|
+
/**
|
|
617
|
+
* Additonal props to pass to `blocksWrapper`. Defaults to `{}`.
|
|
618
|
+
*/
|
|
619
|
+
blocksWrapperProps?: any;
|
|
596
620
|
}
|
|
597
621
|
|
|
598
622
|
type VariantsProviderProps = ContentVariantsPrps & {
|
|
@@ -805,11 +829,11 @@ type ContentResults = {
|
|
|
805
829
|
/**
|
|
806
830
|
* @internal Exported only for testing purposes. Do not use.
|
|
807
831
|
*/
|
|
808
|
-
declare const _processContentResult: (options: GetContentOptions, content: ContentResults, url?: URL) => Promise<
|
|
832
|
+
declare const _processContentResult: (options: GetContentOptions, content: ContentResults, url?: URL) => Promise<BuilderContent[]>;
|
|
809
833
|
/**
|
|
810
834
|
* Returns a paginated array of entries that match the given options.
|
|
811
835
|
*/
|
|
812
|
-
declare function fetchEntries(options: GetContentOptions): Promise<
|
|
836
|
+
declare function fetchEntries(options: GetContentOptions): Promise<BuilderContent[]>;
|
|
813
837
|
/**
|
|
814
838
|
* @deprecated `getAllContent` was renamed to `fetchEntries`. This is a temporary alias to avoid breaking changes.
|
|
815
839
|
*/
|
|
@@ -871,11 +895,16 @@ type EventProperties = Pick<Event, 'type'> & Pick<Event['data'], 'contentId' | '
|
|
|
871
895
|
};
|
|
872
896
|
declare const track: (args: EventProperties) => Promise<void | Response>;
|
|
873
897
|
|
|
898
|
+
/**
|
|
899
|
+
* Lol Typescript
|
|
900
|
+
* https://stackoverflow.com/questions/49927523/disallow-call-with-any/49928360#49928360
|
|
901
|
+
*/
|
|
902
|
+
type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N;
|
|
874
903
|
type OptionalFieldsOnly<T> = {
|
|
875
|
-
[K in keyof T as T[K] extends Required<T>[K] ? never : K]: T[K];
|
|
904
|
+
[K in keyof T as T[K] extends Required<T>[K] ? IfAny<T[K], K, never> : K]: T[K];
|
|
876
905
|
};
|
|
877
906
|
type RequiredFieldsOnly<T> = {
|
|
878
|
-
[K in keyof T as T[K] extends Required<T>[K] ? K : never]: T[K];
|
|
907
|
+
[K in keyof T as T[K] extends Required<T>[K] ? IfAny<T[K], never, K> : never]: T[K];
|
|
879
908
|
};
|
|
880
909
|
type Enforced<T> = {
|
|
881
910
|
[K in keyof T]-?: T[K];
|
package/lib/browser/dev.js
CHANGED
|
@@ -55,7 +55,9 @@ var builder_context_default = createContext({
|
|
|
55
55
|
apiKey: null,
|
|
56
56
|
apiVersion: void 0,
|
|
57
57
|
componentInfos: {},
|
|
58
|
-
inheritedStyles: {}
|
|
58
|
+
inheritedStyles: {},
|
|
59
|
+
BlocksWrapper: "div",
|
|
60
|
+
BlocksWrapperProps: {}
|
|
59
61
|
});
|
|
60
62
|
var components_context_default = createContext({ registeredComponents: {} });
|
|
61
63
|
|
|
@@ -613,85 +615,10 @@ function getBlockActions(options) {
|
|
|
613
615
|
return obj;
|
|
614
616
|
}
|
|
615
617
|
|
|
616
|
-
// src/functions/sanitize-react-native-block-styles.ts
|
|
617
|
-
var propertiesThatMustBeNumber = /* @__PURE__ */ new Set(["lineHeight"]);
|
|
618
|
-
var displayValues = /* @__PURE__ */ new Set(["flex", "none"]);
|
|
619
|
-
var SHOW_WARNINGS = false;
|
|
620
|
-
var normalizeNumber = (value) => {
|
|
621
|
-
if (Number.isNaN(value)) {
|
|
622
|
-
return void 0;
|
|
623
|
-
} else if (value < 0) {
|
|
624
|
-
return 0;
|
|
625
|
-
} else {
|
|
626
|
-
return value;
|
|
627
|
-
}
|
|
628
|
-
};
|
|
629
|
-
var sanitizeReactNativeBlockStyles = (styles) => {
|
|
630
|
-
return Object.keys(styles).reduce((acc, key) => {
|
|
631
|
-
const propertyValue = styles[key];
|
|
632
|
-
if (key === "display" && !displayValues.has(propertyValue)) {
|
|
633
|
-
if (SHOW_WARNINGS) {
|
|
634
|
-
console.warn(`Style value for key "display" must be "flex" or "none" but had ${propertyValue}`);
|
|
635
|
-
}
|
|
636
|
-
return acc;
|
|
637
|
-
}
|
|
638
|
-
if (propertiesThatMustBeNumber.has(key) && typeof propertyValue !== "number") {
|
|
639
|
-
if (SHOW_WARNINGS) {
|
|
640
|
-
console.warn(`Style key ${key} must be a number, but had value \`${styles[key]}\``);
|
|
641
|
-
}
|
|
642
|
-
return acc;
|
|
643
|
-
}
|
|
644
|
-
if (typeof propertyValue === "string") {
|
|
645
|
-
const isPixelUnit = propertyValue.match(/^-?(\d*)(\.?)(\d*)*px$/);
|
|
646
|
-
if (isPixelUnit) {
|
|
647
|
-
const newValue = parseFloat(propertyValue);
|
|
648
|
-
const normalizedValue = normalizeNumber(newValue);
|
|
649
|
-
if (normalizedValue) {
|
|
650
|
-
return {
|
|
651
|
-
...acc,
|
|
652
|
-
[key]: normalizedValue
|
|
653
|
-
};
|
|
654
|
-
} else {
|
|
655
|
-
return acc;
|
|
656
|
-
}
|
|
657
|
-
} else if (propertyValue === "0") {
|
|
658
|
-
return {
|
|
659
|
-
...acc,
|
|
660
|
-
[key]: 0
|
|
661
|
-
};
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
return {
|
|
665
|
-
...acc,
|
|
666
|
-
[key]: propertyValue
|
|
667
|
-
};
|
|
668
|
-
}, {});
|
|
669
|
-
};
|
|
670
|
-
|
|
671
|
-
// src/functions/get-react-native-block-styles.ts
|
|
672
|
-
function getReactNativeBlockStyles({
|
|
673
|
-
block,
|
|
674
|
-
context,
|
|
675
|
-
blockStyles
|
|
676
|
-
}) {
|
|
677
|
-
const responsiveStyles = block.responsiveStyles;
|
|
678
|
-
if (!responsiveStyles) {
|
|
679
|
-
return {};
|
|
680
|
-
}
|
|
681
|
-
const styles = {
|
|
682
|
-
// recursively apply inherited styles so that they can be passed down to children `Text` blocks
|
|
683
|
-
...context.inheritedStyles,
|
|
684
|
-
...responsiveStyles.large || {},
|
|
685
|
-
...responsiveStyles.medium || {},
|
|
686
|
-
...responsiveStyles.small || {},
|
|
687
|
-
...blockStyles
|
|
688
|
-
};
|
|
689
|
-
const newStyles = sanitizeReactNativeBlockStyles(styles);
|
|
690
|
-
return newStyles;
|
|
691
|
-
}
|
|
692
|
-
|
|
693
618
|
// src/functions/transform-block-properties.ts
|
|
694
|
-
function transformBlockProperties(
|
|
619
|
+
function transformBlockProperties({
|
|
620
|
+
properties
|
|
621
|
+
}) {
|
|
695
622
|
return properties;
|
|
696
623
|
}
|
|
697
624
|
|
|
@@ -712,14 +639,11 @@ function getBlockProperties({
|
|
|
712
639
|
style: block.style ? getStyleAttribute(block.style) : void 0,
|
|
713
640
|
class: [block.id, "builder-block", block.class, block.properties?.class].filter(Boolean).join(" ")
|
|
714
641
|
};
|
|
715
|
-
|
|
716
|
-
properties
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
});
|
|
721
|
-
}
|
|
722
|
-
return transformBlockProperties(properties);
|
|
642
|
+
return transformBlockProperties({
|
|
643
|
+
properties,
|
|
644
|
+
context,
|
|
645
|
+
block
|
|
646
|
+
});
|
|
723
647
|
}
|
|
724
648
|
function getStyleAttribute(style) {
|
|
725
649
|
switch (TARGET) {
|
|
@@ -1157,7 +1081,6 @@ function Block(props) {
|
|
|
1157
1081
|
});
|
|
1158
1082
|
}
|
|
1159
1083
|
var block_default = Block;
|
|
1160
|
-
var _tmpl$4 = /* @__PURE__ */ template(`<div>`);
|
|
1161
1084
|
function BlocksWrapper(props) {
|
|
1162
1085
|
function className() {
|
|
1163
1086
|
return "builder-blocks" + (!props.blocks?.length ? " no-blocks" : "");
|
|
@@ -1184,33 +1107,35 @@ function BlocksWrapper(props) {
|
|
|
1184
1107
|
}, "*");
|
|
1185
1108
|
}
|
|
1186
1109
|
}
|
|
1187
|
-
return ((
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1110
|
+
return createComponent(Dynamic, mergeProps({
|
|
1111
|
+
get ["class"]() {
|
|
1112
|
+
return className() + " " + css({
|
|
1113
|
+
display: "flex",
|
|
1114
|
+
flexDirection: "column",
|
|
1115
|
+
alignItems: "stretch"
|
|
1116
|
+
});
|
|
1117
|
+
},
|
|
1118
|
+
get ["builder-path"]() {
|
|
1119
|
+
return props.path;
|
|
1120
|
+
},
|
|
1121
|
+
get ["builder-parent-id"]() {
|
|
1122
|
+
return props.parent;
|
|
1123
|
+
}
|
|
1124
|
+
}, {}, {
|
|
1125
|
+
get style() {
|
|
1126
|
+
return props.styleProp;
|
|
1127
|
+
},
|
|
1128
|
+
onClick: (event) => onClick(),
|
|
1129
|
+
onMouseEnter: (event) => onMouseEnter(),
|
|
1130
|
+
onKeyPress: (event) => onClick()
|
|
1131
|
+
}, () => props.BlocksWrapperProps, {
|
|
1132
|
+
get component() {
|
|
1133
|
+
return props.BlocksWrapper;
|
|
1134
|
+
},
|
|
1135
|
+
get children() {
|
|
1136
|
+
return props.children;
|
|
1137
|
+
}
|
|
1138
|
+
}));
|
|
1214
1139
|
}
|
|
1215
1140
|
var blocks_wrapper_default = BlocksWrapper;
|
|
1216
1141
|
|
|
@@ -1231,6 +1156,12 @@ function Blocks(props) {
|
|
|
1231
1156
|
get styleProp() {
|
|
1232
1157
|
return props.styleProp;
|
|
1233
1158
|
},
|
|
1159
|
+
get BlocksWrapper() {
|
|
1160
|
+
return props.context?.BlocksWrapper;
|
|
1161
|
+
},
|
|
1162
|
+
get BlocksWrapperProps() {
|
|
1163
|
+
return props.context?.BlocksWrapperProps;
|
|
1164
|
+
},
|
|
1234
1165
|
get children() {
|
|
1235
1166
|
return [createComponent(Show, {
|
|
1236
1167
|
get when() {
|
|
@@ -1288,7 +1219,7 @@ function Blocks(props) {
|
|
|
1288
1219
|
var blocks_default = Blocks;
|
|
1289
1220
|
|
|
1290
1221
|
// src/blocks/columns/columns.tsx
|
|
1291
|
-
var _tmpl$
|
|
1222
|
+
var _tmpl$4 = /* @__PURE__ */ template(`<div>`);
|
|
1292
1223
|
function Columns(props) {
|
|
1293
1224
|
const [gutterSize, setGutterSize] = createSignal(typeof props.space === "number" ? props.space || 0 : 20);
|
|
1294
1225
|
const [cols, setCols] = createSignal(props.columns || []);
|
|
@@ -1382,7 +1313,7 @@ function Columns(props) {
|
|
|
1382
1313
|
`;
|
|
1383
1314
|
}
|
|
1384
1315
|
return (() => {
|
|
1385
|
-
const _el$ = _tmpl$
|
|
1316
|
+
const _el$ = _tmpl$4();
|
|
1386
1317
|
spread(_el$, mergeProps({
|
|
1387
1318
|
get ["class"]() {
|
|
1388
1319
|
return `builder-columns ${props.builderBlock.id}-breakpoints ` + css({
|
|
@@ -1411,7 +1342,7 @@ function Columns(props) {
|
|
|
1411
1342
|
children: (column, _index) => {
|
|
1412
1343
|
const index = _index();
|
|
1413
1344
|
return (() => {
|
|
1414
|
-
const _el$2 = _tmpl$
|
|
1345
|
+
const _el$2 = _tmpl$4();
|
|
1415
1346
|
spread(_el$2, mergeProps({
|
|
1416
1347
|
get ["class"]() {
|
|
1417
1348
|
return "builder-column " + css({
|
|
@@ -1452,10 +1383,10 @@ function Columns(props) {
|
|
|
1452
1383
|
})();
|
|
1453
1384
|
}
|
|
1454
1385
|
var columns_default = Columns;
|
|
1455
|
-
var _tmpl$
|
|
1386
|
+
var _tmpl$5 = /* @__PURE__ */ template(`<span>`);
|
|
1456
1387
|
function FragmentComponent(props) {
|
|
1457
1388
|
return (() => {
|
|
1458
|
-
const _el$ = _tmpl$
|
|
1389
|
+
const _el$ = _tmpl$5();
|
|
1459
1390
|
insert(_el$, () => props.children);
|
|
1460
1391
|
return _el$;
|
|
1461
1392
|
})();
|
|
@@ -1510,7 +1441,7 @@ function getSrcSet(url) {
|
|
|
1510
1441
|
}
|
|
1511
1442
|
|
|
1512
1443
|
// src/blocks/image/image.tsx
|
|
1513
|
-
var _tmpl$
|
|
1444
|
+
var _tmpl$6 = /* @__PURE__ */ template(`<source type=image/webp>`);
|
|
1514
1445
|
var _tmpl$22 = /* @__PURE__ */ template(`<picture><img loading=lazy>`);
|
|
1515
1446
|
var _tmpl$32 = /* @__PURE__ */ template(`<div>`);
|
|
1516
1447
|
function Image(props) {
|
|
@@ -1557,7 +1488,7 @@ function Image(props) {
|
|
|
1557
1488
|
return webpSrcSet();
|
|
1558
1489
|
},
|
|
1559
1490
|
get children() {
|
|
1560
|
-
const _el$2 = _tmpl$
|
|
1491
|
+
const _el$2 = _tmpl$6();
|
|
1561
1492
|
effect(() => setAttribute(_el$2, "srcset", webpSrcSet()));
|
|
1562
1493
|
return _el$2;
|
|
1563
1494
|
}
|
|
@@ -1639,10 +1570,10 @@ function Image(props) {
|
|
|
1639
1570
|
})];
|
|
1640
1571
|
}
|
|
1641
1572
|
var image_default = Image;
|
|
1642
|
-
var _tmpl$
|
|
1573
|
+
var _tmpl$7 = /* @__PURE__ */ template(`<section>`);
|
|
1643
1574
|
function SectionComponent(props) {
|
|
1644
1575
|
return (() => {
|
|
1645
|
-
const _el$ = _tmpl$
|
|
1576
|
+
const _el$ = _tmpl$7();
|
|
1646
1577
|
spread(_el$, mergeProps({}, () => props.attributes, {
|
|
1647
1578
|
get style() {
|
|
1648
1579
|
return {
|
|
@@ -2136,7 +2067,7 @@ var componentInfo3 = {
|
|
|
2136
2067
|
advanced: true
|
|
2137
2068
|
}]
|
|
2138
2069
|
};
|
|
2139
|
-
var _tmpl$
|
|
2070
|
+
var _tmpl$8 = /* @__PURE__ */ template(`<div>`);
|
|
2140
2071
|
function CustomCode(props) {
|
|
2141
2072
|
const [scriptsInserted, setScriptsInserted] = createSignal([]);
|
|
2142
2073
|
const [scriptsRun, setScriptsRun] = createSignal([]);
|
|
@@ -2171,7 +2102,7 @@ function CustomCode(props) {
|
|
|
2171
2102
|
}
|
|
2172
2103
|
});
|
|
2173
2104
|
return (() => {
|
|
2174
|
-
const _el$ = _tmpl$
|
|
2105
|
+
const _el$ = _tmpl$8();
|
|
2175
2106
|
const _ref$ = elementRef;
|
|
2176
2107
|
typeof _ref$ === "function" ? use(_ref$, _el$) : elementRef = _el$;
|
|
2177
2108
|
effect((_p$) => {
|
|
@@ -2231,7 +2162,7 @@ var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "applicati
|
|
|
2231
2162
|
var isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
|
|
2232
2163
|
|
|
2233
2164
|
// src/blocks/embed/embed.tsx
|
|
2234
|
-
var _tmpl$
|
|
2165
|
+
var _tmpl$9 = /* @__PURE__ */ template(`<div class=builder-embed>`);
|
|
2235
2166
|
function Embed(props) {
|
|
2236
2167
|
const [scriptsInserted, setScriptsInserted] = createSignal([]);
|
|
2237
2168
|
const [scriptsRun, setScriptsRun] = createSignal([]);
|
|
@@ -2267,7 +2198,7 @@ function Embed(props) {
|
|
|
2267
2198
|
}
|
|
2268
2199
|
createEffect(on(() => [elem, ranInitFn()], onUpdateFn_0));
|
|
2269
2200
|
return (() => {
|
|
2270
|
-
const _el$ = _tmpl$
|
|
2201
|
+
const _el$ = _tmpl$9();
|
|
2271
2202
|
const _ref$ = elem;
|
|
2272
2203
|
typeof _ref$ === "function" ? use(_ref$, _el$) : elem = _el$;
|
|
2273
2204
|
effect(() => _el$.innerHTML = props.content);
|
|
@@ -2424,10 +2355,10 @@ var componentInfo7 = {
|
|
|
2424
2355
|
noWrap: true,
|
|
2425
2356
|
static: true
|
|
2426
2357
|
};
|
|
2427
|
-
var _tmpl$
|
|
2358
|
+
var _tmpl$10 = /* @__PURE__ */ template(`<img>`);
|
|
2428
2359
|
function ImgComponent(props) {
|
|
2429
2360
|
return (() => {
|
|
2430
|
-
const _el$ = _tmpl$
|
|
2361
|
+
const _el$ = _tmpl$10();
|
|
2431
2362
|
spread(_el$, mergeProps({
|
|
2432
2363
|
get style() {
|
|
2433
2364
|
return {
|
|
@@ -2548,10 +2479,10 @@ var componentInfo10 = {
|
|
|
2548
2479
|
textAlign: "center"
|
|
2549
2480
|
}
|
|
2550
2481
|
};
|
|
2551
|
-
var _tmpl$
|
|
2482
|
+
var _tmpl$11 = /* @__PURE__ */ template(`<div class=builder-text>`);
|
|
2552
2483
|
function Text(props) {
|
|
2553
2484
|
return (() => {
|
|
2554
|
-
const _el$ = _tmpl$
|
|
2485
|
+
const _el$ = _tmpl$11();
|
|
2555
2486
|
_el$.style.setProperty("outline", "none");
|
|
2556
2487
|
effect(() => _el$.innerHTML = props.text?.toString() || "");
|
|
2557
2488
|
return _el$;
|
|
@@ -2642,7 +2573,7 @@ var componentInfo11 = {
|
|
|
2642
2573
|
advanced: true
|
|
2643
2574
|
}]
|
|
2644
2575
|
};
|
|
2645
|
-
var _tmpl$
|
|
2576
|
+
var _tmpl$12 = /* @__PURE__ */ template(`<source type=video/mp4>`);
|
|
2646
2577
|
var _tmpl$23 = /* @__PURE__ */ template(`<div>`);
|
|
2647
2578
|
var _tmpl$33 = /* @__PURE__ */ template(`<div><video class=builder-video>`);
|
|
2648
2579
|
function Video(props) {
|
|
@@ -2705,7 +2636,7 @@ function Video(props) {
|
|
|
2705
2636
|
return !props.lazyLoad;
|
|
2706
2637
|
},
|
|
2707
2638
|
get children() {
|
|
2708
|
-
const _el$3 = _tmpl$
|
|
2639
|
+
const _el$3 = _tmpl$12();
|
|
2709
2640
|
effect(() => setAttribute(_el$3, "src", props.video));
|
|
2710
2641
|
return _el$3;
|
|
2711
2642
|
}
|
|
@@ -2864,10 +2795,10 @@ var getUpdateVariantVisibilityScript = ({
|
|
|
2864
2795
|
}) => `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME}(
|
|
2865
2796
|
"${variationId}", "${contentId}", ${isHydrationTarget}
|
|
2866
2797
|
)`;
|
|
2867
|
-
var _tmpl$
|
|
2798
|
+
var _tmpl$13 = /* @__PURE__ */ template(`<script>`);
|
|
2868
2799
|
function InlinedScript(props) {
|
|
2869
2800
|
return (() => {
|
|
2870
|
-
const _el$ = _tmpl$
|
|
2801
|
+
const _el$ = _tmpl$13();
|
|
2871
2802
|
effect((_p$) => {
|
|
2872
2803
|
const _v$ = props.scriptStr, _v$2 = props.id || "";
|
|
2873
2804
|
_v$ !== _p$._v$ && (_el$.innerHTML = _p$._v$ = _v$);
|
|
@@ -3056,7 +2987,7 @@ async function fetchOneEntry(options) {
|
|
|
3056
2987
|
limit: 1
|
|
3057
2988
|
});
|
|
3058
2989
|
if (allContent) {
|
|
3059
|
-
return allContent
|
|
2990
|
+
return allContent[0] || null;
|
|
3060
2991
|
}
|
|
3061
2992
|
return null;
|
|
3062
2993
|
}
|
|
@@ -3079,9 +3010,9 @@ var _processContentResult = async (options, content, url = generateContentUrl(op
|
|
|
3079
3010
|
content.results = newResults;
|
|
3080
3011
|
}
|
|
3081
3012
|
if (!canTrack)
|
|
3082
|
-
return content;
|
|
3013
|
+
return content.results;
|
|
3083
3014
|
if (!(isBrowser() || TARGET === "reactNative"))
|
|
3084
|
-
return content;
|
|
3015
|
+
return content.results;
|
|
3085
3016
|
try {
|
|
3086
3017
|
const newResults = [];
|
|
3087
3018
|
for (const item of content.results) {
|
|
@@ -3094,7 +3025,7 @@ var _processContentResult = async (options, content, url = generateContentUrl(op
|
|
|
3094
3025
|
} catch (e) {
|
|
3095
3026
|
logger.error("Could not process A/B tests. ", e);
|
|
3096
3027
|
}
|
|
3097
|
-
return content;
|
|
3028
|
+
return content.results;
|
|
3098
3029
|
};
|
|
3099
3030
|
async function fetchEntries(options) {
|
|
3100
3031
|
try {
|
|
@@ -3367,7 +3298,7 @@ var getInteractionPropertiesForEvent = (event) => {
|
|
|
3367
3298
|
};
|
|
3368
3299
|
|
|
3369
3300
|
// src/constants/sdk-version.ts
|
|
3370
|
-
var SDK_VERSION = "0.
|
|
3301
|
+
var SDK_VERSION = "0.10.0";
|
|
3371
3302
|
|
|
3372
3303
|
// src/functions/register.ts
|
|
3373
3304
|
var registry = {};
|
|
@@ -3501,11 +3432,11 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
3501
3432
|
};
|
|
3502
3433
|
|
|
3503
3434
|
// src/components/content/components/enable-editor.tsx
|
|
3504
|
-
var _tmpl$15 = /* @__PURE__ */ template(`<div>`);
|
|
3505
3435
|
function EnableEditor(props) {
|
|
3506
3436
|
const [forceReRenderCount, setForceReRenderCount] = createSignal(0);
|
|
3507
3437
|
createSignal(0);
|
|
3508
3438
|
const [shouldSendResetCookie, setShouldSendResetCookie] = createSignal(false);
|
|
3439
|
+
const [ContentWrapper, setContentWrapper] = createSignal(props.contentWrapper || "div");
|
|
3509
3440
|
const [httpReqsData, setHttpReqsData] = createSignal({});
|
|
3510
3441
|
const [clicked, setClicked] = createSignal(false);
|
|
3511
3442
|
function mergeNewContent(newContent) {
|
|
@@ -3738,10 +3669,7 @@ function EnableEditor(props) {
|
|
|
3738
3669
|
return props.builderContextSignal.content;
|
|
3739
3670
|
},
|
|
3740
3671
|
get children() {
|
|
3741
|
-
|
|
3742
|
-
const _ref$ = elementRef;
|
|
3743
|
-
typeof _ref$ === "function" ? use(_ref$, _el$) : elementRef = _el$;
|
|
3744
|
-
spread(_el$, mergeProps({
|
|
3672
|
+
return createComponent(Dynamic, mergeProps({
|
|
3745
3673
|
get ["class"]() {
|
|
3746
3674
|
return `variant-${props.content?.testVariationId || props.content?.id}`;
|
|
3747
3675
|
}
|
|
@@ -3749,7 +3677,11 @@ function EnableEditor(props) {
|
|
|
3749
3677
|
get key() {
|
|
3750
3678
|
return forceReRenderCount();
|
|
3751
3679
|
},
|
|
3752
|
-
|
|
3680
|
+
ref(r$) {
|
|
3681
|
+
const _ref$ = elementRef;
|
|
3682
|
+
typeof _ref$ === "function" ? _ref$(r$) : elementRef = r$;
|
|
3683
|
+
},
|
|
3684
|
+
onClick: (event) => onClick(event),
|
|
3753
3685
|
get ["builder-content-id"]() {
|
|
3754
3686
|
return props.builderContextSignal.content?.id;
|
|
3755
3687
|
},
|
|
@@ -3759,9 +3691,14 @@ function EnableEditor(props) {
|
|
|
3759
3691
|
}, {}, () => props.showContent ? {} : {
|
|
3760
3692
|
hidden: true,
|
|
3761
3693
|
"aria-hidden": true
|
|
3762
|
-
}
|
|
3763
|
-
|
|
3764
|
-
|
|
3694
|
+
}, () => props.contentWrapperProps, {
|
|
3695
|
+
get component() {
|
|
3696
|
+
return ContentWrapper();
|
|
3697
|
+
},
|
|
3698
|
+
get children() {
|
|
3699
|
+
return props.children;
|
|
3700
|
+
}
|
|
3701
|
+
}));
|
|
3765
3702
|
}
|
|
3766
3703
|
});
|
|
3767
3704
|
}
|
|
@@ -3950,7 +3887,9 @@ function ContentComponent(props) {
|
|
|
3950
3887
|
...acc,
|
|
3951
3888
|
[info.name]: serializeComponentInfo(info)
|
|
3952
3889
|
}), {}),
|
|
3953
|
-
inheritedStyles: {}
|
|
3890
|
+
inheritedStyles: {},
|
|
3891
|
+
BlocksWrapper: props.blocksWrapper || "div",
|
|
3892
|
+
BlocksWrapperProps: props.blocksWrapperProps || {}
|
|
3954
3893
|
});
|
|
3955
3894
|
function contentSetState(newRootState) {
|
|
3956
3895
|
setBuilderContextSignal((PREVIOUS_VALUE) => ({
|
|
@@ -3995,6 +3934,12 @@ function ContentComponent(props) {
|
|
|
3995
3934
|
},
|
|
3996
3935
|
get builderContextSignal() {
|
|
3997
3936
|
return builderContextSignal();
|
|
3937
|
+
},
|
|
3938
|
+
get contentWrapper() {
|
|
3939
|
+
return props.contentWrapper;
|
|
3940
|
+
},
|
|
3941
|
+
get contentWrapperProps() {
|
|
3942
|
+
return props.contentWrapperProps;
|
|
3998
3943
|
}
|
|
3999
3944
|
}, {
|
|
4000
3945
|
setBuilderContextSignal
|
|
@@ -4142,6 +4087,18 @@ function ContentVariants(props) {
|
|
|
4142
4087
|
},
|
|
4143
4088
|
get isSsrAbTest() {
|
|
4144
4089
|
return shouldRenderVariants();
|
|
4090
|
+
},
|
|
4091
|
+
get blocksWrapper() {
|
|
4092
|
+
return props.blocksWrapper;
|
|
4093
|
+
},
|
|
4094
|
+
get blocksWrapperProps() {
|
|
4095
|
+
return props.blocksWrapperProps;
|
|
4096
|
+
},
|
|
4097
|
+
get contentWrapper() {
|
|
4098
|
+
return props.contentWrapper;
|
|
4099
|
+
},
|
|
4100
|
+
get contentWrapperProps() {
|
|
4101
|
+
return props.contentWrapperProps;
|
|
4145
4102
|
}
|
|
4146
4103
|
});
|
|
4147
4104
|
}
|
|
@@ -4184,6 +4141,18 @@ function ContentVariants(props) {
|
|
|
4184
4141
|
},
|
|
4185
4142
|
get isSsrAbTest() {
|
|
4186
4143
|
return shouldRenderVariants();
|
|
4144
|
+
},
|
|
4145
|
+
get blocksWrapper() {
|
|
4146
|
+
return props.blocksWrapper;
|
|
4147
|
+
},
|
|
4148
|
+
get blocksWrapperProps() {
|
|
4149
|
+
return props.blocksWrapperProps;
|
|
4150
|
+
},
|
|
4151
|
+
get contentWrapper() {
|
|
4152
|
+
return props.contentWrapper;
|
|
4153
|
+
},
|
|
4154
|
+
get contentWrapperProps() {
|
|
4155
|
+
return props.contentWrapperProps;
|
|
4187
4156
|
}
|
|
4188
4157
|
}))];
|
|
4189
4158
|
}
|
|
@@ -4214,7 +4183,7 @@ var fetchSymbolContent = async ({
|
|
|
4214
4183
|
};
|
|
4215
4184
|
|
|
4216
4185
|
// src/blocks/symbol/symbol.tsx
|
|
4217
|
-
var _tmpl$
|
|
4186
|
+
var _tmpl$14 = /* @__PURE__ */ template(`<div>`);
|
|
4218
4187
|
function Symbol(props) {
|
|
4219
4188
|
const [contentToUse, setContentToUse] = createSignal(props.symbol?.content);
|
|
4220
4189
|
function className() {
|
|
@@ -4240,7 +4209,7 @@ function Symbol(props) {
|
|
|
4240
4209
|
}
|
|
4241
4210
|
createEffect(on(() => [props.symbol], onUpdateFn_0));
|
|
4242
4211
|
return (() => {
|
|
4243
|
-
const _el$ = _tmpl$
|
|
4212
|
+
const _el$ = _tmpl$14();
|
|
4244
4213
|
spread(_el$, mergeProps({
|
|
4245
4214
|
get ["class"]() {
|
|
4246
4215
|
return className();
|