@insignia-education/api-sdk-js 0.25.3 → 0.25.5
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 +1 -1
- package/src/api/v1/CompanySalesGoals.js +13 -0
- package/src/api/v1/Users.js +10 -0
- package/src/api/v1/index.js +2 -0
package/package.json
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export default class CompanySalesGoals {
|
|
2
|
+
#client;
|
|
3
|
+
|
|
4
|
+
constructor(client) {
|
|
5
|
+
this.#client = client;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/** Admin-only: the company's 12 monthly sales goals for a year (`{ month, amount }[]`, 0 where unset). */
|
|
9
|
+
get(year = new Date().getFullYear()) { return this.#client.get('/company-sales-goals', { year }); }
|
|
10
|
+
|
|
11
|
+
/** Admin-only: upserts the given months of a year's company sales goals; resolves the full 12-month list. */
|
|
12
|
+
edit(year, goals) { return this.#client.put('/company-sales-goals', { year, goals }); }
|
|
13
|
+
}
|
package/src/api/v1/Users.js
CHANGED
|
@@ -93,6 +93,16 @@ export default class Users {
|
|
|
93
93
|
|
|
94
94
|
courseNotes(userId) { return this.#nested(userId, 'course-notes'); }
|
|
95
95
|
|
|
96
|
+
/** Admin-only, seller-type users only: the 12 monthly sales goals for a year (`{ month, amount }[]`). edit() upserts the given months. */
|
|
97
|
+
salesGoals(userId) {
|
|
98
|
+
const base = `/users/${userId}/sales-goals`;
|
|
99
|
+
const client = this.#client;
|
|
100
|
+
return {
|
|
101
|
+
get: (year = new Date().getFullYear()) => client.get(base, { year }),
|
|
102
|
+
edit: (year, goals) => client.put(base, { year, goals }),
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
|
|
96
106
|
/** Additional social/contact links (Facebook, WhatsApp, YouTube, etc.) — each row's contact_id points at a ContactTypes.get() entry. */
|
|
97
107
|
contacts(userId) { return this.#nested(userId, 'contacts'); }
|
|
98
108
|
|
package/src/api/v1/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import Auth from './Auth.js';
|
|
|
5
5
|
import Accounts from './Accounts.js';
|
|
6
6
|
import Certificates from './Certificates.js';
|
|
7
7
|
import Changelogs from './Changelogs.js';
|
|
8
|
+
import CompanySalesGoals from './CompanySalesGoals.js';
|
|
8
9
|
import CompanySettings from './CompanySettings.js';
|
|
9
10
|
import ContactForms from './ContactForms.js';
|
|
10
11
|
import ContactTypes from './ContactTypes.js';
|
|
@@ -65,6 +66,7 @@ export default class InsigniaApiV1 extends InsigniaApi {
|
|
|
65
66
|
this.accounts = new Accounts(this);
|
|
66
67
|
this.certificates = new Certificates(this);
|
|
67
68
|
this.changelogs = new Changelogs(this);
|
|
69
|
+
this.companySalesGoals = new CompanySalesGoals(this);
|
|
68
70
|
this.companySettings = new CompanySettings(this);
|
|
69
71
|
this.contactForms = new ContactForms(this);
|
|
70
72
|
this.contactTypes = new ContactTypes(this);
|