@agenus-io/pixel-backend-sdk 1.0.22 → 1.0.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.
- package/dist/Class/index.d.ts +2 -1
- package/dist/Class/index.js +23 -0
- package/dist/Class/interface.d.ts +17 -0
- package/package.json +1 -1
package/dist/Class/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AWSConfig, SendSaleParams } from "../config";
|
|
2
|
-
import { ICreatePixelDTO, IGetOnePixelDTO, IGetPixelDTO, IDeletePixelDTO, IUpdatePixelDTO, IPixelSdk, IUpdateOffersDTO } from './interface';
|
|
2
|
+
import { ICreatePixelDTO, IGetOnePixelDTO, IGetPixelDTO, IDeletePixelDTO, IUpdatePixelDTO, IPixelSdk, IUpdateOffersDTO, IMetricsDTO } from './interface';
|
|
3
3
|
/**
|
|
4
4
|
* Classe responsável por com vendas e pixels
|
|
5
5
|
*/
|
|
@@ -28,4 +28,5 @@ export declare class PixelSDK implements IPixelSdk {
|
|
|
28
28
|
Get({ page, pageSize, filter, workSpaceId, platform, productIds, offerIds }: IGetPixelDTO.Params): Promise<IGetPixelDTO.Result>;
|
|
29
29
|
GetOne({ id, workSpaceId }: IGetOnePixelDTO.Params): Promise<IGetOnePixelDTO.Result>;
|
|
30
30
|
UpdateOffers({ id, workspaceId, offerIds, type }: IUpdateOffersDTO.Params): Promise<void>;
|
|
31
|
+
Metrics({ workSpaceId, platform, productIds, offerIds, filter }: IMetricsDTO.Params): Promise<IMetricsDTO.Result>;
|
|
31
32
|
}
|
package/dist/Class/index.js
CHANGED
|
@@ -217,5 +217,28 @@ class PixelSDK {
|
|
|
217
217
|
throw "Erro ao criar pixel";
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
|
+
async Metrics({ workSpaceId, platform, productIds, offerIds, filter }) {
|
|
221
|
+
try {
|
|
222
|
+
const token = {
|
|
223
|
+
appId: this.appId,
|
|
224
|
+
secretToken: this.appToken,
|
|
225
|
+
workSpaceId: workSpaceId,
|
|
226
|
+
};
|
|
227
|
+
const response = await axios_1.default.get(`${this.apiUrl}/metrics`, {
|
|
228
|
+
headers: { "app-id": token.appId, "app-secret-token": token.secretToken, "work-space-id": token.workSpaceId },
|
|
229
|
+
params: { platform, productIds, offerIds, filter },
|
|
230
|
+
});
|
|
231
|
+
return response.data;
|
|
232
|
+
}
|
|
233
|
+
catch (error) {
|
|
234
|
+
if (error instanceof axios_1.AxiosError) {
|
|
235
|
+
console.log(error.response?.data);
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
console.log(error);
|
|
239
|
+
}
|
|
240
|
+
throw "Erro ao obter métricas";
|
|
241
|
+
}
|
|
242
|
+
}
|
|
220
243
|
}
|
|
221
244
|
exports.PixelSDK = PixelSDK;
|
|
@@ -150,6 +150,22 @@ export declare namespace IUpdateOffersDTO {
|
|
|
150
150
|
offerIds: string[];
|
|
151
151
|
};
|
|
152
152
|
}
|
|
153
|
+
export declare namespace IMetricsDTO {
|
|
154
|
+
type Params = {
|
|
155
|
+
workSpaceId: string;
|
|
156
|
+
platform?: MarketingPlatform;
|
|
157
|
+
productIds?: string[];
|
|
158
|
+
offerIds?: string[];
|
|
159
|
+
filter?: string;
|
|
160
|
+
};
|
|
161
|
+
type Result = {
|
|
162
|
+
metrics: {
|
|
163
|
+
total: number;
|
|
164
|
+
active: number;
|
|
165
|
+
sendedEvents: number;
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
}
|
|
153
169
|
export interface IPixelSdk {
|
|
154
170
|
Create(params: ICreatePixelDTO.Params): Promise<ICreatePixelDTO.Result>;
|
|
155
171
|
Update(params: IUpdatePixelDTO.Params): Promise<void>;
|
|
@@ -157,5 +173,6 @@ export interface IPixelSdk {
|
|
|
157
173
|
Get(params: IGetPixelDTO.Params): Promise<IGetPixelDTO.Result>;
|
|
158
174
|
GetOne(params: IGetOnePixelDTO.Params): Promise<IGetOnePixelDTO.Result>;
|
|
159
175
|
UpdateOffers(params: IUpdateOffersDTO.Params): Promise<void>;
|
|
176
|
+
Metrics(params: IMetricsDTO.Params): Promise<IMetricsDTO.Result>;
|
|
160
177
|
}
|
|
161
178
|
export {};
|