@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/node/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
|
import { createRequire } from 'node:module';
|
|
4
4
|
|
|
5
5
|
// src/blocks/button/button.tsx
|
|
@@ -436,6 +436,8 @@ var getIvm = () => {
|
|
|
436
436
|
function setIsolateContext(options = {
|
|
437
437
|
memoryLimit: 128
|
|
438
438
|
}) {
|
|
439
|
+
if (IVM_CONTEXT)
|
|
440
|
+
return IVM_CONTEXT;
|
|
439
441
|
const ivm = getIvm();
|
|
440
442
|
const isolate = new ivm.Isolate(options);
|
|
441
443
|
const context = isolate.createContextSync();
|
|
@@ -449,10 +451,7 @@ function setIsolateContext(options = {
|
|
|
449
451
|
return context;
|
|
450
452
|
}
|
|
451
453
|
var getIsolateContext = () => {
|
|
452
|
-
|
|
453
|
-
return IVM_CONTEXT;
|
|
454
|
-
const context = setIsolateContext();
|
|
455
|
-
return context;
|
|
454
|
+
return setIsolateContext();
|
|
456
455
|
};
|
|
457
456
|
var runInNode = ({
|
|
458
457
|
code,
|
|
@@ -1826,15 +1825,20 @@ var getColumnsClass = (id) => {
|
|
|
1826
1825
|
|
|
1827
1826
|
// src/blocks/columns/columns.tsx
|
|
1828
1827
|
var _tmpl$3 = /* @__PURE__ */ template(`<div>`);
|
|
1829
|
-
var _tmpl$22 = /* @__PURE__ */ template(`<style>.div-
|
|
1828
|
+
var _tmpl$22 = /* @__PURE__ */ template(`<style>.div-a1dad3b8 {
|
|
1830
1829
|
display: flex;
|
|
1831
1830
|
line-height: normal;
|
|
1832
1831
|
}`);
|
|
1833
1832
|
function Columns(props) {
|
|
1834
|
-
const
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
const
|
|
1833
|
+
const gutterSize = createMemo(() => {
|
|
1834
|
+
return typeof props.space === "number" ? props.space || 0 : 20;
|
|
1835
|
+
});
|
|
1836
|
+
const cols = createMemo(() => {
|
|
1837
|
+
return props.columns || [];
|
|
1838
|
+
});
|
|
1839
|
+
const stackAt = createMemo(() => {
|
|
1840
|
+
return props.stackColumnsAt || "tablet";
|
|
1841
|
+
});
|
|
1838
1842
|
function getTagName(column) {
|
|
1839
1843
|
return column.link ? props.builderLinkComponent || "a" : "div";
|
|
1840
1844
|
}
|
|
@@ -1858,6 +1862,9 @@ function Columns(props) {
|
|
|
1858
1862
|
}) {
|
|
1859
1863
|
return stackAt() === "never" ? desktopStyle : stackedStyle;
|
|
1860
1864
|
}
|
|
1865
|
+
const flexDir = createMemo(() => {
|
|
1866
|
+
return props.stackColumnsAt === "never" ? "row" : props.reverseColumnsWhenStacked ? "column-reverse" : "column";
|
|
1867
|
+
});
|
|
1861
1868
|
function columnsCssVars() {
|
|
1862
1869
|
return {
|
|
1863
1870
|
"--flex-dir": flexDir(),
|
|
@@ -1947,7 +1954,7 @@ function Columns(props) {
|
|
|
1947
1954
|
const _el$ = _tmpl$3();
|
|
1948
1955
|
spread(_el$, mergeProps({
|
|
1949
1956
|
get ["class"]() {
|
|
1950
|
-
return getColumnsClass(props.builderBlock?.id) + " div-
|
|
1957
|
+
return getColumnsClass(props.builderBlock?.id) + " div-a1dad3b8";
|
|
1951
1958
|
},
|
|
1952
1959
|
get style() {
|
|
1953
1960
|
return columnsCssVars();
|
|
@@ -4936,7 +4943,7 @@ function getPreviewContent(_searchParams) {
|
|
|
4936
4943
|
}
|
|
4937
4944
|
|
|
4938
4945
|
// src/constants/sdk-version.ts
|
|
4939
|
-
var SDK_VERSION = "2.0.
|
|
4946
|
+
var SDK_VERSION = "2.0.28";
|
|
4940
4947
|
|
|
4941
4948
|
// src/helpers/sdk-headers.ts
|
|
4942
4949
|
var getSdkHeaders = () => ({
|
|
@@ -5048,7 +5055,8 @@ var generateContentUrl = (options) => {
|
|
|
5048
5055
|
cacheSeconds,
|
|
5049
5056
|
staleCacheSeconds,
|
|
5050
5057
|
sort,
|
|
5051
|
-
includeUnpublished
|
|
5058
|
+
includeUnpublished,
|
|
5059
|
+
apiHost
|
|
5052
5060
|
} = options;
|
|
5053
5061
|
if (!apiKey) {
|
|
5054
5062
|
throw new Error("Missing API key");
|
|
@@ -5057,7 +5065,8 @@ var generateContentUrl = (options) => {
|
|
|
5057
5065
|
throw new Error(`Invalid apiVersion: expected 'v3', received '${apiVersion}'`);
|
|
5058
5066
|
}
|
|
5059
5067
|
const noTraverse = limit !== 1;
|
|
5060
|
-
const
|
|
5068
|
+
const baseUrl = apiHost || "https://cdn.builder.io";
|
|
5069
|
+
const url = new URL(`${baseUrl}/api/${apiVersion}/content/${model}`);
|
|
5061
5070
|
url.searchParams.set("apiKey", apiKey);
|
|
5062
5071
|
url.searchParams.set("limit", String(limit));
|
|
5063
5072
|
url.searchParams.set("noTraverse", String(noTraverse));
|
|
@@ -5345,7 +5354,10 @@ var createEvent = async ({
|
|
|
5345
5354
|
ownerId: apiKey
|
|
5346
5355
|
}
|
|
5347
5356
|
});
|
|
5348
|
-
async function _track(
|
|
5357
|
+
async function _track({
|
|
5358
|
+
apiHost,
|
|
5359
|
+
...eventProps
|
|
5360
|
+
}) {
|
|
5349
5361
|
if (!eventProps.apiKey) {
|
|
5350
5362
|
logger.error("Missing API key for track call. Please provide your API key.");
|
|
5351
5363
|
return;
|
|
@@ -5359,7 +5371,8 @@ async function _track(eventProps) {
|
|
|
5359
5371
|
if (!(isBrowser() || TARGET === "reactNative")) {
|
|
5360
5372
|
return;
|
|
5361
5373
|
}
|
|
5362
|
-
|
|
5374
|
+
const baseUrl = apiHost || "https://cdn.builder.io";
|
|
5375
|
+
return fetch(`${baseUrl}/api/v1/track`, {
|
|
5363
5376
|
method: "POST",
|
|
5364
5377
|
body: JSON.stringify({
|
|
5365
5378
|
events: [await createEvent(eventProps)]
|
|
@@ -5803,6 +5816,7 @@ function EnableEditor(props) {
|
|
|
5803
5816
|
const variationId = props.builderContextSignal.content?.testVariationId;
|
|
5804
5817
|
const contentId = props.builderContextSignal.content?.id;
|
|
5805
5818
|
_track({
|
|
5819
|
+
apiHost: props.apiHost,
|
|
5806
5820
|
type: "click",
|
|
5807
5821
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
5808
5822
|
contentId,
|
|
@@ -5862,7 +5876,7 @@ function EnableEditor(props) {
|
|
|
5862
5876
|
emitStateUpdate();
|
|
5863
5877
|
onMount(() => {
|
|
5864
5878
|
if (isBrowser()) {
|
|
5865
|
-
if (isEditing()) {
|
|
5879
|
+
if (isEditing() && !props.isNestedRender) {
|
|
5866
5880
|
window.addEventListener("message", processMessage);
|
|
5867
5881
|
registerInsertMenu();
|
|
5868
5882
|
setupBrowserForEditing({
|
|
@@ -5888,6 +5902,7 @@ function EnableEditor(props) {
|
|
|
5888
5902
|
const contentId = props.builderContextSignal.content?.id;
|
|
5889
5903
|
const apiKeyProp = props.apiKey;
|
|
5890
5904
|
_track({
|
|
5905
|
+
apiHost: props.apiHost,
|
|
5891
5906
|
type: "impression",
|
|
5892
5907
|
canTrack: true,
|
|
5893
5908
|
contentId,
|
|
@@ -6136,6 +6151,9 @@ function ContentComponent(props) {
|
|
|
6136
6151
|
},
|
|
6137
6152
|
get children() {
|
|
6138
6153
|
return createComponent(enable_editor_default, mergeProps({
|
|
6154
|
+
get apiHost() {
|
|
6155
|
+
return props.apiHost;
|
|
6156
|
+
},
|
|
6139
6157
|
get nonce() {
|
|
6140
6158
|
return props.nonce;
|
|
6141
6159
|
},
|
|
@@ -6177,6 +6195,9 @@ function ContentComponent(props) {
|
|
|
6177
6195
|
},
|
|
6178
6196
|
get trustedHosts() {
|
|
6179
6197
|
return props.trustedHosts;
|
|
6198
|
+
},
|
|
6199
|
+
get isNestedRender() {
|
|
6200
|
+
return props.isNestedRender;
|
|
6180
6201
|
}
|
|
6181
6202
|
}, {
|
|
6182
6203
|
setBuilderContextSignal
|
|
@@ -6309,6 +6330,9 @@ function ContentVariants(props) {
|
|
|
6309
6330
|
children: (variant, _index) => {
|
|
6310
6331
|
_index();
|
|
6311
6332
|
return createComponent(content_default, mergeProps({
|
|
6333
|
+
get apiHost() {
|
|
6334
|
+
return props.apiHost;
|
|
6335
|
+
},
|
|
6312
6336
|
get isNestedRender() {
|
|
6313
6337
|
return props.isNestedRender;
|
|
6314
6338
|
},
|
|
@@ -6373,6 +6397,9 @@ function ContentVariants(props) {
|
|
|
6373
6397
|
})];
|
|
6374
6398
|
}
|
|
6375
6399
|
}), createComponent(content_default, mergeProps({
|
|
6400
|
+
get apiHost() {
|
|
6401
|
+
return props.apiHost;
|
|
6402
|
+
},
|
|
6376
6403
|
get nonce() {
|
|
6377
6404
|
return props.nonce;
|
|
6378
6405
|
},
|
package/lib/node/dev.jsx
CHANGED
|
@@ -75,7 +75,7 @@ function Button(props) {
|
|
|
75
75
|
var button_default = Button;
|
|
76
76
|
|
|
77
77
|
// src/blocks/columns/columns.tsx
|
|
78
|
-
import { Show as Show7, For as For4,
|
|
78
|
+
import { Show as Show7, For as For4, createMemo as createMemo7 } from "solid-js";
|
|
79
79
|
|
|
80
80
|
// src/components/blocks/blocks.tsx
|
|
81
81
|
import { useContext, Show as Show6, For as For3 } from "solid-js";
|
|
@@ -431,6 +431,8 @@ var getIvm = () => {
|
|
|
431
431
|
function setIsolateContext(options = {
|
|
432
432
|
memoryLimit: 128
|
|
433
433
|
}) {
|
|
434
|
+
if (IVM_CONTEXT)
|
|
435
|
+
return IVM_CONTEXT;
|
|
434
436
|
const ivm = getIvm();
|
|
435
437
|
const isolate = new ivm.Isolate(options);
|
|
436
438
|
const context = isolate.createContextSync();
|
|
@@ -444,10 +446,7 @@ function setIsolateContext(options = {
|
|
|
444
446
|
return context;
|
|
445
447
|
}
|
|
446
448
|
var getIsolateContext = () => {
|
|
447
|
-
|
|
448
|
-
return IVM_CONTEXT;
|
|
449
|
-
const context = setIsolateContext();
|
|
450
|
-
return context;
|
|
449
|
+
return setIsolateContext();
|
|
451
450
|
};
|
|
452
451
|
var runInNode = ({
|
|
453
452
|
code,
|
|
@@ -1621,14 +1620,15 @@ var getColumnsClass = (id) => {
|
|
|
1621
1620
|
|
|
1622
1621
|
// src/blocks/columns/columns.tsx
|
|
1623
1622
|
function Columns(props) {
|
|
1624
|
-
const
|
|
1625
|
-
typeof props.space === "number" ? props.space || 0 : 20
|
|
1626
|
-
);
|
|
1627
|
-
const
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1623
|
+
const gutterSize = createMemo7(() => {
|
|
1624
|
+
return typeof props.space === "number" ? props.space || 0 : 20;
|
|
1625
|
+
});
|
|
1626
|
+
const cols = createMemo7(() => {
|
|
1627
|
+
return props.columns || [];
|
|
1628
|
+
});
|
|
1629
|
+
const stackAt = createMemo7(() => {
|
|
1630
|
+
return props.stackColumnsAt || "tablet";
|
|
1631
|
+
});
|
|
1632
1632
|
function getTagName(column) {
|
|
1633
1633
|
return column.link ? props.builderLinkComponent || "a" : "div";
|
|
1634
1634
|
}
|
|
@@ -1652,6 +1652,9 @@ function Columns(props) {
|
|
|
1652
1652
|
}) {
|
|
1653
1653
|
return stackAt() === "never" ? desktopStyle : stackedStyle;
|
|
1654
1654
|
}
|
|
1655
|
+
const flexDir = createMemo7(() => {
|
|
1656
|
+
return props.stackColumnsAt === "never" ? "row" : props.reverseColumnsWhenStacked ? "column-reverse" : "column";
|
|
1657
|
+
});
|
|
1655
1658
|
function columnsCssVars() {
|
|
1656
1659
|
return {
|
|
1657
1660
|
"--flex-dir": flexDir(),
|
|
@@ -1741,7 +1744,7 @@ function Columns(props) {
|
|
|
1741
1744
|
}
|
|
1742
1745
|
return <>
|
|
1743
1746
|
<div
|
|
1744
|
-
class={getColumnsClass(props.builderBlock?.id) + " div-
|
|
1747
|
+
class={getColumnsClass(props.builderBlock?.id) + " div-a1dad3b8"}
|
|
1745
1748
|
style={columnsCssVars()}
|
|
1746
1749
|
{...{}}
|
|
1747
1750
|
>
|
|
@@ -1770,7 +1773,7 @@ function Columns(props) {
|
|
|
1770
1773
|
/></Dynamic_renderer_default>;
|
|
1771
1774
|
}}</For4>
|
|
1772
1775
|
</div>
|
|
1773
|
-
<style>{`.div-
|
|
1776
|
+
<style>{`.div-a1dad3b8 {
|
|
1774
1777
|
display: flex;
|
|
1775
1778
|
line-height: normal;
|
|
1776
1779
|
}`}</style>
|
|
@@ -4426,7 +4429,7 @@ function getPreviewContent(_searchParams) {
|
|
|
4426
4429
|
}
|
|
4427
4430
|
|
|
4428
4431
|
// src/constants/sdk-version.ts
|
|
4429
|
-
var SDK_VERSION = "2.0.
|
|
4432
|
+
var SDK_VERSION = "2.0.28";
|
|
4430
4433
|
|
|
4431
4434
|
// src/helpers/sdk-headers.ts
|
|
4432
4435
|
var getSdkHeaders = () => ({
|
|
@@ -4538,7 +4541,8 @@ var generateContentUrl = (options) => {
|
|
|
4538
4541
|
cacheSeconds,
|
|
4539
4542
|
staleCacheSeconds,
|
|
4540
4543
|
sort,
|
|
4541
|
-
includeUnpublished
|
|
4544
|
+
includeUnpublished,
|
|
4545
|
+
apiHost
|
|
4542
4546
|
} = options;
|
|
4543
4547
|
if (!apiKey) {
|
|
4544
4548
|
throw new Error("Missing API key");
|
|
@@ -4547,7 +4551,8 @@ var generateContentUrl = (options) => {
|
|
|
4547
4551
|
throw new Error(`Invalid apiVersion: expected 'v3', received '${apiVersion}'`);
|
|
4548
4552
|
}
|
|
4549
4553
|
const noTraverse = limit !== 1;
|
|
4550
|
-
const
|
|
4554
|
+
const baseUrl = apiHost || "https://cdn.builder.io";
|
|
4555
|
+
const url = new URL(`${baseUrl}/api/${apiVersion}/content/${model}`);
|
|
4551
4556
|
url.searchParams.set("apiKey", apiKey);
|
|
4552
4557
|
url.searchParams.set("limit", String(limit));
|
|
4553
4558
|
url.searchParams.set("noTraverse", String(noTraverse));
|
|
@@ -4835,7 +4840,10 @@ var createEvent = async ({
|
|
|
4835
4840
|
ownerId: apiKey
|
|
4836
4841
|
}
|
|
4837
4842
|
});
|
|
4838
|
-
async function _track(
|
|
4843
|
+
async function _track({
|
|
4844
|
+
apiHost,
|
|
4845
|
+
...eventProps
|
|
4846
|
+
}) {
|
|
4839
4847
|
if (!eventProps.apiKey) {
|
|
4840
4848
|
logger.error("Missing API key for track call. Please provide your API key.");
|
|
4841
4849
|
return;
|
|
@@ -4849,7 +4857,8 @@ async function _track(eventProps) {
|
|
|
4849
4857
|
if (!(isBrowser() || TARGET === "reactNative")) {
|
|
4850
4858
|
return;
|
|
4851
4859
|
}
|
|
4852
|
-
|
|
4860
|
+
const baseUrl = apiHost || "https://cdn.builder.io";
|
|
4861
|
+
return fetch(`${baseUrl}/api/v1/track`, {
|
|
4853
4862
|
method: "POST",
|
|
4854
4863
|
body: JSON.stringify({
|
|
4855
4864
|
events: [await createEvent(eventProps)]
|
|
@@ -5292,6 +5301,7 @@ function EnableEditor(props) {
|
|
|
5292
5301
|
const variationId = props.builderContextSignal.content?.testVariationId;
|
|
5293
5302
|
const contentId = props.builderContextSignal.content?.id;
|
|
5294
5303
|
_track({
|
|
5304
|
+
apiHost: props.apiHost,
|
|
5295
5305
|
type: "click",
|
|
5296
5306
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
5297
5307
|
contentId,
|
|
@@ -5361,7 +5371,7 @@ function EnableEditor(props) {
|
|
|
5361
5371
|
emitStateUpdate();
|
|
5362
5372
|
onMount6(() => {
|
|
5363
5373
|
if (isBrowser()) {
|
|
5364
|
-
if (isEditing()) {
|
|
5374
|
+
if (isEditing() && !props.isNestedRender) {
|
|
5365
5375
|
window.addEventListener("message", processMessage);
|
|
5366
5376
|
registerInsertMenu();
|
|
5367
5377
|
setupBrowserForEditing({
|
|
@@ -5392,6 +5402,7 @@ function EnableEditor(props) {
|
|
|
5392
5402
|
const contentId = props.builderContextSignal.content?.id;
|
|
5393
5403
|
const apiKeyProp = props.apiKey;
|
|
5394
5404
|
_track({
|
|
5405
|
+
apiHost: props.apiHost,
|
|
5395
5406
|
type: "impression",
|
|
5396
5407
|
canTrack: true,
|
|
5397
5408
|
contentId,
|
|
@@ -5631,6 +5642,7 @@ function ContentComponent(props) {
|
|
|
5631
5642
|
registeredComponents: registeredComponents()
|
|
5632
5643
|
}}
|
|
5633
5644
|
><Enable_editor_default
|
|
5645
|
+
apiHost={props.apiHost}
|
|
5634
5646
|
nonce={props.nonce}
|
|
5635
5647
|
content={props.content}
|
|
5636
5648
|
data={props.data}
|
|
@@ -5645,6 +5657,7 @@ function ContentComponent(props) {
|
|
|
5645
5657
|
contentWrapper={props.contentWrapper}
|
|
5646
5658
|
contentWrapperProps={props.contentWrapperProps}
|
|
5647
5659
|
trustedHosts={props.trustedHosts}
|
|
5660
|
+
isNestedRender={props.isNestedRender}
|
|
5648
5661
|
{...{
|
|
5649
5662
|
setBuilderContextSignal
|
|
5650
5663
|
}}
|
|
@@ -5723,6 +5736,7 @@ function ContentVariants(props) {
|
|
|
5723
5736
|
<For9 each={getVariants(props.content)}>{(variant, _index) => {
|
|
5724
5737
|
const index = _index();
|
|
5725
5738
|
return <Content_default
|
|
5739
|
+
apiHost={props.apiHost}
|
|
5726
5740
|
isNestedRender={props.isNestedRender}
|
|
5727
5741
|
key={variant.testVariationId}
|
|
5728
5742
|
nonce={props.nonce}
|
|
@@ -5749,6 +5763,7 @@ function ContentVariants(props) {
|
|
|
5749
5763
|
}}</For9>
|
|
5750
5764
|
</Show15>
|
|
5751
5765
|
<Content_default
|
|
5766
|
+
apiHost={props.apiHost}
|
|
5752
5767
|
nonce={props.nonce}
|
|
5753
5768
|
isNestedRender={props.isNestedRender}
|
|
5754
5769
|
{...{}}
|
package/lib/node/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
|
import { createRequire } from 'node:module';
|
|
4
4
|
|
|
5
5
|
// src/blocks/button/button.tsx
|
|
@@ -435,6 +435,8 @@ var getIvm = () => {
|
|
|
435
435
|
function setIsolateContext(options = {
|
|
436
436
|
memoryLimit: 128
|
|
437
437
|
}) {
|
|
438
|
+
if (IVM_CONTEXT)
|
|
439
|
+
return IVM_CONTEXT;
|
|
438
440
|
const ivm = getIvm();
|
|
439
441
|
const isolate = new ivm.Isolate(options);
|
|
440
442
|
const context = isolate.createContextSync();
|
|
@@ -447,10 +449,7 @@ function setIsolateContext(options = {
|
|
|
447
449
|
return context;
|
|
448
450
|
}
|
|
449
451
|
var getIsolateContext = () => {
|
|
450
|
-
|
|
451
|
-
return IVM_CONTEXT;
|
|
452
|
-
const context = setIsolateContext();
|
|
453
|
-
return context;
|
|
452
|
+
return setIsolateContext();
|
|
454
453
|
};
|
|
455
454
|
var runInNode = ({
|
|
456
455
|
code,
|
|
@@ -1820,15 +1819,20 @@ var getColumnsClass = (id) => {
|
|
|
1820
1819
|
|
|
1821
1820
|
// src/blocks/columns/columns.tsx
|
|
1822
1821
|
var _tmpl$3 = /* @__PURE__ */ template(`<div>`);
|
|
1823
|
-
var _tmpl$22 = /* @__PURE__ */ template(`<style>.div-
|
|
1822
|
+
var _tmpl$22 = /* @__PURE__ */ template(`<style>.div-a1dad3b8 {
|
|
1824
1823
|
display: flex;
|
|
1825
1824
|
line-height: normal;
|
|
1826
1825
|
}`);
|
|
1827
1826
|
function Columns(props) {
|
|
1828
|
-
const
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
const
|
|
1827
|
+
const gutterSize = createMemo(() => {
|
|
1828
|
+
return typeof props.space === "number" ? props.space || 0 : 20;
|
|
1829
|
+
});
|
|
1830
|
+
const cols = createMemo(() => {
|
|
1831
|
+
return props.columns || [];
|
|
1832
|
+
});
|
|
1833
|
+
const stackAt = createMemo(() => {
|
|
1834
|
+
return props.stackColumnsAt || "tablet";
|
|
1835
|
+
});
|
|
1832
1836
|
function getTagName(column) {
|
|
1833
1837
|
return column.link ? props.builderLinkComponent || "a" : "div";
|
|
1834
1838
|
}
|
|
@@ -1852,6 +1856,9 @@ function Columns(props) {
|
|
|
1852
1856
|
}) {
|
|
1853
1857
|
return stackAt() === "never" ? desktopStyle : stackedStyle;
|
|
1854
1858
|
}
|
|
1859
|
+
const flexDir = createMemo(() => {
|
|
1860
|
+
return props.stackColumnsAt === "never" ? "row" : props.reverseColumnsWhenStacked ? "column-reverse" : "column";
|
|
1861
|
+
});
|
|
1855
1862
|
function columnsCssVars() {
|
|
1856
1863
|
return {
|
|
1857
1864
|
"--flex-dir": flexDir(),
|
|
@@ -1941,7 +1948,7 @@ function Columns(props) {
|
|
|
1941
1948
|
const _el$ = _tmpl$3();
|
|
1942
1949
|
spread(_el$, mergeProps({
|
|
1943
1950
|
get ["class"]() {
|
|
1944
|
-
return getColumnsClass(props.builderBlock?.id) + " div-
|
|
1951
|
+
return getColumnsClass(props.builderBlock?.id) + " div-a1dad3b8";
|
|
1945
1952
|
},
|
|
1946
1953
|
get style() {
|
|
1947
1954
|
return columnsCssVars();
|
|
@@ -4926,7 +4933,7 @@ function getPreviewContent(_searchParams) {
|
|
|
4926
4933
|
}
|
|
4927
4934
|
|
|
4928
4935
|
// src/constants/sdk-version.ts
|
|
4929
|
-
var SDK_VERSION = "2.0.
|
|
4936
|
+
var SDK_VERSION = "2.0.28";
|
|
4930
4937
|
|
|
4931
4938
|
// src/helpers/sdk-headers.ts
|
|
4932
4939
|
var getSdkHeaders = () => ({
|
|
@@ -5036,7 +5043,8 @@ var generateContentUrl = (options) => {
|
|
|
5036
5043
|
cacheSeconds,
|
|
5037
5044
|
staleCacheSeconds,
|
|
5038
5045
|
sort,
|
|
5039
|
-
includeUnpublished
|
|
5046
|
+
includeUnpublished,
|
|
5047
|
+
apiHost
|
|
5040
5048
|
} = options;
|
|
5041
5049
|
if (!apiKey) {
|
|
5042
5050
|
throw new Error("Missing API key");
|
|
@@ -5045,7 +5053,8 @@ var generateContentUrl = (options) => {
|
|
|
5045
5053
|
throw new Error(`Invalid apiVersion: expected 'v3', received '${apiVersion}'`);
|
|
5046
5054
|
}
|
|
5047
5055
|
const noTraverse = limit !== 1;
|
|
5048
|
-
const
|
|
5056
|
+
const baseUrl = apiHost || "https://cdn.builder.io";
|
|
5057
|
+
const url = new URL(`${baseUrl}/api/${apiVersion}/content/${model}`);
|
|
5049
5058
|
url.searchParams.set("apiKey", apiKey);
|
|
5050
5059
|
url.searchParams.set("limit", String(limit));
|
|
5051
5060
|
url.searchParams.set("noTraverse", String(noTraverse));
|
|
@@ -5331,7 +5340,10 @@ var createEvent = async ({
|
|
|
5331
5340
|
ownerId: apiKey
|
|
5332
5341
|
}
|
|
5333
5342
|
});
|
|
5334
|
-
async function _track(
|
|
5343
|
+
async function _track({
|
|
5344
|
+
apiHost,
|
|
5345
|
+
...eventProps
|
|
5346
|
+
}) {
|
|
5335
5347
|
if (!eventProps.apiKey) {
|
|
5336
5348
|
logger.error("Missing API key for track call. Please provide your API key.");
|
|
5337
5349
|
return;
|
|
@@ -5345,7 +5357,8 @@ async function _track(eventProps) {
|
|
|
5345
5357
|
if (!(isBrowser() || TARGET === "reactNative")) {
|
|
5346
5358
|
return;
|
|
5347
5359
|
}
|
|
5348
|
-
|
|
5360
|
+
const baseUrl = apiHost || "https://cdn.builder.io";
|
|
5361
|
+
return fetch(`${baseUrl}/api/v1/track`, {
|
|
5349
5362
|
method: "POST",
|
|
5350
5363
|
body: JSON.stringify({
|
|
5351
5364
|
events: [await createEvent(eventProps)]
|
|
@@ -5787,6 +5800,7 @@ function EnableEditor(props) {
|
|
|
5787
5800
|
const variationId = props.builderContextSignal.content?.testVariationId;
|
|
5788
5801
|
const contentId = props.builderContextSignal.content?.id;
|
|
5789
5802
|
_track({
|
|
5803
|
+
apiHost: props.apiHost,
|
|
5790
5804
|
type: "click",
|
|
5791
5805
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
5792
5806
|
contentId,
|
|
@@ -5845,7 +5859,7 @@ function EnableEditor(props) {
|
|
|
5845
5859
|
emitStateUpdate();
|
|
5846
5860
|
onMount(() => {
|
|
5847
5861
|
if (isBrowser()) {
|
|
5848
|
-
if (isEditing()) {
|
|
5862
|
+
if (isEditing() && !props.isNestedRender) {
|
|
5849
5863
|
window.addEventListener("message", processMessage);
|
|
5850
5864
|
registerInsertMenu();
|
|
5851
5865
|
setupBrowserForEditing({
|
|
@@ -5871,6 +5885,7 @@ function EnableEditor(props) {
|
|
|
5871
5885
|
const contentId = props.builderContextSignal.content?.id;
|
|
5872
5886
|
const apiKeyProp = props.apiKey;
|
|
5873
5887
|
_track({
|
|
5888
|
+
apiHost: props.apiHost,
|
|
5874
5889
|
type: "impression",
|
|
5875
5890
|
canTrack: true,
|
|
5876
5891
|
contentId,
|
|
@@ -6119,6 +6134,9 @@ function ContentComponent(props) {
|
|
|
6119
6134
|
},
|
|
6120
6135
|
get children() {
|
|
6121
6136
|
return createComponent(enable_editor_default, mergeProps({
|
|
6137
|
+
get apiHost() {
|
|
6138
|
+
return props.apiHost;
|
|
6139
|
+
},
|
|
6122
6140
|
get nonce() {
|
|
6123
6141
|
return props.nonce;
|
|
6124
6142
|
},
|
|
@@ -6160,6 +6178,9 @@ function ContentComponent(props) {
|
|
|
6160
6178
|
},
|
|
6161
6179
|
get trustedHosts() {
|
|
6162
6180
|
return props.trustedHosts;
|
|
6181
|
+
},
|
|
6182
|
+
get isNestedRender() {
|
|
6183
|
+
return props.isNestedRender;
|
|
6163
6184
|
}
|
|
6164
6185
|
}, {
|
|
6165
6186
|
setBuilderContextSignal
|
|
@@ -6292,6 +6313,9 @@ function ContentVariants(props) {
|
|
|
6292
6313
|
children: (variant, _index) => {
|
|
6293
6314
|
_index();
|
|
6294
6315
|
return createComponent(content_default, mergeProps({
|
|
6316
|
+
get apiHost() {
|
|
6317
|
+
return props.apiHost;
|
|
6318
|
+
},
|
|
6295
6319
|
get isNestedRender() {
|
|
6296
6320
|
return props.isNestedRender;
|
|
6297
6321
|
},
|
|
@@ -6356,6 +6380,9 @@ function ContentVariants(props) {
|
|
|
6356
6380
|
})];
|
|
6357
6381
|
}
|
|
6358
6382
|
}), createComponent(content_default, mergeProps({
|
|
6383
|
+
get apiHost() {
|
|
6384
|
+
return props.apiHost;
|
|
6385
|
+
},
|
|
6359
6386
|
get nonce() {
|
|
6360
6387
|
return props.nonce;
|
|
6361
6388
|
},
|