@bytebrand/export-cars 1.21.7 → 1.21.8
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/.editorconfig +8 -8
- package/.eslintignore +1 -1
- package/.eslintrc.js +24 -24
- package/.prettierrc.js +7 -7
- package/README.md +65 -65
- package/dist/configs/index.d.ts +1 -0
- package/dist/configs/index.js +1 -0
- package/dist/configs/index.js.map +1 -1
- package/dist/configs/santander.config.d.ts +5 -0
- package/dist/configs/santander.config.js +18 -0
- package/dist/configs/santander.config.js.map +1 -0
- package/dist/enums/export-type.enum.d.ts +1 -0
- package/dist/enums/export-type.enum.js +1 -0
- package/dist/enums/export-type.enum.js.map +1 -1
- package/dist/export.command.js +1 -1
- package/dist/export.command.js.map +1 -1
- package/dist/export.schema.d.ts +6 -2
- package/dist/export.schema.js +4 -0
- package/dist/export.schema.js.map +1 -1
- package/dist/exporters/index.d.ts +1 -0
- package/dist/exporters/index.js +1 -0
- package/dist/exporters/index.js.map +1 -1
- package/dist/exporters/santander.exporter.d.ts +12 -0
- package/dist/exporters/santander.exporter.js +63 -0
- package/dist/exporters/santander.exporter.js.map +1 -0
- package/dist/formats/auto24-xml.builder.js +2 -2
- package/dist/formats/google-xml.builder.js +3 -3
- package/dist/formats/modix-xml.builder.js +2 -2
- package/dist/formats/ooyyo-xml.builder.js +1 -1
- package/dist/formats/santander-csv.builder.d.ts +6 -0
- package/dist/formats/santander-csv.builder.js +17 -0
- package/dist/formats/santander-csv.builder.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/nest-cli.json +5 -5
- package/package.json +61 -61
- package/src/app.module.ts +38 -38
- package/src/configs/alleskralle.config.ts +15 -15
- package/src/configs/as24.config.ts +13 -13
- package/src/configs/auto24.config.ts +15 -15
- package/src/configs/autoboerse.config.ts +16 -16
- package/src/configs/autouncle.config.ts +14 -14
- package/src/configs/awin.config.ts +15 -15
- package/src/configs/by-owner.config.ts +14 -14
- package/src/configs/config.ts +83 -83
- package/src/configs/criteo.config.ts +17 -17
- package/src/configs/dasparking.config.ts +15 -15
- package/src/configs/eauto.config.ts +15 -15
- package/src/configs/evium.config.ts +18 -18
- package/src/configs/facebook-shop.config.ts +16 -16
- package/src/configs/fb.config.ts +16 -16
- package/src/configs/google.config.ts +14 -14
- package/src/configs/index.ts +22 -21
- package/src/configs/kleinanzeigeFocus.config.ts +14 -14
- package/src/configs/marktde.config.ts +18 -18
- package/src/configs/meinstadt.config.ts +15 -15
- package/src/configs/mitula.config.ts +14 -14
- package/src/configs/ooyyo.config.ts +15 -15
- package/src/configs/santander.config.ts +15 -0
- package/src/configs/trovit.config.ts +14 -14
- package/src/configs/yescar.config.ts +17 -17
- package/src/constants/autouncle.contants.ts +4 -4
- package/src/constants/fb.constants.ts +7 -7
- package/src/constants/index.ts +1 -1
- package/src/constants/modix/body-color-name.constant.ts +20 -20
- package/src/constants/modix/category.constant.ts +14 -14
- package/src/constants/modix/fuel.constant.ts +14 -14
- package/src/constants/modix/index.ts +7 -7
- package/src/constants/modix/manufacturers.constant.ts +7498 -7498
- package/src/constants/modix/transmission.constant.ts +8 -8
- package/src/constants/modix/usage-type.constant.ts +13 -13
- package/src/constants/modix/vehicle-class.constant.ts +17 -17
- package/src/enums/environment.enum.ts +5 -5
- package/src/enums/export-type.enum.ts +33 -32
- package/src/enums/file-types.enum.ts +8 -8
- package/src/enums/image-type.enum.ts +4 -4
- package/src/enums/index.ts +4 -4
- package/src/export.command.ts +37 -37
- package/src/export.schema.ts +134 -128
- package/src/exporters/as24.exporter.ts +69 -69
- package/src/exporters/auto24.exporter.ts +48 -48
- package/src/exporters/autouncle.exporter.ts +60 -60
- package/src/exporters/awin.exporter.ts +47 -47
- package/src/exporters/by-owner.exporter.ts +44 -44
- package/src/exporters/facebook-shop.exporter.ts +51 -51
- package/src/exporters/fb.exporter.ts +52 -52
- package/src/exporters/google.exporter.ts +45 -45
- package/src/exporters/index.ts +15 -14
- package/src/exporters/meinstadt.exporter.ts +55 -55
- package/src/exporters/mobile.exporter.ts +64 -64
- package/src/exporters/modix.exporter.ts +56 -56
- package/src/exporters/ooyyo.exporter.ts +48 -48
- package/src/exporters/rubrikk.exporter.ts +53 -53
- package/src/exporters/santander.exporter.ts +50 -0
- package/src/exporters/trovit.exporter.ts +51 -51
- package/src/formats/auto24-xml.builder.ts +54 -54
- package/src/formats/autouncle-json.builder.ts +20 -20
- package/src/formats/awin-csv.builder.ts +16 -16
- package/src/formats/facebook-shop.builder.ts +69 -69
- package/src/formats/fb-xml.builder.ts +71 -71
- package/src/formats/google-xml.builder.ts +35 -35
- package/src/formats/index.ts +5 -5
- package/src/formats/meinstadt-json.builder.ts +19 -19
- package/src/formats/modix-xml.builder.ts +180 -180
- package/src/formats/ooyyo-xml.builder.ts +48 -48
- package/src/formats/rubrikk-xml.builder.ts +27 -27
- package/src/formats/santander-csv.builder.ts +15 -0
- package/src/formats/trovit-xml.builder.ts +44 -44
- package/src/interfaces/atributes-wrap-item.intreface.ts +6 -6
- package/src/interfaces/dealers-mapping.interface.ts +7 -7
- package/src/interfaces/description.interface.ts +24 -24
- package/src/interfaces/export-item.interface.ts +366 -366
- package/src/interfaces/exporter.interface.ts +3 -3
- package/src/interfaces/index.ts +3 -3
- package/src/interfaces/input.interface.ts +6 -6
- package/src/interfaces/mapping-rules.interface.ts +11 -11
- package/src/interfaces/modix/index.ts +1 -1
- package/src/interfaces/modix/modix-item-list.interface.ts +5 -5
- package/src/interfaces/params.interface.ts +13 -13
- package/src/interfaces/rule-parser.interface.ts +3 -3
- package/src/main.ts +14 -14
- package/src/rules/abstract.rule.ts +37 -37
- package/src/rules/date.rule.ts +19 -19
- package/src/rules/number.rule.ts +15 -15
- package/src/rules/string.rule.ts +8 -8
- package/src/services/car.service.ts +49 -49
- package/src/services/config.service.ts +15 -15
- package/src/services/images.service.ts +207 -207
- package/src/services/index.ts +9 -9
- package/src/services/loader.service.ts +29 -29
- package/src/services/mapping.service.ts +91 -91
- package/src/services/request.service.ts +44 -44
- package/src/services/rules.service.ts +61 -61
- package/src/services/transformer.service.ts +129 -129
- package/src/services/user.service.ts +57 -57
- package/src/transformers/as24.transformer.ts +253 -253
- package/src/transformers/auto24.transfomer.ts +155 -155
- package/src/transformers/autouncle.transformer.ts +236 -236
- package/src/transformers/awin.transformer.ts +193 -193
- package/src/transformers/by-owner.transformer.ts +354 -354
- package/src/transformers/facebook-shop.transformer.ts +93 -93
- package/src/transformers/fb-description.transformer.ts +316 -316
- package/src/transformers/fb-equipment.transformer.ts +161 -161
- package/src/transformers/fb.transformer.ts +655 -655
- package/src/transformers/google.transformer.ts +169 -169
- package/src/transformers/index.ts +5 -5
- package/src/transformers/meinstadt.transformer.ts +92 -92
- package/src/transformers/mobile.transformer.ts +482 -482
- package/src/transformers/modix.transformer.ts +227 -227
- package/src/transformers/ooyyo.transformer.ts +109 -109
- package/src/transformers/rubrikk.transformer.ts +200 -200
- package/src/transformers/trovit.transformer.ts +63 -63
- package/src/utils/converter.utils.ts +15 -15
- package/src/utils/index.ts +2 -2
- package/src/utils/validator.utils.ts +7 -7
- package/tsconfig.build.json +4 -4
- package/tsconfig.json +29 -29
|
@@ -1,316 +1,316 @@
|
|
|
1
|
-
import { get, isNil } from 'lodash';
|
|
2
|
-
import { DataSchemes } from '@bytebrand/car-schema';
|
|
3
|
-
import { TranslatorExtended } from '@bytebrand/schema-tools';
|
|
4
|
-
import { FbEquipment } from './fb-equipment.transformer';
|
|
5
|
-
import {
|
|
6
|
-
Description,
|
|
7
|
-
DescriptionInfo,
|
|
8
|
-
DescriptionSubValue,
|
|
9
|
-
DescriptionValue,
|
|
10
|
-
DescriptionValueInfo,
|
|
11
|
-
} from '../interfaces/description.interface';
|
|
12
|
-
|
|
13
|
-
export class FbDescription {
|
|
14
|
-
private constructor(
|
|
15
|
-
private car: DataSchemes.Car,
|
|
16
|
-
private translator: TranslatorExtended,
|
|
17
|
-
private equipment: FbEquipment,
|
|
18
|
-
) {}
|
|
19
|
-
|
|
20
|
-
static create(car: DataSchemes.Car, translator: TranslatorExtended, equipment: FbEquipment) {
|
|
21
|
-
return new FbDescription(car, translator, equipment);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
public getDescriptionArray(): Description[] {
|
|
25
|
-
const engineTransmission = this.getEngineAndTransmissionBlock();
|
|
26
|
-
const dimensions = this.getDimensionsBlock();
|
|
27
|
-
const colorMaterial = this.getColorAndMaterialBlock();
|
|
28
|
-
const equipment = this.getEquipmentBlock();
|
|
29
|
-
|
|
30
|
-
return [engineTransmission, dimensions, colorMaterial, equipment];
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
private getEngineAndTransmissionBlock(): Description {
|
|
34
|
-
const blockInfo: DescriptionInfo = {
|
|
35
|
-
title: 'accordion.tableEngine',
|
|
36
|
-
values: [
|
|
37
|
-
{
|
|
38
|
-
title: 'title.fuel',
|
|
39
|
-
value: {
|
|
40
|
-
key: get(this.car, 'consumption.fuel'),
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
title: 'title.cylinders',
|
|
45
|
-
value: {
|
|
46
|
-
key: get(this.car, 'engineData.cylinders', '') as string,
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
title: 'accordion.captionCapacity',
|
|
51
|
-
value: {
|
|
52
|
-
key: 'title.cubicCapacity',
|
|
53
|
-
data: { cubicCapacity: get(this.car, 'engineData.cubicCapacity') },
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
title: 'accordion.captionPower',
|
|
58
|
-
value: {
|
|
59
|
-
key: 'value.powerAlternateView',
|
|
60
|
-
data: {
|
|
61
|
-
powerKW: get(this.car, 'engineData.powerKW'),
|
|
62
|
-
powerPS: get(this.car, 'engineData.powerPS'),
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
title: 'title.torque',
|
|
68
|
-
value: {
|
|
69
|
-
key: 'value.torque',
|
|
70
|
-
data: {
|
|
71
|
-
torque: get(this.car, 'engineData.torque'),
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
title: 'title.acceleration',
|
|
77
|
-
value: {
|
|
78
|
-
key: 'value.acceleration',
|
|
79
|
-
data: {
|
|
80
|
-
seconds: get(this.car, 'engineData.acceleration100'),
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
title: 'title.topSpeed',
|
|
86
|
-
value: {
|
|
87
|
-
key: 'value.topSpeed',
|
|
88
|
-
data: {
|
|
89
|
-
mileage: get(this.car, 'engineData.highSpeed'),
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
title: 'title.transmission',
|
|
95
|
-
value: {
|
|
96
|
-
key: get(this.car, 'driveSuspension.gearbox'),
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
title: 'title.driveType',
|
|
101
|
-
value: {
|
|
102
|
-
key: get(this.car, 'driveSuspension.driveType'),
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
title: 'title.fuelCapacity',
|
|
107
|
-
value: {
|
|
108
|
-
key: 'value.capacity',
|
|
109
|
-
data: {
|
|
110
|
-
capacity: get(this.car, 'sizeVolumeWeight.fuelCapacity'),
|
|
111
|
-
},
|
|
112
|
-
},
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
title: 'hsn',
|
|
116
|
-
value: {
|
|
117
|
-
key: get(this.car, 'metaData.hsn'),
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
title: 'tsn',
|
|
122
|
-
value: {
|
|
123
|
-
key: get(this.car, 'metaData.tsn'),
|
|
124
|
-
},
|
|
125
|
-
},
|
|
126
|
-
],
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
return this.buildBlock(blockInfo);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
private getDimensionsBlock(): Description {
|
|
133
|
-
const blockInfo: DescriptionInfo = {
|
|
134
|
-
title: 'accordion.tableDimensions',
|
|
135
|
-
values: [
|
|
136
|
-
{
|
|
137
|
-
title: 'title.category',
|
|
138
|
-
value: {
|
|
139
|
-
key: get(this.car, 'mainData.category'),
|
|
140
|
-
},
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
title: 'title.length',
|
|
144
|
-
value: {
|
|
145
|
-
key: 'value.size',
|
|
146
|
-
data: {
|
|
147
|
-
size: get(this.car, 'sizeVolumeWeight.length'),
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
title: 'title.width',
|
|
153
|
-
value: {
|
|
154
|
-
key: 'value.size',
|
|
155
|
-
data: {
|
|
156
|
-
size: get(this.car, 'sizeVolumeWeight.width'),
|
|
157
|
-
},
|
|
158
|
-
},
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
title: 'title.height',
|
|
162
|
-
value: {
|
|
163
|
-
key: 'value.size',
|
|
164
|
-
data: {
|
|
165
|
-
size: get(this.car, 'sizeVolumeWeight.height'),
|
|
166
|
-
},
|
|
167
|
-
},
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
title: 'title.base',
|
|
171
|
-
value: {
|
|
172
|
-
key: get(this.car, 'driveSuspension.wheelBase', '') as string,
|
|
173
|
-
},
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
title: 'title.loadingVolume',
|
|
177
|
-
value: {
|
|
178
|
-
key: 'value.size',
|
|
179
|
-
data: {
|
|
180
|
-
size: get(this.car, 'sizeVolumeWeight.capacityLoad'),
|
|
181
|
-
},
|
|
182
|
-
},
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
title: 'title.bootCapacity',
|
|
186
|
-
value: {
|
|
187
|
-
key: 'value.capacity',
|
|
188
|
-
data: { capacity: get(this.car, 'sizeVolumeWeight.cargoCapacity') },
|
|
189
|
-
},
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
title: 'title.doors',
|
|
193
|
-
value: {
|
|
194
|
-
key: get(this.car, 'mainData.doors', '') as string,
|
|
195
|
-
},
|
|
196
|
-
},
|
|
197
|
-
{
|
|
198
|
-
title: 'title.seats',
|
|
199
|
-
value: {
|
|
200
|
-
key: get(this.car, 'mainData.seats', '') as string,
|
|
201
|
-
},
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
title: 'title.tare',
|
|
205
|
-
value: {
|
|
206
|
-
key: 'value.weight',
|
|
207
|
-
data: {
|
|
208
|
-
weight: get(this.car, 'sizeVolumeWeight.emptyWeight'),
|
|
209
|
-
},
|
|
210
|
-
},
|
|
211
|
-
},
|
|
212
|
-
{
|
|
213
|
-
title: 'title.maximumWeight',
|
|
214
|
-
value: {
|
|
215
|
-
key: 'value.weight',
|
|
216
|
-
data: {
|
|
217
|
-
weight: get(this.car, 'sizeVolumeWeight.maxWeight'),
|
|
218
|
-
},
|
|
219
|
-
},
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
title: 'title.trailerWeightBraked',
|
|
223
|
-
value: {
|
|
224
|
-
key: 'value.weight',
|
|
225
|
-
data: {
|
|
226
|
-
weight: get(this.car, 'sizeVolumeWeight.trailerWeightBraked'),
|
|
227
|
-
},
|
|
228
|
-
},
|
|
229
|
-
},
|
|
230
|
-
{
|
|
231
|
-
title: 'title.trailerWeightUnbraked',
|
|
232
|
-
value: {
|
|
233
|
-
key: 'value.weight',
|
|
234
|
-
data: {
|
|
235
|
-
weight: get(this.car, 'sizeVolumeWeight.trailerWeightUnbraked'),
|
|
236
|
-
},
|
|
237
|
-
},
|
|
238
|
-
},
|
|
239
|
-
],
|
|
240
|
-
};
|
|
241
|
-
|
|
242
|
-
return this.buildBlock(blockInfo);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
private getColorAndMaterialBlock(): Description {
|
|
246
|
-
const blockInfo: DescriptionInfo = {
|
|
247
|
-
title: 'accordion.tableMaterial',
|
|
248
|
-
values: [
|
|
249
|
-
{
|
|
250
|
-
title: 'title.manufacturerColorName',
|
|
251
|
-
value: {
|
|
252
|
-
key: get(this.car, 'exterior.manufacturerColorName'),
|
|
253
|
-
},
|
|
254
|
-
},
|
|
255
|
-
{
|
|
256
|
-
title: 'title.colour',
|
|
257
|
-
value: {
|
|
258
|
-
key: get(this.car, 'exterior.exteriorColor'),
|
|
259
|
-
},
|
|
260
|
-
},
|
|
261
|
-
{
|
|
262
|
-
title: 'title.appointmentsColor',
|
|
263
|
-
value: {
|
|
264
|
-
key: get(this.car, 'interior.interiorColor'),
|
|
265
|
-
},
|
|
266
|
-
},
|
|
267
|
-
{
|
|
268
|
-
title: 'title.interiorType',
|
|
269
|
-
value: {
|
|
270
|
-
key: get(this.car, 'interior.interiorType'),
|
|
271
|
-
},
|
|
272
|
-
},
|
|
273
|
-
],
|
|
274
|
-
};
|
|
275
|
-
|
|
276
|
-
return this.buildBlock(blockInfo);
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
private getEquipmentBlock(): Description {
|
|
280
|
-
const blockInfo: DescriptionInfo = {
|
|
281
|
-
title: 'accordion.tableEqipment',
|
|
282
|
-
values: this.equipment.collect(this.car),
|
|
283
|
-
};
|
|
284
|
-
|
|
285
|
-
return this.buildBlock(blockInfo);
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
private buildBlock(blockInfo: DescriptionInfo): Description {
|
|
289
|
-
return {
|
|
290
|
-
title: this.translator.translateVal(blockInfo.title),
|
|
291
|
-
values: this.buildValues(blockInfo.values),
|
|
292
|
-
};
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
private buildValues(values: DescriptionValueInfo[]): DescriptionValue[] {
|
|
296
|
-
return values
|
|
297
|
-
.filter(({ value }: DescriptionValueInfo) => {
|
|
298
|
-
const valArr = Array.isArray(value) ? value : [value];
|
|
299
|
-
return valArr.some(
|
|
300
|
-
({ key, data }) => !Object.values(data || {}).some(value => isNil(value) || value === '') || !key,
|
|
301
|
-
);
|
|
302
|
-
})
|
|
303
|
-
.map(({ title, value }: DescriptionValueInfo): DescriptionValue => {
|
|
304
|
-
const valArr = Array.isArray(value) ? value : [value];
|
|
305
|
-
const translated: string[] = valArr.map(this.translateValue.bind(this));
|
|
306
|
-
return {
|
|
307
|
-
title: this.translator.translateVal(title),
|
|
308
|
-
value: translated,
|
|
309
|
-
};
|
|
310
|
-
});
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
private translateValue({ key, data }: DescriptionSubValue): string {
|
|
314
|
-
return this.translator.translateValAndReplaceValue(key, data || {});
|
|
315
|
-
}
|
|
316
|
-
}
|
|
1
|
+
import { get, isNil } from 'lodash';
|
|
2
|
+
import { DataSchemes } from '@bytebrand/car-schema';
|
|
3
|
+
import { TranslatorExtended } from '@bytebrand/schema-tools';
|
|
4
|
+
import { FbEquipment } from './fb-equipment.transformer';
|
|
5
|
+
import {
|
|
6
|
+
Description,
|
|
7
|
+
DescriptionInfo,
|
|
8
|
+
DescriptionSubValue,
|
|
9
|
+
DescriptionValue,
|
|
10
|
+
DescriptionValueInfo,
|
|
11
|
+
} from '../interfaces/description.interface';
|
|
12
|
+
|
|
13
|
+
export class FbDescription {
|
|
14
|
+
private constructor(
|
|
15
|
+
private car: DataSchemes.Car,
|
|
16
|
+
private translator: TranslatorExtended,
|
|
17
|
+
private equipment: FbEquipment,
|
|
18
|
+
) {}
|
|
19
|
+
|
|
20
|
+
static create(car: DataSchemes.Car, translator: TranslatorExtended, equipment: FbEquipment) {
|
|
21
|
+
return new FbDescription(car, translator, equipment);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
public getDescriptionArray(): Description[] {
|
|
25
|
+
const engineTransmission = this.getEngineAndTransmissionBlock();
|
|
26
|
+
const dimensions = this.getDimensionsBlock();
|
|
27
|
+
const colorMaterial = this.getColorAndMaterialBlock();
|
|
28
|
+
const equipment = this.getEquipmentBlock();
|
|
29
|
+
|
|
30
|
+
return [engineTransmission, dimensions, colorMaterial, equipment];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
private getEngineAndTransmissionBlock(): Description {
|
|
34
|
+
const blockInfo: DescriptionInfo = {
|
|
35
|
+
title: 'accordion.tableEngine',
|
|
36
|
+
values: [
|
|
37
|
+
{
|
|
38
|
+
title: 'title.fuel',
|
|
39
|
+
value: {
|
|
40
|
+
key: get(this.car, 'consumption.fuel'),
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
title: 'title.cylinders',
|
|
45
|
+
value: {
|
|
46
|
+
key: get(this.car, 'engineData.cylinders', '') as string,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
title: 'accordion.captionCapacity',
|
|
51
|
+
value: {
|
|
52
|
+
key: 'title.cubicCapacity',
|
|
53
|
+
data: { cubicCapacity: get(this.car, 'engineData.cubicCapacity') },
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
title: 'accordion.captionPower',
|
|
58
|
+
value: {
|
|
59
|
+
key: 'value.powerAlternateView',
|
|
60
|
+
data: {
|
|
61
|
+
powerKW: get(this.car, 'engineData.powerKW'),
|
|
62
|
+
powerPS: get(this.car, 'engineData.powerPS'),
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
title: 'title.torque',
|
|
68
|
+
value: {
|
|
69
|
+
key: 'value.torque',
|
|
70
|
+
data: {
|
|
71
|
+
torque: get(this.car, 'engineData.torque'),
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
title: 'title.acceleration',
|
|
77
|
+
value: {
|
|
78
|
+
key: 'value.acceleration',
|
|
79
|
+
data: {
|
|
80
|
+
seconds: get(this.car, 'engineData.acceleration100'),
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
title: 'title.topSpeed',
|
|
86
|
+
value: {
|
|
87
|
+
key: 'value.topSpeed',
|
|
88
|
+
data: {
|
|
89
|
+
mileage: get(this.car, 'engineData.highSpeed'),
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
title: 'title.transmission',
|
|
95
|
+
value: {
|
|
96
|
+
key: get(this.car, 'driveSuspension.gearbox'),
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
title: 'title.driveType',
|
|
101
|
+
value: {
|
|
102
|
+
key: get(this.car, 'driveSuspension.driveType'),
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
title: 'title.fuelCapacity',
|
|
107
|
+
value: {
|
|
108
|
+
key: 'value.capacity',
|
|
109
|
+
data: {
|
|
110
|
+
capacity: get(this.car, 'sizeVolumeWeight.fuelCapacity'),
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
title: 'hsn',
|
|
116
|
+
value: {
|
|
117
|
+
key: get(this.car, 'metaData.hsn'),
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
title: 'tsn',
|
|
122
|
+
value: {
|
|
123
|
+
key: get(this.car, 'metaData.tsn'),
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
],
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
return this.buildBlock(blockInfo);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
private getDimensionsBlock(): Description {
|
|
133
|
+
const blockInfo: DescriptionInfo = {
|
|
134
|
+
title: 'accordion.tableDimensions',
|
|
135
|
+
values: [
|
|
136
|
+
{
|
|
137
|
+
title: 'title.category',
|
|
138
|
+
value: {
|
|
139
|
+
key: get(this.car, 'mainData.category'),
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
title: 'title.length',
|
|
144
|
+
value: {
|
|
145
|
+
key: 'value.size',
|
|
146
|
+
data: {
|
|
147
|
+
size: get(this.car, 'sizeVolumeWeight.length'),
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
title: 'title.width',
|
|
153
|
+
value: {
|
|
154
|
+
key: 'value.size',
|
|
155
|
+
data: {
|
|
156
|
+
size: get(this.car, 'sizeVolumeWeight.width'),
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
title: 'title.height',
|
|
162
|
+
value: {
|
|
163
|
+
key: 'value.size',
|
|
164
|
+
data: {
|
|
165
|
+
size: get(this.car, 'sizeVolumeWeight.height'),
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
title: 'title.base',
|
|
171
|
+
value: {
|
|
172
|
+
key: get(this.car, 'driveSuspension.wheelBase', '') as string,
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
title: 'title.loadingVolume',
|
|
177
|
+
value: {
|
|
178
|
+
key: 'value.size',
|
|
179
|
+
data: {
|
|
180
|
+
size: get(this.car, 'sizeVolumeWeight.capacityLoad'),
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
title: 'title.bootCapacity',
|
|
186
|
+
value: {
|
|
187
|
+
key: 'value.capacity',
|
|
188
|
+
data: { capacity: get(this.car, 'sizeVolumeWeight.cargoCapacity') },
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
title: 'title.doors',
|
|
193
|
+
value: {
|
|
194
|
+
key: get(this.car, 'mainData.doors', '') as string,
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
title: 'title.seats',
|
|
199
|
+
value: {
|
|
200
|
+
key: get(this.car, 'mainData.seats', '') as string,
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
title: 'title.tare',
|
|
205
|
+
value: {
|
|
206
|
+
key: 'value.weight',
|
|
207
|
+
data: {
|
|
208
|
+
weight: get(this.car, 'sizeVolumeWeight.emptyWeight'),
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
title: 'title.maximumWeight',
|
|
214
|
+
value: {
|
|
215
|
+
key: 'value.weight',
|
|
216
|
+
data: {
|
|
217
|
+
weight: get(this.car, 'sizeVolumeWeight.maxWeight'),
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
title: 'title.trailerWeightBraked',
|
|
223
|
+
value: {
|
|
224
|
+
key: 'value.weight',
|
|
225
|
+
data: {
|
|
226
|
+
weight: get(this.car, 'sizeVolumeWeight.trailerWeightBraked'),
|
|
227
|
+
},
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
title: 'title.trailerWeightUnbraked',
|
|
232
|
+
value: {
|
|
233
|
+
key: 'value.weight',
|
|
234
|
+
data: {
|
|
235
|
+
weight: get(this.car, 'sizeVolumeWeight.trailerWeightUnbraked'),
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
],
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
return this.buildBlock(blockInfo);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
private getColorAndMaterialBlock(): Description {
|
|
246
|
+
const blockInfo: DescriptionInfo = {
|
|
247
|
+
title: 'accordion.tableMaterial',
|
|
248
|
+
values: [
|
|
249
|
+
{
|
|
250
|
+
title: 'title.manufacturerColorName',
|
|
251
|
+
value: {
|
|
252
|
+
key: get(this.car, 'exterior.manufacturerColorName'),
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
title: 'title.colour',
|
|
257
|
+
value: {
|
|
258
|
+
key: get(this.car, 'exterior.exteriorColor'),
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
title: 'title.appointmentsColor',
|
|
263
|
+
value: {
|
|
264
|
+
key: get(this.car, 'interior.interiorColor'),
|
|
265
|
+
},
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
title: 'title.interiorType',
|
|
269
|
+
value: {
|
|
270
|
+
key: get(this.car, 'interior.interiorType'),
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
],
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
return this.buildBlock(blockInfo);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
private getEquipmentBlock(): Description {
|
|
280
|
+
const blockInfo: DescriptionInfo = {
|
|
281
|
+
title: 'accordion.tableEqipment',
|
|
282
|
+
values: this.equipment.collect(this.car),
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
return this.buildBlock(blockInfo);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
private buildBlock(blockInfo: DescriptionInfo): Description {
|
|
289
|
+
return {
|
|
290
|
+
title: this.translator.translateVal(blockInfo.title),
|
|
291
|
+
values: this.buildValues(blockInfo.values),
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
private buildValues(values: DescriptionValueInfo[]): DescriptionValue[] {
|
|
296
|
+
return values
|
|
297
|
+
.filter(({ value }: DescriptionValueInfo) => {
|
|
298
|
+
const valArr = Array.isArray(value) ? value : [value];
|
|
299
|
+
return valArr.some(
|
|
300
|
+
({ key, data }) => !Object.values(data || {}).some(value => isNil(value) || value === '') || !key,
|
|
301
|
+
);
|
|
302
|
+
})
|
|
303
|
+
.map(({ title, value }: DescriptionValueInfo): DescriptionValue => {
|
|
304
|
+
const valArr = Array.isArray(value) ? value : [value];
|
|
305
|
+
const translated: string[] = valArr.map(this.translateValue.bind(this));
|
|
306
|
+
return {
|
|
307
|
+
title: this.translator.translateVal(title),
|
|
308
|
+
value: translated,
|
|
309
|
+
};
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
private translateValue({ key, data }: DescriptionSubValue): string {
|
|
314
|
+
return this.translator.translateValAndReplaceValue(key, data || {});
|
|
315
|
+
}
|
|
316
|
+
}
|