@bytebrand/export-cars 1.21.5 → 1.21.6

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.5",
3
+ "version": "1.21.6",
4
4
  "description": "",
5
5
  "author": "bytebrand",
6
6
  "license": "UNLICENSED",
@@ -57,5 +57,5 @@
57
57
  "engines": {
58
58
  "node": ">=14.0.0"
59
59
  },
60
- "gitHead": "c46dc21ef680cacb4416368e3bedb9c9af31624d"
60
+ "gitHead": "3e501f070195d64033e9efbd5bf62cbde7fd8422"
61
61
  }
@@ -119,28 +119,34 @@ export class ImagesService {
119
119
  async getMarketingImages(carId: string, images: ImboImageResponseInterface[], ignoreDefImages: boolean): Promise<string[]> {
120
120
  const imageUrl = this.configService.config.marketingImageUrl;
121
121
 
122
- const transformedImages = this.transformImagesArrayIntoObject(this.sortImages(images));
122
+ const transformedImages = this.transformImagesArrayIntoObject(images);
123
123
  const config = await this.userService.getMarketingImageConfig(this.configService.config.marketingImageConfigId);
124
124
  const marketingImageConfigs = config.marketingImages.map(i => ({ marketingImageCodes: i.imageCodes }));
125
125
 
126
- const imageUrls = [];
126
+ const imageWithUrls: Partial<ImboImageResponseInterface & { url: string }>[] = [];
127
127
  for (let i = 0; i < marketingImageConfigs.length; i++) {
128
128
  const marketingImage = marketingImageConfigs[i];
129
129
  for (let i = 0; i < marketingImage.marketingImageCodes.length; i++) {
130
130
  const imageCode = marketingImage.marketingImageCodes[i];
131
131
  const imageId = transformedImages[imageCode];
132
132
  if (imageId) {
133
- imageUrls.push(this.getImagePathWithExtension(imageUrl, carId, imageId, config));
133
+ imageWithUrls.push({
134
+ imageCodePredicted: imageCode,
135
+ url: this.getImagePathWithExtension(imageUrl, carId, imageId, config)
136
+ });
134
137
  break;
135
138
  }
136
139
  }
137
140
  }
138
141
 
139
- if (!ignoreDefImages && imageUrls.length < FB_MAX_IMAGE_COUNT_FOR_DEAFULT) {
140
- imageUrls.push(...this.DEFAULT_IMAGES);
142
+ this.sortImages(imageWithUrls as ImboImageResponseInterface[]);
143
+
144
+
145
+ if (!ignoreDefImages && imageWithUrls.length < FB_MAX_IMAGE_COUNT_FOR_DEAFULT) {
146
+ imageWithUrls.map(i => i.url).push(...this.DEFAULT_IMAGES);
141
147
  }
142
148
 
143
- return imageUrls;
149
+ return imageWithUrls.map(i => i.url);
144
150
  }
145
151
 
146
152
  private transformImagesArrayIntoObject(images: ImboImageResponseInterface[]): { [imageCode: string]: string } {