@bytebrand/export-cars 1.26.17 → 1.26.19
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/configs/facebook-shop.config.js +1 -1
- package/dist/configs/facebook-shop.config.js.map +1 -1
- package/dist/configs/fb.config.js +1 -1
- package/dist/configs/fb.config.js.map +1 -1
- package/dist/configs/google.config.js +1 -1
- package/dist/configs/google.config.js.map +1 -1
- package/dist/constants/feed-price.constants.d.ts +1 -0
- package/dist/constants/feed-price.constants.js +4 -1
- package/dist/constants/feed-price.constants.js.map +1 -1
- package/dist/exporters/facebook-shop.exporter.js +1 -1
- package/dist/exporters/facebook-shop.exporter.js.map +1 -1
- package/dist/interfaces/params.interface.d.ts +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/configs/facebook-shop.config.ts +2 -2
- package/src/configs/fb.config.ts +2 -2
- package/src/configs/google.config.ts +2 -2
- package/src/constants/feed-price.constants.ts +7 -0
- package/src/exporters/facebook-shop.exporter.ts +3 -1
- package/src/interfaces/params.interface.ts +3 -0
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Params } from '../interfaces/params.interface';
|
|
2
2
|
import { Config } from './config';
|
|
3
3
|
import { ExportType, FileType } from '../enums';
|
|
4
|
-
import {
|
|
4
|
+
import { resolveMaxFeedSalesPrice } from '../constants/feed-price.constants';
|
|
5
5
|
|
|
6
6
|
export class FacebookShopConfig extends Config {
|
|
7
7
|
constructor(params: Params) {
|
|
8
8
|
super(params);
|
|
9
9
|
this.pathesConfig.localConvertedDirectory = `resources/${ExportType.FACEBOOK_SHOP}-export`;
|
|
10
|
-
this.maxCurrentSalesPrice =
|
|
10
|
+
this.maxCurrentSalesPrice = resolveMaxFeedSalesPrice(params.maxCurrentSalesPrice);
|
|
11
11
|
this.imageUrl = this.environmentConfig[params.environment].baseImageUrl;
|
|
12
12
|
this.outputFiles = [
|
|
13
13
|
`${this.pathesConfig.localConvertedDirectory}/api_export_cars_${ExportType.FACEBOOK_SHOP}.${FileType.XML}`,
|
package/src/configs/fb.config.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExportType, FileType, ImageType } from 'src/enums';
|
|
2
|
-
import {
|
|
2
|
+
import { resolveMaxFeedSalesPrice } from '../constants/feed-price.constants';
|
|
3
3
|
import { Params } from '../interfaces/params.interface';
|
|
4
4
|
import { Config } from './config';
|
|
5
5
|
|
|
@@ -7,7 +7,7 @@ export class FbConfig extends Config {
|
|
|
7
7
|
constructor(params: Params) {
|
|
8
8
|
super(params);
|
|
9
9
|
this.pathesConfig.localConvertedDirectory = `resources/${ExportType.FB}-export`;
|
|
10
|
-
this.maxCurrentSalesPrice =
|
|
10
|
+
this.maxCurrentSalesPrice = resolveMaxFeedSalesPrice(params.maxCurrentSalesPrice);
|
|
11
11
|
this.imageUrl = this.environmentConfig[params.environment].imageUrl;
|
|
12
12
|
this.imageType = ImageType.marketing;
|
|
13
13
|
this.marketingImageConfigId = this.environmentConfig[params.environment].fbMarketingImageId;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExportType, FileType, ImageType } from 'src/enums';
|
|
2
|
-
import {
|
|
2
|
+
import { resolveMaxFeedSalesPrice } from '../constants/feed-price.constants';
|
|
3
3
|
import { Params } from '../interfaces/params.interface';
|
|
4
4
|
import { Config } from './config';
|
|
5
5
|
|
|
@@ -8,7 +8,7 @@ export class GoogleConfig extends Config {
|
|
|
8
8
|
super(params);
|
|
9
9
|
this.pathesConfig.localConvertedDirectory = `resources/${ExportType.GOOGLE}-export`;
|
|
10
10
|
this.imageType = ImageType.default;
|
|
11
|
-
this.maxCurrentSalesPrice =
|
|
11
|
+
this.maxCurrentSalesPrice = resolveMaxFeedSalesPrice(params.maxCurrentSalesPrice);
|
|
12
12
|
this.outputFiles = [
|
|
13
13
|
`${this.pathesConfig.localConvertedDirectory}/api_export_cars_${ExportType.GOOGLE}.${FileType.XML}`,
|
|
14
14
|
];
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
+
import { toNumber } from 'lodash';
|
|
2
|
+
|
|
1
3
|
// Shared eligibility cap for the Google Vehicle Ads and Meta AIA/AMA feeds:
|
|
2
4
|
// only cars whose end-customer selling price (price.currentSalesPrice) is
|
|
3
5
|
// ≤ €80,000 may be exported. €80,000.00 itself is still included.
|
|
4
6
|
export const MAX_FEED_SALES_PRICE_EUR = 80_000;
|
|
7
|
+
|
|
8
|
+
// The Cronicle "Max currentSalesPrice" plugin param (a text field) can override
|
|
9
|
+
// the default cap per event; empty/invalid/non-positive values fall back to it.
|
|
10
|
+
export const resolveMaxFeedSalesPrice = (raw?: string): number =>
|
|
11
|
+
toNumber(raw) > 0 ? toNumber(raw) : MAX_FEED_SALES_PRICE_EUR;
|
|
@@ -35,7 +35,9 @@ export class FacebookShopExporter implements Exporter {
|
|
|
35
35
|
const chunkData = chunk.data.filter(car => this.carService.filterCar(car, this.rulesService.rules));
|
|
36
36
|
|
|
37
37
|
for (let i = 0; i < chunkData.length; i += 1) {
|
|
38
|
-
|
|
38
|
+
// chunkData, not chunk.data: indexing the unfiltered array here used to
|
|
39
|
+
// re-admit cars that filterCar had just rejected (and drop valid ones).
|
|
40
|
+
const data = chunkData[i];
|
|
39
41
|
|
|
40
42
|
// console.time(`Transform ${data.car._id}`);
|
|
41
43
|
const items = await facebookShopTransformer.transform(data);
|
|
@@ -11,4 +11,7 @@ export interface Params {
|
|
|
11
11
|
cpc?: string;
|
|
12
12
|
ownerId?: string;
|
|
13
13
|
metaPushPriorityCsvUrl?: string;
|
|
14
|
+
// Cronicle plugin param (text field, so it arrives as a string); overrides the
|
|
15
|
+
// default MAX_FEED_SALES_PRICE_EUR cap in the configs that apply one.
|
|
16
|
+
maxCurrentSalesPrice?: string;
|
|
14
17
|
}
|