@bprotsyk/aso-core 2.1.35 → 2.1.37

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.
package/lib/app/app.d.ts CHANGED
@@ -166,7 +166,7 @@ export declare enum PlugType {
166
166
  GIST = "GIST",
167
167
  OTHER = "OTHER"
168
168
  }
169
- export declare const AppSchema: mongoose.Schema<any, mongoose.Model<any, any, any, any, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, {
169
+ export declare const AppSchema: mongoose.Schema<any, mongoose.Model<any, any, any, any, any, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, {
170
170
  id: number;
171
171
  type: string;
172
172
  geo: string[];
@@ -177,32 +177,114 @@ export declare const AppSchema: mongoose.Schema<any, mongoose.Model<any, any, an
177
177
  trackingUrl: string;
178
178
  integrationVersion: string;
179
179
  geos: string;
180
- name?: string | undefined;
181
- pushesEnabled?: boolean | undefined;
180
+ name?: string | null | undefined;
181
+ pushesEnabled?: boolean | null | undefined;
182
182
  removeDataParams?: any;
183
183
  privacyPolicyParams?: any;
184
184
  offersStubParams?: any;
185
185
  bannerParams?: any;
186
186
  directParams?: any;
187
187
  platforms?: any;
188
- onesignalAppId?: string | undefined;
189
- onesignalRestApiKey?: string | undefined;
190
- appmetricaApiKey?: string | undefined;
191
- appmetricaAppId?: number | undefined;
188
+ onesignalAppId?: string | null | undefined;
189
+ onesignalRestApiKey?: string | null | undefined;
190
+ appmetricaApiKey?: string | null | undefined;
191
+ appmetricaAppId?: number | null | undefined;
192
192
  externalParams?: {
193
- schema?: string | undefined;
194
- showButton?: boolean | undefined;
195
- autoRedirect?: boolean | undefined;
196
- } | undefined;
193
+ schema?: string | null | undefined;
194
+ showButton?: boolean | null | undefined;
195
+ autoRedirect?: boolean | null | undefined;
196
+ } | null | undefined;
197
197
  keitaroData?: {
198
198
  trackingCampaignId: number;
199
199
  trackingCampaignName: string;
200
200
  trackingCampaignAlias: string;
201
201
  trackingDomainId: number;
202
202
  trackingDomainName: string;
203
- } | undefined;
203
+ } | null | undefined;
204
204
  domainParams?: {
205
- name?: string | undefined;
206
- clouflareZone?: string | undefined;
207
- } | undefined;
205
+ name?: string | null | undefined;
206
+ clouflareZone?: string | null | undefined;
207
+ } | null | undefined;
208
+ }, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
209
+ id: number;
210
+ type: string;
211
+ geo: string[];
212
+ enabled: boolean;
213
+ proxied: boolean;
214
+ imageFormat: string;
215
+ bundle: string;
216
+ trackingUrl: string;
217
+ integrationVersion: string;
218
+ geos: string;
219
+ name?: string | null | undefined;
220
+ pushesEnabled?: boolean | null | undefined;
221
+ removeDataParams?: any;
222
+ privacyPolicyParams?: any;
223
+ offersStubParams?: any;
224
+ bannerParams?: any;
225
+ directParams?: any;
226
+ platforms?: any;
227
+ onesignalAppId?: string | null | undefined;
228
+ onesignalRestApiKey?: string | null | undefined;
229
+ appmetricaApiKey?: string | null | undefined;
230
+ appmetricaAppId?: number | null | undefined;
231
+ externalParams?: {
232
+ schema?: string | null | undefined;
233
+ showButton?: boolean | null | undefined;
234
+ autoRedirect?: boolean | null | undefined;
235
+ } | null | undefined;
236
+ keitaroData?: {
237
+ trackingCampaignId: number;
238
+ trackingCampaignName: string;
239
+ trackingCampaignAlias: string;
240
+ trackingDomainId: number;
241
+ trackingDomainName: string;
242
+ } | null | undefined;
243
+ domainParams?: {
244
+ name?: string | null | undefined;
245
+ clouflareZone?: string | null | undefined;
246
+ } | null | undefined;
247
+ }>> & mongoose.FlatRecord<{
248
+ id: number;
249
+ type: string;
250
+ geo: string[];
251
+ enabled: boolean;
252
+ proxied: boolean;
253
+ imageFormat: string;
254
+ bundle: string;
255
+ trackingUrl: string;
256
+ integrationVersion: string;
257
+ geos: string;
258
+ name?: string | null | undefined;
259
+ pushesEnabled?: boolean | null | undefined;
260
+ removeDataParams?: any;
261
+ privacyPolicyParams?: any;
262
+ offersStubParams?: any;
263
+ bannerParams?: any;
264
+ directParams?: any;
265
+ platforms?: any;
266
+ onesignalAppId?: string | null | undefined;
267
+ onesignalRestApiKey?: string | null | undefined;
268
+ appmetricaApiKey?: string | null | undefined;
269
+ appmetricaAppId?: number | null | undefined;
270
+ externalParams?: {
271
+ schema?: string | null | undefined;
272
+ showButton?: boolean | null | undefined;
273
+ autoRedirect?: boolean | null | undefined;
274
+ } | null | undefined;
275
+ keitaroData?: {
276
+ trackingCampaignId: number;
277
+ trackingCampaignName: string;
278
+ trackingCampaignAlias: string;
279
+ trackingDomainId: number;
280
+ trackingDomainName: string;
281
+ } | null | undefined;
282
+ domainParams?: {
283
+ name?: string | null | undefined;
284
+ clouflareZone?: string | null | undefined;
285
+ } | null | undefined;
286
+ }> & {
287
+ _id: mongoose.Types.ObjectId;
288
+ } & {
289
+ __v: number;
208
290
  }>;
@@ -22,6 +22,7 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
25
26
  import { ICloudflareDomainType } from "general/cloudflare-domain";
26
27
  import { Document, Model, Schema } from "mongoose";
27
28
  export interface IDomain extends Document {
@@ -51,6 +52,7 @@ export interface IDomain extends Document {
51
52
  title: string | String;
52
53
  note: string;
53
54
  proxied: boolean;
55
+ appid?: number;
54
56
  }
55
57
  export interface IDomainsBuyRequestResponse {
56
58
  requestId: string;
@@ -79,30 +81,89 @@ export declare enum DomainTarget {
79
81
  UNKNOWN = "unknown"
80
82
  }
81
83
  export declare let getDomainTargetByIp: (ip: string) => DomainTarget;
82
- export declare const DomainSchema: Schema<any, Model<any, any, any, any, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, {
84
+ export declare const DomainSchema: Schema<any, Model<any, any, any, any, any, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, {
83
85
  nameServers: string[];
84
86
  originalNameServers: string[];
85
87
  txtRecords: string[];
86
88
  assignedTo: number[];
87
- id?: string | undefined;
88
- name?: string | undefined;
89
- type?: string | undefined;
90
- caption?: string | undefined;
91
- title?: string | undefined;
92
- proxied?: boolean | undefined;
93
- namecheapId?: string | undefined;
94
- status?: string | undefined;
95
- isUpdating?: boolean | undefined;
96
- cloudflareStatus?: string | undefined;
97
- paused?: boolean | undefined;
98
- originalRegistrar?: string | undefined;
99
- originalDNSHost?: string | undefined;
100
- createdAt?: number | undefined;
101
- expiresAt?: number | undefined;
102
- ip?: string | undefined;
103
- subdomain?: string | undefined;
104
- mxRecord?: string | undefined;
105
- target?: string | undefined;
106
- archived?: boolean | undefined;
107
- note?: string | undefined;
89
+ id?: string | null | undefined;
90
+ name?: string | null | undefined;
91
+ type?: string | null | undefined;
92
+ caption?: string | null | undefined;
93
+ title?: string | null | undefined;
94
+ proxied?: boolean | null | undefined;
95
+ namecheapId?: string | null | undefined;
96
+ status?: string | null | undefined;
97
+ isUpdating?: boolean | null | undefined;
98
+ cloudflareStatus?: string | null | undefined;
99
+ paused?: boolean | null | undefined;
100
+ originalRegistrar?: string | null | undefined;
101
+ originalDNSHost?: string | null | undefined;
102
+ createdAt?: number | null | undefined;
103
+ expiresAt?: number | null | undefined;
104
+ ip?: string | null | undefined;
105
+ subdomain?: string | null | undefined;
106
+ mxRecord?: string | null | undefined;
107
+ target?: string | null | undefined;
108
+ archived?: boolean | null | undefined;
109
+ note?: string | null | undefined;
110
+ appid?: number | null | undefined;
111
+ }, Document<unknown, {}, import("mongoose").FlatRecord<{
112
+ nameServers: string[];
113
+ originalNameServers: string[];
114
+ txtRecords: string[];
115
+ assignedTo: number[];
116
+ id?: string | null | undefined;
117
+ name?: string | null | undefined;
118
+ type?: string | null | undefined;
119
+ caption?: string | null | undefined;
120
+ title?: string | null | undefined;
121
+ proxied?: boolean | null | undefined;
122
+ namecheapId?: string | null | undefined;
123
+ status?: string | null | undefined;
124
+ isUpdating?: boolean | null | undefined;
125
+ cloudflareStatus?: string | null | undefined;
126
+ paused?: boolean | null | undefined;
127
+ originalRegistrar?: string | null | undefined;
128
+ originalDNSHost?: string | null | undefined;
129
+ createdAt?: number | null | undefined;
130
+ expiresAt?: number | null | undefined;
131
+ ip?: string | null | undefined;
132
+ subdomain?: string | null | undefined;
133
+ mxRecord?: string | null | undefined;
134
+ target?: string | null | undefined;
135
+ archived?: boolean | null | undefined;
136
+ note?: string | null | undefined;
137
+ appid?: number | null | undefined;
138
+ }>> & import("mongoose").FlatRecord<{
139
+ nameServers: string[];
140
+ originalNameServers: string[];
141
+ txtRecords: string[];
142
+ assignedTo: number[];
143
+ id?: string | null | undefined;
144
+ name?: string | null | undefined;
145
+ type?: string | null | undefined;
146
+ caption?: string | null | undefined;
147
+ title?: string | null | undefined;
148
+ proxied?: boolean | null | undefined;
149
+ namecheapId?: string | null | undefined;
150
+ status?: string | null | undefined;
151
+ isUpdating?: boolean | null | undefined;
152
+ cloudflareStatus?: string | null | undefined;
153
+ paused?: boolean | null | undefined;
154
+ originalRegistrar?: string | null | undefined;
155
+ originalDNSHost?: string | null | undefined;
156
+ createdAt?: number | null | undefined;
157
+ expiresAt?: number | null | undefined;
158
+ ip?: string | null | undefined;
159
+ subdomain?: string | null | undefined;
160
+ mxRecord?: string | null | undefined;
161
+ target?: string | null | undefined;
162
+ archived?: boolean | null | undefined;
163
+ note?: string | null | undefined;
164
+ appid?: number | null | undefined;
165
+ }> & {
166
+ _id: import("mongoose").Types.ObjectId;
167
+ } & {
168
+ __v: number;
108
169
  }>;
@@ -57,5 +57,6 @@ exports.DomainSchema = new mongoose_1.Schema({
57
57
  archived: Boolean,
58
58
  title: String,
59
59
  note: String,
60
- proxied: Boolean
60
+ proxied: Boolean,
61
+ appid: Number
61
62
  });
@@ -22,6 +22,7 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
25
26
  import { Schema, Document } from "mongoose";
26
27
  export interface INamecheapDomain {
27
28
  ID: string;
@@ -73,13 +74,59 @@ export interface INamecheapBuyResult {
73
74
  };
74
75
  paidTotal: number;
75
76
  }
76
- export declare const NamecheapBuyRequestSchema: Schema<any, import("mongoose").Model<any, any, any, any, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, {
77
- domains: {
78
- name?: string | undefined;
79
- price?: number | undefined;
80
- available?: boolean | undefined;
81
- }[];
82
- id?: string | undefined;
83
- ip?: string | undefined;
84
- fullfilled?: boolean | undefined;
77
+ export declare const NamecheapBuyRequestSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, {
78
+ domains: import("mongoose").Types.DocumentArray<{
79
+ name?: string | null | undefined;
80
+ price?: number | null | undefined;
81
+ available?: boolean | null | undefined;
82
+ }, import("mongoose").Types.Subdocument<import("mongoose").Types.ObjectId, any, {
83
+ name?: string | null | undefined;
84
+ price?: number | null | undefined;
85
+ available?: boolean | null | undefined;
86
+ }> & {
87
+ name?: string | null | undefined;
88
+ price?: number | null | undefined;
89
+ available?: boolean | null | undefined;
90
+ }>;
91
+ id?: string | null | undefined;
92
+ ip?: string | null | undefined;
93
+ fullfilled?: boolean | null | undefined;
94
+ }, Document<unknown, {}, import("mongoose").FlatRecord<{
95
+ domains: import("mongoose").Types.DocumentArray<{
96
+ name?: string | null | undefined;
97
+ price?: number | null | undefined;
98
+ available?: boolean | null | undefined;
99
+ }, import("mongoose").Types.Subdocument<import("mongoose").Types.ObjectId, any, {
100
+ name?: string | null | undefined;
101
+ price?: number | null | undefined;
102
+ available?: boolean | null | undefined;
103
+ }> & {
104
+ name?: string | null | undefined;
105
+ price?: number | null | undefined;
106
+ available?: boolean | null | undefined;
107
+ }>;
108
+ id?: string | null | undefined;
109
+ ip?: string | null | undefined;
110
+ fullfilled?: boolean | null | undefined;
111
+ }>> & import("mongoose").FlatRecord<{
112
+ domains: import("mongoose").Types.DocumentArray<{
113
+ name?: string | null | undefined;
114
+ price?: number | null | undefined;
115
+ available?: boolean | null | undefined;
116
+ }, import("mongoose").Types.Subdocument<import("mongoose").Types.ObjectId, any, {
117
+ name?: string | null | undefined;
118
+ price?: number | null | undefined;
119
+ available?: boolean | null | undefined;
120
+ }> & {
121
+ name?: string | null | undefined;
122
+ price?: number | null | undefined;
123
+ available?: boolean | null | undefined;
124
+ }>;
125
+ id?: string | null | undefined;
126
+ ip?: string | null | undefined;
127
+ fullfilled?: boolean | null | undefined;
128
+ }> & {
129
+ _id: import("mongoose").Types.ObjectId;
130
+ } & {
131
+ __v: number;
85
132
  }>;
@@ -13,6 +13,7 @@ async function getStreamsByCampaignId(campaignId) {
13
13
  }
14
14
  async function getAllCampaigns() {
15
15
  const { data: campaigns } = await http_1.default.get('campaigns');
16
+ console.log("Campaigns fetched:", campaigns);
16
17
  return campaigns;
17
18
  }
18
19
  async function cloneStreams(originalCampaignId, streamPositionsToClone, campaignRegExp) {
@@ -172,16 +173,43 @@ async function upsertStreamToCampaign(campaign, stream) {
172
173
  }
173
174
  }
174
175
  exports.upsertStreamToCampaign = upsertStreamToCampaign;
176
+ // async function cloneOWCampaign(app: IApp): Promise<IKeitaroCampaign> {
177
+ // let name = `#${app.id} [◈]`
178
+ // let allCampaigns = await getAllCampaigns()
179
+ // let matchingCampaign = allCampaigns.filter((c) => new RegExp(`#${app.id}.*◈`).test(c.name))
180
+ // if (matchingCampaign.length > 0) return matchingCampaign[0]
181
+ // const { data: campaigns } = await keitaroApi.post(`/campaigns/2673/clone`);
182
+ // if (campaigns.length == 0) throw Error("Campaign cloning falied")
183
+ // let clonedCampaign: IKeitaroCampaign = campaigns[0]
184
+ // let allDomains = await KeitaroService.getDomains(true)
185
+ // if (!allDomains) {
186
+ // throw Error(`Failed to get all domains list`)
187
+ // }
188
+ // const domain = allDomains[Math.floor(Math.random() * allDomains.length)];
189
+ // let payload: Partial<IKeitaroCampaign> = {
190
+ // name: name,
191
+ // traffic_source_id: TRAFFIC_SOURCE_ID_FLASH_AI,
192
+ // domain_id: domain.id,
193
+ // parameters: prepareOWCampaignParameters(app)
194
+ // }
195
+ // const { data: campaign } = await keitaroApi.put(`/campaigns/${clonedCampaign.id}`, payload)
196
+ // return campaign
197
+ // }
175
198
  async function cloneOWCampaign(app) {
176
199
  let name = `#${app.id} [◈]`;
200
+ console.log("Fetching all campaigns...");
177
201
  let allCampaigns = await getAllCampaigns();
178
202
  let matchingCampaign = allCampaigns.filter((c) => new RegExp(`#${app.id}.*◈`).test(c.name));
179
203
  if (matchingCampaign.length > 0)
180
204
  return matchingCampaign[0];
205
+ console.log("Cloning campaign...");
206
+ console.log(`Campaigns Data:`, await http_1.default.post(`/campaigns/2673/clone`));
181
207
  const { data: campaigns } = await http_1.default.post(`/campaigns/2673/clone`);
208
+ console.log("Campaigns cloned:", campaigns);
182
209
  if (campaigns.length == 0)
183
- throw Error("Campaign cloning falied");
210
+ throw Error("Campaign cloning failed");
184
211
  let clonedCampaign = campaigns[0];
212
+ console.log("Fetching all domains...");
185
213
  let allDomains = await exports.KeitaroService.getDomains(true);
186
214
  if (!allDomains) {
187
215
  throw Error(`Failed to get all domains list`);
@@ -193,7 +221,9 @@ async function cloneOWCampaign(app) {
193
221
  domain_id: domain.id,
194
222
  parameters: (0, keitaro_utils_1.prepareOWCampaignParameters)(app)
195
223
  };
224
+ console.log("Updating cloned campaign...");
196
225
  const { data: campaign } = await http_1.default.put(`/campaigns/${clonedCampaign.id}`, payload);
226
+ console.log("Campaign updated:", campaign);
197
227
  return campaign;
198
228
  }
199
229
  async function cloneDCampaign(app) {
@@ -22,6 +22,7 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
25
26
  import { Schema } from "mongoose";
26
27
  export interface ISectionsList {
27
28
  id: number;
@@ -31,7 +32,404 @@ export interface IAppOffersSection {
31
32
  sectionId: number;
32
33
  offerIdsOrdered: number[];
33
34
  }
34
- export declare const SectionsListSchema: Schema<any, import("mongoose").Model<any, any, any, any, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, {
35
+ export declare const SectionsListSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, {
35
36
  id: number;
36
- content: any[];
37
+ content: import("mongoose").Types.DocumentArray<{
38
+ prototype?: {
39
+ constructor: {
40
+ name?: unknown;
41
+ [Symbol.hasInstance]?: {} | null | undefined;
42
+ prototype?: unknown;
43
+ length?: unknown;
44
+ caller?: any | null | undefined;
45
+ arguments?: unknown;
46
+ toString: {} | null;
47
+ apply?: {} | null | undefined;
48
+ call?: {} | null | undefined;
49
+ bind?: {} | null | undefined;
50
+ } | null;
51
+ toString: {} | null;
52
+ toLocaleString: {} | null;
53
+ valueOf: {} | null;
54
+ hasOwnProperty: {} | null;
55
+ isPrototypeOf: {} | null;
56
+ propertyIsEnumerable: {} | null;
57
+ } | null | undefined;
58
+ getPrototypeOf?: {} | null | undefined;
59
+ getOwnPropertyDescriptor?: {} | null | undefined;
60
+ getOwnPropertyNames?: {} | null | undefined;
61
+ create?: {} | null | undefined;
62
+ defineProperty?: {} | null | undefined;
63
+ defineProperties?: {} | null | undefined;
64
+ seal?: {} | null | undefined;
65
+ freeze?: {} | null | undefined;
66
+ preventExtensions?: {} | null | undefined;
67
+ isSealed?: {} | null | undefined;
68
+ isFrozen?: {} | null | undefined;
69
+ isExtensible?: {} | null | undefined;
70
+ keys?: {} | null | undefined;
71
+ assign?: {} | null | undefined;
72
+ getOwnPropertySymbols?: {} | null | undefined;
73
+ is?: {} | null | undefined;
74
+ setPrototypeOf?: {} | null | undefined;
75
+ values?: {} | null | undefined;
76
+ entries?: {} | null | undefined;
77
+ getOwnPropertyDescriptors?: {} | null | undefined;
78
+ fromEntries?: {} | null | undefined;
79
+ hasOwn?: {} | null | undefined;
80
+ }, import("mongoose").Types.Subdocument<import("mongoose").Types.ObjectId, any, {
81
+ prototype?: {
82
+ constructor: {
83
+ name?: unknown;
84
+ [Symbol.hasInstance]?: {} | null | undefined;
85
+ prototype?: unknown;
86
+ length?: unknown;
87
+ caller?: any | null | undefined;
88
+ arguments?: unknown;
89
+ toString: {} | null;
90
+ apply?: {} | null | undefined;
91
+ call?: {} | null | undefined;
92
+ bind?: {} | null | undefined;
93
+ } | null;
94
+ toString: {} | null;
95
+ toLocaleString: {} | null;
96
+ valueOf: {} | null;
97
+ hasOwnProperty: {} | null;
98
+ isPrototypeOf: {} | null;
99
+ propertyIsEnumerable: {} | null;
100
+ } | null | undefined;
101
+ getPrototypeOf?: {} | null | undefined;
102
+ getOwnPropertyDescriptor?: {} | null | undefined;
103
+ getOwnPropertyNames?: {} | null | undefined;
104
+ create?: {} | null | undefined;
105
+ defineProperty?: {} | null | undefined;
106
+ defineProperties?: {} | null | undefined;
107
+ seal?: {} | null | undefined;
108
+ freeze?: {} | null | undefined;
109
+ preventExtensions?: {} | null | undefined;
110
+ isSealed?: {} | null | undefined;
111
+ isFrozen?: {} | null | undefined;
112
+ isExtensible?: {} | null | undefined;
113
+ keys?: {} | null | undefined;
114
+ assign?: {} | null | undefined;
115
+ getOwnPropertySymbols?: {} | null | undefined;
116
+ is?: {} | null | undefined;
117
+ setPrototypeOf?: {} | null | undefined;
118
+ values?: {} | null | undefined;
119
+ entries?: {} | null | undefined;
120
+ getOwnPropertyDescriptors?: {} | null | undefined;
121
+ fromEntries?: {} | null | undefined;
122
+ hasOwn?: {} | null | undefined;
123
+ }> & {
124
+ prototype?: {
125
+ constructor: {
126
+ name?: unknown;
127
+ [Symbol.hasInstance]?: {} | null | undefined;
128
+ prototype?: unknown;
129
+ length?: unknown;
130
+ caller?: any | null | undefined;
131
+ arguments?: unknown;
132
+ toString: {} | null;
133
+ apply?: {} | null | undefined;
134
+ call?: {} | null | undefined;
135
+ bind?: {} | null | undefined;
136
+ } | null;
137
+ toString: {} | null;
138
+ toLocaleString: {} | null;
139
+ valueOf: {} | null;
140
+ hasOwnProperty: {} | null;
141
+ isPrototypeOf: {} | null;
142
+ propertyIsEnumerable: {} | null;
143
+ } | null | undefined;
144
+ getPrototypeOf?: {} | null | undefined;
145
+ getOwnPropertyDescriptor?: {} | null | undefined;
146
+ getOwnPropertyNames?: {} | null | undefined;
147
+ create?: {} | null | undefined;
148
+ defineProperty?: {} | null | undefined;
149
+ defineProperties?: {} | null | undefined;
150
+ seal?: {} | null | undefined;
151
+ freeze?: {} | null | undefined;
152
+ preventExtensions?: {} | null | undefined;
153
+ isSealed?: {} | null | undefined;
154
+ isFrozen?: {} | null | undefined;
155
+ isExtensible?: {} | null | undefined;
156
+ keys?: {} | null | undefined;
157
+ assign?: {} | null | undefined;
158
+ getOwnPropertySymbols?: {} | null | undefined;
159
+ is?: {} | null | undefined;
160
+ setPrototypeOf?: {} | null | undefined;
161
+ values?: {} | null | undefined;
162
+ entries?: {} | null | undefined;
163
+ getOwnPropertyDescriptors?: {} | null | undefined;
164
+ fromEntries?: {} | null | undefined;
165
+ hasOwn?: {} | null | undefined;
166
+ }>;
167
+ }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
168
+ id: number;
169
+ content: import("mongoose").Types.DocumentArray<{
170
+ prototype?: {
171
+ constructor: {
172
+ name?: unknown;
173
+ [Symbol.hasInstance]?: {} | null | undefined;
174
+ prototype?: unknown;
175
+ length?: unknown;
176
+ caller?: any | null | undefined;
177
+ arguments?: unknown;
178
+ toString: {} | null;
179
+ apply?: {} | null | undefined;
180
+ call?: {} | null | undefined;
181
+ bind?: {} | null | undefined;
182
+ } | null;
183
+ toString: {} | null;
184
+ toLocaleString: {} | null;
185
+ valueOf: {} | null;
186
+ hasOwnProperty: {} | null;
187
+ isPrototypeOf: {} | null;
188
+ propertyIsEnumerable: {} | null;
189
+ } | null | undefined;
190
+ getPrototypeOf?: {} | null | undefined;
191
+ getOwnPropertyDescriptor?: {} | null | undefined;
192
+ getOwnPropertyNames?: {} | null | undefined;
193
+ create?: {} | null | undefined;
194
+ defineProperty?: {} | null | undefined;
195
+ defineProperties?: {} | null | undefined;
196
+ seal?: {} | null | undefined;
197
+ freeze?: {} | null | undefined;
198
+ preventExtensions?: {} | null | undefined;
199
+ isSealed?: {} | null | undefined;
200
+ isFrozen?: {} | null | undefined;
201
+ isExtensible?: {} | null | undefined;
202
+ keys?: {} | null | undefined;
203
+ assign?: {} | null | undefined;
204
+ getOwnPropertySymbols?: {} | null | undefined;
205
+ is?: {} | null | undefined;
206
+ setPrototypeOf?: {} | null | undefined;
207
+ values?: {} | null | undefined;
208
+ entries?: {} | null | undefined;
209
+ getOwnPropertyDescriptors?: {} | null | undefined;
210
+ fromEntries?: {} | null | undefined;
211
+ hasOwn?: {} | null | undefined;
212
+ }, import("mongoose").Types.Subdocument<import("mongoose").Types.ObjectId, any, {
213
+ prototype?: {
214
+ constructor: {
215
+ name?: unknown;
216
+ [Symbol.hasInstance]?: {} | null | undefined;
217
+ prototype?: unknown;
218
+ length?: unknown;
219
+ caller?: any | null | undefined;
220
+ arguments?: unknown;
221
+ toString: {} | null;
222
+ apply?: {} | null | undefined;
223
+ call?: {} | null | undefined;
224
+ bind?: {} | null | undefined;
225
+ } | null;
226
+ toString: {} | null;
227
+ toLocaleString: {} | null;
228
+ valueOf: {} | null;
229
+ hasOwnProperty: {} | null;
230
+ isPrototypeOf: {} | null;
231
+ propertyIsEnumerable: {} | null;
232
+ } | null | undefined;
233
+ getPrototypeOf?: {} | null | undefined;
234
+ getOwnPropertyDescriptor?: {} | null | undefined;
235
+ getOwnPropertyNames?: {} | null | undefined;
236
+ create?: {} | null | undefined;
237
+ defineProperty?: {} | null | undefined;
238
+ defineProperties?: {} | null | undefined;
239
+ seal?: {} | null | undefined;
240
+ freeze?: {} | null | undefined;
241
+ preventExtensions?: {} | null | undefined;
242
+ isSealed?: {} | null | undefined;
243
+ isFrozen?: {} | null | undefined;
244
+ isExtensible?: {} | null | undefined;
245
+ keys?: {} | null | undefined;
246
+ assign?: {} | null | undefined;
247
+ getOwnPropertySymbols?: {} | null | undefined;
248
+ is?: {} | null | undefined;
249
+ setPrototypeOf?: {} | null | undefined;
250
+ values?: {} | null | undefined;
251
+ entries?: {} | null | undefined;
252
+ getOwnPropertyDescriptors?: {} | null | undefined;
253
+ fromEntries?: {} | null | undefined;
254
+ hasOwn?: {} | null | undefined;
255
+ }> & {
256
+ prototype?: {
257
+ constructor: {
258
+ name?: unknown;
259
+ [Symbol.hasInstance]?: {} | null | undefined;
260
+ prototype?: unknown;
261
+ length?: unknown;
262
+ caller?: any | null | undefined;
263
+ arguments?: unknown;
264
+ toString: {} | null;
265
+ apply?: {} | null | undefined;
266
+ call?: {} | null | undefined;
267
+ bind?: {} | null | undefined;
268
+ } | null;
269
+ toString: {} | null;
270
+ toLocaleString: {} | null;
271
+ valueOf: {} | null;
272
+ hasOwnProperty: {} | null;
273
+ isPrototypeOf: {} | null;
274
+ propertyIsEnumerable: {} | null;
275
+ } | null | undefined;
276
+ getPrototypeOf?: {} | null | undefined;
277
+ getOwnPropertyDescriptor?: {} | null | undefined;
278
+ getOwnPropertyNames?: {} | null | undefined;
279
+ create?: {} | null | undefined;
280
+ defineProperty?: {} | null | undefined;
281
+ defineProperties?: {} | null | undefined;
282
+ seal?: {} | null | undefined;
283
+ freeze?: {} | null | undefined;
284
+ preventExtensions?: {} | null | undefined;
285
+ isSealed?: {} | null | undefined;
286
+ isFrozen?: {} | null | undefined;
287
+ isExtensible?: {} | null | undefined;
288
+ keys?: {} | null | undefined;
289
+ assign?: {} | null | undefined;
290
+ getOwnPropertySymbols?: {} | null | undefined;
291
+ is?: {} | null | undefined;
292
+ setPrototypeOf?: {} | null | undefined;
293
+ values?: {} | null | undefined;
294
+ entries?: {} | null | undefined;
295
+ getOwnPropertyDescriptors?: {} | null | undefined;
296
+ fromEntries?: {} | null | undefined;
297
+ hasOwn?: {} | null | undefined;
298
+ }>;
299
+ }>> & import("mongoose").FlatRecord<{
300
+ id: number;
301
+ content: import("mongoose").Types.DocumentArray<{
302
+ prototype?: {
303
+ constructor: {
304
+ name?: unknown;
305
+ [Symbol.hasInstance]?: {} | null | undefined;
306
+ prototype?: unknown;
307
+ length?: unknown;
308
+ caller?: any | null | undefined;
309
+ arguments?: unknown;
310
+ toString: {} | null;
311
+ apply?: {} | null | undefined;
312
+ call?: {} | null | undefined;
313
+ bind?: {} | null | undefined;
314
+ } | null;
315
+ toString: {} | null;
316
+ toLocaleString: {} | null;
317
+ valueOf: {} | null;
318
+ hasOwnProperty: {} | null;
319
+ isPrototypeOf: {} | null;
320
+ propertyIsEnumerable: {} | null;
321
+ } | null | undefined;
322
+ getPrototypeOf?: {} | null | undefined;
323
+ getOwnPropertyDescriptor?: {} | null | undefined;
324
+ getOwnPropertyNames?: {} | null | undefined;
325
+ create?: {} | null | undefined;
326
+ defineProperty?: {} | null | undefined;
327
+ defineProperties?: {} | null | undefined;
328
+ seal?: {} | null | undefined;
329
+ freeze?: {} | null | undefined;
330
+ preventExtensions?: {} | null | undefined;
331
+ isSealed?: {} | null | undefined;
332
+ isFrozen?: {} | null | undefined;
333
+ isExtensible?: {} | null | undefined;
334
+ keys?: {} | null | undefined;
335
+ assign?: {} | null | undefined;
336
+ getOwnPropertySymbols?: {} | null | undefined;
337
+ is?: {} | null | undefined;
338
+ setPrototypeOf?: {} | null | undefined;
339
+ values?: {} | null | undefined;
340
+ entries?: {} | null | undefined;
341
+ getOwnPropertyDescriptors?: {} | null | undefined;
342
+ fromEntries?: {} | null | undefined;
343
+ hasOwn?: {} | null | undefined;
344
+ }, import("mongoose").Types.Subdocument<import("mongoose").Types.ObjectId, any, {
345
+ prototype?: {
346
+ constructor: {
347
+ name?: unknown;
348
+ [Symbol.hasInstance]?: {} | null | undefined;
349
+ prototype?: unknown;
350
+ length?: unknown;
351
+ caller?: any | null | undefined;
352
+ arguments?: unknown;
353
+ toString: {} | null;
354
+ apply?: {} | null | undefined;
355
+ call?: {} | null | undefined;
356
+ bind?: {} | null | undefined;
357
+ } | null;
358
+ toString: {} | null;
359
+ toLocaleString: {} | null;
360
+ valueOf: {} | null;
361
+ hasOwnProperty: {} | null;
362
+ isPrototypeOf: {} | null;
363
+ propertyIsEnumerable: {} | null;
364
+ } | null | undefined;
365
+ getPrototypeOf?: {} | null | undefined;
366
+ getOwnPropertyDescriptor?: {} | null | undefined;
367
+ getOwnPropertyNames?: {} | null | undefined;
368
+ create?: {} | null | undefined;
369
+ defineProperty?: {} | null | undefined;
370
+ defineProperties?: {} | null | undefined;
371
+ seal?: {} | null | undefined;
372
+ freeze?: {} | null | undefined;
373
+ preventExtensions?: {} | null | undefined;
374
+ isSealed?: {} | null | undefined;
375
+ isFrozen?: {} | null | undefined;
376
+ isExtensible?: {} | null | undefined;
377
+ keys?: {} | null | undefined;
378
+ assign?: {} | null | undefined;
379
+ getOwnPropertySymbols?: {} | null | undefined;
380
+ is?: {} | null | undefined;
381
+ setPrototypeOf?: {} | null | undefined;
382
+ values?: {} | null | undefined;
383
+ entries?: {} | null | undefined;
384
+ getOwnPropertyDescriptors?: {} | null | undefined;
385
+ fromEntries?: {} | null | undefined;
386
+ hasOwn?: {} | null | undefined;
387
+ }> & {
388
+ prototype?: {
389
+ constructor: {
390
+ name?: unknown;
391
+ [Symbol.hasInstance]?: {} | null | undefined;
392
+ prototype?: unknown;
393
+ length?: unknown;
394
+ caller?: any | null | undefined;
395
+ arguments?: unknown;
396
+ toString: {} | null;
397
+ apply?: {} | null | undefined;
398
+ call?: {} | null | undefined;
399
+ bind?: {} | null | undefined;
400
+ } | null;
401
+ toString: {} | null;
402
+ toLocaleString: {} | null;
403
+ valueOf: {} | null;
404
+ hasOwnProperty: {} | null;
405
+ isPrototypeOf: {} | null;
406
+ propertyIsEnumerable: {} | null;
407
+ } | null | undefined;
408
+ getPrototypeOf?: {} | null | undefined;
409
+ getOwnPropertyDescriptor?: {} | null | undefined;
410
+ getOwnPropertyNames?: {} | null | undefined;
411
+ create?: {} | null | undefined;
412
+ defineProperty?: {} | null | undefined;
413
+ defineProperties?: {} | null | undefined;
414
+ seal?: {} | null | undefined;
415
+ freeze?: {} | null | undefined;
416
+ preventExtensions?: {} | null | undefined;
417
+ isSealed?: {} | null | undefined;
418
+ isFrozen?: {} | null | undefined;
419
+ isExtensible?: {} | null | undefined;
420
+ keys?: {} | null | undefined;
421
+ assign?: {} | null | undefined;
422
+ getOwnPropertySymbols?: {} | null | undefined;
423
+ is?: {} | null | undefined;
424
+ setPrototypeOf?: {} | null | undefined;
425
+ values?: {} | null | undefined;
426
+ entries?: {} | null | undefined;
427
+ getOwnPropertyDescriptors?: {} | null | undefined;
428
+ fromEntries?: {} | null | undefined;
429
+ hasOwn?: {} | null | undefined;
430
+ }>;
431
+ }> & {
432
+ _id: import("mongoose").Types.ObjectId;
433
+ } & {
434
+ __v: number;
37
435
  }>;
@@ -22,6 +22,7 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
25
26
  import { Document, Model, Schema } from "mongoose";
26
27
  export interface IOffer extends Document {
27
28
  id: number;
@@ -61,31 +62,91 @@ export interface IPartnerSection {
61
62
  name: string;
62
63
  offers: IOffer[];
63
64
  }
64
- export declare const PartnerSchema: Schema<any, Model<any, any, any, any, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, {
65
- partnerId?: number | undefined;
66
- shortName?: string | undefined;
67
- name?: string | undefined;
65
+ export declare const PartnerSchema: Schema<any, Model<any, any, any, any, any, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, {
66
+ partnerId?: number | null | undefined;
67
+ shortName?: string | null | undefined;
68
+ name?: string | null | undefined;
69
+ }, Document<unknown, {}, import("mongoose").FlatRecord<{
70
+ partnerId?: number | null | undefined;
71
+ shortName?: string | null | undefined;
72
+ name?: string | null | undefined;
73
+ }>> & import("mongoose").FlatRecord<{
74
+ partnerId?: number | null | undefined;
75
+ shortName?: string | null | undefined;
76
+ name?: string | null | undefined;
77
+ }> & {
78
+ _id: import("mongoose").Types.ObjectId;
79
+ } & {
80
+ __v: number;
68
81
  }>;
69
- export declare const OfferSchema: Schema<any, Model<any, any, any, any, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, {
82
+ export declare const OfferSchema: Schema<any, Model<any, any, any, any, any, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, {
70
83
  type: string;
71
- id?: number | undefined;
72
- partnerId?: number | undefined;
73
- name?: string | undefined;
74
- graphicFolder?: string | undefined;
75
- geo?: string | undefined;
76
- caption?: string | undefined;
77
- link?: string | undefined;
78
- keitaroId?: string | undefined;
79
- hidden?: boolean | undefined;
84
+ id?: number | null | undefined;
85
+ partnerId?: number | null | undefined;
86
+ name?: string | null | undefined;
87
+ hidden?: boolean | null | undefined;
88
+ graphicFolder?: string | null | undefined;
89
+ geo?: string | null | undefined;
90
+ caption?: string | null | undefined;
91
+ link?: string | null | undefined;
92
+ keitaroId?: string | null | undefined;
80
93
  graphic?: {
81
- logo?: string | undefined;
82
- bg?: string | undefined;
83
- } | undefined;
94
+ logo?: string | null | undefined;
95
+ bg?: string | null | undefined;
96
+ } | null | undefined;
84
97
  history?: {
85
98
  name: string[];
86
99
  caption: string[];
87
100
  link: string[];
88
101
  logoNames: string[];
89
102
  bgNames: string[];
90
- } | undefined;
103
+ } | null | undefined;
104
+ }, Document<unknown, {}, import("mongoose").FlatRecord<{
105
+ type: string;
106
+ id?: number | null | undefined;
107
+ partnerId?: number | null | undefined;
108
+ name?: string | null | undefined;
109
+ hidden?: boolean | null | undefined;
110
+ graphicFolder?: string | null | undefined;
111
+ geo?: string | null | undefined;
112
+ caption?: string | null | undefined;
113
+ link?: string | null | undefined;
114
+ keitaroId?: string | null | undefined;
115
+ graphic?: {
116
+ logo?: string | null | undefined;
117
+ bg?: string | null | undefined;
118
+ } | null | undefined;
119
+ history?: {
120
+ name: string[];
121
+ caption: string[];
122
+ link: string[];
123
+ logoNames: string[];
124
+ bgNames: string[];
125
+ } | null | undefined;
126
+ }>> & import("mongoose").FlatRecord<{
127
+ type: string;
128
+ id?: number | null | undefined;
129
+ partnerId?: number | null | undefined;
130
+ name?: string | null | undefined;
131
+ hidden?: boolean | null | undefined;
132
+ graphicFolder?: string | null | undefined;
133
+ geo?: string | null | undefined;
134
+ caption?: string | null | undefined;
135
+ link?: string | null | undefined;
136
+ keitaroId?: string | null | undefined;
137
+ graphic?: {
138
+ logo?: string | null | undefined;
139
+ bg?: string | null | undefined;
140
+ } | null | undefined;
141
+ history?: {
142
+ name: string[];
143
+ caption: string[];
144
+ link: string[];
145
+ logoNames: string[];
146
+ bgNames: string[];
147
+ } | null | undefined;
148
+ }> & {
149
+ _id: import("mongoose").Types.ObjectId;
150
+ } & {
151
+ __v: number;
91
152
  }>;
@@ -22,6 +22,7 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
25
26
  import { Schema } from "mongoose";
26
27
  export interface IOffersSection {
27
28
  id: number;
@@ -34,10 +35,22 @@ export interface IOffersSection {
34
35
  [key: string]: string;
35
36
  };
36
37
  }
37
- export declare const OffersSectionSchema: Schema<any, import("mongoose").Model<any, any, any, any, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, {
38
+ export declare const OffersSectionSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, {
38
39
  id: number;
39
40
  title?: any;
40
41
  button?: any;
42
+ }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
43
+ id: number;
44
+ title?: any;
45
+ button?: any;
46
+ }>> & import("mongoose").FlatRecord<{
47
+ id: number;
48
+ title?: any;
49
+ button?: any;
50
+ }> & {
51
+ _id: import("mongoose").Types.ObjectId;
52
+ } & {
53
+ __v: number;
41
54
  }>;
42
55
  export declare enum DefaultSectionId {
43
56
  GAMBLING_MAIN = 0,
@@ -22,6 +22,7 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
25
26
  import { Document, Schema } from "mongoose";
26
27
  export declare enum PanelUserAccessScope {
27
28
  ADMIN = 0,
@@ -39,8 +40,20 @@ export interface IPanelUser extends Document {
39
40
  passwordHash: string;
40
41
  accessScopes: PanelUserAccessScope[];
41
42
  }
42
- export declare const PanelUserSchema: Schema<any, import("mongoose").Model<any, any, any, any, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, {
43
+ export declare const PanelUserSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, {
43
44
  accessScopes: string[];
44
- passwordHash?: string | undefined;
45
- username?: string | undefined;
45
+ passwordHash?: string | null | undefined;
46
+ username?: string | null | undefined;
47
+ }, Document<unknown, {}, import("mongoose").FlatRecord<{
48
+ accessScopes: string[];
49
+ passwordHash?: string | null | undefined;
50
+ username?: string | null | undefined;
51
+ }>> & import("mongoose").FlatRecord<{
52
+ accessScopes: string[];
53
+ passwordHash?: string | null | undefined;
54
+ username?: string | null | undefined;
55
+ }> & {
56
+ _id: import("mongoose").Types.ObjectId;
57
+ } & {
58
+ __v: number;
46
59
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bprotsyk/aso-core",
3
- "version": "2.1.35",
3
+ "version": "2.1.37",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "scripts": {
@@ -30,7 +30,7 @@
30
30
  "@types/unzipper": "^0.10.10",
31
31
  "axios": "^1.4.0",
32
32
  "module-alias": "^2.2.2",
33
- "mongoose": "^6.8.3",
33
+ "mongoose": "^8.9.2",
34
34
  "mustache": "^4.2.0",
35
35
  "react": "^18.3.1",
36
36
  "react-dom": "^18.3.1",
package/src/app/app.ts CHANGED
@@ -150,7 +150,7 @@ export interface IPrivacyPolicyParams {
150
150
  export enum IntegrationVersion {
151
151
  NONE = "MVVM",
152
152
  POLICY = "POLICY",
153
- OFFER_STUB = "OFFER_STUB",
153
+ OFFER_STUB = "OFFER_STUB",
154
154
  DIRECT = "DIRECT",
155
155
  WEB = "WEB",
156
156
  WEB_DIRECT = "WEB_DIRECT",
@@ -28,7 +28,7 @@ export interface IDomain extends Document {
28
28
  title: string | String,
29
29
  note: string,
30
30
  proxied: boolean
31
-
31
+ appid?: number
32
32
  }
33
33
 
34
34
  export interface IDomainsBuyRequestResponse {
@@ -102,5 +102,6 @@ export const DomainSchema = new Schema({
102
102
  archived: Boolean,
103
103
  title: String,
104
104
  note: String,
105
- proxied: Boolean
105
+ proxied: Boolean,
106
+ appid: Number
106
107
  })
@@ -22,6 +22,7 @@ async function getStreamsByCampaignId(campaignId: number): Promise<IKeitaroStrea
22
22
 
23
23
  async function getAllCampaigns(): Promise<IKeitaroCampaign[]> {
24
24
  const { data: campaigns } = await keitaroApi.get<IKeitaroCampaign[]>('campaigns');
25
+ console.log("Campaigns fetched:", campaigns);
25
26
  return campaigns
26
27
  }
27
28
 
@@ -210,37 +211,75 @@ export async function upsertStreamToCampaign(campaign: IKeitaroCampaign, stream:
210
211
  }
211
212
  }
212
213
 
213
- async function cloneOWCampaign(app: IApp): Promise<IKeitaroCampaign> {
214
- let name = `#${app.id} [◈]`
214
+ // async function cloneOWCampaign(app: IApp): Promise<IKeitaroCampaign> {
215
+ // let name = `#${app.id} [◈]`
215
216
 
216
- let allCampaigns = await getAllCampaigns()
217
- let matchingCampaign = allCampaigns.filter((c) => new RegExp(`#${app.id}.*◈`).test(c.name))
218
- if (matchingCampaign.length > 0) return matchingCampaign[0]
217
+ // let allCampaigns = await getAllCampaigns()
218
+ // let matchingCampaign = allCampaigns.filter((c) => new RegExp(`#${app.id}.*◈`).test(c.name))
219
+ // if (matchingCampaign.length > 0) return matchingCampaign[0]
219
220
 
220
- const { data: campaigns } = await keitaroApi.post(`/campaigns/2673/clone`);
221
+ // const { data: campaigns } = await keitaroApi.post(`/campaigns/2673/clone`);
221
222
 
222
- if (campaigns.length == 0) throw Error("Campaign cloning falied")
223
+ // if (campaigns.length == 0) throw Error("Campaign cloning falied")
223
224
 
224
- let clonedCampaign: IKeitaroCampaign = campaigns[0]
225
+ // let clonedCampaign: IKeitaroCampaign = campaigns[0]
225
226
 
226
- let allDomains = await KeitaroService.getDomains(true)
227
- if (!allDomains) {
228
- throw Error(`Failed to get all domains list`)
229
- }
227
+ // let allDomains = await KeitaroService.getDomains(true)
228
+ // if (!allDomains) {
229
+ // throw Error(`Failed to get all domains list`)
230
+ // }
230
231
 
231
- const domain = allDomains[Math.floor(Math.random() * allDomains.length)];
232
+ // const domain = allDomains[Math.floor(Math.random() * allDomains.length)];
232
233
 
233
- let payload: Partial<IKeitaroCampaign> = {
234
- name: name,
235
- traffic_source_id: TRAFFIC_SOURCE_ID_FLASH_AI,
236
- domain_id: domain.id,
237
- parameters: prepareOWCampaignParameters(app)
238
- }
234
+ // let payload: Partial<IKeitaroCampaign> = {
235
+ // name: name,
236
+ // traffic_source_id: TRAFFIC_SOURCE_ID_FLASH_AI,
237
+ // domain_id: domain.id,
238
+ // parameters: prepareOWCampaignParameters(app)
239
+ // }
239
240
 
240
- const { data: campaign } = await keitaroApi.put(`/campaigns/${clonedCampaign.id}`, payload)
241
+ // const { data: campaign } = await keitaroApi.put(`/campaigns/${clonedCampaign.id}`, payload)
241
242
 
242
- return campaign
243
- }
243
+ // return campaign
244
+ // }
245
+ async function cloneOWCampaign(app: IApp): Promise<IKeitaroCampaign> {
246
+ let name = `#${app.id} [◈]`;
247
+
248
+ console.log("Fetching all campaigns...");
249
+ let allCampaigns = await getAllCampaigns();
250
+ let matchingCampaign = allCampaigns.filter((c) => new RegExp(`#${app.id}.*◈`).test(c.name));
251
+ if (matchingCampaign.length > 0) return matchingCampaign[0];
252
+
253
+ console.log("Cloning campaign...");
254
+ console.log(`Campaigns Data:`, await keitaroApi.post(`/campaigns/2673/clone`));
255
+ const { data: campaigns } = await keitaroApi.post(`/campaigns/2673/clone`);
256
+ console.log("Campaigns cloned:", campaigns);
257
+
258
+ if (campaigns.length == 0) throw Error("Campaign cloning failed");
259
+
260
+ let clonedCampaign: IKeitaroCampaign = campaigns[0];
261
+
262
+ console.log("Fetching all domains...");
263
+ let allDomains = await KeitaroService.getDomains(true);
264
+ if (!allDomains) {
265
+ throw Error(`Failed to get all domains list`);
266
+ }
267
+
268
+ const domain = allDomains[Math.floor(Math.random() * allDomains.length)];
269
+
270
+ let payload: Partial<IKeitaroCampaign> = {
271
+ name: name,
272
+ traffic_source_id: TRAFFIC_SOURCE_ID_FLASH_AI,
273
+ domain_id: domain.id,
274
+ parameters: prepareOWCampaignParameters(app)
275
+ };
276
+
277
+ console.log("Updating cloned campaign...");
278
+ const { data: campaign } = await keitaroApi.put(`/campaigns/${clonedCampaign.id}`, payload);
279
+ console.log("Campaign updated:", campaign);
280
+
281
+ return campaign;
282
+ }
244
283
 
245
284
  async function cloneDCampaign(app: IApp): Promise<IKeitaroCampaign> {
246
285
  let name = `D #${app.id} (${app.bundle})`