@treely/strapi-slices 3.3.0 → 4.0.0
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/constants/slicesConfig.d.ts +5 -0
- package/dist/index.d.ts +1 -2
- package/dist/strapi-slices.cjs.development.js +14 -17
- package/dist/strapi-slices.cjs.development.js.map +1 -1
- package/dist/strapi-slices.cjs.production.min.js +1 -1
- package/dist/strapi-slices.cjs.production.min.js.map +1 -1
- package/dist/strapi-slices.esm.js +15 -15
- package/dist/strapi-slices.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/constants/{sectionsConfig.ts → slicesConfig.ts} +3 -6
- package/src/index.tsx +0 -11
- package/src/utils/mergeGlobalAndStrapiBlogPostData.ts +6 -4
- package/src/utils/mergeGlobalAndStrapiCustomerStoryData.ts +2 -2
- package/src/utils/mergeGlobalAndStrapiPageData.ts +7 -7
- package/src/utils/mergeGlobalAndStrapiProjectData.ts +5 -5
- package/dist/constants/sectionsConfig.d.ts +0 -5
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const EXTENDABLE_HEADER_SECTIONS: string[];
|
|
2
|
+
export declare const DARK_THEME_HEADER_SECTIONS: string[];
|
|
3
|
+
export declare const SLICES_WITH_BLOG_POSTS: string[];
|
|
4
|
+
export declare const SLICES_WITH_CUSTOMER_STORIES: string[];
|
|
5
|
+
export declare const SLICES_WITH_PROJECTS: string[];
|
package/dist/index.d.ts
CHANGED
|
@@ -49,8 +49,7 @@ import mergeGlobalAndStrapiPageData from './utils/mergeGlobalAndStrapiPageData';
|
|
|
49
49
|
import mergeGlobalAndStrapiProjectData from './utils/mergeGlobalAndStrapiProjectData';
|
|
50
50
|
import strapiLinkUrl from './utils/strapiLinkUrl';
|
|
51
51
|
import strapiMediaUrl from './utils/strapiMediaUrl';
|
|
52
|
-
import { SECTIONS_WITH_BLOG_POSTS, SECTIONS_WITH_CUSTOMER_STORIES, SECTIONS_WITH_PROJECTS } from './constants/sectionsConfig';
|
|
53
52
|
export * from './components/SEOTags';
|
|
54
53
|
export * from './components/SliceRenderer';
|
|
55
|
-
export { mergeGlobalAndStrapiBlogPostData, mergeGlobalAndStrapiCustomerStoryData, mergeGlobalAndStrapiPageData, mergeGlobalAndStrapiProjectData, strapiLinkUrl, strapiMediaUrl,
|
|
54
|
+
export { mergeGlobalAndStrapiBlogPostData, mergeGlobalAndStrapiCustomerStoryData, mergeGlobalAndStrapiPageData, mergeGlobalAndStrapiProjectData, strapiLinkUrl, strapiMediaUrl, };
|
|
56
55
|
export type { IStrapi, IStrapiData, IStrapiResponse, StrapiAuthor, StrapiAvatarWithName, StrapiBanner, StrapiBlogPost, StrapiBlogPostProps, StrapiButtonWithVariant, StrapiCategory, StrapiContactArea, StrapiCustomerStory, StrapiCustomerStoryProps, StrapiDefaultHeader, StrapiGlobal, StrapiGlossaryItem, StrapiHeroCard, StrapiImage, StrapiImageFormat, StrapiImageWithLink, StrapiLink, StrapiLinkList, StrapiLinkPage, StrapiLinkWithIcon, StrapiLocalization, StrapiMedia, StrapiMetadata, StrapiNavMenu, StrapiPage, StrapiPageProps, StrapiPortfolio, StrapiPortfolioCard, StrapiProject, StrapiProjectProps, StrapiProjectCard, StrapiQuoteCard, StrapiShapesCard, StrapiTextCardWithIcons, StrapiTopBanner, HeaderType, Image, Locale, PageMetadata, PageProps, PortfolioProject, };
|
|
@@ -414,14 +414,20 @@ var strapiMediaUrl = function strapiMediaUrl(media, preferredSize) {
|
|
|
414
414
|
var DEFAULT_SHARE_IMAGE = 'https://cdn.tree.ly/assets/v3/app/share-image-generic.webp';
|
|
415
415
|
var DEFAULT_SHARE_ALT = 'Share Image';
|
|
416
416
|
|
|
417
|
+
var EXTENDABLE_HEADER_SECTIONS = ['sections.hero', 'sections.map-hero', 'sections.full-width-image', 'sections.small-hero', 'sections.small-hero-light'];
|
|
418
|
+
var DARK_THEME_HEADER_SECTIONS = ['sections.hero', 'sections.small-hero'];
|
|
419
|
+
var SLICES_WITH_BLOG_POSTS = ['sections.blog', 'sections.blog-cards'];
|
|
420
|
+
var SLICES_WITH_CUSTOMER_STORIES = ['sections.customer-stories'];
|
|
421
|
+
var SLICES_WITH_PROJECTS = ['sections.projects-grid', 'sections.projects-map', 'sections.project-facts', 'sections.text-with-card'];
|
|
422
|
+
|
|
417
423
|
var mergeGlobalAndStrapiBlogPostData = function mergeGlobalAndStrapiBlogPostData(context, global, post, blog, projects) {
|
|
418
424
|
var _post$attributes$meta, _post$attributes$meta2, _post$attributes$meta3, _global$attributes$me, _post$attributes, _post$attributes$meta4, _post$attributes$meta5, _post$attributes$meta6, _post$attributes$meta7, _ref, _post$attributes$meta8, _post$attributes$meta9, _global$attributes$me2;
|
|
419
425
|
var metaShareImageUrl = (_post$attributes$meta = post.attributes.metadata) != null && _post$attributes$meta.shareImage ? strapiMediaUrl((_post$attributes$meta2 = (_post$attributes$meta3 = post.attributes.metadata) == null ? void 0 : _post$attributes$meta3.shareImage.media) != null ? _post$attributes$meta2 : (_global$attributes$me = global.attributes.metadata.shareImage) == null ? void 0 : _global$attributes$me.media, 'large') : DEFAULT_SHARE_IMAGE;
|
|
420
426
|
var returnBlog = post.attributes.slices.some(function (slice) {
|
|
421
|
-
return
|
|
427
|
+
return SLICES_WITH_BLOG_POSTS.includes(slice.__component);
|
|
422
428
|
});
|
|
423
429
|
var returnProjects = post.attributes.slices.some(function (slice) {
|
|
424
|
-
return
|
|
430
|
+
return SLICES_WITH_PROJECTS.includes(slice.__component);
|
|
425
431
|
});
|
|
426
432
|
return _extends({}, post, {
|
|
427
433
|
// Portfolio Projects
|
|
@@ -460,7 +466,7 @@ var mergeGlobalAndStrapiCustomerStoryData = function mergeGlobalAndStrapiCustome
|
|
|
460
466
|
var _customerStory$attrib, _customerStory$attrib2, _customerStory$attrib3, _global$attributes$me, _customerStory$attrib4, _customerStory$attrib5, _customerStory$attrib6, _customerStory$attrib7, _customerStory$attrib8, _ref, _customerStory$attrib9, _customerStory$attrib10, _global$attributes$me2;
|
|
461
467
|
var metaShareImageUrl = (_customerStory$attrib = customerStory.attributes.metadata) != null && _customerStory$attrib.shareImage ? strapiMediaUrl((_customerStory$attrib2 = (_customerStory$attrib3 = customerStory.attributes.metadata) == null ? void 0 : _customerStory$attrib3.shareImage.media) != null ? _customerStory$attrib2 : (_global$attributes$me = global.attributes.metadata.shareImage) == null ? void 0 : _global$attributes$me.media, 'large') : DEFAULT_SHARE_IMAGE;
|
|
462
468
|
var returnCustomerStories = customerStory.attributes.slices.some(function (slice) {
|
|
463
|
-
return
|
|
469
|
+
return SLICES_WITH_CUSTOMER_STORIES.includes(slice.__component);
|
|
464
470
|
});
|
|
465
471
|
return _extends({}, customerStory, {
|
|
466
472
|
// Portfolio Projects
|
|
@@ -494,23 +500,17 @@ var mergeGlobalAndStrapiCustomerStoryData = function mergeGlobalAndStrapiCustome
|
|
|
494
500
|
});
|
|
495
501
|
};
|
|
496
502
|
|
|
497
|
-
var EXTENDABLE_HEADER_SECTIONS = ['sections.hero', 'sections.map-hero', 'sections.full-width-image', 'sections.small-hero', 'sections.small-hero-light'];
|
|
498
|
-
var DARK_THEME_HEADER_SECTIONS = ['sections.hero', 'sections.small-hero'];
|
|
499
|
-
var SECTIONS_WITH_BLOG_POSTS = ['sections.blog', 'sections.blog-cards'];
|
|
500
|
-
var SECTIONS_WITH_CUSTOMER_STORIES = ['sections.customer-stories'];
|
|
501
|
-
var SECTIONS_WITH_PROJECTS = ['sections.projects-grid', 'sections.projects-map', 'sections.project-facts', 'sections.text-with-card'];
|
|
502
|
-
|
|
503
503
|
var mergeGlobalAndStrapiPageData = function mergeGlobalAndStrapiPageData(context, global, page, blogPosts, customerStories, projects) {
|
|
504
504
|
var _page$attributes$meta, _page$attributes$meta2, _page$attributes$meta3, _global$attributes$me, _page$attributes$meta4, _page$attributes, _page$attributes$slic, _page$attributes$slic2, _page$attributes$meta5, _page$attributes$meta6, _page$attributes$meta7, _page$attributes$meta8, _ref, _page$attributes$meta9, _page$attributes$meta10, _global$attributes$me2;
|
|
505
505
|
var metaShareImageUrl = (_page$attributes$meta = page.attributes.metadata) != null && _page$attributes$meta.shareImage ? strapiMediaUrl((_page$attributes$meta2 = (_page$attributes$meta3 = page.attributes.metadata) == null ? void 0 : _page$attributes$meta3.shareImage.media) != null ? _page$attributes$meta2 : (_global$attributes$me = global.attributes.metadata.shareImage) == null ? void 0 : _global$attributes$me.media, 'large') : DEFAULT_SHARE_IMAGE;
|
|
506
506
|
var returnBlogPosts = page.attributes.slices.some(function (slice) {
|
|
507
|
-
return
|
|
507
|
+
return SLICES_WITH_BLOG_POSTS.includes(slice.__component);
|
|
508
508
|
});
|
|
509
509
|
var returnCustomerStories = page.attributes.slices.some(function (slice) {
|
|
510
|
-
return
|
|
510
|
+
return SLICES_WITH_CUSTOMER_STORIES.includes(slice.__component);
|
|
511
511
|
});
|
|
512
512
|
var returnProjects = page.attributes.slices.some(function (slice) {
|
|
513
|
-
return
|
|
513
|
+
return SLICES_WITH_PROJECTS.includes(slice.__component);
|
|
514
514
|
});
|
|
515
515
|
return _extends({}, page, {
|
|
516
516
|
// Portfolio Projects
|
|
@@ -549,10 +549,10 @@ var mergeGlobalAndStrapiProject = function mergeGlobalAndStrapiProject(context,
|
|
|
549
549
|
var _project$attributes$m, _project$attributes$m2, _project$attributes$m3, _global$attributes$me, _project$attributes, _project$attributes$s, _project$attributes$s2, _project$attributes$m4, _project$attributes$m5, _project$attributes$m6, _project$attributes$m7, _ref, _project$attributes$m8, _project$attributes$m9, _global$attributes$me2;
|
|
550
550
|
var metaShareImageUrl = (_project$attributes$m = project.attributes.metadata) != null && _project$attributes$m.shareImage ? strapiMediaUrl((_project$attributes$m2 = (_project$attributes$m3 = project.attributes.metadata) == null ? void 0 : _project$attributes$m3.shareImage.media) != null ? _project$attributes$m2 : (_global$attributes$me = global.attributes.metadata.shareImage) == null ? void 0 : _global$attributes$me.media, 'large') : DEFAULT_SHARE_IMAGE;
|
|
551
551
|
var returnBlogPosts = project.attributes.slices.some(function (slice) {
|
|
552
|
-
return
|
|
552
|
+
return SLICES_WITH_BLOG_POSTS.includes(slice.__component);
|
|
553
553
|
});
|
|
554
554
|
var returnProjects = project.attributes.slices.some(function (slice) {
|
|
555
|
-
return
|
|
555
|
+
return SLICES_WITH_PROJECTS.includes(slice.__component);
|
|
556
556
|
});
|
|
557
557
|
return _extends({}, project, {
|
|
558
558
|
// Portfolio Projects
|
|
@@ -4939,9 +4939,6 @@ var SliceRenderer = function SliceRenderer(_ref) {
|
|
|
4939
4939
|
}));
|
|
4940
4940
|
};
|
|
4941
4941
|
|
|
4942
|
-
exports.SECTIONS_WITH_BLOG_POSTS = SECTIONS_WITH_BLOG_POSTS;
|
|
4943
|
-
exports.SECTIONS_WITH_CUSTOMER_STORIES = SECTIONS_WITH_CUSTOMER_STORIES;
|
|
4944
|
-
exports.SECTIONS_WITH_PROJECTS = SECTIONS_WITH_PROJECTS;
|
|
4945
4942
|
exports.SEOTags = SEOTags;
|
|
4946
4943
|
exports.SliceRenderer = SliceRenderer;
|
|
4947
4944
|
exports.mergeGlobalAndStrapiBlogPostData = mergeGlobalAndStrapiBlogPostData;
|