@xylabs/pixel 4.13.4 → 4.13.5
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/browser/index.d.ts +168 -168
- package/package.json +7 -7
package/dist/browser/index.d.ts
CHANGED
|
@@ -1,168 +1,168 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { EmptyObject } from '@xylabs/object';
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
constructor();
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
name: string;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
fields
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
exids?:
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
export { }
|
|
1
|
+
import Bowser from 'bowser';
|
|
2
|
+
import { JsonObject, EmptyObject } from '@xylabs/object';
|
|
3
|
+
import { Promisable } from '@xylabs/promise';
|
|
4
|
+
|
|
5
|
+
interface ExIds {
|
|
6
|
+
fbc?: string;
|
|
7
|
+
fbp?: string;
|
|
8
|
+
ga?: string;
|
|
9
|
+
gclid?: string;
|
|
10
|
+
rdt_uid?: string;
|
|
11
|
+
scid?: string;
|
|
12
|
+
tt_sessionId?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
type UserEventSystem = Bowser.Parser.ParsedResult;
|
|
16
|
+
|
|
17
|
+
interface UserEvent {
|
|
18
|
+
cid: string;
|
|
19
|
+
create_time?: number;
|
|
20
|
+
email?: string;
|
|
21
|
+
email_hash?: string;
|
|
22
|
+
event?: string;
|
|
23
|
+
event_id?: string;
|
|
24
|
+
exids?: ExIds;
|
|
25
|
+
fields?: Record<string, unknown>;
|
|
26
|
+
host?: string;
|
|
27
|
+
pathname?: string;
|
|
28
|
+
pixel?: string;
|
|
29
|
+
receive_time?: number;
|
|
30
|
+
referrer?: {
|
|
31
|
+
local: string;
|
|
32
|
+
session: string;
|
|
33
|
+
};
|
|
34
|
+
rid?: string;
|
|
35
|
+
system?: UserEventSystem;
|
|
36
|
+
uid?: string;
|
|
37
|
+
utm?: Record<string, string>[] | Record<string, string[]>;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
declare class PixelApi {
|
|
41
|
+
private endPoint;
|
|
42
|
+
constructor(baseUri?: string);
|
|
43
|
+
trackEvents(events: UserEvent[]): Promise<any>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
interface CommonFields {
|
|
47
|
+
funnel?: string;
|
|
48
|
+
testData?: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
interface FunnelStartedFields extends CommonFields {
|
|
52
|
+
name: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
declare class XyPixel {
|
|
56
|
+
static api: PixelApi;
|
|
57
|
+
private static _instance?;
|
|
58
|
+
private static utmFieldsObj;
|
|
59
|
+
cid: string;
|
|
60
|
+
email?: string;
|
|
61
|
+
email_hash?: string | null;
|
|
62
|
+
exids?: ExIds;
|
|
63
|
+
pixelId?: string;
|
|
64
|
+
queue: UserEvent[];
|
|
65
|
+
private queueMutex;
|
|
66
|
+
private constructor();
|
|
67
|
+
static get instance(): XyPixel;
|
|
68
|
+
static init(pixelId: string): XyPixel;
|
|
69
|
+
static selectApi(api: PixelApi): void;
|
|
70
|
+
private static utmFields;
|
|
71
|
+
identify(email?: string): void;
|
|
72
|
+
send<T extends JsonObject>(event: string, fields?: T, eventId?: string): Promise<void>;
|
|
73
|
+
private tryFlushQueue;
|
|
74
|
+
private updateFbId;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
interface PurchaseFields extends CommonFields {
|
|
78
|
+
id: string;
|
|
79
|
+
name?: string;
|
|
80
|
+
price?: number;
|
|
81
|
+
value?: number;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
declare class Referrer {
|
|
85
|
+
private static storageId;
|
|
86
|
+
local: string;
|
|
87
|
+
session: string;
|
|
88
|
+
constructor();
|
|
89
|
+
toJson(): {
|
|
90
|
+
local: string;
|
|
91
|
+
session: string;
|
|
92
|
+
} | undefined;
|
|
93
|
+
private getFromLocal;
|
|
94
|
+
private getFromSession;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
interface TestStartedFields extends CommonFields {
|
|
98
|
+
name: string;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
declare class UniqueUserId {
|
|
102
|
+
private static localStorageId;
|
|
103
|
+
id: string;
|
|
104
|
+
constructor();
|
|
105
|
+
toString(): string;
|
|
106
|
+
private generateId;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
interface UserClickFields extends CommonFields {
|
|
110
|
+
elementName: string;
|
|
111
|
+
elementType: string;
|
|
112
|
+
intent?: string;
|
|
113
|
+
placement?: string;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
interface ViewContentFields extends CommonFields {
|
|
117
|
+
name: string;
|
|
118
|
+
path: string;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
declare abstract class UserEventHandler<TData extends EmptyObject> {
|
|
122
|
+
abstract funnelStarted<T extends TData>(fields: T | FunnelStartedFields): Promisable<void>;
|
|
123
|
+
abstract testStarted<T extends TData>(fields: T | TestStartedFields): Promisable<void>;
|
|
124
|
+
abstract userClick<T extends TData>(fields: T | UserClickFields): Promisable<void>;
|
|
125
|
+
abstract viewContent<T extends TData>(fields: T | ViewContentFields): Promisable<void>;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
declare class UtmFields {
|
|
129
|
+
private static localStorageId;
|
|
130
|
+
fields: Record<string, string>[];
|
|
131
|
+
constructor();
|
|
132
|
+
getUtmRecord: () => Record<string, string> | null;
|
|
133
|
+
toString(): string;
|
|
134
|
+
update(): Record<string, string>[];
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
interface XyLabsTrackingEventJson {
|
|
138
|
+
cid: string;
|
|
139
|
+
create_time?: number;
|
|
140
|
+
email?: string;
|
|
141
|
+
email_hash?: string;
|
|
142
|
+
event?: string;
|
|
143
|
+
event_id?: string;
|
|
144
|
+
exids?: Record<string, string>;
|
|
145
|
+
fields?: Record<string, unknown>;
|
|
146
|
+
host?: string;
|
|
147
|
+
ip?: string;
|
|
148
|
+
pathname?: string;
|
|
149
|
+
pixel?: string;
|
|
150
|
+
receive_time?: number;
|
|
151
|
+
rid?: string;
|
|
152
|
+
system?: unknown;
|
|
153
|
+
ua?: string;
|
|
154
|
+
uid?: string;
|
|
155
|
+
utm?: Record<string, string>[] | Record<string, string[]>;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
declare class XyUserEventHandler<T extends EmptyObject = EmptyObject> extends UserEventHandler<T> {
|
|
159
|
+
constructor();
|
|
160
|
+
funnelStarted(fields: T | FunnelStartedFields): Promise<void>;
|
|
161
|
+
purchase(fields: T | PurchaseFields): Promise<void>;
|
|
162
|
+
testStarted(fields: T | TestStartedFields): Promise<void>;
|
|
163
|
+
userClick(fields: T | UserClickFields): Promise<void>;
|
|
164
|
+
viewContent(fields: T | ViewContentFields): Promise<void>;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export { PixelApi, Referrer, UniqueUserId, UserEventHandler, UtmFields, XyPixel, XyUserEventHandler };
|
|
168
|
+
export type { CommonFields, FunnelStartedFields, PurchaseFields, TestStartedFields, UserClickFields, UserEvent, UserEventSystem, ViewContentFields, XyLabsTrackingEventJson };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xylabs/pixel",
|
|
3
|
-
"version": "4.13.
|
|
3
|
+
"version": "4.13.5",
|
|
4
4
|
"description": "Event Client for xylabs ESB",
|
|
5
5
|
"homepage": "https://xylabs.com",
|
|
6
6
|
"bugs": {
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"module": "dist/browser/index.mjs",
|
|
30
30
|
"types": "dist/browser/index.d.ts",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@xylabs/assert": "^4.13.
|
|
33
|
-
"@xylabs/object": "^4.13.
|
|
34
|
-
"@xylabs/promise": "^4.13.
|
|
35
|
-
"@xylabs/typeof": "^4.13.
|
|
32
|
+
"@xylabs/assert": "^4.13.5",
|
|
33
|
+
"@xylabs/object": "^4.13.5",
|
|
34
|
+
"@xylabs/promise": "^4.13.5",
|
|
35
|
+
"@xylabs/typeof": "^4.13.5",
|
|
36
36
|
"async-mutex": "^0.5.0",
|
|
37
37
|
"axios": "^1.10.0",
|
|
38
38
|
"bowser": "^2.11.0",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"@types/js-cookie": "^3.0.6",
|
|
45
45
|
"@types/node": "^24.0.13",
|
|
46
46
|
"@types/spark-md5": "^3.0.5",
|
|
47
|
-
"@xylabs/ts-scripts-yarn3": "^7.0.0-rc.
|
|
48
|
-
"@xylabs/tsconfig-dom": "^7.0.0-rc.
|
|
47
|
+
"@xylabs/ts-scripts-yarn3": "^7.0.0-rc.8",
|
|
48
|
+
"@xylabs/tsconfig-dom": "^7.0.0-rc.8",
|
|
49
49
|
"axios": "^1.10.0",
|
|
50
50
|
"typescript": "^5.8.3",
|
|
51
51
|
"vitest": "^3.2.4"
|