@treely/strapi-slices 5.11.3 → 5.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/components/ContextProvider/ContextProvider.d.ts +1 -2
- package/dist/constants/strapi.d.ts +1 -0
- package/dist/index.d.ts +6 -3
- package/dist/integrations/strapi/getAllSlugsFromStrapi.d.ts +10 -0
- package/dist/integrations/strapi/getStaticPathsFromStrapi.d.ts +1 -0
- package/dist/integrations/strapi/getStaticPropsFromStrapi.d.ts +1 -0
- package/dist/integrations/strapi/getStrapiCollectionType.d.ts +10 -0
- package/dist/integrations/strapi/getStrapiSingleType.d.ts +8 -0
- package/dist/models/Locale.d.ts +3 -1
- package/dist/models/LocalizedEntity.d.ts +7 -0
- package/dist/models/strapi/StrapiGlobal.d.ts +2 -0
- package/dist/strapi-slices.cjs.development.js +197 -27
- 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 +197 -30
- package/dist/strapi-slices.esm.js.map +1 -1
- package/dist/utils/getMessages.d.ts +142 -0
- package/package.json +1 -1
- package/src/components/ContextProvider/ContextProvider.tsx +3 -5
- package/src/components/MinimalProviders/MinimalProviders.tsx +2 -8
- package/src/constants/strapi.ts +2 -0
- package/src/index.tsx +8 -2
- package/src/integrations/strapi/getAllSlugsFromStrapi.test.ts +33 -0
- package/src/integrations/strapi/getAllSlugsFromStrapi.ts +50 -0
- package/src/integrations/strapi/getPortfolioProjects.test.ts +24 -0
- package/src/integrations/strapi/getPortfolioProjects.ts +25 -5
- package/src/integrations/strapi/getStaticPathsFromStrapi.ts +1 -0
- package/src/integrations/strapi/getStaticPropsFromStrapi.ts +1 -0
- package/src/integrations/strapi/getStrapiCollectionType.test.ts +65 -0
- package/src/integrations/strapi/getStrapiCollectionType.ts +61 -0
- package/src/integrations/strapi/getStrapiSingleType.test.ts +53 -0
- package/src/integrations/strapi/getStrapiSingleType.ts +50 -0
- package/src/models/Locale.ts +3 -1
- package/src/models/LocalizedEntity.ts +9 -0
- package/src/models/strapi/StrapiGlobal.ts +2 -0
- package/src/test/strapiMocks/minimalGlobalData.ts +1 -0
- package/src/utils/getMessages.ts +18 -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:
|
|
5
|
+
locale: string;
|
|
7
6
|
}
|
|
8
7
|
export declare const ContextProvider: React.FC<ContextProviderProps>;
|
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,
|
|
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;
|
package/dist/models/Locale.d.ts
CHANGED
|
@@ -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
|
-
|
|
405
|
-
|
|
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:
|
|
412
|
+
timeout: 60000
|
|
416
413
|
}));
|
|
417
414
|
|
|
418
|
-
var
|
|
419
|
-
|
|
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:
|
|
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
|
-
|
|
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.
|
|
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
|
|
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';
|
|
@@ -2168,6 +2333,9 @@ var CarouselInnerContainer = /*#__PURE__*/styled__default.default(framerMotion.m
|
|
|
2168
2333
|
});
|
|
2169
2334
|
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
2335
|
|
|
2336
|
+
var _templateObject$4;
|
|
2337
|
+
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"])));
|
|
2338
|
+
|
|
2171
2339
|
var messagesDe$f = {
|
|
2172
2340
|
'sections.comparison.backgroundShapes': 'Hintergrundformen'
|
|
2173
2341
|
};
|
|
@@ -2406,17 +2574,20 @@ var unitMessagesEn = {
|
|
|
2406
2574
|
|
|
2407
2575
|
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
2576
|
|
|
2409
|
-
var
|
|
2410
|
-
|
|
2577
|
+
var messages = {
|
|
2578
|
+
en: rootMessagesEn,
|
|
2579
|
+
de: rootMessagesDe
|
|
2580
|
+
};
|
|
2581
|
+
var getMessages = function getMessages(locale) {
|
|
2582
|
+
var messagesLocale = Object.keys(messages).includes("" + locale) ? locale : STRAPI_FALLBACK_LOCALE;
|
|
2583
|
+
return messages[messagesLocale];
|
|
2584
|
+
};
|
|
2411
2585
|
|
|
2412
2586
|
var cache = /*#__PURE__*/reactIntl.createIntlCache();
|
|
2413
2587
|
var intlFactory = function intlFactory(locale) {
|
|
2414
2588
|
return reactIntl.createIntl({
|
|
2415
2589
|
locale: locale,
|
|
2416
|
-
messages:
|
|
2417
|
-
de: rootMessagesDe,
|
|
2418
|
-
en: rootMessagesEn
|
|
2419
|
-
}[locale]
|
|
2590
|
+
messages: getMessages(locale)
|
|
2420
2591
|
}, cache);
|
|
2421
2592
|
};
|
|
2422
2593
|
var IntlContext = /*#__PURE__*/React.createContext( /*#__PURE__*/intlFactory('en'));
|
|
@@ -3103,15 +3274,11 @@ var FONT_CUSTOMIZATIONS = {
|
|
|
3103
3274
|
mono: 'SpaceMono'
|
|
3104
3275
|
};
|
|
3105
3276
|
|
|
3106
|
-
var messages = {
|
|
3107
|
-
en: rootMessagesEn,
|
|
3108
|
-
de: rootMessagesDe
|
|
3109
|
-
};
|
|
3110
3277
|
var MinimalProviders = function MinimalProviders(_ref) {
|
|
3111
3278
|
var children = _ref.children,
|
|
3112
3279
|
locale = _ref.locale;
|
|
3113
3280
|
return React__default.default.createElement(reactIntl.IntlProvider, {
|
|
3114
|
-
messages:
|
|
3281
|
+
messages: getMessages(locale),
|
|
3115
3282
|
locale: locale
|
|
3116
3283
|
}, React__default.default.createElement(boemly.BoemlyThemeProvider, {
|
|
3117
3284
|
fonts: FONT_CUSTOMIZATIONS
|
|
@@ -5640,9 +5807,12 @@ var SliceRenderer = function SliceRenderer(_ref) {
|
|
|
5640
5807
|
exports.PreviewAlert = PreviewAlert;
|
|
5641
5808
|
exports.SEOTags = SEOTags;
|
|
5642
5809
|
exports.SliceRenderer = SliceRenderer;
|
|
5810
|
+
exports.getAllSlugsFromStrapi = getAllSlugsFromStrapi;
|
|
5643
5811
|
exports.getPortfolioProjects = getPortfolioProjects;
|
|
5644
5812
|
exports.getStaticPathsFromStrapi = getStaticPathsFromStrapi;
|
|
5645
5813
|
exports.getStaticPropsFromStrapi = getStaticPropsFromStrapi;
|
|
5814
|
+
exports.getStrapiCollectionType = getStrapiCollectionType;
|
|
5815
|
+
exports.getStrapiSingleType = getStrapiSingleType;
|
|
5646
5816
|
exports.mergeGlobalAndStrapiBlogPostData = mergeGlobalAndStrapiBlogPostData;
|
|
5647
5817
|
exports.mergeGlobalAndStrapiCustomerStoryData = mergeGlobalAndStrapiCustomerStoryData;
|
|
5648
5818
|
exports.mergeGlobalAndStrapiPageData = mergeGlobalAndStrapiPageData;
|