glitch-javascript-sdk 2.7.0 → 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.
@@ -0,0 +1,7 @@
1
+ import Route from "./interface";
2
+ declare class CrmRoute {
3
+ static routes: {
4
+ [key: string]: Route;
5
+ };
6
+ }
7
+ export default CrmRoute;
package/dist/index.d.ts CHANGED
@@ -1809,10 +1809,18 @@ 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
- static getCustomStatement<T>(community_id: string, params: {
1813
- start_date: string;
1814
- end_date: string;
1815
- }): AxiosPromise<Response<T>>;
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>>;
1820
+ /**
1821
+ * List all Stripe invoices for the community.
1822
+ */
1823
+ static listInvoices<T>(community_id: string): AxiosPromise<Response<T>>;
1816
1824
  }
1817
1825
 
1818
1826
  declare class Users {
@@ -7379,6 +7387,81 @@ declare class Education {
7379
7387
  static uploadTemplateBackground<T>(uuid: string, file: File): AxiosPromise<Response<T>>;
7380
7388
  }
7381
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
+
7382
7465
  interface Route {
7383
7466
  url: string;
7384
7467
  method: string;
@@ -7727,6 +7810,7 @@ declare class Glitch {
7727
7810
  Raffles: typeof Raffles;
7728
7811
  DiscordMarketplace: typeof DiscordMarketplace;
7729
7812
  Education: typeof Education;
7813
+ Crm: typeof Crm;
7730
7814
  };
7731
7815
  static util: {
7732
7816
  Requests: typeof Requests;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glitch-javascript-sdk",
3
- "version": "2.7.0",
3
+ "version": "2.7.2",
4
4
  "description": "Javascript SDK for Glitch",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -955,8 +955,34 @@ 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
- public static getCustomStatement<T>(community_id: string, params: { start_date: string, end_date: string }): AxiosPromise<Response<T>> {
959
- return Requests.processRoute(CommunitiesRoute.routes.getCustomStatement, undefined, { community_id }, params);
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
+ );
979
+ }
980
+
981
+ /**
982
+ * List all Stripe invoices for the community.
983
+ */
984
+ public static listInvoices<T>(community_id: string): AxiosPromise<Response<T>> {
985
+ return Requests.processRoute(CommunitiesRoute.routes.listInvoices, undefined, { community_id });
960
986
  }
961
987
 
962
988
  }
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;