@agenus-io/pixel-backend-sdk 1.1.12 → 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.
- package/dist/Class/index.d.ts +4 -1
- package/dist/Class/index.js +39 -0
- package/dist/Class/interface.d.ts +106 -0
- package/package.json +1 -1
package/dist/Class/index.d.ts
CHANGED
|
@@ -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, ISessionsOnlineDTO } 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
|
|
@@ -43,4 +45,5 @@ export declare class PixelSDK implements IPixelSdk {
|
|
|
43
45
|
TrafficDevice({ workSpaceId, startDate, endDate, pixelId }: ITrafficDeviceDTO.Params): Promise<ITrafficDeviceDTO.Result>;
|
|
44
46
|
TrafficSource({ workSpaceId, startDate, endDate, pixelId }: ITrafficSourceDTO.Params): Promise<ITrafficSourceDTO.Result>;
|
|
45
47
|
EventGet({ workSpaceId, startDate, endDate, pixelId, type, category }: IEventGetDTO.Params): Promise<IEventGetDTO.Result>;
|
|
48
|
+
SessionsOnline({ workSpaceId, pixelId, aid }: ISessionsOnlineDTO.Params): Promise<ISessionsOnlineDTO.Result>;
|
|
46
49
|
}
|
package/dist/Class/index.js
CHANGED
|
@@ -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
|
|
@@ -562,5 +578,28 @@ class PixelSDK {
|
|
|
562
578
|
throw "Erro ao obter eventos";
|
|
563
579
|
}
|
|
564
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
|
+
}
|
|
565
604
|
}
|
|
566
605
|
exports.PixelSDK = PixelSDK;
|
|
@@ -522,6 +522,109 @@ 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
|
+
}
|
|
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
|
+
}
|
|
525
628
|
export interface IPixelSdk {
|
|
526
629
|
Create(params: ICreatePixelDTO.Params): Promise<ICreatePixelDTO.Result>;
|
|
527
630
|
Update(params: IUpdatePixelDTO.Params): Promise<void>;
|
|
@@ -544,5 +647,8 @@ export interface IPixelSdk {
|
|
|
544
647
|
TrafficDevice(params: ITrafficDeviceDTO.Params): Promise<ITrafficDeviceDTO.Result>;
|
|
545
648
|
TrafficSource(params: ITrafficSourceDTO.Params): Promise<ITrafficSourceDTO.Result>;
|
|
546
649
|
EventGet(params: IEventGetDTO.Params): Promise<IEventGetDTO.Result>;
|
|
650
|
+
EventSend(params: IEventSendDTO.Params): Promise<void>;
|
|
651
|
+
EventBatchSend(params: IEventBatchSendDTO.Params): Promise<void>;
|
|
652
|
+
SessionsOnline(params: ISessionsOnlineDTO.Params): Promise<ISessionsOnlineDTO.Result>;
|
|
547
653
|
}
|
|
548
654
|
export {};
|