@streamoid/settings 0.4.6 → 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.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
- setAvailableOrgs(orgs);
2066
- setSelectedOrgId((prev) => prev || orgs[0]?._id || "");
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(perms, emailValue.trim());
3724
+ onInvite(
3725
+ perms,
3726
+ emailValue.trim(),
3727
+ showOrganizationStanding ? orgStanding : void 0
3728
+ );
3627
3729
  } else if (onSave) {
3628
3730
  onSave(perms);
3629
3731
  }
@@ -3797,31 +3899,6 @@ function MemberListFrame({
3797
3899
  }
3798
3900
  );
3799
3901
  }
3800
- function OrgMembershipTag({
3801
- organizationName,
3802
- isOrgAdmin
3803
- }) {
3804
- const org = organizationName?.trim() || "the organization";
3805
- return /* @__PURE__ */ jsx11(
3806
- "span",
3807
- {
3808
- className: "shrink-0 whitespace-nowrap",
3809
- style: {
3810
- fontFamily: T7.font,
3811
- fontSize: T7.fsXs,
3812
- fontWeight: 500,
3813
- lineHeight: T7.lhSm,
3814
- padding: "1px 8px",
3815
- borderRadius: "var(--radius-full)",
3816
- color: isOrgAdmin ? T7.primary : T7.muted,
3817
- border: `1px solid ${isOrgAdmin ? T7.primary : T7.borderSubtle}`,
3818
- backgroundColor: "transparent"
3819
- },
3820
- title: `Admin of ${org} \u2014 keeps access to this workspace regardless of what is set here. Manage under Organization \u203A People.`,
3821
- children: "Org admin"
3822
- }
3823
- );
3824
- }
3825
3902
  function RoleChip({
3826
3903
  role,
3827
3904
  label
@@ -4240,8 +4317,6 @@ function AccessIcons({ permissions }) {
4240
4317
  function TeamRow({
4241
4318
  member,
4242
4319
  variant,
4243
- orgMembership,
4244
- organizationName,
4245
4320
  onClick,
4246
4321
  onCancelInvite,
4247
4322
  onResendInvite
@@ -4307,22 +4382,13 @@ function TeamRow({
4307
4382
  ]
4308
4383
  }
4309
4384
  ),
4310
- /* @__PURE__ */ jsxs10("div", { className: "flex items-center shrink-0", style: { gap: 6 }, children: [
4311
- /* @__PURE__ */ jsx12(
4312
- RoleChip,
4313
- {
4314
- role: member.permissions.role === "admin" ? "admin" : "member",
4315
- label: member.permissions.role === "admin" ? "Workspace admin" : "Member"
4316
- }
4317
- ),
4318
- orgMembership && /* @__PURE__ */ jsx12(
4319
- OrgMembershipTag,
4320
- {
4321
- organizationName,
4322
- isOrgAdmin: orgMembership.isOrgAdmin
4323
- }
4324
- )
4325
- ] }),
4385
+ /* @__PURE__ */ jsx12("div", { className: "flex items-center shrink-0", style: { gap: 6 }, children: /* @__PURE__ */ jsx12(
4386
+ RoleChip,
4387
+ {
4388
+ role: member.permissions.role === "admin" ? "admin" : "member",
4389
+ label: member.permissions.role === "admin" ? "Workspace admin" : "Member"
4390
+ }
4391
+ ) }),
4326
4392
  /* @__PURE__ */ jsx12(AccessIcons, { permissions: member.permissions }),
4327
4393
  /* @__PURE__ */ jsx12(
4328
4394
  "div",
@@ -4389,7 +4455,7 @@ function TeamsContent({
4389
4455
  organizationName,
4390
4456
  hiddenApps
4391
4457
  } = {}) {
4392
- const { auth, api, organization, workspace, toast } = useSettingsAdapters();
4458
+ const { auth, api, workspace, organization, toast } = useSettingsAdapters();
4393
4459
  const user = auth.user;
4394
4460
  const [activeTab, setActiveTab] = useState6("active");
4395
4461
  const [activeMembers, setActiveMembers] = useState6([]);
@@ -4399,9 +4465,6 @@ function TeamsContent({
4399
4465
  const [highestRole, setHighestRole] = useState6("admin");
4400
4466
  const [searchQuery, setSearchQuery] = useState6("");
4401
4467
  const [loadingData, setLoadingData] = useState6(false);
4402
- const [orgMemberRoles, setOrgMemberRoles] = useState6(
4403
- () => /* @__PURE__ */ new Map()
4404
- );
4405
4468
  const [modal, setModal] = useState6({
4406
4469
  open: false,
4407
4470
  mode: "invite"
@@ -4480,37 +4543,6 @@ function TeamsContent({
4480
4543
  }
4481
4544
  }
4482
4545
  ];
4483
- const organizationId = organization.current?.id ?? null;
4484
- useEffect6(() => {
4485
- if (!organizationId) {
4486
- setOrgMemberRoles(/* @__PURE__ */ new Map());
4487
- return;
4488
- }
4489
- let cancelled = false;
4490
- organization.fetchMembers().then((members2) => {
4491
- if (cancelled) return;
4492
- const next = /* @__PURE__ */ new Map();
4493
- for (const m of members2) {
4494
- const email = m.user?.email?.trim().toLowerCase();
4495
- if (email) next.set(email, m.role);
4496
- }
4497
- setOrgMemberRoles(next);
4498
- }).catch(() => {
4499
- if (!cancelled) setOrgMemberRoles(/* @__PURE__ */ new Map());
4500
- });
4501
- return () => {
4502
- cancelled = true;
4503
- };
4504
- }, [organizationId, organization]);
4505
- const orgMembershipFor = useCallback2(
4506
- (email) => {
4507
- const key = email?.trim().toLowerCase();
4508
- if (!key || orgMemberRoles.size === 0) return void 0;
4509
- const role = orgMemberRoles.get(key);
4510
- return role ? { isOrgAdmin: role === "admin" } : void 0;
4511
- },
4512
- [orgMemberRoles]
4513
- );
4514
4546
  const fetchData = useCallback2(async () => {
4515
4547
  setLoadingData(true);
4516
4548
  try {
@@ -4725,7 +4757,7 @@ function TeamsContent({
4725
4757
  toast.error(msg);
4726
4758
  }
4727
4759
  };
4728
- const handleInvite = async (permissions, email) => {
4760
+ const handleInvite = async (permissions, email, organizationStanding) => {
4729
4761
  if (highestRole === "member") {
4730
4762
  toast.error("You do not have permission to invite users");
4731
4763
  closeModal();
@@ -4739,7 +4771,12 @@ function TeamsContent({
4739
4771
  inviteAccess: permissions.canInviteUser,
4740
4772
  role: permissions.role,
4741
4773
  serviceIds,
4742
- 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
+ } : {}
4743
4780
  });
4744
4781
  toast.success(`Invitation sent to ${email}`);
4745
4782
  await fetchData();
@@ -4760,6 +4797,9 @@ function TeamsContent({
4760
4797
  const members = activeTab === "active" ? filteredActive : filteredPending;
4761
4798
  const workspaceCurrent = workspace.current;
4762
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);
4763
4803
  const teamInnerContent = /* @__PURE__ */ jsxs10(Fragment6, { children: [
4764
4804
  /* @__PURE__ */ jsx12(
4765
4805
  ScopeHeader,
@@ -4841,8 +4881,6 @@ function TeamsContent({
4841
4881
  {
4842
4882
  member,
4843
4883
  variant: activeTab,
4844
- orgMembership: orgMembershipFor(member.userEmail),
4845
- organizationName,
4846
4884
  onClick: activeTab === "active" ? () => openUpdateModal(member) : void 0,
4847
4885
  onCancelInvite: () => void handleCancelPendingInvite(member),
4848
4886
  onResendInvite: () => void handleResendPendingInvite(member)
@@ -4869,6 +4907,8 @@ function TeamsContent({
4869
4907
  // Must be admin or have invite permission, AND cannot remove yourself
4870
4908
  (highestRole === "admin" || currentMemberPermissions?.canInviteUser === true) && modal.target?.userId !== user?.id
4871
4909
  ),
4910
+ showOrganizationStanding: mayGrantOrgMembership,
4911
+ organizationName: organizationName ?? orgCurrent?.name,
4872
4912
  onInvite: handleInvite
4873
4913
  }
4874
4914
  )
@@ -5077,6 +5117,10 @@ function OrganizationInviteModal({
5077
5117
  mode,
5078
5118
  userEmail = "email@domain.in",
5079
5119
  initialRole,
5120
+ lockRole,
5121
+ canClaimDomain = true,
5122
+ claimableDomain,
5123
+ lockedRoleLabel,
5080
5124
  initialInviteAccess,
5081
5125
  allowSubmitWithoutChanges = false,
5082
5126
  canRemove = true,
@@ -5089,7 +5133,7 @@ function OrganizationInviteModal({
5089
5133
  useOverlayOpen(open, onClose);
5090
5134
  const [inviteMode, setInviteMode] = useState7("email");
5091
5135
  const [emailValue, setEmailValue] = useState7("");
5092
- const [domainValue, setDomainValue] = useState7("");
5136
+ const [domainValue, setDomainValue] = useState7(claimableDomain ?? "");
5093
5137
  const [hasChanges, setHasChanges] = useState7(false);
5094
5138
  const [role, setRole] = useState7("admin");
5095
5139
  const [inviteAccess, setInviteAccess] = useState7(false);
@@ -5101,19 +5145,22 @@ function OrganizationInviteModal({
5101
5145
  if (!open) {
5102
5146
  setInviteMode("email");
5103
5147
  setEmailValue("");
5104
- setDomainValue("");
5148
+ setDomainValue(claimableDomain ?? "");
5105
5149
  setHasChanges(false);
5106
5150
  setRole("admin");
5107
5151
  setInviteAccess(true);
5108
5152
  }
5109
- }, [open, mode, initialRole, initialInviteAccess]);
5153
+ }, [open, mode, initialRole, initialInviteAccess, claimableDomain]);
5110
5154
  if (!open) return null;
5111
5155
  const isInvite = mode === "invite";
5112
5156
  const isEmailInvite = isInvite && inviteMode === "email";
5113
5157
  const isDomainInvite = isInvite && inviteMode === "domain";
5114
5158
  const hasEmail = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(emailValue.trim());
5115
5159
  const hasDomain = /^[^\s@]+\.[^\s@]+$/.test(domainValue.trim());
5116
- const isSubmitDisabled = isEmailInvite ? !hasEmail : isDomainInvite ? !hasDomain : !(allowSubmitWithoutChanges || hasChanges);
5160
+ const isSubmitDisabled = isEmailInvite ? !hasEmail : isDomainInvite ? !hasDomain : (
5161
+ // A locked role has nothing this modal can legitimately submit.
5162
+ lockRole || !(allowSubmitWithoutChanges || hasChanges)
5163
+ );
5117
5164
  function markChanged() {
5118
5165
  setHasChanges(true);
5119
5166
  }
@@ -5188,7 +5235,7 @@ function OrganizationInviteModal({
5188
5235
  className: "flex flex-col items-start w-full",
5189
5236
  style: { padding: `${T9.sp3xl} ${T9.sp6xl}`, gap: T9.sp3xl },
5190
5237
  children: [
5191
- isInvite && /* @__PURE__ */ jsxs11(
5238
+ isInvite && canClaimDomain && /* @__PURE__ */ jsxs11(
5192
5239
  "div",
5193
5240
  {
5194
5241
  className: "flex flex-col items-start justify-center shrink-0 w-full",
@@ -5249,9 +5296,9 @@ function OrganizationInviteModal({
5249
5296
  }
5250
5297
  ),
5251
5298
  isDomainInvite && /* @__PURE__ */ jsx13(
5252
- "input",
5299
+ "span",
5253
5300
  {
5254
- className: "flex-1 min-w-0 bg-transparent border-none outline-none",
5301
+ className: "flex-1 min-w-0 truncate",
5255
5302
  style: {
5256
5303
  fontFamily: T9.font,
5257
5304
  fontSize: T9.fsSm,
@@ -5259,9 +5306,7 @@ function OrganizationInviteModal({
5259
5306
  lineHeight: T9.lhSm,
5260
5307
  color: T9.primary
5261
5308
  },
5262
- placeholder: "streamoid.com",
5263
- value: domainValue,
5264
- onChange: (e) => setDomainValue(e.target.value)
5309
+ children: domainValue
5265
5310
  }
5266
5311
  ),
5267
5312
  !isInvite && /* @__PURE__ */ jsx13(
@@ -5294,9 +5339,10 @@ function OrganizationInviteModal({
5294
5339
  color: T9.muted
5295
5340
  },
5296
5341
  children: [
5297
- "Anyone signing up or logging in with a verified ",
5298
- domainValue.trim() || "this",
5299
- " email address will automatically join this organization going forward."
5342
+ "Anyone who signs up or logs in with an @",
5343
+ domainValue.trim(),
5344
+ " ",
5345
+ "address will automatically join this organization from now on."
5300
5346
  ]
5301
5347
  }
5302
5348
  )
@@ -5310,7 +5356,21 @@ function OrganizationInviteModal({
5310
5356
  style: { gap: T9.spXs },
5311
5357
  children: [
5312
5358
  /* @__PURE__ */ jsx13(FieldLabel3, { text: isDomainInvite ? "Auto-join role" : "Role" }),
5313
- /* @__PURE__ */ jsx13(
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(
5314
5374
  SegmentedToggle,
5315
5375
  {
5316
5376
  options: [
@@ -5328,7 +5388,7 @@ function OrganizationInviteModal({
5328
5388
  ]
5329
5389
  }
5330
5390
  ),
5331
- !isDomainInvite && role === "member" && /* @__PURE__ */ jsxs11(
5391
+ !isDomainInvite && !lockRole && role === "member" && /* @__PURE__ */ jsxs11(
5332
5392
  "div",
5333
5393
  {
5334
5394
  className: "flex items-center shrink-0 w-full cursor-pointer",
@@ -5842,6 +5902,12 @@ function OrganizationModal({
5842
5902
 
5843
5903
  // src/organization-content.tsx
5844
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
+ }
5845
5911
  var T11 = {
5846
5912
  primary: "var(--alias-text---icons-primary)",
5847
5913
  inverse: "var(--alias-text---icons-inverse)",
@@ -5985,7 +6051,7 @@ function MemberRow({
5985
6051
  RoleChip,
5986
6052
  {
5987
6053
  role: member.role === "admin" ? "admin" : "member",
5988
- label: member.role === "admin" ? "Org admin" : "Member"
6054
+ label: orgRoleLabel(member.role)
5989
6055
  }
5990
6056
  ),
5991
6057
  /* @__PURE__ */ jsx15(
@@ -6093,7 +6159,7 @@ function InviteRow({
6093
6159
  RoleChip,
6094
6160
  {
6095
6161
  role: role === "admin" ? "admin" : "member",
6096
- label: role === "admin" ? "Org admin" : "Member"
6162
+ label: orgRoleLabel(role)
6097
6163
  }
6098
6164
  ),
6099
6165
  /* @__PURE__ */ jsx15(
@@ -6240,7 +6306,8 @@ function JoinRequestRow({
6240
6306
  function Section({
6241
6307
  title,
6242
6308
  children,
6243
- empty
6309
+ empty,
6310
+ emptyText
6244
6311
  }) {
6245
6312
  return /* @__PURE__ */ jsxs13("div", { className: "flex flex-col items-start shrink-0 w-full", style: { gap: T11.spMd }, children: [
6246
6313
  /* @__PURE__ */ jsx15(
@@ -6275,7 +6342,7 @@ function Section({
6275
6342
  lineHeight: T11.lhSm,
6276
6343
  color: T11.muted
6277
6344
  },
6278
- children: "Nothing here yet"
6345
+ children: emptyText ?? "Nothing here yet"
6279
6346
  }
6280
6347
  ) }) : children
6281
6348
  }
@@ -6295,7 +6362,9 @@ function OrganizationContent({
6295
6362
  const [invites, setInvites] = useState9([]);
6296
6363
  const [workspaces, setWorkspaces] = useState9([]);
6297
6364
  const [joinRequests, setJoinRequests] = useState9([]);
6298
- const [highestRole, setHighestRole] = useState9("admin");
6365
+ const [highestRole, setHighestRole] = useState9("guest");
6366
+ const [emailDomain, setEmailDomain] = useState9(null);
6367
+ const [canClaimEmailDomain, setCanClaimEmailDomain] = useState9(true);
6299
6368
  const [searchQuery, setSearchQuery] = useState9("");
6300
6369
  const [loadingData, setLoadingData] = useState9(false);
6301
6370
  const [modal, setModal] = useState9({ open: false, mode: "invite" });
@@ -6310,6 +6379,12 @@ function OrganizationContent({
6310
6379
  organization.getHighestRole?.().catch(() => null) ?? Promise.resolve(null)
6311
6380
  ]);
6312
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
+ }
6313
6388
  if (membersRes) setMembers(membersRes.filter((m) => m?.user));
6314
6389
  if (invitesRes) setInvites(invitesRes);
6315
6390
  if (workspacesRes) setWorkspaces(workspacesRes);
@@ -6400,7 +6475,7 @@ function OrganizationContent({
6400
6475
  const openUpdateModal = (member) => setModal({ open: true, mode: "update", target: member });
6401
6476
  const closeModal = () => setModal({ open: false, mode: "invite" });
6402
6477
  const handleInviteEmail = async (input) => {
6403
- if (highestRole === "member") {
6478
+ if (highestRole !== "admin") {
6404
6479
  toast.error("You do not have permission to invite members");
6405
6480
  closeModal();
6406
6481
  return;
@@ -6415,7 +6490,7 @@ function OrganizationContent({
6415
6490
  }
6416
6491
  };
6417
6492
  const handleInviteDomain = async (input) => {
6418
- if (highestRole === "member") {
6493
+ if (highestRole !== "admin") {
6419
6494
  toast.error("You do not have permission to invite members");
6420
6495
  closeModal();
6421
6496
  return;
@@ -6435,7 +6510,7 @@ function OrganizationContent({
6435
6510
  closeModal();
6436
6511
  return;
6437
6512
  }
6438
- if (highestRole === "member") {
6513
+ if (highestRole !== "admin") {
6439
6514
  toast.error("You do not have permission to manage members");
6440
6515
  closeModal();
6441
6516
  return;
@@ -6468,7 +6543,7 @@ function OrganizationContent({
6468
6543
  closeModal();
6469
6544
  return;
6470
6545
  }
6471
- if (highestRole === "member") {
6546
+ if (highestRole !== "admin") {
6472
6547
  toast.error("You do not have permission to manage members");
6473
6548
  closeModal();
6474
6549
  return;
@@ -6487,7 +6562,7 @@ function OrganizationContent({
6487
6562
  closeModal();
6488
6563
  };
6489
6564
  const handleCancelInvite = async (invite) => {
6490
- if (highestRole === "member") {
6565
+ if (highestRole !== "admin") {
6491
6566
  toast.error("You do not have permission to manage invites");
6492
6567
  return;
6493
6568
  }
@@ -6512,7 +6587,7 @@ function OrganizationContent({
6512
6587
  };
6513
6588
  const handleResendInvite = async (invite) => {
6514
6589
  if (invite.kind !== "email") return;
6515
- if (highestRole === "member") {
6590
+ if (highestRole !== "admin") {
6516
6591
  toast.error("You do not have permission to invite members");
6517
6592
  return;
6518
6593
  }
@@ -6728,14 +6803,22 @@ function OrganizationContent({
6728
6803
  }
6729
6804
  );
6730
6805
  const domainsView = /* @__PURE__ */ jsxs13(Fragment9, { children: [
6731
- /* @__PURE__ */ jsx15(Section, { title: "Auto-join by email domain", empty: domainInvites.length === 0, children: domainInvites.map((inv) => /* @__PURE__ */ jsx15(
6732
- InviteRow,
6806
+ /* @__PURE__ */ jsx15(
6807
+ Section,
6733
6808
  {
6734
- invite: inv,
6735
- onCancel: () => void handleCancelInvite(inv)
6736
- },
6737
- inv._id
6738
- )) }),
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
+ ),
6739
6822
  /* @__PURE__ */ jsx15(
6740
6823
  Section,
6741
6824
  {
@@ -6765,10 +6848,14 @@ function OrganizationContent({
6765
6848
  open: modal.open,
6766
6849
  mode: modal.mode,
6767
6850
  userEmail: modal.target?.user.email,
6768
- initialRole: modal.target?.role,
6851
+ initialRole: modal.target?.role === "admin" || modal.target?.role === "member" ? modal.target.role : void 0,
6769
6852
  initialInviteAccess: modal.target?.inviteAccess,
6770
6853
  allowSubmitWithoutChanges: false,
6854
+ lockRole: modal.target?.role === "guest",
6855
+ lockedRoleLabel: orgRoleLabel(modal.target?.role),
6771
6856
  canRemove: highestRole === "admin",
6857
+ canClaimDomain: canClaimEmailDomain,
6858
+ claimableDomain: emailDomain,
6772
6859
  onClose: closeModal,
6773
6860
  onInviteEmail: handleInviteEmail,
6774
6861
  onInviteDomain: handleInviteDomain,
@@ -6838,7 +6925,7 @@ function OrganizationContent({
6838
6925
  variant: "primary",
6839
6926
  size: "md",
6840
6927
  styleVariant: "icon-left",
6841
- state: highestRole === "member" ? "disabled" : "default",
6928
+ state: highestRole !== "admin" ? "disabled" : "default",
6842
6929
  icon: /* @__PURE__ */ jsx15(SiconUserAdd2, { className: "w-5 h-5", color: "var(--alias-text---icons-inverse)" }),
6843
6930
  onClick: openInviteModal
6844
6931
  }
@@ -12157,7 +12244,6 @@ export {
12157
12244
  InviteUpdateModal,
12158
12245
  MemberListFrame,
12159
12246
  MemberListToolbar,
12160
- OrgMembershipTag,
12161
12247
  OrganizationContent,
12162
12248
  OrganizationInviteModal,
12163
12249
  OrganizationModal,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamoid/settings",
3
- "version": "0.4.6",
3
+ "version": "0.6.0",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",