@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/index.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 logger = {
|
|
134
117
|
log: (...message) => void 0,
|
|
@@ -393,6 +376,38 @@ function evaluate({
|
|
|
393
376
|
}
|
|
394
377
|
}
|
|
395
378
|
|
|
379
|
+
// src/functions/get-block-component-options.ts
|
|
380
|
+
function getBlockComponentOptions(block, context) {
|
|
381
|
+
return {
|
|
382
|
+
...block.component?.options,
|
|
383
|
+
...block.options,
|
|
384
|
+
...evaluateTextComponentTextOption(block, context)
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
var evaluateTextComponentTextOption = (block, context) => {
|
|
388
|
+
if (block.component?.name === "Text" && block.component.options?.text && typeof block.component.options.text === "string") {
|
|
389
|
+
return {
|
|
390
|
+
...block.component.options,
|
|
391
|
+
text: block.component.options.text.replace(/{{([^}]+)}}/g, (_match, group) => evaluate({
|
|
392
|
+
code: group,
|
|
393
|
+
context,
|
|
394
|
+
localState: context.localState,
|
|
395
|
+
rootState: context.rootState,
|
|
396
|
+
rootSetState: context.rootSetState
|
|
397
|
+
}))
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
};
|
|
401
|
+
|
|
402
|
+
// src/helpers/omit.ts
|
|
403
|
+
function omit(obj, ...values) {
|
|
404
|
+
const newObject = Object.assign({}, obj);
|
|
405
|
+
for (const key of values) {
|
|
406
|
+
delete newObject[key];
|
|
407
|
+
}
|
|
408
|
+
return newObject;
|
|
409
|
+
}
|
|
410
|
+
|
|
396
411
|
// src/functions/traverse.ts
|
|
397
412
|
function traverse(obj, callback, parent2 = null, key = null, visited = /* @__PURE__ */ new WeakSet()) {
|
|
398
413
|
if (obj == null || typeof obj !== "object") {
|
|
@@ -556,24 +571,19 @@ var evaluateBindings = ({
|
|
|
556
571
|
function getProcessedBlock({
|
|
557
572
|
block,
|
|
558
573
|
context,
|
|
559
|
-
shouldEvaluateBindings,
|
|
560
574
|
localState,
|
|
561
575
|
rootState,
|
|
562
576
|
rootSetState
|
|
563
577
|
}) {
|
|
564
578
|
let transformedBlock = resolveLocalizedValues(block, rootState.locale);
|
|
565
579
|
transformedBlock = transformBlock(transformedBlock);
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
});
|
|
574
|
-
} else {
|
|
575
|
-
return transformedBlock;
|
|
576
|
-
}
|
|
580
|
+
return evaluateBindings({
|
|
581
|
+
block: transformedBlock,
|
|
582
|
+
localState,
|
|
583
|
+
rootState,
|
|
584
|
+
rootSetState,
|
|
585
|
+
context
|
|
586
|
+
});
|
|
577
587
|
}
|
|
578
588
|
|
|
579
589
|
// src/functions/camel-to-kebab-case.ts
|
|
@@ -1291,8 +1301,7 @@ function Block(props) {
|
|
|
1291
1301
|
localState: props.context.localState,
|
|
1292
1302
|
rootState: props.context.rootState,
|
|
1293
1303
|
rootSetState: props.context.rootSetState,
|
|
1294
|
-
context: props.context.context
|
|
1295
|
-
shouldEvaluateBindings: true
|
|
1304
|
+
context: props.context.context
|
|
1296
1305
|
});
|
|
1297
1306
|
return blockToUse;
|
|
1298
1307
|
});
|
|
@@ -1329,7 +1338,7 @@ function Block(props) {
|
|
|
1329
1338
|
blockChildren: processedBlock().children ?? [],
|
|
1330
1339
|
componentRef: blockComponent()?.component,
|
|
1331
1340
|
componentOptions: {
|
|
1332
|
-
...getBlockComponentOptions(processedBlock()),
|
|
1341
|
+
...getBlockComponentOptions(processedBlock(), props.context),
|
|
1333
1342
|
...provideBuilderBlock(blockComponent(), processedBlock()),
|
|
1334
1343
|
...provideBuilderContext(blockComponent(), props.context),
|
|
1335
1344
|
...provideLinkComponent(blockComponent(), props.linkComponent),
|
|
@@ -1483,7 +1492,7 @@ function BlocksWrapper(props) {
|
|
|
1483
1492
|
});
|
|
1484
1493
|
return <>
|
|
1485
1494
|
<Dynamic4
|
|
1486
|
-
class={className() + " dynamic-
|
|
1495
|
+
class={className() + " dynamic-3c4beb0c"}
|
|
1487
1496
|
ref={blocksWrapperRef}
|
|
1488
1497
|
builder-path={dataPath()}
|
|
1489
1498
|
builder-parent-id={props.parent}
|
|
@@ -1495,7 +1504,7 @@ function BlocksWrapper(props) {
|
|
|
1495
1504
|
{...props.BlocksWrapperProps}
|
|
1496
1505
|
component={props.BlocksWrapper}
|
|
1497
1506
|
>{props.children}</Dynamic4>
|
|
1498
|
-
<style>{`.dynamic-
|
|
1507
|
+
<style>{`.dynamic-3c4beb0c {
|
|
1499
1508
|
display: flex;
|
|
1500
1509
|
flex-direction: column;
|
|
1501
1510
|
align-items: stretch;
|
|
@@ -1660,7 +1669,7 @@ function Columns(props) {
|
|
|
1660
1669
|
}
|
|
1661
1670
|
return <>
|
|
1662
1671
|
<div
|
|
1663
|
-
class={getColumnsClass(props.builderBlock?.id) + " div-
|
|
1672
|
+
class={getColumnsClass(props.builderBlock?.id) + " div-3e5f33a4"}
|
|
1664
1673
|
style={columnsCssVars()}
|
|
1665
1674
|
{...{}}
|
|
1666
1675
|
>
|
|
@@ -1689,7 +1698,7 @@ function Columns(props) {
|
|
|
1689
1698
|
/></Dynamic_renderer_default>;
|
|
1690
1699
|
}}</For4>
|
|
1691
1700
|
</div>
|
|
1692
|
-
<style>{`.div-
|
|
1701
|
+
<style>{`.div-3e5f33a4 {
|
|
1693
1702
|
display: flex;
|
|
1694
1703
|
line-height: normal;
|
|
1695
1704
|
}`}</style>
|
|
@@ -1800,7 +1809,7 @@ function Image(props) {
|
|
|
1800
1809
|
<picture>
|
|
1801
1810
|
<Show8 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show8>
|
|
1802
1811
|
<img
|
|
1803
|
-
class={"builder-image" + (props.className ? " " + props.className : "") + " img-
|
|
1812
|
+
class={"builder-image" + (props.className ? " " + props.className : "") + " img-56e07140"}
|
|
1804
1813
|
loading={props.highPriority ? "eager" : "lazy"}
|
|
1805
1814
|
fetchpriority={props.highPriority ? "high" : "auto"}
|
|
1806
1815
|
alt={props.altText}
|
|
@@ -1818,22 +1827,22 @@ function Image(props) {
|
|
|
1818
1827
|
<Show8
|
|
1819
1828
|
when={props.aspectRatio && !(props.builderBlock?.children?.length && props.fitContent)}
|
|
1820
1829
|
><div
|
|
1821
|
-
class="builder-image-sizer div-
|
|
1830
|
+
class="builder-image-sizer div-56e07140"
|
|
1822
1831
|
style={{
|
|
1823
1832
|
"padding-top": props.aspectRatio * 100 + "%"
|
|
1824
1833
|
}}
|
|
1825
1834
|
/></Show8>
|
|
1826
1835
|
<Show8 when={props.builderBlock?.children?.length && props.fitContent}>{props.children}</Show8>
|
|
1827
|
-
<Show8 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-
|
|
1836
|
+
<Show8 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-56e07140-2">{props.children}</div></Show8>
|
|
1828
1837
|
</>
|
|
1829
|
-
<style>{`.img-
|
|
1838
|
+
<style>{`.img-56e07140 {
|
|
1830
1839
|
opacity: 1;
|
|
1831
1840
|
transition: opacity 0.2s ease-in-out;
|
|
1832
|
-
}.div-
|
|
1841
|
+
}.div-56e07140 {
|
|
1833
1842
|
width: 100%;
|
|
1834
1843
|
pointer-events: none;
|
|
1835
1844
|
font-size: 0;
|
|
1836
|
-
}.div-
|
|
1845
|
+
}.div-56e07140-2 {
|
|
1837
1846
|
display: flex;
|
|
1838
1847
|
flex-direction: column;
|
|
1839
1848
|
align-items: stretch;
|
|
@@ -1869,10 +1878,10 @@ function SectionComponent(props) {
|
|
|
1869
1878
|
var section_default = SectionComponent;
|
|
1870
1879
|
|
|
1871
1880
|
// src/blocks/symbol/symbol.tsx
|
|
1872
|
-
import { onMount as onMount8, on as on4, createEffect as createEffect4, createMemo as
|
|
1881
|
+
import { onMount as onMount8, on as on4, createEffect as createEffect4, createMemo as createMemo19, createSignal as createSignal19 } from "solid-js";
|
|
1873
1882
|
|
|
1874
1883
|
// src/components/content-variants/content-variants.tsx
|
|
1875
|
-
import { Show as Show15, For as For9, onMount as onMount7, createSignal as
|
|
1884
|
+
import { Show as Show15, For as For9, onMount as onMount7, createSignal as createSignal18, createMemo as createMemo18 } from "solid-js";
|
|
1876
1885
|
|
|
1877
1886
|
// src/helpers/url.ts
|
|
1878
1887
|
var getTopLevelDomain = (host) => {
|
|
@@ -2066,7 +2075,7 @@ var handleABTesting = async ({
|
|
|
2066
2075
|
var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
|
|
2067
2076
|
|
|
2068
2077
|
// src/components/content/content.tsx
|
|
2069
|
-
import { Show as Show14, createSignal as
|
|
2078
|
+
import { Show as Show14, createSignal as createSignal17 } from "solid-js";
|
|
2070
2079
|
|
|
2071
2080
|
// src/blocks/accordion/component-info.ts
|
|
2072
2081
|
var defaultTitle = {
|
|
@@ -3110,30 +3119,10 @@ var componentInfo10 = {
|
|
|
3110
3119
|
};
|
|
3111
3120
|
|
|
3112
3121
|
// src/blocks/text/text.tsx
|
|
3113
|
-
import { createMemo as createMemo11 } from "solid-js";
|
|
3114
3122
|
function Text(props) {
|
|
3115
|
-
const processedText = createMemo11(() => {
|
|
3116
|
-
const context = props.builderContext;
|
|
3117
|
-
const {
|
|
3118
|
-
context: contextContext,
|
|
3119
|
-
localState,
|
|
3120
|
-
rootState,
|
|
3121
|
-
rootSetState
|
|
3122
|
-
} = context;
|
|
3123
|
-
return String(props.text?.toString() || "").replace(
|
|
3124
|
-
/{{([^}]+)}}/g,
|
|
3125
|
-
(match, group) => evaluate({
|
|
3126
|
-
code: group,
|
|
3127
|
-
context: contextContext,
|
|
3128
|
-
localState,
|
|
3129
|
-
rootState,
|
|
3130
|
-
rootSetState
|
|
3131
|
-
})
|
|
3132
|
-
);
|
|
3133
|
-
});
|
|
3134
3123
|
return <><div
|
|
3135
3124
|
class="builder-text"
|
|
3136
|
-
innerHTML={
|
|
3125
|
+
innerHTML={props.text?.toString() || ""}
|
|
3137
3126
|
style={{
|
|
3138
3127
|
outline: "none"
|
|
3139
3128
|
}}
|
|
@@ -3167,10 +3156,10 @@ var componentInfo11 = {
|
|
|
3167
3156
|
};
|
|
3168
3157
|
|
|
3169
3158
|
// src/blocks/custom-code/custom-code.tsx
|
|
3170
|
-
import { onMount as onMount5, createSignal as
|
|
3159
|
+
import { onMount as onMount5, createSignal as createSignal11 } from "solid-js";
|
|
3171
3160
|
function CustomCode(props) {
|
|
3172
|
-
const [scriptsInserted, setScriptsInserted] =
|
|
3173
|
-
const [scriptsRun, setScriptsRun] =
|
|
3161
|
+
const [scriptsInserted, setScriptsInserted] = createSignal11([]);
|
|
3162
|
+
const [scriptsRun, setScriptsRun] = createSignal11([]);
|
|
3174
3163
|
let elementRef;
|
|
3175
3164
|
onMount5(() => {
|
|
3176
3165
|
if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
|
|
@@ -3231,7 +3220,7 @@ var componentInfo12 = {
|
|
|
3231
3220
|
};
|
|
3232
3221
|
|
|
3233
3222
|
// src/blocks/embed/embed.tsx
|
|
3234
|
-
import { on as on2, createEffect as createEffect2, createMemo as
|
|
3223
|
+
import { on as on2, createEffect as createEffect2, createMemo as createMemo12, createSignal as createSignal12 } from "solid-js";
|
|
3235
3224
|
|
|
3236
3225
|
// src/blocks/embed/helpers.ts
|
|
3237
3226
|
var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
|
|
@@ -3239,9 +3228,9 @@ var isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
|
|
|
3239
3228
|
|
|
3240
3229
|
// src/blocks/embed/embed.tsx
|
|
3241
3230
|
function Embed(props) {
|
|
3242
|
-
const [scriptsInserted, setScriptsInserted] =
|
|
3243
|
-
const [scriptsRun, setScriptsRun] =
|
|
3244
|
-
const [ranInitFn, setRanInitFn] =
|
|
3231
|
+
const [scriptsInserted, setScriptsInserted] = createSignal12([]);
|
|
3232
|
+
const [scriptsRun, setScriptsRun] = createSignal12([]);
|
|
3233
|
+
const [ranInitFn, setRanInitFn] = createSignal12(false);
|
|
3245
3234
|
function findAndRunScripts() {
|
|
3246
3235
|
if (!elem || !elem.getElementsByTagName)
|
|
3247
3236
|
return;
|
|
@@ -3264,8 +3253,8 @@ function Embed(props) {
|
|
|
3264
3253
|
}
|
|
3265
3254
|
}
|
|
3266
3255
|
let elem;
|
|
3267
|
-
const onUpdateFn_0_elem =
|
|
3268
|
-
const onUpdateFn_0_ranInitFn__ =
|
|
3256
|
+
const onUpdateFn_0_elem = createMemo12(() => elem);
|
|
3257
|
+
const onUpdateFn_0_ranInitFn__ = createMemo12(() => ranInitFn());
|
|
3269
3258
|
function onUpdateFn_0() {
|
|
3270
3259
|
if (elem && !ranInitFn()) {
|
|
3271
3260
|
setRanInitFn(true);
|
|
@@ -3520,7 +3509,7 @@ var componentInfo13 = {
|
|
|
3520
3509
|
};
|
|
3521
3510
|
|
|
3522
3511
|
// src/blocks/form/form/form.tsx
|
|
3523
|
-
import { Show as Show11, For as For7, createSignal as
|
|
3512
|
+
import { Show as Show11, For as For7, createSignal as createSignal13 } from "solid-js";
|
|
3524
3513
|
|
|
3525
3514
|
// src/functions/get-env.ts
|
|
3526
3515
|
var validEnvList = ["production", "qa", "test", "development", "dev", "cdn-qa", "cloud", "fast", "cdn2", "cdn-prod"];
|
|
@@ -3540,9 +3529,9 @@ function logFetch(url) {
|
|
|
3540
3529
|
|
|
3541
3530
|
// src/blocks/form/form/form.tsx
|
|
3542
3531
|
function FormComponent(props) {
|
|
3543
|
-
const [formState, setFormState] =
|
|
3544
|
-
const [responseData, setResponseData] =
|
|
3545
|
-
const [formErrorMessage, setFormErrorMessage] =
|
|
3532
|
+
const [formState, setFormState] = createSignal13("unsubmitted");
|
|
3533
|
+
const [responseData, setResponseData] = createSignal13(null);
|
|
3534
|
+
const [formErrorMessage, setFormErrorMessage] = createSignal13("");
|
|
3546
3535
|
function mergeNewRootState(newData) {
|
|
3547
3536
|
const combinedState = {
|
|
3548
3537
|
...props.builderContext.rootState,
|
|
@@ -3757,14 +3746,14 @@ function FormComponent(props) {
|
|
|
3757
3746
|
blocks={props.sendingMessage}
|
|
3758
3747
|
context={props.builderContext}
|
|
3759
3748
|
/></Show11>
|
|
3760
|
-
<Show11 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-
|
|
3749
|
+
<Show11 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-27d18614">{JSON.stringify(responseData(), null, 2)}</pre></Show11>
|
|
3761
3750
|
<Show11 when={submissionState() === "success"}><Blocks_default
|
|
3762
3751
|
path="successMessage"
|
|
3763
3752
|
blocks={props.successMessage}
|
|
3764
3753
|
context={props.builderContext}
|
|
3765
3754
|
/></Show11>
|
|
3766
3755
|
</form>
|
|
3767
|
-
<style>{`.pre-
|
|
3756
|
+
<style>{`.pre-27d18614 {
|
|
3768
3757
|
padding: 10px;
|
|
3769
3758
|
color: red;
|
|
3770
3759
|
text-align: center;
|
|
@@ -4114,9 +4103,9 @@ var componentInfo19 = {
|
|
|
4114
4103
|
};
|
|
4115
4104
|
|
|
4116
4105
|
// src/blocks/video/video.tsx
|
|
4117
|
-
import { Show as Show12, createMemo as
|
|
4106
|
+
import { Show as Show12, createMemo as createMemo14 } from "solid-js";
|
|
4118
4107
|
function Video(props) {
|
|
4119
|
-
const videoProps =
|
|
4108
|
+
const videoProps = createMemo14(() => {
|
|
4120
4109
|
return {
|
|
4121
4110
|
...props.autoPlay === true ? {
|
|
4122
4111
|
autoPlay: true
|
|
@@ -4135,7 +4124,7 @@ function Video(props) {
|
|
|
4135
4124
|
} : {}
|
|
4136
4125
|
};
|
|
4137
4126
|
});
|
|
4138
|
-
const spreadProps =
|
|
4127
|
+
const spreadProps = createMemo14(() => {
|
|
4139
4128
|
return {
|
|
4140
4129
|
...videoProps()
|
|
4141
4130
|
};
|
|
@@ -4345,8 +4334,8 @@ import {
|
|
|
4345
4334
|
onMount as onMount6,
|
|
4346
4335
|
on as on3,
|
|
4347
4336
|
createEffect as createEffect3,
|
|
4348
|
-
createMemo as
|
|
4349
|
-
createSignal as
|
|
4337
|
+
createMemo as createMemo15,
|
|
4338
|
+
createSignal as createSignal15
|
|
4350
4339
|
} from "solid-js";
|
|
4351
4340
|
import { Dynamic as Dynamic5 } from "solid-js/web";
|
|
4352
4341
|
|
|
@@ -4356,7 +4345,7 @@ function getPreviewContent(_searchParams) {
|
|
|
4356
4345
|
}
|
|
4357
4346
|
|
|
4358
4347
|
// src/constants/sdk-version.ts
|
|
4359
|
-
var SDK_VERSION = "3.0.
|
|
4348
|
+
var SDK_VERSION = "3.0.3";
|
|
4360
4349
|
|
|
4361
4350
|
// src/helpers/sdk-headers.ts
|
|
4362
4351
|
var getSdkHeaders = () => ({
|
|
@@ -4419,6 +4408,23 @@ function flattenMongoQuery(obj, _current, _res = {}) {
|
|
|
4419
4408
|
}
|
|
4420
4409
|
return _res;
|
|
4421
4410
|
}
|
|
4411
|
+
function unflatten(obj) {
|
|
4412
|
+
const result = {};
|
|
4413
|
+
for (const key in obj) {
|
|
4414
|
+
const parts = key.split(".");
|
|
4415
|
+
let current = result;
|
|
4416
|
+
for (let i = 0; i < parts.length; i++) {
|
|
4417
|
+
const part = parts[i];
|
|
4418
|
+
if (i === parts.length - 1) {
|
|
4419
|
+
current[part] = obj[key];
|
|
4420
|
+
} else {
|
|
4421
|
+
current[part] = current[part] || {};
|
|
4422
|
+
current = current[part];
|
|
4423
|
+
}
|
|
4424
|
+
}
|
|
4425
|
+
}
|
|
4426
|
+
return result;
|
|
4427
|
+
}
|
|
4422
4428
|
|
|
4423
4429
|
// src/types/api-version.ts
|
|
4424
4430
|
var DEFAULT_API_VERSION = "v3";
|
|
@@ -4483,7 +4489,7 @@ var generateContentUrl = (options) => {
|
|
|
4483
4489
|
url.searchParams.set("noTraverse", String(noTraverse));
|
|
4484
4490
|
url.searchParams.set("includeRefs", String(true));
|
|
4485
4491
|
const finalLocale = locale || userAttributes?.locale;
|
|
4486
|
-
let finalUserAttributes = userAttributes;
|
|
4492
|
+
let finalUserAttributes = userAttributes || {};
|
|
4487
4493
|
if (finalLocale) {
|
|
4488
4494
|
url.searchParams.set("locale", finalLocale);
|
|
4489
4495
|
finalUserAttributes = {
|
|
@@ -4521,11 +4527,15 @@ var generateContentUrl = (options) => {
|
|
|
4521
4527
|
...getBuilderSearchParamsFromWindow(),
|
|
4522
4528
|
...normalizeSearchParams(options.options || {})
|
|
4523
4529
|
};
|
|
4530
|
+
finalUserAttributes = {
|
|
4531
|
+
...finalUserAttributes,
|
|
4532
|
+
...getUserAttributesAsJSON(queryOptions)
|
|
4533
|
+
};
|
|
4524
4534
|
const flattened = flatten(queryOptions);
|
|
4525
4535
|
for (const key in flattened) {
|
|
4526
4536
|
url.searchParams.set(key, String(flattened[key]));
|
|
4527
4537
|
}
|
|
4528
|
-
if (finalUserAttributes) {
|
|
4538
|
+
if (Object.keys(finalUserAttributes).length > 0) {
|
|
4529
4539
|
url.searchParams.set("userAttributes", JSON.stringify(finalUserAttributes));
|
|
4530
4540
|
}
|
|
4531
4541
|
if (query) {
|
|
@@ -4538,6 +4548,28 @@ var generateContentUrl = (options) => {
|
|
|
4538
4548
|
}
|
|
4539
4549
|
return url;
|
|
4540
4550
|
};
|
|
4551
|
+
var getUserAttributesFromQueryOptions = (queryOptions) => {
|
|
4552
|
+
const newUserAttributes = {};
|
|
4553
|
+
for (const key in queryOptions) {
|
|
4554
|
+
if (key.startsWith("userAttributes.")) {
|
|
4555
|
+
newUserAttributes[key] = queryOptions[key];
|
|
4556
|
+
delete queryOptions[key];
|
|
4557
|
+
}
|
|
4558
|
+
}
|
|
4559
|
+
return newUserAttributes;
|
|
4560
|
+
};
|
|
4561
|
+
var getUserAttributesAsJSON = (queryOptions) => {
|
|
4562
|
+
if (isBrowser() && queryOptions["preview"] === "BUILDER_STUDIO") {
|
|
4563
|
+
queryOptions["userAttributes.urlPath"] = window.location.pathname;
|
|
4564
|
+
queryOptions["userAttributes.host"] = window.location.host;
|
|
4565
|
+
const queryOptionsForUserAttributes = getUserAttributesFromQueryOptions(queryOptions);
|
|
4566
|
+
const {
|
|
4567
|
+
userAttributes
|
|
4568
|
+
} = unflatten(queryOptionsForUserAttributes);
|
|
4569
|
+
return userAttributes;
|
|
4570
|
+
}
|
|
4571
|
+
return {};
|
|
4572
|
+
};
|
|
4541
4573
|
|
|
4542
4574
|
// src/functions/get-content/index.ts
|
|
4543
4575
|
var checkContentHasResults = (content) => "results" in content;
|
|
@@ -5155,12 +5187,12 @@ var getWrapperClassName = (variationId) => {
|
|
|
5155
5187
|
|
|
5156
5188
|
// src/components/content/components/enable-editor.tsx
|
|
5157
5189
|
function EnableEditor(props) {
|
|
5158
|
-
const [ContentWrapper, setContentWrapper] =
|
|
5190
|
+
const [ContentWrapper, setContentWrapper] = createSignal15(
|
|
5159
5191
|
props.contentWrapper || "div"
|
|
5160
5192
|
);
|
|
5161
|
-
const [httpReqsData, setHttpReqsData] =
|
|
5162
|
-
const [httpReqsPending, setHttpReqsPending] =
|
|
5163
|
-
const [clicked, setClicked] =
|
|
5193
|
+
const [httpReqsData, setHttpReqsData] = createSignal15({});
|
|
5194
|
+
const [httpReqsPending, setHttpReqsPending] = createSignal15({});
|
|
5195
|
+
const [clicked, setClicked] = createSignal15(false);
|
|
5164
5196
|
function mergeNewRootState(newData) {
|
|
5165
5197
|
const combinedState = {
|
|
5166
5198
|
...props.builderContextSignal.rootState,
|
|
@@ -5194,7 +5226,7 @@ function EnableEditor(props) {
|
|
|
5194
5226
|
content: newContentValue
|
|
5195
5227
|
}));
|
|
5196
5228
|
}
|
|
5197
|
-
const showContentProps =
|
|
5229
|
+
const showContentProps = createMemo15(() => {
|
|
5198
5230
|
return props.showContent ? {} : {
|
|
5199
5231
|
hidden: true,
|
|
5200
5232
|
"aria-hidden": true
|
|
@@ -5350,11 +5382,16 @@ function EnableEditor(props) {
|
|
|
5350
5382
|
`builder.overrides.${searchParamPreviewModel}`
|
|
5351
5383
|
);
|
|
5352
5384
|
const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
|
|
5353
|
-
if (searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
|
|
5385
|
+
if (searchParamPreviewModel === "BUILDER_STUDIO" || searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
|
|
5354
5386
|
fetchOneEntry({
|
|
5355
|
-
model: props.model,
|
|
5387
|
+
model: props.model || "",
|
|
5356
5388
|
apiKey: props.apiKey,
|
|
5357
|
-
apiVersion: props.builderContextSignal.apiVersion
|
|
5389
|
+
apiVersion: props.builderContextSignal.apiVersion,
|
|
5390
|
+
...searchParamPreviewModel === "BUILDER_STUDIO" && props.context?.symbolId ? {
|
|
5391
|
+
query: {
|
|
5392
|
+
id: props.context.symbolId
|
|
5393
|
+
}
|
|
5394
|
+
} : {}
|
|
5358
5395
|
}).then((content) => {
|
|
5359
5396
|
if (content) {
|
|
5360
5397
|
mergeNewContent(content);
|
|
@@ -5364,14 +5401,14 @@ function EnableEditor(props) {
|
|
|
5364
5401
|
}
|
|
5365
5402
|
}
|
|
5366
5403
|
});
|
|
5367
|
-
const onUpdateFn_0_props_content =
|
|
5404
|
+
const onUpdateFn_0_props_content = createMemo15(() => props.content);
|
|
5368
5405
|
function onUpdateFn_0() {
|
|
5369
5406
|
if (props.content) {
|
|
5370
5407
|
mergeNewContent(props.content);
|
|
5371
5408
|
}
|
|
5372
5409
|
}
|
|
5373
5410
|
createEffect3(on3(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
|
|
5374
|
-
const onUpdateFn_1_props_builderContextSignal_rootState =
|
|
5411
|
+
const onUpdateFn_1_props_builderContextSignal_rootState = createMemo15(
|
|
5375
5412
|
() => props.builderContextSignal.rootState
|
|
5376
5413
|
);
|
|
5377
5414
|
function onUpdateFn_1() {
|
|
@@ -5383,14 +5420,14 @@ function EnableEditor(props) {
|
|
|
5383
5420
|
onUpdateFn_1
|
|
5384
5421
|
)
|
|
5385
5422
|
);
|
|
5386
|
-
const onUpdateFn_2_props_data =
|
|
5423
|
+
const onUpdateFn_2_props_data = createMemo15(() => props.data);
|
|
5387
5424
|
function onUpdateFn_2() {
|
|
5388
5425
|
if (props.data) {
|
|
5389
5426
|
mergeNewRootState(props.data);
|
|
5390
5427
|
}
|
|
5391
5428
|
}
|
|
5392
5429
|
createEffect3(on3(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
|
|
5393
|
-
const onUpdateFn_3_props_locale =
|
|
5430
|
+
const onUpdateFn_3_props_locale = createMemo15(() => props.locale);
|
|
5394
5431
|
function onUpdateFn_3() {
|
|
5395
5432
|
if (props.locale) {
|
|
5396
5433
|
mergeNewRootState({
|
|
@@ -5422,9 +5459,9 @@ function EnableEditor(props) {
|
|
|
5422
5459
|
var Enable_editor_default = EnableEditor;
|
|
5423
5460
|
|
|
5424
5461
|
// src/components/content/components/styles.tsx
|
|
5425
|
-
import { createSignal as
|
|
5462
|
+
import { createSignal as createSignal16 } from "solid-js";
|
|
5426
5463
|
function ContentStyles(props) {
|
|
5427
|
-
const [injectedStyles, setInjectedStyles] =
|
|
5464
|
+
const [injectedStyles, setInjectedStyles] = createSignal16(
|
|
5428
5465
|
`
|
|
5429
5466
|
${getCss({
|
|
5430
5467
|
cssCode: props.cssCode,
|
|
@@ -5482,7 +5519,7 @@ var getContentInitialValue = ({
|
|
|
5482
5519
|
|
|
5483
5520
|
// src/components/content/content.tsx
|
|
5484
5521
|
function ContentComponent(props) {
|
|
5485
|
-
const [scriptStr, setScriptStr] =
|
|
5522
|
+
const [scriptStr, setScriptStr] = createSignal17(
|
|
5486
5523
|
getUpdateVariantVisibilityScript({
|
|
5487
5524
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
5488
5525
|
variationId: props.content?.testVariationId,
|
|
@@ -5490,7 +5527,7 @@ function ContentComponent(props) {
|
|
|
5490
5527
|
contentId: props.content?.id
|
|
5491
5528
|
})
|
|
5492
5529
|
);
|
|
5493
|
-
const [registeredComponents, setRegisteredComponents] =
|
|
5530
|
+
const [registeredComponents, setRegisteredComponents] = createSignal17(
|
|
5494
5531
|
[
|
|
5495
5532
|
...getDefaultRegisteredComponents(),
|
|
5496
5533
|
...props.customComponents || []
|
|
@@ -5505,7 +5542,7 @@ function ContentComponent(props) {
|
|
|
5505
5542
|
{}
|
|
5506
5543
|
)
|
|
5507
5544
|
);
|
|
5508
|
-
const [builderContextSignal, setBuilderContextSignal] =
|
|
5545
|
+
const [builderContextSignal, setBuilderContextSignal] = createSignal17({
|
|
5509
5546
|
content: getContentInitialValue({
|
|
5510
5547
|
content: props.content,
|
|
5511
5548
|
data: props.data
|
|
@@ -5613,13 +5650,13 @@ var Content_default = ContentComponent;
|
|
|
5613
5650
|
|
|
5614
5651
|
// src/components/content-variants/content-variants.tsx
|
|
5615
5652
|
function ContentVariants(props) {
|
|
5616
|
-
const [shouldRenderVariants, setShouldRenderVariants] =
|
|
5653
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal18(
|
|
5617
5654
|
checkShouldRenderVariants({
|
|
5618
5655
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
5619
5656
|
content: props.content
|
|
5620
5657
|
})
|
|
5621
5658
|
);
|
|
5622
|
-
const updateCookieAndStylesScriptStr =
|
|
5659
|
+
const updateCookieAndStylesScriptStr = createMemo18(() => {
|
|
5623
5660
|
return getUpdateCookieAndStylesScript(
|
|
5624
5661
|
getVariants(props.content).map((value) => ({
|
|
5625
5662
|
id: value.testVariationId,
|
|
@@ -5628,10 +5665,10 @@ function ContentVariants(props) {
|
|
|
5628
5665
|
props.content?.id || ""
|
|
5629
5666
|
);
|
|
5630
5667
|
});
|
|
5631
|
-
const hideVariantsStyleString =
|
|
5668
|
+
const hideVariantsStyleString = createMemo18(() => {
|
|
5632
5669
|
return getVariants(props.content).map((value) => `.variant-${value.testVariationId} { display: none; } `).join("");
|
|
5633
5670
|
});
|
|
5634
|
-
const defaultContent =
|
|
5671
|
+
const defaultContent = createMemo18(() => {
|
|
5635
5672
|
return shouldRenderVariants() ? {
|
|
5636
5673
|
...props.content,
|
|
5637
5674
|
testVariationId: props.content?.id
|
|
@@ -5743,14 +5780,14 @@ var fetchSymbolContent = async ({
|
|
|
5743
5780
|
|
|
5744
5781
|
// src/blocks/symbol/symbol.tsx
|
|
5745
5782
|
function Symbol(props) {
|
|
5746
|
-
const [contentToUse, setContentToUse] =
|
|
5747
|
-
const blocksWrapper =
|
|
5783
|
+
const [contentToUse, setContentToUse] = createSignal19(props.symbol?.content);
|
|
5784
|
+
const blocksWrapper = createMemo19(() => {
|
|
5748
5785
|
return "div";
|
|
5749
5786
|
});
|
|
5750
|
-
const contentWrapper =
|
|
5787
|
+
const contentWrapper = createMemo19(() => {
|
|
5751
5788
|
return "div";
|
|
5752
5789
|
});
|
|
5753
|
-
const className =
|
|
5790
|
+
const className = createMemo19(() => {
|
|
5754
5791
|
return [
|
|
5755
5792
|
...[props.attributes[getClassPropName()]],
|
|
5756
5793
|
"builder-symbol",
|
|
@@ -5772,7 +5809,7 @@ function Symbol(props) {
|
|
|
5772
5809
|
}
|
|
5773
5810
|
onMount8(() => {
|
|
5774
5811
|
});
|
|
5775
|
-
const onUpdateFn_0_props_symbol =
|
|
5812
|
+
const onUpdateFn_0_props_symbol = createMemo19(() => props.symbol);
|
|
5776
5813
|
function onUpdateFn_0() {
|
|
5777
5814
|
setContent();
|
|
5778
5815
|
}
|