@vrplatform/log 3.0.2 → 3.0.6
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/log/color.d.ts +3 -4
- package/build/main/log/color.js +3 -3
- package/build/main/log/color.js.map +1 -1
- package/build/main/tracking/index.d.ts +8 -8
- package/build/main/tracking/index.js +16 -16
- package/build/main/tracking/index.js.map +1 -1
- package/build/main/tracking/types.d.ts +15 -3
- package/build/main/type.d.ts +37 -0
- package/build/main/type.js +3 -0
- 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/log/color.d.ts +3 -4
- package/build/module/log/color.js +1 -1
- package/build/module/log/color.js.map +1 -1
- package/build/module/tracking/index.d.ts +8 -8
- package/build/module/tracking/index.js +25 -25
- package/build/module/tracking/index.js.map +1 -1
- package/build/module/tracking/types.d.ts +15 -3
- package/build/module/type.d.ts +37 -0
- package/build/module/type.js +2 -0
- package/build/module/type.js.map +1 -0
- package/package.json +32 -26
- package/src/log/color.ts +4 -4
- package/src/tracking/index.ts +34 -34
- package/src/tracking/types.ts +24 -10
- package/build/main/log/index.spec.d.ts +0 -1
- package/build/main/log/index.spec.js +0 -59
- package/build/main/log/index.spec.js.map +0 -1
- package/build/module/log/index.spec.d.ts +0 -1
- package/build/module/log/index.spec.js +0 -57
- package/build/module/log/index.spec.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare module
|
|
1
|
+
declare module 'intercom-client' {
|
|
2
2
|
namespace Intercom {
|
|
3
3
|
interface CreateContactRequestWithExternalId {
|
|
4
4
|
/** A unique identifier for the contact which is given to Intercom */
|
|
@@ -22,7 +22,7 @@ declare module "intercom-client" {
|
|
|
22
22
|
}
|
|
23
23
|
interface UpdateContactRequest {
|
|
24
24
|
/** The role of the contact. */
|
|
25
|
-
role?:
|
|
25
|
+
role?: 'user' | 'lead';
|
|
26
26
|
/** A unique identifier for the contact which is given to Intercom */
|
|
27
27
|
external_id?: string;
|
|
28
28
|
/** The contacts email */
|
|
@@ -85,12 +85,12 @@ declare module "intercom-client" {
|
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
import { Intercom } from
|
|
89
|
-
import { type LogBindings, type WorkerLog } from
|
|
90
|
-
import type { GroupProps, IdentifyProps, TrackingEvent, TrackProps } from
|
|
91
|
-
export * from
|
|
92
|
-
export * from
|
|
93
|
-
export * from
|
|
88
|
+
import { Intercom } from 'intercom-client';
|
|
89
|
+
import { type LogBindings, type WorkerLog } from '../log';
|
|
90
|
+
import type { GroupProps, IdentifyProps, TrackingEvent, TrackProps } from './types';
|
|
91
|
+
export * from 'intercom-client';
|
|
92
|
+
export * from '../utils';
|
|
93
|
+
export * from './types';
|
|
94
94
|
export type Tracking = ReturnType<typeof useTracking>;
|
|
95
95
|
export type UseTracking = {
|
|
96
96
|
name?: string;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { useHasuraClient } from
|
|
2
|
-
import { Intercom } from
|
|
3
|
-
import { useLog } from
|
|
4
|
-
import { isTest, isVrpMember } from
|
|
5
|
-
import { convertValuesToString } from
|
|
6
|
-
import { MixpanelClient } from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
1
|
+
import { useHasuraClient } from '@vrplatform/graphql';
|
|
2
|
+
import { Intercom } from 'intercom-client';
|
|
3
|
+
import { useLog } from '../log';
|
|
4
|
+
import { isTest, isVrpMember } from '../utils';
|
|
5
|
+
import { convertValuesToString } from '../utils/convertValuesToString';
|
|
6
|
+
import { MixpanelClient } from './mixpanel';
|
|
7
|
+
export * from 'intercom-client';
|
|
8
|
+
export * from '../utils';
|
|
9
|
+
export * from './types';
|
|
10
10
|
export const useTracking = ({ dataset, env, name }, isDev) => {
|
|
11
11
|
const client = env.HASURA_ADMIN_SECRET || env.HASURA_GRAPHQL_ADMIN_SECRET
|
|
12
12
|
? useHasuraClient({
|
|
@@ -28,7 +28,7 @@ export const useTracking = ({ dataset, env, name }, isDev) => {
|
|
|
28
28
|
// General
|
|
29
29
|
track: async ({ userId, anonymousId, groupId, event, packageName, properties, timestamp, }, _import = false) => {
|
|
30
30
|
if (isDev ||
|
|
31
|
-
isTest(userId || anonymousId ||
|
|
31
|
+
isTest(userId || anonymousId || '', groupId) ||
|
|
32
32
|
isVrpMember(userId || anonymousId))
|
|
33
33
|
return;
|
|
34
34
|
const id = await client?.mutate((q) => q.insert_tracking_event_one({
|
|
@@ -91,19 +91,19 @@ export const useTracking = ({ dataset, env, name }, isDev) => {
|
|
|
91
91
|
if (mixpanel) {
|
|
92
92
|
mixpanel.identify(userId);
|
|
93
93
|
const {
|
|
94
|
-
// biome-ignore lint/correctness/noUnusedVariables:
|
|
94
|
+
// biome-ignore lint/correctness/noUnusedVariables: excluded to compute rest
|
|
95
95
|
firstName,
|
|
96
|
-
// biome-ignore lint/correctness/noUnusedVariables:
|
|
96
|
+
// biome-ignore lint/correctness/noUnusedVariables: excluded to compute rest
|
|
97
97
|
lastName,
|
|
98
|
-
// biome-ignore lint/correctness/noUnusedVariables:
|
|
98
|
+
// biome-ignore lint/correctness/noUnusedVariables: excluded to compute rest
|
|
99
99
|
name,
|
|
100
|
-
// biome-ignore lint/correctness/noUnusedVariables:
|
|
100
|
+
// biome-ignore lint/correctness/noUnusedVariables: excluded to compute rest
|
|
101
101
|
email,
|
|
102
|
-
// biome-ignore lint/correctness/noUnusedVariables:
|
|
102
|
+
// biome-ignore lint/correctness/noUnusedVariables: excluded to compute rest
|
|
103
103
|
avatar,
|
|
104
|
-
// biome-ignore lint/correctness/noUnusedVariables:
|
|
104
|
+
// biome-ignore lint/correctness/noUnusedVariables: excluded to compute rest
|
|
105
105
|
lastSeenAt,
|
|
106
|
-
// biome-ignore lint/correctness/noUnusedVariables:
|
|
106
|
+
// biome-ignore lint/correctness/noUnusedVariables: excluded to compute rest
|
|
107
107
|
createdAt, ...rest } = traits || {};
|
|
108
108
|
mixpanel.people.set({
|
|
109
109
|
$distinct_id: userId,
|
|
@@ -130,8 +130,8 @@ export const useTracking = ({ dataset, env, name }, isDev) => {
|
|
|
130
130
|
};
|
|
131
131
|
const intercomUser = (await intercom?.contacts.search({
|
|
132
132
|
query: {
|
|
133
|
-
field:
|
|
134
|
-
operator:
|
|
133
|
+
field: 'external_id',
|
|
134
|
+
operator: '=',
|
|
135
135
|
value: userId,
|
|
136
136
|
},
|
|
137
137
|
}))?.data?.at(0);
|
|
@@ -146,7 +146,7 @@ export const useTracking = ({ dataset, env, name }, isDev) => {
|
|
|
146
146
|
},
|
|
147
147
|
group: async ({ traits = {}, groupId, userId, anonymousId, }) => {
|
|
148
148
|
if (isDev ||
|
|
149
|
-
isTest(userId || anonymousId ||
|
|
149
|
+
isTest(userId || anonymousId || '', groupId) ||
|
|
150
150
|
isVrpMember(userId || anonymousId))
|
|
151
151
|
return;
|
|
152
152
|
// add teamId to traits
|
|
@@ -155,11 +155,11 @@ export const useTracking = ({ dataset, env, name }, isDev) => {
|
|
|
155
155
|
const cid = traits?.billingCustomerId;
|
|
156
156
|
const partner = traits?.partner || traits?.accountingPartner; // TODO: remove legacy accountingPartner
|
|
157
157
|
const billingPartner = traits?.billingPartner || traits?.partner || traits?.accountingPartner; // TODO: remove legacy accountingPartner
|
|
158
|
-
if (billingPartner ===
|
|
158
|
+
if (billingPartner === '0b6a7bd6-56cc-46b5-b2ab-1bd7d1e994fa')
|
|
159
159
|
return; // dismiss Demo and Test Console
|
|
160
160
|
// upsert mixpanel group
|
|
161
161
|
if (mixpanel)
|
|
162
|
-
mixpanel.group.set(
|
|
162
|
+
mixpanel.group.set('tenant', groupId, {
|
|
163
163
|
$distinct_id: groupId,
|
|
164
164
|
$name: traits?.name,
|
|
165
165
|
$avatar: traits.avatar,
|
|
@@ -185,7 +185,7 @@ export const useTracking = ({ dataset, env, name }, isDev) => {
|
|
|
185
185
|
trialUntil: traits?.trialUntil,
|
|
186
186
|
isOnboarding: traits?.isOnboarding,
|
|
187
187
|
isTest: billingPartner
|
|
188
|
-
? billingPartner ===
|
|
188
|
+
? billingPartner === 'Demo and Test Console'
|
|
189
189
|
: undefined,
|
|
190
190
|
});
|
|
191
191
|
let intercomCompany;
|
|
@@ -234,8 +234,8 @@ export const useTracking = ({ dataset, env, name }, isDev) => {
|
|
|
234
234
|
try {
|
|
235
235
|
const intercomUser = (await intercom?.contacts.search({
|
|
236
236
|
query: {
|
|
237
|
-
field:
|
|
238
|
-
operator:
|
|
237
|
+
field: 'external_id',
|
|
238
|
+
operator: '=',
|
|
239
239
|
value: userId,
|
|
240
240
|
},
|
|
241
241
|
}))?.data?.at(0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["tracking/index.ts"],"names":[],"mappings":"AAoGA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAoB,MAAM,EAAkB,MAAM,QAAQ,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAQ5C,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,c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AM,CAAC;wBAC9B,KAAK,EAAE;4BACL,KAAK,EAAE,aAAa;4BACpB,QAAQ,EAAE,GAAG;4BACb,KAAK,EAAE,MAAM;yBACd;qBACF,CAAC,CACH,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;oBACf,IAAI,YAAY,EAAE,EAAE,IAAI,eAAe,EAAE,EAAE;wBACzC,QAAQ,EAAE,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,YAAY,EAAE,EAAE,EAAE;4BACpD,UAAU,EAAE,eAAe,EAAE,EAAE;yBAChC,CAAC,CAAC;gBACP,CAAC;gBAAC,OAAO,CAAC,EAAE,CAAC;oBACX,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBACnB,CAAC;YACH,CAAC;QACH,CAAC;QACD,QAAQ,EAAE,KAAK,IAAI,EAAE;YACnB,GAAG,EAAE,KAAK,EAAE,CAAC;YACb,QAAQ,EAAE,KAAK,EAAE,CAAC;QACpB,CAAC;QACD,sBAAsB;QACtB,QAAQ;QACR,GAAG;KACJ,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { recurringFeeType_enum } from '@vrplatform/graphql';
|
|
1
|
+
import type { billing_payment_method_type_enum, recurringFeeType_enum } from '@vrplatform/graphql';
|
|
2
2
|
export type Maybe<T> = T | null | undefined;
|
|
3
3
|
export type TrackProps<T extends TrackingEvent> = OptionalUser<{
|
|
4
4
|
groupId: string;
|
|
@@ -66,6 +66,8 @@ export type TrackingEventProps = {
|
|
|
66
66
|
account_signup_completed: AccountSignupCompletedProps;
|
|
67
67
|
onboarding_account_settings_set: OnboardingAccountSettingsSetProps;
|
|
68
68
|
onboarding_completed: OnboardingCompletedProps;
|
|
69
|
+
getting_started_connection_skipped: GettingStartedConnectionSkippedProps;
|
|
70
|
+
getting_started_team_members_invite_skipped: GettingStartedTeamMembersInviteSkippedProps;
|
|
69
71
|
account_signed_out: AccountSignedOutProps;
|
|
70
72
|
account_signin_completed: AccountSigninCompletedProps;
|
|
71
73
|
account_password_reset_requested: AccountPasswordResetRequestedProps;
|
|
@@ -118,6 +120,7 @@ export type TrackingEventProps = {
|
|
|
118
120
|
hyperline_trial_started: HyperlineTrialStartedProps;
|
|
119
121
|
hyperline_trial_ended: HyperlineTrialEndedProps;
|
|
120
122
|
hyperline_subscription_cancellation_scheduled: HyperlineSubscriptionEventProps;
|
|
123
|
+
hyperline_subscription_created: HyperlineSubscriptionEventProps;
|
|
121
124
|
hyperline_subscription_charged: HyperlineSubscriptionEventProps;
|
|
122
125
|
hyperline_subscription_status_changed: HyperlineSubscriptionEventProps;
|
|
123
126
|
hyperline_customer_created: HyperlineCustomerCreatedProps;
|
|
@@ -153,7 +156,7 @@ export type TenantStatus = 'active' | 'inactive';
|
|
|
153
156
|
export type SubscriptionStatus = 'active' | 'cancelled' | 'draft' | 'errored' | 'paused' | 'pending' | 'voided';
|
|
154
157
|
export type OwnerStatementStatus = 'preview' | 'draft' | 'inReview' | 'void' | 'published' | 'posted';
|
|
155
158
|
export type TaxStatementStatus = 'draft' | 'ignored' | 'inReview' | 'ready' | 'submitted' | 'error';
|
|
156
|
-
export type PaymentMethodType =
|
|
159
|
+
export type PaymentMethodType = billing_payment_method_type_enum;
|
|
157
160
|
type AccountInvitationAcceptedProps = MaybePartial<{
|
|
158
161
|
userId: string;
|
|
159
162
|
userEmail: string;
|
|
@@ -245,6 +248,15 @@ type ConnectionRequestedProps = MaybePartial<{
|
|
|
245
248
|
userEmail: string;
|
|
246
249
|
tenantId: string;
|
|
247
250
|
}>;
|
|
251
|
+
type GettingStartedConnectionSkippedProps = MaybePartial<{
|
|
252
|
+
userId: string;
|
|
253
|
+
tenantId: string;
|
|
254
|
+
integration: 'airbnb' | 'stripe';
|
|
255
|
+
}>;
|
|
256
|
+
type GettingStartedTeamMembersInviteSkippedProps = MaybePartial<{
|
|
257
|
+
userId: string;
|
|
258
|
+
tenantId: string;
|
|
259
|
+
}>;
|
|
248
260
|
type AccountPasswordResetCompletedProps = MaybePartial<{
|
|
249
261
|
userEmail: string;
|
|
250
262
|
}>;
|
|
@@ -606,7 +618,7 @@ type ListingActivatedProps = MaybePartial<{
|
|
|
606
618
|
tenantId: string;
|
|
607
619
|
billingStatus: 'active' | 'inactive';
|
|
608
620
|
name: string;
|
|
609
|
-
vrpStatus: 'active' | '
|
|
621
|
+
vrpStatus: 'active' | 'inactive';
|
|
610
622
|
pmsStatus: string;
|
|
611
623
|
}>;
|
|
612
624
|
type ListingDeactivatedProps = ListingActivatedProps;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export type LogFn = (message: any, additionalContext?: Record<string, any>) => void;
|
|
2
|
+
export type Log = {
|
|
3
|
+
error: LogFn;
|
|
4
|
+
info: LogFn;
|
|
5
|
+
debug: LogFn;
|
|
6
|
+
warn: LogFn;
|
|
7
|
+
child: (data: ChildLogOptions) => Log;
|
|
8
|
+
addContext: (data: Record<string, any>) => void;
|
|
9
|
+
};
|
|
10
|
+
export type ChildLogOptions = {
|
|
11
|
+
correlationId?: string;
|
|
12
|
+
name?: string;
|
|
13
|
+
request?: any;
|
|
14
|
+
context?: Record<string, any>;
|
|
15
|
+
};
|
|
16
|
+
type Res = Response | {
|
|
17
|
+
status: number;
|
|
18
|
+
statusText?: string;
|
|
19
|
+
headers?: Record<string, string>;
|
|
20
|
+
body?: any;
|
|
21
|
+
response?: Response;
|
|
22
|
+
};
|
|
23
|
+
export type BaseLog = Log & {
|
|
24
|
+
flush(): Promise<void> | void;
|
|
25
|
+
};
|
|
26
|
+
export type WorkerLog = BaseLog & {
|
|
27
|
+
respond(response: Res | Promise<Res> | (() => Res | Promise<Res>)): Promise<Response>;
|
|
28
|
+
};
|
|
29
|
+
export type RequestLike = {
|
|
30
|
+
headers: {
|
|
31
|
+
get: (key: string) => string | null;
|
|
32
|
+
};
|
|
33
|
+
method: string;
|
|
34
|
+
url: string;
|
|
35
|
+
json: () => Promise<any>;
|
|
36
|
+
};
|
|
37
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"src/","sources":["type.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,14 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vrplatform/log",
|
|
3
|
-
"version": "3.0.
|
|
4
|
-
"main": "
|
|
3
|
+
"version": "3.0.6",
|
|
4
|
+
"main": "src/index.ts",
|
|
5
|
+
"packageManager": "bun@1.3.0",
|
|
5
6
|
"publishConfig": {
|
|
6
|
-
"access": "public"
|
|
7
|
+
"access": "public",
|
|
8
|
+
"main": "build/main/index.js",
|
|
9
|
+
"typings": "build/main/index.d.ts",
|
|
10
|
+
"module": "build/module/index.js"
|
|
7
11
|
},
|
|
8
12
|
"description": "VRPlatform Logs",
|
|
9
|
-
"repository":
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/vrplatform/ecosystem.git"
|
|
16
|
+
},
|
|
10
17
|
"license": "UNLICENSED",
|
|
11
18
|
"keywords": [],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"up": "bunx npm-check-updates --dep prod,dev,optional,overrides --interactive --format group",
|
|
21
|
+
"pub": "bun run build && npm version patch --no-git-tag-version && npm publish",
|
|
22
|
+
"pub:alpha": "bun run build && npm version prerelease --no-git-tag-version && npm publish --tag alpha",
|
|
23
|
+
"build": "bun build:main & bun build:module",
|
|
24
|
+
"build:main": "tsc -b tsconfig.main.json",
|
|
25
|
+
"build:module": "tsc -b tsconfig.esm.json",
|
|
26
|
+
"check": "bun run typecheck && bun run lint && bun run knip",
|
|
27
|
+
"typecheck": "tsc --noEmit",
|
|
28
|
+
"lint": "biome check .",
|
|
29
|
+
"lint:fix": "biome check --write --unsafe .",
|
|
30
|
+
"knip": "knip",
|
|
31
|
+
"pre-push": "bun typecheck && bun lint",
|
|
32
|
+
"prepare": "git config --local core.hooksPath .github",
|
|
33
|
+
"post-merge": "bun i"
|
|
34
|
+
},
|
|
12
35
|
"files": [
|
|
13
36
|
"build/main",
|
|
14
37
|
"build/module",
|
|
@@ -18,33 +41,16 @@
|
|
|
18
41
|
],
|
|
19
42
|
"dependencies": {
|
|
20
43
|
"@axiomhq/js": "1.3.1",
|
|
44
|
+
"@vrplatform/graphql": "1.1.18",
|
|
21
45
|
"intercom-client": "6.0.0-beta.3"
|
|
22
46
|
},
|
|
23
47
|
"devDependencies": {
|
|
24
|
-
"@
|
|
25
|
-
"@biomejs/biome": "^2.2.4",
|
|
48
|
+
"@biomejs/biome": "2.2.5",
|
|
26
49
|
"@types/bun": "^1.2.22",
|
|
50
|
+
"knip": "^5.64.2",
|
|
27
51
|
"typescript": "5.9.2"
|
|
28
52
|
},
|
|
29
|
-
"peerDependencies": {
|
|
30
|
-
"@vrplatform/graphql": "*"
|
|
31
|
-
},
|
|
32
53
|
"trustedDependencies": [
|
|
33
54
|
"@biomejs/biome"
|
|
34
|
-
]
|
|
35
|
-
|
|
36
|
-
"up": "bunx npm-check-updates --dep prod,dev,optional,overrides --interactive --format group",
|
|
37
|
-
"pub": "bun run build && pnpm version patch --no-commit-hooks --no-git-tag-version && pnpm publish --no-git-checks",
|
|
38
|
-
"pub:alpha": "bun run build && pnpm version prerelease --no-commit-hooks --no-git-tag-version && pnpm publish --no-git-checks --tag alpha",
|
|
39
|
-
"build": "bun build:main & bun build:module",
|
|
40
|
-
"build:main": "tsc -b tsconfig.main.json",
|
|
41
|
-
"build:module": "tsc -b tsconfig.esm.json",
|
|
42
|
-
"typecheck": "tsc --noEmit",
|
|
43
|
-
"lint": "biome check .",
|
|
44
|
-
"lint:fix": "biome check --write --unsafe .",
|
|
45
|
-
"pre-push": "bun typecheck && bun lint",
|
|
46
|
-
"post-merge": "bun i"
|
|
47
|
-
},
|
|
48
|
-
"typings": "build/main/index.d.ts",
|
|
49
|
-
"module": "build/module/index.js"
|
|
50
|
-
}
|
|
55
|
+
]
|
|
56
|
+
}
|
package/src/log/color.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
const objectEntries = Object.entries as <T extends object>(
|
|
2
2
|
value: T
|
|
3
3
|
) => {
|
|
4
4
|
[K in keyof T]-?: [K, T[K]];
|
|
5
5
|
}[keyof T][];
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
type LEVEL = 'debug' | 'info' | 'warn' | 'error' | 'disable' | 'success';
|
|
8
8
|
|
|
9
9
|
type ticketObject = {
|
|
10
10
|
font?: COLOR;
|
|
@@ -15,7 +15,7 @@ type settingObject = {
|
|
|
15
15
|
[key in SETTING]?: boolean;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
type SETTING =
|
|
19
19
|
| 'bold'
|
|
20
20
|
| 'italic'
|
|
21
21
|
| 'dim'
|
|
@@ -23,7 +23,7 @@ export type SETTING =
|
|
|
23
23
|
| 'reverse'
|
|
24
24
|
| 'strikethrough';
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
type COLOR =
|
|
27
27
|
| 'black'
|
|
28
28
|
| 'red'
|
|
29
29
|
| 'green'
|
package/src/tracking/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare module
|
|
1
|
+
declare module 'intercom-client' {
|
|
2
2
|
export namespace Intercom {
|
|
3
3
|
export interface CreateContactRequestWithExternalId {
|
|
4
4
|
/** A unique identifier for the contact which is given to Intercom */
|
|
@@ -22,7 +22,7 @@ declare module "intercom-client" {
|
|
|
22
22
|
}
|
|
23
23
|
interface UpdateContactRequest {
|
|
24
24
|
/** The role of the contact. */
|
|
25
|
-
role?:
|
|
25
|
+
role?: 'user' | 'lead';
|
|
26
26
|
/** A unique identifier for the contact which is given to Intercom */
|
|
27
27
|
external_id?: string;
|
|
28
28
|
/** The contacts email */
|
|
@@ -98,22 +98,22 @@ declare module "intercom-client" {
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
import { useHasuraClient } from
|
|
102
|
-
import { Intercom } from
|
|
103
|
-
import { type LogBindings, useLog, type WorkerLog } from
|
|
104
|
-
import { isTest, isVrpMember } from
|
|
105
|
-
import { convertValuesToString } from
|
|
106
|
-
import { MixpanelClient } from
|
|
101
|
+
import { useHasuraClient } from '@vrplatform/graphql';
|
|
102
|
+
import { Intercom } from 'intercom-client';
|
|
103
|
+
import { type LogBindings, useLog, type WorkerLog } from '../log';
|
|
104
|
+
import { isTest, isVrpMember } from '../utils';
|
|
105
|
+
import { convertValuesToString } from '../utils/convertValuesToString';
|
|
106
|
+
import { MixpanelClient } from './mixpanel';
|
|
107
107
|
import type {
|
|
108
108
|
GroupProps,
|
|
109
109
|
IdentifyProps,
|
|
110
110
|
TrackingEvent,
|
|
111
111
|
TrackProps,
|
|
112
|
-
} from
|
|
112
|
+
} from './types';
|
|
113
113
|
|
|
114
|
-
export * from
|
|
115
|
-
export * from
|
|
116
|
-
export * from
|
|
114
|
+
export * from 'intercom-client';
|
|
115
|
+
export * from '../utils';
|
|
116
|
+
export * from './types';
|
|
117
117
|
|
|
118
118
|
export type Tracking = ReturnType<typeof useTracking>;
|
|
119
119
|
export type UseTracking = {
|
|
@@ -133,11 +133,11 @@ export type UseTracking = {
|
|
|
133
133
|
|
|
134
134
|
export const useTracking = (
|
|
135
135
|
{ dataset, env, name }: UseTracking,
|
|
136
|
-
isDev?: boolean
|
|
136
|
+
isDev?: boolean
|
|
137
137
|
): {
|
|
138
138
|
track: <T extends TrackingEvent>(
|
|
139
139
|
props: TrackProps<T>,
|
|
140
|
-
_import?: boolean
|
|
140
|
+
_import?: boolean
|
|
141
141
|
) => Promise<void>;
|
|
142
142
|
identify: (props: IdentifyProps) => Promise<void>;
|
|
143
143
|
group: (props: GroupProps) => Promise<void>;
|
|
@@ -176,11 +176,11 @@ export const useTracking = (
|
|
|
176
176
|
properties,
|
|
177
177
|
timestamp,
|
|
178
178
|
}: TrackProps<T>,
|
|
179
|
-
_import = false
|
|
179
|
+
_import = false
|
|
180
180
|
) => {
|
|
181
181
|
if (
|
|
182
182
|
isDev ||
|
|
183
|
-
isTest(userId || anonymousId ||
|
|
183
|
+
isTest(userId || anonymousId || '', groupId) ||
|
|
184
184
|
isVrpMember(userId || anonymousId)
|
|
185
185
|
)
|
|
186
186
|
return;
|
|
@@ -197,7 +197,7 @@ export const useTracking = (
|
|
|
197
197
|
// trackedAt: timestamp ? timestamp.toISOString() : undefined,
|
|
198
198
|
packageName,
|
|
199
199
|
},
|
|
200
|
-
}).id
|
|
200
|
+
}).id
|
|
201
201
|
);
|
|
202
202
|
|
|
203
203
|
// track mixpanel event
|
|
@@ -214,7 +214,7 @@ export const useTracking = (
|
|
|
214
214
|
userId: userId,
|
|
215
215
|
...properties,
|
|
216
216
|
},
|
|
217
|
-
_import
|
|
217
|
+
_import
|
|
218
218
|
);
|
|
219
219
|
|
|
220
220
|
if (userId) {
|
|
@@ -256,19 +256,19 @@ export const useTracking = (
|
|
|
256
256
|
mixpanel.identify(userId);
|
|
257
257
|
|
|
258
258
|
const {
|
|
259
|
-
// biome-ignore lint/correctness/noUnusedVariables:
|
|
259
|
+
// biome-ignore lint/correctness/noUnusedVariables: excluded to compute rest
|
|
260
260
|
firstName,
|
|
261
|
-
// biome-ignore lint/correctness/noUnusedVariables:
|
|
261
|
+
// biome-ignore lint/correctness/noUnusedVariables: excluded to compute rest
|
|
262
262
|
lastName,
|
|
263
|
-
// biome-ignore lint/correctness/noUnusedVariables:
|
|
263
|
+
// biome-ignore lint/correctness/noUnusedVariables: excluded to compute rest
|
|
264
264
|
name,
|
|
265
|
-
// biome-ignore lint/correctness/noUnusedVariables:
|
|
265
|
+
// biome-ignore lint/correctness/noUnusedVariables: excluded to compute rest
|
|
266
266
|
email,
|
|
267
|
-
// biome-ignore lint/correctness/noUnusedVariables:
|
|
267
|
+
// biome-ignore lint/correctness/noUnusedVariables: excluded to compute rest
|
|
268
268
|
avatar,
|
|
269
|
-
// biome-ignore lint/correctness/noUnusedVariables:
|
|
269
|
+
// biome-ignore lint/correctness/noUnusedVariables: excluded to compute rest
|
|
270
270
|
lastSeenAt,
|
|
271
|
-
// biome-ignore lint/correctness/noUnusedVariables:
|
|
271
|
+
// biome-ignore lint/correctness/noUnusedVariables: excluded to compute rest
|
|
272
272
|
createdAt,
|
|
273
273
|
...rest
|
|
274
274
|
} = traits || {};
|
|
@@ -300,8 +300,8 @@ export const useTracking = (
|
|
|
300
300
|
const intercomUser = (
|
|
301
301
|
await intercom?.contacts.search({
|
|
302
302
|
query: {
|
|
303
|
-
field:
|
|
304
|
-
operator:
|
|
303
|
+
field: 'external_id',
|
|
304
|
+
operator: '=',
|
|
305
305
|
value: userId,
|
|
306
306
|
},
|
|
307
307
|
})
|
|
@@ -321,7 +321,7 @@ export const useTracking = (
|
|
|
321
321
|
}: GroupProps) => {
|
|
322
322
|
if (
|
|
323
323
|
isDev ||
|
|
324
|
-
isTest(userId || anonymousId ||
|
|
324
|
+
isTest(userId || anonymousId || '', groupId) ||
|
|
325
325
|
isVrpMember(userId || anonymousId)
|
|
326
326
|
)
|
|
327
327
|
return;
|
|
@@ -334,11 +334,11 @@ export const useTracking = (
|
|
|
334
334
|
const billingPartner =
|
|
335
335
|
traits?.billingPartner || traits?.partner || traits?.accountingPartner; // TODO: remove legacy accountingPartner
|
|
336
336
|
|
|
337
|
-
if (billingPartner ===
|
|
337
|
+
if (billingPartner === '0b6a7bd6-56cc-46b5-b2ab-1bd7d1e994fa') return; // dismiss Demo and Test Console
|
|
338
338
|
|
|
339
339
|
// upsert mixpanel group
|
|
340
340
|
if (mixpanel)
|
|
341
|
-
mixpanel.group.set(
|
|
341
|
+
mixpanel.group.set('tenant', groupId, {
|
|
342
342
|
$distinct_id: groupId,
|
|
343
343
|
$name: traits?.name,
|
|
344
344
|
$avatar: traits.avatar,
|
|
@@ -365,7 +365,7 @@ export const useTracking = (
|
|
|
365
365
|
trialUntil: traits?.trialUntil,
|
|
366
366
|
isOnboarding: traits?.isOnboarding,
|
|
367
367
|
isTest: billingPartner
|
|
368
|
-
? billingPartner ===
|
|
368
|
+
? billingPartner === 'Demo and Test Console'
|
|
369
369
|
: undefined,
|
|
370
370
|
});
|
|
371
371
|
|
|
@@ -401,7 +401,7 @@ export const useTracking = (
|
|
|
401
401
|
monthly_spend: traits?.mrr,
|
|
402
402
|
custom_attributes,
|
|
403
403
|
},
|
|
404
|
-
{}
|
|
404
|
+
{}
|
|
405
405
|
);
|
|
406
406
|
} catch (e) {
|
|
407
407
|
console.error(e);
|
|
@@ -413,8 +413,8 @@ export const useTracking = (
|
|
|
413
413
|
const intercomUser = (
|
|
414
414
|
await intercom?.contacts.search({
|
|
415
415
|
query: {
|
|
416
|
-
field:
|
|
417
|
-
operator:
|
|
416
|
+
field: 'external_id',
|
|
417
|
+
operator: '=',
|
|
418
418
|
value: userId,
|
|
419
419
|
},
|
|
420
420
|
})
|
package/src/tracking/types.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
billing_payment_method_type_enum,
|
|
3
|
+
recurringFeeType_enum,
|
|
4
|
+
} from '@vrplatform/graphql';
|
|
2
5
|
|
|
3
6
|
export type Maybe<T> = T | null | undefined;
|
|
4
7
|
|
|
@@ -103,6 +106,10 @@ export type TrackingEventProps = {
|
|
|
103
106
|
onboarding_account_settings_set: OnboardingAccountSettingsSetProps;
|
|
104
107
|
onboarding_completed: OnboardingCompletedProps;
|
|
105
108
|
|
|
109
|
+
// Getting Started Funnel
|
|
110
|
+
getting_started_connection_skipped: GettingStartedConnectionSkippedProps;
|
|
111
|
+
getting_started_team_members_invite_skipped: GettingStartedTeamMembersInviteSkippedProps;
|
|
112
|
+
|
|
106
113
|
// Other Events
|
|
107
114
|
account_signed_out: AccountSignedOutProps;
|
|
108
115
|
account_signin_completed: AccountSigninCompletedProps;
|
|
@@ -156,6 +163,7 @@ export type TrackingEventProps = {
|
|
|
156
163
|
hyperline_trial_started: HyperlineTrialStartedProps;
|
|
157
164
|
hyperline_trial_ended: HyperlineTrialEndedProps;
|
|
158
165
|
hyperline_subscription_cancellation_scheduled: HyperlineSubscriptionEventProps;
|
|
166
|
+
hyperline_subscription_created: HyperlineSubscriptionEventProps;
|
|
159
167
|
hyperline_subscription_charged: HyperlineSubscriptionEventProps;
|
|
160
168
|
hyperline_subscription_status_changed: HyperlineSubscriptionEventProps;
|
|
161
169
|
hyperline_customer_created: HyperlineCustomerCreatedProps;
|
|
@@ -220,14 +228,7 @@ export type TaxStatementStatus =
|
|
|
220
228
|
| 'ready'
|
|
221
229
|
| 'submitted'
|
|
222
230
|
| 'error';
|
|
223
|
-
export type PaymentMethodType =
|
|
224
|
-
| 'card'
|
|
225
|
-
| 'direct_debit'
|
|
226
|
-
| 'direct_debit_ach'
|
|
227
|
-
| 'direct_debit_bacs'
|
|
228
|
-
| 'transfer'
|
|
229
|
-
| 'transfer_automated'
|
|
230
|
-
| 'external';
|
|
231
|
+
export type PaymentMethodType = billing_payment_method_type_enum;
|
|
231
232
|
|
|
232
233
|
// Signup/Onboarding Funnel
|
|
233
234
|
|
|
@@ -337,6 +338,19 @@ type ConnectionRequestedProps = MaybePartial<{
|
|
|
337
338
|
tenantId: string;
|
|
338
339
|
}>;
|
|
339
340
|
|
|
341
|
+
// Getting Started Funnel
|
|
342
|
+
|
|
343
|
+
type GettingStartedConnectionSkippedProps = MaybePartial<{
|
|
344
|
+
userId: string;
|
|
345
|
+
tenantId: string;
|
|
346
|
+
integration: 'airbnb' | 'stripe';
|
|
347
|
+
}>;
|
|
348
|
+
|
|
349
|
+
type GettingStartedTeamMembersInviteSkippedProps = MaybePartial<{
|
|
350
|
+
userId: string;
|
|
351
|
+
tenantId: string;
|
|
352
|
+
}>;
|
|
353
|
+
|
|
340
354
|
// Other Events
|
|
341
355
|
|
|
342
356
|
type AccountPasswordResetCompletedProps = MaybePartial<{
|
|
@@ -776,7 +790,7 @@ type ListingActivatedProps = MaybePartial<{
|
|
|
776
790
|
tenantId: string;
|
|
777
791
|
billingStatus: 'active' | 'inactive';
|
|
778
792
|
name: string;
|
|
779
|
-
vrpStatus: 'active' | '
|
|
793
|
+
vrpStatus: 'active' | 'inactive';
|
|
780
794
|
pmsStatus: string;
|
|
781
795
|
}>;
|
|
782
796
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|