@builder.io/sdk-qwik 0.1.10 → 0.1.12
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/lib/index.qwik.cjs +75 -38
- package/lib/index.qwik.mjs +76 -39
- package/package.json +1 -1
- package/types/blocks/symbol/symbol.d.ts +1 -2
- package/types/components/render-content/render-content.types.d.ts +2 -0
- package/types/context/types.d.ts +2 -0
- package/types/functions/get-content/types.d.ts +6 -0
- package/types/types/api-version.d.ts +1 -0
package/lib/index.qwik.cjs
CHANGED
|
@@ -586,7 +586,7 @@ const RenderBlock = (props) => {
|
|
|
586
586
|
}, "9d_3");
|
|
587
587
|
};
|
|
588
588
|
const RenderBlock$1 = RenderBlock;
|
|
589
|
-
const className
|
|
589
|
+
const className = function className2(props, state, builderContext2) {
|
|
590
590
|
return "builder-blocks" + (!props.blocks?.length ? " no-blocks" : "");
|
|
591
591
|
};
|
|
592
592
|
const onClick$1 = function onClick2(props, state, builderContext2) {
|
|
@@ -614,7 +614,7 @@ const RenderBlocks = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) =
|
|
|
614
614
|
const builderContext$1 = qwik.useContext(builderContext);
|
|
615
615
|
const state = {};
|
|
616
616
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
617
|
-
class: className
|
|
617
|
+
class: className(props) + " div-RenderBlocks",
|
|
618
618
|
get "builder-path"() {
|
|
619
619
|
return props.path;
|
|
620
620
|
},
|
|
@@ -1738,10 +1738,15 @@ const getBuilderSearchParamsFromWindow = () => {
|
|
|
1738
1738
|
};
|
|
1739
1739
|
const normalizeSearchParams = (searchParams) => searchParams instanceof URLSearchParams ? convertSearchParamsToQueryObject(searchParams) : searchParams;
|
|
1740
1740
|
const generateContentUrl = (options) => {
|
|
1741
|
-
const { limit = 30, userAttributes, query, noTraverse = false, model, apiKey, includeRefs = true, locale } = options;
|
|
1741
|
+
const { limit = 30, userAttributes, query, noTraverse = false, model, apiKey, includeRefs = true, locale, apiVersion = "v2" } = options;
|
|
1742
1742
|
if (!apiKey)
|
|
1743
1743
|
throw new Error("Missing API key");
|
|
1744
|
-
|
|
1744
|
+
if (![
|
|
1745
|
+
"v2",
|
|
1746
|
+
"v3"
|
|
1747
|
+
].includes(apiVersion))
|
|
1748
|
+
throw new Error(`Invalid apiVersion: expected 'v2' or 'v3', received '${apiVersion}'`);
|
|
1749
|
+
const url = new URL(`https://cdn.builder.io/api/${apiVersion}/content/${model}?apiKey=${apiKey}&limit=${limit}&noTraverse=${noTraverse}&includeRefs=${includeRefs}${locale ? `&locale=${locale}` : ""}`);
|
|
1745
1750
|
const queryOptions = {
|
|
1746
1751
|
...getBuilderSearchParamsFromWindow(),
|
|
1747
1752
|
...normalizeSearchParams(options.options || {})
|
|
@@ -1779,39 +1784,47 @@ async function getAllContent(options) {
|
|
|
1779
1784
|
});
|
|
1780
1785
|
return content;
|
|
1781
1786
|
}
|
|
1782
|
-
const
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
props.
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
}
|
|
1792
|
-
|
|
1793
|
-
|
|
1787
|
+
const fetchContent = function fetchContent2(props, state, builderContext2) {
|
|
1788
|
+
if (!state.contentToUse && props.symbol?.model && builderContext2?.apiKey)
|
|
1789
|
+
getContent({
|
|
1790
|
+
model: props.symbol.model,
|
|
1791
|
+
apiKey: builderContext2.apiKey,
|
|
1792
|
+
apiVersion: builderContext2.apiVersion,
|
|
1793
|
+
query: {
|
|
1794
|
+
id: props.symbol.entry
|
|
1795
|
+
}
|
|
1796
|
+
}).then((response) => {
|
|
1797
|
+
if (response)
|
|
1798
|
+
state.contentToUse = response;
|
|
1799
|
+
}).catch((err) => {
|
|
1800
|
+
console.error("[Builder.io]: Could not fetch symbol content: ", err);
|
|
1801
|
+
});
|
|
1794
1802
|
};
|
|
1795
1803
|
const Symbol$1 = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) => {
|
|
1796
1804
|
const builderContext$1 = qwik.useContext(builderContext);
|
|
1797
1805
|
const state = qwik.useStore({
|
|
1798
|
-
|
|
1806
|
+
className: [
|
|
1807
|
+
...[
|
|
1808
|
+
props.attributes.class
|
|
1809
|
+
],
|
|
1810
|
+
"builder-symbol",
|
|
1811
|
+
props.symbol?.inline ? "builder-inline-symbol" : void 0,
|
|
1812
|
+
props.symbol?.dynamic || props.dynamic ? "builder-dynamic-symbol" : void 0
|
|
1813
|
+
].filter(Boolean).join(" "),
|
|
1814
|
+
contentToUse: props.symbol?.content
|
|
1799
1815
|
});
|
|
1816
|
+
qwik.useClientEffectQrl(qwik.inlinedQrl(() => {
|
|
1817
|
+
const [builderContext2, props2, state2] = qwik.useLexicalScope();
|
|
1818
|
+
fetchContent(props2, state2, builderContext2);
|
|
1819
|
+
}, "Symbol_component_useClientEffect_Kfc9q3nzeSQ", [
|
|
1820
|
+
builderContext$1,
|
|
1821
|
+
props,
|
|
1822
|
+
state
|
|
1823
|
+
]));
|
|
1800
1824
|
qwik.useTaskQrl(qwik.inlinedQrl(({ track: track2 }) => {
|
|
1801
1825
|
const [builderContext2, props2, state2] = qwik.useLexicalScope();
|
|
1802
1826
|
track2(() => props2.symbol);
|
|
1803
|
-
|
|
1804
|
-
const symbolToUse = props2.symbol;
|
|
1805
|
-
if (symbolToUse && !symbolToUse.content && !state2.fetchedContent && symbolToUse.model && builderContext2?.apiKey)
|
|
1806
|
-
getContent({
|
|
1807
|
-
model: symbolToUse.model,
|
|
1808
|
-
apiKey: builderContext2.apiKey,
|
|
1809
|
-
query: {
|
|
1810
|
-
id: symbolToUse.entry
|
|
1811
|
-
}
|
|
1812
|
-
}).then((response) => {
|
|
1813
|
-
state2.fetchedContent = response;
|
|
1814
|
-
});
|
|
1827
|
+
fetchContent(props2, state2, builderContext2);
|
|
1815
1828
|
}, "Symbol_component_useTask_NIAWAC1bMBo", [
|
|
1816
1829
|
builderContext$1,
|
|
1817
1830
|
props,
|
|
@@ -1819,8 +1832,13 @@ const Symbol$1 = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) => {
|
|
|
1819
1832
|
]));
|
|
1820
1833
|
return /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
1821
1834
|
...props.attributes,
|
|
1822
|
-
class
|
|
1835
|
+
get class() {
|
|
1836
|
+
return state.className;
|
|
1837
|
+
},
|
|
1823
1838
|
children: /* @__PURE__ */ jsxRuntime.jsx(RenderContent$1, {
|
|
1839
|
+
get apiVersion() {
|
|
1840
|
+
return builderContext$1.apiVersion;
|
|
1841
|
+
},
|
|
1824
1842
|
get apiKey() {
|
|
1825
1843
|
return builderContext$1.apiKey;
|
|
1826
1844
|
},
|
|
@@ -1831,15 +1849,22 @@ const Symbol$1 = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) => {
|
|
|
1831
1849
|
data: {
|
|
1832
1850
|
...props.symbol?.data,
|
|
1833
1851
|
...builderContext$1.state,
|
|
1834
|
-
...
|
|
1852
|
+
...state.contentToUse?.data?.state
|
|
1835
1853
|
},
|
|
1836
1854
|
model: props.symbol?.model,
|
|
1837
|
-
content
|
|
1855
|
+
get content() {
|
|
1856
|
+
return state.contentToUse;
|
|
1857
|
+
},
|
|
1838
1858
|
[qwik._IMMUTABLE]: {
|
|
1859
|
+
apiVersion: qwik._wrapSignal(builderContext$1, "apiVersion"),
|
|
1839
1860
|
apiKey: qwik._wrapSignal(builderContext$1, "apiKey"),
|
|
1840
|
-
context: qwik._wrapSignal(builderContext$1, "context")
|
|
1861
|
+
context: qwik._wrapSignal(builderContext$1, "context"),
|
|
1862
|
+
content: qwik._wrapSignal(state, "contentToUse")
|
|
1841
1863
|
}
|
|
1842
|
-
}, "Wt_0")
|
|
1864
|
+
}, "Wt_0"),
|
|
1865
|
+
[qwik._IMMUTABLE]: {
|
|
1866
|
+
class: qwik._wrapSignal(state, "className")
|
|
1867
|
+
}
|
|
1843
1868
|
});
|
|
1844
1869
|
}, "Symbol_component_WVvggdkUPdk"));
|
|
1845
1870
|
const componentInfo$4 = {
|
|
@@ -2937,6 +2962,7 @@ const RenderContent = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props)
|
|
|
2937
2962
|
state: state.contentState,
|
|
2938
2963
|
context: props.context || {},
|
|
2939
2964
|
apiKey: props.apiKey,
|
|
2965
|
+
apiVersion: props.apiVersion,
|
|
2940
2966
|
registeredComponents: state.allRegisteredComponents
|
|
2941
2967
|
}));
|
|
2942
2968
|
qwik.useClientEffectQrl(qwik.inlinedQrl(() => {
|
|
@@ -2980,7 +3006,8 @@ const RenderContent = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props)
|
|
|
2980
3006
|
if (searchParamPreview === props2.model && previewApiKey === props2.apiKey)
|
|
2981
3007
|
getContent({
|
|
2982
3008
|
model: props2.model,
|
|
2983
|
-
apiKey: props2.apiKey
|
|
3009
|
+
apiKey: props2.apiKey,
|
|
3010
|
+
apiVersion: props2.apiVersion
|
|
2984
3011
|
}).then((content) => {
|
|
2985
3012
|
if (content)
|
|
2986
3013
|
mergeNewContent(props2, state2, elementRef2, content);
|
|
@@ -2995,12 +3022,22 @@ const RenderContent = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props)
|
|
|
2995
3022
|
props,
|
|
2996
3023
|
state
|
|
2997
3024
|
]));
|
|
3025
|
+
qwik.useTaskQrl(qwik.inlinedQrl(({ track: track2 }) => {
|
|
3026
|
+
const [elementRef2, props2, state2] = qwik.useLexicalScope();
|
|
3027
|
+
track2(() => props2.content);
|
|
3028
|
+
if (props2.content)
|
|
3029
|
+
mergeNewContent(props2, state2, elementRef2, props2.content);
|
|
3030
|
+
}, "RenderContent_component_useTask_Kulmlf9pM08", [
|
|
3031
|
+
elementRef,
|
|
3032
|
+
props,
|
|
3033
|
+
state
|
|
3034
|
+
]));
|
|
2998
3035
|
qwik.useTaskQrl(qwik.inlinedQrl(({ track: track2 }) => {
|
|
2999
3036
|
const [elementRef2, props2, state2] = qwik.useLexicalScope();
|
|
3000
3037
|
track2(() => state2.useContent?.data?.jsCode);
|
|
3001
3038
|
track2(() => state2.contentState);
|
|
3002
3039
|
evaluateJsCode(props2, state2);
|
|
3003
|
-
}, "
|
|
3040
|
+
}, "RenderContent_component_useTask_1_X59YMGOetns", [
|
|
3004
3041
|
elementRef,
|
|
3005
3042
|
props,
|
|
3006
3043
|
state
|
|
@@ -3009,7 +3046,7 @@ const RenderContent = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props)
|
|
|
3009
3046
|
const [elementRef2, props2, state2] = qwik.useLexicalScope();
|
|
3010
3047
|
track2(() => state2.useContent?.data?.httpRequests);
|
|
3011
3048
|
runHttpRequests(props2, state2, elementRef2);
|
|
3012
|
-
}, "
|
|
3049
|
+
}, "RenderContent_component_useTask_2_u3gn3Pj2b2s", [
|
|
3013
3050
|
elementRef,
|
|
3014
3051
|
props,
|
|
3015
3052
|
state
|
|
@@ -3018,7 +3055,7 @@ const RenderContent = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props)
|
|
|
3018
3055
|
const [elementRef2, props2, state2] = qwik.useLexicalScope();
|
|
3019
3056
|
track2(() => state2.contentState);
|
|
3020
3057
|
emitStateUpdate(props2, state2);
|
|
3021
|
-
}, "
|
|
3058
|
+
}, "RenderContent_component_useTask_3_xLCHvjhJYRM", [
|
|
3022
3059
|
elementRef,
|
|
3023
3060
|
props,
|
|
3024
3061
|
state
|
package/lib/index.qwik.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { componentQrl, inlinedQrl, useStylesScopedQrl, _wrapSignal, _IMMUTABLE, createContext, useLexicalScope, useContextProvider, useStore, useContext, Slot, Fragment as Fragment$1, useTaskQrl, useRef,
|
|
1
|
+
import { componentQrl, inlinedQrl, useStylesScopedQrl, _wrapSignal, _IMMUTABLE, createContext, useLexicalScope, useContextProvider, useStore, useContext, Slot, Fragment as Fragment$1, useClientEffectQrl, useTaskQrl, useRef, useCleanupQrl } from "@builder.io/qwik";
|
|
2
2
|
import { jsx, Fragment, jsxs } from "@builder.io/qwik/jsx-runtime";
|
|
3
3
|
const Button = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
|
|
4
4
|
useStylesScopedQrl(inlinedQrl(STYLES$3, "Button_component_useStylesScoped_a1JZ0Q0Q2Oc"));
|
|
@@ -584,7 +584,7 @@ const RenderBlock = (props) => {
|
|
|
584
584
|
}, "9d_3");
|
|
585
585
|
};
|
|
586
586
|
const RenderBlock$1 = RenderBlock;
|
|
587
|
-
const className
|
|
587
|
+
const className = function className2(props, state, builderContext2) {
|
|
588
588
|
return "builder-blocks" + (!props.blocks?.length ? " no-blocks" : "");
|
|
589
589
|
};
|
|
590
590
|
const onClick$1 = function onClick2(props, state, builderContext2) {
|
|
@@ -612,7 +612,7 @@ const RenderBlocks = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
|
|
|
612
612
|
const builderContext$1 = useContext(builderContext);
|
|
613
613
|
const state = {};
|
|
614
614
|
return /* @__PURE__ */ jsxs("div", {
|
|
615
|
-
class: className
|
|
615
|
+
class: className(props) + " div-RenderBlocks",
|
|
616
616
|
get "builder-path"() {
|
|
617
617
|
return props.path;
|
|
618
618
|
},
|
|
@@ -1736,10 +1736,15 @@ const getBuilderSearchParamsFromWindow = () => {
|
|
|
1736
1736
|
};
|
|
1737
1737
|
const normalizeSearchParams = (searchParams) => searchParams instanceof URLSearchParams ? convertSearchParamsToQueryObject(searchParams) : searchParams;
|
|
1738
1738
|
const generateContentUrl = (options) => {
|
|
1739
|
-
const { limit = 30, userAttributes, query, noTraverse = false, model, apiKey, includeRefs = true, locale } = options;
|
|
1739
|
+
const { limit = 30, userAttributes, query, noTraverse = false, model, apiKey, includeRefs = true, locale, apiVersion = "v2" } = options;
|
|
1740
1740
|
if (!apiKey)
|
|
1741
1741
|
throw new Error("Missing API key");
|
|
1742
|
-
|
|
1742
|
+
if (![
|
|
1743
|
+
"v2",
|
|
1744
|
+
"v3"
|
|
1745
|
+
].includes(apiVersion))
|
|
1746
|
+
throw new Error(`Invalid apiVersion: expected 'v2' or 'v3', received '${apiVersion}'`);
|
|
1747
|
+
const url = new URL(`https://cdn.builder.io/api/${apiVersion}/content/${model}?apiKey=${apiKey}&limit=${limit}&noTraverse=${noTraverse}&includeRefs=${includeRefs}${locale ? `&locale=${locale}` : ""}`);
|
|
1743
1748
|
const queryOptions = {
|
|
1744
1749
|
...getBuilderSearchParamsFromWindow(),
|
|
1745
1750
|
...normalizeSearchParams(options.options || {})
|
|
@@ -1777,39 +1782,47 @@ async function getAllContent(options) {
|
|
|
1777
1782
|
});
|
|
1778
1783
|
return content;
|
|
1779
1784
|
}
|
|
1780
|
-
const
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
props.
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
}
|
|
1790
|
-
|
|
1791
|
-
|
|
1785
|
+
const fetchContent = function fetchContent2(props, state, builderContext2) {
|
|
1786
|
+
if (!state.contentToUse && props.symbol?.model && builderContext2?.apiKey)
|
|
1787
|
+
getContent({
|
|
1788
|
+
model: props.symbol.model,
|
|
1789
|
+
apiKey: builderContext2.apiKey,
|
|
1790
|
+
apiVersion: builderContext2.apiVersion,
|
|
1791
|
+
query: {
|
|
1792
|
+
id: props.symbol.entry
|
|
1793
|
+
}
|
|
1794
|
+
}).then((response) => {
|
|
1795
|
+
if (response)
|
|
1796
|
+
state.contentToUse = response;
|
|
1797
|
+
}).catch((err) => {
|
|
1798
|
+
console.error("[Builder.io]: Could not fetch symbol content: ", err);
|
|
1799
|
+
});
|
|
1792
1800
|
};
|
|
1793
1801
|
const Symbol$1 = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
|
|
1794
1802
|
const builderContext$1 = useContext(builderContext);
|
|
1795
1803
|
const state = useStore({
|
|
1796
|
-
|
|
1804
|
+
className: [
|
|
1805
|
+
...[
|
|
1806
|
+
props.attributes.class
|
|
1807
|
+
],
|
|
1808
|
+
"builder-symbol",
|
|
1809
|
+
props.symbol?.inline ? "builder-inline-symbol" : void 0,
|
|
1810
|
+
props.symbol?.dynamic || props.dynamic ? "builder-dynamic-symbol" : void 0
|
|
1811
|
+
].filter(Boolean).join(" "),
|
|
1812
|
+
contentToUse: props.symbol?.content
|
|
1797
1813
|
});
|
|
1814
|
+
useClientEffectQrl(inlinedQrl(() => {
|
|
1815
|
+
const [builderContext2, props2, state2] = useLexicalScope();
|
|
1816
|
+
fetchContent(props2, state2, builderContext2);
|
|
1817
|
+
}, "Symbol_component_useClientEffect_Kfc9q3nzeSQ", [
|
|
1818
|
+
builderContext$1,
|
|
1819
|
+
props,
|
|
1820
|
+
state
|
|
1821
|
+
]));
|
|
1798
1822
|
useTaskQrl(inlinedQrl(({ track: track2 }) => {
|
|
1799
1823
|
const [builderContext2, props2, state2] = useLexicalScope();
|
|
1800
1824
|
track2(() => props2.symbol);
|
|
1801
|
-
|
|
1802
|
-
const symbolToUse = props2.symbol;
|
|
1803
|
-
if (symbolToUse && !symbolToUse.content && !state2.fetchedContent && symbolToUse.model && builderContext2?.apiKey)
|
|
1804
|
-
getContent({
|
|
1805
|
-
model: symbolToUse.model,
|
|
1806
|
-
apiKey: builderContext2.apiKey,
|
|
1807
|
-
query: {
|
|
1808
|
-
id: symbolToUse.entry
|
|
1809
|
-
}
|
|
1810
|
-
}).then((response) => {
|
|
1811
|
-
state2.fetchedContent = response;
|
|
1812
|
-
});
|
|
1825
|
+
fetchContent(props2, state2, builderContext2);
|
|
1813
1826
|
}, "Symbol_component_useTask_NIAWAC1bMBo", [
|
|
1814
1827
|
builderContext$1,
|
|
1815
1828
|
props,
|
|
@@ -1817,8 +1830,13 @@ const Symbol$1 = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
|
|
|
1817
1830
|
]));
|
|
1818
1831
|
return /* @__PURE__ */ jsx("div", {
|
|
1819
1832
|
...props.attributes,
|
|
1820
|
-
class
|
|
1833
|
+
get class() {
|
|
1834
|
+
return state.className;
|
|
1835
|
+
},
|
|
1821
1836
|
children: /* @__PURE__ */ jsx(RenderContent$1, {
|
|
1837
|
+
get apiVersion() {
|
|
1838
|
+
return builderContext$1.apiVersion;
|
|
1839
|
+
},
|
|
1822
1840
|
get apiKey() {
|
|
1823
1841
|
return builderContext$1.apiKey;
|
|
1824
1842
|
},
|
|
@@ -1829,15 +1847,22 @@ const Symbol$1 = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
|
|
|
1829
1847
|
data: {
|
|
1830
1848
|
...props.symbol?.data,
|
|
1831
1849
|
...builderContext$1.state,
|
|
1832
|
-
...
|
|
1850
|
+
...state.contentToUse?.data?.state
|
|
1833
1851
|
},
|
|
1834
1852
|
model: props.symbol?.model,
|
|
1835
|
-
content
|
|
1853
|
+
get content() {
|
|
1854
|
+
return state.contentToUse;
|
|
1855
|
+
},
|
|
1836
1856
|
[_IMMUTABLE]: {
|
|
1857
|
+
apiVersion: _wrapSignal(builderContext$1, "apiVersion"),
|
|
1837
1858
|
apiKey: _wrapSignal(builderContext$1, "apiKey"),
|
|
1838
|
-
context: _wrapSignal(builderContext$1, "context")
|
|
1859
|
+
context: _wrapSignal(builderContext$1, "context"),
|
|
1860
|
+
content: _wrapSignal(state, "contentToUse")
|
|
1839
1861
|
}
|
|
1840
|
-
}, "Wt_0")
|
|
1862
|
+
}, "Wt_0"),
|
|
1863
|
+
[_IMMUTABLE]: {
|
|
1864
|
+
class: _wrapSignal(state, "className")
|
|
1865
|
+
}
|
|
1841
1866
|
});
|
|
1842
1867
|
}, "Symbol_component_WVvggdkUPdk"));
|
|
1843
1868
|
const componentInfo$4 = {
|
|
@@ -2935,6 +2960,7 @@ const RenderContent = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
|
|
|
2935
2960
|
state: state.contentState,
|
|
2936
2961
|
context: props.context || {},
|
|
2937
2962
|
apiKey: props.apiKey,
|
|
2963
|
+
apiVersion: props.apiVersion,
|
|
2938
2964
|
registeredComponents: state.allRegisteredComponents
|
|
2939
2965
|
}));
|
|
2940
2966
|
useClientEffectQrl(inlinedQrl(() => {
|
|
@@ -2978,7 +3004,8 @@ const RenderContent = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
|
|
|
2978
3004
|
if (searchParamPreview === props2.model && previewApiKey === props2.apiKey)
|
|
2979
3005
|
getContent({
|
|
2980
3006
|
model: props2.model,
|
|
2981
|
-
apiKey: props2.apiKey
|
|
3007
|
+
apiKey: props2.apiKey,
|
|
3008
|
+
apiVersion: props2.apiVersion
|
|
2982
3009
|
}).then((content) => {
|
|
2983
3010
|
if (content)
|
|
2984
3011
|
mergeNewContent(props2, state2, elementRef2, content);
|
|
@@ -2993,12 +3020,22 @@ const RenderContent = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
|
|
|
2993
3020
|
props,
|
|
2994
3021
|
state
|
|
2995
3022
|
]));
|
|
3023
|
+
useTaskQrl(inlinedQrl(({ track: track2 }) => {
|
|
3024
|
+
const [elementRef2, props2, state2] = useLexicalScope();
|
|
3025
|
+
track2(() => props2.content);
|
|
3026
|
+
if (props2.content)
|
|
3027
|
+
mergeNewContent(props2, state2, elementRef2, props2.content);
|
|
3028
|
+
}, "RenderContent_component_useTask_Kulmlf9pM08", [
|
|
3029
|
+
elementRef,
|
|
3030
|
+
props,
|
|
3031
|
+
state
|
|
3032
|
+
]));
|
|
2996
3033
|
useTaskQrl(inlinedQrl(({ track: track2 }) => {
|
|
2997
3034
|
const [elementRef2, props2, state2] = useLexicalScope();
|
|
2998
3035
|
track2(() => state2.useContent?.data?.jsCode);
|
|
2999
3036
|
track2(() => state2.contentState);
|
|
3000
3037
|
evaluateJsCode(props2, state2);
|
|
3001
|
-
}, "
|
|
3038
|
+
}, "RenderContent_component_useTask_1_X59YMGOetns", [
|
|
3002
3039
|
elementRef,
|
|
3003
3040
|
props,
|
|
3004
3041
|
state
|
|
@@ -3007,7 +3044,7 @@ const RenderContent = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
|
|
|
3007
3044
|
const [elementRef2, props2, state2] = useLexicalScope();
|
|
3008
3045
|
track2(() => state2.useContent?.data?.httpRequests);
|
|
3009
3046
|
runHttpRequests(props2, state2, elementRef2);
|
|
3010
|
-
}, "
|
|
3047
|
+
}, "RenderContent_component_useTask_2_u3gn3Pj2b2s", [
|
|
3011
3048
|
elementRef,
|
|
3012
3049
|
props,
|
|
3013
3050
|
state
|
|
@@ -3016,7 +3053,7 @@ const RenderContent = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
|
|
|
3016
3053
|
const [elementRef2, props2, state2] = useLexicalScope();
|
|
3017
3054
|
track2(() => state2.contentState);
|
|
3018
3055
|
emitStateUpdate(props2, state2);
|
|
3019
|
-
}, "
|
|
3056
|
+
}, "RenderContent_component_useTask_3_xLCHvjhJYRM", [
|
|
3020
3057
|
elementRef,
|
|
3021
3058
|
props,
|
|
3022
3059
|
state
|
package/package.json
CHANGED
|
@@ -16,7 +16,6 @@ export interface SymbolProps {
|
|
|
16
16
|
attributes?: any;
|
|
17
17
|
inheritState?: boolean;
|
|
18
18
|
}
|
|
19
|
-
export declare const
|
|
20
|
-
export declare const contentToUse: (props: any, state: any, builderContext: any) => any;
|
|
19
|
+
export declare const fetchContent: (props: any, state: any, builderContext: any) => void;
|
|
21
20
|
export declare const Symbol: import("@builder.io/qwik").Component<SymbolProps>;
|
|
22
21
|
export default Symbol;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { BuilderRenderContext, RegisteredComponent, BuilderRenderState } from '../../context/types';
|
|
2
2
|
import type { BuilderContent } from '../../types/builder-content';
|
|
3
3
|
import type { Nullable } from '../../types/typescript';
|
|
4
|
+
import type { ApiVersion } from '../../types/api-version';
|
|
4
5
|
export type RenderContentProps = {
|
|
5
6
|
content?: Nullable<BuilderContent>;
|
|
6
7
|
model?: string;
|
|
@@ -9,6 +10,7 @@ export type RenderContentProps = {
|
|
|
9
10
|
};
|
|
10
11
|
context?: BuilderRenderContext;
|
|
11
12
|
apiKey: string;
|
|
13
|
+
apiVersion?: ApiVersion;
|
|
12
14
|
customComponents?: RegisteredComponent[];
|
|
13
15
|
canTrack?: boolean;
|
|
14
16
|
locale?: string;
|
package/types/context/types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { BuilderContent } from '../types/builder-content.js';
|
|
2
2
|
import type { ComponentInfo } from '../types/components.js';
|
|
3
3
|
import type { Dictionary, Nullable } from '../types/typescript.js';
|
|
4
|
+
import type { ApiVersion } from '../types/api-version.js';
|
|
4
5
|
export type RegisteredComponent = ComponentInfo & {
|
|
5
6
|
component: any;
|
|
6
7
|
};
|
|
@@ -13,6 +14,7 @@ export interface BuilderContextInterface {
|
|
|
13
14
|
state: BuilderRenderState;
|
|
14
15
|
setState?: (state: BuilderRenderState) => void;
|
|
15
16
|
apiKey: string | null;
|
|
17
|
+
apiVersion?: ApiVersion;
|
|
16
18
|
registeredComponents: RegisteredComponents;
|
|
17
19
|
inheritedStyles: Record<string, unknown>;
|
|
18
20
|
}
|
|
@@ -36,4 +36,10 @@ export interface GetContentOptions {
|
|
|
36
36
|
* If provided, the API will auto-resolve localized objects to the value of this `locale` key.
|
|
37
37
|
*/
|
|
38
38
|
locale?: string;
|
|
39
|
+
/**
|
|
40
|
+
* If provided, sets the Builder API version used to fetch content.
|
|
41
|
+
*
|
|
42
|
+
* Defaults to `v2`.
|
|
43
|
+
*/
|
|
44
|
+
apiVersion?: 'v2' | 'v3';
|
|
39
45
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ApiVersion = 'v2' | 'v3';
|