@treely/strapi-slices 5.17.4 → 6.0.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@treely/strapi-slices",
3
- "version": "5.17.4",
3
+ "version": "6.0.1",
4
4
  "license": "MIT",
5
5
  "author": "Tree.ly FlexCo",
6
6
  "description": "@treely/strapi-slices is a open source library maintained by Tree.ly.",
@@ -23,25 +23,25 @@ const CreditsAvailableBadge = ({
23
23
  message: formatMessage({
24
24
  id: 'components.creditsAvailableBadge.text.yes',
25
25
  }),
26
- color: 'var(--boemly-colors-primary-800)',
26
+ color: 'green.600',
27
27
  },
28
28
  [CreditAvailability.NO_CREDITS_AVAILABLE]: {
29
29
  message: formatMessage({
30
30
  id: 'components.creditsAvailableBadge.text.no',
31
31
  }),
32
- color: 'var(--boemly-colors-red-600)',
32
+ color: 'red.600',
33
33
  },
34
34
  [CreditAvailability.SOME_CREDITS_AVAILABLE]: {
35
35
  message: formatMessage({
36
36
  id: 'components.creditsAvailableBadge.text.some',
37
37
  }),
38
- color: 'var(--boemly-colors-orange-500)',
38
+ color: 'orange.500',
39
39
  },
40
40
  [CreditAvailability.SOON_CREDITS_AVAILABLE]: {
41
41
  message: formatMessage({
42
42
  id: 'components.creditsAvailableBadge.text.notYet',
43
43
  }),
44
- color: 'var(--boemly-colors-blue-500)',
44
+ color: 'blue.500',
45
45
  },
46
46
  };
47
47
 
package/src/index.tsx CHANGED
@@ -47,8 +47,6 @@ import PortfolioProject from './models/PortfolioProject';
47
47
 
48
48
  import getAllSlugsFromStrapi from './integrations/strapi/getAllSlugsFromStrapi';
49
49
  import getPortfolioProjects from './integrations/strapi/getPortfolioProjects';
50
- import getStaticPathsFromStrapi from './integrations/strapi/getStaticPathsFromStrapi';
51
- import getStaticPropsFromStrapi from './integrations/strapi/getStaticPropsFromStrapi';
52
50
  import getStrapiCollectionType from './integrations/strapi/getStrapiCollectionType';
53
51
  import getStrapiSingleType from './integrations/strapi/getStrapiSingleType';
54
52
 
@@ -75,8 +73,6 @@ export {
75
73
  // Integrations
76
74
  getAllSlugsFromStrapi,
77
75
  getPortfolioProjects,
78
- getStaticPathsFromStrapi,
79
- getStaticPropsFromStrapi,
80
76
  getStrapiCollectionType,
81
77
  getStrapiSingleType,
82
78
  };
@@ -1,7 +0,0 @@
1
- import { AxiosResponse } from 'axios';
2
- interface Options {
3
- filters?: Record<string, any>;
4
- }
5
- /** @deprecated Migrate to getAllSlugsFromStrapi */
6
- declare const getStaticPathsFromStrapi: (path: string, { filters }?: Options) => Promise<AxiosResponse>;
7
- export default getStaticPathsFromStrapi;
@@ -1,10 +0,0 @@
1
- import { AxiosResponse } from 'axios';
2
- interface Options {
3
- locale?: string;
4
- slug?: string;
5
- preview?: boolean;
6
- filters?: Record<string, any>;
7
- }
8
- /** @deprecated Migrate to getStrapiSingleType or getStrapiCollectionType */
9
- declare const getStaticPropsFromStrapi: (path: string, { locale, slug, preview, filters }: Options) => Promise<AxiosResponse>;
10
- export default getStaticPropsFromStrapi;
@@ -1,22 +0,0 @@
1
- import MockAxios from 'jest-mock-axios';
2
- import getStaticPathsFromStrapi from './getStaticPathsFromStrapi';
3
- import { strapiProjectMock } from '../../test/strapiMocks/strapiProject';
4
-
5
- describe('The getStaticPathsFromStrapi function', () => {
6
- afterEach(() => {
7
- MockAxios.reset();
8
- });
9
-
10
- it('returns the data from Strapi', async () => {
11
- const resultPromise = getStaticPathsFromStrapi('/projects');
12
-
13
- MockAxios.mockResponseFor(
14
- { url: '/projects' },
15
- { data: [strapiProjectMock] }
16
- );
17
-
18
- const result = await resultPromise;
19
-
20
- expect(result.data).toStrictEqual([strapiProjectMock]);
21
- });
22
- });
@@ -1,23 +0,0 @@
1
- import { AxiosResponse } from 'axios';
2
- import strapiClient from './strapiClient';
3
- import { STRAPI_DEFAULT_PAGE_SIZE } from '../../constants/strapi';
4
-
5
- interface Options {
6
- filters?: Record<string, any>;
7
- }
8
-
9
- /** @deprecated Migrate to getAllSlugsFromStrapi */
10
- const getStaticPathsFromStrapi = async (
11
- path: string,
12
- { filters = {} }: Options = { filters: {} }
13
- ): Promise<AxiosResponse> => {
14
- const params: Record<string, any> = {
15
- locale: 'all',
16
- 'pagination[pageSize]': STRAPI_DEFAULT_PAGE_SIZE,
17
- filters,
18
- };
19
-
20
- return strapiClient.get(path, { params });
21
- };
22
-
23
- export default getStaticPathsFromStrapi;
@@ -1,72 +0,0 @@
1
- import MockAxios from 'jest-mock-axios';
2
- import getStaticPropsFromStrapi from './getStaticPropsFromStrapi';
3
- import { strapiProjectMock } from '../../test/strapiMocks/strapiProject';
4
-
5
- describe('The getStaticPropsFromStrapi function', () => {
6
- afterEach(() => {
7
- MockAxios.reset();
8
- });
9
-
10
- it('returns the data from Strapi', async () => {
11
- const resultPromise = getStaticPropsFromStrapi('/projects', {
12
- locale: 'en',
13
- });
14
-
15
- MockAxios.mockResponseFor(
16
- { url: '/projects' },
17
- { data: [strapiProjectMock] }
18
- );
19
-
20
- const result = await resultPromise;
21
-
22
- expect(result.data).toStrictEqual([strapiProjectMock]);
23
- });
24
-
25
- it('returns the data from Strapi filtered by a slug', async () => {
26
- const resultPromise = getStaticPropsFromStrapi('/projects', {
27
- locale: 'en',
28
- slug: 'test',
29
- });
30
-
31
- MockAxios.mockResponseFor(
32
- { url: '/projects' },
33
- { data: [strapiProjectMock] }
34
- );
35
-
36
- const result = await resultPromise;
37
-
38
- expect(result.data).toStrictEqual([strapiProjectMock]);
39
- });
40
-
41
- it('returns the data from Strapi filtered by any other filter', async () => {
42
- const resultPromise = getStaticPropsFromStrapi('/projects', {
43
- locale: 'en',
44
- filters: { test: 'test' },
45
- });
46
-
47
- MockAxios.mockResponseFor(
48
- { url: '/projects' },
49
- { data: [strapiProjectMock] }
50
- );
51
-
52
- const result = await resultPromise;
53
-
54
- expect(result.data).toStrictEqual([strapiProjectMock]);
55
- });
56
-
57
- it('returns the data from Strapi in preview mode', async () => {
58
- const resultPromise = getStaticPropsFromStrapi('/projects', {
59
- locale: 'en',
60
- preview: true,
61
- });
62
-
63
- MockAxios.mockResponseFor(
64
- { url: '/projects' },
65
- { data: [strapiProjectMock] }
66
- );
67
-
68
- const result = await resultPromise;
69
-
70
- expect(result.data).toStrictEqual([strapiProjectMock]);
71
- });
72
- });
@@ -1,38 +0,0 @@
1
- import { AxiosResponse } from 'axios';
2
- import strapiClient from './strapiClient';
3
- import { STRAPI_DEFAULT_PAGE_SIZE } from '../../constants/strapi';
4
-
5
- interface Options {
6
- locale?: string;
7
- slug?: string;
8
- preview?: boolean;
9
- filters?: Record<string, any>;
10
- }
11
-
12
- /** @deprecated Migrate to getStrapiSingleType or getStrapiCollectionType */
13
- const getStaticPropsFromStrapi = async (
14
- path: string,
15
- { locale = 'en', slug, preview = false, filters = {} }: Options
16
- ): Promise<AxiosResponse> => {
17
- const cache = preview ? false : undefined;
18
- const enrichedFilters: Record<string, string> = filters;
19
-
20
- if (slug) {
21
- enrichedFilters.slug = slug;
22
- }
23
-
24
- const params: Record<string, any> = {
25
- populate: 'deep,6',
26
- locale,
27
- 'pagination[pageSize]': STRAPI_DEFAULT_PAGE_SIZE,
28
- filters: enrichedFilters,
29
- };
30
-
31
- if (preview) {
32
- params.publicationState = 'preview';
33
- }
34
-
35
- return strapiClient.get(path, { params, cache });
36
- };
37
-
38
- export default getStaticPropsFromStrapi;