@heedkit/sdk-react 0.1.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.
@@ -0,0 +1,141 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as React from 'react';
3
+
4
+ type Visibility = "public" | "private";
5
+ type Interaction = "upvote" | "downvote" | "plus_one" | "like";
6
+ type KindInteractions = Partial<Record<Interaction, boolean>>;
7
+ type ShowCounts = Partial<Record<FeatureKind, boolean>>;
8
+ type GroupMode = "tabs" | "list";
9
+ type Theme = {
10
+ primary?: string;
11
+ primaryDark?: string;
12
+ radius?: number;
13
+ mode?: "light" | "dark" | "system";
14
+ font_family?: string;
15
+ font_size?: "sm" | "md" | "lg";
16
+ group_mode?: GroupMode;
17
+ show_counts?: ShowCounts;
18
+ fontFamily?: string;
19
+ };
20
+ type EndUser = {
21
+ externalId?: string;
22
+ email?: string;
23
+ name?: string;
24
+ avatarUrl?: string;
25
+ platform?: string;
26
+ };
27
+ type FeatureKind = "feature_request" | "bug_report" | "improvement" | "appreciation" | "other";
28
+ type Feature = {
29
+ id: string;
30
+ title: string;
31
+ description: string;
32
+ status: "open" | "planned" | "in_progress" | "shipped" | "declined";
33
+ kind: FeatureKind;
34
+ visibility: Visibility;
35
+ on_roadmap: boolean;
36
+ tag: string | null;
37
+ vote_count: number;
38
+ voted: boolean;
39
+ platform: string | null;
40
+ author_name: string | null;
41
+ created_at: string;
42
+ };
43
+ type Comment = {
44
+ id: string;
45
+ body: string;
46
+ author_name: string | null;
47
+ is_internal: boolean;
48
+ created_at: string;
49
+ };
50
+ type HeedKitConfig = {
51
+ projectKey: string;
52
+ apiUrl?: string;
53
+ user?: EndUser;
54
+ };
55
+ type ProjectConfig = {
56
+ name: string;
57
+ theme: Theme;
58
+ enabled_kinds: FeatureKind[];
59
+ kind_visibility: Record<FeatureKind, Visibility>;
60
+ kind_interactions: Record<FeatureKind, KindInteractions>;
61
+ is_public_roadmap?: boolean;
62
+ };
63
+ type InitResult = {
64
+ end_user_id: string;
65
+ project: ProjectConfig;
66
+ };
67
+ declare class HeedKitClient {
68
+ private apiUrl;
69
+ private projectKey;
70
+ private endUserId;
71
+ private theme;
72
+ private projectName;
73
+ private enabledKinds;
74
+ private kindVisibility;
75
+ private kindInteractions;
76
+ constructor(config: HeedKitConfig);
77
+ init(user?: EndUser): Promise<InitResult>;
78
+ getTheme(): Theme;
79
+ getEnabledKinds(): FeatureKind[];
80
+ getKindVisibility(): Partial<Record<FeatureKind, Visibility>>;
81
+ getKindInteractions(): Partial<Record<FeatureKind, Partial<Record<Interaction, boolean>>>>;
82
+ getProjectName(): string;
83
+ getEndUserId(): string | null;
84
+ getInteractionsFor(kind: FeatureKind): Interaction[];
85
+ list(opts?: {
86
+ status?: string;
87
+ kind?: FeatureKind;
88
+ sort?: "top" | "new";
89
+ }): Promise<Feature[]>;
90
+ submit(input: {
91
+ title: string;
92
+ description?: string;
93
+ tag?: string;
94
+ kind?: FeatureKind;
95
+ }): Promise<Feature>;
96
+ vote(featureId: string): Promise<{
97
+ voted: boolean;
98
+ vote_count: number;
99
+ }>;
100
+ listComments(featureId: string): Promise<Comment[]>;
101
+ comment(featureId: string, body: string): Promise<Comment>;
102
+ private ensureInit;
103
+ private request;
104
+ }
105
+
106
+ type MountOptions = HeedKitConfig & {
107
+ label?: string;
108
+ hideLauncher?: boolean;
109
+ container?: HTMLElement;
110
+ };
111
+ type Widget = {
112
+ client: HeedKitClient;
113
+ open: () => void;
114
+ close: () => void;
115
+ destroy: () => void;
116
+ };
117
+ declare function mount(options: MountOptions): Widget;
118
+
119
+ type Ctx = {
120
+ client: HeedKitClient;
121
+ ready: boolean;
122
+ theme: Theme;
123
+ };
124
+ declare function HeedKitProvider({ projectKey, apiUrl, user, children, }: {
125
+ children: React.ReactNode;
126
+ } & HeedKitConfig): react_jsx_runtime.JSX.Element;
127
+ declare function useHeedKit(): Ctx;
128
+ type FeedbackButtonProps = HeedKitConfig & {
129
+ /** Floating launcher label. Default: "Feedback". */
130
+ label?: string;
131
+ /** Hide the floating launcher (call `widget.current?.open()` yourself). */
132
+ hideLauncher?: boolean;
133
+ };
134
+ declare const FeedbackButton: React.ForwardRefExoticComponent<HeedKitConfig & {
135
+ /** Floating launcher label. Default: "Feedback". */
136
+ label?: string;
137
+ /** Hide the floating launcher (call `widget.current?.open()` yourself). */
138
+ hideLauncher?: boolean;
139
+ } & React.RefAttributes<Widget | null>>;
140
+
141
+ export { type Comment, type EndUser, type Feature, type FeatureKind, FeedbackButton, type FeedbackButtonProps, type GroupMode, HeedKitClient, type HeedKitConfig, HeedKitProvider, type InitResult, type Interaction, type KindInteractions, type MountOptions, type ProjectConfig, type ShowCounts, type Theme, type Visibility, type Widget, mount, useHeedKit };
@@ -0,0 +1,141 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as React from 'react';
3
+
4
+ type Visibility = "public" | "private";
5
+ type Interaction = "upvote" | "downvote" | "plus_one" | "like";
6
+ type KindInteractions = Partial<Record<Interaction, boolean>>;
7
+ type ShowCounts = Partial<Record<FeatureKind, boolean>>;
8
+ type GroupMode = "tabs" | "list";
9
+ type Theme = {
10
+ primary?: string;
11
+ primaryDark?: string;
12
+ radius?: number;
13
+ mode?: "light" | "dark" | "system";
14
+ font_family?: string;
15
+ font_size?: "sm" | "md" | "lg";
16
+ group_mode?: GroupMode;
17
+ show_counts?: ShowCounts;
18
+ fontFamily?: string;
19
+ };
20
+ type EndUser = {
21
+ externalId?: string;
22
+ email?: string;
23
+ name?: string;
24
+ avatarUrl?: string;
25
+ platform?: string;
26
+ };
27
+ type FeatureKind = "feature_request" | "bug_report" | "improvement" | "appreciation" | "other";
28
+ type Feature = {
29
+ id: string;
30
+ title: string;
31
+ description: string;
32
+ status: "open" | "planned" | "in_progress" | "shipped" | "declined";
33
+ kind: FeatureKind;
34
+ visibility: Visibility;
35
+ on_roadmap: boolean;
36
+ tag: string | null;
37
+ vote_count: number;
38
+ voted: boolean;
39
+ platform: string | null;
40
+ author_name: string | null;
41
+ created_at: string;
42
+ };
43
+ type Comment = {
44
+ id: string;
45
+ body: string;
46
+ author_name: string | null;
47
+ is_internal: boolean;
48
+ created_at: string;
49
+ };
50
+ type HeedKitConfig = {
51
+ projectKey: string;
52
+ apiUrl?: string;
53
+ user?: EndUser;
54
+ };
55
+ type ProjectConfig = {
56
+ name: string;
57
+ theme: Theme;
58
+ enabled_kinds: FeatureKind[];
59
+ kind_visibility: Record<FeatureKind, Visibility>;
60
+ kind_interactions: Record<FeatureKind, KindInteractions>;
61
+ is_public_roadmap?: boolean;
62
+ };
63
+ type InitResult = {
64
+ end_user_id: string;
65
+ project: ProjectConfig;
66
+ };
67
+ declare class HeedKitClient {
68
+ private apiUrl;
69
+ private projectKey;
70
+ private endUserId;
71
+ private theme;
72
+ private projectName;
73
+ private enabledKinds;
74
+ private kindVisibility;
75
+ private kindInteractions;
76
+ constructor(config: HeedKitConfig);
77
+ init(user?: EndUser): Promise<InitResult>;
78
+ getTheme(): Theme;
79
+ getEnabledKinds(): FeatureKind[];
80
+ getKindVisibility(): Partial<Record<FeatureKind, Visibility>>;
81
+ getKindInteractions(): Partial<Record<FeatureKind, Partial<Record<Interaction, boolean>>>>;
82
+ getProjectName(): string;
83
+ getEndUserId(): string | null;
84
+ getInteractionsFor(kind: FeatureKind): Interaction[];
85
+ list(opts?: {
86
+ status?: string;
87
+ kind?: FeatureKind;
88
+ sort?: "top" | "new";
89
+ }): Promise<Feature[]>;
90
+ submit(input: {
91
+ title: string;
92
+ description?: string;
93
+ tag?: string;
94
+ kind?: FeatureKind;
95
+ }): Promise<Feature>;
96
+ vote(featureId: string): Promise<{
97
+ voted: boolean;
98
+ vote_count: number;
99
+ }>;
100
+ listComments(featureId: string): Promise<Comment[]>;
101
+ comment(featureId: string, body: string): Promise<Comment>;
102
+ private ensureInit;
103
+ private request;
104
+ }
105
+
106
+ type MountOptions = HeedKitConfig & {
107
+ label?: string;
108
+ hideLauncher?: boolean;
109
+ container?: HTMLElement;
110
+ };
111
+ type Widget = {
112
+ client: HeedKitClient;
113
+ open: () => void;
114
+ close: () => void;
115
+ destroy: () => void;
116
+ };
117
+ declare function mount(options: MountOptions): Widget;
118
+
119
+ type Ctx = {
120
+ client: HeedKitClient;
121
+ ready: boolean;
122
+ theme: Theme;
123
+ };
124
+ declare function HeedKitProvider({ projectKey, apiUrl, user, children, }: {
125
+ children: React.ReactNode;
126
+ } & HeedKitConfig): react_jsx_runtime.JSX.Element;
127
+ declare function useHeedKit(): Ctx;
128
+ type FeedbackButtonProps = HeedKitConfig & {
129
+ /** Floating launcher label. Default: "Feedback". */
130
+ label?: string;
131
+ /** Hide the floating launcher (call `widget.current?.open()` yourself). */
132
+ hideLauncher?: boolean;
133
+ };
134
+ declare const FeedbackButton: React.ForwardRefExoticComponent<HeedKitConfig & {
135
+ /** Floating launcher label. Default: "Feedback". */
136
+ label?: string;
137
+ /** Hide the floating launcher (call `widget.current?.open()` yourself). */
138
+ hideLauncher?: boolean;
139
+ } & React.RefAttributes<Widget | null>>;
140
+
141
+ export { type Comment, type EndUser, type Feature, type FeatureKind, FeedbackButton, type FeedbackButtonProps, type GroupMode, HeedKitClient, type HeedKitConfig, HeedKitProvider, type InitResult, type Interaction, type KindInteractions, type MountOptions, type ProjectConfig, type ShowCounts, type Theme, type Visibility, type Widget, mount, useHeedKit };