@agenus-io/pixel-backend-sdk 1.1.1 → 1.1.3

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.
@@ -1,5 +1,5 @@
1
1
  import type { AWSConfig, SendSaleParams } from "../config";
2
- import { ICreatePixelDTO, IGetOnePixelDTO, IGetPixelDTO, IDeletePixelDTO, IUpdatePixelDTO, IPixelSdk, IUpdateOffersDTO, IMetricsDTO } from './interface';
2
+ import { ICreatePixelDTO, IGetOnePixelDTO, IGetPixelDTO, IDeletePixelDTO, IUpdatePixelDTO, IPixelSdk, IUpdateOffersDTO, IMetricsDTO, IFunilSummaryDTO } from './interface';
3
3
  /**
4
4
  * Classe responsável por com vendas e pixels
5
5
  */
@@ -29,4 +29,5 @@ export declare class PixelSDK implements IPixelSdk {
29
29
  GetOne({ id, workSpaceId }: IGetOnePixelDTO.Params): Promise<IGetOnePixelDTO.Result>;
30
30
  UpdateOffers({ id, workspaceId, offerIds, type }: IUpdateOffersDTO.Params): Promise<void>;
31
31
  Metrics({ workSpaceId, platform, productIds, offerIds, filter }: IMetricsDTO.Params): Promise<IMetricsDTO.Result>;
32
+ FunilSummary({ workSpaceId, startDate, endDate, campaigns }: IFunilSummaryDTO.Params): Promise<IFunilSummaryDTO.Result>;
32
33
  }
@@ -240,5 +240,28 @@ class PixelSDK {
240
240
  throw "Erro ao obter métricas";
241
241
  }
242
242
  }
243
+ async FunilSummary({ workSpaceId, startDate, endDate, campaigns }) {
244
+ try {
245
+ const token = {
246
+ appId: this.appId,
247
+ secretToken: this.appToken,
248
+ workSpaceId: workSpaceId,
249
+ };
250
+ const response = await axios_1.default.get(`${this.apiUrl}/pixels/metrics/funil/summary`, {
251
+ headers: { "app-id": token.appId, "app-secret-token": token.secretToken, "work-space-id": token.workSpaceId },
252
+ params: { startDate, endDate, campaigns },
253
+ });
254
+ return response.data;
255
+ }
256
+ catch (error) {
257
+ if (error instanceof axios_1.AxiosError) {
258
+ console.log(error.response?.data);
259
+ }
260
+ else {
261
+ console.log(error);
262
+ }
263
+ throw "Erro ao obter resumo da funil";
264
+ }
265
+ }
243
266
  }
244
267
  exports.PixelSDK = PixelSDK;
@@ -176,6 +176,20 @@ export declare namespace IMetricsDTO {
176
176
  };
177
177
  };
178
178
  }
179
+ export declare namespace IFunilSummaryDTO {
180
+ type Params = {
181
+ workSpaceId: string;
182
+ startDate?: Date;
183
+ endDate?: Date;
184
+ campaigns?: string[];
185
+ };
186
+ type Result = {
187
+ data: {
188
+ type: string;
189
+ _count: number;
190
+ }[];
191
+ };
192
+ }
179
193
  export interface IPixelSdk {
180
194
  Create(params: ICreatePixelDTO.Params): Promise<ICreatePixelDTO.Result>;
181
195
  Update(params: IUpdatePixelDTO.Params): Promise<void>;
@@ -184,5 +198,6 @@ export interface IPixelSdk {
184
198
  GetOne(params: IGetOnePixelDTO.Params): Promise<IGetOnePixelDTO.Result>;
185
199
  UpdateOffers(params: IUpdateOffersDTO.Params): Promise<void>;
186
200
  Metrics(params: IMetricsDTO.Params): Promise<IMetricsDTO.Result>;
201
+ FunilSummary(params: IFunilSummaryDTO.Params): Promise<IFunilSummaryDTO.Result>;
187
202
  }
188
203
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenus-io/pixel-backend-sdk",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "SDK para envio de vendas para fila AWS SQS do micro-serviço de pixels",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",