@bprotsyk/aso-core 2.1.67 → 2.1.69
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/lib/app/app.d.ts
CHANGED
|
@@ -49,6 +49,9 @@ export declare enum EDirectType {
|
|
|
49
49
|
KEITARO_OFFER = "keitaroOffer",
|
|
50
50
|
OFFER_DIRECT = "offerDirect"
|
|
51
51
|
}
|
|
52
|
+
export declare enum EBannerType {
|
|
53
|
+
OFFER_DIRECT = "offerDirect"
|
|
54
|
+
}
|
|
52
55
|
export declare const getPlatformName: (platform: EPlatform | undefined) => string | false;
|
|
53
56
|
export interface IPlatformParams {
|
|
54
57
|
enabled: boolean;
|
|
@@ -111,6 +114,7 @@ export interface IBannerParams {
|
|
|
111
114
|
imageParam: string;
|
|
112
115
|
linkParam: string;
|
|
113
116
|
showStubOnError?: boolean;
|
|
117
|
+
directType?: EDirectType;
|
|
114
118
|
}
|
|
115
119
|
export interface IRemoveDataParams {
|
|
116
120
|
buttonText: string;
|
package/lib/app/app.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AppSchema = exports.PlugType = exports.IntegrationVersion = exports.getPlatformName = exports.EDirectType = exports.EPlatform = exports.EImageFormat = void 0;
|
|
3
|
+
exports.AppSchema = exports.PlugType = exports.IntegrationVersion = exports.getPlatformName = exports.EBannerType = exports.EDirectType = exports.EPlatform = exports.EImageFormat = void 0;
|
|
4
4
|
const app_type_1 = require("./app-type");
|
|
5
5
|
const mongoose_1 = require("mongoose");
|
|
6
6
|
const util = require("util");
|
|
@@ -26,6 +26,10 @@ var EDirectType;
|
|
|
26
26
|
EDirectType["KEITARO_OFFER"] = "keitaroOffer";
|
|
27
27
|
EDirectType["OFFER_DIRECT"] = "offerDirect";
|
|
28
28
|
})(EDirectType = exports.EDirectType || (exports.EDirectType = {}));
|
|
29
|
+
var EBannerType;
|
|
30
|
+
(function (EBannerType) {
|
|
31
|
+
EBannerType["OFFER_DIRECT"] = "offerDirect";
|
|
32
|
+
})(EBannerType = exports.EBannerType || (exports.EBannerType = {}));
|
|
29
33
|
const getPlatformName = (platform) => {
|
|
30
34
|
switch (platform) {
|
|
31
35
|
case EPlatform.SAMSUNG:
|
|
@@ -287,16 +287,29 @@ async function cloneDirectCampaign(app, platform) {
|
|
|
287
287
|
let allCampaigns = await getAllCampaigns();
|
|
288
288
|
let matchingCampaign = [];
|
|
289
289
|
if (platform && platform !== app_1.EPlatform.GENERAL) {
|
|
290
|
-
//
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
290
|
+
// Для конкретної платформи
|
|
291
|
+
const platformName = (0, app_1.getPlatformName)(platform);
|
|
292
|
+
matchingCampaign = allCampaigns.filter((c) => {
|
|
293
|
+
// Перевіряємо наявність ID в будь-якому місці
|
|
294
|
+
const hasId = c.name.includes(app.id.toString());
|
|
295
|
+
// Перевіряємо наявність стрілки
|
|
296
|
+
const hasArrow = c.name.includes('➥');
|
|
297
|
+
// Перевіряємо наявність платформи в дужках
|
|
298
|
+
const hasPlatform = c.name.includes(`(${platformName})`);
|
|
299
|
+
return hasId && hasArrow && hasPlatform;
|
|
300
|
+
});
|
|
294
301
|
}
|
|
295
302
|
else {
|
|
296
|
-
//
|
|
297
|
-
matchingCampaign = allCampaigns.filter((c) =>
|
|
298
|
-
|
|
299
|
-
|
|
303
|
+
// Для General платформи
|
|
304
|
+
matchingCampaign = allCampaigns.filter((c) => {
|
|
305
|
+
// Перевіряємо наявність ID в будь-якому місці
|
|
306
|
+
const hasId = c.name.includes(app.id.toString());
|
|
307
|
+
// Перевіряємо наявність стрілки
|
|
308
|
+
const hasArrow = c.name.includes('➥');
|
|
309
|
+
// Перевіряємо відсутність дужок з платформою
|
|
310
|
+
const hasNoPlatform = !/\([^)]+\)/.test(c.name);
|
|
311
|
+
return hasId && hasArrow && hasNoPlatform;
|
|
312
|
+
});
|
|
300
313
|
}
|
|
301
314
|
if (matchingCampaign.length > 0)
|
|
302
315
|
return matchingCampaign[0];
|
package/package.json
CHANGED
package/src/app/app.ts
CHANGED
|
@@ -62,6 +62,11 @@ export enum EDirectType{
|
|
|
62
62
|
OFFER_DIRECT = 'offerDirect',
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
export enum EBannerType{
|
|
66
|
+
|
|
67
|
+
OFFER_DIRECT = 'offerDirect',
|
|
68
|
+
}
|
|
69
|
+
|
|
65
70
|
|
|
66
71
|
export const getPlatformName = (platform: EPlatform | undefined): string | false => {
|
|
67
72
|
switch (platform) {
|
|
@@ -153,7 +158,8 @@ export interface IBannerParams {
|
|
|
153
158
|
imagePath: string,
|
|
154
159
|
imageParam: string,
|
|
155
160
|
linkParam: string,
|
|
156
|
-
showStubOnError?: boolean
|
|
161
|
+
showStubOnError?: boolean,
|
|
162
|
+
directType?: EDirectType
|
|
157
163
|
}
|
|
158
164
|
|
|
159
165
|
export interface IRemoveDataParams {
|
|
@@ -354,23 +354,31 @@ async function cloneDirectCampaign(app: IApp, platform?: EPlatform): Promise<IKe
|
|
|
354
354
|
};
|
|
355
355
|
|
|
356
356
|
let allCampaigns = await getAllCampaigns();
|
|
357
|
-
|
|
358
357
|
let matchingCampaign: IKeitaroCampaign[] = [];
|
|
359
358
|
|
|
360
359
|
if (platform && platform !== EPlatform.GENERAL) {
|
|
361
|
-
//
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
c.name.includes(
|
|
366
|
-
|
|
360
|
+
// Для конкретної платформи
|
|
361
|
+
const platformName = getPlatformName(platform);
|
|
362
|
+
matchingCampaign = allCampaigns.filter((c) => {
|
|
363
|
+
// Перевіряємо наявність ID в будь-якому місці
|
|
364
|
+
const hasId = c.name.includes(app.id.toString());
|
|
365
|
+
// Перевіряємо наявність стрілки
|
|
366
|
+
const hasArrow = c.name.includes('➥');
|
|
367
|
+
// Перевіряємо наявність платформи в дужках
|
|
368
|
+
const hasPlatform = c.name.includes(`(${platformName})`);
|
|
369
|
+
return hasId && hasArrow && hasPlatform;
|
|
370
|
+
});
|
|
367
371
|
} else {
|
|
368
|
-
//
|
|
369
|
-
matchingCampaign = allCampaigns.filter((c) =>
|
|
370
|
-
|
|
371
|
-
c.name.includes(
|
|
372
|
-
|
|
373
|
-
|
|
372
|
+
// Для General платформи
|
|
373
|
+
matchingCampaign = allCampaigns.filter((c) => {
|
|
374
|
+
// Перевіряємо наявність ID в будь-якому місці
|
|
375
|
+
const hasId = c.name.includes(app.id.toString());
|
|
376
|
+
// Перевіряємо наявність стрілки
|
|
377
|
+
const hasArrow = c.name.includes('➥');
|
|
378
|
+
// Перевіряємо відсутність дужок з платформою
|
|
379
|
+
const hasNoPlatform = !/\([^)]+\)/.test(c.name);
|
|
380
|
+
return hasId && hasArrow && hasNoPlatform;
|
|
381
|
+
});
|
|
374
382
|
}
|
|
375
383
|
|
|
376
384
|
if (matchingCampaign.length > 0) return matchingCampaign[0];
|