@insignia-education/api-sdk-js 0.15.106 → 0.15.108

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.106",
3
+ "version": "0.15.108",
4
4
  "description": "JavaScript SDK for the Insignia Education API",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -16,9 +16,17 @@ export default class Courses {
16
16
  return this.#client.get(qs ? `/courses?${qs}` : '/courses');
17
17
  }
18
18
 
19
- /** Fetch all courses in a single unpaginated request (per_page=0). */
20
- getAll() {
21
- return this.#client.get('/courses?per_page=0');
19
+ /**
20
+ * Fetch all courses in a single unpaginated request (per_page=0).
21
+ * `enabledOnly: true` forces disabled courses out of the result even for a
22
+ * logged-in staff session — the default (employee sees everything, everyone
23
+ * else sees only enabled) still applies when omitted. Use this on genuinely
24
+ * public-facing pages (the /courses catalog, course detail pages) so staff
25
+ * browsing the live site see exactly what a real visitor sees.
26
+ */
27
+ getAll({ enabledOnly = false } = {}) {
28
+ const qs = enabledOnly ? '&enabled_only=1' : '';
29
+ return this.#client.get(`/courses?per_page=0${qs}`);
22
30
  }
23
31
  create(data) { return this.#client.put('/courses', data); }
24
32
  edit(id, data) { return this.#client.patch(`/courses/${id}`, data); }
@@ -70,6 +70,8 @@ export default class Teacher {
70
70
  courseGradedQuizzes: (courseId, quizId = null) => this.#client.get(`${base}/courses/${courseId}/quizzes/graded`, quizId ? { quiz_id: quizId } : {}),
71
71
  /** Quizzes needing correction under this course, each with `lesson.level` eager-loaded — feeds both the graded-tab quiz filter and the pending-tab's level/lesson picker. */
72
72
  courseCorrectableQuizzes: (courseId) => this.#client.get(`${base}/courses/${courseId}/quizzes/correctable`),
73
+ /** Attempts in this course matching a student's name/email (min 2 chars), across every lesson's quiz — unlike courseUngradedQuizzes/courseGradedQuizzes, not scoped to one quiz_id. `graded` selects fully-graded vs not-yet-fully-graded attempts. */
74
+ courseSearchQuizzes: (courseId, q, graded = false) => this.#client.get(`${base}/courses/${courseId}/quizzes/search`, { q, graded: graded ? 1 : 0 }),
73
75
  /** Full attempt detail (all score fields, answers, quiz.questions.answers eager-loaded) for one of this teacher's own students. */
74
76
  quizDetail: (id) => this.#client.get(`${base}/quizzes/${id}`),
75
77
  /**
@@ -134,6 +134,8 @@ export default class Users {
134
134
  delete: (id) => client.del(`${base}/${id}`),
135
135
  verify: (id, data) => client.post(`${base}/${id}/verify`, data),
136
136
  reject: (id, data) => client.post(`${base}/${id}/reject`, data),
137
+ /** Admin-only manual credit/debit of the buyer's account balance — { money_added, money_substracted, password|webauthn_credential, captcha_token }. */
138
+ adjustMoney: (id, data) => client.post(`${base}/${id}/money`, data),
137
139
  /** Preview pricing (with any auto-applied Offer) for a prospective cart, without creating a payment. */
138
140
  quote: (data) => client.post(`${base}/quote`, data),
139
141
  /** Creates a Stripe PaymentIntent for this cart; returns { client_secret, publishable_key, amount } to mount Stripe Elements with. */