@se-studio/contentful-rest-api 1.0.39 → 1.0.41
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 +4 -0
- package/dist/index.js +21 -4
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -233,8 +233,12 @@ interface BaseExternalComponentFields {
|
|
|
233
233
|
externalComponentType: EntryFieldTypes.Symbol<string>;
|
|
234
234
|
heading?: EntryFieldTypes.Symbol;
|
|
235
235
|
data: EntryFieldTypes.Object;
|
|
236
|
+
html: EntryFieldTypes.Text;
|
|
236
237
|
backgroundColour?: EntryFieldTypes.Symbol<string>;
|
|
237
238
|
textColour?: EntryFieldTypes.Symbol<string>;
|
|
239
|
+
backgroundVisual?: EntryFieldTypes.AssetLink;
|
|
240
|
+
mobileBackgroundVisual?: EntryFieldTypes.AssetLink;
|
|
241
|
+
backgroundOverlayOpacity?: EntryFieldTypes.Number;
|
|
238
242
|
}
|
|
239
243
|
type BaseExternalComponentSkeleton = EntrySkeletonType<BaseExternalComponentFields, 'externalComponent'>;
|
|
240
244
|
|
package/dist/index.js
CHANGED
|
@@ -635,6 +635,9 @@ function addPositionMetadata(items) {
|
|
|
635
635
|
};
|
|
636
636
|
});
|
|
637
637
|
}
|
|
638
|
+
function calculateContentCount(...contents) {
|
|
639
|
+
return contents.reduce((acc, content) => acc + content.length, 0);
|
|
640
|
+
}
|
|
638
641
|
|
|
639
642
|
// src/converters/asset.ts
|
|
640
643
|
function convertAssetToVisual(context, asset, options) {
|
|
@@ -1983,6 +1986,7 @@ function baseArticleConverter(context, entry) {
|
|
|
1983
1986
|
title: articleTitle,
|
|
1984
1987
|
description: makeContentfulDescription(description, sys.id),
|
|
1985
1988
|
featuredImage: lookupAsset(context, featuredImage),
|
|
1989
|
+
contentCount: calculateContentCount(topContent, articleContent, bottomContent),
|
|
1986
1990
|
articleType: articleTypeLink,
|
|
1987
1991
|
tags: tags?.map((tag) => resolveLink(context, id, tag)),
|
|
1988
1992
|
contents,
|
|
@@ -2090,6 +2094,7 @@ function baseArticleTypeConverter(context, entry, customTypeEntry) {
|
|
|
2090
2094
|
title: makeContentfulTitle(indexPageTitle, sys.id),
|
|
2091
2095
|
description: makeContentfulDescription(indexPageDescription, sys.id),
|
|
2092
2096
|
featuredImage: lookupAsset(context, featuredImage),
|
|
2097
|
+
contentCount: 0,
|
|
2093
2098
|
contents,
|
|
2094
2099
|
icons,
|
|
2095
2100
|
structuredData: [
|
|
@@ -2250,6 +2255,7 @@ function baseCustomTypeConverter(context, entry) {
|
|
|
2250
2255
|
title,
|
|
2251
2256
|
description,
|
|
2252
2257
|
featuredImage: lookupAsset(context, featuredImage),
|
|
2258
|
+
contentCount: 0,
|
|
2253
2259
|
contents,
|
|
2254
2260
|
icons,
|
|
2255
2261
|
structuredData: [
|
|
@@ -2289,9 +2295,18 @@ function baseCustomTypeLinkConverter(context, entry) {
|
|
|
2289
2295
|
}
|
|
2290
2296
|
|
|
2291
2297
|
// src/converters/externalComponent.ts
|
|
2292
|
-
function baseExternalComponentConverter(
|
|
2298
|
+
function baseExternalComponentConverter(context, entry) {
|
|
2293
2299
|
const { sys, fields } = entry;
|
|
2294
|
-
const {
|
|
2300
|
+
const {
|
|
2301
|
+
cmsLabel,
|
|
2302
|
+
backgroundVisual: bgVisual,
|
|
2303
|
+
mobileBackgroundVisual: mobileBgVisual,
|
|
2304
|
+
...simpleFields
|
|
2305
|
+
} = fields;
|
|
2306
|
+
const backgroundVisual = createResponsiveVisual(
|
|
2307
|
+
lookupAsset(context, bgVisual),
|
|
2308
|
+
lookupAsset(context, mobileBgVisual)
|
|
2309
|
+
);
|
|
2295
2310
|
const externalComponent = {
|
|
2296
2311
|
type: "External component",
|
|
2297
2312
|
id: sys.id,
|
|
@@ -2299,8 +2314,7 @@ function baseExternalComponentConverter(_context, entry) {
|
|
|
2299
2314
|
cmsLabel,
|
|
2300
2315
|
...DEFAULT_POSITION_FIELDS,
|
|
2301
2316
|
...simpleFields,
|
|
2302
|
-
|
|
2303
|
-
backgroundVisual: void 0
|
|
2317
|
+
backgroundVisual
|
|
2304
2318
|
};
|
|
2305
2319
|
return externalComponent;
|
|
2306
2320
|
}
|
|
@@ -2441,6 +2455,7 @@ function basePageConverter(context, entry) {
|
|
|
2441
2455
|
description: makeContentfulDescription(description, id),
|
|
2442
2456
|
featuredImage: lookupAsset(context, featuredImage),
|
|
2443
2457
|
tags: tags?.map((tag) => resolveLink(context, id, tag)),
|
|
2458
|
+
contentCount: calculateContentCount(topContent, pageContent, bottomContent),
|
|
2444
2459
|
contents,
|
|
2445
2460
|
icons,
|
|
2446
2461
|
structuredData: structuredData?.map((link) => resolveSchema(context, id, link)).filter((item) => item !== null),
|
|
@@ -2593,6 +2608,7 @@ function basePersonConverter(context, entry, customTypeEntry) {
|
|
|
2593
2608
|
// Person uses 'media' not 'featuredImage'
|
|
2594
2609
|
href: context.urlCalculators.person(slug),
|
|
2595
2610
|
bio: resolveRichTextDocument(context, id, bioField) ?? null,
|
|
2611
|
+
contentCount: calculateContentCount(personContent),
|
|
2596
2612
|
contents,
|
|
2597
2613
|
menu,
|
|
2598
2614
|
footer,
|
|
@@ -2666,6 +2682,7 @@ function baseTagConverter(context, entry, customTypeEntry) {
|
|
|
2666
2682
|
description: makeContentfulDescription(description, sys.id),
|
|
2667
2683
|
featuredImage: lookupAsset(context, featuredImage),
|
|
2668
2684
|
tagType: tagTypeName ?? null,
|
|
2685
|
+
contentCount: calculateContentCount(topContent),
|
|
2669
2686
|
contents,
|
|
2670
2687
|
icons,
|
|
2671
2688
|
structuredData: structuredData?.map((link) => resolveSchema(context, id, link)).filter((item) => item !== null),
|