@bytebrand/export-cars 1.21.48 → 1.21.50

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.48",
3
+ "version": "1.21.50",
4
4
  "description": "",
5
5
  "author": "bytebrand",
6
6
  "license": "UNLICENSED",
@@ -11,6 +11,10 @@ export class GoogleXmlBuilder extends XMLBuilderBase {
11
11
  async addItem(item: FbXmlItem | GoogleXmlItem | CriteoXmlItem): Promise<void> {
12
12
  const listing: string = Object.entries(item)
13
13
  .map(([key, data]): string => {
14
+ if (key === 'certification') {
15
+ return this.getCertificationElement(key, data);
16
+ }
17
+
14
18
  if (key === 'installment') {
15
19
  return this.getInstallmentElement(key, data);
16
20
  }
@@ -45,6 +49,19 @@ export class GoogleXmlBuilder extends XMLBuilderBase {
45
49
  </g:${rootTag}>`;
46
50
  }
47
51
 
52
+ private getCertificationElement(rootTag: string, data: {
53
+ certification_authority: string;
54
+ certification_name: string;
55
+ certification_code?: string;
56
+ certification_value?: string;
57
+ }): string {
58
+ return `<g:${rootTag}>
59
+ <g:certification_authority>${data.certification_authority}</g:certification_authority>
60
+ <g:certification_name>${data.certification_name} EUR</g:certification_name>
61
+ <g:certification_value>${data.certification_value} EUR</g:certification_value>
62
+ </g:${rootTag}>`;
63
+ }
64
+
48
65
  private getInstallmentElement(rootTag: string, data: { paybackPeriod: string; monthlyInstallment: string }): string {
49
66
  return `<g:${rootTag}>
50
67
  <g:months>${data.paybackPeriod}</g:months>
@@ -178,6 +178,12 @@ export interface GoogleXmlItem {
178
178
  option: string;
179
179
  store_code: string;
180
180
  };
181
+ certification: {
182
+ certification_authority: string;
183
+ certification_name: string;
184
+ certification_code?: string;
185
+ certification_value?: string;
186
+ };
181
187
  link_template: string;
182
188
  additional_image_link: string[];
183
189
  model: string;
@@ -191,7 +197,7 @@ export interface GoogleXmlItem {
191
197
  date_first_registered: string,
192
198
  fuel_consumption: string,
193
199
  energy_consumption: string,
194
- emissions_co2: string,
200
+ co2_emissions: string,
195
201
  identifier_exists: string,
196
202
  ads_redirect?: string;
197
203
  "certified_pre-owned"?: boolean;
@@ -44,6 +44,11 @@ export class GoogleTransformer {
44
44
  option: 'online',
45
45
  store_code: 'Online_shop'
46
46
  },
47
+ certification: {
48
+ certification_authority: 'BMWK',
49
+ certification_name: 'Vehicle_CO2_Class',
50
+ certification_value: `${this.getEnergyClass(car)}`
51
+ },
47
52
  title: this.getTitle(car),
48
53
  product_type: this.getCategory(car),
49
54
  VIN: this.transformService.vinCode(car),
@@ -68,7 +73,7 @@ export class GoogleTransformer {
68
73
  date_first_registered: this.getDateFirstRegistered(car),
69
74
  fuel_consumption: `${this.transformService.fuelConsumption(car)}l/100km`,
70
75
  energy_consumption: this.getWLTP(car),
71
- emissions_co2: `${this.transformService.cO2Emission(car)}g/km`,
76
+ co2_emissions: `${this.transformService.cO2Emission(car)}g/km`,
72
77
  description: (await this.getDescription(car)).substring(0, 4800),
73
78
  identifier_exists: 'no',
74
79
  availability: 'in_stock',