@basictech/react 0.12.0-beta.3 → 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/CHANGELOG.md +22 -0
- package/README.md +145 -12
- package/THIRD_PARTY_NOTICES.md +29 -0
- package/dist/index.d.mts +69 -7
- package/dist/index.d.ts +69 -7
- package/dist/index.js +751 -197
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +729 -180
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +99 -0
- package/dist/styles.css.map +1 -1
- package/package.json +4 -3
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
|
|
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,
|
|
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,19 +1256,129 @@ 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
|
|
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
|
|
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
|
|
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)({});
|
|
1153
1382
|
function accentText(accent) {
|
|
1154
1383
|
if (!/^#([\da-f]{3}|[\da-f]{6})$/i.test(accent)) return "#fff";
|
|
1155
1384
|
const hex = accent.length === 4 ? accent.slice(1).split("").map((digit) => digit + digit).join("") : accent.slice(1);
|
|
@@ -1173,9 +1402,9 @@ function BasicUIProvider({
|
|
|
1173
1402
|
appearance = {},
|
|
1174
1403
|
children
|
|
1175
1404
|
}) {
|
|
1176
|
-
const parent = (0,
|
|
1405
|
+
const parent = (0, import_react15.useContext)(AppearanceContext);
|
|
1177
1406
|
const value = { ...parent, ...appearance };
|
|
1178
|
-
return /* @__PURE__ */ (0,
|
|
1407
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AppearanceContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1179
1408
|
"div",
|
|
1180
1409
|
{
|
|
1181
1410
|
className: "basic-ui",
|
|
@@ -1187,16 +1416,16 @@ function BasicUIProvider({
|
|
|
1187
1416
|
) });
|
|
1188
1417
|
}
|
|
1189
1418
|
function useAppearanceProps() {
|
|
1190
|
-
const appearance = (0,
|
|
1419
|
+
const appearance = (0, import_react15.useContext)(AppearanceContext);
|
|
1191
1420
|
return {
|
|
1192
1421
|
"data-theme": appearance.theme ?? "light",
|
|
1193
1422
|
"data-density": appearance.density ?? "comfortable",
|
|
1194
1423
|
style: appearanceStyle(appearance)
|
|
1195
1424
|
};
|
|
1196
1425
|
}
|
|
1197
|
-
var BasicButton = (0,
|
|
1426
|
+
var BasicButton = (0, import_react15.forwardRef)(
|
|
1198
1427
|
function BasicButton2({ variant = "outline", className = "", type = "button", ...props }, ref) {
|
|
1199
|
-
return /* @__PURE__ */ (0,
|
|
1428
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1200
1429
|
"button",
|
|
1201
1430
|
{
|
|
1202
1431
|
...props,
|
|
@@ -1209,11 +1438,11 @@ var BasicButton = (0, import_react13.forwardRef)(
|
|
|
1209
1438
|
}
|
|
1210
1439
|
);
|
|
1211
1440
|
function useAction() {
|
|
1212
|
-
const [pending, setPending] = (0,
|
|
1213
|
-
const [error, setError] = (0,
|
|
1214
|
-
const busy = (0,
|
|
1215
|
-
const mounted = (0,
|
|
1216
|
-
(0,
|
|
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)(() => {
|
|
1217
1446
|
mounted.current = true;
|
|
1218
1447
|
return () => {
|
|
1219
1448
|
mounted.current = false;
|
|
@@ -1229,7 +1458,7 @@ function useAction() {
|
|
|
1229
1458
|
} catch (cause) {
|
|
1230
1459
|
if (mounted.current)
|
|
1231
1460
|
setError(
|
|
1232
|
-
cause instanceof
|
|
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."
|
|
1233
1462
|
);
|
|
1234
1463
|
} finally {
|
|
1235
1464
|
busy.current = false;
|
|
@@ -1251,8 +1480,8 @@ function AuthButton({
|
|
|
1251
1480
|
const auth = supplied ?? live;
|
|
1252
1481
|
const action = useAction();
|
|
1253
1482
|
const expired = auth.status === "expired";
|
|
1254
|
-
return /* @__PURE__ */ (0,
|
|
1255
|
-
/* @__PURE__ */ (0,
|
|
1483
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "basic-action", children: [
|
|
1484
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1256
1485
|
BasicButton,
|
|
1257
1486
|
{
|
|
1258
1487
|
...props,
|
|
@@ -1268,29 +1497,42 @@ function AuthButton({
|
|
|
1268
1497
|
children: action.pending ? "Please wait\u2026" : children ?? (signOut ? "Sign out" : expired ? "Sign in again" : "Sign in")
|
|
1269
1498
|
}
|
|
1270
1499
|
),
|
|
1271
|
-
/* @__PURE__ */ (0,
|
|
1500
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ActionError, { error: action.error, onClose: action.clearError })
|
|
1272
1501
|
] });
|
|
1273
1502
|
}
|
|
1274
1503
|
function SignInButton(props) {
|
|
1275
|
-
return /* @__PURE__ */ (0,
|
|
1504
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AuthButton, { ...props });
|
|
1276
1505
|
}
|
|
1277
1506
|
function SignOutButton(props) {
|
|
1278
|
-
return /* @__PURE__ */ (0,
|
|
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";
|
|
1279
1517
|
}
|
|
1280
1518
|
function UserAvatar({
|
|
1281
1519
|
accounts,
|
|
1282
1520
|
auth,
|
|
1283
1521
|
projectProfile,
|
|
1522
|
+
invites,
|
|
1523
|
+
showInvites,
|
|
1284
1524
|
allowAddAccount,
|
|
1285
1525
|
menuItems,
|
|
1286
1526
|
...avatarProps
|
|
1287
1527
|
}) {
|
|
1288
|
-
return /* @__PURE__ */ (0,
|
|
1528
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1289
1529
|
UserMenu,
|
|
1290
1530
|
{
|
|
1291
1531
|
accounts,
|
|
1292
1532
|
auth,
|
|
1293
1533
|
projectProfile,
|
|
1534
|
+
invites,
|
|
1535
|
+
showInvites,
|
|
1294
1536
|
allowAddAccount,
|
|
1295
1537
|
menuItems,
|
|
1296
1538
|
sync: avatarProps.sync,
|
|
@@ -1304,25 +1546,34 @@ function AccountAvatar({
|
|
|
1304
1546
|
size = 32,
|
|
1305
1547
|
showSyncBadge,
|
|
1306
1548
|
sync,
|
|
1307
|
-
className = "",
|
|
1308
|
-
style,
|
|
1309
1549
|
...props
|
|
1310
1550
|
}) {
|
|
1311
1551
|
const accounts = useAccounts();
|
|
1312
1552
|
const client = useRequiredClient();
|
|
1313
1553
|
const profile = supplied === void 0 ? accounts.activeAccount : supplied;
|
|
1314
|
-
const
|
|
1315
|
-
|
|
1316
|
-
|
|
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)(
|
|
1317
1568
|
import_avatar.Avatar.Root,
|
|
1318
1569
|
{
|
|
1319
1570
|
...props,
|
|
1320
1571
|
className: `basic-avatar ${className}`,
|
|
1321
1572
|
style: { width: size, height: size, ...style },
|
|
1322
1573
|
role: "img",
|
|
1323
|
-
"aria-label": props["aria-label"] ??
|
|
1574
|
+
"aria-label": props["aria-label"] ?? accountName(profile),
|
|
1324
1575
|
children: [
|
|
1325
|
-
profile?.picture && /* @__PURE__ */ (0,
|
|
1576
|
+
profile?.picture && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1326
1577
|
import_avatar.Avatar.Image,
|
|
1327
1578
|
{
|
|
1328
1579
|
src: profile.picture,
|
|
@@ -1331,14 +1582,100 @@ function AccountAvatar({
|
|
|
1331
1582
|
referrerPolicy: "no-referrer"
|
|
1332
1583
|
}
|
|
1333
1584
|
),
|
|
1334
|
-
/* @__PURE__ */ (0,
|
|
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
|
+
)
|
|
1335
1676
|
]
|
|
1336
1677
|
}
|
|
1337
1678
|
);
|
|
1338
|
-
return showSyncBadge ?? client.mode === "sync" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "basic-avatar-container", children: [
|
|
1339
|
-
avatar,
|
|
1340
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SyncStatus, { sync, className: "basic-avatar-sync" })
|
|
1341
|
-
] }) : avatar;
|
|
1342
1679
|
}
|
|
1343
1680
|
function AuthStatus({
|
|
1344
1681
|
auth: supplied,
|
|
@@ -1349,7 +1686,7 @@ function AuthStatus({
|
|
|
1349
1686
|
const auth = supplied ?? live;
|
|
1350
1687
|
const expired = auth.status === "expired";
|
|
1351
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";
|
|
1352
|
-
return /* @__PURE__ */ (0,
|
|
1689
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1353
1690
|
"span",
|
|
1354
1691
|
{
|
|
1355
1692
|
...props,
|
|
@@ -1357,7 +1694,7 @@ function AuthStatus({
|
|
|
1357
1694
|
className: `basic-status ${className}`,
|
|
1358
1695
|
"data-tone": expired || auth.error ? "warning" : auth.isSignedIn ? "success" : "neutral",
|
|
1359
1696
|
children: [
|
|
1360
|
-
/* @__PURE__ */ (0,
|
|
1697
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "basic-dot" }),
|
|
1361
1698
|
label
|
|
1362
1699
|
]
|
|
1363
1700
|
}
|
|
@@ -1387,7 +1724,7 @@ function SyncStatus({
|
|
|
1387
1724
|
ended: "Access ended"
|
|
1388
1725
|
};
|
|
1389
1726
|
const label = issues ? `${issues} sync ${issues === 1 ? "issue" : "issues"}` : sync.status === "online" && sync.pendingCount ? "Syncing" : labels[sync.status];
|
|
1390
|
-
return /* @__PURE__ */ (0,
|
|
1727
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1391
1728
|
"span",
|
|
1392
1729
|
{
|
|
1393
1730
|
...props,
|
|
@@ -1396,7 +1733,7 @@ function SyncStatus({
|
|
|
1396
1733
|
className: `basic-status ${className}`,
|
|
1397
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",
|
|
1398
1735
|
children: [
|
|
1399
|
-
/* @__PURE__ */ (0,
|
|
1736
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "basic-dot" }),
|
|
1400
1737
|
label,
|
|
1401
1738
|
sync.pendingCount > 0 && ` \xB7 ${sync.pendingCount} pending`
|
|
1402
1739
|
]
|
|
@@ -1407,7 +1744,7 @@ function displayHandle(handle) {
|
|
|
1407
1744
|
return handle ? `@${handle.replace(/^@+/, "")}` : "";
|
|
1408
1745
|
}
|
|
1409
1746
|
function UserButton(props) {
|
|
1410
|
-
return /* @__PURE__ */ (0,
|
|
1747
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(UserMenu, { ...props, trigger: "button" });
|
|
1411
1748
|
}
|
|
1412
1749
|
function UserMenu({
|
|
1413
1750
|
accounts: supplied,
|
|
@@ -1419,6 +1756,8 @@ function UserMenu({
|
|
|
1419
1756
|
trigger = "avatar",
|
|
1420
1757
|
avatarProps,
|
|
1421
1758
|
projectProfile,
|
|
1759
|
+
invites,
|
|
1760
|
+
showInvites,
|
|
1422
1761
|
allowAddAccount = true,
|
|
1423
1762
|
className = "",
|
|
1424
1763
|
accountSettingsUrl,
|
|
@@ -1429,19 +1768,19 @@ function UserMenu({
|
|
|
1429
1768
|
const accounts = supplied ?? liveAccounts;
|
|
1430
1769
|
const auth = suppliedAuth ?? liveAuth;
|
|
1431
1770
|
const action = useAction();
|
|
1432
|
-
const [settingsOpen, setSettingsOpen] = (0,
|
|
1433
|
-
const [clearAccountId, setClearAccountId] = (0,
|
|
1434
|
-
const triggerRef = (0,
|
|
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);
|
|
1435
1774
|
const appearance = useAppearanceProps();
|
|
1436
1775
|
const expired = auth.status === "expired";
|
|
1437
1776
|
const active = accounts.activeAccount;
|
|
1438
1777
|
const otherAccounts = accounts.accounts.filter(
|
|
1439
1778
|
(account) => account.id !== active?.id
|
|
1440
1779
|
);
|
|
1441
|
-
const name = active
|
|
1442
|
-
return /* @__PURE__ */ (0,
|
|
1443
|
-
/* @__PURE__ */ (0,
|
|
1444
|
-
/* @__PURE__ */ (0,
|
|
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)(
|
|
1445
1784
|
import_menu.Menu.Trigger,
|
|
1446
1785
|
{
|
|
1447
1786
|
ref: triggerRef,
|
|
@@ -1450,7 +1789,7 @@ function UserMenu({
|
|
|
1450
1789
|
disabled: !auth.isReady || action.pending,
|
|
1451
1790
|
"aria-label": "Open user menu",
|
|
1452
1791
|
children: [
|
|
1453
|
-
/* @__PURE__ */ (0,
|
|
1792
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1454
1793
|
AccountAvatar,
|
|
1455
1794
|
{
|
|
1456
1795
|
profile: accounts.activeAccount,
|
|
@@ -1459,12 +1798,12 @@ function UserMenu({
|
|
|
1459
1798
|
...avatarProps
|
|
1460
1799
|
}
|
|
1461
1800
|
),
|
|
1462
|
-
trigger === "button" && /* @__PURE__ */ (0,
|
|
1463
|
-
/* @__PURE__ */ (0,
|
|
1464
|
-
/* @__PURE__ */ (0,
|
|
1465
|
-
active?.kind !== "anon" && active?.handle && /* @__PURE__ */ (0,
|
|
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) })
|
|
1466
1805
|
] }),
|
|
1467
|
-
/* @__PURE__ */ (0,
|
|
1806
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1468
1807
|
"svg",
|
|
1469
1808
|
{
|
|
1470
1809
|
className: "basic-chevron",
|
|
@@ -1477,16 +1816,16 @@ function UserMenu({
|
|
|
1477
1816
|
strokeLinecap: "round",
|
|
1478
1817
|
strokeLinejoin: "round",
|
|
1479
1818
|
"aria-hidden": "true",
|
|
1480
|
-
children: /* @__PURE__ */ (0,
|
|
1819
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "m6 9 6 6 6-6" })
|
|
1481
1820
|
}
|
|
1482
1821
|
)
|
|
1483
1822
|
] })
|
|
1484
1823
|
]
|
|
1485
1824
|
}
|
|
1486
1825
|
),
|
|
1487
|
-
/* @__PURE__ */ (0,
|
|
1488
|
-
/* @__PURE__ */ (0,
|
|
1489
|
-
/* @__PURE__ */ (0,
|
|
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)(
|
|
1490
1829
|
AccountAvatar,
|
|
1491
1830
|
{
|
|
1492
1831
|
profile: active,
|
|
@@ -1495,16 +1834,16 @@ function UserMenu({
|
|
|
1495
1834
|
showSyncBadge: false
|
|
1496
1835
|
}
|
|
1497
1836
|
),
|
|
1498
|
-
/* @__PURE__ */ (0,
|
|
1499
|
-
/* @__PURE__ */ (0,
|
|
1500
|
-
active?.kind !== "anon" && active?.handle && /* @__PURE__ */ (0,
|
|
1501
|
-
/* @__PURE__ */ (0,
|
|
1502
|
-
expired && /* @__PURE__ */ (0,
|
|
1503
|
-
showSyncStatus && /* @__PURE__ */ (0,
|
|
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 })
|
|
1504
1843
|
] })
|
|
1505
1844
|
] })
|
|
1506
1845
|
] }),
|
|
1507
|
-
expired && /* @__PURE__ */ (0,
|
|
1846
|
+
expired && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1508
1847
|
import_menu.Menu.Item,
|
|
1509
1848
|
{
|
|
1510
1849
|
className: "basic-menu-item basic-menu-reauth",
|
|
@@ -1513,13 +1852,13 @@ function UserMenu({
|
|
|
1513
1852
|
children: "Sign in again"
|
|
1514
1853
|
}
|
|
1515
1854
|
),
|
|
1516
|
-
/* @__PURE__ */ (0,
|
|
1855
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1517
1856
|
import_menu.Menu.Item,
|
|
1518
1857
|
{
|
|
1519
1858
|
className: "basic-menu-item basic-manage-account",
|
|
1520
1859
|
onClick: () => setSettingsOpen(true),
|
|
1521
1860
|
children: [
|
|
1522
|
-
/* @__PURE__ */ (0,
|
|
1861
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1523
1862
|
"svg",
|
|
1524
1863
|
{
|
|
1525
1864
|
className: "basic-menu-icon",
|
|
@@ -1533,8 +1872,8 @@ function UserMenu({
|
|
|
1533
1872
|
strokeLinejoin: "round",
|
|
1534
1873
|
"aria-hidden": "true",
|
|
1535
1874
|
children: [
|
|
1536
|
-
/* @__PURE__ */ (0,
|
|
1537
|
-
/* @__PURE__ */ (0,
|
|
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" })
|
|
1538
1877
|
]
|
|
1539
1878
|
}
|
|
1540
1879
|
),
|
|
@@ -1542,30 +1881,30 @@ function UserMenu({
|
|
|
1542
1881
|
]
|
|
1543
1882
|
}
|
|
1544
1883
|
),
|
|
1545
|
-
menuItems.map((item) => /* @__PURE__ */ (0,
|
|
1884
|
+
menuItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1546
1885
|
import_menu.Menu.Item,
|
|
1547
1886
|
{
|
|
1548
1887
|
className: "basic-menu-item",
|
|
1549
|
-
render: item.href !== void 0 ? /* @__PURE__ */ (0,
|
|
1888
|
+
render: item.href !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("a", { href: item.href }) : void 0,
|
|
1550
1889
|
disabled: item.disabled || action.pending,
|
|
1551
1890
|
onClick: () => {
|
|
1552
1891
|
if (item.onClick) void action.run(item.onClick);
|
|
1553
1892
|
},
|
|
1554
1893
|
children: [
|
|
1555
|
-
/* @__PURE__ */ (0,
|
|
1894
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "basic-menu-icon", "aria-hidden": "true", children: item.icon }),
|
|
1556
1895
|
item.label
|
|
1557
1896
|
]
|
|
1558
1897
|
},
|
|
1559
1898
|
item.id
|
|
1560
1899
|
)),
|
|
1561
|
-
(auth.isSignedIn || expired || active?.kind === "anon") && /* @__PURE__ */ (0,
|
|
1900
|
+
(auth.isSignedIn || expired || active?.kind === "anon") && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1562
1901
|
import_menu.Menu.Item,
|
|
1563
1902
|
{
|
|
1564
1903
|
className: "basic-menu-item basic-menu-signout",
|
|
1565
1904
|
disabled: action.pending,
|
|
1566
1905
|
onClick: () => active?.kind === "anon" ? setClearAccountId(active.id) : void action.run(() => auth.signOut()),
|
|
1567
1906
|
children: [
|
|
1568
|
-
/* @__PURE__ */ (0,
|
|
1907
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1569
1908
|
"svg",
|
|
1570
1909
|
{
|
|
1571
1910
|
className: "basic-menu-icon",
|
|
@@ -1578,25 +1917,25 @@ function UserMenu({
|
|
|
1578
1917
|
strokeLinecap: "round",
|
|
1579
1918
|
strokeLinejoin: "round",
|
|
1580
1919
|
"aria-hidden": "true",
|
|
1581
|
-
children: /* @__PURE__ */ (0,
|
|
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" })
|
|
1582
1921
|
}
|
|
1583
1922
|
),
|
|
1584
1923
|
active?.kind === "anon" ? "Clear account" : "Sign out"
|
|
1585
1924
|
]
|
|
1586
1925
|
}
|
|
1587
1926
|
),
|
|
1588
|
-
otherAccounts.length > 0 && /* @__PURE__ */ (0,
|
|
1589
|
-
/* @__PURE__ */ (0,
|
|
1590
|
-
/* @__PURE__ */ (0,
|
|
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" })
|
|
1591
1930
|
] }),
|
|
1592
|
-
otherAccounts.map((account) => /* @__PURE__ */ (0,
|
|
1931
|
+
otherAccounts.map((account) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1593
1932
|
import_menu.Menu.Item,
|
|
1594
1933
|
{
|
|
1595
1934
|
className: "basic-menu-item",
|
|
1596
1935
|
disabled: action.pending,
|
|
1597
1936
|
onClick: () => void action.run(() => accounts.switchAccount(account.id)),
|
|
1598
1937
|
children: [
|
|
1599
|
-
/* @__PURE__ */ (0,
|
|
1938
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1600
1939
|
AccountAvatar,
|
|
1601
1940
|
{
|
|
1602
1941
|
profile: account,
|
|
@@ -1605,16 +1944,16 @@ function UserMenu({
|
|
|
1605
1944
|
showSyncBadge: false
|
|
1606
1945
|
}
|
|
1607
1946
|
),
|
|
1608
|
-
/* @__PURE__ */ (0,
|
|
1609
|
-
/* @__PURE__ */ (0,
|
|
1610
|
-
account.kind !== "anon" && account.handle && /* @__PURE__ */ (0,
|
|
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) })
|
|
1611
1950
|
] }),
|
|
1612
|
-
/* @__PURE__ */ (0,
|
|
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 })
|
|
1613
1952
|
]
|
|
1614
1953
|
},
|
|
1615
1954
|
account.id
|
|
1616
1955
|
)),
|
|
1617
|
-
(allowAddAccount || !auth.isSignedIn && !expired) && /* @__PURE__ */ (0,
|
|
1956
|
+
(allowAddAccount || !auth.isSignedIn && !expired) && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1618
1957
|
import_menu.Menu.Item,
|
|
1619
1958
|
{
|
|
1620
1959
|
className: "basic-menu-item",
|
|
@@ -1623,7 +1962,7 @@ function UserMenu({
|
|
|
1623
1962
|
() => allowAddAccount ? accounts.addAccount({ signIn: true }) : auth.signIn()
|
|
1624
1963
|
),
|
|
1625
1964
|
children: [
|
|
1626
|
-
/* @__PURE__ */ (0,
|
|
1965
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1627
1966
|
"svg",
|
|
1628
1967
|
{
|
|
1629
1968
|
className: "basic-menu-icon",
|
|
@@ -1635,7 +1974,7 @@ function UserMenu({
|
|
|
1635
1974
|
strokeWidth: "1.75",
|
|
1636
1975
|
strokeLinecap: "round",
|
|
1637
1976
|
"aria-hidden": "true",
|
|
1638
|
-
children: /* @__PURE__ */ (0,
|
|
1977
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M12 5v14M5 12h14" })
|
|
1639
1978
|
}
|
|
1640
1979
|
),
|
|
1641
1980
|
"Add account"
|
|
@@ -1644,7 +1983,7 @@ function UserMenu({
|
|
|
1644
1983
|
)
|
|
1645
1984
|
] }) }) })
|
|
1646
1985
|
] }),
|
|
1647
|
-
/* @__PURE__ */ (0,
|
|
1986
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1648
1987
|
ActionError,
|
|
1649
1988
|
{
|
|
1650
1989
|
error: action.error,
|
|
@@ -1652,7 +1991,7 @@ function UserMenu({
|
|
|
1652
1991
|
finalFocus: triggerRef
|
|
1653
1992
|
}
|
|
1654
1993
|
),
|
|
1655
|
-
/* @__PURE__ */ (0,
|
|
1994
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1656
1995
|
Modal,
|
|
1657
1996
|
{
|
|
1658
1997
|
open: clearAccountId !== null,
|
|
@@ -1663,8 +2002,8 @@ function UserMenu({
|
|
|
1663
2002
|
finalFocus: triggerRef,
|
|
1664
2003
|
title: "Clear local account?",
|
|
1665
2004
|
description: "This deletes this account\u2019s local data, including unsynced changes. This cannot be undone.",
|
|
1666
|
-
children: /* @__PURE__ */ (0,
|
|
1667
|
-
/* @__PURE__ */ (0,
|
|
2005
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "basic-actions", children: [
|
|
2006
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1668
2007
|
BasicButton,
|
|
1669
2008
|
{
|
|
1670
2009
|
disabled: action.pending,
|
|
@@ -1672,7 +2011,7 @@ function UserMenu({
|
|
|
1672
2011
|
children: "Cancel"
|
|
1673
2012
|
}
|
|
1674
2013
|
),
|
|
1675
|
-
/* @__PURE__ */ (0,
|
|
2014
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1676
2015
|
BasicButton,
|
|
1677
2016
|
{
|
|
1678
2017
|
disabled: action.pending,
|
|
@@ -1688,7 +2027,7 @@ function UserMenu({
|
|
|
1688
2027
|
] })
|
|
1689
2028
|
}
|
|
1690
2029
|
),
|
|
1691
|
-
/* @__PURE__ */ (0,
|
|
2030
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1692
2031
|
AccountSettingsModal,
|
|
1693
2032
|
{
|
|
1694
2033
|
auth,
|
|
@@ -1699,6 +2038,8 @@ function UserMenu({
|
|
|
1699
2038
|
finalFocus: triggerRef,
|
|
1700
2039
|
accountSettingsUrl,
|
|
1701
2040
|
projectProfile,
|
|
2041
|
+
invites,
|
|
2042
|
+
showInvites,
|
|
1702
2043
|
sync
|
|
1703
2044
|
}
|
|
1704
2045
|
)
|
|
@@ -1709,7 +2050,7 @@ function ActionError({
|
|
|
1709
2050
|
onClose,
|
|
1710
2051
|
finalFocus
|
|
1711
2052
|
}) {
|
|
1712
|
-
return /* @__PURE__ */ (0,
|
|
2053
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1713
2054
|
Modal,
|
|
1714
2055
|
{
|
|
1715
2056
|
open: !!error,
|
|
@@ -1721,8 +2062,8 @@ function ActionError({
|
|
|
1721
2062
|
title: "Unable to complete action",
|
|
1722
2063
|
description: "Your request could not be completed.",
|
|
1723
2064
|
children: [
|
|
1724
|
-
/* @__PURE__ */ (0,
|
|
1725
|
-
/* @__PURE__ */ (0,
|
|
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" })
|
|
1726
2067
|
]
|
|
1727
2068
|
}
|
|
1728
2069
|
);
|
|
@@ -1734,29 +2075,36 @@ function Modal({
|
|
|
1734
2075
|
finalFocus,
|
|
1735
2076
|
title,
|
|
1736
2077
|
description,
|
|
2078
|
+
hideTitle = false,
|
|
1737
2079
|
header,
|
|
1738
2080
|
sectionLabel,
|
|
1739
2081
|
children
|
|
1740
2082
|
}) {
|
|
1741
2083
|
const appearance = useAppearanceProps();
|
|
1742
|
-
return /* @__PURE__ */ (0,
|
|
1743
|
-
trigger !== null && ((0,
|
|
1744
|
-
/* @__PURE__ */ (0,
|
|
1745
|
-
/* @__PURE__ */ (0,
|
|
1746
|
-
/* @__PURE__ */ (0,
|
|
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)(
|
|
1747
2089
|
import_dialog.Dialog.Popup,
|
|
1748
2090
|
{
|
|
1749
2091
|
...appearance,
|
|
1750
2092
|
finalFocus,
|
|
1751
2093
|
className: "basic-ui basic-dialog",
|
|
1752
2094
|
children: [
|
|
1753
|
-
/* @__PURE__ */ (0,
|
|
2095
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1754
2096
|
"div",
|
|
1755
2097
|
{
|
|
1756
|
-
className: `basic-dialog-heading${header ? " basic-dialog-heading-overlay" : ""}`,
|
|
2098
|
+
className: `basic-dialog-heading${header || hideTitle ? " basic-dialog-heading-overlay" : ""}`,
|
|
1757
2099
|
children: [
|
|
1758
|
-
/* @__PURE__ */ (0,
|
|
1759
|
-
|
|
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)(
|
|
1760
2108
|
import_dialog.Dialog.Close,
|
|
1761
2109
|
{
|
|
1762
2110
|
className: "basic-button",
|
|
@@ -1768,14 +2116,14 @@ function Modal({
|
|
|
1768
2116
|
}
|
|
1769
2117
|
),
|
|
1770
2118
|
header,
|
|
1771
|
-
/* @__PURE__ */ (0,
|
|
2119
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1772
2120
|
import_dialog.Dialog.Description,
|
|
1773
2121
|
{
|
|
1774
2122
|
className: header ? "basic-sr-only" : "basic-muted",
|
|
1775
2123
|
children: description
|
|
1776
2124
|
}
|
|
1777
2125
|
),
|
|
1778
|
-
sectionLabel && /* @__PURE__ */ (0,
|
|
2126
|
+
sectionLabel && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "basic-modal-section", children: sectionLabel }),
|
|
1779
2127
|
children
|
|
1780
2128
|
]
|
|
1781
2129
|
}
|
|
@@ -1788,6 +2136,8 @@ function AccountSettingsModal({
|
|
|
1788
2136
|
accounts: suppliedAccounts,
|
|
1789
2137
|
accountSettingsUrl,
|
|
1790
2138
|
projectProfile,
|
|
2139
|
+
invites,
|
|
2140
|
+
showInvites = true,
|
|
1791
2141
|
sync,
|
|
1792
2142
|
children,
|
|
1793
2143
|
...props
|
|
@@ -1801,7 +2151,7 @@ function AccountSettingsModal({
|
|
|
1801
2151
|
const client = useRequiredClient();
|
|
1802
2152
|
const account = accounts.activeAccount;
|
|
1803
2153
|
const copyAction = useAction();
|
|
1804
|
-
const [copied, setCopied] = (0,
|
|
2154
|
+
const [copied, setCopied] = (0, import_react15.useState)(null);
|
|
1805
2155
|
const details = [
|
|
1806
2156
|
[
|
|
1807
2157
|
"Account DID",
|
|
@@ -1826,27 +2176,28 @@ function AccountSettingsModal({
|
|
|
1826
2176
|
["Conflicts", String(syncState.conflicts.length)]
|
|
1827
2177
|
];
|
|
1828
2178
|
const diagnostics = JSON.stringify(Object.fromEntries(details), null, 2);
|
|
1829
|
-
return /* @__PURE__ */ (0,
|
|
2179
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1830
2180
|
Modal,
|
|
1831
2181
|
{
|
|
1832
2182
|
...props,
|
|
1833
2183
|
title: "Account settings",
|
|
1834
2184
|
description: "Your identity and session on this device.",
|
|
1835
|
-
header: /* @__PURE__ */ (0,
|
|
1836
|
-
children: /* @__PURE__ */ (0,
|
|
1837
|
-
/* @__PURE__ */ (0,
|
|
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)(
|
|
1838
2188
|
import_tabs.Tabs.List,
|
|
1839
2189
|
{
|
|
1840
2190
|
className: "basic-tabs",
|
|
1841
2191
|
"aria-label": "Account settings sections",
|
|
1842
2192
|
children: [
|
|
1843
|
-
/* @__PURE__ */ (0,
|
|
1844
|
-
/* @__PURE__ */ (0,
|
|
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" })
|
|
1845
2196
|
]
|
|
1846
2197
|
}
|
|
1847
2198
|
),
|
|
1848
|
-
/* @__PURE__ */ (0,
|
|
1849
|
-
auth.isSignedIn && /* @__PURE__ */ (0,
|
|
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)(
|
|
1850
2201
|
ProjectProfileEditor,
|
|
1851
2202
|
{
|
|
1852
2203
|
profile: projectProfile,
|
|
@@ -1854,18 +2205,19 @@ function AccountSettingsModal({
|
|
|
1854
2205
|
},
|
|
1855
2206
|
accounts.activeAccount?.id ?? auth.did
|
|
1856
2207
|
),
|
|
1857
|
-
accountSettingsUrl && /* @__PURE__ */ (0,
|
|
2208
|
+
accountSettingsUrl && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("a", { className: "basic-link", href: accountSettingsUrl, children: "Manage profile and security \u2197" }),
|
|
1858
2209
|
children,
|
|
1859
|
-
!auth.isSignedIn && /* @__PURE__ */ (0,
|
|
2210
|
+
!auth.isSignedIn && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "basic-actions", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SignInButton, { auth }) })
|
|
1860
2211
|
] }),
|
|
1861
|
-
/* @__PURE__ */ (0,
|
|
1862
|
-
|
|
1863
|
-
/* @__PURE__ */ (0,
|
|
1864
|
-
|
|
1865
|
-
/* @__PURE__ */ (0,
|
|
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 })
|
|
1866
2218
|
] }, label)) }),
|
|
1867
|
-
/* @__PURE__ */ (0,
|
|
1868
|
-
/* @__PURE__ */ (0,
|
|
2219
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "basic-actions", children: [
|
|
2220
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1869
2221
|
BasicButton,
|
|
1870
2222
|
{
|
|
1871
2223
|
disabled: copyAction.pending,
|
|
@@ -1881,9 +2233,9 @@ function AccountSettingsModal({
|
|
|
1881
2233
|
children: "Copy to clipboard"
|
|
1882
2234
|
}
|
|
1883
2235
|
),
|
|
1884
|
-
copied === diagnostics && /* @__PURE__ */ (0,
|
|
2236
|
+
copied === diagnostics && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { role: "status", className: "basic-muted", children: "Copied" })
|
|
1885
2237
|
] }),
|
|
1886
|
-
copyAction.error && /* @__PURE__ */ (0,
|
|
2238
|
+
copyAction.error && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { role: "alert", className: "basic-error", children: copyAction.error })
|
|
1887
2239
|
] })
|
|
1888
2240
|
] })
|
|
1889
2241
|
}
|
|
@@ -1893,8 +2245,8 @@ function AccountHeader({
|
|
|
1893
2245
|
account,
|
|
1894
2246
|
sync
|
|
1895
2247
|
}) {
|
|
1896
|
-
return /* @__PURE__ */ (0,
|
|
1897
|
-
/* @__PURE__ */ (0,
|
|
2248
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "basic-profile", children: [
|
|
2249
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1898
2250
|
AccountAvatar,
|
|
1899
2251
|
{
|
|
1900
2252
|
profile: account,
|
|
@@ -1903,10 +2255,10 @@ function AccountHeader({
|
|
|
1903
2255
|
showSyncBadge: false
|
|
1904
2256
|
}
|
|
1905
2257
|
),
|
|
1906
|
-
/* @__PURE__ */ (0,
|
|
1907
|
-
/* @__PURE__ */ (0,
|
|
1908
|
-
account?.kind !== "anon" && account?.handle && /* @__PURE__ */ (0,
|
|
1909
|
-
/* @__PURE__ */ (0,
|
|
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 }) })
|
|
1910
2262
|
] })
|
|
1911
2263
|
] });
|
|
1912
2264
|
}
|
|
@@ -1917,9 +2269,9 @@ function ProjectProfileEditor({
|
|
|
1917
2269
|
const live = useProjectProfile(supplied === void 0);
|
|
1918
2270
|
const profile = supplied ?? live;
|
|
1919
2271
|
const action = useAction();
|
|
1920
|
-
const [draft, setDraft] = (0,
|
|
1921
|
-
const [saved, setSaved] = (0,
|
|
1922
|
-
return /* @__PURE__ */ (0,
|
|
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)(
|
|
1923
2275
|
"form",
|
|
1924
2276
|
{
|
|
1925
2277
|
className: "basic-profile-editor",
|
|
@@ -1933,15 +2285,15 @@ function ProjectProfileEditor({
|
|
|
1933
2285
|
});
|
|
1934
2286
|
},
|
|
1935
2287
|
children: [
|
|
1936
|
-
/* @__PURE__ */ (0,
|
|
1937
|
-
/* @__PURE__ */ (0,
|
|
1938
|
-
profile.isLoading ? /* @__PURE__ */ (0,
|
|
1939
|
-
/* @__PURE__ */ (0,
|
|
1940
|
-
/* @__PURE__ */ (0,
|
|
1941
|
-
] }) : profile.data && /* @__PURE__ */ (0,
|
|
1942
|
-
/* @__PURE__ */ (0,
|
|
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: [
|
|
1943
2295
|
"Display name",
|
|
1944
|
-
/* @__PURE__ */ (0,
|
|
2296
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1945
2297
|
"input",
|
|
1946
2298
|
{
|
|
1947
2299
|
className: "basic-input",
|
|
@@ -1958,8 +2310,8 @@ function ProjectProfileEditor({
|
|
|
1958
2310
|
}
|
|
1959
2311
|
)
|
|
1960
2312
|
] }),
|
|
1961
|
-
/* @__PURE__ */ (0,
|
|
1962
|
-
/* @__PURE__ */ (0,
|
|
2313
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "basic-actions basic-modal-footer", children: [
|
|
2314
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1963
2315
|
BasicButton,
|
|
1964
2316
|
{
|
|
1965
2317
|
variant: "ghost",
|
|
@@ -1970,7 +2322,7 @@ function ProjectProfileEditor({
|
|
|
1970
2322
|
children: "Cancel"
|
|
1971
2323
|
}
|
|
1972
2324
|
),
|
|
1973
|
-
/* @__PURE__ */ (0,
|
|
2325
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1974
2326
|
BasicButton,
|
|
1975
2327
|
{
|
|
1976
2328
|
type: "submit",
|
|
@@ -1981,17 +2333,205 @@ function ProjectProfileEditor({
|
|
|
1981
2333
|
)
|
|
1982
2334
|
] })
|
|
1983
2335
|
] }),
|
|
1984
|
-
action.error && /* @__PURE__ */ (0,
|
|
1985
|
-
saved && /* @__PURE__ */ (0,
|
|
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
|
+
)
|
|
1986
2372
|
]
|
|
1987
2373
|
}
|
|
1988
2374
|
);
|
|
1989
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
|
+
}
|
|
1990
2529
|
function SharesModal({
|
|
1991
2530
|
auth: supplied,
|
|
1992
2531
|
accounts: suppliedAccounts,
|
|
1993
2532
|
sync,
|
|
1994
2533
|
shares,
|
|
2534
|
+
invites,
|
|
1995
2535
|
scope,
|
|
1996
2536
|
repo = "default",
|
|
1997
2537
|
...props
|
|
@@ -1999,37 +2539,43 @@ function SharesModal({
|
|
|
1999
2539
|
const live = useAuth();
|
|
2000
2540
|
const liveAccounts = useAccounts();
|
|
2001
2541
|
const auth = supplied ?? live;
|
|
2002
|
-
return /* @__PURE__ */ (0,
|
|
2542
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2003
2543
|
Modal,
|
|
2004
2544
|
{
|
|
2005
2545
|
...props,
|
|
2006
2546
|
title: "Shares",
|
|
2007
2547
|
description: "Manage incoming invitations and share access to selected data.",
|
|
2008
|
-
header: /* @__PURE__ */ (0,
|
|
2548
|
+
header: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2009
2549
|
AccountHeader,
|
|
2010
2550
|
{
|
|
2011
2551
|
account: (suppliedAccounts ?? liveAccounts).activeAccount,
|
|
2012
2552
|
sync
|
|
2013
2553
|
}
|
|
2014
2554
|
),
|
|
2015
|
-
children: !auth.isReady ? /* @__PURE__ */ (0,
|
|
2016
|
-
/* @__PURE__ */ (0,
|
|
2017
|
-
/* @__PURE__ */ (0,
|
|
2018
|
-
] }) : /* @__PURE__ */ (0,
|
|
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)(
|
|
2019
2559
|
SharesContent,
|
|
2020
2560
|
{
|
|
2021
2561
|
shares,
|
|
2562
|
+
invites,
|
|
2563
|
+
auth,
|
|
2564
|
+
accounts: suppliedAccounts ?? liveAccounts,
|
|
2022
2565
|
scope,
|
|
2023
2566
|
repo,
|
|
2024
2567
|
canWrite: auth.canWrite
|
|
2025
2568
|
},
|
|
2026
|
-
|
|
2569
|
+
(suppliedAccounts ?? liveAccounts).activeAccount?.id ?? auth.did
|
|
2027
2570
|
)
|
|
2028
2571
|
}
|
|
2029
2572
|
);
|
|
2030
2573
|
}
|
|
2031
2574
|
function SharesContent({
|
|
2032
2575
|
shares: supplied,
|
|
2576
|
+
invites,
|
|
2577
|
+
auth,
|
|
2578
|
+
accounts,
|
|
2033
2579
|
scope,
|
|
2034
2580
|
repo,
|
|
2035
2581
|
canWrite
|
|
@@ -2037,36 +2583,32 @@ function SharesContent({
|
|
|
2037
2583
|
const live = useOutgoingShares();
|
|
2038
2584
|
const shares = supplied ?? live;
|
|
2039
2585
|
const action = useAction();
|
|
2040
|
-
const [recipient, setRecipient] = (0,
|
|
2041
|
-
const [role, setRole] = (0,
|
|
2042
|
-
const [confirmation, setConfirmation] = (0,
|
|
2043
|
-
const [message, setMessage] = (0,
|
|
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)("");
|
|
2044
2590
|
const scopeValid = scope.length > 0 && scope.every(
|
|
2045
2591
|
(item) => item.table.trim() && (item.recordIds === void 0 || item.recordIds.length > 0)
|
|
2046
2592
|
);
|
|
2047
|
-
return /* @__PURE__ */ (0,
|
|
2048
|
-
/* @__PURE__ */ (0,
|
|
2049
|
-
/* @__PURE__ */ (0,
|
|
2050
|
-
/* @__PURE__ */ (0,
|
|
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" })
|
|
2051
2597
|
] }),
|
|
2052
|
-
/* @__PURE__ */ (0,
|
|
2053
|
-
|
|
2054
|
-
/* @__PURE__ */ (0,
|
|
2055
|
-
/* @__PURE__ */ (0,
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "basic-muted", children: "Revoking access stops future requests. It cannot retract data the recipient already downloaded." }),
|
|
2059
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "basic-scope", children: [
|
|
2060
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { children: "New invitation permissions" }),
|
|
2061
|
-
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: [
|
|
2062
2604
|
item.table,
|
|
2063
2605
|
" \xB7",
|
|
2064
2606
|
" ",
|
|
2065
2607
|
item.recordIds ? `${item.recordIds.length} selected records` : "all records"
|
|
2066
2608
|
] }, index))
|
|
2067
2609
|
] }),
|
|
2068
|
-
!canWrite && /* @__PURE__ */ (0,
|
|
2069
|
-
/* @__PURE__ */ (0,
|
|
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)(
|
|
2070
2612
|
"form",
|
|
2071
2613
|
{
|
|
2072
2614
|
className: "basic-share-form",
|
|
@@ -2086,9 +2628,9 @@ function SharesContent({
|
|
|
2086
2628
|
});
|
|
2087
2629
|
},
|
|
2088
2630
|
children: [
|
|
2089
|
-
/* @__PURE__ */ (0,
|
|
2631
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "basic-field", children: [
|
|
2090
2632
|
"Recipient handle or DID",
|
|
2091
|
-
/* @__PURE__ */ (0,
|
|
2633
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2092
2634
|
"input",
|
|
2093
2635
|
{
|
|
2094
2636
|
className: "basic-input",
|
|
@@ -2100,9 +2642,9 @@ function SharesContent({
|
|
|
2100
2642
|
}
|
|
2101
2643
|
)
|
|
2102
2644
|
] }),
|
|
2103
|
-
/* @__PURE__ */ (0,
|
|
2645
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "basic-field", children: [
|
|
2104
2646
|
"Permission",
|
|
2105
|
-
/* @__PURE__ */ (0,
|
|
2647
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
2106
2648
|
"select",
|
|
2107
2649
|
{
|
|
2108
2650
|
className: "basic-input",
|
|
@@ -2110,13 +2652,13 @@ function SharesContent({
|
|
|
2110
2652
|
onChange: (event) => setRole(event.target.value),
|
|
2111
2653
|
disabled: action.pending || !canWrite,
|
|
2112
2654
|
children: [
|
|
2113
|
-
/* @__PURE__ */ (0,
|
|
2114
|
-
/* @__PURE__ */ (0,
|
|
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" })
|
|
2115
2657
|
]
|
|
2116
2658
|
}
|
|
2117
2659
|
)
|
|
2118
2660
|
] }),
|
|
2119
|
-
/* @__PURE__ */ (0,
|
|
2661
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2120
2662
|
BasicButton,
|
|
2121
2663
|
{
|
|
2122
2664
|
type: "submit",
|
|
@@ -2128,12 +2670,12 @@ function SharesContent({
|
|
|
2128
2670
|
]
|
|
2129
2671
|
}
|
|
2130
2672
|
),
|
|
2131
|
-
!scopeValid && /* @__PURE__ */ (0,
|
|
2132
|
-
action.error && /* @__PURE__ */ (0,
|
|
2133
|
-
message && /* @__PURE__ */ (0,
|
|
2134
|
-
/* @__PURE__ */ (0,
|
|
2135
|
-
/* @__PURE__ */ (0,
|
|
2136
|
-
/* @__PURE__ */ (0,
|
|
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)(
|
|
2137
2679
|
BasicButton,
|
|
2138
2680
|
{
|
|
2139
2681
|
disabled: action.pending || shares.isLoading,
|
|
@@ -2142,10 +2684,15 @@ function SharesContent({
|
|
|
2142
2684
|
}
|
|
2143
2685
|
)
|
|
2144
2686
|
] }),
|
|
2145
|
-
shares.isLoading ? /* @__PURE__ */ (0,
|
|
2146
|
-
/* @__PURE__ */ (0,
|
|
2147
|
-
|
|
2148
|
-
/* @__PURE__ */ (0,
|
|
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: [
|
|
2149
2696
|
share.role === "viewer" ? "Can view" : "Can edit",
|
|
2150
2697
|
" \xB7",
|
|
2151
2698
|
" ",
|
|
@@ -2155,9 +2702,9 @@ function SharesContent({
|
|
|
2155
2702
|
share.scope.map((item) => item.table).join(", ")
|
|
2156
2703
|
] })
|
|
2157
2704
|
] }),
|
|
2158
|
-
share.state !== "ended" && (confirmation === share.id ? /* @__PURE__ */ (0,
|
|
2159
|
-
/* @__PURE__ */ (0,
|
|
2160
|
-
/* @__PURE__ */ (0,
|
|
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)(
|
|
2161
2708
|
BasicButton,
|
|
2162
2709
|
{
|
|
2163
2710
|
disabled: action.pending || !canWrite,
|
|
@@ -2176,7 +2723,7 @@ function SharesContent({
|
|
|
2176
2723
|
]
|
|
2177
2724
|
}
|
|
2178
2725
|
),
|
|
2179
|
-
/* @__PURE__ */ (0,
|
|
2726
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2180
2727
|
BasicButton,
|
|
2181
2728
|
{
|
|
2182
2729
|
disabled: action.pending,
|
|
@@ -2184,7 +2731,7 @@ function SharesContent({
|
|
|
2184
2731
|
children: "Keep access"
|
|
2185
2732
|
}
|
|
2186
2733
|
)
|
|
2187
|
-
] }) : /* @__PURE__ */ (0,
|
|
2734
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2188
2735
|
BasicButton,
|
|
2189
2736
|
{
|
|
2190
2737
|
disabled: action.pending || !canWrite,
|
|
@@ -2206,6 +2753,11 @@ function SharesContent({
|
|
|
2206
2753
|
BrowserKeyValueStorage,
|
|
2207
2754
|
BrowserTokenStore,
|
|
2208
2755
|
PersistenceStore,
|
|
2756
|
+
ShareInvites,
|
|
2757
|
+
ShareInvitesModal,
|
|
2758
|
+
ShareRecipientAvatar,
|
|
2759
|
+
ShareRecipientAvatars,
|
|
2760
|
+
ShareRecipientLabel,
|
|
2209
2761
|
SharesModal,
|
|
2210
2762
|
SignInButton,
|
|
2211
2763
|
SignOutButton,
|
|
@@ -2234,6 +2786,8 @@ function SharesContent({
|
|
|
2234
2786
|
useQuery,
|
|
2235
2787
|
useRepos,
|
|
2236
2788
|
useSchemaStatus,
|
|
2789
|
+
useShareInvites,
|
|
2790
|
+
useShareRecipients,
|
|
2237
2791
|
useStorageInfo,
|
|
2238
2792
|
useSyncStatus
|
|
2239
2793
|
});
|