@treely/strapi-slices 5.11.3 → 5.13.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.
Files changed (48) hide show
  1. package/dist/components/ContextProvider/ContextProvider.d.ts +1 -2
  2. package/dist/constants/strapi.d.ts +1 -0
  3. package/dist/index.d.ts +6 -3
  4. package/dist/integrations/strapi/getAllSlugsFromStrapi.d.ts +10 -0
  5. package/dist/integrations/strapi/getStaticPathsFromStrapi.d.ts +1 -0
  6. package/dist/integrations/strapi/getStaticPropsFromStrapi.d.ts +1 -0
  7. package/dist/integrations/strapi/getStrapiCollectionType.d.ts +10 -0
  8. package/dist/integrations/strapi/getStrapiSingleType.d.ts +8 -0
  9. package/dist/models/Locale.d.ts +3 -1
  10. package/dist/models/LocalizedEntity.d.ts +7 -0
  11. package/dist/models/PageProps.d.ts +1 -0
  12. package/dist/models/strapi/StrapiGlobal.d.ts +2 -0
  13. package/dist/strapi-slices.cjs.development.js +205 -31
  14. package/dist/strapi-slices.cjs.development.js.map +1 -1
  15. package/dist/strapi-slices.cjs.production.min.js +1 -1
  16. package/dist/strapi-slices.cjs.production.min.js.map +1 -1
  17. package/dist/strapi-slices.esm.js +205 -34
  18. package/dist/strapi-slices.esm.js.map +1 -1
  19. package/dist/utils/getMessages.d.ts +142 -0
  20. package/package.json +1 -1
  21. package/src/components/ContextProvider/ContextProvider.tsx +3 -5
  22. package/src/components/MinimalProviders/MinimalProviders.tsx +2 -8
  23. package/src/constants/strapi.ts +2 -0
  24. package/src/index.tsx +8 -2
  25. package/src/integrations/strapi/getAllSlugsFromStrapi.test.ts +33 -0
  26. package/src/integrations/strapi/getAllSlugsFromStrapi.ts +50 -0
  27. package/src/integrations/strapi/getPortfolioProjects.test.ts +24 -0
  28. package/src/integrations/strapi/getPortfolioProjects.ts +25 -5
  29. package/src/integrations/strapi/getStaticPathsFromStrapi.ts +1 -0
  30. package/src/integrations/strapi/getStaticPropsFromStrapi.ts +1 -0
  31. package/src/integrations/strapi/getStrapiCollectionType.test.ts +65 -0
  32. package/src/integrations/strapi/getStrapiCollectionType.ts +61 -0
  33. package/src/integrations/strapi/getStrapiSingleType.test.ts +53 -0
  34. package/src/integrations/strapi/getStrapiSingleType.ts +50 -0
  35. package/src/models/Locale.ts +3 -1
  36. package/src/models/LocalizedEntity.ts +9 -0
  37. package/src/models/PageProps.ts +1 -0
  38. package/src/models/strapi/StrapiGlobal.ts +2 -0
  39. package/src/test/strapiMocks/minimalGlobalData.ts +1 -0
  40. package/src/utils/getMessages.ts +18 -0
  41. package/src/utils/mergeGlobalAndStrapiBlogPostData.test.ts +25 -4
  42. package/src/utils/mergeGlobalAndStrapiBlogPostData.ts +1 -0
  43. package/src/utils/mergeGlobalAndStrapiCustomerStoryData.test.ts +24 -4
  44. package/src/utils/mergeGlobalAndStrapiCustomerStoryData.ts +1 -0
  45. package/src/utils/mergeGlobalAndStrapiPageData.test.ts +22 -0
  46. package/src/utils/mergeGlobalAndStrapiPageData.ts +1 -0
  47. package/src/utils/mergeGlobalAndStrapiProjectData.test.ts +25 -4
  48. package/src/utils/mergeGlobalAndStrapiProjectData.ts +1 -0
@@ -1,8 +1,7 @@
1
1
  import React from 'react';
2
- import Locale from '../../models/Locale';
3
2
  export declare const IntlContext: React.Context<import("react-intl").IntlShape>;
4
3
  export interface ContextProviderProps {
5
4
  children: React.ReactNode;
6
- locale: Locale;
5
+ locale: string;
7
6
  }
8
7
  export declare const ContextProvider: React.FC<ContextProviderProps>;
@@ -1,2 +1,3 @@
1
1
  export declare const STRAPI_URI: string;
2
2
  export declare const STRAPI_DEFAULT_PAGE_SIZE = "100";
3
+ export declare const STRAPI_FALLBACK_LOCALE = "en";
package/dist/index.d.ts CHANGED
@@ -31,8 +31,8 @@ import StrapiPageProps from './models/strapi/StrapiPageProps';
31
31
  import StrapiPortfolio from './models/strapi/StrapiPortfolio';
32
32
  import StrapiPortfolioCard from './models/strapi/StrapiPortfolioCard';
33
33
  import StrapiProject from './models/strapi/StrapiProject';
34
- import StrapiProjectProps from './models/strapi/StrapiProjectProps';
35
34
  import StrapiProjectCard from './models/strapi/StrapiProjectCard';
35
+ import StrapiProjectProps from './models/strapi/StrapiProjectProps';
36
36
  import StrapiQuoteCard from './models/strapi/StrapiQuoteCard';
37
37
  import StrapiShapesCard from './models/strapi/StrapiShapesCard';
38
38
  import StrapiTextCardWithIcons from './models/strapi/StrapiTextCardWithIcons';
@@ -43,9 +43,12 @@ import Locale from './models/Locale';
43
43
  import PageMetadata from './models/PageMetadata';
44
44
  import PageProps from './models/PageProps';
45
45
  import PortfolioProject from './models/PortfolioProject';
46
+ import getAllSlugsFromStrapi from './integrations/strapi/getAllSlugsFromStrapi';
46
47
  import getPortfolioProjects from './integrations/strapi/getPortfolioProjects';
47
48
  import getStaticPathsFromStrapi from './integrations/strapi/getStaticPathsFromStrapi';
48
49
  import getStaticPropsFromStrapi from './integrations/strapi/getStaticPropsFromStrapi';
50
+ import getStrapiCollectionType from './integrations/strapi/getStrapiCollectionType';
51
+ import getStrapiSingleType from './integrations/strapi/getStrapiSingleType';
49
52
  import mergeGlobalAndStrapiBlogPostData from './utils/mergeGlobalAndStrapiBlogPostData';
50
53
  import mergeGlobalAndStrapiCustomerStoryData from './utils/mergeGlobalAndStrapiCustomerStoryData';
51
54
  import mergeGlobalAndStrapiPageData from './utils/mergeGlobalAndStrapiPageData';
@@ -55,5 +58,5 @@ import strapiMediaUrl from './utils/strapiMediaUrl';
55
58
  export * from './components/PreviewAlert';
56
59
  export * from './components/SEOTags';
57
60
  export * from './components/SliceRenderer';
58
- export { mergeGlobalAndStrapiBlogPostData, mergeGlobalAndStrapiCustomerStoryData, mergeGlobalAndStrapiPageData, mergeGlobalAndStrapiProjectData, strapiLinkUrl, strapiMediaUrl, getPortfolioProjects, getStaticPathsFromStrapi, getStaticPropsFromStrapi, };
59
- 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, };
61
+ export { mergeGlobalAndStrapiBlogPostData, mergeGlobalAndStrapiCustomerStoryData, mergeGlobalAndStrapiPageData, mergeGlobalAndStrapiProjectData, strapiLinkUrl, strapiMediaUrl, getAllSlugsFromStrapi, getPortfolioProjects, getStaticPathsFromStrapi, getStaticPropsFromStrapi, getStrapiCollectionType, getStrapiSingleType, };
62
+ 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, StrapiProjectCard, StrapiProjectProps, StrapiQuoteCard, StrapiShapesCard, StrapiTextCardWithIcons, StrapiTopBanner, HeaderType, Image, Locale, PageMetadata, PageProps, PortfolioProject, };
@@ -0,0 +1,10 @@
1
+ import LocalizedEntity from '../../models/LocalizedEntity';
2
+ interface Options {
3
+ filters?: Record<string, any>;
4
+ }
5
+ type Slug = {
6
+ slug: string;
7
+ locale: string;
8
+ };
9
+ declare const getAllSlugsFromStrapi: <T extends LocalizedEntity<"slug">>(path: string, locales: string[], { filters }?: Options) => Promise<Slug[]>;
10
+ export default getAllSlugsFromStrapi;
@@ -2,5 +2,6 @@ import { AxiosResponse } from 'axios';
2
2
  interface Options {
3
3
  filters?: Record<string, any>;
4
4
  }
5
+ /** @deprecated Migrate to getAllSlugsFromStrapi */
5
6
  declare const getStaticPathsFromStrapi: (path: string, { filters }?: Options) => Promise<AxiosResponse>;
6
7
  export default getStaticPathsFromStrapi;
@@ -5,5 +5,6 @@ interface Options {
5
5
  preview?: boolean;
6
6
  filters?: Record<string, any>;
7
7
  }
8
+ /** @deprecated Migrate to getStrapiSingleType or getStrapiCollectionType */
8
9
  declare const getStaticPropsFromStrapi: (path: string, { locale, slug, preview, filters }: Options) => Promise<AxiosResponse>;
9
10
  export default getStaticPropsFromStrapi;
@@ -0,0 +1,10 @@
1
+ import IStrapiData from '../../models/strapi/IStrapiData';
2
+ import LocalizedEntity from '../../models/LocalizedEntity';
3
+ interface Options {
4
+ locale?: string;
5
+ slug?: string;
6
+ preview?: boolean;
7
+ filters?: Record<string, any>;
8
+ }
9
+ declare const getStrapiCollectionType: <T extends LocalizedEntity<K>, K extends string>(path: string, key: K, { locale, preview, filters }: Options) => Promise<IStrapiData<T>[]>;
10
+ export default getStrapiCollectionType;
@@ -0,0 +1,8 @@
1
+ import IStrapiData from '../../models/strapi/IStrapiData';
2
+ interface Options {
3
+ locale?: string;
4
+ preview?: boolean;
5
+ filters?: Record<string, any>;
6
+ }
7
+ declare const getStrapiSingleType: <T>(path: string, { locale, preview, filters }: Options) => Promise<IStrapiData<T>>;
8
+ export default getStrapiSingleType;
@@ -1,2 +1,4 @@
1
- type Locale = 'en' | 'de';
1
+ /** @deprecated Removing this type because this project now falls back to
2
+ * English if a locale is not supported. */
3
+ type Locale = string;
2
4
  export default Locale;
@@ -0,0 +1,7 @@
1
+ import Locale from './Locale';
2
+ type LocalizedEntity<Key extends string = any> = {
3
+ [key in Key]: any;
4
+ } & {
5
+ locale: Locale;
6
+ };
7
+ export default LocalizedEntity;
@@ -18,5 +18,6 @@ interface PageProps {
18
18
  topBanner?: StrapiTopBanner;
19
19
  customerStories: IStrapiData<StrapiCustomerStory>[];
20
20
  preview: boolean;
21
+ isFallbackLocale: boolean;
21
22
  }
22
23
  export default PageProps;
@@ -1,3 +1,4 @@
1
+ import Locale from '../Locale';
1
2
  import IStrapi from './IStrapi';
2
3
  import IStrapiData from './IStrapiData';
3
4
  import StrapiBanner from './StrapiBanner';
@@ -8,6 +9,7 @@ import StrapiMetadata from './StrapiMetadata';
8
9
  import StrapiNavMenu from './StrapiNavMenu';
9
10
  import StrapiTopBanner from './StrapiTopBanner';
10
11
  interface StrapiGlobal {
12
+ locale: Locale;
11
13
  metadata: StrapiMetadata;
12
14
  favicon: IStrapi<IStrapiData<StrapiMedia>>;
13
15
  metaTitleSuffix: string;
@@ -400,34 +400,87 @@ function _taggedTemplateLiteralLoose(strings, raw) {
400
400
 
401
401
  var STRAPI_URI = process.env.NEXT_PUBLIC_STRAPI_URI || 'http://127.0.0.1:1337';
402
402
  var STRAPI_DEFAULT_PAGE_SIZE = '100';
403
+ var STRAPI_FALLBACK_LOCALE = 'en';
403
404
 
404
- process.env.NEXT_PUBLIC_API_URI || 'http://localhost:4001';
405
- var FPM_API_URI = process.env.NEXT_PUBLIC_FPM_API_URI || 'https://api.fpm.t-staging.com';
406
- var CDN_URI = 'https://cdn.tree.ly';
407
-
408
- var fpmClient = /*#__PURE__*/axiosCacheInterceptor.setupCache( /*#__PURE__*/axios__default.default.create({
409
- baseURL: FPM_API_URI + "/v1",
405
+ var strapiClient = /*#__PURE__*/axiosCacheInterceptor.setupCache( /*#__PURE__*/axios__default.default.create({
406
+ baseURL: STRAPI_URI + "/api",
410
407
  paramsSerializer: function paramsSerializer(p) {
411
408
  return qs__default.default.stringify(p, {
412
409
  encodeValuesOnly: true
413
410
  });
414
411
  },
415
- timeout: 5000
412
+ timeout: 60000
416
413
  }));
417
414
 
418
- var strapiClient = /*#__PURE__*/axiosCacheInterceptor.setupCache( /*#__PURE__*/axios__default.default.create({
419
- baseURL: STRAPI_URI + "/api",
415
+ var getAllSlugsFromStrapi = /*#__PURE__*/function () {
416
+ var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(path, locales, _temp) {
417
+ var _ref2, _ref2$filters, filters, params, _yield$strapiClient$g, data, slugs, fallBackSlugs, nonFallbackSlugs;
418
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
419
+ while (1) switch (_context.prev = _context.next) {
420
+ case 0:
421
+ _ref2 = _temp === void 0 ? {
422
+ filters: {}
423
+ } : _temp, _ref2$filters = _ref2.filters, filters = _ref2$filters === void 0 ? {} : _ref2$filters;
424
+ params = {
425
+ locale: 'all',
426
+ 'pagination[pageSize]': STRAPI_DEFAULT_PAGE_SIZE,
427
+ filters: filters
428
+ };
429
+ _context.next = 4;
430
+ return strapiClient.get(path, {
431
+ params: params
432
+ });
433
+ case 4:
434
+ _yield$strapiClient$g = _context.sent;
435
+ data = _yield$strapiClient$g.data;
436
+ slugs = data.data.map(function (page) {
437
+ return {
438
+ slug: page.attributes.slug,
439
+ locale: page.attributes.locale
440
+ };
441
+ });
442
+ fallBackSlugs = locales.flatMap(function (locale) {
443
+ return slugs.filter(function (slug) {
444
+ return slug.locale === STRAPI_FALLBACK_LOCALE;
445
+ }).map(function (slug) {
446
+ return _extends({}, slug, {
447
+ locale: locale
448
+ });
449
+ });
450
+ });
451
+ nonFallbackSlugs = slugs.filter(function (p) {
452
+ return p.locale !== STRAPI_FALLBACK_LOCALE;
453
+ });
454
+ return _context.abrupt("return", [].concat(fallBackSlugs, nonFallbackSlugs));
455
+ case 10:
456
+ case "end":
457
+ return _context.stop();
458
+ }
459
+ }, _callee);
460
+ }));
461
+ return function getAllSlugsFromStrapi(_x, _x2, _x3) {
462
+ return _ref.apply(this, arguments);
463
+ };
464
+ }();
465
+
466
+ process.env.NEXT_PUBLIC_API_URI || 'http://localhost:4001';
467
+ var FPM_API_URI = process.env.NEXT_PUBLIC_FPM_API_URI || 'https://api.fpm.t-staging.com';
468
+ var CDN_URI = 'https://cdn.tree.ly';
469
+
470
+ var fpmClient = /*#__PURE__*/axiosCacheInterceptor.setupCache( /*#__PURE__*/axios__default.default.create({
471
+ baseURL: FPM_API_URI + "/v1",
420
472
  paramsSerializer: function paramsSerializer(p) {
421
473
  return qs__default.default.stringify(p, {
422
474
  encodeValuesOnly: true
423
475
  });
424
476
  },
425
- timeout: 60000
477
+ timeout: 5000
426
478
  }));
427
479
 
480
+ var FALLBACK_LOCALE = 'en';
428
481
  var getPortfolioProjects = /*#__PURE__*/function () {
429
482
  var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(locale, preview) {
430
- var params, _yield$Promise$all, fpmProjects, strapiProjects;
483
+ var params, _yield$Promise$all, fpmProjects, strapiProjectsLocalized, strapiProjectsEnglish, strapiProjects, _i, _arr, project;
431
484
  return _regeneratorRuntime().wrap(function _callee$(_context) {
432
485
  while (1) switch (_context.prev = _context.next) {
433
486
  case 0:
@@ -448,16 +501,26 @@ var getPortfolioProjects = /*#__PURE__*/function () {
448
501
  _context.next = 6;
449
502
  return Promise.all([fpmClient.get('/public/projects'), strapiClient.get('/projects', {
450
503
  params: params
504
+ }), strapiClient.get('/projects', {
505
+ params: _extends({}, params, {
506
+ locale: FALLBACK_LOCALE
507
+ })
451
508
  })]);
452
509
  case 6:
453
510
  _yield$Promise$all = _context.sent;
454
511
  fpmProjects = _yield$Promise$all[0].data;
455
- strapiProjects = _yield$Promise$all[1].data;
512
+ strapiProjectsLocalized = _yield$Promise$all[1].data;
513
+ strapiProjectsEnglish = _yield$Promise$all[2].data;
514
+ strapiProjects = new Map();
515
+ for (_i = 0, _arr = [].concat(strapiProjectsEnglish.data, strapiProjectsLocalized.data); _i < _arr.length; _i++) {
516
+ project = _arr[_i];
517
+ if (project.attributes.fpmProjectId) {
518
+ strapiProjects.set(project.attributes.fpmProjectId, project);
519
+ }
520
+ }
456
521
  return _context.abrupt("return", fpmProjects.map(function (fpmProject) {
457
522
  var _strapiProject$attrib;
458
- var strapiProject = strapiProjects.data.find(function (sp) {
459
- return sp.attributes.fpmProjectId === fpmProject.id;
460
- });
523
+ var strapiProject = strapiProjects.get(fpmProject.id);
461
524
  var toReturn = fpmProject;
462
525
  if (strapiProject != null && strapiProject.attributes.slug) {
463
526
  toReturn.slug = strapiProject.attributes.slug;
@@ -476,7 +539,7 @@ var getPortfolioProjects = /*#__PURE__*/function () {
476
539
  }
477
540
  return toReturn;
478
541
  }));
479
- case 10:
542
+ case 13:
480
543
  case "end":
481
544
  return _context.stop();
482
545
  }
@@ -487,6 +550,7 @@ var getPortfolioProjects = /*#__PURE__*/function () {
487
550
  };
488
551
  }();
489
552
 
553
+ /** @deprecated Migrate to getAllSlugsFromStrapi */
490
554
  var getStaticPathsFromStrapi = /*#__PURE__*/function () {
491
555
  var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(path, _temp) {
492
556
  var _ref2, _ref2$filters, filters, params;
@@ -515,6 +579,7 @@ var getStaticPathsFromStrapi = /*#__PURE__*/function () {
515
579
  };
516
580
  }();
517
581
 
582
+ /** @deprecated Migrate to getStrapiSingleType or getStrapiCollectionType */
518
583
  var getStaticPropsFromStrapi = /*#__PURE__*/function () {
519
584
  var _ref2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(path, _ref) {
520
585
  var _ref$locale, locale, slug, _ref$preview, preview, _ref$filters, filters, enrichedFilters, params;
@@ -549,6 +614,106 @@ var getStaticPropsFromStrapi = /*#__PURE__*/function () {
549
614
  };
550
615
  }();
551
616
 
617
+ var getStrapiCollectionType = /*#__PURE__*/function () {
618
+ var _ref2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(path, key, _ref) {
619
+ var _ref$locale, locale, _ref$preview, preview, _ref$filters, filters, params, _yield$strapiClient$g, data, localizedResponses, fallbackResponses, responses;
620
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
621
+ while (1) switch (_context.prev = _context.next) {
622
+ case 0:
623
+ _ref$locale = _ref.locale, locale = _ref$locale === void 0 ? 'en' : _ref$locale, _ref$preview = _ref.preview, preview = _ref$preview === void 0 ? false : _ref$preview, _ref$filters = _ref.filters, filters = _ref$filters === void 0 ? {} : _ref$filters;
624
+ params = {
625
+ populate: 'deep,6',
626
+ locale: 'all',
627
+ 'pagination[pageSize]': STRAPI_DEFAULT_PAGE_SIZE,
628
+ filters: filters
629
+ };
630
+ if (preview) {
631
+ params.publicationState = 'preview';
632
+ }
633
+ _context.next = 5;
634
+ return strapiClient.get(path, {
635
+ params: params
636
+ });
637
+ case 5:
638
+ _yield$strapiClient$g = _context.sent;
639
+ data = _yield$strapiClient$g.data;
640
+ localizedResponses = data.data.filter(function (d) {
641
+ return d.attributes.locale === locale;
642
+ });
643
+ fallbackResponses = data.data.filter(function (d) {
644
+ return d.attributes.locale === STRAPI_FALLBACK_LOCALE;
645
+ });
646
+ responses = fallbackResponses.map(function (fallbackResponse) {
647
+ var localizedResponse = localizedResponses.find(function (localized) {
648
+ return localized.attributes[key] === fallbackResponse.attributes[key];
649
+ });
650
+ return localizedResponse || fallbackResponse;
651
+ });
652
+ return _context.abrupt("return", responses);
653
+ case 11:
654
+ case "end":
655
+ return _context.stop();
656
+ }
657
+ }, _callee);
658
+ }));
659
+ return function getStrapiCollectionType(_x, _x2, _x3) {
660
+ return _ref2.apply(this, arguments);
661
+ };
662
+ }();
663
+
664
+ var getStrapiSingleType = /*#__PURE__*/function () {
665
+ var _ref2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(path, _ref) {
666
+ var _ref$locale, locale, _ref$preview, preview, _ref$filters, filters, params, response, _error$response;
667
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
668
+ while (1) switch (_context.prev = _context.next) {
669
+ case 0:
670
+ _ref$locale = _ref.locale, locale = _ref$locale === void 0 ? 'en' : _ref$locale, _ref$preview = _ref.preview, preview = _ref$preview === void 0 ? false : _ref$preview, _ref$filters = _ref.filters, filters = _ref$filters === void 0 ? {} : _ref$filters;
671
+ params = {
672
+ populate: 'deep,6',
673
+ locale: locale,
674
+ 'pagination[pageSize]': STRAPI_DEFAULT_PAGE_SIZE,
675
+ filters: filters
676
+ };
677
+ if (preview) {
678
+ params.publicationState = 'preview';
679
+ }
680
+ _context.prev = 3;
681
+ _context.next = 6;
682
+ return strapiClient.get(path, {
683
+ params: params
684
+ });
685
+ case 6:
686
+ response = _context.sent;
687
+ return _context.abrupt("return", response.data.data);
688
+ case 10:
689
+ _context.prev = 10;
690
+ _context.t0 = _context["catch"](3);
691
+ if (!(_context.t0.isAxiosError && ((_error$response = _context.t0.response) == null ? void 0 : _error$response.status) === 404)) {
692
+ _context.next = 17;
693
+ break;
694
+ }
695
+ _context.next = 15;
696
+ return strapiClient.get(path, {
697
+ params: _extends({}, params, {
698
+ locale: STRAPI_FALLBACK_LOCALE
699
+ })
700
+ });
701
+ case 15:
702
+ response = _context.sent;
703
+ return _context.abrupt("return", response.data.data);
704
+ case 17:
705
+ throw _context.t0;
706
+ case 18:
707
+ case "end":
708
+ return _context.stop();
709
+ }
710
+ }, _callee, null, [[3, 10]]);
711
+ }));
712
+ return function getStrapiSingleType(_x, _x2) {
713
+ return _ref2.apply(this, arguments);
714
+ };
715
+ }();
716
+
552
717
  var strapiMediaUrl = function strapiMediaUrl(media, preferredSize) {
553
718
  if (preferredSize === void 0) {
554
719
  preferredSize = 'native';
@@ -613,7 +778,8 @@ var mergeGlobalAndStrapiBlogPostData = function mergeGlobalAndStrapiBlogPostData
613
778
  banner: global.attributes.banner,
614
779
  topBanner: (post == null ? void 0 : post.attributes.topBanner) || global.attributes.topBanner,
615
780
  customerStories: [],
616
- preview: !!context.preview
781
+ preview: !!context.preview,
782
+ isFallbackLocale: context.locale !== post.attributes.locale
617
783
  });
618
784
  };
619
785
 
@@ -652,7 +818,8 @@ var mergeGlobalAndStrapiCustomerStoryData = function mergeGlobalAndStrapiCustome
652
818
  banner: global.attributes.banner,
653
819
  topBanner: (customerStory == null ? void 0 : customerStory.attributes.topBanner) || global.attributes.topBanner,
654
820
  blogPosts: [],
655
- preview: !!context.preview
821
+ preview: !!context.preview,
822
+ isFallbackLocale: context.locale !== customerStory.attributes.locale
656
823
  });
657
824
  };
658
825
 
@@ -698,7 +865,8 @@ var mergeGlobalAndStrapiPageData = function mergeGlobalAndStrapiPageData(context
698
865
  banner: global.attributes.banner,
699
866
  topBanner: (page == null ? void 0 : page.attributes.topBanner) || global.attributes.topBanner,
700
867
  customerStories: returnCustomerStories ? customerStories : [],
701
- preview: !!context.preview
868
+ preview: !!context.preview,
869
+ isFallbackLocale: context.locale !== page.attributes.locale
702
870
  });
703
871
  };
704
872
 
@@ -741,7 +909,8 @@ var mergeGlobalAndStrapiProject = function mergeGlobalAndStrapiProject(context,
741
909
  banner: global.attributes.banner,
742
910
  topBanner: (project == null ? void 0 : project.attributes.topBanner) || global.attributes.topBanner,
743
911
  customerStories: [],
744
- preview: !!context.preview
912
+ preview: !!context.preview,
913
+ isFallbackLocale: context.locale !== project.attributes.locale
745
914
  });
746
915
  };
747
916
 
@@ -2168,6 +2337,9 @@ var CarouselInnerContainer = /*#__PURE__*/styled__default.default(framerMotion.m
2168
2337
  });
2169
2338
  var CardContainer = /*#__PURE__*/styled__default.default(boemly.Box)(_templateObject3$1 || (_templateObject3$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: var(--boemly-sizes-sm);\n\n @media screen and (max-width: ", ") {\n width: var(--boemly-sizes-2xs);\n\n margin-right: var(--boemly-space-4);\n\n &:first-of-type {\n margin-left: var(--boemly-space-6);\n }\n }\n"])), BREAKPOINT_MD);
2170
2339
 
2340
+ var _templateObject$4;
2341
+ var GLOBAL_STYLE = /*#__PURE__*/react$1.css(_templateObject$4 || (_templateObject$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n :root {\n --default-hero-height: calc(100vh - var(--boemly-space-24));\n }\n\n a {\n text-decoration: none;\n }\n"])));
2342
+
2171
2343
  var messagesDe$f = {
2172
2344
  'sections.comparison.backgroundShapes': 'Hintergrundformen'
2173
2345
  };
@@ -2406,17 +2578,20 @@ var unitMessagesEn = {
2406
2578
 
2407
2579
  var rootMessagesEn = /*#__PURE__*/_extends({}, messagesEn$c, messagesEn$7, messagesEn$3, messagesEn$4, messagesEn$2, messagesEn$d, messagesEn$b, messagesEn$a, messagesEn$9, messagesEn$8, messagesEn$6, messagesEn$5, messagesEn$1, messagesDe, messagesEn, unitMessagesEn);
2408
2580
 
2409
- var _templateObject$4;
2410
- var GLOBAL_STYLE = /*#__PURE__*/react$1.css(_templateObject$4 || (_templateObject$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n :root {\n --default-hero-height: calc(100vh - var(--boemly-space-24));\n }\n\n a {\n text-decoration: none;\n }\n"])));
2581
+ var messages = {
2582
+ en: rootMessagesEn,
2583
+ de: rootMessagesDe
2584
+ };
2585
+ var getMessages = function getMessages(locale) {
2586
+ var messagesLocale = Object.keys(messages).includes("" + locale) ? locale : STRAPI_FALLBACK_LOCALE;
2587
+ return messages[messagesLocale];
2588
+ };
2411
2589
 
2412
2590
  var cache = /*#__PURE__*/reactIntl.createIntlCache();
2413
2591
  var intlFactory = function intlFactory(locale) {
2414
2592
  return reactIntl.createIntl({
2415
2593
  locale: locale,
2416
- messages: {
2417
- de: rootMessagesDe,
2418
- en: rootMessagesEn
2419
- }[locale]
2594
+ messages: getMessages(locale)
2420
2595
  }, cache);
2421
2596
  };
2422
2597
  var IntlContext = /*#__PURE__*/React.createContext( /*#__PURE__*/intlFactory('en'));
@@ -3103,15 +3278,11 @@ var FONT_CUSTOMIZATIONS = {
3103
3278
  mono: 'SpaceMono'
3104
3279
  };
3105
3280
 
3106
- var messages = {
3107
- en: rootMessagesEn,
3108
- de: rootMessagesDe
3109
- };
3110
3281
  var MinimalProviders = function MinimalProviders(_ref) {
3111
3282
  var children = _ref.children,
3112
3283
  locale = _ref.locale;
3113
3284
  return React__default.default.createElement(reactIntl.IntlProvider, {
3114
- messages: messages[locale],
3285
+ messages: getMessages(locale),
3115
3286
  locale: locale
3116
3287
  }, React__default.default.createElement(boemly.BoemlyThemeProvider, {
3117
3288
  fonts: FONT_CUSTOMIZATIONS
@@ -5640,9 +5811,12 @@ var SliceRenderer = function SliceRenderer(_ref) {
5640
5811
  exports.PreviewAlert = PreviewAlert;
5641
5812
  exports.SEOTags = SEOTags;
5642
5813
  exports.SliceRenderer = SliceRenderer;
5814
+ exports.getAllSlugsFromStrapi = getAllSlugsFromStrapi;
5643
5815
  exports.getPortfolioProjects = getPortfolioProjects;
5644
5816
  exports.getStaticPathsFromStrapi = getStaticPathsFromStrapi;
5645
5817
  exports.getStaticPropsFromStrapi = getStaticPropsFromStrapi;
5818
+ exports.getStrapiCollectionType = getStrapiCollectionType;
5819
+ exports.getStrapiSingleType = getStrapiSingleType;
5646
5820
  exports.mergeGlobalAndStrapiBlogPostData = mergeGlobalAndStrapiBlogPostData;
5647
5821
  exports.mergeGlobalAndStrapiCustomerStoryData = mergeGlobalAndStrapiCustomerStoryData;
5648
5822
  exports.mergeGlobalAndStrapiPageData = mergeGlobalAndStrapiPageData;