@vrplatform/log 2.0.0-alpha.27 → 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 +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 +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 +1 -1
- 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,sCAAsC;IAClE,2BAA2B,EAAE,sCAAsC;CACpE,CAAC;AAEF,MAAM,cAAc,GAAG;IACrB,uBAAuB,EAAE,sCAAsC;IAC/D,iBAAi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AE,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"}
|
|
@@ -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,sCAAsC;IACxE,+BAA+B,EAAE,sCAAsC;IACvE,0BAA0B,EAAE,sCAAsC;IAClE,2BAA2B,EAAE,sCAAsC;CACpE,CAAC;AAEF,MAAM,cAAc,GAAG;IACrB,uBAAuB,EAAE,sCAAsC;IAC/D,iBAAiB,EAAE,sCAAsC;CAC1D,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,MAAc,EAAE,OAAgB,EAAE,SAAkB,EAAE,EAAE,CAC7E,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC;IAC9C,CAAC,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC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,SAAS;QACT,OAAO;QACP,IAAI;QACJ,GAAG;KACJ,CAAC;AACJ,CAAC,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
|
@@ -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;
|