@treely/strapi-slices 7.5.4 → 7.5.5

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": "7.5.4",
3
+ "version": "7.5.5",
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.",
@@ -2,5 +2,6 @@ export const STRAPI_URI =
2
2
  process.env.NEXT_PUBLIC_STRAPI_URI || 'http://127.0.0.1:1337';
3
3
 
4
4
  export const STRAPI_DEFAULT_PAGE_SIZE = '100';
5
+ export const STRAPI_DEFAULT_POPULATE_DEPTH = '4';
5
6
 
6
7
  export const STRAPI_FALLBACK_LOCALE = 'en';
@@ -4,7 +4,10 @@ import {
4
4
  PortfolioProject,
5
5
  StrapiProject,
6
6
  } from '../..';
7
- import { STRAPI_DEFAULT_PAGE_SIZE } from '../../constants/strapi';
7
+ import {
8
+ STRAPI_DEFAULT_PAGE_SIZE,
9
+ STRAPI_DEFAULT_POPULATE_DEPTH,
10
+ } from '../../constants/strapi';
8
11
  import FPMProject from '../../models/fpm/FPMProject';
9
12
  import fpmClient from '../fpmClient';
10
13
  import strapiClient from './strapiClient';
@@ -17,7 +20,7 @@ const getPortfolioProjects = async (
17
20
  ): Promise<PortfolioProject[]> => {
18
21
  const cache = preview ? false : undefined;
19
22
  const params: Record<string, any> = {
20
- pLevel: '6',
23
+ pLevel: STRAPI_DEFAULT_POPULATE_DEPTH,
21
24
  locale,
22
25
  'pagination[pageSize]': STRAPI_DEFAULT_PAGE_SIZE,
23
26
  status: preview ? 'draft' : 'published',
@@ -1,6 +1,7 @@
1
1
  import strapiClient from './strapiClient';
2
2
  import {
3
3
  STRAPI_DEFAULT_PAGE_SIZE,
4
+ STRAPI_DEFAULT_POPULATE_DEPTH,
4
5
  STRAPI_FALLBACK_LOCALE,
5
6
  } from '../../constants/strapi';
6
7
  import IStrapiData from '../../models/strapi/IStrapiData';
@@ -25,7 +26,7 @@ const getStrapiCollectionType = async <
25
26
  const cache = preview ? false : undefined;
26
27
 
27
28
  const sharedParams = {
28
- pLevel: '6',
29
+ pLevel: STRAPI_DEFAULT_POPULATE_DEPTH,
29
30
  'pagination[pageSize]': STRAPI_DEFAULT_PAGE_SIZE,
30
31
  filters,
31
32
  status: preview ? 'draft' : 'published',
@@ -2,6 +2,7 @@ import { AxiosResponse } from 'axios';
2
2
  import strapiClient from './strapiClient';
3
3
  import {
4
4
  STRAPI_DEFAULT_PAGE_SIZE,
5
+ STRAPI_DEFAULT_POPULATE_DEPTH,
5
6
  STRAPI_FALLBACK_LOCALE,
6
7
  } from '../../constants/strapi';
7
8
  import IStrapiData from '../../models/strapi/IStrapiData';
@@ -19,7 +20,7 @@ const getStrapiSingleType = async <T>(
19
20
  ): Promise<IStrapiData<T>> => {
20
21
  const cache = preview ? false : undefined;
21
22
  const params: Record<string, any> = {
22
- pLevel: '6',
23
+ pLevel: STRAPI_DEFAULT_POPULATE_DEPTH,
23
24
  locale,
24
25
  'pagination[pageSize]': STRAPI_DEFAULT_PAGE_SIZE,
25
26
  filters,
@@ -23,7 +23,10 @@ import React, {
23
23
  import EventCard from '../../components/EventCard';
24
24
  import { SWRInfiniteKeyLoader } from 'swr/infinite';
25
25
  import useEvents from '../../models/hooks/useEvents';
26
- import { STRAPI_URI } from '../../constants/strapi';
26
+ import {
27
+ STRAPI_DEFAULT_POPULATE_DEPTH,
28
+ STRAPI_URI,
29
+ } from '../../constants/strapi';
27
30
  import { IntlContext } from '../../components/ContextProvider';
28
31
  import { mutate } from 'swr/_internal';
29
32
  import { EventType } from '@testing-library/react';
@@ -90,7 +93,7 @@ export const Events: React.FC<EventsProps> = ({ slice }: EventsProps) => {
90
93
  url.searchParams.append('pagination[limit]', batchSize.toString());
91
94
  url.searchParams.append(startFilter, now);
92
95
  url.searchParams.append('locale', locale);
93
- url.searchParams.append('pLevel', '6');
96
+ url.searchParams.append('pLevel', STRAPI_DEFAULT_POPULATE_DEPTH);
94
97
 
95
98
  if (sort[0] === Sort.OLDEST_FIRST) {
96
99
  url.searchParams.append('sort', 'start:asc');
@@ -165,7 +168,7 @@ export const Events: React.FC<EventsProps> = ({ slice }: EventsProps) => {
165
168
  const fetchAllOptions = useCallback(async () => {
166
169
  const url = new URL(`/treely-events`, STRAPI_URI);
167
170
  url.searchParams.append('locale', locale);
168
- url.searchParams.append('pLevel', '6');
171
+ url.searchParams.append('pLevel', STRAPI_DEFAULT_POPULATE_DEPTH);
169
172
 
170
173
  const response = await fetch(
171
174
  `${STRAPI_URI}/api/treely-events${url.search}`,