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

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 } 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 } from './interface';
3
3
  /**
4
4
  * Classe responsável por com vendas e pixels
5
5
  */
@@ -16,6 +16,8 @@ export declare class PixelSDK implements IPixelSdk {
16
16
  * @param appToken Token da aplicação
17
17
  */
18
18
  constructor(config: AWSConfig, appId: string, appToken: string, environment?: "production" | "develop");
19
+ EventSend(body: IEventSendDTO.Params): Promise<void>;
20
+ EventBatchSend(body: IEventBatchSendDTO.Params): Promise<void>;
19
21
  /**
20
22
  * Envia uma venda para a fila AWS SQS
21
23
  * @param params Parâmetros contendo os dados da venda
@@ -62,6 +62,22 @@ class PixelSDK {
62
62
  },
63
63
  });
64
64
  }
65
+ async EventSend(body) {
66
+ try {
67
+ await axios_1.default.post(`${this.apiUrl}/pixels/public/event`, body);
68
+ }
69
+ catch (error) {
70
+ throw "Erro ao enviar evento";
71
+ }
72
+ }
73
+ async EventBatchSend(body) {
74
+ try {
75
+ await axios_1.default.post(`${this.apiUrl}/pixels/public/event/batch`, body);
76
+ }
77
+ catch (error) {
78
+ throw "Erro ao enviar evento em lote";
79
+ }
80
+ }
65
81
  /**
66
82
  * Envia uma venda para a fila AWS SQS
67
83
  * @param params Parâmetros contendo os dados da venda
@@ -17,7 +17,7 @@ interface CreatePixel {
17
17
  productIds: string[];
18
18
  offerIds: string[];
19
19
  sendIp: SendIp;
20
- eventDispatch: "NONE" | "QUEUE";
20
+ eventDispatch?: "NONE" | "QUEUE";
21
21
  queueDispatch?: string;
22
22
  meta?: any;
23
23
  pixelMeta?: {
@@ -522,6 +522,86 @@ export declare namespace IEventGetDTO {
522
522
  };
523
523
  };
524
524
  }
525
+ export declare namespace IEventSendDTO {
526
+ type Params = {
527
+ id?: string;
528
+ pixel_code: string;
529
+ session_id: string;
530
+ visitor_id: string;
531
+ identifiers?: {
532
+ fbp?: string | undefined;
533
+ fbc?: string | undefined;
534
+ ga?: string | undefined;
535
+ gcl_au?: string | undefined;
536
+ };
537
+ page?: {
538
+ path?: string | undefined;
539
+ title?: string | undefined;
540
+ url?: string | undefined;
541
+ referrer?: string | undefined;
542
+ hostname?: string | undefined;
543
+ };
544
+ type?: string | undefined;
545
+ category?: string | undefined;
546
+ timestamp?: string | undefined;
547
+ fingerprint?: string | undefined;
548
+ device?: any;
549
+ data?: any;
550
+ currency?: string | undefined;
551
+ customer?: {
552
+ email: string;
553
+ name: string;
554
+ phone: string;
555
+ city: string;
556
+ state: string;
557
+ zipCode: string;
558
+ country: string;
559
+ };
560
+ meta?: any;
561
+ };
562
+ }
563
+ export declare namespace IEventBatchSendDTO {
564
+ type Params = {
565
+ pixel_code: string;
566
+ visitor_id?: string;
567
+ session_id?: string;
568
+ batch_id?: string;
569
+ sent_at?: number;
570
+ meta?: any;
571
+ events: {
572
+ id: string;
573
+ type?: string;
574
+ category?: string;
575
+ timestamp?: string;
576
+ fingerprint?: string;
577
+ identifiers?: {
578
+ fbp?: string;
579
+ fbc?: string;
580
+ ga?: string;
581
+ gcl_au?: string;
582
+ };
583
+ page: {
584
+ url?: string;
585
+ title?: string;
586
+ referrer?: string;
587
+ path?: string;
588
+ hostname?: string;
589
+ };
590
+ device?: any;
591
+ data?: any;
592
+ currency?: string;
593
+ customer?: {
594
+ email?: string;
595
+ name?: string;
596
+ phone?: string;
597
+ city?: string;
598
+ state?: string;
599
+ zipCode?: string;
600
+ country?: string;
601
+ };
602
+ }[];
603
+ };
604
+ }
525
605
  export interface IPixelSdk {
526
606
  Create(params: ICreatePixelDTO.Params): Promise<ICreatePixelDTO.Result>;
527
607
  Update(params: IUpdatePixelDTO.Params): Promise<void>;
@@ -544,5 +624,7 @@ export interface IPixelSdk {
544
624
  TrafficDevice(params: ITrafficDeviceDTO.Params): Promise<ITrafficDeviceDTO.Result>;
545
625
  TrafficSource(params: ITrafficSourceDTO.Params): Promise<ITrafficSourceDTO.Result>;
546
626
  EventGet(params: IEventGetDTO.Params): Promise<IEventGetDTO.Result>;
627
+ EventSend(params: IEventSendDTO.Params): Promise<void>;
628
+ EventBatchSend(params: IEventBatchSendDTO.Params): Promise<void>;
547
629
  }
548
630
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenus-io/pixel-backend-sdk",
3
- "version": "1.1.11",
3
+ "version": "1.1.13",
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",