@veritree/services 2.5.6 → 2.6.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veritree/services",
3
- "version": "2.5.6",
3
+ "version": "2.6.0",
4
4
  "description": "A collection of javascript functions/services to talk to veritree API",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -9,7 +9,9 @@ class SponsorsApi extends Api {
9
9
  async map() {
10
10
  this.setOrg();
11
11
 
12
- if(!this.orgId) throw new Error('No org id provided');
12
+ if (!this.orgId) {
13
+ throw new Error('No org id provided');
14
+ }
13
15
 
14
16
  const url = `${this.getUrl()}/${this.orgId}/map-data`;
15
17
  return await this.get(url);
@@ -18,7 +20,9 @@ class SponsorsApi extends Api {
18
20
  async profile() {
19
21
  this.setOrg();
20
22
 
21
- if(!this.orgId) throw new Error('No org id provided');
23
+ if (!this.orgId) {
24
+ throw new Error('No org id provided');
25
+ }
22
26
 
23
27
  const url = `${this.getUrl()}/${this.orgId}/profile`;
24
28
  return await this.get(url);
@@ -32,8 +36,19 @@ class SponsorsApi extends Api {
32
36
  async totalPlantingStats(args) {
33
37
  const url = `${this.getUrl()}/total-planting-stats${this.getUrlParams(args)}`;
34
38
  return await this.get(url);
35
- }
39
+ }
40
+
41
+ async cmsToken(args) {
42
+ const urlParams = this.getUrlParams(args);
43
+ const url = `${this.getUrl()}/${this.orgId}/cms/token${urlParams}`;
44
+ return await this.get(url);
45
+ }
36
46
 
47
+ async cmsImageUploadUrl(args) {
48
+ const urlParams = this.getUrlParams(args);
49
+ const url = `${this.getUrl()}/${this.orgId}/cms/image-upload-url${urlParams}`;
50
+ return await this.get(url);
51
+ }
37
52
  }
38
53
 
39
54
  export const Sponsors = new SponsorsApi();
@@ -174,6 +174,9 @@ export default class Api {
174
174
  if(isOrgAs) {
175
175
  orgIdParam = `org_id=${args.org_id_as}`;
176
176
  orgTypeParam = `&org_type=${args.org_type_as}`;
177
+
178
+ delete args.org_id_as;
179
+ delete args.org_type_as;
177
180
  }
178
181
 
179
182
  if (!isOrgLess && !isOrgAs) {
@@ -29,8 +29,8 @@ const Team = (api, id) => {
29
29
  return await api.post(url, data, 'patch');
30
30
  }
31
31
 
32
- const remove = async (userId) => {
33
- url = `${url}/${userId}${api.getUrlParams()}`;
32
+ const remove = async (userId, args) => {
33
+ url = `${url}/${userId}${api.getUrlParams(args)}`;
34
34
  return await api.post(url, null, "delete");
35
35
  }
36
36