@insignia-education/api-sdk-js 0.16.1 → 0.16.3

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.16.1",
3
+ "version": "0.16.3",
4
4
  "description": "JavaScript SDK for the Insignia Education API",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -9,6 +9,11 @@ export default class Search {
9
9
  * Sales-and-above global search: users (name/email/dni) and courses (cod/title).
10
10
  * `offset` pages through the user results only (courses are always the first page) —
11
11
  * response includes `users_has_more` to know whether another page exists.
12
+ * `includeTrashed` opts into soft-deleted accounts (flagged via `deleted_at` on the
13
+ * returned row) — off by default, since this same endpoint also backs pickers (coupon
14
+ * grant, referrer) that must never offer a deleted account as a valid target.
12
15
  */
13
- query(q, offset = 0) { return this.#client.get('/search', { q, offset }); }
16
+ query(q, offset = 0, includeTrashed = false) {
17
+ return this.#client.get('/search', { q, offset, include_trashed: includeTrashed ? 1 : undefined });
18
+ }
14
19
  }
@@ -247,8 +247,20 @@ export default class Users {
247
247
  /** Admin-only: lifts a hard block. */
248
248
  unblock(userId) { return this.#client.post(`/users/${userId}/unblock`); }
249
249
 
250
- /** GDPR erasure request — self-service or sales-and-above, always confirmed with the ACTOR's own current password. Soft-deletes now; the API permanently purges it after a 1-year retention window. */
251
- delete(userId, password) { return this.#client.del(`/users/${userId}`, { password }); }
250
+ /**
251
+ * GDPR erasure request — self-service or sales-and-above. `data` is either
252
+ * `{ password, captcha_token }` or `{ webauthn_credential }`, same step-up
253
+ * shape as payments().verify()/reject(). Soft-deletes now; the API
254
+ * permanently purges it after a 1-year retention window, and immediately
255
+ * emails a one-time undo link to the account's own address.
256
+ */
257
+ delete(userId, data) { return this.#client.del(`/users/${userId}`, data); }
258
+
259
+ /** Sellers+: reverses a soft-deletion found via the global search (which includes trashed accounts). */
260
+ restore(userId) { return this.#client.post(`/users/${userId}/restore`); }
261
+
262
+ /** Public — the account is soft-deleted so its own session is already dead; this is the only way it gets back in. No auth. */
263
+ undoDeletionConfirm(hash) { return this.#client.post(`/accounts/undo-deletion/${hash}`); }
252
264
 
253
265
  /** GDPR access/portability request (Art. 15/20) — self-service or sales-and-above. Runs synchronously and returns the DataRequest with `pdf_url`/`json_url` already populated. */
254
266
  exportData(userId) { return this.#client.post(`/users/${userId}/data-export`); }