@agenus-io/pixel-backend-sdk 1.1.7 → 1.1.8
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 +2 -1
- package/dist/Class/index.js +23 -0
- package/dist/Class/interface.d.ts +141 -1
- 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 } 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 } from './interface';
|
|
3
3
|
/**
|
|
4
4
|
* Classe responsável por com vendas e pixels
|
|
5
5
|
*/
|
|
@@ -42,4 +42,5 @@ export declare class PixelSDK implements IPixelSdk {
|
|
|
42
42
|
VisitorsGraph({ workSpaceId, startDate, endDate, pixelId }: IVisitorsGraphDTO.Params): Promise<IVisitorsGraphDTO.Result>;
|
|
43
43
|
TrafficDevice({ workSpaceId, startDate, endDate, pixelId }: ITrafficDeviceDTO.Params): Promise<ITrafficDeviceDTO.Result>;
|
|
44
44
|
TrafficSource({ workSpaceId, startDate, endDate, pixelId }: ITrafficSourceDTO.Params): Promise<ITrafficSourceDTO.Result>;
|
|
45
|
+
EventGet({ workSpaceId, startDate, endDate, pixelId, type, category }: IEventGetDTO.Params): Promise<IEventGetDTO.Result>;
|
|
45
46
|
}
|
package/dist/Class/index.js
CHANGED
|
@@ -539,5 +539,28 @@ class PixelSDK {
|
|
|
539
539
|
throw "Erro ao obter dispositivos de tráfego";
|
|
540
540
|
}
|
|
541
541
|
}
|
|
542
|
+
async EventGet({ workSpaceId, startDate, endDate, pixelId, type, category }) {
|
|
543
|
+
try {
|
|
544
|
+
const token = {
|
|
545
|
+
appId: this.appId,
|
|
546
|
+
secretToken: this.appToken,
|
|
547
|
+
workSpaceId: workSpaceId,
|
|
548
|
+
};
|
|
549
|
+
const response = await axios_1.default.get(`${this.apiUrl}/events`, {
|
|
550
|
+
headers: { "app-id": token.appId, "app-secret-token": token.secretToken, "work-space-id": token.workSpaceId },
|
|
551
|
+
params: { startDate, endDate, pixelId, type, category },
|
|
552
|
+
});
|
|
553
|
+
return response.data;
|
|
554
|
+
}
|
|
555
|
+
catch (error) {
|
|
556
|
+
if (error instanceof axios_1.AxiosError) {
|
|
557
|
+
console.log(error.response?.data);
|
|
558
|
+
}
|
|
559
|
+
else {
|
|
560
|
+
console.log(error);
|
|
561
|
+
}
|
|
562
|
+
throw "Erro ao obter eventos";
|
|
563
|
+
}
|
|
564
|
+
}
|
|
542
565
|
}
|
|
543
566
|
exports.PixelSDK = PixelSDK;
|
|
@@ -259,8 +259,134 @@ export declare namespace IEventsPerProjectDTO {
|
|
|
259
259
|
startDate: Date;
|
|
260
260
|
endDate: Date;
|
|
261
261
|
};
|
|
262
|
+
type PaginationMeta = {
|
|
263
|
+
total: number;
|
|
264
|
+
totalPages: number;
|
|
265
|
+
page: number;
|
|
266
|
+
pageSize: number;
|
|
267
|
+
};
|
|
268
|
+
type DeviceOs = {
|
|
269
|
+
name: string;
|
|
270
|
+
version: string;
|
|
271
|
+
};
|
|
272
|
+
type DeviceEngine = {
|
|
273
|
+
name: string;
|
|
274
|
+
version: string;
|
|
275
|
+
};
|
|
276
|
+
type DeviceScreen = {
|
|
277
|
+
width: number;
|
|
278
|
+
height: number;
|
|
279
|
+
pixel_ratio: number;
|
|
280
|
+
};
|
|
281
|
+
type DeviceBrowser = {
|
|
282
|
+
name: string;
|
|
283
|
+
version: string;
|
|
284
|
+
};
|
|
285
|
+
type EventDevice = {
|
|
286
|
+
id: string;
|
|
287
|
+
os: DeviceOs;
|
|
288
|
+
type: string;
|
|
289
|
+
engine: DeviceEngine;
|
|
290
|
+
screen: DeviceScreen;
|
|
291
|
+
browser: DeviceBrowser;
|
|
292
|
+
language: string;
|
|
293
|
+
userAgent: string;
|
|
294
|
+
};
|
|
295
|
+
type EventScriptMeta = {
|
|
296
|
+
pageId: string;
|
|
297
|
+
version: string;
|
|
298
|
+
projectId: string;
|
|
299
|
+
script_url: string;
|
|
300
|
+
environment: string;
|
|
301
|
+
pixel_source: string;
|
|
302
|
+
};
|
|
303
|
+
type BehaviorSnapshot = {
|
|
304
|
+
state: {
|
|
305
|
+
isIdle: boolean;
|
|
306
|
+
isActive: boolean;
|
|
307
|
+
isVisible: boolean;
|
|
308
|
+
};
|
|
309
|
+
pageId: string;
|
|
310
|
+
scroll: {
|
|
311
|
+
maxDepth: number;
|
|
312
|
+
};
|
|
313
|
+
timing: {
|
|
314
|
+
idleTime: number;
|
|
315
|
+
activeTime: number;
|
|
316
|
+
visibleTime: number;
|
|
317
|
+
};
|
|
318
|
+
sessionId: string;
|
|
319
|
+
timestamp: number;
|
|
320
|
+
visitorId: string;
|
|
321
|
+
engagement: {
|
|
322
|
+
level: string;
|
|
323
|
+
score: number;
|
|
324
|
+
};
|
|
325
|
+
interaction: {
|
|
326
|
+
clicks: number;
|
|
327
|
+
keypresses: number;
|
|
328
|
+
mouseMovements: number;
|
|
329
|
+
};
|
|
330
|
+
};
|
|
331
|
+
type BehaviorCriticalEvent = {
|
|
332
|
+
type: string;
|
|
333
|
+
pageId: string;
|
|
334
|
+
sessionId: string;
|
|
335
|
+
timestamp: number;
|
|
336
|
+
visitorId: string;
|
|
337
|
+
};
|
|
338
|
+
type BehaviorSummaryData = {
|
|
339
|
+
path: string;
|
|
340
|
+
hostname: string;
|
|
341
|
+
page_url: string;
|
|
342
|
+
sessionId: string;
|
|
343
|
+
timestamp: number;
|
|
344
|
+
visitorId: string;
|
|
345
|
+
behaviorSnapshots: BehaviorSnapshot[];
|
|
346
|
+
behaviorCriticalEvents: BehaviorCriticalEvent[];
|
|
347
|
+
};
|
|
348
|
+
type UserIdleData = {
|
|
349
|
+
path: string;
|
|
350
|
+
hostname: string;
|
|
351
|
+
page_url: string;
|
|
352
|
+
active_ms: number;
|
|
353
|
+
timestamp: number;
|
|
354
|
+
idle_threshold_ms: number;
|
|
355
|
+
};
|
|
356
|
+
type EventPayload = BehaviorSummaryData | UserIdleData | Record<string, unknown>;
|
|
357
|
+
type EventItem = {
|
|
358
|
+
id: string;
|
|
359
|
+
eventId: string;
|
|
360
|
+
sent: boolean;
|
|
361
|
+
errorType: string;
|
|
362
|
+
errorMessage: string | null;
|
|
363
|
+
sessionId: string;
|
|
364
|
+
currency: string | null;
|
|
365
|
+
type: string;
|
|
366
|
+
category: string;
|
|
367
|
+
timestamp: string;
|
|
368
|
+
fingerprint: string;
|
|
369
|
+
ip: string;
|
|
370
|
+
userAgent: string;
|
|
371
|
+
device: EventDevice;
|
|
372
|
+
data: EventPayload;
|
|
373
|
+
meta: EventScriptMeta;
|
|
374
|
+
pixelId: string;
|
|
375
|
+
createdAt: string;
|
|
376
|
+
updatedAt: string;
|
|
377
|
+
visitorId: string;
|
|
378
|
+
utms: unknown;
|
|
379
|
+
utmSource: string | null;
|
|
380
|
+
utmMedium: string | null;
|
|
381
|
+
utmCampaign: string | null;
|
|
382
|
+
utmContent: string | null;
|
|
383
|
+
utmTerm: string | null;
|
|
384
|
+
pageusProjectId: string | null;
|
|
385
|
+
pageusPageId: string | null;
|
|
386
|
+
};
|
|
262
387
|
type Result = {
|
|
263
|
-
data:
|
|
388
|
+
data: EventItem[];
|
|
389
|
+
meta: PaginationMeta;
|
|
264
390
|
};
|
|
265
391
|
}
|
|
266
392
|
export declare namespace ISummaryDTO {
|
|
@@ -375,6 +501,19 @@ export declare namespace ITrafficSourceDTO {
|
|
|
375
501
|
utmSource: string;
|
|
376
502
|
}[];
|
|
377
503
|
}
|
|
504
|
+
export declare namespace IEventGetDTO {
|
|
505
|
+
type Params = {
|
|
506
|
+
workSpaceId: string;
|
|
507
|
+
startDate?: Date;
|
|
508
|
+
endDate?: Date;
|
|
509
|
+
pixelId?: string;
|
|
510
|
+
type?: string[];
|
|
511
|
+
category?: string[];
|
|
512
|
+
};
|
|
513
|
+
type Result = {
|
|
514
|
+
data: Record<string, number>;
|
|
515
|
+
};
|
|
516
|
+
}
|
|
378
517
|
export interface IPixelSdk {
|
|
379
518
|
Create(params: ICreatePixelDTO.Params): Promise<ICreatePixelDTO.Result>;
|
|
380
519
|
Update(params: IUpdatePixelDTO.Params): Promise<void>;
|
|
@@ -396,5 +535,6 @@ export interface IPixelSdk {
|
|
|
396
535
|
VisitorsGraph(params: IVisitorsGraphDTO.Params): Promise<IVisitorsGraphDTO.Result>;
|
|
397
536
|
TrafficDevice(params: ITrafficDeviceDTO.Params): Promise<ITrafficDeviceDTO.Result>;
|
|
398
537
|
TrafficSource(params: ITrafficSourceDTO.Params): Promise<ITrafficSourceDTO.Result>;
|
|
538
|
+
EventGet(params: IEventGetDTO.Params): Promise<IEventGetDTO.Result>;
|
|
399
539
|
}
|
|
400
540
|
export {};
|