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

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, ICheckoutLiveConnectionDTO } from './interface';
3
3
  /**
4
4
  * Classe responsável por com vendas e pixels
5
5
  */
@@ -45,4 +45,6 @@ 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>;
49
+ CheckoutLiveConnection({ aid }: ICheckoutLiveConnectionDTO.Params): Promise<void>;
48
50
  }
@@ -578,5 +578,49 @@ 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
+ }
604
+ async CheckoutLiveConnection({ aid }) {
605
+ try {
606
+ const token = {
607
+ appId: this.appId,
608
+ secretToken: this.appToken,
609
+ };
610
+ await axios_1.default.post(`${this.apiUrl}/checkout-live/connect`, {
611
+ headers: { "app-id": token.appId, "app-secret-token": token.secretToken },
612
+ body: { aid },
613
+ });
614
+ }
615
+ catch (error) {
616
+ if (error instanceof axios_1.AxiosError) {
617
+ console.log(error.response?.data);
618
+ }
619
+ else {
620
+ console.log(error);
621
+ }
622
+ throw "Erro ao conectar ao checkout live";
623
+ }
624
+ }
581
625
  }
582
626
  exports.PixelSDK = PixelSDK;
@@ -602,6 +602,34 @@ 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
+ }
628
+ export declare namespace ICheckoutLiveConnectionDTO {
629
+ type Params = {
630
+ aid: string;
631
+ };
632
+ }
605
633
  export interface IPixelSdk {
606
634
  Create(params: ICreatePixelDTO.Params): Promise<ICreatePixelDTO.Result>;
607
635
  Update(params: IUpdatePixelDTO.Params): Promise<void>;
@@ -626,5 +654,7 @@ export interface IPixelSdk {
626
654
  EventGet(params: IEventGetDTO.Params): Promise<IEventGetDTO.Result>;
627
655
  EventSend(params: IEventSendDTO.Params): Promise<void>;
628
656
  EventBatchSend(params: IEventBatchSendDTO.Params): Promise<void>;
657
+ SessionsOnline(params: ISessionsOnlineDTO.Params): Promise<ISessionsOnlineDTO.Result>;
658
+ CheckoutLiveConnection(params: ICheckoutLiveConnectionDTO.Params): Promise<void>;
629
659
  }
630
660
  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.15",
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",