@crossworks/client-types 0.232.318 → 0.232.320

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": "@crossworks/client-types",
3
- "version": "0.232.318",
3
+ "version": "0.232.320",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -0,0 +1,125 @@
1
+ /**
2
+ * The client API's wire shapes (client logins, Phase C2): what a CLIENT
3
+ * login's app reads from /api/client/*, and what an admin reads and writes
4
+ * about client logins in Team admin > Clients. A client reads items at
5
+ * client level only (the brain enforces it with row security). Client DTOs
6
+ * never carry a staff name or an author: clients see the brand name.
7
+ */
8
+ import type { MemberItemKind } from '../member-kinds';
9
+
10
+ /** GET /api/client/shell: who is signed in and the brain's brand. */
11
+ export type ClientShell = {
12
+ role: 'client';
13
+ loginId: string;
14
+ displayName: string | null;
15
+ email: string;
16
+ /** Append as `?at=` to /api/client/files/* and /api/client/draws/* srcs. */
17
+ assetToken: string;
18
+ siteName: string | null;
19
+ colorTheme: string | null;
20
+ fontLogo: string | null;
21
+ fontTitle: string | null;
22
+ fontUi: string | null;
23
+ fontProse: string | null;
24
+ fontSize: string | null;
25
+ fontLogoSize: string | null;
26
+ fontTitleSize: string | null;
27
+ fontProseSize: string | null;
28
+ logoVersion: string | null;
29
+ logoDarkVersion: string | null;
30
+ };
31
+
32
+ /** One item in "Shared with you": an item at client level. */
33
+ export type ClientSharedRow = {
34
+ id: string;
35
+ type: MemberItemKind;
36
+ title: string;
37
+ icon: string | null;
38
+ summary: string | null;
39
+ updatedAt: string;
40
+ };
41
+
42
+ /** GET /api/client/shared?kind=&q=&page= : newest first. */
43
+ export type ClientSharedPage = {
44
+ items: ClientSharedRow[];
45
+ total: number;
46
+ page: number;
47
+ pageSize: number;
48
+ };
49
+
50
+ /** GET /api/client/shared/:id -> { item }. A page's doc and a note's text
51
+ * come with every reference to something a client may not read replaced:
52
+ * a mention chip or a link names "Private item" and points nowhere, an
53
+ * embed of such an item is left out. */
54
+ export type ClientSharedItem =
55
+ | (ClientSharedRow & { type: 'page'; doc: unknown })
56
+ | (ClientSharedRow & { type: 'note'; content: string })
57
+ | (ClientSharedRow & { type: 'table'; table: unknown })
58
+ | (ClientSharedRow & { type: 'draw' })
59
+ | (ClientSharedRow & {
60
+ type: 'file';
61
+ filename: string;
62
+ mimeType: string | null;
63
+ sizeBytes: number | null;
64
+ });
65
+
66
+ /** The label a client sees instead of a reference it may not read. */
67
+ export const CLIENT_PRIVATE_LABEL = 'Private item';
68
+
69
+ // ── Admin side: Team admin > Clients ────────────────────────────────────────
70
+
71
+ /** A sign-in link an admin issued (the code itself is shown once, at issue). */
72
+ export type ClientSigninLinkRow = {
73
+ id: string;
74
+ createdAt: string;
75
+ expiresAt: string;
76
+ };
77
+
78
+ /** One client login, as Team admin > Clients lists it. */
79
+ export type ClientLoginRow = {
80
+ id: string;
81
+ email: string;
82
+ displayName: string | null;
83
+ contactId: string | null;
84
+ disabled: boolean;
85
+ createdAt: string;
86
+ lastLoginAt: string | null;
87
+ /** The open (unused, unexpired, unrevoked) sign-in link, if any. */
88
+ openLink: ClientSigninLinkRow | null;
89
+ /** When a sign-in link of this login was last used. */
90
+ lastLinkUsedAt: string | null;
91
+ };
92
+
93
+ /** GET /api/team-admin/clients. `reportAcknowledged`: an admin has checked
94
+ * "What clients see" and nothing went to client since; until then Add
95
+ * client and Issue sign-in link are refused (409 `report-not-acknowledged`). */
96
+ export type ClientLoginList = {
97
+ clients: ClientLoginRow[];
98
+ reportAcknowledged: boolean;
99
+ };
100
+
101
+ /** POST /api/team-admin/clients { email, displayName?, contactId? }
102
+ * -> { client }. The login has no password: it signs in with a link. */
103
+ export type ClientLoginCreated = { client: ClientLoginRow };
104
+
105
+ /** POST /api/team-admin/clients/:id/signin-link -> the link, ONCE. `path` is
106
+ * the client-app path to hand the client (the code is its only secret);
107
+ * 72 hours, one use. Any older open link of the login is revoked. */
108
+ export type ClientSigninLinkCreated = {
109
+ link: ClientSigninLinkRow;
110
+ code: string;
111
+ path: string;
112
+ };
113
+
114
+ /** Why an admin's client action was refused (the 4xx `reason`). */
115
+ export type ClientAdminRefusedReason =
116
+ | 'report-not-acknowledged'
117
+ | 'email-has-login'
118
+ | 'contact-not-found'
119
+ | 'contact-has-login'
120
+ | 'no-email'
121
+ | 'not-a-client';
122
+
123
+ /** POST /api/auth/client-link { code, email } -> 200 { ok: true } and the
124
+ * session cookie (30 days), or one uniform 401 for every failure. */
125
+ export type ClientLinkSignIn = { ok: true };
package/src/dto/member.ts CHANGED
@@ -39,7 +39,9 @@ export type MemberLibraryRow = {
39
39
  title: string;
40
40
  icon: string | null;
41
41
  summary: string | null;
42
- audience: AccessLevel;
42
+ /** A member's Library holds team and client items (client logins,
43
+ * decision 6): 'client' = a client login reads it too (the Client badge). */
44
+ audience: 'team' | 'client';
43
45
  updatedAt: string;
44
46
  /** A member wrote it and an admin accepted it (the member-authored badge).
45
47
  * Absent from brains before 0.232.285. */
package/src/index.ts CHANGED
@@ -96,6 +96,19 @@ export type {
96
96
  } from './dto/member-invites';
97
97
  export type { MemberItemKind } from './member-kinds';
98
98
  export type { LoginKind, LoginRefused, LoginRefusedReason } from './dto/logins';
99
+ export type {
100
+ ClientAdminRefusedReason,
101
+ ClientLinkSignIn,
102
+ ClientLoginCreated,
103
+ ClientLoginList,
104
+ ClientLoginRow,
105
+ ClientSharedItem,
106
+ ClientSharedPage,
107
+ ClientSharedRow,
108
+ ClientShell,
109
+ ClientSigninLinkCreated,
110
+ ClientSigninLinkRow,
111
+ } from './dto/client';
99
112
 
100
113
  // Types only at the root; the runtime constants (APP_TINTS, limits) are the
101
114
  // `@mantle/client-types/app-nav` subpath.