@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.
@@ -10,7 +10,7 @@ export interface ProjectInfoProps {
10
10
  projectTypeSubtitle?: string;
11
11
  projectDeveloperSubtitle?: string;
12
12
  verificationStandardSubtitle?: string;
13
- forecastedAmountSubtitle?: string;
13
+ averageSellableAmountPerYearSubtitle?: string;
14
14
  riskBufferSubtitle?: string;
15
15
  buyCreditsSubtitle?: string;
16
16
  };
@@ -39,6 +39,7 @@ interface FPMProject {
39
39
  updatedAt: Date;
40
40
  };
41
41
  forecastedAmountYearly?: number;
42
+ averageSellableAmountPerYear: number;
42
43
  riskBuffer?: number;
43
44
  defaultIssuer?: Issuer;
44
45
  creditAvailability: CreditAvailability;
@@ -23,7 +23,7 @@ export interface ProjectFactsProps {
23
23
  projectTypeSubtitle?: string;
24
24
  projectDeveloperSubtitle?: string;
25
25
  verificationStandardSubtitle?: string;
26
- forecastedAmountSubtitle?: string;
26
+ averageSellableAmountPerYearSubtitle?: string;
27
27
  riskBufferSubtitle?: string;
28
28
  buyCreditsSubtitle?: string;
29
29
  contactTitle?: string;
@@ -555,10 +555,10 @@ var getStrapiProjects = /*#__PURE__*/function () {
555
555
  }();
556
556
 
557
557
  var getPortfolioProjects = /*#__PURE__*/function () {
558
- var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(locale, preview) {
558
+ var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(locale, preview) {
559
559
  var cache, _yield$Promise$all, fpmProjects, strapiProjects;
560
- return _regeneratorRuntime().wrap(function _callee$(_context) {
561
- while (1) switch (_context.prev = _context.next) {
560
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
561
+ while (1) switch (_context2.prev = _context2.next) {
562
562
  case 0:
563
563
  if (locale === void 0) {
564
564
  locale = 'en';
@@ -567,34 +567,72 @@ var getPortfolioProjects = /*#__PURE__*/function () {
567
567
  preview = false;
568
568
  }
569
569
  cache = preview ? false : undefined;
570
- _context.next = 5;
570
+ _context2.next = 5;
571
571
  return Promise.all([fpmClient.get('/public/projects', {
572
572
  cache: cache
573
573
  }), getStrapiProjects(locale, STRAPI_DEFAULT_POPULATE_DEPTH, preview)]);
574
574
  case 5:
575
- _yield$Promise$all = _context.sent;
575
+ _yield$Promise$all = _context2.sent;
576
576
  fpmProjects = _yield$Promise$all[0].data;
577
577
  strapiProjects = _yield$Promise$all[1];
578
- return _context.abrupt("return", fpmProjects.map(function (fpmProject) {
579
- var _strapiProject$attrib;
580
- var strapiProject = strapiProjects.get(fpmProject.id);
581
- var toReturn = fpmProject;
582
- if (strapiProject != null && strapiProject.attributes.slug) {
583
- toReturn.slug = strapiProject.attributes.slug;
584
- }
585
- if (strapiProject != null && strapiProject.attributes.thumbnail) {
586
- toReturn.thumbnail = strapiProject == null ? void 0 : strapiProject.attributes.thumbnail;
587
- }
588
- if (strapiProject != null && (_strapiProject$attrib = strapiProject.attributes.portfolio.data) != null && _strapiProject$attrib.attributes.host) {
589
- toReturn.portfolioHost = strapiProject.attributes.portfolio.data.attributes.host;
590
- }
591
- return toReturn;
592
- }));
578
+ return _context2.abrupt("return", Promise.all(fpmProjects.map(/*#__PURE__*/function () {
579
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(fpmProject) {
580
+ var _strapiProject$attrib;
581
+ var fpmProjectWithAverageSellableAmountPerYear, _error$response, strapiProject, toReturn;
582
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
583
+ while (1) switch (_context.prev = _context.next) {
584
+ case 0:
585
+ _context.prev = 0;
586
+ _context.next = 3;
587
+ return fpmClient.get("/public/projects/" + fpmProject.id, {
588
+ cache: cache
589
+ });
590
+ case 3:
591
+ fpmProjectWithAverageSellableAmountPerYear = _context.sent;
592
+ fpmProject.averageSellableAmountPerYear = fpmProjectWithAverageSellableAmountPerYear.data.averageSellableAmountPerYear;
593
+ // Handle 404 errors for private projects
594
+ _context.next = 14;
595
+ break;
596
+ case 7:
597
+ _context.prev = 7;
598
+ _context.t0 = _context["catch"](0);
599
+ if (!(((_error$response = _context.t0.response) == null ? void 0 : _error$response.status) === 404)) {
600
+ _context.next = 13;
601
+ break;
602
+ }
603
+ fpmProject.averageSellableAmountPerYear = 0;
604
+ _context.next = 14;
605
+ break;
606
+ case 13:
607
+ throw _context.t0;
608
+ case 14:
609
+ strapiProject = strapiProjects.get(fpmProject.id);
610
+ toReturn = fpmProject;
611
+ if (strapiProject != null && strapiProject.attributes.slug) {
612
+ toReturn.slug = strapiProject.attributes.slug;
613
+ }
614
+ if (strapiProject != null && strapiProject.attributes.thumbnail) {
615
+ toReturn.thumbnail = strapiProject == null ? void 0 : strapiProject.attributes.thumbnail;
616
+ }
617
+ if (strapiProject != null && (_strapiProject$attrib = strapiProject.attributes.portfolio.data) != null && _strapiProject$attrib.attributes.host) {
618
+ toReturn.portfolioHost = strapiProject.attributes.portfolio.data.attributes.host;
619
+ }
620
+ return _context.abrupt("return", toReturn);
621
+ case 20:
622
+ case "end":
623
+ return _context.stop();
624
+ }
625
+ }, _callee, null, [[0, 7]]);
626
+ }));
627
+ return function (_x3) {
628
+ return _ref2.apply(this, arguments);
629
+ };
630
+ }())));
593
631
  case 9:
594
632
  case "end":
595
- return _context.stop();
633
+ return _context2.stop();
596
634
  }
597
- }, _callee);
635
+ }, _callee2);
598
636
  }));
599
637
  return function getPortfolioProjects(_x, _x2) {
600
638
  return _ref.apply(this, arguments);
@@ -1433,7 +1471,7 @@ var messagesDe$7 = {
1433
1471
  'features.projectInfo.properties.verificationStandard.label': 'Verifizierungsstandard',
1434
1472
  'features.projectInfo.properties.verificationStandard.value.SilvaconsultFCSISO14': 'SILVACONSULT® Forest Carbon Standard, ISO 14064-2',
1435
1473
  'features.projectInfo.properties.verificationStandard.value.MfKWCH': 'Methodik für Klimaschutzprojekte im Wald für die Schweiz',
1436
- '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.',
1474
+ '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.',
1437
1475
  'features.projectInfo.properties.forecastedAmountYear.label': 'Projektvolumen',
1438
1476
  'features.projectInfo.properties.riskBuffer': 'Anteil Risikopuffer',
1439
1477
  'features.projectInfo.properties.year': '{years} {years, plural, one {Jahr} other {Jahre} }'
@@ -1575,7 +1613,7 @@ var messagesEn$3 = {
1575
1613
  'features.projectInfo.properties.verificationStandard.value.SilvaconsultFCSISO14': 'SILVACONSULT® Forest Carbon Standard, ISO 14064-2',
1576
1614
  'features.projectInfo.properties.verificationStandard.value.MfKWCH': 'Methodik für Klimaschutzprojekte im Wald für die Schweiz',
1577
1615
  'features.projectInfo.properties.forecastedAmountYear.label': 'Project Volume',
1578
- '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.",
1616
+ 'features.projectInfo.properties.forecastedAmountYear.toolTip': "This is the average amount of credits that are issued per year. This value doesn't represent availabilities.",
1579
1617
  'features.projectInfo.properties.riskBuffer': 'Risk Buffer Share',
1580
1618
  'features.projectInfo.properties.year': '{years} {years, plural, one {year} other {years} }'
1581
1619
  };
@@ -5608,15 +5646,15 @@ var ProjectInfo = function ProjectInfo(_ref) {
5608
5646
  style: {
5609
5647
  objectFit: 'contain'
5610
5648
  }
5611
- })))) : React__default.default.createElement(React__default.default.Fragment, null), project.forecastedAmountYearly && project.riskBuffer ? React__default.default.createElement(React__default.default.Fragment, null, React__default.default.createElement(boemly.Spacer, {
5649
+ })))) : React__default.default.createElement(React__default.default.Fragment, null), project.averageSellableAmountPerYear !== 0 || project.riskBuffer ? React__default.default.createElement(React__default.default.Fragment, null, React__default.default.createElement(boemly.Spacer, {
5612
5650
  height: "8"
5613
5651
  }), React__default.default.createElement(boemly.Divider, null), React__default.default.createElement(boemly.Spacer, {
5614
5652
  height: "8"
5615
- }), React__default.default.createElement(boemly.SimpleGrid, {
5653
+ })) : React__default.default.createElement(React__default.default.Fragment, null), React__default.default.createElement(boemly.SimpleGrid, {
5616
5654
  columns: [1, null, null, 2],
5617
5655
  spacingX: "10",
5618
5656
  spacingY: "8"
5619
- }, React__default.default.createElement(boemly.Tooltip, {
5657
+ }, project.averageSellableAmountPerYear !== 0 && React__default.default.createElement(boemly.Tooltip, {
5620
5658
  label: formatMessage({
5621
5659
  id: 'features.projectInfo.properties.forecastedAmountYear.toolTip'
5622
5660
  })
@@ -5627,18 +5665,18 @@ var ProjectInfo = function ProjectInfo(_ref) {
5627
5665
  text: formatMessage({
5628
5666
  id: 'unit.formatter.tonsCo2PerYear'
5629
5667
  }, {
5630
- number: formatNumber(convertCo2AmountKgToTons(project.forecastedAmountYearly.toString()), {
5668
+ number: formatNumber(convertCo2AmountKgToTons(project.averageSellableAmountPerYear.toString()), {
5631
5669
  maximumFractionDigits: 0
5632
5670
  })
5633
5671
  }),
5634
- caption: subtitles.forecastedAmountSubtitle
5635
- }))), React__default.default.createElement(boemly.Box, null, React__default.default.createElement(boemly.LabelTextPair, {
5672
+ caption: subtitles.averageSellableAmountPerYearSubtitle
5673
+ }))), project.riskBuffer && React__default.default.createElement(boemly.Box, null, React__default.default.createElement(boemly.LabelTextPair, {
5636
5674
  label: formatMessage({
5637
5675
  id: 'features.projectInfo.properties.riskBuffer'
5638
5676
  }),
5639
5677
  text: formatNumber(project.riskBuffer / 100, FORMAT_AS_PERCENT_CONFIG),
5640
5678
  caption: subtitles.riskBufferSubtitle
5641
- })))) : React__default.default.createElement(React__default.default.Fragment, null), React__default.default.createElement(boemly.Box, {
5679
+ }))), React__default.default.createElement(boemly.Box, {
5642
5680
  mt: "2"
5643
5681
  }, React__default.default.createElement(CreditsAvailableBadge, {
5644
5682
  status: project.creditAvailability