@census-ai/census-sdk 0.2.0 → 0.2.2
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/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +84 -0
- package/dist/index.d.ts +84 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +2 -2
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +204 -2
- package/dist/react/index.d.ts +204 -2
- package/dist/react/index.js +2 -2
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
package/dist/react/index.d.cts
CHANGED
|
@@ -188,6 +188,21 @@ interface Request {
|
|
|
188
188
|
rating: number | null;
|
|
189
189
|
helpful: boolean | null;
|
|
190
190
|
metadata: Record<string, unknown>;
|
|
191
|
+
vote_count: number;
|
|
192
|
+
user_has_voted: boolean;
|
|
193
|
+
is_own: boolean;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Feedback visibility setting
|
|
197
|
+
*/
|
|
198
|
+
type FeedbackVisibility = 'own' | 'organization' | 'all';
|
|
199
|
+
/**
|
|
200
|
+
* Project settings for requests
|
|
201
|
+
*/
|
|
202
|
+
interface RequestsSettings {
|
|
203
|
+
feedbackVisibility: FeedbackVisibility;
|
|
204
|
+
allowVoting: boolean;
|
|
205
|
+
allowRequestCreation: boolean;
|
|
191
206
|
}
|
|
192
207
|
/**
|
|
193
208
|
* Options for fetching requests
|
|
@@ -223,6 +238,7 @@ interface RequestsResponse {
|
|
|
223
238
|
offset: number;
|
|
224
239
|
hasMore: boolean;
|
|
225
240
|
};
|
|
241
|
+
settings: RequestsSettings;
|
|
226
242
|
}
|
|
227
243
|
/**
|
|
228
244
|
* Position for floating UI elements
|
|
@@ -442,6 +458,36 @@ interface GuidesResponse {
|
|
|
442
458
|
completedGuides: string[];
|
|
443
459
|
}
|
|
444
460
|
type GuideEventType = 'started' | 'step_viewed' | 'step_completed' | 'completed' | 'skipped' | 'dismissed';
|
|
461
|
+
/**
|
|
462
|
+
* A feature within a feature group
|
|
463
|
+
*/
|
|
464
|
+
interface Feature {
|
|
465
|
+
id: string;
|
|
466
|
+
name: string;
|
|
467
|
+
slug: string;
|
|
468
|
+
description: string | null;
|
|
469
|
+
status: string;
|
|
470
|
+
article_count: number;
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* A group of related features
|
|
474
|
+
*/
|
|
475
|
+
interface FeatureGroup {
|
|
476
|
+
id: string;
|
|
477
|
+
name: string;
|
|
478
|
+
slug: string;
|
|
479
|
+
description: string | null;
|
|
480
|
+
color: string | null;
|
|
481
|
+
features: Feature[];
|
|
482
|
+
feature_count: number;
|
|
483
|
+
article_count: number;
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* Response from feature groups endpoint
|
|
487
|
+
*/
|
|
488
|
+
interface FeatureGroupsResponse {
|
|
489
|
+
feature_groups: FeatureGroup[];
|
|
490
|
+
}
|
|
445
491
|
interface GuideAnalyticsEvent {
|
|
446
492
|
guideId: string;
|
|
447
493
|
eventType: GuideEventType;
|
|
@@ -563,6 +609,21 @@ declare class CensusClient {
|
|
|
563
609
|
* ```
|
|
564
610
|
*/
|
|
565
611
|
getArticle(slugOrId: string): Promise<Article | null>;
|
|
612
|
+
/**
|
|
613
|
+
* Fetch feature groups with their features and article counts.
|
|
614
|
+
* Used for navigation in the knowledge base.
|
|
615
|
+
*
|
|
616
|
+
* @returns Feature groups with nested features
|
|
617
|
+
*
|
|
618
|
+
* @example
|
|
619
|
+
* ```typescript
|
|
620
|
+
* const { feature_groups } = await census.getFeatureGroups();
|
|
621
|
+
* feature_groups.forEach(group => {
|
|
622
|
+
* console.log(group.name, group.features.length);
|
|
623
|
+
* });
|
|
624
|
+
* ```
|
|
625
|
+
*/
|
|
626
|
+
getFeatureGroups(): Promise<FeatureGroupsResponse>;
|
|
566
627
|
/**
|
|
567
628
|
* Fetch the current user's submitted requests (feedback, bugs, feature requests).
|
|
568
629
|
* Requires a user to be identified first.
|
|
@@ -583,6 +644,29 @@ declare class CensusClient {
|
|
|
583
644
|
* ```
|
|
584
645
|
*/
|
|
585
646
|
getRequests(options?: RequestsOptions): Promise<RequestsResponse>;
|
|
647
|
+
/**
|
|
648
|
+
* Vote on a feedback request (toggle).
|
|
649
|
+
* If the user has already voted, removes the vote.
|
|
650
|
+
* If the user hasn't voted, adds a vote.
|
|
651
|
+
*
|
|
652
|
+
* @param feedbackId - ID of the feedback to vote on
|
|
653
|
+
* @returns Vote result with action taken and new vote count
|
|
654
|
+
*
|
|
655
|
+
* @example
|
|
656
|
+
* ```typescript
|
|
657
|
+
* // Vote on a feedback request
|
|
658
|
+
* const result = await census.vote('feedback-id-123');
|
|
659
|
+
* console.log(result.action); // 'added' or 'removed'
|
|
660
|
+
* console.log(result.vote_count); // 5
|
|
661
|
+
* console.log(result.user_has_voted); // true
|
|
662
|
+
* ```
|
|
663
|
+
*/
|
|
664
|
+
vote(feedbackId: string): Promise<{
|
|
665
|
+
success: boolean;
|
|
666
|
+
action: 'added' | 'removed';
|
|
667
|
+
vote_count: number;
|
|
668
|
+
user_has_voted: boolean;
|
|
669
|
+
}>;
|
|
586
670
|
/**
|
|
587
671
|
* Track a custom analytics event.
|
|
588
672
|
*
|
|
@@ -889,7 +973,7 @@ declare function useArticle(slugOrId: string): {
|
|
|
889
973
|
* @example
|
|
890
974
|
* ```tsx
|
|
891
975
|
* function MyRequests() {
|
|
892
|
-
* const { requests, isLoading, error, refetch } = useRequests();
|
|
976
|
+
* const { requests, isLoading, error, refetch, settings } = useRequests();
|
|
893
977
|
*
|
|
894
978
|
* if (isLoading) return <p>Loading...</p>;
|
|
895
979
|
* if (error) return <p>Error: {error.message}</p>;
|
|
@@ -912,10 +996,44 @@ declare function useRequests(options?: RequestsOptions): {
|
|
|
912
996
|
offset: number;
|
|
913
997
|
hasMore: boolean;
|
|
914
998
|
} | undefined;
|
|
999
|
+
settings: RequestsSettings;
|
|
915
1000
|
isLoading: boolean;
|
|
916
1001
|
error: Error | null;
|
|
917
1002
|
refetch: () => Promise<void>;
|
|
918
1003
|
};
|
|
1004
|
+
/**
|
|
1005
|
+
* Hook for voting on requests.
|
|
1006
|
+
*
|
|
1007
|
+
* @returns Object with vote function and loading state
|
|
1008
|
+
*
|
|
1009
|
+
* @example
|
|
1010
|
+
* ```tsx
|
|
1011
|
+
* function VoteButton({ feedbackId }: { feedbackId: string }) {
|
|
1012
|
+
* const { vote, isVoting } = useVote();
|
|
1013
|
+
*
|
|
1014
|
+
* const handleVote = async () => {
|
|
1015
|
+
* const result = await vote(feedbackId);
|
|
1016
|
+
* console.log('Voted:', result.action); // 'added' or 'removed'
|
|
1017
|
+
* };
|
|
1018
|
+
*
|
|
1019
|
+
* return (
|
|
1020
|
+
* <button onClick={handleVote} disabled={isVoting}>
|
|
1021
|
+
* Vote
|
|
1022
|
+
* </button>
|
|
1023
|
+
* );
|
|
1024
|
+
* }
|
|
1025
|
+
* ```
|
|
1026
|
+
*/
|
|
1027
|
+
declare function useVote(): {
|
|
1028
|
+
vote: (feedbackId: string) => Promise<{
|
|
1029
|
+
success: boolean;
|
|
1030
|
+
action: "added" | "removed";
|
|
1031
|
+
vote_count: number;
|
|
1032
|
+
user_has_voted: boolean;
|
|
1033
|
+
}>;
|
|
1034
|
+
isVoting: boolean;
|
|
1035
|
+
error: Error | null;
|
|
1036
|
+
};
|
|
919
1037
|
/**
|
|
920
1038
|
* Hook for tracking events.
|
|
921
1039
|
*
|
|
@@ -943,6 +1061,37 @@ declare function useTrack(): {
|
|
|
943
1061
|
properties?: Record<string, unknown>;
|
|
944
1062
|
}>) => Promise<void>;
|
|
945
1063
|
};
|
|
1064
|
+
/**
|
|
1065
|
+
* Hook for fetching feature groups with their features.
|
|
1066
|
+
*
|
|
1067
|
+
* @returns Object with feature groups data and loading state
|
|
1068
|
+
*
|
|
1069
|
+
* @example
|
|
1070
|
+
* ```tsx
|
|
1071
|
+
* function FeatureNav() {
|
|
1072
|
+
* const { featureGroups, isLoading, error } = useFeatureGroups();
|
|
1073
|
+
*
|
|
1074
|
+
* if (isLoading) return <p>Loading...</p>;
|
|
1075
|
+
* if (error) return <p>Error: {error.message}</p>;
|
|
1076
|
+
*
|
|
1077
|
+
* return (
|
|
1078
|
+
* <ul>
|
|
1079
|
+
* {featureGroups.map(group => (
|
|
1080
|
+
* <li key={group.id}>
|
|
1081
|
+
* {group.name} ({group.feature_count} features)
|
|
1082
|
+
* </li>
|
|
1083
|
+
* ))}
|
|
1084
|
+
* </ul>
|
|
1085
|
+
* );
|
|
1086
|
+
* }
|
|
1087
|
+
* ```
|
|
1088
|
+
*/
|
|
1089
|
+
declare function useFeatureGroups(): {
|
|
1090
|
+
featureGroups: FeatureGroup[];
|
|
1091
|
+
isLoading: boolean;
|
|
1092
|
+
error: Error | null;
|
|
1093
|
+
refetch: () => Promise<void>;
|
|
1094
|
+
};
|
|
946
1095
|
|
|
947
1096
|
/**
|
|
948
1097
|
* Floating feedback button component.
|
|
@@ -1010,4 +1159,57 @@ declare function KnowledgeBase({ showSearch, showCategories, defaultCategory, th
|
|
|
1010
1159
|
*/
|
|
1011
1160
|
declare function Requests({ status, type, limit, className, showEmptyState, onRequestClick, }: RequestsProps): react_jsx_runtime.JSX.Element | null;
|
|
1012
1161
|
|
|
1013
|
-
|
|
1162
|
+
type HelpCenterTab = 'articles' | 'requests';
|
|
1163
|
+
interface HelpCenterProps {
|
|
1164
|
+
/**
|
|
1165
|
+
* Which tabs to show
|
|
1166
|
+
* @default ['articles', 'requests']
|
|
1167
|
+
*/
|
|
1168
|
+
tabs?: HelpCenterTab[];
|
|
1169
|
+
/**
|
|
1170
|
+
* Default active tab
|
|
1171
|
+
* @default 'articles'
|
|
1172
|
+
*/
|
|
1173
|
+
defaultTab?: HelpCenterTab;
|
|
1174
|
+
/**
|
|
1175
|
+
* Custom labels for tabs
|
|
1176
|
+
*/
|
|
1177
|
+
tabLabels?: Partial<Record<HelpCenterTab, string>>;
|
|
1178
|
+
/**
|
|
1179
|
+
* Show search in knowledge base
|
|
1180
|
+
* @default true
|
|
1181
|
+
*/
|
|
1182
|
+
showSearch?: boolean;
|
|
1183
|
+
/**
|
|
1184
|
+
* Show categories in knowledge base
|
|
1185
|
+
* @default true
|
|
1186
|
+
*/
|
|
1187
|
+
showCategories?: boolean;
|
|
1188
|
+
/**
|
|
1189
|
+
* Custom CSS class
|
|
1190
|
+
*/
|
|
1191
|
+
className?: string;
|
|
1192
|
+
}
|
|
1193
|
+
/**
|
|
1194
|
+
* HelpCenter component that combines KnowledgeBase and Requests with tabs.
|
|
1195
|
+
*
|
|
1196
|
+
* @example
|
|
1197
|
+
* ```tsx
|
|
1198
|
+
* import { CensusProvider, HelpCenter } from '@census-ai/census-sdk/react';
|
|
1199
|
+
*
|
|
1200
|
+
* function HelpPage() {
|
|
1201
|
+
* return (
|
|
1202
|
+
* <CensusProvider apiKey="cs_live_xxx">
|
|
1203
|
+
* <HelpCenter
|
|
1204
|
+
* tabs={['articles', 'requests']}
|
|
1205
|
+
* defaultTab="articles"
|
|
1206
|
+
* showSearch
|
|
1207
|
+
* />
|
|
1208
|
+
* </CensusProvider>
|
|
1209
|
+
* );
|
|
1210
|
+
* }
|
|
1211
|
+
* ```
|
|
1212
|
+
*/
|
|
1213
|
+
declare function HelpCenter({ tabs, defaultTab, tabLabels, showSearch, showCategories, className, }: HelpCenterProps): react_jsx_runtime.JSX.Element;
|
|
1214
|
+
|
|
1215
|
+
export { type Article, type ArticlesOptions, CensusProvider, type CensusProviderProps, type CensusTheme, type Feature, type FeatureGroup, FeedbackButton, type FeedbackButtonProps, type FeedbackOptions, type FeedbackType, type FeedbackVisibility, HelpCenter, type HelpCenterProps, type HelpCenterTab, KnowledgeBase, type KnowledgeBaseProps, type Position, type Request, Requests, type RequestsOptions, type RequestsProps, type RequestsSettings, type UserIdentity, useArticle, useArticles, useCensus, useCensusContext, useFeatureGroups, useFeedback, useIdentify, useRequests, useTrack, useVote };
|
package/dist/react/index.d.ts
CHANGED
|
@@ -188,6 +188,21 @@ interface Request {
|
|
|
188
188
|
rating: number | null;
|
|
189
189
|
helpful: boolean | null;
|
|
190
190
|
metadata: Record<string, unknown>;
|
|
191
|
+
vote_count: number;
|
|
192
|
+
user_has_voted: boolean;
|
|
193
|
+
is_own: boolean;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Feedback visibility setting
|
|
197
|
+
*/
|
|
198
|
+
type FeedbackVisibility = 'own' | 'organization' | 'all';
|
|
199
|
+
/**
|
|
200
|
+
* Project settings for requests
|
|
201
|
+
*/
|
|
202
|
+
interface RequestsSettings {
|
|
203
|
+
feedbackVisibility: FeedbackVisibility;
|
|
204
|
+
allowVoting: boolean;
|
|
205
|
+
allowRequestCreation: boolean;
|
|
191
206
|
}
|
|
192
207
|
/**
|
|
193
208
|
* Options for fetching requests
|
|
@@ -223,6 +238,7 @@ interface RequestsResponse {
|
|
|
223
238
|
offset: number;
|
|
224
239
|
hasMore: boolean;
|
|
225
240
|
};
|
|
241
|
+
settings: RequestsSettings;
|
|
226
242
|
}
|
|
227
243
|
/**
|
|
228
244
|
* Position for floating UI elements
|
|
@@ -442,6 +458,36 @@ interface GuidesResponse {
|
|
|
442
458
|
completedGuides: string[];
|
|
443
459
|
}
|
|
444
460
|
type GuideEventType = 'started' | 'step_viewed' | 'step_completed' | 'completed' | 'skipped' | 'dismissed';
|
|
461
|
+
/**
|
|
462
|
+
* A feature within a feature group
|
|
463
|
+
*/
|
|
464
|
+
interface Feature {
|
|
465
|
+
id: string;
|
|
466
|
+
name: string;
|
|
467
|
+
slug: string;
|
|
468
|
+
description: string | null;
|
|
469
|
+
status: string;
|
|
470
|
+
article_count: number;
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* A group of related features
|
|
474
|
+
*/
|
|
475
|
+
interface FeatureGroup {
|
|
476
|
+
id: string;
|
|
477
|
+
name: string;
|
|
478
|
+
slug: string;
|
|
479
|
+
description: string | null;
|
|
480
|
+
color: string | null;
|
|
481
|
+
features: Feature[];
|
|
482
|
+
feature_count: number;
|
|
483
|
+
article_count: number;
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* Response from feature groups endpoint
|
|
487
|
+
*/
|
|
488
|
+
interface FeatureGroupsResponse {
|
|
489
|
+
feature_groups: FeatureGroup[];
|
|
490
|
+
}
|
|
445
491
|
interface GuideAnalyticsEvent {
|
|
446
492
|
guideId: string;
|
|
447
493
|
eventType: GuideEventType;
|
|
@@ -563,6 +609,21 @@ declare class CensusClient {
|
|
|
563
609
|
* ```
|
|
564
610
|
*/
|
|
565
611
|
getArticle(slugOrId: string): Promise<Article | null>;
|
|
612
|
+
/**
|
|
613
|
+
* Fetch feature groups with their features and article counts.
|
|
614
|
+
* Used for navigation in the knowledge base.
|
|
615
|
+
*
|
|
616
|
+
* @returns Feature groups with nested features
|
|
617
|
+
*
|
|
618
|
+
* @example
|
|
619
|
+
* ```typescript
|
|
620
|
+
* const { feature_groups } = await census.getFeatureGroups();
|
|
621
|
+
* feature_groups.forEach(group => {
|
|
622
|
+
* console.log(group.name, group.features.length);
|
|
623
|
+
* });
|
|
624
|
+
* ```
|
|
625
|
+
*/
|
|
626
|
+
getFeatureGroups(): Promise<FeatureGroupsResponse>;
|
|
566
627
|
/**
|
|
567
628
|
* Fetch the current user's submitted requests (feedback, bugs, feature requests).
|
|
568
629
|
* Requires a user to be identified first.
|
|
@@ -583,6 +644,29 @@ declare class CensusClient {
|
|
|
583
644
|
* ```
|
|
584
645
|
*/
|
|
585
646
|
getRequests(options?: RequestsOptions): Promise<RequestsResponse>;
|
|
647
|
+
/**
|
|
648
|
+
* Vote on a feedback request (toggle).
|
|
649
|
+
* If the user has already voted, removes the vote.
|
|
650
|
+
* If the user hasn't voted, adds a vote.
|
|
651
|
+
*
|
|
652
|
+
* @param feedbackId - ID of the feedback to vote on
|
|
653
|
+
* @returns Vote result with action taken and new vote count
|
|
654
|
+
*
|
|
655
|
+
* @example
|
|
656
|
+
* ```typescript
|
|
657
|
+
* // Vote on a feedback request
|
|
658
|
+
* const result = await census.vote('feedback-id-123');
|
|
659
|
+
* console.log(result.action); // 'added' or 'removed'
|
|
660
|
+
* console.log(result.vote_count); // 5
|
|
661
|
+
* console.log(result.user_has_voted); // true
|
|
662
|
+
* ```
|
|
663
|
+
*/
|
|
664
|
+
vote(feedbackId: string): Promise<{
|
|
665
|
+
success: boolean;
|
|
666
|
+
action: 'added' | 'removed';
|
|
667
|
+
vote_count: number;
|
|
668
|
+
user_has_voted: boolean;
|
|
669
|
+
}>;
|
|
586
670
|
/**
|
|
587
671
|
* Track a custom analytics event.
|
|
588
672
|
*
|
|
@@ -889,7 +973,7 @@ declare function useArticle(slugOrId: string): {
|
|
|
889
973
|
* @example
|
|
890
974
|
* ```tsx
|
|
891
975
|
* function MyRequests() {
|
|
892
|
-
* const { requests, isLoading, error, refetch } = useRequests();
|
|
976
|
+
* const { requests, isLoading, error, refetch, settings } = useRequests();
|
|
893
977
|
*
|
|
894
978
|
* if (isLoading) return <p>Loading...</p>;
|
|
895
979
|
* if (error) return <p>Error: {error.message}</p>;
|
|
@@ -912,10 +996,44 @@ declare function useRequests(options?: RequestsOptions): {
|
|
|
912
996
|
offset: number;
|
|
913
997
|
hasMore: boolean;
|
|
914
998
|
} | undefined;
|
|
999
|
+
settings: RequestsSettings;
|
|
915
1000
|
isLoading: boolean;
|
|
916
1001
|
error: Error | null;
|
|
917
1002
|
refetch: () => Promise<void>;
|
|
918
1003
|
};
|
|
1004
|
+
/**
|
|
1005
|
+
* Hook for voting on requests.
|
|
1006
|
+
*
|
|
1007
|
+
* @returns Object with vote function and loading state
|
|
1008
|
+
*
|
|
1009
|
+
* @example
|
|
1010
|
+
* ```tsx
|
|
1011
|
+
* function VoteButton({ feedbackId }: { feedbackId: string }) {
|
|
1012
|
+
* const { vote, isVoting } = useVote();
|
|
1013
|
+
*
|
|
1014
|
+
* const handleVote = async () => {
|
|
1015
|
+
* const result = await vote(feedbackId);
|
|
1016
|
+
* console.log('Voted:', result.action); // 'added' or 'removed'
|
|
1017
|
+
* };
|
|
1018
|
+
*
|
|
1019
|
+
* return (
|
|
1020
|
+
* <button onClick={handleVote} disabled={isVoting}>
|
|
1021
|
+
* Vote
|
|
1022
|
+
* </button>
|
|
1023
|
+
* );
|
|
1024
|
+
* }
|
|
1025
|
+
* ```
|
|
1026
|
+
*/
|
|
1027
|
+
declare function useVote(): {
|
|
1028
|
+
vote: (feedbackId: string) => Promise<{
|
|
1029
|
+
success: boolean;
|
|
1030
|
+
action: "added" | "removed";
|
|
1031
|
+
vote_count: number;
|
|
1032
|
+
user_has_voted: boolean;
|
|
1033
|
+
}>;
|
|
1034
|
+
isVoting: boolean;
|
|
1035
|
+
error: Error | null;
|
|
1036
|
+
};
|
|
919
1037
|
/**
|
|
920
1038
|
* Hook for tracking events.
|
|
921
1039
|
*
|
|
@@ -943,6 +1061,37 @@ declare function useTrack(): {
|
|
|
943
1061
|
properties?: Record<string, unknown>;
|
|
944
1062
|
}>) => Promise<void>;
|
|
945
1063
|
};
|
|
1064
|
+
/**
|
|
1065
|
+
* Hook for fetching feature groups with their features.
|
|
1066
|
+
*
|
|
1067
|
+
* @returns Object with feature groups data and loading state
|
|
1068
|
+
*
|
|
1069
|
+
* @example
|
|
1070
|
+
* ```tsx
|
|
1071
|
+
* function FeatureNav() {
|
|
1072
|
+
* const { featureGroups, isLoading, error } = useFeatureGroups();
|
|
1073
|
+
*
|
|
1074
|
+
* if (isLoading) return <p>Loading...</p>;
|
|
1075
|
+
* if (error) return <p>Error: {error.message}</p>;
|
|
1076
|
+
*
|
|
1077
|
+
* return (
|
|
1078
|
+
* <ul>
|
|
1079
|
+
* {featureGroups.map(group => (
|
|
1080
|
+
* <li key={group.id}>
|
|
1081
|
+
* {group.name} ({group.feature_count} features)
|
|
1082
|
+
* </li>
|
|
1083
|
+
* ))}
|
|
1084
|
+
* </ul>
|
|
1085
|
+
* );
|
|
1086
|
+
* }
|
|
1087
|
+
* ```
|
|
1088
|
+
*/
|
|
1089
|
+
declare function useFeatureGroups(): {
|
|
1090
|
+
featureGroups: FeatureGroup[];
|
|
1091
|
+
isLoading: boolean;
|
|
1092
|
+
error: Error | null;
|
|
1093
|
+
refetch: () => Promise<void>;
|
|
1094
|
+
};
|
|
946
1095
|
|
|
947
1096
|
/**
|
|
948
1097
|
* Floating feedback button component.
|
|
@@ -1010,4 +1159,57 @@ declare function KnowledgeBase({ showSearch, showCategories, defaultCategory, th
|
|
|
1010
1159
|
*/
|
|
1011
1160
|
declare function Requests({ status, type, limit, className, showEmptyState, onRequestClick, }: RequestsProps): react_jsx_runtime.JSX.Element | null;
|
|
1012
1161
|
|
|
1013
|
-
|
|
1162
|
+
type HelpCenterTab = 'articles' | 'requests';
|
|
1163
|
+
interface HelpCenterProps {
|
|
1164
|
+
/**
|
|
1165
|
+
* Which tabs to show
|
|
1166
|
+
* @default ['articles', 'requests']
|
|
1167
|
+
*/
|
|
1168
|
+
tabs?: HelpCenterTab[];
|
|
1169
|
+
/**
|
|
1170
|
+
* Default active tab
|
|
1171
|
+
* @default 'articles'
|
|
1172
|
+
*/
|
|
1173
|
+
defaultTab?: HelpCenterTab;
|
|
1174
|
+
/**
|
|
1175
|
+
* Custom labels for tabs
|
|
1176
|
+
*/
|
|
1177
|
+
tabLabels?: Partial<Record<HelpCenterTab, string>>;
|
|
1178
|
+
/**
|
|
1179
|
+
* Show search in knowledge base
|
|
1180
|
+
* @default true
|
|
1181
|
+
*/
|
|
1182
|
+
showSearch?: boolean;
|
|
1183
|
+
/**
|
|
1184
|
+
* Show categories in knowledge base
|
|
1185
|
+
* @default true
|
|
1186
|
+
*/
|
|
1187
|
+
showCategories?: boolean;
|
|
1188
|
+
/**
|
|
1189
|
+
* Custom CSS class
|
|
1190
|
+
*/
|
|
1191
|
+
className?: string;
|
|
1192
|
+
}
|
|
1193
|
+
/**
|
|
1194
|
+
* HelpCenter component that combines KnowledgeBase and Requests with tabs.
|
|
1195
|
+
*
|
|
1196
|
+
* @example
|
|
1197
|
+
* ```tsx
|
|
1198
|
+
* import { CensusProvider, HelpCenter } from '@census-ai/census-sdk/react';
|
|
1199
|
+
*
|
|
1200
|
+
* function HelpPage() {
|
|
1201
|
+
* return (
|
|
1202
|
+
* <CensusProvider apiKey="cs_live_xxx">
|
|
1203
|
+
* <HelpCenter
|
|
1204
|
+
* tabs={['articles', 'requests']}
|
|
1205
|
+
* defaultTab="articles"
|
|
1206
|
+
* showSearch
|
|
1207
|
+
* />
|
|
1208
|
+
* </CensusProvider>
|
|
1209
|
+
* );
|
|
1210
|
+
* }
|
|
1211
|
+
* ```
|
|
1212
|
+
*/
|
|
1213
|
+
declare function HelpCenter({ tabs, defaultTab, tabLabels, showSearch, showCategories, className, }: HelpCenterProps): react_jsx_runtime.JSX.Element;
|
|
1214
|
+
|
|
1215
|
+
export { type Article, type ArticlesOptions, CensusProvider, type CensusProviderProps, type CensusTheme, type Feature, type FeatureGroup, FeedbackButton, type FeedbackButtonProps, type FeedbackOptions, type FeedbackType, type FeedbackVisibility, HelpCenter, type HelpCenterProps, type HelpCenterTab, KnowledgeBase, type KnowledgeBaseProps, type Position, type Request, Requests, type RequestsOptions, type RequestsProps, type RequestsSettings, type UserIdentity, useArticle, useArticles, useCensus, useCensusContext, useFeatureGroups, useFeedback, useIdentify, useRequests, useTrack, useVote };
|