@singi-labs/sifa-sdk 0.12.49 → 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.
@@ -230,7 +230,9 @@ var sifaQueryKeys = {
230
230
  // Scoped to the session for the same reason as the endorsement inbox: the
231
231
  // AppView reads the subject from the session cookie, so there is only ever
232
232
  // one inbox per client.
233
- pending: () => ["sifa", "confirmation", "pending"]
233
+ pending: () => ["sifa", "confirmation", "pending"],
234
+ /** Confirmations this session has given, for the withdraw surface. */
235
+ given: () => ["sifa", "confirmation", "given"]
234
236
  },
235
237
  stream: {
236
238
  all: () => ["sifa", "stream"],
@@ -1077,6 +1079,18 @@ async function fetchPendingConfirmations(config, options = {}) {
1077
1079
  return { confirmations: [] };
1078
1080
  }
1079
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
+ }
1080
1094
  function createConfirmation(config, data, options = {}) {
1081
1095
  return apiWriteCreate(config, "/api/confirmation", data, options);
1082
1096
  }
@@ -1096,6 +1110,14 @@ function usePendingConfirmations(options) {
1096
1110
  ...options
1097
1111
  });
1098
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
+ }
1099
1121
  function useCreateConfirmation(claimerHandleOrDid, options) {
1100
1122
  const config = useSifaConfig();
1101
1123
  const queryClient = reactQuery.useQueryClient();
@@ -1106,6 +1128,9 @@ function useCreateConfirmation(claimerHandleOrDid, options) {
1106
1128
  await queryClient.invalidateQueries({
1107
1129
  queryKey: sifaQueryKeys.confirmation.pending()
1108
1130
  });
1131
+ await queryClient.invalidateQueries({
1132
+ queryKey: sifaQueryKeys.confirmation.given()
1133
+ });
1109
1134
  if (claimerHandleOrDid) {
1110
1135
  await queryClient.invalidateQueries({
1111
1136
  queryKey: sifaQueryKeys.profile.byHandle(claimerHandleOrDid)
@@ -2841,6 +2866,7 @@ exports.useFollowing = useFollowing;
2841
2866
  exports.useFollowingFeed = useFollowingFeed;
2842
2867
  exports.useFollowingList = useFollowingList;
2843
2868
  exports.useGetProfileView = useGetProfileView;
2869
+ exports.useGivenConfirmations = useGivenConfirmations;
2844
2870
  exports.useHeatmapData = useHeatmapData;
2845
2871
  exports.useHiddenApps = useHiddenApps;
2846
2872
  exports.useHideKeytraceClaim = useHideKeytraceClaim;