@builder.io/sdk-solid 3.0.1 → 3.0.3
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 +12 -1
- package/lib/browser/dev.js +108 -67
- package/lib/browser/dev.jsx +152 -115
- package/lib/browser/index.js +108 -67
- package/lib/browser/index.jsx +152 -115
- package/lib/edge/dev.js +109 -70
- package/lib/edge/dev.jsx +153 -118
- package/lib/edge/index.js +109 -70
- package/lib/edge/index.jsx +153 -118
- package/lib/node/dev.js +108 -67
- package/lib/node/dev.jsx +152 -115
- package/lib/node/index.js +108 -67
- package/lib/node/index.jsx +152 -115
- package/package.json +1 -1
package/lib/browser/dev.jsx
CHANGED
|
@@ -112,23 +112,6 @@ import {
|
|
|
112
112
|
createSignal as createSignal5
|
|
113
113
|
} from "solid-js";
|
|
114
114
|
|
|
115
|
-
// src/functions/get-block-component-options.ts
|
|
116
|
-
function getBlockComponentOptions(block) {
|
|
117
|
-
return {
|
|
118
|
-
...block.component?.options,
|
|
119
|
-
...block.options
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// src/helpers/omit.ts
|
|
124
|
-
function omit(obj, ...values) {
|
|
125
|
-
const newObject = Object.assign({}, obj);
|
|
126
|
-
for (const key of values) {
|
|
127
|
-
delete newObject[key];
|
|
128
|
-
}
|
|
129
|
-
return newObject;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
115
|
// src/helpers/logger.ts
|
|
133
116
|
var MSG_PREFIX = "[Builder.io]: ";
|
|
134
117
|
var logger = {
|
|
@@ -395,6 +378,38 @@ function evaluate({
|
|
|
395
378
|
}
|
|
396
379
|
}
|
|
397
380
|
|
|
381
|
+
// src/functions/get-block-component-options.ts
|
|
382
|
+
function getBlockComponentOptions(block, context) {
|
|
383
|
+
return {
|
|
384
|
+
...block.component?.options,
|
|
385
|
+
...block.options,
|
|
386
|
+
...evaluateTextComponentTextOption(block, context)
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
var evaluateTextComponentTextOption = (block, context) => {
|
|
390
|
+
if (block.component?.name === "Text" && block.component.options?.text && typeof block.component.options.text === "string") {
|
|
391
|
+
return {
|
|
392
|
+
...block.component.options,
|
|
393
|
+
text: block.component.options.text.replace(/{{([^}]+)}}/g, (_match, group) => evaluate({
|
|
394
|
+
code: group,
|
|
395
|
+
context,
|
|
396
|
+
localState: context.localState,
|
|
397
|
+
rootState: context.rootState,
|
|
398
|
+
rootSetState: context.rootSetState
|
|
399
|
+
}))
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
// src/helpers/omit.ts
|
|
405
|
+
function omit(obj, ...values) {
|
|
406
|
+
const newObject = Object.assign({}, obj);
|
|
407
|
+
for (const key of values) {
|
|
408
|
+
delete newObject[key];
|
|
409
|
+
}
|
|
410
|
+
return newObject;
|
|
411
|
+
}
|
|
412
|
+
|
|
398
413
|
// src/functions/traverse.ts
|
|
399
414
|
function traverse(obj, callback, parent2 = null, key = null, visited = /* @__PURE__ */ new WeakSet()) {
|
|
400
415
|
if (obj == null || typeof obj !== "object") {
|
|
@@ -559,24 +574,19 @@ var evaluateBindings = ({
|
|
|
559
574
|
function getProcessedBlock({
|
|
560
575
|
block,
|
|
561
576
|
context,
|
|
562
|
-
shouldEvaluateBindings,
|
|
563
577
|
localState,
|
|
564
578
|
rootState,
|
|
565
579
|
rootSetState
|
|
566
580
|
}) {
|
|
567
581
|
let transformedBlock = resolveLocalizedValues(block, rootState.locale);
|
|
568
582
|
transformedBlock = transformBlock(transformedBlock);
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
});
|
|
577
|
-
} else {
|
|
578
|
-
return transformedBlock;
|
|
579
|
-
}
|
|
583
|
+
return evaluateBindings({
|
|
584
|
+
block: transformedBlock,
|
|
585
|
+
localState,
|
|
586
|
+
rootState,
|
|
587
|
+
rootSetState,
|
|
588
|
+
context
|
|
589
|
+
});
|
|
580
590
|
}
|
|
581
591
|
|
|
582
592
|
// src/functions/camel-to-kebab-case.ts
|
|
@@ -1298,8 +1308,7 @@ function Block(props) {
|
|
|
1298
1308
|
localState: props.context.localState,
|
|
1299
1309
|
rootState: props.context.rootState,
|
|
1300
1310
|
rootSetState: props.context.rootSetState,
|
|
1301
|
-
context: props.context.context
|
|
1302
|
-
shouldEvaluateBindings: true
|
|
1311
|
+
context: props.context.context
|
|
1303
1312
|
});
|
|
1304
1313
|
return blockToUse;
|
|
1305
1314
|
});
|
|
@@ -1336,7 +1345,7 @@ function Block(props) {
|
|
|
1336
1345
|
blockChildren: processedBlock().children ?? [],
|
|
1337
1346
|
componentRef: blockComponent()?.component,
|
|
1338
1347
|
componentOptions: {
|
|
1339
|
-
...getBlockComponentOptions(processedBlock()),
|
|
1348
|
+
...getBlockComponentOptions(processedBlock(), props.context),
|
|
1340
1349
|
...provideBuilderBlock(blockComponent(), processedBlock()),
|
|
1341
1350
|
...provideBuilderContext(blockComponent(), props.context),
|
|
1342
1351
|
...provideLinkComponent(blockComponent(), props.linkComponent),
|
|
@@ -1490,7 +1499,7 @@ function BlocksWrapper(props) {
|
|
|
1490
1499
|
});
|
|
1491
1500
|
return <>
|
|
1492
1501
|
<Dynamic4
|
|
1493
|
-
class={className() + " dynamic-
|
|
1502
|
+
class={className() + " dynamic-3c4beb0c"}
|
|
1494
1503
|
ref={blocksWrapperRef}
|
|
1495
1504
|
builder-path={dataPath()}
|
|
1496
1505
|
builder-parent-id={props.parent}
|
|
@@ -1502,7 +1511,7 @@ function BlocksWrapper(props) {
|
|
|
1502
1511
|
{...props.BlocksWrapperProps}
|
|
1503
1512
|
component={props.BlocksWrapper}
|
|
1504
1513
|
>{props.children}</Dynamic4>
|
|
1505
|
-
<style>{`.dynamic-
|
|
1514
|
+
<style>{`.dynamic-3c4beb0c {
|
|
1506
1515
|
display: flex;
|
|
1507
1516
|
flex-direction: column;
|
|
1508
1517
|
align-items: stretch;
|
|
@@ -1667,7 +1676,7 @@ function Columns(props) {
|
|
|
1667
1676
|
}
|
|
1668
1677
|
return <>
|
|
1669
1678
|
<div
|
|
1670
|
-
class={getColumnsClass(props.builderBlock?.id) + " div-
|
|
1679
|
+
class={getColumnsClass(props.builderBlock?.id) + " div-3e5f33a4"}
|
|
1671
1680
|
style={columnsCssVars()}
|
|
1672
1681
|
{...{}}
|
|
1673
1682
|
>
|
|
@@ -1696,7 +1705,7 @@ function Columns(props) {
|
|
|
1696
1705
|
/></Dynamic_renderer_default>;
|
|
1697
1706
|
}}</For4>
|
|
1698
1707
|
</div>
|
|
1699
|
-
<style>{`.div-
|
|
1708
|
+
<style>{`.div-3e5f33a4 {
|
|
1700
1709
|
display: flex;
|
|
1701
1710
|
line-height: normal;
|
|
1702
1711
|
}`}</style>
|
|
@@ -1808,7 +1817,7 @@ function Image(props) {
|
|
|
1808
1817
|
<picture>
|
|
1809
1818
|
<Show8 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show8>
|
|
1810
1819
|
<img
|
|
1811
|
-
class={"builder-image" + (props.className ? " " + props.className : "") + " img-
|
|
1820
|
+
class={"builder-image" + (props.className ? " " + props.className : "") + " img-56e07140"}
|
|
1812
1821
|
loading={props.highPriority ? "eager" : "lazy"}
|
|
1813
1822
|
fetchpriority={props.highPriority ? "high" : "auto"}
|
|
1814
1823
|
alt={props.altText}
|
|
@@ -1826,22 +1835,22 @@ function Image(props) {
|
|
|
1826
1835
|
<Show8
|
|
1827
1836
|
when={props.aspectRatio && !(props.builderBlock?.children?.length && props.fitContent)}
|
|
1828
1837
|
><div
|
|
1829
|
-
class="builder-image-sizer div-
|
|
1838
|
+
class="builder-image-sizer div-56e07140"
|
|
1830
1839
|
style={{
|
|
1831
1840
|
"padding-top": props.aspectRatio * 100 + "%"
|
|
1832
1841
|
}}
|
|
1833
1842
|
/></Show8>
|
|
1834
1843
|
<Show8 when={props.builderBlock?.children?.length && props.fitContent}>{props.children}</Show8>
|
|
1835
|
-
<Show8 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-
|
|
1844
|
+
<Show8 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-56e07140-2">{props.children}</div></Show8>
|
|
1836
1845
|
</>
|
|
1837
|
-
<style>{`.img-
|
|
1846
|
+
<style>{`.img-56e07140 {
|
|
1838
1847
|
opacity: 1;
|
|
1839
1848
|
transition: opacity 0.2s ease-in-out;
|
|
1840
|
-
}.div-
|
|
1849
|
+
}.div-56e07140 {
|
|
1841
1850
|
width: 100%;
|
|
1842
1851
|
pointer-events: none;
|
|
1843
1852
|
font-size: 0;
|
|
1844
|
-
}.div-
|
|
1853
|
+
}.div-56e07140-2 {
|
|
1845
1854
|
display: flex;
|
|
1846
1855
|
flex-direction: column;
|
|
1847
1856
|
align-items: stretch;
|
|
@@ -1877,10 +1886,10 @@ function SectionComponent(props) {
|
|
|
1877
1886
|
var section_default = SectionComponent;
|
|
1878
1887
|
|
|
1879
1888
|
// src/blocks/symbol/symbol.tsx
|
|
1880
|
-
import { onMount as onMount8, on as on4, createEffect as createEffect4, createMemo as
|
|
1889
|
+
import { onMount as onMount8, on as on4, createEffect as createEffect4, createMemo as createMemo19, createSignal as createSignal19 } from "solid-js";
|
|
1881
1890
|
|
|
1882
1891
|
// src/components/content-variants/content-variants.tsx
|
|
1883
|
-
import { Show as Show15, For as For9, onMount as onMount7, createSignal as
|
|
1892
|
+
import { Show as Show15, For as For9, onMount as onMount7, createSignal as createSignal18, createMemo as createMemo18 } from "solid-js";
|
|
1884
1893
|
|
|
1885
1894
|
// src/helpers/url.ts
|
|
1886
1895
|
var getTopLevelDomain = (host) => {
|
|
@@ -2074,7 +2083,7 @@ var handleABTesting = async ({
|
|
|
2074
2083
|
var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
|
|
2075
2084
|
|
|
2076
2085
|
// src/components/content/content.tsx
|
|
2077
|
-
import { Show as Show14, createSignal as
|
|
2086
|
+
import { Show as Show14, createSignal as createSignal17 } from "solid-js";
|
|
2078
2087
|
|
|
2079
2088
|
// src/blocks/accordion/component-info.ts
|
|
2080
2089
|
var defaultTitle = {
|
|
@@ -3119,30 +3128,10 @@ var componentInfo10 = {
|
|
|
3119
3128
|
};
|
|
3120
3129
|
|
|
3121
3130
|
// src/blocks/text/text.tsx
|
|
3122
|
-
import { createMemo as createMemo11 } from "solid-js";
|
|
3123
3131
|
function Text(props) {
|
|
3124
|
-
const processedText = createMemo11(() => {
|
|
3125
|
-
const context = props.builderContext;
|
|
3126
|
-
const {
|
|
3127
|
-
context: contextContext,
|
|
3128
|
-
localState,
|
|
3129
|
-
rootState,
|
|
3130
|
-
rootSetState
|
|
3131
|
-
} = context;
|
|
3132
|
-
return String(props.text?.toString() || "").replace(
|
|
3133
|
-
/{{([^}]+)}}/g,
|
|
3134
|
-
(match, group) => evaluate({
|
|
3135
|
-
code: group,
|
|
3136
|
-
context: contextContext,
|
|
3137
|
-
localState,
|
|
3138
|
-
rootState,
|
|
3139
|
-
rootSetState
|
|
3140
|
-
})
|
|
3141
|
-
);
|
|
3142
|
-
});
|
|
3143
3132
|
return <><div
|
|
3144
3133
|
class="builder-text"
|
|
3145
|
-
innerHTML={
|
|
3134
|
+
innerHTML={props.text?.toString() || ""}
|
|
3146
3135
|
style={{
|
|
3147
3136
|
outline: "none"
|
|
3148
3137
|
}}
|
|
@@ -3176,10 +3165,10 @@ var componentInfo11 = {
|
|
|
3176
3165
|
};
|
|
3177
3166
|
|
|
3178
3167
|
// src/blocks/custom-code/custom-code.tsx
|
|
3179
|
-
import { onMount as onMount5, createSignal as
|
|
3168
|
+
import { onMount as onMount5, createSignal as createSignal11 } from "solid-js";
|
|
3180
3169
|
function CustomCode(props) {
|
|
3181
|
-
const [scriptsInserted, setScriptsInserted] =
|
|
3182
|
-
const [scriptsRun, setScriptsRun] =
|
|
3170
|
+
const [scriptsInserted, setScriptsInserted] = createSignal11([]);
|
|
3171
|
+
const [scriptsRun, setScriptsRun] = createSignal11([]);
|
|
3183
3172
|
let elementRef;
|
|
3184
3173
|
onMount5(() => {
|
|
3185
3174
|
if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
|
|
@@ -3241,7 +3230,7 @@ var componentInfo12 = {
|
|
|
3241
3230
|
};
|
|
3242
3231
|
|
|
3243
3232
|
// src/blocks/embed/embed.tsx
|
|
3244
|
-
import { on as on2, createEffect as createEffect2, createMemo as
|
|
3233
|
+
import { on as on2, createEffect as createEffect2, createMemo as createMemo12, createSignal as createSignal12 } from "solid-js";
|
|
3245
3234
|
|
|
3246
3235
|
// src/blocks/embed/helpers.ts
|
|
3247
3236
|
var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
|
|
@@ -3249,9 +3238,9 @@ var isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
|
|
|
3249
3238
|
|
|
3250
3239
|
// src/blocks/embed/embed.tsx
|
|
3251
3240
|
function Embed(props) {
|
|
3252
|
-
const [scriptsInserted, setScriptsInserted] =
|
|
3253
|
-
const [scriptsRun, setScriptsRun] =
|
|
3254
|
-
const [ranInitFn, setRanInitFn] =
|
|
3241
|
+
const [scriptsInserted, setScriptsInserted] = createSignal12([]);
|
|
3242
|
+
const [scriptsRun, setScriptsRun] = createSignal12([]);
|
|
3243
|
+
const [ranInitFn, setRanInitFn] = createSignal12(false);
|
|
3255
3244
|
function findAndRunScripts() {
|
|
3256
3245
|
if (!elem || !elem.getElementsByTagName)
|
|
3257
3246
|
return;
|
|
@@ -3275,8 +3264,8 @@ function Embed(props) {
|
|
|
3275
3264
|
}
|
|
3276
3265
|
}
|
|
3277
3266
|
let elem;
|
|
3278
|
-
const onUpdateFn_0_elem =
|
|
3279
|
-
const onUpdateFn_0_ranInitFn__ =
|
|
3267
|
+
const onUpdateFn_0_elem = createMemo12(() => elem);
|
|
3268
|
+
const onUpdateFn_0_ranInitFn__ = createMemo12(() => ranInitFn());
|
|
3280
3269
|
function onUpdateFn_0() {
|
|
3281
3270
|
if (elem && !ranInitFn()) {
|
|
3282
3271
|
setRanInitFn(true);
|
|
@@ -3531,7 +3520,7 @@ var componentInfo13 = {
|
|
|
3531
3520
|
};
|
|
3532
3521
|
|
|
3533
3522
|
// src/blocks/form/form/form.tsx
|
|
3534
|
-
import { Show as Show11, For as For7, createSignal as
|
|
3523
|
+
import { Show as Show11, For as For7, createSignal as createSignal13 } from "solid-js";
|
|
3535
3524
|
|
|
3536
3525
|
// src/functions/get-env.ts
|
|
3537
3526
|
var validEnvList = ["production", "qa", "test", "development", "dev", "cdn-qa", "cloud", "fast", "cdn2", "cdn-prod"];
|
|
@@ -3551,9 +3540,9 @@ function logFetch(url) {
|
|
|
3551
3540
|
|
|
3552
3541
|
// src/blocks/form/form/form.tsx
|
|
3553
3542
|
function FormComponent(props) {
|
|
3554
|
-
const [formState, setFormState] =
|
|
3555
|
-
const [responseData, setResponseData] =
|
|
3556
|
-
const [formErrorMessage, setFormErrorMessage] =
|
|
3543
|
+
const [formState, setFormState] = createSignal13("unsubmitted");
|
|
3544
|
+
const [responseData, setResponseData] = createSignal13(null);
|
|
3545
|
+
const [formErrorMessage, setFormErrorMessage] = createSignal13("");
|
|
3557
3546
|
function mergeNewRootState(newData) {
|
|
3558
3547
|
const combinedState = {
|
|
3559
3548
|
...props.builderContext.rootState,
|
|
@@ -3768,14 +3757,14 @@ function FormComponent(props) {
|
|
|
3768
3757
|
blocks={props.sendingMessage}
|
|
3769
3758
|
context={props.builderContext}
|
|
3770
3759
|
/></Show11>
|
|
3771
|
-
<Show11 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-
|
|
3760
|
+
<Show11 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-27d18614">{JSON.stringify(responseData(), null, 2)}</pre></Show11>
|
|
3772
3761
|
<Show11 when={submissionState() === "success"}><Blocks_default
|
|
3773
3762
|
path="successMessage"
|
|
3774
3763
|
blocks={props.successMessage}
|
|
3775
3764
|
context={props.builderContext}
|
|
3776
3765
|
/></Show11>
|
|
3777
3766
|
</form>
|
|
3778
|
-
<style>{`.pre-
|
|
3767
|
+
<style>{`.pre-27d18614 {
|
|
3779
3768
|
padding: 10px;
|
|
3780
3769
|
color: red;
|
|
3781
3770
|
text-align: center;
|
|
@@ -4125,9 +4114,9 @@ var componentInfo19 = {
|
|
|
4125
4114
|
};
|
|
4126
4115
|
|
|
4127
4116
|
// src/blocks/video/video.tsx
|
|
4128
|
-
import { Show as Show12, createMemo as
|
|
4117
|
+
import { Show as Show12, createMemo as createMemo14 } from "solid-js";
|
|
4129
4118
|
function Video(props) {
|
|
4130
|
-
const videoProps =
|
|
4119
|
+
const videoProps = createMemo14(() => {
|
|
4131
4120
|
return {
|
|
4132
4121
|
...props.autoPlay === true ? {
|
|
4133
4122
|
autoPlay: true
|
|
@@ -4146,7 +4135,7 @@ function Video(props) {
|
|
|
4146
4135
|
} : {}
|
|
4147
4136
|
};
|
|
4148
4137
|
});
|
|
4149
|
-
const spreadProps =
|
|
4138
|
+
const spreadProps = createMemo14(() => {
|
|
4150
4139
|
return {
|
|
4151
4140
|
...videoProps()
|
|
4152
4141
|
};
|
|
@@ -4356,8 +4345,8 @@ import {
|
|
|
4356
4345
|
onMount as onMount6,
|
|
4357
4346
|
on as on3,
|
|
4358
4347
|
createEffect as createEffect3,
|
|
4359
|
-
createMemo as
|
|
4360
|
-
createSignal as
|
|
4348
|
+
createMemo as createMemo15,
|
|
4349
|
+
createSignal as createSignal15
|
|
4361
4350
|
} from "solid-js";
|
|
4362
4351
|
import { Dynamic as Dynamic5 } from "solid-js/web";
|
|
4363
4352
|
|
|
@@ -4367,7 +4356,7 @@ function getPreviewContent(_searchParams) {
|
|
|
4367
4356
|
}
|
|
4368
4357
|
|
|
4369
4358
|
// src/constants/sdk-version.ts
|
|
4370
|
-
var SDK_VERSION = "3.0.
|
|
4359
|
+
var SDK_VERSION = "3.0.3";
|
|
4371
4360
|
|
|
4372
4361
|
// src/helpers/sdk-headers.ts
|
|
4373
4362
|
var getSdkHeaders = () => ({
|
|
@@ -4432,6 +4421,23 @@ function flattenMongoQuery(obj, _current, _res = {}) {
|
|
|
4432
4421
|
}
|
|
4433
4422
|
return _res;
|
|
4434
4423
|
}
|
|
4424
|
+
function unflatten(obj) {
|
|
4425
|
+
const result = {};
|
|
4426
|
+
for (const key in obj) {
|
|
4427
|
+
const parts = key.split(".");
|
|
4428
|
+
let current = result;
|
|
4429
|
+
for (let i = 0; i < parts.length; i++) {
|
|
4430
|
+
const part = parts[i];
|
|
4431
|
+
if (i === parts.length - 1) {
|
|
4432
|
+
current[part] = obj[key];
|
|
4433
|
+
} else {
|
|
4434
|
+
current[part] = current[part] || {};
|
|
4435
|
+
current = current[part];
|
|
4436
|
+
}
|
|
4437
|
+
}
|
|
4438
|
+
}
|
|
4439
|
+
return result;
|
|
4440
|
+
}
|
|
4435
4441
|
|
|
4436
4442
|
// src/types/api-version.ts
|
|
4437
4443
|
var DEFAULT_API_VERSION = "v3";
|
|
@@ -4496,7 +4502,7 @@ var generateContentUrl = (options) => {
|
|
|
4496
4502
|
url.searchParams.set("noTraverse", String(noTraverse));
|
|
4497
4503
|
url.searchParams.set("includeRefs", String(true));
|
|
4498
4504
|
const finalLocale = locale || userAttributes?.locale;
|
|
4499
|
-
let finalUserAttributes = userAttributes;
|
|
4505
|
+
let finalUserAttributes = userAttributes || {};
|
|
4500
4506
|
if (finalLocale) {
|
|
4501
4507
|
url.searchParams.set("locale", finalLocale);
|
|
4502
4508
|
finalUserAttributes = {
|
|
@@ -4534,11 +4540,15 @@ var generateContentUrl = (options) => {
|
|
|
4534
4540
|
...getBuilderSearchParamsFromWindow(),
|
|
4535
4541
|
...normalizeSearchParams(options.options || {})
|
|
4536
4542
|
};
|
|
4543
|
+
finalUserAttributes = {
|
|
4544
|
+
...finalUserAttributes,
|
|
4545
|
+
...getUserAttributesAsJSON(queryOptions)
|
|
4546
|
+
};
|
|
4537
4547
|
const flattened = flatten(queryOptions);
|
|
4538
4548
|
for (const key in flattened) {
|
|
4539
4549
|
url.searchParams.set(key, String(flattened[key]));
|
|
4540
4550
|
}
|
|
4541
|
-
if (finalUserAttributes) {
|
|
4551
|
+
if (Object.keys(finalUserAttributes).length > 0) {
|
|
4542
4552
|
url.searchParams.set("userAttributes", JSON.stringify(finalUserAttributes));
|
|
4543
4553
|
}
|
|
4544
4554
|
if (query) {
|
|
@@ -4551,6 +4561,28 @@ var generateContentUrl = (options) => {
|
|
|
4551
4561
|
}
|
|
4552
4562
|
return url;
|
|
4553
4563
|
};
|
|
4564
|
+
var getUserAttributesFromQueryOptions = (queryOptions) => {
|
|
4565
|
+
const newUserAttributes = {};
|
|
4566
|
+
for (const key in queryOptions) {
|
|
4567
|
+
if (key.startsWith("userAttributes.")) {
|
|
4568
|
+
newUserAttributes[key] = queryOptions[key];
|
|
4569
|
+
delete queryOptions[key];
|
|
4570
|
+
}
|
|
4571
|
+
}
|
|
4572
|
+
return newUserAttributes;
|
|
4573
|
+
};
|
|
4574
|
+
var getUserAttributesAsJSON = (queryOptions) => {
|
|
4575
|
+
if (isBrowser() && queryOptions["preview"] === "BUILDER_STUDIO") {
|
|
4576
|
+
queryOptions["userAttributes.urlPath"] = window.location.pathname;
|
|
4577
|
+
queryOptions["userAttributes.host"] = window.location.host;
|
|
4578
|
+
const queryOptionsForUserAttributes = getUserAttributesFromQueryOptions(queryOptions);
|
|
4579
|
+
const {
|
|
4580
|
+
userAttributes
|
|
4581
|
+
} = unflatten(queryOptionsForUserAttributes);
|
|
4582
|
+
return userAttributes;
|
|
4583
|
+
}
|
|
4584
|
+
return {};
|
|
4585
|
+
};
|
|
4554
4586
|
|
|
4555
4587
|
// src/functions/get-content/index.ts
|
|
4556
4588
|
var checkContentHasResults = (content) => "results" in content;
|
|
@@ -5172,12 +5204,12 @@ var getWrapperClassName = (variationId) => {
|
|
|
5172
5204
|
|
|
5173
5205
|
// src/components/content/components/enable-editor.tsx
|
|
5174
5206
|
function EnableEditor(props) {
|
|
5175
|
-
const [ContentWrapper, setContentWrapper] =
|
|
5207
|
+
const [ContentWrapper, setContentWrapper] = createSignal15(
|
|
5176
5208
|
props.contentWrapper || "div"
|
|
5177
5209
|
);
|
|
5178
|
-
const [httpReqsData, setHttpReqsData] =
|
|
5179
|
-
const [httpReqsPending, setHttpReqsPending] =
|
|
5180
|
-
const [clicked, setClicked] =
|
|
5210
|
+
const [httpReqsData, setHttpReqsData] = createSignal15({});
|
|
5211
|
+
const [httpReqsPending, setHttpReqsPending] = createSignal15({});
|
|
5212
|
+
const [clicked, setClicked] = createSignal15(false);
|
|
5181
5213
|
function mergeNewRootState(newData) {
|
|
5182
5214
|
const combinedState = {
|
|
5183
5215
|
...props.builderContextSignal.rootState,
|
|
@@ -5211,7 +5243,7 @@ function EnableEditor(props) {
|
|
|
5211
5243
|
content: newContentValue
|
|
5212
5244
|
}));
|
|
5213
5245
|
}
|
|
5214
|
-
const showContentProps =
|
|
5246
|
+
const showContentProps = createMemo15(() => {
|
|
5215
5247
|
return props.showContent ? {} : {
|
|
5216
5248
|
hidden: true,
|
|
5217
5249
|
"aria-hidden": true
|
|
@@ -5368,11 +5400,16 @@ function EnableEditor(props) {
|
|
|
5368
5400
|
`builder.overrides.${searchParamPreviewModel}`
|
|
5369
5401
|
);
|
|
5370
5402
|
const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
|
|
5371
|
-
if (searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
|
|
5403
|
+
if (searchParamPreviewModel === "BUILDER_STUDIO" || searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
|
|
5372
5404
|
fetchOneEntry({
|
|
5373
|
-
model: props.model,
|
|
5405
|
+
model: props.model || "",
|
|
5374
5406
|
apiKey: props.apiKey,
|
|
5375
|
-
apiVersion: props.builderContextSignal.apiVersion
|
|
5407
|
+
apiVersion: props.builderContextSignal.apiVersion,
|
|
5408
|
+
...searchParamPreviewModel === "BUILDER_STUDIO" && props.context?.symbolId ? {
|
|
5409
|
+
query: {
|
|
5410
|
+
id: props.context.symbolId
|
|
5411
|
+
}
|
|
5412
|
+
} : {}
|
|
5376
5413
|
}).then((content) => {
|
|
5377
5414
|
if (content) {
|
|
5378
5415
|
mergeNewContent(content);
|
|
@@ -5382,14 +5419,14 @@ function EnableEditor(props) {
|
|
|
5382
5419
|
}
|
|
5383
5420
|
}
|
|
5384
5421
|
});
|
|
5385
|
-
const onUpdateFn_0_props_content =
|
|
5422
|
+
const onUpdateFn_0_props_content = createMemo15(() => props.content);
|
|
5386
5423
|
function onUpdateFn_0() {
|
|
5387
5424
|
if (props.content) {
|
|
5388
5425
|
mergeNewContent(props.content);
|
|
5389
5426
|
}
|
|
5390
5427
|
}
|
|
5391
5428
|
createEffect3(on3(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
|
|
5392
|
-
const onUpdateFn_1_props_builderContextSignal_rootState =
|
|
5429
|
+
const onUpdateFn_1_props_builderContextSignal_rootState = createMemo15(
|
|
5393
5430
|
() => props.builderContextSignal.rootState
|
|
5394
5431
|
);
|
|
5395
5432
|
function onUpdateFn_1() {
|
|
@@ -5401,14 +5438,14 @@ function EnableEditor(props) {
|
|
|
5401
5438
|
onUpdateFn_1
|
|
5402
5439
|
)
|
|
5403
5440
|
);
|
|
5404
|
-
const onUpdateFn_2_props_data =
|
|
5441
|
+
const onUpdateFn_2_props_data = createMemo15(() => props.data);
|
|
5405
5442
|
function onUpdateFn_2() {
|
|
5406
5443
|
if (props.data) {
|
|
5407
5444
|
mergeNewRootState(props.data);
|
|
5408
5445
|
}
|
|
5409
5446
|
}
|
|
5410
5447
|
createEffect3(on3(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
|
|
5411
|
-
const onUpdateFn_3_props_locale =
|
|
5448
|
+
const onUpdateFn_3_props_locale = createMemo15(() => props.locale);
|
|
5412
5449
|
function onUpdateFn_3() {
|
|
5413
5450
|
if (props.locale) {
|
|
5414
5451
|
mergeNewRootState({
|
|
@@ -5440,9 +5477,9 @@ function EnableEditor(props) {
|
|
|
5440
5477
|
var Enable_editor_default = EnableEditor;
|
|
5441
5478
|
|
|
5442
5479
|
// src/components/content/components/styles.tsx
|
|
5443
|
-
import { createSignal as
|
|
5480
|
+
import { createSignal as createSignal16 } from "solid-js";
|
|
5444
5481
|
function ContentStyles(props) {
|
|
5445
|
-
const [injectedStyles, setInjectedStyles] =
|
|
5482
|
+
const [injectedStyles, setInjectedStyles] = createSignal16(
|
|
5446
5483
|
`
|
|
5447
5484
|
${getCss({
|
|
5448
5485
|
cssCode: props.cssCode,
|
|
@@ -5500,7 +5537,7 @@ var getContentInitialValue = ({
|
|
|
5500
5537
|
|
|
5501
5538
|
// src/components/content/content.tsx
|
|
5502
5539
|
function ContentComponent(props) {
|
|
5503
|
-
const [scriptStr, setScriptStr] =
|
|
5540
|
+
const [scriptStr, setScriptStr] = createSignal17(
|
|
5504
5541
|
getUpdateVariantVisibilityScript({
|
|
5505
5542
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
5506
5543
|
variationId: props.content?.testVariationId,
|
|
@@ -5508,7 +5545,7 @@ function ContentComponent(props) {
|
|
|
5508
5545
|
contentId: props.content?.id
|
|
5509
5546
|
})
|
|
5510
5547
|
);
|
|
5511
|
-
const [registeredComponents, setRegisteredComponents] =
|
|
5548
|
+
const [registeredComponents, setRegisteredComponents] = createSignal17(
|
|
5512
5549
|
[
|
|
5513
5550
|
...getDefaultRegisteredComponents(),
|
|
5514
5551
|
...props.customComponents || []
|
|
@@ -5523,7 +5560,7 @@ function ContentComponent(props) {
|
|
|
5523
5560
|
{}
|
|
5524
5561
|
)
|
|
5525
5562
|
);
|
|
5526
|
-
const [builderContextSignal, setBuilderContextSignal] =
|
|
5563
|
+
const [builderContextSignal, setBuilderContextSignal] = createSignal17({
|
|
5527
5564
|
content: getContentInitialValue({
|
|
5528
5565
|
content: props.content,
|
|
5529
5566
|
data: props.data
|
|
@@ -5631,13 +5668,13 @@ var Content_default = ContentComponent;
|
|
|
5631
5668
|
|
|
5632
5669
|
// src/components/content-variants/content-variants.tsx
|
|
5633
5670
|
function ContentVariants(props) {
|
|
5634
|
-
const [shouldRenderVariants, setShouldRenderVariants] =
|
|
5671
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal18(
|
|
5635
5672
|
checkShouldRenderVariants({
|
|
5636
5673
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
5637
5674
|
content: props.content
|
|
5638
5675
|
})
|
|
5639
5676
|
);
|
|
5640
|
-
const updateCookieAndStylesScriptStr =
|
|
5677
|
+
const updateCookieAndStylesScriptStr = createMemo18(() => {
|
|
5641
5678
|
return getUpdateCookieAndStylesScript(
|
|
5642
5679
|
getVariants(props.content).map((value) => ({
|
|
5643
5680
|
id: value.testVariationId,
|
|
@@ -5646,10 +5683,10 @@ function ContentVariants(props) {
|
|
|
5646
5683
|
props.content?.id || ""
|
|
5647
5684
|
);
|
|
5648
5685
|
});
|
|
5649
|
-
const hideVariantsStyleString =
|
|
5686
|
+
const hideVariantsStyleString = createMemo18(() => {
|
|
5650
5687
|
return getVariants(props.content).map((value) => `.variant-${value.testVariationId} { display: none; } `).join("");
|
|
5651
5688
|
});
|
|
5652
|
-
const defaultContent =
|
|
5689
|
+
const defaultContent = createMemo18(() => {
|
|
5653
5690
|
return shouldRenderVariants() ? {
|
|
5654
5691
|
...props.content,
|
|
5655
5692
|
testVariationId: props.content?.id
|
|
@@ -5761,14 +5798,14 @@ var fetchSymbolContent = async ({
|
|
|
5761
5798
|
|
|
5762
5799
|
// src/blocks/symbol/symbol.tsx
|
|
5763
5800
|
function Symbol(props) {
|
|
5764
|
-
const [contentToUse, setContentToUse] =
|
|
5765
|
-
const blocksWrapper =
|
|
5801
|
+
const [contentToUse, setContentToUse] = createSignal19(props.symbol?.content);
|
|
5802
|
+
const blocksWrapper = createMemo19(() => {
|
|
5766
5803
|
return "div";
|
|
5767
5804
|
});
|
|
5768
|
-
const contentWrapper =
|
|
5805
|
+
const contentWrapper = createMemo19(() => {
|
|
5769
5806
|
return "div";
|
|
5770
5807
|
});
|
|
5771
|
-
const className =
|
|
5808
|
+
const className = createMemo19(() => {
|
|
5772
5809
|
return [
|
|
5773
5810
|
...[props.attributes[getClassPropName()]],
|
|
5774
5811
|
"builder-symbol",
|
|
@@ -5790,7 +5827,7 @@ function Symbol(props) {
|
|
|
5790
5827
|
}
|
|
5791
5828
|
onMount8(() => {
|
|
5792
5829
|
});
|
|
5793
|
-
const onUpdateFn_0_props_symbol =
|
|
5830
|
+
const onUpdateFn_0_props_symbol = createMemo19(() => props.symbol);
|
|
5794
5831
|
function onUpdateFn_0() {
|
|
5795
5832
|
setContent();
|
|
5796
5833
|
}
|