@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.mjs
CHANGED
|
@@ -1564,7 +1564,7 @@ function ScopeHeader({
|
|
|
1564
1564
|
}) {
|
|
1565
1565
|
const displayName = name?.trim() || (kind === "workspace" ? "Workspace" : "Organization");
|
|
1566
1566
|
const ScopeIcon = kind === "workspace" ? SiconWorkspace : SiconGlobe;
|
|
1567
|
-
const roleLabel = role === "admin" ? "You're an admin" : role ? "You're a member" : null;
|
|
1567
|
+
const roleLabel = role === "admin" ? "You're an admin" : role === "member" ? "You're a member" : role === "guest" ? "You're a guest" : null;
|
|
1568
1568
|
const detail = [roleLabel, ...facts].filter((part) => typeof part === "string" && part.length > 0).join(" \xB7 ");
|
|
1569
1569
|
return /* @__PURE__ */ jsxs5(
|
|
1570
1570
|
"div",
|
|
@@ -2062,8 +2062,9 @@ function OrganizationAffiliationCard({
|
|
|
2062
2062
|
let cancelled = false;
|
|
2063
2063
|
organizationAdapter.list().then((orgs) => {
|
|
2064
2064
|
if (cancelled) return;
|
|
2065
|
-
|
|
2066
|
-
|
|
2065
|
+
const joinable = orgs.filter((org) => org.role !== "guest");
|
|
2066
|
+
setAvailableOrgs(joinable);
|
|
2067
|
+
setSelectedOrgId((prev) => prev || joinable[0]?._id || "");
|
|
2067
2068
|
}).catch(() => {
|
|
2068
2069
|
if (!cancelled) setAvailableOrgs([]);
|
|
2069
2070
|
});
|
|
@@ -2564,12 +2565,19 @@ function InviteUpdateModal({
|
|
|
2564
2565
|
onSave,
|
|
2565
2566
|
onRemove,
|
|
2566
2567
|
canRemove = true,
|
|
2568
|
+
showOrganizationStanding = false,
|
|
2569
|
+
organizationName,
|
|
2570
|
+
allowGuestStanding = true,
|
|
2571
|
+
initialOrganizationStanding = "guest",
|
|
2567
2572
|
onInvite
|
|
2568
2573
|
}) {
|
|
2569
2574
|
useOverlayOpen(open, onClose);
|
|
2570
2575
|
const [emailValue, setEmailValue] = useState5("");
|
|
2571
2576
|
const [hasChanges, setHasChanges] = useState5(false);
|
|
2572
2577
|
const [role, setRole] = useState5("admin");
|
|
2578
|
+
const [orgStanding, setOrgStanding] = useState5(
|
|
2579
|
+
initialOrganizationStanding
|
|
2580
|
+
);
|
|
2573
2581
|
const [canUseCredits, setCanUseCredits] = useState5(false);
|
|
2574
2582
|
const [canInviteUser, setCanInviteUser] = useState5(false);
|
|
2575
2583
|
const [artifaxOn, setArtifaxOn] = useState5(!hiddenApps.includes("artifax"));
|
|
@@ -2606,6 +2614,7 @@ function InviteUpdateModal({
|
|
|
2606
2614
|
setEmailValue("");
|
|
2607
2615
|
setHasChanges(false);
|
|
2608
2616
|
setRole("admin");
|
|
2617
|
+
setOrgStanding(initialOrganizationStanding);
|
|
2609
2618
|
setCanUseCredits(true);
|
|
2610
2619
|
setCanInviteUser(true);
|
|
2611
2620
|
setArtifaxOn(!hidden.has("artifax"));
|
|
@@ -2615,7 +2624,7 @@ function InviteUpdateModal({
|
|
|
2615
2624
|
setStoreSearch("");
|
|
2616
2625
|
setSelectedStores(/* @__PURE__ */ new Set());
|
|
2617
2626
|
}
|
|
2618
|
-
}, [open, initialPermissions, hiddenKey]);
|
|
2627
|
+
}, [open, initialPermissions, hiddenKey, initialOrganizationStanding]);
|
|
2619
2628
|
if (!open) return null;
|
|
2620
2629
|
const isInvite = mode === "invite";
|
|
2621
2630
|
const hasEmail = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(emailValue.trim());
|
|
@@ -2991,6 +3000,95 @@ function InviteUpdateModal({
|
|
|
2991
3000
|
]
|
|
2992
3001
|
}
|
|
2993
3002
|
),
|
|
3003
|
+
showOrganizationStanding && mode === "invite" && /* @__PURE__ */ jsxs8(
|
|
3004
|
+
"div",
|
|
3005
|
+
{
|
|
3006
|
+
className: "flex flex-col items-start justify-center shrink-0 w-full",
|
|
3007
|
+
style: { gap: T6.spXs },
|
|
3008
|
+
children: [
|
|
3009
|
+
/* @__PURE__ */ jsx10(FieldLabel2, { text: "Organization access" }),
|
|
3010
|
+
/* @__PURE__ */ jsxs8(
|
|
3011
|
+
"div",
|
|
3012
|
+
{
|
|
3013
|
+
className: "shrink-0 w-full relative",
|
|
3014
|
+
style: { borderRadius: T6.rXl },
|
|
3015
|
+
children: [
|
|
3016
|
+
/* @__PURE__ */ jsx10(
|
|
3017
|
+
"div",
|
|
3018
|
+
{
|
|
3019
|
+
"aria-hidden": true,
|
|
3020
|
+
className: "absolute inset-0 pointer-events-none",
|
|
3021
|
+
style: {
|
|
3022
|
+
border: `0.5px solid ${T6.borderSubtle}`,
|
|
3023
|
+
borderRadius: T6.rXl
|
|
3024
|
+
}
|
|
3025
|
+
}
|
|
3026
|
+
),
|
|
3027
|
+
/* @__PURE__ */ jsx10("div", { className: "flex flex-row items-center size-full", children: /* @__PURE__ */ jsx10(
|
|
3028
|
+
"div",
|
|
3029
|
+
{
|
|
3030
|
+
className: "flex items-center w-full",
|
|
3031
|
+
style: { padding: T6.spXs },
|
|
3032
|
+
children: [
|
|
3033
|
+
["colleague", "Colleague"],
|
|
3034
|
+
...allowGuestStanding ? [["guest", "Guest"]] : []
|
|
3035
|
+
].map(([value, label]) => /* @__PURE__ */ jsx10(
|
|
3036
|
+
"div",
|
|
3037
|
+
{
|
|
3038
|
+
className: "flex-1 min-w-0 cursor-pointer",
|
|
3039
|
+
style: {
|
|
3040
|
+
background: orgStanding === value ? T6.neutral300 : "transparent",
|
|
3041
|
+
borderRadius: T6.rMd
|
|
3042
|
+
},
|
|
3043
|
+
onClick: () => {
|
|
3044
|
+
setOrgStanding(value);
|
|
3045
|
+
markChanged();
|
|
3046
|
+
},
|
|
3047
|
+
children: /* @__PURE__ */ jsx10("div", { className: "flex flex-row items-center justify-center size-full", children: /* @__PURE__ */ jsx10(
|
|
3048
|
+
"div",
|
|
3049
|
+
{
|
|
3050
|
+
className: "flex items-center justify-center w-full",
|
|
3051
|
+
style: { padding: T6.spMd },
|
|
3052
|
+
children: /* @__PURE__ */ jsx10(
|
|
3053
|
+
"span",
|
|
3054
|
+
{
|
|
3055
|
+
style: {
|
|
3056
|
+
fontFamily: T6.font,
|
|
3057
|
+
fontSize: T6.fsSm,
|
|
3058
|
+
fontWeight: orgStanding === value ? 500 : 400,
|
|
3059
|
+
lineHeight: T6.lhSm,
|
|
3060
|
+
color: orgStanding === value ? T6.inverse : T6.muted,
|
|
3061
|
+
textAlign: "center"
|
|
3062
|
+
},
|
|
3063
|
+
children: label
|
|
3064
|
+
}
|
|
3065
|
+
)
|
|
3066
|
+
}
|
|
3067
|
+
) })
|
|
3068
|
+
},
|
|
3069
|
+
value
|
|
3070
|
+
))
|
|
3071
|
+
}
|
|
3072
|
+
) })
|
|
3073
|
+
]
|
|
3074
|
+
}
|
|
3075
|
+
),
|
|
3076
|
+
/* @__PURE__ */ jsx10(
|
|
3077
|
+
"span",
|
|
3078
|
+
{
|
|
3079
|
+
style: {
|
|
3080
|
+
fontFamily: T6.font,
|
|
3081
|
+
fontSize: T6.fsXs,
|
|
3082
|
+
fontWeight: 400,
|
|
3083
|
+
lineHeight: T6.lhXs,
|
|
3084
|
+
color: T6.tertiary
|
|
3085
|
+
},
|
|
3086
|
+
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"}.`
|
|
3087
|
+
}
|
|
3088
|
+
)
|
|
3089
|
+
]
|
|
3090
|
+
}
|
|
3091
|
+
),
|
|
2994
3092
|
role !== "admin" && shownApps.length > 0 && /* @__PURE__ */ jsxs8(
|
|
2995
3093
|
"div",
|
|
2996
3094
|
{
|
|
@@ -3623,7 +3721,11 @@ function InviteUpdateModal({
|
|
|
3623
3721
|
catalogixStores: role === "admin" || showsApp("catalogix") ? Array.from(selectedStores) : []
|
|
3624
3722
|
};
|
|
3625
3723
|
if (isInvite && onInvite) {
|
|
3626
|
-
onInvite(
|
|
3724
|
+
onInvite(
|
|
3725
|
+
perms,
|
|
3726
|
+
emailValue.trim(),
|
|
3727
|
+
showOrganizationStanding ? orgStanding : void 0
|
|
3728
|
+
);
|
|
3627
3729
|
} else if (onSave) {
|
|
3628
3730
|
onSave(perms);
|
|
3629
3731
|
}
|
|
@@ -4353,7 +4455,7 @@ function TeamsContent({
|
|
|
4353
4455
|
organizationName,
|
|
4354
4456
|
hiddenApps
|
|
4355
4457
|
} = {}) {
|
|
4356
|
-
const { auth, api, workspace, toast } = useSettingsAdapters();
|
|
4458
|
+
const { auth, api, workspace, organization, toast } = useSettingsAdapters();
|
|
4357
4459
|
const user = auth.user;
|
|
4358
4460
|
const [activeTab, setActiveTab] = useState6("active");
|
|
4359
4461
|
const [activeMembers, setActiveMembers] = useState6([]);
|
|
@@ -4655,7 +4757,7 @@ function TeamsContent({
|
|
|
4655
4757
|
toast.error(msg);
|
|
4656
4758
|
}
|
|
4657
4759
|
};
|
|
4658
|
-
const handleInvite = async (permissions, email) => {
|
|
4760
|
+
const handleInvite = async (permissions, email, organizationStanding) => {
|
|
4659
4761
|
if (highestRole === "member") {
|
|
4660
4762
|
toast.error("You do not have permission to invite users");
|
|
4661
4763
|
closeModal();
|
|
@@ -4669,7 +4771,12 @@ function TeamsContent({
|
|
|
4669
4771
|
inviteAccess: permissions.canInviteUser,
|
|
4670
4772
|
role: permissions.role,
|
|
4671
4773
|
serviceIds,
|
|
4672
|
-
storeIds: permissions.catalogixStores || []
|
|
4774
|
+
storeIds: permissions.catalogixStores || [],
|
|
4775
|
+
// Omitted when the control was never shown, which leaves the backend
|
|
4776
|
+
// deriving the standing from the invitee's email domain as before.
|
|
4777
|
+
...organizationStanding ? {
|
|
4778
|
+
organizationRole: organizationStanding === "colleague" ? "member" : "guest"
|
|
4779
|
+
} : {}
|
|
4673
4780
|
});
|
|
4674
4781
|
toast.success(`Invitation sent to ${email}`);
|
|
4675
4782
|
await fetchData();
|
|
@@ -4690,6 +4797,9 @@ function TeamsContent({
|
|
|
4690
4797
|
const members = activeTab === "active" ? filteredActive : filteredPending;
|
|
4691
4798
|
const workspaceCurrent = workspace.current;
|
|
4692
4799
|
const orgVisibility = workspaceCurrent?.orgVisibility ?? "private";
|
|
4800
|
+
const workspaceOrgId = workspaceCurrent?.organizationId;
|
|
4801
|
+
const orgCurrent = organization.current;
|
|
4802
|
+
const mayGrantOrgMembership = !!workspaceOrgId && orgCurrent?.id === workspaceOrgId && orgCurrent?.role !== "guest" && (orgCurrent?.role === "admin" || orgCurrent?.inviteAccess === true);
|
|
4693
4803
|
const teamInnerContent = /* @__PURE__ */ jsxs10(Fragment6, { children: [
|
|
4694
4804
|
/* @__PURE__ */ jsx12(
|
|
4695
4805
|
ScopeHeader,
|
|
@@ -4797,6 +4907,8 @@ function TeamsContent({
|
|
|
4797
4907
|
// Must be admin or have invite permission, AND cannot remove yourself
|
|
4798
4908
|
(highestRole === "admin" || currentMemberPermissions?.canInviteUser === true) && modal.target?.userId !== user?.id
|
|
4799
4909
|
),
|
|
4910
|
+
showOrganizationStanding: mayGrantOrgMembership,
|
|
4911
|
+
organizationName: organizationName ?? orgCurrent?.name,
|
|
4800
4912
|
onInvite: handleInvite
|
|
4801
4913
|
}
|
|
4802
4914
|
)
|
|
@@ -5005,6 +5117,10 @@ function OrganizationInviteModal({
|
|
|
5005
5117
|
mode,
|
|
5006
5118
|
userEmail = "email@domain.in",
|
|
5007
5119
|
initialRole,
|
|
5120
|
+
lockRole,
|
|
5121
|
+
canClaimDomain = true,
|
|
5122
|
+
claimableDomain,
|
|
5123
|
+
lockedRoleLabel,
|
|
5008
5124
|
initialInviteAccess,
|
|
5009
5125
|
allowSubmitWithoutChanges = false,
|
|
5010
5126
|
canRemove = true,
|
|
@@ -5017,7 +5133,7 @@ function OrganizationInviteModal({
|
|
|
5017
5133
|
useOverlayOpen(open, onClose);
|
|
5018
5134
|
const [inviteMode, setInviteMode] = useState7("email");
|
|
5019
5135
|
const [emailValue, setEmailValue] = useState7("");
|
|
5020
|
-
const [domainValue, setDomainValue] = useState7("");
|
|
5136
|
+
const [domainValue, setDomainValue] = useState7(claimableDomain ?? "");
|
|
5021
5137
|
const [hasChanges, setHasChanges] = useState7(false);
|
|
5022
5138
|
const [role, setRole] = useState7("admin");
|
|
5023
5139
|
const [inviteAccess, setInviteAccess] = useState7(false);
|
|
@@ -5029,19 +5145,22 @@ function OrganizationInviteModal({
|
|
|
5029
5145
|
if (!open) {
|
|
5030
5146
|
setInviteMode("email");
|
|
5031
5147
|
setEmailValue("");
|
|
5032
|
-
setDomainValue("");
|
|
5148
|
+
setDomainValue(claimableDomain ?? "");
|
|
5033
5149
|
setHasChanges(false);
|
|
5034
5150
|
setRole("admin");
|
|
5035
5151
|
setInviteAccess(true);
|
|
5036
5152
|
}
|
|
5037
|
-
}, [open, mode, initialRole, initialInviteAccess]);
|
|
5153
|
+
}, [open, mode, initialRole, initialInviteAccess, claimableDomain]);
|
|
5038
5154
|
if (!open) return null;
|
|
5039
5155
|
const isInvite = mode === "invite";
|
|
5040
5156
|
const isEmailInvite = isInvite && inviteMode === "email";
|
|
5041
5157
|
const isDomainInvite = isInvite && inviteMode === "domain";
|
|
5042
5158
|
const hasEmail = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(emailValue.trim());
|
|
5043
5159
|
const hasDomain = /^[^\s@]+\.[^\s@]+$/.test(domainValue.trim());
|
|
5044
|
-
const isSubmitDisabled = isEmailInvite ? !hasEmail : isDomainInvite ? !hasDomain :
|
|
5160
|
+
const isSubmitDisabled = isEmailInvite ? !hasEmail : isDomainInvite ? !hasDomain : (
|
|
5161
|
+
// A locked role has nothing this modal can legitimately submit.
|
|
5162
|
+
lockRole || !(allowSubmitWithoutChanges || hasChanges)
|
|
5163
|
+
);
|
|
5045
5164
|
function markChanged() {
|
|
5046
5165
|
setHasChanges(true);
|
|
5047
5166
|
}
|
|
@@ -5116,7 +5235,7 @@ function OrganizationInviteModal({
|
|
|
5116
5235
|
className: "flex flex-col items-start w-full",
|
|
5117
5236
|
style: { padding: `${T9.sp3xl} ${T9.sp6xl}`, gap: T9.sp3xl },
|
|
5118
5237
|
children: [
|
|
5119
|
-
isInvite && /* @__PURE__ */ jsxs11(
|
|
5238
|
+
isInvite && canClaimDomain && /* @__PURE__ */ jsxs11(
|
|
5120
5239
|
"div",
|
|
5121
5240
|
{
|
|
5122
5241
|
className: "flex flex-col items-start justify-center shrink-0 w-full",
|
|
@@ -5177,9 +5296,9 @@ function OrganizationInviteModal({
|
|
|
5177
5296
|
}
|
|
5178
5297
|
),
|
|
5179
5298
|
isDomainInvite && /* @__PURE__ */ jsx13(
|
|
5180
|
-
"
|
|
5299
|
+
"span",
|
|
5181
5300
|
{
|
|
5182
|
-
className: "flex-1 min-w-0
|
|
5301
|
+
className: "flex-1 min-w-0 truncate",
|
|
5183
5302
|
style: {
|
|
5184
5303
|
fontFamily: T9.font,
|
|
5185
5304
|
fontSize: T9.fsSm,
|
|
@@ -5187,9 +5306,7 @@ function OrganizationInviteModal({
|
|
|
5187
5306
|
lineHeight: T9.lhSm,
|
|
5188
5307
|
color: T9.primary
|
|
5189
5308
|
},
|
|
5190
|
-
|
|
5191
|
-
value: domainValue,
|
|
5192
|
-
onChange: (e) => setDomainValue(e.target.value)
|
|
5309
|
+
children: domainValue
|
|
5193
5310
|
}
|
|
5194
5311
|
),
|
|
5195
5312
|
!isInvite && /* @__PURE__ */ jsx13(
|
|
@@ -5222,9 +5339,10 @@ function OrganizationInviteModal({
|
|
|
5222
5339
|
color: T9.muted
|
|
5223
5340
|
},
|
|
5224
5341
|
children: [
|
|
5225
|
-
"Anyone
|
|
5226
|
-
domainValue.trim()
|
|
5227
|
-
"
|
|
5342
|
+
"Anyone who signs up or logs in with an @",
|
|
5343
|
+
domainValue.trim(),
|
|
5344
|
+
" ",
|
|
5345
|
+
"address will automatically join this organization from now on."
|
|
5228
5346
|
]
|
|
5229
5347
|
}
|
|
5230
5348
|
)
|
|
@@ -5238,7 +5356,21 @@ function OrganizationInviteModal({
|
|
|
5238
5356
|
style: { gap: T9.spXs },
|
|
5239
5357
|
children: [
|
|
5240
5358
|
/* @__PURE__ */ jsx13(FieldLabel3, { text: isDomainInvite ? "Auto-join role" : "Role" }),
|
|
5241
|
-
/* @__PURE__ */
|
|
5359
|
+
lockRole ? /* @__PURE__ */ jsxs11(
|
|
5360
|
+
"span",
|
|
5361
|
+
{
|
|
5362
|
+
style: {
|
|
5363
|
+
fontFamily: T9.font,
|
|
5364
|
+
fontSize: T9.fsSm,
|
|
5365
|
+
lineHeight: T9.lhSm,
|
|
5366
|
+
color: T9.muted
|
|
5367
|
+
},
|
|
5368
|
+
children: [
|
|
5369
|
+
lockedRoleLabel || "Guest",
|
|
5370
|
+
" \u2014 invited to specific workspaces only, with no access to the rest of the organization. Remove them to end that access."
|
|
5371
|
+
]
|
|
5372
|
+
}
|
|
5373
|
+
) : /* @__PURE__ */ jsx13(
|
|
5242
5374
|
SegmentedToggle,
|
|
5243
5375
|
{
|
|
5244
5376
|
options: [
|
|
@@ -5256,7 +5388,7 @@ function OrganizationInviteModal({
|
|
|
5256
5388
|
]
|
|
5257
5389
|
}
|
|
5258
5390
|
),
|
|
5259
|
-
!isDomainInvite && role === "member" && /* @__PURE__ */ jsxs11(
|
|
5391
|
+
!isDomainInvite && !lockRole && role === "member" && /* @__PURE__ */ jsxs11(
|
|
5260
5392
|
"div",
|
|
5261
5393
|
{
|
|
5262
5394
|
className: "flex items-center shrink-0 w-full cursor-pointer",
|
|
@@ -5770,6 +5902,12 @@ function OrganizationModal({
|
|
|
5770
5902
|
|
|
5771
5903
|
// src/organization-content.tsx
|
|
5772
5904
|
import { Fragment as Fragment9, jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
5905
|
+
function orgRoleLabel(role) {
|
|
5906
|
+
if (role === "admin") return "Org admin";
|
|
5907
|
+
if (role === "member") return "Member";
|
|
5908
|
+
if (role === "guest") return "Guest";
|
|
5909
|
+
return role || "Member";
|
|
5910
|
+
}
|
|
5773
5911
|
var T11 = {
|
|
5774
5912
|
primary: "var(--alias-text---icons-primary)",
|
|
5775
5913
|
inverse: "var(--alias-text---icons-inverse)",
|
|
@@ -5913,7 +6051,7 @@ function MemberRow({
|
|
|
5913
6051
|
RoleChip,
|
|
5914
6052
|
{
|
|
5915
6053
|
role: member.role === "admin" ? "admin" : "member",
|
|
5916
|
-
label: member.role
|
|
6054
|
+
label: orgRoleLabel(member.role)
|
|
5917
6055
|
}
|
|
5918
6056
|
),
|
|
5919
6057
|
/* @__PURE__ */ jsx15(
|
|
@@ -6021,7 +6159,7 @@ function InviteRow({
|
|
|
6021
6159
|
RoleChip,
|
|
6022
6160
|
{
|
|
6023
6161
|
role: role === "admin" ? "admin" : "member",
|
|
6024
|
-
label: role
|
|
6162
|
+
label: orgRoleLabel(role)
|
|
6025
6163
|
}
|
|
6026
6164
|
),
|
|
6027
6165
|
/* @__PURE__ */ jsx15(
|
|
@@ -6168,7 +6306,8 @@ function JoinRequestRow({
|
|
|
6168
6306
|
function Section({
|
|
6169
6307
|
title,
|
|
6170
6308
|
children,
|
|
6171
|
-
empty
|
|
6309
|
+
empty,
|
|
6310
|
+
emptyText
|
|
6172
6311
|
}) {
|
|
6173
6312
|
return /* @__PURE__ */ jsxs13("div", { className: "flex flex-col items-start shrink-0 w-full", style: { gap: T11.spMd }, children: [
|
|
6174
6313
|
/* @__PURE__ */ jsx15(
|
|
@@ -6203,7 +6342,7 @@ function Section({
|
|
|
6203
6342
|
lineHeight: T11.lhSm,
|
|
6204
6343
|
color: T11.muted
|
|
6205
6344
|
},
|
|
6206
|
-
children: "Nothing here yet"
|
|
6345
|
+
children: emptyText ?? "Nothing here yet"
|
|
6207
6346
|
}
|
|
6208
6347
|
) }) : children
|
|
6209
6348
|
}
|
|
@@ -6223,7 +6362,9 @@ function OrganizationContent({
|
|
|
6223
6362
|
const [invites, setInvites] = useState9([]);
|
|
6224
6363
|
const [workspaces, setWorkspaces] = useState9([]);
|
|
6225
6364
|
const [joinRequests, setJoinRequests] = useState9([]);
|
|
6226
|
-
const [highestRole, setHighestRole] = useState9("
|
|
6365
|
+
const [highestRole, setHighestRole] = useState9("guest");
|
|
6366
|
+
const [emailDomain, setEmailDomain] = useState9(null);
|
|
6367
|
+
const [canClaimEmailDomain, setCanClaimEmailDomain] = useState9(true);
|
|
6227
6368
|
const [searchQuery, setSearchQuery] = useState9("");
|
|
6228
6369
|
const [loadingData, setLoadingData] = useState9(false);
|
|
6229
6370
|
const [modal, setModal] = useState9({ open: false, mode: "invite" });
|
|
@@ -6238,6 +6379,12 @@ function OrganizationContent({
|
|
|
6238
6379
|
organization.getHighestRole?.().catch(() => null) ?? Promise.resolve(null)
|
|
6239
6380
|
]);
|
|
6240
6381
|
if (highestRoleRes?.role) setHighestRole(highestRoleRes.role);
|
|
6382
|
+
if (highestRoleRes?.emailDomain !== void 0) {
|
|
6383
|
+
setEmailDomain(highestRoleRes.emailDomain ?? null);
|
|
6384
|
+
}
|
|
6385
|
+
if (highestRoleRes?.canClaimEmailDomain !== void 0) {
|
|
6386
|
+
setCanClaimEmailDomain(highestRoleRes.canClaimEmailDomain);
|
|
6387
|
+
}
|
|
6241
6388
|
if (membersRes) setMembers(membersRes.filter((m) => m?.user));
|
|
6242
6389
|
if (invitesRes) setInvites(invitesRes);
|
|
6243
6390
|
if (workspacesRes) setWorkspaces(workspacesRes);
|
|
@@ -6328,7 +6475,7 @@ function OrganizationContent({
|
|
|
6328
6475
|
const openUpdateModal = (member) => setModal({ open: true, mode: "update", target: member });
|
|
6329
6476
|
const closeModal = () => setModal({ open: false, mode: "invite" });
|
|
6330
6477
|
const handleInviteEmail = async (input) => {
|
|
6331
|
-
if (highestRole
|
|
6478
|
+
if (highestRole !== "admin") {
|
|
6332
6479
|
toast.error("You do not have permission to invite members");
|
|
6333
6480
|
closeModal();
|
|
6334
6481
|
return;
|
|
@@ -6343,7 +6490,7 @@ function OrganizationContent({
|
|
|
6343
6490
|
}
|
|
6344
6491
|
};
|
|
6345
6492
|
const handleInviteDomain = async (input) => {
|
|
6346
|
-
if (highestRole
|
|
6493
|
+
if (highestRole !== "admin") {
|
|
6347
6494
|
toast.error("You do not have permission to invite members");
|
|
6348
6495
|
closeModal();
|
|
6349
6496
|
return;
|
|
@@ -6363,7 +6510,7 @@ function OrganizationContent({
|
|
|
6363
6510
|
closeModal();
|
|
6364
6511
|
return;
|
|
6365
6512
|
}
|
|
6366
|
-
if (highestRole
|
|
6513
|
+
if (highestRole !== "admin") {
|
|
6367
6514
|
toast.error("You do not have permission to manage members");
|
|
6368
6515
|
closeModal();
|
|
6369
6516
|
return;
|
|
@@ -6396,7 +6543,7 @@ function OrganizationContent({
|
|
|
6396
6543
|
closeModal();
|
|
6397
6544
|
return;
|
|
6398
6545
|
}
|
|
6399
|
-
if (highestRole
|
|
6546
|
+
if (highestRole !== "admin") {
|
|
6400
6547
|
toast.error("You do not have permission to manage members");
|
|
6401
6548
|
closeModal();
|
|
6402
6549
|
return;
|
|
@@ -6415,7 +6562,7 @@ function OrganizationContent({
|
|
|
6415
6562
|
closeModal();
|
|
6416
6563
|
};
|
|
6417
6564
|
const handleCancelInvite = async (invite) => {
|
|
6418
|
-
if (highestRole
|
|
6565
|
+
if (highestRole !== "admin") {
|
|
6419
6566
|
toast.error("You do not have permission to manage invites");
|
|
6420
6567
|
return;
|
|
6421
6568
|
}
|
|
@@ -6440,7 +6587,7 @@ function OrganizationContent({
|
|
|
6440
6587
|
};
|
|
6441
6588
|
const handleResendInvite = async (invite) => {
|
|
6442
6589
|
if (invite.kind !== "email") return;
|
|
6443
|
-
if (highestRole
|
|
6590
|
+
if (highestRole !== "admin") {
|
|
6444
6591
|
toast.error("You do not have permission to invite members");
|
|
6445
6592
|
return;
|
|
6446
6593
|
}
|
|
@@ -6656,14 +6803,22 @@ function OrganizationContent({
|
|
|
6656
6803
|
}
|
|
6657
6804
|
);
|
|
6658
6805
|
const domainsView = /* @__PURE__ */ jsxs13(Fragment9, { children: [
|
|
6659
|
-
/* @__PURE__ */ jsx15(
|
|
6660
|
-
|
|
6806
|
+
/* @__PURE__ */ jsx15(
|
|
6807
|
+
Section,
|
|
6661
6808
|
{
|
|
6662
|
-
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6809
|
+
title: "Auto-join by email domain",
|
|
6810
|
+
empty: domainInvites.length === 0,
|
|
6811
|
+
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.`,
|
|
6812
|
+
children: domainInvites.map((inv) => /* @__PURE__ */ jsx15(
|
|
6813
|
+
InviteRow,
|
|
6814
|
+
{
|
|
6815
|
+
invite: inv,
|
|
6816
|
+
onCancel: () => void handleCancelInvite(inv)
|
|
6817
|
+
},
|
|
6818
|
+
inv._id
|
|
6819
|
+
))
|
|
6820
|
+
}
|
|
6821
|
+
),
|
|
6667
6822
|
/* @__PURE__ */ jsx15(
|
|
6668
6823
|
Section,
|
|
6669
6824
|
{
|
|
@@ -6693,10 +6848,14 @@ function OrganizationContent({
|
|
|
6693
6848
|
open: modal.open,
|
|
6694
6849
|
mode: modal.mode,
|
|
6695
6850
|
userEmail: modal.target?.user.email,
|
|
6696
|
-
initialRole: modal.target?.role,
|
|
6851
|
+
initialRole: modal.target?.role === "admin" || modal.target?.role === "member" ? modal.target.role : void 0,
|
|
6697
6852
|
initialInviteAccess: modal.target?.inviteAccess,
|
|
6698
6853
|
allowSubmitWithoutChanges: false,
|
|
6854
|
+
lockRole: modal.target?.role === "guest",
|
|
6855
|
+
lockedRoleLabel: orgRoleLabel(modal.target?.role),
|
|
6699
6856
|
canRemove: highestRole === "admin",
|
|
6857
|
+
canClaimDomain: canClaimEmailDomain,
|
|
6858
|
+
claimableDomain: emailDomain,
|
|
6700
6859
|
onClose: closeModal,
|
|
6701
6860
|
onInviteEmail: handleInviteEmail,
|
|
6702
6861
|
onInviteDomain: handleInviteDomain,
|
|
@@ -6766,7 +6925,7 @@ function OrganizationContent({
|
|
|
6766
6925
|
variant: "primary",
|
|
6767
6926
|
size: "md",
|
|
6768
6927
|
styleVariant: "icon-left",
|
|
6769
|
-
state: highestRole
|
|
6928
|
+
state: highestRole !== "admin" ? "disabled" : "default",
|
|
6770
6929
|
icon: /* @__PURE__ */ jsx15(SiconUserAdd2, { className: "w-5 h-5", color: "var(--alias-text---icons-inverse)" }),
|
|
6771
6930
|
onClick: openInviteModal
|
|
6772
6931
|
}
|