hive-react-kit 0.8.8 → 0.9.1

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.
@@ -2,6 +2,19 @@ import { Follower, Following, UserProfileResponse, Account } from "@/types/user"
2
2
  import { Post } from "@/types/post";
3
3
  import type { Poll } from "@/types/poll";
4
4
  import type { PendingAuthorRow, PendingCurationRow } from "@/types/reward";
5
+ /** Default "parent" container for getUserSnaps (kept for backwards compatibility). */
6
+ export declare const DEFAULT_SNAP_PARENT = "peak.snaps";
7
+ /**
8
+ * Known snap-container parents supported by UserDetailProfile's segmented
9
+ * control. Values are the account names queried via `?parent=<account>`.
10
+ */
11
+ export declare const SNAP_SUBTYPE_PARENTS: {
12
+ readonly snaps: "peak.snaps";
13
+ readonly ecency: "ecency.waves";
14
+ readonly threads: "leothreads";
15
+ readonly liketu: "liketu.moments";
16
+ };
17
+ export type SnapSubType = keyof typeof SNAP_SUBTYPE_PARENTS;
5
18
  declare class UserService {
6
19
  private readonly HIVE_API_URL;
7
20
  /** Central fetch wrapper — threads AbortSignal to every network request */
@@ -19,10 +32,15 @@ declare class UserService {
19
32
  getUserComments(username: string, limit?: number, startAuthor?: string, startPermlink?: string, signal?: AbortSignal): Promise<Post[]>;
20
33
  getUserReplies(username: string, limit?: number, startAuthor?: string, startPermlink?: string, signal?: AbortSignal): Promise<Post[]>;
21
34
  /**
22
- * Fetch snap references for a user from PeakD API.
23
- * Returns { id, author, permlink }[] with cursor for pagination.
35
+ * Fetch snap references for a user from the hreplier API.
36
+ * Returns `{ id, author, permlink }[]`. The endpoint does not support
37
+ * cursor-based pagination — it returns a single batch, so `startId`
38
+ * is accepted for call-site compatibility but ignored.
39
+ *
40
+ * `parent` selects the container account: `peak.snaps` (Snaps), `ecency.waves`
41
+ * (Ecency waves), `leothreads` (Threads), `liketu.moments` (Liketu moments).
24
42
  */
25
- getSnapReferences(username: string, startId?: number, signal?: AbortSignal): Promise<{
43
+ getSnapReferences(username: string, _startId?: number, signal?: AbortSignal, parent?: string): Promise<{
26
44
  id: number;
27
45
  author: string;
28
46
  permlink: string;
@@ -33,11 +51,24 @@ declare class UserService {
33
51
  */
34
52
  private batchGetPosts;
35
53
  /**
36
- * Fetch snaps for a user using PeakD API + Hive bridge.get_post.
37
- * Step 1: Get snap references from PeakD (with pagination via startId)
38
- * Step 2: Batch fetch full post data via bridge.get_post
54
+ * Fetch a page of snaps for a user via the hreplier API + Hive bridge.get_post.
55
+ *
56
+ * The hreplier endpoint returns the full snap-reference list in one shot and
57
+ * has no server-side pagination, so we cache it per (username, parent) and
58
+ * slice client-side. `startId` is repurposed as the slice offset (20-item
59
+ * pages):
60
+ * - undefined / 0 → first 20 refs
61
+ * - 20, 40, … → subsequent pages
62
+ * `nextStartId` is the next offset to request, or null when exhausted.
63
+ *
64
+ * `parent` selects the container account — see SNAP_SUBTYPE_PARENTS
65
+ * (defaults to `peak.snaps`). Cache is keyed per parent so switching
66
+ * segments never collides.
67
+ *
68
+ * Only the current slice is materialised via bridge.get_post, so switching
69
+ * pages stays snappy.
39
70
  */
40
- getUserSnaps(username: string, startId?: number, observer?: string, signal?: AbortSignal): Promise<{
71
+ getUserSnaps(username: string, startId?: number, observer?: string, signal?: AbortSignal, parent?: string): Promise<{
41
72
  snaps: Post[];
42
73
  nextStartId: number | null;
43
74
  }>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hive-react-kit",
3
3
  "private": false,
4
- "version": "0.8.8",
4
+ "version": "0.9.1",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs.js",
7
7
  "module": "./dist/index.esm.js",
@@ -82,8 +82,6 @@
82
82
  "isomorphic-dompurify": "^3.6.0",
83
83
  "lucide-react": "^0.462.0",
84
84
  "next-themes": "^0.4.4",
85
- "react": "^19.0.0",
86
- "react-dom": "^19.0.0",
87
85
  "react-hook-form": "^7.61.1",
88
86
  "react-icons": "^5.5.0",
89
87
  "react-resizable-panels": "^2.1.9",
@@ -98,6 +96,8 @@
98
96
  "@types/node": "^22.16.5",
99
97
  "@types/react": "^18.3.23",
100
98
  "@types/react-dom": "^18.3.7",
99
+ "react": "^19.0.0",
100
+ "react-dom": "^19.0.0",
101
101
  "@vitejs/plugin-react": "^4.6.0",
102
102
  "@vitejs/plugin-react-swc": "^3.11.0",
103
103
  "autoprefixer": "^10.4.21",