@bprotsyk/aso-core 2.1.181 → 2.1.183
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 +2 -97
- package/lib/app/app.js +5 -50
- package/lib/general/domain.d.ts +3 -3
- package/lib/index.d.ts +2 -1
- package/lib/index.js +3 -1
- package/lib/keitaro/keitaro-clo-geos.js +4 -4
- package/lib/network/keitaro/traffle/traffle-keitaro-service.js +29 -15
- package/lib/panel/app/upsert-flash-app-request.d.ts +2 -11
- package/lib/utils/keitaro-utils.js +1 -1
- package/package.json +1 -1
- package/src/app/app.ts +5 -99
- package/src/index.ts +3 -2
- package/src/keitaro/keitaro-clo-geos.ts +4 -4
- package/src/network/keitaro/traffle/traffle-keitaro-service.ts +32 -16
- package/src/panel/app/upsert-flash-app-request.ts +2 -12
- package/src/utils/keitaro-utils.ts +1 -1
package/lib/app/app.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { AppType } from "./app-type";
|
|
2
1
|
import mongoose, { Document } from "mongoose";
|
|
3
2
|
export interface IAppsflyerPostback {
|
|
4
3
|
campaign_id: number;
|
|
@@ -12,43 +11,23 @@ export interface IApp extends Document {
|
|
|
12
11
|
id: number;
|
|
13
12
|
enabled: boolean;
|
|
14
13
|
name: string;
|
|
15
|
-
trackingUrl?: string;
|
|
16
14
|
bundle: string;
|
|
17
|
-
pushesEnabled?: boolean;
|
|
18
|
-
policyUrl?: string;
|
|
19
|
-
type: AppType;
|
|
20
15
|
status: AppStatus;
|
|
21
|
-
geo: string[];
|
|
22
16
|
team: ETeam;
|
|
23
17
|
onesignalAppId: string;
|
|
24
18
|
onesignalRestApiKey: string;
|
|
25
19
|
appmetricaApiKey?: string;
|
|
26
20
|
appmetricaAppId?: number;
|
|
27
|
-
webInterfaceName: string;
|
|
28
21
|
keitaroData: IAppKeitaroData | null;
|
|
29
|
-
integrationVersion: IntegrationVersion;
|
|
30
|
-
offersStubParams?: IOffersStubParams;
|
|
31
|
-
directParams?: IDirectParams;
|
|
32
22
|
bannerParams?: IBannerParams;
|
|
33
|
-
remoteServerParams?: IRemoteServerParams;
|
|
34
23
|
domainParams: IDomainParams;
|
|
35
24
|
platforms: {
|
|
36
25
|
[key: string]: IPlatformParams;
|
|
37
26
|
};
|
|
38
|
-
publicationHistory: IPublicationHistory;
|
|
39
|
-
offersListId: number;
|
|
40
|
-
externalParams?: IExternalParams;
|
|
41
|
-
proxied: boolean;
|
|
42
27
|
ech?: boolean;
|
|
43
|
-
imageFormat: EImageFormat;
|
|
44
28
|
policyPath: string;
|
|
45
29
|
postbacks?: IAppsflyerPostback[];
|
|
46
30
|
}
|
|
47
|
-
export declare enum EImageFormat {
|
|
48
|
-
PNG = "png",
|
|
49
|
-
JPEG = "jpg",
|
|
50
|
-
WEBP = "webp"
|
|
51
|
-
}
|
|
52
31
|
export declare enum ETeam {
|
|
53
32
|
TRAFFLE = "traffle",
|
|
54
33
|
ELTRAFICO = "eltrafico"
|
|
@@ -70,15 +49,9 @@ export declare enum EDirectType {
|
|
|
70
49
|
TRAFFLE_KEITARO_OFFER = "traffleKeitaroOffer",
|
|
71
50
|
TRAFFLE_OFFER_DIRECT = "traffleOfferDirect"
|
|
72
51
|
}
|
|
73
|
-
export interface IPublicationHistory {
|
|
74
|
-
publications: number[];
|
|
75
|
-
removals: IRemovalInfo[];
|
|
76
|
-
}
|
|
77
52
|
export declare const getPlatformName: (platform: EPlatform | undefined) => string | false;
|
|
78
53
|
export interface IPlatformParams {
|
|
79
54
|
enabled: boolean;
|
|
80
|
-
geo: string[];
|
|
81
|
-
trackingUrl?: string;
|
|
82
55
|
adjustParams?: {
|
|
83
56
|
appId: string;
|
|
84
57
|
eventIds: IAdjustEventIds;
|
|
@@ -87,7 +60,6 @@ export interface IPlatformParams {
|
|
|
87
60
|
enabled: boolean;
|
|
88
61
|
keitaroData: IAppKeitaroData | boolean;
|
|
89
62
|
directType?: EDirectType;
|
|
90
|
-
trackingUrl?: string;
|
|
91
63
|
addDefaultStreams?: boolean;
|
|
92
64
|
};
|
|
93
65
|
metricaParams?: {
|
|
@@ -101,7 +73,6 @@ export interface IPlatformParams {
|
|
|
101
73
|
devKey: string;
|
|
102
74
|
};
|
|
103
75
|
proxied?: boolean;
|
|
104
|
-
keitaroData?: IAppKeitaroData | boolean;
|
|
105
76
|
}
|
|
106
77
|
export interface IAdjustEventIds {
|
|
107
78
|
lead: string;
|
|
@@ -109,29 +80,11 @@ export interface IAdjustEventIds {
|
|
|
109
80
|
sale: string;
|
|
110
81
|
rejected: string;
|
|
111
82
|
}
|
|
112
|
-
export interface IExternalParams {
|
|
113
|
-
showButton: boolean;
|
|
114
|
-
schema: string;
|
|
115
|
-
autoRedirect: boolean;
|
|
116
|
-
}
|
|
117
|
-
export interface IRemoteServerParams {
|
|
118
|
-
ip: string;
|
|
119
|
-
port: string;
|
|
120
|
-
password: string;
|
|
121
|
-
}
|
|
122
|
-
export interface IOffersStubParams {
|
|
123
|
-
offersPath: string;
|
|
124
|
-
imagesPath: string;
|
|
125
|
-
}
|
|
126
83
|
export interface IDomainParams {
|
|
127
84
|
name: string;
|
|
128
85
|
clouflareZone: string;
|
|
129
86
|
ready: boolean;
|
|
130
87
|
}
|
|
131
|
-
export interface IDirectParams {
|
|
132
|
-
path: string;
|
|
133
|
-
response: string;
|
|
134
|
-
}
|
|
135
88
|
export interface IBannerParams {
|
|
136
89
|
dataPath: string;
|
|
137
90
|
imagePath: string;
|
|
@@ -140,12 +93,9 @@ export interface IBannerParams {
|
|
|
140
93
|
showStubOnError?: boolean;
|
|
141
94
|
}
|
|
142
95
|
export declare enum AppStatus {
|
|
143
|
-
INACTIVE = "INACTIVE",
|
|
144
|
-
PUBLISHED = "PUBLISHED",
|
|
145
|
-
MODERATION = "ACTIVE",
|
|
146
|
-
REMOVED = "REMOVED",
|
|
147
96
|
ARCHIVED = "ARCHIVED",
|
|
148
|
-
|
|
97
|
+
IN_DEVELOPMENT = "IN_DEVELOPMENT",
|
|
98
|
+
READY = "READY"
|
|
149
99
|
}
|
|
150
100
|
export interface IRemoveDataParams {
|
|
151
101
|
buttonText: string;
|
|
@@ -207,17 +157,11 @@ export declare enum PlugType {
|
|
|
207
157
|
}
|
|
208
158
|
export declare const AppSchema: mongoose.Schema<any, mongoose.Model<any, any, any, any, any, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, {
|
|
209
159
|
id: number;
|
|
210
|
-
type: AppType;
|
|
211
|
-
geo: string[];
|
|
212
160
|
enabled: boolean;
|
|
213
|
-
proxied: boolean;
|
|
214
161
|
ech: boolean;
|
|
215
|
-
imageFormat: EImageFormat;
|
|
216
162
|
status: AppStatus;
|
|
217
163
|
team: ETeam;
|
|
218
164
|
bundle: string;
|
|
219
|
-
trackingUrl: string;
|
|
220
|
-
integrationVersion: IntegrationVersion;
|
|
221
165
|
removeInfo: any;
|
|
222
166
|
policyPath: string;
|
|
223
167
|
postbacks: mongoose.Types.DocumentArray<{
|
|
@@ -243,23 +187,14 @@ export declare const AppSchema: mongoose.Schema<any, mongoose.Model<any, any, an
|
|
|
243
187
|
notes?: string | null | undefined;
|
|
244
188
|
}>;
|
|
245
189
|
name?: string | null | undefined;
|
|
246
|
-
pushesEnabled?: boolean | null | undefined;
|
|
247
|
-
publicationHistory?: any;
|
|
248
190
|
removeDataParams?: any;
|
|
249
191
|
privacyPolicyParams?: any;
|
|
250
|
-
offersStubParams?: any;
|
|
251
192
|
bannerParams?: any;
|
|
252
|
-
directParams?: any;
|
|
253
193
|
platforms?: any;
|
|
254
194
|
onesignalAppId?: string | null | undefined;
|
|
255
195
|
onesignalRestApiKey?: string | null | undefined;
|
|
256
196
|
appmetricaApiKey?: string | null | undefined;
|
|
257
197
|
appmetricaAppId?: number | null | undefined;
|
|
258
|
-
externalParams?: {
|
|
259
|
-
schema?: string | null | undefined;
|
|
260
|
-
showButton?: boolean | null | undefined;
|
|
261
|
-
autoRedirect?: boolean | null | undefined;
|
|
262
|
-
} | null | undefined;
|
|
263
198
|
keitaroData?: {
|
|
264
199
|
trackingCampaignId: number;
|
|
265
200
|
trackingCampaignName: string;
|
|
@@ -273,17 +208,11 @@ export declare const AppSchema: mongoose.Schema<any, mongoose.Model<any, any, an
|
|
|
273
208
|
} | null | undefined;
|
|
274
209
|
}, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
|
|
275
210
|
id: number;
|
|
276
|
-
type: AppType;
|
|
277
|
-
geo: string[];
|
|
278
211
|
enabled: boolean;
|
|
279
|
-
proxied: boolean;
|
|
280
212
|
ech: boolean;
|
|
281
|
-
imageFormat: EImageFormat;
|
|
282
213
|
status: AppStatus;
|
|
283
214
|
team: ETeam;
|
|
284
215
|
bundle: string;
|
|
285
|
-
trackingUrl: string;
|
|
286
|
-
integrationVersion: IntegrationVersion;
|
|
287
216
|
removeInfo: any;
|
|
288
217
|
policyPath: string;
|
|
289
218
|
postbacks: mongoose.Types.DocumentArray<{
|
|
@@ -309,23 +238,14 @@ export declare const AppSchema: mongoose.Schema<any, mongoose.Model<any, any, an
|
|
|
309
238
|
notes?: string | null | undefined;
|
|
310
239
|
}>;
|
|
311
240
|
name?: string | null | undefined;
|
|
312
|
-
pushesEnabled?: boolean | null | undefined;
|
|
313
|
-
publicationHistory?: any;
|
|
314
241
|
removeDataParams?: any;
|
|
315
242
|
privacyPolicyParams?: any;
|
|
316
|
-
offersStubParams?: any;
|
|
317
243
|
bannerParams?: any;
|
|
318
|
-
directParams?: any;
|
|
319
244
|
platforms?: any;
|
|
320
245
|
onesignalAppId?: string | null | undefined;
|
|
321
246
|
onesignalRestApiKey?: string | null | undefined;
|
|
322
247
|
appmetricaApiKey?: string | null | undefined;
|
|
323
248
|
appmetricaAppId?: number | null | undefined;
|
|
324
|
-
externalParams?: {
|
|
325
|
-
schema?: string | null | undefined;
|
|
326
|
-
showButton?: boolean | null | undefined;
|
|
327
|
-
autoRedirect?: boolean | null | undefined;
|
|
328
|
-
} | null | undefined;
|
|
329
249
|
keitaroData?: {
|
|
330
250
|
trackingCampaignId: number;
|
|
331
251
|
trackingCampaignName: string;
|
|
@@ -339,17 +259,11 @@ export declare const AppSchema: mongoose.Schema<any, mongoose.Model<any, any, an
|
|
|
339
259
|
} | null | undefined;
|
|
340
260
|
}>, {}, mongoose.ResolveSchemaOptions<mongoose.DefaultSchemaOptions>> & mongoose.FlatRecord<{
|
|
341
261
|
id: number;
|
|
342
|
-
type: AppType;
|
|
343
|
-
geo: string[];
|
|
344
262
|
enabled: boolean;
|
|
345
|
-
proxied: boolean;
|
|
346
263
|
ech: boolean;
|
|
347
|
-
imageFormat: EImageFormat;
|
|
348
264
|
status: AppStatus;
|
|
349
265
|
team: ETeam;
|
|
350
266
|
bundle: string;
|
|
351
|
-
trackingUrl: string;
|
|
352
|
-
integrationVersion: IntegrationVersion;
|
|
353
267
|
removeInfo: any;
|
|
354
268
|
policyPath: string;
|
|
355
269
|
postbacks: mongoose.Types.DocumentArray<{
|
|
@@ -375,23 +289,14 @@ export declare const AppSchema: mongoose.Schema<any, mongoose.Model<any, any, an
|
|
|
375
289
|
notes?: string | null | undefined;
|
|
376
290
|
}>;
|
|
377
291
|
name?: string | null | undefined;
|
|
378
|
-
pushesEnabled?: boolean | null | undefined;
|
|
379
|
-
publicationHistory?: any;
|
|
380
292
|
removeDataParams?: any;
|
|
381
293
|
privacyPolicyParams?: any;
|
|
382
|
-
offersStubParams?: any;
|
|
383
294
|
bannerParams?: any;
|
|
384
|
-
directParams?: any;
|
|
385
295
|
platforms?: any;
|
|
386
296
|
onesignalAppId?: string | null | undefined;
|
|
387
297
|
onesignalRestApiKey?: string | null | undefined;
|
|
388
298
|
appmetricaApiKey?: string | null | undefined;
|
|
389
299
|
appmetricaAppId?: number | null | undefined;
|
|
390
|
-
externalParams?: {
|
|
391
|
-
schema?: string | null | undefined;
|
|
392
|
-
showButton?: boolean | null | undefined;
|
|
393
|
-
autoRedirect?: boolean | null | undefined;
|
|
394
|
-
} | null | undefined;
|
|
395
300
|
keitaroData?: {
|
|
396
301
|
trackingCampaignId: number;
|
|
397
302
|
trackingCampaignName: string;
|
package/lib/app/app.js
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AppSchema = exports.PlugType = exports.IntegrationVersion = exports.AppStatus = exports.getPlatformName = exports.EDirectType = exports.EPlatform = exports.ETeam =
|
|
4
|
-
const app_type_1 = require("./app-type");
|
|
3
|
+
exports.AppSchema = exports.PlugType = exports.IntegrationVersion = exports.AppStatus = exports.getPlatformName = exports.EDirectType = exports.EPlatform = exports.ETeam = void 0;
|
|
5
4
|
const mongoose_1 = require("mongoose");
|
|
6
5
|
const util = require("util");
|
|
7
|
-
var EImageFormat;
|
|
8
|
-
(function (EImageFormat) {
|
|
9
|
-
EImageFormat["PNG"] = "png";
|
|
10
|
-
EImageFormat["JPEG"] = "jpg";
|
|
11
|
-
EImageFormat["WEBP"] = "webp";
|
|
12
|
-
})(EImageFormat = exports.EImageFormat || (exports.EImageFormat = {}));
|
|
13
6
|
var ETeam;
|
|
14
7
|
(function (ETeam) {
|
|
15
8
|
ETeam["TRAFFLE"] = "traffle";
|
|
@@ -34,6 +27,7 @@ var EDirectType;
|
|
|
34
27
|
EDirectType["TRAFFLE_KEITARO_OFFER"] = "traffleKeitaroOffer";
|
|
35
28
|
EDirectType["TRAFFLE_OFFER_DIRECT"] = "traffleOfferDirect";
|
|
36
29
|
})(EDirectType = exports.EDirectType || (exports.EDirectType = {}));
|
|
30
|
+
// Removed IPublicationHistory interface
|
|
37
31
|
const getPlatformName = (platform) => {
|
|
38
32
|
switch (platform) {
|
|
39
33
|
case EPlatform.SAMSUNG:
|
|
@@ -59,12 +53,9 @@ const getPlatformName = (platform) => {
|
|
|
59
53
|
exports.getPlatformName = getPlatformName;
|
|
60
54
|
var AppStatus;
|
|
61
55
|
(function (AppStatus) {
|
|
62
|
-
AppStatus["INACTIVE"] = "INACTIVE";
|
|
63
|
-
AppStatus["PUBLISHED"] = "PUBLISHED";
|
|
64
|
-
AppStatus["MODERATION"] = "ACTIVE";
|
|
65
|
-
AppStatus["REMOVED"] = "REMOVED";
|
|
66
56
|
AppStatus["ARCHIVED"] = "ARCHIVED";
|
|
67
|
-
AppStatus["
|
|
57
|
+
AppStatus["IN_DEVELOPMENT"] = "IN_DEVELOPMENT";
|
|
58
|
+
AppStatus["READY"] = "READY";
|
|
68
59
|
})(AppStatus = exports.AppStatus || (exports.AppStatus = {}));
|
|
69
60
|
var IntegrationVersion;
|
|
70
61
|
(function (IntegrationVersion) {
|
|
@@ -93,24 +84,14 @@ exports.AppSchema = new mongoose_1.Schema({
|
|
|
93
84
|
required: true,
|
|
94
85
|
default: false
|
|
95
86
|
},
|
|
96
|
-
proxied: {
|
|
97
|
-
type: Boolean,
|
|
98
|
-
require: true,
|
|
99
|
-
default: true
|
|
100
|
-
},
|
|
101
87
|
ech: {
|
|
102
88
|
type: Boolean,
|
|
103
89
|
default: false
|
|
104
90
|
},
|
|
105
|
-
imageFormat: {
|
|
106
|
-
type: String,
|
|
107
|
-
enum: EImageFormat,
|
|
108
|
-
default: EImageFormat.PNG
|
|
109
|
-
},
|
|
110
91
|
status: {
|
|
111
92
|
type: String,
|
|
112
93
|
enum: AppStatus,
|
|
113
|
-
default: AppStatus.
|
|
94
|
+
default: AppStatus.IN_DEVELOPMENT
|
|
114
95
|
},
|
|
115
96
|
team: {
|
|
116
97
|
type: String,
|
|
@@ -123,24 +104,6 @@ exports.AppSchema = new mongoose_1.Schema({
|
|
|
123
104
|
required: true
|
|
124
105
|
},
|
|
125
106
|
name: String,
|
|
126
|
-
trackingUrl: {
|
|
127
|
-
type: String,
|
|
128
|
-
default: null
|
|
129
|
-
},
|
|
130
|
-
pushesEnabled: Boolean,
|
|
131
|
-
integrationVersion: {
|
|
132
|
-
type: String,
|
|
133
|
-
enum: IntegrationVersion,
|
|
134
|
-
default: null
|
|
135
|
-
},
|
|
136
|
-
type: {
|
|
137
|
-
type: String,
|
|
138
|
-
enum: app_type_1.AppType,
|
|
139
|
-
default: app_type_1.AppType.GAMBLING
|
|
140
|
-
},
|
|
141
|
-
geo: {
|
|
142
|
-
type: [String]
|
|
143
|
-
},
|
|
144
107
|
onesignalAppId: {
|
|
145
108
|
type: String,
|
|
146
109
|
required: false
|
|
@@ -157,11 +120,6 @@ exports.AppSchema = new mongoose_1.Schema({
|
|
|
157
120
|
type: Number,
|
|
158
121
|
required: false
|
|
159
122
|
},
|
|
160
|
-
externalParams: {
|
|
161
|
-
showButton: Boolean,
|
|
162
|
-
schema: String,
|
|
163
|
-
autoRedirect: Boolean,
|
|
164
|
-
},
|
|
165
123
|
keitaroData: {
|
|
166
124
|
trackingCampaignId: {
|
|
167
125
|
type: Number,
|
|
@@ -192,16 +150,13 @@ exports.AppSchema = new mongoose_1.Schema({
|
|
|
192
150
|
default: "none"
|
|
193
151
|
},
|
|
194
152
|
},
|
|
195
|
-
publicationHistory: Object,
|
|
196
153
|
removeDataParams: Object,
|
|
197
154
|
removeInfo: {
|
|
198
155
|
type: Object,
|
|
199
156
|
default: null
|
|
200
157
|
},
|
|
201
158
|
privacyPolicyParams: Object,
|
|
202
|
-
offersStubParams: Object,
|
|
203
159
|
bannerParams: Object,
|
|
204
|
-
directParams: Object,
|
|
205
160
|
domainParams: {
|
|
206
161
|
name: {
|
|
207
162
|
type: String,
|
package/lib/general/domain.d.ts
CHANGED
|
@@ -93,7 +93,6 @@ export declare const DomainSchema: Schema<any, Model<any, any, any, any, any, an
|
|
|
93
93
|
type?: string | null | undefined;
|
|
94
94
|
caption?: string | null | undefined;
|
|
95
95
|
title?: string | null | undefined;
|
|
96
|
-
proxied?: boolean | null | undefined;
|
|
97
96
|
status?: string | null | undefined;
|
|
98
97
|
ip?: string | null | undefined;
|
|
99
98
|
namecheapId?: string | null | undefined;
|
|
@@ -109,6 +108,7 @@ export declare const DomainSchema: Schema<any, Model<any, any, any, any, any, an
|
|
|
109
108
|
target?: string | null | undefined;
|
|
110
109
|
archived?: boolean | null | undefined;
|
|
111
110
|
note?: string | null | undefined;
|
|
111
|
+
proxied?: boolean | null | undefined;
|
|
112
112
|
appid?: number | null | undefined;
|
|
113
113
|
}, Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
114
114
|
nameServers: string[];
|
|
@@ -121,7 +121,6 @@ export declare const DomainSchema: Schema<any, Model<any, any, any, any, any, an
|
|
|
121
121
|
type?: string | null | undefined;
|
|
122
122
|
caption?: string | null | undefined;
|
|
123
123
|
title?: string | null | undefined;
|
|
124
|
-
proxied?: boolean | null | undefined;
|
|
125
124
|
status?: string | null | undefined;
|
|
126
125
|
ip?: string | null | undefined;
|
|
127
126
|
namecheapId?: string | null | undefined;
|
|
@@ -137,6 +136,7 @@ export declare const DomainSchema: Schema<any, Model<any, any, any, any, any, an
|
|
|
137
136
|
target?: string | null | undefined;
|
|
138
137
|
archived?: boolean | null | undefined;
|
|
139
138
|
note?: string | null | undefined;
|
|
139
|
+
proxied?: boolean | null | undefined;
|
|
140
140
|
appid?: number | null | undefined;
|
|
141
141
|
}>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<{
|
|
142
142
|
nameServers: string[];
|
|
@@ -149,7 +149,6 @@ export declare const DomainSchema: Schema<any, Model<any, any, any, any, any, an
|
|
|
149
149
|
type?: string | null | undefined;
|
|
150
150
|
caption?: string | null | undefined;
|
|
151
151
|
title?: string | null | undefined;
|
|
152
|
-
proxied?: boolean | null | undefined;
|
|
153
152
|
status?: string | null | undefined;
|
|
154
153
|
ip?: string | null | undefined;
|
|
155
154
|
namecheapId?: string | null | undefined;
|
|
@@ -165,6 +164,7 @@ export declare const DomainSchema: Schema<any, Model<any, any, any, any, any, an
|
|
|
165
164
|
target?: string | null | undefined;
|
|
166
165
|
archived?: boolean | null | undefined;
|
|
167
166
|
note?: string | null | undefined;
|
|
167
|
+
proxied?: boolean | null | undefined;
|
|
168
168
|
appid?: number | null | undefined;
|
|
169
169
|
}> & {
|
|
170
170
|
_id: import("mongoose").Types.ObjectId;
|
package/lib/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { IPush } from "./general/push";
|
|
|
2
2
|
export { IOffer, IPartner, IOfferType } from "./offers/offer";
|
|
3
3
|
export { IOffersSection, OffersSectionSchema, DefaultSectionId } from "./offers/section";
|
|
4
4
|
export { IAppOffersSection, ISectionsList, SectionsListSchema, IOfferState } from "./offers/list";
|
|
5
|
-
export { IAdjustEventIds, IntegrationVersion, IApp, AppSchema, PlugType, IAppKeitaroData,
|
|
5
|
+
export { IAdjustEventIds, IntegrationVersion, IApp, AppSchema, PlugType, IAppKeitaroData, IPlatformParams, EPlatform, AppStatus, IRemovalInfo, EDirectType, IAppsflyerPostback } from "./app/app";
|
|
6
6
|
export { IAppListItem } from "./app/app-list-item";
|
|
7
7
|
export { AppType } from "./app/app-type";
|
|
8
8
|
export { AlternativeLayoutType, AlternativeSourceType, AlternativeLogicType, AlternativeNetworkTool, AlternativeStorageType, AlternativeNavigation, AlternativeOnBackPressed, AlternativeOnActivityResult, IAppIntegration as IFlashIntegration } from "./app/app-integration";
|
|
@@ -26,3 +26,4 @@ export { INamecheapDomain, INamecheapBuyRequest, INamecheapContactInfo, Namechea
|
|
|
26
26
|
export { NginxTemplate } from "./templates/nginx-template";
|
|
27
27
|
export { TraffleKeitaroService } from "./network/keitaro/traffle/traffle-keitaro-service";
|
|
28
28
|
export { KeitaroCLOGeosService } from "./keitaro/keitaro-clo-geos";
|
|
29
|
+
export { ETeam } from "./app/app";
|
package/lib/index.js
CHANGED
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.KeitaroCLOGeosService = exports.TraffleKeitaroService = exports.NginxTemplate = exports.NamecheapBuyRequestSchema = exports.getDomainTargetByIp = exports.CONST_CLOUFLARE_STATUS_READY = exports.DomainTarget = exports.DomainStatus = exports.ICloudflareDomainType = exports.ICloudflareDomainStatus = exports.KeitaroUtils = exports.KeitaroService = exports.ShapeDiv = exports.PanelUserSchema = exports.PanelUserAccessScope = exports.AlternativeOnActivityResult = exports.AlternativeOnBackPressed = exports.AlternativeNavigation = exports.AlternativeStorageType = exports.AlternativeNetworkTool = exports.AlternativeLogicType = exports.AlternativeSourceType = exports.AlternativeLayoutType = exports.AppType = exports.EDirectType = exports.AppStatus = exports.EPlatform = exports.PlugType = exports.AppSchema = exports.IntegrationVersion = exports.SectionsListSchema = exports.DefaultSectionId = exports.OffersSectionSchema = exports.IOfferType = void 0;
|
|
26
|
+
exports.ETeam = exports.KeitaroCLOGeosService = exports.TraffleKeitaroService = exports.NginxTemplate = exports.NamecheapBuyRequestSchema = exports.getDomainTargetByIp = exports.CONST_CLOUFLARE_STATUS_READY = exports.DomainTarget = exports.DomainStatus = exports.ICloudflareDomainType = exports.ICloudflareDomainStatus = exports.KeitaroUtils = exports.KeitaroService = exports.ShapeDiv = exports.PanelUserSchema = exports.PanelUserAccessScope = exports.AlternativeOnActivityResult = exports.AlternativeOnBackPressed = exports.AlternativeNavigation = exports.AlternativeStorageType = exports.AlternativeNetworkTool = exports.AlternativeLogicType = exports.AlternativeSourceType = exports.AlternativeLayoutType = exports.AppType = exports.EDirectType = exports.AppStatus = exports.EPlatform = exports.PlugType = exports.AppSchema = exports.IntegrationVersion = exports.SectionsListSchema = exports.DefaultSectionId = exports.OffersSectionSchema = exports.IOfferType = void 0;
|
|
27
27
|
var offer_1 = require("./offers/offer");
|
|
28
28
|
Object.defineProperty(exports, "IOfferType", { enumerable: true, get: function () { return offer_1.IOfferType; } });
|
|
29
29
|
var section_1 = require("./offers/section");
|
|
@@ -73,3 +73,5 @@ var traffle_keitaro_service_1 = require("./network/keitaro/traffle/traffle-keita
|
|
|
73
73
|
Object.defineProperty(exports, "TraffleKeitaroService", { enumerable: true, get: function () { return traffle_keitaro_service_1.TraffleKeitaroService; } });
|
|
74
74
|
var keitaro_clo_geos_1 = require("./keitaro/keitaro-clo-geos");
|
|
75
75
|
Object.defineProperty(exports, "KeitaroCLOGeosService", { enumerable: true, get: function () { return keitaro_clo_geos_1.KeitaroCLOGeosService; } });
|
|
76
|
+
var app_2 = require("./app/app");
|
|
77
|
+
Object.defineProperty(exports, "ETeam", { enumerable: true, get: function () { return app_2.ETeam; } });
|
|
@@ -211,7 +211,7 @@ async function syncKeitaroCLOGeosWithApps(apps) {
|
|
|
211
211
|
console.log(` Keitaro CLO гео: ${keitaroGeos.join(', ')}`);
|
|
212
212
|
// Отримуємо гео з додатку для конкретної платформи
|
|
213
213
|
const platformData = app.platforms[platform];
|
|
214
|
-
const appGeos =
|
|
214
|
+
const appGeos = []; // geo field removed from IPlatformParams
|
|
215
215
|
console.log(` App гео для платформи ${platform}: ${appGeos.join(', ')}`);
|
|
216
216
|
// Порівнюємо гео
|
|
217
217
|
const missingGeos = keitaroGeos.filter(geo => !appGeos.includes(geo));
|
|
@@ -285,11 +285,11 @@ async function getAppGeoSyncDetails(appId, platform, apps) {
|
|
|
285
285
|
});
|
|
286
286
|
// Отримуємо гео з CLO потоку
|
|
287
287
|
const keitaroGeos = await getCLOGeosFromCampaign(ourCampaign.id);
|
|
288
|
-
const appGeos =
|
|
288
|
+
const appGeos = []; // geo field removed from IPlatformParams
|
|
289
289
|
// Порівнюємо гео
|
|
290
|
-
const missingGeos = keitaroGeos.filter(geo => !appGeos.includes(geo));
|
|
290
|
+
const missingGeos = keitaroGeos.filter((geo) => !appGeos.includes(geo));
|
|
291
291
|
const needsUpdate = missingGeos.length > 0 || appGeos.length !== keitaroGeos.length ||
|
|
292
|
-
!appGeos.every(geo => keitaroGeos.includes(geo));
|
|
292
|
+
!appGeos.every((geo) => keitaroGeos.includes(geo));
|
|
293
293
|
return {
|
|
294
294
|
appId,
|
|
295
295
|
platform,
|
|
@@ -493,29 +493,38 @@ async function cloneTraffleCampaign(app, platform, addDefaultStreams) {
|
|
|
493
493
|
const chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
|
494
494
|
return Array.from({ length: 8 }, () => chars.charAt(Math.floor(Math.random() * chars.length))).join('');
|
|
495
495
|
};
|
|
496
|
+
// Get all groups to find the group with name matching app.id
|
|
497
|
+
const allGroups = await http_1.default.get('/groups?type=campaigns');
|
|
498
|
+
const appGroup = allGroups.data.find((g) => String(g.name).trim() === String(app.id).trim());
|
|
499
|
+
if (!appGroup) {
|
|
500
|
+
console.log(`[Traffle] No group found with name ${app.id}, will create a new campaign with new group`);
|
|
501
|
+
}
|
|
502
|
+
else {
|
|
503
|
+
console.log(`[Traffle] Found group ${appGroup.name} with id ${appGroup.id} for app ${app.id}`);
|
|
504
|
+
}
|
|
496
505
|
let allCampaigns = await getAllCampaigns();
|
|
497
506
|
let matchingCampaign = [];
|
|
498
507
|
if (platform && platform !== app_1.EPlatform.GENERAL) {
|
|
499
508
|
// Для конкретної платформи
|
|
500
509
|
const platformName = (0, app_1.getPlatformName)(platform);
|
|
501
510
|
matchingCampaign = allCampaigns.filter((c) => {
|
|
502
|
-
|
|
503
|
-
const
|
|
511
|
+
// Check if campaign belongs to the group with name matching app.id
|
|
512
|
+
const hasCorrectGroup = appGroup && c.group_id === appGroup.id;
|
|
504
513
|
// Перевіряємо наявність платформи в дужках в кінці назви
|
|
505
514
|
const platformPattern = new RegExp(`\\(.*${platformName}.*\\)\\s*$`);
|
|
506
515
|
const hasPlatform = platformPattern.test(c.name);
|
|
507
|
-
return
|
|
516
|
+
return hasCorrectGroup && hasPlatform;
|
|
508
517
|
});
|
|
509
518
|
}
|
|
510
519
|
else {
|
|
511
520
|
// Для General платформи
|
|
512
521
|
matchingCampaign = allCampaigns.filter((c) => {
|
|
513
|
-
|
|
514
|
-
const
|
|
522
|
+
// Check if campaign belongs to the group with name matching app.id
|
|
523
|
+
const hasCorrectGroup = appGroup && c.group_id === appGroup.id;
|
|
515
524
|
// Перевіряємо відсутність платформи в дужках в кінці
|
|
516
525
|
// Дозволяємо будь-які інші дужки (як для гео або опису)
|
|
517
526
|
const noPlatformAtEnd = !/\(.*(?:iOS|Android|Desktop|Mobile).*\)\s*$/.test(c.name);
|
|
518
|
-
return
|
|
527
|
+
return hasCorrectGroup && noPlatformAtEnd;
|
|
519
528
|
});
|
|
520
529
|
}
|
|
521
530
|
// Якщо знайдена існуюча кампанія - перевіряємо параметри
|
|
@@ -546,7 +555,7 @@ async function cloneTraffleCampaign(app, platform, addDefaultStreams) {
|
|
|
546
555
|
{
|
|
547
556
|
name: "country",
|
|
548
557
|
mode: "reject",
|
|
549
|
-
payload:
|
|
558
|
+
payload: [] // geo field removed from IPlatformParams
|
|
550
559
|
},
|
|
551
560
|
{
|
|
552
561
|
name: "bot",
|
|
@@ -695,7 +704,7 @@ async function cloneTraffleCampaign(app, platform, addDefaultStreams) {
|
|
|
695
704
|
{
|
|
696
705
|
name: "country",
|
|
697
706
|
mode: "reject",
|
|
698
|
-
payload:
|
|
707
|
+
payload: [] // geo field removed from IPlatformParams
|
|
699
708
|
},
|
|
700
709
|
{
|
|
701
710
|
name: "bot",
|
|
@@ -778,24 +787,29 @@ async function cloneTraffleCampaign(app, platform, addDefaultStreams) {
|
|
|
778
787
|
return updatedCampaign;
|
|
779
788
|
}
|
|
780
789
|
async function findCampaignForAppPlatform(app, platform) {
|
|
790
|
+
// Get all groups to find the group with name matching app.id
|
|
791
|
+
const allGroups = await http_1.default.get('/groups?type=campaigns');
|
|
792
|
+
const appGroup = allGroups.data.find((g) => String(g.name).trim() === String(app.id).trim());
|
|
793
|
+
if (!appGroup) {
|
|
794
|
+
console.log(`[Traffle] No group found with name ${app.id}`);
|
|
795
|
+
return null;
|
|
796
|
+
}
|
|
781
797
|
let allCampaigns = await getAllCampaigns();
|
|
782
798
|
let matchingCampaign = [];
|
|
783
799
|
if (platform && platform !== app_1.EPlatform.GENERAL) {
|
|
784
800
|
const platformName = (0, app_1.getPlatformName)(platform);
|
|
785
801
|
matchingCampaign = allCampaigns.filter((c) => {
|
|
786
|
-
const
|
|
787
|
-
const hasGroup = c.group == app.id.toString();
|
|
802
|
+
const hasCorrectGroup = c.group_id === appGroup.id;
|
|
788
803
|
const platformPattern = new RegExp(`\\(.*${platformName}.*\\)\\s*$`);
|
|
789
804
|
const hasPlatform = platformPattern.test(c.name);
|
|
790
|
-
return
|
|
805
|
+
return hasCorrectGroup && hasPlatform;
|
|
791
806
|
});
|
|
792
807
|
}
|
|
793
808
|
else {
|
|
794
809
|
matchingCampaign = allCampaigns.filter((c) => {
|
|
795
|
-
const
|
|
796
|
-
const hasDomain = c.name.includes(app.domainParams.name);
|
|
810
|
+
const hasCorrectGroup = c.group_id === appGroup.id;
|
|
797
811
|
const noPlatformAtEnd = !/\(.*(?:iOS|Android|Desktop|Mobile).*\)\s*$/.test(c.name);
|
|
798
|
-
return
|
|
812
|
+
return hasCorrectGroup && noPlatformAtEnd;
|
|
799
813
|
});
|
|
800
814
|
}
|
|
801
815
|
return matchingCampaign.length > 0 ? matchingCampaign[0] : null;
|
|
@@ -866,7 +880,7 @@ async function updateStreamsForApp(app, platform) {
|
|
|
866
880
|
return changed;
|
|
867
881
|
}
|
|
868
882
|
// enabled: turn on CLO and geo streams that match platform geo. Leave others as-is.
|
|
869
|
-
const platformGeo =
|
|
883
|
+
const platformGeo = []; // geo field removed from IPlatformParams
|
|
870
884
|
for (const s of streams) {
|
|
871
885
|
const isClo = s.name === STREAM_NAMES.CLO;
|
|
872
886
|
if (isClo && s.state !== STREAM_STATES.ACTIVE) {
|
|
@@ -1,27 +1,19 @@
|
|
|
1
|
-
import { AppStatus,
|
|
1
|
+
import { AppStatus, IAppKeitaroData, IBannerParams, IDomainParams, IPlatformParams } from "app/app";
|
|
2
2
|
export interface IUpsertAppRequest {
|
|
3
3
|
id: number;
|
|
4
4
|
name?: string;
|
|
5
5
|
bundle?: string;
|
|
6
6
|
sourceUrl?: string;
|
|
7
7
|
enabled?: boolean;
|
|
8
|
-
geos?: string;
|
|
9
|
-
geo?: string[];
|
|
10
8
|
appmetricaApiKey?: string;
|
|
11
9
|
appmetricaAppId?: number;
|
|
12
|
-
integrationVersion?: IntegrationVersion;
|
|
13
10
|
keitaroData?: Partial<IAppKeitaroData>;
|
|
14
|
-
offersStubParams?: IOffersStubParams;
|
|
15
11
|
bannerParams?: IBannerParams;
|
|
16
12
|
domainParams: IDomainParams;
|
|
17
|
-
directParams?: IDirectParams;
|
|
18
|
-
externalParams?: IExternalParams;
|
|
19
13
|
platforms: {
|
|
20
14
|
[key: string]: IPlatformParams;
|
|
21
15
|
};
|
|
22
|
-
|
|
23
|
-
ech: boolean;
|
|
24
|
-
imageFormat?: EImageFormat;
|
|
16
|
+
ech?: boolean;
|
|
25
17
|
file?: any;
|
|
26
18
|
status?: AppStatus;
|
|
27
19
|
policyPath?: string;
|
|
@@ -30,5 +22,4 @@ export interface IUpsertAppResponse {
|
|
|
30
22
|
data: IUpsertAppRequest;
|
|
31
23
|
linkName: string;
|
|
32
24
|
archive: string;
|
|
33
|
-
externalParams?: IExternalParams;
|
|
34
25
|
}
|
|
@@ -405,7 +405,7 @@ function createDefenceMainStreamPartialPayload(app) {
|
|
|
405
405
|
name: "ALL",
|
|
406
406
|
type: "regular",
|
|
407
407
|
action_type: "http",
|
|
408
|
-
action_payload:
|
|
408
|
+
action_payload: undefined,
|
|
409
409
|
schema: "redirect",
|
|
410
410
|
filter_or: false,
|
|
411
411
|
collect_clicks: true,
|
package/package.json
CHANGED
package/src/app/app.ts
CHANGED
|
@@ -17,14 +17,8 @@ export interface IApp extends Document {
|
|
|
17
17
|
id: number
|
|
18
18
|
enabled: boolean,
|
|
19
19
|
name: string
|
|
20
|
-
trackingUrl?: string
|
|
21
20
|
bundle: string
|
|
22
|
-
|
|
23
|
-
pushesEnabled?: boolean
|
|
24
|
-
policyUrl?: string
|
|
25
|
-
type: AppType
|
|
26
21
|
status: AppStatus
|
|
27
|
-
geo: string[]
|
|
28
22
|
team: ETeam
|
|
29
23
|
onesignalAppId: string
|
|
30
24
|
onesignalRestApiKey: string
|
|
@@ -32,34 +26,17 @@ export interface IApp extends Document {
|
|
|
32
26
|
appmetricaApiKey?: string
|
|
33
27
|
appmetricaAppId?: number
|
|
34
28
|
|
|
35
|
-
webInterfaceName: string
|
|
36
|
-
|
|
37
29
|
keitaroData: IAppKeitaroData | null
|
|
38
|
-
integrationVersion: IntegrationVersion
|
|
39
30
|
|
|
40
|
-
offersStubParams?: IOffersStubParams
|
|
41
|
-
directParams?: IDirectParams,
|
|
42
31
|
bannerParams?: IBannerParams,
|
|
43
|
-
remoteServerParams?: IRemoteServerParams,
|
|
44
32
|
domainParams: IDomainParams
|
|
45
33
|
platforms: { [key: string]: IPlatformParams },
|
|
46
|
-
publicationHistory: IPublicationHistory,
|
|
47
34
|
|
|
48
|
-
offersListId: number,
|
|
49
|
-
externalParams?: IExternalParams,
|
|
50
|
-
proxied: boolean,
|
|
51
35
|
ech?: boolean,
|
|
52
|
-
imageFormat: EImageFormat
|
|
53
36
|
policyPath: string
|
|
54
37
|
postbacks?: IAppsflyerPostback[]
|
|
55
38
|
}
|
|
56
39
|
|
|
57
|
-
export enum EImageFormat {
|
|
58
|
-
PNG = "png",
|
|
59
|
-
JPEG = "jpg",
|
|
60
|
-
WEBP = "webp"
|
|
61
|
-
}
|
|
62
|
-
|
|
63
40
|
export enum ETeam {
|
|
64
41
|
TRAFFLE = 'traffle',
|
|
65
42
|
ELTRAFICO = 'eltrafico'
|
|
@@ -84,10 +61,7 @@ export enum EDirectType{
|
|
|
84
61
|
TRAFFLE_OFFER_DIRECT = 'traffleOfferDirect'
|
|
85
62
|
}
|
|
86
63
|
|
|
87
|
-
|
|
88
|
-
publications: number[],
|
|
89
|
-
removals: IRemovalInfo[]
|
|
90
|
-
}
|
|
64
|
+
// Removed IPublicationHistory interface
|
|
91
65
|
|
|
92
66
|
export const getPlatformName = (platform: EPlatform | undefined): string | false => {
|
|
93
67
|
switch (platform) {
|
|
@@ -114,8 +88,6 @@ export const getPlatformName = (platform: EPlatform | undefined): string | false
|
|
|
114
88
|
|
|
115
89
|
export interface IPlatformParams {
|
|
116
90
|
enabled: boolean,
|
|
117
|
-
geo: string[],
|
|
118
|
-
trackingUrl?: string,
|
|
119
91
|
adjustParams?: {
|
|
120
92
|
appId: string,
|
|
121
93
|
eventIds: IAdjustEventIds,
|
|
@@ -124,7 +96,6 @@ export interface IPlatformParams {
|
|
|
124
96
|
enabled: boolean,
|
|
125
97
|
keitaroData: IAppKeitaroData | boolean,
|
|
126
98
|
directType?: EDirectType,
|
|
127
|
-
trackingUrl?: string
|
|
128
99
|
addDefaultStreams?: boolean
|
|
129
100
|
},
|
|
130
101
|
metricaParams?: {
|
|
@@ -137,9 +108,7 @@ export interface IPlatformParams {
|
|
|
137
108
|
appId?: string,
|
|
138
109
|
devKey: string
|
|
139
110
|
},
|
|
140
|
-
proxied?: boolean
|
|
141
|
-
|
|
142
|
-
keitaroData?: IAppKeitaroData | boolean
|
|
111
|
+
proxied?: boolean
|
|
143
112
|
}
|
|
144
113
|
|
|
145
114
|
export interface IAdjustEventIds {
|
|
@@ -149,34 +118,12 @@ export interface IAdjustEventIds {
|
|
|
149
118
|
rejected: string,
|
|
150
119
|
}
|
|
151
120
|
|
|
152
|
-
export interface IExternalParams {
|
|
153
|
-
showButton: boolean,
|
|
154
|
-
schema: string,
|
|
155
|
-
autoRedirect: boolean
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export interface IRemoteServerParams {
|
|
159
|
-
ip: string,
|
|
160
|
-
port: string,
|
|
161
|
-
password: string
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
export interface IOffersStubParams {
|
|
165
|
-
offersPath: string,
|
|
166
|
-
imagesPath: string
|
|
167
|
-
}
|
|
168
|
-
|
|
169
121
|
export interface IDomainParams {
|
|
170
122
|
name: string,
|
|
171
123
|
clouflareZone: string,
|
|
172
124
|
ready: boolean
|
|
173
125
|
}
|
|
174
126
|
|
|
175
|
-
export interface IDirectParams {
|
|
176
|
-
path: string,
|
|
177
|
-
response: string,
|
|
178
|
-
}
|
|
179
|
-
|
|
180
127
|
export interface IBannerParams {
|
|
181
128
|
dataPath: string,
|
|
182
129
|
imagePath: string,
|
|
@@ -186,12 +133,9 @@ export interface IBannerParams {
|
|
|
186
133
|
}
|
|
187
134
|
|
|
188
135
|
export enum AppStatus {
|
|
189
|
-
INACTIVE = "INACTIVE",
|
|
190
|
-
PUBLISHED = "PUBLISHED",
|
|
191
|
-
MODERATION = "ACTIVE",
|
|
192
|
-
REMOVED = "REMOVED",
|
|
193
136
|
ARCHIVED = "ARCHIVED",
|
|
194
|
-
|
|
137
|
+
IN_DEVELOPMENT = "IN_DEVELOPMENT",
|
|
138
|
+
READY = "READY"
|
|
195
139
|
}
|
|
196
140
|
|
|
197
141
|
export interface IRemoveDataParams {
|
|
@@ -274,24 +218,14 @@ export const AppSchema = new Schema({
|
|
|
274
218
|
required: true,
|
|
275
219
|
default: false
|
|
276
220
|
},
|
|
277
|
-
proxied: {
|
|
278
|
-
type: Boolean,
|
|
279
|
-
require: true,
|
|
280
|
-
default: true
|
|
281
|
-
},
|
|
282
221
|
ech: {
|
|
283
222
|
type: Boolean,
|
|
284
223
|
default: false
|
|
285
224
|
},
|
|
286
|
-
imageFormat: {
|
|
287
|
-
type: String,
|
|
288
|
-
enum: EImageFormat,
|
|
289
|
-
default: EImageFormat.PNG
|
|
290
|
-
},
|
|
291
225
|
status: {
|
|
292
226
|
type: String,
|
|
293
227
|
enum: AppStatus,
|
|
294
|
-
default: AppStatus.
|
|
228
|
+
default: AppStatus.IN_DEVELOPMENT
|
|
295
229
|
},
|
|
296
230
|
team: {
|
|
297
231
|
type: String,
|
|
@@ -305,25 +239,6 @@ export const AppSchema = new Schema({
|
|
|
305
239
|
required: true
|
|
306
240
|
},
|
|
307
241
|
name: String,
|
|
308
|
-
trackingUrl: {
|
|
309
|
-
type: String,
|
|
310
|
-
default: null
|
|
311
|
-
},
|
|
312
|
-
|
|
313
|
-
pushesEnabled: Boolean,
|
|
314
|
-
integrationVersion: {
|
|
315
|
-
type: String,
|
|
316
|
-
enum: IntegrationVersion,
|
|
317
|
-
default: null
|
|
318
|
-
},
|
|
319
|
-
type: {
|
|
320
|
-
type: String,
|
|
321
|
-
enum: AppType,
|
|
322
|
-
default: AppType.GAMBLING
|
|
323
|
-
},
|
|
324
|
-
geo: {
|
|
325
|
-
type: [String]
|
|
326
|
-
},
|
|
327
242
|
onesignalAppId: {
|
|
328
243
|
type: String,
|
|
329
244
|
required: false
|
|
@@ -341,12 +256,6 @@ export const AppSchema = new Schema({
|
|
|
341
256
|
required: false
|
|
342
257
|
},
|
|
343
258
|
|
|
344
|
-
externalParams: {
|
|
345
|
-
showButton: Boolean,
|
|
346
|
-
schema: String,
|
|
347
|
-
autoRedirect: Boolean,
|
|
348
|
-
},
|
|
349
|
-
|
|
350
259
|
keitaroData: {
|
|
351
260
|
trackingCampaignId: {
|
|
352
261
|
type: Number,
|
|
@@ -377,16 +286,13 @@ export const AppSchema = new Schema({
|
|
|
377
286
|
default: "none"
|
|
378
287
|
},
|
|
379
288
|
},
|
|
380
|
-
publicationHistory: Object,
|
|
381
289
|
removeDataParams: Object,
|
|
382
290
|
removeInfo: {
|
|
383
291
|
type: Object,
|
|
384
292
|
default: null
|
|
385
293
|
},
|
|
386
294
|
privacyPolicyParams: Object,
|
|
387
|
-
offersStubParams: Object,
|
|
388
295
|
bannerParams: Object,
|
|
389
|
-
directParams: Object,
|
|
390
296
|
domainParams: {
|
|
391
297
|
name: {
|
|
392
298
|
type: String,
|
package/src/index.ts
CHANGED
|
@@ -4,7 +4,7 @@ export { IOffer, IPartner, IOfferType } from "./offers/offer"
|
|
|
4
4
|
export { IOffersSection, OffersSectionSchema, DefaultSectionId } from "./offers/section"
|
|
5
5
|
export { IAppOffersSection, ISectionsList, SectionsListSchema, IOfferState } from "./offers/list"
|
|
6
6
|
|
|
7
|
-
export { IAdjustEventIds, IntegrationVersion, IApp, AppSchema, PlugType, IAppKeitaroData,
|
|
7
|
+
export { IAdjustEventIds, IntegrationVersion, IApp, AppSchema, PlugType, IAppKeitaroData, IPlatformParams, EPlatform, AppStatus, IRemovalInfo, EDirectType, IAppsflyerPostback } from "./app/app"
|
|
8
8
|
export { IAppListItem } from "./app/app-list-item"
|
|
9
9
|
export { AppType } from "./app/app-type"
|
|
10
10
|
export { AlternativeLayoutType, AlternativeSourceType, AlternativeLogicType, AlternativeNetworkTool, AlternativeStorageType, AlternativeNavigation, AlternativeOnBackPressed, AlternativeOnActivityResult, IAppIntegration as IFlashIntegration } from "./app/app-integration"
|
|
@@ -33,4 +33,5 @@ export { INamecheapDomain, INamecheapBuyRequest, INamecheapContactInfo, Namechea
|
|
|
33
33
|
export { NginxTemplate } from "./templates/nginx-template";
|
|
34
34
|
|
|
35
35
|
export { TraffleKeitaroService } from "./network/keitaro/traffle/traffle-keitaro-service"
|
|
36
|
-
export { KeitaroCLOGeosService } from "./keitaro/keitaro-clo-geos"
|
|
36
|
+
export { KeitaroCLOGeosService } from "./keitaro/keitaro-clo-geos"
|
|
37
|
+
export { ETeam} from "./app/app";
|
|
@@ -261,7 +261,7 @@ export async function syncKeitaroCLOGeosWithApps(apps: IApp[]): Promise<IGeoSync
|
|
|
261
261
|
|
|
262
262
|
// Отримуємо гео з додатку для конкретної платформи
|
|
263
263
|
const platformData = app.platforms[platform as EPlatform];
|
|
264
|
-
const appGeos =
|
|
264
|
+
const appGeos: string[] = []; // geo field removed from IPlatformParams
|
|
265
265
|
console.log(` App гео для платформи ${platform}: ${appGeos.join(', ')}`);
|
|
266
266
|
|
|
267
267
|
// Порівнюємо гео
|
|
@@ -349,12 +349,12 @@ export async function getAppGeoSyncDetails(appId: number, platform: string, apps
|
|
|
349
349
|
|
|
350
350
|
// Отримуємо гео з CLO потоку
|
|
351
351
|
const keitaroGeos = await getCLOGeosFromCampaign(ourCampaign.id);
|
|
352
|
-
const appGeos =
|
|
352
|
+
const appGeos: string[] = []; // geo field removed from IPlatformParams
|
|
353
353
|
|
|
354
354
|
// Порівнюємо гео
|
|
355
|
-
const missingGeos = keitaroGeos.filter(geo => !appGeos.includes(geo));
|
|
355
|
+
const missingGeos = keitaroGeos.filter((geo: string) => !appGeos.includes(geo));
|
|
356
356
|
const needsUpdate = missingGeos.length > 0 || appGeos.length !== keitaroGeos.length ||
|
|
357
|
-
!appGeos.every(geo => keitaroGeos.includes(geo));
|
|
357
|
+
!appGeos.every((geo: string) => keitaroGeos.includes(geo));
|
|
358
358
|
|
|
359
359
|
return {
|
|
360
360
|
appId,
|
|
@@ -610,6 +610,16 @@ async function cloneTraffleCampaign(app: IApp, platform: EPlatform, addDefaultSt
|
|
|
610
610
|
).join('');
|
|
611
611
|
};
|
|
612
612
|
|
|
613
|
+
// Get all groups to find the group with name matching app.id
|
|
614
|
+
const allGroups = await keitaroApi.get('/groups?type=campaigns');
|
|
615
|
+
const appGroup = allGroups.data.find((g: any) => String(g.name).trim() === String(app.id).trim());
|
|
616
|
+
|
|
617
|
+
if (!appGroup) {
|
|
618
|
+
console.log(`[Traffle] No group found with name ${app.id}, will create a new campaign with new group`);
|
|
619
|
+
} else {
|
|
620
|
+
console.log(`[Traffle] Found group ${appGroup.name} with id ${appGroup.id} for app ${app.id}`);
|
|
621
|
+
}
|
|
622
|
+
|
|
613
623
|
let allCampaigns = await getAllCampaigns();
|
|
614
624
|
let matchingCampaign: IKeitaroCampaign[] = [];
|
|
615
625
|
|
|
@@ -617,25 +627,24 @@ async function cloneTraffleCampaign(app: IApp, platform: EPlatform, addDefaultSt
|
|
|
617
627
|
// Для конкретної платформи
|
|
618
628
|
const platformName = getPlatformName(platform);
|
|
619
629
|
matchingCampaign = allCampaigns.filter((c) => {
|
|
620
|
-
|
|
621
|
-
const
|
|
622
|
-
const hasGroup = c.group == app.id.toString()
|
|
630
|
+
// Check if campaign belongs to the group with name matching app.id
|
|
631
|
+
const hasCorrectGroup = appGroup && c.group_id === appGroup.id;
|
|
623
632
|
|
|
624
633
|
// Перевіряємо наявність платформи в дужках в кінці назви
|
|
625
634
|
const platformPattern = new RegExp(`\\(.*${platformName}.*\\)\\s*$`);
|
|
626
635
|
const hasPlatform = platformPattern.test(c.name);
|
|
627
|
-
return
|
|
636
|
+
return hasCorrectGroup && hasPlatform;
|
|
628
637
|
});
|
|
629
638
|
} else {
|
|
630
639
|
// Для General платформи
|
|
631
640
|
matchingCampaign = allCampaigns.filter((c) => {
|
|
632
|
-
|
|
633
|
-
const
|
|
641
|
+
// Check if campaign belongs to the group with name matching app.id
|
|
642
|
+
const hasCorrectGroup = appGroup && c.group_id === appGroup.id;
|
|
634
643
|
|
|
635
644
|
// Перевіряємо відсутність платформи в дужках в кінці
|
|
636
645
|
// Дозволяємо будь-які інші дужки (як для гео або опису)
|
|
637
646
|
const noPlatformAtEnd = !/\(.*(?:iOS|Android|Desktop|Mobile).*\)\s*$/.test(c.name);
|
|
638
|
-
return
|
|
647
|
+
return hasCorrectGroup && noPlatformAtEnd;
|
|
639
648
|
});
|
|
640
649
|
}
|
|
641
650
|
|
|
@@ -670,7 +679,7 @@ async function cloneTraffleCampaign(app: IApp, platform: EPlatform, addDefaultSt
|
|
|
670
679
|
{
|
|
671
680
|
name: "country",
|
|
672
681
|
mode: "reject",
|
|
673
|
-
payload:
|
|
682
|
+
payload: [] // geo field removed from IPlatformParams
|
|
674
683
|
},
|
|
675
684
|
{
|
|
676
685
|
name: "bot",
|
|
@@ -839,7 +848,7 @@ async function cloneTraffleCampaign(app: IApp, platform: EPlatform, addDefaultSt
|
|
|
839
848
|
{
|
|
840
849
|
name: "country",
|
|
841
850
|
mode: "reject",
|
|
842
|
-
payload:
|
|
851
|
+
payload: [] // geo field removed from IPlatformParams
|
|
843
852
|
},
|
|
844
853
|
{
|
|
845
854
|
name: "bot",
|
|
@@ -937,24 +946,31 @@ async function cloneTraffleCampaign(app: IApp, platform: EPlatform, addDefaultSt
|
|
|
937
946
|
}
|
|
938
947
|
|
|
939
948
|
async function findCampaignForAppPlatform(app: IApp, platform: EPlatform): Promise<IKeitaroCampaign | null> {
|
|
949
|
+
// Get all groups to find the group with name matching app.id
|
|
950
|
+
const allGroups = await keitaroApi.get('/groups?type=campaigns');
|
|
951
|
+
const appGroup = allGroups.data.find((g: any) => String(g.name).trim() === String(app.id).trim());
|
|
952
|
+
|
|
953
|
+
if (!appGroup) {
|
|
954
|
+
console.log(`[Traffle] No group found with name ${app.id}`);
|
|
955
|
+
return null;
|
|
956
|
+
}
|
|
957
|
+
|
|
940
958
|
let allCampaigns = await getAllCampaigns();
|
|
941
959
|
let matchingCampaign: IKeitaroCampaign[] = [];
|
|
942
960
|
|
|
943
961
|
if (platform && platform !== EPlatform.GENERAL) {
|
|
944
962
|
const platformName = getPlatformName(platform);
|
|
945
963
|
matchingCampaign = allCampaigns.filter((c) => {
|
|
946
|
-
const
|
|
947
|
-
const hasGroup = c.group == app.id.toString();
|
|
964
|
+
const hasCorrectGroup = c.group_id === appGroup.id;
|
|
948
965
|
const platformPattern = new RegExp(`\\(.*${platformName}.*\\)\\s*$`);
|
|
949
966
|
const hasPlatform = platformPattern.test(c.name);
|
|
950
|
-
return
|
|
967
|
+
return hasCorrectGroup && hasPlatform;
|
|
951
968
|
});
|
|
952
969
|
} else {
|
|
953
970
|
matchingCampaign = allCampaigns.filter((c) => {
|
|
954
|
-
const
|
|
955
|
-
const hasDomain = c.name.includes(app.domainParams.name);
|
|
971
|
+
const hasCorrectGroup = c.group_id === appGroup.id;
|
|
956
972
|
const noPlatformAtEnd = !/\(.*(?:iOS|Android|Desktop|Mobile).*\)\s*$/.test(c.name);
|
|
957
|
-
return
|
|
973
|
+
return hasCorrectGroup && noPlatformAtEnd;
|
|
958
974
|
});
|
|
959
975
|
}
|
|
960
976
|
|
|
@@ -1034,7 +1050,7 @@ export async function updateStreamsForApp(app: IApp, platform: EPlatform): Promi
|
|
|
1034
1050
|
}
|
|
1035
1051
|
|
|
1036
1052
|
// enabled: turn on CLO and geo streams that match platform geo. Leave others as-is.
|
|
1037
|
-
const platformGeo =
|
|
1053
|
+
const platformGeo: string[] = []; // geo field removed from IPlatformParams
|
|
1038
1054
|
for (const s of streams) {
|
|
1039
1055
|
const isClo = s.name === STREAM_NAMES.CLO;
|
|
1040
1056
|
if (isClo && s.state !== STREAM_STATES.ACTIVE) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AppStatus,
|
|
1
|
+
import { AppStatus, IAppKeitaroData, IBannerParams, IDomainParams, IPlatformParams, IPrivacyPolicyParams, IRemoveDataParams } from "app/app"
|
|
2
2
|
import { PlugType } from "index"
|
|
3
3
|
|
|
4
4
|
export interface IUpsertAppRequest {
|
|
@@ -7,8 +7,6 @@ export interface IUpsertAppRequest {
|
|
|
7
7
|
bundle?: string
|
|
8
8
|
sourceUrl?: string, // –
|
|
9
9
|
enabled?: boolean,
|
|
10
|
-
geos?: string,
|
|
11
|
-
geo?: string[],
|
|
12
10
|
|
|
13
11
|
// onesignalAppId: string
|
|
14
12
|
// onesignalRestApiKey: string
|
|
@@ -16,18 +14,11 @@ export interface IUpsertAppRequest {
|
|
|
16
14
|
appmetricaApiKey?: string
|
|
17
15
|
appmetricaAppId?: number
|
|
18
16
|
|
|
19
|
-
integrationVersion?: IntegrationVersion,
|
|
20
|
-
|
|
21
17
|
keitaroData?: Partial<IAppKeitaroData>,
|
|
22
|
-
offersStubParams?: IOffersStubParams,
|
|
23
18
|
bannerParams?: IBannerParams,
|
|
24
19
|
domainParams: IDomainParams,
|
|
25
|
-
directParams?: IDirectParams,
|
|
26
|
-
externalParams?: IExternalParams,
|
|
27
20
|
platforms: { [key: string]: IPlatformParams },
|
|
28
|
-
|
|
29
|
-
ech: boolean,
|
|
30
|
-
imageFormat?: EImageFormat,
|
|
21
|
+
ech?: boolean,
|
|
31
22
|
file?: any
|
|
32
23
|
status?: AppStatus
|
|
33
24
|
policyPath?: string
|
|
@@ -37,6 +28,5 @@ export interface IUpsertAppResponse {
|
|
|
37
28
|
data: IUpsertAppRequest,
|
|
38
29
|
linkName: string,
|
|
39
30
|
archive: string,
|
|
40
|
-
externalParams?: IExternalParams,
|
|
41
31
|
}
|
|
42
32
|
|
|
@@ -445,7 +445,7 @@ function createDefenceMainStreamPartialPayload(app: IApp): Partial<IKeitaroStrea
|
|
|
445
445
|
name: "ALL",
|
|
446
446
|
type: "regular",
|
|
447
447
|
action_type: "http",
|
|
448
|
-
action_payload:
|
|
448
|
+
action_payload: undefined, // directParams field removed from IApp
|
|
449
449
|
schema: "redirect",
|
|
450
450
|
filter_or: false,
|
|
451
451
|
collect_clicks: true,
|