@bprotsyk/aso-core 1.2.207 → 1.2.208
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/index.d.ts +1 -1
- package/lib/keitaro/keitaro-offer.d.ts +1 -0
- package/lib/network/keitaro/keitaro-service.d.ts +11 -3
- package/lib/network/keitaro/keitaro-service.js +11 -1
- package/package.json +1 -1
- package/src/index.ts +1 -1
- package/src/keitaro/keitaro-offer.ts +1 -0
- package/src/network/keitaro/keitaro-service.ts +25 -7
package/lib/index.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export { IOfferWallAuthConfig } from "./aso/offerwall/auth/offerwall-auth-config
|
|
|
30
30
|
export { IOfferWallAuthLocalization } from "./aso/offerwall/auth/offerwall-auth-localization";
|
|
31
31
|
export { IOfferWallAuthSubmitRequest } from "./aso/offerwall/auth/offerwall-auth-submit-request";
|
|
32
32
|
export { IOfferWallAuthSubmitResponse } from "./aso/offerwall/auth/offerwall-auth-submit-response";
|
|
33
|
-
export { KeitaroService } from "./network/keitaro/keitaro-service";
|
|
33
|
+
export { KeitaroService, IKeitaroOffersFilter } from "./network/keitaro/keitaro-service";
|
|
34
34
|
export * as KeitaroUtils from "./utils/keitaro-utils";
|
|
35
35
|
export { IKeitaroCampaign, IKeitaroCampaignParameters, IKeitaroCampaignParameter } from "./keitaro/keitaro-campaign";
|
|
36
36
|
export { IKeitaroDomain } from "./keitaro/keitaro-domain";
|
|
@@ -3,13 +3,20 @@ import { IOffer } from "../../shared/offer";
|
|
|
3
3
|
import { IKeitaroCampaign } from "../../keitaro/keitaro-campaign";
|
|
4
4
|
import { IKeitaroDomain } from "../../keitaro/keitaro-domain";
|
|
5
5
|
import { IFlashApp } from "../../flash/flash-app";
|
|
6
|
+
import { IKeitaroOffer } from "index";
|
|
7
|
+
export interface IKeitaroOffersFilter {
|
|
8
|
+
keitaroId?: number;
|
|
9
|
+
name?: string;
|
|
10
|
+
caption?: string;
|
|
11
|
+
}
|
|
6
12
|
declare function getStreamsByCampaignId(campaignId: number): Promise<IKeitaroStream[]>;
|
|
7
13
|
declare function getAllCampaigns(): Promise<IKeitaroCampaign[]>;
|
|
8
14
|
declare function cloneStreams(originalCampaignId: number, streamPositionsToClone: number[], campaignRegExp: RegExp): Promise<void>;
|
|
9
15
|
declare function updateCampaign(id: number, payload: Partial<IKeitaroCampaign>): Promise<void>;
|
|
10
|
-
declare function getAllOffers(): Promise<
|
|
11
|
-
declare function
|
|
12
|
-
declare function
|
|
16
|
+
declare function getAllOffers(): Promise<IKeitaroOffer[]>;
|
|
17
|
+
declare function findKeitaroOffers(filter: IKeitaroOffersFilter): Promise<IKeitaroOffer[]>;
|
|
18
|
+
declare function getOfferByKeitaroId(id: number): Promise<IKeitaroOffer>;
|
|
19
|
+
declare function updateOffer(offer: any): Promise<IKeitaroOffer>;
|
|
13
20
|
declare function addOfferToKeitaro(offer: IOffer, affiliateId: number, link: string, campaignGroupId?: number, groupId?: number): Promise<void>;
|
|
14
21
|
declare function createCampaign(campaignData: Partial<IKeitaroCampaign>): Promise<IKeitaroCampaign>;
|
|
15
22
|
declare function getCampaignById(id: number): Promise<IKeitaroCampaign>;
|
|
@@ -38,5 +45,6 @@ export declare const KeitaroService: {
|
|
|
38
45
|
getProfitForTimeRange: typeof getProfitForTimeRange;
|
|
39
46
|
getProfitForTodayAndYesterday: typeof getProfitForTodayAndYesterday;
|
|
40
47
|
cloneDCampaign: typeof cloneDCampaign;
|
|
48
|
+
findKeitaroOffers: typeof findKeitaroOffers;
|
|
41
49
|
};
|
|
42
50
|
export {};
|
|
@@ -83,6 +83,16 @@ async function getAllOffers() {
|
|
|
83
83
|
const { data: offers } = await http_1.default.get('offers');
|
|
84
84
|
return offers;
|
|
85
85
|
}
|
|
86
|
+
async function findKeitaroOffers(filter) {
|
|
87
|
+
let offers = await getAllOffers();
|
|
88
|
+
if (filter.caption)
|
|
89
|
+
offers = offers.filter((o) => o.name.includes(filter.caption));
|
|
90
|
+
if (filter.keitaroId)
|
|
91
|
+
offers = offers.filter((o) => o.id == filter.keitaroId);
|
|
92
|
+
if (filter.name)
|
|
93
|
+
offers = offers.filter((o) => o.name.includes(filter.name));
|
|
94
|
+
return offers;
|
|
95
|
+
}
|
|
86
96
|
async function getOfferByKeitaroId(id) {
|
|
87
97
|
const { data: offer } = await http_1.default.get(`offers/${id}`);
|
|
88
98
|
return offer;
|
|
@@ -246,5 +256,5 @@ async function getProfitForTodayAndYesterday() {
|
|
|
246
256
|
}
|
|
247
257
|
exports.KeitaroService = {
|
|
248
258
|
getStreamsByCampaignId, updateCampaign, getAllCampaigns, getAllOffers, cloneStreams, addOfferToKeitaro, getOfferByKeitaroId, getDomains, createCampaign, getCampaignById, upsertStreamToCampaign, cloneOWCampaign,
|
|
249
|
-
updateOffer, changeCampaignsGroup, getProfitForTimeRange, getProfitForTodayAndYesterday, cloneDCampaign
|
|
259
|
+
updateOffer, changeCampaignsGroup, getProfitForTimeRange, getProfitForTodayAndYesterday, cloneDCampaign, findKeitaroOffers
|
|
250
260
|
};
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -37,7 +37,7 @@ export { IOfferWallAuthLocalization } from "./aso/offerwall/auth/offerwall-auth-
|
|
|
37
37
|
export { IOfferWallAuthSubmitRequest } from "./aso/offerwall/auth/offerwall-auth-submit-request"
|
|
38
38
|
export { IOfferWallAuthSubmitResponse } from "./aso/offerwall/auth/offerwall-auth-submit-response"
|
|
39
39
|
|
|
40
|
-
export { KeitaroService } from "./network/keitaro/keitaro-service"
|
|
40
|
+
export { KeitaroService, IKeitaroOffersFilter } from "./network/keitaro/keitaro-service"
|
|
41
41
|
export * as KeitaroUtils from "./utils/keitaro-utils"
|
|
42
42
|
|
|
43
43
|
export { IKeitaroCampaign, IKeitaroCampaignParameters, IKeitaroCampaignParameter } from "./keitaro/keitaro-campaign"
|
|
@@ -6,6 +6,13 @@ import { IKeitaroDomain } from "../../keitaro/keitaro-domain";
|
|
|
6
6
|
import { IFlashApp } from "../../flash/flash-app";
|
|
7
7
|
import { TRAFFIC_SOURCE_ID_FLASH_AI, prepareOWCampaignParameters } from "../../utils/keitaro-utils";
|
|
8
8
|
import { convertMillisToDate, getTimestampsForTodayAndYesterday } from "../../utils/general";
|
|
9
|
+
import { IKeitaroOffer } from "index";
|
|
10
|
+
|
|
11
|
+
export interface IKeitaroOffersFilter {
|
|
12
|
+
keitaroId?: number,
|
|
13
|
+
name?: string,
|
|
14
|
+
caption?: string
|
|
15
|
+
}
|
|
9
16
|
|
|
10
17
|
async function getStreamsByCampaignId(campaignId: number): Promise<IKeitaroStream[]> {
|
|
11
18
|
const { data: streams } = await keitaroApi.get<IKeitaroStream[]>(`campaigns/${campaignId}/streams`);
|
|
@@ -93,20 +100,31 @@ async function createStreamForMatchingCampaigns(streamPartialPayload: any, offer
|
|
|
93
100
|
}
|
|
94
101
|
}
|
|
95
102
|
|
|
96
|
-
async function getAllOffers(): Promise<
|
|
97
|
-
const { data: offers } = await keitaroApi.get<
|
|
103
|
+
async function getAllOffers(): Promise<IKeitaroOffer[]> {
|
|
104
|
+
const { data: offers } = await keitaroApi.get<IKeitaroOffer[]>('offers')
|
|
105
|
+
|
|
106
|
+
return offers
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
async function findKeitaroOffers(filter: IKeitaroOffersFilter): Promise<IKeitaroOffer[]> {
|
|
111
|
+
let offers = await getAllOffers()
|
|
112
|
+
|
|
113
|
+
if (filter.caption) offers = offers.filter((o) => o.name.includes(filter.caption!))
|
|
114
|
+
if (filter.keitaroId) offers = offers.filter((o) => o.id == filter.keitaroId!)
|
|
115
|
+
if (filter.name) offers = offers.filter((o) => o.name.includes(filter.name!))
|
|
98
116
|
|
|
99
117
|
return offers
|
|
100
118
|
}
|
|
101
119
|
|
|
102
|
-
async function getOfferByKeitaroId(id: number): Promise<
|
|
103
|
-
const { data: offer } = await keitaroApi.get<
|
|
120
|
+
async function getOfferByKeitaroId(id: number): Promise<IKeitaroOffer> {
|
|
121
|
+
const { data: offer } = await keitaroApi.get<IKeitaroOffer>(`offers/${id}`)
|
|
104
122
|
|
|
105
123
|
return offer
|
|
106
124
|
}
|
|
107
125
|
|
|
108
|
-
async function updateOffer(offer: any): Promise<
|
|
109
|
-
const { data: o } = await keitaroApi.put<
|
|
126
|
+
async function updateOffer(offer: any): Promise<IKeitaroOffer> {
|
|
127
|
+
const { data: o } = await keitaroApi.put<IKeitaroOffer>(`offers/${offer.id}`, offer)
|
|
110
128
|
|
|
111
129
|
return o
|
|
112
130
|
}
|
|
@@ -300,5 +318,5 @@ async function getProfitForTodayAndYesterday(): Promise<any> {
|
|
|
300
318
|
|
|
301
319
|
export const KeitaroService = {
|
|
302
320
|
getStreamsByCampaignId, updateCampaign, getAllCampaigns, getAllOffers, cloneStreams, addOfferToKeitaro, getOfferByKeitaroId, getDomains, createCampaign, getCampaignById, upsertStreamToCampaign, cloneOWCampaign,
|
|
303
|
-
updateOffer, changeCampaignsGroup, getProfitForTimeRange, getProfitForTodayAndYesterday, cloneDCampaign
|
|
321
|
+
updateOffer, changeCampaignsGroup, getProfitForTimeRange, getProfitForTodayAndYesterday, cloneDCampaign, findKeitaroOffers
|
|
304
322
|
}
|