@crossworks/client-types 0.232.289 → 0.232.291
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 +1 -1
- package/src/dto/member-invites.ts +59 -0
- package/src/index.ts +8 -0
package/package.json
CHANGED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Member invites (member logins Phase 6): an admin invites a person, who
|
|
3
|
+
* opens the invite link, sets a password and becomes a MEMBER login.
|
|
4
|
+
*
|
|
5
|
+
* Admin: /api/team-admin/invites (create, list, revoke). Public, no session:
|
|
6
|
+
* /api/auth/invite/:code (preview) and /api/auth/invite/accept (redeem). The
|
|
7
|
+
* plaintext code is in the create response only, never in a list.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/** Where an invite stands. A revoked invite is not listed. */
|
|
11
|
+
export type MemberInviteState = 'open' | 'redeemed' | 'expired';
|
|
12
|
+
|
|
13
|
+
/** One invite in GET /api/team-admin/invites (no code). */
|
|
14
|
+
export type MemberInviteRow = {
|
|
15
|
+
id: string;
|
|
16
|
+
/** The contact it was made for; null for an email-only invite, or once
|
|
17
|
+
* the contact is deleted. */
|
|
18
|
+
contactId: string | null;
|
|
19
|
+
/** The contact's current name; null when there is no contact. */
|
|
20
|
+
contactName: string | null;
|
|
21
|
+
/** The email the member login is created with (lower-cased). */
|
|
22
|
+
email: string;
|
|
23
|
+
displayName: string | null;
|
|
24
|
+
state: MemberInviteState;
|
|
25
|
+
createdAt: string;
|
|
26
|
+
expiresAt: string;
|
|
27
|
+
redeemedAt: string | null;
|
|
28
|
+
/** The member login the invite created. */
|
|
29
|
+
redeemedLoginId: string | null;
|
|
30
|
+
/** The admin login that made it; null once that login is deleted. */
|
|
31
|
+
createdBy: string | null;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/** GET /api/team-admin/invites: newest first. */
|
|
35
|
+
export type MemberInviteList = { invites: MemberInviteRow[] };
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* POST /api/team-admin/invites (201). `code` and `linkPath` are shown ONCE:
|
|
39
|
+
* only the code's hash is stored. `linkPath` is a client-app path
|
|
40
|
+
* (`/invite?code=…`); prefix the client's origin to share it.
|
|
41
|
+
*/
|
|
42
|
+
export type MemberInviteCreated = {
|
|
43
|
+
invite: MemberInviteRow;
|
|
44
|
+
code: string;
|
|
45
|
+
linkPath: string;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/** GET /api/auth/invite/:code (public): who the invite is for, so the page
|
|
49
|
+
* can greet them. Any code that cannot be redeemed is a uniform 404. */
|
|
50
|
+
export type MemberInvitePreview = {
|
|
51
|
+
email: string;
|
|
52
|
+
displayName: string | null;
|
|
53
|
+
siteName: string | null;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/** POST /api/auth/invite/accept (public) { code, password, email? }: the
|
|
57
|
+
* member login is created and the session cookie is set, as a login does.
|
|
58
|
+
* Any failure about the code is a uniform 401. */
|
|
59
|
+
export type MemberInviteAccepted = { ok: true; email: string };
|
package/src/index.ts
CHANGED
|
@@ -70,6 +70,14 @@ export type {
|
|
|
70
70
|
MemberHomeApp,
|
|
71
71
|
MemberHomeData,
|
|
72
72
|
} from './dto/member-apps';
|
|
73
|
+
export type {
|
|
74
|
+
MemberInviteAccepted,
|
|
75
|
+
MemberInviteCreated,
|
|
76
|
+
MemberInviteList,
|
|
77
|
+
MemberInvitePreview,
|
|
78
|
+
MemberInviteRow,
|
|
79
|
+
MemberInviteState,
|
|
80
|
+
} from './dto/member-invites';
|
|
73
81
|
export type { MemberItemKind } from './member-kinds';
|
|
74
82
|
|
|
75
83
|
// Types only at the root; the runtime constants (APP_TINTS, limits) are the
|