@singi-labs/sifa-sdk 0.12.90 → 0.12.92

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.
@@ -209,6 +209,12 @@ var sifaQueryKeys = {
209
209
  registry: () => ["sifa", "apps", "registry"],
210
210
  hidden: () => ["sifa", "apps", "hidden"]
211
211
  },
212
+ auth: {
213
+ all: () => ["sifa", "auth"],
214
+ // Session-scoped: the AppView reads the account list from the browser's
215
+ // cookies, so there is only ever one list per client.
216
+ accounts: () => ["sifa", "auth", "accounts"]
217
+ },
212
218
  activity: {
213
219
  all: () => ["sifa", "activity"],
214
220
  heatmap: (handleOrDid, days) => ["sifa", "activity", "heatmap", handleOrDid, days],
@@ -1662,6 +1668,32 @@ function useHiddenApps(options) {
1662
1668
  });
1663
1669
  }
1664
1670
 
1671
+ // src/query/fetchers/accounts.ts
1672
+ async function fetchAccounts(config, options = {}) {
1673
+ const headers = { ...options.headers ?? {} };
1674
+ if (options.cookieHeader) headers.cookie = options.cookieHeader;
1675
+ try {
1676
+ const data = await apiFetch(config, "/api/auth/accounts", {
1677
+ credentials: "include",
1678
+ ...options,
1679
+ headers
1680
+ });
1681
+ return data.accounts;
1682
+ } catch {
1683
+ return [];
1684
+ }
1685
+ }
1686
+
1687
+ // src/query/hooks/use-accounts.ts
1688
+ function useAccounts(options) {
1689
+ const config = useSifaConfig();
1690
+ return reactQuery.useQuery({
1691
+ queryKey: sifaQueryKeys.auth.accounts(),
1692
+ queryFn: () => fetchAccounts(config),
1693
+ ...options
1694
+ });
1695
+ }
1696
+
1665
1697
  // src/query/fetchers/search.ts
1666
1698
  var EMPTY_SEARCH = { profiles: [], total: 0, limit: 20, offset: 0 };
1667
1699
  var EMPTY_FILTERS = { countries: [], industries: [], apps: [], openTo: [] };
@@ -3232,6 +3264,7 @@ function useDeleteInvestment(ownerDid, options) {
3232
3264
 
3233
3265
  exports.SifaProvider = SifaProvider;
3234
3266
  exports.sifaQueryKeys = sifaQueryKeys;
3267
+ exports.useAccounts = useAccounts;
3235
3268
  exports.useActivityFeed = useActivityFeed;
3236
3269
  exports.useActivityTeaser = useActivityTeaser;
3237
3270
  exports.useAddFeatureAllowlist = useAddFeatureAllowlist;