@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/node/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 = {
|
|
@@ -579,6 +562,38 @@ function evaluate({
|
|
|
579
562
|
}
|
|
580
563
|
}
|
|
581
564
|
|
|
565
|
+
// src/functions/get-block-component-options.ts
|
|
566
|
+
function getBlockComponentOptions(block, context) {
|
|
567
|
+
return {
|
|
568
|
+
...block.component?.options,
|
|
569
|
+
...block.options,
|
|
570
|
+
...evaluateTextComponentTextOption(block, context)
|
|
571
|
+
};
|
|
572
|
+
}
|
|
573
|
+
var evaluateTextComponentTextOption = (block, context) => {
|
|
574
|
+
if (block.component?.name === "Text" && block.component.options?.text && typeof block.component.options.text === "string") {
|
|
575
|
+
return {
|
|
576
|
+
...block.component.options,
|
|
577
|
+
text: block.component.options.text.replace(/{{([^}]+)}}/g, (_match, group) => evaluate({
|
|
578
|
+
code: group,
|
|
579
|
+
context,
|
|
580
|
+
localState: context.localState,
|
|
581
|
+
rootState: context.rootState,
|
|
582
|
+
rootSetState: context.rootSetState
|
|
583
|
+
}))
|
|
584
|
+
};
|
|
585
|
+
}
|
|
586
|
+
};
|
|
587
|
+
|
|
588
|
+
// src/helpers/omit.ts
|
|
589
|
+
function omit(obj, ...values) {
|
|
590
|
+
const newObject = Object.assign({}, obj);
|
|
591
|
+
for (const key of values) {
|
|
592
|
+
delete newObject[key];
|
|
593
|
+
}
|
|
594
|
+
return newObject;
|
|
595
|
+
}
|
|
596
|
+
|
|
582
597
|
// src/functions/traverse.ts
|
|
583
598
|
function traverse(obj, callback, parent2 = null, key = null, visited = /* @__PURE__ */ new WeakSet()) {
|
|
584
599
|
if (obj == null || typeof obj !== "object") {
|
|
@@ -730,24 +745,19 @@ var evaluateBindings = ({
|
|
|
730
745
|
function getProcessedBlock({
|
|
731
746
|
block,
|
|
732
747
|
context,
|
|
733
|
-
shouldEvaluateBindings,
|
|
734
748
|
localState,
|
|
735
749
|
rootState,
|
|
736
750
|
rootSetState
|
|
737
751
|
}) {
|
|
738
752
|
let transformedBlock = resolveLocalizedValues(block, rootState.locale);
|
|
739
753
|
transformedBlock = transformBlock(transformedBlock);
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
});
|
|
748
|
-
} else {
|
|
749
|
-
return transformedBlock;
|
|
750
|
-
}
|
|
754
|
+
return evaluateBindings({
|
|
755
|
+
block: transformedBlock,
|
|
756
|
+
localState,
|
|
757
|
+
rootState,
|
|
758
|
+
rootSetState,
|
|
759
|
+
context
|
|
760
|
+
});
|
|
751
761
|
}
|
|
752
762
|
|
|
753
763
|
// src/functions/camel-to-kebab-case.ts
|
|
@@ -1469,8 +1479,7 @@ function Block(props) {
|
|
|
1469
1479
|
localState: props.context.localState,
|
|
1470
1480
|
rootState: props.context.rootState,
|
|
1471
1481
|
rootSetState: props.context.rootSetState,
|
|
1472
|
-
context: props.context.context
|
|
1473
|
-
shouldEvaluateBindings: true
|
|
1482
|
+
context: props.context.context
|
|
1474
1483
|
});
|
|
1475
1484
|
return blockToUse;
|
|
1476
1485
|
});
|
|
@@ -1507,7 +1516,7 @@ function Block(props) {
|
|
|
1507
1516
|
blockChildren: processedBlock().children ?? [],
|
|
1508
1517
|
componentRef: blockComponent()?.component,
|
|
1509
1518
|
componentOptions: {
|
|
1510
|
-
...getBlockComponentOptions(processedBlock()),
|
|
1519
|
+
...getBlockComponentOptions(processedBlock(), props.context),
|
|
1511
1520
|
...provideBuilderBlock(blockComponent(), processedBlock()),
|
|
1512
1521
|
...provideBuilderContext(blockComponent(), props.context),
|
|
1513
1522
|
...provideLinkComponent(blockComponent(), props.linkComponent),
|
|
@@ -1661,7 +1670,7 @@ function BlocksWrapper(props) {
|
|
|
1661
1670
|
});
|
|
1662
1671
|
return <>
|
|
1663
1672
|
<Dynamic4
|
|
1664
|
-
class={className() + " dynamic-
|
|
1673
|
+
class={className() + " dynamic-3c4beb0c"}
|
|
1665
1674
|
ref={blocksWrapperRef}
|
|
1666
1675
|
builder-path={dataPath()}
|
|
1667
1676
|
builder-parent-id={props.parent}
|
|
@@ -1673,7 +1682,7 @@ function BlocksWrapper(props) {
|
|
|
1673
1682
|
{...props.BlocksWrapperProps}
|
|
1674
1683
|
component={props.BlocksWrapper}
|
|
1675
1684
|
>{props.children}</Dynamic4>
|
|
1676
|
-
<style>{`.dynamic-
|
|
1685
|
+
<style>{`.dynamic-3c4beb0c {
|
|
1677
1686
|
display: flex;
|
|
1678
1687
|
flex-direction: column;
|
|
1679
1688
|
align-items: stretch;
|
|
@@ -1838,7 +1847,7 @@ function Columns(props) {
|
|
|
1838
1847
|
}
|
|
1839
1848
|
return <>
|
|
1840
1849
|
<div
|
|
1841
|
-
class={getColumnsClass(props.builderBlock?.id) + " div-
|
|
1850
|
+
class={getColumnsClass(props.builderBlock?.id) + " div-3e5f33a4"}
|
|
1842
1851
|
style={columnsCssVars()}
|
|
1843
1852
|
{...{}}
|
|
1844
1853
|
>
|
|
@@ -1867,7 +1876,7 @@ function Columns(props) {
|
|
|
1867
1876
|
/></Dynamic_renderer_default>;
|
|
1868
1877
|
}}</For4>
|
|
1869
1878
|
</div>
|
|
1870
|
-
<style>{`.div-
|
|
1879
|
+
<style>{`.div-3e5f33a4 {
|
|
1871
1880
|
display: flex;
|
|
1872
1881
|
line-height: normal;
|
|
1873
1882
|
}`}</style>
|
|
@@ -1979,7 +1988,7 @@ function Image(props) {
|
|
|
1979
1988
|
<picture>
|
|
1980
1989
|
<Show8 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show8>
|
|
1981
1990
|
<img
|
|
1982
|
-
class={"builder-image" + (props.className ? " " + props.className : "") + " img-
|
|
1991
|
+
class={"builder-image" + (props.className ? " " + props.className : "") + " img-56e07140"}
|
|
1983
1992
|
loading={props.highPriority ? "eager" : "lazy"}
|
|
1984
1993
|
fetchpriority={props.highPriority ? "high" : "auto"}
|
|
1985
1994
|
alt={props.altText}
|
|
@@ -1997,22 +2006,22 @@ function Image(props) {
|
|
|
1997
2006
|
<Show8
|
|
1998
2007
|
when={props.aspectRatio && !(props.builderBlock?.children?.length && props.fitContent)}
|
|
1999
2008
|
><div
|
|
2000
|
-
class="builder-image-sizer div-
|
|
2009
|
+
class="builder-image-sizer div-56e07140"
|
|
2001
2010
|
style={{
|
|
2002
2011
|
"padding-top": props.aspectRatio * 100 + "%"
|
|
2003
2012
|
}}
|
|
2004
2013
|
/></Show8>
|
|
2005
2014
|
<Show8 when={props.builderBlock?.children?.length && props.fitContent}>{props.children}</Show8>
|
|
2006
|
-
<Show8 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-
|
|
2015
|
+
<Show8 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-56e07140-2">{props.children}</div></Show8>
|
|
2007
2016
|
</>
|
|
2008
|
-
<style>{`.img-
|
|
2017
|
+
<style>{`.img-56e07140 {
|
|
2009
2018
|
opacity: 1;
|
|
2010
2019
|
transition: opacity 0.2s ease-in-out;
|
|
2011
|
-
}.div-
|
|
2020
|
+
}.div-56e07140 {
|
|
2012
2021
|
width: 100%;
|
|
2013
2022
|
pointer-events: none;
|
|
2014
2023
|
font-size: 0;
|
|
2015
|
-
}.div-
|
|
2024
|
+
}.div-56e07140-2 {
|
|
2016
2025
|
display: flex;
|
|
2017
2026
|
flex-direction: column;
|
|
2018
2027
|
align-items: stretch;
|
|
@@ -2048,10 +2057,10 @@ function SectionComponent(props) {
|
|
|
2048
2057
|
var section_default = SectionComponent;
|
|
2049
2058
|
|
|
2050
2059
|
// src/blocks/symbol/symbol.tsx
|
|
2051
|
-
import { onMount as onMount8, on as on4, createEffect as createEffect4, createMemo as
|
|
2060
|
+
import { onMount as onMount8, on as on4, createEffect as createEffect4, createMemo as createMemo19, createSignal as createSignal19 } from "solid-js";
|
|
2052
2061
|
|
|
2053
2062
|
// src/components/content-variants/content-variants.tsx
|
|
2054
|
-
import { Show as Show15, For as For9, onMount as onMount7, createSignal as
|
|
2063
|
+
import { Show as Show15, For as For9, onMount as onMount7, createSignal as createSignal18, createMemo as createMemo18 } from "solid-js";
|
|
2055
2064
|
|
|
2056
2065
|
// src/helpers/url.ts
|
|
2057
2066
|
var getTopLevelDomain = (host) => {
|
|
@@ -2245,7 +2254,7 @@ var handleABTesting = async ({
|
|
|
2245
2254
|
var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
|
|
2246
2255
|
|
|
2247
2256
|
// src/components/content/content.tsx
|
|
2248
|
-
import { Show as Show14, createSignal as
|
|
2257
|
+
import { Show as Show14, createSignal as createSignal17 } from "solid-js";
|
|
2249
2258
|
|
|
2250
2259
|
// src/blocks/accordion/component-info.ts
|
|
2251
2260
|
var defaultTitle = {
|
|
@@ -3290,30 +3299,10 @@ var componentInfo10 = {
|
|
|
3290
3299
|
};
|
|
3291
3300
|
|
|
3292
3301
|
// src/blocks/text/text.tsx
|
|
3293
|
-
import { createMemo as createMemo11 } from "solid-js";
|
|
3294
3302
|
function Text(props) {
|
|
3295
|
-
const processedText = createMemo11(() => {
|
|
3296
|
-
const context = props.builderContext;
|
|
3297
|
-
const {
|
|
3298
|
-
context: contextContext,
|
|
3299
|
-
localState,
|
|
3300
|
-
rootState,
|
|
3301
|
-
rootSetState
|
|
3302
|
-
} = context;
|
|
3303
|
-
return String(props.text?.toString() || "").replace(
|
|
3304
|
-
/{{([^}]+)}}/g,
|
|
3305
|
-
(match, group) => evaluate({
|
|
3306
|
-
code: group,
|
|
3307
|
-
context: contextContext,
|
|
3308
|
-
localState,
|
|
3309
|
-
rootState,
|
|
3310
|
-
rootSetState
|
|
3311
|
-
})
|
|
3312
|
-
);
|
|
3313
|
-
});
|
|
3314
3303
|
return <><div
|
|
3315
3304
|
class="builder-text"
|
|
3316
|
-
innerHTML={
|
|
3305
|
+
innerHTML={props.text?.toString() || ""}
|
|
3317
3306
|
style={{
|
|
3318
3307
|
outline: "none"
|
|
3319
3308
|
}}
|
|
@@ -3347,10 +3336,10 @@ var componentInfo11 = {
|
|
|
3347
3336
|
};
|
|
3348
3337
|
|
|
3349
3338
|
// src/blocks/custom-code/custom-code.tsx
|
|
3350
|
-
import { onMount as onMount5, createSignal as
|
|
3339
|
+
import { onMount as onMount5, createSignal as createSignal11 } from "solid-js";
|
|
3351
3340
|
function CustomCode(props) {
|
|
3352
|
-
const [scriptsInserted, setScriptsInserted] =
|
|
3353
|
-
const [scriptsRun, setScriptsRun] =
|
|
3341
|
+
const [scriptsInserted, setScriptsInserted] = createSignal11([]);
|
|
3342
|
+
const [scriptsRun, setScriptsRun] = createSignal11([]);
|
|
3354
3343
|
let elementRef;
|
|
3355
3344
|
onMount5(() => {
|
|
3356
3345
|
if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
|
|
@@ -3412,7 +3401,7 @@ var componentInfo12 = {
|
|
|
3412
3401
|
};
|
|
3413
3402
|
|
|
3414
3403
|
// src/blocks/embed/embed.tsx
|
|
3415
|
-
import { on as on2, createEffect as createEffect2, createMemo as
|
|
3404
|
+
import { on as on2, createEffect as createEffect2, createMemo as createMemo12, createSignal as createSignal12 } from "solid-js";
|
|
3416
3405
|
|
|
3417
3406
|
// src/blocks/embed/helpers.ts
|
|
3418
3407
|
var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
|
|
@@ -3420,9 +3409,9 @@ var isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
|
|
|
3420
3409
|
|
|
3421
3410
|
// src/blocks/embed/embed.tsx
|
|
3422
3411
|
function Embed(props) {
|
|
3423
|
-
const [scriptsInserted, setScriptsInserted] =
|
|
3424
|
-
const [scriptsRun, setScriptsRun] =
|
|
3425
|
-
const [ranInitFn, setRanInitFn] =
|
|
3412
|
+
const [scriptsInserted, setScriptsInserted] = createSignal12([]);
|
|
3413
|
+
const [scriptsRun, setScriptsRun] = createSignal12([]);
|
|
3414
|
+
const [ranInitFn, setRanInitFn] = createSignal12(false);
|
|
3426
3415
|
function findAndRunScripts() {
|
|
3427
3416
|
if (!elem || !elem.getElementsByTagName)
|
|
3428
3417
|
return;
|
|
@@ -3446,8 +3435,8 @@ function Embed(props) {
|
|
|
3446
3435
|
}
|
|
3447
3436
|
}
|
|
3448
3437
|
let elem;
|
|
3449
|
-
const onUpdateFn_0_elem =
|
|
3450
|
-
const onUpdateFn_0_ranInitFn__ =
|
|
3438
|
+
const onUpdateFn_0_elem = createMemo12(() => elem);
|
|
3439
|
+
const onUpdateFn_0_ranInitFn__ = createMemo12(() => ranInitFn());
|
|
3451
3440
|
function onUpdateFn_0() {
|
|
3452
3441
|
if (elem && !ranInitFn()) {
|
|
3453
3442
|
setRanInitFn(true);
|
|
@@ -3702,7 +3691,7 @@ var componentInfo13 = {
|
|
|
3702
3691
|
};
|
|
3703
3692
|
|
|
3704
3693
|
// src/blocks/form/form/form.tsx
|
|
3705
|
-
import { Show as Show11, For as For7, createSignal as
|
|
3694
|
+
import { Show as Show11, For as For7, createSignal as createSignal13 } from "solid-js";
|
|
3706
3695
|
|
|
3707
3696
|
// src/functions/get-env.ts
|
|
3708
3697
|
var validEnvList = ["production", "qa", "test", "development", "dev", "cdn-qa", "cloud", "fast", "cdn2", "cdn-prod"];
|
|
@@ -3722,9 +3711,9 @@ function logFetch(url) {
|
|
|
3722
3711
|
|
|
3723
3712
|
// src/blocks/form/form/form.tsx
|
|
3724
3713
|
function FormComponent(props) {
|
|
3725
|
-
const [formState, setFormState] =
|
|
3726
|
-
const [responseData, setResponseData] =
|
|
3727
|
-
const [formErrorMessage, setFormErrorMessage] =
|
|
3714
|
+
const [formState, setFormState] = createSignal13("unsubmitted");
|
|
3715
|
+
const [responseData, setResponseData] = createSignal13(null);
|
|
3716
|
+
const [formErrorMessage, setFormErrorMessage] = createSignal13("");
|
|
3728
3717
|
function mergeNewRootState(newData) {
|
|
3729
3718
|
const combinedState = {
|
|
3730
3719
|
...props.builderContext.rootState,
|
|
@@ -3939,14 +3928,14 @@ function FormComponent(props) {
|
|
|
3939
3928
|
blocks={props.sendingMessage}
|
|
3940
3929
|
context={props.builderContext}
|
|
3941
3930
|
/></Show11>
|
|
3942
|
-
<Show11 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-
|
|
3931
|
+
<Show11 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-27d18614">{JSON.stringify(responseData(), null, 2)}</pre></Show11>
|
|
3943
3932
|
<Show11 when={submissionState() === "success"}><Blocks_default
|
|
3944
3933
|
path="successMessage"
|
|
3945
3934
|
blocks={props.successMessage}
|
|
3946
3935
|
context={props.builderContext}
|
|
3947
3936
|
/></Show11>
|
|
3948
3937
|
</form>
|
|
3949
|
-
<style>{`.pre-
|
|
3938
|
+
<style>{`.pre-27d18614 {
|
|
3950
3939
|
padding: 10px;
|
|
3951
3940
|
color: red;
|
|
3952
3941
|
text-align: center;
|
|
@@ -4296,9 +4285,9 @@ var componentInfo19 = {
|
|
|
4296
4285
|
};
|
|
4297
4286
|
|
|
4298
4287
|
// src/blocks/video/video.tsx
|
|
4299
|
-
import { Show as Show12, createMemo as
|
|
4288
|
+
import { Show as Show12, createMemo as createMemo14 } from "solid-js";
|
|
4300
4289
|
function Video(props) {
|
|
4301
|
-
const videoProps =
|
|
4290
|
+
const videoProps = createMemo14(() => {
|
|
4302
4291
|
return {
|
|
4303
4292
|
...props.autoPlay === true ? {
|
|
4304
4293
|
autoPlay: true
|
|
@@ -4317,7 +4306,7 @@ function Video(props) {
|
|
|
4317
4306
|
} : {}
|
|
4318
4307
|
};
|
|
4319
4308
|
});
|
|
4320
|
-
const spreadProps =
|
|
4309
|
+
const spreadProps = createMemo14(() => {
|
|
4321
4310
|
return {
|
|
4322
4311
|
...videoProps()
|
|
4323
4312
|
};
|
|
@@ -4527,8 +4516,8 @@ import {
|
|
|
4527
4516
|
onMount as onMount6,
|
|
4528
4517
|
on as on3,
|
|
4529
4518
|
createEffect as createEffect3,
|
|
4530
|
-
createMemo as
|
|
4531
|
-
createSignal as
|
|
4519
|
+
createMemo as createMemo15,
|
|
4520
|
+
createSignal as createSignal15
|
|
4532
4521
|
} from "solid-js";
|
|
4533
4522
|
import { Dynamic as Dynamic5 } from "solid-js/web";
|
|
4534
4523
|
|
|
@@ -4538,7 +4527,7 @@ function getPreviewContent(_searchParams) {
|
|
|
4538
4527
|
}
|
|
4539
4528
|
|
|
4540
4529
|
// src/constants/sdk-version.ts
|
|
4541
|
-
var SDK_VERSION = "3.0.
|
|
4530
|
+
var SDK_VERSION = "3.0.3";
|
|
4542
4531
|
|
|
4543
4532
|
// src/helpers/sdk-headers.ts
|
|
4544
4533
|
var getSdkHeaders = () => ({
|
|
@@ -4603,6 +4592,23 @@ function flattenMongoQuery(obj, _current, _res = {}) {
|
|
|
4603
4592
|
}
|
|
4604
4593
|
return _res;
|
|
4605
4594
|
}
|
|
4595
|
+
function unflatten(obj) {
|
|
4596
|
+
const result = {};
|
|
4597
|
+
for (const key in obj) {
|
|
4598
|
+
const parts = key.split(".");
|
|
4599
|
+
let current = result;
|
|
4600
|
+
for (let i = 0; i < parts.length; i++) {
|
|
4601
|
+
const part = parts[i];
|
|
4602
|
+
if (i === parts.length - 1) {
|
|
4603
|
+
current[part] = obj[key];
|
|
4604
|
+
} else {
|
|
4605
|
+
current[part] = current[part] || {};
|
|
4606
|
+
current = current[part];
|
|
4607
|
+
}
|
|
4608
|
+
}
|
|
4609
|
+
}
|
|
4610
|
+
return result;
|
|
4611
|
+
}
|
|
4606
4612
|
|
|
4607
4613
|
// src/types/api-version.ts
|
|
4608
4614
|
var DEFAULT_API_VERSION = "v3";
|
|
@@ -4667,7 +4673,7 @@ var generateContentUrl = (options) => {
|
|
|
4667
4673
|
url.searchParams.set("noTraverse", String(noTraverse));
|
|
4668
4674
|
url.searchParams.set("includeRefs", String(true));
|
|
4669
4675
|
const finalLocale = locale || userAttributes?.locale;
|
|
4670
|
-
let finalUserAttributes = userAttributes;
|
|
4676
|
+
let finalUserAttributes = userAttributes || {};
|
|
4671
4677
|
if (finalLocale) {
|
|
4672
4678
|
url.searchParams.set("locale", finalLocale);
|
|
4673
4679
|
finalUserAttributes = {
|
|
@@ -4705,11 +4711,15 @@ var generateContentUrl = (options) => {
|
|
|
4705
4711
|
...getBuilderSearchParamsFromWindow(),
|
|
4706
4712
|
...normalizeSearchParams(options.options || {})
|
|
4707
4713
|
};
|
|
4714
|
+
finalUserAttributes = {
|
|
4715
|
+
...finalUserAttributes,
|
|
4716
|
+
...getUserAttributesAsJSON(queryOptions)
|
|
4717
|
+
};
|
|
4708
4718
|
const flattened = flatten(queryOptions);
|
|
4709
4719
|
for (const key in flattened) {
|
|
4710
4720
|
url.searchParams.set(key, String(flattened[key]));
|
|
4711
4721
|
}
|
|
4712
|
-
if (finalUserAttributes) {
|
|
4722
|
+
if (Object.keys(finalUserAttributes).length > 0) {
|
|
4713
4723
|
url.searchParams.set("userAttributes", JSON.stringify(finalUserAttributes));
|
|
4714
4724
|
}
|
|
4715
4725
|
if (query) {
|
|
@@ -4722,6 +4732,28 @@ var generateContentUrl = (options) => {
|
|
|
4722
4732
|
}
|
|
4723
4733
|
return url;
|
|
4724
4734
|
};
|
|
4735
|
+
var getUserAttributesFromQueryOptions = (queryOptions) => {
|
|
4736
|
+
const newUserAttributes = {};
|
|
4737
|
+
for (const key in queryOptions) {
|
|
4738
|
+
if (key.startsWith("userAttributes.")) {
|
|
4739
|
+
newUserAttributes[key] = queryOptions[key];
|
|
4740
|
+
delete queryOptions[key];
|
|
4741
|
+
}
|
|
4742
|
+
}
|
|
4743
|
+
return newUserAttributes;
|
|
4744
|
+
};
|
|
4745
|
+
var getUserAttributesAsJSON = (queryOptions) => {
|
|
4746
|
+
if (isBrowser() && queryOptions["preview"] === "BUILDER_STUDIO") {
|
|
4747
|
+
queryOptions["userAttributes.urlPath"] = window.location.pathname;
|
|
4748
|
+
queryOptions["userAttributes.host"] = window.location.host;
|
|
4749
|
+
const queryOptionsForUserAttributes = getUserAttributesFromQueryOptions(queryOptions);
|
|
4750
|
+
const {
|
|
4751
|
+
userAttributes
|
|
4752
|
+
} = unflatten(queryOptionsForUserAttributes);
|
|
4753
|
+
return userAttributes;
|
|
4754
|
+
}
|
|
4755
|
+
return {};
|
|
4756
|
+
};
|
|
4725
4757
|
|
|
4726
4758
|
// src/functions/get-content/index.ts
|
|
4727
4759
|
var checkContentHasResults = (content) => "results" in content;
|
|
@@ -5343,12 +5375,12 @@ var getWrapperClassName = (variationId) => {
|
|
|
5343
5375
|
|
|
5344
5376
|
// src/components/content/components/enable-editor.tsx
|
|
5345
5377
|
function EnableEditor(props) {
|
|
5346
|
-
const [ContentWrapper, setContentWrapper] =
|
|
5378
|
+
const [ContentWrapper, setContentWrapper] = createSignal15(
|
|
5347
5379
|
props.contentWrapper || "div"
|
|
5348
5380
|
);
|
|
5349
|
-
const [httpReqsData, setHttpReqsData] =
|
|
5350
|
-
const [httpReqsPending, setHttpReqsPending] =
|
|
5351
|
-
const [clicked, setClicked] =
|
|
5381
|
+
const [httpReqsData, setHttpReqsData] = createSignal15({});
|
|
5382
|
+
const [httpReqsPending, setHttpReqsPending] = createSignal15({});
|
|
5383
|
+
const [clicked, setClicked] = createSignal15(false);
|
|
5352
5384
|
function mergeNewRootState(newData) {
|
|
5353
5385
|
const combinedState = {
|
|
5354
5386
|
...props.builderContextSignal.rootState,
|
|
@@ -5382,7 +5414,7 @@ function EnableEditor(props) {
|
|
|
5382
5414
|
content: newContentValue
|
|
5383
5415
|
}));
|
|
5384
5416
|
}
|
|
5385
|
-
const showContentProps =
|
|
5417
|
+
const showContentProps = createMemo15(() => {
|
|
5386
5418
|
return props.showContent ? {} : {
|
|
5387
5419
|
hidden: true,
|
|
5388
5420
|
"aria-hidden": true
|
|
@@ -5539,11 +5571,16 @@ function EnableEditor(props) {
|
|
|
5539
5571
|
`builder.overrides.${searchParamPreviewModel}`
|
|
5540
5572
|
);
|
|
5541
5573
|
const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
|
|
5542
|
-
if (searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
|
|
5574
|
+
if (searchParamPreviewModel === "BUILDER_STUDIO" || searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
|
|
5543
5575
|
fetchOneEntry({
|
|
5544
|
-
model: props.model,
|
|
5576
|
+
model: props.model || "",
|
|
5545
5577
|
apiKey: props.apiKey,
|
|
5546
|
-
apiVersion: props.builderContextSignal.apiVersion
|
|
5578
|
+
apiVersion: props.builderContextSignal.apiVersion,
|
|
5579
|
+
...searchParamPreviewModel === "BUILDER_STUDIO" && props.context?.symbolId ? {
|
|
5580
|
+
query: {
|
|
5581
|
+
id: props.context.symbolId
|
|
5582
|
+
}
|
|
5583
|
+
} : {}
|
|
5547
5584
|
}).then((content) => {
|
|
5548
5585
|
if (content) {
|
|
5549
5586
|
mergeNewContent(content);
|
|
@@ -5553,14 +5590,14 @@ function EnableEditor(props) {
|
|
|
5553
5590
|
}
|
|
5554
5591
|
}
|
|
5555
5592
|
});
|
|
5556
|
-
const onUpdateFn_0_props_content =
|
|
5593
|
+
const onUpdateFn_0_props_content = createMemo15(() => props.content);
|
|
5557
5594
|
function onUpdateFn_0() {
|
|
5558
5595
|
if (props.content) {
|
|
5559
5596
|
mergeNewContent(props.content);
|
|
5560
5597
|
}
|
|
5561
5598
|
}
|
|
5562
5599
|
createEffect3(on3(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
|
|
5563
|
-
const onUpdateFn_1_props_builderContextSignal_rootState =
|
|
5600
|
+
const onUpdateFn_1_props_builderContextSignal_rootState = createMemo15(
|
|
5564
5601
|
() => props.builderContextSignal.rootState
|
|
5565
5602
|
);
|
|
5566
5603
|
function onUpdateFn_1() {
|
|
@@ -5572,14 +5609,14 @@ function EnableEditor(props) {
|
|
|
5572
5609
|
onUpdateFn_1
|
|
5573
5610
|
)
|
|
5574
5611
|
);
|
|
5575
|
-
const onUpdateFn_2_props_data =
|
|
5612
|
+
const onUpdateFn_2_props_data = createMemo15(() => props.data);
|
|
5576
5613
|
function onUpdateFn_2() {
|
|
5577
5614
|
if (props.data) {
|
|
5578
5615
|
mergeNewRootState(props.data);
|
|
5579
5616
|
}
|
|
5580
5617
|
}
|
|
5581
5618
|
createEffect3(on3(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
|
|
5582
|
-
const onUpdateFn_3_props_locale =
|
|
5619
|
+
const onUpdateFn_3_props_locale = createMemo15(() => props.locale);
|
|
5583
5620
|
function onUpdateFn_3() {
|
|
5584
5621
|
if (props.locale) {
|
|
5585
5622
|
mergeNewRootState({
|
|
@@ -5611,9 +5648,9 @@ function EnableEditor(props) {
|
|
|
5611
5648
|
var Enable_editor_default = EnableEditor;
|
|
5612
5649
|
|
|
5613
5650
|
// src/components/content/components/styles.tsx
|
|
5614
|
-
import { createSignal as
|
|
5651
|
+
import { createSignal as createSignal16 } from "solid-js";
|
|
5615
5652
|
function ContentStyles(props) {
|
|
5616
|
-
const [injectedStyles, setInjectedStyles] =
|
|
5653
|
+
const [injectedStyles, setInjectedStyles] = createSignal16(
|
|
5617
5654
|
`
|
|
5618
5655
|
${getCss({
|
|
5619
5656
|
cssCode: props.cssCode,
|
|
@@ -5671,7 +5708,7 @@ var getContentInitialValue = ({
|
|
|
5671
5708
|
|
|
5672
5709
|
// src/components/content/content.tsx
|
|
5673
5710
|
function ContentComponent(props) {
|
|
5674
|
-
const [scriptStr, setScriptStr] =
|
|
5711
|
+
const [scriptStr, setScriptStr] = createSignal17(
|
|
5675
5712
|
getUpdateVariantVisibilityScript({
|
|
5676
5713
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
5677
5714
|
variationId: props.content?.testVariationId,
|
|
@@ -5679,7 +5716,7 @@ function ContentComponent(props) {
|
|
|
5679
5716
|
contentId: props.content?.id
|
|
5680
5717
|
})
|
|
5681
5718
|
);
|
|
5682
|
-
const [registeredComponents, setRegisteredComponents] =
|
|
5719
|
+
const [registeredComponents, setRegisteredComponents] = createSignal17(
|
|
5683
5720
|
[
|
|
5684
5721
|
...getDefaultRegisteredComponents(),
|
|
5685
5722
|
...props.customComponents || []
|
|
@@ -5694,7 +5731,7 @@ function ContentComponent(props) {
|
|
|
5694
5731
|
{}
|
|
5695
5732
|
)
|
|
5696
5733
|
);
|
|
5697
|
-
const [builderContextSignal, setBuilderContextSignal] =
|
|
5734
|
+
const [builderContextSignal, setBuilderContextSignal] = createSignal17({
|
|
5698
5735
|
content: getContentInitialValue({
|
|
5699
5736
|
content: props.content,
|
|
5700
5737
|
data: props.data
|
|
@@ -5802,13 +5839,13 @@ var Content_default = ContentComponent;
|
|
|
5802
5839
|
|
|
5803
5840
|
// src/components/content-variants/content-variants.tsx
|
|
5804
5841
|
function ContentVariants(props) {
|
|
5805
|
-
const [shouldRenderVariants, setShouldRenderVariants] =
|
|
5842
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal18(
|
|
5806
5843
|
checkShouldRenderVariants({
|
|
5807
5844
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
5808
5845
|
content: props.content
|
|
5809
5846
|
})
|
|
5810
5847
|
);
|
|
5811
|
-
const updateCookieAndStylesScriptStr =
|
|
5848
|
+
const updateCookieAndStylesScriptStr = createMemo18(() => {
|
|
5812
5849
|
return getUpdateCookieAndStylesScript(
|
|
5813
5850
|
getVariants(props.content).map((value) => ({
|
|
5814
5851
|
id: value.testVariationId,
|
|
@@ -5817,10 +5854,10 @@ function ContentVariants(props) {
|
|
|
5817
5854
|
props.content?.id || ""
|
|
5818
5855
|
);
|
|
5819
5856
|
});
|
|
5820
|
-
const hideVariantsStyleString =
|
|
5857
|
+
const hideVariantsStyleString = createMemo18(() => {
|
|
5821
5858
|
return getVariants(props.content).map((value) => `.variant-${value.testVariationId} { display: none; } `).join("");
|
|
5822
5859
|
});
|
|
5823
|
-
const defaultContent =
|
|
5860
|
+
const defaultContent = createMemo18(() => {
|
|
5824
5861
|
return shouldRenderVariants() ? {
|
|
5825
5862
|
...props.content,
|
|
5826
5863
|
testVariationId: props.content?.id
|
|
@@ -5932,14 +5969,14 @@ var fetchSymbolContent = async ({
|
|
|
5932
5969
|
|
|
5933
5970
|
// src/blocks/symbol/symbol.tsx
|
|
5934
5971
|
function Symbol(props) {
|
|
5935
|
-
const [contentToUse, setContentToUse] =
|
|
5936
|
-
const blocksWrapper =
|
|
5972
|
+
const [contentToUse, setContentToUse] = createSignal19(props.symbol?.content);
|
|
5973
|
+
const blocksWrapper = createMemo19(() => {
|
|
5937
5974
|
return "div";
|
|
5938
5975
|
});
|
|
5939
|
-
const contentWrapper =
|
|
5976
|
+
const contentWrapper = createMemo19(() => {
|
|
5940
5977
|
return "div";
|
|
5941
5978
|
});
|
|
5942
|
-
const className =
|
|
5979
|
+
const className = createMemo19(() => {
|
|
5943
5980
|
return [
|
|
5944
5981
|
...[props.attributes[getClassPropName()]],
|
|
5945
5982
|
"builder-symbol",
|
|
@@ -5961,7 +5998,7 @@ function Symbol(props) {
|
|
|
5961
5998
|
}
|
|
5962
5999
|
onMount8(() => {
|
|
5963
6000
|
});
|
|
5964
|
-
const onUpdateFn_0_props_symbol =
|
|
6001
|
+
const onUpdateFn_0_props_symbol = createMemo19(() => props.symbol);
|
|
5965
6002
|
function onUpdateFn_0() {
|
|
5966
6003
|
setContent();
|
|
5967
6004
|
}
|