@bprotsyk/aso-core 1.2.88 → 1.2.91

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.
@@ -0,0 +1,33 @@
1
+ export declare enum AlternativeNetworkTool {
2
+ RETROFIT = "Retrofit",
3
+ VOLLEY = "Volley",
4
+ HTTP_URL = "HTTPUrlConnection"
5
+ }
6
+ export declare enum AlternativeLogicType {
7
+ CALLBACKS = "Callback",
8
+ RX = "RX",
9
+ COROUTINES = "Coroutines"
10
+ }
11
+ export declare enum AlternativeWebViewType {
12
+ ACTIVITY = "Activity",
13
+ FRAGMENT_FM = "Fragment",
14
+ FRAGMENT_NAV_HOST = "Fragment (NavHost)"
15
+ }
16
+ export declare enum AlternativeStorageType {
17
+ FILE = "File",
18
+ ROOM = "Room",
19
+ ENCRYPTED_PREFS = "Encrypted Preferences",
20
+ SHARED_PREFERENCES = "Shared Preferences",
21
+ CONTENT_PROVIDER = "Content Provider"
22
+ }
23
+ export declare enum AlternativeLayoutType {
24
+ DATA_BINDING = "DataBinding",
25
+ BY_ID = "findViewById",
26
+ PROGRAMATICALLY = "Create in code"
27
+ }
28
+ export interface IFlashIntegration {
29
+ id: number;
30
+ name: string;
31
+ description: string;
32
+ alterations: [any[]];
33
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AlternativeLayoutType = exports.AlternativeStorageType = exports.AlternativeWebViewType = exports.AlternativeLogicType = exports.AlternativeNetworkTool = void 0;
4
+ var AlternativeNetworkTool;
5
+ (function (AlternativeNetworkTool) {
6
+ AlternativeNetworkTool["RETROFIT"] = "Retrofit";
7
+ AlternativeNetworkTool["VOLLEY"] = "Volley";
8
+ AlternativeNetworkTool["HTTP_URL"] = "HTTPUrlConnection";
9
+ })(AlternativeNetworkTool = exports.AlternativeNetworkTool || (exports.AlternativeNetworkTool = {}));
10
+ var AlternativeLogicType;
11
+ (function (AlternativeLogicType) {
12
+ AlternativeLogicType["CALLBACKS"] = "Callback";
13
+ AlternativeLogicType["RX"] = "RX";
14
+ AlternativeLogicType["COROUTINES"] = "Coroutines";
15
+ })(AlternativeLogicType = exports.AlternativeLogicType || (exports.AlternativeLogicType = {}));
16
+ var AlternativeWebViewType;
17
+ (function (AlternativeWebViewType) {
18
+ AlternativeWebViewType["ACTIVITY"] = "Activity";
19
+ AlternativeWebViewType["FRAGMENT_FM"] = "Fragment";
20
+ AlternativeWebViewType["FRAGMENT_NAV_HOST"] = "Fragment (NavHost)";
21
+ })(AlternativeWebViewType = exports.AlternativeWebViewType || (exports.AlternativeWebViewType = {}));
22
+ var AlternativeStorageType;
23
+ (function (AlternativeStorageType) {
24
+ AlternativeStorageType["FILE"] = "File";
25
+ AlternativeStorageType["ROOM"] = "Room";
26
+ AlternativeStorageType["ENCRYPTED_PREFS"] = "Encrypted Preferences";
27
+ AlternativeStorageType["SHARED_PREFERENCES"] = "Shared Preferences";
28
+ AlternativeStorageType["CONTENT_PROVIDER"] = "Content Provider";
29
+ })(AlternativeStorageType = exports.AlternativeStorageType || (exports.AlternativeStorageType = {}));
30
+ var AlternativeLayoutType;
31
+ (function (AlternativeLayoutType) {
32
+ AlternativeLayoutType["DATA_BINDING"] = "DataBinding";
33
+ AlternativeLayoutType["BY_ID"] = "findViewById";
34
+ AlternativeLayoutType["PROGRAMATICALLY"] = "Create in code";
35
+ })(AlternativeLayoutType = exports.AlternativeLayoutType || (exports.AlternativeLayoutType = {}));
package/lib/index.d.ts CHANGED
@@ -19,19 +19,3 @@ export { IOfferWallHomeDialogData } from "./aso/offerwall/offerwall-home-dialog-
19
19
  export { IFlashApp, FlashAppSchema, updateSchemaAndMoveValue, PlugType, FlashAppPlugStatus } from "./flash/flash-app";
20
20
  export { IFlashAppListItem } from "./flash/flash-app-list-item";
21
21
  export { FlashAppType } from "./flash/flash-app-type";
22
- export * as ASOConfigFetch from "./aso/usage-logs/aso-config-fetch-entry";
23
- export { IPanelUser, PanelUserAccessScope, PanelUserSchema } from "./panel/user";
24
- export { IAuthToken } from "./panel/auth";
25
- export { IUpsertFlashAppRequest, IUpsertFlashAppResponse } from "./panel/flash/create-flash-app-request";
26
- export { IGradient, IStroke, IShape, ShapeDiv } from "./shared/shape";
27
- export { ColoredText, IColoredTextProps } from "./shared/colored-text";
28
- export { IOfferWallAuthConfig } from "./aso/offerwall/auth/offerwall-auth-config";
29
- export { IOfferWallAuthLocalization } from "./aso/offerwall/auth/offerwall-auth-localization";
30
- export { IOfferWallAuthSubmitRequest } from "./aso/offerwall/auth/offerwall-auth-submit-request";
31
- export { IOfferWallAuthSubmitResponse } from "./aso/offerwall/auth/offerwall-auth-submit-response";
32
- export { KeitaroService } from "./network/keitaro/keitaro-service";
33
- export * as KeitaroUtils from "./utils/keitaro-utils";
34
- export { IKeitaroCampaign, IKeitaroCampaignParameters, IKeitaroCampaignParameter } from "./keitaro/keitaro-campaign";
35
- export { IKeitaroDomain } from "./keitaro/keitaro-domain";
36
- export { IKeitaroOffer } from "./keitaro/keitaro-offer";
37
- export { IKeitaroStream } from "./keitaro/keitaro-stream";
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.KeitaroUtils = exports.KeitaroService = exports.ColoredText = exports.ShapeDiv = exports.PanelUserSchema = exports.PanelUserAccessScope = exports.ASOConfigFetch = exports.FlashAppType = exports.FlashAppPlugStatus = exports.PlugType = exports.updateSchemaAndMoveValue = exports.FlashAppSchema = exports.ASO_v5 = exports.ASO_v4 = exports.ASO_v3 = exports.ASO_v2 = exports.ASO_v1 = exports.ASO_v0 = void 0;
26
+ exports.FlashAppType = exports.FlashAppPlugStatus = exports.PlugType = exports.updateSchemaAndMoveValue = exports.FlashAppSchema = exports.ASO_v5 = exports.ASO_v4 = exports.ASO_v3 = exports.ASO_v2 = exports.ASO_v1 = exports.ASO_v0 = void 0;
27
27
  exports.ASO_v0 = __importStar(require("./aso/config/aso-config-v0"));
28
28
  exports.ASO_v1 = __importStar(require("./aso/config/aso-config-v1"));
29
29
  exports.ASO_v2 = __importStar(require("./aso/config/aso-config-v2"));
@@ -37,14 +37,26 @@ Object.defineProperty(exports, "PlugType", { enumerable: true, get: function ()
37
37
  Object.defineProperty(exports, "FlashAppPlugStatus", { enumerable: true, get: function () { return flash_app_1.FlashAppPlugStatus; } });
38
38
  var flash_app_type_1 = require("./flash/flash-app-type");
39
39
  Object.defineProperty(exports, "FlashAppType", { enumerable: true, get: function () { return flash_app_type_1.FlashAppType; } });
40
- exports.ASOConfigFetch = __importStar(require("./aso/usage-logs/aso-config-fetch-entry"));
41
- var user_1 = require("./panel/user");
42
- Object.defineProperty(exports, "PanelUserAccessScope", { enumerable: true, get: function () { return user_1.PanelUserAccessScope; } });
43
- Object.defineProperty(exports, "PanelUserSchema", { enumerable: true, get: function () { return user_1.PanelUserSchema; } });
44
- var shape_1 = require("./shared/shape");
45
- Object.defineProperty(exports, "ShapeDiv", { enumerable: true, get: function () { return shape_1.ShapeDiv; } });
46
- var colored_text_1 = require("./shared/colored-text");
47
- Object.defineProperty(exports, "ColoredText", { enumerable: true, get: function () { return colored_text_1.ColoredText; } });
48
- var keitaro_service_1 = require("./network/keitaro/keitaro-service");
49
- Object.defineProperty(exports, "KeitaroService", { enumerable: true, get: function () { return keitaro_service_1.KeitaroService; } });
50
- exports.KeitaroUtils = __importStar(require("./utils/keitaro-utils"));
40
+ `
41
+ export { AlternativeLayoutType, AlternativeLogicType, AlternativeNetworkTool, AlternativeStorageType, AlternativeWebViewType, IFlashIntegration } from "./flash/flash-app-integration"
42
+
43
+ export * as ASOConfigFetch from "./aso/usage-logs/aso-config-fetch-entry"
44
+
45
+ export { IPanelUser, PanelUserAccessScope, PanelUserSchema } from "./panel/user"
46
+ export { IAuthToken } from "./panel/auth"
47
+ export { IUpsertFlashAppRequest, IUpsertFlashAppResponse } from "./panel/flash/create-flash-app-request"
48
+
49
+ export { IGradient, IStroke, IShape, ShapeDiv } from "./shared/shape"
50
+ export { ColoredText, IColoredTextProps } from "./shared/colored-text"
51
+ export { IOfferWallAuthConfig } from "./aso/offerwall/auth/offerwall-auth-config"
52
+ export { IOfferWallAuthLocalization } from "./aso/offerwall/auth/offerwall-auth-localization"
53
+ export { IOfferWallAuthSubmitRequest } from "./aso/offerwall/auth/offerwall-auth-submit-request"
54
+ export { IOfferWallAuthSubmitResponse } from "./aso/offerwall/auth/offerwall-auth-submit-response"
55
+
56
+ export { KeitaroService } from "./network/keitaro/keitaro-service"
57
+ export * as KeitaroUtils from "./utils/keitaro-utils"
58
+
59
+ export {IKeitaroCampaign, IKeitaroCampaignParameters, IKeitaroCampaignParameter} from "./keitaro/keitaro-campaign"
60
+ export {IKeitaroDomain} from "./keitaro/keitaro-domain"
61
+ export {IKeitaroOffer} from "./keitaro/keitaro-offer"
62
+ export {IKeitaroStream} from "./keitaro/keitaro-stream";
@@ -9,6 +9,7 @@ declare function cloneStreams(originalCampaignId: number, streamPositionsToClone
9
9
  declare function updateCampaign(id: number, payload: Partial<IKeitaroCampaign>): Promise<void>;
10
10
  declare function getAllOffers(): Promise<any[]>;
11
11
  declare function getOfferByKeitaroId(id: number): Promise<any>;
12
+ declare function updateOffer(offer: any): Promise<any>;
12
13
  declare function addOfferToKeitaro(offer: IOffer, affiliateId: number, link: string, groupId?: number): Promise<void>;
13
14
  declare function createCampaign(campaignData: Partial<IKeitaroCampaign>): Promise<IKeitaroCampaign>;
14
15
  declare function getCampaignById(id: number): Promise<IKeitaroCampaign>;
@@ -28,5 +29,6 @@ export declare const KeitaroService: {
28
29
  getCampaignById: typeof getCampaignById;
29
30
  upsertStreamToCampaign: typeof upsertStreamToCampaign;
30
31
  cloneOWCampaign: typeof cloneOWCampaign;
32
+ updateOffer: typeof updateOffer;
31
33
  };
32
34
  export {};
@@ -86,6 +86,10 @@ async function getOfferByKeitaroId(id) {
86
86
  const { data: offer } = await http_1.default.get(`offers/${id}`);
87
87
  return offer;
88
88
  }
89
+ async function updateOffer(offer) {
90
+ const { data: o } = await http_1.default.put(`offers/${offer.id}`, offer);
91
+ return o;
92
+ }
89
93
  function createStreamPartialPayload(keitaroOfferId, offerName, offerId, offerGeo) {
90
94
  return {
91
95
  name: `${offerName} ${offerGeo} (${offerId})`,
@@ -187,5 +191,6 @@ async function getDomains(onlyActive) {
187
191
  return onlyActive ? domains.filter((d) => d.network_status == "active") : domains;
188
192
  }
189
193
  exports.KeitaroService = {
190
- getStreamsByCampaignId, updateCampaign, getAllCampaigns, getAllOffers, cloneStreams, addOfferToKeitaro, getOfferByKeitaroId, getDomains, createCampaign, getCampaignById, upsertStreamToCampaign, cloneOWCampaign
194
+ getStreamsByCampaignId, updateCampaign, getAllCampaigns, getAllOffers, cloneStreams, addOfferToKeitaro, getOfferByKeitaroId, getDomains, createCampaign, getCampaignById, upsertStreamToCampaign, cloneOWCampaign,
195
+ updateOffer
191
196
  };
@@ -1,3 +1,4 @@
1
+ import { IAppKeitaroData } from "flash/flash-app";
1
2
  export interface IUpsertFlashAppRequest {
2
3
  id: number;
3
4
  name: string;
@@ -11,6 +12,7 @@ export interface IUpsertFlashAppRequest {
11
12
  developerEmail: string;
12
13
  developerOrganization: string;
13
14
  generationOptions: IAppGenerationOptions;
15
+ keitaroData?: Partial<IAppKeitaroData>;
14
16
  }
15
17
  export interface IAppGenerationOptions {
16
18
  splashActivityClassName: string;
@@ -0,0 +1,2 @@
1
+ export declare let modifyAppBuildGragleFile: (file: string, alias: string, password: string, keyName: string) => Promise<string>;
2
+ export declare let mofidyGradleBuildFile: (file: string) => Promise<string>;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mofidyGradleBuildFile = exports.modifyAppBuildGragleFile = void 0;
4
+ let modifyAppBuildGragleFile = async (file, alias, password, keyName) => {
5
+ const newSigningConfig = `
6
+ signingConfigs {
7
+ release {
8
+ keyAlias "${alias}"
9
+ keyPassword "${password}"
10
+ storePassword "${password}"
11
+ storeFile file('./${keyName}.jks')
12
+ v1SigningEnabled true
13
+ v2SigningEnabled true
14
+ }
15
+ `;
16
+ const huaweiBlock = `
17
+ huawei {
18
+ minifyEnabled true
19
+ shrinkResources true
20
+ signingConfig signingConfigs.release
21
+ proguardFiles(
22
+ getDefaultProguardFile("proguard-android-optimize.txt"),
23
+ "proguard-rules.pro"
24
+ )
25
+ }
26
+ `;
27
+ let updatedConfigString = file.replace(/(signingConfigs\s*{[^}]+})/, newSigningConfig.trim());
28
+ if (!file.includes("signingConfigs")) {
29
+ // If the signingConfigs block doesn't exist, insert it after buildTypes
30
+ updatedConfigString = file.replace("buildTypes {", `signingConfigs ${newSigningConfig.trim()}\n\nbuildTypes {`);
31
+ }
32
+ file = updatedConfigString
33
+ .replace("buildTypes {", `buildTypes {\n${huaweiBlock.trim()}\n`)
34
+ .replace("plugins {", "plugins {\n id 'com.huawei.agconnect'")
35
+ .replace("apply plugin: 'com.android.application'", "apply plugin: 'com.huawei.agconnect'\napply plugin: 'com.android.application'")
36
+ .replace(/(implementation 'com\.onesignal.*')/g, `debugImplementation 'com.onesignal:OneSignal:4.7.2'
37
+ releaseImplementation 'com.onesignal:OneSignal:4.7.2'
38
+
39
+ huaweiImplementation 'com.huawei.hms:push:6.3.0.304'
40
+
41
+ huaweiImplementation('com.onesignal:OneSignal:4.7.2') {
42
+ exclude group: 'com.google.android.gms'
43
+ exclude group: 'com.google.firebase'
44
+ }`);
45
+ return file;
46
+ };
47
+ exports.modifyAppBuildGragleFile = modifyAppBuildGragleFile;
48
+ let mofidyGradleBuildFile = async (file) => {
49
+ return file
50
+ .replace(/repositories {/g, "repositories {\nmaven {url 'https://developer.huawei.com/repo/'")
51
+ .replace(/dependencies {/g, "dependencies {\nclasspath 'com.huawei.agconnect:agcp:1.9.0.300'");
52
+ };
53
+ exports.mofidyGradleBuildFile = mofidyGradleBuildFile;
@@ -103,17 +103,17 @@ let addGeosToAllRedirectCampaigns = async (geosToAdd) => {
103
103
  console.log({
104
104
  name: stream.name,
105
105
  });
106
- let geos = stream?.filters[0]?.payload;
106
+ let geos = stream?.filters[stream.type == "forced" ? 1 : 0]?.payload;
107
107
  if (!geos)
108
108
  continue;
109
109
  geosToAdd.split(" ").forEach((geo) => {
110
110
  let streamForGeo = streams.find((s) => s.name == geo);
111
- if (streamForGeo && stream && stream.type != "forced")
111
+ if (streamForGeo && stream)
112
112
  return;
113
113
  if (!geos.includes(geo))
114
114
  geos.push(geo);
115
115
  });
116
- stream.filters[0].payload = geos;
116
+ stream.filters[stream.type == "forced" ? 1 : 0].payload = geos;
117
117
  await keitaro_service_1.KeitaroService.upsertStreamToCampaign(campaign, stream);
118
118
  await (0, sleep_promise_1.default)(2000);
119
119
  }
@@ -380,6 +380,16 @@ let changeSourceForFA = async () => {
380
380
  });
381
381
  }
382
382
  };
383
+ let replaceDomainInOffers = async (oldDomain, newDomain, offerNameRegEx) => {
384
+ let offers = await keitaro_service_1.KeitaroService.getAllOffers();
385
+ offers = offers.filter((o) => offerNameRegEx.exec(o.name));
386
+ for (let offer of offers) {
387
+ console.log(offer);
388
+ // offer.action_payload = offer.action_payload.replace(oldDomain, newDomain)
389
+ // await sleep(700)
390
+ // await KeitaroService.updateOffer(offer)
391
+ }
392
+ };
383
393
  let gatherInfoForFlashApps = async () => {
384
394
  console.log(__dirname);
385
395
  const pasteMap = JSON.parse(await readFile('/Users/bprtsk/Documents/Work/ASO/AI Control Panel /AI Panel Core/src/utils/map-paste.json', 'utf8'));
@@ -466,6 +476,7 @@ let gatherInfoForFlashApps = async () => {
466
476
  // removeBrokenDomain()
467
477
  // createFlashCampaigns(sampleApp)
468
478
  // changeSourceForFA()
469
- // addGeosToAllRedirectCampaigns("BE")
479
+ // addGeosToAllRedirectCam`paigns("GR")
470
480
  // removeGeosFromAllRedirectCampaigns("BE`")
471
481
  // gatherInfoForFlashApps()
482
+ replaceDomainInOffers(`mariorel.com`, `xmariorel.com`, /Icecasino Huffson.*/g);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bprotsyk/aso-core",
3
- "version": "1.2.88",
3
+ "version": "1.2.91",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "scripts": {
@@ -29,6 +29,7 @@
29
29
  "module-alias": "^2.2.2",
30
30
  "mongoose": "^6.8.3",
31
31
  "react": "^18.2.0",
32
+ "replace-in-file": "^7.0.1",
32
33
  "sleep-promise": "^9.1.0",
33
34
  "styled-components": "^5.3.9"
34
35
  },
@@ -0,0 +1,38 @@
1
+ export enum AlternativeNetworkTool {
2
+ RETROFIT = "Retrofit",
3
+ VOLLEY = "Volley",
4
+ HTTP_URL = "HTTPUrlConnection",
5
+ }
6
+
7
+ export enum AlternativeLogicType {
8
+ CALLBACKS = "Callback",
9
+ RX = "RX",
10
+ COROUTINES = "Coroutines",
11
+ }
12
+
13
+ export enum AlternativeWebViewType {
14
+ ACTIVITY = "Activity",
15
+ FRAGMENT_FM = "Fragment",
16
+ FRAGMENT_NAV_HOST = "Fragment (NavHost)",
17
+ }
18
+
19
+ export enum AlternativeStorageType {
20
+ FILE = "File",
21
+ ROOM = "Room",
22
+ ENCRYPTED_PREFS = "Encrypted Preferences",
23
+ SHARED_PREFERENCES = "Shared Preferences",
24
+ CONTENT_PROVIDER = "Content Provider",
25
+ }
26
+
27
+ export enum AlternativeLayoutType {
28
+ DATA_BINDING = "DataBinding",
29
+ BY_ID = "findViewById",
30
+ PROGRAMATICALLY = "Create in code"
31
+ }
32
+
33
+ export interface IFlashIntegration {
34
+ id: number,
35
+ name: string,
36
+ description: string,
37
+ alterations: [any[]]
38
+ }
package/src/index.ts CHANGED
@@ -21,7 +21,8 @@ export { IOfferWallHomeDialogData } from "./aso/offerwall/offerwall-home-dialog-
21
21
 
22
22
  export { IFlashApp, FlashAppSchema, updateSchemaAndMoveValue, PlugType, FlashAppPlugStatus } from "./flash/flash-app"
23
23
  export { IFlashAppListItem } from "./flash/flash-app-list-item"
24
- export { FlashAppType } from "./flash/flash-app-type"
24
+ export { FlashAppType } from "./flash/flash-app-type"`
25
+ export { AlternativeLayoutType, AlternativeLogicType, AlternativeNetworkTool, AlternativeStorageType, AlternativeWebViewType, IFlashIntegration } from "./flash/flash-app-integration"
25
26
 
26
27
  export * as ASOConfigFetch from "./aso/usage-logs/aso-config-fetch-entry"
27
28
 
@@ -104,6 +104,12 @@ async function getOfferByKeitaroId(id: number): Promise<any> {
104
104
  return offer
105
105
  }
106
106
 
107
+ async function updateOffer(offer: any): Promise<any> {
108
+ const { data: o } = await keitaroApi.put<any>(`offers/${offer.id}`, offer)
109
+
110
+ return o
111
+ }
112
+
107
113
  function createStreamPartialPayload(keitaroOfferId: number, offerName: string, offerId: string, offerGeo: string) {
108
114
  return {
109
115
  name: `${offerName} ${offerGeo} (${offerId})`,
@@ -224,5 +230,6 @@ async function getDomains(onlyActive?: boolean): Promise<IKeitaroDomain[]> {
224
230
  }
225
231
 
226
232
  export const KeitaroService = {
227
- getStreamsByCampaignId, updateCampaign, getAllCampaigns, getAllOffers, cloneStreams, addOfferToKeitaro, getOfferByKeitaroId, getDomains, createCampaign, getCampaignById, upsertStreamToCampaign, cloneOWCampaign
233
+ getStreamsByCampaignId, updateCampaign, getAllCampaigns, getAllOffers, cloneStreams, addOfferToKeitaro, getOfferByKeitaroId, getDomains, createCampaign, getCampaignById, upsertStreamToCampaign, cloneOWCampaign,
234
+ updateOffer
228
235
  }
@@ -1,3 +1,4 @@
1
+ import { IAppKeitaroData } from "flash/flash-app"
1
2
  import { PlugType } from "index"
2
3
 
3
4
  export interface IUpsertFlashAppRequest {
@@ -15,6 +16,7 @@ export interface IUpsertFlashAppRequest {
15
16
  developerEmail: string
16
17
  developerOrganization: string
17
18
  generationOptions: IAppGenerationOptions
19
+ keitaroData?: Partial<IAppKeitaroData>
18
20
  }
19
21
 
20
22
  export interface IAppGenerationOptions {
@@ -0,0 +1,55 @@
1
+ export let modifyAppBuildGragleFile = async (file: string, alias: string, password: string, keyName: string) => {
2
+ const newSigningConfig = `
3
+ signingConfigs {
4
+ release {
5
+ keyAlias "${alias}"
6
+ keyPassword "${password}"
7
+ storePassword "${password}"
8
+ storeFile file('./${keyName}.jks')
9
+ v1SigningEnabled true
10
+ v2SigningEnabled true
11
+ }
12
+ `;
13
+
14
+ const huaweiBlock = `
15
+ huawei {
16
+ minifyEnabled true
17
+ shrinkResources true
18
+ signingConfig signingConfigs.release
19
+ proguardFiles(
20
+ getDefaultProguardFile("proguard-android-optimize.txt"),
21
+ "proguard-rules.pro"
22
+ )
23
+ }
24
+ `;
25
+
26
+ let updatedConfigString = file.replace(/(signingConfigs\s*{[^}]+})/, newSigningConfig.trim());
27
+
28
+ if (!file.includes("signingConfigs")) {
29
+ // If the signingConfigs block doesn't exist, insert it after buildTypes
30
+ updatedConfigString = file.replace("buildTypes {", `signingConfigs ${newSigningConfig.trim()}\n\nbuildTypes {`);
31
+ }
32
+
33
+ file = updatedConfigString
34
+ .replace("buildTypes {", `buildTypes {\n${huaweiBlock.trim()}\n`)
35
+ .replace("plugins {", "plugins {\n id 'com.huawei.agconnect'")
36
+ .replace("apply plugin: 'com.android.application'", "apply plugin: 'com.huawei.agconnect'\napply plugin: 'com.android.application'")
37
+ .replace(/(implementation 'com\.onesignal.*')/g, `debugImplementation 'com.onesignal:OneSignal:4.7.2'
38
+ releaseImplementation 'com.onesignal:OneSignal:4.7.2'
39
+
40
+ huaweiImplementation 'com.huawei.hms:push:6.3.0.304'
41
+
42
+ huaweiImplementation('com.onesignal:OneSignal:4.7.2') {
43
+ exclude group: 'com.google.android.gms'
44
+ exclude group: 'com.google.firebase'
45
+ }`)
46
+
47
+ return file
48
+ }
49
+
50
+ export let mofidyGradleBuildFile = async (file: string) => {
51
+ return file
52
+ .replace(/repositories {/g, "repositories {\nmaven {url 'https://developer.huawei.com/repo/'")
53
+ .replace(/dependencies {/g, "dependencies {\nclasspath 'com.huawei.agconnect:agcp:1.9.0.300'")
54
+ }
55
+
@@ -85,15 +85,15 @@ export let addGeosToAllRedirectCampaigns = async (geosToAdd: string) => {
85
85
  console.log({
86
86
  name: stream.name,
87
87
  })
88
- let geos = stream?.filters[0]?.payload
88
+ let geos = stream?.filters[stream.type == "forced" ? 1 : 0]?.payload
89
89
  if (!geos) continue
90
90
  geosToAdd.split(" ").forEach((geo: string) => {
91
91
  let streamForGeo = streams.find((s) => s.name == geo)
92
- if (streamForGeo && stream && stream.type != "forced") return
92
+ if (streamForGeo && stream) return
93
93
  if (!geos.includes(geo)) geos.push(geo)
94
94
  });
95
95
 
96
- stream.filters[0].payload = geos
96
+ stream.filters[stream.type == "forced" ? 1 : 0].payload = geos
97
97
 
98
98
  await KeitaroService.upsertStreamToCampaign(campaign, stream)
99
99
  await sleep(2000)
@@ -388,6 +388,20 @@ let changeSourceForFA = async () => {
388
388
  }
389
389
  }
390
390
 
391
+ let replaceDomainInOffers = async (oldDomain: string, newDomain: string, offerNameRegEx: RegExp)=> {
392
+ let offers = await KeitaroService.getAllOffers()
393
+
394
+ offers = offers.filter((o) => offerNameRegEx.exec(o.name))
395
+
396
+ for (let offer of offers) {
397
+ console.log(offer)
398
+ // offer.action_payload = offer.action_payload.replace(oldDomain, newDomain)
399
+
400
+ // await sleep(700)
401
+ // await KeitaroService.updateOffer(offer)
402
+ }
403
+ }
404
+
391
405
  let gatherInfoForFlashApps = async () => {
392
406
  console.log(__dirname)
393
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'));
@@ -495,7 +509,9 @@ let gatherInfoForFlashApps = async () => {
495
509
 
496
510
  // createFlashCampaigns(sampleApp)
497
511
  // changeSourceForFA()
498
- // addGeosToAllRedirectCampaigns("BE")
512
+ // addGeosToAllRedirectCam`paigns("GR")
499
513
  // removeGeosFromAllRedirectCampaigns("BE`")
500
514
 
501
- // gatherInfoForFlashApps()
515
+ // gatherInfoForFlashApps()
516
+
517
+ replaceDomainInOffers(`mariorel.com`, `xmariorel.com`, /Icecasino Huffson.*/g)