@singi-labs/sifa-sdk 0.18.6 → 0.18.8

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.
@@ -219,7 +219,10 @@ var sifaQueryKeys = {
219
219
  all: () => ["sifa", "activity"],
220
220
  heatmap: (handleOrDid, days) => ["sifa", "activity", "heatmap", handleOrDid, days],
221
221
  teaser: (handleOrDid) => ["sifa", "activity", "teaser", handleOrDid],
222
- feed: (handleOrDid, opts) => ["sifa", "activity", "feed", handleOrDid, opts]
222
+ feed: (handleOrDid, opts) => ["sifa", "activity", "feed", handleOrDid, opts],
223
+ // Session-scoped: the AppView reads the caller's own hides from their
224
+ // cookie, so there is only ever one list per client.
225
+ hiddenItems: () => ["sifa", "activity", "hidden-items"]
223
226
  },
224
227
  github: {
225
228
  all: () => ["sifa", "github"],
@@ -1602,6 +1605,60 @@ var useBulkUnhideProfileItems = makeWriteHook2(
1602
1605
  (config, input) => bulkUnhideProfileItems(config, input)
1603
1606
  );
1604
1607
 
1608
+ // src/query/fetchers/activity-items-hide.ts
1609
+ function hideActivityItem(config, input, options = {}) {
1610
+ return apiWrite(config, "/api/activity/items/hide", "POST", { ...options, body: input });
1611
+ }
1612
+ function unhideActivityItem(config, input, options = {}) {
1613
+ return apiWrite(config, "/api/activity/items/hide", "DELETE", { ...options, body: input });
1614
+ }
1615
+ async function fetchHiddenActivityItems(config, options = {}) {
1616
+ const headers = { ...options.headers ?? {} };
1617
+ if (options.cookieHeader) headers.cookie = options.cookieHeader;
1618
+ try {
1619
+ const data = await apiFetch(
1620
+ config,
1621
+ "/api/activity/hidden-items",
1622
+ { credentials: "include", ...options, headers }
1623
+ );
1624
+ return data.items;
1625
+ } catch {
1626
+ return [];
1627
+ }
1628
+ }
1629
+
1630
+ // src/query/hooks/use-activity-items-hide.ts
1631
+ function useHiddenActivityItems(options) {
1632
+ const config = useSifaConfig();
1633
+ return reactQuery.useQuery({
1634
+ queryKey: sifaQueryKeys.activity.hiddenItems(),
1635
+ queryFn: () => fetchHiddenActivityItems(config),
1636
+ ...options
1637
+ });
1638
+ }
1639
+ function makeHideHook(fetcher) {
1640
+ return function useHook(options) {
1641
+ const config = useSifaConfig();
1642
+ const queryClient = reactQuery.useQueryClient();
1643
+ return reactQuery.useMutation({
1644
+ mutationFn: (v) => fetcher(config, v),
1645
+ onSuccess: async (result, variables, onMutateResult, context) => {
1646
+ if (result.success) {
1647
+ await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.activity.all() });
1648
+ }
1649
+ await options?.onSuccess?.(result, variables, onMutateResult, context);
1650
+ },
1651
+ ...options
1652
+ });
1653
+ };
1654
+ }
1655
+ var useHideActivityItem = makeHideHook(
1656
+ (config, input) => hideActivityItem(config, input)
1657
+ );
1658
+ var useUnhideActivityItem = makeHideHook(
1659
+ (config, input) => unhideActivityItem(config, input)
1660
+ );
1661
+
1605
1662
  // src/query/fetchers/stats.ts
1606
1663
  async function fetchStats(config, options = {}) {
1607
1664
  try {
@@ -3317,7 +3374,9 @@ exports.useFollowingList = useFollowingList;
3317
3374
  exports.useGetProfileView = useGetProfileView;
3318
3375
  exports.useGivenConfirmations = useGivenConfirmations;
3319
3376
  exports.useHeatmapData = useHeatmapData;
3377
+ exports.useHiddenActivityItems = useHiddenActivityItems;
3320
3378
  exports.useHiddenApps = useHiddenApps;
3379
+ exports.useHideActivityItem = useHideActivityItem;
3321
3380
  exports.useHideKeytraceClaim = useHideKeytraceClaim;
3322
3381
  exports.useHideOrcidPublication = useHideOrcidPublication;
3323
3382
  exports.useHideProfileItem = useHideProfileItem;
@@ -3359,6 +3418,7 @@ exports.useStats = useStats;
3359
3418
  exports.useSuggestionCount = useSuggestionCount;
3360
3419
  exports.useSuggestions = useSuggestions;
3361
3420
  exports.useUnfollow = useUnfollow;
3421
+ exports.useUnhideActivityItem = useUnhideActivityItem;
3362
3422
  exports.useUnhideKeytraceClaim = useUnhideKeytraceClaim;
3363
3423
  exports.useUnhideOrcidPublication = useUnhideOrcidPublication;
3364
3424
  exports.useUnhideProfileItem = useUnhideProfileItem;