@bytebrand/export-cars 1.21.26 → 1.21.28

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.26",
3
+ "version": "1.21.28",
4
4
  "description": "",
5
5
  "author": "bytebrand",
6
6
  "license": "UNLICENSED",
@@ -14,6 +14,10 @@ export class GoogleXmlBuilder extends XMLBuilderBase {
14
14
  if (key === 'installment') {
15
15
  return this.getInstallmentElement(key, data);
16
16
  }
17
+
18
+ if (['additional_image_link', 'vehicle_option'].includes(key))
19
+ data.map((value: string) => this.getElement(`g:${key}`, this.escapeXML(value)))
20
+
17
21
  return this.getElement(`g:${key}`, this.escapeXML(data));
18
22
  })
19
23
  .join('');
@@ -155,20 +155,20 @@ export interface GoogleXmlItem {
155
155
  energy_efficiency_class?: string;
156
156
  installment?: { paybackPeriod: any; monthlyInstallment: any };
157
157
 
158
- additional_image_link: string;
158
+ additional_image_link: string[];
159
159
  model: string;
160
160
  VIN: string;
161
161
  trim: string;
162
162
  year: number;
163
- mileage: number;
164
- vehicle_option: string;
163
+ mileage: string;
164
+ vehicle_option: string[];
165
165
  body_style: string,
166
166
  engine: string,
167
167
  date_first_registered: string,
168
168
  fuel_consumption: string,
169
169
  energy_consumption: string,
170
170
  emissions_co2: string,
171
-
171
+ identifier_exists: string,
172
172
  ads_redirect?: string;
173
173
  "certified_pre-owned"?: boolean;
174
174
  custom_label_0?: string;
@@ -41,7 +41,7 @@ export class GoogleTransformer {
41
41
  VIN: this.transformService.vinCode(car),
42
42
  id: carId,
43
43
  image_link: transformedImages[0],
44
- additional_image_link: transformedImages.slice(1).join(','),
44
+ additional_image_link: transformedImages.slice(1, 10),
45
45
  ads_redirect: this.getLink(car),
46
46
  link: this.getLink(car),
47
47
  condition: this.mapState(car),
@@ -51,7 +51,7 @@ export class GoogleTransformer {
51
51
  model: this.transformService.model(car),
52
52
  trim: this.getTrim(car),
53
53
  year: this.getYear(car),
54
- mileage: this.transformService.mileage(car),
54
+ mileage: `${this.transformService.mileage(car)}km`,
55
55
  color: this.getColor(car),
56
56
  vehicle_option: this.getExtrasField(car),
57
57
  body_style: this.mapBodyStyle(car),
@@ -60,7 +60,9 @@ export class GoogleTransformer {
60
60
  fuel_consumption: `${this.transformService.fuelConsumption(car)}l/100km`,
61
61
  energy_consumption: this.getWLTP(car),
62
62
  emissions_co2: `${this.transformService.cO2Emission(car)}g/km`,
63
- description: await this.getDescription(car),
63
+ description: (await this.getDescription(car)).substring(0, 4800),
64
+ identifier_exists: 'no',
65
+ availability: 'in_stock',
64
66
  // custom_label_0: '',
65
67
  // custom_label_1: '',
66
68
  // custom_label_2: '',
@@ -222,22 +224,20 @@ export class GoogleTransformer {
222
224
 
223
225
  private mapBodyStyle(car: DataSchemes.Car): string {
224
226
  const available = {
225
- selector_unknown: 'Other',
226
- selector_category_combi: 'Wagon',
227
- selector_category_sedan: 'Sedan',
228
- selector_category_compact: 'Small_car',
229
- selector_category_coupe: 'Coupe',
230
- selector_category_convertible: 'Convertible',
231
- selector_category_suv: 'Suv',
232
- selector_category_van: 'Van',
233
- selector_category_transporter: 'Truck',
234
- selector_category_minibus: 'Minivan',
227
+ selector_category_combi: 'station wagon',
228
+ selector_category_sedan: 'sedan',
229
+ selector_category_coupe: 'coupe',
230
+ selector_category_convertible: 'convertible',
231
+ selector_category_suv: 'suv',
232
+ selector_category_van: 'full size van',
233
+ selector_category_transporter: 'truck',
234
+ selector_category_minibus: 'minivan',
235
235
  };
236
236
  const category = get(car, 'mainData.category', 'selector_unknown');
237
237
  return get(available, category);
238
238
  }
239
239
 
240
- private getExtrasField(car: DataSchemes.Car): string {
240
+ private getExtrasField(car: DataSchemes.Car): string[] {
241
241
  const booleanFields: string[] = [
242
242
  'engineData.startStopSystem',
243
243
  'window.panoramicGlassRoof',
@@ -296,10 +296,13 @@ export class GoogleTransformer {
296
296
  return filteredBooleanFields
297
297
  .concat(filteredSelectorFields)
298
298
  .concat(filteredSelectorListFields)
299
+ .slice(0, 200)
299
300
  .map((field: string) => {
300
301
  return this.translator.translateVal(field.replace('.', '_'));
301
302
  })
302
- .join(', ');
303
+ .map((field: string) => {
304
+ return field.substring(0, 200)
305
+ });
303
306
  }
304
307
 
305
308
  private getTrim(car: DataSchemes.Car): string {