@vrplatform/log 2.0.0-alpha.28 → 2.0.0-alpha.29
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/tracking/index.d.ts +3 -17
- package/build/main/tracking/index.js +18 -3
- package/build/main/tracking/index.js.map +1 -1
- package/build/main/tracking/intercom.d.ts +5 -5
- package/build/main/tracking/intercom.js +11 -11
- package/build/main/tracking/intercom.js.map +1 -1
- package/build/main/tracking/types.d.ts +16 -0
- package/build/main/tracking/types.js +3 -0
- package/build/main/tracking/types.js.map +1 -0
- package/build/module/tracking/index.d.ts +3 -17
- package/build/module/tracking/index.js +4 -3
- package/build/module/tracking/index.js.map +1 -1
- package/build/module/tracking/intercom.d.ts +5 -5
- package/build/module/tracking/intercom.js +11 -11
- package/build/module/tracking/intercom.js.map +1 -1
- package/build/module/tracking/types.d.ts +16 -0
- package/build/module/tracking/types.js +2 -0
- package/build/module/tracking/types.js.map +1 -0
- package/package.json +2 -1
- package/src/tracking/index.ts +10 -102
- package/src/tracking/intercom.ts +11 -11
- package/src/tracking/types.ts +97 -0
|
@@ -2,23 +2,10 @@ import { Analytics } from '@june-so/analytics-node';
|
|
|
2
2
|
import { PostHog } from 'posthog-node';
|
|
3
3
|
import { type LogBindings, type WorkerLog } from '../log';
|
|
4
4
|
import { useIntercom } from './intercom';
|
|
5
|
+
import type { TrackingEvent } from './types';
|
|
6
|
+
export * from './types';
|
|
5
7
|
export declare const isTest: (userId: string, groupId?: string, userEmail?: string) => boolean | "" | undefined;
|
|
6
8
|
export declare const convertKeysToSnakeCase: (obj?: Record<string, any>) => Record<string, any>;
|
|
7
|
-
type AuthEvent = 'account_signin_completed' | 'account_signup_code_requested' | 'account_signup_code_completed' | 'account_signup_code_failed' | 'account_signup_completed' | 'account_password_reset_requested' | 'account_password_reset_failed' | 'account_password_reset_completed' | 'account_invitation_accepted' | 'account_signed_out';
|
|
8
|
-
type TeamEvent = 'team_added' | 'team_info_updated' | 'team_deleted' | 'team_member_removed';
|
|
9
|
-
type ConnectionEvent = 'connection_created' | 'connection_reconnected' | 'connection_deleted' | 'connection_requested';
|
|
10
|
-
type OwnershipEvent = 'ownership_created' | 'ownership_updated' | 'ownership_deleted';
|
|
11
|
-
type OwnerEvent = 'owner_created' | 'owner_updated' | 'owner_deleted' | 'owner_tax_info_modal_opened' | 'owner_tax_info_modal_submitted';
|
|
12
|
-
type SetupEvent = 'setup_classes_set' | 'setup_accounting_version_completed' | 'setup_accounting_config_completed' | 'setup_owner_imported' | 'setup_listing_imported';
|
|
13
|
-
type AutomationEvent = 'automation_created' | 'automation_updated' | 'automation_deleted';
|
|
14
|
-
type TaxStatementEvent = 'tax_statement_preview_opened' | 'tax_statement_downloaded';
|
|
15
|
-
type GLOwnerStatementEvent = 'gl_owner_statement_preview_opened' | 'gl_owner_statement_downloaded';
|
|
16
|
-
type HyperlineEvent = 'hyperline_invoice_ready' | 'hyperline_invoice_settled' | 'hyperline_trial_started' | 'hyperline_trial_ended' | 'hyperline_subscription_activated' | 'hyperline_subscription_cancelled' | 'hyperline_subscription_created' | 'hyperline_subscription_errored' | 'hyperline_subscription_paused' | 'hyperline_subscription_voided' | 'hyperline_subscription_charged' | 'hyperline_customer_created' | 'hyperline_customer_updated' | 'hyperline_payment_method_created' | 'hyperline_payment_method_errored' | 'hyperline_payment_method_deleted';
|
|
17
|
-
type ListingEvent = 'listing_activated' | 'listing_deactivated';
|
|
18
|
-
type ReportEvent = 'listings_reported';
|
|
19
|
-
type UserEvent = 'update_refresh_accepted' | 'owner_statement_opened';
|
|
20
|
-
type TestEvent = 'test_event' | 'test_error';
|
|
21
|
-
export type TrackingEvent = AuthEvent | TeamEvent | ConnectionEvent | OwnershipEvent | OwnerEvent | SetupEvent | AutomationEvent | TaxStatementEvent | GLOwnerStatementEvent | HyperlineEvent | UserEvent | ListingEvent | ReportEvent | TestEvent;
|
|
22
9
|
export type TrackingProps = {
|
|
23
10
|
name: string;
|
|
24
11
|
dataset: string;
|
|
@@ -61,7 +48,6 @@ export declare const useTracking: ({ dataset, env, name }: TrackingProps, isDev?
|
|
|
61
48
|
shutdown: () => Promise<any>;
|
|
62
49
|
log: WorkerLog;
|
|
63
50
|
june?: Analytics;
|
|
64
|
-
|
|
51
|
+
_intercom?: ReturnType<typeof useIntercom>;
|
|
65
52
|
posthog?: PostHog;
|
|
66
53
|
};
|
|
67
|
-
export {};
|
|
@@ -1,10 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
17
|
exports.useTracking = exports.convertKeysToSnakeCase = exports.isTest = void 0;
|
|
4
18
|
const analytics_node_1 = require("@june-so/analytics-node");
|
|
5
19
|
const posthog_node_1 = require("posthog-node");
|
|
6
20
|
const log_1 = require("../log");
|
|
7
21
|
const intercom_1 = require("./intercom");
|
|
22
|
+
__exportStar(require("./types"), exports);
|
|
8
23
|
const E2E_TEST_USERS = {
|
|
9
24
|
'e2e-invite-member@finalytic.io': '113d73d8-ee21-46b7-a12a-a74f632401ca',
|
|
10
25
|
'e2e-invite-owner@finalytic.io': '917b7c4e-cb03-491c-9e94-d33a5bdeca05',
|
|
@@ -42,7 +57,7 @@ const convertKeysToSnakeCase = (obj) => {
|
|
|
42
57
|
exports.convertKeysToSnakeCase = convertKeysToSnakeCase;
|
|
43
58
|
const useTracking = ({ dataset, env, name }, isDev) => {
|
|
44
59
|
const log = (0, log_1.useLog)({ name, dataset, env });
|
|
45
|
-
const
|
|
60
|
+
const _intercom = env.INTERCOM_TOKEN
|
|
46
61
|
? (0, intercom_1.useIntercom)(env.INTERCOM_TOKEN, log)
|
|
47
62
|
: undefined;
|
|
48
63
|
const june = env.JUNESO_TOKEN ? new analytics_node_1.Analytics(env.JUNESO_TOKEN) : undefined;
|
|
@@ -99,7 +114,7 @@ const useTracking = ({ dataset, env, name }, isDev) => {
|
|
|
99
114
|
console.error(err);
|
|
100
115
|
});
|
|
101
116
|
try {
|
|
102
|
-
await
|
|
117
|
+
await _intercom?.trackEvent({
|
|
103
118
|
user_id: userId,
|
|
104
119
|
event_name: event,
|
|
105
120
|
metadata: properties,
|
|
@@ -157,7 +172,7 @@ const useTracking = ({ dataset, env, name }, isDev) => {
|
|
|
157
172
|
},
|
|
158
173
|
shutdown: async () => Promise.all([posthog?.shutdown(), june?.closeAndFlush(), log?.flush()]),
|
|
159
174
|
// export dependencies
|
|
160
|
-
|
|
175
|
+
_intercom,
|
|
161
176
|
posthog,
|
|
162
177
|
june,
|
|
163
178
|
log,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["tracking/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["tracking/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,4DAAoD;AACpD,+CAAuC;AACvC,gCAAkE;AAClE,yCAAyC;AAGzC,0CAAwB;AAExB,MAAM,cAAc,GAAG;IACrB,gCAAgC,EAAE,sCAAsC;IACxE,+BAA+B,EAAE,sCAAsC;IACvE,0BAA0B,EAAE,sCAA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AAE,MAAM;iBACnB,CAAC,CAAC;gBACH,IAAI,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE;oBAC1D,IAAI,GAAG;wBAAE,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBAC9B,CAAC,CAAC,CAAC;YACL,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,SAAS;QACT,OAAO;QACP,IAAI;QACJ,GAAG;KACJ,CAAC;AACJ,CAAC,CAAC;AAhKW,QAAA,WAAW,eAgKtB"}
|
|
@@ -4,7 +4,7 @@ export declare class IntercomAPI {
|
|
|
4
4
|
private headers;
|
|
5
5
|
private log?;
|
|
6
6
|
private fetch;
|
|
7
|
-
getUserByUserId(userId: string): Promise<
|
|
7
|
+
getUserByUserId(userId: string): Promise<{
|
|
8
8
|
type: "list";
|
|
9
9
|
data: {
|
|
10
10
|
id: string;
|
|
@@ -34,7 +34,7 @@ export declare class IntercomAPI {
|
|
|
34
34
|
[key: string]: any;
|
|
35
35
|
};
|
|
36
36
|
}): Promise<unknown>;
|
|
37
|
-
deleteUser(intercom_contact_id: string): Promise<
|
|
37
|
+
deleteUser(intercom_contact_id: string): Promise<{
|
|
38
38
|
id: "6657adf56abd0167d9419d1c";
|
|
39
39
|
external_id: "70";
|
|
40
40
|
type: "contact";
|
|
@@ -47,7 +47,7 @@ export declare class IntercomAPI {
|
|
|
47
47
|
deleteCompanyUser({ intercom_company_id, intercom_contact_id, }: {
|
|
48
48
|
intercom_contact_id: string;
|
|
49
49
|
intercom_company_id: string;
|
|
50
|
-
}): Promise<
|
|
50
|
+
}): Promise<{
|
|
51
51
|
id: "6657adc96abd0167d9419ca7";
|
|
52
52
|
} | undefined>;
|
|
53
53
|
trackEvent(data: {
|
|
@@ -55,7 +55,7 @@ export declare class IntercomAPI {
|
|
|
55
55
|
event_name: string;
|
|
56
56
|
metadata: Record<string, any>;
|
|
57
57
|
}): Promise<unknown>;
|
|
58
|
-
getCompanyByTenantId(tenantId: string): Promise<
|
|
58
|
+
getCompanyByTenantId(tenantId: string): Promise<{
|
|
59
59
|
type: "list";
|
|
60
60
|
data: [{
|
|
61
61
|
type: "company";
|
|
@@ -100,7 +100,7 @@ export declare class IntercomAPI {
|
|
|
100
100
|
companyId: string;
|
|
101
101
|
data: Record<string, any>;
|
|
102
102
|
}): Promise<unknown>;
|
|
103
|
-
deleteCompany(intercom_company_id: string): Promise<
|
|
103
|
+
deleteCompany(intercom_company_id: string): Promise<{
|
|
104
104
|
id: "6657adc96abd0167d9419ca7";
|
|
105
105
|
object: "company";
|
|
106
106
|
deleted: true;
|
|
@@ -64,24 +64,24 @@ class IntercomAPI {
|
|
|
64
64
|
value: userId,
|
|
65
65
|
},
|
|
66
66
|
},
|
|
67
|
-
})
|
|
67
|
+
});
|
|
68
68
|
}
|
|
69
69
|
async createUser({ data, userId, }) {
|
|
70
70
|
return await this.fetch('/contacts', {
|
|
71
71
|
method: 'POST',
|
|
72
72
|
data: { ...data, external_id: userId },
|
|
73
|
-
})
|
|
73
|
+
});
|
|
74
74
|
}
|
|
75
75
|
async updateUser({ data, contactId, }) {
|
|
76
76
|
return await this.fetch(`/contacts/${contactId}`, {
|
|
77
77
|
method: 'PUT',
|
|
78
78
|
data,
|
|
79
|
-
})
|
|
79
|
+
});
|
|
80
80
|
}
|
|
81
81
|
async deleteUser(intercom_contact_id) {
|
|
82
82
|
return await this.fetch(`/contacts/${intercom_contact_id}`, {
|
|
83
83
|
method: 'DELETE',
|
|
84
|
-
})
|
|
84
|
+
});
|
|
85
85
|
}
|
|
86
86
|
async createCompanyUser(data) {
|
|
87
87
|
return await this.fetch(`/contacts/${data.intercom_contact_id}/companies`, {
|
|
@@ -89,12 +89,12 @@ class IntercomAPI {
|
|
|
89
89
|
data: {
|
|
90
90
|
id: data.intercom_company_id,
|
|
91
91
|
},
|
|
92
|
-
})
|
|
92
|
+
});
|
|
93
93
|
}
|
|
94
94
|
async deleteCompanyUser({ intercom_company_id, intercom_contact_id, }) {
|
|
95
95
|
return await this.fetch(`/contacts/${intercom_contact_id}/companies/${intercom_company_id}`, {
|
|
96
96
|
method: 'DELETE',
|
|
97
|
-
})
|
|
97
|
+
});
|
|
98
98
|
}
|
|
99
99
|
async trackEvent(data) {
|
|
100
100
|
return await this.fetch('/events', {
|
|
@@ -103,13 +103,13 @@ class IntercomAPI {
|
|
|
103
103
|
created_at: Math.floor(new Date().getTime() / 1000), // to seconds
|
|
104
104
|
...data,
|
|
105
105
|
},
|
|
106
|
-
})
|
|
106
|
+
});
|
|
107
107
|
}
|
|
108
108
|
// Company
|
|
109
109
|
async getCompanyByTenantId(tenantId) {
|
|
110
110
|
return await this.fetch(`/companies?company_id=${tenantId}`, {
|
|
111
111
|
method: 'GET',
|
|
112
|
-
})
|
|
112
|
+
});
|
|
113
113
|
}
|
|
114
114
|
async createCompany({ data, tenantId, }) {
|
|
115
115
|
return await this.fetch('/companies', {
|
|
@@ -118,18 +118,18 @@ class IntercomAPI {
|
|
|
118
118
|
...data,
|
|
119
119
|
company_id: tenantId,
|
|
120
120
|
},
|
|
121
|
-
})
|
|
121
|
+
});
|
|
122
122
|
}
|
|
123
123
|
async updateCompany({ data, companyId, }) {
|
|
124
124
|
return await this.fetch(`/companies/${companyId}`, {
|
|
125
125
|
method: 'PUT',
|
|
126
126
|
data,
|
|
127
|
-
})
|
|
127
|
+
});
|
|
128
128
|
}
|
|
129
129
|
async deleteCompany(intercom_company_id) {
|
|
130
130
|
return await this.fetch(`/companies/${intercom_company_id}`, {
|
|
131
131
|
method: 'DELETE',
|
|
132
|
-
})
|
|
132
|
+
});
|
|
133
133
|
}
|
|
134
134
|
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oBAAoB,CAAC,QAAgB;QACzC,OAAO,MAAM,IAAI,CAAC,KAAK,CAoCpB,yBAAyB,QAAQ,EAAE,EAAE;YACtC,MAAM,EAAE,KAAK;SACd,CAAC,CAAC;IACL,CAAC;IACD,KAAK,CAAC,aAAa,CAAC,EAClB,IAAI,EACJ,QAAQ,GAQT;QACC,OAAO,MAAM,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE;YACpC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE;gBACJ,GAAG,IAAI;gBACP,UAAU,EAAE,QAAQ;aACrB;SACF,CAAC,CAAC;IACL,CAAC;IACD,KAAK,CAAC,aAAa,CAAC,EAClB,IAAI,EACJ,SAAS,GAIV;QACC,OAAO,MAAM,IAAI,CAAC,KAAK,CAAC,cAAc,SAAS,EAAE,EAAE;YACjD,MAAM,EAAE,KAAK;YACb,IAAI;SACL,CAAC,CAAC;IACL,CAAC;IACD,KAAK,CAAC,aAAa,CAAC,mBAA2B;QAC7C,OAAO,MAAM,IAAI,CAAC,KAAK,CAIpB,cAAc,mBAAmB,EAAE,EAAE;YACtC,MAAM,EAAE,QAAQ;SACjB,CAAC,CAAC;IACL,CAAC;CACF;AA3PD,kCA2PC;AAED,SAAgB,WAAW,CAAC,KAAa,EAAE,GAAS;IAClD,OAAO,IAAI,WAAW,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
type AuthEvent = 'account_signin_completed' | 'account_signup_code_requested' | 'account_signup_code_completed' | 'account_signup_code_failed' | 'account_signup_completed' | 'account_password_reset_requested' | 'account_password_reset_failed' | 'account_password_reset_completed' | 'account_invitation_accepted' | 'account_signed_out';
|
|
2
|
+
type TeamEvent = 'team_added' | 'team_info_updated' | 'team_deleted' | 'team_member_removed';
|
|
3
|
+
type ConnectionEvent = 'connection_created' | 'connection_reconnected' | 'connection_deleted' | 'connection_requested';
|
|
4
|
+
type OwnershipEvent = 'ownership_created' | 'ownership_updated' | 'ownership_deleted';
|
|
5
|
+
type OwnerEvent = 'owner_created' | 'owner_updated' | 'owner_deleted' | 'owner_tax_info_modal_opened' | 'owner_tax_info_modal_submitted';
|
|
6
|
+
type SetupEvent = 'setup_classes_set' | 'setup_accounting_version_completed' | 'setup_accounting_config_completed' | 'setup_owner_imported' | 'setup_listing_imported';
|
|
7
|
+
type AutomationEvent = 'automation_created' | 'automation_updated' | 'automation_deleted';
|
|
8
|
+
type TaxStatementEvent = 'tax_statement_preview_opened' | 'tax_statement_downloaded';
|
|
9
|
+
type GLOwnerStatementEvent = 'gl_owner_statement_preview_opened' | 'gl_owner_statement_downloaded';
|
|
10
|
+
type HyperlineEvent = 'hyperline_invoice_ready' | 'hyperline_invoice_settled' | 'hyperline_trial_started' | 'hyperline_trial_ended' | 'hyperline_subscription_activated' | 'hyperline_subscription_cancelled' | 'hyperline_subscription_created' | 'hyperline_subscription_errored' | 'hyperline_subscription_paused' | 'hyperline_subscription_voided' | 'hyperline_subscription_charged' | 'hyperline_customer_created' | 'hyperline_customer_updated' | 'hyperline_payment_method_created' | 'hyperline_payment_method_errored' | 'hyperline_payment_method_deleted';
|
|
11
|
+
type ListingEvent = 'listing_activated' | 'listing_deactivated';
|
|
12
|
+
type ReportEvent = 'listings_reported';
|
|
13
|
+
type UserEvent = 'update_refresh_accepted' | 'owner_statement_opened';
|
|
14
|
+
type TestEvent = 'test_event' | 'test_error';
|
|
15
|
+
export type TrackingEvent = AuthEvent | TeamEvent | ConnectionEvent | OwnershipEvent | OwnerEvent | SetupEvent | AutomationEvent | TaxStatementEvent | GLOwnerStatementEvent | HyperlineEvent | UserEvent | ListingEvent | ReportEvent | TestEvent;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"src/","sources":["tracking/types.ts"],"names":[],"mappings":""}
|
|
@@ -2,23 +2,10 @@ import { Analytics } from '@june-so/analytics-node';
|
|
|
2
2
|
import { PostHog } from 'posthog-node';
|
|
3
3
|
import { type LogBindings, type WorkerLog } from '../log';
|
|
4
4
|
import { useIntercom } from './intercom';
|
|
5
|
+
import type { TrackingEvent } from './types';
|
|
6
|
+
export * from './types';
|
|
5
7
|
export declare const isTest: (userId: string, groupId?: string, userEmail?: string) => boolean | "" | undefined;
|
|
6
8
|
export declare const convertKeysToSnakeCase: (obj?: Record<string, any>) => Record<string, any>;
|
|
7
|
-
type AuthEvent = 'account_signin_completed' | 'account_signup_code_requested' | 'account_signup_code_completed' | 'account_signup_code_failed' | 'account_signup_completed' | 'account_password_reset_requested' | 'account_password_reset_failed' | 'account_password_reset_completed' | 'account_invitation_accepted' | 'account_signed_out';
|
|
8
|
-
type TeamEvent = 'team_added' | 'team_info_updated' | 'team_deleted' | 'team_member_removed';
|
|
9
|
-
type ConnectionEvent = 'connection_created' | 'connection_reconnected' | 'connection_deleted' | 'connection_requested';
|
|
10
|
-
type OwnershipEvent = 'ownership_created' | 'ownership_updated' | 'ownership_deleted';
|
|
11
|
-
type OwnerEvent = 'owner_created' | 'owner_updated' | 'owner_deleted' | 'owner_tax_info_modal_opened' | 'owner_tax_info_modal_submitted';
|
|
12
|
-
type SetupEvent = 'setup_classes_set' | 'setup_accounting_version_completed' | 'setup_accounting_config_completed' | 'setup_owner_imported' | 'setup_listing_imported';
|
|
13
|
-
type AutomationEvent = 'automation_created' | 'automation_updated' | 'automation_deleted';
|
|
14
|
-
type TaxStatementEvent = 'tax_statement_preview_opened' | 'tax_statement_downloaded';
|
|
15
|
-
type GLOwnerStatementEvent = 'gl_owner_statement_preview_opened' | 'gl_owner_statement_downloaded';
|
|
16
|
-
type HyperlineEvent = 'hyperline_invoice_ready' | 'hyperline_invoice_settled' | 'hyperline_trial_started' | 'hyperline_trial_ended' | 'hyperline_subscription_activated' | 'hyperline_subscription_cancelled' | 'hyperline_subscription_created' | 'hyperline_subscription_errored' | 'hyperline_subscription_paused' | 'hyperline_subscription_voided' | 'hyperline_subscription_charged' | 'hyperline_customer_created' | 'hyperline_customer_updated' | 'hyperline_payment_method_created' | 'hyperline_payment_method_errored' | 'hyperline_payment_method_deleted';
|
|
17
|
-
type ListingEvent = 'listing_activated' | 'listing_deactivated';
|
|
18
|
-
type ReportEvent = 'listings_reported';
|
|
19
|
-
type UserEvent = 'update_refresh_accepted' | 'owner_statement_opened';
|
|
20
|
-
type TestEvent = 'test_event' | 'test_error';
|
|
21
|
-
export type TrackingEvent = AuthEvent | TeamEvent | ConnectionEvent | OwnershipEvent | OwnerEvent | SetupEvent | AutomationEvent | TaxStatementEvent | GLOwnerStatementEvent | HyperlineEvent | UserEvent | ListingEvent | ReportEvent | TestEvent;
|
|
22
9
|
export type TrackingProps = {
|
|
23
10
|
name: string;
|
|
24
11
|
dataset: string;
|
|
@@ -61,7 +48,6 @@ export declare const useTracking: ({ dataset, env, name }: TrackingProps, isDev?
|
|
|
61
48
|
shutdown: () => Promise<any>;
|
|
62
49
|
log: WorkerLog;
|
|
63
50
|
june?: Analytics;
|
|
64
|
-
|
|
51
|
+
_intercom?: ReturnType<typeof useIntercom>;
|
|
65
52
|
posthog?: PostHog;
|
|
66
53
|
};
|
|
67
|
-
export {};
|
|
@@ -2,6 +2,7 @@ import { Analytics } from '@june-so/analytics-node';
|
|
|
2
2
|
import { PostHog } from 'posthog-node';
|
|
3
3
|
import { useLog } from '../log';
|
|
4
4
|
import { useIntercom } from './intercom';
|
|
5
|
+
export * from './types';
|
|
5
6
|
const E2E_TEST_USERS = {
|
|
6
7
|
'e2e-invite-member@finalytic.io': '113d73d8-ee21-46b7-a12a-a74f632401ca',
|
|
7
8
|
'e2e-invite-owner@finalytic.io': '917b7c4e-cb03-491c-9e94-d33a5bdeca05',
|
|
@@ -37,7 +38,7 @@ export const convertKeysToSnakeCase = (obj) => {
|
|
|
37
38
|
};
|
|
38
39
|
export const useTracking = ({ dataset, env, name }, isDev) => {
|
|
39
40
|
const log = useLog({ name, dataset, env });
|
|
40
|
-
const
|
|
41
|
+
const _intercom = env.INTERCOM_TOKEN
|
|
41
42
|
? useIntercom(env.INTERCOM_TOKEN, log)
|
|
42
43
|
: undefined;
|
|
43
44
|
const june = env.JUNESO_TOKEN ? new Analytics(env.JUNESO_TOKEN) : undefined;
|
|
@@ -94,7 +95,7 @@ export const useTracking = ({ dataset, env, name }, isDev) => {
|
|
|
94
95
|
console.error(err);
|
|
95
96
|
});
|
|
96
97
|
try {
|
|
97
|
-
await
|
|
98
|
+
await _intercom?.trackEvent({
|
|
98
99
|
user_id: userId,
|
|
99
100
|
event_name: event,
|
|
100
101
|
metadata: properties,
|
|
@@ -152,7 +153,7 @@ export const useTracking = ({ dataset, env, name }, isDev) => {
|
|
|
152
153
|
},
|
|
153
154
|
shutdown: async () => Promise.all([posthog?.shutdown(), june?.closeAndFlush(), log?.flush()]),
|
|
154
155
|
// export dependencies
|
|
155
|
-
|
|
156
|
+
_intercom,
|
|
156
157
|
posthog,
|
|
157
158
|
june,
|
|
158
159
|
log,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["tracking/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAoC,MAAM,EAAE,MAAM,QAAQ,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["tracking/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAoC,MAAM,EAAE,MAAM,QAAQ,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGzC,cAAc,SAAS,CAAC;AAExB,MAAM,cAAc,GAAG;IACrB,gCAAgC,EAAE,sC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;gBACH,IAAI,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE;oBAC1D,IAAI,GAAG;wBAAE,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBAC9B,CAAC,CAAC,CAAC;YACL,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,SAAS;QACT,OAAO;QACP,IAAI;QACJ,GAAG;KACJ,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -4,7 +4,7 @@ export declare class IntercomAPI {
|
|
|
4
4
|
private headers;
|
|
5
5
|
private log?;
|
|
6
6
|
private fetch;
|
|
7
|
-
getUserByUserId(userId: string): Promise<
|
|
7
|
+
getUserByUserId(userId: string): Promise<{
|
|
8
8
|
type: "list";
|
|
9
9
|
data: {
|
|
10
10
|
id: string;
|
|
@@ -34,7 +34,7 @@ export declare class IntercomAPI {
|
|
|
34
34
|
[key: string]: any;
|
|
35
35
|
};
|
|
36
36
|
}): Promise<unknown>;
|
|
37
|
-
deleteUser(intercom_contact_id: string): Promise<
|
|
37
|
+
deleteUser(intercom_contact_id: string): Promise<{
|
|
38
38
|
id: "6657adf56abd0167d9419d1c";
|
|
39
39
|
external_id: "70";
|
|
40
40
|
type: "contact";
|
|
@@ -47,7 +47,7 @@ export declare class IntercomAPI {
|
|
|
47
47
|
deleteCompanyUser({ intercom_company_id, intercom_contact_id, }: {
|
|
48
48
|
intercom_contact_id: string;
|
|
49
49
|
intercom_company_id: string;
|
|
50
|
-
}): Promise<
|
|
50
|
+
}): Promise<{
|
|
51
51
|
id: "6657adc96abd0167d9419ca7";
|
|
52
52
|
} | undefined>;
|
|
53
53
|
trackEvent(data: {
|
|
@@ -55,7 +55,7 @@ export declare class IntercomAPI {
|
|
|
55
55
|
event_name: string;
|
|
56
56
|
metadata: Record<string, any>;
|
|
57
57
|
}): Promise<unknown>;
|
|
58
|
-
getCompanyByTenantId(tenantId: string): Promise<
|
|
58
|
+
getCompanyByTenantId(tenantId: string): Promise<{
|
|
59
59
|
type: "list";
|
|
60
60
|
data: [{
|
|
61
61
|
type: "company";
|
|
@@ -100,7 +100,7 @@ export declare class IntercomAPI {
|
|
|
100
100
|
companyId: string;
|
|
101
101
|
data: Record<string, any>;
|
|
102
102
|
}): Promise<unknown>;
|
|
103
|
-
deleteCompany(intercom_company_id: string): Promise<
|
|
103
|
+
deleteCompany(intercom_company_id: string): Promise<{
|
|
104
104
|
id: "6657adc96abd0167d9419ca7";
|
|
105
105
|
object: "company";
|
|
106
106
|
deleted: true;
|
|
@@ -62,24 +62,24 @@ export class IntercomAPI {
|
|
|
62
62
|
value: userId,
|
|
63
63
|
},
|
|
64
64
|
},
|
|
65
|
-
})
|
|
65
|
+
});
|
|
66
66
|
}
|
|
67
67
|
async createUser({ data, userId, }) {
|
|
68
68
|
return await this.fetch('/contacts', {
|
|
69
69
|
method: 'POST',
|
|
70
70
|
data: { ...data, external_id: userId },
|
|
71
|
-
})
|
|
71
|
+
});
|
|
72
72
|
}
|
|
73
73
|
async updateUser({ data, contactId, }) {
|
|
74
74
|
return await this.fetch(`/contacts/${contactId}`, {
|
|
75
75
|
method: 'PUT',
|
|
76
76
|
data,
|
|
77
|
-
})
|
|
77
|
+
});
|
|
78
78
|
}
|
|
79
79
|
async deleteUser(intercom_contact_id) {
|
|
80
80
|
return await this.fetch(`/contacts/${intercom_contact_id}`, {
|
|
81
81
|
method: 'DELETE',
|
|
82
|
-
})
|
|
82
|
+
});
|
|
83
83
|
}
|
|
84
84
|
async createCompanyUser(data) {
|
|
85
85
|
return await this.fetch(`/contacts/${data.intercom_contact_id}/companies`, {
|
|
@@ -87,12 +87,12 @@ export class IntercomAPI {
|
|
|
87
87
|
data: {
|
|
88
88
|
id: data.intercom_company_id,
|
|
89
89
|
},
|
|
90
|
-
})
|
|
90
|
+
});
|
|
91
91
|
}
|
|
92
92
|
async deleteCompanyUser({ intercom_company_id, intercom_contact_id, }) {
|
|
93
93
|
return await this.fetch(`/contacts/${intercom_contact_id}/companies/${intercom_company_id}`, {
|
|
94
94
|
method: 'DELETE',
|
|
95
|
-
})
|
|
95
|
+
});
|
|
96
96
|
}
|
|
97
97
|
async trackEvent(data) {
|
|
98
98
|
return await this.fetch('/events', {
|
|
@@ -101,13 +101,13 @@ export class IntercomAPI {
|
|
|
101
101
|
created_at: Math.floor(new Date().getTime() / 1000), // to seconds
|
|
102
102
|
...data,
|
|
103
103
|
},
|
|
104
|
-
})
|
|
104
|
+
});
|
|
105
105
|
}
|
|
106
106
|
// Company
|
|
107
107
|
async getCompanyByTenantId(tenantId) {
|
|
108
108
|
return await this.fetch(`/companies?company_id=${tenantId}`, {
|
|
109
109
|
method: 'GET',
|
|
110
|
-
})
|
|
110
|
+
});
|
|
111
111
|
}
|
|
112
112
|
async createCompany({ data, tenantId, }) {
|
|
113
113
|
return await this.fetch('/companies', {
|
|
@@ -116,18 +116,18 @@ export class IntercomAPI {
|
|
|
116
116
|
...data,
|
|
117
117
|
company_id: tenantId,
|
|
118
118
|
},
|
|
119
|
-
})
|
|
119
|
+
});
|
|
120
120
|
}
|
|
121
121
|
async updateCompany({ data, companyId, }) {
|
|
122
122
|
return await this.fetch(`/companies/${companyId}`, {
|
|
123
123
|
method: 'PUT',
|
|
124
124
|
data,
|
|
125
|
-
})
|
|
125
|
+
});
|
|
126
126
|
}
|
|
127
127
|
async deleteCompany(intercom_company_id) {
|
|
128
128
|
return await this.fetch(`/companies/${intercom_company_id}`, {
|
|
129
129
|
method: 'DELETE',
|
|
130
|
-
})
|
|
130
|
+
});
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
export function useIntercom(token, log) {
|
|
@@ -1 +1 @@
|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CAAC,QAAgB;QACzC,OAAO,MAAM,IAAI,CAAC,KAAK,CAoCpB,yBAAyB,QAAQ,EAAE,EAAE;YACtC,MAAM,EAAE,KAAK;SACd,CAAC,CAAC;IACL,CAAC;IACD,KAAK,CAAC,aAAa,CAAC,EAClB,IAAI,EACJ,QAAQ,GAQT;QACC,OAAO,MAAM,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE;YACpC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE;gBACJ,GAAG,IAAI;gBACP,UAAU,EAAE,QAAQ;aACrB;SACF,CAAC,CAAC;IACL,CAAC;IACD,KAAK,CAAC,aAAa,CAAC,EAClB,IAAI,EACJ,SAAS,GAIV;QACC,OAAO,MAAM,IAAI,CAAC,KAAK,CAAC,cAAc,SAAS,EAAE,EAAE;YACjD,MAAM,EAAE,KAAK;YACb,IAAI;SACL,CAAC,CAAC;IACL,CAAC;IACD,KAAK,CAAC,aAAa,CAAC,mBAA2B;QAC7C,OAAO,MAAM,IAAI,CAAC,KAAK,CAIpB,cAAc,mBAAmB,EAAE,EAAE;YACtC,MAAM,EAAE,QAAQ;SACjB,CAAC,CAAC;IACL,CAAC;CACF;AAED,MAAM,UAAU,WAAW,CAAC,KAAa,EAAE,GAAS;IAClD,OAAO,IAAI,WAAW,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
type AuthEvent = 'account_signin_completed' | 'account_signup_code_requested' | 'account_signup_code_completed' | 'account_signup_code_failed' | 'account_signup_completed' | 'account_password_reset_requested' | 'account_password_reset_failed' | 'account_password_reset_completed' | 'account_invitation_accepted' | 'account_signed_out';
|
|
2
|
+
type TeamEvent = 'team_added' | 'team_info_updated' | 'team_deleted' | 'team_member_removed';
|
|
3
|
+
type ConnectionEvent = 'connection_created' | 'connection_reconnected' | 'connection_deleted' | 'connection_requested';
|
|
4
|
+
type OwnershipEvent = 'ownership_created' | 'ownership_updated' | 'ownership_deleted';
|
|
5
|
+
type OwnerEvent = 'owner_created' | 'owner_updated' | 'owner_deleted' | 'owner_tax_info_modal_opened' | 'owner_tax_info_modal_submitted';
|
|
6
|
+
type SetupEvent = 'setup_classes_set' | 'setup_accounting_version_completed' | 'setup_accounting_config_completed' | 'setup_owner_imported' | 'setup_listing_imported';
|
|
7
|
+
type AutomationEvent = 'automation_created' | 'automation_updated' | 'automation_deleted';
|
|
8
|
+
type TaxStatementEvent = 'tax_statement_preview_opened' | 'tax_statement_downloaded';
|
|
9
|
+
type GLOwnerStatementEvent = 'gl_owner_statement_preview_opened' | 'gl_owner_statement_downloaded';
|
|
10
|
+
type HyperlineEvent = 'hyperline_invoice_ready' | 'hyperline_invoice_settled' | 'hyperline_trial_started' | 'hyperline_trial_ended' | 'hyperline_subscription_activated' | 'hyperline_subscription_cancelled' | 'hyperline_subscription_created' | 'hyperline_subscription_errored' | 'hyperline_subscription_paused' | 'hyperline_subscription_voided' | 'hyperline_subscription_charged' | 'hyperline_customer_created' | 'hyperline_customer_updated' | 'hyperline_payment_method_created' | 'hyperline_payment_method_errored' | 'hyperline_payment_method_deleted';
|
|
11
|
+
type ListingEvent = 'listing_activated' | 'listing_deactivated';
|
|
12
|
+
type ReportEvent = 'listings_reported';
|
|
13
|
+
type UserEvent = 'update_refresh_accepted' | 'owner_statement_opened';
|
|
14
|
+
type TestEvent = 'test_event' | 'test_error';
|
|
15
|
+
export type TrackingEvent = AuthEvent | TeamEvent | ConnectionEvent | OwnershipEvent | OwnerEvent | SetupEvent | AutomationEvent | TaxStatementEvent | GLOwnerStatementEvent | HyperlineEvent | UserEvent | ListingEvent | ReportEvent | TestEvent;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"src/","sources":["tracking/types.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vrplatform/log",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.29",
|
|
4
4
|
"main": "src/index.ts",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@axiomhq/js": "1.0.0-rc.3",
|
|
38
38
|
"@june-so/analytics-node": "^8.0.0",
|
|
39
|
+
"intercom-client": "^6.0.0-alpha1",
|
|
39
40
|
"posthog-node": "^4.0.1",
|
|
40
41
|
"serialize-error": "11.0.3"
|
|
41
42
|
},
|
package/src/tracking/index.ts
CHANGED
|
@@ -2,6 +2,9 @@ import { Analytics } from '@june-so/analytics-node';
|
|
|
2
2
|
import { PostHog } from 'posthog-node';
|
|
3
3
|
import { type LogBindings, type WorkerLog, useLog } from '../log';
|
|
4
4
|
import { useIntercom } from './intercom';
|
|
5
|
+
import type { TrackingEvent } from './types';
|
|
6
|
+
|
|
7
|
+
export * from './types';
|
|
5
8
|
|
|
6
9
|
const E2E_TEST_USERS = {
|
|
7
10
|
'e2e-invite-member@finalytic.io': '113d73d8-ee21-46b7-a12a-a74f632401ca',
|
|
@@ -46,104 +49,6 @@ export const convertKeysToSnakeCase = (obj?: Record<string, any>) => {
|
|
|
46
49
|
return result;
|
|
47
50
|
};
|
|
48
51
|
|
|
49
|
-
type AuthEvent =
|
|
50
|
-
| 'account_signin_completed'
|
|
51
|
-
| 'account_signup_code_requested'
|
|
52
|
-
| 'account_signup_code_completed'
|
|
53
|
-
| 'account_signup_code_failed'
|
|
54
|
-
| 'account_signup_completed'
|
|
55
|
-
| 'account_password_reset_requested'
|
|
56
|
-
| 'account_password_reset_failed'
|
|
57
|
-
| 'account_password_reset_completed'
|
|
58
|
-
| 'account_invitation_accepted'
|
|
59
|
-
| 'account_signed_out';
|
|
60
|
-
|
|
61
|
-
type TeamEvent =
|
|
62
|
-
| 'team_added'
|
|
63
|
-
| 'team_info_updated'
|
|
64
|
-
| 'team_deleted'
|
|
65
|
-
| 'team_member_removed';
|
|
66
|
-
|
|
67
|
-
type ConnectionEvent =
|
|
68
|
-
| 'connection_created'
|
|
69
|
-
| 'connection_reconnected'
|
|
70
|
-
| 'connection_deleted'
|
|
71
|
-
| 'connection_requested';
|
|
72
|
-
|
|
73
|
-
type OwnershipEvent =
|
|
74
|
-
| 'ownership_created'
|
|
75
|
-
| 'ownership_updated'
|
|
76
|
-
| 'ownership_deleted';
|
|
77
|
-
|
|
78
|
-
type OwnerEvent =
|
|
79
|
-
| 'owner_created'
|
|
80
|
-
| 'owner_updated'
|
|
81
|
-
| 'owner_deleted'
|
|
82
|
-
| 'owner_tax_info_modal_opened'
|
|
83
|
-
| 'owner_tax_info_modal_submitted';
|
|
84
|
-
|
|
85
|
-
type SetupEvent =
|
|
86
|
-
| 'setup_classes_set'
|
|
87
|
-
| 'setup_accounting_version_completed'
|
|
88
|
-
| 'setup_accounting_config_completed'
|
|
89
|
-
| 'setup_owner_imported'
|
|
90
|
-
| 'setup_listing_imported';
|
|
91
|
-
|
|
92
|
-
type AutomationEvent =
|
|
93
|
-
| 'automation_created'
|
|
94
|
-
| 'automation_updated'
|
|
95
|
-
| 'automation_deleted';
|
|
96
|
-
|
|
97
|
-
type TaxStatementEvent =
|
|
98
|
-
| 'tax_statement_preview_opened'
|
|
99
|
-
| 'tax_statement_downloaded';
|
|
100
|
-
|
|
101
|
-
type GLOwnerStatementEvent =
|
|
102
|
-
| 'gl_owner_statement_preview_opened'
|
|
103
|
-
| 'gl_owner_statement_downloaded';
|
|
104
|
-
|
|
105
|
-
type HyperlineEvent =
|
|
106
|
-
| 'hyperline_invoice_ready'
|
|
107
|
-
| 'hyperline_invoice_settled'
|
|
108
|
-
| 'hyperline_trial_started'
|
|
109
|
-
| 'hyperline_trial_ended'
|
|
110
|
-
| 'hyperline_subscription_activated'
|
|
111
|
-
| 'hyperline_subscription_cancelled'
|
|
112
|
-
| 'hyperline_subscription_created'
|
|
113
|
-
| 'hyperline_subscription_errored'
|
|
114
|
-
| 'hyperline_subscription_paused'
|
|
115
|
-
| 'hyperline_subscription_voided'
|
|
116
|
-
| 'hyperline_subscription_charged'
|
|
117
|
-
| 'hyperline_customer_created'
|
|
118
|
-
| 'hyperline_customer_updated'
|
|
119
|
-
| 'hyperline_payment_method_created'
|
|
120
|
-
| 'hyperline_payment_method_errored'
|
|
121
|
-
| 'hyperline_payment_method_deleted';
|
|
122
|
-
|
|
123
|
-
type ListingEvent = 'listing_activated' | 'listing_deactivated';
|
|
124
|
-
|
|
125
|
-
type ReportEvent = 'listings_reported';
|
|
126
|
-
|
|
127
|
-
type UserEvent = 'update_refresh_accepted' | 'owner_statement_opened';
|
|
128
|
-
|
|
129
|
-
type TestEvent = 'test_event' | 'test_error';
|
|
130
|
-
|
|
131
|
-
export type TrackingEvent =
|
|
132
|
-
| AuthEvent
|
|
133
|
-
| TeamEvent
|
|
134
|
-
| ConnectionEvent
|
|
135
|
-
| OwnershipEvent
|
|
136
|
-
| OwnerEvent
|
|
137
|
-
| SetupEvent
|
|
138
|
-
| AutomationEvent
|
|
139
|
-
| TaxStatementEvent
|
|
140
|
-
| GLOwnerStatementEvent
|
|
141
|
-
| HyperlineEvent
|
|
142
|
-
| UserEvent
|
|
143
|
-
| ListingEvent
|
|
144
|
-
| ReportEvent
|
|
145
|
-
| TestEvent;
|
|
146
|
-
|
|
147
52
|
export type TrackingProps = {
|
|
148
53
|
name: string;
|
|
149
54
|
dataset: string;
|
|
@@ -192,14 +97,17 @@ export const useTracking = (
|
|
|
192
97
|
shutdown: () => Promise<any>;
|
|
193
98
|
log: WorkerLog;
|
|
194
99
|
june?: Analytics;
|
|
195
|
-
|
|
100
|
+
_intercom?: ReturnType<typeof useIntercom>;
|
|
196
101
|
posthog?: PostHog;
|
|
197
102
|
} => {
|
|
198
103
|
const log = useLog({ name, dataset, env });
|
|
199
|
-
|
|
104
|
+
|
|
105
|
+
const _intercom = env.INTERCOM_TOKEN
|
|
200
106
|
? useIntercom(env.INTERCOM_TOKEN, log)
|
|
201
107
|
: undefined;
|
|
108
|
+
|
|
202
109
|
const june = env.JUNESO_TOKEN ? new Analytics(env.JUNESO_TOKEN) : undefined;
|
|
110
|
+
|
|
203
111
|
const posthog = env.POSTHOG_TOKEN
|
|
204
112
|
? new PostHog(env.POSTHOG_TOKEN, {
|
|
205
113
|
host: 'https://app.posthog.com',
|
|
@@ -266,7 +174,7 @@ export const useTracking = (
|
|
|
266
174
|
);
|
|
267
175
|
|
|
268
176
|
try {
|
|
269
|
-
await
|
|
177
|
+
await _intercom?.trackEvent({
|
|
270
178
|
user_id: userId,
|
|
271
179
|
event_name: event,
|
|
272
180
|
metadata: properties,
|
|
@@ -334,7 +242,7 @@ export const useTracking = (
|
|
|
334
242
|
shutdown: async () =>
|
|
335
243
|
Promise.all([posthog?.shutdown(), june?.closeAndFlush(), log?.flush()]),
|
|
336
244
|
// export dependencies
|
|
337
|
-
|
|
245
|
+
_intercom,
|
|
338
246
|
posthog,
|
|
339
247
|
june,
|
|
340
248
|
log,
|
package/src/tracking/intercom.ts
CHANGED
|
@@ -86,7 +86,7 @@ export class IntercomAPI {
|
|
|
86
86
|
value: userId,
|
|
87
87
|
},
|
|
88
88
|
},
|
|
89
|
-
})
|
|
89
|
+
});
|
|
90
90
|
}
|
|
91
91
|
async createUser({
|
|
92
92
|
data,
|
|
@@ -102,7 +102,7 @@ export class IntercomAPI {
|
|
|
102
102
|
return await this.fetch('/contacts', {
|
|
103
103
|
method: 'POST',
|
|
104
104
|
data: { ...data, external_id: userId },
|
|
105
|
-
})
|
|
105
|
+
});
|
|
106
106
|
}
|
|
107
107
|
async updateUser({
|
|
108
108
|
data,
|
|
@@ -119,7 +119,7 @@ export class IntercomAPI {
|
|
|
119
119
|
return await this.fetch(`/contacts/${contactId}`, {
|
|
120
120
|
method: 'PUT',
|
|
121
121
|
data,
|
|
122
|
-
})
|
|
122
|
+
});
|
|
123
123
|
}
|
|
124
124
|
async deleteUser(intercom_contact_id: string) {
|
|
125
125
|
return await this.fetch<{
|
|
@@ -129,7 +129,7 @@ export class IntercomAPI {
|
|
|
129
129
|
deleted: true;
|
|
130
130
|
}>(`/contacts/${intercom_contact_id}`, {
|
|
131
131
|
method: 'DELETE',
|
|
132
|
-
})
|
|
132
|
+
});
|
|
133
133
|
}
|
|
134
134
|
async createCompanyUser(data: {
|
|
135
135
|
intercom_contact_id: string;
|
|
@@ -140,7 +140,7 @@ export class IntercomAPI {
|
|
|
140
140
|
data: {
|
|
141
141
|
id: data.intercom_company_id,
|
|
142
142
|
},
|
|
143
|
-
})
|
|
143
|
+
});
|
|
144
144
|
}
|
|
145
145
|
async deleteCompanyUser({
|
|
146
146
|
intercom_company_id,
|
|
@@ -153,7 +153,7 @@ export class IntercomAPI {
|
|
|
153
153
|
id: '6657adc96abd0167d9419ca7';
|
|
154
154
|
}>(`/contacts/${intercom_contact_id}/companies/${intercom_company_id}`, {
|
|
155
155
|
method: 'DELETE',
|
|
156
|
-
})
|
|
156
|
+
});
|
|
157
157
|
}
|
|
158
158
|
async trackEvent(data: {
|
|
159
159
|
user_id: string;
|
|
@@ -166,7 +166,7 @@ export class IntercomAPI {
|
|
|
166
166
|
created_at: Math.floor(new Date().getTime() / 1000), // to seconds
|
|
167
167
|
...data,
|
|
168
168
|
},
|
|
169
|
-
})
|
|
169
|
+
});
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
// Company
|
|
@@ -209,7 +209,7 @@ export class IntercomAPI {
|
|
|
209
209
|
total_count: 1;
|
|
210
210
|
}>(`/companies?company_id=${tenantId}`, {
|
|
211
211
|
method: 'GET',
|
|
212
|
-
})
|
|
212
|
+
});
|
|
213
213
|
}
|
|
214
214
|
async createCompany({
|
|
215
215
|
data,
|
|
@@ -228,7 +228,7 @@ export class IntercomAPI {
|
|
|
228
228
|
...data,
|
|
229
229
|
company_id: tenantId,
|
|
230
230
|
},
|
|
231
|
-
})
|
|
231
|
+
});
|
|
232
232
|
}
|
|
233
233
|
async updateCompany({
|
|
234
234
|
data,
|
|
@@ -240,7 +240,7 @@ export class IntercomAPI {
|
|
|
240
240
|
return await this.fetch(`/companies/${companyId}`, {
|
|
241
241
|
method: 'PUT',
|
|
242
242
|
data,
|
|
243
|
-
})
|
|
243
|
+
});
|
|
244
244
|
}
|
|
245
245
|
async deleteCompany(intercom_company_id: string) {
|
|
246
246
|
return await this.fetch<{
|
|
@@ -249,7 +249,7 @@ export class IntercomAPI {
|
|
|
249
249
|
deleted: true;
|
|
250
250
|
}>(`/companies/${intercom_company_id}`, {
|
|
251
251
|
method: 'DELETE',
|
|
252
|
-
})
|
|
252
|
+
});
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
255
|
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
type AuthEvent =
|
|
2
|
+
| 'account_signin_completed'
|
|
3
|
+
| 'account_signup_code_requested'
|
|
4
|
+
| 'account_signup_code_completed'
|
|
5
|
+
| 'account_signup_code_failed'
|
|
6
|
+
| 'account_signup_completed'
|
|
7
|
+
| 'account_password_reset_requested'
|
|
8
|
+
| 'account_password_reset_failed'
|
|
9
|
+
| 'account_password_reset_completed'
|
|
10
|
+
| 'account_invitation_accepted'
|
|
11
|
+
| 'account_signed_out';
|
|
12
|
+
|
|
13
|
+
type TeamEvent =
|
|
14
|
+
| 'team_added'
|
|
15
|
+
| 'team_info_updated'
|
|
16
|
+
| 'team_deleted'
|
|
17
|
+
| 'team_member_removed';
|
|
18
|
+
|
|
19
|
+
type ConnectionEvent =
|
|
20
|
+
| 'connection_created'
|
|
21
|
+
| 'connection_reconnected'
|
|
22
|
+
| 'connection_deleted'
|
|
23
|
+
| 'connection_requested';
|
|
24
|
+
|
|
25
|
+
type OwnershipEvent =
|
|
26
|
+
| 'ownership_created'
|
|
27
|
+
| 'ownership_updated'
|
|
28
|
+
| 'ownership_deleted';
|
|
29
|
+
|
|
30
|
+
type OwnerEvent =
|
|
31
|
+
| 'owner_created'
|
|
32
|
+
| 'owner_updated'
|
|
33
|
+
| 'owner_deleted'
|
|
34
|
+
| 'owner_tax_info_modal_opened'
|
|
35
|
+
| 'owner_tax_info_modal_submitted';
|
|
36
|
+
|
|
37
|
+
type SetupEvent =
|
|
38
|
+
| 'setup_classes_set'
|
|
39
|
+
| 'setup_accounting_version_completed'
|
|
40
|
+
| 'setup_accounting_config_completed'
|
|
41
|
+
| 'setup_owner_imported'
|
|
42
|
+
| 'setup_listing_imported';
|
|
43
|
+
|
|
44
|
+
type AutomationEvent =
|
|
45
|
+
| 'automation_created'
|
|
46
|
+
| 'automation_updated'
|
|
47
|
+
| 'automation_deleted';
|
|
48
|
+
|
|
49
|
+
type TaxStatementEvent =
|
|
50
|
+
| 'tax_statement_preview_opened'
|
|
51
|
+
| 'tax_statement_downloaded';
|
|
52
|
+
|
|
53
|
+
type GLOwnerStatementEvent =
|
|
54
|
+
| 'gl_owner_statement_preview_opened'
|
|
55
|
+
| 'gl_owner_statement_downloaded';
|
|
56
|
+
|
|
57
|
+
type HyperlineEvent =
|
|
58
|
+
| 'hyperline_invoice_ready'
|
|
59
|
+
| 'hyperline_invoice_settled'
|
|
60
|
+
| 'hyperline_trial_started'
|
|
61
|
+
| 'hyperline_trial_ended'
|
|
62
|
+
| 'hyperline_subscription_activated'
|
|
63
|
+
| 'hyperline_subscription_cancelled'
|
|
64
|
+
| 'hyperline_subscription_created'
|
|
65
|
+
| 'hyperline_subscription_errored'
|
|
66
|
+
| 'hyperline_subscription_paused'
|
|
67
|
+
| 'hyperline_subscription_voided'
|
|
68
|
+
| 'hyperline_subscription_charged'
|
|
69
|
+
| 'hyperline_customer_created'
|
|
70
|
+
| 'hyperline_customer_updated'
|
|
71
|
+
| 'hyperline_payment_method_created'
|
|
72
|
+
| 'hyperline_payment_method_errored'
|
|
73
|
+
| 'hyperline_payment_method_deleted';
|
|
74
|
+
|
|
75
|
+
type ListingEvent = 'listing_activated' | 'listing_deactivated';
|
|
76
|
+
|
|
77
|
+
type ReportEvent = 'listings_reported';
|
|
78
|
+
|
|
79
|
+
type UserEvent = 'update_refresh_accepted' | 'owner_statement_opened';
|
|
80
|
+
|
|
81
|
+
type TestEvent = 'test_event' | 'test_error';
|
|
82
|
+
|
|
83
|
+
export type TrackingEvent =
|
|
84
|
+
| AuthEvent
|
|
85
|
+
| TeamEvent
|
|
86
|
+
| ConnectionEvent
|
|
87
|
+
| OwnershipEvent
|
|
88
|
+
| OwnerEvent
|
|
89
|
+
| SetupEvent
|
|
90
|
+
| AutomationEvent
|
|
91
|
+
| TaxStatementEvent
|
|
92
|
+
| GLOwnerStatementEvent
|
|
93
|
+
| HyperlineEvent
|
|
94
|
+
| UserEvent
|
|
95
|
+
| ListingEvent
|
|
96
|
+
| ReportEvent
|
|
97
|
+
| TestEvent;
|