@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.
- package/dist/components/PreviewAlert/PreviewAlert.stories.d.ts +2 -2
- package/dist/integrations/strapi/getAvailableLocalesFromStrapi.d.ts +2 -0
- package/dist/slices/BlogCards/BlogCards.stories.d.ts +4 -4
- package/dist/slices/CarouselMarqueeBanner/CarouselMarqueeBanner.stories.d.ts +3 -3
- package/dist/slices/Comparison/Comparison.stories.d.ts +5 -5
- package/dist/slices/Cta/Cta.stories.d.ts +8 -8
- package/dist/slices/CtaOnly/CtaOnly.stories.d.ts +2 -2
- package/dist/slices/CustomerStories/CustomerStories.stories.d.ts +5 -5
- package/dist/slices/Events/Events.stories.d.ts +3 -3
- package/dist/slices/Facts/Facts.stories.d.ts +6 -6
- package/dist/slices/FullWidthHighlightQuote/FullWidthHighlightQuote.stories.d.ts +3 -3
- package/dist/slices/FullWidthImage/FullWidthImage.stories.d.ts +4 -4
- package/dist/slices/FullWidthImageSlider/FullWidthImageSlider.stories.d.ts +2 -2
- package/dist/slices/Glossary/Glossary.stories.d.ts +2 -2
- package/dist/slices/Hero/Hero.stories.d.ts +8 -8
- package/dist/slices/IconGrid/IconGrid.stories.d.ts +4 -4
- package/dist/slices/ImageGrid/ImageGrid.stories.d.ts +4 -4
- package/dist/slices/ImageTextSequence/ImageTextSequence.stories.d.ts +6 -6
- package/dist/slices/LeftTextRightCard/LeftTextRightCard.stories.d.ts +7 -7
- package/dist/slices/LinkCardsGrid/LinkCardsGrid.stories.d.ts +4 -4
- package/dist/slices/LogoGridWithText/LogoGridWithText.stories.d.ts +5 -5
- package/dist/slices/MapHero/MapHero.stories.d.ts +7 -7
- package/dist/slices/ProjectFacts/ProjectFacts.stories.d.ts +7 -7
- package/dist/slices/ProjectsGrid/ProjectsGrid.stories.d.ts +4 -4
- package/dist/slices/ProjectsMap/ProjectsMap.stories.d.ts +5 -5
- package/dist/slices/QAndA/QAndA.stories.d.ts +6 -6
- package/dist/slices/QuoteCards/QuoteCards.stories.d.ts +7 -7
- package/dist/slices/RichTextSection/RichTextSection.stories.d.ts +2 -2
- package/dist/slices/ShopCheckout/ShopCheckout.stories.d.ts +7 -7
- package/dist/slices/SideBySideImages/SideBySideImages.stories.d.ts +2 -2
- package/dist/slices/SmallHero/SmallHero.stories.d.ts +10 -10
- package/dist/slices/Steps/Steps.stories.d.ts +6 -6
- package/dist/slices/TextCardGrid/TextCardGrid.stories.d.ts +7 -7
- package/dist/slices/TextCarousel/TextCarousel.stories.d.ts +7 -7
- package/dist/slices/TextWithCard/TextWithCard.stories.d.ts +9 -9
- package/dist/slices/TextWithTextCards/TextWithTextCards.stories.d.ts +6 -6
- package/dist/slices/Timeline/Timeline.stories.d.ts +8 -8
- package/dist/slices/Video/Video.stories.d.ts +2 -2
- package/dist/strapi-slices.cjs.development.js +166 -130
- 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 +166 -130
- package/dist/strapi-slices.esm.js.map +1 -1
- package/package.json +17 -12
- package/src/integrations/strapi/getAllSlugsFromStrapi.test.ts +30 -5
- package/src/integrations/strapi/getAllSlugsFromStrapi.ts +39 -26
- package/src/integrations/strapi/getAvailableLocalesFromStrapi.test.ts +22 -0
- package/src/integrations/strapi/getAvailableLocalesFromStrapi.ts +8 -0
- package/src/integrations/strapi/getPortfolioProjects.ts +1 -1
- package/src/integrations/strapi/getStrapiCollectionType.test.ts +41 -10
- package/src/integrations/strapi/getStrapiCollectionType.ts +30 -17
- package/src/integrations/strapi/getStrapiSingleType.ts +1 -1
- package/src/integrations/strapi/strapiClient.ts +1 -0
- package/src/slices/Events/Events.tsx +8 -3
- package/src/stories/{Introduction.stories.mdx → Introduction.mdx} +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
declare const _default: import("@storybook/
|
|
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/
|
|
4
|
-
export declare const WithTagline: import("@storybook/
|
|
5
|
-
export declare const WithTaglineAndText: import("@storybook/
|
|
6
|
-
export declare const WithList: import("@storybook/
|
|
7
|
-
export declare const WithButton: import("@storybook/
|
|
8
|
-
export declare const WithCard: import("@storybook/
|
|
9
|
-
export declare const WithCardOnRight: import("@storybook/
|
|
10
|
-
export declare const WithProjects: import("@storybook/
|
|
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/
|
|
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/
|
|
4
|
-
export declare const WithTagline: import("@storybook/
|
|
5
|
-
export declare const WithTaglineAndText: import("@storybook/
|
|
6
|
-
export declare const WithContact: import("@storybook/
|
|
7
|
-
export declare const WithShape: import("@storybook/
|
|
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/
|
|
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/
|
|
4
|
-
export declare const WithTaglineAndText: import("@storybook/
|
|
5
|
-
export declare const WithBackgroundShapes: import("@storybook/
|
|
6
|
-
export declare const WithButton: import("@storybook/
|
|
7
|
-
export declare const WithBadgeOrLogo: import("@storybook/
|
|
8
|
-
export declare const WithImage: import("@storybook/
|
|
9
|
-
export declare const WithIcon: import("@storybook/
|
|
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/
|
|
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/
|
|
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
|
|
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
|
|
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
|
|
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
|
|
345
|
-
|
|
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(
|
|
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(
|
|
426
|
-
var _ref2, _ref2$filters, filters,
|
|
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
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
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
|
-
|
|
452
|
-
|
|
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
|
-
}).
|
|
455
|
-
return
|
|
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(
|
|
464
|
-
case
|
|
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(
|
|
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(
|
|
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
|
-
|
|
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(
|
|
565
|
-
var _ref$locale, locale, _ref$preview, preview, _ref$filters, filters, cache,
|
|
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
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
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
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
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
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
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 =
|
|
623
|
+
fallbackResponses = results.filter(function (d) {
|
|
592
624
|
return d.attributes.locale === STRAPI_FALLBACK_LOCALE;
|
|
593
625
|
});
|
|
594
|
-
|
|
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",
|
|
601
|
-
case
|
|
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(
|
|
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
|
-
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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('
|
|
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(
|
|
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('
|
|
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;
|