@bytebrand/export-cars 1.21.6 → 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/autouncle.exporter.js +5 -1
- package/dist/exporters/autouncle.exporter.js.map +1 -1
- package/dist/exporters/fb.exporter.js +7 -1
- package/dist/exporters/fb.exporter.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 -58
- 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 -50
- 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,161 +1,161 @@
|
|
|
1
|
-
import { DataSchemes } from '@bytebrand/car-schema';
|
|
2
|
-
import { get } from 'lodash';
|
|
3
|
-
import { DescriptionValueInfo } from '../interfaces/description.interface';
|
|
4
|
-
|
|
5
|
-
export class FbEquipment {
|
|
6
|
-
public collect(car: DataSchemes.Car): DescriptionValueInfo[] {
|
|
7
|
-
const doors = get(car, 'doors', {});
|
|
8
|
-
const wheel = get(car, 'wheel', {});
|
|
9
|
-
const extras = get(car, 'extras', {});
|
|
10
|
-
const window = get(car, 'window', {});
|
|
11
|
-
const mirrors = get(car, 'mirrors', {});
|
|
12
|
-
const multimedia = get(car, 'multimedia', {});
|
|
13
|
-
const climatisation = get(car, 'climatisation', {});
|
|
14
|
-
const airbag = get(car, 'airbags.airbag', []);
|
|
15
|
-
|
|
16
|
-
const auxiliaryHeating = get(car, 'heatingCooling.auxiliaryHeating', []);
|
|
17
|
-
const heatingCoolingClimatisation = get(car, 'heatingCooling.climatisation', null);
|
|
18
|
-
|
|
19
|
-
const lightSensor = get(car, 'lights.lightSensor', false);
|
|
20
|
-
const lights = get(car, 'lights', {});
|
|
21
|
-
delete (lights as any).lightSensor;
|
|
22
|
-
|
|
23
|
-
const seats = get(car, 'seats', {});
|
|
24
|
-
const backSeats = get(car, 'seats.backSeats', []);
|
|
25
|
-
const coDriverSeats = get(car, 'seats.coDriverSeats', []);
|
|
26
|
-
const driverSeats = get(car, 'seats.driverSeats', []);
|
|
27
|
-
const electricHeated = get(car, 'seats.electricHeated', null);
|
|
28
|
-
const electricHeatedRearSeats = get(car, 'seats.electricHeatedRearSeats', null);
|
|
29
|
-
delete (seats as any).backSeats;
|
|
30
|
-
delete (seats as any).coDriverSeats;
|
|
31
|
-
delete (seats as any).driverSeats;
|
|
32
|
-
|
|
33
|
-
const x4AllWeatherTires = get(car, 'wheels.x4AllWeatherTires', null);
|
|
34
|
-
const x4SummerTires = get(car, 'wheels.x4SummerTires', null);
|
|
35
|
-
const x4WinterTires = get(car, 'wheels.x4WinterTires', null);
|
|
36
|
-
|
|
37
|
-
const assistants = get(car, 'assistants', {});
|
|
38
|
-
const parkingAssistants = get(car, 'assistants.parkingAssistants', null);
|
|
39
|
-
const powerAssistedSteering = get(car, 'assistants.powerAssistedSteering', null);
|
|
40
|
-
delete (assistants as any).parkingAssistants;
|
|
41
|
-
delete (assistants as any).powerAssistedSteering;
|
|
42
|
-
|
|
43
|
-
const sportChassis = get(car, 'driveSuspension.sportChassis', null);
|
|
44
|
-
const adaptiveChassis = get(car, 'driveSuspension.adaptiveChassis', null);
|
|
45
|
-
const airSuspension = get(car, 'driveSuspension.airSuspension', null);
|
|
46
|
-
const roughRoadSuspension = get(car, 'driveSuspension.roughRoadSuspension', null);
|
|
47
|
-
const selfLockingDifferential = get(car, 'driveSuspension.selfLockingDifferential', null);
|
|
48
|
-
const airSuspensionAdaptive = get(car, 'driveSuspension.airSuspensionAdaptive', null);
|
|
49
|
-
const driveType = get(car, 'driveSuspension.driveType', null);
|
|
50
|
-
|
|
51
|
-
const heatingDriverSeats = driverSeats.indexOf('selector_driverSeats_electricHeated') !== -1;
|
|
52
|
-
const heatingCoDriverSeats = coDriverSeats.indexOf('selector_coDriverSeats_electricHeated') !== -1;
|
|
53
|
-
const heatingBackSeats = backSeats.indexOf('selector_backSeats_electricHeated') !== -1;
|
|
54
|
-
|
|
55
|
-
return [
|
|
56
|
-
{
|
|
57
|
-
title: 'accordion.captionAssistanceSystems',
|
|
58
|
-
value: [...this.objectToValues(assistants, 'assistants'), ...this.objectToValues({ lightSensor }, 'lights')],
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
title: 'accordion.captionAirbags',
|
|
62
|
-
value: this.arrayToValues(airbag),
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
title: 'accordion.captionParkingAid',
|
|
66
|
-
value: this.arrayToValues(parkingAssistants),
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
title: 'accordion.captionAirConditioning',
|
|
70
|
-
value: this.objectToValues({
|
|
71
|
-
[heatingCoolingClimatisation]: heatingCoolingClimatisation,
|
|
72
|
-
...climatisation,
|
|
73
|
-
}),
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
title: 'accordion.captionHeater',
|
|
77
|
-
value: this.objectToValues({
|
|
78
|
-
heatingCooling_auxiliaryHeating: auxiliaryHeating,
|
|
79
|
-
seats_driverSeats: heatingDriverSeats,
|
|
80
|
-
seats_coDriverSeats: heatingCoDriverSeats,
|
|
81
|
-
seats_backSeats: heatingBackSeats,
|
|
82
|
-
seats_electricHeated: electricHeated,
|
|
83
|
-
seats_electricHeatedRearSeats: electricHeatedRearSeats,
|
|
84
|
-
}),
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
title: 'accordion.captionMultimedia',
|
|
88
|
-
value: this.objectToValues(multimedia, 'multimedia'),
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
title: 'accordion.captionSeats',
|
|
92
|
-
value: [
|
|
93
|
-
...this.arrayToValues(backSeats),
|
|
94
|
-
...this.arrayToValues(coDriverSeats),
|
|
95
|
-
...this.arrayToValues(driverSeats),
|
|
96
|
-
...this.objectToValues(seats, 'seats'),
|
|
97
|
-
],
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
title: 'accordion.captionSteeringWheel',
|
|
101
|
-
value: [
|
|
102
|
-
...this.objectToValues(wheel, 'wheel'),
|
|
103
|
-
...this.objectToValues({ powerAssistedSteering }, 'assistants'),
|
|
104
|
-
],
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
title: 'accordion.captionLight',
|
|
108
|
-
value: this.objectToValues(lights, 'lights'),
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
title: 'accordion.captionDoors',
|
|
112
|
-
value: this.objectToValues(doors, 'doors'),
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
title: 'accordion.captionSlices',
|
|
116
|
-
value: this.objectToValues(window, 'window'),
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
title: 'accordion.captionMirror',
|
|
120
|
-
value: this.objectToValues(mirrors, 'mirrors'),
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
title: 'accordion.captionWheelsLandingGear',
|
|
124
|
-
value: [
|
|
125
|
-
...this.objectToValues(
|
|
126
|
-
{
|
|
127
|
-
sportChassis,
|
|
128
|
-
adaptiveChassis,
|
|
129
|
-
airSuspension,
|
|
130
|
-
roughRoadSuspension,
|
|
131
|
-
selfLockingDifferential,
|
|
132
|
-
airSuspensionAdaptive,
|
|
133
|
-
},
|
|
134
|
-
'driveSuspension',
|
|
135
|
-
),
|
|
136
|
-
...this.objectToValues({ x4AllWeatherTires, x4SummerTires, x4WinterTires }, 'bikes'),
|
|
137
|
-
...this.objectToValues({ [driveType]: driveType }),
|
|
138
|
-
],
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
title: 'accordion.captionExtras',
|
|
142
|
-
value: this.objectToValues(extras, 'extras'),
|
|
143
|
-
},
|
|
144
|
-
].filter(({ value }) => value.length > 0);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
private objectToValues(obj: {}, keyPrefix?: string): { key: string }[] {
|
|
148
|
-
return Object.entries(obj)
|
|
149
|
-
.map(([key, value]: [string, any]): [string, any] => [`${keyPrefix ? keyPrefix + '_' : ''}${key}`, value])
|
|
150
|
-
.filter(([, value]: [string, any]) => !!value)
|
|
151
|
-
.map(([translation]) => this.toValue(translation));
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
private arrayToValues(ara: string[]): { key: string }[] {
|
|
155
|
-
return ara.map(this.toValue);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
private toValue(translation: string): { key: string } {
|
|
159
|
-
return { key: translation };
|
|
160
|
-
}
|
|
161
|
-
}
|
|
1
|
+
import { DataSchemes } from '@bytebrand/car-schema';
|
|
2
|
+
import { get } from 'lodash';
|
|
3
|
+
import { DescriptionValueInfo } from '../interfaces/description.interface';
|
|
4
|
+
|
|
5
|
+
export class FbEquipment {
|
|
6
|
+
public collect(car: DataSchemes.Car): DescriptionValueInfo[] {
|
|
7
|
+
const doors = get(car, 'doors', {});
|
|
8
|
+
const wheel = get(car, 'wheel', {});
|
|
9
|
+
const extras = get(car, 'extras', {});
|
|
10
|
+
const window = get(car, 'window', {});
|
|
11
|
+
const mirrors = get(car, 'mirrors', {});
|
|
12
|
+
const multimedia = get(car, 'multimedia', {});
|
|
13
|
+
const climatisation = get(car, 'climatisation', {});
|
|
14
|
+
const airbag = get(car, 'airbags.airbag', []);
|
|
15
|
+
|
|
16
|
+
const auxiliaryHeating = get(car, 'heatingCooling.auxiliaryHeating', []);
|
|
17
|
+
const heatingCoolingClimatisation = get(car, 'heatingCooling.climatisation', null);
|
|
18
|
+
|
|
19
|
+
const lightSensor = get(car, 'lights.lightSensor', false);
|
|
20
|
+
const lights = get(car, 'lights', {});
|
|
21
|
+
delete (lights as any).lightSensor;
|
|
22
|
+
|
|
23
|
+
const seats = get(car, 'seats', {});
|
|
24
|
+
const backSeats = get(car, 'seats.backSeats', []);
|
|
25
|
+
const coDriverSeats = get(car, 'seats.coDriverSeats', []);
|
|
26
|
+
const driverSeats = get(car, 'seats.driverSeats', []);
|
|
27
|
+
const electricHeated = get(car, 'seats.electricHeated', null);
|
|
28
|
+
const electricHeatedRearSeats = get(car, 'seats.electricHeatedRearSeats', null);
|
|
29
|
+
delete (seats as any).backSeats;
|
|
30
|
+
delete (seats as any).coDriverSeats;
|
|
31
|
+
delete (seats as any).driverSeats;
|
|
32
|
+
|
|
33
|
+
const x4AllWeatherTires = get(car, 'wheels.x4AllWeatherTires', null);
|
|
34
|
+
const x4SummerTires = get(car, 'wheels.x4SummerTires', null);
|
|
35
|
+
const x4WinterTires = get(car, 'wheels.x4WinterTires', null);
|
|
36
|
+
|
|
37
|
+
const assistants = get(car, 'assistants', {});
|
|
38
|
+
const parkingAssistants = get(car, 'assistants.parkingAssistants', null);
|
|
39
|
+
const powerAssistedSteering = get(car, 'assistants.powerAssistedSteering', null);
|
|
40
|
+
delete (assistants as any).parkingAssistants;
|
|
41
|
+
delete (assistants as any).powerAssistedSteering;
|
|
42
|
+
|
|
43
|
+
const sportChassis = get(car, 'driveSuspension.sportChassis', null);
|
|
44
|
+
const adaptiveChassis = get(car, 'driveSuspension.adaptiveChassis', null);
|
|
45
|
+
const airSuspension = get(car, 'driveSuspension.airSuspension', null);
|
|
46
|
+
const roughRoadSuspension = get(car, 'driveSuspension.roughRoadSuspension', null);
|
|
47
|
+
const selfLockingDifferential = get(car, 'driveSuspension.selfLockingDifferential', null);
|
|
48
|
+
const airSuspensionAdaptive = get(car, 'driveSuspension.airSuspensionAdaptive', null);
|
|
49
|
+
const driveType = get(car, 'driveSuspension.driveType', null);
|
|
50
|
+
|
|
51
|
+
const heatingDriverSeats = driverSeats.indexOf('selector_driverSeats_electricHeated') !== -1;
|
|
52
|
+
const heatingCoDriverSeats = coDriverSeats.indexOf('selector_coDriverSeats_electricHeated') !== -1;
|
|
53
|
+
const heatingBackSeats = backSeats.indexOf('selector_backSeats_electricHeated') !== -1;
|
|
54
|
+
|
|
55
|
+
return [
|
|
56
|
+
{
|
|
57
|
+
title: 'accordion.captionAssistanceSystems',
|
|
58
|
+
value: [...this.objectToValues(assistants, 'assistants'), ...this.objectToValues({ lightSensor }, 'lights')],
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
title: 'accordion.captionAirbags',
|
|
62
|
+
value: this.arrayToValues(airbag),
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
title: 'accordion.captionParkingAid',
|
|
66
|
+
value: this.arrayToValues(parkingAssistants),
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
title: 'accordion.captionAirConditioning',
|
|
70
|
+
value: this.objectToValues({
|
|
71
|
+
[heatingCoolingClimatisation]: heatingCoolingClimatisation,
|
|
72
|
+
...climatisation,
|
|
73
|
+
}),
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
title: 'accordion.captionHeater',
|
|
77
|
+
value: this.objectToValues({
|
|
78
|
+
heatingCooling_auxiliaryHeating: auxiliaryHeating,
|
|
79
|
+
seats_driverSeats: heatingDriverSeats,
|
|
80
|
+
seats_coDriverSeats: heatingCoDriverSeats,
|
|
81
|
+
seats_backSeats: heatingBackSeats,
|
|
82
|
+
seats_electricHeated: electricHeated,
|
|
83
|
+
seats_electricHeatedRearSeats: electricHeatedRearSeats,
|
|
84
|
+
}),
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
title: 'accordion.captionMultimedia',
|
|
88
|
+
value: this.objectToValues(multimedia, 'multimedia'),
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
title: 'accordion.captionSeats',
|
|
92
|
+
value: [
|
|
93
|
+
...this.arrayToValues(backSeats),
|
|
94
|
+
...this.arrayToValues(coDriverSeats),
|
|
95
|
+
...this.arrayToValues(driverSeats),
|
|
96
|
+
...this.objectToValues(seats, 'seats'),
|
|
97
|
+
],
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
title: 'accordion.captionSteeringWheel',
|
|
101
|
+
value: [
|
|
102
|
+
...this.objectToValues(wheel, 'wheel'),
|
|
103
|
+
...this.objectToValues({ powerAssistedSteering }, 'assistants'),
|
|
104
|
+
],
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
title: 'accordion.captionLight',
|
|
108
|
+
value: this.objectToValues(lights, 'lights'),
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
title: 'accordion.captionDoors',
|
|
112
|
+
value: this.objectToValues(doors, 'doors'),
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
title: 'accordion.captionSlices',
|
|
116
|
+
value: this.objectToValues(window, 'window'),
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
title: 'accordion.captionMirror',
|
|
120
|
+
value: this.objectToValues(mirrors, 'mirrors'),
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
title: 'accordion.captionWheelsLandingGear',
|
|
124
|
+
value: [
|
|
125
|
+
...this.objectToValues(
|
|
126
|
+
{
|
|
127
|
+
sportChassis,
|
|
128
|
+
adaptiveChassis,
|
|
129
|
+
airSuspension,
|
|
130
|
+
roughRoadSuspension,
|
|
131
|
+
selfLockingDifferential,
|
|
132
|
+
airSuspensionAdaptive,
|
|
133
|
+
},
|
|
134
|
+
'driveSuspension',
|
|
135
|
+
),
|
|
136
|
+
...this.objectToValues({ x4AllWeatherTires, x4SummerTires, x4WinterTires }, 'bikes'),
|
|
137
|
+
...this.objectToValues({ [driveType]: driveType }),
|
|
138
|
+
],
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
title: 'accordion.captionExtras',
|
|
142
|
+
value: this.objectToValues(extras, 'extras'),
|
|
143
|
+
},
|
|
144
|
+
].filter(({ value }) => value.length > 0);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
private objectToValues(obj: {}, keyPrefix?: string): { key: string }[] {
|
|
148
|
+
return Object.entries(obj)
|
|
149
|
+
.map(([key, value]: [string, any]): [string, any] => [`${keyPrefix ? keyPrefix + '_' : ''}${key}`, value])
|
|
150
|
+
.filter(([, value]: [string, any]) => !!value)
|
|
151
|
+
.map(([translation]) => this.toValue(translation));
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
private arrayToValues(ara: string[]): { key: string }[] {
|
|
155
|
+
return ara.map(this.toValue);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
private toValue(translation: string): { key: string } {
|
|
159
|
+
return { key: translation };
|
|
160
|
+
}
|
|
161
|
+
}
|