@se-studio/contentful-rest-api 1.0.23 → 1.0.24
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 +2 -1
- package/dist/index.js +14 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IBaseArticle, IBaseArticleType, BaseCollectionContent, IBaseCollection, IBaseComponent, IBaseCustomType, INavigationItem, IBasePage, IBaseTag, IInternalLink, IVisual, IBasePerson, INavigation, IArticleLink, IArticleTypeLink, ITyped, IResponsiveVisual } from '@se-studio/core-data-types';
|
|
1
|
+
import { IBaseArticle, IBaseArticleType, BaseCollectionContent, IBaseCollection, IBaseComponent, IBaseCustomType, INavigationItem, IBasePage, IBaseTag, IInternalLink, IVisual, IBasePerson, INavigation, IArticleLink, IArticleTypeLink, ITyped, ISvgImage, IResponsiveVisual } from '@se-studio/core-data-types';
|
|
2
2
|
import * as contentful from 'contentful';
|
|
3
3
|
import { EntrySkeletonType, EntryFieldTypes, Entry, UnresolvedLink } from 'contentful';
|
|
4
4
|
import { Document } from '@contentful/rich-text-types';
|
|
@@ -532,6 +532,7 @@ interface IFetchedTemplate {
|
|
|
532
532
|
backgroundColour?: string;
|
|
533
533
|
textColour?: string;
|
|
534
534
|
stickyNav: boolean;
|
|
535
|
+
icons?: ReadonlyArray<ISvgImage>;
|
|
535
536
|
}
|
|
536
537
|
declare function contentfulTemplateRest(context: BaseConverterContext, config: ContentfulConfig, cmsLabel: string, options?: FetchOptions): Promise<CmsResponse<IFetchedTemplate | null>>;
|
|
537
538
|
|
package/dist/index.js
CHANGED
|
@@ -2602,6 +2602,18 @@ function templateConverter(context, entry) {
|
|
|
2602
2602
|
const menu = fields.menu ? resolveNavigation(context, fields.menu) : void 0;
|
|
2603
2603
|
const footer = fields.footer ? resolveNavigation(context, fields.footer) : void 0;
|
|
2604
2604
|
const stickyNav = fields.flags?.includes("Sticky nav") ?? false;
|
|
2605
|
+
const contentIcons = collectIconsFromContent([...preContent, ...postContent]);
|
|
2606
|
+
const menuIcons = collectIconsFromNavigation(menu);
|
|
2607
|
+
const footerIcons = collectIconsFromNavigation(footer);
|
|
2608
|
+
const allIcons = [...contentIcons, ...menuIcons, ...footerIcons];
|
|
2609
|
+
const seenIconIds = /* @__PURE__ */ new Set();
|
|
2610
|
+
const icons = allIcons.filter((icon) => {
|
|
2611
|
+
if (seenIconIds.has(icon.id)) {
|
|
2612
|
+
return false;
|
|
2613
|
+
}
|
|
2614
|
+
seenIconIds.add(icon.id);
|
|
2615
|
+
return true;
|
|
2616
|
+
});
|
|
2605
2617
|
return {
|
|
2606
2618
|
id,
|
|
2607
2619
|
cmsLabel: fields.cmsLabel,
|
|
@@ -2611,7 +2623,8 @@ function templateConverter(context, entry) {
|
|
|
2611
2623
|
footer,
|
|
2612
2624
|
backgroundColour: fields.backgroundColour,
|
|
2613
2625
|
textColour: fields.textColour,
|
|
2614
|
-
stickyNav
|
|
2626
|
+
stickyNav,
|
|
2627
|
+
icons: icons.length > 0 ? icons : void 0
|
|
2615
2628
|
};
|
|
2616
2629
|
}
|
|
2617
2630
|
async function contentfulTemplateRest(context, config, cmsLabel, options) {
|