@friggframework/api-module-zoho-crm 2.0.0-next.7 → 2.0.0-next.9
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/api.d.ts +3 -1
- package/dist/api.js +18 -8
- package/dist/types.d.ts +11 -0
- package/package.json +2 -2
package/dist/api.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OAuth2Requester } from '@friggframework/core';
|
|
2
|
-
import { ZohoConfig, ZohoLocation, QueryParams, SearchParams, UsersResponse, RolesResponse, ProfilesResponse, ContactsResponse, ContactResponse, LeadsResponse, LeadResponse, AccountsResponse, AccountResponse, TokenResponse, CreateNoteData, NotesResponse, NoteListResponse, NotificationWatchConfig, NotificationResponse, NotificationDetailsResponse, ZohoCallData, CallsResponse } from './types';
|
|
2
|
+
import { ZohoConfig, ZohoLocation, QueryParams, SearchParams, UsersResponse, RolesResponse, ProfilesResponse, ContactsResponse, ContactResponse, LeadsResponse, LeadResponse, AccountsResponse, AccountResponse, TokenResponse, CreateNoteData, NotesResponse, NoteListResponse, NotificationWatchConfig, NotificationResponse, NotificationDetailsResponse, ZohoCallData, CallsResponse, OrgResponse } from './types';
|
|
3
3
|
export declare class Api extends OAuth2Requester {
|
|
4
4
|
URLs: Record<string, string | ((id: string) => string)>;
|
|
5
5
|
location: ZohoLocation;
|
|
@@ -8,6 +8,8 @@ export declare class Api extends OAuth2Requester {
|
|
|
8
8
|
private static readonly ACCOUNTS_DEFAULT_FIELDS;
|
|
9
9
|
constructor(params: ZohoConfig);
|
|
10
10
|
getAuthUri(): string;
|
|
11
|
+
getCrmBaseUrl(): string;
|
|
12
|
+
getOrg(): Promise<OrgResponse>;
|
|
11
13
|
setLocation(location: ZohoLocation): void;
|
|
12
14
|
getTokenFromCode(code: string): Promise<TokenResponse>;
|
|
13
15
|
_delete(options: any): Promise<any>;
|
package/dist/api.js
CHANGED
|
@@ -8,14 +8,14 @@ const core_1 = require("@friggframework/core");
|
|
|
8
8
|
* @see https://www.zoho.com/crm/developer/docs/api/v8/multi-dc.html
|
|
9
9
|
*/
|
|
10
10
|
const LOCATION_CONFIG = {
|
|
11
|
-
us: { accounts: 'https://accounts.zoho.com', api: 'https://www.zohoapis.com' },
|
|
12
|
-
eu: { accounts: 'https://accounts.zoho.eu', api: 'https://www.zohoapis.eu' },
|
|
13
|
-
in: { accounts: 'https://accounts.zoho.in', api: 'https://www.zohoapis.in' },
|
|
14
|
-
au: { accounts: 'https://accounts.zoho.com.au', api: 'https://www.zohoapis.com.au' },
|
|
15
|
-
cn: { accounts: 'https://accounts.zoho.com.cn', api: 'https://www.zohoapis.com.cn' },
|
|
16
|
-
ca: { accounts: 'https://accounts.zohocloud.ca', api: 'https://www.zohoapis.ca' },
|
|
17
|
-
jp: { accounts: 'https://accounts.zoho.jp', api: 'https://www.zohoapis.jp' },
|
|
18
|
-
sa: { accounts: 'https://accounts.zoho.sa', api: 'https://www.zohoapis.sa' },
|
|
11
|
+
us: { accounts: 'https://accounts.zoho.com', api: 'https://www.zohoapis.com', crm: 'https://crm.zoho.com' },
|
|
12
|
+
eu: { accounts: 'https://accounts.zoho.eu', api: 'https://www.zohoapis.eu', crm: 'https://crm.zoho.eu' },
|
|
13
|
+
in: { accounts: 'https://accounts.zoho.in', api: 'https://www.zohoapis.in', crm: 'https://crm.zoho.in' },
|
|
14
|
+
au: { accounts: 'https://accounts.zoho.com.au', api: 'https://www.zohoapis.com.au', crm: 'https://crm.zoho.com.au' },
|
|
15
|
+
cn: { accounts: 'https://accounts.zoho.com.cn', api: 'https://www.zohoapis.com.cn', crm: 'https://crm.zoho.com.cn' },
|
|
16
|
+
ca: { accounts: 'https://accounts.zohocloud.ca', api: 'https://www.zohoapis.ca', crm: 'https://crm.zohocloud.ca' },
|
|
17
|
+
jp: { accounts: 'https://accounts.zoho.jp', api: 'https://www.zohoapis.jp', crm: 'https://crm.zoho.jp' },
|
|
18
|
+
sa: { accounts: 'https://accounts.zoho.sa', api: 'https://www.zohoapis.sa', crm: 'https://crm.zoho.sa' },
|
|
19
19
|
};
|
|
20
20
|
const DEFAULT_LOCATION = 'us';
|
|
21
21
|
/**
|
|
@@ -58,11 +58,18 @@ class Api extends core_1.OAuth2Requester {
|
|
|
58
58
|
calls: '/Calls',
|
|
59
59
|
call: (callId) => `/Calls/${callId}`,
|
|
60
60
|
notificationsWatch: '/actions/watch',
|
|
61
|
+
org: '/org',
|
|
61
62
|
};
|
|
62
63
|
}
|
|
63
64
|
getAuthUri() {
|
|
64
65
|
return this.authorizationUri;
|
|
65
66
|
}
|
|
67
|
+
getCrmBaseUrl() {
|
|
68
|
+
return LOCATION_CONFIG[this.location].crm;
|
|
69
|
+
}
|
|
70
|
+
async getOrg() {
|
|
71
|
+
return this._get({ url: this.baseUrl + this.URLs.org });
|
|
72
|
+
}
|
|
66
73
|
setLocation(location) {
|
|
67
74
|
if (!LOCATION_CONFIG[location]) {
|
|
68
75
|
throw new Error(`Invalid Zoho location: ${location}. Must be one of: ${Object.keys(LOCATION_CONFIG).join(', ')}`);
|
|
@@ -87,6 +94,9 @@ class Api extends core_1.OAuth2Requester {
|
|
|
87
94
|
url: this.tokenUri,
|
|
88
95
|
};
|
|
89
96
|
const response = await this._post(options, false);
|
|
97
|
+
if (response.error) {
|
|
98
|
+
throw new Error(`[Zoho API] Zoho token exchange failed: ${response.error}`);
|
|
99
|
+
}
|
|
90
100
|
await this.setTokens(response);
|
|
91
101
|
return response;
|
|
92
102
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -381,6 +381,17 @@ export interface ZohoCallData {
|
|
|
381
381
|
/** Additional custom fields */
|
|
382
382
|
[key: string]: any;
|
|
383
383
|
}
|
|
384
|
+
export interface ZohoOrg {
|
|
385
|
+
id: string;
|
|
386
|
+
company_name: string;
|
|
387
|
+
domain_name: string;
|
|
388
|
+
time_zone: string;
|
|
389
|
+
currency: string;
|
|
390
|
+
[key: string]: any;
|
|
391
|
+
}
|
|
392
|
+
export interface OrgResponse {
|
|
393
|
+
org: ZohoOrg[];
|
|
394
|
+
}
|
|
384
395
|
/**
|
|
385
396
|
* Response from Calls module operations
|
|
386
397
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@friggframework/api-module-zoho-crm",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.9",
|
|
4
4
|
"prettier": "@friggframework/prettier-config",
|
|
5
5
|
"description": "Zoho CRM API module that lets the Frigg Framework interact with Zoho CRM",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "4ebe2d5147ac4c260ae9667c24411b16add89001"
|
|
40
40
|
}
|