@bprotsyk/aso-core 1.2.48 → 1.2.49

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.
@@ -133,15 +133,25 @@ exports.FlashAppSchema = new mongoose_1.Schema({
133
133
  });
134
134
  // TODO app type (casino / fin)
135
135
  async function updateSchemaAndMoveValue(model) {
136
- // let pipelineStage: PipelineStage[] = [
137
- // {
138
- // $addFields: {
139
- // plugUrl: 0
140
- // }
141
- // }
142
- // ]
143
- // let aggregation = model.aggregate(pipelineStage)
144
- // await aggregation.exec()
136
+ let pipelineStage = [
137
+ {
138
+ $addFields: {
139
+ keitaroData: {
140
+ redirectCampaignId: "none",
141
+ redirectCampaignName: "none",
142
+ trackingCampaignId: "none",
143
+ trackingCampaignName: "none",
144
+ clickIdParameterName: "none",
145
+ offerIdParameterName: "none",
146
+ domainId: "none",
147
+ domainName: "none",
148
+ },
149
+ type: flash_app_type_1.FlashAppType.GAMBLING
150
+ }
151
+ }
152
+ ];
153
+ let aggregation = model.aggregate(pipelineStage);
154
+ await aggregation.exec();
145
155
  const updateOperation = {
146
156
  $set: {
147
157
  pushesEnabled: true,
package/lib/index.d.ts CHANGED
@@ -30,3 +30,7 @@ export { IOfferWallAuthLocalization } from "./aso/offerwall/auth/offerwall-auth-
30
30
  export { IOfferWallAuthSubmitRequest } from "./aso/offerwall/auth/offerwall-auth-submit-request";
31
31
  export { IOfferWallAuthSubmitResponse } from "./aso/offerwall/auth/offerwall-auth-submit-response";
32
32
  export { KeitaroService } from "./network/keitaro/keitaro-service";
33
+ export { IKeitaroCampaign, IKeitaroCampaignParameters, IKeitaroCampaignParameter } from "./keitaro/keitaro-campaign";
34
+ export { IKeitaroDomain } from "./keitaro/keitaro-domain";
35
+ export { IKeitaroOffer } from "./keitaro/keitaro-offer";
36
+ export { IKeitaroStream } from "./keitaro/keitaro-stream";
@@ -0,0 +1,26 @@
1
+ export interface IKeitaroCampaign {
2
+ id: number;
3
+ alias: string;
4
+ name: string;
5
+ type: string;
6
+ is_paused: boolean;
7
+ state: string;
8
+ cost_type: string;
9
+ cost_value: string;
10
+ group_id: number;
11
+ traffic_source_id: number;
12
+ cost_auto: boolean;
13
+ domain_id: number;
14
+ domain: string;
15
+ parameters: IKeitaroCampaignParameters;
16
+ }
17
+ export interface IKeitaroCampaignParameters {
18
+ [key: string]: IKeitaroCampaignParameter;
19
+ }
20
+ export interface IKeitaroCampaignParameter {
21
+ name: string;
22
+ placeholder: string;
23
+ alias: string;
24
+ }
25
+ export declare const AI_CAMPAIGN_GROUP_FLASH_REDIRECT = 82;
26
+ export declare const AI_CAMPAIGN_TRAFFIC_SOURCE_FLASH = 22;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AI_CAMPAIGN_TRAFFIC_SOURCE_FLASH = exports.AI_CAMPAIGN_GROUP_FLASH_REDIRECT = void 0;
4
+ exports.AI_CAMPAIGN_GROUP_FLASH_REDIRECT = 82;
5
+ exports.AI_CAMPAIGN_TRAFFIC_SOURCE_FLASH = 22;
@@ -0,0 +1,6 @@
1
+ export interface IKeitaroDomain {
2
+ id: number;
3
+ name: "string";
4
+ state: "active";
5
+ network_status: "active";
6
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ export interface IKeitaroOffer {
2
+ id: number;
3
+ campaign_id: number;
4
+ name: string;
5
+ url: string;
6
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,16 @@
1
+ export interface IKeitaroStream {
2
+ id: number;
3
+ name: string;
4
+ campaign_id: number;
5
+ offer_id: number;
6
+ url: string;
7
+ redirect_url: string;
8
+ traffic_type: string;
9
+ state: string;
10
+ filters: any[];
11
+ position: number;
12
+ offers: any[];
13
+ schema: string;
14
+ type: string;
15
+ action_type: string;
16
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,24 +1,6 @@
1
+ import { IKeitaroStream } from "keitaro/keitaro-stream";
1
2
  import { IOffer } from "../../shared/offer";
2
- export interface IKeitaroStream {
3
- id: number;
4
- name: string;
5
- campaign_id: number;
6
- offer_id: number;
7
- url: string;
8
- redirect_url: string;
9
- traffic_type: string;
10
- state: string;
11
- filters: any[];
12
- position: number;
13
- offers: any[];
14
- schema: string;
15
- type: string;
16
- action_type: string;
17
- }
18
- export interface IKeitaroCampaign {
19
- id: number;
20
- name: string;
21
- }
3
+ import { IKeitaroCampaign } from "keitaro/keitaro-campaign";
22
4
  declare function getStreamsByCampaignId(campaignId: number): Promise<IKeitaroStream[]>;
23
5
  declare function getAllCampaigns(): Promise<IKeitaroCampaign[]>;
24
6
  declare function cloneStreams(originalCampaignId: number, streamPositionsToClone: number[], campaignRegExp: RegExp): Promise<void>;
@@ -128,6 +128,18 @@ async function addOfferToKeitaro(offer, affiliateId, link, groupId) {
128
128
  let streamPartialPayload = createStreamPartialPayload(keitaroOfferId, offer.caption, offer.name, offer.geo);
129
129
  await createStreamForMatchingCampaigns(streamPartialPayload, offer.name, /^(FA #|A #)/);
130
130
  }
131
+ // Domain
132
+ async function getDomains() {
133
+ try {
134
+ const response = await http_1.default.get(`/domains`);
135
+ if (response.status == 200) {
136
+ return response.data;
137
+ }
138
+ }
139
+ catch (e) {
140
+ }
141
+ return null;
142
+ }
131
143
  exports.KeitaroService = {
132
144
  getStreamsByCampaignId, getAllCampaigns, getAllOffers, cloneStreams, addOfferToKeitaro, getOfferByKeitaroId
133
145
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bprotsyk/aso-core",
3
- "version": "1.2.48",
3
+ "version": "1.2.49",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "scripts": {
@@ -183,17 +183,29 @@ export const FlashAppSchema = new Schema({
183
183
  })
184
184
  // TODO app type (casino / fin)
185
185
  export async function updateSchemaAndMoveValue(model: Model<IFlashApp>): Promise<void> {
186
- // let pipelineStage: PipelineStage[] = [
187
- // {
188
- // $addFields: {
189
- // plugUrl: 0
190
- // }
191
- // }
192
- // ]
193
-
194
- // let aggregation = model.aggregate(pipelineStage)
195
-
196
- // await aggregation.exec()
186
+ let pipelineStage: PipelineStage[] = [
187
+ {
188
+ $addFields: {
189
+ keitaroData: {
190
+ redirectCampaignId: "none",
191
+ redirectCampaignName: "none",
192
+ trackingCampaignId: "none",
193
+ trackingCampaignName: "none",
194
+
195
+ clickIdParameterName: "none",
196
+ offerIdParameterName: "none",
197
+
198
+ domainId: "none",
199
+ domainName: "none",
200
+ },
201
+ type: FlashAppType.GAMBLING
202
+ }
203
+ }
204
+ ]
205
+
206
+ let aggregation = model.aggregate(pipelineStage)
207
+
208
+ await aggregation.exec()
197
209
 
198
210
  const updateOperation: UpdateQuery<IFlashApp> = {
199
211
  $set: {
package/src/index.ts CHANGED
@@ -35,4 +35,10 @@ export { IOfferWallAuthConfig } from "./aso/offerwall/auth/offerwall-auth-config
35
35
  export { IOfferWallAuthLocalization } from "./aso/offerwall/auth/offerwall-auth-localization"
36
36
  export { IOfferWallAuthSubmitRequest } from "./aso/offerwall/auth/offerwall-auth-submit-request"
37
37
  export { IOfferWallAuthSubmitResponse } from "./aso/offerwall/auth/offerwall-auth-submit-response"
38
- export { KeitaroService } from "./network/keitaro/keitaro-service"
38
+
39
+ export { KeitaroService } from "./network/keitaro/keitaro-service"
40
+
41
+ export {IKeitaroCampaign, IKeitaroCampaignParameters, IKeitaroCampaignParameter} from "./keitaro/keitaro-campaign"
42
+ export {IKeitaroDomain} from "./keitaro/keitaro-domain"
43
+ export {IKeitaroOffer} from "./keitaro/keitaro-offer"
44
+ export {IKeitaroStream} from "./keitaro/keitaro-stream"
@@ -0,0 +1,31 @@
1
+ export interface IKeitaroCampaign {
2
+ id: number
3
+ alias: string,
4
+ name: string
5
+ type: string
6
+ is_paused: boolean,
7
+ state: string,
8
+ cost_type: string // CPC
9
+ cost_value: string // USD
10
+ group_id: number
11
+ traffic_source_id: number
12
+ cost_auto: boolean
13
+ domain_id: number
14
+ domain: string // https://generous-slide.com/,
15
+ parameters: IKeitaroCampaignParameters
16
+ }
17
+
18
+ export interface IKeitaroCampaignParameters {
19
+ [key: string]: IKeitaroCampaignParameter
20
+ }
21
+
22
+
23
+ export interface IKeitaroCampaignParameter {
24
+ name: string,
25
+ placeholder: string,
26
+ alias: string
27
+ }
28
+
29
+ export const AI_CAMPAIGN_GROUP_FLASH_REDIRECT = 82
30
+
31
+ export const AI_CAMPAIGN_TRAFFIC_SOURCE_FLASH = 22
@@ -0,0 +1,6 @@
1
+ export interface IKeitaroDomain {
2
+ id: number,
3
+ name: "string",
4
+ state: "active",
5
+ network_status: "active"
6
+ }
@@ -0,0 +1,6 @@
1
+ export interface IKeitaroOffer {
2
+ id: number;
3
+ campaign_id: number;
4
+ name: string;
5
+ url: string;
6
+ }
@@ -0,0 +1,16 @@
1
+ export interface IKeitaroStream {
2
+ id: number;
3
+ name: string;
4
+ campaign_id: number;
5
+ offer_id: number;
6
+ url: string;
7
+ redirect_url: string;
8
+ traffic_type: string;
9
+ state: string;
10
+ filters: any[]
11
+ position: number;
12
+ offers: any[],
13
+ schema: string,
14
+ type: string,
15
+ action_type: string
16
+ }
@@ -1,27 +1,8 @@
1
+ import { IKeitaroStream } from "keitaro/keitaro-stream";
1
2
  import { IOffer } from "../../shared/offer"
2
3
  import keitaroApi from "./http"
3
-
4
- export interface IKeitaroStream {
5
- id: number;
6
- name: string;
7
- campaign_id: number;
8
- offer_id: number;
9
- url: string;
10
- redirect_url: string;
11
- traffic_type: string;
12
- state: string;
13
- filters: any[]
14
- position: number;
15
- offers: any[],
16
- schema: string,
17
- type: string,
18
- action_type: string
19
- }
20
-
21
- export interface IKeitaroCampaign {
22
- id: number;
23
- name: string;
24
- }
4
+ import { IKeitaroCampaign } from "keitaro/keitaro-campaign";
5
+ import { IKeitaroDomain } from "keitaro/keitaro-domain";
25
6
 
26
7
  async function getStreamsByCampaignId(campaignId: number): Promise<IKeitaroStream[]> {
27
8
  const { data: streams } = await keitaroApi.get<IKeitaroStream[]>(`campaigns/${campaignId}/streams`);
@@ -169,6 +150,23 @@ async function addOfferToKeitaro(offer: IOffer, affiliateId: number, link: strin
169
150
  await createStreamForMatchingCampaigns(streamPartialPayload, offer.name, /^(FA #|A #)/)
170
151
  }
171
152
 
153
+
154
+ // Domain
155
+
156
+ async function getDomains(): Promise<IKeitaroDomain[] | null> {
157
+ try {
158
+ const response = await keitaroApi.get(`/domains`);
159
+ if (response.status == 200) {
160
+ return response.data as IKeitaroDomain[]
161
+ }
162
+ }
163
+ catch (e) {
164
+
165
+ }
166
+
167
+ return null
168
+ }
169
+
172
170
  export const KeitaroService = {
173
171
  getStreamsByCampaignId, getAllCampaigns, getAllOffers, cloneStreams, addOfferToKeitaro, getOfferByKeitaroId
174
172
  }