@treely/strapi-slices 7.11.0 → 7.12.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/models/PageMetadata.d.ts +1 -0
- package/dist/models/strapi/StrapiMetadata.d.ts +1 -0
- package/dist/strapi-slices.cjs.development.js +30 -22
- 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 +30 -22
- package/dist/strapi-slices.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/models/PageMetadata.ts +1 -0
- package/src/models/strapi/StrapiMetadata.ts +1 -0
- package/src/test/strapiMocks/strapiMetadata.ts +1 -0
- package/src/utils/mergeGlobalAndStrapiBlogPostData.test.ts +81 -0
- package/src/utils/mergeGlobalAndStrapiBlogPostData.ts +6 -0
- package/src/utils/mergeGlobalAndStrapiCustomerStoryData.test.ts +78 -0
- package/src/utils/mergeGlobalAndStrapiCustomerStoryData.ts +6 -0
- package/src/utils/mergeGlobalAndStrapiPageData.test.ts +84 -0
- package/src/utils/mergeGlobalAndStrapiPageData.ts +6 -0
- package/src/utils/mergeGlobalAndStrapiProjectData.test.ts +81 -0
- package/src/utils/mergeGlobalAndStrapiProjectData.ts +6 -0
|
@@ -689,8 +689,9 @@ var SLICES_WITH_CUSTOMER_STORIES = ['sections.customer-stories'];
|
|
|
689
689
|
var SLICES_WITH_PROJECTS = ['sections.projects-grid', 'sections.projects-map', 'sections.project-facts', 'sections.text-with-card'];
|
|
690
690
|
|
|
691
691
|
var mergeGlobalAndStrapiBlogPostData = function mergeGlobalAndStrapiBlogPostData(context, global, post, blog, projects) {
|
|
692
|
-
var _post$attributes$meta, _post$attributes$meta2, _post$attributes$meta3, _global$attributes$me,
|
|
692
|
+
var _post$attributes$meta, _post$attributes$meta2, _post$attributes$meta3, _global$attributes$me, _ref, _post$attributes$meta4, _post$attributes$meta5, _global$attributes$me2, _post$attributes, _post$attributes$meta6, _post$attributes$meta7, _post$attributes$meta8, _post$attributes$meta9, _ref2, _post$attributes$meta10, _post$attributes$meta11, _global$attributes$me3;
|
|
693
693
|
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;
|
|
694
|
+
var schemaMarkupTypes = (_ref = (_post$attributes$meta4 = (_post$attributes$meta5 = post.attributes.metadata) == null ? void 0 : _post$attributes$meta5.schemaMarkupTypes) != null ? _post$attributes$meta4 : (_global$attributes$me2 = global.attributes.metadata) == null ? void 0 : _global$attributes$me2.schemaMarkupTypes) != null ? _ref : [];
|
|
694
695
|
var returnBlog = post.attributes.slices.some(function (slice) {
|
|
695
696
|
return SLICES_WITH_BLOG_POSTS.includes(slice.__component);
|
|
696
697
|
});
|
|
@@ -713,14 +714,15 @@ var mergeGlobalAndStrapiBlogPostData = function mergeGlobalAndStrapiBlogPostData
|
|
|
713
714
|
headerButtons: global.attributes.navbar.buttons || [],
|
|
714
715
|
footerLinks: global.attributes.footer.links || [],
|
|
715
716
|
metadata: {
|
|
716
|
-
title: (_post$attributes$
|
|
717
|
-
description: (_post$attributes$
|
|
717
|
+
title: (_post$attributes$meta6 = (_post$attributes$meta7 = post.attributes.metadata) == null ? void 0 : _post$attributes$meta7.title) != null ? _post$attributes$meta6 : global.attributes.metadata.title,
|
|
718
|
+
description: (_post$attributes$meta8 = (_post$attributes$meta9 = post.attributes.metadata) == null ? void 0 : _post$attributes$meta9.description) != null ? _post$attributes$meta8 : global.attributes.metadata.description,
|
|
718
719
|
shareImage: {
|
|
719
720
|
url: metaShareImageUrl,
|
|
720
|
-
alt: (
|
|
721
|
+
alt: (_ref2 = (_post$attributes$meta10 = (_post$attributes$meta11 = post.attributes.metadata) == null || (_post$attributes$meta11 = _post$attributes$meta11.shareImage) == null ? void 0 : _post$attributes$meta11.alt) != null ? _post$attributes$meta10 : (_global$attributes$me3 = global.attributes.metadata.shareImage) == null ? void 0 : _global$attributes$me3.alt) != null ? _ref2 : DEFAULT_SHARE_ALT
|
|
721
722
|
},
|
|
722
723
|
metaTitleSuffix: global.attributes.metaTitleSuffix,
|
|
723
|
-
favicon: strapiMediaUrl(global.attributes.favicon, 'thumbnail')
|
|
724
|
+
favicon: strapiMediaUrl(global.attributes.favicon, 'thumbnail'),
|
|
725
|
+
schemaMarkupTypes: schemaMarkupTypes
|
|
724
726
|
},
|
|
725
727
|
slices: post == null ? void 0 : post.attributes.slices,
|
|
726
728
|
blogPosts: returnBlog ? blog : [],
|
|
@@ -733,8 +735,9 @@ var mergeGlobalAndStrapiBlogPostData = function mergeGlobalAndStrapiBlogPostData
|
|
|
733
735
|
};
|
|
734
736
|
|
|
735
737
|
var mergeGlobalAndStrapiCustomerStoryData = function mergeGlobalAndStrapiCustomerStoryData(context, global, customerStory, customerStories) {
|
|
736
|
-
var _customerStory$attrib, _customerStory$attrib2, _customerStory$attrib3, _global$attributes$me, _customerStory$attrib4, _customerStory$attrib5, _customerStory$attrib6, _customerStory$attrib7, _customerStory$attrib8,
|
|
738
|
+
var _customerStory$attrib, _customerStory$attrib2, _customerStory$attrib3, _global$attributes$me, _ref, _customerStory$attrib4, _customerStory$attrib5, _global$attributes$me2, _customerStory$attrib6, _customerStory$attrib7, _customerStory$attrib8, _customerStory$attrib9, _customerStory$attrib10, _ref2, _customerStory$attrib11, _customerStory$attrib12, _global$attributes$me3;
|
|
737
739
|
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;
|
|
740
|
+
var schemaMarkupTypes = (_ref = (_customerStory$attrib4 = (_customerStory$attrib5 = customerStory.attributes.metadata) == null ? void 0 : _customerStory$attrib5.schemaMarkupTypes) != null ? _customerStory$attrib4 : (_global$attributes$me2 = global.attributes.metadata) == null ? void 0 : _global$attributes$me2.schemaMarkupTypes) != null ? _ref : [];
|
|
738
741
|
var returnCustomerStories = customerStory.attributes.slices.some(function (slice) {
|
|
739
742
|
return SLICES_WITH_CUSTOMER_STORIES.includes(slice.__component);
|
|
740
743
|
});
|
|
@@ -742,7 +745,7 @@ var mergeGlobalAndStrapiCustomerStoryData = function mergeGlobalAndStrapiCustome
|
|
|
742
745
|
// Portfolio Projects
|
|
743
746
|
projects: [],
|
|
744
747
|
attributes: _extends({}, customerStory == null ? void 0 : customerStory.attributes, {
|
|
745
|
-
metadata: (customerStory == null || (_customerStory$
|
|
748
|
+
metadata: (customerStory == null || (_customerStory$attrib6 = customerStory.attributes) == null ? void 0 : _customerStory$attrib6.metadata) || global.attributes.metadata
|
|
746
749
|
}),
|
|
747
750
|
// PageProps
|
|
748
751
|
headerType: {
|
|
@@ -753,14 +756,15 @@ var mergeGlobalAndStrapiCustomerStoryData = function mergeGlobalAndStrapiCustome
|
|
|
753
756
|
headerButtons: global.attributes.navbar.buttons || [],
|
|
754
757
|
footerLinks: global.attributes.footer.links || [],
|
|
755
758
|
metadata: {
|
|
756
|
-
title: (_customerStory$
|
|
757
|
-
description: (_customerStory$
|
|
759
|
+
title: (_customerStory$attrib7 = (_customerStory$attrib8 = customerStory.attributes.metadata) == null ? void 0 : _customerStory$attrib8.title) != null ? _customerStory$attrib7 : global.attributes.metadata.title,
|
|
760
|
+
description: (_customerStory$attrib9 = (_customerStory$attrib10 = customerStory.attributes.metadata) == null ? void 0 : _customerStory$attrib10.description) != null ? _customerStory$attrib9 : global.attributes.metadata.description,
|
|
758
761
|
shareImage: {
|
|
759
762
|
url: metaShareImageUrl,
|
|
760
|
-
alt: (
|
|
763
|
+
alt: (_ref2 = (_customerStory$attrib11 = (_customerStory$attrib12 = customerStory.attributes.metadata) == null || (_customerStory$attrib12 = _customerStory$attrib12.shareImage) == null ? void 0 : _customerStory$attrib12.alt) != null ? _customerStory$attrib11 : (_global$attributes$me3 = global.attributes.metadata.shareImage) == null ? void 0 : _global$attributes$me3.alt) != null ? _ref2 : DEFAULT_SHARE_ALT
|
|
761
764
|
},
|
|
762
765
|
metaTitleSuffix: global.attributes.metaTitleSuffix,
|
|
763
|
-
favicon: strapiMediaUrl(global.attributes.favicon, 'thumbnail')
|
|
766
|
+
favicon: strapiMediaUrl(global.attributes.favicon, 'thumbnail'),
|
|
767
|
+
schemaMarkupTypes: schemaMarkupTypes
|
|
764
768
|
},
|
|
765
769
|
slices: customerStory == null ? void 0 : customerStory.attributes.slices,
|
|
766
770
|
customerStories: returnCustomerStories ? customerStories : [],
|
|
@@ -773,8 +777,9 @@ var mergeGlobalAndStrapiCustomerStoryData = function mergeGlobalAndStrapiCustome
|
|
|
773
777
|
};
|
|
774
778
|
|
|
775
779
|
var mergeGlobalAndStrapiPageData = function mergeGlobalAndStrapiPageData(context, global, page, blogPosts, customerStories, projects) {
|
|
776
|
-
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$
|
|
780
|
+
var _page$attributes$meta, _page$attributes$meta2, _page$attributes$meta3, _global$attributes$me, _ref, _page$attributes$meta4, _page$attributes$meta5, _global$attributes$me2, _page$attributes$meta6, _page$attributes, _page$attributes$slic, _page$attributes$slic2, _page$attributes$meta7, _page$attributes$meta8, _page$attributes$meta9, _page$attributes$meta10, _ref2, _page$attributes$meta11, _page$attributes$meta12, _global$attributes$me3;
|
|
777
781
|
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;
|
|
782
|
+
var schemaMarkupTypes = (_ref = (_page$attributes$meta4 = (_page$attributes$meta5 = page.attributes.metadata) == null ? void 0 : _page$attributes$meta5.schemaMarkupTypes) != null ? _page$attributes$meta4 : (_global$attributes$me2 = global.attributes.metadata) == null ? void 0 : _global$attributes$me2.schemaMarkupTypes) != null ? _ref : [];
|
|
778
783
|
var returnBlogPosts = page.attributes.slices.some(function (slice) {
|
|
779
784
|
return SLICES_WITH_BLOG_POSTS.includes(slice.__component);
|
|
780
785
|
});
|
|
@@ -789,7 +794,7 @@ var mergeGlobalAndStrapiPageData = function mergeGlobalAndStrapiPageData(context
|
|
|
789
794
|
projects: returnProjects ? projects : [],
|
|
790
795
|
// StrapiPage
|
|
791
796
|
attributes: _extends({}, page == null ? void 0 : page.attributes, {
|
|
792
|
-
metadata: (_page$attributes$
|
|
797
|
+
metadata: (_page$attributes$meta6 = page == null || (_page$attributes = page.attributes) == null ? void 0 : _page$attributes.metadata) != null ? _page$attributes$meta6 : global.attributes.metadata
|
|
793
798
|
}),
|
|
794
799
|
// PageProps
|
|
795
800
|
headerType: {
|
|
@@ -800,14 +805,15 @@ var mergeGlobalAndStrapiPageData = function mergeGlobalAndStrapiPageData(context
|
|
|
800
805
|
headerButtons: global.attributes.navbar.buttons || [],
|
|
801
806
|
footerLinks: global.attributes.footer.links || [],
|
|
802
807
|
metadata: {
|
|
803
|
-
title: (_page$attributes$
|
|
804
|
-
description: (_page$attributes$
|
|
808
|
+
title: (_page$attributes$meta7 = (_page$attributes$meta8 = page.attributes.metadata) == null ? void 0 : _page$attributes$meta8.title) != null ? _page$attributes$meta7 : global.attributes.metadata.title,
|
|
809
|
+
description: (_page$attributes$meta9 = (_page$attributes$meta10 = page.attributes.metadata) == null ? void 0 : _page$attributes$meta10.description) != null ? _page$attributes$meta9 : global.attributes.metadata.description,
|
|
805
810
|
shareImage: {
|
|
806
811
|
url: metaShareImageUrl,
|
|
807
|
-
alt: (
|
|
812
|
+
alt: (_ref2 = (_page$attributes$meta11 = (_page$attributes$meta12 = page.attributes.metadata) == null || (_page$attributes$meta12 = _page$attributes$meta12.shareImage) == null ? void 0 : _page$attributes$meta12.alt) != null ? _page$attributes$meta11 : (_global$attributes$me3 = global.attributes.metadata.shareImage) == null ? void 0 : _global$attributes$me3.alt) != null ? _ref2 : DEFAULT_SHARE_ALT
|
|
808
813
|
},
|
|
809
814
|
metaTitleSuffix: global.attributes.metaTitleSuffix,
|
|
810
|
-
favicon: strapiMediaUrl(global.attributes.favicon, 'thumbnail')
|
|
815
|
+
favicon: strapiMediaUrl(global.attributes.favicon, 'thumbnail'),
|
|
816
|
+
schemaMarkupTypes: schemaMarkupTypes
|
|
811
817
|
},
|
|
812
818
|
slices: page == null ? void 0 : page.attributes.slices,
|
|
813
819
|
blogPosts: returnBlogPosts ? blogPosts : [],
|
|
@@ -820,8 +826,9 @@ var mergeGlobalAndStrapiPageData = function mergeGlobalAndStrapiPageData(context
|
|
|
820
826
|
};
|
|
821
827
|
|
|
822
828
|
var mergeGlobalAndStrapiProject = function mergeGlobalAndStrapiProject(context, global, project, blogPosts, projects) {
|
|
823
|
-
var _project$attributes$m, _project$attributes$m2, _project$attributes$m3, _global$attributes$me, _project$attributes, _project$attributes$s, _project$attributes$s2, _project$attributes$
|
|
829
|
+
var _project$attributes$m, _project$attributes$m2, _project$attributes$m3, _global$attributes$me, _ref, _project$attributes$m4, _project$attributes$m5, _global$attributes$me2, _project$attributes, _project$attributes$s, _project$attributes$s2, _project$attributes$m6, _project$attributes$m7, _project$attributes$m8, _project$attributes$m9, _ref2, _project$attributes$m10, _project$attributes$m11, _global$attributes$me3;
|
|
824
830
|
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;
|
|
831
|
+
var schemaMarkupTypes = (_ref = (_project$attributes$m4 = (_project$attributes$m5 = project.attributes.metadata) == null ? void 0 : _project$attributes$m5.schemaMarkupTypes) != null ? _project$attributes$m4 : (_global$attributes$me2 = global.attributes.metadata) == null ? void 0 : _global$attributes$me2.schemaMarkupTypes) != null ? _ref : [];
|
|
825
832
|
var returnBlogPosts = project.attributes.slices.some(function (slice) {
|
|
826
833
|
return SLICES_WITH_BLOG_POSTS.includes(slice.__component);
|
|
827
834
|
});
|
|
@@ -844,14 +851,15 @@ var mergeGlobalAndStrapiProject = function mergeGlobalAndStrapiProject(context,
|
|
|
844
851
|
headerButtons: global.attributes.navbar.buttons || [],
|
|
845
852
|
footerLinks: global.attributes.footer.links || [],
|
|
846
853
|
metadata: {
|
|
847
|
-
title: (_project$attributes$
|
|
848
|
-
description: (_project$attributes$
|
|
854
|
+
title: (_project$attributes$m6 = (_project$attributes$m7 = project.attributes.metadata) == null ? void 0 : _project$attributes$m7.title) != null ? _project$attributes$m6 : global.attributes.metadata.title,
|
|
855
|
+
description: (_project$attributes$m8 = (_project$attributes$m9 = project.attributes.metadata) == null ? void 0 : _project$attributes$m9.description) != null ? _project$attributes$m8 : global.attributes.metadata.description,
|
|
849
856
|
shareImage: {
|
|
850
857
|
url: metaShareImageUrl,
|
|
851
|
-
alt: (
|
|
858
|
+
alt: (_ref2 = (_project$attributes$m10 = (_project$attributes$m11 = project.attributes.metadata) == null || (_project$attributes$m11 = _project$attributes$m11.shareImage) == null ? void 0 : _project$attributes$m11.alt) != null ? _project$attributes$m10 : (_global$attributes$me3 = global.attributes.metadata.shareImage) == null ? void 0 : _global$attributes$me3.alt) != null ? _ref2 : DEFAULT_SHARE_ALT
|
|
852
859
|
},
|
|
853
860
|
metaTitleSuffix: global.attributes.metaTitleSuffix,
|
|
854
|
-
favicon: strapiMediaUrl(global.attributes.favicon, 'thumbnail')
|
|
861
|
+
favicon: strapiMediaUrl(global.attributes.favicon, 'thumbnail'),
|
|
862
|
+
schemaMarkupTypes: schemaMarkupTypes
|
|
855
863
|
},
|
|
856
864
|
slices: project.attributes.slices,
|
|
857
865
|
blogPosts: returnBlogPosts ? blogPosts : [],
|