@treely/strapi-slices 7.14.0 → 7.15.0

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.
@@ -536,10 +536,10 @@ var getStrapiProjects = /*#__PURE__*/function () {
536
536
  }();
537
537
 
538
538
  var getPortfolioProjects = /*#__PURE__*/function () {
539
- var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(locale, preview) {
539
+ var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(locale, preview) {
540
540
  var cache, _yield$Promise$all, fpmProjects, strapiProjects;
541
- return _regeneratorRuntime().wrap(function _callee$(_context) {
542
- while (1) switch (_context.prev = _context.next) {
541
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
542
+ while (1) switch (_context2.prev = _context2.next) {
543
543
  case 0:
544
544
  if (locale === void 0) {
545
545
  locale = 'en';
@@ -548,34 +548,72 @@ var getPortfolioProjects = /*#__PURE__*/function () {
548
548
  preview = false;
549
549
  }
550
550
  cache = preview ? false : undefined;
551
- _context.next = 5;
551
+ _context2.next = 5;
552
552
  return Promise.all([fpmClient.get('/public/projects', {
553
553
  cache: cache
554
554
  }), getStrapiProjects(locale, STRAPI_DEFAULT_POPULATE_DEPTH, preview)]);
555
555
  case 5:
556
- _yield$Promise$all = _context.sent;
556
+ _yield$Promise$all = _context2.sent;
557
557
  fpmProjects = _yield$Promise$all[0].data;
558
558
  strapiProjects = _yield$Promise$all[1];
559
- return _context.abrupt("return", fpmProjects.map(function (fpmProject) {
560
- var _strapiProject$attrib;
561
- var strapiProject = strapiProjects.get(fpmProject.id);
562
- var toReturn = fpmProject;
563
- if (strapiProject != null && strapiProject.attributes.slug) {
564
- toReturn.slug = strapiProject.attributes.slug;
565
- }
566
- if (strapiProject != null && strapiProject.attributes.thumbnail) {
567
- toReturn.thumbnail = strapiProject == null ? void 0 : strapiProject.attributes.thumbnail;
568
- }
569
- if (strapiProject != null && (_strapiProject$attrib = strapiProject.attributes.portfolio.data) != null && _strapiProject$attrib.attributes.host) {
570
- toReturn.portfolioHost = strapiProject.attributes.portfolio.data.attributes.host;
571
- }
572
- return toReturn;
573
- }));
559
+ return _context2.abrupt("return", Promise.all(fpmProjects.map(/*#__PURE__*/function () {
560
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(fpmProject) {
561
+ var _strapiProject$attrib;
562
+ var fpmProjectWithAverageSellableAmountPerYear, _error$response, strapiProject, toReturn;
563
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
564
+ while (1) switch (_context.prev = _context.next) {
565
+ case 0:
566
+ _context.prev = 0;
567
+ _context.next = 3;
568
+ return fpmClient.get("/public/projects/" + fpmProject.id, {
569
+ cache: cache
570
+ });
571
+ case 3:
572
+ fpmProjectWithAverageSellableAmountPerYear = _context.sent;
573
+ fpmProject.averageSellableAmountPerYear = fpmProjectWithAverageSellableAmountPerYear.data.averageSellableAmountPerYear;
574
+ // Handle 404 errors for private projects
575
+ _context.next = 14;
576
+ break;
577
+ case 7:
578
+ _context.prev = 7;
579
+ _context.t0 = _context["catch"](0);
580
+ if (!(((_error$response = _context.t0.response) == null ? void 0 : _error$response.status) === 404)) {
581
+ _context.next = 13;
582
+ break;
583
+ }
584
+ fpmProject.averageSellableAmountPerYear = 0;
585
+ _context.next = 14;
586
+ break;
587
+ case 13:
588
+ throw _context.t0;
589
+ case 14:
590
+ strapiProject = strapiProjects.get(fpmProject.id);
591
+ toReturn = fpmProject;
592
+ if (strapiProject != null && strapiProject.attributes.slug) {
593
+ toReturn.slug = strapiProject.attributes.slug;
594
+ }
595
+ if (strapiProject != null && strapiProject.attributes.thumbnail) {
596
+ toReturn.thumbnail = strapiProject == null ? void 0 : strapiProject.attributes.thumbnail;
597
+ }
598
+ if (strapiProject != null && (_strapiProject$attrib = strapiProject.attributes.portfolio.data) != null && _strapiProject$attrib.attributes.host) {
599
+ toReturn.portfolioHost = strapiProject.attributes.portfolio.data.attributes.host;
600
+ }
601
+ return _context.abrupt("return", toReturn);
602
+ case 20:
603
+ case "end":
604
+ return _context.stop();
605
+ }
606
+ }, _callee, null, [[0, 7]]);
607
+ }));
608
+ return function (_x3) {
609
+ return _ref2.apply(this, arguments);
610
+ };
611
+ }())));
574
612
  case 9:
575
613
  case "end":
576
- return _context.stop();
614
+ return _context2.stop();
577
615
  }
578
- }, _callee);
616
+ }, _callee2);
579
617
  }));
580
618
  return function getPortfolioProjects(_x, _x2) {
581
619
  return _ref.apply(this, arguments);
@@ -1414,7 +1452,7 @@ var messagesDe$7 = {
1414
1452
  'features.projectInfo.properties.verificationStandard.label': 'Verifizierungsstandard',
1415
1453
  'features.projectInfo.properties.verificationStandard.value.SilvaconsultFCSISO14': 'SILVACONSULT® Forest Carbon Standard, ISO 14064-2',
1416
1454
  'features.projectInfo.properties.verificationStandard.value.MfKWCH': 'Methodik für Klimaschutzprojekte im Wald für die Schweiz',
1417
- 'features.projectInfo.properties.forecastedAmountYear.toolTip': 'Dies ist das jährliche Projekt-Senkenvolumen gemäß dem TÜV-geprüften PDD, dieser Wert stellt nicht die aktuellen Verfügbarkeiten dar.',
1455
+ 'features.projectInfo.properties.forecastedAmountYear.toolTip': 'Dies ist der jährlich verkaufbare Betrag an Credits pro Jahr im Durchschnitt. Dieser Wert repräsentiert nicht die Verfügbarkeiten.',
1418
1456
  'features.projectInfo.properties.forecastedAmountYear.label': 'Projektvolumen',
1419
1457
  'features.projectInfo.properties.riskBuffer': 'Anteil Risikopuffer',
1420
1458
  'features.projectInfo.properties.year': '{years} {years, plural, one {Jahr} other {Jahre} }'
@@ -1556,7 +1594,7 @@ var messagesEn$3 = {
1556
1594
  'features.projectInfo.properties.verificationStandard.value.SilvaconsultFCSISO14': 'SILVACONSULT® Forest Carbon Standard, ISO 14064-2',
1557
1595
  'features.projectInfo.properties.verificationStandard.value.MfKWCH': 'Methodik für Klimaschutzprojekte im Wald für die Schweiz',
1558
1596
  'features.projectInfo.properties.forecastedAmountYear.label': 'Project Volume',
1559
- 'features.projectInfo.properties.forecastedAmountYear.toolTip': "This is the yearly project sink volume according to the TÜV-verified PDD, this value doesn't represent current availabilities.",
1597
+ 'features.projectInfo.properties.forecastedAmountYear.toolTip': "This is the average amount of credits that are issued per year. This value doesn't represent availabilities.",
1560
1598
  'features.projectInfo.properties.riskBuffer': 'Risk Buffer Share',
1561
1599
  'features.projectInfo.properties.year': '{years} {years, plural, one {year} other {years} }'
1562
1600
  };
@@ -5589,15 +5627,15 @@ var ProjectInfo = function ProjectInfo(_ref) {
5589
5627
  style: {
5590
5628
  objectFit: 'contain'
5591
5629
  }
5592
- })))) : React.createElement(React.Fragment, null), project.forecastedAmountYearly && project.riskBuffer ? React.createElement(React.Fragment, null, React.createElement(Spacer, {
5630
+ })))) : React.createElement(React.Fragment, null), project.averageSellableAmountPerYear !== 0 || project.riskBuffer ? React.createElement(React.Fragment, null, React.createElement(Spacer, {
5593
5631
  height: "8"
5594
5632
  }), React.createElement(Divider, null), React.createElement(Spacer, {
5595
5633
  height: "8"
5596
- }), React.createElement(SimpleGrid, {
5634
+ })) : React.createElement(React.Fragment, null), React.createElement(SimpleGrid, {
5597
5635
  columns: [1, null, null, 2],
5598
5636
  spacingX: "10",
5599
5637
  spacingY: "8"
5600
- }, React.createElement(Tooltip, {
5638
+ }, project.averageSellableAmountPerYear !== 0 && React.createElement(Tooltip, {
5601
5639
  label: formatMessage({
5602
5640
  id: 'features.projectInfo.properties.forecastedAmountYear.toolTip'
5603
5641
  })
@@ -5608,18 +5646,18 @@ var ProjectInfo = function ProjectInfo(_ref) {
5608
5646
  text: formatMessage({
5609
5647
  id: 'unit.formatter.tonsCo2PerYear'
5610
5648
  }, {
5611
- number: formatNumber(convertCo2AmountKgToTons(project.forecastedAmountYearly.toString()), {
5649
+ number: formatNumber(convertCo2AmountKgToTons(project.averageSellableAmountPerYear.toString()), {
5612
5650
  maximumFractionDigits: 0
5613
5651
  })
5614
5652
  }),
5615
- caption: subtitles.forecastedAmountSubtitle
5616
- }))), React.createElement(Box, null, React.createElement(LabelTextPair, {
5653
+ caption: subtitles.averageSellableAmountPerYearSubtitle
5654
+ }))), project.riskBuffer && React.createElement(Box, null, React.createElement(LabelTextPair, {
5617
5655
  label: formatMessage({
5618
5656
  id: 'features.projectInfo.properties.riskBuffer'
5619
5657
  }),
5620
5658
  text: formatNumber(project.riskBuffer / 100, FORMAT_AS_PERCENT_CONFIG),
5621
5659
  caption: subtitles.riskBufferSubtitle
5622
- })))) : React.createElement(React.Fragment, null), React.createElement(Box, {
5660
+ }))), React.createElement(Box, {
5623
5661
  mt: "2"
5624
5662
  }, React.createElement(CreditsAvailableBadge, {
5625
5663
  status: project.creditAvailability