@builder.io/sdk-solid 2.0.25 → 2.0.28
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 +8 -0
- package/lib/browser/dev.js +41 -13
- package/lib/browser/dev.jsx +33 -17
- package/lib/browser/index.js +41 -13
- package/lib/browser/index.jsx +33 -17
- package/lib/edge/dev.js +41 -13
- package/lib/edge/dev.jsx +33 -17
- package/lib/edge/index.js +41 -13
- package/lib/edge/index.jsx +33 -17
- package/lib/node/dev.js +44 -17
- package/lib/node/dev.jsx +36 -21
- package/lib/node/index.js +44 -17
- package/lib/node/index.jsx +36 -21
- package/package.json +1 -1
package/lib/edge/dev.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { delegateEvents, createComponent, spread, mergeProps, insert, effect, setAttribute, className, style, template, Dynamic, memo, use } from 'solid-js/web';
|
|
2
|
-
import { createContext, useContext, Show, For,
|
|
2
|
+
import { createContext, useContext, Show, For, createMemo, onMount, createSignal, createEffect, on } from 'solid-js';
|
|
3
3
|
|
|
4
4
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
5
5
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
@@ -4839,15 +4839,20 @@ var getColumnsClass = (id2) => {
|
|
|
4839
4839
|
|
|
4840
4840
|
// src/blocks/columns/columns.tsx
|
|
4841
4841
|
var _tmpl$3 = /* @__PURE__ */ template(`<div>`);
|
|
4842
|
-
var _tmpl$22 = /* @__PURE__ */ template(`<style>.div-
|
|
4842
|
+
var _tmpl$22 = /* @__PURE__ */ template(`<style>.div-a1dad3b8 {
|
|
4843
4843
|
display: flex;
|
|
4844
4844
|
line-height: normal;
|
|
4845
4845
|
}`);
|
|
4846
4846
|
function Columns(props) {
|
|
4847
|
-
const
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
const
|
|
4847
|
+
const gutterSize = createMemo(() => {
|
|
4848
|
+
return typeof props.space === "number" ? props.space || 0 : 20;
|
|
4849
|
+
});
|
|
4850
|
+
const cols = createMemo(() => {
|
|
4851
|
+
return props.columns || [];
|
|
4852
|
+
});
|
|
4853
|
+
const stackAt = createMemo(() => {
|
|
4854
|
+
return props.stackColumnsAt || "tablet";
|
|
4855
|
+
});
|
|
4851
4856
|
function getTagName(column) {
|
|
4852
4857
|
return column.link ? props.builderLinkComponent || "a" : "div";
|
|
4853
4858
|
}
|
|
@@ -4871,6 +4876,9 @@ function Columns(props) {
|
|
|
4871
4876
|
}) {
|
|
4872
4877
|
return stackAt() === "never" ? desktopStyle : stackedStyle;
|
|
4873
4878
|
}
|
|
4879
|
+
const flexDir = createMemo(() => {
|
|
4880
|
+
return props.stackColumnsAt === "never" ? "row" : props.reverseColumnsWhenStacked ? "column-reverse" : "column";
|
|
4881
|
+
});
|
|
4874
4882
|
function columnsCssVars() {
|
|
4875
4883
|
return {
|
|
4876
4884
|
"--flex-dir": flexDir(),
|
|
@@ -4960,7 +4968,7 @@ function Columns(props) {
|
|
|
4960
4968
|
const _el$ = _tmpl$3();
|
|
4961
4969
|
spread(_el$, mergeProps({
|
|
4962
4970
|
get ["class"]() {
|
|
4963
|
-
return getColumnsClass(props.builderBlock?.id) + " div-
|
|
4971
|
+
return getColumnsClass(props.builderBlock?.id) + " div-a1dad3b8";
|
|
4964
4972
|
},
|
|
4965
4973
|
get style() {
|
|
4966
4974
|
return columnsCssVars();
|
|
@@ -7949,7 +7957,7 @@ function getPreviewContent(_searchParams) {
|
|
|
7949
7957
|
}
|
|
7950
7958
|
|
|
7951
7959
|
// src/constants/sdk-version.ts
|
|
7952
|
-
var SDK_VERSION = "2.0.
|
|
7960
|
+
var SDK_VERSION = "2.0.28";
|
|
7953
7961
|
|
|
7954
7962
|
// src/helpers/sdk-headers.ts
|
|
7955
7963
|
var getSdkHeaders = () => ({
|
|
@@ -8061,7 +8069,8 @@ var generateContentUrl = (options) => {
|
|
|
8061
8069
|
cacheSeconds,
|
|
8062
8070
|
staleCacheSeconds,
|
|
8063
8071
|
sort,
|
|
8064
|
-
includeUnpublished
|
|
8072
|
+
includeUnpublished,
|
|
8073
|
+
apiHost
|
|
8065
8074
|
} = options;
|
|
8066
8075
|
if (!apiKey) {
|
|
8067
8076
|
throw new Error("Missing API key");
|
|
@@ -8070,7 +8079,8 @@ var generateContentUrl = (options) => {
|
|
|
8070
8079
|
throw new Error(`Invalid apiVersion: expected 'v3', received '${apiVersion}'`);
|
|
8071
8080
|
}
|
|
8072
8081
|
const noTraverse = limit !== 1;
|
|
8073
|
-
const
|
|
8082
|
+
const baseUrl = apiHost || "https://cdn.builder.io";
|
|
8083
|
+
const url = new URL(`${baseUrl}/api/${apiVersion}/content/${model}`);
|
|
8074
8084
|
url.searchParams.set("apiKey", apiKey);
|
|
8075
8085
|
url.searchParams.set("limit", String(limit));
|
|
8076
8086
|
url.searchParams.set("noTraverse", String(noTraverse));
|
|
@@ -8358,7 +8368,10 @@ var createEvent = async ({
|
|
|
8358
8368
|
ownerId: apiKey
|
|
8359
8369
|
}
|
|
8360
8370
|
});
|
|
8361
|
-
async function _track(
|
|
8371
|
+
async function _track({
|
|
8372
|
+
apiHost,
|
|
8373
|
+
...eventProps
|
|
8374
|
+
}) {
|
|
8362
8375
|
if (!eventProps.apiKey) {
|
|
8363
8376
|
logger.error("Missing API key for track call. Please provide your API key.");
|
|
8364
8377
|
return;
|
|
@@ -8372,7 +8385,8 @@ async function _track(eventProps) {
|
|
|
8372
8385
|
if (!(isBrowser() || TARGET === "reactNative")) {
|
|
8373
8386
|
return;
|
|
8374
8387
|
}
|
|
8375
|
-
|
|
8388
|
+
const baseUrl = apiHost || "https://cdn.builder.io";
|
|
8389
|
+
return fetch(`${baseUrl}/api/v1/track`, {
|
|
8376
8390
|
method: "POST",
|
|
8377
8391
|
body: JSON.stringify({
|
|
8378
8392
|
events: [await createEvent(eventProps)]
|
|
@@ -8816,6 +8830,7 @@ function EnableEditor(props) {
|
|
|
8816
8830
|
const variationId = props.builderContextSignal.content?.testVariationId;
|
|
8817
8831
|
const contentId = props.builderContextSignal.content?.id;
|
|
8818
8832
|
_track({
|
|
8833
|
+
apiHost: props.apiHost,
|
|
8819
8834
|
type: "click",
|
|
8820
8835
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
8821
8836
|
contentId,
|
|
@@ -8875,7 +8890,7 @@ function EnableEditor(props) {
|
|
|
8875
8890
|
emitStateUpdate();
|
|
8876
8891
|
onMount(() => {
|
|
8877
8892
|
if (isBrowser()) {
|
|
8878
|
-
if (isEditing()) {
|
|
8893
|
+
if (isEditing() && !props.isNestedRender) {
|
|
8879
8894
|
window.addEventListener("message", processMessage);
|
|
8880
8895
|
registerInsertMenu();
|
|
8881
8896
|
setupBrowserForEditing({
|
|
@@ -8901,6 +8916,7 @@ function EnableEditor(props) {
|
|
|
8901
8916
|
const contentId = props.builderContextSignal.content?.id;
|
|
8902
8917
|
const apiKeyProp = props.apiKey;
|
|
8903
8918
|
_track({
|
|
8919
|
+
apiHost: props.apiHost,
|
|
8904
8920
|
type: "impression",
|
|
8905
8921
|
canTrack: true,
|
|
8906
8922
|
contentId,
|
|
@@ -9149,6 +9165,9 @@ function ContentComponent(props) {
|
|
|
9149
9165
|
},
|
|
9150
9166
|
get children() {
|
|
9151
9167
|
return createComponent(enable_editor_default, mergeProps({
|
|
9168
|
+
get apiHost() {
|
|
9169
|
+
return props.apiHost;
|
|
9170
|
+
},
|
|
9152
9171
|
get nonce() {
|
|
9153
9172
|
return props.nonce;
|
|
9154
9173
|
},
|
|
@@ -9190,6 +9209,9 @@ function ContentComponent(props) {
|
|
|
9190
9209
|
},
|
|
9191
9210
|
get trustedHosts() {
|
|
9192
9211
|
return props.trustedHosts;
|
|
9212
|
+
},
|
|
9213
|
+
get isNestedRender() {
|
|
9214
|
+
return props.isNestedRender;
|
|
9193
9215
|
}
|
|
9194
9216
|
}, {
|
|
9195
9217
|
setBuilderContextSignal
|
|
@@ -9322,6 +9344,9 @@ function ContentVariants(props) {
|
|
|
9322
9344
|
children: (variant, _index) => {
|
|
9323
9345
|
_index();
|
|
9324
9346
|
return createComponent(content_default, mergeProps({
|
|
9347
|
+
get apiHost() {
|
|
9348
|
+
return props.apiHost;
|
|
9349
|
+
},
|
|
9325
9350
|
get isNestedRender() {
|
|
9326
9351
|
return props.isNestedRender;
|
|
9327
9352
|
},
|
|
@@ -9386,6 +9411,9 @@ function ContentVariants(props) {
|
|
|
9386
9411
|
})];
|
|
9387
9412
|
}
|
|
9388
9413
|
}), createComponent(content_default, mergeProps({
|
|
9414
|
+
get apiHost() {
|
|
9415
|
+
return props.apiHost;
|
|
9416
|
+
},
|
|
9389
9417
|
get nonce() {
|
|
9390
9418
|
return props.nonce;
|
|
9391
9419
|
},
|
package/lib/edge/dev.jsx
CHANGED
|
@@ -83,7 +83,7 @@ function Button(props) {
|
|
|
83
83
|
var button_default = Button;
|
|
84
84
|
|
|
85
85
|
// src/blocks/columns/columns.tsx
|
|
86
|
-
import { Show as Show7, For as For4,
|
|
86
|
+
import { Show as Show7, For as For4, createMemo as createMemo7 } from "solid-js";
|
|
87
87
|
|
|
88
88
|
// src/components/blocks/blocks.tsx
|
|
89
89
|
import { useContext, Show as Show6, For as For3 } from "solid-js";
|
|
@@ -4634,14 +4634,15 @@ var getColumnsClass = (id2) => {
|
|
|
4634
4634
|
|
|
4635
4635
|
// src/blocks/columns/columns.tsx
|
|
4636
4636
|
function Columns(props) {
|
|
4637
|
-
const
|
|
4638
|
-
typeof props.space === "number" ? props.space || 0 : 20
|
|
4639
|
-
);
|
|
4640
|
-
const
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4637
|
+
const gutterSize = createMemo7(() => {
|
|
4638
|
+
return typeof props.space === "number" ? props.space || 0 : 20;
|
|
4639
|
+
});
|
|
4640
|
+
const cols = createMemo7(() => {
|
|
4641
|
+
return props.columns || [];
|
|
4642
|
+
});
|
|
4643
|
+
const stackAt = createMemo7(() => {
|
|
4644
|
+
return props.stackColumnsAt || "tablet";
|
|
4645
|
+
});
|
|
4645
4646
|
function getTagName(column) {
|
|
4646
4647
|
return column.link ? props.builderLinkComponent || "a" : "div";
|
|
4647
4648
|
}
|
|
@@ -4665,6 +4666,9 @@ function Columns(props) {
|
|
|
4665
4666
|
}) {
|
|
4666
4667
|
return stackAt() === "never" ? desktopStyle : stackedStyle;
|
|
4667
4668
|
}
|
|
4669
|
+
const flexDir = createMemo7(() => {
|
|
4670
|
+
return props.stackColumnsAt === "never" ? "row" : props.reverseColumnsWhenStacked ? "column-reverse" : "column";
|
|
4671
|
+
});
|
|
4668
4672
|
function columnsCssVars() {
|
|
4669
4673
|
return {
|
|
4670
4674
|
"--flex-dir": flexDir(),
|
|
@@ -4754,7 +4758,7 @@ function Columns(props) {
|
|
|
4754
4758
|
}
|
|
4755
4759
|
return <>
|
|
4756
4760
|
<div
|
|
4757
|
-
class={getColumnsClass(props.builderBlock?.id) + " div-
|
|
4761
|
+
class={getColumnsClass(props.builderBlock?.id) + " div-a1dad3b8"}
|
|
4758
4762
|
style={columnsCssVars()}
|
|
4759
4763
|
{...{}}
|
|
4760
4764
|
>
|
|
@@ -4783,7 +4787,7 @@ function Columns(props) {
|
|
|
4783
4787
|
/></Dynamic_renderer_default>;
|
|
4784
4788
|
}}</For4>
|
|
4785
4789
|
</div>
|
|
4786
|
-
<style>{`.div-
|
|
4790
|
+
<style>{`.div-a1dad3b8 {
|
|
4787
4791
|
display: flex;
|
|
4788
4792
|
line-height: normal;
|
|
4789
4793
|
}`}</style>
|
|
@@ -7439,7 +7443,7 @@ function getPreviewContent(_searchParams) {
|
|
|
7439
7443
|
}
|
|
7440
7444
|
|
|
7441
7445
|
// src/constants/sdk-version.ts
|
|
7442
|
-
var SDK_VERSION = "2.0.
|
|
7446
|
+
var SDK_VERSION = "2.0.28";
|
|
7443
7447
|
|
|
7444
7448
|
// src/helpers/sdk-headers.ts
|
|
7445
7449
|
var getSdkHeaders = () => ({
|
|
@@ -7551,7 +7555,8 @@ var generateContentUrl = (options) => {
|
|
|
7551
7555
|
cacheSeconds,
|
|
7552
7556
|
staleCacheSeconds,
|
|
7553
7557
|
sort,
|
|
7554
|
-
includeUnpublished
|
|
7558
|
+
includeUnpublished,
|
|
7559
|
+
apiHost
|
|
7555
7560
|
} = options;
|
|
7556
7561
|
if (!apiKey) {
|
|
7557
7562
|
throw new Error("Missing API key");
|
|
@@ -7560,7 +7565,8 @@ var generateContentUrl = (options) => {
|
|
|
7560
7565
|
throw new Error(`Invalid apiVersion: expected 'v3', received '${apiVersion}'`);
|
|
7561
7566
|
}
|
|
7562
7567
|
const noTraverse = limit !== 1;
|
|
7563
|
-
const
|
|
7568
|
+
const baseUrl = apiHost || "https://cdn.builder.io";
|
|
7569
|
+
const url = new URL(`${baseUrl}/api/${apiVersion}/content/${model}`);
|
|
7564
7570
|
url.searchParams.set("apiKey", apiKey);
|
|
7565
7571
|
url.searchParams.set("limit", String(limit));
|
|
7566
7572
|
url.searchParams.set("noTraverse", String(noTraverse));
|
|
@@ -7848,7 +7854,10 @@ var createEvent = async ({
|
|
|
7848
7854
|
ownerId: apiKey
|
|
7849
7855
|
}
|
|
7850
7856
|
});
|
|
7851
|
-
async function _track(
|
|
7857
|
+
async function _track({
|
|
7858
|
+
apiHost,
|
|
7859
|
+
...eventProps
|
|
7860
|
+
}) {
|
|
7852
7861
|
if (!eventProps.apiKey) {
|
|
7853
7862
|
logger.error("Missing API key for track call. Please provide your API key.");
|
|
7854
7863
|
return;
|
|
@@ -7862,7 +7871,8 @@ async function _track(eventProps) {
|
|
|
7862
7871
|
if (!(isBrowser() || TARGET === "reactNative")) {
|
|
7863
7872
|
return;
|
|
7864
7873
|
}
|
|
7865
|
-
|
|
7874
|
+
const baseUrl = apiHost || "https://cdn.builder.io";
|
|
7875
|
+
return fetch(`${baseUrl}/api/v1/track`, {
|
|
7866
7876
|
method: "POST",
|
|
7867
7877
|
body: JSON.stringify({
|
|
7868
7878
|
events: [await createEvent(eventProps)]
|
|
@@ -8305,6 +8315,7 @@ function EnableEditor(props) {
|
|
|
8305
8315
|
const variationId = props.builderContextSignal.content?.testVariationId;
|
|
8306
8316
|
const contentId = props.builderContextSignal.content?.id;
|
|
8307
8317
|
_track({
|
|
8318
|
+
apiHost: props.apiHost,
|
|
8308
8319
|
type: "click",
|
|
8309
8320
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
8310
8321
|
contentId,
|
|
@@ -8374,7 +8385,7 @@ function EnableEditor(props) {
|
|
|
8374
8385
|
emitStateUpdate();
|
|
8375
8386
|
onMount6(() => {
|
|
8376
8387
|
if (isBrowser()) {
|
|
8377
|
-
if (isEditing()) {
|
|
8388
|
+
if (isEditing() && !props.isNestedRender) {
|
|
8378
8389
|
window.addEventListener("message", processMessage);
|
|
8379
8390
|
registerInsertMenu();
|
|
8380
8391
|
setupBrowserForEditing({
|
|
@@ -8405,6 +8416,7 @@ function EnableEditor(props) {
|
|
|
8405
8416
|
const contentId = props.builderContextSignal.content?.id;
|
|
8406
8417
|
const apiKeyProp = props.apiKey;
|
|
8407
8418
|
_track({
|
|
8419
|
+
apiHost: props.apiHost,
|
|
8408
8420
|
type: "impression",
|
|
8409
8421
|
canTrack: true,
|
|
8410
8422
|
contentId,
|
|
@@ -8644,6 +8656,7 @@ function ContentComponent(props) {
|
|
|
8644
8656
|
registeredComponents: registeredComponents()
|
|
8645
8657
|
}}
|
|
8646
8658
|
><Enable_editor_default
|
|
8659
|
+
apiHost={props.apiHost}
|
|
8647
8660
|
nonce={props.nonce}
|
|
8648
8661
|
content={props.content}
|
|
8649
8662
|
data={props.data}
|
|
@@ -8658,6 +8671,7 @@ function ContentComponent(props) {
|
|
|
8658
8671
|
contentWrapper={props.contentWrapper}
|
|
8659
8672
|
contentWrapperProps={props.contentWrapperProps}
|
|
8660
8673
|
trustedHosts={props.trustedHosts}
|
|
8674
|
+
isNestedRender={props.isNestedRender}
|
|
8661
8675
|
{...{
|
|
8662
8676
|
setBuilderContextSignal
|
|
8663
8677
|
}}
|
|
@@ -8736,6 +8750,7 @@ function ContentVariants(props) {
|
|
|
8736
8750
|
<For9 each={getVariants(props.content)}>{(variant, _index) => {
|
|
8737
8751
|
const index = _index();
|
|
8738
8752
|
return <Content_default
|
|
8753
|
+
apiHost={props.apiHost}
|
|
8739
8754
|
isNestedRender={props.isNestedRender}
|
|
8740
8755
|
key={variant.testVariationId}
|
|
8741
8756
|
nonce={props.nonce}
|
|
@@ -8762,6 +8777,7 @@ function ContentVariants(props) {
|
|
|
8762
8777
|
}}</For9>
|
|
8763
8778
|
</Show15>
|
|
8764
8779
|
<Content_default
|
|
8780
|
+
apiHost={props.apiHost}
|
|
8765
8781
|
nonce={props.nonce}
|
|
8766
8782
|
isNestedRender={props.isNestedRender}
|
|
8767
8783
|
{...{}}
|
package/lib/edge/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { delegateEvents, createComponent, spread, mergeProps, insert, effect, setAttribute, className, style, template, Dynamic, memo, use } from 'solid-js/web';
|
|
2
|
-
import { createContext, useContext, Show, For,
|
|
2
|
+
import { createContext, useContext, Show, For, createMemo, onMount, createSignal, createEffect, on } from 'solid-js';
|
|
3
3
|
|
|
4
4
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
5
5
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
@@ -4833,15 +4833,20 @@ var getColumnsClass = (id2) => {
|
|
|
4833
4833
|
|
|
4834
4834
|
// src/blocks/columns/columns.tsx
|
|
4835
4835
|
var _tmpl$3 = /* @__PURE__ */ template(`<div>`);
|
|
4836
|
-
var _tmpl$22 = /* @__PURE__ */ template(`<style>.div-
|
|
4836
|
+
var _tmpl$22 = /* @__PURE__ */ template(`<style>.div-a1dad3b8 {
|
|
4837
4837
|
display: flex;
|
|
4838
4838
|
line-height: normal;
|
|
4839
4839
|
}`);
|
|
4840
4840
|
function Columns(props) {
|
|
4841
|
-
const
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
const
|
|
4841
|
+
const gutterSize = createMemo(() => {
|
|
4842
|
+
return typeof props.space === "number" ? props.space || 0 : 20;
|
|
4843
|
+
});
|
|
4844
|
+
const cols = createMemo(() => {
|
|
4845
|
+
return props.columns || [];
|
|
4846
|
+
});
|
|
4847
|
+
const stackAt = createMemo(() => {
|
|
4848
|
+
return props.stackColumnsAt || "tablet";
|
|
4849
|
+
});
|
|
4845
4850
|
function getTagName(column) {
|
|
4846
4851
|
return column.link ? props.builderLinkComponent || "a" : "div";
|
|
4847
4852
|
}
|
|
@@ -4865,6 +4870,9 @@ function Columns(props) {
|
|
|
4865
4870
|
}) {
|
|
4866
4871
|
return stackAt() === "never" ? desktopStyle : stackedStyle;
|
|
4867
4872
|
}
|
|
4873
|
+
const flexDir = createMemo(() => {
|
|
4874
|
+
return props.stackColumnsAt === "never" ? "row" : props.reverseColumnsWhenStacked ? "column-reverse" : "column";
|
|
4875
|
+
});
|
|
4868
4876
|
function columnsCssVars() {
|
|
4869
4877
|
return {
|
|
4870
4878
|
"--flex-dir": flexDir(),
|
|
@@ -4954,7 +4962,7 @@ function Columns(props) {
|
|
|
4954
4962
|
const _el$ = _tmpl$3();
|
|
4955
4963
|
spread(_el$, mergeProps({
|
|
4956
4964
|
get ["class"]() {
|
|
4957
|
-
return getColumnsClass(props.builderBlock?.id) + " div-
|
|
4965
|
+
return getColumnsClass(props.builderBlock?.id) + " div-a1dad3b8";
|
|
4958
4966
|
},
|
|
4959
4967
|
get style() {
|
|
4960
4968
|
return columnsCssVars();
|
|
@@ -7939,7 +7947,7 @@ function getPreviewContent(_searchParams) {
|
|
|
7939
7947
|
}
|
|
7940
7948
|
|
|
7941
7949
|
// src/constants/sdk-version.ts
|
|
7942
|
-
var SDK_VERSION = "2.0.
|
|
7950
|
+
var SDK_VERSION = "2.0.28";
|
|
7943
7951
|
|
|
7944
7952
|
// src/helpers/sdk-headers.ts
|
|
7945
7953
|
var getSdkHeaders = () => ({
|
|
@@ -8049,7 +8057,8 @@ var generateContentUrl = (options) => {
|
|
|
8049
8057
|
cacheSeconds,
|
|
8050
8058
|
staleCacheSeconds,
|
|
8051
8059
|
sort,
|
|
8052
|
-
includeUnpublished
|
|
8060
|
+
includeUnpublished,
|
|
8061
|
+
apiHost
|
|
8053
8062
|
} = options;
|
|
8054
8063
|
if (!apiKey) {
|
|
8055
8064
|
throw new Error("Missing API key");
|
|
@@ -8058,7 +8067,8 @@ var generateContentUrl = (options) => {
|
|
|
8058
8067
|
throw new Error(`Invalid apiVersion: expected 'v3', received '${apiVersion}'`);
|
|
8059
8068
|
}
|
|
8060
8069
|
const noTraverse = limit !== 1;
|
|
8061
|
-
const
|
|
8070
|
+
const baseUrl = apiHost || "https://cdn.builder.io";
|
|
8071
|
+
const url = new URL(`${baseUrl}/api/${apiVersion}/content/${model}`);
|
|
8062
8072
|
url.searchParams.set("apiKey", apiKey);
|
|
8063
8073
|
url.searchParams.set("limit", String(limit));
|
|
8064
8074
|
url.searchParams.set("noTraverse", String(noTraverse));
|
|
@@ -8344,7 +8354,10 @@ var createEvent = async ({
|
|
|
8344
8354
|
ownerId: apiKey
|
|
8345
8355
|
}
|
|
8346
8356
|
});
|
|
8347
|
-
async function _track(
|
|
8357
|
+
async function _track({
|
|
8358
|
+
apiHost,
|
|
8359
|
+
...eventProps
|
|
8360
|
+
}) {
|
|
8348
8361
|
if (!eventProps.apiKey) {
|
|
8349
8362
|
logger.error("Missing API key for track call. Please provide your API key.");
|
|
8350
8363
|
return;
|
|
@@ -8358,7 +8371,8 @@ async function _track(eventProps) {
|
|
|
8358
8371
|
if (!(isBrowser() || TARGET === "reactNative")) {
|
|
8359
8372
|
return;
|
|
8360
8373
|
}
|
|
8361
|
-
|
|
8374
|
+
const baseUrl = apiHost || "https://cdn.builder.io";
|
|
8375
|
+
return fetch(`${baseUrl}/api/v1/track`, {
|
|
8362
8376
|
method: "POST",
|
|
8363
8377
|
body: JSON.stringify({
|
|
8364
8378
|
events: [await createEvent(eventProps)]
|
|
@@ -8800,6 +8814,7 @@ function EnableEditor(props) {
|
|
|
8800
8814
|
const variationId = props.builderContextSignal.content?.testVariationId;
|
|
8801
8815
|
const contentId = props.builderContextSignal.content?.id;
|
|
8802
8816
|
_track({
|
|
8817
|
+
apiHost: props.apiHost,
|
|
8803
8818
|
type: "click",
|
|
8804
8819
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
8805
8820
|
contentId,
|
|
@@ -8858,7 +8873,7 @@ function EnableEditor(props) {
|
|
|
8858
8873
|
emitStateUpdate();
|
|
8859
8874
|
onMount(() => {
|
|
8860
8875
|
if (isBrowser()) {
|
|
8861
|
-
if (isEditing()) {
|
|
8876
|
+
if (isEditing() && !props.isNestedRender) {
|
|
8862
8877
|
window.addEventListener("message", processMessage);
|
|
8863
8878
|
registerInsertMenu();
|
|
8864
8879
|
setupBrowserForEditing({
|
|
@@ -8884,6 +8899,7 @@ function EnableEditor(props) {
|
|
|
8884
8899
|
const contentId = props.builderContextSignal.content?.id;
|
|
8885
8900
|
const apiKeyProp = props.apiKey;
|
|
8886
8901
|
_track({
|
|
8902
|
+
apiHost: props.apiHost,
|
|
8887
8903
|
type: "impression",
|
|
8888
8904
|
canTrack: true,
|
|
8889
8905
|
contentId,
|
|
@@ -9132,6 +9148,9 @@ function ContentComponent(props) {
|
|
|
9132
9148
|
},
|
|
9133
9149
|
get children() {
|
|
9134
9150
|
return createComponent(enable_editor_default, mergeProps({
|
|
9151
|
+
get apiHost() {
|
|
9152
|
+
return props.apiHost;
|
|
9153
|
+
},
|
|
9135
9154
|
get nonce() {
|
|
9136
9155
|
return props.nonce;
|
|
9137
9156
|
},
|
|
@@ -9173,6 +9192,9 @@ function ContentComponent(props) {
|
|
|
9173
9192
|
},
|
|
9174
9193
|
get trustedHosts() {
|
|
9175
9194
|
return props.trustedHosts;
|
|
9195
|
+
},
|
|
9196
|
+
get isNestedRender() {
|
|
9197
|
+
return props.isNestedRender;
|
|
9176
9198
|
}
|
|
9177
9199
|
}, {
|
|
9178
9200
|
setBuilderContextSignal
|
|
@@ -9305,6 +9327,9 @@ function ContentVariants(props) {
|
|
|
9305
9327
|
children: (variant, _index) => {
|
|
9306
9328
|
_index();
|
|
9307
9329
|
return createComponent(content_default, mergeProps({
|
|
9330
|
+
get apiHost() {
|
|
9331
|
+
return props.apiHost;
|
|
9332
|
+
},
|
|
9308
9333
|
get isNestedRender() {
|
|
9309
9334
|
return props.isNestedRender;
|
|
9310
9335
|
},
|
|
@@ -9369,6 +9394,9 @@ function ContentVariants(props) {
|
|
|
9369
9394
|
})];
|
|
9370
9395
|
}
|
|
9371
9396
|
}), createComponent(content_default, mergeProps({
|
|
9397
|
+
get apiHost() {
|
|
9398
|
+
return props.apiHost;
|
|
9399
|
+
},
|
|
9372
9400
|
get nonce() {
|
|
9373
9401
|
return props.nonce;
|
|
9374
9402
|
},
|
package/lib/edge/index.jsx
CHANGED
|
@@ -83,7 +83,7 @@ function Button(props) {
|
|
|
83
83
|
var button_default = Button;
|
|
84
84
|
|
|
85
85
|
// src/blocks/columns/columns.tsx
|
|
86
|
-
import { Show as Show7, For as For4,
|
|
86
|
+
import { Show as Show7, For as For4, createMemo as createMemo7 } from "solid-js";
|
|
87
87
|
|
|
88
88
|
// src/components/blocks/blocks.tsx
|
|
89
89
|
import { useContext, Show as Show6, For as For3 } from "solid-js";
|
|
@@ -4628,14 +4628,15 @@ var getColumnsClass = (id2) => {
|
|
|
4628
4628
|
|
|
4629
4629
|
// src/blocks/columns/columns.tsx
|
|
4630
4630
|
function Columns(props) {
|
|
4631
|
-
const
|
|
4632
|
-
typeof props.space === "number" ? props.space || 0 : 20
|
|
4633
|
-
);
|
|
4634
|
-
const
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4631
|
+
const gutterSize = createMemo7(() => {
|
|
4632
|
+
return typeof props.space === "number" ? props.space || 0 : 20;
|
|
4633
|
+
});
|
|
4634
|
+
const cols = createMemo7(() => {
|
|
4635
|
+
return props.columns || [];
|
|
4636
|
+
});
|
|
4637
|
+
const stackAt = createMemo7(() => {
|
|
4638
|
+
return props.stackColumnsAt || "tablet";
|
|
4639
|
+
});
|
|
4639
4640
|
function getTagName(column) {
|
|
4640
4641
|
return column.link ? props.builderLinkComponent || "a" : "div";
|
|
4641
4642
|
}
|
|
@@ -4659,6 +4660,9 @@ function Columns(props) {
|
|
|
4659
4660
|
}) {
|
|
4660
4661
|
return stackAt() === "never" ? desktopStyle : stackedStyle;
|
|
4661
4662
|
}
|
|
4663
|
+
const flexDir = createMemo7(() => {
|
|
4664
|
+
return props.stackColumnsAt === "never" ? "row" : props.reverseColumnsWhenStacked ? "column-reverse" : "column";
|
|
4665
|
+
});
|
|
4662
4666
|
function columnsCssVars() {
|
|
4663
4667
|
return {
|
|
4664
4668
|
"--flex-dir": flexDir(),
|
|
@@ -4748,7 +4752,7 @@ function Columns(props) {
|
|
|
4748
4752
|
}
|
|
4749
4753
|
return <>
|
|
4750
4754
|
<div
|
|
4751
|
-
class={getColumnsClass(props.builderBlock?.id) + " div-
|
|
4755
|
+
class={getColumnsClass(props.builderBlock?.id) + " div-a1dad3b8"}
|
|
4752
4756
|
style={columnsCssVars()}
|
|
4753
4757
|
{...{}}
|
|
4754
4758
|
>
|
|
@@ -4777,7 +4781,7 @@ function Columns(props) {
|
|
|
4777
4781
|
/></Dynamic_renderer_default>;
|
|
4778
4782
|
}}</For4>
|
|
4779
4783
|
</div>
|
|
4780
|
-
<style>{`.div-
|
|
4784
|
+
<style>{`.div-a1dad3b8 {
|
|
4781
4785
|
display: flex;
|
|
4782
4786
|
line-height: normal;
|
|
4783
4787
|
}`}</style>
|
|
@@ -7429,7 +7433,7 @@ function getPreviewContent(_searchParams) {
|
|
|
7429
7433
|
}
|
|
7430
7434
|
|
|
7431
7435
|
// src/constants/sdk-version.ts
|
|
7432
|
-
var SDK_VERSION = "2.0.
|
|
7436
|
+
var SDK_VERSION = "2.0.28";
|
|
7433
7437
|
|
|
7434
7438
|
// src/helpers/sdk-headers.ts
|
|
7435
7439
|
var getSdkHeaders = () => ({
|
|
@@ -7539,7 +7543,8 @@ var generateContentUrl = (options) => {
|
|
|
7539
7543
|
cacheSeconds,
|
|
7540
7544
|
staleCacheSeconds,
|
|
7541
7545
|
sort,
|
|
7542
|
-
includeUnpublished
|
|
7546
|
+
includeUnpublished,
|
|
7547
|
+
apiHost
|
|
7543
7548
|
} = options;
|
|
7544
7549
|
if (!apiKey) {
|
|
7545
7550
|
throw new Error("Missing API key");
|
|
@@ -7548,7 +7553,8 @@ var generateContentUrl = (options) => {
|
|
|
7548
7553
|
throw new Error(`Invalid apiVersion: expected 'v3', received '${apiVersion}'`);
|
|
7549
7554
|
}
|
|
7550
7555
|
const noTraverse = limit !== 1;
|
|
7551
|
-
const
|
|
7556
|
+
const baseUrl = apiHost || "https://cdn.builder.io";
|
|
7557
|
+
const url = new URL(`${baseUrl}/api/${apiVersion}/content/${model}`);
|
|
7552
7558
|
url.searchParams.set("apiKey", apiKey);
|
|
7553
7559
|
url.searchParams.set("limit", String(limit));
|
|
7554
7560
|
url.searchParams.set("noTraverse", String(noTraverse));
|
|
@@ -7834,7 +7840,10 @@ var createEvent = async ({
|
|
|
7834
7840
|
ownerId: apiKey
|
|
7835
7841
|
}
|
|
7836
7842
|
});
|
|
7837
|
-
async function _track(
|
|
7843
|
+
async function _track({
|
|
7844
|
+
apiHost,
|
|
7845
|
+
...eventProps
|
|
7846
|
+
}) {
|
|
7838
7847
|
if (!eventProps.apiKey) {
|
|
7839
7848
|
logger.error("Missing API key for track call. Please provide your API key.");
|
|
7840
7849
|
return;
|
|
@@ -7848,7 +7857,8 @@ async function _track(eventProps) {
|
|
|
7848
7857
|
if (!(isBrowser() || TARGET === "reactNative")) {
|
|
7849
7858
|
return;
|
|
7850
7859
|
}
|
|
7851
|
-
|
|
7860
|
+
const baseUrl = apiHost || "https://cdn.builder.io";
|
|
7861
|
+
return fetch(`${baseUrl}/api/v1/track`, {
|
|
7852
7862
|
method: "POST",
|
|
7853
7863
|
body: JSON.stringify({
|
|
7854
7864
|
events: [await createEvent(eventProps)]
|
|
@@ -8289,6 +8299,7 @@ function EnableEditor(props) {
|
|
|
8289
8299
|
const variationId = props.builderContextSignal.content?.testVariationId;
|
|
8290
8300
|
const contentId = props.builderContextSignal.content?.id;
|
|
8291
8301
|
_track({
|
|
8302
|
+
apiHost: props.apiHost,
|
|
8292
8303
|
type: "click",
|
|
8293
8304
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
8294
8305
|
contentId,
|
|
@@ -8357,7 +8368,7 @@ function EnableEditor(props) {
|
|
|
8357
8368
|
emitStateUpdate();
|
|
8358
8369
|
onMount6(() => {
|
|
8359
8370
|
if (isBrowser()) {
|
|
8360
|
-
if (isEditing()) {
|
|
8371
|
+
if (isEditing() && !props.isNestedRender) {
|
|
8361
8372
|
window.addEventListener("message", processMessage);
|
|
8362
8373
|
registerInsertMenu();
|
|
8363
8374
|
setupBrowserForEditing({
|
|
@@ -8388,6 +8399,7 @@ function EnableEditor(props) {
|
|
|
8388
8399
|
const contentId = props.builderContextSignal.content?.id;
|
|
8389
8400
|
const apiKeyProp = props.apiKey;
|
|
8390
8401
|
_track({
|
|
8402
|
+
apiHost: props.apiHost,
|
|
8391
8403
|
type: "impression",
|
|
8392
8404
|
canTrack: true,
|
|
8393
8405
|
contentId,
|
|
@@ -8627,6 +8639,7 @@ function ContentComponent(props) {
|
|
|
8627
8639
|
registeredComponents: registeredComponents()
|
|
8628
8640
|
}}
|
|
8629
8641
|
><Enable_editor_default
|
|
8642
|
+
apiHost={props.apiHost}
|
|
8630
8643
|
nonce={props.nonce}
|
|
8631
8644
|
content={props.content}
|
|
8632
8645
|
data={props.data}
|
|
@@ -8641,6 +8654,7 @@ function ContentComponent(props) {
|
|
|
8641
8654
|
contentWrapper={props.contentWrapper}
|
|
8642
8655
|
contentWrapperProps={props.contentWrapperProps}
|
|
8643
8656
|
trustedHosts={props.trustedHosts}
|
|
8657
|
+
isNestedRender={props.isNestedRender}
|
|
8644
8658
|
{...{
|
|
8645
8659
|
setBuilderContextSignal
|
|
8646
8660
|
}}
|
|
@@ -8719,6 +8733,7 @@ function ContentVariants(props) {
|
|
|
8719
8733
|
<For9 each={getVariants(props.content)}>{(variant, _index) => {
|
|
8720
8734
|
const index = _index();
|
|
8721
8735
|
return <Content_default
|
|
8736
|
+
apiHost={props.apiHost}
|
|
8722
8737
|
isNestedRender={props.isNestedRender}
|
|
8723
8738
|
key={variant.testVariationId}
|
|
8724
8739
|
nonce={props.nonce}
|
|
@@ -8745,6 +8760,7 @@ function ContentVariants(props) {
|
|
|
8745
8760
|
}}</For9>
|
|
8746
8761
|
</Show15>
|
|
8747
8762
|
<Content_default
|
|
8763
|
+
apiHost={props.apiHost}
|
|
8748
8764
|
nonce={props.nonce}
|
|
8749
8765
|
isNestedRender={props.isNestedRender}
|
|
8750
8766
|
{...{}}
|