@agenus-io/pixel-backend-sdk 1.1.13 → 1.1.14

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, IFunilSummaryDTO, IAccessGraphDTO, IEventsSourceDTO, IEventsDeviceDTO, IEventsPerPageDTO, IEventsPerProjectDTO, ISummaryDTO, ISessionsSummaryDTO, ISessionsGraphDTO, IConversionGraphDTO, IVisitorsGraphDTO, ITrafficDeviceDTO, ITrafficSourceDTO, IEventGetDTO, IEventSendDTO, IEventBatchSendDTO } from './interface';
2
+ import { ICreatePixelDTO, IGetOnePixelDTO, IGetPixelDTO, IDeletePixelDTO, IUpdatePixelDTO, IPixelSdk, IUpdateOffersDTO, IMetricsDTO, IFunilSummaryDTO, IAccessGraphDTO, IEventsSourceDTO, IEventsDeviceDTO, IEventsPerPageDTO, IEventsPerProjectDTO, ISummaryDTO, ISessionsSummaryDTO, ISessionsGraphDTO, IConversionGraphDTO, IVisitorsGraphDTO, ITrafficDeviceDTO, ITrafficSourceDTO, IEventGetDTO, IEventSendDTO, IEventBatchSendDTO, ISessionsOnlineDTO } from './interface';
3
3
  /**
4
4
  * Classe responsável por com vendas e pixels
5
5
  */
@@ -45,4 +45,5 @@ export declare class PixelSDK implements IPixelSdk {
45
45
  TrafficDevice({ workSpaceId, startDate, endDate, pixelId }: ITrafficDeviceDTO.Params): Promise<ITrafficDeviceDTO.Result>;
46
46
  TrafficSource({ workSpaceId, startDate, endDate, pixelId }: ITrafficSourceDTO.Params): Promise<ITrafficSourceDTO.Result>;
47
47
  EventGet({ workSpaceId, startDate, endDate, pixelId, type, category }: IEventGetDTO.Params): Promise<IEventGetDTO.Result>;
48
+ SessionsOnline({ workSpaceId, pixelId, aid }: ISessionsOnlineDTO.Params): Promise<ISessionsOnlineDTO.Result>;
48
49
  }
@@ -578,5 +578,28 @@ class PixelSDK {
578
578
  throw "Erro ao obter eventos";
579
579
  }
580
580
  }
581
+ async SessionsOnline({ workSpaceId, pixelId, aid }) {
582
+ try {
583
+ const token = {
584
+ appId: this.appId,
585
+ secretToken: this.appToken,
586
+ workSpaceId: workSpaceId,
587
+ };
588
+ const response = await axios_1.default.get(`${this.apiUrl}/pixels/sessions/online`, {
589
+ headers: { "app-id": token.appId, "app-secret-token": token.secretToken, "work-space-id": token.workSpaceId },
590
+ params: { pixelId, aid },
591
+ });
592
+ return response.data;
593
+ }
594
+ catch (error) {
595
+ if (error instanceof axios_1.AxiosError) {
596
+ console.log(error.response?.data);
597
+ }
598
+ else {
599
+ console.log(error);
600
+ }
601
+ throw "Erro ao obter eventos";
602
+ }
603
+ }
581
604
  }
582
605
  exports.PixelSDK = PixelSDK;
@@ -602,6 +602,29 @@ export declare namespace IEventBatchSendDTO {
602
602
  }[];
603
603
  };
604
604
  }
605
+ export declare namespace ISessionsOnlineDTO {
606
+ type Params = {
607
+ workSpaceId: string;
608
+ pixelId: string;
609
+ aid?: string;
610
+ };
611
+ type Result = {
612
+ data: {
613
+ id: string;
614
+ externalId: string;
615
+ aid: string;
616
+ geo: {
617
+ lat: number;
618
+ lng: number;
619
+ city: string;
620
+ region: string;
621
+ country: string;
622
+ timezone: string;
623
+ } | null;
624
+ }[];
625
+ total: number;
626
+ };
627
+ }
605
628
  export interface IPixelSdk {
606
629
  Create(params: ICreatePixelDTO.Params): Promise<ICreatePixelDTO.Result>;
607
630
  Update(params: IUpdatePixelDTO.Params): Promise<void>;
@@ -626,5 +649,6 @@ export interface IPixelSdk {
626
649
  EventGet(params: IEventGetDTO.Params): Promise<IEventGetDTO.Result>;
627
650
  EventSend(params: IEventSendDTO.Params): Promise<void>;
628
651
  EventBatchSend(params: IEventBatchSendDTO.Params): Promise<void>;
652
+ SessionsOnline(params: ISessionsOnlineDTO.Params): Promise<ISessionsOnlineDTO.Result>;
629
653
  }
630
654
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenus-io/pixel-backend-sdk",
3
- "version": "1.1.13",
3
+ "version": "1.1.14",
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",