@basictech/react 0.12.0-beta.2 → 0.12.0-beta.4

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.js CHANGED
@@ -39,6 +39,11 @@ __export(index_exports, {
39
39
  BrowserKeyValueStorage: () => BrowserKeyValueStorage,
40
40
  BrowserTokenStore: () => BrowserTokenStore,
41
41
  PersistenceStore: () => PersistenceStore,
42
+ ShareInvites: () => ShareInvites,
43
+ ShareInvitesModal: () => ShareInvitesModal,
44
+ ShareRecipientAvatar: () => ShareRecipientAvatar,
45
+ ShareRecipientAvatars: () => ShareRecipientAvatars,
46
+ ShareRecipientLabel: () => ShareRecipientLabel,
42
47
  SharesModal: () => SharesModal,
43
48
  SignInButton: () => SignInButton,
44
49
  SignOutButton: () => SignOutButton,
@@ -67,13 +72,15 @@ __export(index_exports, {
67
72
  useQuery: () => useQuery,
68
73
  useRepos: () => useRepos,
69
74
  useSchemaStatus: () => useSchemaStatus,
75
+ useShareInvites: () => useShareInvites,
76
+ useShareRecipients: () => useShareRecipients,
70
77
  useStorageInfo: () => useStorageInfo,
71
78
  useSyncStatus: () => useSyncStatus
72
79
  });
73
80
  module.exports = __toCommonJS(index_exports);
74
81
 
75
82
  // src/create-basic.tsx
76
- var import_react12 = require("react");
83
+ var import_react13 = require("react");
77
84
 
78
85
  // src/context.ts
79
86
  var import_react = require("react");
@@ -1105,6 +1112,118 @@ function useProjectProfile(enabled = true) {
1105
1112
  return useProjectProfileFor(useRequiredClient(), enabled);
1106
1113
  }
1107
1114
 
1115
+ // src/hooks/invites.ts
1116
+ var import_react12 = require("react");
1117
+ var import_core7 = require("@basictech/core");
1118
+ function useShareInvitesFor(client, enabled = true) {
1119
+ const snapshot = useClientSnapshot(client);
1120
+ const accountId = snapshot.activeAccount?.id;
1121
+ const currentClient = (0, import_react12.useRef)(client);
1122
+ currentClient.current = client;
1123
+ const gate = useSignInGate(snapshot);
1124
+ const canLoad = enabled && snapshot.isReady && snapshot.isSignedIn;
1125
+ const result = useAsyncResult(
1126
+ async () => {
1127
+ try {
1128
+ return {
1129
+ client,
1130
+ accountId,
1131
+ data: await client.shares.listInvites(),
1132
+ error: null
1133
+ };
1134
+ } catch (error) {
1135
+ return {
1136
+ client,
1137
+ accountId,
1138
+ data: [],
1139
+ error: toBasicError(error)
1140
+ };
1141
+ }
1142
+ },
1143
+ null,
1144
+ canLoad,
1145
+ !enabled || snapshot.isReady,
1146
+ [client, accountId]
1147
+ );
1148
+ const current = result.data?.client === client && result.data.accountId === accountId ? result.data : null;
1149
+ const resolveContactHandle = (0, import_react12.useCallback)(
1150
+ (did) => client.shares.resolveContactHandle(did),
1151
+ [client]
1152
+ );
1153
+ const checkAccount = () => {
1154
+ if (currentClient.current !== client || client.getSnapshot().activeAccount?.id !== accountId)
1155
+ throw new import_core7.BasicError("ACCOUNT_CHANGED");
1156
+ };
1157
+ async function run(action, refresh = true) {
1158
+ checkAccount();
1159
+ try {
1160
+ const value = await action();
1161
+ checkAccount();
1162
+ return value;
1163
+ } catch (error) {
1164
+ checkAccount();
1165
+ throw error;
1166
+ } finally {
1167
+ if (refresh && currentClient.current === client && client.getSnapshot().activeAccount?.id === accountId)
1168
+ result.refresh();
1169
+ }
1170
+ }
1171
+ return {
1172
+ data: canLoad ? current?.data ?? [] : [],
1173
+ isLoading: enabled && (!snapshot.isReady || canLoad && (result.isLoading || !current)),
1174
+ error: enabled ? gate ?? (canLoad ? current?.error ?? null : null) : null,
1175
+ refresh: result.refresh,
1176
+ get: (id) => run(() => client.shares.getInvite(id), false),
1177
+ accept: (id) => run(() => client.shares.acceptInvite(id)),
1178
+ decline: (id) => run(() => client.shares.declineInvite(id)),
1179
+ delete: (id) => run(() => client.shares.deleteInvite(id)),
1180
+ resolveContactHandle
1181
+ };
1182
+ }
1183
+ function useShareInvites(enabled = true) {
1184
+ return useShareInvitesFor(useRequiredClient(), enabled);
1185
+ }
1186
+
1187
+ // src/hooks/recipients.ts
1188
+ function useShareRecipientsFor(client, dids) {
1189
+ const unique = [...new Set(dids)];
1190
+ const key = JSON.stringify(unique);
1191
+ const result = useAsyncResult(
1192
+ async () => {
1193
+ const handles = await Promise.allSettled(
1194
+ unique.map((did) => client.shares.resolveContactHandle(did))
1195
+ );
1196
+ const failed = handles.find((handle) => handle.status === "rejected");
1197
+ return {
1198
+ client,
1199
+ key,
1200
+ data: unique.map((did, index) => {
1201
+ const handle = handles[index];
1202
+ return {
1203
+ did,
1204
+ handle: handle.status === "fulfilled" ? handle.value : null
1205
+ };
1206
+ }),
1207
+ error: failed ? toBasicError(failed.reason) : null
1208
+ };
1209
+ },
1210
+ null,
1211
+ unique.length > 0,
1212
+ true,
1213
+ [client, key]
1214
+ );
1215
+ const current = result.data?.client === client && result.data.key === key ? result.data : null;
1216
+ return {
1217
+ data: current?.data ?? unique.map((did) => ({ did, handle: null })),
1218
+ isLoading: unique.length > 0 && (result.isLoading || !current),
1219
+ error: result.isLoading ? null : current?.error ?? null,
1220
+ refresh: result.refresh
1221
+ };
1222
+ }
1223
+ function useShareRecipients(dids) {
1224
+ return useShareRecipientsFor(useRequiredClient(), dids);
1225
+ }
1226
+
1108
1227
  // src/create-basic.tsx
1109
1228
  var import_jsx_runtime2 = require("react/jsx-runtime");
1110
1229
  function createBasic(config) {
@@ -1113,7 +1232,7 @@ function createBasic(config) {
1113
1232
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BasicProvider, { client, renderWhileLoading, children });
1114
1233
  }
1115
1234
  function useBound() {
1116
- if ((0, import_react12.useContext)(BasicClientContext) !== client) {
1235
+ if ((0, import_react13.useContext)(BasicClientContext) !== client) {
1117
1236
  throw new Error("Bound Basic hooks must be used within their own <basic.Provider>");
1118
1237
  }
1119
1238
  return client;
@@ -1137,22 +1256,145 @@ function createBasic(config) {
1137
1256
  useFiles: (query = {}, options = {}) => useFilesFor(useBound(), query, options),
1138
1257
  useStorageInfo: () => useStorageInfoFor(useBound()),
1139
1258
  useMounts: (query = {}) => useMountsFor(useBound(), query),
1140
- useOutgoingShares: () => useOutgoingSharesFor(useBound())
1259
+ useOutgoingShares: () => useOutgoingSharesFor(useBound()),
1260
+ useShareInvites: (enabled) => useShareInvitesFor(useBound(), enabled),
1261
+ useShareRecipients: (dids) => useShareRecipientsFor(useBound(), dids)
1141
1262
  };
1142
1263
  }
1143
1264
 
1144
1265
  // src/components.tsx
1145
- var import_react13 = require("react");
1266
+ var import_react15 = require("react");
1146
1267
  var import_avatar = require("@base-ui/react/avatar");
1147
1268
  var import_dialog = require("@base-ui/react/dialog");
1148
1269
  var import_menu = require("@base-ui/react/menu");
1149
1270
  var import_tabs = require("@base-ui/react/tabs");
1150
- var import_core7 = require("@basictech/core");
1271
+ var import_core8 = require("@basictech/core");
1272
+
1273
+ // src/avatar-marble.tsx
1274
+ var import_react14 = require("react");
1151
1275
  var import_jsx_runtime3 = require("react/jsx-runtime");
1152
- var AppearanceContext = (0, import_react13.createContext)({});
1276
+ var ELEMENTS = 3;
1277
+ var SIZE = 80;
1278
+ var COLORS = ["#92A1C6", "#146A7C", "#F0AB3D", "#C271B4", "#C20D90"];
1279
+ function hashCode(value) {
1280
+ let hash = 0;
1281
+ for (let index = 0; index < value.length; index += 1) {
1282
+ hash = (hash << 5) - hash + value.charCodeAt(index);
1283
+ hash &= hash;
1284
+ }
1285
+ return Math.abs(hash);
1286
+ }
1287
+ function getDigit(value, position) {
1288
+ return Math.floor(value / 10 ** position % 10);
1289
+ }
1290
+ function getUnit(value, range, position) {
1291
+ const unit = value % range;
1292
+ return position && getDigit(value, position) % 2 === 0 ? -unit : unit;
1293
+ }
1294
+ function generateProperties(seed) {
1295
+ const value = hashCode(seed);
1296
+ return Array.from({ length: ELEMENTS }, (_, index) => ({
1297
+ color: COLORS[(value + index) % COLORS.length],
1298
+ translateX: getUnit(value * (index + 1), SIZE / 10, 1),
1299
+ translateY: getUnit(value * (index + 1), SIZE / 10, 2),
1300
+ scale: 1.2 + getUnit(value * (index + 1), SIZE / 20) / 10,
1301
+ rotate: getUnit(value * (index + 1), 360, 1)
1302
+ }));
1303
+ }
1304
+ function MarbleAvatar({ seed }) {
1305
+ const properties = generateProperties(seed);
1306
+ const instanceId = (0, import_react14.useId)().replaceAll(":", "");
1307
+ const maskId = `basic-avatar-mask-${instanceId}`;
1308
+ const filterId = `basic-avatar-filter-${instanceId}`;
1309
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1310
+ "svg",
1311
+ {
1312
+ viewBox: `0 0 ${SIZE} ${SIZE}`,
1313
+ width: "100%",
1314
+ height: "100%",
1315
+ fill: "none",
1316
+ xmlns: "http://www.w3.org/2000/svg",
1317
+ "aria-hidden": "true",
1318
+ focusable: "false",
1319
+ children: [
1320
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1321
+ "mask",
1322
+ {
1323
+ id: maskId,
1324
+ maskUnits: "userSpaceOnUse",
1325
+ x: "0",
1326
+ y: "0",
1327
+ width: SIZE,
1328
+ height: SIZE,
1329
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("rect", { width: SIZE, height: SIZE, rx: SIZE * 2, fill: "#FFFFFF" })
1330
+ }
1331
+ ),
1332
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("g", { mask: `url(#${maskId})`, children: [
1333
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("rect", { width: SIZE, height: SIZE, fill: properties[0].color }),
1334
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1335
+ "path",
1336
+ {
1337
+ filter: `url(#${filterId})`,
1338
+ d: "M32.414 59.35L50.376 70.5H72.5v-71H33.728L26.5 13.381l19.057 27.08L32.414 59.35z",
1339
+ fill: properties[1].color,
1340
+ transform: `translate(${properties[1].translateX} ${properties[1].translateY}) rotate(${properties[1].rotate} ${SIZE / 2} ${SIZE / 2}) scale(${properties[2].scale})`
1341
+ }
1342
+ ),
1343
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1344
+ "path",
1345
+ {
1346
+ filter: `url(#${filterId})`,
1347
+ style: { mixBlendMode: "overlay" },
1348
+ d: "M22.216 24L0 46.75l14.108 38.129L78 86l-3.081-59.276-22.378 4.005 12.972 20.186-23.35 27.395L22.215 24z",
1349
+ fill: properties[2].color,
1350
+ transform: `translate(${properties[2].translateX} ${properties[2].translateY}) rotate(${properties[2].rotate} ${SIZE / 2} ${SIZE / 2}) scale(${properties[2].scale})`
1351
+ }
1352
+ )
1353
+ ] }),
1354
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1355
+ "filter",
1356
+ {
1357
+ id: filterId,
1358
+ filterUnits: "userSpaceOnUse",
1359
+ colorInterpolationFilters: "sRGB",
1360
+ children: [
1361
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("feFlood", { floodOpacity: "0", result: "BackgroundImageFix" }),
1362
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1363
+ "feBlend",
1364
+ {
1365
+ in: "SourceGraphic",
1366
+ in2: "BackgroundImageFix",
1367
+ result: "shape"
1368
+ }
1369
+ ),
1370
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("feGaussianBlur", { stdDeviation: "7", result: "effect1_foregroundBlur" })
1371
+ ]
1372
+ }
1373
+ ) })
1374
+ ]
1375
+ }
1376
+ );
1377
+ }
1378
+
1379
+ // src/components.tsx
1380
+ var import_jsx_runtime4 = require("react/jsx-runtime");
1381
+ var AppearanceContext = (0, import_react15.createContext)({});
1382
+ function accentText(accent) {
1383
+ if (!/^#([\da-f]{3}|[\da-f]{6})$/i.test(accent)) return "#fff";
1384
+ const hex = accent.length === 4 ? accent.slice(1).split("").map((digit) => digit + digit).join("") : accent.slice(1);
1385
+ const [red, green, blue] = [0, 2, 4].map((offset) => {
1386
+ const channel = parseInt(hex.slice(offset, offset + 2), 16) / 255;
1387
+ return channel <= 0.04045 ? channel / 12.92 : ((channel + 0.055) / 1.055) ** 2.4;
1388
+ });
1389
+ return 0.2126 * red + 0.7152 * green + 0.0722 * blue > 0.179 ? "#000" : "#fff";
1390
+ }
1153
1391
  function appearanceStyle(appearance) {
1154
1392
  return {
1155
- ...appearance.accent ? { "--basic-accent": appearance.accent } : {},
1393
+ ...appearance.base ? { "--basic-surface": appearance.base } : {},
1394
+ ...appearance.accent ? {
1395
+ "--basic-accent": appearance.accent,
1396
+ "--basic-accent-text": accentText(appearance.accent)
1397
+ } : {},
1156
1398
  ...appearance.radius ? { "--basic-radius": appearance.radius } : {}
1157
1399
  };
1158
1400
  }
@@ -1160,9 +1402,9 @@ function BasicUIProvider({
1160
1402
  appearance = {},
1161
1403
  children
1162
1404
  }) {
1163
- const parent = (0, import_react13.useContext)(AppearanceContext);
1405
+ const parent = (0, import_react15.useContext)(AppearanceContext);
1164
1406
  const value = { ...parent, ...appearance };
1165
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(AppearanceContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1407
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AppearanceContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1166
1408
  "div",
1167
1409
  {
1168
1410
  className: "basic-ui",
@@ -1174,16 +1416,16 @@ function BasicUIProvider({
1174
1416
  ) });
1175
1417
  }
1176
1418
  function useAppearanceProps() {
1177
- const appearance = (0, import_react13.useContext)(AppearanceContext);
1419
+ const appearance = (0, import_react15.useContext)(AppearanceContext);
1178
1420
  return {
1179
1421
  "data-theme": appearance.theme ?? "light",
1180
1422
  "data-density": appearance.density ?? "comfortable",
1181
1423
  style: appearanceStyle(appearance)
1182
1424
  };
1183
1425
  }
1184
- var BasicButton = (0, import_react13.forwardRef)(
1426
+ var BasicButton = (0, import_react15.forwardRef)(
1185
1427
  function BasicButton2({ variant = "outline", className = "", type = "button", ...props }, ref) {
1186
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1428
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1187
1429
  "button",
1188
1430
  {
1189
1431
  ...props,
@@ -1196,11 +1438,11 @@ var BasicButton = (0, import_react13.forwardRef)(
1196
1438
  }
1197
1439
  );
1198
1440
  function useAction() {
1199
- const [pending, setPending] = (0, import_react13.useState)(false);
1200
- const [error, setError] = (0, import_react13.useState)(null);
1201
- const busy = (0, import_react13.useRef)(false);
1202
- const mounted = (0, import_react13.useRef)(true);
1203
- (0, import_react13.useEffect)(() => {
1441
+ const [pending, setPending] = (0, import_react15.useState)(false);
1442
+ const [error, setError] = (0, import_react15.useState)(null);
1443
+ const busy = (0, import_react15.useRef)(false);
1444
+ const mounted = (0, import_react15.useRef)(true);
1445
+ (0, import_react15.useEffect)(() => {
1204
1446
  mounted.current = true;
1205
1447
  return () => {
1206
1448
  mounted.current = false;
@@ -1216,7 +1458,7 @@ function useAction() {
1216
1458
  } catch (cause) {
1217
1459
  if (mounted.current)
1218
1460
  setError(
1219
- cause instanceof import_core7.BasicError && cause.code === "REDIRECT_URI_NOT_REGISTERED" ? "Sign-in is unavailable on this URL. Ask the app owner to register its callback URL in project settings." : cause instanceof Error ? cause.message : "The action failed. Please try again."
1461
+ cause instanceof import_core8.BasicError && cause.code === "REDIRECT_URI_NOT_REGISTERED" ? "Sign-in is unavailable on this URL. Ask the app owner to register its callback URL in project settings." : cause instanceof Error ? cause.message : "The action failed. Please try again."
1220
1462
  );
1221
1463
  } finally {
1222
1464
  busy.current = false;
@@ -1238,8 +1480,8 @@ function AuthButton({
1238
1480
  const auth = supplied ?? live;
1239
1481
  const action = useAction();
1240
1482
  const expired = auth.status === "expired";
1241
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "basic-action", children: [
1242
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1483
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "basic-action", children: [
1484
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1243
1485
  BasicButton,
1244
1486
  {
1245
1487
  ...props,
@@ -1255,29 +1497,44 @@ function AuthButton({
1255
1497
  children: action.pending ? "Please wait\u2026" : children ?? (signOut ? "Sign out" : expired ? "Sign in again" : "Sign in")
1256
1498
  }
1257
1499
  ),
1258
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ActionError, { error: action.error, onClose: action.clearError })
1500
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ActionError, { error: action.error, onClose: action.clearError })
1259
1501
  ] });
1260
1502
  }
1261
1503
  function SignInButton(props) {
1262
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(AuthButton, { ...props });
1504
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AuthButton, { ...props });
1263
1505
  }
1264
1506
  function SignOutButton(props) {
1265
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(AuthButton, { ...props, signOut: true });
1507
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AuthButton, { ...props, signOut: true });
1508
+ }
1509
+ var ANONYMOUS_ACCOUNT_NAME = "Local User";
1510
+ function accountName(profile, emptyFallback = "Guest") {
1511
+ if (!profile) return emptyFallback;
1512
+ return profile.name || (profile.kind === "anon" ? ANONYMOUS_ACCOUNT_NAME : displayHandle(profile.handle) || profile.email || "Account");
1513
+ }
1514
+ function avatarSeed(profile) {
1515
+ if (!profile) return "guest";
1516
+ return profile.did || profile.id && `account:${profile.id}` || profile.handle || profile.email || profile.name || "guest";
1266
1517
  }
1267
1518
  function UserAvatar({
1268
1519
  accounts,
1269
1520
  auth,
1270
1521
  projectProfile,
1522
+ invites,
1523
+ showInvites,
1271
1524
  allowAddAccount,
1525
+ menuItems,
1272
1526
  ...avatarProps
1273
1527
  }) {
1274
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1528
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1275
1529
  UserMenu,
1276
1530
  {
1277
1531
  accounts,
1278
1532
  auth,
1279
1533
  projectProfile,
1534
+ invites,
1535
+ showInvites,
1280
1536
  allowAddAccount,
1537
+ menuItems,
1281
1538
  sync: avatarProps.sync,
1282
1539
  showSyncBadge: avatarProps.showSyncBadge,
1283
1540
  avatarProps
@@ -1289,25 +1546,34 @@ function AccountAvatar({
1289
1546
  size = 32,
1290
1547
  showSyncBadge,
1291
1548
  sync,
1292
- className = "",
1293
- style,
1294
1549
  ...props
1295
1550
  }) {
1296
1551
  const accounts = useAccounts();
1297
1552
  const client = useRequiredClient();
1298
1553
  const profile = supplied === void 0 ? accounts.activeAccount : supplied;
1299
- const name = profile?.name || (profile?.kind === "anon" ? "Local account" : profile?.handle || profile?.email || "Guest");
1300
- const initials = name.trim().split(/\s+/).slice(0, 2).map((part) => Array.from(part)[0]).join("").toUpperCase();
1301
- const avatar = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1554
+ const avatar = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ProfileAvatar, { ...props, profile, size });
1555
+ return showSyncBadge ?? client.mode === "sync" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "basic-avatar-container", children: [
1556
+ avatar,
1557
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SyncStatus, { sync, className: "basic-avatar-sync" })
1558
+ ] }) : avatar;
1559
+ }
1560
+ function ProfileAvatar({
1561
+ profile,
1562
+ size = 32,
1563
+ className = "",
1564
+ style,
1565
+ ...props
1566
+ }) {
1567
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1302
1568
  import_avatar.Avatar.Root,
1303
1569
  {
1304
1570
  ...props,
1305
1571
  className: `basic-avatar ${className}`,
1306
1572
  style: { width: size, height: size, ...style },
1307
1573
  role: "img",
1308
- "aria-label": props["aria-label"] ?? name,
1574
+ "aria-label": props["aria-label"] ?? accountName(profile),
1309
1575
  children: [
1310
- profile?.picture && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1576
+ profile?.picture && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1311
1577
  import_avatar.Avatar.Image,
1312
1578
  {
1313
1579
  src: profile.picture,
@@ -1316,14 +1582,100 @@ function AccountAvatar({
1316
1582
  referrerPolicy: "no-referrer"
1317
1583
  }
1318
1584
  ),
1319
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_avatar.Avatar.Fallback, { className: "basic-avatar-fallback", children: initials || "?" })
1585
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_avatar.Avatar.Fallback, { className: "basic-avatar-fallback", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(MarbleAvatar, { seed: avatarSeed(profile) }) })
1586
+ ]
1587
+ }
1588
+ );
1589
+ }
1590
+ function ShareRecipientAvatar({
1591
+ recipient,
1592
+ ...props
1593
+ }) {
1594
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1595
+ ProfileAvatar,
1596
+ {
1597
+ title: displayHandle(recipient.handle) || recipient.name || recipient.did,
1598
+ ...props,
1599
+ profile: {
1600
+ ...recipient,
1601
+ name: recipient.name || displayHandle(recipient.handle) || recipient.did,
1602
+ kind: "account"
1603
+ }
1604
+ }
1605
+ );
1606
+ }
1607
+ function ShareRecipientLabel({
1608
+ recipient,
1609
+ size = 24,
1610
+ className = "",
1611
+ ...props
1612
+ }) {
1613
+ const label = displayHandle(recipient.handle) || recipient.name || "Unknown user";
1614
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1615
+ "span",
1616
+ {
1617
+ title: recipient.did,
1618
+ ...props,
1619
+ className: `basic-recipient-label ${className}`,
1620
+ children: [
1621
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1622
+ ShareRecipientAvatar,
1623
+ {
1624
+ recipient,
1625
+ size,
1626
+ "aria-hidden": "true",
1627
+ title: void 0
1628
+ }
1629
+ ),
1630
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "basic-recipient-handle", children: label })
1631
+ ]
1632
+ }
1633
+ );
1634
+ }
1635
+ function ShareRecipientAvatars({
1636
+ recipients,
1637
+ size = 32,
1638
+ max = 4,
1639
+ className = "",
1640
+ ...props
1641
+ }) {
1642
+ const unique = [
1643
+ ...new Map(
1644
+ recipients.map((recipient) => [recipient.did, recipient])
1645
+ ).values()
1646
+ ];
1647
+ const visible = unique.slice(0, Math.max(1, max));
1648
+ const remaining = unique.length - visible.length;
1649
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1650
+ "span",
1651
+ {
1652
+ ...props,
1653
+ className: `basic-recipient-avatars ${className}`,
1654
+ role: "group",
1655
+ "aria-label": props["aria-label"] ?? `Shared with ${unique.length} recipients`,
1656
+ children: [
1657
+ visible.map((recipient) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1658
+ ShareRecipientAvatar,
1659
+ {
1660
+ recipient,
1661
+ size
1662
+ },
1663
+ recipient.did
1664
+ )),
1665
+ remaining > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1666
+ "span",
1667
+ {
1668
+ className: "basic-recipient-overflow",
1669
+ "aria-label": `${remaining} more recipients`,
1670
+ children: [
1671
+ "+",
1672
+ remaining
1673
+ ]
1674
+ }
1675
+ )
1320
1676
  ]
1321
1677
  }
1322
1678
  );
1323
- return showSyncBadge ?? client.mode === "sync" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "basic-avatar-container", children: [
1324
- avatar,
1325
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SyncStatus, { sync, className: "basic-avatar-sync" })
1326
- ] }) : avatar;
1327
1679
  }
1328
1680
  function AuthStatus({
1329
1681
  auth: supplied,
@@ -1334,7 +1686,7 @@ function AuthStatus({
1334
1686
  const auth = supplied ?? live;
1335
1687
  const expired = auth.status === "expired";
1336
1688
  const label = !auth.isReady || auth.status === "bootstrapping" ? "Checking session" : expired ? "Session expired" : auth.status === "recovering" ? "Reconnecting session" : auth.isSignedIn ? "Signed in" : auth.isAnonymous ? "Guest \xB7 local only" : "Signed out";
1337
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1689
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1338
1690
  "span",
1339
1691
  {
1340
1692
  ...props,
@@ -1342,7 +1694,7 @@ function AuthStatus({
1342
1694
  className: `basic-status ${className}`,
1343
1695
  "data-tone": expired || auth.error ? "warning" : auth.isSignedIn ? "success" : "neutral",
1344
1696
  children: [
1345
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "basic-dot" }),
1697
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "basic-dot" }),
1346
1698
  label
1347
1699
  ]
1348
1700
  }
@@ -1372,7 +1724,7 @@ function SyncStatus({
1372
1724
  ended: "Access ended"
1373
1725
  };
1374
1726
  const label = issues ? `${issues} sync ${issues === 1 ? "issue" : "issues"}` : sync.status === "online" && sync.pendingCount ? "Syncing" : labels[sync.status];
1375
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1727
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1376
1728
  "span",
1377
1729
  {
1378
1730
  ...props,
@@ -1381,7 +1733,7 @@ function SyncStatus({
1381
1733
  className: `basic-status ${className}`,
1382
1734
  "data-tone": issues || ["error", "stale", "ended"].includes(sync.status) ? "warning" : sync.status === "online" && !sync.pendingCount ? "success" : ["bootstrapping", "connecting"].includes(sync.status) || sync.status === "online" && sync.pendingCount > 0 ? "progress" : "neutral",
1383
1735
  children: [
1384
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "basic-dot" }),
1736
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "basic-dot" }),
1385
1737
  label,
1386
1738
  sync.pendingCount > 0 && ` \xB7 ${sync.pendingCount} pending`
1387
1739
  ]
@@ -1392,7 +1744,7 @@ function displayHandle(handle) {
1392
1744
  return handle ? `@${handle.replace(/^@+/, "")}` : "";
1393
1745
  }
1394
1746
  function UserButton(props) {
1395
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(UserMenu, { ...props, trigger: "button" });
1747
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(UserMenu, { ...props, trigger: "button" });
1396
1748
  }
1397
1749
  function UserMenu({
1398
1750
  accounts: supplied,
@@ -1404,28 +1756,31 @@ function UserMenu({
1404
1756
  trigger = "avatar",
1405
1757
  avatarProps,
1406
1758
  projectProfile,
1759
+ invites,
1760
+ showInvites,
1407
1761
  allowAddAccount = true,
1408
1762
  className = "",
1409
- accountSettingsUrl
1763
+ accountSettingsUrl,
1764
+ menuItems = []
1410
1765
  }) {
1411
1766
  const liveAccounts = useAccounts();
1412
1767
  const liveAuth = useAuth();
1413
1768
  const accounts = supplied ?? liveAccounts;
1414
1769
  const auth = suppliedAuth ?? liveAuth;
1415
1770
  const action = useAction();
1416
- const [settingsOpen, setSettingsOpen] = (0, import_react13.useState)(false);
1417
- const [clearAccountId, setClearAccountId] = (0, import_react13.useState)(null);
1418
- const triggerRef = (0, import_react13.useRef)(null);
1771
+ const [settingsOpen, setSettingsOpen] = (0, import_react15.useState)(false);
1772
+ const [clearAccountId, setClearAccountId] = (0, import_react15.useState)(null);
1773
+ const triggerRef = (0, import_react15.useRef)(null);
1419
1774
  const appearance = useAppearanceProps();
1420
1775
  const expired = auth.status === "expired";
1421
1776
  const active = accounts.activeAccount;
1422
1777
  const otherAccounts = accounts.accounts.filter(
1423
1778
  (account) => account.id !== active?.id
1424
1779
  );
1425
- const name = active?.name || active?.kind !== "anon" && displayHandle(active?.handle) || "Local account";
1426
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: `basic-action ${className}`, children: [
1427
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_menu.Menu.Root, { children: [
1428
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1780
+ const name = active ? accountName(active) : "Local account";
1781
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: `basic-action ${className}`, children: [
1782
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_menu.Menu.Root, { children: [
1783
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1429
1784
  import_menu.Menu.Trigger,
1430
1785
  {
1431
1786
  ref: triggerRef,
@@ -1434,7 +1789,7 @@ function UserMenu({
1434
1789
  disabled: !auth.isReady || action.pending,
1435
1790
  "aria-label": "Open user menu",
1436
1791
  children: [
1437
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1792
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1438
1793
  AccountAvatar,
1439
1794
  {
1440
1795
  profile: accounts.activeAccount,
@@ -1443,12 +1798,12 @@ function UserMenu({
1443
1798
  ...avatarProps
1444
1799
  }
1445
1800
  ),
1446
- trigger === "button" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
1447
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "basic-identity", children: [
1448
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { children: name }),
1449
- active?.kind !== "anon" && active?.handle && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("small", { children: displayHandle(active.handle) })
1801
+ trigger === "button" && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
1802
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "basic-identity", children: [
1803
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: name }),
1804
+ active?.kind !== "anon" && active?.handle && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("small", { children: displayHandle(active.handle) })
1450
1805
  ] }),
1451
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1806
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1452
1807
  "svg",
1453
1808
  {
1454
1809
  className: "basic-chevron",
@@ -1461,16 +1816,16 @@ function UserMenu({
1461
1816
  strokeLinecap: "round",
1462
1817
  strokeLinejoin: "round",
1463
1818
  "aria-hidden": "true",
1464
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "m6 9 6 6 6-6" })
1819
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "m6 9 6 6 6-6" })
1465
1820
  }
1466
1821
  )
1467
1822
  ] })
1468
1823
  ]
1469
1824
  }
1470
1825
  ),
1471
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_menu.Menu.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_menu.Menu.Positioner, { sideOffset: 8, className: "basic-positioner", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_menu.Menu.Popup, { ...appearance, className: "basic-ui basic-menu", children: [
1472
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "basic-menu-profile", children: [
1473
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1826
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_menu.Menu.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_menu.Menu.Positioner, { sideOffset: 8, className: "basic-positioner", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_menu.Menu.Popup, { ...appearance, className: "basic-ui basic-menu", children: [
1827
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "basic-menu-profile", children: [
1828
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1474
1829
  AccountAvatar,
1475
1830
  {
1476
1831
  profile: active,
@@ -1479,16 +1834,16 @@ function UserMenu({
1479
1834
  showSyncBadge: false
1480
1835
  }
1481
1836
  ),
1482
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "basic-identity", children: [
1483
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { children: active ? name : "No active account" }),
1484
- active?.kind !== "anon" && active?.handle && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("small", { children: displayHandle(active.handle) }),
1485
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "basic-account-statuses", children: [
1486
- expired && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "basic-status", "data-tone": "warning", children: "Expired" }),
1487
- showSyncStatus && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SyncStatus, { sync })
1837
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "basic-identity", children: [
1838
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: active ? name : "No active account" }),
1839
+ active?.kind !== "anon" && active?.handle && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("small", { children: displayHandle(active.handle) }),
1840
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "basic-account-statuses", children: [
1841
+ expired && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "basic-status", "data-tone": "warning", children: "Expired" }),
1842
+ showSyncStatus && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SyncStatus, { sync })
1488
1843
  ] })
1489
1844
  ] })
1490
1845
  ] }),
1491
- expired && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1846
+ expired && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1492
1847
  import_menu.Menu.Item,
1493
1848
  {
1494
1849
  className: "basic-menu-item basic-menu-reauth",
@@ -1497,13 +1852,13 @@ function UserMenu({
1497
1852
  children: "Sign in again"
1498
1853
  }
1499
1854
  ),
1500
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1855
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1501
1856
  import_menu.Menu.Item,
1502
1857
  {
1503
1858
  className: "basic-menu-item basic-manage-account",
1504
1859
  onClick: () => setSettingsOpen(true),
1505
1860
  children: [
1506
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1861
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1507
1862
  "svg",
1508
1863
  {
1509
1864
  className: "basic-menu-icon",
@@ -1517,8 +1872,8 @@ function UserMenu({
1517
1872
  strokeLinejoin: "round",
1518
1873
  "aria-hidden": "true",
1519
1874
  children: [
1520
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { cx: "12", cy: "7", r: "4" }),
1521
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2" })
1875
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("circle", { cx: "12", cy: "7", r: "4" }),
1876
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2" })
1522
1877
  ]
1523
1878
  }
1524
1879
  ),
@@ -1526,14 +1881,30 @@ function UserMenu({
1526
1881
  ]
1527
1882
  }
1528
1883
  ),
1529
- (auth.isSignedIn || expired || active?.kind === "anon") && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1884
+ menuItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1885
+ import_menu.Menu.Item,
1886
+ {
1887
+ className: "basic-menu-item",
1888
+ render: item.href !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("a", { href: item.href }) : void 0,
1889
+ disabled: item.disabled || action.pending,
1890
+ onClick: () => {
1891
+ if (item.onClick) void action.run(item.onClick);
1892
+ },
1893
+ children: [
1894
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "basic-menu-icon", "aria-hidden": "true", children: item.icon }),
1895
+ item.label
1896
+ ]
1897
+ },
1898
+ item.id
1899
+ )),
1900
+ (auth.isSignedIn || expired || active?.kind === "anon") && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1530
1901
  import_menu.Menu.Item,
1531
1902
  {
1532
1903
  className: "basic-menu-item basic-menu-signout",
1533
1904
  disabled: action.pending,
1534
1905
  onClick: () => active?.kind === "anon" ? setClearAccountId(active.id) : void action.run(() => auth.signOut()),
1535
1906
  children: [
1536
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1907
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1537
1908
  "svg",
1538
1909
  {
1539
1910
  className: "basic-menu-icon",
@@ -1546,25 +1917,25 @@ function UserMenu({
1546
1917
  strokeLinecap: "round",
1547
1918
  strokeLinejoin: "round",
1548
1919
  "aria-hidden": "true",
1549
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4M16 17l5-5-5-5M21 12H9" })
1920
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4M16 17l5-5-5-5M21 12H9" })
1550
1921
  }
1551
1922
  ),
1552
1923
  active?.kind === "anon" ? "Clear account" : "Sign out"
1553
1924
  ]
1554
1925
  }
1555
1926
  ),
1556
- otherAccounts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
1557
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_menu.Menu.Separator, { className: "basic-separator" }),
1558
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "basic-menu-heading", children: "Switch accounts" })
1927
+ otherAccounts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
1928
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_menu.Menu.Separator, { className: "basic-separator" }),
1929
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "basic-menu-heading", children: "Switch accounts" })
1559
1930
  ] }),
1560
- otherAccounts.map((account) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1931
+ otherAccounts.map((account) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1561
1932
  import_menu.Menu.Item,
1562
1933
  {
1563
1934
  className: "basic-menu-item",
1564
1935
  disabled: action.pending,
1565
1936
  onClick: () => void action.run(() => accounts.switchAccount(account.id)),
1566
1937
  children: [
1567
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1938
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1568
1939
  AccountAvatar,
1569
1940
  {
1570
1941
  profile: account,
@@ -1573,16 +1944,16 @@ function UserMenu({
1573
1944
  showSyncBadge: false
1574
1945
  }
1575
1946
  ),
1576
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "basic-identity", children: [
1577
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { children: account.name || account.kind !== "anon" && displayHandle(account.handle) || (account.kind === "anon" ? "Local account" : "Account") }),
1578
- account.kind !== "anon" && account.handle && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("small", { children: displayHandle(account.handle) })
1947
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "basic-identity", children: [
1948
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: accountName(account, "Account") }),
1949
+ account.kind !== "anon" && account.handle && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("small", { children: displayHandle(account.handle) })
1579
1950
  ] }),
1580
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "basic-account-statuses", children: account.auth.status === "expired" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "basic-status", "data-tone": "warning", children: "Expired" }) : null })
1951
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "basic-account-statuses", children: account.auth.status === "expired" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "basic-status", "data-tone": "warning", children: "Expired" }) : null })
1581
1952
  ]
1582
1953
  },
1583
1954
  account.id
1584
1955
  )),
1585
- (allowAddAccount || !auth.isSignedIn && !expired) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1956
+ (allowAddAccount || !auth.isSignedIn && !expired) && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1586
1957
  import_menu.Menu.Item,
1587
1958
  {
1588
1959
  className: "basic-menu-item",
@@ -1590,12 +1961,29 @@ function UserMenu({
1590
1961
  onClick: () => void action.run(
1591
1962
  () => allowAddAccount ? accounts.addAccount({ signIn: true }) : auth.signIn()
1592
1963
  ),
1593
- children: "\uFF0B Add account"
1964
+ children: [
1965
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1966
+ "svg",
1967
+ {
1968
+ className: "basic-menu-icon",
1969
+ width: "16",
1970
+ height: "16",
1971
+ viewBox: "0 0 24 24",
1972
+ fill: "none",
1973
+ stroke: "currentColor",
1974
+ strokeWidth: "1.75",
1975
+ strokeLinecap: "round",
1976
+ "aria-hidden": "true",
1977
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M12 5v14M5 12h14" })
1978
+ }
1979
+ ),
1980
+ "Add account"
1981
+ ]
1594
1982
  }
1595
1983
  )
1596
1984
  ] }) }) })
1597
1985
  ] }),
1598
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1986
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1599
1987
  ActionError,
1600
1988
  {
1601
1989
  error: action.error,
@@ -1603,7 +1991,7 @@ function UserMenu({
1603
1991
  finalFocus: triggerRef
1604
1992
  }
1605
1993
  ),
1606
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1994
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1607
1995
  Modal,
1608
1996
  {
1609
1997
  open: clearAccountId !== null,
@@ -1614,8 +2002,8 @@ function UserMenu({
1614
2002
  finalFocus: triggerRef,
1615
2003
  title: "Clear local account?",
1616
2004
  description: "This deletes this account\u2019s local data, including unsynced changes. This cannot be undone.",
1617
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "basic-actions", children: [
1618
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2005
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "basic-actions", children: [
2006
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1619
2007
  BasicButton,
1620
2008
  {
1621
2009
  disabled: action.pending,
@@ -1623,7 +2011,7 @@ function UserMenu({
1623
2011
  children: "Cancel"
1624
2012
  }
1625
2013
  ),
1626
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2014
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1627
2015
  BasicButton,
1628
2016
  {
1629
2017
  disabled: action.pending,
@@ -1639,7 +2027,7 @@ function UserMenu({
1639
2027
  ] })
1640
2028
  }
1641
2029
  ),
1642
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2030
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1643
2031
  AccountSettingsModal,
1644
2032
  {
1645
2033
  auth,
@@ -1650,6 +2038,8 @@ function UserMenu({
1650
2038
  finalFocus: triggerRef,
1651
2039
  accountSettingsUrl,
1652
2040
  projectProfile,
2041
+ invites,
2042
+ showInvites,
1653
2043
  sync
1654
2044
  }
1655
2045
  )
@@ -1660,7 +2050,7 @@ function ActionError({
1660
2050
  onClose,
1661
2051
  finalFocus
1662
2052
  }) {
1663
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
2053
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1664
2054
  Modal,
1665
2055
  {
1666
2056
  open: !!error,
@@ -1672,8 +2062,8 @@ function ActionError({
1672
2062
  title: "Unable to complete action",
1673
2063
  description: "Your request could not be completed.",
1674
2064
  children: [
1675
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { role: "alert", className: "basic-error", children: error }),
1676
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(BasicButton, { onClick: onClose, children: "Dismiss" })
2065
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { role: "alert", className: "basic-error", children: error }),
2066
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(BasicButton, { onClick: onClose, children: "Dismiss" })
1677
2067
  ]
1678
2068
  }
1679
2069
  );
@@ -1685,29 +2075,36 @@ function Modal({
1685
2075
  finalFocus,
1686
2076
  title,
1687
2077
  description,
2078
+ hideTitle = false,
1688
2079
  header,
1689
2080
  sectionLabel,
1690
2081
  children
1691
2082
  }) {
1692
2083
  const appearance = useAppearanceProps();
1693
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_dialog.Dialog.Root, { open, onOpenChange, children: [
1694
- trigger !== null && ((0, import_react13.isValidElement)(trigger) ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dialog.Dialog.Trigger, { render: trigger }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dialog.Dialog.Trigger, { render: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(BasicButton, {}), children: trigger ?? title })),
1695
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_dialog.Dialog.Portal, { children: [
1696
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dialog.Dialog.Backdrop, { className: "basic-backdrop" }),
1697
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
2084
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_dialog.Dialog.Root, { open, onOpenChange, children: [
2085
+ trigger !== null && ((0, import_react15.isValidElement)(trigger) ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dialog.Dialog.Trigger, { render: trigger }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dialog.Dialog.Trigger, { render: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(BasicButton, {}), children: trigger ?? title })),
2086
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_dialog.Dialog.Portal, { children: [
2087
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dialog.Dialog.Backdrop, { className: "basic-backdrop" }),
2088
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1698
2089
  import_dialog.Dialog.Popup,
1699
2090
  {
1700
2091
  ...appearance,
1701
2092
  finalFocus,
1702
2093
  className: "basic-ui basic-dialog",
1703
2094
  children: [
1704
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
2095
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1705
2096
  "div",
1706
2097
  {
1707
- className: `basic-dialog-heading${header ? " basic-dialog-heading-overlay" : ""}`,
2098
+ className: `basic-dialog-heading${header || hideTitle ? " basic-dialog-heading-overlay" : ""}`,
1708
2099
  children: [
1709
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dialog.Dialog.Title, { className: header ? "basic-sr-only" : "basic-title", children: title }),
1710
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2100
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2101
+ import_dialog.Dialog.Title,
2102
+ {
2103
+ className: header || hideTitle ? "basic-sr-only" : "basic-title",
2104
+ children: title
2105
+ }
2106
+ ),
2107
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1711
2108
  import_dialog.Dialog.Close,
1712
2109
  {
1713
2110
  className: "basic-button",
@@ -1719,14 +2116,14 @@ function Modal({
1719
2116
  }
1720
2117
  ),
1721
2118
  header,
1722
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2119
+ description && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1723
2120
  import_dialog.Dialog.Description,
1724
2121
  {
1725
2122
  className: header ? "basic-sr-only" : "basic-muted",
1726
2123
  children: description
1727
2124
  }
1728
2125
  ),
1729
- sectionLabel && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "basic-modal-section", children: sectionLabel }),
2126
+ sectionLabel && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "basic-modal-section", children: sectionLabel }),
1730
2127
  children
1731
2128
  ]
1732
2129
  }
@@ -1739,6 +2136,8 @@ function AccountSettingsModal({
1739
2136
  accounts: suppliedAccounts,
1740
2137
  accountSettingsUrl,
1741
2138
  projectProfile,
2139
+ invites,
2140
+ showInvites = true,
1742
2141
  sync,
1743
2142
  children,
1744
2143
  ...props
@@ -1752,7 +2151,7 @@ function AccountSettingsModal({
1752
2151
  const client = useRequiredClient();
1753
2152
  const account = accounts.activeAccount;
1754
2153
  const copyAction = useAction();
1755
- const [copied, setCopied] = (0, import_react13.useState)(null);
2154
+ const [copied, setCopied] = (0, import_react15.useState)(null);
1756
2155
  const details = [
1757
2156
  [
1758
2157
  "Account DID",
@@ -1777,27 +2176,28 @@ function AccountSettingsModal({
1777
2176
  ["Conflicts", String(syncState.conflicts.length)]
1778
2177
  ];
1779
2178
  const diagnostics = JSON.stringify(Object.fromEntries(details), null, 2);
1780
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2179
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1781
2180
  Modal,
1782
2181
  {
1783
2182
  ...props,
1784
2183
  title: "Account settings",
1785
2184
  description: "Your identity and session on this device.",
1786
- header: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(AccountHeader, { account: accounts.activeAccount, sync }),
1787
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_tabs.Tabs.Root, { defaultValue: "profile", children: [
1788
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
2185
+ header: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AccountHeader, { account: accounts.activeAccount, sync }),
2186
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_tabs.Tabs.Root, { defaultValue: "profile", children: [
2187
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1789
2188
  import_tabs.Tabs.List,
1790
2189
  {
1791
2190
  className: "basic-tabs",
1792
2191
  "aria-label": "Account settings sections",
1793
2192
  children: [
1794
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_tabs.Tabs.Tab, { value: "profile", children: "Profile" }),
1795
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_tabs.Tabs.Tab, { value: "advanced", children: "Advanced" })
2193
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_tabs.Tabs.Tab, { value: "profile", children: "Profile" }),
2194
+ showInvites && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_tabs.Tabs.Tab, { value: "invites", children: "Share Invites" }),
2195
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_tabs.Tabs.Tab, { value: "advanced", children: "Advanced" })
1796
2196
  ]
1797
2197
  }
1798
2198
  ),
1799
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_tabs.Tabs.Panel, { value: "profile", keepMounted: true, children: [
1800
- auth.isSignedIn && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2199
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_tabs.Tabs.Panel, { value: "profile", keepMounted: true, children: [
2200
+ auth.isSignedIn && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1801
2201
  ProjectProfileEditor,
1802
2202
  {
1803
2203
  profile: projectProfile,
@@ -1805,18 +2205,19 @@ function AccountSettingsModal({
1805
2205
  },
1806
2206
  accounts.activeAccount?.id ?? auth.did
1807
2207
  ),
1808
- accountSettingsUrl && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("a", { className: "basic-link", href: accountSettingsUrl, children: "Manage profile and security \u2197" }),
2208
+ accountSettingsUrl && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("a", { className: "basic-link", href: accountSettingsUrl, children: "Manage profile and security \u2197" }),
1809
2209
  children,
1810
- !auth.isSignedIn && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "basic-actions", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SignInButton, { auth }) })
2210
+ !auth.isSignedIn && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "basic-actions", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SignInButton, { auth }) })
1811
2211
  ] }),
1812
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_tabs.Tabs.Panel, { value: "advanced", children: [
1813
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "basic-muted", children: "Read-only diagnostics for this account." }),
1814
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("dl", { className: "basic-details", children: details.map(([label, value]) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react13.Fragment, { children: [
1815
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("dt", { children: label }),
1816
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("dd", { children: value })
2212
+ showInvites && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_tabs.Tabs.Panel, { value: "invites", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ShareInvites, { auth, accounts, invites }) }),
2213
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_tabs.Tabs.Panel, { value: "advanced", children: [
2214
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "basic-muted", children: "Read-only diagnostics for this account." }),
2215
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dl", { className: "basic-details", children: details.map(([label, value]) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react15.Fragment, { children: [
2216
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dt", { children: label }),
2217
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dd", { children: value })
1817
2218
  ] }, label)) }),
1818
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "basic-actions", children: [
1819
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2219
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "basic-actions", children: [
2220
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1820
2221
  BasicButton,
1821
2222
  {
1822
2223
  disabled: copyAction.pending,
@@ -1832,9 +2233,9 @@ function AccountSettingsModal({
1832
2233
  children: "Copy to clipboard"
1833
2234
  }
1834
2235
  ),
1835
- copied === diagnostics && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { role: "status", className: "basic-muted", children: "Copied" })
2236
+ copied === diagnostics && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { role: "status", className: "basic-muted", children: "Copied" })
1836
2237
  ] }),
1837
- copyAction.error && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { role: "alert", className: "basic-error", children: copyAction.error })
2238
+ copyAction.error && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { role: "alert", className: "basic-error", children: copyAction.error })
1838
2239
  ] })
1839
2240
  ] })
1840
2241
  }
@@ -1844,8 +2245,8 @@ function AccountHeader({
1844
2245
  account,
1845
2246
  sync
1846
2247
  }) {
1847
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "basic-profile", children: [
1848
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2248
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "basic-profile", children: [
2249
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1849
2250
  AccountAvatar,
1850
2251
  {
1851
2252
  profile: account,
@@ -1854,10 +2255,10 @@ function AccountHeader({
1854
2255
  showSyncBadge: false
1855
2256
  }
1856
2257
  ),
1857
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "basic-identity", children: [
1858
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { children: account?.name || account?.kind !== "anon" && displayHandle(account?.handle) || "Local account" }),
1859
- account?.kind !== "anon" && account?.handle && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("small", { children: displayHandle(account.handle) }),
1860
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "basic-account-statuses", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SyncStatus, { sync }) })
2258
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "basic-identity", children: [
2259
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: account ? accountName(account) : "Local account" }),
2260
+ account?.kind !== "anon" && account?.handle && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("small", { children: displayHandle(account.handle) }),
2261
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "basic-account-statuses", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SyncStatus, { sync }) })
1861
2262
  ] })
1862
2263
  ] });
1863
2264
  }
@@ -1868,9 +2269,9 @@ function ProjectProfileEditor({
1868
2269
  const live = useProjectProfile(supplied === void 0);
1869
2270
  const profile = supplied ?? live;
1870
2271
  const action = useAction();
1871
- const [draft, setDraft] = (0, import_react13.useState)({});
1872
- const [saved, setSaved] = (0, import_react13.useState)(false);
1873
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
2272
+ const [draft, setDraft] = (0, import_react15.useState)({});
2273
+ const [saved, setSaved] = (0, import_react15.useState)(false);
2274
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1874
2275
  "form",
1875
2276
  {
1876
2277
  className: "basic-profile-editor",
@@ -1884,15 +2285,15 @@ function ProjectProfileEditor({
1884
2285
  });
1885
2286
  },
1886
2287
  children: [
1887
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h3", { className: "basic-section-label", children: "Personal information" }),
1888
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "basic-muted", children: "Only this app sees these overrides. Clear a field to use your universal profile value." }),
1889
- profile.isLoading ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { role: "status", children: "Loading project profile\u2026" }) : profile.error ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
1890
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { role: "alert", className: "basic-error", children: profile.error.message }),
1891
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(BasicButton, { onClick: profile.refresh, children: "Retry profile" })
1892
- ] }) : profile.data && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("fieldset", { disabled: !canWrite || action.pending, children: [
1893
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "basic-field", children: [
2288
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { className: "basic-section-label", children: "Personal information" }),
2289
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "basic-muted", children: "Only this app sees these overrides. Clear a field to use your universal profile value." }),
2290
+ profile.isLoading ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { role: "status", children: "Loading project profile\u2026" }) : profile.error ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
2291
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { role: "alert", className: "basic-error", children: profile.error.message }),
2292
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(BasicButton, { onClick: profile.refresh, children: "Retry profile" })
2293
+ ] }) : profile.data && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("fieldset", { disabled: !canWrite || action.pending, children: [
2294
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "basic-field", children: [
1894
2295
  "Display name",
1895
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2296
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1896
2297
  "input",
1897
2298
  {
1898
2299
  className: "basic-input",
@@ -1909,8 +2310,8 @@ function ProjectProfileEditor({
1909
2310
  }
1910
2311
  )
1911
2312
  ] }),
1912
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "basic-actions basic-modal-footer", children: [
1913
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2313
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "basic-actions basic-modal-footer", children: [
2314
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1914
2315
  BasicButton,
1915
2316
  {
1916
2317
  variant: "ghost",
@@ -1921,7 +2322,7 @@ function ProjectProfileEditor({
1921
2322
  children: "Cancel"
1922
2323
  }
1923
2324
  ),
1924
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2325
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1925
2326
  BasicButton,
1926
2327
  {
1927
2328
  type: "submit",
@@ -1932,17 +2333,205 @@ function ProjectProfileEditor({
1932
2333
  )
1933
2334
  ] })
1934
2335
  ] }),
1935
- action.error && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { role: "alert", className: "basic-error", children: action.error }),
1936
- saved && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { role: "status", children: "Project profile saved." })
2336
+ action.error && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { role: "alert", className: "basic-error", children: action.error }),
2337
+ saved && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { role: "status", children: "Project profile saved." })
2338
+ ]
2339
+ }
2340
+ );
2341
+ }
2342
+ function ShareInvites({
2343
+ auth: suppliedAuth,
2344
+ accounts: suppliedAccounts,
2345
+ invites,
2346
+ className = "",
2347
+ ...props
2348
+ }) {
2349
+ const liveAuth = useAuth();
2350
+ const liveAccounts = useAccounts();
2351
+ const auth = suppliedAuth ?? liveAuth;
2352
+ const accounts = suppliedAccounts ?? liveAccounts;
2353
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
2354
+ "section",
2355
+ {
2356
+ ...props,
2357
+ className: `basic-invites ${className}`,
2358
+ "aria-label": props["aria-label"] ?? "Share Invites",
2359
+ children: [
2360
+ (!auth.isReady || !auth.isSignedIn) && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { className: "basic-title", children: "Share Invites" }),
2361
+ !auth.isReady ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { role: "status", children: "Checking session\u2026" }) : !auth.isSignedIn ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
2362
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "basic-muted", children: "Sign in to view invites." }),
2363
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SignInButton, { auth })
2364
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2365
+ ShareInvitesContent,
2366
+ {
2367
+ invites,
2368
+ canWrite: auth.canWrite
2369
+ },
2370
+ accounts.activeAccount?.id ?? auth.did
2371
+ )
1937
2372
  ]
1938
2373
  }
1939
2374
  );
1940
2375
  }
2376
+ function ShareInvitesContent({
2377
+ invites: supplied,
2378
+ canWrite
2379
+ }) {
2380
+ const live = useShareInvites(supplied === void 0);
2381
+ const invites = supplied ?? live;
2382
+ const action = useAction();
2383
+ const [message, setMessage] = (0, import_react15.useState)("");
2384
+ const visible = invites.data.filter((invite) => invite.state !== "deleted");
2385
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
2386
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "basic-section-heading", children: [
2387
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { className: "basic-title", children: "Share Invites" }),
2388
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2389
+ BasicButton,
2390
+ {
2391
+ disabled: invites.isLoading || action.pending,
2392
+ onClick: invites.refresh,
2393
+ children: "Refresh"
2394
+ }
2395
+ )
2396
+ ] }),
2397
+ !canWrite && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "basic-error", children: "Read-only session. Invite changes are disabled." }),
2398
+ action.error && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { role: "alert", className: "basic-error", children: action.error }),
2399
+ message && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { role: "status", children: message }),
2400
+ action.pending && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { role: "status", children: "Updating invite\u2026" }),
2401
+ invites.isLoading ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { role: "status", children: "Loading invites\u2026" }) : invites.error ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { role: "alert", className: "basic-error", children: invites.error.message }) : !visible.length ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "basic-empty", children: "No share invites." }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("ul", { className: "basic-share-list basic-invite-list", children: visible.map((invite) => {
2402
+ const title = invite.display.shareName || invite.display.repoName || "Shared data";
2403
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2404
+ ShareInviteRow,
2405
+ {
2406
+ invite,
2407
+ title,
2408
+ resolveContactHandle: invites.resolveContactHandle,
2409
+ disabled: !canWrite || action.pending,
2410
+ onDecision: (decision) => void action.run(async () => {
2411
+ setMessage("");
2412
+ await invites[decision](invite.id);
2413
+ setMessage(
2414
+ `${decision === "accept" ? "Accepted" : "Declined"} \u201C${title}\u201D.`
2415
+ );
2416
+ })
2417
+ },
2418
+ invite.id
2419
+ );
2420
+ }) })
2421
+ ] });
2422
+ }
2423
+ function ShareInviteRow({
2424
+ invite,
2425
+ title,
2426
+ resolveContactHandle,
2427
+ disabled,
2428
+ onDecision
2429
+ }) {
2430
+ const did = invite.originOwnerDid;
2431
+ const [sender, setSender] = (0, import_react15.useState)(null);
2432
+ (0, import_react15.useEffect)(() => {
2433
+ let active = true;
2434
+ void resolveContactHandle(did).then(
2435
+ (handle2) => {
2436
+ if (active) setSender({ did, handle: handle2 });
2437
+ },
2438
+ () => {
2439
+ if (active) setSender({ did, handle: null });
2440
+ }
2441
+ );
2442
+ return () => {
2443
+ active = false;
2444
+ };
2445
+ }, [did, resolveContactHandle]);
2446
+ const handle = sender?.did === did ? sender.handle : null;
2447
+ const pending = invite.state === "pending";
2448
+ const accepting = invite.state === "accepting";
2449
+ const expiresAt = new Date(invite.acceptBy);
2450
+ const expired = expiresAt.getTime() <= Date.now();
2451
+ const blocked = invite.compatibility.state === "app_connection_required" ? "Connect this app to accept." : invite.compatibility.state === "compatible_repo_required" ? "A compatible repository is required." : null;
2452
+ const status = pending && !expired ? null : (pending || accepting) && expired ? "Expired" : accepting ? "Retry to finish accepting" : invite.state === "accepted" ? "Accepted" : invite.state === "declined" ? "Declined" : "Acceptance rejected";
2453
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("li", { children: [
2454
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2455
+ ShareRecipientAvatar,
2456
+ {
2457
+ recipient: {
2458
+ did,
2459
+ name: handle ? displayHandle(handle) : "Unknown sender"
2460
+ },
2461
+ size: 32
2462
+ }
2463
+ ),
2464
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "basic-identity", children: [
2465
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: title }),
2466
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("small", { children: handle ? displayHandle(handle) : "Unknown sender" }),
2467
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("small", { children: invite.role === "editor" ? "Can edit" : "Can view" }),
2468
+ status && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "basic-invite-state", children: status }),
2469
+ blocked && (pending || accepting) && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "basic-error", children: blocked })
2470
+ ] }),
2471
+ (pending || accepting) && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "basic-invite-actions", children: [
2472
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2473
+ BasicButton,
2474
+ {
2475
+ variant: "solid",
2476
+ disabled: disabled || expired || !!blocked,
2477
+ onClick: () => onDecision("accept"),
2478
+ children: accepting ? "Retry acceptance" : "Accept"
2479
+ }
2480
+ ),
2481
+ pending && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2482
+ BasicButton,
2483
+ {
2484
+ disabled,
2485
+ onClick: () => onDecision("decline"),
2486
+ children: "Decline"
2487
+ }
2488
+ )
2489
+ ] }),
2490
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("details", { className: "basic-invite-details", children: [
2491
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("summary", { children: "Details" }),
2492
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "basic-invite-scope", children: [
2493
+ invite.scope.map((scope, index) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
2494
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: scope.table }),
2495
+ " \xB7",
2496
+ " ",
2497
+ scope.recordIds ? `${scope.recordIds.length} selected records` : "all records",
2498
+ scope.recordIds && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("code", { children: scope.recordIds.join(", ") })
2499
+ ] }, index)),
2500
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("small", { children: [
2501
+ "Sender DID: ",
2502
+ did
2503
+ ] }),
2504
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("small", { children: [
2505
+ "Expires",
2506
+ " ",
2507
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("time", { dateTime: invite.acceptBy, children: [
2508
+ expiresAt.toLocaleString("en-US", {
2509
+ dateStyle: "medium",
2510
+ timeStyle: "short",
2511
+ timeZone: "UTC"
2512
+ }),
2513
+ " ",
2514
+ "UTC"
2515
+ ] })
2516
+ ] })
2517
+ ] })
2518
+ ] })
2519
+ ] });
2520
+ }
2521
+ function ShareInvitesModal({
2522
+ auth,
2523
+ accounts,
2524
+ invites,
2525
+ ...props
2526
+ }) {
2527
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Modal, { ...props, title: "Share Invites", hideTitle: true, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ShareInvites, { auth, accounts, invites }) });
2528
+ }
1941
2529
  function SharesModal({
1942
2530
  auth: supplied,
1943
2531
  accounts: suppliedAccounts,
1944
2532
  sync,
1945
2533
  shares,
2534
+ invites,
1946
2535
  scope,
1947
2536
  repo = "default",
1948
2537
  ...props
@@ -1950,37 +2539,43 @@ function SharesModal({
1950
2539
  const live = useAuth();
1951
2540
  const liveAccounts = useAccounts();
1952
2541
  const auth = supplied ?? live;
1953
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2542
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1954
2543
  Modal,
1955
2544
  {
1956
2545
  ...props,
1957
2546
  title: "Shares",
1958
2547
  description: "Manage incoming invitations and share access to selected data.",
1959
- header: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2548
+ header: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1960
2549
  AccountHeader,
1961
2550
  {
1962
2551
  account: (suppliedAccounts ?? liveAccounts).activeAccount,
1963
2552
  sync
1964
2553
  }
1965
2554
  ),
1966
- children: !auth.isReady ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { role: "status", children: "Checking session\u2026" }) : !auth.isSignedIn ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
1967
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "basic-muted", children: "Sign in to share data." }),
1968
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SignInButton, { auth })
1969
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2555
+ children: !auth.isReady ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { role: "status", children: "Checking session\u2026" }) : !auth.isSignedIn ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
2556
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "basic-muted", children: "Sign in to share data." }),
2557
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SignInButton, { auth })
2558
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1970
2559
  SharesContent,
1971
2560
  {
1972
2561
  shares,
2562
+ invites,
2563
+ auth,
2564
+ accounts: suppliedAccounts ?? liveAccounts,
1973
2565
  scope,
1974
2566
  repo,
1975
2567
  canWrite: auth.canWrite
1976
2568
  },
1977
- auth.did ?? "account"
2569
+ (suppliedAccounts ?? liveAccounts).activeAccount?.id ?? auth.did
1978
2570
  )
1979
2571
  }
1980
2572
  );
1981
2573
  }
1982
2574
  function SharesContent({
1983
2575
  shares: supplied,
2576
+ invites,
2577
+ auth,
2578
+ accounts,
1984
2579
  scope,
1985
2580
  repo,
1986
2581
  canWrite
@@ -1988,36 +2583,32 @@ function SharesContent({
1988
2583
  const live = useOutgoingShares();
1989
2584
  const shares = supplied ?? live;
1990
2585
  const action = useAction();
1991
- const [recipient, setRecipient] = (0, import_react13.useState)("");
1992
- const [role, setRole] = (0, import_react13.useState)("viewer");
1993
- const [confirmation, setConfirmation] = (0, import_react13.useState)(null);
1994
- const [message, setMessage] = (0, import_react13.useState)("");
2586
+ const [recipient, setRecipient] = (0, import_react15.useState)("");
2587
+ const [role, setRole] = (0, import_react15.useState)("viewer");
2588
+ const [confirmation, setConfirmation] = (0, import_react15.useState)(null);
2589
+ const [message, setMessage] = (0, import_react15.useState)("");
1995
2590
  const scopeValid = scope.length > 0 && scope.every(
1996
2591
  (item) => item.table.trim() && (item.recordIds === void 0 || item.recordIds.length > 0)
1997
2592
  );
1998
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_tabs.Tabs.Root, { defaultValue: "outgoing", className: "basic-shares", children: [
1999
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_tabs.Tabs.List, { className: "basic-tabs", "aria-label": "Share direction", children: [
2000
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_tabs.Tabs.Tab, { value: "outgoing", children: "Outgoing" }),
2001
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_tabs.Tabs.Tab, { value: "incoming", children: "Incoming invitations" })
2593
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_tabs.Tabs.Root, { defaultValue: "outgoing", className: "basic-shares", children: [
2594
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_tabs.Tabs.List, { className: "basic-tabs", "aria-label": "Share direction", children: [
2595
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_tabs.Tabs.Tab, { value: "outgoing", children: "Outgoing" }),
2596
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_tabs.Tabs.Tab, { value: "incoming", children: "Share Invites" })
2002
2597
  ] }),
2003
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_tabs.Tabs.Panel, { value: "incoming", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("section", { "aria-label": "Incoming invitations", children: [
2004
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h3", { className: "basic-title", children: "Incoming invitations" }),
2005
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "basic-muted", children: "View, accept, or decline incoming invitations in Basic ID. Your app session cannot access the account-wide inbox." }),
2006
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("a", { className: "basic-link", href: shares.manageUrl(), children: "Open incoming invitations in Basic ID \u2197" })
2007
- ] }) }),
2008
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_tabs.Tabs.Panel, { value: "outgoing", children: [
2009
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "basic-muted", children: "Revoking access stops future requests. It cannot retract data the recipient already downloaded." }),
2010
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "basic-scope", children: [
2011
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { children: "New invitation permissions" }),
2012
- scope.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { children: [
2598
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_tabs.Tabs.Panel, { value: "incoming", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ShareInvites, { invites, auth, accounts }) }),
2599
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_tabs.Tabs.Panel, { value: "outgoing", children: [
2600
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "basic-muted", children: "Revoking access stops future requests. It cannot retract data the recipient already downloaded." }),
2601
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "basic-scope", children: [
2602
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: "New invitation permissions" }),
2603
+ scope.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { children: [
2013
2604
  item.table,
2014
2605
  " \xB7",
2015
2606
  " ",
2016
2607
  item.recordIds ? `${item.recordIds.length} selected records` : "all records"
2017
2608
  ] }, index))
2018
2609
  ] }),
2019
- !canWrite && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "basic-error", children: "This session is read only. Sharing changes are disabled." }),
2020
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
2610
+ !canWrite && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "basic-error", children: "This session is read only. Sharing changes are disabled." }),
2611
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
2021
2612
  "form",
2022
2613
  {
2023
2614
  className: "basic-share-form",
@@ -2037,9 +2628,9 @@ function SharesContent({
2037
2628
  });
2038
2629
  },
2039
2630
  children: [
2040
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "basic-field", children: [
2631
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "basic-field", children: [
2041
2632
  "Recipient handle or DID",
2042
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2633
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2043
2634
  "input",
2044
2635
  {
2045
2636
  className: "basic-input",
@@ -2051,9 +2642,9 @@ function SharesContent({
2051
2642
  }
2052
2643
  )
2053
2644
  ] }),
2054
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "basic-field", children: [
2645
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "basic-field", children: [
2055
2646
  "Permission",
2056
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
2647
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
2057
2648
  "select",
2058
2649
  {
2059
2650
  className: "basic-input",
@@ -2061,13 +2652,13 @@ function SharesContent({
2061
2652
  onChange: (event) => setRole(event.target.value),
2062
2653
  disabled: action.pending || !canWrite,
2063
2654
  children: [
2064
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: "viewer", children: "Can view" }),
2065
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: "editor", children: "Can edit" })
2655
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "viewer", children: "Can view" }),
2656
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "editor", children: "Can edit" })
2066
2657
  ]
2067
2658
  }
2068
2659
  )
2069
2660
  ] }),
2070
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2661
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2071
2662
  BasicButton,
2072
2663
  {
2073
2664
  type: "submit",
@@ -2079,12 +2670,12 @@ function SharesContent({
2079
2670
  ]
2080
2671
  }
2081
2672
  ),
2082
- !scopeValid && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { role: "alert", className: "basic-error", children: "Select at least one table or record to share." }),
2083
- action.error && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { role: "alert", className: "basic-error", children: action.error }),
2084
- message && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { role: "status", className: "basic-muted", children: message }),
2085
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "basic-section-heading", children: [
2086
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h3", { className: "basic-title", children: "Outgoing shares \xB7 all permissions" }),
2087
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2673
+ !scopeValid && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { role: "alert", className: "basic-error", children: "Select at least one table or record to share." }),
2674
+ action.error && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { role: "alert", className: "basic-error", children: action.error }),
2675
+ message && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { role: "status", className: "basic-muted", children: message }),
2676
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "basic-section-heading", children: [
2677
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { className: "basic-title", children: "Outgoing shares \xB7 all permissions" }),
2678
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2088
2679
  BasicButton,
2089
2680
  {
2090
2681
  disabled: action.pending || shares.isLoading,
@@ -2093,10 +2684,15 @@ function SharesContent({
2093
2684
  }
2094
2685
  )
2095
2686
  ] }),
2096
- shares.isLoading ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { role: "status", children: "Loading shares\u2026" }) : shares.error ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { role: "alert", className: "basic-error", children: shares.error.message }) : !shares.data.length ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "basic-empty", children: "No outgoing shares yet." }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ul", { className: "basic-share-list", children: shares.data.map((share) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("li", { children: [
2097
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "basic-identity", children: [
2098
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { children: share.display.shareName || share.recipientDid }),
2099
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("small", { children: [
2687
+ shares.isLoading ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { role: "status", children: "Loading shares\u2026" }) : shares.error ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { role: "alert", className: "basic-error", children: shares.error.message }) : !shares.data.length ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "basic-empty", children: "No outgoing shares yet." }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("ul", { className: "basic-share-list", children: shares.data.map((share) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("li", { children: [
2688
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ShareRecipientAvatar, { recipient: { did: share.recipientDid } }),
2689
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "basic-identity", children: [
2690
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: share.display.shareName || share.recipientDid }),
2691
+ share.display.shareName && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("small", { children: [
2692
+ "To ",
2693
+ share.recipientDid
2694
+ ] }),
2695
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("small", { children: [
2100
2696
  share.role === "viewer" ? "Can view" : "Can edit",
2101
2697
  " \xB7",
2102
2698
  " ",
@@ -2106,9 +2702,9 @@ function SharesContent({
2106
2702
  share.scope.map((item) => item.table).join(", ")
2107
2703
  ] })
2108
2704
  ] }),
2109
- share.state !== "ended" && (confirmation === share.id ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "basic-actions", children: [
2110
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "Remove access?" }),
2111
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
2705
+ share.state !== "ended" && (confirmation === share.id ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "basic-actions", children: [
2706
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "Remove access?" }),
2707
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
2112
2708
  BasicButton,
2113
2709
  {
2114
2710
  disabled: action.pending || !canWrite,
@@ -2127,7 +2723,7 @@ function SharesContent({
2127
2723
  ]
2128
2724
  }
2129
2725
  ),
2130
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2726
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2131
2727
  BasicButton,
2132
2728
  {
2133
2729
  disabled: action.pending,
@@ -2135,7 +2731,7 @@ function SharesContent({
2135
2731
  children: "Keep access"
2136
2732
  }
2137
2733
  )
2138
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2734
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2139
2735
  BasicButton,
2140
2736
  {
2141
2737
  disabled: action.pending || !canWrite,
@@ -2157,6 +2753,11 @@ function SharesContent({
2157
2753
  BrowserKeyValueStorage,
2158
2754
  BrowserTokenStore,
2159
2755
  PersistenceStore,
2756
+ ShareInvites,
2757
+ ShareInvitesModal,
2758
+ ShareRecipientAvatar,
2759
+ ShareRecipientAvatars,
2760
+ ShareRecipientLabel,
2160
2761
  SharesModal,
2161
2762
  SignInButton,
2162
2763
  SignOutButton,
@@ -2185,6 +2786,8 @@ function SharesContent({
2185
2786
  useQuery,
2186
2787
  useRepos,
2187
2788
  useSchemaStatus,
2789
+ useShareInvites,
2790
+ useShareRecipients,
2188
2791
  useStorageInfo,
2189
2792
  useSyncStatus
2190
2793
  });