@plasmicpkgs/plasmic-contentful 0.0.125 → 0.0.127
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.js +7 -4
- package/dist/index.mjs +7 -4
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -270,8 +270,11 @@ function ContentfulFetcher({
|
|
|
270
270
|
const { data: filteredData } = (0, import_query.usePlasmicQueryData)(
|
|
271
271
|
contentType && filterField && filterValue ? `${cacheKey}/${contentType}/filteredData` : null,
|
|
272
272
|
async () => {
|
|
273
|
-
|
|
274
|
-
|
|
273
|
+
let query = `/spaces/${creds.space}/environments/${creds.environment}/entries?access_token=${creds.accessToken}&content_type=${contentType}&fields.${filterField}${searchParameter}=${filterValue}`;
|
|
274
|
+
if (include) {
|
|
275
|
+
query = `${query}&include=${include}`;
|
|
276
|
+
}
|
|
277
|
+
const resp = await fetch(`${baseUrl}${query}`);
|
|
275
278
|
return resp.json();
|
|
276
279
|
}
|
|
277
280
|
);
|
|
@@ -464,7 +467,7 @@ function ContentfulField({
|
|
|
464
467
|
objectPath,
|
|
465
468
|
setControlContextData
|
|
466
469
|
}) {
|
|
467
|
-
var _a;
|
|
470
|
+
var _a, _b;
|
|
468
471
|
const item = (_a = (0, import_host.useSelector)("contentfulItem")) == null ? void 0 : _a.fields;
|
|
469
472
|
if (!item) {
|
|
470
473
|
return /* @__PURE__ */ import_react.default.createElement("div", null, "ContentfulField must be used within a ContentfulFetcher ");
|
|
@@ -484,7 +487,7 @@ function ContentfulField({
|
|
|
484
487
|
dangerouslySetInnerHTML: { __html: (0, import_rich_text_html_renderer.documentToHtmlString)(data) }
|
|
485
488
|
}
|
|
486
489
|
);
|
|
487
|
-
} else if (typeof data === "object" && data.sys.linkType === "Asset" && data.url) {
|
|
490
|
+
} else if (typeof data === "object" && ((_b = data.sys) == null ? void 0 : _b.linkType) === "Asset" && data.url) {
|
|
488
491
|
return /* @__PURE__ */ import_react.default.createElement("img", { className, src: data.url });
|
|
489
492
|
} else if (!data) {
|
|
490
493
|
return /* @__PURE__ */ import_react.default.createElement("div", null, "Please specify a valid field.");
|
package/dist/index.mjs
CHANGED
|
@@ -233,8 +233,11 @@ function ContentfulFetcher({
|
|
|
233
233
|
const { data: filteredData } = usePlasmicQueryData(
|
|
234
234
|
contentType && filterField && filterValue ? `${cacheKey}/${contentType}/filteredData` : null,
|
|
235
235
|
async () => {
|
|
236
|
-
|
|
237
|
-
|
|
236
|
+
let query = `/spaces/${creds.space}/environments/${creds.environment}/entries?access_token=${creds.accessToken}&content_type=${contentType}&fields.${filterField}${searchParameter}=${filterValue}`;
|
|
237
|
+
if (include) {
|
|
238
|
+
query = `${query}&include=${include}`;
|
|
239
|
+
}
|
|
240
|
+
const resp = await fetch(`${baseUrl}${query}`);
|
|
238
241
|
return resp.json();
|
|
239
242
|
}
|
|
240
243
|
);
|
|
@@ -427,7 +430,7 @@ function ContentfulField({
|
|
|
427
430
|
objectPath,
|
|
428
431
|
setControlContextData
|
|
429
432
|
}) {
|
|
430
|
-
var _a;
|
|
433
|
+
var _a, _b;
|
|
431
434
|
const item = (_a = useSelector("contentfulItem")) == null ? void 0 : _a.fields;
|
|
432
435
|
if (!item) {
|
|
433
436
|
return /* @__PURE__ */ React.createElement("div", null, "ContentfulField must be used within a ContentfulFetcher ");
|
|
@@ -447,7 +450,7 @@ function ContentfulField({
|
|
|
447
450
|
dangerouslySetInnerHTML: { __html: documentToHtmlString(data) }
|
|
448
451
|
}
|
|
449
452
|
);
|
|
450
|
-
} else if (typeof data === "object" && data.sys.linkType === "Asset" && data.url) {
|
|
453
|
+
} else if (typeof data === "object" && ((_b = data.sys) == null ? void 0 : _b.linkType) === "Asset" && data.url) {
|
|
451
454
|
return /* @__PURE__ */ React.createElement("img", { className, src: data.url });
|
|
452
455
|
} else if (!data) {
|
|
453
456
|
return /* @__PURE__ */ React.createElement("div", null, "Please specify a valid field.");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plasmicpkgs/plasmic-contentful",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.127",
|
|
4
4
|
"description": "Plasmic Contentful components.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
}
|
|
33
33
|
],
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@plasmicapp/host": "1.0.
|
|
35
|
+
"@plasmicapp/host": "1.0.186",
|
|
36
36
|
"@plasmicapp/query": "0.1.77",
|
|
37
37
|
"@size-limit/preset-small-lib": "^7.0.8",
|
|
38
38
|
"@types/dlv": "^1.1.2",
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"change-case": "^4.1.2",
|
|
53
53
|
"dlv": "^1.1.3"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "c8e66753e8f375487f4dc60f29897496fe889e51"
|
|
56
56
|
}
|