@streamoid/settings 0.7.5 → 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 CHANGED
@@ -365,6 +365,10 @@ 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;
368
372
  }
369
373
  /** A shared workspace in the organization that the viewer isn't in yet. */
370
374
  interface OrganizationJoinableWorkspace {
@@ -464,13 +468,13 @@ interface SettingsOrganizationAdapter {
464
468
  }>;
465
469
  fetchWorkspaces: () => Promise<OrganizationWorkspaceItem[]>;
466
470
  /**
467
- * Optional: the organization's shared workspaces the viewer isn't in yet —
468
- * the workspace picker's list. When given (with `joinWorkspaces`), org
469
- * members see them under Organization › Workspaces and can join any of them
470
- * as a member at any time, not only at first sign-in.
471
+ * @deprecated Since 0.7.6 never called: `fetchWorkspaces()` lists every
472
+ * shared workspace for an org member, flagged with `joined`.
471
473
  */
472
474
  fetchJoinableWorkspaces?: () => Promise<OrganizationJoinableWorkspace[]>;
473
- /** Optional: join those workspaces as a member. Resolves to the ids joined. */
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`. */
474
478
  joinWorkspaces?: (workspaceIds: string[]) => Promise<string[]>;
475
479
  fetchJoinRequests: () => Promise<OrganizationJoinRequest[]>;
476
480
  approveJoinRequest: (requestId: string) => Promise<void>;
package/dist/index.d.ts CHANGED
@@ -365,6 +365,10 @@ 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;
368
372
  }
369
373
  /** A shared workspace in the organization that the viewer isn't in yet. */
370
374
  interface OrganizationJoinableWorkspace {
@@ -464,13 +468,13 @@ interface SettingsOrganizationAdapter {
464
468
  }>;
465
469
  fetchWorkspaces: () => Promise<OrganizationWorkspaceItem[]>;
466
470
  /**
467
- * Optional: the organization's shared workspaces the viewer isn't in yet —
468
- * the workspace picker's list. When given (with `joinWorkspaces`), org
469
- * members see them under Organization › Workspaces and can join any of them
470
- * as a member at any time, not only at first sign-in.
471
+ * @deprecated Since 0.7.6 never called: `fetchWorkspaces()` lists every
472
+ * shared workspace for an org member, flagged with `joined`.
471
473
  */
472
474
  fetchJoinableWorkspaces?: () => Promise<OrganizationJoinableWorkspace[]>;
473
- /** Optional: join those workspaces as a member. Resolves to the ids joined. */
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`. */
474
478
  joinWorkspaces?: (workspaceIds: string[]) => Promise<string[]>;
475
479
  fetchJoinRequests: () => Promise<OrganizationJoinRequest[]>;
476
480
  approveJoinRequest: (requestId: string) => Promise<void>;
package/dist/index.js CHANGED
@@ -6133,7 +6133,11 @@ function MemberRow({
6133
6133
  }
6134
6134
  );
6135
6135
  }
6136
- function WorkspaceRow({ workspace }) {
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,80 +6173,19 @@ function WorkspaceRow({ workspace }) {
6169
6173
  }
6170
6174
  )
6171
6175
  ] }),
6172
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(VisibilityBadge, { visibility: workspace.orgVisibility })
6173
- ]
6174
- }
6175
- );
6176
- }
6177
- function JoinableWorkspaceRow({
6178
- workspace,
6179
- joining,
6180
- onJoin
6181
- }) {
6182
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
6183
- "div",
6184
- {
6185
- className: "flex items-center self-stretch shrink-0",
6186
- style: {
6187
- borderBottom: `1px solid ${T11.borderSubtle}`,
6188
- padding: `${T11.spXl} ${T11.sp3xl}`,
6189
- gap: T11.sp6xl
6190
- },
6191
- children: [
6192
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center min-w-0", style: { flex: 1, gap: T11.spMd }, children: [
6193
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6194
- ProfileAvatar,
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,
6195
6180
  {
6196
- name: workspace.name,
6197
- profileImage: workspace.imageUrl,
6198
- size: 28,
6199
- borderRadius: "var(--radius-lg)"
6181
+ text: joining ? "Joining\u2026" : "Join",
6182
+ variant: "secondary",
6183
+ size: "sm",
6184
+ state: joining ? "disabled" : "default",
6185
+ onClick: joining ? void 0 : onJoin
6200
6186
  }
6201
- ),
6202
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-col min-w-0", children: [
6203
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6204
- "span",
6205
- {
6206
- className: "truncate",
6207
- style: {
6208
- fontFamily: T11.font,
6209
- fontSize: T11.fsSm,
6210
- fontWeight: 500,
6211
- lineHeight: T11.lhSm,
6212
- color: T11.primary
6213
- },
6214
- children: workspace.name
6215
- }
6216
- ),
6217
- workspace.ownerName && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
6218
- "span",
6219
- {
6220
- className: "truncate",
6221
- style: {
6222
- fontFamily: T11.font,
6223
- fontSize: T11.fsXs,
6224
- fontWeight: 400,
6225
- lineHeight: T11.lhXs,
6226
- color: T11.muted
6227
- },
6228
- children: [
6229
- "Created by ",
6230
- workspace.ownerName
6231
- ]
6232
- }
6233
- )
6234
- ] })
6235
- ] }),
6236
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6237
- import_ui8.ScButton,
6238
- {
6239
- text: joining ? "Joining\u2026" : "Join",
6240
- variant: "secondary",
6241
- size: "sm",
6242
- state: joining ? "disabled" : "default",
6243
- onClick: joining ? void 0 : onJoin
6244
- }
6245
- )
6187
+ )
6188
+ ] })
6246
6189
  ]
6247
6190
  }
6248
6191
  );
@@ -6370,8 +6313,7 @@ function OrganizationContent({
6370
6313
  const current = organization.current;
6371
6314
  const [members, setMembers] = (0, import_react12.useState)([]);
6372
6315
  const [workspaces, setWorkspaces] = (0, import_react12.useState)([]);
6373
- const canJoinShared = current?.role === "member" && !!organization.fetchJoinableWorkspaces && !!organization.joinWorkspaces;
6374
- const [joinable, setJoinable] = (0, import_react12.useState)([]);
6316
+ const canJoinShared = current?.role === "member" && !!organization.joinWorkspaces;
6375
6317
  const [joiningId, setJoiningId] = (0, import_react12.useState)(null);
6376
6318
  const [joinRequests, setJoinRequests] = (0, import_react12.useState)([]);
6377
6319
  const [highestRole, setHighestRole] = (0, import_react12.useState)("guest");
@@ -6382,20 +6324,12 @@ function OrganizationContent({
6382
6324
  if (!organization.current) return;
6383
6325
  setLoadingData(true);
6384
6326
  try {
6385
- const [
6386
- membersRes,
6387
- workspacesRes,
6388
- joinRequestsRes,
6389
- highestRoleRes,
6390
- joinableRes
6391
- ] = await Promise.all([
6327
+ const [membersRes, workspacesRes, joinRequestsRes, highestRoleRes] = await Promise.all([
6392
6328
  organization.fetchMembers().catch(() => null),
6393
6329
  organization.fetchWorkspaces().catch(() => null),
6394
6330
  organization.fetchJoinRequests().catch(() => null),
6395
- organization.getHighestRole?.().catch(() => null) ?? Promise.resolve(null),
6396
- canJoinShared ? organization.fetchJoinableWorkspaces().catch(() => null) : Promise.resolve(null)
6331
+ organization.getHighestRole?.().catch(() => null) ?? Promise.resolve(null)
6397
6332
  ]);
6398
- if (joinableRes) setJoinable(joinableRes);
6399
6333
  if (highestRoleRes?.role) setHighestRole(highestRoleRes.role);
6400
6334
  if (membersRes) setMembers(membersRes.filter((m) => m?.user));
6401
6335
  if (workspacesRes) setWorkspaces(workspacesRes);
@@ -6404,7 +6338,7 @@ function OrganizationContent({
6404
6338
  } finally {
6405
6339
  setLoadingData(false);
6406
6340
  }
6407
- }, [organization, canJoinShared]);
6341
+ }, [organization]);
6408
6342
  (0, import_react12.useEffect)(() => {
6409
6343
  fetchData();
6410
6344
  }, [fetchData]);
@@ -6653,21 +6587,12 @@ function OrganizationContent({
6653
6587
  {
6654
6588
  title: "Workspaces in this organization",
6655
6589
  empty: workspaces.length === 0,
6656
- children: workspaces.map((ws) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(WorkspaceRow, { workspace: ws }, ws._id))
6657
- }
6658
- ),
6659
- canJoinShared && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6660
- Section,
6661
- {
6662
- title: "Shared workspaces you can join",
6663
- empty: joinable.length === 0,
6664
- emptyText: "You're in every shared workspace in this organization",
6665
- children: joinable.map((ws) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6666
- JoinableWorkspaceRow,
6590
+ children: workspaces.map((ws) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6591
+ WorkspaceRow,
6667
6592
  {
6668
6593
  workspace: ws,
6669
6594
  joining: joiningId === ws._id,
6670
- onJoin: () => void handleJoinWorkspace(ws)
6595
+ onJoin: canJoinShared && ws.joined === false && ws.orgVisibility === "shared" ? () => void handleJoinWorkspace(ws) : void 0
6671
6596
  },
6672
6597
  ws._id
6673
6598
  ))
package/dist/index.mjs CHANGED
@@ -6110,7 +6110,11 @@ function MemberRow({
6110
6110
  }
6111
6111
  );
6112
6112
  }
6113
- function WorkspaceRow({ workspace }) {
6113
+ function WorkspaceRow({
6114
+ workspace,
6115
+ joining = false,
6116
+ onJoin
6117
+ }) {
6114
6118
  return /* @__PURE__ */ jsxs14(
6115
6119
  "div",
6116
6120
  {
@@ -6146,80 +6150,19 @@ function WorkspaceRow({ workspace }) {
6146
6150
  }
6147
6151
  )
6148
6152
  ] }),
6149
- /* @__PURE__ */ jsx17(VisibilityBadge, { visibility: workspace.orgVisibility })
6150
- ]
6151
- }
6152
- );
6153
- }
6154
- function JoinableWorkspaceRow({
6155
- workspace,
6156
- joining,
6157
- onJoin
6158
- }) {
6159
- return /* @__PURE__ */ jsxs14(
6160
- "div",
6161
- {
6162
- className: "flex items-center self-stretch shrink-0",
6163
- style: {
6164
- borderBottom: `1px solid ${T11.borderSubtle}`,
6165
- padding: `${T11.spXl} ${T11.sp3xl}`,
6166
- gap: T11.sp6xl
6167
- },
6168
- children: [
6169
- /* @__PURE__ */ jsxs14("div", { className: "flex items-center min-w-0", style: { flex: 1, gap: T11.spMd }, children: [
6170
- /* @__PURE__ */ jsx17(
6171
- ProfileAvatar,
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,
6172
6157
  {
6173
- name: workspace.name,
6174
- profileImage: workspace.imageUrl,
6175
- size: 28,
6176
- borderRadius: "var(--radius-lg)"
6158
+ text: joining ? "Joining\u2026" : "Join",
6159
+ variant: "secondary",
6160
+ size: "sm",
6161
+ state: joining ? "disabled" : "default",
6162
+ onClick: joining ? void 0 : onJoin
6177
6163
  }
6178
- ),
6179
- /* @__PURE__ */ jsxs14("div", { className: "flex flex-col min-w-0", children: [
6180
- /* @__PURE__ */ jsx17(
6181
- "span",
6182
- {
6183
- className: "truncate",
6184
- style: {
6185
- fontFamily: T11.font,
6186
- fontSize: T11.fsSm,
6187
- fontWeight: 500,
6188
- lineHeight: T11.lhSm,
6189
- color: T11.primary
6190
- },
6191
- children: workspace.name
6192
- }
6193
- ),
6194
- workspace.ownerName && /* @__PURE__ */ jsxs14(
6195
- "span",
6196
- {
6197
- className: "truncate",
6198
- style: {
6199
- fontFamily: T11.font,
6200
- fontSize: T11.fsXs,
6201
- fontWeight: 400,
6202
- lineHeight: T11.lhXs,
6203
- color: T11.muted
6204
- },
6205
- children: [
6206
- "Created by ",
6207
- workspace.ownerName
6208
- ]
6209
- }
6210
- )
6211
- ] })
6212
- ] }),
6213
- /* @__PURE__ */ jsx17(
6214
- ScButton5,
6215
- {
6216
- text: joining ? "Joining\u2026" : "Join",
6217
- variant: "secondary",
6218
- size: "sm",
6219
- state: joining ? "disabled" : "default",
6220
- onClick: joining ? void 0 : onJoin
6221
- }
6222
- )
6164
+ )
6165
+ ] })
6223
6166
  ]
6224
6167
  }
6225
6168
  );
@@ -6347,8 +6290,7 @@ function OrganizationContent({
6347
6290
  const current = organization.current;
6348
6291
  const [members, setMembers] = useState10([]);
6349
6292
  const [workspaces, setWorkspaces] = useState10([]);
6350
- const canJoinShared = current?.role === "member" && !!organization.fetchJoinableWorkspaces && !!organization.joinWorkspaces;
6351
- const [joinable, setJoinable] = useState10([]);
6293
+ const canJoinShared = current?.role === "member" && !!organization.joinWorkspaces;
6352
6294
  const [joiningId, setJoiningId] = useState10(null);
6353
6295
  const [joinRequests, setJoinRequests] = useState10([]);
6354
6296
  const [highestRole, setHighestRole] = useState10("guest");
@@ -6359,20 +6301,12 @@ function OrganizationContent({
6359
6301
  if (!organization.current) return;
6360
6302
  setLoadingData(true);
6361
6303
  try {
6362
- const [
6363
- membersRes,
6364
- workspacesRes,
6365
- joinRequestsRes,
6366
- highestRoleRes,
6367
- joinableRes
6368
- ] = await Promise.all([
6304
+ const [membersRes, workspacesRes, joinRequestsRes, highestRoleRes] = await Promise.all([
6369
6305
  organization.fetchMembers().catch(() => null),
6370
6306
  organization.fetchWorkspaces().catch(() => null),
6371
6307
  organization.fetchJoinRequests().catch(() => null),
6372
- organization.getHighestRole?.().catch(() => null) ?? Promise.resolve(null),
6373
- canJoinShared ? organization.fetchJoinableWorkspaces().catch(() => null) : Promise.resolve(null)
6308
+ organization.getHighestRole?.().catch(() => null) ?? Promise.resolve(null)
6374
6309
  ]);
6375
- if (joinableRes) setJoinable(joinableRes);
6376
6310
  if (highestRoleRes?.role) setHighestRole(highestRoleRes.role);
6377
6311
  if (membersRes) setMembers(membersRes.filter((m) => m?.user));
6378
6312
  if (workspacesRes) setWorkspaces(workspacesRes);
@@ -6381,7 +6315,7 @@ function OrganizationContent({
6381
6315
  } finally {
6382
6316
  setLoadingData(false);
6383
6317
  }
6384
- }, [organization, canJoinShared]);
6318
+ }, [organization]);
6385
6319
  useEffect10(() => {
6386
6320
  fetchData();
6387
6321
  }, [fetchData]);
@@ -6630,21 +6564,12 @@ function OrganizationContent({
6630
6564
  {
6631
6565
  title: "Workspaces in this organization",
6632
6566
  empty: workspaces.length === 0,
6633
- children: workspaces.map((ws) => /* @__PURE__ */ jsx17(WorkspaceRow, { workspace: ws }, ws._id))
6634
- }
6635
- ),
6636
- canJoinShared && /* @__PURE__ */ jsx17(
6637
- Section,
6638
- {
6639
- title: "Shared workspaces you can join",
6640
- empty: joinable.length === 0,
6641
- emptyText: "You're in every shared workspace in this organization",
6642
- children: joinable.map((ws) => /* @__PURE__ */ jsx17(
6643
- JoinableWorkspaceRow,
6567
+ children: workspaces.map((ws) => /* @__PURE__ */ jsx17(
6568
+ WorkspaceRow,
6644
6569
  {
6645
6570
  workspace: ws,
6646
6571
  joining: joiningId === ws._id,
6647
- onJoin: () => void handleJoinWorkspace(ws)
6572
+ onJoin: canJoinShared && ws.joined === false && ws.orgVisibility === "shared" ? () => void handleJoinWorkspace(ws) : void 0
6648
6573
  },
6649
6574
  ws._id
6650
6575
  ))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamoid/settings",
3
- "version": "0.7.5",
3
+ "version": "0.7.6",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",