@agenus-io/pixel-backend-sdk 1.1.6 → 1.1.7
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 +7 -1
- package/dist/Class/index.js +138 -0
- package/dist/Class/interface.d.ts +101 -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 } 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 } from './interface';
|
|
3
3
|
/**
|
|
4
4
|
* Classe responsável por com vendas e pixels
|
|
5
5
|
*/
|
|
@@ -36,4 +36,10 @@ export declare class PixelSDK implements IPixelSdk {
|
|
|
36
36
|
EventsPerPage({ workSpaceId, startDate, endDate }: IEventsPerPageDTO.Params): Promise<IEventsPerPageDTO.Result>;
|
|
37
37
|
EventsPerProject({ workSpaceId, startDate, endDate }: IEventsPerProjectDTO.Params): Promise<IEventsPerProjectDTO.Result>;
|
|
38
38
|
Summary({ workSpaceId, startDate, endDate, projectId, pageId }: ISummaryDTO.Params): Promise<ISummaryDTO.Result>;
|
|
39
|
+
SessionsSummary({ workSpaceId, startDate, endDate, pixelId }: ISessionsSummaryDTO.Params): Promise<ISessionsSummaryDTO.Result>;
|
|
40
|
+
SessionsGraph({ workSpaceId, startDate, endDate }: ISessionsGraphDTO.Params): Promise<ISessionsGraphDTO.Result>;
|
|
41
|
+
ConversionGraph({ workSpaceId, startDate, endDate, pixelId }: IConversionGraphDTO.Params): Promise<IConversionGraphDTO.Result>;
|
|
42
|
+
VisitorsGraph({ workSpaceId, startDate, endDate, pixelId }: IVisitorsGraphDTO.Params): Promise<IVisitorsGraphDTO.Result>;
|
|
43
|
+
TrafficDevice({ workSpaceId, startDate, endDate, pixelId }: ITrafficDeviceDTO.Params): Promise<ITrafficDeviceDTO.Result>;
|
|
44
|
+
TrafficSource({ workSpaceId, startDate, endDate, pixelId }: ITrafficSourceDTO.Params): Promise<ITrafficSourceDTO.Result>;
|
|
39
45
|
}
|
package/dist/Class/index.js
CHANGED
|
@@ -401,5 +401,143 @@ class PixelSDK {
|
|
|
401
401
|
throw "Erro ao obter resumo de eventos";
|
|
402
402
|
}
|
|
403
403
|
}
|
|
404
|
+
async SessionsSummary({ workSpaceId, startDate, endDate, pixelId }) {
|
|
405
|
+
try {
|
|
406
|
+
const token = {
|
|
407
|
+
appId: this.appId,
|
|
408
|
+
secretToken: this.appToken,
|
|
409
|
+
workSpaceId: workSpaceId,
|
|
410
|
+
};
|
|
411
|
+
const response = await axios_1.default.get(`${this.apiUrl}/metrics/sessions/summary`, {
|
|
412
|
+
headers: { "app-id": token.appId, "app-secret-token": token.secretToken, "work-space-id": token.workSpaceId },
|
|
413
|
+
params: { startDate, endDate, pixelId },
|
|
414
|
+
});
|
|
415
|
+
return response.data;
|
|
416
|
+
}
|
|
417
|
+
catch (error) {
|
|
418
|
+
if (error instanceof axios_1.AxiosError) {
|
|
419
|
+
console.log(error.response?.data);
|
|
420
|
+
}
|
|
421
|
+
else {
|
|
422
|
+
console.log(error);
|
|
423
|
+
}
|
|
424
|
+
throw "Erro ao obter resumo de sessões";
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
async SessionsGraph({ workSpaceId, startDate, endDate }) {
|
|
428
|
+
try {
|
|
429
|
+
const token = {
|
|
430
|
+
appId: this.appId,
|
|
431
|
+
secretToken: this.appToken,
|
|
432
|
+
workSpaceId: workSpaceId,
|
|
433
|
+
};
|
|
434
|
+
const response = await axios_1.default.get(`${this.apiUrl}/metrics/sessions/graph`, {
|
|
435
|
+
headers: { "app-id": token.appId, "app-secret-token": token.secretToken, "work-space-id": token.workSpaceId },
|
|
436
|
+
params: { startDate, endDate },
|
|
437
|
+
});
|
|
438
|
+
return response.data;
|
|
439
|
+
}
|
|
440
|
+
catch (error) {
|
|
441
|
+
if (error instanceof axios_1.AxiosError) {
|
|
442
|
+
console.log(error.response?.data);
|
|
443
|
+
}
|
|
444
|
+
else {
|
|
445
|
+
console.log(error);
|
|
446
|
+
}
|
|
447
|
+
throw "Erro ao obter gráfico de sessões";
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
async ConversionGraph({ workSpaceId, startDate, endDate, pixelId }) {
|
|
451
|
+
try {
|
|
452
|
+
const token = {
|
|
453
|
+
appId: this.appId,
|
|
454
|
+
secretToken: this.appToken,
|
|
455
|
+
workSpaceId: workSpaceId,
|
|
456
|
+
};
|
|
457
|
+
const response = await axios_1.default.get(`${this.apiUrl}/metrics/sessions/conversion-graph`, {
|
|
458
|
+
headers: { "app-id": token.appId, "app-secret-token": token.secretToken, "work-space-id": token.workSpaceId },
|
|
459
|
+
params: { startDate, endDate, pixelId },
|
|
460
|
+
});
|
|
461
|
+
return response.data;
|
|
462
|
+
}
|
|
463
|
+
catch (error) {
|
|
464
|
+
if (error instanceof axios_1.AxiosError) {
|
|
465
|
+
console.log(error.response?.data);
|
|
466
|
+
}
|
|
467
|
+
else {
|
|
468
|
+
console.log(error);
|
|
469
|
+
}
|
|
470
|
+
throw "Erro ao obter gráfico de conversões";
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
async VisitorsGraph({ workSpaceId, startDate, endDate, pixelId }) {
|
|
474
|
+
try {
|
|
475
|
+
const token = {
|
|
476
|
+
appId: this.appId,
|
|
477
|
+
secretToken: this.appToken,
|
|
478
|
+
workSpaceId: workSpaceId,
|
|
479
|
+
};
|
|
480
|
+
const response = await axios_1.default.get(`${this.apiUrl}/metrics/visitors/graph`, {
|
|
481
|
+
headers: { "app-id": token.appId, "app-secret-token": token.secretToken, "work-space-id": token.workSpaceId },
|
|
482
|
+
params: { startDate, endDate, pixelId },
|
|
483
|
+
});
|
|
484
|
+
return response.data;
|
|
485
|
+
}
|
|
486
|
+
catch (error) {
|
|
487
|
+
if (error instanceof axios_1.AxiosError) {
|
|
488
|
+
console.log(error.response?.data);
|
|
489
|
+
}
|
|
490
|
+
else {
|
|
491
|
+
console.log(error);
|
|
492
|
+
}
|
|
493
|
+
throw "Erro ao obter gráfico de visitantes";
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
async TrafficDevice({ workSpaceId, startDate, endDate, pixelId }) {
|
|
497
|
+
try {
|
|
498
|
+
const token = {
|
|
499
|
+
appId: this.appId,
|
|
500
|
+
secretToken: this.appToken,
|
|
501
|
+
workSpaceId: workSpaceId,
|
|
502
|
+
};
|
|
503
|
+
const response = await axios_1.default.get(`${this.apiUrl}/metrics/visitors/traffic-device`, {
|
|
504
|
+
headers: { "app-id": token.appId, "app-secret-token": token.secretToken, "work-space-id": token.workSpaceId },
|
|
505
|
+
params: { startDate, endDate, pixelId },
|
|
506
|
+
});
|
|
507
|
+
return response.data;
|
|
508
|
+
}
|
|
509
|
+
catch (error) {
|
|
510
|
+
if (error instanceof axios_1.AxiosError) {
|
|
511
|
+
console.log(error.response?.data);
|
|
512
|
+
}
|
|
513
|
+
else {
|
|
514
|
+
console.log(error);
|
|
515
|
+
}
|
|
516
|
+
throw "Erro ao obter dispositivos de tráfego";
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
async TrafficSource({ workSpaceId, startDate, endDate, pixelId }) {
|
|
520
|
+
try {
|
|
521
|
+
const token = {
|
|
522
|
+
appId: this.appId,
|
|
523
|
+
secretToken: this.appToken,
|
|
524
|
+
workSpaceId: workSpaceId,
|
|
525
|
+
};
|
|
526
|
+
const response = await axios_1.default.get(`${this.apiUrl}/metrics/visitors/traffic-source`, {
|
|
527
|
+
headers: { "app-id": token.appId, "app-secret-token": token.secretToken, "work-space-id": token.workSpaceId },
|
|
528
|
+
params: { startDate, endDate, pixelId },
|
|
529
|
+
});
|
|
530
|
+
return response.data;
|
|
531
|
+
}
|
|
532
|
+
catch (error) {
|
|
533
|
+
if (error instanceof axios_1.AxiosError) {
|
|
534
|
+
console.log(error.response?.data);
|
|
535
|
+
}
|
|
536
|
+
else {
|
|
537
|
+
console.log(error);
|
|
538
|
+
}
|
|
539
|
+
throw "Erro ao obter dispositivos de tráfego";
|
|
540
|
+
}
|
|
541
|
+
}
|
|
404
542
|
}
|
|
405
543
|
exports.PixelSDK = PixelSDK;
|
|
@@ -280,6 +280,101 @@ export declare namespace ISummaryDTO {
|
|
|
280
280
|
engagementRate: number;
|
|
281
281
|
};
|
|
282
282
|
}
|
|
283
|
+
export declare namespace ISessionsSummaryDTO {
|
|
284
|
+
type Params = {
|
|
285
|
+
workSpaceId: string;
|
|
286
|
+
startDate?: Date;
|
|
287
|
+
endDate?: Date;
|
|
288
|
+
pixelId?: string;
|
|
289
|
+
};
|
|
290
|
+
type Result = {
|
|
291
|
+
totalSessions: number;
|
|
292
|
+
uniqueUsers: number;
|
|
293
|
+
averageTimeSession: number;
|
|
294
|
+
conversionRate: string;
|
|
295
|
+
dataSessionsEngagement: number;
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
export declare namespace ISessionsGraphDTO {
|
|
299
|
+
type Params = {
|
|
300
|
+
workSpaceId: string;
|
|
301
|
+
startDate?: Date;
|
|
302
|
+
endDate?: Date;
|
|
303
|
+
pixelId?: string;
|
|
304
|
+
};
|
|
305
|
+
type Result = {
|
|
306
|
+
graph: {
|
|
307
|
+
sessions: number;
|
|
308
|
+
date: string;
|
|
309
|
+
}[];
|
|
310
|
+
percentageEvolution: number;
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
export declare namespace IConversionGraphDTO {
|
|
314
|
+
type Params = {
|
|
315
|
+
workSpaceId: string;
|
|
316
|
+
startDate?: Date;
|
|
317
|
+
endDate?: Date;
|
|
318
|
+
pixelId?: string;
|
|
319
|
+
};
|
|
320
|
+
type Result = {
|
|
321
|
+
graph: {
|
|
322
|
+
conversions: number;
|
|
323
|
+
sessions: number;
|
|
324
|
+
date: string;
|
|
325
|
+
}[];
|
|
326
|
+
percentageEvolution: number;
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
export declare namespace IVisitorsGraphDTO {
|
|
330
|
+
type Params = {
|
|
331
|
+
workSpaceId: string;
|
|
332
|
+
startDate?: Date;
|
|
333
|
+
endDate?: Date;
|
|
334
|
+
pixelId?: string;
|
|
335
|
+
};
|
|
336
|
+
type Result = {
|
|
337
|
+
graph: {
|
|
338
|
+
date: string;
|
|
339
|
+
visitors: number;
|
|
340
|
+
}[];
|
|
341
|
+
percentageEvolution: number;
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
export declare namespace ITrafficDeviceDTO {
|
|
345
|
+
type Params = {
|
|
346
|
+
workSpaceId: string;
|
|
347
|
+
startDate?: Date;
|
|
348
|
+
endDate?: Date;
|
|
349
|
+
pixelId?: string;
|
|
350
|
+
};
|
|
351
|
+
type Result = {
|
|
352
|
+
os: {
|
|
353
|
+
_count: number;
|
|
354
|
+
os: string;
|
|
355
|
+
}[];
|
|
356
|
+
browser: {
|
|
357
|
+
_count: number;
|
|
358
|
+
browser: string;
|
|
359
|
+
}[];
|
|
360
|
+
type: {
|
|
361
|
+
_count: number;
|
|
362
|
+
type: string;
|
|
363
|
+
}[];
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
export declare namespace ITrafficSourceDTO {
|
|
367
|
+
type Params = {
|
|
368
|
+
workSpaceId: string;
|
|
369
|
+
startDate?: Date;
|
|
370
|
+
endDate?: Date;
|
|
371
|
+
pixelId?: string;
|
|
372
|
+
};
|
|
373
|
+
type Result = {
|
|
374
|
+
_count: number;
|
|
375
|
+
utmSource: string;
|
|
376
|
+
}[];
|
|
377
|
+
}
|
|
283
378
|
export interface IPixelSdk {
|
|
284
379
|
Create(params: ICreatePixelDTO.Params): Promise<ICreatePixelDTO.Result>;
|
|
285
380
|
Update(params: IUpdatePixelDTO.Params): Promise<void>;
|
|
@@ -295,5 +390,11 @@ export interface IPixelSdk {
|
|
|
295
390
|
EventsPerPage(params: IEventsPerPageDTO.Params): Promise<IEventsPerPageDTO.Result>;
|
|
296
391
|
EventsPerProject(params: IEventsPerProjectDTO.Params): Promise<IEventsPerProjectDTO.Result>;
|
|
297
392
|
Summary(params: ISummaryDTO.Params): Promise<ISummaryDTO.Result>;
|
|
393
|
+
SessionsSummary(params: ISessionsSummaryDTO.Params): Promise<ISessionsSummaryDTO.Result>;
|
|
394
|
+
SessionsGraph(params: ISessionsGraphDTO.Params): Promise<ISessionsGraphDTO.Result>;
|
|
395
|
+
ConversionGraph(params: IConversionGraphDTO.Params): Promise<IConversionGraphDTO.Result>;
|
|
396
|
+
VisitorsGraph(params: IVisitorsGraphDTO.Params): Promise<IVisitorsGraphDTO.Result>;
|
|
397
|
+
TrafficDevice(params: ITrafficDeviceDTO.Params): Promise<ITrafficDeviceDTO.Result>;
|
|
398
|
+
TrafficSource(params: ITrafficSourceDTO.Params): Promise<ITrafficSourceDTO.Result>;
|
|
298
399
|
}
|
|
299
400
|
export {};
|