@agenus-io/pixel-backend-sdk 1.1.14 → 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, ISessionsOnlineDTO } 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
  */
@@ -46,4 +46,5 @@ export declare class PixelSDK implements IPixelSdk {
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
48
  SessionsOnline({ workSpaceId, pixelId, aid }: ISessionsOnlineDTO.Params): Promise<ISessionsOnlineDTO.Result>;
49
+ CheckoutLiveConnection({ aid }: ICheckoutLiveConnectionDTO.Params): Promise<void>;
49
50
  }
@@ -601,5 +601,26 @@ class PixelSDK {
601
601
  throw "Erro ao obter eventos";
602
602
  }
603
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
+ }
604
625
  }
605
626
  exports.PixelSDK = PixelSDK;
@@ -625,6 +625,11 @@ export declare namespace ISessionsOnlineDTO {
625
625
  total: number;
626
626
  };
627
627
  }
628
+ export declare namespace ICheckoutLiveConnectionDTO {
629
+ type Params = {
630
+ aid: string;
631
+ };
632
+ }
628
633
  export interface IPixelSdk {
629
634
  Create(params: ICreatePixelDTO.Params): Promise<ICreatePixelDTO.Result>;
630
635
  Update(params: IUpdatePixelDTO.Params): Promise<void>;
@@ -650,5 +655,6 @@ export interface IPixelSdk {
650
655
  EventSend(params: IEventSendDTO.Params): Promise<void>;
651
656
  EventBatchSend(params: IEventBatchSendDTO.Params): Promise<void>;
652
657
  SessionsOnline(params: ISessionsOnlineDTO.Params): Promise<ISessionsOnlineDTO.Result>;
658
+ CheckoutLiveConnection(params: ICheckoutLiveConnectionDTO.Params): Promise<void>;
653
659
  }
654
660
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenus-io/pixel-backend-sdk",
3
- "version": "1.1.14",
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",