@bytebrand/export-cars 1.21.20 → 1.21.22

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytebrand/export-cars",
3
- "version": "1.21.20",
3
+ "version": "1.21.22",
4
4
  "description": "",
5
5
  "author": "bytebrand",
6
6
  "license": "UNLICENSED",
@@ -14,7 +14,7 @@ export class GoogleXmlBuilder extends XMLBuilderBase {
14
14
  if (key === 'installment') {
15
15
  return this.getInstallmentElement(key, data);
16
16
  }
17
- return this.getElement(`g:${key}`, data);
17
+ return this.getElement(`g:${key}`, this.escapeXML(data));
18
18
  })
19
19
  .join('');
20
20
 
@@ -32,4 +32,12 @@ export class GoogleXmlBuilder extends XMLBuilderBase {
32
32
  <g:amount>${data.monthlyInstallment} EUR</g:amount>
33
33
  </g:${rootTag}>`;
34
34
  }
35
+
36
+ private escapeXML(str: string): string {
37
+ return str.replace(/&/g, '&amp;')
38
+ .replace(/</g, '&lt;')
39
+ .replace(/>/g, '&gt;')
40
+ .replace(/"/g, '&quot;')
41
+ .replace(/'/g, '&apos;');
42
+ }
35
43
  }
@@ -146,13 +146,14 @@ export interface GoogleXmlItem {
146
146
  link: string;
147
147
  image_link: string;
148
148
  condition: string;
149
- availability: string;
150
149
  brand: any;
151
150
  price: string;
152
- sale_price: string;
153
- energy_efficiency_class: string;
154
151
  color: string;
155
- installment: { paybackPeriod: any; monthlyInstallment: any };
152
+
153
+ sale_price?: string;
154
+ availability?: string;
155
+ energy_efficiency_class?: string;
156
+ installment?: { paybackPeriod: any; monthlyInstallment: any };
156
157
 
157
158
  additional_image_link: string;
158
159
  model: string;
@@ -42,8 +42,8 @@ export class GoogleTransformer {
42
42
  id: carId,
43
43
  image_link: transformedImages[0],
44
44
  additional_image_link: transformedImages.slice(1).join(','),
45
- // ads_redirect: this.getLink(car),
46
- link: this.transformService.link(car),
45
+ ads_redirect: this.getLink(car),
46
+ link: this.getLink(car),
47
47
  condition: this.mapState(car),
48
48
  price: this.getPrice(car),
49
49
  // certified_pre-owned: '',
@@ -67,11 +67,11 @@ export class GoogleTransformer {
67
67
  // custom_label_3: '',
68
68
  // custom_label_4: '',
69
69
 
70
- availability: this.getAvailability(car),
71
- sale_price: this.getPrice(car),
72
- energy_efficiency_class: this.getEnergyClass(car),
73
- installment: this.getInstallment(car),
74
- custom_label_0: `${this.getInstallment(car)} EUR mtl.`,
70
+ // availability: this.getAvailability(car),
71
+ // sale_price: this.getPrice(car),
72
+ // energy_efficiency_class: this.getEnergyClass(car),
73
+ // installment: this.getInstallment(car),
74
+ // custom_label_0: `${this.getInstallment(car)} EUR mtl.`,
75
75
  };
76
76
  }
77
77