@bytebrand/export-cars 1.22.25 → 1.22.26

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.
@@ -77,15 +77,14 @@ export class FbTransformer {
77
77
  // console.time(`Images ${car._id}`);
78
78
  const image_links = await this.imagesService.getImages(car, images, ImageType.marketing, false);
79
79
  // console.timeEnd(`Images ${car._id}`);
80
- const transformedImages = image_links.map(el => {
81
- return { url: el };
82
- });
83
80
 
84
81
  return {
85
82
  fb_page_id: '176306386132',
86
83
  ...address,
87
84
  ...dealerInfo,
88
85
  vehicle_id: get(car, 'metaData.vehicleId', autodeId),
86
+ stock_number: autodeId,
87
+ availability: this.mapAvailability(car),
89
88
  title: this.getTitle(car),
90
89
  features: this.getHighlights(car),
91
90
  description: this.getDescription(car), // be careful it changes car object
@@ -94,7 +93,8 @@ export class FbTransformer {
94
93
  make: toString(get(car, 'mainData.make', '')),
95
94
  model: toString(get(car, 'mainData.model', '')),
96
95
  trim: this.getTrim(car),
97
- image: transformedImages,
96
+ image_link: image_links[0],
97
+ additional_image_link: image_links.slice(1, 21), // Meta allows max 20 additional images
98
98
  year: toString(year),
99
99
  mileage: {
100
100
  value: this.getMileage(car),
@@ -108,28 +108,28 @@ export class FbTransformer {
108
108
  price: this.getPrice(car),
109
109
  exterior_color: this.getExteriorColor(car),
110
110
  interior_color: this.getInteriorColor(car),
111
- state_of_vehicle: this.mapState(car),
111
+ condition: this.mapCondition(car),
112
112
  energy_efficiency_class_eu: this.getEnergyEfficiencyClass(car),
113
113
  vehicle_specifications: [
114
114
  {
115
115
  type: 'gas_mileage_combined',
116
116
  units: 'l/100km',
117
- value: get(car, 'consumption.consumptionCombined', ''),
117
+ value: get(car, 'consumption.wltpCombined', ''),
118
118
  },
119
119
  {
120
120
  type: 'gas_mileage_city',
121
121
  units: 'l/100km',
122
- value: get(car, 'consumption.consumptionInner', ''),
122
+ value: get(car, 'consumption.wltpSlow', ''),
123
123
  },
124
124
  {
125
125
  type: 'gas_mileage_highway',
126
126
  units: 'l/100km',
127
- value: get(car, 'consumption.consumptionOuter', ''),
127
+ value: get(car, 'consumption.wltpVeryFast', ''),
128
128
  },
129
129
  {
130
130
  type: 'CO2_emissions',
131
131
  units: 'g/km',
132
- value: get(car, 'environmentEmissions.co2', ''),
132
+ value: get(car, 'environmentEmissions.wltpCo2', ''),
133
133
  },
134
134
  ],
135
135
  };
@@ -373,16 +373,20 @@ export class FbTransformer {
373
373
  return this.translator.translateVal(colorSelection);
374
374
  }
375
375
 
376
- private mapState(car: DataSchemes.Car): string {
376
+ private mapCondition(car: DataSchemes.Car): string {
377
377
  const available = {
378
- selector_condition_new: 'CPO',
379
- selector_condition_used: 'USED',
380
- selector_unknown: 'USED',
378
+ selector_condition_new: 'new',
379
+ selector_condition_used: 'used',
380
+ selector_unknown: 'used',
381
381
  };
382
382
  const condition = get(car, 'mainData.condition', 'selector_unknown');
383
383
  return get(available, condition);
384
384
  }
385
385
 
386
+ private mapAvailability(car: DataSchemes.Car): string {
387
+ return get(car, 'state.isOnline', false) ? 'in stock' : 'out of stock';
388
+ }
389
+
386
390
  private getEnergyEfficiencyClass(car: DataSchemes.Car): string {
387
391
  const available = {
388
392
  selector_energyEfficiencyClass_appp: 'A+',
@@ -397,7 +401,7 @@ export class FbTransformer {
397
401
  selector_energyEfficiencyClass_g: 'G',
398
402
  selector_unknown: 'G',
399
403
  };
400
- const energyClass = get(car, 'environmentEmissions.energyEfficiencyClass', 'selector_unknown');
404
+ const energyClass = get(car, 'environmentEmissions.wltpEnergyEfficiencyClass', 'selector_unknown');
401
405
  return get(available, energyClass);
402
406
  }
403
407