@bprotsyk/aso-core 1.2.235 → 1.2.237

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