@bprotsyk/aso-core 2.1.21 → 2.1.23

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