@bytebrand/fe-ui-core-autobahn 1.0.131 → 1.0.132

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.
@@ -165,7 +165,10 @@ const getDecoratedLightProps = (
165
165
  if (hybridPlugin) {
166
166
  if (wltpWeightedPowerCombinedContent && wltpWeightedCombinedContent) {
167
167
  const dischargedCombined = Number.isFinite(wltpConsumptionCombined) ? wltpConsumptionCombined : 19.9;
168
- const dischargedClass = car.environmentEmissions.wltpDischargedEnergyEfficiencyClass || 'selector_energyEfficiencyClass_g';
168
+ // ADV-187: the discharged class is derived server-side from wltpCo2Discharged; when the
169
+ // backend could not derive it the field is selector_unknown — hide the segment, never
170
+ // fall back to a hard-coded class here.
171
+ const dischargedClass = car.environmentEmissions.wltpDischargedEnergyEfficiencyClass;
169
172
  const weightedCombinedLabeled = t('vehicleProps:value.wltpWeightedCombinedLabel', { consumption: wltpWeightedCombined.toLocaleString(language), unit: translatedUnit });
170
173
  const dischargedCombinedLabeled = t('vehicleProps:value.wltpDischargedCombinedLabel', { consumption: dischargedCombined.toLocaleString(language), unit: translatedUnit });
171
174
  const co2WeightedContent = Number.isFinite(wltpCo2)
@@ -174,14 +177,16 @@ const getDecoratedLightProps = (
174
177
  const co2ClassWeighted = isPropDefined(wltpEnergyEfficiencyClass)
175
178
  ? t('vehicleProps:value.co2ClassWeighted', { class: t(`cbd:${wltpEnergyEfficiencyClass}`) })
176
179
  : null;
177
- const co2ClassDischarged = t('vehicleProps:value.co2ClassDischarged', { class: t(`cbd:${dischargedClass}`) });
180
+ const co2ClassDischarged = isPropDefined(dischargedClass)
181
+ ? t('vehicleProps:value.co2ClassDischarged', { class: t(`cbd:${dischargedClass}`) })
182
+ : null;
178
183
  return <React.Fragment>
179
184
  {`${wltpWeightedPowerCombinedContent} + `}
180
185
  {`${weightedCombinedLabeled}, `}
181
186
  {`${dischargedCombinedLabeled}`}
182
187
  {co2WeightedContent && <>, {co2WeightedContent}</>}
183
188
  {co2ClassWeighted && <>, {co2ClassWeighted}</>}
184
- {<>, {co2ClassDischarged}</>}
189
+ {co2ClassDischarged && <>, {co2ClassDischarged}</>}
185
190
  </React.Fragment>
186
191
  }
187
192
 
@@ -316,7 +321,10 @@ const getDecoratedLightProps = (
316
321
  if (hybridPlugin) {
317
322
  if (wltpWeightedPowerCombinedContent && wltpWeightedCombinedContent) {
318
323
  const dischargedCombined = Number.isFinite(wltpConsumptionCombined) ? wltpConsumptionCombined : 19.9;
319
- const dischargedClass = car.environmentEmissions.wltpDischargedEnergyEfficiencyClass || 'selector_energyEfficiencyClass_g';
324
+ // ADV-187: the discharged class is derived server-side from wltpCo2Discharged; when the
325
+ // backend could not derive it the field is selector_unknown — hide the segment, never
326
+ // fall back to a hard-coded class here.
327
+ const dischargedClass = car.environmentEmissions.wltpDischargedEnergyEfficiencyClass;
320
328
  const weightedCombinedLabeled = t('vehicleProps:value.wltpWeightedCombinedLabel', { consumption: wltpWeightedCombined.toLocaleString(language), unit: translatedUnit });
321
329
  const dischargedCombinedLabeled = t('vehicleProps:value.wltpDischargedCombinedLabel', { consumption: dischargedCombined.toLocaleString(language), unit: translatedUnit });
322
330
  const co2WeightedContent = Number.isFinite(wltpCo2)
@@ -325,14 +333,16 @@ const getDecoratedLightProps = (
325
333
  const co2ClassWeighted = isPropDefined(wltpEnergyEfficiencyClass)
326
334
  ? t('vehicleProps:value.co2ClassWeighted', { class: t(`cbd:${wltpEnergyEfficiencyClass}`) })
327
335
  : null;
328
- const co2ClassDischarged = t('vehicleProps:value.co2ClassDischarged', { class: t(`cbd:${dischargedClass}`) });
336
+ const co2ClassDischarged = isPropDefined(dischargedClass)
337
+ ? t('vehicleProps:value.co2ClassDischarged', { class: t(`cbd:${dischargedClass}`) })
338
+ : null;
329
339
  return <React.Fragment>
330
340
  {`${wltpWeightedPowerCombinedContent} + `}
331
341
  {`${weightedCombinedLabeled}, `}
332
342
  {`${dischargedCombinedLabeled}`}
333
343
  {co2WeightedContent && <>, {co2WeightedContent}</>}
334
344
  {co2ClassWeighted && <>, {co2ClassWeighted}</>}
335
- {<>, {co2ClassDischarged}</>}
345
+ {co2ClassDischarged && <>, {co2ClassDischarged}</>}
336
346
  </React.Fragment>
337
347
  }
338
348
 
@@ -880,10 +880,12 @@ const getDecoratedProps = (
880
880
  // (entladen, komb) fuel consumption + a discharged CO2 class.
881
881
  if (hybridPlugin && wltpConsumptionWeightedPowerCombinedContent && wltpConsumptionWeightedCombinedContent) {
882
882
  const ADV88_DEFAULT_DISCHARGED_COMBINED = 19.9;
883
- const ADV88_DEFAULT_DISCHARGED_CO2_CLASS = 'selector_energyEfficiencyClass_g';
884
883
 
885
884
  const dischargedCombined = Number.isFinite(wltpCombined) ? wltpCombined : ADV88_DEFAULT_DISCHARGED_COMBINED;
886
- const dischargedClass = car.environmentEmissions.wltpDischargedEnergyEfficiencyClass || ADV88_DEFAULT_DISCHARGED_CO2_CLASS;
885
+ // ADV-187: the discharged class is derived server-side from wltpCo2Discharged; when the
886
+ // backend could not derive it the field is selector_unknown — hide the segment, never
887
+ // fall back to a hard-coded class here.
888
+ const dischargedClass = car.environmentEmissions.wltpDischargedEnergyEfficiencyClass;
887
889
 
888
890
  const weightedCombinedLabeled = t('vehicleProps:value.wltpWeightedCombinedLabel', { consumption: wltpWeightedCombined.toLocaleString(language), unit: translatedUnit });
889
891
  const dischargedCombinedLabeled = t('vehicleProps:value.wltpDischargedCombinedLabel', { consumption: dischargedCombined.toLocaleString(language), unit: translatedUnit });
@@ -893,7 +895,9 @@ const getDecoratedProps = (
893
895
  const co2ClassWeighted = isPropDefined(wltpEnergyEfficiencyClass)
894
896
  ? t('vehicleProps:value.co2ClassWeighted', { class: t(`cbd:${wltpEnergyEfficiencyClass}`) })
895
897
  : null;
896
- const co2ClassDischarged = t('vehicleProps:value.co2ClassDischarged', { class: t(`cbd:${dischargedClass}`) });
898
+ const co2ClassDischarged = isPropDefined(dischargedClass)
899
+ ? t('vehicleProps:value.co2ClassDischarged', { class: t(`cbd:${dischargedClass}`) })
900
+ : null;
897
901
 
898
902
  return <React.Fragment>
899
903
  {wrapValue(wltpConsumptionWeightedPowerCombinedContent)}{' + '}
@@ -901,7 +905,7 @@ const getDecoratedProps = (
901
905
  {wrapValue(dischargedCombinedLabeled)}
902
906
  {co2WeightedContent && <>{', '}{wrapValue(co2WeightedContent)}</>}
903
907
  {co2ClassWeighted && <>{', '}{co2ClassWeighted}</>}
904
- {', '}{co2ClassDischarged}
908
+ {co2ClassDischarged && <>{', '}{co2ClassDischarged}</>}
905
909
  </React.Fragment>
906
910
  }
907
911