@streamoid/settings 0.4.7 → 0.6.0
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 +115 -10
- package/dist/index.d.ts +115 -10
- package/dist/index.js +202 -43
- package/dist/index.mjs +202 -43
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1599,7 +1599,7 @@ function ScopeHeader({
|
|
|
1599
1599
|
}) {
|
|
1600
1600
|
const displayName = name?.trim() || (kind === "workspace" ? "Workspace" : "Organization");
|
|
1601
1601
|
const ScopeIcon = kind === "workspace" ? import_icons.SiconWorkspace : import_icons.SiconGlobe;
|
|
1602
|
-
const roleLabel = role === "admin" ? "You're an admin" : role ? "You're a member" : null;
|
|
1602
|
+
const roleLabel = role === "admin" ? "You're an admin" : role === "member" ? "You're a member" : role === "guest" ? "You're a guest" : null;
|
|
1603
1603
|
const detail = [roleLabel, ...facts].filter((part) => typeof part === "string" && part.length > 0).join(" \xB7 ");
|
|
1604
1604
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1605
1605
|
"div",
|
|
@@ -2097,8 +2097,9 @@ function OrganizationAffiliationCard({
|
|
|
2097
2097
|
let cancelled = false;
|
|
2098
2098
|
organizationAdapter.list().then((orgs) => {
|
|
2099
2099
|
if (cancelled) return;
|
|
2100
|
-
|
|
2101
|
-
|
|
2100
|
+
const joinable = orgs.filter((org) => org.role !== "guest");
|
|
2101
|
+
setAvailableOrgs(joinable);
|
|
2102
|
+
setSelectedOrgId((prev) => prev || joinable[0]?._id || "");
|
|
2102
2103
|
}).catch(() => {
|
|
2103
2104
|
if (!cancelled) setAvailableOrgs([]);
|
|
2104
2105
|
});
|
|
@@ -2581,12 +2582,19 @@ function InviteUpdateModal({
|
|
|
2581
2582
|
onSave,
|
|
2582
2583
|
onRemove,
|
|
2583
2584
|
canRemove = true,
|
|
2585
|
+
showOrganizationStanding = false,
|
|
2586
|
+
organizationName,
|
|
2587
|
+
allowGuestStanding = true,
|
|
2588
|
+
initialOrganizationStanding = "guest",
|
|
2584
2589
|
onInvite
|
|
2585
2590
|
}) {
|
|
2586
2591
|
useOverlayOpen(open, onClose);
|
|
2587
2592
|
const [emailValue, setEmailValue] = (0, import_react7.useState)("");
|
|
2588
2593
|
const [hasChanges, setHasChanges] = (0, import_react7.useState)(false);
|
|
2589
2594
|
const [role, setRole] = (0, import_react7.useState)("admin");
|
|
2595
|
+
const [orgStanding, setOrgStanding] = (0, import_react7.useState)(
|
|
2596
|
+
initialOrganizationStanding
|
|
2597
|
+
);
|
|
2590
2598
|
const [canUseCredits, setCanUseCredits] = (0, import_react7.useState)(false);
|
|
2591
2599
|
const [canInviteUser, setCanInviteUser] = (0, import_react7.useState)(false);
|
|
2592
2600
|
const [artifaxOn, setArtifaxOn] = (0, import_react7.useState)(!hiddenApps.includes("artifax"));
|
|
@@ -2623,6 +2631,7 @@ function InviteUpdateModal({
|
|
|
2623
2631
|
setEmailValue("");
|
|
2624
2632
|
setHasChanges(false);
|
|
2625
2633
|
setRole("admin");
|
|
2634
|
+
setOrgStanding(initialOrganizationStanding);
|
|
2626
2635
|
setCanUseCredits(true);
|
|
2627
2636
|
setCanInviteUser(true);
|
|
2628
2637
|
setArtifaxOn(!hidden.has("artifax"));
|
|
@@ -2632,7 +2641,7 @@ function InviteUpdateModal({
|
|
|
2632
2641
|
setStoreSearch("");
|
|
2633
2642
|
setSelectedStores(/* @__PURE__ */ new Set());
|
|
2634
2643
|
}
|
|
2635
|
-
}, [open, initialPermissions, hiddenKey]);
|
|
2644
|
+
}, [open, initialPermissions, hiddenKey, initialOrganizationStanding]);
|
|
2636
2645
|
if (!open) return null;
|
|
2637
2646
|
const isInvite = mode === "invite";
|
|
2638
2647
|
const hasEmail = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(emailValue.trim());
|
|
@@ -3008,6 +3017,95 @@ function InviteUpdateModal({
|
|
|
3008
3017
|
]
|
|
3009
3018
|
}
|
|
3010
3019
|
),
|
|
3020
|
+
showOrganizationStanding && mode === "invite" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
3021
|
+
"div",
|
|
3022
|
+
{
|
|
3023
|
+
className: "flex flex-col items-start justify-center shrink-0 w-full",
|
|
3024
|
+
style: { gap: T6.spXs },
|
|
3025
|
+
children: [
|
|
3026
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FieldLabel2, { text: "Organization access" }),
|
|
3027
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
3028
|
+
"div",
|
|
3029
|
+
{
|
|
3030
|
+
className: "shrink-0 w-full relative",
|
|
3031
|
+
style: { borderRadius: T6.rXl },
|
|
3032
|
+
children: [
|
|
3033
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3034
|
+
"div",
|
|
3035
|
+
{
|
|
3036
|
+
"aria-hidden": true,
|
|
3037
|
+
className: "absolute inset-0 pointer-events-none",
|
|
3038
|
+
style: {
|
|
3039
|
+
border: `0.5px solid ${T6.borderSubtle}`,
|
|
3040
|
+
borderRadius: T6.rXl
|
|
3041
|
+
}
|
|
3042
|
+
}
|
|
3043
|
+
),
|
|
3044
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex flex-row items-center size-full", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3045
|
+
"div",
|
|
3046
|
+
{
|
|
3047
|
+
className: "flex items-center w-full",
|
|
3048
|
+
style: { padding: T6.spXs },
|
|
3049
|
+
children: [
|
|
3050
|
+
["colleague", "Colleague"],
|
|
3051
|
+
...allowGuestStanding ? [["guest", "Guest"]] : []
|
|
3052
|
+
].map(([value, label]) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3053
|
+
"div",
|
|
3054
|
+
{
|
|
3055
|
+
className: "flex-1 min-w-0 cursor-pointer",
|
|
3056
|
+
style: {
|
|
3057
|
+
background: orgStanding === value ? T6.neutral300 : "transparent",
|
|
3058
|
+
borderRadius: T6.rMd
|
|
3059
|
+
},
|
|
3060
|
+
onClick: () => {
|
|
3061
|
+
setOrgStanding(value);
|
|
3062
|
+
markChanged();
|
|
3063
|
+
},
|
|
3064
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex flex-row items-center justify-center size-full", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3065
|
+
"div",
|
|
3066
|
+
{
|
|
3067
|
+
className: "flex items-center justify-center w-full",
|
|
3068
|
+
style: { padding: T6.spMd },
|
|
3069
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3070
|
+
"span",
|
|
3071
|
+
{
|
|
3072
|
+
style: {
|
|
3073
|
+
fontFamily: T6.font,
|
|
3074
|
+
fontSize: T6.fsSm,
|
|
3075
|
+
fontWeight: orgStanding === value ? 500 : 400,
|
|
3076
|
+
lineHeight: T6.lhSm,
|
|
3077
|
+
color: orgStanding === value ? T6.inverse : T6.muted,
|
|
3078
|
+
textAlign: "center"
|
|
3079
|
+
},
|
|
3080
|
+
children: label
|
|
3081
|
+
}
|
|
3082
|
+
)
|
|
3083
|
+
}
|
|
3084
|
+
) })
|
|
3085
|
+
},
|
|
3086
|
+
value
|
|
3087
|
+
))
|
|
3088
|
+
}
|
|
3089
|
+
) })
|
|
3090
|
+
]
|
|
3091
|
+
}
|
|
3092
|
+
),
|
|
3093
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3094
|
+
"span",
|
|
3095
|
+
{
|
|
3096
|
+
style: {
|
|
3097
|
+
fontFamily: T6.font,
|
|
3098
|
+
fontSize: T6.fsXs,
|
|
3099
|
+
fontWeight: 400,
|
|
3100
|
+
lineHeight: T6.lhXs,
|
|
3101
|
+
color: T6.tertiary
|
|
3102
|
+
},
|
|
3103
|
+
children: orgStanding === "colleague" ? `Joins ${organizationName || "the organization"} as a member \u2014 they'll also see its shared workspaces.` : `This workspace only. They see nothing else in ${organizationName || "the organization"}.`
|
|
3104
|
+
}
|
|
3105
|
+
)
|
|
3106
|
+
]
|
|
3107
|
+
}
|
|
3108
|
+
),
|
|
3011
3109
|
role !== "admin" && shownApps.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
3012
3110
|
"div",
|
|
3013
3111
|
{
|
|
@@ -3640,7 +3738,11 @@ function InviteUpdateModal({
|
|
|
3640
3738
|
catalogixStores: role === "admin" || showsApp("catalogix") ? Array.from(selectedStores) : []
|
|
3641
3739
|
};
|
|
3642
3740
|
if (isInvite && onInvite) {
|
|
3643
|
-
onInvite(
|
|
3741
|
+
onInvite(
|
|
3742
|
+
perms,
|
|
3743
|
+
emailValue.trim(),
|
|
3744
|
+
showOrganizationStanding ? orgStanding : void 0
|
|
3745
|
+
);
|
|
3644
3746
|
} else if (onSave) {
|
|
3645
3747
|
onSave(perms);
|
|
3646
3748
|
}
|
|
@@ -4370,7 +4472,7 @@ function TeamsContent({
|
|
|
4370
4472
|
organizationName,
|
|
4371
4473
|
hiddenApps
|
|
4372
4474
|
} = {}) {
|
|
4373
|
-
const { auth, api, workspace, toast } = useSettingsAdapters();
|
|
4475
|
+
const { auth, api, workspace, organization, toast } = useSettingsAdapters();
|
|
4374
4476
|
const user = auth.user;
|
|
4375
4477
|
const [activeTab, setActiveTab] = (0, import_react8.useState)("active");
|
|
4376
4478
|
const [activeMembers, setActiveMembers] = (0, import_react8.useState)([]);
|
|
@@ -4672,7 +4774,7 @@ function TeamsContent({
|
|
|
4672
4774
|
toast.error(msg);
|
|
4673
4775
|
}
|
|
4674
4776
|
};
|
|
4675
|
-
const handleInvite = async (permissions, email) => {
|
|
4777
|
+
const handleInvite = async (permissions, email, organizationStanding) => {
|
|
4676
4778
|
if (highestRole === "member") {
|
|
4677
4779
|
toast.error("You do not have permission to invite users");
|
|
4678
4780
|
closeModal();
|
|
@@ -4686,7 +4788,12 @@ function TeamsContent({
|
|
|
4686
4788
|
inviteAccess: permissions.canInviteUser,
|
|
4687
4789
|
role: permissions.role,
|
|
4688
4790
|
serviceIds,
|
|
4689
|
-
storeIds: permissions.catalogixStores || []
|
|
4791
|
+
storeIds: permissions.catalogixStores || [],
|
|
4792
|
+
// Omitted when the control was never shown, which leaves the backend
|
|
4793
|
+
// deriving the standing from the invitee's email domain as before.
|
|
4794
|
+
...organizationStanding ? {
|
|
4795
|
+
organizationRole: organizationStanding === "colleague" ? "member" : "guest"
|
|
4796
|
+
} : {}
|
|
4690
4797
|
});
|
|
4691
4798
|
toast.success(`Invitation sent to ${email}`);
|
|
4692
4799
|
await fetchData();
|
|
@@ -4707,6 +4814,9 @@ function TeamsContent({
|
|
|
4707
4814
|
const members = activeTab === "active" ? filteredActive : filteredPending;
|
|
4708
4815
|
const workspaceCurrent = workspace.current;
|
|
4709
4816
|
const orgVisibility = workspaceCurrent?.orgVisibility ?? "private";
|
|
4817
|
+
const workspaceOrgId = workspaceCurrent?.organizationId;
|
|
4818
|
+
const orgCurrent = organization.current;
|
|
4819
|
+
const mayGrantOrgMembership = !!workspaceOrgId && orgCurrent?.id === workspaceOrgId && orgCurrent?.role !== "guest" && (orgCurrent?.role === "admin" || orgCurrent?.inviteAccess === true);
|
|
4710
4820
|
const teamInnerContent = /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
4711
4821
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
4712
4822
|
ScopeHeader,
|
|
@@ -4814,6 +4924,8 @@ function TeamsContent({
|
|
|
4814
4924
|
// Must be admin or have invite permission, AND cannot remove yourself
|
|
4815
4925
|
(highestRole === "admin" || currentMemberPermissions?.canInviteUser === true) && modal.target?.userId !== user?.id
|
|
4816
4926
|
),
|
|
4927
|
+
showOrganizationStanding: mayGrantOrgMembership,
|
|
4928
|
+
organizationName: organizationName ?? orgCurrent?.name,
|
|
4817
4929
|
onInvite: handleInvite
|
|
4818
4930
|
}
|
|
4819
4931
|
)
|
|
@@ -5022,6 +5134,10 @@ function OrganizationInviteModal({
|
|
|
5022
5134
|
mode,
|
|
5023
5135
|
userEmail = "email@domain.in",
|
|
5024
5136
|
initialRole,
|
|
5137
|
+
lockRole,
|
|
5138
|
+
canClaimDomain = true,
|
|
5139
|
+
claimableDomain,
|
|
5140
|
+
lockedRoleLabel,
|
|
5025
5141
|
initialInviteAccess,
|
|
5026
5142
|
allowSubmitWithoutChanges = false,
|
|
5027
5143
|
canRemove = true,
|
|
@@ -5034,7 +5150,7 @@ function OrganizationInviteModal({
|
|
|
5034
5150
|
useOverlayOpen(open, onClose);
|
|
5035
5151
|
const [inviteMode, setInviteMode] = (0, import_react9.useState)("email");
|
|
5036
5152
|
const [emailValue, setEmailValue] = (0, import_react9.useState)("");
|
|
5037
|
-
const [domainValue, setDomainValue] = (0, import_react9.useState)("");
|
|
5153
|
+
const [domainValue, setDomainValue] = (0, import_react9.useState)(claimableDomain ?? "");
|
|
5038
5154
|
const [hasChanges, setHasChanges] = (0, import_react9.useState)(false);
|
|
5039
5155
|
const [role, setRole] = (0, import_react9.useState)("admin");
|
|
5040
5156
|
const [inviteAccess, setInviteAccess] = (0, import_react9.useState)(false);
|
|
@@ -5046,19 +5162,22 @@ function OrganizationInviteModal({
|
|
|
5046
5162
|
if (!open) {
|
|
5047
5163
|
setInviteMode("email");
|
|
5048
5164
|
setEmailValue("");
|
|
5049
|
-
setDomainValue("");
|
|
5165
|
+
setDomainValue(claimableDomain ?? "");
|
|
5050
5166
|
setHasChanges(false);
|
|
5051
5167
|
setRole("admin");
|
|
5052
5168
|
setInviteAccess(true);
|
|
5053
5169
|
}
|
|
5054
|
-
}, [open, mode, initialRole, initialInviteAccess]);
|
|
5170
|
+
}, [open, mode, initialRole, initialInviteAccess, claimableDomain]);
|
|
5055
5171
|
if (!open) return null;
|
|
5056
5172
|
const isInvite = mode === "invite";
|
|
5057
5173
|
const isEmailInvite = isInvite && inviteMode === "email";
|
|
5058
5174
|
const isDomainInvite = isInvite && inviteMode === "domain";
|
|
5059
5175
|
const hasEmail = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(emailValue.trim());
|
|
5060
5176
|
const hasDomain = /^[^\s@]+\.[^\s@]+$/.test(domainValue.trim());
|
|
5061
|
-
const isSubmitDisabled = isEmailInvite ? !hasEmail : isDomainInvite ? !hasDomain :
|
|
5177
|
+
const isSubmitDisabled = isEmailInvite ? !hasEmail : isDomainInvite ? !hasDomain : (
|
|
5178
|
+
// A locked role has nothing this modal can legitimately submit.
|
|
5179
|
+
lockRole || !(allowSubmitWithoutChanges || hasChanges)
|
|
5180
|
+
);
|
|
5062
5181
|
function markChanged() {
|
|
5063
5182
|
setHasChanges(true);
|
|
5064
5183
|
}
|
|
@@ -5133,7 +5252,7 @@ function OrganizationInviteModal({
|
|
|
5133
5252
|
className: "flex flex-col items-start w-full",
|
|
5134
5253
|
style: { padding: `${T9.sp3xl} ${T9.sp6xl}`, gap: T9.sp3xl },
|
|
5135
5254
|
children: [
|
|
5136
|
-
isInvite && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
5255
|
+
isInvite && canClaimDomain && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
5137
5256
|
"div",
|
|
5138
5257
|
{
|
|
5139
5258
|
className: "flex flex-col items-start justify-center shrink-0 w-full",
|
|
@@ -5194,9 +5313,9 @@ function OrganizationInviteModal({
|
|
|
5194
5313
|
}
|
|
5195
5314
|
),
|
|
5196
5315
|
isDomainInvite && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
5197
|
-
"
|
|
5316
|
+
"span",
|
|
5198
5317
|
{
|
|
5199
|
-
className: "flex-1 min-w-0
|
|
5318
|
+
className: "flex-1 min-w-0 truncate",
|
|
5200
5319
|
style: {
|
|
5201
5320
|
fontFamily: T9.font,
|
|
5202
5321
|
fontSize: T9.fsSm,
|
|
@@ -5204,9 +5323,7 @@ function OrganizationInviteModal({
|
|
|
5204
5323
|
lineHeight: T9.lhSm,
|
|
5205
5324
|
color: T9.primary
|
|
5206
5325
|
},
|
|
5207
|
-
|
|
5208
|
-
value: domainValue,
|
|
5209
|
-
onChange: (e) => setDomainValue(e.target.value)
|
|
5326
|
+
children: domainValue
|
|
5210
5327
|
}
|
|
5211
5328
|
),
|
|
5212
5329
|
!isInvite && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
@@ -5239,9 +5356,10 @@ function OrganizationInviteModal({
|
|
|
5239
5356
|
color: T9.muted
|
|
5240
5357
|
},
|
|
5241
5358
|
children: [
|
|
5242
|
-
"Anyone
|
|
5243
|
-
domainValue.trim()
|
|
5244
|
-
"
|
|
5359
|
+
"Anyone who signs up or logs in with an @",
|
|
5360
|
+
domainValue.trim(),
|
|
5361
|
+
" ",
|
|
5362
|
+
"address will automatically join this organization from now on."
|
|
5245
5363
|
]
|
|
5246
5364
|
}
|
|
5247
5365
|
)
|
|
@@ -5255,7 +5373,21 @@ function OrganizationInviteModal({
|
|
|
5255
5373
|
style: { gap: T9.spXs },
|
|
5256
5374
|
children: [
|
|
5257
5375
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(FieldLabel3, { text: isDomainInvite ? "Auto-join role" : "Role" }),
|
|
5258
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.
|
|
5376
|
+
lockRole ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
5377
|
+
"span",
|
|
5378
|
+
{
|
|
5379
|
+
style: {
|
|
5380
|
+
fontFamily: T9.font,
|
|
5381
|
+
fontSize: T9.fsSm,
|
|
5382
|
+
lineHeight: T9.lhSm,
|
|
5383
|
+
color: T9.muted
|
|
5384
|
+
},
|
|
5385
|
+
children: [
|
|
5386
|
+
lockedRoleLabel || "Guest",
|
|
5387
|
+
" \u2014 invited to specific workspaces only, with no access to the rest of the organization. Remove them to end that access."
|
|
5388
|
+
]
|
|
5389
|
+
}
|
|
5390
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
5259
5391
|
SegmentedToggle,
|
|
5260
5392
|
{
|
|
5261
5393
|
options: [
|
|
@@ -5273,7 +5405,7 @@ function OrganizationInviteModal({
|
|
|
5273
5405
|
]
|
|
5274
5406
|
}
|
|
5275
5407
|
),
|
|
5276
|
-
!isDomainInvite && role === "member" && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
5408
|
+
!isDomainInvite && !lockRole && role === "member" && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
5277
5409
|
"div",
|
|
5278
5410
|
{
|
|
5279
5411
|
className: "flex items-center shrink-0 w-full cursor-pointer",
|
|
@@ -5787,6 +5919,12 @@ function OrganizationModal({
|
|
|
5787
5919
|
|
|
5788
5920
|
// src/organization-content.tsx
|
|
5789
5921
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
5922
|
+
function orgRoleLabel(role) {
|
|
5923
|
+
if (role === "admin") return "Org admin";
|
|
5924
|
+
if (role === "member") return "Member";
|
|
5925
|
+
if (role === "guest") return "Guest";
|
|
5926
|
+
return role || "Member";
|
|
5927
|
+
}
|
|
5790
5928
|
var T11 = {
|
|
5791
5929
|
primary: "var(--alias-text---icons-primary)",
|
|
5792
5930
|
inverse: "var(--alias-text---icons-inverse)",
|
|
@@ -5930,7 +6068,7 @@ function MemberRow({
|
|
|
5930
6068
|
RoleChip,
|
|
5931
6069
|
{
|
|
5932
6070
|
role: member.role === "admin" ? "admin" : "member",
|
|
5933
|
-
label: member.role
|
|
6071
|
+
label: orgRoleLabel(member.role)
|
|
5934
6072
|
}
|
|
5935
6073
|
),
|
|
5936
6074
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
@@ -6038,7 +6176,7 @@ function InviteRow({
|
|
|
6038
6176
|
RoleChip,
|
|
6039
6177
|
{
|
|
6040
6178
|
role: role === "admin" ? "admin" : "member",
|
|
6041
|
-
label: role
|
|
6179
|
+
label: orgRoleLabel(role)
|
|
6042
6180
|
}
|
|
6043
6181
|
),
|
|
6044
6182
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
@@ -6185,7 +6323,8 @@ function JoinRequestRow({
|
|
|
6185
6323
|
function Section({
|
|
6186
6324
|
title,
|
|
6187
6325
|
children,
|
|
6188
|
-
empty
|
|
6326
|
+
empty,
|
|
6327
|
+
emptyText
|
|
6189
6328
|
}) {
|
|
6190
6329
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-col items-start shrink-0 w-full", style: { gap: T11.spMd }, children: [
|
|
6191
6330
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
@@ -6220,7 +6359,7 @@ function Section({
|
|
|
6220
6359
|
lineHeight: T11.lhSm,
|
|
6221
6360
|
color: T11.muted
|
|
6222
6361
|
},
|
|
6223
|
-
children: "Nothing here yet"
|
|
6362
|
+
children: emptyText ?? "Nothing here yet"
|
|
6224
6363
|
}
|
|
6225
6364
|
) }) : children
|
|
6226
6365
|
}
|
|
@@ -6240,7 +6379,9 @@ function OrganizationContent({
|
|
|
6240
6379
|
const [invites, setInvites] = (0, import_react11.useState)([]);
|
|
6241
6380
|
const [workspaces, setWorkspaces] = (0, import_react11.useState)([]);
|
|
6242
6381
|
const [joinRequests, setJoinRequests] = (0, import_react11.useState)([]);
|
|
6243
|
-
const [highestRole, setHighestRole] = (0, import_react11.useState)("
|
|
6382
|
+
const [highestRole, setHighestRole] = (0, import_react11.useState)("guest");
|
|
6383
|
+
const [emailDomain, setEmailDomain] = (0, import_react11.useState)(null);
|
|
6384
|
+
const [canClaimEmailDomain, setCanClaimEmailDomain] = (0, import_react11.useState)(true);
|
|
6244
6385
|
const [searchQuery, setSearchQuery] = (0, import_react11.useState)("");
|
|
6245
6386
|
const [loadingData, setLoadingData] = (0, import_react11.useState)(false);
|
|
6246
6387
|
const [modal, setModal] = (0, import_react11.useState)({ open: false, mode: "invite" });
|
|
@@ -6255,6 +6396,12 @@ function OrganizationContent({
|
|
|
6255
6396
|
organization.getHighestRole?.().catch(() => null) ?? Promise.resolve(null)
|
|
6256
6397
|
]);
|
|
6257
6398
|
if (highestRoleRes?.role) setHighestRole(highestRoleRes.role);
|
|
6399
|
+
if (highestRoleRes?.emailDomain !== void 0) {
|
|
6400
|
+
setEmailDomain(highestRoleRes.emailDomain ?? null);
|
|
6401
|
+
}
|
|
6402
|
+
if (highestRoleRes?.canClaimEmailDomain !== void 0) {
|
|
6403
|
+
setCanClaimEmailDomain(highestRoleRes.canClaimEmailDomain);
|
|
6404
|
+
}
|
|
6258
6405
|
if (membersRes) setMembers(membersRes.filter((m) => m?.user));
|
|
6259
6406
|
if (invitesRes) setInvites(invitesRes);
|
|
6260
6407
|
if (workspacesRes) setWorkspaces(workspacesRes);
|
|
@@ -6345,7 +6492,7 @@ function OrganizationContent({
|
|
|
6345
6492
|
const openUpdateModal = (member) => setModal({ open: true, mode: "update", target: member });
|
|
6346
6493
|
const closeModal = () => setModal({ open: false, mode: "invite" });
|
|
6347
6494
|
const handleInviteEmail = async (input) => {
|
|
6348
|
-
if (highestRole
|
|
6495
|
+
if (highestRole !== "admin") {
|
|
6349
6496
|
toast.error("You do not have permission to invite members");
|
|
6350
6497
|
closeModal();
|
|
6351
6498
|
return;
|
|
@@ -6360,7 +6507,7 @@ function OrganizationContent({
|
|
|
6360
6507
|
}
|
|
6361
6508
|
};
|
|
6362
6509
|
const handleInviteDomain = async (input) => {
|
|
6363
|
-
if (highestRole
|
|
6510
|
+
if (highestRole !== "admin") {
|
|
6364
6511
|
toast.error("You do not have permission to invite members");
|
|
6365
6512
|
closeModal();
|
|
6366
6513
|
return;
|
|
@@ -6380,7 +6527,7 @@ function OrganizationContent({
|
|
|
6380
6527
|
closeModal();
|
|
6381
6528
|
return;
|
|
6382
6529
|
}
|
|
6383
|
-
if (highestRole
|
|
6530
|
+
if (highestRole !== "admin") {
|
|
6384
6531
|
toast.error("You do not have permission to manage members");
|
|
6385
6532
|
closeModal();
|
|
6386
6533
|
return;
|
|
@@ -6413,7 +6560,7 @@ function OrganizationContent({
|
|
|
6413
6560
|
closeModal();
|
|
6414
6561
|
return;
|
|
6415
6562
|
}
|
|
6416
|
-
if (highestRole
|
|
6563
|
+
if (highestRole !== "admin") {
|
|
6417
6564
|
toast.error("You do not have permission to manage members");
|
|
6418
6565
|
closeModal();
|
|
6419
6566
|
return;
|
|
@@ -6432,7 +6579,7 @@ function OrganizationContent({
|
|
|
6432
6579
|
closeModal();
|
|
6433
6580
|
};
|
|
6434
6581
|
const handleCancelInvite = async (invite) => {
|
|
6435
|
-
if (highestRole
|
|
6582
|
+
if (highestRole !== "admin") {
|
|
6436
6583
|
toast.error("You do not have permission to manage invites");
|
|
6437
6584
|
return;
|
|
6438
6585
|
}
|
|
@@ -6457,7 +6604,7 @@ function OrganizationContent({
|
|
|
6457
6604
|
};
|
|
6458
6605
|
const handleResendInvite = async (invite) => {
|
|
6459
6606
|
if (invite.kind !== "email") return;
|
|
6460
|
-
if (highestRole
|
|
6607
|
+
if (highestRole !== "admin") {
|
|
6461
6608
|
toast.error("You do not have permission to invite members");
|
|
6462
6609
|
return;
|
|
6463
6610
|
}
|
|
@@ -6673,14 +6820,22 @@ function OrganizationContent({
|
|
|
6673
6820
|
}
|
|
6674
6821
|
);
|
|
6675
6822
|
const domainsView = /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
6676
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
6677
|
-
|
|
6823
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
6824
|
+
Section,
|
|
6678
6825
|
{
|
|
6679
|
-
|
|
6680
|
-
|
|
6681
|
-
|
|
6682
|
-
|
|
6683
|
-
|
|
6826
|
+
title: "Auto-join by email domain",
|
|
6827
|
+
empty: domainInvites.length === 0,
|
|
6828
|
+
emptyText: canClaimEmailDomain ? void 0 : `Auto-join needs a company email domain.${emailDomain ? ` ${emailDomain} is a public email provider, so it` : " A public email provider"} can't be claimed \u2014 invite people by email instead.`,
|
|
6829
|
+
children: domainInvites.map((inv) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
6830
|
+
InviteRow,
|
|
6831
|
+
{
|
|
6832
|
+
invite: inv,
|
|
6833
|
+
onCancel: () => void handleCancelInvite(inv)
|
|
6834
|
+
},
|
|
6835
|
+
inv._id
|
|
6836
|
+
))
|
|
6837
|
+
}
|
|
6838
|
+
),
|
|
6684
6839
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
6685
6840
|
Section,
|
|
6686
6841
|
{
|
|
@@ -6710,10 +6865,14 @@ function OrganizationContent({
|
|
|
6710
6865
|
open: modal.open,
|
|
6711
6866
|
mode: modal.mode,
|
|
6712
6867
|
userEmail: modal.target?.user.email,
|
|
6713
|
-
initialRole: modal.target?.role,
|
|
6868
|
+
initialRole: modal.target?.role === "admin" || modal.target?.role === "member" ? modal.target.role : void 0,
|
|
6714
6869
|
initialInviteAccess: modal.target?.inviteAccess,
|
|
6715
6870
|
allowSubmitWithoutChanges: false,
|
|
6871
|
+
lockRole: modal.target?.role === "guest",
|
|
6872
|
+
lockedRoleLabel: orgRoleLabel(modal.target?.role),
|
|
6716
6873
|
canRemove: highestRole === "admin",
|
|
6874
|
+
canClaimDomain: canClaimEmailDomain,
|
|
6875
|
+
claimableDomain: emailDomain,
|
|
6717
6876
|
onClose: closeModal,
|
|
6718
6877
|
onInviteEmail: handleInviteEmail,
|
|
6719
6878
|
onInviteDomain: handleInviteDomain,
|
|
@@ -6783,7 +6942,7 @@ function OrganizationContent({
|
|
|
6783
6942
|
variant: "primary",
|
|
6784
6943
|
size: "md",
|
|
6785
6944
|
styleVariant: "icon-left",
|
|
6786
|
-
state: highestRole
|
|
6945
|
+
state: highestRole !== "admin" ? "disabled" : "default",
|
|
6787
6946
|
icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_icons7.SiconUserAdd, { className: "w-5 h-5", color: "var(--alias-text---icons-inverse)" }),
|
|
6788
6947
|
onClick: openInviteModal
|
|
6789
6948
|
}
|