@streamoid/settings 0.3.4 → 0.3.6
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/dist/index.d.mts +219 -2
- package/dist/index.d.ts +219 -2
- package/dist/index.js +2809 -588
- package/dist/index.mjs +2821 -593
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -9,7 +9,7 @@ import { SVGProps, ReactNode } from 'react';
|
|
|
9
9
|
* so consumers don't have to re-implement tab/URL conversion if they don't
|
|
10
10
|
* want to.
|
|
11
11
|
*/
|
|
12
|
-
type SettingsTab = "profile" | "workspace" | "referral" | "team" | "billing" | "apikey";
|
|
12
|
+
type SettingsTab = "profile" | "workspace" | "referral" | "team" | "organization" | "billing" | "apikey";
|
|
13
13
|
/** Internal tab id → URL slug. */
|
|
14
14
|
declare const TAB_TO_URL: Record<SettingsTab, string>;
|
|
15
15
|
/** URL slug → internal tab id. */
|
|
@@ -90,6 +90,20 @@ interface SettingsWorkspaceCurrent {
|
|
|
90
90
|
totalCredits?: number | null;
|
|
91
91
|
/** ISO country code for the workspace; drives plan currency selection. */
|
|
92
92
|
country?: string;
|
|
93
|
+
/**
|
|
94
|
+
* Organization multi-tenancy — present when the workspace has joined (or is
|
|
95
|
+
* pending to join) an org. `undefined`/absent means the workspace has no
|
|
96
|
+
* org affiliation, in which case the Workspace modal offers "Request to
|
|
97
|
+
* join organization" instead of the visibility toggle / leave action.
|
|
98
|
+
*/
|
|
99
|
+
organizationId?: string;
|
|
100
|
+
/**
|
|
101
|
+
* "private" = only members of this workspace can see it; "shared" = every
|
|
102
|
+
* member of the parent org gets implicit view-only access. Toggled from
|
|
103
|
+
* the Workspace tab; org admins always have full implicit access
|
|
104
|
+
* regardless of this flag (host-side rule, not enforced by this package).
|
|
105
|
+
*/
|
|
106
|
+
orgVisibility?: "private" | "shared";
|
|
93
107
|
}
|
|
94
108
|
interface SettingsWorkspaceListItem {
|
|
95
109
|
_id: string;
|
|
@@ -155,6 +169,153 @@ interface SettingsWorkspaceAdapter {
|
|
|
155
169
|
* to) re-running `list()`. Lets the host re-sync its own context state.
|
|
156
170
|
*/
|
|
157
171
|
refresh?: () => Promise<void>;
|
|
172
|
+
/**
|
|
173
|
+
* Request to join an org from the workspace side. Creates a pending
|
|
174
|
+
* workspace-join-request that an org admin later approves/rejects via
|
|
175
|
+
* `SettingsOrganizationAdapter.approveJoinRequest`.
|
|
176
|
+
*/
|
|
177
|
+
requestJoinOrganization?: (organizationId: string) => Promise<void>;
|
|
178
|
+
/** Leave the org this workspace currently belongs to. */
|
|
179
|
+
leaveOrganization?: () => Promise<void>;
|
|
180
|
+
/** Toggle this workspace's `orgVisibility` within its parent org. */
|
|
181
|
+
setOrgVisibility?: (visibility: "private" | "shared") => Promise<void>;
|
|
182
|
+
}
|
|
183
|
+
interface SettingsOrganizationListItem {
|
|
184
|
+
_id: string;
|
|
185
|
+
name: string;
|
|
186
|
+
imageUrl?: string;
|
|
187
|
+
role?: "admin" | "member";
|
|
188
|
+
}
|
|
189
|
+
interface SettingsOrganizationCurrent {
|
|
190
|
+
id: string;
|
|
191
|
+
name?: string;
|
|
192
|
+
imageUrl?: string;
|
|
193
|
+
role?: "admin" | "member" | string;
|
|
194
|
+
}
|
|
195
|
+
interface OrganizationMember {
|
|
196
|
+
_id: string;
|
|
197
|
+
role: "admin" | "member";
|
|
198
|
+
inviteAccess: boolean;
|
|
199
|
+
user: {
|
|
200
|
+
_id: string;
|
|
201
|
+
email: string;
|
|
202
|
+
name: string;
|
|
203
|
+
createdAt?: string;
|
|
204
|
+
};
|
|
205
|
+
createdAt?: string;
|
|
206
|
+
invitedBy?: string | {
|
|
207
|
+
email?: string;
|
|
208
|
+
name?: string;
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
/** A single row in the combined Organization invites table. */
|
|
212
|
+
interface OrganizationInvite {
|
|
213
|
+
_id: string;
|
|
214
|
+
kind: "email" | "domain";
|
|
215
|
+
email?: string;
|
|
216
|
+
domain?: string;
|
|
217
|
+
status: "active" | "revoked" | "cancelled" | "rejected" | "expired" | "completed";
|
|
218
|
+
token?: string;
|
|
219
|
+
role?: "admin" | "member";
|
|
220
|
+
autoJoinRole?: "admin" | "member";
|
|
221
|
+
invitedBy?: string | {
|
|
222
|
+
email?: string;
|
|
223
|
+
name?: string;
|
|
224
|
+
};
|
|
225
|
+
createdAt?: string;
|
|
226
|
+
}
|
|
227
|
+
interface OrganizationWorkspaceItem {
|
|
228
|
+
_id: string;
|
|
229
|
+
name: string;
|
|
230
|
+
imageUrl?: string;
|
|
231
|
+
orgVisibility: "private" | "shared";
|
|
232
|
+
}
|
|
233
|
+
interface OrganizationJoinRequest {
|
|
234
|
+
_id: string;
|
|
235
|
+
workspace: {
|
|
236
|
+
_id: string;
|
|
237
|
+
name: string;
|
|
238
|
+
imageUrl?: string;
|
|
239
|
+
};
|
|
240
|
+
requester: {
|
|
241
|
+
_id: string;
|
|
242
|
+
name?: string;
|
|
243
|
+
email: string;
|
|
244
|
+
};
|
|
245
|
+
createdAt?: string;
|
|
246
|
+
}
|
|
247
|
+
/** Result of checking whether the current user's email domain already has
|
|
248
|
+
* an org claiming it via a domain invite — drives the "an organization
|
|
249
|
+
* already exists for your company" prompt in the create-organization
|
|
250
|
+
* empty state, so people don't fragment a company across duplicate orgs. */
|
|
251
|
+
interface OrganizationDomainMatch {
|
|
252
|
+
organizationId: string;
|
|
253
|
+
organizationName: string;
|
|
254
|
+
domain: string;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Mirrors `SettingsWorkspaceAdapter` conventions: `current` is embedded
|
|
258
|
+
* reactive state the host re-creates on change; lists are fetched on demand;
|
|
259
|
+
* mutations are fire-then-refetch and throw on failure.
|
|
260
|
+
*/
|
|
261
|
+
interface SettingsOrganizationAdapter {
|
|
262
|
+
current: SettingsOrganizationCurrent | null;
|
|
263
|
+
list: () => Promise<SettingsOrganizationListItem[]>;
|
|
264
|
+
create: (input: {
|
|
265
|
+
name: string;
|
|
266
|
+
imageFile?: File | null;
|
|
267
|
+
}) => Promise<{
|
|
268
|
+
id: string;
|
|
269
|
+
} | void>;
|
|
270
|
+
update: (id: string, patch: {
|
|
271
|
+
name?: string;
|
|
272
|
+
imageFile?: File | null;
|
|
273
|
+
imageUrl?: string | null;
|
|
274
|
+
}) => Promise<void>;
|
|
275
|
+
switch: (id: string) => Promise<void>;
|
|
276
|
+
delete: (id: string) => Promise<void>;
|
|
277
|
+
fetchMembers: () => Promise<OrganizationMember[]>;
|
|
278
|
+
/** Merged email + domain invites, tagged by `kind`. Drives a single
|
|
279
|
+
* combined pending-invites table (not two separate lists). */
|
|
280
|
+
fetchInvites: () => Promise<OrganizationInvite[]>;
|
|
281
|
+
inviteMemberByEmail: (input: {
|
|
282
|
+
email: string;
|
|
283
|
+
role: "admin" | "member";
|
|
284
|
+
inviteAccess: boolean;
|
|
285
|
+
}) => Promise<void>;
|
|
286
|
+
inviteDomain: (input: {
|
|
287
|
+
domain: string;
|
|
288
|
+
autoJoinRole: "admin" | "member";
|
|
289
|
+
}) => Promise<void>;
|
|
290
|
+
/** Revoke a domain invite. Only stops *future* auto-joins — does not
|
|
291
|
+
* remove members who already joined via that domain. */
|
|
292
|
+
revokeDomainInvite: (id: string) => Promise<void>;
|
|
293
|
+
cancelInvite: (token: string) => Promise<void>;
|
|
294
|
+
resendInvite: (invitationId: string) => Promise<void>;
|
|
295
|
+
removeMember: (input: {
|
|
296
|
+
userIds?: string[];
|
|
297
|
+
invitationIds?: string[];
|
|
298
|
+
}) => Promise<void>;
|
|
299
|
+
updateMemberRole: (input: {
|
|
300
|
+
userId: string;
|
|
301
|
+
role: "admin" | "member";
|
|
302
|
+
inviteAccess?: boolean;
|
|
303
|
+
}) => Promise<void>;
|
|
304
|
+
/** Optional: gates write affordances inside the Organization tab. */
|
|
305
|
+
getHighestRole?: () => Promise<{
|
|
306
|
+
role: "admin" | "member";
|
|
307
|
+
}>;
|
|
308
|
+
fetchWorkspaces: () => Promise<OrganizationWorkspaceItem[]>;
|
|
309
|
+
fetchJoinRequests: () => Promise<OrganizationJoinRequest[]>;
|
|
310
|
+
approveJoinRequest: (requestId: string) => Promise<void>;
|
|
311
|
+
rejectJoinRequest: (requestId: string) => Promise<void>;
|
|
312
|
+
/** Checks whether the current user's email domain already has an org
|
|
313
|
+
* claiming it. Called when `current` is null, before showing the
|
|
314
|
+
* "create organization" empty state. */
|
|
315
|
+
checkDomainMatch: () => Promise<OrganizationDomainMatch | null>;
|
|
316
|
+
/** Self-service join for the domain-match prompt — domain invites are
|
|
317
|
+
* auto-join by design, so this doesn't need admin approval. */
|
|
318
|
+
joinByDomain: () => Promise<void>;
|
|
158
319
|
}
|
|
159
320
|
type TokenExpiry = "30d" | "60d" | "90d" | "1y" | "never";
|
|
160
321
|
interface ApiToken {
|
|
@@ -553,6 +714,7 @@ interface SettingsImageUploadAdapter {
|
|
|
553
714
|
interface SettingsAdapters {
|
|
554
715
|
auth: SettingsAuthAdapter;
|
|
555
716
|
workspace: SettingsWorkspaceAdapter;
|
|
717
|
+
organization: SettingsOrganizationAdapter;
|
|
556
718
|
api: SettingsApiAdapter;
|
|
557
719
|
navigation: SettingsNavigationAdapter;
|
|
558
720
|
toast: SettingsToastAdapter;
|
|
@@ -602,6 +764,12 @@ declare function TeamsContent({ embedded, onInviteOpen, onInviteOpenChange, }?:
|
|
|
602
764
|
onInviteOpenChange?: (open: boolean) => void;
|
|
603
765
|
}): react_jsx_runtime.JSX.Element;
|
|
604
766
|
|
|
767
|
+
declare function OrganizationContent({ embedded, onInviteOpen, onInviteOpenChange, }?: {
|
|
768
|
+
embedded?: boolean;
|
|
769
|
+
onInviteOpen?: boolean;
|
|
770
|
+
onInviteOpenChange?: (open: boolean) => void;
|
|
771
|
+
}): react_jsx_runtime.JSX.Element;
|
|
772
|
+
|
|
605
773
|
declare function TokensContent({ embedded, showRevokedOverride, onShowRevokedChange: _onShowRevokedChange, createOpenOverride, onCreateOpenChange, }?: {
|
|
606
774
|
embedded?: boolean;
|
|
607
775
|
showRevokedOverride?: boolean;
|
|
@@ -646,6 +814,55 @@ interface WorkspaceModalProps {
|
|
|
646
814
|
}
|
|
647
815
|
declare function WorkspaceModal({ open, mode, workspace, onClose, onCreate, onUpdate, onLeave, onDelete, }: WorkspaceModalProps): react_jsx_runtime.JSX.Element | null;
|
|
648
816
|
|
|
817
|
+
interface OrganizationData {
|
|
818
|
+
id: string;
|
|
819
|
+
name: string;
|
|
820
|
+
initials: string;
|
|
821
|
+
role: string;
|
|
822
|
+
isCurrent: boolean;
|
|
823
|
+
imageUrl?: string;
|
|
824
|
+
imageName?: string;
|
|
825
|
+
}
|
|
826
|
+
interface OrganizationModalProps {
|
|
827
|
+
open: boolean;
|
|
828
|
+
mode: "create" | "update";
|
|
829
|
+
organization?: OrganizationData | null;
|
|
830
|
+
onClose: () => void;
|
|
831
|
+
onCreate?: (name: string, imageFile: File | null) => void | boolean | Promise<void | boolean>;
|
|
832
|
+
onUpdate?: (name: string, imageFile: File | null, imageRemoved: boolean) => void | boolean | Promise<void | boolean>;
|
|
833
|
+
onDelete?: () => void | boolean | Promise<void | boolean>;
|
|
834
|
+
}
|
|
835
|
+
declare function OrganizationModal({ open, mode, organization, onClose, onCreate, onUpdate, onDelete, }: OrganizationModalProps): react_jsx_runtime.JSX.Element | null;
|
|
836
|
+
|
|
837
|
+
type ModalMode$1 = "invite" | "update";
|
|
838
|
+
interface OrganizationInviteModalProps {
|
|
839
|
+
open: boolean;
|
|
840
|
+
mode: ModalMode$1;
|
|
841
|
+
/** Update mode: the target member's email (read-only display). */
|
|
842
|
+
userEmail?: string;
|
|
843
|
+
initialRole?: "admin" | "member";
|
|
844
|
+
initialInviteAccess?: boolean;
|
|
845
|
+
/** Lets a pending-invite row reopen this modal to resend without edits. */
|
|
846
|
+
allowSubmitWithoutChanges?: boolean;
|
|
847
|
+
canRemove?: boolean;
|
|
848
|
+
onClose: () => void;
|
|
849
|
+
onInviteEmail?: (input: {
|
|
850
|
+
email: string;
|
|
851
|
+
role: "admin" | "member";
|
|
852
|
+
inviteAccess: boolean;
|
|
853
|
+
}) => void;
|
|
854
|
+
onInviteDomain?: (input: {
|
|
855
|
+
domain: string;
|
|
856
|
+
autoJoinRole: "admin" | "member";
|
|
857
|
+
}) => void;
|
|
858
|
+
onUpdate?: (input: {
|
|
859
|
+
role: "admin" | "member";
|
|
860
|
+
inviteAccess: boolean;
|
|
861
|
+
}) => void;
|
|
862
|
+
onRemove?: () => void;
|
|
863
|
+
}
|
|
864
|
+
declare function OrganizationInviteModal({ open, mode, userEmail, initialRole, initialInviteAccess, allowSubmitWithoutChanges, canRemove, onClose, onInviteEmail, onInviteDomain, onUpdate, onRemove, }: OrganizationInviteModalProps): react_jsx_runtime.JSX.Element | null;
|
|
865
|
+
|
|
649
866
|
interface ConfirmLeaveModalProps {
|
|
650
867
|
open: boolean;
|
|
651
868
|
workspaceName: string;
|
|
@@ -740,4 +957,4 @@ declare function SettingsAdaptersProvider({ adapters, children, }: {
|
|
|
740
957
|
*/
|
|
741
958
|
declare function useSettingsAdapters(): SettingsAdapters;
|
|
742
959
|
|
|
743
|
-
export { type ApiToken, type AvailableCreditsResponse, BillingContent, type BillingEventPayload, type BillingProduct, type BillingSubscription, BuyCreditsModal, type BuyCreditsPayload, type BuyCreditsResponse, ConfirmDeleteModal, ConfirmLeaveModal, type CreatedToken, type CustomCreditInfo, type CustomCreditResponse, DEFAULT_PERMISSIONS, ExportDateModal, InviteUpdateModal, type InvoicePdfResponse, type MemberPermissionsPayload, type Price, type PriceMetadata, type ProductsResponse, ProfileAvatar, ProfileTab, ReferralTab, type ServiceItem, type SettingsAdapters, SettingsAdaptersProvider, type SettingsApiAdapter, type SettingsAuthAdapter, type SettingsAuthUser, SettingsContent, type SettingsContentProps, type SettingsImageUploadAdapter, type SettingsNavigationAdapter, type SettingsTab, type SettingsToastAdapter, type SettingsWorkspaceAdapter, type SettingsWorkspaceCurrent, type SettingsWorkspaceListItem, SiconKey, type StoreItem, type SubscriptionPlan, type SubscriptionResponse, TAB_LABELS, TAB_TO_URL, type TeamMember, TeamsContent, type TokenExpiry, TokensContent, URL_TO_TAB, type UpdateSubscriptionPayload, type UpdateSubscriptionResponse, type UsageHistoryItem, type UsageHistoryResponse, type UserPermissions, type WorkspaceData, type WorkspaceInvite, type WorkspaceMember, WorkspaceModal, WorkspaceTab, resolveSettingsTabFromPath, useSettingsAdapters };
|
|
960
|
+
export { type ApiToken, type AvailableCreditsResponse, BillingContent, type BillingEventPayload, type BillingProduct, type BillingSubscription, BuyCreditsModal, type BuyCreditsPayload, type BuyCreditsResponse, ConfirmDeleteModal, ConfirmLeaveModal, type CreatedToken, type CustomCreditInfo, type CustomCreditResponse, DEFAULT_PERMISSIONS, ExportDateModal, InviteUpdateModal, type InvoicePdfResponse, type MemberPermissionsPayload, OrganizationContent, type OrganizationData, type OrganizationInvite, OrganizationInviteModal, type OrganizationInviteModalProps, type OrganizationJoinRequest, type OrganizationMember, OrganizationModal, type OrganizationWorkspaceItem, type Price, type PriceMetadata, type ProductsResponse, ProfileAvatar, ProfileTab, ReferralTab, type ServiceItem, type SettingsAdapters, SettingsAdaptersProvider, type SettingsApiAdapter, type SettingsAuthAdapter, type SettingsAuthUser, SettingsContent, type SettingsContentProps, type SettingsImageUploadAdapter, type SettingsNavigationAdapter, type SettingsOrganizationAdapter, type SettingsOrganizationCurrent, type SettingsOrganizationListItem, type SettingsTab, type SettingsToastAdapter, type SettingsWorkspaceAdapter, type SettingsWorkspaceCurrent, type SettingsWorkspaceListItem, SiconKey, type StoreItem, type SubscriptionPlan, type SubscriptionResponse, TAB_LABELS, TAB_TO_URL, type TeamMember, TeamsContent, type TokenExpiry, TokensContent, URL_TO_TAB, type UpdateSubscriptionPayload, type UpdateSubscriptionResponse, type UsageHistoryItem, type UsageHistoryResponse, type UserPermissions, type WorkspaceData, type WorkspaceInvite, type WorkspaceMember, WorkspaceModal, WorkspaceTab, resolveSettingsTabFromPath, useSettingsAdapters };
|
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { SVGProps, ReactNode } from 'react';
|
|
|
9
9
|
* so consumers don't have to re-implement tab/URL conversion if they don't
|
|
10
10
|
* want to.
|
|
11
11
|
*/
|
|
12
|
-
type SettingsTab = "profile" | "workspace" | "referral" | "team" | "billing" | "apikey";
|
|
12
|
+
type SettingsTab = "profile" | "workspace" | "referral" | "team" | "organization" | "billing" | "apikey";
|
|
13
13
|
/** Internal tab id → URL slug. */
|
|
14
14
|
declare const TAB_TO_URL: Record<SettingsTab, string>;
|
|
15
15
|
/** URL slug → internal tab id. */
|
|
@@ -90,6 +90,20 @@ interface SettingsWorkspaceCurrent {
|
|
|
90
90
|
totalCredits?: number | null;
|
|
91
91
|
/** ISO country code for the workspace; drives plan currency selection. */
|
|
92
92
|
country?: string;
|
|
93
|
+
/**
|
|
94
|
+
* Organization multi-tenancy — present when the workspace has joined (or is
|
|
95
|
+
* pending to join) an org. `undefined`/absent means the workspace has no
|
|
96
|
+
* org affiliation, in which case the Workspace modal offers "Request to
|
|
97
|
+
* join organization" instead of the visibility toggle / leave action.
|
|
98
|
+
*/
|
|
99
|
+
organizationId?: string;
|
|
100
|
+
/**
|
|
101
|
+
* "private" = only members of this workspace can see it; "shared" = every
|
|
102
|
+
* member of the parent org gets implicit view-only access. Toggled from
|
|
103
|
+
* the Workspace tab; org admins always have full implicit access
|
|
104
|
+
* regardless of this flag (host-side rule, not enforced by this package).
|
|
105
|
+
*/
|
|
106
|
+
orgVisibility?: "private" | "shared";
|
|
93
107
|
}
|
|
94
108
|
interface SettingsWorkspaceListItem {
|
|
95
109
|
_id: string;
|
|
@@ -155,6 +169,153 @@ interface SettingsWorkspaceAdapter {
|
|
|
155
169
|
* to) re-running `list()`. Lets the host re-sync its own context state.
|
|
156
170
|
*/
|
|
157
171
|
refresh?: () => Promise<void>;
|
|
172
|
+
/**
|
|
173
|
+
* Request to join an org from the workspace side. Creates a pending
|
|
174
|
+
* workspace-join-request that an org admin later approves/rejects via
|
|
175
|
+
* `SettingsOrganizationAdapter.approveJoinRequest`.
|
|
176
|
+
*/
|
|
177
|
+
requestJoinOrganization?: (organizationId: string) => Promise<void>;
|
|
178
|
+
/** Leave the org this workspace currently belongs to. */
|
|
179
|
+
leaveOrganization?: () => Promise<void>;
|
|
180
|
+
/** Toggle this workspace's `orgVisibility` within its parent org. */
|
|
181
|
+
setOrgVisibility?: (visibility: "private" | "shared") => Promise<void>;
|
|
182
|
+
}
|
|
183
|
+
interface SettingsOrganizationListItem {
|
|
184
|
+
_id: string;
|
|
185
|
+
name: string;
|
|
186
|
+
imageUrl?: string;
|
|
187
|
+
role?: "admin" | "member";
|
|
188
|
+
}
|
|
189
|
+
interface SettingsOrganizationCurrent {
|
|
190
|
+
id: string;
|
|
191
|
+
name?: string;
|
|
192
|
+
imageUrl?: string;
|
|
193
|
+
role?: "admin" | "member" | string;
|
|
194
|
+
}
|
|
195
|
+
interface OrganizationMember {
|
|
196
|
+
_id: string;
|
|
197
|
+
role: "admin" | "member";
|
|
198
|
+
inviteAccess: boolean;
|
|
199
|
+
user: {
|
|
200
|
+
_id: string;
|
|
201
|
+
email: string;
|
|
202
|
+
name: string;
|
|
203
|
+
createdAt?: string;
|
|
204
|
+
};
|
|
205
|
+
createdAt?: string;
|
|
206
|
+
invitedBy?: string | {
|
|
207
|
+
email?: string;
|
|
208
|
+
name?: string;
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
/** A single row in the combined Organization invites table. */
|
|
212
|
+
interface OrganizationInvite {
|
|
213
|
+
_id: string;
|
|
214
|
+
kind: "email" | "domain";
|
|
215
|
+
email?: string;
|
|
216
|
+
domain?: string;
|
|
217
|
+
status: "active" | "revoked" | "cancelled" | "rejected" | "expired" | "completed";
|
|
218
|
+
token?: string;
|
|
219
|
+
role?: "admin" | "member";
|
|
220
|
+
autoJoinRole?: "admin" | "member";
|
|
221
|
+
invitedBy?: string | {
|
|
222
|
+
email?: string;
|
|
223
|
+
name?: string;
|
|
224
|
+
};
|
|
225
|
+
createdAt?: string;
|
|
226
|
+
}
|
|
227
|
+
interface OrganizationWorkspaceItem {
|
|
228
|
+
_id: string;
|
|
229
|
+
name: string;
|
|
230
|
+
imageUrl?: string;
|
|
231
|
+
orgVisibility: "private" | "shared";
|
|
232
|
+
}
|
|
233
|
+
interface OrganizationJoinRequest {
|
|
234
|
+
_id: string;
|
|
235
|
+
workspace: {
|
|
236
|
+
_id: string;
|
|
237
|
+
name: string;
|
|
238
|
+
imageUrl?: string;
|
|
239
|
+
};
|
|
240
|
+
requester: {
|
|
241
|
+
_id: string;
|
|
242
|
+
name?: string;
|
|
243
|
+
email: string;
|
|
244
|
+
};
|
|
245
|
+
createdAt?: string;
|
|
246
|
+
}
|
|
247
|
+
/** Result of checking whether the current user's email domain already has
|
|
248
|
+
* an org claiming it via a domain invite — drives the "an organization
|
|
249
|
+
* already exists for your company" prompt in the create-organization
|
|
250
|
+
* empty state, so people don't fragment a company across duplicate orgs. */
|
|
251
|
+
interface OrganizationDomainMatch {
|
|
252
|
+
organizationId: string;
|
|
253
|
+
organizationName: string;
|
|
254
|
+
domain: string;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Mirrors `SettingsWorkspaceAdapter` conventions: `current` is embedded
|
|
258
|
+
* reactive state the host re-creates on change; lists are fetched on demand;
|
|
259
|
+
* mutations are fire-then-refetch and throw on failure.
|
|
260
|
+
*/
|
|
261
|
+
interface SettingsOrganizationAdapter {
|
|
262
|
+
current: SettingsOrganizationCurrent | null;
|
|
263
|
+
list: () => Promise<SettingsOrganizationListItem[]>;
|
|
264
|
+
create: (input: {
|
|
265
|
+
name: string;
|
|
266
|
+
imageFile?: File | null;
|
|
267
|
+
}) => Promise<{
|
|
268
|
+
id: string;
|
|
269
|
+
} | void>;
|
|
270
|
+
update: (id: string, patch: {
|
|
271
|
+
name?: string;
|
|
272
|
+
imageFile?: File | null;
|
|
273
|
+
imageUrl?: string | null;
|
|
274
|
+
}) => Promise<void>;
|
|
275
|
+
switch: (id: string) => Promise<void>;
|
|
276
|
+
delete: (id: string) => Promise<void>;
|
|
277
|
+
fetchMembers: () => Promise<OrganizationMember[]>;
|
|
278
|
+
/** Merged email + domain invites, tagged by `kind`. Drives a single
|
|
279
|
+
* combined pending-invites table (not two separate lists). */
|
|
280
|
+
fetchInvites: () => Promise<OrganizationInvite[]>;
|
|
281
|
+
inviteMemberByEmail: (input: {
|
|
282
|
+
email: string;
|
|
283
|
+
role: "admin" | "member";
|
|
284
|
+
inviteAccess: boolean;
|
|
285
|
+
}) => Promise<void>;
|
|
286
|
+
inviteDomain: (input: {
|
|
287
|
+
domain: string;
|
|
288
|
+
autoJoinRole: "admin" | "member";
|
|
289
|
+
}) => Promise<void>;
|
|
290
|
+
/** Revoke a domain invite. Only stops *future* auto-joins — does not
|
|
291
|
+
* remove members who already joined via that domain. */
|
|
292
|
+
revokeDomainInvite: (id: string) => Promise<void>;
|
|
293
|
+
cancelInvite: (token: string) => Promise<void>;
|
|
294
|
+
resendInvite: (invitationId: string) => Promise<void>;
|
|
295
|
+
removeMember: (input: {
|
|
296
|
+
userIds?: string[];
|
|
297
|
+
invitationIds?: string[];
|
|
298
|
+
}) => Promise<void>;
|
|
299
|
+
updateMemberRole: (input: {
|
|
300
|
+
userId: string;
|
|
301
|
+
role: "admin" | "member";
|
|
302
|
+
inviteAccess?: boolean;
|
|
303
|
+
}) => Promise<void>;
|
|
304
|
+
/** Optional: gates write affordances inside the Organization tab. */
|
|
305
|
+
getHighestRole?: () => Promise<{
|
|
306
|
+
role: "admin" | "member";
|
|
307
|
+
}>;
|
|
308
|
+
fetchWorkspaces: () => Promise<OrganizationWorkspaceItem[]>;
|
|
309
|
+
fetchJoinRequests: () => Promise<OrganizationJoinRequest[]>;
|
|
310
|
+
approveJoinRequest: (requestId: string) => Promise<void>;
|
|
311
|
+
rejectJoinRequest: (requestId: string) => Promise<void>;
|
|
312
|
+
/** Checks whether the current user's email domain already has an org
|
|
313
|
+
* claiming it. Called when `current` is null, before showing the
|
|
314
|
+
* "create organization" empty state. */
|
|
315
|
+
checkDomainMatch: () => Promise<OrganizationDomainMatch | null>;
|
|
316
|
+
/** Self-service join for the domain-match prompt — domain invites are
|
|
317
|
+
* auto-join by design, so this doesn't need admin approval. */
|
|
318
|
+
joinByDomain: () => Promise<void>;
|
|
158
319
|
}
|
|
159
320
|
type TokenExpiry = "30d" | "60d" | "90d" | "1y" | "never";
|
|
160
321
|
interface ApiToken {
|
|
@@ -553,6 +714,7 @@ interface SettingsImageUploadAdapter {
|
|
|
553
714
|
interface SettingsAdapters {
|
|
554
715
|
auth: SettingsAuthAdapter;
|
|
555
716
|
workspace: SettingsWorkspaceAdapter;
|
|
717
|
+
organization: SettingsOrganizationAdapter;
|
|
556
718
|
api: SettingsApiAdapter;
|
|
557
719
|
navigation: SettingsNavigationAdapter;
|
|
558
720
|
toast: SettingsToastAdapter;
|
|
@@ -602,6 +764,12 @@ declare function TeamsContent({ embedded, onInviteOpen, onInviteOpenChange, }?:
|
|
|
602
764
|
onInviteOpenChange?: (open: boolean) => void;
|
|
603
765
|
}): react_jsx_runtime.JSX.Element;
|
|
604
766
|
|
|
767
|
+
declare function OrganizationContent({ embedded, onInviteOpen, onInviteOpenChange, }?: {
|
|
768
|
+
embedded?: boolean;
|
|
769
|
+
onInviteOpen?: boolean;
|
|
770
|
+
onInviteOpenChange?: (open: boolean) => void;
|
|
771
|
+
}): react_jsx_runtime.JSX.Element;
|
|
772
|
+
|
|
605
773
|
declare function TokensContent({ embedded, showRevokedOverride, onShowRevokedChange: _onShowRevokedChange, createOpenOverride, onCreateOpenChange, }?: {
|
|
606
774
|
embedded?: boolean;
|
|
607
775
|
showRevokedOverride?: boolean;
|
|
@@ -646,6 +814,55 @@ interface WorkspaceModalProps {
|
|
|
646
814
|
}
|
|
647
815
|
declare function WorkspaceModal({ open, mode, workspace, onClose, onCreate, onUpdate, onLeave, onDelete, }: WorkspaceModalProps): react_jsx_runtime.JSX.Element | null;
|
|
648
816
|
|
|
817
|
+
interface OrganizationData {
|
|
818
|
+
id: string;
|
|
819
|
+
name: string;
|
|
820
|
+
initials: string;
|
|
821
|
+
role: string;
|
|
822
|
+
isCurrent: boolean;
|
|
823
|
+
imageUrl?: string;
|
|
824
|
+
imageName?: string;
|
|
825
|
+
}
|
|
826
|
+
interface OrganizationModalProps {
|
|
827
|
+
open: boolean;
|
|
828
|
+
mode: "create" | "update";
|
|
829
|
+
organization?: OrganizationData | null;
|
|
830
|
+
onClose: () => void;
|
|
831
|
+
onCreate?: (name: string, imageFile: File | null) => void | boolean | Promise<void | boolean>;
|
|
832
|
+
onUpdate?: (name: string, imageFile: File | null, imageRemoved: boolean) => void | boolean | Promise<void | boolean>;
|
|
833
|
+
onDelete?: () => void | boolean | Promise<void | boolean>;
|
|
834
|
+
}
|
|
835
|
+
declare function OrganizationModal({ open, mode, organization, onClose, onCreate, onUpdate, onDelete, }: OrganizationModalProps): react_jsx_runtime.JSX.Element | null;
|
|
836
|
+
|
|
837
|
+
type ModalMode$1 = "invite" | "update";
|
|
838
|
+
interface OrganizationInviteModalProps {
|
|
839
|
+
open: boolean;
|
|
840
|
+
mode: ModalMode$1;
|
|
841
|
+
/** Update mode: the target member's email (read-only display). */
|
|
842
|
+
userEmail?: string;
|
|
843
|
+
initialRole?: "admin" | "member";
|
|
844
|
+
initialInviteAccess?: boolean;
|
|
845
|
+
/** Lets a pending-invite row reopen this modal to resend without edits. */
|
|
846
|
+
allowSubmitWithoutChanges?: boolean;
|
|
847
|
+
canRemove?: boolean;
|
|
848
|
+
onClose: () => void;
|
|
849
|
+
onInviteEmail?: (input: {
|
|
850
|
+
email: string;
|
|
851
|
+
role: "admin" | "member";
|
|
852
|
+
inviteAccess: boolean;
|
|
853
|
+
}) => void;
|
|
854
|
+
onInviteDomain?: (input: {
|
|
855
|
+
domain: string;
|
|
856
|
+
autoJoinRole: "admin" | "member";
|
|
857
|
+
}) => void;
|
|
858
|
+
onUpdate?: (input: {
|
|
859
|
+
role: "admin" | "member";
|
|
860
|
+
inviteAccess: boolean;
|
|
861
|
+
}) => void;
|
|
862
|
+
onRemove?: () => void;
|
|
863
|
+
}
|
|
864
|
+
declare function OrganizationInviteModal({ open, mode, userEmail, initialRole, initialInviteAccess, allowSubmitWithoutChanges, canRemove, onClose, onInviteEmail, onInviteDomain, onUpdate, onRemove, }: OrganizationInviteModalProps): react_jsx_runtime.JSX.Element | null;
|
|
865
|
+
|
|
649
866
|
interface ConfirmLeaveModalProps {
|
|
650
867
|
open: boolean;
|
|
651
868
|
workspaceName: string;
|
|
@@ -740,4 +957,4 @@ declare function SettingsAdaptersProvider({ adapters, children, }: {
|
|
|
740
957
|
*/
|
|
741
958
|
declare function useSettingsAdapters(): SettingsAdapters;
|
|
742
959
|
|
|
743
|
-
export { type ApiToken, type AvailableCreditsResponse, BillingContent, type BillingEventPayload, type BillingProduct, type BillingSubscription, BuyCreditsModal, type BuyCreditsPayload, type BuyCreditsResponse, ConfirmDeleteModal, ConfirmLeaveModal, type CreatedToken, type CustomCreditInfo, type CustomCreditResponse, DEFAULT_PERMISSIONS, ExportDateModal, InviteUpdateModal, type InvoicePdfResponse, type MemberPermissionsPayload, type Price, type PriceMetadata, type ProductsResponse, ProfileAvatar, ProfileTab, ReferralTab, type ServiceItem, type SettingsAdapters, SettingsAdaptersProvider, type SettingsApiAdapter, type SettingsAuthAdapter, type SettingsAuthUser, SettingsContent, type SettingsContentProps, type SettingsImageUploadAdapter, type SettingsNavigationAdapter, type SettingsTab, type SettingsToastAdapter, type SettingsWorkspaceAdapter, type SettingsWorkspaceCurrent, type SettingsWorkspaceListItem, SiconKey, type StoreItem, type SubscriptionPlan, type SubscriptionResponse, TAB_LABELS, TAB_TO_URL, type TeamMember, TeamsContent, type TokenExpiry, TokensContent, URL_TO_TAB, type UpdateSubscriptionPayload, type UpdateSubscriptionResponse, type UsageHistoryItem, type UsageHistoryResponse, type UserPermissions, type WorkspaceData, type WorkspaceInvite, type WorkspaceMember, WorkspaceModal, WorkspaceTab, resolveSettingsTabFromPath, useSettingsAdapters };
|
|
960
|
+
export { type ApiToken, type AvailableCreditsResponse, BillingContent, type BillingEventPayload, type BillingProduct, type BillingSubscription, BuyCreditsModal, type BuyCreditsPayload, type BuyCreditsResponse, ConfirmDeleteModal, ConfirmLeaveModal, type CreatedToken, type CustomCreditInfo, type CustomCreditResponse, DEFAULT_PERMISSIONS, ExportDateModal, InviteUpdateModal, type InvoicePdfResponse, type MemberPermissionsPayload, OrganizationContent, type OrganizationData, type OrganizationInvite, OrganizationInviteModal, type OrganizationInviteModalProps, type OrganizationJoinRequest, type OrganizationMember, OrganizationModal, type OrganizationWorkspaceItem, type Price, type PriceMetadata, type ProductsResponse, ProfileAvatar, ProfileTab, ReferralTab, type ServiceItem, type SettingsAdapters, SettingsAdaptersProvider, type SettingsApiAdapter, type SettingsAuthAdapter, type SettingsAuthUser, SettingsContent, type SettingsContentProps, type SettingsImageUploadAdapter, type SettingsNavigationAdapter, type SettingsOrganizationAdapter, type SettingsOrganizationCurrent, type SettingsOrganizationListItem, type SettingsTab, type SettingsToastAdapter, type SettingsWorkspaceAdapter, type SettingsWorkspaceCurrent, type SettingsWorkspaceListItem, SiconKey, type StoreItem, type SubscriptionPlan, type SubscriptionResponse, TAB_LABELS, TAB_TO_URL, type TeamMember, TeamsContent, type TokenExpiry, TokensContent, URL_TO_TAB, type UpdateSubscriptionPayload, type UpdateSubscriptionResponse, type UsageHistoryItem, type UsageHistoryResponse, type UserPermissions, type WorkspaceData, type WorkspaceInvite, type WorkspaceMember, WorkspaceModal, WorkspaceTab, resolveSettingsTabFromPath, useSettingsAdapters };
|