@treely/strapi-slices 7.4.2 → 7.5.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.
Files changed (56) hide show
  1. package/dist/components/PreviewAlert/PreviewAlert.stories.d.ts +2 -2
  2. package/dist/integrations/strapi/getAvailableLocalesFromStrapi.d.ts +2 -0
  3. package/dist/slices/BlogCards/BlogCards.stories.d.ts +4 -4
  4. package/dist/slices/CarouselMarqueeBanner/CarouselMarqueeBanner.stories.d.ts +3 -3
  5. package/dist/slices/Comparison/Comparison.stories.d.ts +5 -5
  6. package/dist/slices/Cta/Cta.stories.d.ts +8 -8
  7. package/dist/slices/CtaOnly/CtaOnly.stories.d.ts +2 -2
  8. package/dist/slices/CustomerStories/CustomerStories.stories.d.ts +5 -5
  9. package/dist/slices/Events/Events.stories.d.ts +3 -3
  10. package/dist/slices/Facts/Facts.stories.d.ts +6 -6
  11. package/dist/slices/FullWidthHighlightQuote/FullWidthHighlightQuote.stories.d.ts +3 -3
  12. package/dist/slices/FullWidthImage/FullWidthImage.stories.d.ts +4 -4
  13. package/dist/slices/FullWidthImageSlider/FullWidthImageSlider.stories.d.ts +2 -2
  14. package/dist/slices/Glossary/Glossary.stories.d.ts +2 -2
  15. package/dist/slices/Hero/Hero.stories.d.ts +8 -8
  16. package/dist/slices/IconGrid/IconGrid.stories.d.ts +4 -4
  17. package/dist/slices/ImageGrid/ImageGrid.stories.d.ts +4 -4
  18. package/dist/slices/ImageTextSequence/ImageTextSequence.stories.d.ts +6 -6
  19. package/dist/slices/LeftTextRightCard/LeftTextRightCard.stories.d.ts +7 -7
  20. package/dist/slices/LinkCardsGrid/LinkCardsGrid.stories.d.ts +4 -4
  21. package/dist/slices/LogoGridWithText/LogoGridWithText.stories.d.ts +5 -5
  22. package/dist/slices/MapHero/MapHero.stories.d.ts +7 -7
  23. package/dist/slices/ProjectFacts/ProjectFacts.stories.d.ts +7 -7
  24. package/dist/slices/ProjectsGrid/ProjectsGrid.stories.d.ts +4 -4
  25. package/dist/slices/ProjectsMap/ProjectsMap.stories.d.ts +5 -5
  26. package/dist/slices/QAndA/QAndA.stories.d.ts +6 -6
  27. package/dist/slices/QuoteCards/QuoteCards.stories.d.ts +7 -7
  28. package/dist/slices/RichTextSection/RichTextSection.stories.d.ts +2 -2
  29. package/dist/slices/ShopCheckout/ShopCheckout.stories.d.ts +7 -7
  30. package/dist/slices/SideBySideImages/SideBySideImages.stories.d.ts +2 -2
  31. package/dist/slices/SmallHero/SmallHero.stories.d.ts +10 -10
  32. package/dist/slices/Steps/Steps.stories.d.ts +6 -6
  33. package/dist/slices/TextCardGrid/TextCardGrid.stories.d.ts +7 -7
  34. package/dist/slices/TextCarousel/TextCarousel.stories.d.ts +7 -7
  35. package/dist/slices/TextWithCard/TextWithCard.stories.d.ts +9 -9
  36. package/dist/slices/TextWithTextCards/TextWithTextCards.stories.d.ts +6 -6
  37. package/dist/slices/Timeline/Timeline.stories.d.ts +8 -8
  38. package/dist/slices/Video/Video.stories.d.ts +2 -2
  39. package/dist/strapi-slices.cjs.development.js +166 -130
  40. package/dist/strapi-slices.cjs.development.js.map +1 -1
  41. package/dist/strapi-slices.cjs.production.min.js +1 -1
  42. package/dist/strapi-slices.cjs.production.min.js.map +1 -1
  43. package/dist/strapi-slices.esm.js +166 -130
  44. package/dist/strapi-slices.esm.js.map +1 -1
  45. package/package.json +17 -12
  46. package/src/integrations/strapi/getAllSlugsFromStrapi.test.ts +30 -5
  47. package/src/integrations/strapi/getAllSlugsFromStrapi.ts +39 -26
  48. package/src/integrations/strapi/getAvailableLocalesFromStrapi.test.ts +22 -0
  49. package/src/integrations/strapi/getAvailableLocalesFromStrapi.ts +8 -0
  50. package/src/integrations/strapi/getPortfolioProjects.ts +1 -1
  51. package/src/integrations/strapi/getStrapiCollectionType.test.ts +41 -10
  52. package/src/integrations/strapi/getStrapiCollectionType.ts +30 -17
  53. package/src/integrations/strapi/getStrapiSingleType.ts +1 -1
  54. package/src/integrations/strapi/strapiClient.ts +1 -0
  55. package/src/slices/Events/Events.tsx +8 -3
  56. package/src/stories/{Introduction.stories.mdx → Introduction.mdx} +1 -1
@@ -1,10 +1,10 @@
1
- declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0fc72a6d").R, import("./TextWithCard").TextWithCardProps>;
1
+ declare const _default: import("@storybook/core/csf").ComponentAnnotations<import("@storybook/react/dist/types-5617c98e").R, import("./TextWithCard").TextWithCardProps>;
2
2
  export default _default;
3
- export declare const Minimal: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("./TextWithCard").TextWithCardProps>;
4
- export declare const WithTagline: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("./TextWithCard").TextWithCardProps>;
5
- export declare const WithTaglineAndText: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("./TextWithCard").TextWithCardProps>;
6
- export declare const WithList: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("./TextWithCard").TextWithCardProps>;
7
- export declare const WithButton: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("./TextWithCard").TextWithCardProps>;
8
- export declare const WithCard: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("./TextWithCard").TextWithCardProps>;
9
- export declare const WithCardOnRight: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("./TextWithCard").TextWithCardProps>;
10
- export declare const WithProjects: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("./TextWithCard").TextWithCardProps>;
3
+ export declare const Minimal: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react/dist/types-5617c98e").R, import("./TextWithCard").TextWithCardProps>;
4
+ export declare const WithTagline: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react/dist/types-5617c98e").R, import("./TextWithCard").TextWithCardProps>;
5
+ export declare const WithTaglineAndText: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react/dist/types-5617c98e").R, import("./TextWithCard").TextWithCardProps>;
6
+ export declare const WithList: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react/dist/types-5617c98e").R, import("./TextWithCard").TextWithCardProps>;
7
+ export declare const WithButton: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react/dist/types-5617c98e").R, import("./TextWithCard").TextWithCardProps>;
8
+ export declare const WithCard: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react/dist/types-5617c98e").R, import("./TextWithCard").TextWithCardProps>;
9
+ export declare const WithCardOnRight: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react/dist/types-5617c98e").R, import("./TextWithCard").TextWithCardProps>;
10
+ export declare const WithProjects: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react/dist/types-5617c98e").R, import("./TextWithCard").TextWithCardProps>;
@@ -1,7 +1,7 @@
1
- declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0fc72a6d").R, import("./TextWithTextCards").TextWithTextCardsProps>;
1
+ declare const _default: import("@storybook/core/csf").ComponentAnnotations<import("@storybook/react/dist/types-5617c98e").R, import("./TextWithTextCards").TextWithTextCardsProps>;
2
2
  export default _default;
3
- export declare const Minimal: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("./TextWithTextCards").TextWithTextCardsProps>;
4
- export declare const WithTagline: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("./TextWithTextCards").TextWithTextCardsProps>;
5
- export declare const WithTaglineAndText: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("./TextWithTextCards").TextWithTextCardsProps>;
6
- export declare const WithContact: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("./TextWithTextCards").TextWithTextCardsProps>;
7
- export declare const WithShape: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("./TextWithTextCards").TextWithTextCardsProps>;
3
+ export declare const Minimal: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react/dist/types-5617c98e").R, import("./TextWithTextCards").TextWithTextCardsProps>;
4
+ export declare const WithTagline: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react/dist/types-5617c98e").R, import("./TextWithTextCards").TextWithTextCardsProps>;
5
+ export declare const WithTaglineAndText: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react/dist/types-5617c98e").R, import("./TextWithTextCards").TextWithTextCardsProps>;
6
+ export declare const WithContact: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react/dist/types-5617c98e").R, import("./TextWithTextCards").TextWithTextCardsProps>;
7
+ export declare const WithShape: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react/dist/types-5617c98e").R, import("./TextWithTextCards").TextWithTextCardsProps>;
@@ -1,9 +1,9 @@
1
- declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0fc72a6d").R, import("./Timeline").TimelineProps>;
1
+ declare const _default: import("@storybook/core/csf").ComponentAnnotations<import("@storybook/react/dist/types-5617c98e").R, import("./Timeline").TimelineProps>;
2
2
  export default _default;
3
- export declare const Minimal: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("./Timeline").TimelineProps>;
4
- export declare const WithTaglineAndText: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("./Timeline").TimelineProps>;
5
- export declare const WithBackgroundShapes: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("./Timeline").TimelineProps>;
6
- export declare const WithButton: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("./Timeline").TimelineProps>;
7
- export declare const WithBadgeOrLogo: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("./Timeline").TimelineProps>;
8
- export declare const WithImage: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("./Timeline").TimelineProps>;
9
- export declare const WithIcon: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("./Timeline").TimelineProps>;
3
+ export declare const Minimal: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react/dist/types-5617c98e").R, import("./Timeline").TimelineProps>;
4
+ export declare const WithTaglineAndText: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react/dist/types-5617c98e").R, import("./Timeline").TimelineProps>;
5
+ export declare const WithBackgroundShapes: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react/dist/types-5617c98e").R, import("./Timeline").TimelineProps>;
6
+ export declare const WithButton: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react/dist/types-5617c98e").R, import("./Timeline").TimelineProps>;
7
+ export declare const WithBadgeOrLogo: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react/dist/types-5617c98e").R, import("./Timeline").TimelineProps>;
8
+ export declare const WithImage: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react/dist/types-5617c98e").R, import("./Timeline").TimelineProps>;
9
+ export declare const WithIcon: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react/dist/types-5617c98e").R, import("./Timeline").TimelineProps>;
@@ -1,3 +1,3 @@
1
- declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0fc72a6d").R, import("./Video").VideoProps>;
1
+ declare const _default: import("@storybook/core/csf").ComponentAnnotations<import("@storybook/react/dist/types-5617c98e").R, import("./Video").VideoProps>;
2
2
  export default _default;
3
- export declare const Default: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("./Video").VideoProps>;
3
+ export declare const Default: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react/dist/types-5617c98e").R, import("./Video").VideoProps>;
@@ -40,6 +40,49 @@ var useEmblaCarousel__default = /*#__PURE__*/_interopDefault(useEmblaCarousel);
40
40
  var AutoScroll__default = /*#__PURE__*/_interopDefault(AutoScroll);
41
41
  var useSWRInfinite__default = /*#__PURE__*/_interopDefault(useSWRInfinite);
42
42
 
43
+ function asyncGeneratorStep(n, t, e, r, o, a, c) {
44
+ try {
45
+ var i = n[a](c),
46
+ u = i.value;
47
+ } catch (n) {
48
+ return void e(n);
49
+ }
50
+ i.done ? t(u) : Promise.resolve(u).then(r, o);
51
+ }
52
+ function _asyncToGenerator(n) {
53
+ return function () {
54
+ var t = this,
55
+ e = arguments;
56
+ return new Promise(function (r, o) {
57
+ var a = n.apply(t, e);
58
+ function _next(n) {
59
+ asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
60
+ }
61
+ function _throw(n) {
62
+ asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
63
+ }
64
+ _next(void 0);
65
+ });
66
+ };
67
+ }
68
+ function _extends() {
69
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
70
+ for (var e = 1; e < arguments.length; e++) {
71
+ var t = arguments[e];
72
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
73
+ }
74
+ return n;
75
+ }, _extends.apply(null, arguments);
76
+ }
77
+ function _objectWithoutPropertiesLoose(r, e) {
78
+ if (null == r) return {};
79
+ var t = {};
80
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
81
+ if (-1 !== e.indexOf(n)) continue;
82
+ t[n] = r[n];
83
+ }
84
+ return t;
85
+ }
43
86
  function _regeneratorRuntime() {
44
87
  _regeneratorRuntime = function () {
45
88
  return e;
@@ -148,7 +191,7 @@ function _regeneratorRuntime() {
148
191
  function makeInvokeMethod(e, r, n) {
149
192
  var o = h;
150
193
  return function (i, a) {
151
- if (o === f) throw new Error("Generator is already running");
194
+ if (o === f) throw Error("Generator is already running");
152
195
  if (o === s) {
153
196
  if ("throw" === i) throw a;
154
197
  return {
@@ -290,7 +333,7 @@ function _regeneratorRuntime() {
290
333
  } else if (c) {
291
334
  if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
292
335
  } else {
293
- if (!u) throw new Error("try statement without catch or finally");
336
+ if (!u) throw Error("try statement without catch or finally");
294
337
  if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
295
338
  }
296
339
  }
@@ -330,7 +373,7 @@ function _regeneratorRuntime() {
330
373
  return o;
331
374
  }
332
375
  }
333
- throw new Error("illegal catch attempt");
376
+ throw Error("illegal catch attempt");
334
377
  },
335
378
  delegateYield: function (e, r, n) {
336
379
  return this.delegate = {
@@ -341,76 +384,19 @@ function _regeneratorRuntime() {
341
384
  }
342
385
  }, e;
343
386
  }
344
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
345
- try {
346
- var info = gen[key](arg);
347
- var value = info.value;
348
- } catch (error) {
349
- reject(error);
350
- return;
351
- }
352
- if (info.done) {
353
- resolve(value);
354
- } else {
355
- Promise.resolve(value).then(_next, _throw);
356
- }
357
- }
358
- function _asyncToGenerator(fn) {
359
- return function () {
360
- var self = this,
361
- args = arguments;
362
- return new Promise(function (resolve, reject) {
363
- var gen = fn.apply(self, args);
364
- function _next(value) {
365
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
366
- }
367
- function _throw(err) {
368
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
369
- }
370
- _next(undefined);
371
- });
372
- };
373
- }
374
- function _extends() {
375
- _extends = Object.assign ? Object.assign.bind() : function (target) {
376
- for (var i = 1; i < arguments.length; i++) {
377
- var source = arguments[i];
378
- for (var key in source) {
379
- if (Object.prototype.hasOwnProperty.call(source, key)) {
380
- target[key] = source[key];
381
- }
382
- }
383
- }
384
- return target;
385
- };
386
- return _extends.apply(this, arguments);
387
- }
388
- function _objectWithoutPropertiesLoose(source, excluded) {
389
- if (source == null) return {};
390
- var target = {};
391
- var sourceKeys = Object.keys(source);
392
- var key, i;
393
- for (i = 0; i < sourceKeys.length; i++) {
394
- key = sourceKeys[i];
395
- if (excluded.indexOf(key) >= 0) continue;
396
- target[key] = source[key];
397
- }
398
- return target;
399
- }
400
- function _taggedTemplateLiteralLoose(strings, raw) {
401
- if (!raw) {
402
- raw = strings.slice(0);
403
- }
404
- strings.raw = raw;
405
- return strings;
387
+ function _taggedTemplateLiteralLoose(e, t) {
388
+ return t || (t = e.slice(0)), e.raw = t, e;
406
389
  }
407
390
 
408
391
  var STRAPI_URI = process.env.NEXT_PUBLIC_STRAPI_URI || 'http://127.0.0.1:1337';
409
392
  var STRAPI_DEFAULT_PAGE_SIZE = '100';
410
393
  var STRAPI_FALLBACK_LOCALE = 'en';
411
394
 
412
- var strapiClient = /*#__PURE__*/axiosCacheInterceptor.setupCache( /*#__PURE__*/axios__default.default.create({
395
+ var strapiClient = /*#__PURE__*/axiosCacheInterceptor.setupCache(/*#__PURE__*/axios__default.default.create({
413
396
  baseURL: STRAPI_URI + "/api",
397
+ headers: {
398
+ 'Strapi-Response-Format': 'v4'
399
+ },
414
400
  paramsSerializer: function paramsSerializer(p) {
415
401
  return qs__default.default.stringify(p, {
416
402
  encodeValuesOnly: true
@@ -421,47 +407,81 @@ var strapiClient = /*#__PURE__*/axiosCacheInterceptor.setupCache( /*#__PURE__*/a
421
407
  ttl: /*#__PURE__*/STRAPI_URI.includes('127.0.0.1') || /*#__PURE__*/STRAPI_URI.includes('localhost') ? 0 : 10 * 60 * 1000 // 10 minutes
422
408
  });
423
409
 
410
+ var getAvailableLocalesFromStrapi = /*#__PURE__*/function () {
411
+ var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
412
+ var _yield$strapiClient$g, data;
413
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
414
+ while (1) switch (_context.prev = _context.next) {
415
+ case 0:
416
+ _context.next = 2;
417
+ return strapiClient.get('/i18n/locales');
418
+ case 2:
419
+ _yield$strapiClient$g = _context.sent;
420
+ data = _yield$strapiClient$g.data;
421
+ return _context.abrupt("return", data.map(function (locale) {
422
+ return locale.code;
423
+ }));
424
+ case 5:
425
+ case "end":
426
+ return _context.stop();
427
+ }
428
+ }, _callee);
429
+ }));
430
+ return function getAvailableLocalesFromStrapi() {
431
+ return _ref.apply(this, arguments);
432
+ };
433
+ }();
434
+
424
435
  var getAllSlugsFromStrapi = /*#__PURE__*/function () {
425
- var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(path, locales, _temp) {
426
- var _ref2, _ref2$filters, filters, params, _yield$strapiClient$g, data, slugs, fallBackSlugs, nonFallbackSlugs;
436
+ var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(path, locales, _temp) {
437
+ var _ref2, _ref2$filters, filters, allLocales, slugPromises, slugResults, allSlugs, missingLocales;
427
438
  return _regeneratorRuntime().wrap(function _callee$(_context) {
428
439
  while (1) switch (_context.prev = _context.next) {
429
440
  case 0:
430
441
  _ref2 = _temp === void 0 ? {
431
442
  filters: {}
432
443
  } : _temp, _ref2$filters = _ref2.filters, filters = _ref2$filters === void 0 ? {} : _ref2$filters;
433
- params = {
434
- locale: 'all',
435
- 'pagination[pageSize]': STRAPI_DEFAULT_PAGE_SIZE,
436
- filters: filters
437
- };
438
- _context.next = 4;
439
- return strapiClient.get(path, {
440
- params: params
441
- });
442
- case 4:
443
- _yield$strapiClient$g = _context.sent;
444
- data = _yield$strapiClient$g.data;
445
- slugs = data.data.map(function (page) {
446
- return {
447
- slug: page.attributes.slug,
448
- locale: page.attributes.locale
444
+ _context.next = 3;
445
+ return getAvailableLocalesFromStrapi();
446
+ case 3:
447
+ allLocales = _context.sent;
448
+ slugPromises = allLocales.map(function (locale) {
449
+ var params = {
450
+ locale: locale,
451
+ 'pagination[pageSize]': STRAPI_DEFAULT_PAGE_SIZE,
452
+ filters: filters
449
453
  };
454
+ return strapiClient.get(path, {
455
+ params: params
456
+ });
450
457
  });
451
- fallBackSlugs = locales.flatMap(function (locale) {
452
- return slugs.filter(function (slug) {
458
+ _context.next = 7;
459
+ return Promise.all(slugPromises);
460
+ case 7:
461
+ slugResults = _context.sent;
462
+ allSlugs = slugResults.map(function (result) {
463
+ return result.data.data.map(function (page) {
464
+ return {
465
+ slug: page.attributes.slug,
466
+ locale: page.attributes.locale
467
+ };
468
+ });
469
+ }).flat(); // Identify missing locales for each slug
470
+ missingLocales = locales.flatMap(function (locale) {
471
+ return allSlugs.filter(function (slug) {
453
472
  return slug.locale === STRAPI_FALLBACK_LOCALE;
454
- }).map(function (slug) {
455
- return _extends({}, slug, {
473
+ }).filter(function (fallbackSlug) {
474
+ return !allSlugs.some(function (slug) {
475
+ return slug.slug === fallbackSlug.slug && slug.locale === locale;
476
+ });
477
+ }).map(function (fallbackSlug) {
478
+ return _extends({}, fallbackSlug, {
456
479
  locale: locale
457
480
  });
458
- });
459
- });
460
- nonFallbackSlugs = slugs.filter(function (p) {
461
- return p.locale !== STRAPI_FALLBACK_LOCALE;
481
+ }); // Clone only for missing locales
462
482
  });
463
- return _context.abrupt("return", [].concat(fallBackSlugs, nonFallbackSlugs));
464
- case 10:
483
+ return _context.abrupt("return", [].concat(allSlugs, missingLocales));
484
+ case 11:
465
485
  case "end":
466
486
  return _context.stop();
467
487
  }
@@ -476,7 +496,7 @@ process.env.NEXT_PUBLIC_API_URI || 'http://localhost:4001';
476
496
  var FPM_API_URI = process.env.NEXT_PUBLIC_FPM_API_URI || 'https://api.fpm.t-staging.com';
477
497
  var CDN_URI = 'https://cdn.tree.ly';
478
498
 
479
- var fpmClient = /*#__PURE__*/axiosCacheInterceptor.setupCache( /*#__PURE__*/axios__default.default.create({
499
+ var fpmClient = /*#__PURE__*/axiosCacheInterceptor.setupCache(/*#__PURE__*/axios__default.default.create({
480
500
  baseURL: FPM_API_URI + "/v1",
481
501
  paramsSerializer: function paramsSerializer(p) {
482
502
  return qs__default.default.stringify(p, {
@@ -490,7 +510,7 @@ var fpmClient = /*#__PURE__*/axiosCacheInterceptor.setupCache( /*#__PURE__*/axio
490
510
 
491
511
  var FALLBACK_LOCALE = 'en';
492
512
  var getPortfolioProjects = /*#__PURE__*/function () {
493
- var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(locale, preview) {
513
+ var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(locale, preview) {
494
514
  var cache, params, _yield$Promise$all, fpmProjects, strapiProjectsLocalized, strapiProjectsEnglish, strapiProjects, _i, _arr, project;
495
515
  return _regeneratorRuntime().wrap(function _callee$(_context) {
496
516
  while (1) switch (_context.prev = _context.next) {
@@ -503,7 +523,7 @@ var getPortfolioProjects = /*#__PURE__*/function () {
503
523
  }
504
524
  cache = preview ? false : undefined;
505
525
  params = {
506
- populate: 'deep,6',
526
+ pLevel: '6',
507
527
  locale: locale,
508
528
  'pagination[pageSize]': STRAPI_DEFAULT_PAGE_SIZE
509
529
  };
@@ -561,44 +581,56 @@ var getPortfolioProjects = /*#__PURE__*/function () {
561
581
  }();
562
582
 
563
583
  var getStrapiCollectionType = /*#__PURE__*/function () {
564
- var _ref2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(path, key, _ref) {
565
- var _ref$locale, locale, _ref$preview, preview, _ref$filters, filters, cache, params, _yield$strapiClient$g, data, localizedResponses, fallbackResponses, responses;
584
+ var _ref2 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(path, key, _ref) {
585
+ var _ref$locale, locale, _ref$preview, preview, _ref$filters, filters, cache, allLocales, promises, responses, results, localizedResponses, fallbackResponses, result;
566
586
  return _regeneratorRuntime().wrap(function _callee$(_context) {
567
587
  while (1) switch (_context.prev = _context.next) {
568
588
  case 0:
569
589
  _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;
570
590
  cache = preview ? false : undefined;
571
- params = {
572
- populate: 'deep,6',
573
- locale: 'all',
574
- 'pagination[pageSize]': STRAPI_DEFAULT_PAGE_SIZE,
575
- filters: filters
576
- };
577
- if (preview) {
578
- params.publicationState = 'preview';
591
+ _context.next = 4;
592
+ return getAvailableLocalesFromStrapi();
593
+ case 4:
594
+ allLocales = _context.sent;
595
+ if (!allLocales.includes(STRAPI_FALLBACK_LOCALE)) {
596
+ allLocales.push(STRAPI_FALLBACK_LOCALE);
579
597
  }
580
- _context.next = 6;
581
- return strapiClient.get(path, {
582
- params: params,
583
- cache: cache
598
+ promises = allLocales.map(function (loc) {
599
+ var params = {
600
+ pLevel: '6',
601
+ locale: loc,
602
+ 'pagination[pageSize]': STRAPI_DEFAULT_PAGE_SIZE,
603
+ filters: filters
604
+ };
605
+ if (preview) {
606
+ params.publicationState = 'preview';
607
+ }
608
+ return strapiClient.get(path, {
609
+ params: params,
610
+ cache: cache
611
+ });
584
612
  });
585
- case 6:
586
- _yield$strapiClient$g = _context.sent;
587
- data = _yield$strapiClient$g.data;
588
- localizedResponses = data.data.filter(function (d) {
613
+ _context.next = 9;
614
+ return Promise.all(promises);
615
+ case 9:
616
+ responses = _context.sent;
617
+ results = responses.flatMap(function (response) {
618
+ return response.data.data;
619
+ });
620
+ localizedResponses = results.filter(function (d) {
589
621
  return d.attributes.locale === locale;
590
622
  });
591
- fallbackResponses = data.data.filter(function (d) {
623
+ fallbackResponses = results.filter(function (d) {
592
624
  return d.attributes.locale === STRAPI_FALLBACK_LOCALE;
593
625
  });
594
- responses = fallbackResponses.map(function (fallbackResponse) {
626
+ result = fallbackResponses.map(function (fallbackResponse) {
595
627
  var localizedResponse = localizedResponses.find(function (localized) {
596
628
  return localized.attributes[key] === fallbackResponse.attributes[key];
597
629
  });
598
630
  return localizedResponse || fallbackResponse;
599
631
  });
600
- return _context.abrupt("return", responses);
601
- case 12:
632
+ return _context.abrupt("return", result);
633
+ case 15:
602
634
  case "end":
603
635
  return _context.stop();
604
636
  }
@@ -610,7 +642,7 @@ var getStrapiCollectionType = /*#__PURE__*/function () {
610
642
  }();
611
643
 
612
644
  var getStrapiSingleType = /*#__PURE__*/function () {
613
- var _ref2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(path, _ref) {
645
+ var _ref2 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(path, _ref) {
614
646
  var _ref$locale, locale, _ref$preview, preview, _ref$filters, filters, cache, params, response, _error$response;
615
647
  return _regeneratorRuntime().wrap(function _callee$(_context) {
616
648
  while (1) switch (_context.prev = _context.next) {
@@ -618,7 +650,7 @@ var getStrapiSingleType = /*#__PURE__*/function () {
618
650
  _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;
619
651
  cache = preview ? false : undefined;
620
652
  params = {
621
- populate: 'deep,6',
653
+ pLevel: '6',
622
654
  locale: locale,
623
655
  'pagination[pageSize]': STRAPI_DEFAULT_PAGE_SIZE,
624
656
  filters: filters
@@ -2589,12 +2621,12 @@ var intlFactory = function intlFactory(locale) {
2589
2621
  messages: getMessages(locale)
2590
2622
  }, cache);
2591
2623
  };
2592
- var IntlContext = /*#__PURE__*/React.createContext( /*#__PURE__*/intlFactory('en'));
2624
+ var IntlContext = /*#__PURE__*/React.createContext(/*#__PURE__*/intlFactory('en'));
2593
2625
  var ContextProvider = function ContextProvider(_ref) {
2594
2626
  var children = _ref.children,
2595
2627
  locale = _ref.locale;
2596
2628
  var fetcher = /*#__PURE__*/function () {
2597
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(resource, init) {
2629
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(resource, init) {
2598
2630
  var response, errorData;
2599
2631
  return _regeneratorRuntime().wrap(function _callee$(_context) {
2600
2632
  while (1) switch (_context.prev = _context.next) {
@@ -4166,7 +4198,7 @@ var Glossary = function Glossary(_ref) {
4166
4198
  grouped[index].push(curr.attributes);
4167
4199
  }, {});
4168
4200
  var handleAnchorClick = /*#__PURE__*/function () {
4169
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(slug) {
4201
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(slug) {
4170
4202
  var _window;
4171
4203
  var currentUrl;
4172
4204
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -4230,7 +4262,7 @@ var Glossary = function Glossary(_ref) {
4230
4262
  id: 'sections.glossary.copyButtonLabel'
4231
4263
  }),
4232
4264
  onClick: function () {
4233
- var _onClick = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
4265
+ var _onClick = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
4234
4266
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
4235
4267
  while (1) switch (_context2.prev = _context2.next) {
4236
4268
  case 0:
@@ -4685,7 +4717,7 @@ var SmallCheckout = function SmallCheckout(_ref) {
4685
4717
  return errors;
4686
4718
  }, [currency, locale]);
4687
4719
  var onSubmit = /*#__PURE__*/function () {
4688
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref2) {
4720
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref2) {
4689
4721
  var contributionValueCurrency, checkoutURL, currentURL;
4690
4722
  return _regeneratorRuntime().wrap(function _callee$(_context) {
4691
4723
  while (1) switch (_context.prev = _context.next) {
@@ -6168,7 +6200,7 @@ var Events = function Events(_ref) {
6168
6200
  url.searchParams.append('pagination[limit]', batchSize.toString());
6169
6201
  url.searchParams.append(startFilter, now);
6170
6202
  url.searchParams.append('locale', locale);
6171
- url.searchParams.append('populate', 'deep,6');
6203
+ url.searchParams.append('pLevel', '6');
6172
6204
  if (sort[0] === Sort.OLDEST_FIRST) {
6173
6205
  url.searchParams.append('sort', 'start:asc');
6174
6206
  } else {
@@ -6228,16 +6260,20 @@ var Events = function Events(_ref) {
6228
6260
  return processEvents(pastData);
6229
6261
  }, [pastData]);
6230
6262
  // Function to fetch all possible options
6231
- var fetchAllOptions = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
6263
+ var fetchAllOptions = React.useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
6232
6264
  var url, response, data, events, allEventTypes, allLanguages;
6233
6265
  return _regeneratorRuntime().wrap(function _callee$(_context) {
6234
6266
  while (1) switch (_context.prev = _context.next) {
6235
6267
  case 0:
6236
6268
  url = new URL("/treely-events", STRAPI_URI);
6237
6269
  url.searchParams.append('locale', locale);
6238
- url.searchParams.append('populate', 'deep,6');
6270
+ url.searchParams.append('pLevel', '6');
6239
6271
  _context.next = 5;
6240
- return fetch(STRAPI_URI + "/api/treely-events" + url.search);
6272
+ return fetch(STRAPI_URI + "/api/treely-events" + url.search, {
6273
+ headers: {
6274
+ 'Strapi-Response-Format': 'v4'
6275
+ }
6276
+ });
6241
6277
  case 5:
6242
6278
  response = _context.sent;
6243
6279
  _context.next = 8;