@singi-labs/sifa-sdk 0.12.91 → 0.13.0

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.
@@ -744,6 +744,30 @@ async function fetchHiddenApps(config, options = {}) {
744
744
  }
745
745
  }
746
746
 
747
+ // src/query/fetchers/accounts.ts
748
+ async function fetchAccounts(config, options = {}) {
749
+ const headers = { ...options.headers ?? {} };
750
+ if (options.cookieHeader) headers.cookie = options.cookieHeader;
751
+ try {
752
+ const data = await apiFetch(config, "/api/auth/accounts", {
753
+ credentials: "include",
754
+ ...options,
755
+ headers
756
+ });
757
+ return data.accounts;
758
+ } catch {
759
+ return [];
760
+ }
761
+ }
762
+ async function switchAccount(config, did, options = {}) {
763
+ await apiFetch(config, "/oauth/switch", {
764
+ method: "POST",
765
+ body: { did },
766
+ credentials: "include",
767
+ ...options
768
+ });
769
+ }
770
+
747
771
  // src/query/fetchers/search.ts
748
772
  var EMPTY_SEARCH = { profiles: [], total: 0, limit: 20, offset: 0 };
749
773
  var EMPTY_FILTERS = { countries: [], industries: [], apps: [], openTo: [] };
@@ -800,6 +824,43 @@ async function searchSkills(config, query, limit = 10, options = {}) {
800
824
  return [];
801
825
  }
802
826
  }
827
+
828
+ // src/query/fetchers/speakers.ts
829
+ var EMPTY_SPEAKERS = { speakers: [] };
830
+ var EMPTY_TALKS = { talks: [] };
831
+ function buildParams(filters) {
832
+ const params = new URLSearchParams();
833
+ const topic = filters.topic?.trim();
834
+ if (topic) params.set("topic", topic);
835
+ if (filters.limit !== void 0) params.set("limit", String(filters.limit));
836
+ return params;
837
+ }
838
+ async function fetchSpeakers(config, filters = {}, options = {}) {
839
+ const params = buildParams(filters);
840
+ const query = params.toString();
841
+ const path = query ? `/api/speakers?${query}` : "/api/speakers";
842
+ try {
843
+ return await apiFetch(config, path, {
844
+ cache: "no-store",
845
+ ...options
846
+ });
847
+ } catch {
848
+ return EMPTY_SPEAKERS;
849
+ }
850
+ }
851
+ async function fetchTalks(config, filters = {}, options = {}) {
852
+ const params = buildParams(filters);
853
+ const query = params.toString();
854
+ const path = query ? `/api/talks?${query}` : "/api/talks";
855
+ try {
856
+ return await apiFetch(config, path, {
857
+ cache: "no-store",
858
+ ...options
859
+ });
860
+ } catch {
861
+ return EMPTY_TALKS;
862
+ }
863
+ }
803
864
  var httpUrlNullable = zod.z.string().refine((s) => /^https?:\/\//i.test(s), { message: "must be an http(s) URL" }).nullable();
804
865
  var searchResultCommon = {
805
866
  kind: zod.z.string(),
@@ -1585,6 +1646,12 @@ var sifaQueryKeys = {
1585
1646
  registry: () => ["sifa", "apps", "registry"],
1586
1647
  hidden: () => ["sifa", "apps", "hidden"]
1587
1648
  },
1649
+ auth: {
1650
+ all: () => ["sifa", "auth"],
1651
+ // Session-scoped: the AppView reads the account list from the browser's
1652
+ // cookies, so there is only ever one list per client.
1653
+ accounts: () => ["sifa", "auth", "accounts"]
1654
+ },
1588
1655
  activity: {
1589
1656
  all: () => ["sifa", "activity"],
1590
1657
  heatmap: (handleOrDid, days) => ["sifa", "activity", "heatmap", handleOrDid, days],
@@ -2617,6 +2684,14 @@ function useHiddenApps(options) {
2617
2684
  ...options
2618
2685
  });
2619
2686
  }
2687
+ function useAccounts(options) {
2688
+ const config = useSifaConfig();
2689
+ return reactQuery.useQuery({
2690
+ queryKey: sifaQueryKeys.auth.accounts(),
2691
+ queryFn: () => fetchAccounts(config),
2692
+ ...options
2693
+ });
2694
+ }
2620
2695
  function useSearchProfiles(filters, options) {
2621
2696
  const config = useSifaConfig();
2622
2697
  return reactQuery.useQuery({
@@ -3381,6 +3456,7 @@ exports.deleteSkill = deleteSkill;
3381
3456
  exports.dismissConfirmation = dismissConfirmation;
3382
3457
  exports.dismissEndorsement = dismissEndorsement;
3383
3458
  exports.effectiveContentVisibility = effectiveContentVisibility;
3459
+ exports.fetchAccounts = fetchAccounts;
3384
3460
  exports.fetchActivityFeed = fetchActivityFeed;
3385
3461
  exports.fetchActivityTeaser = fetchActivityTeaser;
3386
3462
  exports.fetchAppsRegistry = fetchAppsRegistry;
@@ -3413,9 +3489,11 @@ exports.fetchSearchFilters = fetchSearchFilters;
3413
3489
  exports.fetchSearchProfiles = fetchSearchProfiles;
3414
3490
  exports.fetchSimilarProfiles = fetchSimilarProfiles;
3415
3491
  exports.fetchSkillSuggestions = fetchSkillSuggestions;
3492
+ exports.fetchSpeakers = fetchSpeakers;
3416
3493
  exports.fetchStats = fetchStats;
3417
3494
  exports.fetchSuggestionCount = fetchSuggestionCount;
3418
3495
  exports.fetchSuggestions = fetchSuggestions;
3496
+ exports.fetchTalks = fetchTalks;
3419
3497
  exports.fetchTypeaheadActors = fetchTypeaheadActors;
3420
3498
  exports.fetchWipePreview = fetchWipePreview;
3421
3499
  exports.followUser = followUser;
@@ -3455,6 +3533,7 @@ exports.setPositionPrimary = setPositionPrimary;
3455
3533
  exports.shouldGateAdultMedia = shouldGateAdultMedia;
3456
3534
  exports.sifaQueryKeys = sifaQueryKeys;
3457
3535
  exports.submitOrgClaim = submitOrgClaim;
3536
+ exports.switchAccount = switchAccount;
3458
3537
  exports.unfollowUser = unfollowUser;
3459
3538
  exports.unhideKeytraceClaim = unhideKeytraceClaim;
3460
3539
  exports.unhideOrcidPublication = unhideOrcidPublication;
@@ -3478,6 +3557,7 @@ exports.updateSkill = updateSkill;
3478
3557
  exports.updateSkillSubCategories = updateSkillSubCategories;
3479
3558
  exports.uploadAvatar = uploadAvatar;
3480
3559
  exports.uploadNamePronunciationAudio = uploadNamePronunciationAudio;
3560
+ exports.useAccounts = useAccounts;
3481
3561
  exports.useActivityFeed = useActivityFeed;
3482
3562
  exports.useActivityTeaser = useActivityTeaser;
3483
3563
  exports.useAddFeatureAllowlist = useAddFeatureAllowlist;