@bytebrand/export-cars 1.22.25 → 1.22.27
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/dist/constants/fb.constants.d.ts +3 -3
- package/dist/constants/fb.constants.js +3 -3
- package/dist/constants/fb.constants.js.map +1 -1
- package/dist/formats/fb-xml.builder.js +3 -0
- package/dist/formats/fb-xml.builder.js.map +1 -1
- package/dist/transformers/fb.transformer.d.ts +2 -1
- package/dist/transformers/fb.transformer.js +19 -16
- package/dist/transformers/fb.transformer.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/constants/fb.constants.ts +3 -3
- package/src/formats/fb-xml.builder.ts +3 -0
- package/src/transformers/fb.transformer.ts +20 -16
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const FB_MAX_TRIM_LENGTH = 50;
|
|
2
2
|
export const FB_MAX_IMAGE_COUNT_FOR_DEAFULT = 47;
|
|
3
3
|
export const FB_MIN_MILEAGES = 900;
|
|
4
|
-
export const DEFAULT_ZIP = '
|
|
5
|
-
export const DEFAULT_CITY = '
|
|
6
|
-
export const DEFAULT_ADDR1 = '
|
|
4
|
+
export const DEFAULT_ZIP = '06796';
|
|
5
|
+
export const DEFAULT_CITY = 'Sandersdorf-Brehna';
|
|
6
|
+
export const DEFAULT_ADDR1 = 'Max-Planck-Str. 19';
|
|
7
7
|
export const TIMESTAMP_FIRST_YEAR = 1970;
|
|
@@ -16,6 +16,9 @@ export class FbXmlBuilder extends XMLBuilderBase {
|
|
|
16
16
|
if (key === 'description') {
|
|
17
17
|
return this.getDescriptionElement(key, data);
|
|
18
18
|
}
|
|
19
|
+
if (key === 'additional_image_link' && Array.isArray(data)) {
|
|
20
|
+
return data.map((value: string) => this.getElement(key, value, true)).join('');
|
|
21
|
+
}
|
|
19
22
|
if (Array.isArray(data)) {
|
|
20
23
|
return this.getElementsArray(key, data);
|
|
21
24
|
}
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
132
|
+
value: get(car, 'environmentEmissions.wltpCo2', ''),
|
|
133
133
|
},
|
|
134
134
|
],
|
|
135
135
|
};
|
|
@@ -168,9 +168,9 @@ export class FbTransformer {
|
|
|
168
168
|
return {
|
|
169
169
|
dealer_communication_channel: 'LEAD_FORM',
|
|
170
170
|
dealer_id: get(car, 'metaData.ownerId'),
|
|
171
|
-
dealer_privacy_policy_url: 'https://www.auto.de/
|
|
171
|
+
dealer_privacy_policy_url: 'https://www.auto.de/datenschutz/',
|
|
172
172
|
dealer_email: 'auto@auto.de',
|
|
173
|
-
dealer_phone: '+
|
|
173
|
+
dealer_phone: '+498004030182',
|
|
174
174
|
};
|
|
175
175
|
}
|
|
176
176
|
|
|
@@ -373,16 +373,20 @@ export class FbTransformer {
|
|
|
373
373
|
return this.translator.translateVal(colorSelection);
|
|
374
374
|
}
|
|
375
375
|
|
|
376
|
-
private
|
|
376
|
+
private mapCondition(car: DataSchemes.Car): string {
|
|
377
377
|
const available = {
|
|
378
|
-
selector_condition_new: '
|
|
379
|
-
selector_condition_used: '
|
|
380
|
-
selector_unknown: '
|
|
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.
|
|
404
|
+
const energyClass = get(car, 'environmentEmissions.wltpEnergyEfficiencyClass', 'selector_unknown');
|
|
401
405
|
return get(available, energyClass);
|
|
402
406
|
}
|
|
403
407
|
|