@startsimpli/ui 0.4.15 → 0.4.17
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 +2 -1
- package/src/components/__tests__/error-surfaces.test.tsx +70 -0
- package/src/components/error/GlobalError.tsx +261 -0
- package/src/components/error/NotFound.tsx +78 -0
- package/src/components/error/RouteErrorBoundary.tsx +175 -0
- package/src/components/error/index.ts +6 -0
- package/src/components/index.ts +5 -0
- package/src/components/team/__tests__/team-settings-page.test.tsx +146 -0
- package/src/components/team/index.ts +5 -0
- package/src/components/team/pages/DomainsSettingsPage.tsx +289 -0
- package/src/components/team/pages/TeamSettingsPage.tsx +423 -0
- package/src/components/team/pages/domains-settings-page-default-class-names.ts +89 -0
- package/src/components/team/pages/index.ts +33 -0
- package/src/components/team/pages/team-settings-page-default-class-names.ts +116 -0
- package/src/components/team/pages/types.ts +135 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Narrow API-surface interfaces for the shared TeamSettingsPage /
|
|
3
|
+
* DomainsSettingsPage composers.
|
|
4
|
+
*
|
|
5
|
+
* Apps pass in the @startsimpli/api `api` instance and these interfaces
|
|
6
|
+
* structurally describe the slice the pages actually use. Keeping the slice
|
|
7
|
+
* shape inline here means @startsimpli/ui does NOT depend on @startsimpli/api
|
|
8
|
+
* directly. startsim-o7s.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type {
|
|
12
|
+
InvitationLite,
|
|
13
|
+
MemberRow,
|
|
14
|
+
TeamRole,
|
|
15
|
+
DomainClaimLite,
|
|
16
|
+
} from '../types'
|
|
17
|
+
|
|
18
|
+
/** A page-level `member` row hits the API as-is — keep the shape thin. */
|
|
19
|
+
export interface ApiMember {
|
|
20
|
+
id: string
|
|
21
|
+
userId: string
|
|
22
|
+
teamId: string
|
|
23
|
+
role: TeamRole
|
|
24
|
+
joinedAt: string
|
|
25
|
+
user?: MemberRow['user']
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Paginated wrapper used by @startsimpli/api list endpoints. */
|
|
29
|
+
export interface ApiPaginated<T> {
|
|
30
|
+
count?: number
|
|
31
|
+
next?: string | null
|
|
32
|
+
previous?: string | null
|
|
33
|
+
results: T[]
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** A team membership row from /team-members/my-teams/. */
|
|
37
|
+
export interface ApiMyTeamMembership {
|
|
38
|
+
id: string
|
|
39
|
+
userId: string
|
|
40
|
+
teamId: string
|
|
41
|
+
role: TeamRole
|
|
42
|
+
joinedAt: string
|
|
43
|
+
team?: {
|
|
44
|
+
id: string
|
|
45
|
+
slug: string
|
|
46
|
+
name: string
|
|
47
|
+
companyId: string
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** A team row from /teams/{idOrSlug}/. */
|
|
52
|
+
export interface ApiTeam {
|
|
53
|
+
id: string
|
|
54
|
+
slug: string
|
|
55
|
+
name: string
|
|
56
|
+
companyId: string
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** A company row from /companies/{idOrSlug}/. */
|
|
60
|
+
export interface ApiCompany {
|
|
61
|
+
id: string
|
|
62
|
+
slug: string
|
|
63
|
+
name: string
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** An invitation row from /team-invitations/. */
|
|
67
|
+
export interface ApiInvitation extends InvitationLite {
|
|
68
|
+
createdAt: string
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** A domain-claim row from /team-domain-claims/. */
|
|
72
|
+
export interface ApiDomainClaim extends DomainClaimLite {}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Minimum API surface the TeamSettingsPage composer needs. The real
|
|
76
|
+
* @startsimpli/api `api` instance satisfies this structurally.
|
|
77
|
+
*/
|
|
78
|
+
export interface TeamSettingsApi {
|
|
79
|
+
teams: {
|
|
80
|
+
myTeams: () => Promise<ApiMyTeamMembership[]>
|
|
81
|
+
retrieve: (idOrSlug: string) => Promise<ApiTeam>
|
|
82
|
+
members: (idOrSlug: string) => Promise<ApiMember[]>
|
|
83
|
+
updateRole: (
|
|
84
|
+
idOrSlug: string,
|
|
85
|
+
userId: string,
|
|
86
|
+
role: TeamRole,
|
|
87
|
+
) => Promise<unknown>
|
|
88
|
+
removeMember: (idOrSlug: string, userId: string) => Promise<unknown>
|
|
89
|
+
bulkInvite: (
|
|
90
|
+
idOrSlug: string,
|
|
91
|
+
invitations: Array<{ email: string; role: TeamRole }>,
|
|
92
|
+
) => Promise<{
|
|
93
|
+
invited: ApiInvitation[]
|
|
94
|
+
skipped?: Array<{ email: string; reason: string }>
|
|
95
|
+
}>
|
|
96
|
+
}
|
|
97
|
+
teamInvitations: {
|
|
98
|
+
list: (params: { teamId: string }) => Promise<ApiPaginated<ApiInvitation>>
|
|
99
|
+
create: (input: {
|
|
100
|
+
email: string
|
|
101
|
+
teamId: string
|
|
102
|
+
role: TeamRole
|
|
103
|
+
}) => Promise<ApiInvitation>
|
|
104
|
+
revoke: (id: string) => Promise<void>
|
|
105
|
+
}
|
|
106
|
+
companies: {
|
|
107
|
+
retrieve: (idOrSlug: string) => Promise<ApiCompany>
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Minimum API surface the DomainsSettingsPage composer needs. The real
|
|
113
|
+
* @startsimpli/api `api` instance satisfies this structurally.
|
|
114
|
+
*/
|
|
115
|
+
export interface DomainsSettingsApi {
|
|
116
|
+
domainClaims: {
|
|
117
|
+
list: (params: { companyId: string }) => Promise<ApiPaginated<ApiDomainClaim>>
|
|
118
|
+
create: (input: {
|
|
119
|
+
companyId: string
|
|
120
|
+
domain: string
|
|
121
|
+
}) => Promise<ApiDomainClaim>
|
|
122
|
+
verifyDns: (id: string) => Promise<ApiDomainClaim>
|
|
123
|
+
verifyEmailInitiate: (id: string) => Promise<{ detail: string }>
|
|
124
|
+
verifyEmailCode: (id: string, code: string) => Promise<ApiDomainClaim>
|
|
125
|
+
revoke: (id: string) => Promise<void>
|
|
126
|
+
}
|
|
127
|
+
/** Used to pick the default companyId when the prop is omitted. */
|
|
128
|
+
teams: {
|
|
129
|
+
myTeams: () => Promise<ApiMyTeamMembership[]>
|
|
130
|
+
retrieve: (idOrSlug: string) => Promise<ApiTeam>
|
|
131
|
+
}
|
|
132
|
+
companies: {
|
|
133
|
+
retrieve: (idOrSlug: string) => Promise<ApiCompany>
|
|
134
|
+
}
|
|
135
|
+
}
|