@iveri/contracts 0.137.0 → 0.139.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/README.md CHANGED
@@ -314,6 +314,11 @@ Conduit's outbox.
314
314
  - Version `0.137.0` adds a gym plan's free guest visits: `GymPlan.guestVisitsPerMonth`, the membership's guest
315
315
  counters, `GymGuestVisit`, `RecordGymGuestVisitRequest`, and the `GymRefusal` members `guest-passes-used` and
316
316
  `guest-pass-not-current`.
317
+ - Version `0.138.0` adds `profile:directory:read` and `profile:directory:read-any` with `ProfileDirectoryPage` under
318
+ `@iveri/contracts/identity` (the names of a company's members who hold a permission), and `UniboxAgent` /
319
+ `UniboxAgents` under `@iveri/contracts/unibox`, so the inbox picks agents by name.
320
+ - Version `0.139.0` adds a trainer's notes on a member: `GymTrainerNote`, `GymTrainerNotes`, `SaveGymTrainerNoteRequest`,
321
+ `GymMyTrainerNote` and the `GymRefusal` member `not-their-trainer` under `@iveri/contracts/gym`.
317
322
  - Version `0.134.0` adds `delivery:job:create-any`, `delivery:job:read-any` and `delivery:job:operate-any`, so a shop's
318
323
  and a restaurant's operator-workspace keys ask for, confirm and follow a courier in the company a request names.
319
324
  - Version `0.131.0` adds `mobility:dispatch:create-any`, `mobility:dispatch:read-any`, `mobility:dispatch:operate-any`,
@@ -51,5 +51,10 @@ export declare enum GymRefusal {
51
51
  /** This month's free guest visits are used; `details.resetsOn` is the date the count starts again. */
52
52
  GUEST_PASSES_USED = "guest-passes-used",
53
53
  /** Guest visits ride on a membership that is current today, so not a frozen, ended, unpaid or future one. */
54
- GUEST_PASS_NOT_CURRENT = "guest-pass-not-current"
54
+ GUEST_PASS_NOT_CURRENT = "guest-pass-not-current",
55
+ /**
56
+ * Only a trainer who has a personal session with the member (booked, attended or missed) writes notes about them;
57
+ * the screen was stale, for example the only session was called off.
58
+ */
59
+ NOT_THEIR_TRAINER = "not-their-trainer"
55
60
  }
@@ -53,4 +53,9 @@ export var GymRefusal;
53
53
  GymRefusal["GUEST_PASSES_USED"] = "guest-passes-used";
54
54
  /** Guest visits ride on a membership that is current today, so not a frozen, ended, unpaid or future one. */
55
55
  GymRefusal["GUEST_PASS_NOT_CURRENT"] = "guest-pass-not-current";
56
+ /**
57
+ * Only a trainer who has a personal session with the member (booked, attended or missed) writes notes about them;
58
+ * the screen was stale, for example the only session was called off.
59
+ */
60
+ GymRefusal["NOT_THEIR_TRAINER"] = "not-their-trainer";
56
61
  })(GymRefusal || (GymRefusal = {}));
@@ -0,0 +1,43 @@
1
+ import type { IsoDateTime } from '../../type/iso-date-time.type.js';
2
+ import type { Nullable } from '../../type/nil.type.js';
3
+ import type { UUID } from '../../type/uuid.type.js';
4
+ /**
5
+ * A dated note a trainer wrote about a member's progress, as the gym's staff read it.
6
+ *
7
+ * Notes are not a secret file: the member reads every note written about them (`GymMyTrainerNote`), so nothing is
8
+ * kept about a person that they cannot see. Plain text, at most 2000 characters, line breaks kept.
9
+ */
10
+ export interface GymTrainerNote {
11
+ id: UUID;
12
+ memberId: UUID;
13
+ /** The staff member who wrote it. */
14
+ trainerId: UUID;
15
+ trainerName: string;
16
+ body: string;
17
+ /** True when the caller wrote it, so may change or remove it. */
18
+ writtenByMe: boolean;
19
+ createdAt: IsoDateTime;
20
+ /** When the text was last changed, or null when it reads as first written. No earlier wording is kept. */
21
+ editedAt: Nullable<IsoDateTime>;
22
+ }
23
+ /** A member's notes, newest first, and whether the caller may add one. */
24
+ export interface GymTrainerNotes {
25
+ notes: GymTrainerNote[];
26
+ /**
27
+ * Whether the caller may write about this member: an active trainer of the gym who has a personal session with
28
+ * them (booked, attended or missed, past or upcoming).
29
+ */
30
+ canWrite: boolean;
31
+ }
32
+ /** Writing or rewriting a note. Plain text, at most 2000 characters, not blank. */
33
+ export interface SaveGymTrainerNoteRequest {
34
+ body: string;
35
+ }
36
+ /** A note as the member it is about reads it, read-only. */
37
+ export interface GymMyTrainerNote {
38
+ id: UUID;
39
+ trainerName: string;
40
+ body: string;
41
+ createdAt: IsoDateTime;
42
+ editedAt: Nullable<IsoDateTime>;
43
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -42,6 +42,7 @@ export * from './gym-session-kind.enum.js';
42
42
  export * from './gym-session-status.enum.js';
43
43
  export * from './gym-signature-method.enum.js';
44
44
  export * from './gym-staff.type.js';
45
+ export * from './gym-trainer-note.type.js';
45
46
  export * from './gym-trainer-time-off.type.js';
46
47
  export * from './gym-training.type.js';
47
48
  export * from './gym-waiver.type.js';
@@ -42,6 +42,7 @@ export * from './gym-session-kind.enum.js';
42
42
  export * from './gym-session-status.enum.js';
43
43
  export * from './gym-signature-method.enum.js';
44
44
  export * from './gym-staff.type.js';
45
+ export * from './gym-trainer-note.type.js';
45
46
  export * from './gym-trainer-time-off.type.js';
46
47
  export * from './gym-training.type.js';
47
48
  export * from './gym-waiver.type.js';
@@ -1,6 +1,7 @@
1
1
  import type { UserPermission } from '../../enum/user-permission.enum.js';
2
2
  import type { IsoDateTime } from '../../type/iso-date-time.type.js';
3
3
  import type { Nullable } from '../../type/nil.type.js';
4
+ import type { Paginated } from '../../type/paginated.type.js';
4
5
  import type { UUID } from '../../type/uuid.type.js';
5
6
  import type { MembershipStatus } from './membership-status.enum.js';
6
7
  import type { TenantStatus } from './tenant-status.enum.js';
@@ -229,3 +230,12 @@ export interface PublicProfile {
229
230
  displayName: string;
230
231
  avatarUrl: Nullable<string>;
231
232
  }
233
+ /**
234
+ * `GET /users/profiles?permission=`: the public profiles of a company's **active** members whose roles grant
235
+ * `permission`, ordered by name. Behind {@link UserPermission.PROFILE_DIRECTORY_READ}; `tenantId` names another company
236
+ * only beside `profile:directory:read-any` from Iveri's operator workspace.
237
+ *
238
+ * An invited, suspended or removed person is absent, so a caller holding an id this list does not name knows the person
239
+ * cannot do the thing asked about here any more — the list is the answer, not a cache to patch.
240
+ */
241
+ export type ProfileDirectoryPage = Paginated<PublicProfile>;
@@ -0,0 +1,30 @@
1
+ import type { Nullable } from '../../type/nil.type.js';
2
+ import type { UUID } from '../../type/uuid.type.js';
3
+ /**
4
+ * Somebody in the company who can work the inbox, named for a picker: assign a conversation, add a team member.
5
+ *
6
+ * **Unibox stores no names.** `unibox-api` asks identity, under its operator-workspace key naming the company, for the
7
+ * active members whose roles grant `unibox:conversation:read`, and passes on the public half only: a name and a photo,
8
+ * never an email or a role. An agent assigning a conversation therefore needs no `user:read`, which is the company's
9
+ * staff directory with everybody's email in it.
10
+ */
11
+ export interface UniboxAgent {
12
+ /** The identity user id a team's `memberUserIds` and a conversation's `assigneeUserId` hold. */
13
+ userId: UUID;
14
+ /** Composed by identity: `firstName lastName`, or the email's local part when no name is set. */
15
+ displayName: string;
16
+ avatarUrl: Nullable<string>;
17
+ }
18
+ /**
19
+ * `GET /api/v1/agents`, ordered by name, behind `unibox:conversation:read`.
20
+ *
21
+ * An id a team or a conversation holds that is not in `items` belongs to somebody who has left the company or can no
22
+ * longer work the inbox, and a client says so ("former agent") rather than printing the id — **but only when
23
+ * `isComplete`**. A company with more agents than one answer carries is cut short, and then an unknown id is simply
24
+ * not named.
25
+ */
26
+ export interface UniboxAgents {
27
+ items: UniboxAgent[];
28
+ /** False when the company has more agents than `unibox-api` reads in one answer. */
29
+ isComplete: boolean;
30
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,4 @@
1
+ export * from './agent.type.js';
1
2
  export * from './canned-reply.type.js';
2
3
  export * from './channel-platform.enum.js';
3
4
  export * from './channel.type.js';
@@ -1,3 +1,4 @@
1
+ export * from './agent.type.js';
1
2
  export * from './canned-reply.type.js';
2
3
  export * from './channel-platform.enum.js';
3
4
  export * from './channel.type.js';
@@ -44,6 +44,21 @@ export declare enum UserPermission {
44
44
  * product sold to many companies names each company's people in the conversations it opens for them.
45
45
  */
46
46
  PROFILE_READ_ANY = "profile:read-any",
47
+ /**
48
+ * List the public profiles of a company's active members who hold one named permission — the same name and photo
49
+ * {@link UserPermission.PROFILE_READ} answers for one person, never an email, phone or role.
50
+ *
51
+ * Deliberately neither `USER_READ` nor `PROFILE_READ`. The first is the staff directory with emails; the second is
52
+ * held by shoppers and passengers so they can see who is driving, and a list on it would let any of them enumerate
53
+ * a company's people. This is what a product shows in a picker ("assign to…") without handing anybody either.
54
+ */
55
+ PROFILE_DIRECTORY_READ = "profile:directory:read",
56
+ /**
57
+ * List those profiles in a company the request names in `tenantId`. A platform permission, held beside
58
+ * {@link UserPermission.PROFILE_DIRECTORY_READ} only by a service credential in Iveri's operator workspace, so a
59
+ * product sold to many companies (Unibox's agent picker) names each company's people from one key.
60
+ */
61
+ PROFILE_DIRECTORY_READ_ANY = "profile:directory:read-any",
47
62
  MEMBERSHIP_READ = "membership:read",
48
63
  /** Suspend or reactivate someone's access without deleting their account. */
49
64
  MEMBERSHIP_UPDATE = "membership:update",
@@ -49,6 +49,21 @@ export var UserPermission;
49
49
  * product sold to many companies names each company's people in the conversations it opens for them.
50
50
  */
51
51
  UserPermission["PROFILE_READ_ANY"] = "profile:read-any";
52
+ /**
53
+ * List the public profiles of a company's active members who hold one named permission — the same name and photo
54
+ * {@link UserPermission.PROFILE_READ} answers for one person, never an email, phone or role.
55
+ *
56
+ * Deliberately neither `USER_READ` nor `PROFILE_READ`. The first is the staff directory with emails; the second is
57
+ * held by shoppers and passengers so they can see who is driving, and a list on it would let any of them enumerate
58
+ * a company's people. This is what a product shows in a picker ("assign to…") without handing anybody either.
59
+ */
60
+ UserPermission["PROFILE_DIRECTORY_READ"] = "profile:directory:read";
61
+ /**
62
+ * List those profiles in a company the request names in `tenantId`. A platform permission, held beside
63
+ * {@link UserPermission.PROFILE_DIRECTORY_READ} only by a service credential in Iveri's operator workspace, so a
64
+ * product sold to many companies (Unibox's agent picker) names each company's people from one key.
65
+ */
66
+ UserPermission["PROFILE_DIRECTORY_READ_ANY"] = "profile:directory:read-any";
52
67
  // ── Membership ──────────────────────────────────────────────────────────
53
68
  UserPermission["MEMBERSHIP_READ"] = "membership:read";
54
69
  /** Suspend or reactivate someone's access without deleting their account. */
@@ -832,6 +847,7 @@ export const PLATFORM_PERMISSIONS = Object.freeze([
832
847
  UserPermission.NOTIFICATION_SEND_ANY,
833
848
  UserPermission.CHAT_EMBED_MANAGE_ANY,
834
849
  UserPermission.PROFILE_READ_ANY,
850
+ UserPermission.PROFILE_DIRECTORY_READ_ANY,
835
851
  UserPermission.REALTIME_SUBSCRIPTION_GRANT_ISSUE_ANY,
836
852
  UserPermission.REALTIME_EVENT_PUBLISH_ANY,
837
853
  UserPermission.MOBILITY_WORKER_READ_ANY,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iveri/contracts",
3
- "version": "0.137.0",
3
+ "version": "0.139.0",
4
4
  "description": "Wire contracts shared by every Iveri backend and frontend. Zero runtime dependencies.",
5
5
  "license": "MIT",
6
6
  "repository": {