@bytebrand/export-cars 1.21.90 → 1.21.91
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
|
@@ -86,7 +86,7 @@ export class GoogleTransformer {
|
|
|
86
86
|
fuel_consumption: `${this.transformService.fuelConsumption(car)}l/100km`,
|
|
87
87
|
energy_consumption: this.getWLTP(car),
|
|
88
88
|
co2_emissions: `${this.transformService.cO2Emission(car)}g/km`,
|
|
89
|
-
description: (await this.getDescription(car))
|
|
89
|
+
description: this.processText((await this.getDescription(car))),
|
|
90
90
|
identifier_exists: 'no',
|
|
91
91
|
availability: 'in_stock',
|
|
92
92
|
// custom_label_0: '',
|
|
@@ -119,6 +119,26 @@ export class GoogleTransformer {
|
|
|
119
119
|
return trim(escape(join([this.getBrand(car), model], ' ')));
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
+
private processText(input: string) {
|
|
123
|
+
return input
|
|
124
|
+
.replace(/\*\*\\/g, '</strong></p>|||')
|
|
125
|
+
.replace(/\*\*/g, '<p><strong>')
|
|
126
|
+
.split('|||')
|
|
127
|
+
.map(item => item.trim())
|
|
128
|
+
.flatMap(str =>
|
|
129
|
+
str.split('\\')
|
|
130
|
+
.map(item => item.trim())
|
|
131
|
+
.filter(Boolean)
|
|
132
|
+
)
|
|
133
|
+
.map(item =>
|
|
134
|
+
item.startsWith('* ') ? item.slice(2) : item
|
|
135
|
+
)
|
|
136
|
+
.map(item =>
|
|
137
|
+
item.includes('<p>') ? item : `<p>${item}</p>`
|
|
138
|
+
)
|
|
139
|
+
.join('');
|
|
140
|
+
}
|
|
141
|
+
|
|
122
142
|
private async getDescription(car: DataSchemes.Car): Promise<string> {
|
|
123
143
|
const dealerId = get(car, 'metaData.ownerId');
|
|
124
144
|
const descriptionSchema = await this.userService.getDefaultSummaryByDealerId(dealerId);
|