@singi-labs/sifa-sdk 0.12.48 → 0.12.50

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.
@@ -196,7 +196,8 @@ var sifaQueryKeys = {
196
196
  },
197
197
  admin: {
198
198
  all: () => ["sifa", "admin"],
199
- featureAllowlist: (flag) => ["sifa", "admin", "feature-allowlist", flag]
199
+ featureAllowlist: (flag) => ["sifa", "admin", "feature-allowlist", flag],
200
+ reviewQueues: () => ["sifa", "admin", "review-queues"]
200
201
  },
201
202
  stats: {
202
203
  all: () => ["sifa", "stats"],
@@ -229,7 +230,9 @@ var sifaQueryKeys = {
229
230
  // Scoped to the session for the same reason as the endorsement inbox: the
230
231
  // AppView reads the subject from the session cookie, so there is only ever
231
232
  // one inbox per client.
232
- pending: () => ["sifa", "confirmation", "pending"]
233
+ pending: () => ["sifa", "confirmation", "pending"],
234
+ /** Confirmations this session has given, for the withdraw surface. */
235
+ given: () => ["sifa", "confirmation", "given"]
233
236
  },
234
237
  stream: {
235
238
  all: () => ["sifa", "stream"],
@@ -1076,6 +1079,18 @@ async function fetchPendingConfirmations(config, options = {}) {
1076
1079
  return { confirmations: [] };
1077
1080
  }
1078
1081
  }
1082
+ async function fetchGivenConfirmations(config, options = {}) {
1083
+ try {
1084
+ const data = await apiFetch(
1085
+ config,
1086
+ "/api/confirmations/mine",
1087
+ { cache: "no-store", credentials: "include", timeoutMs: 5e3, ...options }
1088
+ );
1089
+ return { confirmations: data?.confirmations ?? [] };
1090
+ } catch {
1091
+ return { confirmations: [] };
1092
+ }
1093
+ }
1079
1094
  function createConfirmation(config, data, options = {}) {
1080
1095
  return apiWriteCreate(config, "/api/confirmation", data, options);
1081
1096
  }
@@ -1095,6 +1110,14 @@ function usePendingConfirmations(options) {
1095
1110
  ...options
1096
1111
  });
1097
1112
  }
1113
+ function useGivenConfirmations(options) {
1114
+ const config = useSifaConfig();
1115
+ return reactQuery.useQuery({
1116
+ queryKey: sifaQueryKeys.confirmation.given(),
1117
+ queryFn: () => fetchGivenConfirmations(config),
1118
+ ...options
1119
+ });
1120
+ }
1098
1121
  function useCreateConfirmation(claimerHandleOrDid, options) {
1099
1122
  const config = useSifaConfig();
1100
1123
  const queryClient = reactQuery.useQueryClient();
@@ -1105,6 +1128,9 @@ function useCreateConfirmation(claimerHandleOrDid, options) {
1105
1128
  await queryClient.invalidateQueries({
1106
1129
  queryKey: sifaQueryKeys.confirmation.pending()
1107
1130
  });
1131
+ await queryClient.invalidateQueries({
1132
+ queryKey: sifaQueryKeys.confirmation.given()
1133
+ });
1108
1134
  if (claimerHandleOrDid) {
1109
1135
  await queryClient.invalidateQueries({
1110
1136
  queryKey: sifaQueryKeys.profile.byHandle(claimerHandleOrDid)
@@ -2021,6 +2047,42 @@ function useRemoveFeatureAllowlist(flag, options) {
2021
2047
  );
2022
2048
  }
2023
2049
 
2050
+ // src/query/fetchers/admin-review-queues.ts
2051
+ async function getAdminReviewQueues(config, opts = {}) {
2052
+ const headers = { ...opts.headers ?? {} };
2053
+ if (opts.cookieHeader) headers.cookie = opts.cookieHeader;
2054
+ const res = await apiFetch(config, "/api/admin/stats/review-queues", {
2055
+ credentials: "include",
2056
+ cache: "no-store",
2057
+ ...opts,
2058
+ headers
2059
+ });
2060
+ const ideas = res.ideas ?? 0;
2061
+ const nameCorrections = res.nameCorrections ?? 0;
2062
+ const pendingCompanies = res.pendingCompanies ?? 0;
2063
+ return {
2064
+ ideas,
2065
+ nameCorrections,
2066
+ pendingCompanies,
2067
+ // Derived rather than trusted so an API that predates the field still
2068
+ // yields a usable pill count.
2069
+ total: res.total ?? ideas + nameCorrections + pendingCompanies,
2070
+ generatedAt: res.generatedAt ?? ""
2071
+ };
2072
+ }
2073
+
2074
+ // src/query/hooks/use-admin-review-queues.ts
2075
+ var REVIEW_QUEUES_STALE_TIME_MS = 6e4;
2076
+ function useAdminReviewQueues(options) {
2077
+ const config = useSifaConfig();
2078
+ return reactQuery.useQuery({
2079
+ queryKey: sifaQueryKeys.admin.reviewQueues(),
2080
+ queryFn: () => getAdminReviewQueues(config),
2081
+ staleTime: REVIEW_QUEUES_STALE_TIME_MS,
2082
+ ...options
2083
+ });
2084
+ }
2085
+
2024
2086
  // src/query/fetchers/activity.ts
2025
2087
  async function fetchHeatmapData(config, handleOrDid, days, options = {}) {
2026
2088
  const path = `/api/activity/${encodeIdentifier(handleOrDid)}/heatmap?days=${days}`;
@@ -2762,6 +2824,7 @@ exports.useActivityFeed = useActivityFeed;
2762
2824
  exports.useActivityTeaser = useActivityTeaser;
2763
2825
  exports.useAddFeatureAllowlist = useAddFeatureAllowlist;
2764
2826
  exports.useAddOrgNotificationEmail = useAddOrgNotificationEmail;
2827
+ exports.useAdminReviewQueues = useAdminReviewQueues;
2765
2828
  exports.useAppAccountCheck = useAppAccountCheck;
2766
2829
  exports.useAppsRegistry = useAppsRegistry;
2767
2830
  exports.useAtFundLink = useAtFundLink;
@@ -2803,6 +2866,7 @@ exports.useFollowing = useFollowing;
2803
2866
  exports.useFollowingFeed = useFollowingFeed;
2804
2867
  exports.useFollowingList = useFollowingList;
2805
2868
  exports.useGetProfileView = useGetProfileView;
2869
+ exports.useGivenConfirmations = useGivenConfirmations;
2806
2870
  exports.useHeatmapData = useHeatmapData;
2807
2871
  exports.useHiddenApps = useHiddenApps;
2808
2872
  exports.useHideKeytraceClaim = useHideKeytraceClaim;