@bytebrand/export-cars 1.26.13 → 1.26.14
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/dist/services/images.service.js +3 -14
- package/dist/services/images.service.js.map +1 -1
- package/dist/services/user.service.d.ts +0 -1
- package/dist/services/user.service.js +0 -8
- package/dist/services/user.service.js.map +1 -1
- package/dist/transformers/fb.transformer.js +3 -4
- package/dist/transformers/fb.transformer.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/services/images.service.ts +6 -30
- package/src/services/user.service.ts +0 -13
- package/src/transformers/fb.transformer.ts +8 -6
package/package.json
CHANGED
|
@@ -8,12 +8,12 @@ import { MarketingImageConfigsInterface } from '@bytebrand/autode-request';
|
|
|
8
8
|
import { ImboImageResponseInterface } from '@bytebrand/chunkable';
|
|
9
9
|
import { DataSchemes } from '@bytebrand/car-schema';
|
|
10
10
|
|
|
11
|
-
import { FB_MAX_IMAGE_COUNT_FOR_DEAFULT, META_AIA_CHANNEL_CODE
|
|
11
|
+
import { FB_MAX_IMAGE_COUNT_FOR_DEAFULT, META_AIA_CHANNEL_CODE } from '../constants/fb.constants';
|
|
12
12
|
import { ConfigService } from './config.service';
|
|
13
13
|
import { UserService } from './user.service';
|
|
14
14
|
import { isNotEmptyArray } from '../utils';
|
|
15
15
|
import { Config } from '../configs/config';
|
|
16
|
-
import {
|
|
16
|
+
import { ImageSize, ImageType } from '../enums';
|
|
17
17
|
|
|
18
18
|
@Injectable()
|
|
19
19
|
export class ImagesService {
|
|
@@ -176,28 +176,10 @@ export class ImagesService {
|
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
async getMarketingImages(carId: string, images: ImboImageResponseInterface[], ignoreDefImages: boolean): Promise<string[]> {
|
|
179
|
-
const
|
|
180
|
-
// fbMarketingImageId is a hardcoded per-environment id in config.ts and has drifted from
|
|
181
|
-
// the real meta_aia config at least once (dev's id pointed at a stale, never-populated "fb"
|
|
182
|
-
// channel) — the FB feed resolves its config by channelCode instead of trusting that id.
|
|
183
|
-
const config = this.configService.config.exportType === ExportType.FB
|
|
184
|
-
? await this.userService.getMarketingImageConfigByChannelCode(META_AIA_CHANNEL_CODE)
|
|
185
|
-
: await this.userService.getMarketingImageConfig(this.configService.config.marketingImageConfigId);
|
|
186
|
-
|
|
187
|
-
if (!config) {
|
|
188
|
-
console.log('getMarketingImages: no marketing image config found (channelCode meta_aia missing?)');
|
|
189
|
-
return ignoreDefImages ? [] : [...this.DEFAULT_IMAGES];
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
// marketingImageUrl AND config.imageUrl (FbConfig overrides the latter to the same
|
|
193
|
-
// per-env value right after super()) both point at the old "fb" channel's base path
|
|
194
|
-
// (/cache_test on dev, already /generated_images on prod) — not where image-generator
|
|
195
|
-
// publishes meta_aia composites. metaAiaImageUrl is derived from the un-suffixed
|
|
196
|
-
// baseImageUrl, so it's the one safe /generated_images base.
|
|
197
|
-
const imageUrl = config.channelCode === META_AIA_CHANNEL_CODE
|
|
198
|
-
? this.configService.config.metaAiaImageUrl
|
|
199
|
-
: this.configService.config.marketingImageUrl;
|
|
179
|
+
const imageUrl = this.configService.config.marketingImageUrl;
|
|
200
180
|
|
|
181
|
+
const transformedImages = this.transformImagesArrayIntoObject(images);
|
|
182
|
+
const config = await this.userService.getMarketingImageConfig(this.configService.config.marketingImageConfigId);
|
|
201
183
|
const marketingImageConfigs = config.marketingImages.map(i => ({ marketingImageCodes: i.imageCodes }));
|
|
202
184
|
|
|
203
185
|
const imageWithUrls: Partial<ImboImageResponseInterface & { url: string }>[] = [];
|
|
@@ -292,13 +274,7 @@ export class ImagesService {
|
|
|
292
274
|
|
|
293
275
|
protected getImagePathWithExtension(imageUrl: string, carId: string, imageId: string, config: MarketingImageConfigsInterface): string {
|
|
294
276
|
const { channelCode, imageExtension } = config;
|
|
295
|
-
|
|
296
|
-
// `meta-aia-leasing-{imageId}` (hyphenated, mode baked into the name) — not derived from
|
|
297
|
-
// channelCode the way other channels are. FB only wants the financing variant.
|
|
298
|
-
const filenamePrefix = channelCode === META_AIA_CHANNEL_CODE
|
|
299
|
-
? `meta-aia-${META_AIA_MODE_FINANCING}`
|
|
300
|
-
: channelCode.replace(/ /g, '-');
|
|
301
|
-
return `${this.getChannelPath(imageUrl, carId)}/${filenamePrefix}-${imageId}.${imageExtension}`;
|
|
277
|
+
return `${this.getChannelPath(imageUrl, carId)}/${channelCode.replace(/ /g, '-')}-${imageId}.${imageExtension}`;
|
|
302
278
|
}
|
|
303
279
|
|
|
304
280
|
sortImages(images: ImboImageResponseInterface[]): ImboImageResponseInterface[] {
|
|
@@ -67,17 +67,4 @@ export class UserService {
|
|
|
67
67
|
|
|
68
68
|
return result;
|
|
69
69
|
}
|
|
70
|
-
|
|
71
|
-
// The per-environment fbMarketingImageId config.ts hardcodes doesn't reliably point at the
|
|
72
|
-
// meta_aia channel (dev's id 8 turned out to be a stale, never-populated "fb" channel) —
|
|
73
|
-
// resolve by channelCode instead of trusting a fixed id.
|
|
74
|
-
async getMarketingImageConfigByChannelCode(channelCode: string): Promise<MarketingImageConfigInterface | null> {
|
|
75
|
-
const configs = await this.getMarketingImageConfigs();
|
|
76
|
-
const match = configs.find(config => config.channelCode === channelCode);
|
|
77
|
-
if (!match) {
|
|
78
|
-
return null;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return this.getMarketingImageConfig(match.id);
|
|
82
|
-
}
|
|
83
70
|
}
|
|
@@ -30,13 +30,13 @@ import { ConfigService, ImagesService, MappingService } from '../services';
|
|
|
30
30
|
import { FbEquipment } from './fb-equipment.transformer';
|
|
31
31
|
import { isValidVin, normalizeFeedText } from '../utils';
|
|
32
32
|
import { UserService } from 'src/services';
|
|
33
|
-
import { ImageType } from '../enums';
|
|
34
33
|
import {
|
|
35
34
|
DEFAULT_ADDR1,
|
|
36
35
|
DEFAULT_CITY,
|
|
37
36
|
DEFAULT_ZIP,
|
|
38
37
|
FB_MAX_TRIM_LENGTH,
|
|
39
38
|
FB_MIN_MILEAGES,
|
|
39
|
+
META_AIA_MODE_FINANCING,
|
|
40
40
|
META_PUSH_PRIORITY_ALLOWED_VALUES,
|
|
41
41
|
META_PUSH_PRIORITY_STANDARD,
|
|
42
42
|
TIMESTAMP_FIRST_YEAR,
|
|
@@ -72,10 +72,12 @@ export class FbTransformer {
|
|
|
72
72
|
images: ImboImageResponseInterface[];
|
|
73
73
|
owner: unknown;
|
|
74
74
|
}): Promise<unknown> {
|
|
75
|
-
//
|
|
76
|
-
//
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
// Meta AIA financing overlay is the ONLY image this feed ships — same HEAD-checked path as
|
|
76
|
+
// the AMA facebook-shop feed. getMetaAiaImage returns null when the car has no eligible photo
|
|
77
|
+
// OR the composite hasn't actually been rendered/landed on the CDN yet, so every exported item
|
|
78
|
+
// is guaranteed a real, existing image (no placeholders, no 404s, no zero-image cars).
|
|
79
|
+
const metaAiaImage = await this.imagesService.getMetaAiaImage(car._id, images, META_AIA_MODE_FINANCING);
|
|
80
|
+
if (!metaAiaImage) {
|
|
79
81
|
return null;
|
|
80
82
|
}
|
|
81
83
|
|
|
@@ -105,7 +107,7 @@ export class FbTransformer {
|
|
|
105
107
|
make: toString(get(car, 'mainData.make', '')),
|
|
106
108
|
model: toString(get(car, 'mainData.model', '')),
|
|
107
109
|
trim: this.getTrim(car),
|
|
108
|
-
image:
|
|
110
|
+
image: [metaAiaImage], // single Meta AIA financing overlay, per feed spec
|
|
109
111
|
year: toString(year),
|
|
110
112
|
mileage: {
|
|
111
113
|
value: this.getMileage(car),
|