@singi-labs/sifa-sdk 0.18.11 → 0.18.12
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.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{network-map-CMod-9od.d.ts → network-map-5WbfyFed.d.ts} +12 -3
- package/dist/{network-map-CH37aj_Q.d.cts → network-map-Cwv7SsL0.d.cts} +12 -3
- package/dist/{org-3gFPQ_pC.d.cts → org-BHz9ymjp.d.cts} +122 -4
- package/dist/{org-CTSJ5zTZ.d.ts → org-Bgz5parA.d.ts} +122 -4
- package/dist/query/fetchers/index.cjs +116 -5
- package/dist/query/fetchers/index.cjs.map +1 -1
- package/dist/query/fetchers/index.d.cts +3 -3
- package/dist/query/fetchers/index.d.ts +3 -3
- package/dist/query/fetchers/index.js +113 -6
- package/dist/query/fetchers/index.js.map +1 -1
- package/dist/query/hooks/index.cjs +152 -4
- package/dist/query/hooks/index.cjs.map +1 -1
- package/dist/query/hooks/index.d.cts +3 -3
- package/dist/query/hooks/index.d.ts +3 -3
- package/dist/query/hooks/index.js +150 -5
- package/dist/query/hooks/index.js.map +1 -1
- package/dist/query/index.cjs +161 -5
- package/dist/query/index.cjs.map +1 -1
- package/dist/query/index.d.cts +5 -5
- package/dist/query/index.d.ts +5 -5
- package/dist/query/index.js +155 -6
- package/dist/query/index.js.map +1 -1
- package/dist/{use-org-notification-emails-J29DcsSu.d.ts → use-org-notification-emails-C9CWyhSC.d.ts} +24 -2
- package/dist/{use-org-notification-emails-CdRgTAj4.d.cts → use-org-notification-emails-vNekuQKF.d.cts} +24 -2
- package/package.json +1 -1
|
@@ -161,11 +161,23 @@ var sifaQueryKeys = {
|
|
|
161
161
|
byHandle: (handleOrDid) => ["sifa", "profile", handleOrDid],
|
|
162
162
|
atFundLink: (did) => ["sifa", "profile", "at-fund-link", did],
|
|
163
163
|
view: (actor) => ["sifa", "profile", "view", actor],
|
|
164
|
-
externalAccounts: (handleOrDid) => ["sifa", "profile", "external-accounts", handleOrDid]
|
|
164
|
+
externalAccounts: (handleOrDid) => ["sifa", "profile", "external-accounts", handleOrDid],
|
|
165
|
+
// Session-scoped: the AppView reads the owner from the session cookie, so
|
|
166
|
+
// there is only ever one completeness result per client.
|
|
167
|
+
completeness: () => ["sifa", "profile", "completeness"]
|
|
165
168
|
},
|
|
166
169
|
position: {
|
|
167
170
|
all: () => ["sifa", "position"],
|
|
168
|
-
byOwner: (did) => ["sifa", "position", "by-owner", did]
|
|
171
|
+
byOwner: (did) => ["sifa", "position", "by-owner", did],
|
|
172
|
+
// Session-scoped: the AppView reads the owner from the session cookie.
|
|
173
|
+
unlinked: () => ["sifa", "position", "unlinked"]
|
|
174
|
+
},
|
|
175
|
+
// Aggregate inbox counts for the header bell badge (session-scoped). The first
|
|
176
|
+
// aggregate namespace: it fans in across confirmations, endorsements, drift,
|
|
177
|
+
// unlinked positions and profile completeness on the server.
|
|
178
|
+
inbox: {
|
|
179
|
+
all: () => ["sifa", "inbox"],
|
|
180
|
+
counts: () => ["sifa", "inbox", "counts"]
|
|
169
181
|
},
|
|
170
182
|
search: {
|
|
171
183
|
all: () => ["sifa", "search"],
|
|
@@ -1207,12 +1219,16 @@ function useCreateEndorsement(endorsedHandleOrDid, options) {
|
|
|
1207
1219
|
|
|
1208
1220
|
// src/query/fetchers/confirmations.ts
|
|
1209
1221
|
async function fetchPendingConfirmations(config, options = {}) {
|
|
1222
|
+
const { cookieHeader, ...rest } = options;
|
|
1223
|
+
const headers = { ...rest.headers ?? {} };
|
|
1224
|
+
if (cookieHeader) headers.cookie = cookieHeader;
|
|
1210
1225
|
try {
|
|
1211
1226
|
const data = await apiFetch(config, "/api/confirmations/pending", {
|
|
1212
1227
|
cache: "no-store",
|
|
1213
1228
|
credentials: "include",
|
|
1214
1229
|
timeoutMs: 5e3,
|
|
1215
|
-
...
|
|
1230
|
+
...rest,
|
|
1231
|
+
headers
|
|
1216
1232
|
});
|
|
1217
1233
|
return { confirmations: data?.confirmations ?? [], cursor: data?.cursor };
|
|
1218
1234
|
} catch {
|
|
@@ -1220,11 +1236,14 @@ async function fetchPendingConfirmations(config, options = {}) {
|
|
|
1220
1236
|
}
|
|
1221
1237
|
}
|
|
1222
1238
|
async function fetchGivenConfirmations(config, options = {}) {
|
|
1239
|
+
const { cookieHeader, ...rest } = options;
|
|
1240
|
+
const headers = { ...rest.headers ?? {} };
|
|
1241
|
+
if (cookieHeader) headers.cookie = cookieHeader;
|
|
1223
1242
|
try {
|
|
1224
1243
|
const data = await apiFetch(
|
|
1225
1244
|
config,
|
|
1226
1245
|
"/api/confirmations/mine",
|
|
1227
|
-
{ cache: "no-store", credentials: "include", timeoutMs: 5e3, ...
|
|
1246
|
+
{ cache: "no-store", credentials: "include", timeoutMs: 5e3, ...rest, headers }
|
|
1228
1247
|
);
|
|
1229
1248
|
return { confirmations: data?.confirmations ?? [] };
|
|
1230
1249
|
} catch {
|
|
@@ -1274,6 +1293,9 @@ function useCreateConfirmation(claimerHandleOrDid, options) {
|
|
|
1274
1293
|
await queryClient.invalidateQueries({
|
|
1275
1294
|
queryKey: sifaQueryKeys.confirmation.given()
|
|
1276
1295
|
});
|
|
1296
|
+
await queryClient.invalidateQueries({
|
|
1297
|
+
queryKey: sifaQueryKeys.inbox.counts()
|
|
1298
|
+
});
|
|
1277
1299
|
if (claimerHandleOrDid) {
|
|
1278
1300
|
await queryClient.invalidateQueries({
|
|
1279
1301
|
queryKey: sifaQueryKeys.profile.byHandle(claimerHandleOrDid)
|
|
@@ -1297,6 +1319,9 @@ function useDismissConfirmation(options) {
|
|
|
1297
1319
|
await queryClient.invalidateQueries({
|
|
1298
1320
|
queryKey: sifaQueryKeys.confirmation.pending()
|
|
1299
1321
|
});
|
|
1322
|
+
await queryClient.invalidateQueries({
|
|
1323
|
+
queryKey: sifaQueryKeys.inbox.counts()
|
|
1324
|
+
});
|
|
1300
1325
|
}
|
|
1301
1326
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
1302
1327
|
}
|
|
@@ -1315,6 +1340,12 @@ function useRevokeConfirmation(claimerHandleOrDid, options) {
|
|
|
1315
1340
|
await queryClient.invalidateQueries({
|
|
1316
1341
|
queryKey: sifaQueryKeys.confirmation.pending()
|
|
1317
1342
|
});
|
|
1343
|
+
await queryClient.invalidateQueries({
|
|
1344
|
+
queryKey: sifaQueryKeys.confirmation.given()
|
|
1345
|
+
});
|
|
1346
|
+
await queryClient.invalidateQueries({
|
|
1347
|
+
queryKey: sifaQueryKeys.inbox.counts()
|
|
1348
|
+
});
|
|
1318
1349
|
if (claimerHandleOrDid) {
|
|
1319
1350
|
await queryClient.invalidateQueries({
|
|
1320
1351
|
queryKey: sifaQueryKeys.profile.byHandle(claimerHandleOrDid)
|
|
@@ -1326,6 +1357,120 @@ function useRevokeConfirmation(claimerHandleOrDid, options) {
|
|
|
1326
1357
|
});
|
|
1327
1358
|
}
|
|
1328
1359
|
|
|
1360
|
+
// src/query/fetchers/inbox.ts
|
|
1361
|
+
function toCount(value) {
|
|
1362
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? Math.trunc(value) : 0;
|
|
1363
|
+
}
|
|
1364
|
+
async function fetchInboxCounts(config, options = {}) {
|
|
1365
|
+
const { cookieHeader, ...rest } = options;
|
|
1366
|
+
const headers = { ...rest.headers ?? {} };
|
|
1367
|
+
if (cookieHeader) headers.cookie = cookieHeader;
|
|
1368
|
+
try {
|
|
1369
|
+
const data = await apiFetch(config, "/api/inbox/counts", {
|
|
1370
|
+
cache: "no-store",
|
|
1371
|
+
credentials: "include",
|
|
1372
|
+
timeoutMs: 5e3,
|
|
1373
|
+
...rest,
|
|
1374
|
+
headers
|
|
1375
|
+
});
|
|
1376
|
+
return {
|
|
1377
|
+
tasks: toCount(data?.tasks),
|
|
1378
|
+
unreadNotifications: toCount(data?.unreadNotifications)
|
|
1379
|
+
};
|
|
1380
|
+
} catch {
|
|
1381
|
+
return { tasks: 0, unreadNotifications: 0 };
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1385
|
+
// src/query/hooks/use-inbox.ts
|
|
1386
|
+
function useInboxCounts(options) {
|
|
1387
|
+
const config = useSifaConfig();
|
|
1388
|
+
return reactQuery.useQuery({
|
|
1389
|
+
queryKey: sifaQueryKeys.inbox.counts(),
|
|
1390
|
+
queryFn: () => fetchInboxCounts(config),
|
|
1391
|
+
...options
|
|
1392
|
+
});
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
// src/query/fetchers/unlinked-positions.ts
|
|
1396
|
+
async function fetchUnlinkedPositions(config, options = {}) {
|
|
1397
|
+
const { cookieHeader, ...rest } = options;
|
|
1398
|
+
const headers = { ...rest.headers ?? {} };
|
|
1399
|
+
if (cookieHeader) headers.cookie = cookieHeader;
|
|
1400
|
+
try {
|
|
1401
|
+
const data = await apiFetch(config, "/api/positions/unlinked", {
|
|
1402
|
+
cache: "no-store",
|
|
1403
|
+
credentials: "include",
|
|
1404
|
+
timeoutMs: 5e3,
|
|
1405
|
+
...rest,
|
|
1406
|
+
headers
|
|
1407
|
+
});
|
|
1408
|
+
return { positions: Array.isArray(data?.positions) ? data.positions : [] };
|
|
1409
|
+
} catch {
|
|
1410
|
+
return { positions: [] };
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1414
|
+
// src/query/hooks/use-unlinked-positions.ts
|
|
1415
|
+
function useUnlinkedPositions(options) {
|
|
1416
|
+
const config = useSifaConfig();
|
|
1417
|
+
return reactQuery.useQuery({
|
|
1418
|
+
queryKey: sifaQueryKeys.position.unlinked(),
|
|
1419
|
+
queryFn: () => fetchUnlinkedPositions(config),
|
|
1420
|
+
...options
|
|
1421
|
+
});
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
// src/query/fetchers/profile-completeness.ts
|
|
1425
|
+
var PROFILE_COMPLETENESS_SIGNALS = [
|
|
1426
|
+
"headline",
|
|
1427
|
+
"about",
|
|
1428
|
+
"position",
|
|
1429
|
+
"education",
|
|
1430
|
+
"skill",
|
|
1431
|
+
"certification"
|
|
1432
|
+
];
|
|
1433
|
+
async function fetchProfileCompleteness(config, options = {}) {
|
|
1434
|
+
const { cookieHeader, ...rest } = options;
|
|
1435
|
+
const headers = { ...rest.headers ?? {} };
|
|
1436
|
+
if (cookieHeader) headers.cookie = cookieHeader;
|
|
1437
|
+
const empty = {
|
|
1438
|
+
complete: true,
|
|
1439
|
+
score: PROFILE_COMPLETENESS_SIGNALS.length,
|
|
1440
|
+
total: PROFILE_COMPLETENESS_SIGNALS.length,
|
|
1441
|
+
missing: []
|
|
1442
|
+
};
|
|
1443
|
+
try {
|
|
1444
|
+
const data = await apiFetch(config, "/api/profile/completeness", {
|
|
1445
|
+
cache: "no-store",
|
|
1446
|
+
credentials: "include",
|
|
1447
|
+
timeoutMs: 5e3,
|
|
1448
|
+
...rest,
|
|
1449
|
+
headers
|
|
1450
|
+
});
|
|
1451
|
+
if (!data) return empty;
|
|
1452
|
+
const missing = Array.isArray(data.missing) ? data.missing : [];
|
|
1453
|
+
return {
|
|
1454
|
+
complete: data.complete ?? missing.length === 0,
|
|
1455
|
+
score: data.score ?? PROFILE_COMPLETENESS_SIGNALS.length - missing.length,
|
|
1456
|
+
total: data.total ?? PROFILE_COMPLETENESS_SIGNALS.length,
|
|
1457
|
+
missing
|
|
1458
|
+
};
|
|
1459
|
+
} catch {
|
|
1460
|
+
return empty;
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1463
|
+
|
|
1464
|
+
// src/query/hooks/use-profile-completeness.ts
|
|
1465
|
+
function useProfileCompleteness(options) {
|
|
1466
|
+
const config = useSifaConfig();
|
|
1467
|
+
return reactQuery.useQuery({
|
|
1468
|
+
queryKey: sifaQueryKeys.profile.completeness(),
|
|
1469
|
+
queryFn: () => fetchProfileCompleteness(config),
|
|
1470
|
+
...options
|
|
1471
|
+
});
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1329
1474
|
// src/query/fetchers/keytrace-claims.ts
|
|
1330
1475
|
function hideKeytraceClaim(config, rkey, options = {}) {
|
|
1331
1476
|
return apiWrite(
|
|
@@ -3383,6 +3528,7 @@ exports.useHideProfileItem = useHideProfileItem;
|
|
|
3383
3528
|
exports.useHideSifaPublication = useHideSifaPublication;
|
|
3384
3529
|
exports.useHideStandardPublication = useHideStandardPublication;
|
|
3385
3530
|
exports.useImportSearchEntities = useImportSearchEntities;
|
|
3531
|
+
exports.useInboxCounts = useInboxCounts;
|
|
3386
3532
|
exports.useLinkSkillToPosition = useLinkSkillToPosition;
|
|
3387
3533
|
exports.useMutuals = useMutuals;
|
|
3388
3534
|
exports.useMyGithubPullRequests = useMyGithubPullRequests;
|
|
@@ -3394,6 +3540,7 @@ exports.useOrgDomainVerify = useOrgDomainVerify;
|
|
|
3394
3540
|
exports.useOrgProfile = useOrgProfile;
|
|
3395
3541
|
exports.usePendingConfirmations = usePendingConfirmations;
|
|
3396
3542
|
exports.useProfile = useProfile;
|
|
3543
|
+
exports.useProfileCompleteness = useProfileCompleteness;
|
|
3397
3544
|
exports.useReactionStatus = useReactionStatus;
|
|
3398
3545
|
exports.useRefreshOrcidPublications = useRefreshOrcidPublications;
|
|
3399
3546
|
exports.useRefreshPds = useRefreshPds;
|
|
@@ -3425,6 +3572,7 @@ exports.useUnhideProfileItem = useUnhideProfileItem;
|
|
|
3425
3572
|
exports.useUnhideSifaPublication = useUnhideSifaPublication;
|
|
3426
3573
|
exports.useUnhideStandardPublication = useUnhideStandardPublication;
|
|
3427
3574
|
exports.useUnlinkSkillFromPosition = useUnlinkSkillFromPosition;
|
|
3575
|
+
exports.useUnlinkedPositions = useUnlinkedPositions;
|
|
3428
3576
|
exports.useUnrevealMarqueDomain = useUnrevealMarqueDomain;
|
|
3429
3577
|
exports.useUnsetExternalAccountPrimary = useUnsetExternalAccountPrimary;
|
|
3430
3578
|
exports.useUnsetPositionPrimary = useUnsetPositionPrimary;
|