@vrplatform/log 3.0.10 → 3.0.14
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/_intercom.d.ts +109 -0
- package/build/main/tracking/_intercom.js +139 -0
- package/build/main/tracking/_intercom.js.map +1 -0
- package/build/main/tracking/eventTypes.d.ts +16 -0
- package/build/main/tracking/eventTypes.js +3 -0
- package/build/main/tracking/eventTypes.js.map +1 -0
- package/build/main/tracking/index.d.ts +0 -89
- package/build/main/tracking/index.js.map +1 -1
- package/build/main/tracking/intercom.d.ts +109 -0
- package/build/main/tracking/intercom.js +139 -0
- package/build/main/tracking/intercom.js.map +1 -0
- package/build/main/tracking/test.d.ts +1 -0
- package/build/main/tracking/test.js +23 -0
- package/build/main/tracking/test.js.map +1 -0
- package/build/main/tracking/types.d.ts +9 -0
- package/build/module/tracking/_intercom.d.ts +109 -0
- package/build/module/tracking/_intercom.js +136 -0
- package/build/module/tracking/_intercom.js.map +1 -0
- package/build/module/tracking/eventTypes.d.ts +16 -0
- package/build/module/tracking/eventTypes.js +2 -0
- package/build/module/tracking/eventTypes.js.map +1 -0
- package/build/module/tracking/index.d.ts +0 -89
- package/build/module/tracking/index.js.map +1 -1
- package/build/module/tracking/intercom.d.ts +109 -0
- package/build/module/tracking/intercom.js +136 -0
- package/build/module/tracking/intercom.js.map +1 -0
- package/build/module/tracking/test.d.ts +1 -0
- package/build/module/tracking/test.js +21 -0
- package/build/module/tracking/test.js.map +1 -0
- package/build/module/tracking/types.d.ts +9 -0
- package/package.json +4 -4
- package/src/tracking/index.ts +0 -102
- package/src/tracking/types.ts +10 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
export class IntercomAPI {
|
|
2
|
+
constructor(token, log) {
|
|
3
|
+
this.headers = {
|
|
4
|
+
'Content-Type': 'application/json',
|
|
5
|
+
Accept: 'application/json',
|
|
6
|
+
'Intercom-Version': '2.11',
|
|
7
|
+
Authorization: `Bearer ${token}`,
|
|
8
|
+
};
|
|
9
|
+
this.log = log;
|
|
10
|
+
}
|
|
11
|
+
headers;
|
|
12
|
+
log;
|
|
13
|
+
async fetch(path, options) {
|
|
14
|
+
if (options?.data) {
|
|
15
|
+
options.body = JSON.stringify(options.data);
|
|
16
|
+
options.data = undefined;
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
const result = await fetch(`https://api.intercom.io${path}`, {
|
|
20
|
+
method: 'GET',
|
|
21
|
+
headers: this.headers,
|
|
22
|
+
...options,
|
|
23
|
+
});
|
|
24
|
+
if (!result.ok) {
|
|
25
|
+
this.log?.info('Failed to fetch from Intercom', {
|
|
26
|
+
result: {
|
|
27
|
+
status: result.status,
|
|
28
|
+
statusText: result.statusText,
|
|
29
|
+
body: await result.text(),
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
if (result.status === 404)
|
|
33
|
+
return undefined;
|
|
34
|
+
if (result.status === 429) {
|
|
35
|
+
console.log('Intercom rate limit exceeded, waiting for 1 minute');
|
|
36
|
+
// X-RateLimit-Reset: 1487332520 => timestamp from header response when resetting
|
|
37
|
+
const reset = Number(result.headers.get('X-RateLimit-Reset'));
|
|
38
|
+
if (reset) {
|
|
39
|
+
const now = Math.floor(Date.now() / 1000);
|
|
40
|
+
const wait = reset - now + 1;
|
|
41
|
+
console.log(`Waiting for ${wait} seconds`);
|
|
42
|
+
await new Promise((resolve) => setTimeout(resolve, wait * 1000));
|
|
43
|
+
return await this.fetch(path, options);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return result.status === 202 ? {} : (await result.json());
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
this.log?.error(error);
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// User
|
|
55
|
+
async getUserByUserId(userId) {
|
|
56
|
+
return await this.fetch('/contacts/search', {
|
|
57
|
+
method: 'POST',
|
|
58
|
+
data: {
|
|
59
|
+
query: {
|
|
60
|
+
field: 'external_id',
|
|
61
|
+
operator: '=',
|
|
62
|
+
value: userId,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
async createUser({ data, userId, }) {
|
|
68
|
+
return await this.fetch('/contacts', {
|
|
69
|
+
method: 'POST',
|
|
70
|
+
data: { ...data, external_id: userId },
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
async updateUser({ data, contactId, }) {
|
|
74
|
+
return await this.fetch(`/contacts/${contactId}`, {
|
|
75
|
+
method: 'PUT',
|
|
76
|
+
data,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
async deleteUser(intercom_contact_id) {
|
|
80
|
+
return await this.fetch(`/contacts/${intercom_contact_id}`, {
|
|
81
|
+
method: 'DELETE',
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
async createCompanyUser(data) {
|
|
85
|
+
return await this.fetch(`/contacts/${data.intercom_contact_id}/companies`, {
|
|
86
|
+
method: 'POST',
|
|
87
|
+
data: {
|
|
88
|
+
id: data.intercom_company_id,
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
async deleteCompanyUser({ intercom_company_id, intercom_contact_id, }) {
|
|
93
|
+
return await this.fetch(`/contacts/${intercom_contact_id}/companies/${intercom_company_id}`, {
|
|
94
|
+
method: 'DELETE',
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
async trackEvent(data) {
|
|
98
|
+
return await this.fetch('/events', {
|
|
99
|
+
method: 'POST',
|
|
100
|
+
data: {
|
|
101
|
+
created_at: Math.floor(new Date().getTime() / 1000), // to seconds
|
|
102
|
+
...data,
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
// Company
|
|
107
|
+
async getCompanyByTenantId(tenantId) {
|
|
108
|
+
return await this.fetch(`/companies?company_id=${tenantId}`, {
|
|
109
|
+
method: 'GET',
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
async createCompany({ data, tenantId, }) {
|
|
113
|
+
return await this.fetch('/companies', {
|
|
114
|
+
method: 'POST',
|
|
115
|
+
data: {
|
|
116
|
+
...data,
|
|
117
|
+
company_id: tenantId,
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
async updateCompany({ data, companyId, }) {
|
|
122
|
+
return await this.fetch(`/companies/${companyId}`, {
|
|
123
|
+
method: 'PUT',
|
|
124
|
+
data,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
async deleteCompany(intercom_company_id) {
|
|
128
|
+
return await this.fetch(`/companies/${intercom_company_id}`, {
|
|
129
|
+
method: 'DELETE',
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
export function useIntercom(token, log) {
|
|
134
|
+
return new IntercomAPI(token, log);
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=intercom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intercom.js","sourceRoot":"src/","sources":["tracking/intercom.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,WAAW;IACtB,YAAY,KAAa,EAAE,GAAS;QAClC,IAAI,CAAC,OAAO,GAAG;YACb,cAAc,EAAE,kBAAkB;YAClC,MAAM,EAAE,kBAAkB;YAC1B,kBAAkB,EAAE,MAAM;YAC1B,aAAa,EAAE,UAAU,KAAK,EAAE;SACjC,CAAC;QAEF,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAEO,OAAO,CAAyB;IAChC,GAAG,CAAO;IAEV,KAAK,CAAC,KAAK,CACjB,IAAY,EACZ,OAAsC;QAEtC,IAAI,OAAO,EAAE,IAAI,EAAE,CAAC;YAClB,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC5C,OAAO,CAAC,IAAI,GAAG,SAAS,CAAC;QAC3B,CAAC;QAED,IA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AK,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 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { MixpanelClient } from './mixpanel';
|
|
2
|
+
const mixpanel = new MixpanelClient('933a19cf6d01a51a06ccdd083083f2a9');
|
|
3
|
+
mixpanel.identify('user@example.com');
|
|
4
|
+
mixpanel.group.set('tenant', '123test', {
|
|
5
|
+
$name: '123 Test!',
|
|
6
|
+
isTest: true,
|
|
7
|
+
});
|
|
8
|
+
mixpanel.people.set({
|
|
9
|
+
$email: 'user@example.com',
|
|
10
|
+
$name: 'John Doe',
|
|
11
|
+
$created: new Date().getTime() / 1000,
|
|
12
|
+
isTest: true,
|
|
13
|
+
tenant: ['123test'],
|
|
14
|
+
});
|
|
15
|
+
mixpanel.track('test_event', {
|
|
16
|
+
success: true,
|
|
17
|
+
message: 'Super Test!',
|
|
18
|
+
tenant: ['123test'],
|
|
19
|
+
});
|
|
20
|
+
mixpanel.reset();
|
|
21
|
+
//# sourceMappingURL=test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test.js","sourceRoot":"src/","sources":["tracking/test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,QAAQ,GAAG,IAAI,cAAc,CAAC,kCAAkC,CAAC,CAAC;AAExE,QAAQ,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;AAEtC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,SAAS,EAAE;IACtC,KAAK,EAAE,WAAW;IAClB,MAAM,EAAE,IAAI;CACb,CAAC,CAAC;AAEH,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC;IAClB,MAAM,EAAE,kBAAkB;IAC1B,KAAK,EAAE,UAAU;IACjB,QAAQ,EAAE,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI;IACrC,MAAM,EAAE,IAAI;IACZ,MAAM,EAAE,CAAC,SAAS,CAAC;CACpB,CAAC,CAAC;AAEH,QAAQ,CAAC,KAAK,CAAC,YAAY,EAAE;IAC3B,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,aAAa;IACtB,MAAM,EAAE,CAAC,SAAS,CAAC;CACpB,CAAC,CAAC;AAEH,QAAQ,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -128,6 +128,7 @@ export type TrackingEventProps = {
|
|
|
128
128
|
hyperline_customer_deleted: HyperlineCustomerDeletedProps;
|
|
129
129
|
hyperline_payment_method_created: HyperlinePaymentMethodCreatedProps;
|
|
130
130
|
hyperline_payment_method_errored: HyperlinePaymentMethodErroredProps;
|
|
131
|
+
hyperline_payment_method_expired: HyperlinePaymentMethodExpiredProps;
|
|
131
132
|
hyperline_payment_method_deleted: HyperlinePaymentMethodDeletedProps;
|
|
132
133
|
listing_activated: ListingActivatedProps;
|
|
133
134
|
listing_deactivated: ListingDeactivatedProps;
|
|
@@ -388,6 +389,14 @@ type HyperlinePaymentMethodDeletedProps = MaybePartial<{
|
|
|
388
389
|
subscriptionId: string;
|
|
389
390
|
customerId: string;
|
|
390
391
|
}>;
|
|
392
|
+
type HyperlinePaymentMethodExpiredProps = MaybePartial<{
|
|
393
|
+
tenantId: string;
|
|
394
|
+
subscriptionStartDate: string;
|
|
395
|
+
paymentMethodType: PaymentMethodType;
|
|
396
|
+
subscriptionStatus: SubscriptionStatus;
|
|
397
|
+
subscriptionId: string;
|
|
398
|
+
customerId: string;
|
|
399
|
+
}>;
|
|
391
400
|
type HyperlinePaymentMethodErroredProps = MaybePartial<{
|
|
392
401
|
tenantId: string;
|
|
393
402
|
subscriptionStartDate: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vrplatform/log",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.14",
|
|
4
4
|
"main": "src/index.ts",
|
|
5
5
|
"packageManager": "bun@1.3.0",
|
|
6
6
|
"publishConfig": {
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@axiomhq/js": "1.3.1",
|
|
46
|
-
"@vrplatform/graphql": "1.1.
|
|
47
|
-
"intercom-client": "
|
|
46
|
+
"@vrplatform/graphql": "1.1.42",
|
|
47
|
+
"intercom-client": "7.0.1"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@biomejs/biome": "2.3.8",
|
|
51
51
|
"@types/bun": "1.3.4",
|
|
52
|
-
"knip": "5.
|
|
52
|
+
"knip": "5.82.1",
|
|
53
53
|
"typescript": "5.9.3"
|
|
54
54
|
},
|
|
55
55
|
"trustedDependencies": [
|
package/src/tracking/index.ts
CHANGED
|
@@ -1,105 +1,3 @@
|
|
|
1
|
-
declare module 'intercom-client' {
|
|
2
|
-
export namespace Intercom {
|
|
3
|
-
export interface CreateContactRequestWithExternalId {
|
|
4
|
-
/** A unique identifier for the contact which is given to Intercom */
|
|
5
|
-
external_id: string;
|
|
6
|
-
/** The contacts phone */
|
|
7
|
-
phone?: string;
|
|
8
|
-
/** The contacts name */
|
|
9
|
-
name?: string;
|
|
10
|
-
/** An image URL containing the avatar of a contact */
|
|
11
|
-
avatar?: string;
|
|
12
|
-
/** The time specified for when a contact signed up */
|
|
13
|
-
signed_up_at?: number;
|
|
14
|
-
/** The time when the contact was last seen (either where the Intercom Messenger was installed or when specified manually) */
|
|
15
|
-
last_seen_at?: number;
|
|
16
|
-
/** The id of an admin that has been assigned account ownership of the contact */
|
|
17
|
-
owner_id?: number;
|
|
18
|
-
/** Whether the contact is unsubscribed from emails */
|
|
19
|
-
unsubscribed_from_emails?: boolean;
|
|
20
|
-
/** The custom attributes which are set for the contact */
|
|
21
|
-
custom_attributes?: ContactCustomAttributes;
|
|
22
|
-
}
|
|
23
|
-
interface UpdateContactRequest {
|
|
24
|
-
/** The contact id */
|
|
25
|
-
contact_id: string;
|
|
26
|
-
/** The role of the contact. */
|
|
27
|
-
role?: 'user' | 'lead';
|
|
28
|
-
/** A unique identifier for the contact which is given to Intercom */
|
|
29
|
-
external_id?: string;
|
|
30
|
-
/** The contacts email */
|
|
31
|
-
email?: string;
|
|
32
|
-
/** The contacts phone */
|
|
33
|
-
phone?: string;
|
|
34
|
-
/** The contacts name */
|
|
35
|
-
name?: string;
|
|
36
|
-
/** An image URL containing the avatar of a contact */
|
|
37
|
-
avatar?: string;
|
|
38
|
-
/** The time specified for when a contact signed up */
|
|
39
|
-
signed_up_at?: number;
|
|
40
|
-
/** The time when the contact was last seen (either where the Intercom Messenger was installed or when specified manually) */
|
|
41
|
-
last_seen_at?: number;
|
|
42
|
-
/** The id of an admin that has been assigned account ownership of the contact */
|
|
43
|
-
owner_id?: number;
|
|
44
|
-
/** Whether the contact is unsubscribed from emails */
|
|
45
|
-
unsubscribed_from_emails?: boolean;
|
|
46
|
-
/** The custom attributes which are set for the contact */
|
|
47
|
-
custom_attributes?: ContactCustomAttributes;
|
|
48
|
-
}
|
|
49
|
-
interface ContactCustomAttributes {
|
|
50
|
-
Onboarding_Support?: string; // The customer's preferred onboarding level
|
|
51
|
-
userType?: string; // User Type (user or owner)
|
|
52
|
-
// ARCHIVED
|
|
53
|
-
// article_id?: string; // undefined
|
|
54
|
-
// workflowInstanceId?: number; // undefined
|
|
55
|
-
// Active_Listings?: string; // The number of active listings a user has
|
|
56
|
-
// Accounting_Software?: string; // The client's accounting software
|
|
57
|
-
}
|
|
58
|
-
interface CreateOrUpdateCompanyRequest {
|
|
59
|
-
/** The name of the Company */
|
|
60
|
-
name?: string;
|
|
61
|
-
/** The company id you have defined for the company. Can't be updated */
|
|
62
|
-
company_id?: string;
|
|
63
|
-
/** The name of the plan you have associated with the company. */
|
|
64
|
-
plan?: string;
|
|
65
|
-
/** The number of employees in this company. */
|
|
66
|
-
size?: number;
|
|
67
|
-
/** The URL for this company's website. Please note that the value specified here is not validated. Accepts any string. */
|
|
68
|
-
website?: string;
|
|
69
|
-
/** The industry that this company operates in. */
|
|
70
|
-
industry?: string;
|
|
71
|
-
/** A hash of key/value pairs containing any other data about the company you want Intercom to store. */
|
|
72
|
-
custom_attributes?: CompanyCustomAttributes;
|
|
73
|
-
/** The time the company was created by you. */
|
|
74
|
-
remote_created_at?: number;
|
|
75
|
-
/** How much revenue the company generates for your business. Note that this will truncate floats. i.e. it only allow for whole integers, 155.98 will be truncated to 155. Note that this has an upper limit of 2\*\*31-1 or 2147483647.. */
|
|
76
|
-
monthly_spend?: number;
|
|
77
|
-
}
|
|
78
|
-
interface CompanyCustomAttributes {
|
|
79
|
-
teamId?: string; // undefined
|
|
80
|
-
team?: string; // undefined
|
|
81
|
-
type?: string; // undefined
|
|
82
|
-
status?: string; // undefined
|
|
83
|
-
pms?: string; // undefined
|
|
84
|
-
accountingSoftware?: string; // Accounting software used by the team.
|
|
85
|
-
creation_source?: string; // undefined
|
|
86
|
-
activeListings?: number; // Active Listings
|
|
87
|
-
paymentMethodType?: string; // Payment Method
|
|
88
|
-
partnerName?: string; // Partner Name
|
|
89
|
-
billingPortalUrl?: string; // Billing Portal URL
|
|
90
|
-
billingStatus?: string; // undefined
|
|
91
|
-
billingPartner?: string; // Name of billing partner
|
|
92
|
-
// ARCHIVED
|
|
93
|
-
// firstName?: string; // undefined
|
|
94
|
-
// lastName?: string; // undefined
|
|
95
|
-
// email?: string; // undefined
|
|
96
|
-
// apps?: string; // All active connections besides pms/accounting
|
|
97
|
-
// accountingPartner?: string; // Name of accounting partner
|
|
98
|
-
// 'SaaS User'?: boolean; // undefined
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
1
|
import { useHasuraClient } from '@vrplatform/graphql';
|
|
104
2
|
import { type Intercom, IntercomClient } from 'intercom-client';
|
|
105
3
|
import { type LogBindings, useLog, type WorkerLog } from '../log';
|
package/src/tracking/types.ts
CHANGED
|
@@ -171,6 +171,7 @@ export type TrackingEventProps = {
|
|
|
171
171
|
hyperline_customer_deleted: HyperlineCustomerDeletedProps;
|
|
172
172
|
hyperline_payment_method_created: HyperlinePaymentMethodCreatedProps;
|
|
173
173
|
hyperline_payment_method_errored: HyperlinePaymentMethodErroredProps;
|
|
174
|
+
hyperline_payment_method_expired: HyperlinePaymentMethodExpiredProps;
|
|
174
175
|
hyperline_payment_method_deleted: HyperlinePaymentMethodDeletedProps;
|
|
175
176
|
listing_activated: ListingActivatedProps;
|
|
176
177
|
listing_deactivated: ListingDeactivatedProps;
|
|
@@ -509,6 +510,15 @@ type HyperlinePaymentMethodDeletedProps = MaybePartial<{
|
|
|
509
510
|
customerId: string;
|
|
510
511
|
}>;
|
|
511
512
|
|
|
513
|
+
type HyperlinePaymentMethodExpiredProps = MaybePartial<{
|
|
514
|
+
tenantId: string;
|
|
515
|
+
subscriptionStartDate: string;
|
|
516
|
+
paymentMethodType: PaymentMethodType;
|
|
517
|
+
subscriptionStatus: SubscriptionStatus;
|
|
518
|
+
subscriptionId: string;
|
|
519
|
+
customerId: string;
|
|
520
|
+
}>;
|
|
521
|
+
|
|
512
522
|
type HyperlinePaymentMethodErroredProps = MaybePartial<{
|
|
513
523
|
tenantId: string;
|
|
514
524
|
subscriptionStartDate: string;
|