@builder.io/sdk-react-nextjs 0.22.0 → 0.22.1
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/browser/blocks/img/component-info.cjs +1 -1
- package/lib/browser/blocks/img/component-info.mjs +33 -3
- package/lib/browser/blocks/img/img.cjs +1 -1
- package/lib/browser/blocks/img/img.mjs +22 -17
- package/lib/browser/constants/sdk-version.cjs +1 -1
- package/lib/browser/constants/sdk-version.mjs +1 -1
- package/lib/browser/functions/get-content/generate-content-url.cjs +1 -1
- package/lib/browser/functions/get-content/generate-content-url.mjs +38 -42
- package/lib/browser/functions/get-content/index.cjs +1 -1
- package/lib/browser/functions/get-content/index.mjs +42 -36
- package/lib/edge/blocks/img/component-info.cjs +1 -1
- package/lib/edge/blocks/img/component-info.mjs +33 -3
- package/lib/edge/blocks/img/img.cjs +1 -1
- package/lib/edge/blocks/img/img.mjs +22 -17
- package/lib/edge/constants/sdk-version.cjs +1 -1
- package/lib/edge/constants/sdk-version.mjs +1 -1
- package/lib/edge/functions/get-content/generate-content-url.cjs +1 -1
- package/lib/edge/functions/get-content/generate-content-url.mjs +38 -42
- package/lib/edge/functions/get-content/index.cjs +1 -1
- package/lib/edge/functions/get-content/index.mjs +42 -36
- package/lib/node/blocks/img/component-info.cjs +1 -1
- package/lib/node/blocks/img/component-info.mjs +33 -3
- package/lib/node/blocks/img/img.cjs +1 -1
- package/lib/node/blocks/img/img.mjs +22 -17
- package/lib/node/constants/sdk-version.cjs +1 -1
- package/lib/node/constants/sdk-version.mjs +1 -1
- package/lib/node/functions/get-content/generate-content-url.cjs +1 -1
- package/lib/node/functions/get-content/generate-content-url.mjs +38 -42
- package/lib/node/functions/get-content/index.cjs +1 -1
- package/lib/node/functions/get-content/index.mjs +42 -36
- package/package.json +1 -1
- package/types/cjs/blocks/img/img.d.ts +2 -0
- package/types/cjs/constants/sdk-version.d.ts +1 -1
- package/types/esm/blocks/img/img.d.ts +2 -0
- package/types/esm/constants/sdk-version.d.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../constants/file-types.cjs"),t={name:"Raw:Img",hideFromInsertMenu:!0,image:"https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4",inputs:[{name:"image",bubble:!0,type:"file",allowedFileTypes:e.IMAGE_FILE_TYPES,required:!0}],
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../constants/file-types.cjs"),t={name:"Raw:Img",hideFromInsertMenu:!0,image:"https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4",inputs:[{name:"image",bubble:!0,type:"file",allowedFileTypes:e.IMAGE_FILE_TYPES,required:!0},{name:"backgroundSize",type:"text",defaultValue:"cover",enum:[{label:"contain",value:"contain",helperText:"The image should never get cropped"},{label:"cover",value:"cover",helperText:"The image should fill it's box, cropping when needed"}]},{name:"backgroundPosition",type:"text",defaultValue:"center",enum:["center","top","left","right","bottom","top left","top right","bottom left","bottom right"]},{name:"altText",type:"string",helperText:"Text to display when the user has images off"},{name:"title",type:"string",helperText:"Text to display when hovering over the asset"},{name:"aspectRatio",type:"number",helperText:"This is the ratio of height/width, e.g. set to 1.5 for a 300px wide and 200px tall photo. Set to 0 to not force the image to maintain it's aspect ratio",advanced:!0,defaultValue:.7041}],noWrap:!0};exports.componentInfo=t;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { IMAGE_FILE_TYPES as e } from "../../constants/file-types.mjs";
|
|
2
2
|
const o = {
|
|
3
|
-
// friendlyName?
|
|
4
3
|
name: "Raw:Img",
|
|
5
4
|
hideFromInsertMenu: !0,
|
|
6
5
|
image: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4",
|
|
@@ -10,9 +9,40 @@ const o = {
|
|
|
10
9
|
type: "file",
|
|
11
10
|
allowedFileTypes: e,
|
|
12
11
|
required: !0
|
|
12
|
+
}, {
|
|
13
|
+
name: "backgroundSize",
|
|
14
|
+
type: "text",
|
|
15
|
+
defaultValue: "cover",
|
|
16
|
+
enum: [{
|
|
17
|
+
label: "contain",
|
|
18
|
+
value: "contain",
|
|
19
|
+
helperText: "The image should never get cropped"
|
|
20
|
+
}, {
|
|
21
|
+
label: "cover",
|
|
22
|
+
value: "cover",
|
|
23
|
+
helperText: "The image should fill it's box, cropping when needed"
|
|
24
|
+
}]
|
|
25
|
+
}, {
|
|
26
|
+
name: "backgroundPosition",
|
|
27
|
+
type: "text",
|
|
28
|
+
defaultValue: "center",
|
|
29
|
+
enum: ["center", "top", "left", "right", "bottom", "top left", "top right", "bottom left", "bottom right"]
|
|
30
|
+
}, {
|
|
31
|
+
name: "altText",
|
|
32
|
+
type: "string",
|
|
33
|
+
helperText: "Text to display when the user has images off"
|
|
34
|
+
}, {
|
|
35
|
+
name: "title",
|
|
36
|
+
type: "string",
|
|
37
|
+
helperText: "Text to display when hovering over the asset"
|
|
38
|
+
}, {
|
|
39
|
+
name: "aspectRatio",
|
|
40
|
+
type: "number",
|
|
41
|
+
helperText: "This is the ratio of height/width, e.g. set to 1.5 for a 300px wide and 200px tall photo. Set to 0 to not force the image to maintain it's aspect ratio",
|
|
42
|
+
advanced: !0,
|
|
43
|
+
defaultValue: 0.7041
|
|
13
44
|
}],
|
|
14
|
-
noWrap: !0
|
|
15
|
-
static: !0
|
|
45
|
+
noWrap: !0
|
|
16
46
|
};
|
|
17
47
|
export {
|
|
18
48
|
o as componentInfo
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";const
|
|
1
|
+
"use client";"use strict";const s=require("react/jsx-runtime"),c=require("../../functions/is-editing.cjs"),a=require("../../functions/get-class-prop-name.cjs");function r(t){var e;function n(){const i={...t.attributes,[a.getClassPropName()]:`builder-raw-img ${t.attributes[a.getClassPropName()]||""}`};return delete i.style,i}return s.jsx("img",{loading:"lazy",alt:t.altText,title:t.title,src:t.imgSrc||t.image,...n(),style:{objectFit:t.backgroundSize||"cover",objectPosition:t.backgroundPosition||"center",aspectRatio:t.aspectRatio||void 0,...((e=t.attributes)==null?void 0:e.style)||{}}},c.isEditing()&&t.imgSrc||"default-key")}module.exports=r;
|
|
@@ -1,29 +1,34 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { isEditing as
|
|
4
|
-
import {
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
3
|
+
import { isEditing as r } from "../../functions/is-editing.mjs";
|
|
4
|
+
import { getClassPropName as a } from "../../functions/get-class-prop-name.mjs";
|
|
5
|
+
function u(t) {
|
|
6
|
+
var e;
|
|
7
|
+
function n() {
|
|
8
|
+
const i = {
|
|
9
|
+
...t.attributes,
|
|
10
|
+
[a()]: `builder-raw-img ${t.attributes[a()] || ""}`
|
|
11
|
+
};
|
|
12
|
+
return delete i.style, i;
|
|
10
13
|
}
|
|
11
|
-
return /* @__PURE__ */
|
|
14
|
+
return /* @__PURE__ */ o(
|
|
12
15
|
"img",
|
|
13
16
|
{
|
|
14
17
|
loading: "lazy",
|
|
15
|
-
style: {
|
|
16
|
-
objectFit: t.backgroundSize || "cover",
|
|
17
|
-
objectPosition: t.backgroundPosition || "center"
|
|
18
|
-
},
|
|
19
18
|
alt: t.altText,
|
|
19
|
+
title: t.title,
|
|
20
20
|
src: t.imgSrc || t.image,
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
...n(),
|
|
22
|
+
style: {
|
|
23
|
+
objectFit: t.backgroundSize || "cover",
|
|
24
|
+
objectPosition: t.backgroundPosition || "center",
|
|
25
|
+
aspectRatio: t.aspectRatio || void 0,
|
|
26
|
+
...((e = t.attributes) == null ? void 0 : e.style) || {}
|
|
27
|
+
}
|
|
23
28
|
},
|
|
24
|
-
|
|
29
|
+
r() && t.imgSrc || "default-key"
|
|
25
30
|
);
|
|
26
31
|
}
|
|
27
32
|
export {
|
|
28
|
-
|
|
33
|
+
u as default
|
|
29
34
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.22.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.22.1";exports.SDK_VERSION=e;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../helpers/flatten.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../helpers/flatten.cjs"),I=require("../../helpers/search/search.cjs"),O=require("../../types/api-version.cjs"),E=require("../get-builder-search-params/index.cjs"),F=require("../is-browser.cjs"),U=t=>typeof t=="number"&&!isNaN(t)&&t>=0,T=t=>{const{limit:i=30,userAttributes:s,query:m,model:w,apiKey:d,enrich:P,locale:S,apiVersion:c=O.DEFAULT_API_VERSION,fields:b,omit:l,offset:u,cacheSeconds:f,staleCacheSeconds:h,sort:g,includeUnpublished:p,apiHost:v}=t;if(!d)throw new Error("Missing API key");if(!["v3"].includes(c))throw new Error(`Invalid apiVersion: expected 'v3', received '${c}'`);const N=i!==1,k=v||"https://cdn.builder.io",e=new URL(`${k}/api/${c}/content/${w}`);e.searchParams.set("apiKey",d),e.searchParams.set("limit",String(i)),e.searchParams.set("noTraverse",String(N)),e.searchParams.set("includeRefs",String(!0)),S&&e.searchParams.set("locale",S);let a=s||{};if(P&&e.searchParams.set("enrich",String(P)),e.searchParams.set("omit",l!=null?l:"meta.componentsUsed"),b&&e.searchParams.set("fields",b),Number.isFinite(u)&&u>-1&&e.searchParams.set("offset",String(Math.floor(u))),typeof p=="boolean"&&e.searchParams.set("includeUnpublished",String(p)),f&&U(f)&&e.searchParams.set("cacheSeconds",String(f)),h&&U(h)&&e.searchParams.set("staleCacheSeconds",String(h)),g){const r=o.flatten({sort:g});for(const n in r)e.searchParams.set(n,JSON.stringify(r[n]))}const y={...E.getBuilderSearchParamsFromWindow(),...I.normalizeSearchParams(t.options||{})};a={...a,...$(y)};const A=o.flatten(y);for(const r in A)e.searchParams.set(r,String(A[r]));if(Object.keys(a).length>0&&e.searchParams.set("userAttributes",JSON.stringify(a)),m){const r=o.flattenMongoQuery({query:m});for(const n in r)e.searchParams.set(n,JSON.stringify(r[n]))}return e},V=t=>{const i={};for(const s in t)s.startsWith("userAttributes.")&&(i[s]=t[s],delete t[s]);return i},$=t=>{if(F.isBrowser()&&t.preview==="BUILDER_STUDIO"){t["userAttributes.urlPath"]=window.location.pathname,t["userAttributes.host"]=window.location.host;const i=V(t),{userAttributes:s}=o.unflatten(i);return s}return{}};exports.generateContentUrl=T;
|
|
@@ -1,62 +1,58 @@
|
|
|
1
|
-
import { flatten as
|
|
2
|
-
import { normalizeSearchParams as
|
|
3
|
-
import { DEFAULT_API_VERSION as
|
|
4
|
-
import { getBuilderSearchParamsFromWindow as
|
|
1
|
+
import { flatten as U, flattenMongoQuery as I, unflatten as E } from "../../helpers/flatten.mjs";
|
|
2
|
+
import { normalizeSearchParams as F } from "../../helpers/search/search.mjs";
|
|
3
|
+
import { DEFAULT_API_VERSION as O } from "../../types/api-version.mjs";
|
|
4
|
+
import { getBuilderSearchParamsFromWindow as J } from "../get-builder-search-params/index.mjs";
|
|
5
5
|
import { isBrowser as R } from "../is-browser.mjs";
|
|
6
|
-
const
|
|
6
|
+
const w = (t) => typeof t == "number" && !isNaN(t) && t >= 0, V = (t) => {
|
|
7
7
|
const {
|
|
8
8
|
limit: a = 30,
|
|
9
9
|
userAttributes: r,
|
|
10
10
|
query: u,
|
|
11
|
-
model:
|
|
12
|
-
apiKey:
|
|
13
|
-
enrich:
|
|
14
|
-
locale:
|
|
15
|
-
apiVersion: o =
|
|
11
|
+
model: y,
|
|
12
|
+
apiKey: h,
|
|
13
|
+
enrich: d,
|
|
14
|
+
locale: P,
|
|
15
|
+
apiVersion: o = O,
|
|
16
16
|
fields: S,
|
|
17
17
|
omit: c,
|
|
18
|
-
offset:
|
|
19
|
-
cacheSeconds:
|
|
20
|
-
staleCacheSeconds:
|
|
21
|
-
sort:
|
|
22
|
-
includeUnpublished:
|
|
23
|
-
apiHost:
|
|
18
|
+
offset: f,
|
|
19
|
+
cacheSeconds: m,
|
|
20
|
+
staleCacheSeconds: l,
|
|
21
|
+
sort: b,
|
|
22
|
+
includeUnpublished: p,
|
|
23
|
+
apiHost: N
|
|
24
24
|
} = t;
|
|
25
|
-
if (!
|
|
25
|
+
if (!h)
|
|
26
26
|
throw new Error("Missing API key");
|
|
27
27
|
if (!["v3"].includes(o))
|
|
28
28
|
throw new Error(`Invalid apiVersion: expected 'v3', received '${o}'`);
|
|
29
|
-
const
|
|
30
|
-
e.searchParams.set("apiKey",
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
...i
|
|
36
|
-
}), P && e.searchParams.set("enrich", String(P)), e.searchParams.set("omit", c != null ? c : "meta.componentsUsed"), S && e.searchParams.set("fields", S), Number.isFinite(l) && l > -1 && e.searchParams.set("offset", String(Math.floor(l))), typeof b == "boolean" && e.searchParams.set("includeUnpublished", String(b)), f && y(f) && e.searchParams.set("cacheSeconds", String(f)), m && y(m) && e.searchParams.set("staleCacheSeconds", String(m)), p) {
|
|
37
|
-
const s = w({
|
|
38
|
-
sort: p
|
|
29
|
+
const v = a !== 1, k = N || "https://cdn.builder.io", e = new URL(`${k}/api/${o}/content/${y}`);
|
|
30
|
+
e.searchParams.set("apiKey", h), e.searchParams.set("limit", String(a)), e.searchParams.set("noTraverse", String(v)), e.searchParams.set("includeRefs", String(!0)), P && e.searchParams.set("locale", P);
|
|
31
|
+
let n = r || {};
|
|
32
|
+
if (d && e.searchParams.set("enrich", String(d)), e.searchParams.set("omit", c != null ? c : "meta.componentsUsed"), S && e.searchParams.set("fields", S), Number.isFinite(f) && f > -1 && e.searchParams.set("offset", String(Math.floor(f))), typeof p == "boolean" && e.searchParams.set("includeUnpublished", String(p)), m && w(m) && e.searchParams.set("cacheSeconds", String(m)), l && w(l) && e.searchParams.set("staleCacheSeconds", String(l)), b) {
|
|
33
|
+
const s = U({
|
|
34
|
+
sort: b
|
|
39
35
|
});
|
|
40
|
-
for (const
|
|
41
|
-
e.searchParams.set(
|
|
36
|
+
for (const i in s)
|
|
37
|
+
e.searchParams.set(i, JSON.stringify(s[i]));
|
|
42
38
|
}
|
|
43
39
|
const g = {
|
|
44
|
-
...
|
|
45
|
-
...
|
|
40
|
+
...J(),
|
|
41
|
+
...F(t.options || {})
|
|
46
42
|
};
|
|
47
|
-
|
|
48
|
-
...
|
|
43
|
+
n = {
|
|
44
|
+
...n,
|
|
49
45
|
...$(g)
|
|
50
46
|
};
|
|
51
|
-
const
|
|
52
|
-
for (const s in
|
|
53
|
-
e.searchParams.set(s, String(
|
|
54
|
-
if (Object.keys(
|
|
55
|
-
const s =
|
|
47
|
+
const A = U(g);
|
|
48
|
+
for (const s in A)
|
|
49
|
+
e.searchParams.set(s, String(A[s]));
|
|
50
|
+
if (Object.keys(n).length > 0 && e.searchParams.set("userAttributes", JSON.stringify(n)), u) {
|
|
51
|
+
const s = I({
|
|
56
52
|
query: u
|
|
57
53
|
});
|
|
58
|
-
for (const
|
|
59
|
-
e.searchParams.set(
|
|
54
|
+
for (const i in s)
|
|
55
|
+
e.searchParams.set(i, JSON.stringify(s[i]));
|
|
60
56
|
}
|
|
61
57
|
return e;
|
|
62
58
|
}, T = (t) => {
|
|
@@ -69,11 +65,11 @@ const y = (t) => typeof t == "number" && !isNaN(t) && t >= 0, _ = (t) => {
|
|
|
69
65
|
t["userAttributes.urlPath"] = window.location.pathname, t["userAttributes.host"] = window.location.host;
|
|
70
66
|
const a = T(t), {
|
|
71
67
|
userAttributes: r
|
|
72
|
-
} =
|
|
68
|
+
} = E(a);
|
|
73
69
|
return r;
|
|
74
70
|
}
|
|
75
71
|
return {};
|
|
76
72
|
};
|
|
77
73
|
export {
|
|
78
|
-
|
|
74
|
+
V as generateContentUrl
|
|
79
75
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("../../constants/target.cjs"),g=require("../../helpers/ab-tests.cjs"),w=require("../../helpers/canTrack.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("../../constants/target.cjs"),g=require("../../helpers/ab-tests.cjs"),w=require("../../helpers/canTrack.cjs"),l=require("../../helpers/logger.cjs"),C=require("../../helpers/preview-lru-cache/get.cjs"),d=require("../../helpers/sdk-headers.cjs"),T=require("../get-fetch.cjs"),q=require("../is-browser.cjs"),u=require("./generate-content-url.cjs"),y=e=>"results"in e;async function k(e){var n;const t=e.locale||((n=e.userAttributes)==null?void 0:n.locale);t&&(e.locale=t,e.userAttributes={locale:t,...e.userAttributes});const r=await i({...e,limit:1});return r&&r[0]||null}const v=async e=>{var c,a;const t=u.generateContentUrl(e),r=(c=e.fetch)!=null?c:T.fetch,n={...e.fetchOptions,headers:{...(a=e.fetchOptions)==null?void 0:a.headers,...d.getSdkHeaders()}};return await(await r(t.href,n)).json()},o=async(e,t,r=u.generateContentUrl(e))=>{const n=w.getDefaultCanTrack(e.canTrack);if(r.search.includes("preview=")){const s=[];for(const c of t.results){const a=C.getPreviewContent(r.searchParams);s.push(a||c)}t.results=s}if(!n||!(q.isBrowser()||h.TARGET==="reactNative"))return t.results;try{const s=[];for(const c of t.results)s.push(await g.handleABTesting({item:c,canTrack:n}));t.results=s}catch(s){l.logger.error("Could not process A/B tests. ",s)}return t.results};async function i(e){const t=u.generateContentUrl(e),r=await v(e);if(!y(r))throw l.logger.error("Error fetching data. ",{url:t,content:r,options:e}),r;return o(e,r)}exports._processContentResult=o;exports.fetchEntries=i;exports.fetchOneEntry=k;
|
|
@@ -1,67 +1,73 @@
|
|
|
1
1
|
import { TARGET as u } from "../../constants/target.mjs";
|
|
2
|
-
import { handleABTesting as
|
|
2
|
+
import { handleABTesting as f } from "../../helpers/ab-tests.mjs";
|
|
3
3
|
import { getDefaultCanTrack as m } from "../../helpers/canTrack.mjs";
|
|
4
4
|
import { logger as i } from "../../helpers/logger.mjs";
|
|
5
5
|
import { getPreviewContent as h } from "../../helpers/preview-lru-cache/get.mjs";
|
|
6
6
|
import { getSdkHeaders as w } from "../../helpers/sdk-headers.mjs";
|
|
7
|
-
import { fetch as
|
|
8
|
-
import { isBrowser as
|
|
9
|
-
import { generateContentUrl as
|
|
10
|
-
const
|
|
11
|
-
async function
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
import { fetch as g } from "../get-fetch.mjs";
|
|
8
|
+
import { isBrowser as C } from "../is-browser.mjs";
|
|
9
|
+
import { generateContentUrl as o } from "./generate-content-url.mjs";
|
|
10
|
+
const d = (e) => "results" in e;
|
|
11
|
+
async function _(e) {
|
|
12
|
+
var n;
|
|
13
|
+
const t = e.locale || ((n = e.userAttributes) == null ? void 0 : n.locale);
|
|
14
|
+
t && (e.locale = t, e.userAttributes = {
|
|
15
|
+
locale: t,
|
|
16
|
+
...e.userAttributes
|
|
17
|
+
});
|
|
18
|
+
const r = await y({
|
|
19
|
+
...e,
|
|
14
20
|
limit: 1
|
|
15
21
|
});
|
|
16
|
-
return
|
|
22
|
+
return r && r[0] || null;
|
|
17
23
|
}
|
|
18
|
-
const
|
|
19
|
-
var
|
|
20
|
-
const
|
|
21
|
-
...
|
|
24
|
+
const p = async (e) => {
|
|
25
|
+
var c, a;
|
|
26
|
+
const t = o(e), r = (c = e.fetch) != null ? c : g, n = {
|
|
27
|
+
...e.fetchOptions,
|
|
22
28
|
headers: {
|
|
23
|
-
...(
|
|
29
|
+
...(a = e.fetchOptions) == null ? void 0 : a.headers,
|
|
24
30
|
...w()
|
|
25
31
|
}
|
|
26
32
|
};
|
|
27
|
-
return await (await r(
|
|
28
|
-
}, v = async (
|
|
29
|
-
const
|
|
33
|
+
return await (await r(t.href, n)).json();
|
|
34
|
+
}, v = async (e, t, r = o(e)) => {
|
|
35
|
+
const n = m(e.canTrack);
|
|
30
36
|
if (r.search.includes("preview=")) {
|
|
31
37
|
const s = [];
|
|
32
|
-
for (const
|
|
33
|
-
const
|
|
34
|
-
s.push(
|
|
38
|
+
for (const c of t.results) {
|
|
39
|
+
const a = h(r.searchParams);
|
|
40
|
+
s.push(a || c);
|
|
35
41
|
}
|
|
36
|
-
|
|
42
|
+
t.results = s;
|
|
37
43
|
}
|
|
38
|
-
if (!
|
|
39
|
-
return
|
|
44
|
+
if (!n || !(C() || u === "reactNative"))
|
|
45
|
+
return t.results;
|
|
40
46
|
try {
|
|
41
47
|
const s = [];
|
|
42
|
-
for (const
|
|
43
|
-
s.push(await
|
|
44
|
-
item:
|
|
45
|
-
canTrack:
|
|
48
|
+
for (const c of t.results)
|
|
49
|
+
s.push(await f({
|
|
50
|
+
item: c,
|
|
51
|
+
canTrack: n
|
|
46
52
|
}));
|
|
47
|
-
|
|
53
|
+
t.results = s;
|
|
48
54
|
} catch (s) {
|
|
49
55
|
i.error("Could not process A/B tests. ", s);
|
|
50
56
|
}
|
|
51
|
-
return
|
|
57
|
+
return t.results;
|
|
52
58
|
};
|
|
53
|
-
async function y(
|
|
54
|
-
const
|
|
55
|
-
if (!
|
|
59
|
+
async function y(e) {
|
|
60
|
+
const t = o(e), r = await p(e);
|
|
61
|
+
if (!d(r))
|
|
56
62
|
throw i.error("Error fetching data. ", {
|
|
57
|
-
url:
|
|
63
|
+
url: t,
|
|
58
64
|
content: r,
|
|
59
|
-
options:
|
|
65
|
+
options: e
|
|
60
66
|
}), r;
|
|
61
|
-
return v(
|
|
67
|
+
return v(e, r);
|
|
62
68
|
}
|
|
63
69
|
export {
|
|
64
70
|
v as _processContentResult,
|
|
65
71
|
y as fetchEntries,
|
|
66
|
-
|
|
72
|
+
_ as fetchOneEntry
|
|
67
73
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../constants/file-types.cjs"),t={name:"Raw:Img",hideFromInsertMenu:!0,image:"https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4",inputs:[{name:"image",bubble:!0,type:"file",allowedFileTypes:e.IMAGE_FILE_TYPES,required:!0}],
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../constants/file-types.cjs"),t={name:"Raw:Img",hideFromInsertMenu:!0,image:"https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4",inputs:[{name:"image",bubble:!0,type:"file",allowedFileTypes:e.IMAGE_FILE_TYPES,required:!0},{name:"backgroundSize",type:"text",defaultValue:"cover",enum:[{label:"contain",value:"contain",helperText:"The image should never get cropped"},{label:"cover",value:"cover",helperText:"The image should fill it's box, cropping when needed"}]},{name:"backgroundPosition",type:"text",defaultValue:"center",enum:["center","top","left","right","bottom","top left","top right","bottom left","bottom right"]},{name:"altText",type:"string",helperText:"Text to display when the user has images off"},{name:"title",type:"string",helperText:"Text to display when hovering over the asset"},{name:"aspectRatio",type:"number",helperText:"This is the ratio of height/width, e.g. set to 1.5 for a 300px wide and 200px tall photo. Set to 0 to not force the image to maintain it's aspect ratio",advanced:!0,defaultValue:.7041}],noWrap:!0};exports.componentInfo=t;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { IMAGE_FILE_TYPES as e } from "../../constants/file-types.mjs";
|
|
2
2
|
const o = {
|
|
3
|
-
// friendlyName?
|
|
4
3
|
name: "Raw:Img",
|
|
5
4
|
hideFromInsertMenu: !0,
|
|
6
5
|
image: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4",
|
|
@@ -10,9 +9,40 @@ const o = {
|
|
|
10
9
|
type: "file",
|
|
11
10
|
allowedFileTypes: e,
|
|
12
11
|
required: !0
|
|
12
|
+
}, {
|
|
13
|
+
name: "backgroundSize",
|
|
14
|
+
type: "text",
|
|
15
|
+
defaultValue: "cover",
|
|
16
|
+
enum: [{
|
|
17
|
+
label: "contain",
|
|
18
|
+
value: "contain",
|
|
19
|
+
helperText: "The image should never get cropped"
|
|
20
|
+
}, {
|
|
21
|
+
label: "cover",
|
|
22
|
+
value: "cover",
|
|
23
|
+
helperText: "The image should fill it's box, cropping when needed"
|
|
24
|
+
}]
|
|
25
|
+
}, {
|
|
26
|
+
name: "backgroundPosition",
|
|
27
|
+
type: "text",
|
|
28
|
+
defaultValue: "center",
|
|
29
|
+
enum: ["center", "top", "left", "right", "bottom", "top left", "top right", "bottom left", "bottom right"]
|
|
30
|
+
}, {
|
|
31
|
+
name: "altText",
|
|
32
|
+
type: "string",
|
|
33
|
+
helperText: "Text to display when the user has images off"
|
|
34
|
+
}, {
|
|
35
|
+
name: "title",
|
|
36
|
+
type: "string",
|
|
37
|
+
helperText: "Text to display when hovering over the asset"
|
|
38
|
+
}, {
|
|
39
|
+
name: "aspectRatio",
|
|
40
|
+
type: "number",
|
|
41
|
+
helperText: "This is the ratio of height/width, e.g. set to 1.5 for a 300px wide and 200px tall photo. Set to 0 to not force the image to maintain it's aspect ratio",
|
|
42
|
+
advanced: !0,
|
|
43
|
+
defaultValue: 0.7041
|
|
13
44
|
}],
|
|
14
|
-
noWrap: !0
|
|
15
|
-
static: !0
|
|
45
|
+
noWrap: !0
|
|
16
46
|
};
|
|
17
47
|
export {
|
|
18
48
|
o as componentInfo
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";const
|
|
1
|
+
"use client";"use strict";const s=require("react/jsx-runtime"),c=require("../../functions/is-editing.cjs"),a=require("../../functions/get-class-prop-name.cjs");function r(t){var e;function n(){const i={...t.attributes,[a.getClassPropName()]:`builder-raw-img ${t.attributes[a.getClassPropName()]||""}`};return delete i.style,i}return s.jsx("img",{loading:"lazy",alt:t.altText,title:t.title,src:t.imgSrc||t.image,...n(),style:{objectFit:t.backgroundSize||"cover",objectPosition:t.backgroundPosition||"center",aspectRatio:t.aspectRatio||void 0,...((e=t.attributes)==null?void 0:e.style)||{}}},c.isEditing()&&t.imgSrc||"default-key")}module.exports=r;
|
|
@@ -1,29 +1,34 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { isEditing as
|
|
4
|
-
import {
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
3
|
+
import { isEditing as r } from "../../functions/is-editing.mjs";
|
|
4
|
+
import { getClassPropName as a } from "../../functions/get-class-prop-name.mjs";
|
|
5
|
+
function u(t) {
|
|
6
|
+
var e;
|
|
7
|
+
function n() {
|
|
8
|
+
const i = {
|
|
9
|
+
...t.attributes,
|
|
10
|
+
[a()]: `builder-raw-img ${t.attributes[a()] || ""}`
|
|
11
|
+
};
|
|
12
|
+
return delete i.style, i;
|
|
10
13
|
}
|
|
11
|
-
return /* @__PURE__ */
|
|
14
|
+
return /* @__PURE__ */ o(
|
|
12
15
|
"img",
|
|
13
16
|
{
|
|
14
17
|
loading: "lazy",
|
|
15
|
-
style: {
|
|
16
|
-
objectFit: t.backgroundSize || "cover",
|
|
17
|
-
objectPosition: t.backgroundPosition || "center"
|
|
18
|
-
},
|
|
19
18
|
alt: t.altText,
|
|
19
|
+
title: t.title,
|
|
20
20
|
src: t.imgSrc || t.image,
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
...n(),
|
|
22
|
+
style: {
|
|
23
|
+
objectFit: t.backgroundSize || "cover",
|
|
24
|
+
objectPosition: t.backgroundPosition || "center",
|
|
25
|
+
aspectRatio: t.aspectRatio || void 0,
|
|
26
|
+
...((e = t.attributes) == null ? void 0 : e.style) || {}
|
|
27
|
+
}
|
|
23
28
|
},
|
|
24
|
-
|
|
29
|
+
r() && t.imgSrc || "default-key"
|
|
25
30
|
);
|
|
26
31
|
}
|
|
27
32
|
export {
|
|
28
|
-
|
|
33
|
+
u as default
|
|
29
34
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.22.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.22.1";exports.SDK_VERSION=e;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../helpers/flatten.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../helpers/flatten.cjs"),I=require("../../helpers/search/search.cjs"),O=require("../../types/api-version.cjs"),E=require("../get-builder-search-params/index.cjs"),F=require("../is-browser.cjs"),U=t=>typeof t=="number"&&!isNaN(t)&&t>=0,T=t=>{const{limit:i=30,userAttributes:s,query:m,model:w,apiKey:d,enrich:P,locale:S,apiVersion:c=O.DEFAULT_API_VERSION,fields:b,omit:l,offset:u,cacheSeconds:f,staleCacheSeconds:h,sort:g,includeUnpublished:p,apiHost:v}=t;if(!d)throw new Error("Missing API key");if(!["v3"].includes(c))throw new Error(`Invalid apiVersion: expected 'v3', received '${c}'`);const N=i!==1,k=v||"https://cdn.builder.io",e=new URL(`${k}/api/${c}/content/${w}`);e.searchParams.set("apiKey",d),e.searchParams.set("limit",String(i)),e.searchParams.set("noTraverse",String(N)),e.searchParams.set("includeRefs",String(!0)),S&&e.searchParams.set("locale",S);let a=s||{};if(P&&e.searchParams.set("enrich",String(P)),e.searchParams.set("omit",l!=null?l:"meta.componentsUsed"),b&&e.searchParams.set("fields",b),Number.isFinite(u)&&u>-1&&e.searchParams.set("offset",String(Math.floor(u))),typeof p=="boolean"&&e.searchParams.set("includeUnpublished",String(p)),f&&U(f)&&e.searchParams.set("cacheSeconds",String(f)),h&&U(h)&&e.searchParams.set("staleCacheSeconds",String(h)),g){const r=o.flatten({sort:g});for(const n in r)e.searchParams.set(n,JSON.stringify(r[n]))}const y={...E.getBuilderSearchParamsFromWindow(),...I.normalizeSearchParams(t.options||{})};a={...a,...$(y)};const A=o.flatten(y);for(const r in A)e.searchParams.set(r,String(A[r]));if(Object.keys(a).length>0&&e.searchParams.set("userAttributes",JSON.stringify(a)),m){const r=o.flattenMongoQuery({query:m});for(const n in r)e.searchParams.set(n,JSON.stringify(r[n]))}return e},V=t=>{const i={};for(const s in t)s.startsWith("userAttributes.")&&(i[s]=t[s],delete t[s]);return i},$=t=>{if(F.isBrowser()&&t.preview==="BUILDER_STUDIO"){t["userAttributes.urlPath"]=window.location.pathname,t["userAttributes.host"]=window.location.host;const i=V(t),{userAttributes:s}=o.unflatten(i);return s}return{}};exports.generateContentUrl=T;
|
|
@@ -1,62 +1,58 @@
|
|
|
1
|
-
import { flatten as
|
|
2
|
-
import { normalizeSearchParams as
|
|
3
|
-
import { DEFAULT_API_VERSION as
|
|
4
|
-
import { getBuilderSearchParamsFromWindow as
|
|
1
|
+
import { flatten as U, flattenMongoQuery as I, unflatten as E } from "../../helpers/flatten.mjs";
|
|
2
|
+
import { normalizeSearchParams as F } from "../../helpers/search/search.mjs";
|
|
3
|
+
import { DEFAULT_API_VERSION as O } from "../../types/api-version.mjs";
|
|
4
|
+
import { getBuilderSearchParamsFromWindow as J } from "../get-builder-search-params/index.mjs";
|
|
5
5
|
import { isBrowser as R } from "../is-browser.mjs";
|
|
6
|
-
const
|
|
6
|
+
const w = (t) => typeof t == "number" && !isNaN(t) && t >= 0, V = (t) => {
|
|
7
7
|
const {
|
|
8
8
|
limit: a = 30,
|
|
9
9
|
userAttributes: r,
|
|
10
10
|
query: u,
|
|
11
|
-
model:
|
|
12
|
-
apiKey:
|
|
13
|
-
enrich:
|
|
14
|
-
locale:
|
|
15
|
-
apiVersion: o =
|
|
11
|
+
model: y,
|
|
12
|
+
apiKey: h,
|
|
13
|
+
enrich: d,
|
|
14
|
+
locale: P,
|
|
15
|
+
apiVersion: o = O,
|
|
16
16
|
fields: S,
|
|
17
17
|
omit: c,
|
|
18
|
-
offset:
|
|
19
|
-
cacheSeconds:
|
|
20
|
-
staleCacheSeconds:
|
|
21
|
-
sort:
|
|
22
|
-
includeUnpublished:
|
|
23
|
-
apiHost:
|
|
18
|
+
offset: f,
|
|
19
|
+
cacheSeconds: m,
|
|
20
|
+
staleCacheSeconds: l,
|
|
21
|
+
sort: b,
|
|
22
|
+
includeUnpublished: p,
|
|
23
|
+
apiHost: N
|
|
24
24
|
} = t;
|
|
25
|
-
if (!
|
|
25
|
+
if (!h)
|
|
26
26
|
throw new Error("Missing API key");
|
|
27
27
|
if (!["v3"].includes(o))
|
|
28
28
|
throw new Error(`Invalid apiVersion: expected 'v3', received '${o}'`);
|
|
29
|
-
const
|
|
30
|
-
e.searchParams.set("apiKey",
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
...i
|
|
36
|
-
}), P && e.searchParams.set("enrich", String(P)), e.searchParams.set("omit", c != null ? c : "meta.componentsUsed"), S && e.searchParams.set("fields", S), Number.isFinite(l) && l > -1 && e.searchParams.set("offset", String(Math.floor(l))), typeof b == "boolean" && e.searchParams.set("includeUnpublished", String(b)), f && y(f) && e.searchParams.set("cacheSeconds", String(f)), m && y(m) && e.searchParams.set("staleCacheSeconds", String(m)), p) {
|
|
37
|
-
const s = w({
|
|
38
|
-
sort: p
|
|
29
|
+
const v = a !== 1, k = N || "https://cdn.builder.io", e = new URL(`${k}/api/${o}/content/${y}`);
|
|
30
|
+
e.searchParams.set("apiKey", h), e.searchParams.set("limit", String(a)), e.searchParams.set("noTraverse", String(v)), e.searchParams.set("includeRefs", String(!0)), P && e.searchParams.set("locale", P);
|
|
31
|
+
let n = r || {};
|
|
32
|
+
if (d && e.searchParams.set("enrich", String(d)), e.searchParams.set("omit", c != null ? c : "meta.componentsUsed"), S && e.searchParams.set("fields", S), Number.isFinite(f) && f > -1 && e.searchParams.set("offset", String(Math.floor(f))), typeof p == "boolean" && e.searchParams.set("includeUnpublished", String(p)), m && w(m) && e.searchParams.set("cacheSeconds", String(m)), l && w(l) && e.searchParams.set("staleCacheSeconds", String(l)), b) {
|
|
33
|
+
const s = U({
|
|
34
|
+
sort: b
|
|
39
35
|
});
|
|
40
|
-
for (const
|
|
41
|
-
e.searchParams.set(
|
|
36
|
+
for (const i in s)
|
|
37
|
+
e.searchParams.set(i, JSON.stringify(s[i]));
|
|
42
38
|
}
|
|
43
39
|
const g = {
|
|
44
|
-
...
|
|
45
|
-
...
|
|
40
|
+
...J(),
|
|
41
|
+
...F(t.options || {})
|
|
46
42
|
};
|
|
47
|
-
|
|
48
|
-
...
|
|
43
|
+
n = {
|
|
44
|
+
...n,
|
|
49
45
|
...$(g)
|
|
50
46
|
};
|
|
51
|
-
const
|
|
52
|
-
for (const s in
|
|
53
|
-
e.searchParams.set(s, String(
|
|
54
|
-
if (Object.keys(
|
|
55
|
-
const s =
|
|
47
|
+
const A = U(g);
|
|
48
|
+
for (const s in A)
|
|
49
|
+
e.searchParams.set(s, String(A[s]));
|
|
50
|
+
if (Object.keys(n).length > 0 && e.searchParams.set("userAttributes", JSON.stringify(n)), u) {
|
|
51
|
+
const s = I({
|
|
56
52
|
query: u
|
|
57
53
|
});
|
|
58
|
-
for (const
|
|
59
|
-
e.searchParams.set(
|
|
54
|
+
for (const i in s)
|
|
55
|
+
e.searchParams.set(i, JSON.stringify(s[i]));
|
|
60
56
|
}
|
|
61
57
|
return e;
|
|
62
58
|
}, T = (t) => {
|
|
@@ -69,11 +65,11 @@ const y = (t) => typeof t == "number" && !isNaN(t) && t >= 0, _ = (t) => {
|
|
|
69
65
|
t["userAttributes.urlPath"] = window.location.pathname, t["userAttributes.host"] = window.location.host;
|
|
70
66
|
const a = T(t), {
|
|
71
67
|
userAttributes: r
|
|
72
|
-
} =
|
|
68
|
+
} = E(a);
|
|
73
69
|
return r;
|
|
74
70
|
}
|
|
75
71
|
return {};
|
|
76
72
|
};
|
|
77
73
|
export {
|
|
78
|
-
|
|
74
|
+
V as generateContentUrl
|
|
79
75
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("../../constants/target.cjs"),g=require("../../helpers/ab-tests.cjs"),w=require("../../helpers/canTrack.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("../../constants/target.cjs"),g=require("../../helpers/ab-tests.cjs"),w=require("../../helpers/canTrack.cjs"),l=require("../../helpers/logger.cjs"),C=require("../../helpers/preview-lru-cache/get.cjs"),d=require("../../helpers/sdk-headers.cjs"),T=require("../get-fetch.cjs"),q=require("../is-browser.cjs"),u=require("./generate-content-url.cjs"),y=e=>"results"in e;async function k(e){var n;const t=e.locale||((n=e.userAttributes)==null?void 0:n.locale);t&&(e.locale=t,e.userAttributes={locale:t,...e.userAttributes});const r=await i({...e,limit:1});return r&&r[0]||null}const v=async e=>{var c,a;const t=u.generateContentUrl(e),r=(c=e.fetch)!=null?c:T.fetch,n={...e.fetchOptions,headers:{...(a=e.fetchOptions)==null?void 0:a.headers,...d.getSdkHeaders()}};return await(await r(t.href,n)).json()},o=async(e,t,r=u.generateContentUrl(e))=>{const n=w.getDefaultCanTrack(e.canTrack);if(r.search.includes("preview=")){const s=[];for(const c of t.results){const a=C.getPreviewContent(r.searchParams);s.push(a||c)}t.results=s}if(!n||!(q.isBrowser()||h.TARGET==="reactNative"))return t.results;try{const s=[];for(const c of t.results)s.push(await g.handleABTesting({item:c,canTrack:n}));t.results=s}catch(s){l.logger.error("Could not process A/B tests. ",s)}return t.results};async function i(e){const t=u.generateContentUrl(e),r=await v(e);if(!y(r))throw l.logger.error("Error fetching data. ",{url:t,content:r,options:e}),r;return o(e,r)}exports._processContentResult=o;exports.fetchEntries=i;exports.fetchOneEntry=k;
|
|
@@ -1,67 +1,73 @@
|
|
|
1
1
|
import { TARGET as u } from "../../constants/target.mjs";
|
|
2
|
-
import { handleABTesting as
|
|
2
|
+
import { handleABTesting as f } from "../../helpers/ab-tests.mjs";
|
|
3
3
|
import { getDefaultCanTrack as m } from "../../helpers/canTrack.mjs";
|
|
4
4
|
import { logger as i } from "../../helpers/logger.mjs";
|
|
5
5
|
import { getPreviewContent as h } from "../../helpers/preview-lru-cache/get.mjs";
|
|
6
6
|
import { getSdkHeaders as w } from "../../helpers/sdk-headers.mjs";
|
|
7
|
-
import { fetch as
|
|
8
|
-
import { isBrowser as
|
|
9
|
-
import { generateContentUrl as
|
|
10
|
-
const
|
|
11
|
-
async function
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
import { fetch as g } from "../get-fetch.mjs";
|
|
8
|
+
import { isBrowser as C } from "../is-browser.mjs";
|
|
9
|
+
import { generateContentUrl as o } from "./generate-content-url.mjs";
|
|
10
|
+
const d = (e) => "results" in e;
|
|
11
|
+
async function _(e) {
|
|
12
|
+
var n;
|
|
13
|
+
const t = e.locale || ((n = e.userAttributes) == null ? void 0 : n.locale);
|
|
14
|
+
t && (e.locale = t, e.userAttributes = {
|
|
15
|
+
locale: t,
|
|
16
|
+
...e.userAttributes
|
|
17
|
+
});
|
|
18
|
+
const r = await y({
|
|
19
|
+
...e,
|
|
14
20
|
limit: 1
|
|
15
21
|
});
|
|
16
|
-
return
|
|
22
|
+
return r && r[0] || null;
|
|
17
23
|
}
|
|
18
|
-
const
|
|
19
|
-
var
|
|
20
|
-
const
|
|
21
|
-
...
|
|
24
|
+
const p = async (e) => {
|
|
25
|
+
var c, a;
|
|
26
|
+
const t = o(e), r = (c = e.fetch) != null ? c : g, n = {
|
|
27
|
+
...e.fetchOptions,
|
|
22
28
|
headers: {
|
|
23
|
-
...(
|
|
29
|
+
...(a = e.fetchOptions) == null ? void 0 : a.headers,
|
|
24
30
|
...w()
|
|
25
31
|
}
|
|
26
32
|
};
|
|
27
|
-
return await (await r(
|
|
28
|
-
}, v = async (
|
|
29
|
-
const
|
|
33
|
+
return await (await r(t.href, n)).json();
|
|
34
|
+
}, v = async (e, t, r = o(e)) => {
|
|
35
|
+
const n = m(e.canTrack);
|
|
30
36
|
if (r.search.includes("preview=")) {
|
|
31
37
|
const s = [];
|
|
32
|
-
for (const
|
|
33
|
-
const
|
|
34
|
-
s.push(
|
|
38
|
+
for (const c of t.results) {
|
|
39
|
+
const a = h(r.searchParams);
|
|
40
|
+
s.push(a || c);
|
|
35
41
|
}
|
|
36
|
-
|
|
42
|
+
t.results = s;
|
|
37
43
|
}
|
|
38
|
-
if (!
|
|
39
|
-
return
|
|
44
|
+
if (!n || !(C() || u === "reactNative"))
|
|
45
|
+
return t.results;
|
|
40
46
|
try {
|
|
41
47
|
const s = [];
|
|
42
|
-
for (const
|
|
43
|
-
s.push(await
|
|
44
|
-
item:
|
|
45
|
-
canTrack:
|
|
48
|
+
for (const c of t.results)
|
|
49
|
+
s.push(await f({
|
|
50
|
+
item: c,
|
|
51
|
+
canTrack: n
|
|
46
52
|
}));
|
|
47
|
-
|
|
53
|
+
t.results = s;
|
|
48
54
|
} catch (s) {
|
|
49
55
|
i.error("Could not process A/B tests. ", s);
|
|
50
56
|
}
|
|
51
|
-
return
|
|
57
|
+
return t.results;
|
|
52
58
|
};
|
|
53
|
-
async function y(
|
|
54
|
-
const
|
|
55
|
-
if (!
|
|
59
|
+
async function y(e) {
|
|
60
|
+
const t = o(e), r = await p(e);
|
|
61
|
+
if (!d(r))
|
|
56
62
|
throw i.error("Error fetching data. ", {
|
|
57
|
-
url:
|
|
63
|
+
url: t,
|
|
58
64
|
content: r,
|
|
59
|
-
options:
|
|
65
|
+
options: e
|
|
60
66
|
}), r;
|
|
61
|
-
return v(
|
|
67
|
+
return v(e, r);
|
|
62
68
|
}
|
|
63
69
|
export {
|
|
64
70
|
v as _processContentResult,
|
|
65
71
|
y as fetchEntries,
|
|
66
|
-
|
|
72
|
+
_ as fetchOneEntry
|
|
67
73
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../constants/file-types.cjs"),t={name:"Raw:Img",hideFromInsertMenu:!0,image:"https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4",inputs:[{name:"image",bubble:!0,type:"file",allowedFileTypes:e.IMAGE_FILE_TYPES,required:!0}],
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../constants/file-types.cjs"),t={name:"Raw:Img",hideFromInsertMenu:!0,image:"https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4",inputs:[{name:"image",bubble:!0,type:"file",allowedFileTypes:e.IMAGE_FILE_TYPES,required:!0},{name:"backgroundSize",type:"text",defaultValue:"cover",enum:[{label:"contain",value:"contain",helperText:"The image should never get cropped"},{label:"cover",value:"cover",helperText:"The image should fill it's box, cropping when needed"}]},{name:"backgroundPosition",type:"text",defaultValue:"center",enum:["center","top","left","right","bottom","top left","top right","bottom left","bottom right"]},{name:"altText",type:"string",helperText:"Text to display when the user has images off"},{name:"title",type:"string",helperText:"Text to display when hovering over the asset"},{name:"aspectRatio",type:"number",helperText:"This is the ratio of height/width, e.g. set to 1.5 for a 300px wide and 200px tall photo. Set to 0 to not force the image to maintain it's aspect ratio",advanced:!0,defaultValue:.7041}],noWrap:!0};exports.componentInfo=t;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { IMAGE_FILE_TYPES as e } from "../../constants/file-types.mjs";
|
|
2
2
|
const o = {
|
|
3
|
-
// friendlyName?
|
|
4
3
|
name: "Raw:Img",
|
|
5
4
|
hideFromInsertMenu: !0,
|
|
6
5
|
image: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4",
|
|
@@ -10,9 +9,40 @@ const o = {
|
|
|
10
9
|
type: "file",
|
|
11
10
|
allowedFileTypes: e,
|
|
12
11
|
required: !0
|
|
12
|
+
}, {
|
|
13
|
+
name: "backgroundSize",
|
|
14
|
+
type: "text",
|
|
15
|
+
defaultValue: "cover",
|
|
16
|
+
enum: [{
|
|
17
|
+
label: "contain",
|
|
18
|
+
value: "contain",
|
|
19
|
+
helperText: "The image should never get cropped"
|
|
20
|
+
}, {
|
|
21
|
+
label: "cover",
|
|
22
|
+
value: "cover",
|
|
23
|
+
helperText: "The image should fill it's box, cropping when needed"
|
|
24
|
+
}]
|
|
25
|
+
}, {
|
|
26
|
+
name: "backgroundPosition",
|
|
27
|
+
type: "text",
|
|
28
|
+
defaultValue: "center",
|
|
29
|
+
enum: ["center", "top", "left", "right", "bottom", "top left", "top right", "bottom left", "bottom right"]
|
|
30
|
+
}, {
|
|
31
|
+
name: "altText",
|
|
32
|
+
type: "string",
|
|
33
|
+
helperText: "Text to display when the user has images off"
|
|
34
|
+
}, {
|
|
35
|
+
name: "title",
|
|
36
|
+
type: "string",
|
|
37
|
+
helperText: "Text to display when hovering over the asset"
|
|
38
|
+
}, {
|
|
39
|
+
name: "aspectRatio",
|
|
40
|
+
type: "number",
|
|
41
|
+
helperText: "This is the ratio of height/width, e.g. set to 1.5 for a 300px wide and 200px tall photo. Set to 0 to not force the image to maintain it's aspect ratio",
|
|
42
|
+
advanced: !0,
|
|
43
|
+
defaultValue: 0.7041
|
|
13
44
|
}],
|
|
14
|
-
noWrap: !0
|
|
15
|
-
static: !0
|
|
45
|
+
noWrap: !0
|
|
16
46
|
};
|
|
17
47
|
export {
|
|
18
48
|
o as componentInfo
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";const
|
|
1
|
+
"use client";"use strict";const s=require("react/jsx-runtime"),c=require("../../functions/is-editing.cjs"),a=require("../../functions/get-class-prop-name.cjs");function r(t){var e;function n(){const i={...t.attributes,[a.getClassPropName()]:`builder-raw-img ${t.attributes[a.getClassPropName()]||""}`};return delete i.style,i}return s.jsx("img",{loading:"lazy",alt:t.altText,title:t.title,src:t.imgSrc||t.image,...n(),style:{objectFit:t.backgroundSize||"cover",objectPosition:t.backgroundPosition||"center",aspectRatio:t.aspectRatio||void 0,...((e=t.attributes)==null?void 0:e.style)||{}}},c.isEditing()&&t.imgSrc||"default-key")}module.exports=r;
|
|
@@ -1,29 +1,34 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { isEditing as
|
|
4
|
-
import {
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
3
|
+
import { isEditing as r } from "../../functions/is-editing.mjs";
|
|
4
|
+
import { getClassPropName as a } from "../../functions/get-class-prop-name.mjs";
|
|
5
|
+
function u(t) {
|
|
6
|
+
var e;
|
|
7
|
+
function n() {
|
|
8
|
+
const i = {
|
|
9
|
+
...t.attributes,
|
|
10
|
+
[a()]: `builder-raw-img ${t.attributes[a()] || ""}`
|
|
11
|
+
};
|
|
12
|
+
return delete i.style, i;
|
|
10
13
|
}
|
|
11
|
-
return /* @__PURE__ */
|
|
14
|
+
return /* @__PURE__ */ o(
|
|
12
15
|
"img",
|
|
13
16
|
{
|
|
14
17
|
loading: "lazy",
|
|
15
|
-
style: {
|
|
16
|
-
objectFit: t.backgroundSize || "cover",
|
|
17
|
-
objectPosition: t.backgroundPosition || "center"
|
|
18
|
-
},
|
|
19
18
|
alt: t.altText,
|
|
19
|
+
title: t.title,
|
|
20
20
|
src: t.imgSrc || t.image,
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
...n(),
|
|
22
|
+
style: {
|
|
23
|
+
objectFit: t.backgroundSize || "cover",
|
|
24
|
+
objectPosition: t.backgroundPosition || "center",
|
|
25
|
+
aspectRatio: t.aspectRatio || void 0,
|
|
26
|
+
...((e = t.attributes) == null ? void 0 : e.style) || {}
|
|
27
|
+
}
|
|
23
28
|
},
|
|
24
|
-
|
|
29
|
+
r() && t.imgSrc || "default-key"
|
|
25
30
|
);
|
|
26
31
|
}
|
|
27
32
|
export {
|
|
28
|
-
|
|
33
|
+
u as default
|
|
29
34
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.22.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.22.1";exports.SDK_VERSION=e;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../helpers/flatten.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../helpers/flatten.cjs"),I=require("../../helpers/search/search.cjs"),O=require("../../types/api-version.cjs"),E=require("../get-builder-search-params/index.cjs"),F=require("../is-browser.cjs"),U=t=>typeof t=="number"&&!isNaN(t)&&t>=0,T=t=>{const{limit:i=30,userAttributes:s,query:m,model:w,apiKey:d,enrich:P,locale:S,apiVersion:c=O.DEFAULT_API_VERSION,fields:b,omit:l,offset:u,cacheSeconds:f,staleCacheSeconds:h,sort:g,includeUnpublished:p,apiHost:v}=t;if(!d)throw new Error("Missing API key");if(!["v3"].includes(c))throw new Error(`Invalid apiVersion: expected 'v3', received '${c}'`);const N=i!==1,k=v||"https://cdn.builder.io",e=new URL(`${k}/api/${c}/content/${w}`);e.searchParams.set("apiKey",d),e.searchParams.set("limit",String(i)),e.searchParams.set("noTraverse",String(N)),e.searchParams.set("includeRefs",String(!0)),S&&e.searchParams.set("locale",S);let a=s||{};if(P&&e.searchParams.set("enrich",String(P)),e.searchParams.set("omit",l!=null?l:"meta.componentsUsed"),b&&e.searchParams.set("fields",b),Number.isFinite(u)&&u>-1&&e.searchParams.set("offset",String(Math.floor(u))),typeof p=="boolean"&&e.searchParams.set("includeUnpublished",String(p)),f&&U(f)&&e.searchParams.set("cacheSeconds",String(f)),h&&U(h)&&e.searchParams.set("staleCacheSeconds",String(h)),g){const r=o.flatten({sort:g});for(const n in r)e.searchParams.set(n,JSON.stringify(r[n]))}const y={...E.getBuilderSearchParamsFromWindow(),...I.normalizeSearchParams(t.options||{})};a={...a,...$(y)};const A=o.flatten(y);for(const r in A)e.searchParams.set(r,String(A[r]));if(Object.keys(a).length>0&&e.searchParams.set("userAttributes",JSON.stringify(a)),m){const r=o.flattenMongoQuery({query:m});for(const n in r)e.searchParams.set(n,JSON.stringify(r[n]))}return e},V=t=>{const i={};for(const s in t)s.startsWith("userAttributes.")&&(i[s]=t[s],delete t[s]);return i},$=t=>{if(F.isBrowser()&&t.preview==="BUILDER_STUDIO"){t["userAttributes.urlPath"]=window.location.pathname,t["userAttributes.host"]=window.location.host;const i=V(t),{userAttributes:s}=o.unflatten(i);return s}return{}};exports.generateContentUrl=T;
|
|
@@ -1,62 +1,58 @@
|
|
|
1
|
-
import { flatten as
|
|
2
|
-
import { normalizeSearchParams as
|
|
3
|
-
import { DEFAULT_API_VERSION as
|
|
4
|
-
import { getBuilderSearchParamsFromWindow as
|
|
1
|
+
import { flatten as U, flattenMongoQuery as I, unflatten as E } from "../../helpers/flatten.mjs";
|
|
2
|
+
import { normalizeSearchParams as F } from "../../helpers/search/search.mjs";
|
|
3
|
+
import { DEFAULT_API_VERSION as O } from "../../types/api-version.mjs";
|
|
4
|
+
import { getBuilderSearchParamsFromWindow as J } from "../get-builder-search-params/index.mjs";
|
|
5
5
|
import { isBrowser as R } from "../is-browser.mjs";
|
|
6
|
-
const
|
|
6
|
+
const w = (t) => typeof t == "number" && !isNaN(t) && t >= 0, V = (t) => {
|
|
7
7
|
const {
|
|
8
8
|
limit: a = 30,
|
|
9
9
|
userAttributes: r,
|
|
10
10
|
query: u,
|
|
11
|
-
model:
|
|
12
|
-
apiKey:
|
|
13
|
-
enrich:
|
|
14
|
-
locale:
|
|
15
|
-
apiVersion: o =
|
|
11
|
+
model: y,
|
|
12
|
+
apiKey: h,
|
|
13
|
+
enrich: d,
|
|
14
|
+
locale: P,
|
|
15
|
+
apiVersion: o = O,
|
|
16
16
|
fields: S,
|
|
17
17
|
omit: c,
|
|
18
|
-
offset:
|
|
19
|
-
cacheSeconds:
|
|
20
|
-
staleCacheSeconds:
|
|
21
|
-
sort:
|
|
22
|
-
includeUnpublished:
|
|
23
|
-
apiHost:
|
|
18
|
+
offset: f,
|
|
19
|
+
cacheSeconds: m,
|
|
20
|
+
staleCacheSeconds: l,
|
|
21
|
+
sort: b,
|
|
22
|
+
includeUnpublished: p,
|
|
23
|
+
apiHost: N
|
|
24
24
|
} = t;
|
|
25
|
-
if (!
|
|
25
|
+
if (!h)
|
|
26
26
|
throw new Error("Missing API key");
|
|
27
27
|
if (!["v3"].includes(o))
|
|
28
28
|
throw new Error(`Invalid apiVersion: expected 'v3', received '${o}'`);
|
|
29
|
-
const
|
|
30
|
-
e.searchParams.set("apiKey",
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
...i
|
|
36
|
-
}), P && e.searchParams.set("enrich", String(P)), e.searchParams.set("omit", c != null ? c : "meta.componentsUsed"), S && e.searchParams.set("fields", S), Number.isFinite(l) && l > -1 && e.searchParams.set("offset", String(Math.floor(l))), typeof b == "boolean" && e.searchParams.set("includeUnpublished", String(b)), f && y(f) && e.searchParams.set("cacheSeconds", String(f)), m && y(m) && e.searchParams.set("staleCacheSeconds", String(m)), p) {
|
|
37
|
-
const s = w({
|
|
38
|
-
sort: p
|
|
29
|
+
const v = a !== 1, k = N || "https://cdn.builder.io", e = new URL(`${k}/api/${o}/content/${y}`);
|
|
30
|
+
e.searchParams.set("apiKey", h), e.searchParams.set("limit", String(a)), e.searchParams.set("noTraverse", String(v)), e.searchParams.set("includeRefs", String(!0)), P && e.searchParams.set("locale", P);
|
|
31
|
+
let n = r || {};
|
|
32
|
+
if (d && e.searchParams.set("enrich", String(d)), e.searchParams.set("omit", c != null ? c : "meta.componentsUsed"), S && e.searchParams.set("fields", S), Number.isFinite(f) && f > -1 && e.searchParams.set("offset", String(Math.floor(f))), typeof p == "boolean" && e.searchParams.set("includeUnpublished", String(p)), m && w(m) && e.searchParams.set("cacheSeconds", String(m)), l && w(l) && e.searchParams.set("staleCacheSeconds", String(l)), b) {
|
|
33
|
+
const s = U({
|
|
34
|
+
sort: b
|
|
39
35
|
});
|
|
40
|
-
for (const
|
|
41
|
-
e.searchParams.set(
|
|
36
|
+
for (const i in s)
|
|
37
|
+
e.searchParams.set(i, JSON.stringify(s[i]));
|
|
42
38
|
}
|
|
43
39
|
const g = {
|
|
44
|
-
...
|
|
45
|
-
...
|
|
40
|
+
...J(),
|
|
41
|
+
...F(t.options || {})
|
|
46
42
|
};
|
|
47
|
-
|
|
48
|
-
...
|
|
43
|
+
n = {
|
|
44
|
+
...n,
|
|
49
45
|
...$(g)
|
|
50
46
|
};
|
|
51
|
-
const
|
|
52
|
-
for (const s in
|
|
53
|
-
e.searchParams.set(s, String(
|
|
54
|
-
if (Object.keys(
|
|
55
|
-
const s =
|
|
47
|
+
const A = U(g);
|
|
48
|
+
for (const s in A)
|
|
49
|
+
e.searchParams.set(s, String(A[s]));
|
|
50
|
+
if (Object.keys(n).length > 0 && e.searchParams.set("userAttributes", JSON.stringify(n)), u) {
|
|
51
|
+
const s = I({
|
|
56
52
|
query: u
|
|
57
53
|
});
|
|
58
|
-
for (const
|
|
59
|
-
e.searchParams.set(
|
|
54
|
+
for (const i in s)
|
|
55
|
+
e.searchParams.set(i, JSON.stringify(s[i]));
|
|
60
56
|
}
|
|
61
57
|
return e;
|
|
62
58
|
}, T = (t) => {
|
|
@@ -69,11 +65,11 @@ const y = (t) => typeof t == "number" && !isNaN(t) && t >= 0, _ = (t) => {
|
|
|
69
65
|
t["userAttributes.urlPath"] = window.location.pathname, t["userAttributes.host"] = window.location.host;
|
|
70
66
|
const a = T(t), {
|
|
71
67
|
userAttributes: r
|
|
72
|
-
} =
|
|
68
|
+
} = E(a);
|
|
73
69
|
return r;
|
|
74
70
|
}
|
|
75
71
|
return {};
|
|
76
72
|
};
|
|
77
73
|
export {
|
|
78
|
-
|
|
74
|
+
V as generateContentUrl
|
|
79
75
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("../../constants/target.cjs"),g=require("../../helpers/ab-tests.cjs"),w=require("../../helpers/canTrack.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("../../constants/target.cjs"),g=require("../../helpers/ab-tests.cjs"),w=require("../../helpers/canTrack.cjs"),l=require("../../helpers/logger.cjs"),C=require("../../helpers/preview-lru-cache/get.cjs"),d=require("../../helpers/sdk-headers.cjs"),T=require("../get-fetch.cjs"),q=require("../is-browser.cjs"),u=require("./generate-content-url.cjs"),y=e=>"results"in e;async function k(e){var n;const t=e.locale||((n=e.userAttributes)==null?void 0:n.locale);t&&(e.locale=t,e.userAttributes={locale:t,...e.userAttributes});const r=await i({...e,limit:1});return r&&r[0]||null}const v=async e=>{var c,a;const t=u.generateContentUrl(e),r=(c=e.fetch)!=null?c:T.fetch,n={...e.fetchOptions,headers:{...(a=e.fetchOptions)==null?void 0:a.headers,...d.getSdkHeaders()}};return await(await r(t.href,n)).json()},o=async(e,t,r=u.generateContentUrl(e))=>{const n=w.getDefaultCanTrack(e.canTrack);if(r.search.includes("preview=")){const s=[];for(const c of t.results){const a=C.getPreviewContent(r.searchParams);s.push(a||c)}t.results=s}if(!n||!(q.isBrowser()||h.TARGET==="reactNative"))return t.results;try{const s=[];for(const c of t.results)s.push(await g.handleABTesting({item:c,canTrack:n}));t.results=s}catch(s){l.logger.error("Could not process A/B tests. ",s)}return t.results};async function i(e){const t=u.generateContentUrl(e),r=await v(e);if(!y(r))throw l.logger.error("Error fetching data. ",{url:t,content:r,options:e}),r;return o(e,r)}exports._processContentResult=o;exports.fetchEntries=i;exports.fetchOneEntry=k;
|
|
@@ -1,67 +1,73 @@
|
|
|
1
1
|
import { TARGET as u } from "../../constants/target.mjs";
|
|
2
|
-
import { handleABTesting as
|
|
2
|
+
import { handleABTesting as f } from "../../helpers/ab-tests.mjs";
|
|
3
3
|
import { getDefaultCanTrack as m } from "../../helpers/canTrack.mjs";
|
|
4
4
|
import { logger as i } from "../../helpers/logger.mjs";
|
|
5
5
|
import { getPreviewContent as h } from "../../helpers/preview-lru-cache/get.mjs";
|
|
6
6
|
import { getSdkHeaders as w } from "../../helpers/sdk-headers.mjs";
|
|
7
|
-
import { fetch as
|
|
8
|
-
import { isBrowser as
|
|
9
|
-
import { generateContentUrl as
|
|
10
|
-
const
|
|
11
|
-
async function
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
import { fetch as g } from "../get-fetch.mjs";
|
|
8
|
+
import { isBrowser as C } from "../is-browser.mjs";
|
|
9
|
+
import { generateContentUrl as o } from "./generate-content-url.mjs";
|
|
10
|
+
const d = (e) => "results" in e;
|
|
11
|
+
async function _(e) {
|
|
12
|
+
var n;
|
|
13
|
+
const t = e.locale || ((n = e.userAttributes) == null ? void 0 : n.locale);
|
|
14
|
+
t && (e.locale = t, e.userAttributes = {
|
|
15
|
+
locale: t,
|
|
16
|
+
...e.userAttributes
|
|
17
|
+
});
|
|
18
|
+
const r = await y({
|
|
19
|
+
...e,
|
|
14
20
|
limit: 1
|
|
15
21
|
});
|
|
16
|
-
return
|
|
22
|
+
return r && r[0] || null;
|
|
17
23
|
}
|
|
18
|
-
const
|
|
19
|
-
var
|
|
20
|
-
const
|
|
21
|
-
...
|
|
24
|
+
const p = async (e) => {
|
|
25
|
+
var c, a;
|
|
26
|
+
const t = o(e), r = (c = e.fetch) != null ? c : g, n = {
|
|
27
|
+
...e.fetchOptions,
|
|
22
28
|
headers: {
|
|
23
|
-
...(
|
|
29
|
+
...(a = e.fetchOptions) == null ? void 0 : a.headers,
|
|
24
30
|
...w()
|
|
25
31
|
}
|
|
26
32
|
};
|
|
27
|
-
return await (await r(
|
|
28
|
-
}, v = async (
|
|
29
|
-
const
|
|
33
|
+
return await (await r(t.href, n)).json();
|
|
34
|
+
}, v = async (e, t, r = o(e)) => {
|
|
35
|
+
const n = m(e.canTrack);
|
|
30
36
|
if (r.search.includes("preview=")) {
|
|
31
37
|
const s = [];
|
|
32
|
-
for (const
|
|
33
|
-
const
|
|
34
|
-
s.push(
|
|
38
|
+
for (const c of t.results) {
|
|
39
|
+
const a = h(r.searchParams);
|
|
40
|
+
s.push(a || c);
|
|
35
41
|
}
|
|
36
|
-
|
|
42
|
+
t.results = s;
|
|
37
43
|
}
|
|
38
|
-
if (!
|
|
39
|
-
return
|
|
44
|
+
if (!n || !(C() || u === "reactNative"))
|
|
45
|
+
return t.results;
|
|
40
46
|
try {
|
|
41
47
|
const s = [];
|
|
42
|
-
for (const
|
|
43
|
-
s.push(await
|
|
44
|
-
item:
|
|
45
|
-
canTrack:
|
|
48
|
+
for (const c of t.results)
|
|
49
|
+
s.push(await f({
|
|
50
|
+
item: c,
|
|
51
|
+
canTrack: n
|
|
46
52
|
}));
|
|
47
|
-
|
|
53
|
+
t.results = s;
|
|
48
54
|
} catch (s) {
|
|
49
55
|
i.error("Could not process A/B tests. ", s);
|
|
50
56
|
}
|
|
51
|
-
return
|
|
57
|
+
return t.results;
|
|
52
58
|
};
|
|
53
|
-
async function y(
|
|
54
|
-
const
|
|
55
|
-
if (!
|
|
59
|
+
async function y(e) {
|
|
60
|
+
const t = o(e), r = await p(e);
|
|
61
|
+
if (!d(r))
|
|
56
62
|
throw i.error("Error fetching data. ", {
|
|
57
|
-
url:
|
|
63
|
+
url: t,
|
|
58
64
|
content: r,
|
|
59
|
-
options:
|
|
65
|
+
options: e
|
|
60
66
|
}), r;
|
|
61
|
-
return v(
|
|
67
|
+
return v(e, r);
|
|
62
68
|
}
|
|
63
69
|
export {
|
|
64
70
|
v as _processContentResult,
|
|
65
71
|
y as fetchEntries,
|
|
66
|
-
|
|
72
|
+
_ as fetchOneEntry
|
|
67
73
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@builder.io/sdk-react-nextjs",
|
|
3
3
|
"description": "Builder.io RSC SDK for NextJS App Directory",
|
|
4
|
-
"version": "0.22.
|
|
4
|
+
"version": "0.22.1",
|
|
5
5
|
"homepage": "https://github.com/BuilderIO/builder/tree/main/packages/sdks/output/nextjs",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -9,6 +9,8 @@ export interface ImgProps {
|
|
|
9
9
|
altText?: string;
|
|
10
10
|
backgroundSize?: "cover" | "contain";
|
|
11
11
|
backgroundPosition?: "center" | "top" | "left" | "right" | "bottom" | "top left" | "top right" | "bottom left" | "bottom right";
|
|
12
|
+
aspectRatio?: number;
|
|
13
|
+
title?: string;
|
|
12
14
|
}
|
|
13
15
|
declare function ImgComponent(props: ImgProps): React.JSX.Element;
|
|
14
16
|
export default ImgComponent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.22.
|
|
1
|
+
export declare const SDK_VERSION = "0.22.1";
|
|
@@ -9,6 +9,8 @@ export interface ImgProps {
|
|
|
9
9
|
altText?: string;
|
|
10
10
|
backgroundSize?: "cover" | "contain";
|
|
11
11
|
backgroundPosition?: "center" | "top" | "left" | "right" | "bottom" | "top left" | "top right" | "bottom left" | "bottom right";
|
|
12
|
+
aspectRatio?: number;
|
|
13
|
+
title?: string;
|
|
12
14
|
}
|
|
13
15
|
declare function ImgComponent(props: ImgProps): React.JSX.Element;
|
|
14
16
|
export default ImgComponent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.22.
|
|
1
|
+
export declare const SDK_VERSION = "0.22.1";
|