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