@bprotsyk/aso-core 1.2.102 → 1.2.104

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.
@@ -29,7 +29,8 @@ export declare enum AlternativeSourceType {
29
29
  FIREBASE_REALTIME_DATABASE = "Firebase Realtime DB",
30
30
  GET_RETROFIT = "From link via Retrofit",
31
31
  GET_VOLLEY = "From link via Volley",
32
- GET_HTTP_URL = "From link via HTTPUrlConnection"
32
+ GET_HTTP_URL = "From link via HTTPUrlConnection",
33
+ DIRECT = "Directly from link"
33
34
  }
34
35
  export declare enum AlternativeOnBackPressed {
35
36
  OLD = "Old",
@@ -39,6 +39,7 @@ var AlternativeSourceType;
39
39
  AlternativeSourceType["GET_RETROFIT"] = "From link via Retrofit";
40
40
  AlternativeSourceType["GET_VOLLEY"] = "From link via Volley";
41
41
  AlternativeSourceType["GET_HTTP_URL"] = "From link via HTTPUrlConnection";
42
+ AlternativeSourceType["DIRECT"] = "Directly from link";
42
43
  // WITHIN_WEBVIEW = "Within webview",
43
44
  })(AlternativeSourceType = exports.AlternativeSourceType || (exports.AlternativeSourceType = {}));
44
45
  // backpress
@@ -1,4 +1,4 @@
1
- import { AlternativeLogicType, AlternativeNavigation, AlternativeNetworkTool, AlternativeSourceType, AlternativeStorageType } from "index";
1
+ import { AlternativeLayoutType, AlternativeLogicType, AlternativeNavigation, AlternativeNetworkTool, AlternativeOnActivityResult, AlternativeOnBackPressed, AlternativeSourceType, AlternativeStorageType } from "index";
2
2
  import { FlashAppType } from "./flash-app-type";
3
3
  import mongoose, { Document, Model } from "mongoose";
4
4
  export declare enum FlashAppPlugStatus {
@@ -41,10 +41,13 @@ export interface IntegrationAlterations {
41
41
  navigation: AlternativeNavigation;
42
42
  storageType: AlternativeStorageType;
43
43
  sourceType: AlternativeSourceType;
44
+ onBackPressed: AlternativeOnBackPressed;
45
+ onActivityResult: AlternativeOnActivityResult;
46
+ layoutType: AlternativeLayoutType;
44
47
  }
45
48
  export interface IAppGenerationOptions {
46
49
  splashActivityClassName: string;
47
- mainActivityClassName: string;
50
+ webViewClassName: string;
48
51
  linkName: string;
49
52
  savedName: string;
50
53
  paranoidSeed: number;
@@ -82,10 +85,12 @@ export declare const FlashAppSchema: mongoose.Schema<any, mongoose.Model<any, an
82
85
  name?: string | undefined;
83
86
  pushesEnabled?: boolean | undefined;
84
87
  sourceUrl?: string | undefined;
88
+ integrationVersion?: number | undefined;
89
+ integrationAlterations?: any;
85
90
  policyUrl?: string | undefined;
86
91
  generationOptions?: {
87
92
  splashActivityClassName: string;
88
- mainActivityClassName: string;
93
+ webViewClassName: string;
89
94
  linkName: string;
90
95
  savedName: string;
91
96
  paranoidSeed: number;
@@ -76,12 +76,14 @@ exports.FlashAppSchema = new mongoose_1.Schema({
76
76
  // unique: true,
77
77
  required: true
78
78
  },
79
+ integrationVersion: Number,
80
+ integrationAlterations: Object,
79
81
  generationOptions: {
80
82
  splashActivityClassName: {
81
83
  type: String,
82
84
  required: true
83
85
  },
84
- mainActivityClassName: {
86
+ webViewClassName: {
85
87
  type: String,
86
88
  required: true
87
89
  },
@@ -1,27 +1,4 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
4
  };
@@ -29,10 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
29
6
  exports.createFlashCampaigns = exports.createOWStreamPartialPayload = exports.prepareOWCampaignParameters = exports.createOrFindFlashRedirectCampaign = exports.removeGeosFromAllRedirectCampaigns = exports.addGeosToAllRedirectCampaigns = exports.TRAFFIC_SOURCE_ID_FLASH_AI = void 0;
30
7
  const keitaro_service_1 = require("../network/keitaro/keitaro-service");
31
8
  const sleep_promise_1 = __importDefault(require("sleep-promise"));
32
- const fs = require("fs");
33
- const util = __importStar(require("util"));
34
- const axios_1 = __importDefault(require("axios"));
35
- const readFile = util.promisify(fs.readFile);
36
9
  const FLASH_REDIRECT_GROUP_ID = 82;
37
10
  exports.TRAFFIC_SOURCE_ID_FLASH_AI = 22;
38
11
  const UNIQUENESS_METHOD = "ip_ua";
@@ -388,89 +361,89 @@ let replaceDomainInOffers = async (oldDomain, newDomain, offerNameRegEx) => {
388
361
  // // await KeitaroService.updateOffer(offer)
389
362
  // }
390
363
  };
391
- let gatherInfoForFlashApps = async () => {
392
- console.log(__dirname);
393
- const pasteMap = JSON.parse(await readFile('/Users/bprtsk/Documents/Work/ASO/AI Control Panel /AI Panel Core/src/utils/map-paste.json', 'utf8'));
394
- const trackingMap = JSON.parse(await readFile('/Users/bprtsk/Documents/Work/ASO/AI Control Panel /AI Panel Core/src/utils/map-tracking.json', 'utf8'));
395
- const flashApps = JSON.parse(await readFile('/Users/bprtsk/Documents/Work/ASO/AI Control Panel /AI Panel Core/src/utils/map-apps.json', 'utf8'));
396
- let allCampaigns = await keitaro_service_1.KeitaroService.getAllCampaigns();
397
- let owCampaigns = allCampaigns.filter(c => new RegExp(`^FA #`).exec(c.name)).reduce((acc, obj) => ({ ...acc, [new RegExp(/#(.*) \(/g).exec(obj.name)?.[1] || obj.name]: obj }), {});
398
- let redirectCampaigns = allCampaigns.filter(c => new RegExp(`^F #`).exec(c.name)).reduce((acc, obj) => ({ ...acc, [new RegExp(/#(.*) \(/g).exec(obj.name)?.[1] || obj.name]: obj }), {});
399
- let result = [];
400
- for (let [id, paste] of Object.entries(pasteMap)) {
401
- console.log(`- #${id}`);
402
- // let ow = owCampaigns[id as keyof object] as IKeitaroCampaign | undefined
403
- // let redirect = redirectCampaigns[id as keyof object] as IKeitaroCampaign | undefined
404
- // let tracking = trackingMap[id as keyof object]
405
- let app = flashApps[id];
406
- if (!app) {
407
- console.log(`! No app for ${id}`);
408
- continue;
409
- }
410
- // if (paste.status == FlashAppPlugStatus.ENABLED) {
411
- // if (!ow) console.log(`#${id}: no OW`)
412
- // if (!redirect) console.log(`No redirect for #${id}`)
413
- // else if (!paste.content.includes(redirect.domain)) console.log(`#${id}: Redirect domain (${redirect.domain}) differs from paste domain (${paste.content})`)
414
- // else if (!paste.content.includes(redirect.alias)) console.log(`#${id}: Redirect campaign alias (${redirect.alias}) differs from paste id (${paste.content})`)
415
- // }
416
- // let appId
417
- // for (let parameter of Object.values(redirect?.parameters || {})) {
418
- // if (parameter.name == "appId") {
419
- // appId = parameter.placeholder
420
- // }
421
- // }
422
- // if (!appId && ow) console.log(`No app id for #${id}`)
423
- // else if (appId != id && ow) console.log(`Wrong app id (${appId}) for #${id}`)
424
- // let owDomain = ow?.domain?.split("/")[2]
425
- // let owDomainId = ow?.domain_id
426
- // let owCampaignId = ow?.id
427
- // let owCampaignName = ow?.name
428
- // let owCampaignAlias = ow?.alias
429
- // let redirectDomain = redirect?.domain?.split("/")[2]
430
- // let redirectDomainId = redirect?.domain_id
431
- // let redirectCampaignId = redirect?.id
432
- // let redirectCampaignName = redirect?.name
433
- // let redirectCampaignAlias = redirect?.alias
434
- // let clickIdParameterName = ow?.parameters?.sub_id_8?.name
435
- // let offerIdParameterName = ow?.parameters?.sub_id_15?.name
436
- // if (!clickIdParameterName && app && ow) console.log(`No click id parameter for #${id}`)
437
- // if (!offerIdParameterName && app && ow) console.log(`No offer id parameter for #${id}`)
438
- // let trackingLink = tracking?.trackingUrl
439
- // app.plugStatus = paste.status
440
- // app.plugContent = paste.content
441
- // app.plugType = PlugType.PASTEBIN
442
- // app.plugId = paste.paste_id
443
- // app.reservePlugType = PlugType.PASTEBIN
444
- // app.plugAccountId = parseInt(paste.accountId)
445
- // app.keitaroData.redirectDomainName = redirectDomain || "none"
446
- // app.keitaroData.redirectDomainId = redirectDomainId || 0
447
- // app.keitaroData.redirectCampaignId = redirectCampaignId || 0
448
- // app.keitaroData.redirectCampaignName = redirectCampaignName || "none"
449
- // app.keitaroData.redirectCampaignAlias = redirectCampaignAlias || "none"
450
- // app.keitaroData.trackingDomainId = owDomainId || 0
451
- // app.keitaroData.trackingDomainName = owDomain || "none"
452
- // app.keitaroData.trackingCampaignId = owCampaignId || 0
453
- // app.keitaroData.trackingCampaignName = owCampaignName || "none"
454
- // app.keitaroData.trackingCampaignAlias = owCampaignAlias || "none"
455
- // if (clickIdParameterName) app.keitaroData.clickIdParameterName = clickIdParameterName
456
- // if (offerIdParameterName) app.keitaroData.offerIdParameterName = offerIdParameterName
457
- // if (trackingLink) app.trackingUrl = trackingLink
458
- // if (!owCampaignName?.includes(app.bundle) && ow) {
459
- // console.log(`OW: bundle differs (${app.bundle} in DB and ${owCampaignName})`)
460
- // }
461
- // if (!redirectCampaignName?.includes(app.bundle) && redirect) {
462
- // console.log(`Redirect: bundle differs (${app.bundle} in DB and ${redirectCampaignName})`)
463
- // }
464
- result.push(app);
465
- console.log("--------------------");
466
- }
467
- await axios_1.default.post(`https://aipanel-secondary.com/flash/batch-update`, result, {
468
- headers: {
469
- "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwiaWF0IjoxNjg3Mjc2NjA0LCJleHAiOjE2ODc4ODE0MDR9.XesrnNGmWlK-yBBMs5TeKvTe07A8Sud7B4MyfZAOMag"
470
- }
471
- });
472
- // console.log(result)
473
- };
364
+ // let gatherInfoForFlashApps = async () => {
365
+ // console.log(__dirname)
366
+ // const pasteMap: PasteMap = JSON.parse(await readFile('/Users/bprtsk/Documents/Work/ASO/AI Control Panel /AI Panel Core/src/utils/map-paste.json', 'utf8'));
367
+ // const trackingMap: TrackingMap = JSON.parse(await readFile('/Users/bprtsk/Documents/Work/ASO/AI Control Panel /AI Panel Core/src/utils/map-tracking.json', 'utf8'));
368
+ // const flashApps: { [key: string]: IFlashApp | undefined } = JSON.parse(await readFile('/Users/bprtsk/Documents/Work/ASO/AI Control Panel /AI Panel Core/src/utils/map-apps.json', 'utf8'));
369
+ // let allCampaigns = await KeitaroService.getAllCampaigns()
370
+ // let owCampaigns = allCampaigns.filter(c => new RegExp(`^FA #`).exec(c.name)).reduce((acc, obj) => ({ ...acc, [new RegExp(/#(.*) \(/g).exec(obj.name)?.[1] || obj.name]: obj }), {});
371
+ // let redirectCampaigns = allCampaigns.filter(c => new RegExp(`^F #`).exec(c.name)).reduce((acc, obj) => ({ ...acc, [new RegExp(/#(.*) \(/g).exec(obj.name)?.[1] || obj.name]: obj }), {});
372
+ // let result = []
373
+ // for (let [id, paste] of Object.entries(pasteMap)) {
374
+ // console.log(`- #${id}`)
375
+ // // let ow = owCampaigns[id as keyof object] as IKeitaroCampaign | undefined
376
+ // // let redirect = redirectCampaigns[id as keyof object] as IKeitaroCampaign | undefined
377
+ // // let tracking = trackingMap[id as keyof object]
378
+ // let app = flashApps[id as keyof object]
379
+ // if (!app) {
380
+ // console.log(`! No app for ${id}`)
381
+ // continue
382
+ // }
383
+ // // if (paste.status == FlashAppPlugStatus.ENABLED) {
384
+ // // if (!ow) console.log(`#${id}: no OW`)
385
+ // // if (!redirect) console.log(`No redirect for #${id}`)
386
+ // // else if (!paste.content.includes(redirect.domain)) console.log(`#${id}: Redirect domain (${redirect.domain}) differs from paste domain (${paste.content})`)
387
+ // // else if (!paste.content.includes(redirect.alias)) console.log(`#${id}: Redirect campaign alias (${redirect.alias}) differs from paste id (${paste.content})`)
388
+ // // }
389
+ // // let appId
390
+ // // for (let parameter of Object.values(redirect?.parameters || {})) {
391
+ // // if (parameter.name == "appId") {
392
+ // // appId = parameter.placeholder
393
+ // // }
394
+ // // }
395
+ // // if (!appId && ow) console.log(`No app id for #${id}`)
396
+ // // else if (appId != id && ow) console.log(`Wrong app id (${appId}) for #${id}`)
397
+ // // let owDomain = ow?.domain?.split("/")[2]
398
+ // // let owDomainId = ow?.domain_id
399
+ // // let owCampaignId = ow?.id
400
+ // // let owCampaignName = ow?.name
401
+ // // let owCampaignAlias = ow?.alias
402
+ // // let redirectDomain = redirect?.domain?.split("/")[2]
403
+ // // let redirectDomainId = redirect?.domain_id
404
+ // // let redirectCampaignId = redirect?.id
405
+ // // let redirectCampaignName = redirect?.name
406
+ // // let redirectCampaignAlias = redirect?.alias
407
+ // // let clickIdParameterName = ow?.parameters?.sub_id_8?.name
408
+ // // let offerIdParameterName = ow?.parameters?.sub_id_15?.name
409
+ // // if (!clickIdParameterName && app && ow) console.log(`No click id parameter for #${id}`)
410
+ // // if (!offerIdParameterName && app && ow) console.log(`No offer id parameter for #${id}`)
411
+ // // let trackingLink = tracking?.trackingUrl
412
+ // // app.plugStatus = paste.status
413
+ // // app.plugContent = paste.content
414
+ // // app.plugType = PlugType.PASTEBIN
415
+ // // app.plugId = paste.paste_id
416
+ // // app.reservePlugType = PlugType.PASTEBIN
417
+ // // app.plugAccountId = parseInt(paste.accountId)
418
+ // // app.keitaroData.redirectDomainName = redirectDomain || "none"
419
+ // // app.keitaroData.redirectDomainId = redirectDomainId || 0
420
+ // // app.keitaroData.redirectCampaignId = redirectCampaignId || 0
421
+ // // app.keitaroData.redirectCampaignName = redirectCampaignName || "none"
422
+ // // app.keitaroData.redirectCampaignAlias = redirectCampaignAlias || "none"
423
+ // // app.keitaroData.trackingDomainId = owDomainId || 0
424
+ // // app.keitaroData.trackingDomainName = owDomain || "none"
425
+ // // app.keitaroData.trackingCampaignId = owCampaignId || 0
426
+ // // app.keitaroData.trackingCampaignName = owCampaignName || "none"
427
+ // // app.keitaroData.trackingCampaignAlias = owCampaignAlias || "none"
428
+ // // if (clickIdParameterName) app.keitaroData.clickIdParameterName = clickIdParameterName
429
+ // // if (offerIdParameterName) app.keitaroData.offerIdParameterName = offerIdParameterName
430
+ // // if (trackingLink) app.trackingUrl = trackingLink
431
+ // // if (!owCampaignName?.includes(app.bundle) && ow) {
432
+ // // console.log(`OW: bundle differs (${app.bundle} in DB and ${owCampaignName})`)
433
+ // // }
434
+ // // if (!redirectCampaignName?.includes(app.bundle) && redirect) {
435
+ // // console.log(`Redirect: bundle differs (${app.bundle} in DB and ${redirectCampaignName})`)
436
+ // // }
437
+ // result.push(app)
438
+ // console.log("--------------------")
439
+ // }
440
+ // await axios.post(`https://aipanel-secondary.com/flash/batch-update`, result, {
441
+ // headers: {
442
+ // "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwiaWF0IjoxNjg3Mjc2NjA0LCJleHAiOjE2ODc4ODE0MDR9.XesrnNGmWlK-yBBMs5TeKvTe07A8Sud7B4MyfZAOMag"
443
+ // }
444
+ // })
445
+ // // console.log(result)
446
+ // }
474
447
  let findBrokenOfferStreams = async () => {
475
448
  let allCampaigns = await keitaro_service_1.KeitaroService.getAllCampaigns();
476
449
  let regexp = new RegExp(`^FA #`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bprotsyk/aso-core",
3
- "version": "1.2.102",
3
+ "version": "1.2.104",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "scripts": {
@@ -35,6 +35,7 @@ export enum AlternativeSourceType {
35
35
  GET_RETROFIT = "From link via Retrofit",
36
36
  GET_VOLLEY = "From link via Volley",
37
37
  GET_HTTP_URL = "From link via HTTPUrlConnection",
38
+ DIRECT = "Directly from link"
38
39
  // WITHIN_WEBVIEW = "Within webview",
39
40
  }
40
41
 
@@ -1,4 +1,4 @@
1
- import { AlternativeLogicType, AlternativeNavigation, AlternativeNetworkTool, AlternativeSourceType, AlternativeStorageType } from "index";
1
+ import { AlternativeLayoutType, AlternativeLogicType, AlternativeNavigation, AlternativeNetworkTool, AlternativeOnActivityResult, AlternativeOnBackPressed, AlternativeSourceType, AlternativeStorageType } from "index";
2
2
  import { FlashAppType } from "./flash-app-type";
3
3
  import mongoose, { Document, Model, model, PipelineStage, Schema, UpdateQuery, UpdateWithAggregationPipeline } from "mongoose";
4
4
  const util = require("util")
@@ -48,12 +48,15 @@ export interface IntegrationAlterations {
48
48
  logicType: AlternativeLogicType, // Logic
49
49
  navigation: AlternativeNavigation, // Navigation
50
50
  storageType: AlternativeStorageType, // Storage
51
- sourceType: AlternativeSourceType // Source
51
+ sourceType: AlternativeSourceType, // Source
52
+ onBackPressed: AlternativeOnBackPressed,
53
+ onActivityResult: AlternativeOnActivityResult,
54
+ layoutType: AlternativeLayoutType
52
55
  }
53
56
 
54
57
  export interface IAppGenerationOptions {
55
58
  splashActivityClassName: string
56
- mainActivityClassName: string
59
+ webViewClassName: string
57
60
  linkName: string
58
61
  savedName: string
59
62
  paranoidSeed: number
@@ -140,12 +143,15 @@ export const FlashAppSchema = new Schema({
140
143
  required: true
141
144
  },
142
145
 
146
+ integrationVersion: Number,
147
+ integrationAlterations: Object,
148
+
143
149
  generationOptions: {
144
150
  splashActivityClassName: {
145
151
  type: String,
146
152
  required: true
147
153
  },
148
- mainActivityClassName: {
154
+ webViewClassName: {
149
155
  type: String,
150
156
  required: true
151
157
  },
@@ -5,11 +5,9 @@ import { IKeitaroCampaign, IKeitaroCampaignParameters } from "../keitaro/keitaro
5
5
  import { IKeitaroDomain } from "../keitaro/keitaro-domain"
6
6
  import { KeitaroService } from "../network/keitaro/keitaro-service"
7
7
  import sleep from 'sleep-promise';
8
- const fs = require("fs")
9
8
  import * as util from 'util';
10
9
  import { PasteMap, TrackingMap } from "utils/app-gathering-utils"
11
10
  import axios from "axios"
12
- const readFile = util.promisify(fs.readFile);
13
11
 
14
12
  const FLASH_REDIRECT_GROUP_ID = 82
15
13
  export const TRAFFIC_SOURCE_ID_FLASH_AI = 22
@@ -402,108 +400,108 @@ let replaceDomainInOffers = async (oldDomain: string, newDomain: string, offerNa
402
400
  // }
403
401
  }
404
402
 
405
- let gatherInfoForFlashApps = async () => {
406
- console.log(__dirname)
407
- const pasteMap: PasteMap = JSON.parse(await readFile('/Users/bprtsk/Documents/Work/ASO/AI Control Panel /AI Panel Core/src/utils/map-paste.json', 'utf8'));
408
- const trackingMap: TrackingMap = JSON.parse(await readFile('/Users/bprtsk/Documents/Work/ASO/AI Control Panel /AI Panel Core/src/utils/map-tracking.json', 'utf8'));
409
- const flashApps: { [key: string]: IFlashApp | undefined } = JSON.parse(await readFile('/Users/bprtsk/Documents/Work/ASO/AI Control Panel /AI Panel Core/src/utils/map-apps.json', 'utf8'));
410
-
411
- let allCampaigns = await KeitaroService.getAllCampaigns()
412
- let owCampaigns = allCampaigns.filter(c => new RegExp(`^FA #`).exec(c.name)).reduce((acc, obj) => ({ ...acc, [new RegExp(/#(.*) \(/g).exec(obj.name)?.[1] || obj.name]: obj }), {});
413
- let redirectCampaigns = allCampaigns.filter(c => new RegExp(`^F #`).exec(c.name)).reduce((acc, obj) => ({ ...acc, [new RegExp(/#(.*) \(/g).exec(obj.name)?.[1] || obj.name]: obj }), {});
414
-
415
- let result = []
416
- for (let [id, paste] of Object.entries(pasteMap)) {
417
- console.log(`- #${id}`)
418
- // let ow = owCampaigns[id as keyof object] as IKeitaroCampaign | undefined
419
- // let redirect = redirectCampaigns[id as keyof object] as IKeitaroCampaign | undefined
420
- // let tracking = trackingMap[id as keyof object]
421
- let app = flashApps[id as keyof object]
422
-
423
- if (!app) {
424
- console.log(`! No app for ${id}`)
425
- continue
426
- }
427
-
428
- // if (paste.status == FlashAppPlugStatus.ENABLED) {
429
- // if (!ow) console.log(`#${id}: no OW`)
430
-
431
- // if (!redirect) console.log(`No redirect for #${id}`)
432
- // else if (!paste.content.includes(redirect.domain)) console.log(`#${id}: Redirect domain (${redirect.domain}) differs from paste domain (${paste.content})`)
433
- // else if (!paste.content.includes(redirect.alias)) console.log(`#${id}: Redirect campaign alias (${redirect.alias}) differs from paste id (${paste.content})`)
434
- // }
435
-
436
- // let appId
437
- // for (let parameter of Object.values(redirect?.parameters || {})) {
438
- // if (parameter.name == "appId") {
439
- // appId = parameter.placeholder
440
- // }
441
- // }
442
- // if (!appId && ow) console.log(`No app id for #${id}`)
443
- // else if (appId != id && ow) console.log(`Wrong app id (${appId}) for #${id}`)
444
-
445
- // let owDomain = ow?.domain?.split("/")[2]
446
- // let owDomainId = ow?.domain_id
447
- // let owCampaignId = ow?.id
448
- // let owCampaignName = ow?.name
449
- // let owCampaignAlias = ow?.alias
450
- // let redirectDomain = redirect?.domain?.split("/")[2]
451
- // let redirectDomainId = redirect?.domain_id
452
- // let redirectCampaignId = redirect?.id
453
- // let redirectCampaignName = redirect?.name
454
- // let redirectCampaignAlias = redirect?.alias
455
-
456
- // let clickIdParameterName = ow?.parameters?.sub_id_8?.name
457
- // let offerIdParameterName = ow?.parameters?.sub_id_15?.name
458
- // if (!clickIdParameterName && app && ow) console.log(`No click id parameter for #${id}`)
459
- // if (!offerIdParameterName && app && ow) console.log(`No offer id parameter for #${id}`)
460
-
461
- // let trackingLink = tracking?.trackingUrl
462
-
463
- // app.plugStatus = paste.status
464
- // app.plugContent = paste.content
465
- // app.plugType = PlugType.PASTEBIN
466
- // app.plugId = paste.paste_id
467
- // app.reservePlugType = PlugType.PASTEBIN
468
- // app.plugAccountId = parseInt(paste.accountId)
469
-
470
- // app.keitaroData.redirectDomainName = redirectDomain || "none"
471
- // app.keitaroData.redirectDomainId = redirectDomainId || 0
472
- // app.keitaroData.redirectCampaignId = redirectCampaignId || 0
473
- // app.keitaroData.redirectCampaignName = redirectCampaignName || "none"
474
- // app.keitaroData.redirectCampaignAlias = redirectCampaignAlias || "none"
475
- // app.keitaroData.trackingDomainId = owDomainId || 0
476
- // app.keitaroData.trackingDomainName = owDomain || "none"
477
- // app.keitaroData.trackingCampaignId = owCampaignId || 0
478
- // app.keitaroData.trackingCampaignName = owCampaignName || "none"
479
- // app.keitaroData.trackingCampaignAlias = owCampaignAlias || "none"
480
-
481
- // if (clickIdParameterName) app.keitaroData.clickIdParameterName = clickIdParameterName
482
- // if (offerIdParameterName) app.keitaroData.offerIdParameterName = offerIdParameterName
483
-
484
- // if (trackingLink) app.trackingUrl = trackingLink
485
-
486
- // if (!owCampaignName?.includes(app.bundle) && ow) {
487
- // console.log(`OW: bundle differs (${app.bundle} in DB and ${owCampaignName})`)
488
- // }
489
-
490
- // if (!redirectCampaignName?.includes(app.bundle) && redirect) {
491
- // console.log(`Redirect: bundle differs (${app.bundle} in DB and ${redirectCampaignName})`)
492
- // }
493
-
494
- result.push(app)
495
-
496
- console.log("--------------------")
497
- }
403
+ // let gatherInfoForFlashApps = async () => {
404
+ // console.log(__dirname)
405
+ // const pasteMap: PasteMap = JSON.parse(await readFile('/Users/bprtsk/Documents/Work/ASO/AI Control Panel /AI Panel Core/src/utils/map-paste.json', 'utf8'));
406
+ // const trackingMap: TrackingMap = JSON.parse(await readFile('/Users/bprtsk/Documents/Work/ASO/AI Control Panel /AI Panel Core/src/utils/map-tracking.json', 'utf8'));
407
+ // const flashApps: { [key: string]: IFlashApp | undefined } = JSON.parse(await readFile('/Users/bprtsk/Documents/Work/ASO/AI Control Panel /AI Panel Core/src/utils/map-apps.json', 'utf8'));
408
+
409
+ // let allCampaigns = await KeitaroService.getAllCampaigns()
410
+ // let owCampaigns = allCampaigns.filter(c => new RegExp(`^FA #`).exec(c.name)).reduce((acc, obj) => ({ ...acc, [new RegExp(/#(.*) \(/g).exec(obj.name)?.[1] || obj.name]: obj }), {});
411
+ // let redirectCampaigns = allCampaigns.filter(c => new RegExp(`^F #`).exec(c.name)).reduce((acc, obj) => ({ ...acc, [new RegExp(/#(.*) \(/g).exec(obj.name)?.[1] || obj.name]: obj }), {});
412
+
413
+ // let result = []
414
+ // for (let [id, paste] of Object.entries(pasteMap)) {
415
+ // console.log(`- #${id}`)
416
+ // // let ow = owCampaigns[id as keyof object] as IKeitaroCampaign | undefined
417
+ // // let redirect = redirectCampaigns[id as keyof object] as IKeitaroCampaign | undefined
418
+ // // let tracking = trackingMap[id as keyof object]
419
+ // let app = flashApps[id as keyof object]
420
+
421
+ // if (!app) {
422
+ // console.log(`! No app for ${id}`)
423
+ // continue
424
+ // }
425
+
426
+ // // if (paste.status == FlashAppPlugStatus.ENABLED) {
427
+ // // if (!ow) console.log(`#${id}: no OW`)
428
+
429
+ // // if (!redirect) console.log(`No redirect for #${id}`)
430
+ // // else if (!paste.content.includes(redirect.domain)) console.log(`#${id}: Redirect domain (${redirect.domain}) differs from paste domain (${paste.content})`)
431
+ // // else if (!paste.content.includes(redirect.alias)) console.log(`#${id}: Redirect campaign alias (${redirect.alias}) differs from paste id (${paste.content})`)
432
+ // // }
433
+
434
+ // // let appId
435
+ // // for (let parameter of Object.values(redirect?.parameters || {})) {
436
+ // // if (parameter.name == "appId") {
437
+ // // appId = parameter.placeholder
438
+ // // }
439
+ // // }
440
+ // // if (!appId && ow) console.log(`No app id for #${id}`)
441
+ // // else if (appId != id && ow) console.log(`Wrong app id (${appId}) for #${id}`)
442
+
443
+ // // let owDomain = ow?.domain?.split("/")[2]
444
+ // // let owDomainId = ow?.domain_id
445
+ // // let owCampaignId = ow?.id
446
+ // // let owCampaignName = ow?.name
447
+ // // let owCampaignAlias = ow?.alias
448
+ // // let redirectDomain = redirect?.domain?.split("/")[2]
449
+ // // let redirectDomainId = redirect?.domain_id
450
+ // // let redirectCampaignId = redirect?.id
451
+ // // let redirectCampaignName = redirect?.name
452
+ // // let redirectCampaignAlias = redirect?.alias
453
+
454
+ // // let clickIdParameterName = ow?.parameters?.sub_id_8?.name
455
+ // // let offerIdParameterName = ow?.parameters?.sub_id_15?.name
456
+ // // if (!clickIdParameterName && app && ow) console.log(`No click id parameter for #${id}`)
457
+ // // if (!offerIdParameterName && app && ow) console.log(`No offer id parameter for #${id}`)
458
+
459
+ // // let trackingLink = tracking?.trackingUrl
460
+
461
+ // // app.plugStatus = paste.status
462
+ // // app.plugContent = paste.content
463
+ // // app.plugType = PlugType.PASTEBIN
464
+ // // app.plugId = paste.paste_id
465
+ // // app.reservePlugType = PlugType.PASTEBIN
466
+ // // app.plugAccountId = parseInt(paste.accountId)
467
+
468
+ // // app.keitaroData.redirectDomainName = redirectDomain || "none"
469
+ // // app.keitaroData.redirectDomainId = redirectDomainId || 0
470
+ // // app.keitaroData.redirectCampaignId = redirectCampaignId || 0
471
+ // // app.keitaroData.redirectCampaignName = redirectCampaignName || "none"
472
+ // // app.keitaroData.redirectCampaignAlias = redirectCampaignAlias || "none"
473
+ // // app.keitaroData.trackingDomainId = owDomainId || 0
474
+ // // app.keitaroData.trackingDomainName = owDomain || "none"
475
+ // // app.keitaroData.trackingCampaignId = owCampaignId || 0
476
+ // // app.keitaroData.trackingCampaignName = owCampaignName || "none"
477
+ // // app.keitaroData.trackingCampaignAlias = owCampaignAlias || "none"
478
+
479
+ // // if (clickIdParameterName) app.keitaroData.clickIdParameterName = clickIdParameterName
480
+ // // if (offerIdParameterName) app.keitaroData.offerIdParameterName = offerIdParameterName
481
+
482
+ // // if (trackingLink) app.trackingUrl = trackingLink
483
+
484
+ // // if (!owCampaignName?.includes(app.bundle) && ow) {
485
+ // // console.log(`OW: bundle differs (${app.bundle} in DB and ${owCampaignName})`)
486
+ // // }
487
+
488
+ // // if (!redirectCampaignName?.includes(app.bundle) && redirect) {
489
+ // // console.log(`Redirect: bundle differs (${app.bundle} in DB and ${redirectCampaignName})`)
490
+ // // }
491
+
492
+ // result.push(app)
493
+
494
+ // console.log("--------------------")
495
+ // }
498
496
 
499
- await axios.post(`https://aipanel-secondary.com/flash/batch-update`, result, {
500
- headers: {
501
- "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwiaWF0IjoxNjg3Mjc2NjA0LCJleHAiOjE2ODc4ODE0MDR9.XesrnNGmWlK-yBBMs5TeKvTe07A8Sud7B4MyfZAOMag"
502
- }
503
- })
497
+ // await axios.post(`https://aipanel-secondary.com/flash/batch-update`, result, {
498
+ // headers: {
499
+ // "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwiaWF0IjoxNjg3Mjc2NjA0LCJleHAiOjE2ODc4ODE0MDR9.XesrnNGmWlK-yBBMs5TeKvTe07A8Sud7B4MyfZAOMag"
500
+ // }
501
+ // })
504
502
 
505
- // console.log(result)
506
- }
503
+ // // console.log(result)
504
+ // }
507
505
 
508
506
  let findBrokenOfferStreams = async () => {
509
507
  let allCampaigns = await KeitaroService.getAllCampaigns()