hive-react-kit 0.8.7 → 0.9.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.
- package/dist/build.css +47 -1
- package/dist/components/HiveDetailPost.d.ts +21 -2
- package/dist/components/actionButtons/PostActionButton.d.ts +12 -3
- package/dist/components/comments/AddCommentInput.d.ts +43 -2
- package/dist/components/comments/CommentsModal.d.ts +11 -3
- package/dist/components/inlineComments/InlineCommentItem.d.ts +8 -1
- package/dist/components/inlineComments/InlineCommentSection.d.ts +16 -2
- package/dist/index.cjs.js +131 -131
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.js +14622 -13866
- package/dist/utils/commentOptions.d.ts +35 -0
- package/dist/utils/hiveLinks.d.ts +33 -0
- package/package.json +3 -3
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reward-routing options exposed by PostComposer's reward selector, plus a
|
|
3
|
+
* helper to build the matching Hive `comment_options` operation tuple that
|
|
4
|
+
* should accompany the `comment` op at broadcast time.
|
|
5
|
+
*
|
|
6
|
+
* The composer itself does not broadcast; it emits the chosen option via
|
|
7
|
+
* `onRewardChange`. Consumers call `buildCommentOptions(author, permlink, reward)`
|
|
8
|
+
* to produce the op they append to their `signAndBroadcastTx` array.
|
|
9
|
+
*/
|
|
10
|
+
export type RewardOption = 'default' | 'power_up' | 'burn' | 'decline';
|
|
11
|
+
/** Human-readable labels used by the PostComposer reward dropdown. */
|
|
12
|
+
export declare const REWARD_OPTION_LABELS: Record<RewardOption, string>;
|
|
13
|
+
export declare const REWARD_OPTIONS: RewardOption[];
|
|
14
|
+
type CommentOptionsOp = [
|
|
15
|
+
'comment_options',
|
|
16
|
+
{
|
|
17
|
+
author: string;
|
|
18
|
+
permlink: string;
|
|
19
|
+
allow_votes: boolean;
|
|
20
|
+
allow_curation_rewards: boolean;
|
|
21
|
+
max_accepted_payout: string;
|
|
22
|
+
percent_hbd: number;
|
|
23
|
+
extensions: unknown[];
|
|
24
|
+
}
|
|
25
|
+
];
|
|
26
|
+
/**
|
|
27
|
+
* Build the Hive `comment_options` op tuple for the chosen reward routing.
|
|
28
|
+
* Returns `null` for the default 50/50 option — Hive treats the absence of
|
|
29
|
+
* `comment_options` as the default, so there is no op to broadcast.
|
|
30
|
+
*
|
|
31
|
+
* Appending the returned tuple to your `[['comment', ...]]` array is all
|
|
32
|
+
* that's needed.
|
|
33
|
+
*/
|
|
34
|
+
export declare function buildCommentOptions(author: string, permlink: string, reward: RewardOption): CommentOptionsOp | null;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse a URL to detect Hive-frontend post or profile links so consumers can
|
|
3
|
+
* route them in-app instead of opening peakd/hive.blog/ecency externally.
|
|
4
|
+
*/
|
|
5
|
+
export type HiveLinkTarget = {
|
|
6
|
+
kind: 'post';
|
|
7
|
+
author: string;
|
|
8
|
+
permlink: string;
|
|
9
|
+
} | {
|
|
10
|
+
kind: 'user';
|
|
11
|
+
author: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Return the in-app target for a Hive-frontend URL, or null if the URL does
|
|
15
|
+
* not match a recognised pattern.
|
|
16
|
+
*
|
|
17
|
+
* Handles:
|
|
18
|
+
* https://peakd.com/@alice → user
|
|
19
|
+
* https://peakd.com/@alice/permlink → post
|
|
20
|
+
* https://peakd.com/hive-178315/@alice/permlink → post (community prefix)
|
|
21
|
+
* https://peakd.com/trending/@alice/permlink → post (tag prefix)
|
|
22
|
+
* https://hive.blog/@alice/permlink → post
|
|
23
|
+
* https://ecency.com/@alice/permlink → post
|
|
24
|
+
* https://inleo.io/threads/view/alice/permlink → post
|
|
25
|
+
*
|
|
26
|
+
* Also resolves relative/hash hrefs emitted by @snapie/renderer (`convertHiveUrls`)
|
|
27
|
+
* and in-app hash router links:
|
|
28
|
+
* /@alice → user
|
|
29
|
+
* /@alice/permlink → post
|
|
30
|
+
* #/@alice → user
|
|
31
|
+
* #/@alice/permlink → post
|
|
32
|
+
*/
|
|
33
|
+
export declare function parseHiveFrontendUrl(href: string): HiveLinkTarget | null;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hive-react-kit",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.9.0",
|
|
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",
|