@iveri/contracts 0.136.0 → 0.138.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
@@ -311,6 +311,12 @@ Conduit's outbox.
311
311
  - Version `0.136.0` adds `Principal.emailVerifiedAt` (required, null until the address is confirmed) and the email
312
312
  confirmation bodies `RegisterShopperBody`, `RequestEmailConfirmationBody` and `ConfirmEmailBody` under
313
313
  `@iveri/contracts/identity`.
314
+ - Version `0.137.0` adds a gym plan's free guest visits: `GymPlan.guestVisitsPerMonth`, the membership's guest
315
+ counters, `GymGuestVisit`, `RecordGymGuestVisitRequest`, and the `GymRefusal` members `guest-passes-used` and
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.
314
320
  - Version `0.134.0` adds `delivery:job:create-any`, `delivery:job:read-any` and `delivery:job:operate-any`, so a shop's
315
321
  and a restaurant's operator-workspace keys ask for, confirm and follow a courier in the company a request names.
316
322
  - Version `0.131.0` adds `mobility:dispatch:create-any`, `mobility:dispatch:read-any`, `mobility:dispatch:operate-any`,
@@ -40,6 +40,12 @@ export interface GymMembership {
40
40
  freezeDaysAllowed: number;
41
41
  freezeDaysUsed: number;
42
42
  memberCanFreeze: boolean;
43
+ /** Copied from the plan when sold: free guest visits each calendar month on the club's clock. 0 means none. */
44
+ guestVisitsPerMonth: number;
45
+ /** Guest visits recorded against this membership in the current calendar month. */
46
+ guestVisitsUsedThisMonth: number;
47
+ /** The calendar date the guest count starts again (the first of next month), or null when there is no allowance. */
48
+ guestVisitsResetOn: Nullable<string>;
43
49
  freezes: GymMembershipFreeze[];
44
50
  currency: string;
45
51
  priceMinor: number;
@@ -91,3 +97,19 @@ export interface GymExpiringMembership {
91
97
  name: LocalizedText;
92
98
  endsOn: string;
93
99
  }
100
+ /**
101
+ * A guest a member brought, recorded by the desk against the member's membership. It counts against the membership's
102
+ * monthly guest allowance. Nothing else about the guest is kept: they have agreed to nothing.
103
+ */
104
+ export interface GymGuestVisit {
105
+ id: UUID;
106
+ membershipId: UUID;
107
+ /** The calendar date of the visit, on the club's clock. */
108
+ visitedOn: string;
109
+ /** Optional, and cleared after a retention window; the visit itself stays, because it is the count. */
110
+ guestFirstName: Nullable<string>;
111
+ createdAt: IsoDateTime;
112
+ }
113
+ export interface RecordGymGuestVisitRequest {
114
+ guestFirstName?: Nullable<string>;
115
+ }
@@ -37,6 +37,11 @@ export interface GymPlan {
37
37
  freezeDaysAllowed: number;
38
38
  /** Whether a member may freeze this themselves or has to ask at the desk. */
39
39
  memberCanFreeze: boolean;
40
+ /**
41
+ * Free guest visits a member on this plan may bring each calendar month, on the club's clock. 0 means none. Unused
42
+ * visits do not carry over, and nothing is charged for them.
43
+ */
44
+ guestVisitsPerMonth: number;
40
45
  activation: GymPlanActivation;
41
46
  /** Whether it is on the website and in the app. A staff-only plan can still be sold at the desk. */
42
47
  isPublic: boolean;
@@ -62,6 +67,7 @@ export interface CreateGymPlanRequest {
62
67
  accessHours?: Nullable<GymWeeklyPeriod[]>;
63
68
  freezeDaysAllowed?: number;
64
69
  memberCanFreeze?: boolean;
70
+ guestVisitsPerMonth?: number;
65
71
  activation?: GymPlanActivation;
66
72
  isPublic?: boolean;
67
73
  isFeatured?: boolean;
@@ -47,5 +47,9 @@ export declare enum GymRefusal {
47
47
  /** The email confirmation link is too old; a new one is sent from the account. */
48
48
  LINK_EXPIRED = "link-expired",
49
49
  /** The member has already signed this version of the waiver. */
50
- WAIVER_SIGNED = "waiver-signed"
50
+ WAIVER_SIGNED = "waiver-signed",
51
+ /** This month's free guest visits are used; `details.resetsOn` is the date the count starts again. */
52
+ GUEST_PASSES_USED = "guest-passes-used",
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"
51
55
  }
@@ -49,4 +49,8 @@ export var GymRefusal;
49
49
  GymRefusal["LINK_EXPIRED"] = "link-expired";
50
50
  /** The member has already signed this version of the waiver. */
51
51
  GymRefusal["WAIVER_SIGNED"] = "waiver-signed";
52
+ /** This month's free guest visits are used; `details.resetsOn` is the date the count starts again. */
53
+ GymRefusal["GUEST_PASSES_USED"] = "guest-passes-used";
54
+ /** Guest visits ride on a membership that is current today, so not a frozen, ended, unpaid or future one. */
55
+ GymRefusal["GUEST_PASS_NOT_CURRENT"] = "guest-pass-not-current";
52
56
  })(GymRefusal || (GymRefusal = {}));
@@ -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.136.0",
3
+ "version": "0.138.0",
4
4
  "description": "Wire contracts shared by every Iveri backend and frontend. Zero runtime dependencies.",
5
5
  "license": "MIT",
6
6
  "repository": {