@bprotsyk/aso-core 2.1.24 → 2.1.32

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.
Files changed (248) hide show
  1. package/README.md +1 -1
  2. package/lib/app/app-integration.d.ts +53 -53
  3. package/lib/app/app-integration.js +63 -63
  4. package/lib/app/app-list-item.d.ts +5 -5
  5. package/lib/app/app-list-item.js +2 -2
  6. package/lib/app/app-type.d.ts +4 -4
  7. package/lib/app/app-type.js +8 -8
  8. package/lib/app/app.d.ts +207 -213
  9. package/lib/app/app.js +161 -184
  10. package/lib/general/cloudflare-domain.d.ts +42 -42
  11. package/lib/general/cloudflare-domain.js +12 -12
  12. package/lib/general/domain.d.ts +108 -108
  13. package/lib/general/domain.js +61 -61
  14. package/lib/general/namecheap-domain.d.ts +85 -85
  15. package/lib/general/namecheap-domain.js +14 -14
  16. package/lib/general/push.d.ts +6 -6
  17. package/lib/general/push.js +2 -2
  18. package/lib/general/queue.d.ts +2 -2
  19. package/lib/general/queue.js +1 -1
  20. package/lib/general/shape.d.ts +18 -18
  21. package/lib/general/shape.js +36 -36
  22. package/lib/index.d.ts +26 -26
  23. package/lib/index.js +69 -69
  24. package/lib/keitaro/keitaro-campaign.d.ts +31 -31
  25. package/lib/keitaro/keitaro-campaign.js +5 -5
  26. package/lib/keitaro/keitaro-domain.d.ts +6 -6
  27. package/lib/keitaro/keitaro-domain.js +2 -2
  28. package/lib/keitaro/keitaro-offer.d.ts +7 -7
  29. package/lib/keitaro/keitaro-offer.js +2 -2
  30. package/lib/keitaro/keitaro-stream.d.ts +20 -20
  31. package/lib/keitaro/keitaro-stream.js +2 -2
  32. package/lib/network/keitaro/http.d.ts +2 -2
  33. package/lib/network/keitaro/http.js +12 -12
  34. package/lib/network/keitaro/keitaro-service.d.ts +48 -50
  35. package/lib/network/keitaro/keitaro-service.js +263 -261
  36. package/lib/offers/list.d.ts +37 -37
  37. package/lib/offers/list.js +12 -12
  38. package/lib/offers/offer.d.ts +91 -91
  39. package/lib/offers/offer.js +42 -42
  40. package/lib/offers/offerwall/offerwall-home-dialog-data.d.ts +6 -6
  41. package/lib/offers/offerwall/offerwall-home-dialog-data.js +2 -2
  42. package/lib/offers/offerwall/offerwall-offer.d.ts +12 -12
  43. package/lib/offers/offerwall/offerwall-offer.js +2 -2
  44. package/lib/offers/offerwall/offerwall-response.d.ts +6 -6
  45. package/lib/offers/offerwall/offerwall-response.js +2 -2
  46. package/lib/offers/offerwall/offerwall-section.d.ts +6 -6
  47. package/lib/offers/offerwall/offerwall-section.js +2 -2
  48. package/lib/offers/section.d.ts +47 -47
  49. package/lib/offers/section.js +20 -20
  50. package/lib/panel/app/upsert-flash-app-request.d.ts +31 -0
  51. package/lib/panel/app/upsert-flash-app-request.js +2 -0
  52. package/lib/panel/auth.d.ts +9 -9
  53. package/lib/panel/auth.js +2 -2
  54. package/lib/panel/flash/upsert-flash-app-request.d.ts +31 -31
  55. package/lib/panel/flash/upsert-flash-app-request.js +2 -2
  56. package/lib/panel/user.d.ts +46 -46
  57. package/lib/panel/user.js +28 -28
  58. package/lib/templates/nginx-template.conf +35 -35
  59. package/lib/templates/nginx-template.d.ts +1 -1
  60. package/lib/templates/nginx-template.js +39 -39
  61. package/lib/templates/nginx-template.ts +35 -35
  62. package/lib/utils/general.d.ts +11 -11
  63. package/lib/utils/general.js +40 -40
  64. package/lib/utils/huawei/converter.d.ts +2 -2
  65. package/lib/utils/huawei/converter.js +53 -53
  66. package/lib/utils/keitaro-utils.d.ts +13 -15
  67. package/lib/utils/keitaro-utils.js +569 -569
  68. package/lib/utils/server-util.js +303 -303
  69. package/package.json +51 -51
  70. package/src/app/app-integration.ts +66 -66
  71. package/src/app/app-list-item.ts +4 -4
  72. package/src/app/app-type.ts +3 -3
  73. package/src/app/app.ts +322 -346
  74. package/src/general/cloudflare-domain.ts +44 -44
  75. package/src/general/domain.ts +105 -105
  76. package/src/general/namecheap-domain.ts +63 -63
  77. package/src/general/push.ts +5 -5
  78. package/src/general/queue.ts +4 -4
  79. package/src/general/shape.tsx +55 -55
  80. package/src/index.ts +32 -32
  81. package/src/keitaro/keitaro-campaign.ts +35 -35
  82. package/src/keitaro/keitaro-domain.ts +5 -5
  83. package/src/keitaro/keitaro-offer.ts +6 -6
  84. package/src/keitaro/keitaro-stream.ts +19 -19
  85. package/src/network/keitaro/http.ts +8 -8
  86. package/src/network/keitaro/keitaro-service.ts +325 -323
  87. package/src/offers/list.ts +19 -19
  88. package/src/offers/offer.ts +80 -80
  89. package/src/offers/offerwall/offerwall-home-dialog-data.ts +6 -6
  90. package/src/offers/offerwall/offerwall-offer.ts +12 -12
  91. package/src/offers/offerwall/offerwall-response.ts +7 -7
  92. package/src/offers/offerwall/offerwall-section.ts +7 -7
  93. package/src/offers/section.ts +29 -29
  94. package/src/panel/{flash → app}/upsert-flash-app-request.ts +39 -39
  95. package/src/panel/auth.ts +9 -9
  96. package/src/panel/user.ts +38 -38
  97. package/src/templates/nginx-template.ts +35 -35
  98. package/src/utils/data.csv +65 -65
  99. package/src/utils/general.ts +36 -36
  100. package/src/utils/huawei/converter.ts +55 -55
  101. package/src/utils/keitaro-utils.ts +664 -662
  102. package/src/utils/map-apps.json +4747 -4747
  103. package/src/utils/server-util.ts +368 -368
  104. package/src/utils/update-postbacks.js +27 -27
  105. package/tsconfig.json +20 -20
  106. package/docs/.nojekyll +0 -1
  107. package/docs/DOCS.zip +0 -0
  108. package/docs/assets/highlight.css +0 -22
  109. package/docs/assets/main.js +0 -58
  110. package/docs/assets/search.js +0 -1
  111. package/docs/assets/style.css +0 -1279
  112. package/docs/enums/PanelUserAccessScope.html +0 -127
  113. package/docs/functions/ASO_v0.toDefault.html +0 -81
  114. package/docs/functions/ASO_v1.toDefault.html +0 -81
  115. package/docs/functions/ASO_v2.toDefault.html +0 -79
  116. package/docs/functions/ASO_v3.toDefault.html +0 -78
  117. package/docs/functions/ASO_v4.toDefault.html +0 -76
  118. package/docs/functions/ASO_v5.toDefault.html +0 -77
  119. package/docs/functions/ColoredText.html +0 -93
  120. package/docs/functions/ShapeDiv.html +0 -110
  121. package/docs/index.html +0 -83
  122. package/docs/interfaces/ASOConfigFetch.IUsageLogEntry.html +0 -1414
  123. package/docs/interfaces/ASOConfigFetch.IUsageLogRequest.html +0 -104
  124. package/docs/interfaces/ASOConfigFetch.IUsageLogResponse.html +0 -109
  125. package/docs/interfaces/ASO_v0.IAuthorizationActionMapping.html +0 -146
  126. package/docs/interfaces/ASO_v0.IColoredSpan.html +0 -90
  127. package/docs/interfaces/ASO_v0.IColoredSpanMapping.html +0 -90
  128. package/docs/interfaces/ASO_v0.IColoredString.html +0 -90
  129. package/docs/interfaces/ASO_v0.IColoredStringMapping.html +0 -90
  130. package/docs/interfaces/ASO_v0.IConfig.html +0 -557
  131. package/docs/interfaces/ASO_v0.IConfigMapping.html +0 -230
  132. package/docs/interfaces/ASO_v0.ILocalization.html +0 -517
  133. package/docs/interfaces/ASO_v0.ILocalizationMap.html +0 -78
  134. package/docs/interfaces/ASO_v0.ILocalizationMapping.html +0 -503
  135. package/docs/interfaces/ASO_v0.IOfferResult.html +0 -104
  136. package/docs/interfaces/ASO_v0.IOfferResultEmoji.html +0 -83
  137. package/docs/interfaces/ASO_v0.IOfferResultMapping.html +0 -118
  138. package/docs/interfaces/ASO_v0.IOfferSectionMapping.html +0 -109
  139. package/docs/interfaces/ASO_v0.IOffersSection.html +0 -97
  140. package/docs/interfaces/ASO_v0.ISectionPalette.html +0 -153
  141. package/docs/interfaces/ASO_v0.ISectionPaletteMapping.html +0 -153
  142. package/docs/interfaces/ASO_v1.IAuthorizationActionMapping.html +0 -146
  143. package/docs/interfaces/ASO_v1.IColoredSpan.html +0 -90
  144. package/docs/interfaces/ASO_v1.IColoredSpanMapping.html +0 -90
  145. package/docs/interfaces/ASO_v1.IColoredString.html +0 -90
  146. package/docs/interfaces/ASO_v1.IColoredStringMapping.html +0 -90
  147. package/docs/interfaces/ASO_v1.IConfig.html +0 -550
  148. package/docs/interfaces/ASO_v1.IConfigMapping.html +0 -230
  149. package/docs/interfaces/ASO_v1.ILocalization.html +0 -482
  150. package/docs/interfaces/ASO_v1.ILocalizationMap.html +0 -78
  151. package/docs/interfaces/ASO_v1.ILocalizationMapping.html +0 -482
  152. package/docs/interfaces/ASO_v1.IOfferResult.html +0 -104
  153. package/docs/interfaces/ASO_v1.IOfferResultEmoji.html +0 -83
  154. package/docs/interfaces/ASO_v1.IOfferResultMapping.html +0 -118
  155. package/docs/interfaces/ASO_v1.IOfferSectionMapping.html +0 -109
  156. package/docs/interfaces/ASO_v1.IOffersSection.html +0 -102
  157. package/docs/interfaces/ASO_v1.ISectionPalette.html +0 -153
  158. package/docs/interfaces/ASO_v1.ISectionPaletteMapping.html +0 -153
  159. package/docs/interfaces/ASO_v2.IAuthorizationActionMapping.html +0 -139
  160. package/docs/interfaces/ASO_v2.IColoredSpanMapping.html +0 -90
  161. package/docs/interfaces/ASO_v2.IColoredString.html +0 -90
  162. package/docs/interfaces/ASO_v2.IColoredStringMapping.html +0 -90
  163. package/docs/interfaces/ASO_v2.IConfig.html +0 -494
  164. package/docs/interfaces/ASO_v2.IConfigMapping.html +0 -202
  165. package/docs/interfaces/ASO_v2.ILocalization.html +0 -475
  166. package/docs/interfaces/ASO_v2.ILocalizationMap.html +0 -76
  167. package/docs/interfaces/ASO_v2.ILocalizationMapping.html +0 -363
  168. package/docs/interfaces/ASO_v2.IOfferResult.html +0 -111
  169. package/docs/interfaces/ASO_v2.IOfferResultMapping.html +0 -118
  170. package/docs/interfaces/ASO_v2.IOfferSectionMapping.html +0 -109
  171. package/docs/interfaces/ASO_v2.IOffersSection.html +0 -102
  172. package/docs/interfaces/ASO_v2.ISectionPalette.html +0 -153
  173. package/docs/interfaces/ASO_v2.ISectionPaletteMapping.html +0 -153
  174. package/docs/interfaces/ASO_v3.IAuthorizationActionMapping.html +0 -139
  175. package/docs/interfaces/ASO_v3.IColoredSpanMapping.html +0 -90
  176. package/docs/interfaces/ASO_v3.IColoredString.html +0 -90
  177. package/docs/interfaces/ASO_v3.IColoredStringMapping.html +0 -90
  178. package/docs/interfaces/ASO_v3.IConfig.html +0 -515
  179. package/docs/interfaces/ASO_v3.IConfigMapping.html +0 -209
  180. package/docs/interfaces/ASO_v3.ILocalization.html +0 -447
  181. package/docs/interfaces/ASO_v3.ILocalizationMap.html +0 -75
  182. package/docs/interfaces/ASO_v3.ILocalizationMapping.html +0 -342
  183. package/docs/interfaces/ASO_v3.IOfferResultMapping.html +0 -118
  184. package/docs/interfaces/ASO_v3.IOfferSectionMapping.html +0 -109
  185. package/docs/interfaces/ASO_v3.IOffersSection.html +0 -102
  186. package/docs/interfaces/ASO_v3.ISectionPalette.html +0 -153
  187. package/docs/interfaces/ASO_v3.ISectionPaletteMapping.html +0 -153
  188. package/docs/interfaces/ASO_v4.IAuthorizationActionMapping.html +0 -139
  189. package/docs/interfaces/ASO_v4.IColoredSpanMapping.html +0 -90
  190. package/docs/interfaces/ASO_v4.IColoredString.html +0 -90
  191. package/docs/interfaces/ASO_v4.IColoredStringMapping.html +0 -90
  192. package/docs/interfaces/ASO_v4.IConfig.html +0 -515
  193. package/docs/interfaces/ASO_v4.IConfigMapping.html +0 -132
  194. package/docs/interfaces/ASO_v4.ILocalization.html +0 -370
  195. package/docs/interfaces/ASO_v4.ILocalizationMap.html +0 -73
  196. package/docs/interfaces/ASO_v4.ILocalizationMapping.html +0 -258
  197. package/docs/interfaces/ASO_v4.IOfferResultMapping.html +0 -118
  198. package/docs/interfaces/ASO_v4.IOfferSectionMapping.html +0 -90
  199. package/docs/interfaces/ASO_v4.LocalizedString.html +0 -83
  200. package/docs/interfaces/ASO_v5.IAuthorizationActionMapping.html +0 -139
  201. package/docs/interfaces/ASO_v5.IColoredSpan.html +0 -90
  202. package/docs/interfaces/ASO_v5.IColoredSpanMapping.html +0 -90
  203. package/docs/interfaces/ASO_v5.IColoredString.html +0 -90
  204. package/docs/interfaces/ASO_v5.IColoredStringMapping.html +0 -90
  205. package/docs/interfaces/ASO_v5.IConfig.html +0 -543
  206. package/docs/interfaces/ASO_v5.IConfigMapping.html +0 -160
  207. package/docs/interfaces/ASO_v5.ILocalization.html +0 -412
  208. package/docs/interfaces/ASO_v5.ILocalizationMap.html +0 -74
  209. package/docs/interfaces/ASO_v5.ILocalizationMapping.html +0 -300
  210. package/docs/interfaces/ASO_v5.IOfferResultMapping.html +0 -118
  211. package/docs/interfaces/ASO_v5.IOfferSectionMapping.html +0 -90
  212. package/docs/interfaces/ASO_v5.LocalizedString.html +0 -83
  213. package/docs/interfaces/IAsoConfigResponse.html +0 -82
  214. package/docs/interfaces/IAsoCustomizedOffer.html +0 -117
  215. package/docs/interfaces/IAsoDefaultConfig.html +0 -444
  216. package/docs/interfaces/IAsoOfferResponse.html +0 -82
  217. package/docs/interfaces/IAsoSection.html +0 -89
  218. package/docs/interfaces/IAsoSingleOffer.html +0 -89
  219. package/docs/interfaces/IAuthToken.html +0 -103
  220. package/docs/interfaces/IColoredTextProps.html +0 -75
  221. package/docs/interfaces/IFlashApp.html +0 -145
  222. package/docs/interfaces/IFlashAppListItem.html +0 -89
  223. package/docs/interfaces/IGradient.html +0 -96
  224. package/docs/interfaces/IOffer.html +0 -138
  225. package/docs/interfaces/IOfferWallAuthConfig.html +0 -131
  226. package/docs/interfaces/IOfferWallAuthLocalization.html +0 -103
  227. package/docs/interfaces/IOfferWallAuthSubmitRequest.html +0 -75
  228. package/docs/interfaces/IOfferWallAuthSubmitResponse.html +0 -75
  229. package/docs/interfaces/IOfferWallHomeDialogData.html +0 -96
  230. package/docs/interfaces/IOfferWallOffer.html +0 -110
  231. package/docs/interfaces/IOfferWallResponse.html +0 -82
  232. package/docs/interfaces/IOfferWallSection.html +0 -89
  233. package/docs/interfaces/IPanelUser.html +0 -1406
  234. package/docs/interfaces/IPush.html +0 -96
  235. package/docs/interfaces/IShape.html +0 -103
  236. package/docs/interfaces/IStroke.html +0 -82
  237. package/docs/interfaces/IUpsertFlashAppRequest.html +0 -215
  238. package/docs/interfaces/IUpsertFlashAppResponse.html +0 -82
  239. package/docs/modules/ASOConfigFetch.html +0 -64
  240. package/docs/modules/ASO_v0.html +0 -97
  241. package/docs/modules/ASO_v1.html +0 -97
  242. package/docs/modules/ASO_v2.html +0 -93
  243. package/docs/modules/ASO_v3.html +0 -91
  244. package/docs/modules/ASO_v4.html +0 -87
  245. package/docs/modules/ASO_v5.html +0 -89
  246. package/docs/modules.html +0 -134
  247. package/docs/variables/FlashAppSchema.html +0 -84
  248. package/docs/variables/PanelUserSchema.html +0 -84
@@ -1,569 +1,569 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createOWCampaign = exports.createDirectCampaign = exports.createFlashCampaigns = exports.createOWStreamPartialPayload = exports.prepareOWCampaignParameters = exports.createOrFindFlashRedirectCampaign = exports.removeGeosFromAllRedirectCampaigns = exports.addGeosToAllRedirectCampaigns = exports.TRAFFIC_SOURCE_ID_FLASH_AI = void 0;
4
- const keitaro_service_1 = require("../network/keitaro/keitaro-service");
5
- const sleep = require('sleep-promise');
6
- const FLASH_REDIRECT_GROUP_ID = 82;
7
- exports.TRAFFIC_SOURCE_ID_FLASH_AI = 22;
8
- const UNIQUENESS_METHOD = "ip_ua";
9
- const MAX_COOKIES_TTL = 8760;
10
- const TYPE_POSITION = "position";
11
- const STATE_ACTIVE = "active";
12
- const COST_TYPE_CPC = "CPC";
13
- const COST_VALUE = 0;
14
- const COST_CURRENCY_USD = "USD";
15
- // clear campaigns from unused / wrong streams
16
- // let sampleApp: IFlashApp = {
17
- // id: 96,
18
- // bundle: "com.dynastyof.desert",
19
- // name: "Room of Fortuna",
20
- // plugId: "https://pastebin.com/raw/AR2u7dSD",
21
- // plugType: PlugType.PASTEBIN,
22
- // plugContent: "",
23
- // plugStatus: FlashAppPlugStatus.DISABLED,
24
- // plugAccountId: 1,
25
- // reservePlugId: "none",
26
- // reservePlugType: PlugType.OTHER,
27
- // reservePlugContent: "",
28
- // reservePlugStatus: FlashAppPlugStatus.DISABLED,
29
- // reservePlugAccountId: 1,
30
- // type: FlashAppType.GAMBLING,
31
- // developerEmail: "bolly.dreams@yahoo.com",
32
- // developerName: "Serhii Bolsky",
33
- // developerOrganization: "S.I.B FOP",
34
- // onesignalAppId: "e66658af-91c3-44bc-8123-ec64b1969cbd",
35
- // onesignalRestApiKey: "MDk2NjZlNTMtMzBhYi00MjEzLTg0ZGItOWVmZWZhMTczMzI0",
36
- // generationOptions: {
37
- // splashActivityClassName: "SplashActivity",
38
- // mainActivityClassName: "YourActivity",
39
- // linkName: "likn",
40
- // savedName: "isOk",
41
- // paranoidSeed: 228143750
42
- // },
43
- // geos: "RU,UA,KZ,ES,BR,PT,CL,MX",
44
- // keitaroData: {
45
- // redirectCampaignId: 0,
46
- // redirectCampaignName: "",
47
- // redirectDomainId: 0,
48
- // redirectDomainName: "",
49
- // trackingCampaignId: 0,
50
- // trackingCampaignName: "",
51
- // trackingDomainId: 0,
52
- // trackingDomainName: "",
53
- // clickIdParameterName: "p",
54
- // offerIdParameterName: "i",
55
- // }
56
- // } as IFlashApp
57
- let addGeosToAllRedirectCampaigns = async (geosToAdd) => {
58
- let allCampaigns = await keitaro_service_1.KeitaroService.getAllCampaigns();
59
- let regexp = new RegExp(`^F #`);
60
- const matchingCampaigns = allCampaigns.filter(campaign => regexp.exec(campaign.name));
61
- for (let campaign of matchingCampaigns) {
62
- console.log(campaign.name);
63
- console.log("––––––––––––––––––––––––");
64
- let streams = await keitaro_service_1.KeitaroService.getStreamsByCampaignId(campaign.id);
65
- let botStream = streams[0];
66
- botStream.name = "Bot Protection";
67
- let owStream = streams.find(s => s.name == "OW");
68
- for (let stream of [owStream, botStream]) {
69
- if (!stream)
70
- continue;
71
- console.log({
72
- name: stream.name,
73
- });
74
- let geos = stream?.filters[stream.type == "forced" ? 1 : 0]?.payload;
75
- if (!geos)
76
- continue;
77
- geosToAdd.split(" ").forEach((geo) => {
78
- let streamForGeo = streams.find((s) => s.name == geo);
79
- if (streamForGeo && stream)
80
- return;
81
- if (!geos.includes(geo))
82
- geos.push(geo);
83
- });
84
- stream.filters[stream.type == "forced" ? 1 : 0].payload = geos;
85
- await keitaro_service_1.KeitaroService.upsertStreamToCampaign(campaign, stream);
86
- await sleep(2000);
87
- }
88
- console.log("––––––––––––––––––––––––");
89
- }
90
- };
91
- exports.addGeosToAllRedirectCampaigns = addGeosToAllRedirectCampaigns;
92
- // export let changeTrackingOfferGeo = async (appId: number, keitaroId: string, geo: string) => {
93
- // let allCampaigns = await KeitaroService.getAllCampaigns()
94
- // let regexp = new RegExp(`^FA #${appId} `)
95
- // let matchingCampaign = allCampaigns.find(campaign => regexp.exec(campaign.name))
96
- // if (!matchingCampaign) throw new Error(`No matching campaign got appId ${appId}`)
97
- // let streams = await KeitaroService.getStreamsByCampaignId(matchingCampaign.id)
98
- // letstream =
99
- // for (let campaign of matchingCampaigns) {
100
- // console.log(campaign.name)
101
- // console.log("––––––––––––––––––––––––")
102
- // let streams = await KeitaroService.getStreamsByCampaignId(campaign.id)
103
- // let botStream = streams[0]
104
- // botStream.name = "Bot Protection"
105
- // let owStream = streams.find(s => s.name == "OW")
106
- // for (let stream of [owStream, botStream]) {
107
- // if (!stream) continue
108
- // console.log({
109
- // name: stream.name,
110
- // })
111
- // let geos = stream?.filters[stream.type == "forced" ? 1 : 0]?.payload
112
- // if (!geos) continue
113
- // geosToAdd.split(" ").forEach((geo: string) => {
114
- // let streamForGeo = streams.find((s) => s.name == geo)
115
- // if (streamForGeo && stream) return
116
- // if (!geos.includes(geo)) geos.push(geo)
117
- // });
118
- // stream.filters[stream.type == "forced" ? 1 : 0].payload = geos
119
- // await KeitaroService.upsertStreamToCampaign(campaign, stream)
120
- // await sleep(2000)
121
- // }
122
- // console.log("––––––––––––––––––––––––")
123
- // }
124
- // }
125
- let removeGeosFromAllRedirectCampaigns = async (geoToRemove) => {
126
- let allCampaigns = await keitaro_service_1.KeitaroService.getAllCampaigns();
127
- let regexp = new RegExp(`^F #`);
128
- const matchingCampaigns = allCampaigns.filter(campaign => regexp.exec(campaign.name));
129
- for (let campaign of matchingCampaigns) {
130
- console.log(campaign.name);
131
- console.log("––––––––––––––––––––––––");
132
- let streams = await keitaro_service_1.KeitaroService.getStreamsByCampaignId(campaign.id);
133
- let botStream = streams[0];
134
- botStream.name = "Bot Protection";
135
- let owStream = streams.find(s => s.name == "OW");
136
- for (let stream of [owStream, botStream]) {
137
- if (!stream)
138
- continue;
139
- let geos = stream?.filters[0]?.payload;
140
- if (!geos)
141
- continue;
142
- let index = geos.findIndex(geo => geo == geoToRemove);
143
- geos.splice(index, 1);
144
- let newGeos = stream.filters[0].payload = geos;
145
- console.log({
146
- name: stream.name,
147
- geos: geos,
148
- geosToRemove: geoToRemove,
149
- newGeos: newGeos
150
- });
151
- await keitaro_service_1.KeitaroService.upsertStreamToCampaign(campaign, stream);
152
- await sleep(1200);
153
- }
154
- console.log("––––––––––––––––––––––––");
155
- }
156
- };
157
- exports.removeGeosFromAllRedirectCampaigns = removeGeosFromAllRedirectCampaigns;
158
- let createOrFindFlashRedirectCampaign = async (app) => {
159
- if (app.keitaroData && app.keitaroData?.redirectCampaignId && app.keitaroData?.redirectCampaignId != 0) {
160
- console.log("Already exists! Fetching...");
161
- let campaign = await keitaro_service_1.KeitaroService.getCampaignById(app.keitaroData.redirectCampaignId);
162
- return campaign;
163
- }
164
- // Checking for already existing campaign
165
- let allCampaigns = await keitaro_service_1.KeitaroService.getAllCampaigns();
166
- let regexp = new RegExp(`^F #${app.id}`);
167
- const matchingCampaigns = allCampaigns.filter(campaign => regexp.exec(campaign.name));
168
- if (matchingCampaigns.length != 0) {
169
- let campaign = matchingCampaigns[0];
170
- if (app.keitaroData)
171
- app.keitaroData.redirectCampaignId = campaign.id;
172
- console.log("Already exists!");
173
- // await app.save()
174
- return campaign;
175
- }
176
- // Select domain for a campaign
177
- let allDomains = await keitaro_service_1.KeitaroService.getDomains(true);
178
- if (!allDomains) {
179
- throw Error(`Failed to get all domains list`);
180
- }
181
- const domain = allDomains[Math.floor(Math.random() * allDomains.length)];
182
- // Okay, now we have everything, let's create name for our campaign
183
- const name = `F #${app.id} (${app.bundle})`;
184
- // And generate alias
185
- const alias = Array.from({ length: 8 }, () => Math.floor(Math.random() * 36).toString(36)).join('');
186
- // Here go the parameters for our campaign
187
- let parameters = prepareRedirectCampaignParameters(app.id);
188
- // Now let create a campaign object
189
- let campaignData = prepareCampaignObject(name, alias, domain, parameters);
190
- // And POST it to Keitaro!
191
- let createdCampaign = await keitaro_service_1.KeitaroService.createCampaign(campaignData);
192
- console.log(`Done! Campaign data:`);
193
- console.log(createdCampaign);
194
- return createdCampaign;
195
- };
196
- exports.createOrFindFlashRedirectCampaign = createOrFindFlashRedirectCampaign;
197
- let prepareCampaignObject = (name, alias, domain, parameters) => {
198
- return {
199
- name: name,
200
- alias: alias,
201
- type: TYPE_POSITION,
202
- uniqueness_method: UNIQUENESS_METHOD,
203
- cookies_ttl: MAX_COOKIES_TTL,
204
- state: STATE_ACTIVE,
205
- cost_type: COST_TYPE_CPC,
206
- cost_value: COST_VALUE,
207
- cost_currency: COST_CURRENCY_USD,
208
- group_id: FLASH_REDIRECT_GROUP_ID,
209
- traffic_source_id: exports.TRAFFIC_SOURCE_ID_FLASH_AI,
210
- domain_id: domain.id,
211
- parameters: parameters,
212
- uniqueness_use_cookies: true,
213
- traffic_loss: 0
214
- };
215
- };
216
- let prepareRedirectCampaignParameters = (appId) => {
217
- return {
218
- "keyword": {
219
- "name": "keyword",
220
- "placeholder": "",
221
- "alias": ""
222
- },
223
- "cost": {
224
- "name": "cost",
225
- "placeholder": "",
226
- "alias": ""
227
- },
228
- "currency": {
229
- "name": "currency",
230
- "placeholder": "",
231
- "alias": ""
232
- },
233
- "external_id": {
234
- "name": "external_id",
235
- "placeholder": "",
236
- "alias": ""
237
- },
238
- "creative_id": {
239
- "name": "creative_id",
240
- "placeholder": "",
241
- "alias": ""
242
- },
243
- "ad_campaign_id": {
244
- "name": "ad_campaign_id",
245
- "placeholder": "",
246
- "alias": ""
247
- },
248
- "source": {
249
- "name": "source",
250
- "placeholder": "",
251
- "alias": ""
252
- },
253
- sub_id_1: {
254
- name: "appId",
255
- placeholder: `${appId}`,
256
- alias: ""
257
- }
258
- };
259
- };
260
- let prepareOWCampaignParameters = (app) => {
261
- return {
262
- "keyword": {
263
- "name": "keyword",
264
- "placeholder": "",
265
- "alias": ""
266
- },
267
- "cost": {
268
- "name": "cost",
269
- "placeholder": "",
270
- "alias": ""
271
- },
272
- "currency": {
273
- "name": "currency",
274
- "placeholder": "",
275
- "alias": ""
276
- },
277
- "external_id": {
278
- "name": "external_id",
279
- "placeholder": "",
280
- "alias": ""
281
- },
282
- "creative_id": {
283
- "name": "creative_id",
284
- "placeholder": "",
285
- "alias": ""
286
- },
287
- "ad_campaign_id": {
288
- "name": "ad_campaign_id",
289
- "placeholder": "",
290
- "alias": ""
291
- },
292
- "source": {
293
- "name": "source",
294
- "placeholder": "",
295
- "alias": ""
296
- },
297
- sub_id_8: {
298
- "name": app.keitaroData?.clickIdParameterName || "",
299
- "placeholder": "{click_id}",
300
- "alias": "click_id"
301
- },
302
- sub_id_15: {
303
- "name": app.keitaroData?.offerIdParameterName || "",
304
- "placeholder": "{offer_custom_id}",
305
- "alias": "offer_custom_id"
306
- }
307
- };
308
- };
309
- exports.prepareOWCampaignParameters = prepareOWCampaignParameters;
310
- function createBPStreamPartialPayload(app) {
311
- return {
312
- name: `Bot Protection`,
313
- type: "forced",
314
- action_type: "http",
315
- action_payload: "https://tomain.com",
316
- schema: "redirect",
317
- filter_or: true,
318
- collect_clicks: true,
319
- weight: 0,
320
- filters: [{
321
- name: "country",
322
- mode: "reject",
323
- payload: app.geos.split(" ")
324
- }, {
325
- name: "bot",
326
- mode: "accept",
327
- payload: null,
328
- }],
329
- };
330
- }
331
- function createDefenceMainStreamPartialPayload(app) {
332
- return {
333
- name: "ALL",
334
- type: "regular",
335
- action_type: "http",
336
- action_payload: app.directParams?.path,
337
- schema: "redirect",
338
- filter_or: false,
339
- collect_clicks: true,
340
- weight: 100,
341
- };
342
- }
343
- function createOWStreamPartialPayload(app) {
344
- return {
345
- name: `OW`,
346
- type: "regular",
347
- action_type: "http",
348
- action_payload: "https://bprtsk-controlpanel.com/ow?appId={appId}&clickId={uid}&countryCode={country}",
349
- schema: "redirect",
350
- filter_or: false,
351
- collect_clicks: true,
352
- weight: 100,
353
- filters: [{
354
- name: "country",
355
- mode: "accept",
356
- payload: app.geos.split(" ")
357
- }],
358
- };
359
- }
360
- exports.createOWStreamPartialPayload = createOWStreamPartialPayload;
361
- async function createFlashCampaigns(app) {
362
- // Upserting Flash Redirect campaign
363
- let redirectCampaign = await (0, exports.createOrFindFlashRedirectCampaign)(app);
364
- console.log(`Redirect campaign name:`);
365
- console.log(`${redirectCampaign.domain}/${redirectCampaign.alias}?uid=`);
366
- // Upserting necessary streams
367
- let botProtectionStream = createBPStreamPartialPayload(app);
368
- let owStream = createOWStreamPartialPayload(app);
369
- for (let stream of [botProtectionStream, owStream]) {
370
- await keitaro_service_1.KeitaroService.upsertStreamToCampaign(redirectCampaign, stream);
371
- }
372
- // Upserting OW campaign
373
- let owCampaign = await keitaro_service_1.KeitaroService.cloneOWCampaign(app);
374
- return {
375
- tracking: owCampaign,
376
- redirect: redirectCampaign
377
- };
378
- }
379
- exports.createFlashCampaigns = createFlashCampaigns;
380
- async function createDirectCampaign(app) {
381
- let campaign = await keitaro_service_1.KeitaroService.cloneDCampaign(app);
382
- let stream = createDefenceMainStreamPartialPayload(app);
383
- await keitaro_service_1.KeitaroService.upsertStreamToCampaign(campaign, stream);
384
- return campaign;
385
- }
386
- exports.createDirectCampaign = createDirectCampaign;
387
- async function createOWCampaign(app) {
388
- let owCampaign = await keitaro_service_1.KeitaroService.cloneOWCampaign(app);
389
- return owCampaign;
390
- }
391
- exports.createOWCampaign = createOWCampaign;
392
- // TODO separate files for offers, campaigns etc.
393
- let removeBrokenDomain = async () => {
394
- let regexp = new RegExp(`^#`);
395
- let campaigns = (await keitaro_service_1.KeitaroService.getAllCampaigns()).filter(campaign => regexp.exec(campaign.name) && campaign.domain == "https://slottibolt.com/");
396
- for (let campaign of campaigns) {
397
- console.log(campaign.name);
398
- }
399
- };
400
- let changeSourceForFA = async () => {
401
- let regexp = new RegExp(`^#`);
402
- let campaigns = (await keitaro_service_1.KeitaroService.getAllCampaigns()).filter(campaign => regexp.exec(campaign.name));
403
- for (let campaign of campaigns) {
404
- console.log(campaign.name);
405
- await keitaro_service_1.KeitaroService.updateCampaign(campaign.id, {
406
- traffic_source_id: 22
407
- });
408
- }
409
- };
410
- let replaceInOfferLink = async (old, replace, offerNameRegEx) => {
411
- let offers = await keitaro_service_1.KeitaroService.getAllOffers();
412
- offers = offers.filter((o) => offerNameRegEx.exec(o.name));
413
- for (let offer of offers) {
414
- console.log(offer.name);
415
- // offer.action_payload = offer.action_payload.replace(old, replace)
416
- await sleep(700);
417
- await keitaro_service_1.KeitaroService.updateOffer(offer);
418
- }
419
- };
420
- // let gatherInfoForFlashApps = async () => {
421
- // console.log(__dirname)
422
- // const pasteMap: PasteMap = JSON.parse(await readFile('/Users/bprtsk/Documents/Work/ASO/AI Control Panel /AI Panel Core/src/utils/map-paste.json', 'utf8'));
423
- // const trackingMap: TrackingMap = JSON.parse(await readFile('/Users/bprtsk/Documents/Work/ASO/AI Control Panel /AI Panel Core/src/utils/map-tracking.json', 'utf8'));
424
- // 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'));
425
- // let allCampaigns = await KeitaroService.getAllCampaigns()
426
- // 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 }), {});
427
- // 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 }), {});
428
- // let result = []
429
- // for (let [id, paste] of Object.entries(pasteMap)) {
430
- // console.log(`- #${id}`)
431
- // // let ow = owCampaigns[id as keyof object] as IKeitaroCampaign | undefined
432
- // // let redirect = redirectCampaigns[id as keyof object] as IKeitaroCampaign | undefined
433
- // // let tracking = trackingMap[id as keyof object]
434
- // let app = flashApps[id as keyof object]
435
- // if (!app) {
436
- // console.log(`! No app for ${id}`)
437
- // continue
438
- // }
439
- // // if (paste.status == FlashAppPlugStatus.ENABLED) {
440
- // // if (!ow) console.log(`#${id}: no OW`)
441
- // // if (!redirect) console.log(`No redirect for #${id}`)
442
- // // else if (!paste.content.includes(redirect.domain)) console.log(`#${id}: Redirect domain (${redirect.domain}) differs from paste domain (${paste.content})`)
443
- // // else if (!paste.content.includes(redirect.alias)) console.log(`#${id}: Redirect campaign alias (${redirect.alias}) differs from paste id (${paste.content})`)
444
- // // }
445
- // // let appId
446
- // // for (let parameter of Object.values(redirect?.parameters || {})) {
447
- // // if (parameter.name == "appId") {
448
- // // appId = parameter.placeholder
449
- // // }
450
- // // }
451
- // // if (!appId && ow) console.log(`No app id for #${id}`)
452
- // // else if (appId != id && ow) console.log(`Wrong app id (${appId}) for #${id}`)
453
- // // let owDomain = ow?.domain?.split("/")[2]
454
- // // let owDomainId = ow?.domain_id
455
- // // let owCampaignId = ow?.id
456
- // // let owCampaignName = ow?.name
457
- // // let owCampaignAlias = ow?.alias
458
- // // let redirectDomain = redirect?.domain?.split("/")[2]
459
- // // let redirectDomainId = redirect?.domain_id
460
- // // let redirectCampaignId = redirect?.id
461
- // // let redirectCampaignName = redirect?.name
462
- // // let redirectCampaignAlias = redirect?.alias
463
- // // let clickIdParameterName = ow?.parameters?.sub_id_8?.name
464
- // // let offerIdParameterName = ow?.parameters?.sub_id_15?.name
465
- // // if (!clickIdParameterName && app && ow) console.log(`No click id parameter for #${id}`)
466
- // // if (!offerIdParameterName && app && ow) console.log(`No offer id parameter for #${id}`)
467
- // // let trackingLink = tracking?.trackingUrl
468
- // // app.plugStatus = paste.status
469
- // // app.plugContent = paste.content
470
- // // app.plugType = PlugType.PASTEBIN
471
- // // app.plugId = paste.paste_id
472
- // // app.reservePlugType = PlugType.PASTEBIN
473
- // // app.plugAccountId = parseInt(paste.accountId)
474
- // // app.keitaroData.redirectDomainName = redirectDomain || "none"
475
- // // app.keitaroData.redirectDomainId = redirectDomainId || 0
476
- // // app.keitaroData.redirectCampaignId = redirectCampaignId || 0
477
- // // app.keitaroData.redirectCampaignName = redirectCampaignName || "none"
478
- // // app.keitaroData.redirectCampaignAlias = redirectCampaignAlias || "none"
479
- // // app.keitaroData.trackingDomainId = owDomainId || 0
480
- // // app.keitaroData.trackingDomainName = owDomain || "none"
481
- // // app.keitaroData.trackingCampaignId = owCampaignId || 0
482
- // // app.keitaroData.trackingCampaignName = owCampaignName || "none"
483
- // // app.keitaroData.trackingCampaignAlias = owCampaignAlias || "none"
484
- // // if (clickIdParameterName) app.keitaroData.clickIdParameterName = clickIdParameterName
485
- // // if (offerIdParameterName) app.keitaroData.offerIdParameterName = offerIdParameterName
486
- // // if (trackingLink) app.trackingUrl = trackingLink
487
- // // if (!owCampaignName?.includes(app.bundle) && ow) {
488
- // // console.log(`OW: bundle differs (${app.bundle} in DB and ${owCampaignName})`)
489
- // // }
490
- // // if (!redirectCampaignName?.includes(app.bundle) && redirect) {
491
- // // console.log(`Redirect: bundle differs (${app.bundle} in DB and ${redirectCampaignName})`)
492
- // // }
493
- // result.push(app)
494
- // console.log("--------------------")
495
- // }
496
- // await axios.post(`https://aipanel-secondary.com/flash/batch-update`, result, {
497
- // headers: {
498
- // "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwiaWF0IjoxNjg3Mjc2NjA0LCJleHAiOjE2ODc4ODE0MDR9.XesrnNGmWlK-yBBMs5TeKvTe07A8Sud7B4MyfZAOMag"
499
- // }
500
- // })
501
- // // console.log(result)
502
- // }
503
- let findBrokenOfferStreams = async () => {
504
- let allCampaigns = await keitaro_service_1.KeitaroService.getAllCampaigns();
505
- let regexp = new RegExp(`^#`);
506
- const matchingCampaigns = allCampaigns.filter(campaign => regexp.exec(campaign.name));
507
- for (let campaign of matchingCampaigns) {
508
- console.log(campaign.name);
509
- console.log("––––––––––––––––––––––––");
510
- let streams = await keitaro_service_1.KeitaroService.getStreamsByCampaignId(campaign.id);
511
- for (let stream of streams) {
512
- if (stream.name == "Bot Protection")
513
- continue;
514
- let idPayload = stream.filters.find(f => f.name == "sub_id_15");
515
- if (!idPayload) {
516
- console.log(`${stream.name}: id payload is missing, payload: ${stream.filters}`);
517
- }
518
- }
519
- }
520
- };
521
- let moveCampaignsToAnotherGroup = async () => {
522
- const appIds = [
523
- 460, 457, 459, 456, 421, 711, 451, 709, 712, 428, 455, 388, 458,
524
- 355, 341, 342, 334, 431, 403, 436, 365, 393, 801, 702, 448, 444,
525
- 437, 439, 447, 378, 412, 380, 402, 852, 438
526
- ];
527
- let allCampaigns = await keitaro_service_1.KeitaroService.getAllCampaigns();
528
- let campaignIds = allCampaigns.filter(c => {
529
- for (let id of appIds)
530
- if (c.name.includes(`#${id}`))
531
- return true;
532
- return false;
533
- }).map(c => c.id);
534
- let from = 2, to = 80;
535
- await keitaro_service_1.KeitaroService.changeCampaignsGroup(from, to, campaignIds);
536
- };
537
- let renameCampaigns = async () => {
538
- let allCampaigns = await keitaro_service_1.KeitaroService.getAllCampaigns();
539
- let regexp = /^#(\d+)/;
540
- // Filter campaigns that match the regex
541
- const matchingCampaigns = allCampaigns.filter(campaign => regexp.test(campaign.name) && campaign.group_id == 80);
542
- console.log(`Matching campaigns found: ${matchingCampaigns.length}`);
543
- for (let campaign of matchingCampaigns) {
544
- const match = regexp.exec(campaign.name);
545
- if (match && match[1]) {
546
- const appId = match[1]; // Extracted number after '#'
547
- await keitaro_service_1.KeitaroService.updateCampaign(campaign.id, { name: `#${appId} [⛌]` });
548
- console.log(`Updated "${campaign.name}" to #${appId} [⛌]`);
549
- }
550
- }
551
- };
552
- // renameCampaigns()
553
- // moveCampaignsToAnotherGroup()
554
- // Getting campaign group ids
555
- // (async () => {
556
- // let campaigns = await KeitaroService.getAllCampaigns()
557
- // let normal = campaigns.find(c => c.id == 2684)
558
- // let archive = campaigns.find(c => c.id == 2679)
559
- // console.log([normal?.group_id, archive?.group_id])
560
- // })()
561
- // findBrokenOfferStreams()
562
- // removeBrokenDomain()
563
- // createFlashCampaigns(sampleApp)
564
- // changeSourceForFA()
565
- // addGeosToAllRedirectCam`paigns("GR")
566
- // removeGeosFromAllRedirectCampaigns("BE`")
567
- // gatherInfoForFlashApps()
568
- // replaceInOfferLink(`xmariorel.com`, `lalielynaualish.com`, /.*icecasino_huffson.*/g)
569
- // replaceInOfferLink(`lp=18`, `lp=00`, /.*icecasino_huffson.*/g)
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createOWCampaign = exports.createDirectCampaign = exports.createFlashCampaigns = exports.createOWStreamPartialPayload = exports.prepareOWCampaignParameters = exports.removeGeosFromAllRedirectCampaigns = exports.addGeosToAllRedirectCampaigns = exports.TRAFFIC_SOURCE_ID_FLASH_AI = void 0;
4
+ const keitaro_service_1 = require("../network/keitaro/keitaro-service");
5
+ const sleep = require('sleep-promise');
6
+ const FLASH_REDIRECT_GROUP_ID = 82;
7
+ exports.TRAFFIC_SOURCE_ID_FLASH_AI = 22;
8
+ const UNIQUENESS_METHOD = "ip_ua";
9
+ const MAX_COOKIES_TTL = 8760;
10
+ const TYPE_POSITION = "position";
11
+ const STATE_ACTIVE = "active";
12
+ const COST_TYPE_CPC = "CPC";
13
+ const COST_VALUE = 0;
14
+ const COST_CURRENCY_USD = "USD";
15
+ // clear campaigns from unused / wrong streams
16
+ // let sampleApp: IFlashApp = {
17
+ // id: 96,
18
+ // bundle: "com.dynastyof.desert",
19
+ // name: "Room of Fortuna",
20
+ // plugId: "https://pastebin.com/raw/AR2u7dSD",
21
+ // plugType: PlugType.PASTEBIN,
22
+ // plugContent: "",
23
+ // plugStatus: FlashAppPlugStatus.DISABLED,
24
+ // plugAccountId: 1,
25
+ // reservePlugId: "none",
26
+ // reservePlugType: PlugType.OTHER,
27
+ // reservePlugContent: "",
28
+ // reservePlugStatus: FlashAppPlugStatus.DISABLED,
29
+ // reservePlugAccountId: 1,
30
+ // type: FlashAppType.GAMBLING,
31
+ // developerEmail: "bolly.dreams@yahoo.com",
32
+ // developerName: "Serhii Bolsky",
33
+ // developerOrganization: "S.I.B FOP",
34
+ // onesignalAppId: "e66658af-91c3-44bc-8123-ec64b1969cbd",
35
+ // onesignalRestApiKey: "MDk2NjZlNTMtMzBhYi00MjEzLTg0ZGItOWVmZWZhMTczMzI0",
36
+ // generationOptions: {
37
+ // splashActivityClassName: "SplashActivity",
38
+ // mainActivityClassName: "YourActivity",
39
+ // linkName: "likn",
40
+ // savedName: "isOk",
41
+ // paranoidSeed: 228143750
42
+ // },
43
+ // geos: "RU,UA,KZ,ES,BR,PT,CL,MX",
44
+ // keitaroData: {
45
+ // redirectCampaignId: 0,
46
+ // redirectCampaignName: "",
47
+ // redirectDomainId: 0,
48
+ // redirectDomainName: "",
49
+ // trackingCampaignId: 0,
50
+ // trackingCampaignName: "",
51
+ // trackingDomainId: 0,
52
+ // trackingDomainName: "",
53
+ // clickIdParameterName: "p",
54
+ // offerIdParameterName: "i",
55
+ // }
56
+ // } as IFlashApp
57
+ let addGeosToAllRedirectCampaigns = async (geosToAdd) => {
58
+ let allCampaigns = await keitaro_service_1.KeitaroService.getAllCampaigns();
59
+ let regexp = new RegExp(`^F #`);
60
+ const matchingCampaigns = allCampaigns.filter(campaign => regexp.exec(campaign.name));
61
+ for (let campaign of matchingCampaigns) {
62
+ console.log(campaign.name);
63
+ console.log("––––––––––––––––––––––––");
64
+ let streams = await keitaro_service_1.KeitaroService.getStreamsByCampaignId(campaign.id);
65
+ let botStream = streams[0];
66
+ botStream.name = "Bot Protection";
67
+ let owStream = streams.find(s => s.name == "OW");
68
+ for (let stream of [owStream, botStream]) {
69
+ if (!stream)
70
+ continue;
71
+ console.log({
72
+ name: stream.name,
73
+ });
74
+ let geos = stream?.filters[stream.type == "forced" ? 1 : 0]?.payload;
75
+ if (!geos)
76
+ continue;
77
+ geosToAdd.split(" ").forEach((geo) => {
78
+ let streamForGeo = streams.find((s) => s.name == geo);
79
+ if (streamForGeo && stream)
80
+ return;
81
+ if (!geos.includes(geo))
82
+ geos.push(geo);
83
+ });
84
+ stream.filters[stream.type == "forced" ? 1 : 0].payload = geos;
85
+ await keitaro_service_1.KeitaroService.upsertStreamToCampaign(campaign, stream);
86
+ await sleep(2000);
87
+ }
88
+ console.log("––––––––––––––––––––––––");
89
+ }
90
+ };
91
+ exports.addGeosToAllRedirectCampaigns = addGeosToAllRedirectCampaigns;
92
+ // export let changeTrackingOfferGeo = async (appId: number, keitaroId: string, geo: string) => {
93
+ // let allCampaigns = await KeitaroService.getAllCampaigns()
94
+ // let regexp = new RegExp(`^FA #${appId} `)
95
+ // let matchingCampaign = allCampaigns.find(campaign => regexp.exec(campaign.name))
96
+ // if (!matchingCampaign) throw new Error(`No matching campaign got appId ${appId}`)
97
+ // let streams = await KeitaroService.getStreamsByCampaignId(matchingCampaign.id)
98
+ // letstream =
99
+ // for (let campaign of matchingCampaigns) {
100
+ // console.log(campaign.name)
101
+ // console.log("––––––––––––––––––––––––")
102
+ // let streams = await KeitaroService.getStreamsByCampaignId(campaign.id)
103
+ // let botStream = streams[0]
104
+ // botStream.name = "Bot Protection"
105
+ // let owStream = streams.find(s => s.name == "OW")
106
+ // for (let stream of [owStream, botStream]) {
107
+ // if (!stream) continue
108
+ // console.log({
109
+ // name: stream.name,
110
+ // })
111
+ // let geos = stream?.filters[stream.type == "forced" ? 1 : 0]?.payload
112
+ // if (!geos) continue
113
+ // geosToAdd.split(" ").forEach((geo: string) => {
114
+ // let streamForGeo = streams.find((s) => s.name == geo)
115
+ // if (streamForGeo && stream) return
116
+ // if (!geos.includes(geo)) geos.push(geo)
117
+ // });
118
+ // stream.filters[stream.type == "forced" ? 1 : 0].payload = geos
119
+ // await KeitaroService.upsertStreamToCampaign(campaign, stream)
120
+ // await sleep(2000)
121
+ // }
122
+ // console.log("––––––––––––––––––––––––")
123
+ // }
124
+ // }
125
+ let removeGeosFromAllRedirectCampaigns = async (geoToRemove) => {
126
+ let allCampaigns = await keitaro_service_1.KeitaroService.getAllCampaigns();
127
+ let regexp = new RegExp(`^F #`);
128
+ const matchingCampaigns = allCampaigns.filter(campaign => regexp.exec(campaign.name));
129
+ for (let campaign of matchingCampaigns) {
130
+ console.log(campaign.name);
131
+ console.log("––––––––––––––––––––––––");
132
+ let streams = await keitaro_service_1.KeitaroService.getStreamsByCampaignId(campaign.id);
133
+ let botStream = streams[0];
134
+ botStream.name = "Bot Protection";
135
+ let owStream = streams.find(s => s.name == "OW");
136
+ for (let stream of [owStream, botStream]) {
137
+ if (!stream)
138
+ continue;
139
+ let geos = stream?.filters[0]?.payload;
140
+ if (!geos)
141
+ continue;
142
+ let index = geos.findIndex(geo => geo == geoToRemove);
143
+ geos.splice(index, 1);
144
+ let newGeos = stream.filters[0].payload = geos;
145
+ console.log({
146
+ name: stream.name,
147
+ geos: geos,
148
+ geosToRemove: geoToRemove,
149
+ newGeos: newGeos
150
+ });
151
+ await keitaro_service_1.KeitaroService.upsertStreamToCampaign(campaign, stream);
152
+ await sleep(1200);
153
+ }
154
+ console.log("––––––––––––––––––––––––");
155
+ }
156
+ };
157
+ exports.removeGeosFromAllRedirectCampaigns = removeGeosFromAllRedirectCampaigns;
158
+ // export let createOrFindFlashRedirectCampaign = async (app: IApp): Promise<IKeitaroCampaign> => {
159
+ // if (app.keitaroData && app.keitaroData?.redirectCampaignId && app.keitaroData?.redirectCampaignId != 0) {
160
+ // console.log("Already exists! Fetching...")
161
+ // let campaign = await KeitaroService.getCampaignById(app.keitaroData.redirectCampaignId)
162
+ // return campaign
163
+ // }
164
+ // // Checking for already existing campaign
165
+ // let allCampaigns = await KeitaroService.getAllCampaigns()
166
+ // let regexp = new RegExp(`^F #${app.id}`)
167
+ // const matchingCampaigns = allCampaigns.filter(campaign => regexp.exec(campaign.name));
168
+ // if (matchingCampaigns.length != 0) {
169
+ // let campaign = matchingCampaigns[0]
170
+ // // if (app.keitaroData) app.keitaroData.redirectCampaignId = campaign.id
171
+ // console.log("Already exists!")
172
+ // // await app.save()
173
+ // return campaign
174
+ // }
175
+ // // Select domain for a campaign
176
+ // let allDomains = await KeitaroService.getDomains(true)
177
+ // if (!allDomains) {
178
+ // throw Error(`Failed to get all domains list`)
179
+ // }
180
+ // const domain = allDomains[Math.floor(Math.random() * allDomains.length)];
181
+ // // Okay, now we have everything, let's create name for our campaign
182
+ // const name = `F #${app.id} (${app.bundle})`
183
+ // // And generate alias
184
+ // const alias = Array.from({ length: 8 }, () => Math.floor(Math.random() * 36).toString(36)).join('');
185
+ // // Here go the parameters for our campaign
186
+ // let parameters = prepareRedirectCampaignParameters(app.id)
187
+ // // Now let create a campaign object
188
+ // let campaignData = prepareCampaignObject(name, alias, domain, parameters)
189
+ // // And POST it to Keitaro!
190
+ // let createdCampaign = await KeitaroService.createCampaign(campaignData)
191
+ // console.log(`Done! Campaign data:`)
192
+ // console.log(createdCampaign)
193
+ // return createdCampaign
194
+ // }
195
+ let prepareCampaignObject = (name, alias, domain, parameters) => {
196
+ return {
197
+ name: name,
198
+ alias: alias,
199
+ type: TYPE_POSITION,
200
+ uniqueness_method: UNIQUENESS_METHOD,
201
+ cookies_ttl: MAX_COOKIES_TTL,
202
+ state: STATE_ACTIVE,
203
+ cost_type: COST_TYPE_CPC,
204
+ cost_value: COST_VALUE,
205
+ cost_currency: COST_CURRENCY_USD,
206
+ group_id: FLASH_REDIRECT_GROUP_ID,
207
+ traffic_source_id: exports.TRAFFIC_SOURCE_ID_FLASH_AI,
208
+ domain_id: domain.id,
209
+ parameters: parameters,
210
+ uniqueness_use_cookies: true,
211
+ traffic_loss: 0
212
+ };
213
+ };
214
+ let prepareRedirectCampaignParameters = (appId) => {
215
+ return {
216
+ "keyword": {
217
+ "name": "keyword",
218
+ "placeholder": "",
219
+ "alias": ""
220
+ },
221
+ "cost": {
222
+ "name": "cost",
223
+ "placeholder": "",
224
+ "alias": ""
225
+ },
226
+ "currency": {
227
+ "name": "currency",
228
+ "placeholder": "",
229
+ "alias": ""
230
+ },
231
+ "external_id": {
232
+ "name": "external_id",
233
+ "placeholder": "",
234
+ "alias": ""
235
+ },
236
+ "creative_id": {
237
+ "name": "creative_id",
238
+ "placeholder": "",
239
+ "alias": ""
240
+ },
241
+ "ad_campaign_id": {
242
+ "name": "ad_campaign_id",
243
+ "placeholder": "",
244
+ "alias": ""
245
+ },
246
+ "source": {
247
+ "name": "source",
248
+ "placeholder": "",
249
+ "alias": ""
250
+ },
251
+ sub_id_1: {
252
+ name: "appId",
253
+ placeholder: `${appId}`,
254
+ alias: ""
255
+ }
256
+ };
257
+ };
258
+ let prepareOWCampaignParameters = (app) => {
259
+ return {
260
+ "keyword": {
261
+ "name": "keyword",
262
+ "placeholder": "",
263
+ "alias": ""
264
+ },
265
+ "cost": {
266
+ "name": "cost",
267
+ "placeholder": "",
268
+ "alias": ""
269
+ },
270
+ "currency": {
271
+ "name": "currency",
272
+ "placeholder": "",
273
+ "alias": ""
274
+ },
275
+ "external_id": {
276
+ "name": "external_id",
277
+ "placeholder": "",
278
+ "alias": ""
279
+ },
280
+ "creative_id": {
281
+ "name": "creative_id",
282
+ "placeholder": "",
283
+ "alias": ""
284
+ },
285
+ "ad_campaign_id": {
286
+ "name": "ad_campaign_id",
287
+ "placeholder": "",
288
+ "alias": ""
289
+ },
290
+ "source": {
291
+ "name": "source",
292
+ "placeholder": "",
293
+ "alias": ""
294
+ },
295
+ sub_id_8: {
296
+ "name": "click_id",
297
+ "placeholder": "{click_id}",
298
+ "alias": "click_id"
299
+ },
300
+ sub_id_15: {
301
+ "name": "offer_id",
302
+ "placeholder": "{offer_custom_id}",
303
+ "alias": "offer_custom_id"
304
+ }
305
+ };
306
+ };
307
+ exports.prepareOWCampaignParameters = prepareOWCampaignParameters;
308
+ function createBPStreamPartialPayload(app) {
309
+ return {
310
+ name: `Bot Protection`,
311
+ type: "forced",
312
+ action_type: "http",
313
+ action_payload: "https://tomain.com",
314
+ schema: "redirect",
315
+ filter_or: true,
316
+ collect_clicks: true,
317
+ weight: 0,
318
+ filters: [{
319
+ name: "country",
320
+ mode: "reject",
321
+ payload: app.geos.split(" ")
322
+ }, {
323
+ name: "bot",
324
+ mode: "accept",
325
+ payload: null,
326
+ }],
327
+ };
328
+ }
329
+ function createDefenceMainStreamPartialPayload(app) {
330
+ return {
331
+ name: "ALL",
332
+ type: "regular",
333
+ action_type: "http",
334
+ action_payload: app.directParams?.path,
335
+ schema: "redirect",
336
+ filter_or: false,
337
+ collect_clicks: true,
338
+ weight: 100,
339
+ };
340
+ }
341
+ function createOWStreamPartialPayload(app) {
342
+ return {
343
+ name: `OW`,
344
+ type: "regular",
345
+ action_type: "http",
346
+ action_payload: "https://bprtsk-controlpanel.com/ow?appId={appId}&clickId={uid}&countryCode={country}",
347
+ schema: "redirect",
348
+ filter_or: false,
349
+ collect_clicks: true,
350
+ weight: 100,
351
+ filters: [{
352
+ name: "country",
353
+ mode: "accept",
354
+ payload: app.geos.split(" ")
355
+ }],
356
+ };
357
+ }
358
+ exports.createOWStreamPartialPayload = createOWStreamPartialPayload;
359
+ async function createFlashCampaigns(app) {
360
+ // Upserting Flash Redirect campaign
361
+ // let redirectCampaign = await createOrFindFlashRedirectCampaign(app)
362
+ // console.log(`Redirect campaign name:`)
363
+ // console.log(`${redirectCampaign.domain}/${redirectCampaign.alias}?uid=`)
364
+ // Upserting necessary streams
365
+ // let botProtectionStream = createBPStreamPartialPayload(app)
366
+ // let owStream = createOWStreamPartialPayload(app)
367
+ // for (let stream of [botProtectionStream, owStream]) {
368
+ // await KeitaroService.upsertStreamToCampaign(redirectCampaign, stream)
369
+ // }
370
+ // Upserting OW campaign
371
+ let owCampaign = await keitaro_service_1.KeitaroService.cloneOWCampaign(app);
372
+ return {
373
+ tracking: owCampaign,
374
+ // redirect: redirectCampaign
375
+ };
376
+ }
377
+ exports.createFlashCampaigns = createFlashCampaigns;
378
+ async function createDirectCampaign(app) {
379
+ let campaign = await keitaro_service_1.KeitaroService.cloneDCampaign(app);
380
+ let stream = createDefenceMainStreamPartialPayload(app);
381
+ await keitaro_service_1.KeitaroService.upsertStreamToCampaign(campaign, stream);
382
+ return campaign;
383
+ }
384
+ exports.createDirectCampaign = createDirectCampaign;
385
+ async function createOWCampaign(app) {
386
+ let owCampaign = await keitaro_service_1.KeitaroService.cloneOWCampaign(app);
387
+ return owCampaign;
388
+ }
389
+ exports.createOWCampaign = createOWCampaign;
390
+ // TODO separate files for offers, campaigns etc.
391
+ let removeBrokenDomain = async () => {
392
+ let regexp = new RegExp(`^#`);
393
+ let campaigns = (await keitaro_service_1.KeitaroService.getAllCampaigns()).filter(campaign => regexp.exec(campaign.name) && campaign.domain == "https://slottibolt.com/");
394
+ for (let campaign of campaigns) {
395
+ console.log(campaign.name);
396
+ }
397
+ };
398
+ let changeSourceForFA = async () => {
399
+ let regexp = new RegExp(`^#`);
400
+ let campaigns = (await keitaro_service_1.KeitaroService.getAllCampaigns()).filter(campaign => regexp.exec(campaign.name));
401
+ for (let campaign of campaigns) {
402
+ console.log(campaign.name);
403
+ await keitaro_service_1.KeitaroService.updateCampaign(campaign.id, {
404
+ traffic_source_id: 22
405
+ });
406
+ }
407
+ };
408
+ let replaceInOfferLink = async (old, replace, offerNameRegEx) => {
409
+ let offers = await keitaro_service_1.KeitaroService.getAllOffers();
410
+ offers = offers.filter((o) => offerNameRegEx.exec(o.name));
411
+ for (let offer of offers) {
412
+ console.log(offer.name);
413
+ // offer.action_payload = offer.action_payload.replace(old, replace)
414
+ await sleep(700);
415
+ await keitaro_service_1.KeitaroService.updateOffer(offer);
416
+ }
417
+ };
418
+ // let gatherInfoForFlashApps = async () => {
419
+ // console.log(__dirname)
420
+ // const pasteMap: PasteMap = JSON.parse(await readFile('/Users/bprtsk/Documents/Work/ASO/AI Control Panel /AI Panel Core/src/utils/map-paste.json', 'utf8'));
421
+ // const trackingMap: TrackingMap = JSON.parse(await readFile('/Users/bprtsk/Documents/Work/ASO/AI Control Panel /AI Panel Core/src/utils/map-tracking.json', 'utf8'));
422
+ // 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'));
423
+ // let allCampaigns = await KeitaroService.getAllCampaigns()
424
+ // 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 }), {});
425
+ // 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 }), {});
426
+ // let result = []
427
+ // for (let [id, paste] of Object.entries(pasteMap)) {
428
+ // console.log(`- #${id}`)
429
+ // // let ow = owCampaigns[id as keyof object] as IKeitaroCampaign | undefined
430
+ // // let redirect = redirectCampaigns[id as keyof object] as IKeitaroCampaign | undefined
431
+ // // let tracking = trackingMap[id as keyof object]
432
+ // let app = flashApps[id as keyof object]
433
+ // if (!app) {
434
+ // console.log(`! No app for ${id}`)
435
+ // continue
436
+ // }
437
+ // // if (paste.status == FlashAppPlugStatus.ENABLED) {
438
+ // // if (!ow) console.log(`#${id}: no OW`)
439
+ // // if (!redirect) console.log(`No redirect for #${id}`)
440
+ // // else if (!paste.content.includes(redirect.domain)) console.log(`#${id}: Redirect domain (${redirect.domain}) differs from paste domain (${paste.content})`)
441
+ // // else if (!paste.content.includes(redirect.alias)) console.log(`#${id}: Redirect campaign alias (${redirect.alias}) differs from paste id (${paste.content})`)
442
+ // // }
443
+ // // let appId
444
+ // // for (let parameter of Object.values(redirect?.parameters || {})) {
445
+ // // if (parameter.name == "appId") {
446
+ // // appId = parameter.placeholder
447
+ // // }
448
+ // // }
449
+ // // if (!appId && ow) console.log(`No app id for #${id}`)
450
+ // // else if (appId != id && ow) console.log(`Wrong app id (${appId}) for #${id}`)
451
+ // // let owDomain = ow?.domain?.split("/")[2]
452
+ // // let owDomainId = ow?.domain_id
453
+ // // let owCampaignId = ow?.id
454
+ // // let owCampaignName = ow?.name
455
+ // // let owCampaignAlias = ow?.alias
456
+ // // let redirectDomain = redirect?.domain?.split("/")[2]
457
+ // // let redirectDomainId = redirect?.domain_id
458
+ // // let redirectCampaignId = redirect?.id
459
+ // // let redirectCampaignName = redirect?.name
460
+ // // let redirectCampaignAlias = redirect?.alias
461
+ // // let clickIdParameterName = ow?.parameters?.sub_id_8?.name
462
+ // // let offerIdParameterName = ow?.parameters?.sub_id_15?.name
463
+ // // if (!clickIdParameterName && app && ow) console.log(`No click id parameter for #${id}`)
464
+ // // if (!offerIdParameterName && app && ow) console.log(`No offer id parameter for #${id}`)
465
+ // // let trackingLink = tracking?.trackingUrl
466
+ // // app.plugStatus = paste.status
467
+ // // app.plugContent = paste.content
468
+ // // app.plugType = PlugType.PASTEBIN
469
+ // // app.plugId = paste.paste_id
470
+ // // app.reservePlugType = PlugType.PASTEBIN
471
+ // // app.plugAccountId = parseInt(paste.accountId)
472
+ // // app.keitaroData.redirectDomainName = redirectDomain || "none"
473
+ // // app.keitaroData.redirectDomainId = redirectDomainId || 0
474
+ // // app.keitaroData.redirectCampaignId = redirectCampaignId || 0
475
+ // // app.keitaroData.redirectCampaignName = redirectCampaignName || "none"
476
+ // // app.keitaroData.redirectCampaignAlias = redirectCampaignAlias || "none"
477
+ // // app.keitaroData.trackingDomainId = owDomainId || 0
478
+ // // app.keitaroData.trackingDomainName = owDomain || "none"
479
+ // // app.keitaroData.trackingCampaignId = owCampaignId || 0
480
+ // // app.keitaroData.trackingCampaignName = owCampaignName || "none"
481
+ // // app.keitaroData.trackingCampaignAlias = owCampaignAlias || "none"
482
+ // // if (clickIdParameterName) app.keitaroData.clickIdParameterName = clickIdParameterName
483
+ // // if (offerIdParameterName) app.keitaroData.offerIdParameterName = offerIdParameterName
484
+ // // if (trackingLink) app.trackingUrl = trackingLink
485
+ // // if (!owCampaignName?.includes(app.bundle) && ow) {
486
+ // // console.log(`OW: bundle differs (${app.bundle} in DB and ${owCampaignName})`)
487
+ // // }
488
+ // // if (!redirectCampaignName?.includes(app.bundle) && redirect) {
489
+ // // console.log(`Redirect: bundle differs (${app.bundle} in DB and ${redirectCampaignName})`)
490
+ // // }
491
+ // result.push(app)
492
+ // console.log("--------------------")
493
+ // }
494
+ // await axios.post(`https://aipanel-secondary.com/flash/batch-update`, result, {
495
+ // headers: {
496
+ // "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwiaWF0IjoxNjg3Mjc2NjA0LCJleHAiOjE2ODc4ODE0MDR9.XesrnNGmWlK-yBBMs5TeKvTe07A8Sud7B4MyfZAOMag"
497
+ // }
498
+ // })
499
+ // // console.log(result)
500
+ // }
501
+ let findBrokenOfferStreams = async () => {
502
+ let allCampaigns = await keitaro_service_1.KeitaroService.getAllCampaigns();
503
+ let regexp = new RegExp(`^#`);
504
+ const matchingCampaigns = allCampaigns.filter(campaign => regexp.exec(campaign.name));
505
+ for (let campaign of matchingCampaigns) {
506
+ console.log(campaign.name);
507
+ console.log("––––––––––––––––––––––––");
508
+ let streams = await keitaro_service_1.KeitaroService.getStreamsByCampaignId(campaign.id);
509
+ for (let stream of streams) {
510
+ if (stream.name == "Bot Protection")
511
+ continue;
512
+ let idPayload = stream.filters.find(f => f.name == "sub_id_15");
513
+ if (!idPayload) {
514
+ console.log(`${stream.name}: id payload is missing, payload: ${stream.filters}`);
515
+ }
516
+ }
517
+ }
518
+ };
519
+ let moveCampaignsToAnotherGroup = async () => {
520
+ const appIds = [
521
+ 460, 457, 459, 456, 421, 711, 451, 709, 712, 428, 455, 388, 458,
522
+ 355, 341, 342, 334, 431, 403, 436, 365, 393, 801, 702, 448, 444,
523
+ 437, 439, 447, 378, 412, 380, 402, 852, 438
524
+ ];
525
+ let allCampaigns = await keitaro_service_1.KeitaroService.getAllCampaigns();
526
+ let campaignIds = allCampaigns.filter(c => {
527
+ for (let id of appIds)
528
+ if (c.name.includes(`#${id}`))
529
+ return true;
530
+ return false;
531
+ }).map(c => c.id);
532
+ let from = 2, to = 80;
533
+ await keitaro_service_1.KeitaroService.changeCampaignsGroup(from, to, campaignIds);
534
+ };
535
+ let renameCampaigns = async () => {
536
+ let allCampaigns = await keitaro_service_1.KeitaroService.getAllCampaigns();
537
+ let regexp = /^#(\d+)/;
538
+ // Filter campaigns that match the regex
539
+ const matchingCampaigns = allCampaigns.filter(campaign => regexp.test(campaign.name) && campaign.group_id == 80);
540
+ console.log(`Matching campaigns found: ${matchingCampaigns.length}`);
541
+ for (let campaign of matchingCampaigns) {
542
+ const match = regexp.exec(campaign.name);
543
+ if (match && match[1]) {
544
+ const appId = match[1]; // Extracted number after '#'
545
+ await keitaro_service_1.KeitaroService.updateCampaign(campaign.id, { name: `#${appId} []` });
546
+ console.log(`Updated "${campaign.name}" to #${appId} []`);
547
+ }
548
+ }
549
+ };
550
+ // renameCampaigns()
551
+ // moveCampaignsToAnotherGroup()
552
+ // Getting campaign group ids
553
+ // (async () => {
554
+ // let campaigns = await KeitaroService.getAllCampaigns()
555
+ // let normal = campaigns.find(c => c.id == 2684)
556
+ // let archive = campaigns.find(c => c.id == 2679)
557
+ // console.log([normal?.group_id, archive?.group_id])
558
+ // })()
559
+ // findBrokenOfferStreams()
560
+ // removeBrokenDomain()
561
+ // createFlashCampaigns(sampleApp)
562
+ // changeSourceForFA()
563
+ // addGeosToAllRedirectCam`paigns("GR")
564
+ // removeGeosFromAllRedirectCampaigns("BE`")
565
+ // gatherInfoForFlashApps()
566
+ // replaceInOfferLink(`xmariorel.com`, `lalielynaualish.com`, /.*icecasino_huffson.*/g)
567
+ // replaceInOfferLink(`lp=18`, `lp=00`, /.*icecasino_huffson.*/g)
568
+ // let test = async () => console.log(await KeitaroService.getProfitForTodayAndYesterday())
569
+ // test()