@treely/strapi-slices 7.5.3 → 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.
@@ -1,3 +1,4 @@
1
1
  export declare const STRAPI_URI: string;
2
2
  export declare const STRAPI_DEFAULT_PAGE_SIZE = "100";
3
+ export declare const STRAPI_DEFAULT_POPULATE_DEPTH = "4";
3
4
  export declare const STRAPI_FALLBACK_LOCALE = "en";
@@ -390,6 +390,7 @@ function _taggedTemplateLiteralLoose(e, t) {
390
390
 
391
391
  var STRAPI_URI = process.env.NEXT_PUBLIC_STRAPI_URI || 'http://127.0.0.1:1337';
392
392
  var STRAPI_DEFAULT_PAGE_SIZE = '100';
393
+ var STRAPI_DEFAULT_POPULATE_DEPTH = '4';
393
394
  var STRAPI_FALLBACK_LOCALE = 'en';
394
395
 
395
396
  var strapiClient = /*#__PURE__*/axiosCacheInterceptor.setupCache(/*#__PURE__*/axios__default.default.create({
@@ -501,14 +502,12 @@ var getPortfolioProjects = /*#__PURE__*/function () {
501
502
  }
502
503
  cache = preview ? false : undefined;
503
504
  params = {
504
- pLevel: '6',
505
+ pLevel: STRAPI_DEFAULT_POPULATE_DEPTH,
505
506
  locale: locale,
506
- 'pagination[pageSize]': STRAPI_DEFAULT_PAGE_SIZE
507
+ 'pagination[pageSize]': STRAPI_DEFAULT_PAGE_SIZE,
508
+ status: preview ? 'draft' : 'published'
507
509
  };
508
- if (preview) {
509
- params.publicationState = 'preview';
510
- }
511
- _context.next = 7;
510
+ _context.next = 6;
512
511
  return Promise.all([fpmClient.get('/public/projects', {
513
512
  cache: cache
514
513
  }), strapiClient.get('/projects', {
@@ -520,7 +519,7 @@ var getPortfolioProjects = /*#__PURE__*/function () {
520
519
  }),
521
520
  cache: cache
522
521
  })]);
523
- case 7:
522
+ case 6:
524
523
  _yield$Promise$all = _context.sent;
525
524
  fpmProjects = _yield$Promise$all[0].data;
526
525
  strapiProjectsLocalized = _yield$Promise$all[1].data;
@@ -547,7 +546,7 @@ var getPortfolioProjects = /*#__PURE__*/function () {
547
546
  }
548
547
  return toReturn;
549
548
  }));
550
- case 14:
549
+ case 13:
551
550
  case "end":
552
551
  return _context.stop();
553
552
  }
@@ -566,13 +565,12 @@ var getStrapiCollectionType = /*#__PURE__*/function () {
566
565
  case 0:
567
566
  _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;
568
567
  cache = preview ? false : undefined;
569
- sharedParams = _extends({
570
- pLevel: '6',
568
+ sharedParams = {
569
+ pLevel: STRAPI_DEFAULT_POPULATE_DEPTH,
571
570
  'pagination[pageSize]': STRAPI_DEFAULT_PAGE_SIZE,
572
- filters: filters
573
- }, preview ? {
574
- publicationState: 'preview'
575
- } : {});
571
+ filters: filters,
572
+ status: preview ? 'draft' : 'published'
573
+ };
576
574
  _context.next = 5;
577
575
  return strapiClient.get(path, {
578
576
  params: _extends({}, sharedParams, {
@@ -638,47 +636,45 @@ var getStrapiSingleType = /*#__PURE__*/function () {
638
636
  _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;
639
637
  cache = preview ? false : undefined;
640
638
  params = {
641
- pLevel: '6',
639
+ pLevel: STRAPI_DEFAULT_POPULATE_DEPTH,
642
640
  locale: locale,
643
641
  'pagination[pageSize]': STRAPI_DEFAULT_PAGE_SIZE,
644
- filters: filters
642
+ filters: filters,
643
+ status: preview ? 'draft' : 'published'
645
644
  };
646
- if (preview) {
647
- params.publicationState = 'preview';
648
- }
649
- _context.prev = 4;
650
- _context.next = 7;
645
+ _context.prev = 3;
646
+ _context.next = 6;
651
647
  return strapiClient.get(path, {
652
648
  params: params,
653
649
  cache: cache
654
650
  });
655
- case 7:
651
+ case 6:
656
652
  response = _context.sent;
657
653
  return _context.abrupt("return", response.data.data);
658
- case 11:
659
- _context.prev = 11;
660
- _context.t0 = _context["catch"](4);
654
+ case 10:
655
+ _context.prev = 10;
656
+ _context.t0 = _context["catch"](3);
661
657
  if (!(_context.t0.isAxiosError && ((_error$response = _context.t0.response) == null ? void 0 : _error$response.status) === 404)) {
662
- _context.next = 18;
658
+ _context.next = 17;
663
659
  break;
664
660
  }
665
- _context.next = 16;
661
+ _context.next = 15;
666
662
  return strapiClient.get(path, {
667
663
  params: _extends({}, params, {
668
664
  locale: STRAPI_FALLBACK_LOCALE
669
665
  }),
670
666
  cache: cache
671
667
  });
672
- case 16:
668
+ case 15:
673
669
  response = _context.sent;
674
670
  return _context.abrupt("return", response.data.data);
675
- case 18:
671
+ case 17:
676
672
  throw _context.t0;
677
- case 19:
673
+ case 18:
678
674
  case "end":
679
675
  return _context.stop();
680
676
  }
681
- }, _callee, null, [[4, 11]]);
677
+ }, _callee, null, [[3, 10]]);
682
678
  }));
683
679
  return function getStrapiSingleType(_x, _x2) {
684
680
  return _ref2.apply(this, arguments);
@@ -6188,7 +6184,7 @@ var Events = function Events(_ref) {
6188
6184
  url.searchParams.append('pagination[limit]', batchSize.toString());
6189
6185
  url.searchParams.append(startFilter, now);
6190
6186
  url.searchParams.append('locale', locale);
6191
- url.searchParams.append('pLevel', '6');
6187
+ url.searchParams.append('pLevel', STRAPI_DEFAULT_POPULATE_DEPTH);
6192
6188
  if (sort[0] === Sort.OLDEST_FIRST) {
6193
6189
  url.searchParams.append('sort', 'start:asc');
6194
6190
  } else {
@@ -6255,7 +6251,7 @@ var Events = function Events(_ref) {
6255
6251
  case 0:
6256
6252
  url = new URL("/treely-events", STRAPI_URI);
6257
6253
  url.searchParams.append('locale', locale);
6258
- url.searchParams.append('pLevel', '6');
6254
+ url.searchParams.append('pLevel', STRAPI_DEFAULT_POPULATE_DEPTH);
6259
6255
  _context.next = 5;
6260
6256
  return fetch(STRAPI_URI + "/api/treely-events" + url.search, {
6261
6257
  headers: {