@streamoid/settings 0.7.4 → 0.7.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 +22 -1
- package/dist/index.d.ts +22 -1
- package/dist/index.js +50 -4
- package/dist/index.mjs +50 -4
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -365,6 +365,18 @@ interface OrganizationWorkspaceItem {
|
|
|
365
365
|
name: string;
|
|
366
366
|
imageUrl?: string;
|
|
367
367
|
orgVisibility: "private" | "shared";
|
|
368
|
+
/** Whether the viewer is in it. An org member is shown every shared
|
|
369
|
+
* workspace; the ones with `joined: false` get a Join button (with
|
|
370
|
+
* `joinWorkspaces`). Absent is treated as joined. */
|
|
371
|
+
joined?: boolean;
|
|
372
|
+
}
|
|
373
|
+
/** A shared workspace in the organization that the viewer isn't in yet. */
|
|
374
|
+
interface OrganizationJoinableWorkspace {
|
|
375
|
+
_id: string;
|
|
376
|
+
name: string;
|
|
377
|
+
imageUrl?: string;
|
|
378
|
+
/** Who created it, shown under the name. */
|
|
379
|
+
ownerName?: string;
|
|
368
380
|
}
|
|
369
381
|
interface OrganizationJoinRequest {
|
|
370
382
|
_id: string;
|
|
@@ -455,6 +467,15 @@ interface SettingsOrganizationAdapter {
|
|
|
455
467
|
canClaimEmailDomain?: boolean;
|
|
456
468
|
}>;
|
|
457
469
|
fetchWorkspaces: () => Promise<OrganizationWorkspaceItem[]>;
|
|
470
|
+
/**
|
|
471
|
+
* @deprecated Since 0.7.6 never called: `fetchWorkspaces()` lists every
|
|
472
|
+
* shared workspace for an org member, flagged with `joined`.
|
|
473
|
+
*/
|
|
474
|
+
fetchJoinableWorkspaces?: () => Promise<OrganizationJoinableWorkspace[]>;
|
|
475
|
+
/** Optional: join workspaces as a member. Resolves to the ids joined. With
|
|
476
|
+
* it, an org member gets a Join button on each shared workspace listed
|
|
477
|
+
* under Organization › Workspaces with `joined: false`. */
|
|
478
|
+
joinWorkspaces?: (workspaceIds: string[]) => Promise<string[]>;
|
|
458
479
|
fetchJoinRequests: () => Promise<OrganizationJoinRequest[]>;
|
|
459
480
|
approveJoinRequest: (requestId: string) => Promise<void>;
|
|
460
481
|
rejectJoinRequest: (requestId: string) => Promise<void>;
|
|
@@ -1468,4 +1489,4 @@ declare function SettingsAdaptersProvider({ adapters, children, }: {
|
|
|
1468
1489
|
*/
|
|
1469
1490
|
declare function useSettingsAdapters(): SettingsAdapters;
|
|
1470
1491
|
|
|
1471
|
-
export { APP_KEYS, type ApiToken, type AppKey, type AvailableCreditsResponse, BillingContent, type BillingEventPayload, type BillingProduct, type BillingSubscription, BuyCreditsModal, type BuyCreditsPayload, type BuyCreditsResponse, ConfirmDeleteModal, ConfirmLeaveModal, type CreatedToken, type CustomCreditInfo, type CustomCreditResponse, DEFAULT_PERMISSIONS, DEFAULT_USER_LANGUAGE, ExportDateModal, InviteUpdateModal, type InvoicePdfResponse, MemberListFrame, type MemberListFrameProps, type MemberListTab, MemberListToolbar, type MemberListToolbarProps, type MemberPermissionsPayload, OrganizationContent, type OrganizationData, type OrganizationInvite, type OrganizationJoinRequest, type OrganizationMember, OrganizationMemberModal, type OrganizationMemberModalProps, OrganizationModal, type OrganizationView, type OrganizationWorkspaceItem, type Price, type PriceMetadata, type ProductsResponse, ProfileAvatar, ProfileTab, ReferralTab, SCOPE_LABELS, ScopeHeader, type ScopeHeaderProps, 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 SettingsScope, type SettingsTab, type SettingsToastAdapter, SettingsTooltip, type SettingsTooltipPlacement, type SettingsTooltipProps, type SettingsWorkspaceAdapter, type SettingsWorkspaceCurrent, type SettingsWorkspaceListItem, SiconKey, type StoreItem, type SubscriptionPlan, type SubscriptionResponse, TAB_DESCRIPTIONS, TAB_LABELS, TAB_SCOPE, TAB_TO_URL, type TeamMember, TeamsContent, type TokenExpiry, TokensContent, URL_TO_TAB, USER_LANGUAGES, type UpdateSubscriptionPayload, type UpdateSubscriptionResponse, type UsageHistoryItem, type UsageHistoryResponse, type UserLanguage, type UserPermissions, WORKSPACE_LIST_PAGE_SIZE, type WorkspaceData, WorkspaceGeneralTab, type WorkspaceGeneralTabProps, type WorkspaceInvite, type WorkspaceListOrganization, WorkspaceListTab, type WorkspaceMember, WorkspaceModal, type WorkspaceOrganization, type WorkspaceOrganizationRequest, WorkspacePicker, type WorkspacePickerItem, type WorkspacePickerProps, WorkspaceTab, type WorkspaceUsageResponse, countLabel, groupWorkspaceList, loadWorkspaceOrganization, resolveSettingsTabFromPath, useSettingsAdapters, useWorkspaceOrganization, userLanguageLabel };
|
|
1492
|
+
export { APP_KEYS, type ApiToken, type AppKey, type AvailableCreditsResponse, BillingContent, type BillingEventPayload, type BillingProduct, type BillingSubscription, BuyCreditsModal, type BuyCreditsPayload, type BuyCreditsResponse, ConfirmDeleteModal, ConfirmLeaveModal, type CreatedToken, type CustomCreditInfo, type CustomCreditResponse, DEFAULT_PERMISSIONS, DEFAULT_USER_LANGUAGE, ExportDateModal, InviteUpdateModal, type InvoicePdfResponse, MemberListFrame, type MemberListFrameProps, type MemberListTab, MemberListToolbar, type MemberListToolbarProps, type MemberPermissionsPayload, OrganizationContent, type OrganizationData, type OrganizationInvite, type OrganizationJoinRequest, type OrganizationJoinableWorkspace, type OrganizationMember, OrganizationMemberModal, type OrganizationMemberModalProps, OrganizationModal, type OrganizationView, type OrganizationWorkspaceItem, type Price, type PriceMetadata, type ProductsResponse, ProfileAvatar, ProfileTab, ReferralTab, SCOPE_LABELS, ScopeHeader, type ScopeHeaderProps, 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 SettingsScope, type SettingsTab, type SettingsToastAdapter, SettingsTooltip, type SettingsTooltipPlacement, type SettingsTooltipProps, type SettingsWorkspaceAdapter, type SettingsWorkspaceCurrent, type SettingsWorkspaceListItem, SiconKey, type StoreItem, type SubscriptionPlan, type SubscriptionResponse, TAB_DESCRIPTIONS, TAB_LABELS, TAB_SCOPE, TAB_TO_URL, type TeamMember, TeamsContent, type TokenExpiry, TokensContent, URL_TO_TAB, USER_LANGUAGES, type UpdateSubscriptionPayload, type UpdateSubscriptionResponse, type UsageHistoryItem, type UsageHistoryResponse, type UserLanguage, type UserPermissions, WORKSPACE_LIST_PAGE_SIZE, type WorkspaceData, WorkspaceGeneralTab, type WorkspaceGeneralTabProps, type WorkspaceInvite, type WorkspaceListOrganization, WorkspaceListTab, type WorkspaceMember, WorkspaceModal, type WorkspaceOrganization, type WorkspaceOrganizationRequest, WorkspacePicker, type WorkspacePickerItem, type WorkspacePickerProps, WorkspaceTab, type WorkspaceUsageResponse, countLabel, groupWorkspaceList, loadWorkspaceOrganization, resolveSettingsTabFromPath, useSettingsAdapters, useWorkspaceOrganization, userLanguageLabel };
|
package/dist/index.d.ts
CHANGED
|
@@ -365,6 +365,18 @@ interface OrganizationWorkspaceItem {
|
|
|
365
365
|
name: string;
|
|
366
366
|
imageUrl?: string;
|
|
367
367
|
orgVisibility: "private" | "shared";
|
|
368
|
+
/** Whether the viewer is in it. An org member is shown every shared
|
|
369
|
+
* workspace; the ones with `joined: false` get a Join button (with
|
|
370
|
+
* `joinWorkspaces`). Absent is treated as joined. */
|
|
371
|
+
joined?: boolean;
|
|
372
|
+
}
|
|
373
|
+
/** A shared workspace in the organization that the viewer isn't in yet. */
|
|
374
|
+
interface OrganizationJoinableWorkspace {
|
|
375
|
+
_id: string;
|
|
376
|
+
name: string;
|
|
377
|
+
imageUrl?: string;
|
|
378
|
+
/** Who created it, shown under the name. */
|
|
379
|
+
ownerName?: string;
|
|
368
380
|
}
|
|
369
381
|
interface OrganizationJoinRequest {
|
|
370
382
|
_id: string;
|
|
@@ -455,6 +467,15 @@ interface SettingsOrganizationAdapter {
|
|
|
455
467
|
canClaimEmailDomain?: boolean;
|
|
456
468
|
}>;
|
|
457
469
|
fetchWorkspaces: () => Promise<OrganizationWorkspaceItem[]>;
|
|
470
|
+
/**
|
|
471
|
+
* @deprecated Since 0.7.6 never called: `fetchWorkspaces()` lists every
|
|
472
|
+
* shared workspace for an org member, flagged with `joined`.
|
|
473
|
+
*/
|
|
474
|
+
fetchJoinableWorkspaces?: () => Promise<OrganizationJoinableWorkspace[]>;
|
|
475
|
+
/** Optional: join workspaces as a member. Resolves to the ids joined. With
|
|
476
|
+
* it, an org member gets a Join button on each shared workspace listed
|
|
477
|
+
* under Organization › Workspaces with `joined: false`. */
|
|
478
|
+
joinWorkspaces?: (workspaceIds: string[]) => Promise<string[]>;
|
|
458
479
|
fetchJoinRequests: () => Promise<OrganizationJoinRequest[]>;
|
|
459
480
|
approveJoinRequest: (requestId: string) => Promise<void>;
|
|
460
481
|
rejectJoinRequest: (requestId: string) => Promise<void>;
|
|
@@ -1468,4 +1489,4 @@ declare function SettingsAdaptersProvider({ adapters, children, }: {
|
|
|
1468
1489
|
*/
|
|
1469
1490
|
declare function useSettingsAdapters(): SettingsAdapters;
|
|
1470
1491
|
|
|
1471
|
-
export { APP_KEYS, type ApiToken, type AppKey, type AvailableCreditsResponse, BillingContent, type BillingEventPayload, type BillingProduct, type BillingSubscription, BuyCreditsModal, type BuyCreditsPayload, type BuyCreditsResponse, ConfirmDeleteModal, ConfirmLeaveModal, type CreatedToken, type CustomCreditInfo, type CustomCreditResponse, DEFAULT_PERMISSIONS, DEFAULT_USER_LANGUAGE, ExportDateModal, InviteUpdateModal, type InvoicePdfResponse, MemberListFrame, type MemberListFrameProps, type MemberListTab, MemberListToolbar, type MemberListToolbarProps, type MemberPermissionsPayload, OrganizationContent, type OrganizationData, type OrganizationInvite, type OrganizationJoinRequest, type OrganizationMember, OrganizationMemberModal, type OrganizationMemberModalProps, OrganizationModal, type OrganizationView, type OrganizationWorkspaceItem, type Price, type PriceMetadata, type ProductsResponse, ProfileAvatar, ProfileTab, ReferralTab, SCOPE_LABELS, ScopeHeader, type ScopeHeaderProps, 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 SettingsScope, type SettingsTab, type SettingsToastAdapter, SettingsTooltip, type SettingsTooltipPlacement, type SettingsTooltipProps, type SettingsWorkspaceAdapter, type SettingsWorkspaceCurrent, type SettingsWorkspaceListItem, SiconKey, type StoreItem, type SubscriptionPlan, type SubscriptionResponse, TAB_DESCRIPTIONS, TAB_LABELS, TAB_SCOPE, TAB_TO_URL, type TeamMember, TeamsContent, type TokenExpiry, TokensContent, URL_TO_TAB, USER_LANGUAGES, type UpdateSubscriptionPayload, type UpdateSubscriptionResponse, type UsageHistoryItem, type UsageHistoryResponse, type UserLanguage, type UserPermissions, WORKSPACE_LIST_PAGE_SIZE, type WorkspaceData, WorkspaceGeneralTab, type WorkspaceGeneralTabProps, type WorkspaceInvite, type WorkspaceListOrganization, WorkspaceListTab, type WorkspaceMember, WorkspaceModal, type WorkspaceOrganization, type WorkspaceOrganizationRequest, WorkspacePicker, type WorkspacePickerItem, type WorkspacePickerProps, WorkspaceTab, type WorkspaceUsageResponse, countLabel, groupWorkspaceList, loadWorkspaceOrganization, resolveSettingsTabFromPath, useSettingsAdapters, useWorkspaceOrganization, userLanguageLabel };
|
|
1492
|
+
export { APP_KEYS, type ApiToken, type AppKey, type AvailableCreditsResponse, BillingContent, type BillingEventPayload, type BillingProduct, type BillingSubscription, BuyCreditsModal, type BuyCreditsPayload, type BuyCreditsResponse, ConfirmDeleteModal, ConfirmLeaveModal, type CreatedToken, type CustomCreditInfo, type CustomCreditResponse, DEFAULT_PERMISSIONS, DEFAULT_USER_LANGUAGE, ExportDateModal, InviteUpdateModal, type InvoicePdfResponse, MemberListFrame, type MemberListFrameProps, type MemberListTab, MemberListToolbar, type MemberListToolbarProps, type MemberPermissionsPayload, OrganizationContent, type OrganizationData, type OrganizationInvite, type OrganizationJoinRequest, type OrganizationJoinableWorkspace, type OrganizationMember, OrganizationMemberModal, type OrganizationMemberModalProps, OrganizationModal, type OrganizationView, type OrganizationWorkspaceItem, type Price, type PriceMetadata, type ProductsResponse, ProfileAvatar, ProfileTab, ReferralTab, SCOPE_LABELS, ScopeHeader, type ScopeHeaderProps, 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 SettingsScope, type SettingsTab, type SettingsToastAdapter, SettingsTooltip, type SettingsTooltipPlacement, type SettingsTooltipProps, type SettingsWorkspaceAdapter, type SettingsWorkspaceCurrent, type SettingsWorkspaceListItem, SiconKey, type StoreItem, type SubscriptionPlan, type SubscriptionResponse, TAB_DESCRIPTIONS, TAB_LABELS, TAB_SCOPE, TAB_TO_URL, type TeamMember, TeamsContent, type TokenExpiry, TokensContent, URL_TO_TAB, USER_LANGUAGES, type UpdateSubscriptionPayload, type UpdateSubscriptionResponse, type UsageHistoryItem, type UsageHistoryResponse, type UserLanguage, type UserPermissions, WORKSPACE_LIST_PAGE_SIZE, type WorkspaceData, WorkspaceGeneralTab, type WorkspaceGeneralTabProps, type WorkspaceInvite, type WorkspaceListOrganization, WorkspaceListTab, type WorkspaceMember, WorkspaceModal, type WorkspaceOrganization, type WorkspaceOrganizationRequest, WorkspacePicker, type WorkspacePickerItem, type WorkspacePickerProps, WorkspaceTab, type WorkspaceUsageResponse, countLabel, groupWorkspaceList, loadWorkspaceOrganization, resolveSettingsTabFromPath, useSettingsAdapters, useWorkspaceOrganization, userLanguageLabel };
|
package/dist/index.js
CHANGED
|
@@ -6133,7 +6133,11 @@ function MemberRow({
|
|
|
6133
6133
|
}
|
|
6134
6134
|
);
|
|
6135
6135
|
}
|
|
6136
|
-
function WorkspaceRow({
|
|
6136
|
+
function WorkspaceRow({
|
|
6137
|
+
workspace,
|
|
6138
|
+
joining = false,
|
|
6139
|
+
onJoin
|
|
6140
|
+
}) {
|
|
6137
6141
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
6138
6142
|
"div",
|
|
6139
6143
|
{
|
|
@@ -6169,7 +6173,19 @@ function WorkspaceRow({ workspace }) {
|
|
|
6169
6173
|
}
|
|
6170
6174
|
)
|
|
6171
6175
|
] }),
|
|
6172
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.
|
|
6176
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center shrink-0", style: { gap: T11.spMd }, children: [
|
|
6177
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(VisibilityBadge, { visibility: workspace.orgVisibility }),
|
|
6178
|
+
onJoin && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6179
|
+
import_ui8.ScButton,
|
|
6180
|
+
{
|
|
6181
|
+
text: joining ? "Joining\u2026" : "Join",
|
|
6182
|
+
variant: "secondary",
|
|
6183
|
+
size: "sm",
|
|
6184
|
+
state: joining ? "disabled" : "default",
|
|
6185
|
+
onClick: joining ? void 0 : onJoin
|
|
6186
|
+
}
|
|
6187
|
+
)
|
|
6188
|
+
] })
|
|
6173
6189
|
]
|
|
6174
6190
|
}
|
|
6175
6191
|
);
|
|
@@ -6293,10 +6309,12 @@ function OrganizationContent({
|
|
|
6293
6309
|
embedded = false,
|
|
6294
6310
|
view = "people"
|
|
6295
6311
|
} = {}) {
|
|
6296
|
-
const { organization, toast } = useSettingsAdapters();
|
|
6312
|
+
const { organization, workspace: workspaceAdapter, toast } = useSettingsAdapters();
|
|
6297
6313
|
const current = organization.current;
|
|
6298
6314
|
const [members, setMembers] = (0, import_react12.useState)([]);
|
|
6299
6315
|
const [workspaces, setWorkspaces] = (0, import_react12.useState)([]);
|
|
6316
|
+
const canJoinShared = current?.role === "member" && !!organization.joinWorkspaces;
|
|
6317
|
+
const [joiningId, setJoiningId] = (0, import_react12.useState)(null);
|
|
6300
6318
|
const [joinRequests, setJoinRequests] = (0, import_react12.useState)([]);
|
|
6301
6319
|
const [highestRole, setHighestRole] = (0, import_react12.useState)("guest");
|
|
6302
6320
|
const [searchQuery, setSearchQuery] = (0, import_react12.useState)("");
|
|
@@ -6324,6 +6342,26 @@ function OrganizationContent({
|
|
|
6324
6342
|
(0, import_react12.useEffect)(() => {
|
|
6325
6343
|
fetchData();
|
|
6326
6344
|
}, [fetchData]);
|
|
6345
|
+
const handleJoinWorkspace = async (target) => {
|
|
6346
|
+
if (!organization.joinWorkspaces) return;
|
|
6347
|
+
setJoiningId(target._id);
|
|
6348
|
+
try {
|
|
6349
|
+
const joined = await organization.joinWorkspaces([target._id]);
|
|
6350
|
+
if (!joined.includes(target._id)) {
|
|
6351
|
+
toast.error(`Couldn't join ${target.name}. Try again.`);
|
|
6352
|
+
return;
|
|
6353
|
+
}
|
|
6354
|
+
toast.success(`Joined ${target.name}`);
|
|
6355
|
+
await workspaceAdapter.refresh?.().catch(() => void 0);
|
|
6356
|
+
await fetchData();
|
|
6357
|
+
} catch (err) {
|
|
6358
|
+
toast.error(
|
|
6359
|
+
err instanceof Error ? err.message : `Couldn't join ${target.name}`
|
|
6360
|
+
);
|
|
6361
|
+
} finally {
|
|
6362
|
+
setJoiningId(null);
|
|
6363
|
+
}
|
|
6364
|
+
};
|
|
6327
6365
|
const [manageModalOpen, setManageModalOpen] = (0, import_react12.useState)(false);
|
|
6328
6366
|
const handleUpdateOrganization = async (name, imageFile) => {
|
|
6329
6367
|
if (!current) return false;
|
|
@@ -6549,7 +6587,15 @@ function OrganizationContent({
|
|
|
6549
6587
|
{
|
|
6550
6588
|
title: "Workspaces in this organization",
|
|
6551
6589
|
empty: workspaces.length === 0,
|
|
6552
|
-
children: workspaces.map((ws) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6590
|
+
children: workspaces.map((ws) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6591
|
+
WorkspaceRow,
|
|
6592
|
+
{
|
|
6593
|
+
workspace: ws,
|
|
6594
|
+
joining: joiningId === ws._id,
|
|
6595
|
+
onJoin: canJoinShared && ws.joined === false && ws.orgVisibility === "shared" ? () => void handleJoinWorkspace(ws) : void 0
|
|
6596
|
+
},
|
|
6597
|
+
ws._id
|
|
6598
|
+
))
|
|
6553
6599
|
}
|
|
6554
6600
|
),
|
|
6555
6601
|
(isOrgAdmin || joinRequests.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
package/dist/index.mjs
CHANGED
|
@@ -6110,7 +6110,11 @@ function MemberRow({
|
|
|
6110
6110
|
}
|
|
6111
6111
|
);
|
|
6112
6112
|
}
|
|
6113
|
-
function WorkspaceRow({
|
|
6113
|
+
function WorkspaceRow({
|
|
6114
|
+
workspace,
|
|
6115
|
+
joining = false,
|
|
6116
|
+
onJoin
|
|
6117
|
+
}) {
|
|
6114
6118
|
return /* @__PURE__ */ jsxs14(
|
|
6115
6119
|
"div",
|
|
6116
6120
|
{
|
|
@@ -6146,7 +6150,19 @@ function WorkspaceRow({ workspace }) {
|
|
|
6146
6150
|
}
|
|
6147
6151
|
)
|
|
6148
6152
|
] }),
|
|
6149
|
-
/* @__PURE__ */
|
|
6153
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex items-center shrink-0", style: { gap: T11.spMd }, children: [
|
|
6154
|
+
/* @__PURE__ */ jsx17(VisibilityBadge, { visibility: workspace.orgVisibility }),
|
|
6155
|
+
onJoin && /* @__PURE__ */ jsx17(
|
|
6156
|
+
ScButton5,
|
|
6157
|
+
{
|
|
6158
|
+
text: joining ? "Joining\u2026" : "Join",
|
|
6159
|
+
variant: "secondary",
|
|
6160
|
+
size: "sm",
|
|
6161
|
+
state: joining ? "disabled" : "default",
|
|
6162
|
+
onClick: joining ? void 0 : onJoin
|
|
6163
|
+
}
|
|
6164
|
+
)
|
|
6165
|
+
] })
|
|
6150
6166
|
]
|
|
6151
6167
|
}
|
|
6152
6168
|
);
|
|
@@ -6270,10 +6286,12 @@ function OrganizationContent({
|
|
|
6270
6286
|
embedded = false,
|
|
6271
6287
|
view = "people"
|
|
6272
6288
|
} = {}) {
|
|
6273
|
-
const { organization, toast } = useSettingsAdapters();
|
|
6289
|
+
const { organization, workspace: workspaceAdapter, toast } = useSettingsAdapters();
|
|
6274
6290
|
const current = organization.current;
|
|
6275
6291
|
const [members, setMembers] = useState10([]);
|
|
6276
6292
|
const [workspaces, setWorkspaces] = useState10([]);
|
|
6293
|
+
const canJoinShared = current?.role === "member" && !!organization.joinWorkspaces;
|
|
6294
|
+
const [joiningId, setJoiningId] = useState10(null);
|
|
6277
6295
|
const [joinRequests, setJoinRequests] = useState10([]);
|
|
6278
6296
|
const [highestRole, setHighestRole] = useState10("guest");
|
|
6279
6297
|
const [searchQuery, setSearchQuery] = useState10("");
|
|
@@ -6301,6 +6319,26 @@ function OrganizationContent({
|
|
|
6301
6319
|
useEffect10(() => {
|
|
6302
6320
|
fetchData();
|
|
6303
6321
|
}, [fetchData]);
|
|
6322
|
+
const handleJoinWorkspace = async (target) => {
|
|
6323
|
+
if (!organization.joinWorkspaces) return;
|
|
6324
|
+
setJoiningId(target._id);
|
|
6325
|
+
try {
|
|
6326
|
+
const joined = await organization.joinWorkspaces([target._id]);
|
|
6327
|
+
if (!joined.includes(target._id)) {
|
|
6328
|
+
toast.error(`Couldn't join ${target.name}. Try again.`);
|
|
6329
|
+
return;
|
|
6330
|
+
}
|
|
6331
|
+
toast.success(`Joined ${target.name}`);
|
|
6332
|
+
await workspaceAdapter.refresh?.().catch(() => void 0);
|
|
6333
|
+
await fetchData();
|
|
6334
|
+
} catch (err) {
|
|
6335
|
+
toast.error(
|
|
6336
|
+
err instanceof Error ? err.message : `Couldn't join ${target.name}`
|
|
6337
|
+
);
|
|
6338
|
+
} finally {
|
|
6339
|
+
setJoiningId(null);
|
|
6340
|
+
}
|
|
6341
|
+
};
|
|
6304
6342
|
const [manageModalOpen, setManageModalOpen] = useState10(false);
|
|
6305
6343
|
const handleUpdateOrganization = async (name, imageFile) => {
|
|
6306
6344
|
if (!current) return false;
|
|
@@ -6526,7 +6564,15 @@ function OrganizationContent({
|
|
|
6526
6564
|
{
|
|
6527
6565
|
title: "Workspaces in this organization",
|
|
6528
6566
|
empty: workspaces.length === 0,
|
|
6529
|
-
children: workspaces.map((ws) => /* @__PURE__ */ jsx17(
|
|
6567
|
+
children: workspaces.map((ws) => /* @__PURE__ */ jsx17(
|
|
6568
|
+
WorkspaceRow,
|
|
6569
|
+
{
|
|
6570
|
+
workspace: ws,
|
|
6571
|
+
joining: joiningId === ws._id,
|
|
6572
|
+
onJoin: canJoinShared && ws.joined === false && ws.orgVisibility === "shared" ? () => void handleJoinWorkspace(ws) : void 0
|
|
6573
|
+
},
|
|
6574
|
+
ws._id
|
|
6575
|
+
))
|
|
6530
6576
|
}
|
|
6531
6577
|
),
|
|
6532
6578
|
(isOrgAdmin || joinRequests.length > 0) && /* @__PURE__ */ jsx17(
|