@iblai/data-layer 1.27.0 → 1.29.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/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iblai/data-layer",
3
- "version": "1.26.0",
3
+ "version": "1.28.0",
4
4
  "description": "ibl.ai data layer",
5
5
  "main": "dist/index.esm.js",
6
6
  "types": "dist/index.d.ts",
@@ -24,11 +24,32 @@ export interface UserChatPrivacySettings {
24
24
  chat_privacy_enabled: boolean;
25
25
  chat_privacy_mode: ChatPrivacyMode | null;
26
26
  }
27
+ /**
28
+ * `is_locked` is true only when the winning tier is `mentor` or `tenant`. A
29
+ * mentor with `disable_privacy_mode` on therefore reports `is_locked: true`
30
+ * only when it actually clamped a user's global "disabled" preference to
31
+ * `anonymized`; for everyone else the read says `normal` / `default` /
32
+ * unlocked, so the lock itself has to be read from the mentor's public
33
+ * settings (`MentorChatPrivacyPublicSettings`).
34
+ */
27
35
  export interface ChatPrivacyEffective {
28
36
  mode: ChatPrivacyMode;
29
37
  source: 'tenant' | 'mentor' | 'user' | 'session' | 'default';
30
38
  is_locked: boolean;
31
39
  }
40
+ /**
41
+ * Chat-privacy fields of `GET …/mentors/{mentor}/public-settings/` — readable
42
+ * by members, writable through the mentor settings PUT by admins only.
43
+ */
44
+ export interface MentorChatPrivacyPublicSettings {
45
+ /**
46
+ * When on, end users cannot make conversations with this mentor private:
47
+ * the SPA hides the privacy toggle, and the backend answers a private
48
+ * session start or a `disable-chathistory` flip with 403. `null` is an
49
+ * older record and means off.
50
+ */
51
+ disable_privacy_mode?: boolean | null;
52
+ }
32
53
  interface OrgUserArgs {
33
54
  org: string;
34
55
  userId: string;
@@ -0,0 +1,25 @@
1
+ import type { BaseQueryFn } from '@reduxjs/toolkit/query';
2
+ type AnyBaseQuery = BaseQueryFn<any, any, any, any, any>;
3
+ /**
4
+ * Makes a base query that reports failures by THROWING report them by
5
+ * RETURNING `{ error }` instead, which is the only form RTK Query keeps.
6
+ *
7
+ * `iblFetchBaseQuery` throws `{ status, data }` on any failed request. RTK
8
+ * Query treats a thrown value as an unhandled exception: the thunk rejects
9
+ * with `miniSerializeError(e)`, which copies only `name` / `message` /
10
+ * `stack` / `code`. For a `{ status, data }` object that leaves `{}` — so
11
+ * `.unwrap()` rejects with an empty object and a hook's `error` is empty too.
12
+ * The HTTP status and the backend's body never reach the caller: a 403 cannot
13
+ * be told from any other failure, and a 400's field messages or its
14
+ * form-level `error` string cannot be shown.
15
+ *
16
+ * Wrap a slice's base query with this when its callers need the status or the
17
+ * body, e.g. to place backend validation messages next to their fields.
18
+ *
19
+ * Only values that look like an RTK error (an object with a `status`) are
20
+ * converted; anything else is rethrown untouched. Note that a returned error
21
+ * also lets a mutation's static `invalidatesTags` run, as RTK does for any
22
+ * handled error.
23
+ */
24
+ export declare function withReturnedErrors<Query extends AnyBaseQuery>(baseQuery: Query): Query;
25
+ export {};