@insignia-education/api-sdk-js 0.15.18 → 0.15.20

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": "@insignia-education/api-sdk-js",
3
- "version": "0.15.18",
3
+ "version": "0.15.20",
4
4
  "description": "JavaScript SDK for the Insignia Education API",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -23,4 +23,28 @@ export default class Payments {
23
23
  edit: (id, data) => client.patch(`${base}/${id}`, data),
24
24
  };
25
25
  }
26
+
27
+ /**
28
+ * Employee-only: remove/restore any of a payment's line items. Removal is a
29
+ * soft delete — the line stays visible in the admin panel flagged as removed,
30
+ * and restore() puts it back. `type` is one of 'courses' | 'sessions' |
31
+ * 'quizzes' | 'premiums' | 'taxes'.
32
+ */
33
+ items(paymentId) {
34
+ const base = `/payments/${paymentId}`;
35
+ const client = this.#client;
36
+ return {
37
+ delete: (type, id) => client.del(`${base}/${type}/${id}`),
38
+ restore: (type, id) => client.post(`${base}/${type}/${id}/restore`),
39
+ };
40
+ }
41
+
42
+ /** Employee-only: a payment's premium line items. Amount is derived server-side from the selected premium's course price * percentage + fixed price. */
43
+ premiums(paymentId) {
44
+ const base = `/payments/${paymentId}/premiums`;
45
+ const client = this.#client;
46
+ return {
47
+ edit: (id, data) => client.patch(`${base}/${id}`, data),
48
+ };
49
+ }
26
50
  }
@@ -0,0 +1,12 @@
1
+ export default class Premiums {
2
+ #client;
3
+
4
+ constructor(client) {
5
+ this.#client = client;
6
+ }
7
+
8
+ /** Every premium across all courses — used to populate admin selects. */
9
+ get() {
10
+ return this.#client.get('/premiums');
11
+ }
12
+ }
@@ -23,6 +23,7 @@ import Payments from './Payments.js';
23
23
  import Quizzes from './Quizzes.js';
24
24
  import ShortLinks from './ShortLinks.js';
25
25
  import Surveys from './Surveys.js';
26
+ import Premiums from './Premiums.js';
26
27
  import Taxes from './Taxes.js';
27
28
  import Teacher from './Teacher.js';
28
29
  import Telegram from './Telegram.js';
@@ -70,6 +71,7 @@ export default class InsigniaApiV1 extends InsigniaApi {
70
71
  this.quizzes = new Quizzes(this);
71
72
  this.shortLinks = new ShortLinks(this);
72
73
  this.surveys = new Surveys(this);
74
+ this.premiums = new Premiums(this);
73
75
  this.taxes = new Taxes(this);
74
76
  this.teacher = new Teacher(this);
75
77
  this.telegram = new Telegram(this);