glitch-javascript-sdk 2.7.1 → 2.7.2
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/dist/cjs/index.js +158 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/Communities.d.ts +8 -4
- package/dist/esm/api/Crm.d.ts +77 -0
- package/dist/esm/api/index.d.ts +2 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +158 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/routes/CrmRoute.d.ts +7 -0
- package/dist/index.d.ts +84 -4
- package/package.json +1 -1
- package/src/api/Communities.ts +21 -2
- package/src/api/Crm.ts +134 -0
- package/src/api/index.ts +3 -1
- package/src/index.ts +2 -0
- package/src/routes/CrmRoute.ts +34 -0
package/dist/index.d.ts
CHANGED
|
@@ -1809,10 +1809,14 @@ declare class Communities {
|
|
|
1809
1809
|
* @param community_id The ID of the community.
|
|
1810
1810
|
* @param params Should include { start_date: 'YYYY-MM-DD', end_date: 'YYYY-MM-DD' }
|
|
1811
1811
|
*/
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1812
|
+
/**
|
|
1813
|
+
* Generate a custom date-range statement for reimbursement.
|
|
1814
|
+
*
|
|
1815
|
+
* @param community_id The ID of the community.
|
|
1816
|
+
* @param startDate 'YYYY-MM-DD'
|
|
1817
|
+
* @param endDate 'YYYY-MM-DD'
|
|
1818
|
+
*/
|
|
1819
|
+
static getCustomStatement<T>(community_id: string, startDate: string, endDate: string): AxiosPromise<Response<T>>;
|
|
1816
1820
|
/**
|
|
1817
1821
|
* List all Stripe invoices for the community.
|
|
1818
1822
|
*/
|
|
@@ -7383,6 +7387,81 @@ declare class Education {
|
|
|
7383
7387
|
static uploadTemplateBackground<T>(uuid: string, file: File): AxiosPromise<Response<T>>;
|
|
7384
7388
|
}
|
|
7385
7389
|
|
|
7390
|
+
declare class Crm {
|
|
7391
|
+
/**
|
|
7392
|
+
* List and search CRM leads.
|
|
7393
|
+
*/
|
|
7394
|
+
static listLeads<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
7395
|
+
/**
|
|
7396
|
+
* Manually create a new lead.
|
|
7397
|
+
*/
|
|
7398
|
+
static createLead<T>(data: object): AxiosPromise<Response<T>>;
|
|
7399
|
+
/**
|
|
7400
|
+
* View a single lead with contacts and activity timeline.
|
|
7401
|
+
*/
|
|
7402
|
+
static viewLead<T>(lead_id: string): AxiosPromise<Response<T>>;
|
|
7403
|
+
/**
|
|
7404
|
+
* Update lead information.
|
|
7405
|
+
*/
|
|
7406
|
+
static updateLead<T>(lead_id: string, data: object): AxiosPromise<Response<T>>;
|
|
7407
|
+
/**
|
|
7408
|
+
* Delete a lead (Soft Delete).
|
|
7409
|
+
*/
|
|
7410
|
+
static deleteLead<T>(lead_id: string): AxiosPromise<Response<T>>;
|
|
7411
|
+
/**
|
|
7412
|
+
* Assign a Super Admin as the owner of a lead.
|
|
7413
|
+
*/
|
|
7414
|
+
static assignOwner<T>(lead_id: string, user_id: string): AxiosPromise<Response<T>>;
|
|
7415
|
+
/**
|
|
7416
|
+
* Manually trigger Apollo enrichment and website scraping for a lead.
|
|
7417
|
+
*/
|
|
7418
|
+
static enrichLead<T>(lead_id: string): AxiosPromise<Response<T>>;
|
|
7419
|
+
/**
|
|
7420
|
+
* Approve a specific contact to start the Apollo email sequence.
|
|
7421
|
+
*/
|
|
7422
|
+
static approveContact<T>(contact_id: string): AxiosPromise<Response<T>>;
|
|
7423
|
+
/**
|
|
7424
|
+
* Manually update the pipeline status of a lead.
|
|
7425
|
+
*/
|
|
7426
|
+
static updateStatus<T>(lead_id: string, status: string, note?: string): AxiosPromise<Response<T>>;
|
|
7427
|
+
/**
|
|
7428
|
+
* Add a manual note to the lead's activity timeline.
|
|
7429
|
+
*/
|
|
7430
|
+
static addNote<T>(lead_id: string, content: string): AxiosPromise<Response<T>>;
|
|
7431
|
+
/**
|
|
7432
|
+
* Manually add a contact person to a lead.
|
|
7433
|
+
*/
|
|
7434
|
+
static addContact<T>(lead_id: string, data: object): AxiosPromise<Response<T>>;
|
|
7435
|
+
/**
|
|
7436
|
+
* Mark a lead as lost and record the reason.
|
|
7437
|
+
*/
|
|
7438
|
+
static markAsLost<T>(lead_id: string, reason: string): AxiosPromise<Response<T>>;
|
|
7439
|
+
/**
|
|
7440
|
+
* Record that a staff member has manually replied to a prospect.
|
|
7441
|
+
*/
|
|
7442
|
+
static recordStaffReply<T>(lead_id: string): AxiosPromise<Response<T>>;
|
|
7443
|
+
/**
|
|
7444
|
+
* Approve a batch of contacts for outreach.
|
|
7445
|
+
*/
|
|
7446
|
+
static bulkApprove<T>(contact_ids: string[]): AxiosPromise<Response<T>>;
|
|
7447
|
+
/**
|
|
7448
|
+
* Manually trigger the bi-weekly sourcing automation.
|
|
7449
|
+
*/
|
|
7450
|
+
static triggerSourcing<T>(): AxiosPromise<Response<T>>;
|
|
7451
|
+
/**
|
|
7452
|
+
* Manually trigger the Apollo status and conversion sync.
|
|
7453
|
+
*/
|
|
7454
|
+
static triggerSync<T>(): AxiosPromise<Response<T>>;
|
|
7455
|
+
/**
|
|
7456
|
+
* Get funnel conversion percentages.
|
|
7457
|
+
*/
|
|
7458
|
+
static getFunnelStats<T>(): AxiosPromise<Response<T>>;
|
|
7459
|
+
/**
|
|
7460
|
+
* Get win rates and response time analytics.
|
|
7461
|
+
*/
|
|
7462
|
+
static getPerformanceStats<T>(): AxiosPromise<Response<T>>;
|
|
7463
|
+
}
|
|
7464
|
+
|
|
7386
7465
|
interface Route {
|
|
7387
7466
|
url: string;
|
|
7388
7467
|
method: string;
|
|
@@ -7731,6 +7810,7 @@ declare class Glitch {
|
|
|
7731
7810
|
Raffles: typeof Raffles;
|
|
7732
7811
|
DiscordMarketplace: typeof DiscordMarketplace;
|
|
7733
7812
|
Education: typeof Education;
|
|
7813
|
+
Crm: typeof Crm;
|
|
7734
7814
|
};
|
|
7735
7815
|
static util: {
|
|
7736
7816
|
Requests: typeof Requests;
|
package/package.json
CHANGED
package/src/api/Communities.ts
CHANGED
|
@@ -955,8 +955,27 @@ class Communities {
|
|
|
955
955
|
* @param community_id The ID of the community.
|
|
956
956
|
* @param params Should include { start_date: 'YYYY-MM-DD', end_date: 'YYYY-MM-DD' }
|
|
957
957
|
*/
|
|
958
|
-
|
|
959
|
-
|
|
958
|
+
|
|
959
|
+
/**
|
|
960
|
+
* Generate a custom date-range statement for reimbursement.
|
|
961
|
+
*
|
|
962
|
+
* @param community_id The ID of the community.
|
|
963
|
+
* @param startDate 'YYYY-MM-DD'
|
|
964
|
+
* @param endDate 'YYYY-MM-DD'
|
|
965
|
+
*/
|
|
966
|
+
public static getCustomStatement<T>(community_id: string, startDate: string, endDate: string): AxiosPromise<Response<T>> {
|
|
967
|
+
// Wrap the strings into a named object so Requests.get can serialize them correctly
|
|
968
|
+
const params = {
|
|
969
|
+
start_date: startDate,
|
|
970
|
+
end_date: endDate
|
|
971
|
+
};
|
|
972
|
+
|
|
973
|
+
return Requests.processRoute(
|
|
974
|
+
CommunitiesRoute.routes.getCustomStatement,
|
|
975
|
+
undefined,
|
|
976
|
+
{ community_id: community_id },
|
|
977
|
+
params
|
|
978
|
+
);
|
|
960
979
|
}
|
|
961
980
|
|
|
962
981
|
/**
|
package/src/api/Crm.ts
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import CrmRoute from "../routes/CrmRoute";
|
|
2
|
+
import Requests from "../util/Requests";
|
|
3
|
+
import Response from "../util/Response";
|
|
4
|
+
import { AxiosPromise } from "axios";
|
|
5
|
+
|
|
6
|
+
class Crm {
|
|
7
|
+
/**
|
|
8
|
+
* List and search CRM leads.
|
|
9
|
+
*/
|
|
10
|
+
public static listLeads<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
11
|
+
return Requests.processRoute(CrmRoute.routes.listLeads, undefined, undefined, params);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Manually create a new lead.
|
|
16
|
+
*/
|
|
17
|
+
public static createLead<T>(data: object): AxiosPromise<Response<T>> {
|
|
18
|
+
return Requests.processRoute(CrmRoute.routes.createLead, data);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* View a single lead with contacts and activity timeline.
|
|
23
|
+
*/
|
|
24
|
+
public static viewLead<T>(lead_id: string): AxiosPromise<Response<T>> {
|
|
25
|
+
return Requests.processRoute(CrmRoute.routes.viewLead, {}, { lead_id });
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Update lead information.
|
|
30
|
+
*/
|
|
31
|
+
public static updateLead<T>(lead_id: string, data: object): AxiosPromise<Response<T>> {
|
|
32
|
+
return Requests.processRoute(CrmRoute.routes.updateLead, data, { lead_id });
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Delete a lead (Soft Delete).
|
|
37
|
+
*/
|
|
38
|
+
public static deleteLead<T>(lead_id: string): AxiosPromise<Response<T>> {
|
|
39
|
+
return Requests.processRoute(CrmRoute.routes.deleteLead, {}, { lead_id });
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Assign a Super Admin as the owner of a lead.
|
|
44
|
+
*/
|
|
45
|
+
public static assignOwner<T>(lead_id: string, user_id: string): AxiosPromise<Response<T>> {
|
|
46
|
+
return Requests.processRoute(CrmRoute.routes.assignOwner, { user_id }, { lead_id });
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Manually trigger Apollo enrichment and website scraping for a lead.
|
|
51
|
+
*/
|
|
52
|
+
public static enrichLead<T>(lead_id: string): AxiosPromise<Response<T>> {
|
|
53
|
+
return Requests.processRoute(CrmRoute.routes.enrichLead, {}, { lead_id });
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Approve a specific contact to start the Apollo email sequence.
|
|
58
|
+
*/
|
|
59
|
+
public static approveContact<T>(contact_id: string): AxiosPromise<Response<T>> {
|
|
60
|
+
return Requests.processRoute(CrmRoute.routes.approveContact, {}, { contact_id });
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Manually update the pipeline status of a lead.
|
|
65
|
+
*/
|
|
66
|
+
public static updateStatus<T>(lead_id: string, status: string, note?: string): AxiosPromise<Response<T>> {
|
|
67
|
+
return Requests.processRoute(CrmRoute.routes.updateStatus, { status, note }, { lead_id });
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Add a manual note to the lead's activity timeline.
|
|
72
|
+
*/
|
|
73
|
+
public static addNote<T>(lead_id: string, content: string): AxiosPromise<Response<T>> {
|
|
74
|
+
return Requests.processRoute(CrmRoute.routes.addNote, { content }, { lead_id });
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Manually add a contact person to a lead.
|
|
79
|
+
*/
|
|
80
|
+
public static addContact<T>(lead_id: string, data: object): AxiosPromise<Response<T>> {
|
|
81
|
+
return Requests.processRoute(CrmRoute.routes.addContact, data, { lead_id });
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Mark a lead as lost and record the reason.
|
|
86
|
+
*/
|
|
87
|
+
public static markAsLost<T>(lead_id: string, reason: string): AxiosPromise<Response<T>> {
|
|
88
|
+
return Requests.processRoute(CrmRoute.routes.markAsLost, { reason }, { lead_id });
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Record that a staff member has manually replied to a prospect.
|
|
93
|
+
*/
|
|
94
|
+
public static recordStaffReply<T>(lead_id: string): AxiosPromise<Response<T>> {
|
|
95
|
+
return Requests.processRoute(CrmRoute.routes.recordStaffReply, {}, { lead_id });
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Approve a batch of contacts for outreach.
|
|
100
|
+
*/
|
|
101
|
+
public static bulkApprove<T>(contact_ids: string[]): AxiosPromise<Response<T>> {
|
|
102
|
+
return Requests.processRoute(CrmRoute.routes.bulkApprove, { contact_ids });
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Manually trigger the bi-weekly sourcing automation.
|
|
107
|
+
*/
|
|
108
|
+
public static triggerSourcing<T>(): AxiosPromise<Response<T>> {
|
|
109
|
+
return Requests.processRoute(CrmRoute.routes.triggerSourcing, {});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Manually trigger the Apollo status and conversion sync.
|
|
114
|
+
*/
|
|
115
|
+
public static triggerSync<T>(): AxiosPromise<Response<T>> {
|
|
116
|
+
return Requests.processRoute(CrmRoute.routes.triggerSync, {});
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Get funnel conversion percentages.
|
|
121
|
+
*/
|
|
122
|
+
public static getFunnelStats<T>(): AxiosPromise<Response<T>> {
|
|
123
|
+
return Requests.processRoute(CrmRoute.routes.funnelStats);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Get win rates and response time analytics.
|
|
128
|
+
*/
|
|
129
|
+
public static getPerformanceStats<T>(): AxiosPromise<Response<T>> {
|
|
130
|
+
return Requests.processRoute(CrmRoute.routes.performanceStats);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export default Crm;
|
package/src/api/index.ts
CHANGED
|
@@ -41,6 +41,7 @@ import TwitchReporting from "./TwitchReporting";
|
|
|
41
41
|
import Raffles from "./Raffles";
|
|
42
42
|
import DiscordMarketplace from "./DiscordMarketplace";
|
|
43
43
|
import Education from "./Education";
|
|
44
|
+
import Crm from "./Crm";
|
|
44
45
|
|
|
45
46
|
export {Ads};
|
|
46
47
|
export {AccessKeys};
|
|
@@ -84,4 +85,5 @@ export {MarketingAgencies};
|
|
|
84
85
|
export {TwitchReporting};
|
|
85
86
|
export {Raffles};
|
|
86
87
|
export {DiscordMarketplace};
|
|
87
|
-
export {Education};
|
|
88
|
+
export {Education};
|
|
89
|
+
export {Crm};
|
package/src/index.ts
CHANGED
|
@@ -45,6 +45,7 @@ import {TwitchReporting} from './api'
|
|
|
45
45
|
import {Raffles} from './api'
|
|
46
46
|
import {DiscordMarketplace} from './api';
|
|
47
47
|
import {Education} from './api';
|
|
48
|
+
import {Crm} from './api';
|
|
48
49
|
|
|
49
50
|
import Requests from "./util/Requests";
|
|
50
51
|
import Parser from "./util/Parser";
|
|
@@ -119,6 +120,7 @@ class Glitch {
|
|
|
119
120
|
Raffles : Raffles,
|
|
120
121
|
DiscordMarketplace : DiscordMarketplace,
|
|
121
122
|
Education: Education,
|
|
123
|
+
Crm : Crm,
|
|
122
124
|
}
|
|
123
125
|
|
|
124
126
|
public static util = {
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import Route from "./interface";
|
|
2
|
+
import HTTP_METHODS from "../constants/HttpMethods";
|
|
3
|
+
|
|
4
|
+
class CrmRoute {
|
|
5
|
+
public static routes: { [key: string]: Route } = {
|
|
6
|
+
// Lead Management
|
|
7
|
+
listLeads: { url: '/admin/crm/leads', method: HTTP_METHODS.GET },
|
|
8
|
+
createLead: { url: '/admin/crm/leads', method: HTTP_METHODS.POST },
|
|
9
|
+
viewLead: { url: '/admin/crm/leads/{lead_id}', method: HTTP_METHODS.GET },
|
|
10
|
+
updateLead: { url: '/admin/crm/leads/{lead_id}', method: HTTP_METHODS.PUT },
|
|
11
|
+
deleteLead: { url: '/admin/crm/leads/{lead_id}', method: HTTP_METHODS.DELETE },
|
|
12
|
+
|
|
13
|
+
// Pipeline Actions
|
|
14
|
+
assignOwner: { url: '/admin/crm/leads/{lead_id}/assign', method: HTTP_METHODS.POST },
|
|
15
|
+
enrichLead: { url: '/admin/crm/leads/{lead_id}/enrich', method: HTTP_METHODS.POST },
|
|
16
|
+
approveContact: { url: '/admin/crm/contacts/{contact_id}/approve', method: HTTP_METHODS.POST },
|
|
17
|
+
updateStatus: { url: '/admin/crm/leads/{lead_id}/status', method: HTTP_METHODS.POST },
|
|
18
|
+
addNote: { url: '/admin/crm/leads/{lead_id}/notes', method: HTTP_METHODS.POST },
|
|
19
|
+
addContact: { url: '/admin/crm/leads/{lead_id}/contacts', method: HTTP_METHODS.POST },
|
|
20
|
+
markAsLost: { url: '/admin/crm/leads/{lead_id}/lost', method: HTTP_METHODS.POST },
|
|
21
|
+
recordStaffReply: { url: '/admin/crm/leads/{lead_id}/replied', method: HTTP_METHODS.POST },
|
|
22
|
+
bulkApprove: { url: '/admin/crm/contacts/bulk-approve', method: HTTP_METHODS.POST },
|
|
23
|
+
|
|
24
|
+
// Automation Triggers
|
|
25
|
+
triggerSourcing: { url: '/admin/crm/automation/source', method: HTTP_METHODS.POST },
|
|
26
|
+
triggerSync: { url: '/admin/crm/automation/sync', method: HTTP_METHODS.POST },
|
|
27
|
+
|
|
28
|
+
// Analytics
|
|
29
|
+
funnelStats: { url: '/admin/crm/analytics/funnel', method: HTTP_METHODS.GET },
|
|
30
|
+
performanceStats: { url: '/admin/crm/analytics/performance', method: HTTP_METHODS.GET },
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export default CrmRoute;
|