@singi-labs/sifa-sdk 0.12.78 → 0.12.80

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.
Files changed (33) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.js +1 -1
  3. package/dist/{network-map-DMpXK9rM.d.cts → network-map-DMfaQ1UI.d.cts} +32 -2
  4. package/dist/{network-map-kR4Ndke4.d.ts → network-map-FK6emkhf.d.ts} +32 -2
  5. package/dist/{org-CnAMbO63.d.ts → org-Dg25S76d.d.ts} +2 -1
  6. package/dist/{org-DQyVyZ65.d.cts → org-gIoCYQNA.d.cts} +2 -1
  7. package/dist/query/fetchers/index.cjs +19 -1
  8. package/dist/query/fetchers/index.cjs.map +1 -1
  9. package/dist/query/fetchers/index.d.cts +3 -3
  10. package/dist/query/fetchers/index.d.ts +3 -3
  11. package/dist/query/fetchers/index.js +19 -2
  12. package/dist/query/fetchers/index.js.map +1 -1
  13. package/dist/query/hooks/index.cjs +2 -1
  14. package/dist/query/hooks/index.cjs.map +1 -1
  15. package/dist/query/hooks/index.d.cts +3 -3
  16. package/dist/query/hooks/index.d.ts +3 -3
  17. package/dist/query/hooks/index.js +2 -1
  18. package/dist/query/hooks/index.js.map +1 -1
  19. package/dist/query/index.cjs +30 -1
  20. package/dist/query/index.cjs.map +1 -1
  21. package/dist/query/index.d.cts +11 -6
  22. package/dist/query/index.d.ts +11 -6
  23. package/dist/query/index.js +29 -2
  24. package/dist/query/index.js.map +1 -1
  25. package/dist/schemas/write/index.cjs +12 -1
  26. package/dist/schemas/write/index.cjs.map +1 -1
  27. package/dist/schemas/write/index.d.cts +21 -1
  28. package/dist/schemas/write/index.d.ts +21 -1
  29. package/dist/schemas/write/index.js +12 -2
  30. package/dist/schemas/write/index.js.map +1 -1
  31. package/dist/{use-org-notification-emails-C45soS39.d.cts → use-org-notification-emails-CdPL2KHh.d.cts} +1 -1
  32. package/dist/{use-org-notification-emails-DaZqJMfA.d.ts → use-org-notification-emails-Dh34pNU7.d.ts} +1 -1
  33. package/package.json +1 -1
@@ -447,6 +447,22 @@ function confirmEndorsement(config, data, options = {}) {
447
447
  );
448
448
  }
449
449
 
450
+ // src/query/fetchers/received-endorsements.ts
451
+ async function fetchReceivedEndorsements(config, did, options = {}) {
452
+ const { limit, ...fetchOptions } = options;
453
+ const qs = limit ? `?limit=${limit}` : "";
454
+ try {
455
+ const data = await apiFetch(
456
+ config,
457
+ `/api/endorsement/${encodeIdentifier(did)}${qs}`,
458
+ { cache: "no-store", timeoutMs: 5e3, ...fetchOptions }
459
+ );
460
+ return { endorsements: data?.endorsements ?? [], cursor: data?.cursor };
461
+ } catch {
462
+ return { endorsements: [] };
463
+ }
464
+ }
465
+
450
466
  // src/query/fetchers/reciprocity.ts
451
467
  async function fetchReciprocityCandidate(config, options = {}) {
452
468
  try {
@@ -1544,7 +1560,8 @@ var sifaQueryKeys = {
1544
1560
  pending: () => ["sifa", "endorsement", "pending"],
1545
1561
  // Also session-scoped: the AppView picks the candidate from the viewer's
1546
1562
  // own follows, dismissals and blocks.
1547
- reciprocity: () => ["sifa", "endorsement", "reciprocity"]
1563
+ reciprocity: () => ["sifa", "endorsement", "reciprocity"],
1564
+ received: (did) => ["sifa", "endorsement", "received", did]
1548
1565
  },
1549
1566
  confirmation: {
1550
1567
  all: () => ["sifa", "confirmation"],
@@ -2181,6 +2198,16 @@ function useCreateEndorsement(endorsedHandleOrDid, options) {
2181
2198
  }
2182
2199
  });
2183
2200
  }
2201
+ function useReceivedEndorsements(did, options) {
2202
+ const config = useSifaConfig();
2203
+ const { limit, ...queryOptions } = options ?? {};
2204
+ return reactQuery.useQuery({
2205
+ queryKey: sifaQueryKeys.endorsement.received(did ?? ""),
2206
+ queryFn: () => fetchReceivedEndorsements(config, did ?? "", { limit }),
2207
+ enabled: Boolean(did) && (queryOptions.enabled ?? true),
2208
+ ...queryOptions
2209
+ });
2210
+ }
2184
2211
  function useReciprocityCandidate(options) {
2185
2212
  const config = useSifaConfig();
2186
2213
  return reactQuery.useQuery({
@@ -3301,6 +3328,7 @@ exports.fetchPendingEndorsements = fetchPendingEndorsements;
3301
3328
  exports.fetchProfile = fetchProfile;
3302
3329
  exports.fetchProfileSummary = fetchProfileSummary;
3303
3330
  exports.fetchReactionStatus = fetchReactionStatus;
3331
+ exports.fetchReceivedEndorsements = fetchReceivedEndorsements;
3304
3332
  exports.fetchReciprocityCandidate = fetchReciprocityCandidate;
3305
3333
  exports.fetchRepoInventory = fetchRepoInventory;
3306
3334
  exports.fetchResolveActor = fetchResolveActor;
@@ -3445,6 +3473,7 @@ exports.usePendingConfirmations = usePendingConfirmations;
3445
3473
  exports.usePendingEndorsements = usePendingEndorsements;
3446
3474
  exports.useProfile = useProfile;
3447
3475
  exports.useReactionStatus = useReactionStatus;
3476
+ exports.useReceivedEndorsements = useReceivedEndorsements;
3448
3477
  exports.useReciprocityCandidate = useReciprocityCandidate;
3449
3478
  exports.useRefreshOrcidPublications = useRefreshOrcidPublications;
3450
3479
  exports.useRefreshPds = useRefreshPds;