@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/edge/dev.jsx
CHANGED
|
@@ -120,23 +120,6 @@ import {
|
|
|
120
120
|
createSignal as createSignal5
|
|
121
121
|
} from "solid-js";
|
|
122
122
|
|
|
123
|
-
// src/functions/get-block-component-options.ts
|
|
124
|
-
function getBlockComponentOptions(block) {
|
|
125
|
-
return {
|
|
126
|
-
...block.component?.options,
|
|
127
|
-
...block.options
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// src/helpers/omit.ts
|
|
132
|
-
function omit(obj, ...values) {
|
|
133
|
-
const newObject = Object.assign({}, obj);
|
|
134
|
-
for (const key of values) {
|
|
135
|
-
delete newObject[key];
|
|
136
|
-
}
|
|
137
|
-
return newObject;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
123
|
// src/helpers/logger.ts
|
|
141
124
|
var MSG_PREFIX = "[Builder.io]: ";
|
|
142
125
|
var logger = {
|
|
@@ -3471,10 +3454,8 @@ var runInEdge = ({
|
|
|
3471
3454
|
return `var ${key} = ${jsonValName} === undefined ? undefined : JSON.parse(${jsonValName});`;
|
|
3472
3455
|
}).join("\n");
|
|
3473
3456
|
const cleanedCode = processCode(code);
|
|
3474
|
-
if (cleanedCode === "")
|
|
3475
|
-
logger.warn("Skipping evaluation of empty code block.");
|
|
3457
|
+
if (cleanedCode === "")
|
|
3476
3458
|
return;
|
|
3477
|
-
}
|
|
3478
3459
|
const transformed = `
|
|
3479
3460
|
function theFunction() {
|
|
3480
3461
|
${prependedCode}
|
|
@@ -3580,6 +3561,38 @@ function evaluate({
|
|
|
3580
3561
|
}
|
|
3581
3562
|
}
|
|
3582
3563
|
|
|
3564
|
+
// src/functions/get-block-component-options.ts
|
|
3565
|
+
function getBlockComponentOptions(block, context) {
|
|
3566
|
+
return {
|
|
3567
|
+
...block.component?.options,
|
|
3568
|
+
...block.options,
|
|
3569
|
+
...evaluateTextComponentTextOption(block, context)
|
|
3570
|
+
};
|
|
3571
|
+
}
|
|
3572
|
+
var evaluateTextComponentTextOption = (block, context) => {
|
|
3573
|
+
if (block.component?.name === "Text" && block.component.options?.text && typeof block.component.options.text === "string") {
|
|
3574
|
+
return {
|
|
3575
|
+
...block.component.options,
|
|
3576
|
+
text: block.component.options.text.replace(/{{([^}]+)}}/g, (_match, group) => evaluate({
|
|
3577
|
+
code: group,
|
|
3578
|
+
context,
|
|
3579
|
+
localState: context.localState,
|
|
3580
|
+
rootState: context.rootState,
|
|
3581
|
+
rootSetState: context.rootSetState
|
|
3582
|
+
}))
|
|
3583
|
+
};
|
|
3584
|
+
}
|
|
3585
|
+
};
|
|
3586
|
+
|
|
3587
|
+
// src/helpers/omit.ts
|
|
3588
|
+
function omit(obj, ...values) {
|
|
3589
|
+
const newObject = Object.assign({}, obj);
|
|
3590
|
+
for (const key of values) {
|
|
3591
|
+
delete newObject[key];
|
|
3592
|
+
}
|
|
3593
|
+
return newObject;
|
|
3594
|
+
}
|
|
3595
|
+
|
|
3583
3596
|
// src/functions/traverse.ts
|
|
3584
3597
|
function traverse(obj, callback, parent2 = null, key = null, visited = /* @__PURE__ */ new WeakSet()) {
|
|
3585
3598
|
if (obj == null || typeof obj !== "object") {
|
|
@@ -3744,24 +3757,19 @@ var evaluateBindings = ({
|
|
|
3744
3757
|
function getProcessedBlock({
|
|
3745
3758
|
block,
|
|
3746
3759
|
context,
|
|
3747
|
-
shouldEvaluateBindings,
|
|
3748
3760
|
localState,
|
|
3749
3761
|
rootState,
|
|
3750
3762
|
rootSetState
|
|
3751
3763
|
}) {
|
|
3752
3764
|
let transformedBlock = resolveLocalizedValues(block, rootState.locale);
|
|
3753
3765
|
transformedBlock = transformBlock(transformedBlock);
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
});
|
|
3762
|
-
} else {
|
|
3763
|
-
return transformedBlock;
|
|
3764
|
-
}
|
|
3766
|
+
return evaluateBindings({
|
|
3767
|
+
block: transformedBlock,
|
|
3768
|
+
localState,
|
|
3769
|
+
rootState,
|
|
3770
|
+
rootSetState,
|
|
3771
|
+
context
|
|
3772
|
+
});
|
|
3765
3773
|
}
|
|
3766
3774
|
|
|
3767
3775
|
// src/functions/camel-to-kebab-case.ts
|
|
@@ -4483,8 +4491,7 @@ function Block(props) {
|
|
|
4483
4491
|
localState: props.context.localState,
|
|
4484
4492
|
rootState: props.context.rootState,
|
|
4485
4493
|
rootSetState: props.context.rootSetState,
|
|
4486
|
-
context: props.context.context
|
|
4487
|
-
shouldEvaluateBindings: true
|
|
4494
|
+
context: props.context.context
|
|
4488
4495
|
});
|
|
4489
4496
|
return blockToUse;
|
|
4490
4497
|
});
|
|
@@ -4521,7 +4528,7 @@ function Block(props) {
|
|
|
4521
4528
|
blockChildren: processedBlock().children ?? [],
|
|
4522
4529
|
componentRef: blockComponent()?.component,
|
|
4523
4530
|
componentOptions: {
|
|
4524
|
-
...getBlockComponentOptions(processedBlock()),
|
|
4531
|
+
...getBlockComponentOptions(processedBlock(), props.context),
|
|
4525
4532
|
...provideBuilderBlock(blockComponent(), processedBlock()),
|
|
4526
4533
|
...provideBuilderContext(blockComponent(), props.context),
|
|
4527
4534
|
...provideLinkComponent(blockComponent(), props.linkComponent),
|
|
@@ -4675,7 +4682,7 @@ function BlocksWrapper(props) {
|
|
|
4675
4682
|
});
|
|
4676
4683
|
return <>
|
|
4677
4684
|
<Dynamic4
|
|
4678
|
-
class={className() + " dynamic-
|
|
4685
|
+
class={className() + " dynamic-3c4beb0c"}
|
|
4679
4686
|
ref={blocksWrapperRef}
|
|
4680
4687
|
builder-path={dataPath()}
|
|
4681
4688
|
builder-parent-id={props.parent}
|
|
@@ -4687,7 +4694,7 @@ function BlocksWrapper(props) {
|
|
|
4687
4694
|
{...props.BlocksWrapperProps}
|
|
4688
4695
|
component={props.BlocksWrapper}
|
|
4689
4696
|
>{props.children}</Dynamic4>
|
|
4690
|
-
<style>{`.dynamic-
|
|
4697
|
+
<style>{`.dynamic-3c4beb0c {
|
|
4691
4698
|
display: flex;
|
|
4692
4699
|
flex-direction: column;
|
|
4693
4700
|
align-items: stretch;
|
|
@@ -4852,7 +4859,7 @@ function Columns(props) {
|
|
|
4852
4859
|
}
|
|
4853
4860
|
return <>
|
|
4854
4861
|
<div
|
|
4855
|
-
class={getColumnsClass(props.builderBlock?.id) + " div-
|
|
4862
|
+
class={getColumnsClass(props.builderBlock?.id) + " div-3e5f33a4"}
|
|
4856
4863
|
style={columnsCssVars()}
|
|
4857
4864
|
{...{}}
|
|
4858
4865
|
>
|
|
@@ -4881,7 +4888,7 @@ function Columns(props) {
|
|
|
4881
4888
|
/></Dynamic_renderer_default>;
|
|
4882
4889
|
}}</For4>
|
|
4883
4890
|
</div>
|
|
4884
|
-
<style>{`.div-
|
|
4891
|
+
<style>{`.div-3e5f33a4 {
|
|
4885
4892
|
display: flex;
|
|
4886
4893
|
line-height: normal;
|
|
4887
4894
|
}`}</style>
|
|
@@ -4993,7 +5000,7 @@ function Image(props) {
|
|
|
4993
5000
|
<picture>
|
|
4994
5001
|
<Show8 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show8>
|
|
4995
5002
|
<img
|
|
4996
|
-
class={"builder-image" + (props.className ? " " + props.className : "") + " img-
|
|
5003
|
+
class={"builder-image" + (props.className ? " " + props.className : "") + " img-56e07140"}
|
|
4997
5004
|
loading={props.highPriority ? "eager" : "lazy"}
|
|
4998
5005
|
fetchpriority={props.highPriority ? "high" : "auto"}
|
|
4999
5006
|
alt={props.altText}
|
|
@@ -5011,22 +5018,22 @@ function Image(props) {
|
|
|
5011
5018
|
<Show8
|
|
5012
5019
|
when={props.aspectRatio && !(props.builderBlock?.children?.length && props.fitContent)}
|
|
5013
5020
|
><div
|
|
5014
|
-
class="builder-image-sizer div-
|
|
5021
|
+
class="builder-image-sizer div-56e07140"
|
|
5015
5022
|
style={{
|
|
5016
5023
|
"padding-top": props.aspectRatio * 100 + "%"
|
|
5017
5024
|
}}
|
|
5018
5025
|
/></Show8>
|
|
5019
5026
|
<Show8 when={props.builderBlock?.children?.length && props.fitContent}>{props.children}</Show8>
|
|
5020
|
-
<Show8 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-
|
|
5027
|
+
<Show8 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-56e07140-2">{props.children}</div></Show8>
|
|
5021
5028
|
</>
|
|
5022
|
-
<style>{`.img-
|
|
5029
|
+
<style>{`.img-56e07140 {
|
|
5023
5030
|
opacity: 1;
|
|
5024
5031
|
transition: opacity 0.2s ease-in-out;
|
|
5025
|
-
}.div-
|
|
5032
|
+
}.div-56e07140 {
|
|
5026
5033
|
width: 100%;
|
|
5027
5034
|
pointer-events: none;
|
|
5028
5035
|
font-size: 0;
|
|
5029
|
-
}.div-
|
|
5036
|
+
}.div-56e07140-2 {
|
|
5030
5037
|
display: flex;
|
|
5031
5038
|
flex-direction: column;
|
|
5032
5039
|
align-items: stretch;
|
|
@@ -5062,10 +5069,10 @@ function SectionComponent(props) {
|
|
|
5062
5069
|
var section_default = SectionComponent;
|
|
5063
5070
|
|
|
5064
5071
|
// src/blocks/symbol/symbol.tsx
|
|
5065
|
-
import { onMount as onMount8, on as on4, createEffect as createEffect4, createMemo as
|
|
5072
|
+
import { onMount as onMount8, on as on4, createEffect as createEffect4, createMemo as createMemo19, createSignal as createSignal19 } from "solid-js";
|
|
5066
5073
|
|
|
5067
5074
|
// src/components/content-variants/content-variants.tsx
|
|
5068
|
-
import { Show as Show15, For as For9, onMount as onMount7, createSignal as
|
|
5075
|
+
import { Show as Show15, For as For9, onMount as onMount7, createSignal as createSignal18, createMemo as createMemo18 } from "solid-js";
|
|
5069
5076
|
|
|
5070
5077
|
// src/helpers/url.ts
|
|
5071
5078
|
var getTopLevelDomain = (host) => {
|
|
@@ -5259,7 +5266,7 @@ var handleABTesting = async ({
|
|
|
5259
5266
|
var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
|
|
5260
5267
|
|
|
5261
5268
|
// src/components/content/content.tsx
|
|
5262
|
-
import { Show as Show14, createSignal as
|
|
5269
|
+
import { Show as Show14, createSignal as createSignal17 } from "solid-js";
|
|
5263
5270
|
|
|
5264
5271
|
// src/blocks/accordion/component-info.ts
|
|
5265
5272
|
var defaultTitle = {
|
|
@@ -6304,30 +6311,10 @@ var componentInfo10 = {
|
|
|
6304
6311
|
};
|
|
6305
6312
|
|
|
6306
6313
|
// src/blocks/text/text.tsx
|
|
6307
|
-
import { createMemo as createMemo11 } from "solid-js";
|
|
6308
6314
|
function Text(props) {
|
|
6309
|
-
const processedText = createMemo11(() => {
|
|
6310
|
-
const context = props.builderContext;
|
|
6311
|
-
const {
|
|
6312
|
-
context: contextContext,
|
|
6313
|
-
localState,
|
|
6314
|
-
rootState,
|
|
6315
|
-
rootSetState
|
|
6316
|
-
} = context;
|
|
6317
|
-
return String(props.text?.toString() || "").replace(
|
|
6318
|
-
/{{([^}]+)}}/g,
|
|
6319
|
-
(match, group) => evaluate({
|
|
6320
|
-
code: group,
|
|
6321
|
-
context: contextContext,
|
|
6322
|
-
localState,
|
|
6323
|
-
rootState,
|
|
6324
|
-
rootSetState
|
|
6325
|
-
})
|
|
6326
|
-
);
|
|
6327
|
-
});
|
|
6328
6315
|
return <><div
|
|
6329
6316
|
class="builder-text"
|
|
6330
|
-
innerHTML={
|
|
6317
|
+
innerHTML={props.text?.toString() || ""}
|
|
6331
6318
|
style={{
|
|
6332
6319
|
outline: "none"
|
|
6333
6320
|
}}
|
|
@@ -6361,10 +6348,10 @@ var componentInfo11 = {
|
|
|
6361
6348
|
};
|
|
6362
6349
|
|
|
6363
6350
|
// src/blocks/custom-code/custom-code.tsx
|
|
6364
|
-
import { onMount as onMount5, createSignal as
|
|
6351
|
+
import { onMount as onMount5, createSignal as createSignal11 } from "solid-js";
|
|
6365
6352
|
function CustomCode(props) {
|
|
6366
|
-
const [scriptsInserted, setScriptsInserted] =
|
|
6367
|
-
const [scriptsRun, setScriptsRun] =
|
|
6353
|
+
const [scriptsInserted, setScriptsInserted] = createSignal11([]);
|
|
6354
|
+
const [scriptsRun, setScriptsRun] = createSignal11([]);
|
|
6368
6355
|
let elementRef;
|
|
6369
6356
|
onMount5(() => {
|
|
6370
6357
|
if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
|
|
@@ -6426,7 +6413,7 @@ var componentInfo12 = {
|
|
|
6426
6413
|
};
|
|
6427
6414
|
|
|
6428
6415
|
// src/blocks/embed/embed.tsx
|
|
6429
|
-
import { on as on2, createEffect as createEffect2, createMemo as
|
|
6416
|
+
import { on as on2, createEffect as createEffect2, createMemo as createMemo12, createSignal as createSignal12 } from "solid-js";
|
|
6430
6417
|
|
|
6431
6418
|
// src/blocks/embed/helpers.ts
|
|
6432
6419
|
var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
|
|
@@ -6434,9 +6421,9 @@ var isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
|
|
|
6434
6421
|
|
|
6435
6422
|
// src/blocks/embed/embed.tsx
|
|
6436
6423
|
function Embed(props) {
|
|
6437
|
-
const [scriptsInserted, setScriptsInserted] =
|
|
6438
|
-
const [scriptsRun, setScriptsRun] =
|
|
6439
|
-
const [ranInitFn, setRanInitFn] =
|
|
6424
|
+
const [scriptsInserted, setScriptsInserted] = createSignal12([]);
|
|
6425
|
+
const [scriptsRun, setScriptsRun] = createSignal12([]);
|
|
6426
|
+
const [ranInitFn, setRanInitFn] = createSignal12(false);
|
|
6440
6427
|
function findAndRunScripts() {
|
|
6441
6428
|
if (!elem || !elem.getElementsByTagName)
|
|
6442
6429
|
return;
|
|
@@ -6460,8 +6447,8 @@ function Embed(props) {
|
|
|
6460
6447
|
}
|
|
6461
6448
|
}
|
|
6462
6449
|
let elem;
|
|
6463
|
-
const onUpdateFn_0_elem =
|
|
6464
|
-
const onUpdateFn_0_ranInitFn__ =
|
|
6450
|
+
const onUpdateFn_0_elem = createMemo12(() => elem);
|
|
6451
|
+
const onUpdateFn_0_ranInitFn__ = createMemo12(() => ranInitFn());
|
|
6465
6452
|
function onUpdateFn_0() {
|
|
6466
6453
|
if (elem && !ranInitFn()) {
|
|
6467
6454
|
setRanInitFn(true);
|
|
@@ -6716,7 +6703,7 @@ var componentInfo13 = {
|
|
|
6716
6703
|
};
|
|
6717
6704
|
|
|
6718
6705
|
// src/blocks/form/form/form.tsx
|
|
6719
|
-
import { Show as Show11, For as For7, createSignal as
|
|
6706
|
+
import { Show as Show11, For as For7, createSignal as createSignal13 } from "solid-js";
|
|
6720
6707
|
|
|
6721
6708
|
// src/functions/get-env.ts
|
|
6722
6709
|
var validEnvList = ["production", "qa", "test", "development", "dev", "cdn-qa", "cloud", "fast", "cdn2", "cdn-prod"];
|
|
@@ -6736,9 +6723,9 @@ function logFetch(url) {
|
|
|
6736
6723
|
|
|
6737
6724
|
// src/blocks/form/form/form.tsx
|
|
6738
6725
|
function FormComponent(props) {
|
|
6739
|
-
const [formState, setFormState] =
|
|
6740
|
-
const [responseData, setResponseData] =
|
|
6741
|
-
const [formErrorMessage, setFormErrorMessage] =
|
|
6726
|
+
const [formState, setFormState] = createSignal13("unsubmitted");
|
|
6727
|
+
const [responseData, setResponseData] = createSignal13(null);
|
|
6728
|
+
const [formErrorMessage, setFormErrorMessage] = createSignal13("");
|
|
6742
6729
|
function mergeNewRootState(newData) {
|
|
6743
6730
|
const combinedState = {
|
|
6744
6731
|
...props.builderContext.rootState,
|
|
@@ -6953,14 +6940,14 @@ function FormComponent(props) {
|
|
|
6953
6940
|
blocks={props.sendingMessage}
|
|
6954
6941
|
context={props.builderContext}
|
|
6955
6942
|
/></Show11>
|
|
6956
|
-
<Show11 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-
|
|
6943
|
+
<Show11 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-27d18614">{JSON.stringify(responseData(), null, 2)}</pre></Show11>
|
|
6957
6944
|
<Show11 when={submissionState() === "success"}><Blocks_default
|
|
6958
6945
|
path="successMessage"
|
|
6959
6946
|
blocks={props.successMessage}
|
|
6960
6947
|
context={props.builderContext}
|
|
6961
6948
|
/></Show11>
|
|
6962
6949
|
</form>
|
|
6963
|
-
<style>{`.pre-
|
|
6950
|
+
<style>{`.pre-27d18614 {
|
|
6964
6951
|
padding: 10px;
|
|
6965
6952
|
color: red;
|
|
6966
6953
|
text-align: center;
|
|
@@ -7310,9 +7297,9 @@ var componentInfo19 = {
|
|
|
7310
7297
|
};
|
|
7311
7298
|
|
|
7312
7299
|
// src/blocks/video/video.tsx
|
|
7313
|
-
import { Show as Show12, createMemo as
|
|
7300
|
+
import { Show as Show12, createMemo as createMemo14 } from "solid-js";
|
|
7314
7301
|
function Video(props) {
|
|
7315
|
-
const videoProps =
|
|
7302
|
+
const videoProps = createMemo14(() => {
|
|
7316
7303
|
return {
|
|
7317
7304
|
...props.autoPlay === true ? {
|
|
7318
7305
|
autoPlay: true
|
|
@@ -7331,7 +7318,7 @@ function Video(props) {
|
|
|
7331
7318
|
} : {}
|
|
7332
7319
|
};
|
|
7333
7320
|
});
|
|
7334
|
-
const spreadProps =
|
|
7321
|
+
const spreadProps = createMemo14(() => {
|
|
7335
7322
|
return {
|
|
7336
7323
|
...videoProps()
|
|
7337
7324
|
};
|
|
@@ -7541,8 +7528,8 @@ import {
|
|
|
7541
7528
|
onMount as onMount6,
|
|
7542
7529
|
on as on3,
|
|
7543
7530
|
createEffect as createEffect3,
|
|
7544
|
-
createMemo as
|
|
7545
|
-
createSignal as
|
|
7531
|
+
createMemo as createMemo15,
|
|
7532
|
+
createSignal as createSignal15
|
|
7546
7533
|
} from "solid-js";
|
|
7547
7534
|
import { Dynamic as Dynamic5 } from "solid-js/web";
|
|
7548
7535
|
|
|
@@ -7552,7 +7539,7 @@ function getPreviewContent(_searchParams) {
|
|
|
7552
7539
|
}
|
|
7553
7540
|
|
|
7554
7541
|
// src/constants/sdk-version.ts
|
|
7555
|
-
var SDK_VERSION = "3.0.
|
|
7542
|
+
var SDK_VERSION = "3.0.3";
|
|
7556
7543
|
|
|
7557
7544
|
// src/helpers/sdk-headers.ts
|
|
7558
7545
|
var getSdkHeaders = () => ({
|
|
@@ -7617,6 +7604,23 @@ function flattenMongoQuery(obj, _current, _res = {}) {
|
|
|
7617
7604
|
}
|
|
7618
7605
|
return _res;
|
|
7619
7606
|
}
|
|
7607
|
+
function unflatten(obj) {
|
|
7608
|
+
const result = {};
|
|
7609
|
+
for (const key in obj) {
|
|
7610
|
+
const parts = key.split(".");
|
|
7611
|
+
let current = result;
|
|
7612
|
+
for (let i = 0; i < parts.length; i++) {
|
|
7613
|
+
const part = parts[i];
|
|
7614
|
+
if (i === parts.length - 1) {
|
|
7615
|
+
current[part] = obj[key];
|
|
7616
|
+
} else {
|
|
7617
|
+
current[part] = current[part] || {};
|
|
7618
|
+
current = current[part];
|
|
7619
|
+
}
|
|
7620
|
+
}
|
|
7621
|
+
}
|
|
7622
|
+
return result;
|
|
7623
|
+
}
|
|
7620
7624
|
|
|
7621
7625
|
// src/types/api-version.ts
|
|
7622
7626
|
var DEFAULT_API_VERSION = "v3";
|
|
@@ -7681,7 +7685,7 @@ var generateContentUrl = (options) => {
|
|
|
7681
7685
|
url.searchParams.set("noTraverse", String(noTraverse));
|
|
7682
7686
|
url.searchParams.set("includeRefs", String(true));
|
|
7683
7687
|
const finalLocale = locale || userAttributes?.locale;
|
|
7684
|
-
let finalUserAttributes = userAttributes;
|
|
7688
|
+
let finalUserAttributes = userAttributes || {};
|
|
7685
7689
|
if (finalLocale) {
|
|
7686
7690
|
url.searchParams.set("locale", finalLocale);
|
|
7687
7691
|
finalUserAttributes = {
|
|
@@ -7719,11 +7723,15 @@ var generateContentUrl = (options) => {
|
|
|
7719
7723
|
...getBuilderSearchParamsFromWindow(),
|
|
7720
7724
|
...normalizeSearchParams(options.options || {})
|
|
7721
7725
|
};
|
|
7726
|
+
finalUserAttributes = {
|
|
7727
|
+
...finalUserAttributes,
|
|
7728
|
+
...getUserAttributesAsJSON(queryOptions)
|
|
7729
|
+
};
|
|
7722
7730
|
const flattened = flatten(queryOptions);
|
|
7723
7731
|
for (const key in flattened) {
|
|
7724
7732
|
url.searchParams.set(key, String(flattened[key]));
|
|
7725
7733
|
}
|
|
7726
|
-
if (finalUserAttributes) {
|
|
7734
|
+
if (Object.keys(finalUserAttributes).length > 0) {
|
|
7727
7735
|
url.searchParams.set("userAttributes", JSON.stringify(finalUserAttributes));
|
|
7728
7736
|
}
|
|
7729
7737
|
if (query) {
|
|
@@ -7736,6 +7744,28 @@ var generateContentUrl = (options) => {
|
|
|
7736
7744
|
}
|
|
7737
7745
|
return url;
|
|
7738
7746
|
};
|
|
7747
|
+
var getUserAttributesFromQueryOptions = (queryOptions) => {
|
|
7748
|
+
const newUserAttributes = {};
|
|
7749
|
+
for (const key in queryOptions) {
|
|
7750
|
+
if (key.startsWith("userAttributes.")) {
|
|
7751
|
+
newUserAttributes[key] = queryOptions[key];
|
|
7752
|
+
delete queryOptions[key];
|
|
7753
|
+
}
|
|
7754
|
+
}
|
|
7755
|
+
return newUserAttributes;
|
|
7756
|
+
};
|
|
7757
|
+
var getUserAttributesAsJSON = (queryOptions) => {
|
|
7758
|
+
if (isBrowser() && queryOptions["preview"] === "BUILDER_STUDIO") {
|
|
7759
|
+
queryOptions["userAttributes.urlPath"] = window.location.pathname;
|
|
7760
|
+
queryOptions["userAttributes.host"] = window.location.host;
|
|
7761
|
+
const queryOptionsForUserAttributes = getUserAttributesFromQueryOptions(queryOptions);
|
|
7762
|
+
const {
|
|
7763
|
+
userAttributes
|
|
7764
|
+
} = unflatten(queryOptionsForUserAttributes);
|
|
7765
|
+
return userAttributes;
|
|
7766
|
+
}
|
|
7767
|
+
return {};
|
|
7768
|
+
};
|
|
7739
7769
|
|
|
7740
7770
|
// src/functions/get-content/index.ts
|
|
7741
7771
|
var checkContentHasResults = (content) => "results" in content;
|
|
@@ -8357,12 +8387,12 @@ var getWrapperClassName = (variationId) => {
|
|
|
8357
8387
|
|
|
8358
8388
|
// src/components/content/components/enable-editor.tsx
|
|
8359
8389
|
function EnableEditor(props) {
|
|
8360
|
-
const [ContentWrapper, setContentWrapper] =
|
|
8390
|
+
const [ContentWrapper, setContentWrapper] = createSignal15(
|
|
8361
8391
|
props.contentWrapper || "div"
|
|
8362
8392
|
);
|
|
8363
|
-
const [httpReqsData, setHttpReqsData] =
|
|
8364
|
-
const [httpReqsPending, setHttpReqsPending] =
|
|
8365
|
-
const [clicked, setClicked] =
|
|
8393
|
+
const [httpReqsData, setHttpReqsData] = createSignal15({});
|
|
8394
|
+
const [httpReqsPending, setHttpReqsPending] = createSignal15({});
|
|
8395
|
+
const [clicked, setClicked] = createSignal15(false);
|
|
8366
8396
|
function mergeNewRootState(newData) {
|
|
8367
8397
|
const combinedState = {
|
|
8368
8398
|
...props.builderContextSignal.rootState,
|
|
@@ -8396,7 +8426,7 @@ function EnableEditor(props) {
|
|
|
8396
8426
|
content: newContentValue
|
|
8397
8427
|
}));
|
|
8398
8428
|
}
|
|
8399
|
-
const showContentProps =
|
|
8429
|
+
const showContentProps = createMemo15(() => {
|
|
8400
8430
|
return props.showContent ? {} : {
|
|
8401
8431
|
hidden: true,
|
|
8402
8432
|
"aria-hidden": true
|
|
@@ -8553,11 +8583,16 @@ function EnableEditor(props) {
|
|
|
8553
8583
|
`builder.overrides.${searchParamPreviewModel}`
|
|
8554
8584
|
);
|
|
8555
8585
|
const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
|
|
8556
|
-
if (searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
|
|
8586
|
+
if (searchParamPreviewModel === "BUILDER_STUDIO" || searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
|
|
8557
8587
|
fetchOneEntry({
|
|
8558
|
-
model: props.model,
|
|
8588
|
+
model: props.model || "",
|
|
8559
8589
|
apiKey: props.apiKey,
|
|
8560
|
-
apiVersion: props.builderContextSignal.apiVersion
|
|
8590
|
+
apiVersion: props.builderContextSignal.apiVersion,
|
|
8591
|
+
...searchParamPreviewModel === "BUILDER_STUDIO" && props.context?.symbolId ? {
|
|
8592
|
+
query: {
|
|
8593
|
+
id: props.context.symbolId
|
|
8594
|
+
}
|
|
8595
|
+
} : {}
|
|
8561
8596
|
}).then((content) => {
|
|
8562
8597
|
if (content) {
|
|
8563
8598
|
mergeNewContent(content);
|
|
@@ -8567,14 +8602,14 @@ function EnableEditor(props) {
|
|
|
8567
8602
|
}
|
|
8568
8603
|
}
|
|
8569
8604
|
});
|
|
8570
|
-
const onUpdateFn_0_props_content =
|
|
8605
|
+
const onUpdateFn_0_props_content = createMemo15(() => props.content);
|
|
8571
8606
|
function onUpdateFn_0() {
|
|
8572
8607
|
if (props.content) {
|
|
8573
8608
|
mergeNewContent(props.content);
|
|
8574
8609
|
}
|
|
8575
8610
|
}
|
|
8576
8611
|
createEffect3(on3(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
|
|
8577
|
-
const onUpdateFn_1_props_builderContextSignal_rootState =
|
|
8612
|
+
const onUpdateFn_1_props_builderContextSignal_rootState = createMemo15(
|
|
8578
8613
|
() => props.builderContextSignal.rootState
|
|
8579
8614
|
);
|
|
8580
8615
|
function onUpdateFn_1() {
|
|
@@ -8586,14 +8621,14 @@ function EnableEditor(props) {
|
|
|
8586
8621
|
onUpdateFn_1
|
|
8587
8622
|
)
|
|
8588
8623
|
);
|
|
8589
|
-
const onUpdateFn_2_props_data =
|
|
8624
|
+
const onUpdateFn_2_props_data = createMemo15(() => props.data);
|
|
8590
8625
|
function onUpdateFn_2() {
|
|
8591
8626
|
if (props.data) {
|
|
8592
8627
|
mergeNewRootState(props.data);
|
|
8593
8628
|
}
|
|
8594
8629
|
}
|
|
8595
8630
|
createEffect3(on3(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
|
|
8596
|
-
const onUpdateFn_3_props_locale =
|
|
8631
|
+
const onUpdateFn_3_props_locale = createMemo15(() => props.locale);
|
|
8597
8632
|
function onUpdateFn_3() {
|
|
8598
8633
|
if (props.locale) {
|
|
8599
8634
|
mergeNewRootState({
|
|
@@ -8625,9 +8660,9 @@ function EnableEditor(props) {
|
|
|
8625
8660
|
var Enable_editor_default = EnableEditor;
|
|
8626
8661
|
|
|
8627
8662
|
// src/components/content/components/styles.tsx
|
|
8628
|
-
import { createSignal as
|
|
8663
|
+
import { createSignal as createSignal16 } from "solid-js";
|
|
8629
8664
|
function ContentStyles(props) {
|
|
8630
|
-
const [injectedStyles, setInjectedStyles] =
|
|
8665
|
+
const [injectedStyles, setInjectedStyles] = createSignal16(
|
|
8631
8666
|
`
|
|
8632
8667
|
${getCss({
|
|
8633
8668
|
cssCode: props.cssCode,
|
|
@@ -8685,7 +8720,7 @@ var getContentInitialValue = ({
|
|
|
8685
8720
|
|
|
8686
8721
|
// src/components/content/content.tsx
|
|
8687
8722
|
function ContentComponent(props) {
|
|
8688
|
-
const [scriptStr, setScriptStr] =
|
|
8723
|
+
const [scriptStr, setScriptStr] = createSignal17(
|
|
8689
8724
|
getUpdateVariantVisibilityScript({
|
|
8690
8725
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
8691
8726
|
variationId: props.content?.testVariationId,
|
|
@@ -8693,7 +8728,7 @@ function ContentComponent(props) {
|
|
|
8693
8728
|
contentId: props.content?.id
|
|
8694
8729
|
})
|
|
8695
8730
|
);
|
|
8696
|
-
const [registeredComponents, setRegisteredComponents] =
|
|
8731
|
+
const [registeredComponents, setRegisteredComponents] = createSignal17(
|
|
8697
8732
|
[
|
|
8698
8733
|
...getDefaultRegisteredComponents(),
|
|
8699
8734
|
...props.customComponents || []
|
|
@@ -8708,7 +8743,7 @@ function ContentComponent(props) {
|
|
|
8708
8743
|
{}
|
|
8709
8744
|
)
|
|
8710
8745
|
);
|
|
8711
|
-
const [builderContextSignal, setBuilderContextSignal] =
|
|
8746
|
+
const [builderContextSignal, setBuilderContextSignal] = createSignal17({
|
|
8712
8747
|
content: getContentInitialValue({
|
|
8713
8748
|
content: props.content,
|
|
8714
8749
|
data: props.data
|
|
@@ -8816,13 +8851,13 @@ var Content_default = ContentComponent;
|
|
|
8816
8851
|
|
|
8817
8852
|
// src/components/content-variants/content-variants.tsx
|
|
8818
8853
|
function ContentVariants(props) {
|
|
8819
|
-
const [shouldRenderVariants, setShouldRenderVariants] =
|
|
8854
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal18(
|
|
8820
8855
|
checkShouldRenderVariants({
|
|
8821
8856
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
8822
8857
|
content: props.content
|
|
8823
8858
|
})
|
|
8824
8859
|
);
|
|
8825
|
-
const updateCookieAndStylesScriptStr =
|
|
8860
|
+
const updateCookieAndStylesScriptStr = createMemo18(() => {
|
|
8826
8861
|
return getUpdateCookieAndStylesScript(
|
|
8827
8862
|
getVariants(props.content).map((value) => ({
|
|
8828
8863
|
id: value.testVariationId,
|
|
@@ -8831,10 +8866,10 @@ function ContentVariants(props) {
|
|
|
8831
8866
|
props.content?.id || ""
|
|
8832
8867
|
);
|
|
8833
8868
|
});
|
|
8834
|
-
const hideVariantsStyleString =
|
|
8869
|
+
const hideVariantsStyleString = createMemo18(() => {
|
|
8835
8870
|
return getVariants(props.content).map((value) => `.variant-${value.testVariationId} { display: none; } `).join("");
|
|
8836
8871
|
});
|
|
8837
|
-
const defaultContent =
|
|
8872
|
+
const defaultContent = createMemo18(() => {
|
|
8838
8873
|
return shouldRenderVariants() ? {
|
|
8839
8874
|
...props.content,
|
|
8840
8875
|
testVariationId: props.content?.id
|
|
@@ -8946,14 +8981,14 @@ var fetchSymbolContent = async ({
|
|
|
8946
8981
|
|
|
8947
8982
|
// src/blocks/symbol/symbol.tsx
|
|
8948
8983
|
function Symbol2(props) {
|
|
8949
|
-
const [contentToUse, setContentToUse] =
|
|
8950
|
-
const blocksWrapper =
|
|
8984
|
+
const [contentToUse, setContentToUse] = createSignal19(props.symbol?.content);
|
|
8985
|
+
const blocksWrapper = createMemo19(() => {
|
|
8951
8986
|
return "div";
|
|
8952
8987
|
});
|
|
8953
|
-
const contentWrapper =
|
|
8988
|
+
const contentWrapper = createMemo19(() => {
|
|
8954
8989
|
return "div";
|
|
8955
8990
|
});
|
|
8956
|
-
const className =
|
|
8991
|
+
const className = createMemo19(() => {
|
|
8957
8992
|
return [
|
|
8958
8993
|
...[props.attributes[getClassPropName()]],
|
|
8959
8994
|
"builder-symbol",
|
|
@@ -8975,7 +9010,7 @@ function Symbol2(props) {
|
|
|
8975
9010
|
}
|
|
8976
9011
|
onMount8(() => {
|
|
8977
9012
|
});
|
|
8978
|
-
const onUpdateFn_0_props_symbol =
|
|
9013
|
+
const onUpdateFn_0_props_symbol = createMemo19(() => props.symbol);
|
|
8979
9014
|
function onUpdateFn_0() {
|
|
8980
9015
|
setContent();
|
|
8981
9016
|
}
|