@bytebrand/export-cars 1.21.22 → 1.21.24

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytebrand/export-cars",
3
- "version": "1.21.22",
3
+ "version": "1.21.24",
4
4
  "description": "",
5
5
  "author": "bytebrand",
6
6
  "license": "UNLICENSED",
@@ -33,11 +33,11 @@ export class GoogleXmlBuilder extends XMLBuilderBase {
33
33
  </g:${rootTag}>`;
34
34
  }
35
35
 
36
- private escapeXML(str: string): string {
37
- return str.replace(/&/g, '&amp;')
36
+ private escapeXML(str: string | null | undefined): string {
37
+ return str ? str.replace(/&/g, '&amp;')
38
38
  .replace(/</g, '&lt;')
39
39
  .replace(/>/g, '&gt;')
40
40
  .replace(/"/g, '&quot;')
41
- .replace(/'/g, '&apos;');
41
+ .replace(/'/g, '&apos;') : '';
42
42
  }
43
43
  }
@@ -57,8 +57,8 @@ export class GoogleTransformer {
57
57
  body_style: this.mapBodyStyle(car),
58
58
  engine: this.mapFuel(car),
59
59
  date_first_registered: this.getDateFirstRegistered(car),
60
- fuel_consumption: `${this.transformService.fuelConsumption(car)}'l/100km'`,
61
- energy_consumption: `${this.transformService.fuelConsumption(car)}'kWt/100km'`,
60
+ fuel_consumption: `${this.transformService.fuelConsumption(car)}l/100km`,
61
+ energy_consumption: this.getWLTP(car),
62
62
  emissions_co2: `${this.transformService.cO2Emission(car)}g/km`,
63
63
  description: await this.getDescription(car),
64
64
  // custom_label_0: '',
@@ -111,6 +111,16 @@ export class GoogleTransformer {
111
111
  return `https://www.${this.configService.config.domain}/search/vehicle/${autodeId}`;
112
112
  }
113
113
 
114
+ protected getWLTP(car: any): any {
115
+ const envkvCompliant = get(car, 'consumption.envkvCompliant');
116
+ const hybridPlagin = get(car, 'engineData.hybridPlugin');
117
+
118
+ if (envkvCompliant && hybridPlagin) {
119
+ const powerCombined = get(car, 'consumption.consumptionPowerCombined');
120
+ return `${powerCombined}kWt/100km`;
121
+ }
122
+ }
123
+
114
124
  private getRetailPrice(car: DataSchemes.Car): string {
115
125
  const retailPrice = get(car, 'recommendedRetailPrice', '');
116
126
  if (retailPrice) {