@vrplatform/log 2.0.29 → 2.0.31
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/build/main/baselog.d.ts +19 -0
- package/build/main/baselog.js +137 -0
- package/build/main/baselog.js.map +1 -0
- package/build/main/color.d.ts +54 -0
- package/build/main/color.js +371 -0
- package/build/main/color.js.map +1 -0
- package/build/main/common.d.ts +29 -0
- package/build/main/common.js +86 -0
- package/build/main/common.js.map +1 -0
- package/build/main/index.spec.d.ts +0 -0
- package/build/main/index.spec.js +2 -0
- package/build/main/index.spec.js.map +1 -0
- package/build/main/log/index.js +8 -2
- package/build/main/log/index.js.map +1 -1
- package/build/main/tracking/index.d.ts +6 -0
- package/build/main/tracking/index.js +83 -6
- package/build/main/tracking/index.js.map +1 -1
- package/build/main/tracking/types.d.ts +3 -0
- package/build/main/type.d.ts +39 -0
- package/build/main/{tracking/eventTypes.js → type.js} +1 -1
- package/build/main/type.js.map +1 -0
- package/build/module/baselog.d.ts +19 -0
- package/build/module/baselog.js +120 -0
- package/build/module/baselog.js.map +1 -0
- package/build/module/color.d.ts +54 -0
- package/build/module/color.js +375 -0
- package/build/module/color.js.map +1 -0
- package/build/module/common.d.ts +29 -0
- package/build/module/common.js +80 -0
- package/build/module/common.js.map +1 -0
- package/build/module/index.spec.d.ts +0 -0
- package/build/module/index.spec.js +2 -0
- package/build/module/index.spec.js.map +1 -0
- package/build/module/log/index.js +8 -2
- package/build/module/log/index.js.map +1 -1
- package/build/module/tracking/index.d.ts +6 -0
- package/build/module/tracking/index.js +85 -8
- package/build/module/tracking/index.js.map +1 -1
- package/build/module/tracking/types.d.ts +3 -0
- package/build/module/type.d.ts +39 -0
- package/build/module/type.js +2 -0
- package/build/module/type.js.map +1 -0
- package/package.json +3 -1
- package/src/log/index.ts +9 -2
- package/src/tracking/index.ts +112 -6
- package/src/tracking/types.ts +3 -0
- package/build/main/tracking/_intercom.d.ts +0 -109
- package/build/main/tracking/_intercom.js +0 -139
- package/build/main/tracking/_intercom.js.map +0 -1
- package/build/main/tracking/eventTypes.d.ts +0 -16
- package/build/main/tracking/eventTypes.js.map +0 -1
- package/build/main/tracking/intercom.d.ts +0 -109
- package/build/main/tracking/intercom.js +0 -139
- package/build/main/tracking/intercom.js.map +0 -1
- package/build/module/tracking/_intercom.d.ts +0 -109
- package/build/module/tracking/_intercom.js +0 -136
- package/build/module/tracking/_intercom.js.map +0 -1
- package/build/module/tracking/eventTypes.d.ts +0 -16
- package/build/module/tracking/eventTypes.js +0 -2
- package/build/module/tracking/eventTypes.js.map +0 -1
- package/build/module/tracking/intercom.d.ts +0 -109
- package/build/module/tracking/intercom.js +0 -136
- package/build/module/tracking/intercom.js.map +0 -1
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useHasuraClient } from '@finalytic/graphql';
|
|
2
|
+
import { Analytics } from '@june-so/analytics-node';
|
|
2
3
|
import { Intercom } from 'intercom-client';
|
|
4
|
+
import { PostHog } from 'posthog-node';
|
|
3
5
|
import { useLog } from '../log';
|
|
4
|
-
import { isTest } from '../utils';
|
|
6
|
+
import { convertKeysToSnakeCase, isTest } from '../utils';
|
|
5
7
|
import { convertValuesToString } from '../utils/convertValuesToString';
|
|
6
8
|
export * from './types';
|
|
7
9
|
export * from 'intercom-client';
|
|
8
10
|
export * from '../utils';
|
|
9
11
|
export const useTracking = ({ dataset, env, name }, isDev) => {
|
|
10
12
|
const client = env.HASURA_GRAPHQL_ADMIN_SECRET
|
|
11
|
-
?
|
|
13
|
+
? useHasuraClient({
|
|
12
14
|
secret: env.HASURA_ADMIN_SECRET || env.HASURA_GRAPHQL_ADMIN_SECRET,
|
|
13
15
|
})
|
|
14
16
|
: undefined;
|
|
@@ -23,6 +25,12 @@ export const useTracking = ({ dataset, env, name }, isDev) => {
|
|
|
23
25
|
// }),
|
|
24
26
|
})
|
|
25
27
|
: undefined;
|
|
28
|
+
const june = env.JUNESO_TOKEN ? new Analytics(env.JUNESO_TOKEN) : undefined;
|
|
29
|
+
const posthog = env.POSTHOG_TOKEN
|
|
30
|
+
? new PostHog(env.POSTHOG_TOKEN, {
|
|
31
|
+
host: 'https://app.posthog.com',
|
|
32
|
+
})
|
|
33
|
+
: undefined;
|
|
26
34
|
return {
|
|
27
35
|
// General
|
|
28
36
|
track: async ({ userId, anonymousId, groupId, event, packageName, properties, timestamp = new Date(), }) => {
|
|
@@ -38,7 +46,48 @@ export const useTracking = ({ dataset, env, name }, isDev) => {
|
|
|
38
46
|
packageName,
|
|
39
47
|
},
|
|
40
48
|
}).id);
|
|
41
|
-
if (
|
|
49
|
+
if (anonymousId) {
|
|
50
|
+
posthog?.capture({
|
|
51
|
+
distinctId: anonymousId,
|
|
52
|
+
event,
|
|
53
|
+
groups: {
|
|
54
|
+
tenant: groupId,
|
|
55
|
+
},
|
|
56
|
+
timestamp,
|
|
57
|
+
properties: convertKeysToSnakeCase(properties),
|
|
58
|
+
});
|
|
59
|
+
june?.track({
|
|
60
|
+
anonymousId,
|
|
61
|
+
event,
|
|
62
|
+
properties,
|
|
63
|
+
timestamp,
|
|
64
|
+
context: { groupId },
|
|
65
|
+
}, (err) => {
|
|
66
|
+
if (err)
|
|
67
|
+
console.error(err);
|
|
68
|
+
});
|
|
69
|
+
// no intercom for anonymous
|
|
70
|
+
}
|
|
71
|
+
else if (userId) {
|
|
72
|
+
posthog?.capture({
|
|
73
|
+
distinctId: userId,
|
|
74
|
+
event,
|
|
75
|
+
groups: {
|
|
76
|
+
tenant: groupId,
|
|
77
|
+
},
|
|
78
|
+
timestamp,
|
|
79
|
+
properties: convertKeysToSnakeCase(properties),
|
|
80
|
+
});
|
|
81
|
+
june?.track({
|
|
82
|
+
userId,
|
|
83
|
+
event,
|
|
84
|
+
properties,
|
|
85
|
+
timestamp,
|
|
86
|
+
context: { groupId },
|
|
87
|
+
}, (err) => {
|
|
88
|
+
if (err)
|
|
89
|
+
console.error(err);
|
|
90
|
+
});
|
|
42
91
|
try {
|
|
43
92
|
await intercom?.dataEvents.create({
|
|
44
93
|
body: {
|
|
@@ -54,9 +103,19 @@ export const useTracking = ({ dataset, env, name }, isDev) => {
|
|
|
54
103
|
}
|
|
55
104
|
}
|
|
56
105
|
},
|
|
57
|
-
identify: async ({ traits, userId }) => {
|
|
106
|
+
identify: async ({ traits, userId, disableGeoip, timestamp = new Date(), }) => {
|
|
58
107
|
if (isDev || isTest(userId))
|
|
59
108
|
return;
|
|
109
|
+
posthog?.identify({
|
|
110
|
+
distinctId: userId,
|
|
111
|
+
properties: convertKeysToSnakeCase(traits),
|
|
112
|
+
disableGeoip,
|
|
113
|
+
});
|
|
114
|
+
june?.identify({
|
|
115
|
+
userId,
|
|
116
|
+
traits,
|
|
117
|
+
timestamp,
|
|
118
|
+
}, (err) => (err ? console.error(err) : {}));
|
|
60
119
|
// upsert intercom user
|
|
61
120
|
try {
|
|
62
121
|
const data = {
|
|
@@ -93,7 +152,7 @@ export const useTracking = ({ dataset, env, name }, isDev) => {
|
|
|
93
152
|
console.error(e);
|
|
94
153
|
}
|
|
95
154
|
},
|
|
96
|
-
group: async ({ traits = {}, groupId, userId, anonymousId, }) => {
|
|
155
|
+
group: async ({ traits = {}, groupId, userId, anonymousId, timestamp = new Date(), }) => {
|
|
97
156
|
if (isDev || isTest(userId || anonymousId || '', groupId))
|
|
98
157
|
return;
|
|
99
158
|
// add teamId to traits
|
|
@@ -145,7 +204,23 @@ export const useTracking = ({ dataset, env, name }, isDev) => {
|
|
|
145
204
|
catch (e) {
|
|
146
205
|
console.error(e);
|
|
147
206
|
}
|
|
148
|
-
if (
|
|
207
|
+
if (anonymousId) {
|
|
208
|
+
posthog?.groupIdentify({
|
|
209
|
+
groupKey: groupId,
|
|
210
|
+
groupType: 'tenant',
|
|
211
|
+
properties: convertKeysToSnakeCase(traits),
|
|
212
|
+
distinctId: anonymousId,
|
|
213
|
+
});
|
|
214
|
+
june?.group({ anonymousId, groupId, traits, timestamp }, (err) => err ? console.error(err) : {});
|
|
215
|
+
}
|
|
216
|
+
else if (userId) {
|
|
217
|
+
posthog?.groupIdentify({
|
|
218
|
+
groupKey: groupId,
|
|
219
|
+
groupType: 'tenant',
|
|
220
|
+
properties: convertKeysToSnakeCase(traits),
|
|
221
|
+
distinctId: userId,
|
|
222
|
+
});
|
|
223
|
+
june?.group({ userId, groupId, traits, timestamp }, (err) => err ? console.error(err) : {});
|
|
149
224
|
// attach intercom user to intercom company
|
|
150
225
|
try {
|
|
151
226
|
const intercomUser = (await intercom?.contacts.search({
|
|
@@ -165,9 +240,11 @@ export const useTracking = ({ dataset, env, name }, isDev) => {
|
|
|
165
240
|
}
|
|
166
241
|
}
|
|
167
242
|
},
|
|
168
|
-
shutdown: async () => log?.flush(),
|
|
243
|
+
shutdown: async () => Promise.all([posthog?.shutdown(), june?.closeAndFlush(), log?.flush()]),
|
|
169
244
|
// export dependencies
|
|
170
245
|
intercom,
|
|
246
|
+
posthog,
|
|
247
|
+
june,
|
|
171
248
|
log,
|
|
172
249
|
};
|
|
173
250
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["tracking/index.ts"],"names":[],"mappings":"AAoGA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["tracking/index.ts"],"names":[],"mappings":"AAoGA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAoC,MAAM,EAAE,MAAM,QAAQ,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAQvE,cAAc,SAAS,CAAC;AACxB,cA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,CAAC,CAAC;gBACnB,CAAC;YACH,CAAC;QACH,CAAC;QACD,QAAQ,EAAE,KAAK,IAAI,EAAE,CACnB,OAAO,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC;QACzE,sBAAsB;QACtB,QAAQ;QACR,OAAO;QACP,IAAI;QACJ,GAAG;KACJ,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -24,6 +24,8 @@ export type IdentifyProps = {
|
|
|
24
24
|
role?: UserRole;
|
|
25
25
|
[key: string]: string | number | boolean | null | undefined;
|
|
26
26
|
};
|
|
27
|
+
disableGeoip?: boolean;
|
|
28
|
+
timestamp?: Date;
|
|
27
29
|
};
|
|
28
30
|
export type GroupProps = OptionalUser<{
|
|
29
31
|
groupId: string;
|
|
@@ -50,6 +52,7 @@ export type GroupProps = OptionalUser<{
|
|
|
50
52
|
trialUntil?: string;
|
|
51
53
|
[key: string]: string | number | boolean | null | undefined;
|
|
52
54
|
};
|
|
55
|
+
timestamp?: Date;
|
|
53
56
|
}>;
|
|
54
57
|
export type TrackingEventProps = {
|
|
55
58
|
account_invitation_accepted: AccountInvitationAcceptedProps;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export type LogFn = (message: any, additionalContext?: Record<string, any>) => void;
|
|
2
|
+
export type LogFns = {
|
|
3
|
+
error: LogFn;
|
|
4
|
+
info: LogFn;
|
|
5
|
+
debug: LogFn;
|
|
6
|
+
warn: LogFn;
|
|
7
|
+
};
|
|
8
|
+
export type Log = LogFns & {
|
|
9
|
+
child: (data: ChildLogOptions) => Log;
|
|
10
|
+
addContext: (data: Record<string, any>) => void;
|
|
11
|
+
};
|
|
12
|
+
export type ChildLogOptions = {
|
|
13
|
+
correlationId?: string;
|
|
14
|
+
name?: string;
|
|
15
|
+
request?: any;
|
|
16
|
+
context?: Record<string, any>;
|
|
17
|
+
};
|
|
18
|
+
type Res = Response | {
|
|
19
|
+
status: number;
|
|
20
|
+
statusText?: string;
|
|
21
|
+
headers?: Record<string, string>;
|
|
22
|
+
body?: any;
|
|
23
|
+
response?: Response;
|
|
24
|
+
};
|
|
25
|
+
export type BaseLog = Log & {
|
|
26
|
+
flush(): Promise<void> | void;
|
|
27
|
+
};
|
|
28
|
+
export type WorkerLog = BaseLog & {
|
|
29
|
+
respond(response: Res | Promise<Res> | (() => Res | Promise<Res>)): Promise<Response>;
|
|
30
|
+
};
|
|
31
|
+
export type RequestLike = {
|
|
32
|
+
headers: {
|
|
33
|
+
get: (key: string) => string | null;
|
|
34
|
+
};
|
|
35
|
+
method: string;
|
|
36
|
+
url: string;
|
|
37
|
+
json: () => Promise<any>;
|
|
38
|
+
};
|
|
39
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"src/","sources":["type.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vrplatform/log",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.31",
|
|
4
4
|
"main": "build/main/index.js",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -19,7 +19,9 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@axiomhq/js": "1.0.0-rc.3",
|
|
21
21
|
"@finalytic/graphql": "1.12.133",
|
|
22
|
+
"@june-so/analytics-node": "8.0.0",
|
|
22
23
|
"intercom-client": "6.0.0-beta.3",
|
|
24
|
+
"posthog-node": "4.0.1",
|
|
23
25
|
"serialize-error": "11.0.3"
|
|
24
26
|
},
|
|
25
27
|
"devDependencies": {
|
package/src/log/index.ts
CHANGED
|
@@ -44,17 +44,24 @@ export function useLog({
|
|
|
44
44
|
};
|
|
45
45
|
}): WorkerLog {
|
|
46
46
|
const environment = _environment || getEnvironment(env);
|
|
47
|
-
const colorLogs =
|
|
47
|
+
// const colorLogs = env?.[LOG_ENV] === '*' || ;
|
|
48
48
|
const correlationId = cid || getCorrelationId(request); //const logger = nodeColorLog;
|
|
49
49
|
|
|
50
50
|
const axiomToken = env?.[AXIOM_AUTH_TOKEN_ENV];
|
|
51
51
|
|
|
52
|
+
const isNodeJsCompat = typeof process !== 'undefined';
|
|
53
|
+
const isDev = environment === 'development';
|
|
54
|
+
const isLogEnabled = env?.[LOG_ENV] === '*';
|
|
55
|
+
const consoleLog = !axiomToken || isDev || isLogEnabled;
|
|
56
|
+
const colorLog = consoleLog && isNodeJsCompat;
|
|
57
|
+
|
|
52
58
|
const axiom = createBaseLog(
|
|
53
59
|
{
|
|
54
60
|
token: axiomToken,
|
|
55
61
|
orgId: env?.[AXIOM_ORG_ID_ENV],
|
|
56
62
|
dataset: _dataset || env?.[AXIOM_DATASET_ENV] || 'default',
|
|
57
|
-
|
|
63
|
+
// color log on development and if env is *
|
|
64
|
+
consoleLog: colorLog ? 'color' : consoleLog,
|
|
58
65
|
},
|
|
59
66
|
{
|
|
60
67
|
environment,
|
package/src/tracking/index.ts
CHANGED
|
@@ -98,8 +98,10 @@ declare module 'intercom-client' {
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
import {
|
|
101
|
+
import { useHasuraClient } from '@finalytic/graphql';
|
|
102
|
+
import { Analytics } from '@june-so/analytics-node';
|
|
102
103
|
import { Intercom } from 'intercom-client';
|
|
104
|
+
import { PostHog } from 'posthog-node';
|
|
103
105
|
import { type LogBindings, type WorkerLog, useLog } from '../log';
|
|
104
106
|
import { convertKeysToSnakeCase, isTest } from '../utils';
|
|
105
107
|
import { convertValuesToString } from '../utils/convertValuesToString';
|
|
@@ -120,6 +122,8 @@ export type UseTracking = {
|
|
|
120
122
|
dataset: string;
|
|
121
123
|
env: {
|
|
122
124
|
INTERCOM_TOKEN?: string;
|
|
125
|
+
JUNESO_TOKEN?: string;
|
|
126
|
+
POSTHOG_TOKEN?: string;
|
|
123
127
|
HASURA_GRAPHQL_ADMIN_SECRET?: string;
|
|
124
128
|
HASURA_ADMIN_SECRET?: string;
|
|
125
129
|
} & LogBindings;
|
|
@@ -135,10 +139,12 @@ export const useTracking = (
|
|
|
135
139
|
group: (props: GroupProps) => Promise<void>;
|
|
136
140
|
shutdown: () => Promise<any>;
|
|
137
141
|
log: WorkerLog;
|
|
142
|
+
june?: Analytics;
|
|
138
143
|
intercom?: Intercom;
|
|
144
|
+
posthog?: PostHog;
|
|
139
145
|
} => {
|
|
140
146
|
const client = env.HASURA_GRAPHQL_ADMIN_SECRET
|
|
141
|
-
?
|
|
147
|
+
? useHasuraClient({
|
|
142
148
|
secret: env.HASURA_ADMIN_SECRET || env.HASURA_GRAPHQL_ADMIN_SECRET,
|
|
143
149
|
})
|
|
144
150
|
: undefined;
|
|
@@ -153,6 +159,12 @@ export const useTracking = (
|
|
|
153
159
|
// }),
|
|
154
160
|
})
|
|
155
161
|
: undefined;
|
|
162
|
+
const june = env.JUNESO_TOKEN ? new Analytics(env.JUNESO_TOKEN) : undefined;
|
|
163
|
+
const posthog = env.POSTHOG_TOKEN
|
|
164
|
+
? new PostHog(env.POSTHOG_TOKEN, {
|
|
165
|
+
host: 'https://app.posthog.com',
|
|
166
|
+
})
|
|
167
|
+
: undefined;
|
|
156
168
|
|
|
157
169
|
return {
|
|
158
170
|
// General
|
|
@@ -181,7 +193,55 @@ export const useTracking = (
|
|
|
181
193
|
}).id
|
|
182
194
|
);
|
|
183
195
|
|
|
184
|
-
if (
|
|
196
|
+
if (anonymousId) {
|
|
197
|
+
posthog?.capture({
|
|
198
|
+
distinctId: anonymousId,
|
|
199
|
+
event,
|
|
200
|
+
groups: {
|
|
201
|
+
tenant: groupId,
|
|
202
|
+
},
|
|
203
|
+
timestamp,
|
|
204
|
+
properties: convertKeysToSnakeCase(properties),
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
june?.track(
|
|
208
|
+
{
|
|
209
|
+
anonymousId,
|
|
210
|
+
event,
|
|
211
|
+
properties,
|
|
212
|
+
timestamp,
|
|
213
|
+
context: { groupId },
|
|
214
|
+
},
|
|
215
|
+
(err) => {
|
|
216
|
+
if (err) console.error(err);
|
|
217
|
+
}
|
|
218
|
+
);
|
|
219
|
+
|
|
220
|
+
// no intercom for anonymous
|
|
221
|
+
} else if (userId) {
|
|
222
|
+
posthog?.capture({
|
|
223
|
+
distinctId: userId,
|
|
224
|
+
event,
|
|
225
|
+
groups: {
|
|
226
|
+
tenant: groupId,
|
|
227
|
+
},
|
|
228
|
+
timestamp,
|
|
229
|
+
properties: convertKeysToSnakeCase(properties),
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
june?.track(
|
|
233
|
+
{
|
|
234
|
+
userId,
|
|
235
|
+
event,
|
|
236
|
+
properties,
|
|
237
|
+
timestamp,
|
|
238
|
+
context: { groupId },
|
|
239
|
+
},
|
|
240
|
+
(err) => {
|
|
241
|
+
if (err) console.error(err);
|
|
242
|
+
}
|
|
243
|
+
);
|
|
244
|
+
|
|
185
245
|
try {
|
|
186
246
|
await intercom?.dataEvents.create({
|
|
187
247
|
body: {
|
|
@@ -196,9 +256,29 @@ export const useTracking = (
|
|
|
196
256
|
}
|
|
197
257
|
}
|
|
198
258
|
},
|
|
199
|
-
identify: async ({
|
|
259
|
+
identify: async ({
|
|
260
|
+
traits,
|
|
261
|
+
userId,
|
|
262
|
+
disableGeoip,
|
|
263
|
+
timestamp = new Date(),
|
|
264
|
+
}: IdentifyProps) => {
|
|
200
265
|
if (isDev || isTest(userId)) return;
|
|
201
266
|
|
|
267
|
+
posthog?.identify({
|
|
268
|
+
distinctId: userId,
|
|
269
|
+
properties: convertKeysToSnakeCase(traits),
|
|
270
|
+
disableGeoip,
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
june?.identify(
|
|
274
|
+
{
|
|
275
|
+
userId,
|
|
276
|
+
traits,
|
|
277
|
+
timestamp,
|
|
278
|
+
},
|
|
279
|
+
(err) => (err ? console.error(err) : {})
|
|
280
|
+
);
|
|
281
|
+
|
|
202
282
|
// upsert intercom user
|
|
203
283
|
try {
|
|
204
284
|
const data = {
|
|
@@ -242,6 +322,7 @@ export const useTracking = (
|
|
|
242
322
|
groupId,
|
|
243
323
|
userId,
|
|
244
324
|
anonymousId,
|
|
325
|
+
timestamp = new Date(),
|
|
245
326
|
}: GroupProps) => {
|
|
246
327
|
if (isDev || isTest(userId || anonymousId || '', groupId)) return;
|
|
247
328
|
|
|
@@ -293,7 +374,29 @@ export const useTracking = (
|
|
|
293
374
|
console.error(e);
|
|
294
375
|
}
|
|
295
376
|
|
|
296
|
-
if (
|
|
377
|
+
if (anonymousId) {
|
|
378
|
+
posthog?.groupIdentify({
|
|
379
|
+
groupKey: groupId,
|
|
380
|
+
groupType: 'tenant',
|
|
381
|
+
properties: convertKeysToSnakeCase(traits),
|
|
382
|
+
distinctId: anonymousId,
|
|
383
|
+
});
|
|
384
|
+
|
|
385
|
+
june?.group({ anonymousId, groupId, traits, timestamp }, (err) =>
|
|
386
|
+
err ? console.error(err) : {}
|
|
387
|
+
);
|
|
388
|
+
} else if (userId) {
|
|
389
|
+
posthog?.groupIdentify({
|
|
390
|
+
groupKey: groupId,
|
|
391
|
+
groupType: 'tenant',
|
|
392
|
+
properties: convertKeysToSnakeCase(traits),
|
|
393
|
+
distinctId: userId,
|
|
394
|
+
});
|
|
395
|
+
|
|
396
|
+
june?.group({ userId, groupId, traits, timestamp }, (err) =>
|
|
397
|
+
err ? console.error(err) : {}
|
|
398
|
+
);
|
|
399
|
+
|
|
297
400
|
// attach intercom user to intercom company
|
|
298
401
|
try {
|
|
299
402
|
const intercomUser = (
|
|
@@ -314,9 +417,12 @@ export const useTracking = (
|
|
|
314
417
|
}
|
|
315
418
|
}
|
|
316
419
|
},
|
|
317
|
-
shutdown: async () =>
|
|
420
|
+
shutdown: async () =>
|
|
421
|
+
Promise.all([posthog?.shutdown(), june?.closeAndFlush(), log?.flush()]),
|
|
318
422
|
// export dependencies
|
|
319
423
|
intercom,
|
|
424
|
+
posthog,
|
|
425
|
+
june,
|
|
320
426
|
log,
|
|
321
427
|
};
|
|
322
428
|
};
|
package/src/tracking/types.ts
CHANGED
|
@@ -36,6 +36,8 @@ export type IdentifyProps = {
|
|
|
36
36
|
role?: UserRole;
|
|
37
37
|
[key: string]: string | number | boolean | null | undefined;
|
|
38
38
|
};
|
|
39
|
+
disableGeoip?: boolean;
|
|
40
|
+
timestamp?: Date;
|
|
39
41
|
};
|
|
40
42
|
|
|
41
43
|
export type GroupProps = OptionalUser<{
|
|
@@ -63,6 +65,7 @@ export type GroupProps = OptionalUser<{
|
|
|
63
65
|
trialUntil?: string;
|
|
64
66
|
[key: string]: string | number | boolean | null | undefined;
|
|
65
67
|
};
|
|
68
|
+
timestamp?: Date;
|
|
66
69
|
}>;
|
|
67
70
|
|
|
68
71
|
export type TrackingEventProps = {
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import type { Log } from '../log';
|
|
2
|
-
export declare class IntercomAPI {
|
|
3
|
-
constructor(token: string, log?: Log);
|
|
4
|
-
private headers;
|
|
5
|
-
private log?;
|
|
6
|
-
private fetch;
|
|
7
|
-
getUserByUserId(userId: string): Promise<{
|
|
8
|
-
type: "list";
|
|
9
|
-
data: {
|
|
10
|
-
id: string;
|
|
11
|
-
}[] | undefined;
|
|
12
|
-
total_count: 0;
|
|
13
|
-
pages: {
|
|
14
|
-
type: "pages";
|
|
15
|
-
page: 1;
|
|
16
|
-
per_page: 10;
|
|
17
|
-
total_pages: 0;
|
|
18
|
-
};
|
|
19
|
-
} | undefined>;
|
|
20
|
-
createUser({ data, userId, }: {
|
|
21
|
-
userId: string;
|
|
22
|
-
data: {
|
|
23
|
-
email: string;
|
|
24
|
-
name: string;
|
|
25
|
-
custom_attributes: Record<string, any>;
|
|
26
|
-
};
|
|
27
|
-
}): Promise<unknown>;
|
|
28
|
-
updateUser({ data, contactId, }: {
|
|
29
|
-
contactId: string;
|
|
30
|
-
data: {
|
|
31
|
-
email?: string;
|
|
32
|
-
name?: string;
|
|
33
|
-
custom_attributes: Record<string, any>;
|
|
34
|
-
[key: string]: any;
|
|
35
|
-
};
|
|
36
|
-
}): Promise<unknown>;
|
|
37
|
-
deleteUser(intercom_contact_id: string): Promise<{
|
|
38
|
-
id: "6657adf56abd0167d9419d1c";
|
|
39
|
-
external_id: "70";
|
|
40
|
-
type: "contact";
|
|
41
|
-
deleted: true;
|
|
42
|
-
} | undefined>;
|
|
43
|
-
createCompanyUser(data: {
|
|
44
|
-
intercom_contact_id: string;
|
|
45
|
-
intercom_company_id: string;
|
|
46
|
-
}): Promise<unknown>;
|
|
47
|
-
deleteCompanyUser({ intercom_company_id, intercom_contact_id, }: {
|
|
48
|
-
intercom_contact_id: string;
|
|
49
|
-
intercom_company_id: string;
|
|
50
|
-
}): Promise<{
|
|
51
|
-
id: "6657adc96abd0167d9419ca7";
|
|
52
|
-
} | undefined>;
|
|
53
|
-
trackEvent(data: {
|
|
54
|
-
user_id: string;
|
|
55
|
-
event_name: string;
|
|
56
|
-
metadata: Record<string, any>;
|
|
57
|
-
}): Promise<unknown>;
|
|
58
|
-
getCompanyByTenantId(tenantId: string): Promise<{
|
|
59
|
-
type: "list";
|
|
60
|
-
data: [{
|
|
61
|
-
type: "company";
|
|
62
|
-
company_id: "remote_companies_scroll_2";
|
|
63
|
-
id: "664df5436abd01f7945e1a78";
|
|
64
|
-
app_id: "this_is_an_id111_that_should_be_at_least_";
|
|
65
|
-
name: "IntercomQATest1";
|
|
66
|
-
remote_created_at: 1716385091;
|
|
67
|
-
created_at: 1716385091;
|
|
68
|
-
updated_at: 1716385091;
|
|
69
|
-
monthly_spend: 0;
|
|
70
|
-
session_count: 0;
|
|
71
|
-
user_count: 4;
|
|
72
|
-
tags: {
|
|
73
|
-
type: "tag.list";
|
|
74
|
-
tags: [];
|
|
75
|
-
};
|
|
76
|
-
segments: {
|
|
77
|
-
type: "segment.list";
|
|
78
|
-
segments: [];
|
|
79
|
-
};
|
|
80
|
-
custom_attributes: Record<string, string>;
|
|
81
|
-
}] | undefined;
|
|
82
|
-
pages: {
|
|
83
|
-
type: "pages";
|
|
84
|
-
next: null;
|
|
85
|
-
page: 1;
|
|
86
|
-
per_page: 15;
|
|
87
|
-
total_pages: 1;
|
|
88
|
-
};
|
|
89
|
-
total_count: 1;
|
|
90
|
-
} | undefined>;
|
|
91
|
-
createCompany({ data, tenantId, }: {
|
|
92
|
-
tenantId: string;
|
|
93
|
-
data: {
|
|
94
|
-
name: string;
|
|
95
|
-
remote_created_at: number;
|
|
96
|
-
custom_attributes: Record<string, any>;
|
|
97
|
-
};
|
|
98
|
-
}): Promise<unknown>;
|
|
99
|
-
updateCompany({ data, companyId, }: {
|
|
100
|
-
companyId: string;
|
|
101
|
-
data: Record<string, any>;
|
|
102
|
-
}): Promise<unknown>;
|
|
103
|
-
deleteCompany(intercom_company_id: string): Promise<{
|
|
104
|
-
id: "6657adc96abd0167d9419ca7";
|
|
105
|
-
object: "company";
|
|
106
|
-
deleted: true;
|
|
107
|
-
} | undefined>;
|
|
108
|
-
}
|
|
109
|
-
export declare function useIntercom(token: string, log?: Log): IntercomAPI;
|