@census-ai/census-sdk 0.3.0 → 0.4.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.
@@ -107,7 +107,7 @@ interface Article {
107
107
  read_time_minutes: number | null;
108
108
  published_at: string | null;
109
109
  sort_order: number;
110
- content?: unknown;
110
+ content?: string;
111
111
  content_html?: string;
112
112
  features?: {
113
113
  id: string;
@@ -115,6 +115,36 @@ interface Article {
115
115
  slug: string;
116
116
  };
117
117
  }
118
+ /**
119
+ * A feature within a feature group
120
+ */
121
+ interface Feature {
122
+ id: string;
123
+ name: string;
124
+ slug: string;
125
+ description: string | null;
126
+ status: string;
127
+ article_count: number;
128
+ }
129
+ /**
130
+ * A feature group containing features
131
+ */
132
+ interface FeatureGroup {
133
+ id: string;
134
+ name: string;
135
+ slug: string;
136
+ description: string | null;
137
+ color: string | null;
138
+ features: Feature[];
139
+ feature_count: number;
140
+ article_count: number;
141
+ }
142
+ /**
143
+ * Response from feature groups endpoint
144
+ */
145
+ interface FeatureGroupsResponse {
146
+ feature_groups: FeatureGroup[];
147
+ }
118
148
  /**
119
149
  * Options for fetching articles
120
150
  */
@@ -628,6 +658,70 @@ interface RequestsProps {
628
658
  */
629
659
  onRequestClick?: (request: Request) => void;
630
660
  }
661
+ /**
662
+ * Available tabs in the HelpCenter component
663
+ */
664
+ type HelpCenterTab = 'articles' | 'requests';
665
+ /**
666
+ * Props for the HelpCenter component
667
+ */
668
+ interface HelpCenterProps {
669
+ /**
670
+ * Which tabs to show. Order determines tab order.
671
+ * @default ['articles', 'requests']
672
+ *
673
+ * @example
674
+ * // Show both tabs
675
+ * tabs={['articles', 'requests']}
676
+ *
677
+ * // Articles only (e.g., documentation page)
678
+ * tabs={['articles']}
679
+ *
680
+ * // Requests only (e.g., feedback page)
681
+ * tabs={['requests']}
682
+ */
683
+ tabs?: HelpCenterTab[];
684
+ /**
685
+ * Default tab to show on load
686
+ * @default First tab in the tabs array
687
+ */
688
+ defaultTab?: HelpCenterTab;
689
+ /**
690
+ * Custom labels for tabs
691
+ * @default { articles: 'Articles', requests: 'My Requests' }
692
+ */
693
+ tabLabels?: Partial<Record<HelpCenterTab, string>>;
694
+ /**
695
+ * Show search bar in articles tab
696
+ * @default true
697
+ */
698
+ showSearch?: boolean;
699
+ /**
700
+ * Show category filters in articles tab
701
+ * @default true
702
+ */
703
+ showCategories?: boolean;
704
+ /**
705
+ * Theme customization
706
+ */
707
+ theme?: CensusTheme;
708
+ /**
709
+ * Custom CSS class
710
+ */
711
+ className?: string;
712
+ /**
713
+ * Callback when an article is viewed
714
+ */
715
+ onArticleView?: (article: Article) => void;
716
+ /**
717
+ * Callback when a request is clicked
718
+ */
719
+ onRequestClick?: (request: Request) => void;
720
+ /**
721
+ * Callback when the active tab changes
722
+ */
723
+ onTabChange?: (tab: HelpCenterTab) => void;
724
+ }
631
725
  /**
632
726
  * Props for the CensusProvider component
633
727
  */
@@ -779,6 +873,21 @@ declare class CensusClient {
779
873
  * ```
780
874
  */
781
875
  getArticle(slugOrId: string): Promise<Article | null>;
876
+ /**
877
+ * Fetch feature groups with their features.
878
+ * Used by the HelpCenter component for navigation.
879
+ *
880
+ * @returns Feature groups with features and article counts
881
+ *
882
+ * @example
883
+ * ```typescript
884
+ * const { feature_groups } = await census.getFeatureGroups();
885
+ * feature_groups.forEach(group => {
886
+ * console.log(group.name, group.features.length);
887
+ * });
888
+ * ```
889
+ */
890
+ getFeatureGroups(): Promise<FeatureGroupsResponse>;
782
891
  /**
783
892
  * Fetch the current user's submitted requests (feedback, bugs, feature requests).
784
893
  * Requires a user to be identified first.
@@ -1229,6 +1338,42 @@ declare function useArticle(slugOrId: string): {
1229
1338
  error: Error | null;
1230
1339
  refetch: () => Promise<void>;
1231
1340
  };
1341
+ /**
1342
+ * Hook for fetching feature groups with their features.
1343
+ * Used by the HelpCenter component for navigation.
1344
+ *
1345
+ * @returns Object with feature groups data and loading state
1346
+ *
1347
+ * @example
1348
+ * ```tsx
1349
+ * function FeatureNav() {
1350
+ * const { featureGroups, isLoading } = useFeatureGroups();
1351
+ *
1352
+ * if (isLoading) return <p>Loading...</p>;
1353
+ *
1354
+ * return (
1355
+ * <nav>
1356
+ * {featureGroups.map(group => (
1357
+ * <div key={group.id}>
1358
+ * <h3>{group.name}</h3>
1359
+ * <ul>
1360
+ * {group.features.map(feature => (
1361
+ * <li key={feature.id}>{feature.name}</li>
1362
+ * ))}
1363
+ * </ul>
1364
+ * </div>
1365
+ * ))}
1366
+ * </nav>
1367
+ * );
1368
+ * }
1369
+ * ```
1370
+ */
1371
+ declare function useFeatureGroups(): {
1372
+ featureGroups: FeatureGroup[];
1373
+ isLoading: boolean;
1374
+ error: Error | null;
1375
+ refetch: () => Promise<void>;
1376
+ };
1232
1377
  /**
1233
1378
  * Hook for fetching the current user's submitted requests.
1234
1379
  *
@@ -1521,6 +1666,26 @@ declare function KnowledgeBase({ showSearch, showCategories, defaultCategory, th
1521
1666
  */
1522
1667
  declare function Requests({ status, type, limit, className, showEmptyState, onRequestClick, }: RequestsProps): react_jsx_runtime.JSX.Element | null;
1523
1668
 
1669
+ /**
1670
+ * Unified help center component with left navigation showing feature groups.
1671
+ *
1672
+ * @example
1673
+ * ```tsx
1674
+ * import { HelpCenter } from '@census-ai/census-sdk/react';
1675
+ *
1676
+ * function HelpPage() {
1677
+ * return (
1678
+ * <HelpCenter
1679
+ * tabs={['articles', 'requests']}
1680
+ * showSearch
1681
+ * />
1682
+ * );
1683
+ * }
1684
+ * ```
1685
+ */
1686
+ declare function HelpCenter({ tabs, defaultTab, tabLabels, showSearch, showCategories: _showCategories, // Reserved for future use
1687
+ theme: themeProp, className, onArticleView, onRequestClick, onTabChange, }: HelpCenterProps): react_jsx_runtime.JSX.Element;
1688
+
1524
1689
  /**
1525
1690
  * Props for the GuideBuilder component
1526
1691
  */
@@ -1936,4 +2101,4 @@ interface GuideRendererProps {
1936
2101
  */
1937
2102
  declare function GuideRenderer({ guide, onComplete, onDismiss, onStepChange, onCustomAction, globalStyle, startStep, zIndex, }: GuideRendererProps): react_jsx_runtime.JSX.Element | null;
1938
2103
 
1939
- export { type AdvanceTrigger, type Article, type ArticlesOptions, Backdrop, BannerStep, CensusProvider, type CensusProviderProps, type CensusTheme, type CreateGuideOptions, type CreateGuideStepOptions, FeedbackButton, type FeedbackButtonProps, type FeedbackOptions, type FeedbackType, type Guide, GuideBuilder, type GuideFormType, GuideRenderer, type GuideStatus, type GuideStep, type GuideStepAdvanceConfig, type GuideStepDisplayConfig, type GuideStepRichContent, type GuideStepStyleConfig, type GuideStepType, type GuideTriggerType, type GuidesOptions, type GuidesResponse, HotspotStep, KnowledgeBase, type KnowledgeBaseProps, ModalStep, type Position, type Request, Requests, type RequestsOptions, type RequestsProps, type SelectorStrategy, SlideoutStep, StepButtons, StepContent, type TooltipPosition, TooltipStep, type UpdateGuideOptions, type UpdateGuideStepOptions, type UserIdentity, useArticle, useArticles, useCensus, useCensusContext, useFeedback, useGuideBuilder, useGuideRenderer, useGuides, useIdentify, useRequests, useTrack };
2104
+ export { type AdvanceTrigger, type Article, type ArticlesOptions, Backdrop, BannerStep, CensusProvider, type CensusProviderProps, type CensusTheme, type CreateGuideOptions, type CreateGuideStepOptions, type Feature, type FeatureGroup, type FeatureGroupsResponse, FeedbackButton, type FeedbackButtonProps, type FeedbackOptions, type FeedbackType, type Guide, GuideBuilder, type GuideFormType, GuideRenderer, type GuideStatus, type GuideStep, type GuideStepAdvanceConfig, type GuideStepDisplayConfig, type GuideStepRichContent, type GuideStepStyleConfig, type GuideStepType, type GuideTriggerType, type GuidesOptions, type GuidesResponse, HelpCenter, type HelpCenterProps, type HelpCenterTab, HotspotStep, KnowledgeBase, type KnowledgeBaseProps, ModalStep, type Position, type Request, Requests, type RequestsOptions, type RequestsProps, type SelectorStrategy, SlideoutStep, StepButtons, StepContent, type TooltipPosition, TooltipStep, type UpdateGuideOptions, type UpdateGuideStepOptions, type UserIdentity, useArticle, useArticles, useCensus, useCensusContext, useFeatureGroups, useFeedback, useGuideBuilder, useGuideRenderer, useGuides, useIdentify, useRequests, useTrack };
@@ -107,7 +107,7 @@ interface Article {
107
107
  read_time_minutes: number | null;
108
108
  published_at: string | null;
109
109
  sort_order: number;
110
- content?: unknown;
110
+ content?: string;
111
111
  content_html?: string;
112
112
  features?: {
113
113
  id: string;
@@ -115,6 +115,36 @@ interface Article {
115
115
  slug: string;
116
116
  };
117
117
  }
118
+ /**
119
+ * A feature within a feature group
120
+ */
121
+ interface Feature {
122
+ id: string;
123
+ name: string;
124
+ slug: string;
125
+ description: string | null;
126
+ status: string;
127
+ article_count: number;
128
+ }
129
+ /**
130
+ * A feature group containing features
131
+ */
132
+ interface FeatureGroup {
133
+ id: string;
134
+ name: string;
135
+ slug: string;
136
+ description: string | null;
137
+ color: string | null;
138
+ features: Feature[];
139
+ feature_count: number;
140
+ article_count: number;
141
+ }
142
+ /**
143
+ * Response from feature groups endpoint
144
+ */
145
+ interface FeatureGroupsResponse {
146
+ feature_groups: FeatureGroup[];
147
+ }
118
148
  /**
119
149
  * Options for fetching articles
120
150
  */
@@ -628,6 +658,70 @@ interface RequestsProps {
628
658
  */
629
659
  onRequestClick?: (request: Request) => void;
630
660
  }
661
+ /**
662
+ * Available tabs in the HelpCenter component
663
+ */
664
+ type HelpCenterTab = 'articles' | 'requests';
665
+ /**
666
+ * Props for the HelpCenter component
667
+ */
668
+ interface HelpCenterProps {
669
+ /**
670
+ * Which tabs to show. Order determines tab order.
671
+ * @default ['articles', 'requests']
672
+ *
673
+ * @example
674
+ * // Show both tabs
675
+ * tabs={['articles', 'requests']}
676
+ *
677
+ * // Articles only (e.g., documentation page)
678
+ * tabs={['articles']}
679
+ *
680
+ * // Requests only (e.g., feedback page)
681
+ * tabs={['requests']}
682
+ */
683
+ tabs?: HelpCenterTab[];
684
+ /**
685
+ * Default tab to show on load
686
+ * @default First tab in the tabs array
687
+ */
688
+ defaultTab?: HelpCenterTab;
689
+ /**
690
+ * Custom labels for tabs
691
+ * @default { articles: 'Articles', requests: 'My Requests' }
692
+ */
693
+ tabLabels?: Partial<Record<HelpCenterTab, string>>;
694
+ /**
695
+ * Show search bar in articles tab
696
+ * @default true
697
+ */
698
+ showSearch?: boolean;
699
+ /**
700
+ * Show category filters in articles tab
701
+ * @default true
702
+ */
703
+ showCategories?: boolean;
704
+ /**
705
+ * Theme customization
706
+ */
707
+ theme?: CensusTheme;
708
+ /**
709
+ * Custom CSS class
710
+ */
711
+ className?: string;
712
+ /**
713
+ * Callback when an article is viewed
714
+ */
715
+ onArticleView?: (article: Article) => void;
716
+ /**
717
+ * Callback when a request is clicked
718
+ */
719
+ onRequestClick?: (request: Request) => void;
720
+ /**
721
+ * Callback when the active tab changes
722
+ */
723
+ onTabChange?: (tab: HelpCenterTab) => void;
724
+ }
631
725
  /**
632
726
  * Props for the CensusProvider component
633
727
  */
@@ -779,6 +873,21 @@ declare class CensusClient {
779
873
  * ```
780
874
  */
781
875
  getArticle(slugOrId: string): Promise<Article | null>;
876
+ /**
877
+ * Fetch feature groups with their features.
878
+ * Used by the HelpCenter component for navigation.
879
+ *
880
+ * @returns Feature groups with features and article counts
881
+ *
882
+ * @example
883
+ * ```typescript
884
+ * const { feature_groups } = await census.getFeatureGroups();
885
+ * feature_groups.forEach(group => {
886
+ * console.log(group.name, group.features.length);
887
+ * });
888
+ * ```
889
+ */
890
+ getFeatureGroups(): Promise<FeatureGroupsResponse>;
782
891
  /**
783
892
  * Fetch the current user's submitted requests (feedback, bugs, feature requests).
784
893
  * Requires a user to be identified first.
@@ -1229,6 +1338,42 @@ declare function useArticle(slugOrId: string): {
1229
1338
  error: Error | null;
1230
1339
  refetch: () => Promise<void>;
1231
1340
  };
1341
+ /**
1342
+ * Hook for fetching feature groups with their features.
1343
+ * Used by the HelpCenter component for navigation.
1344
+ *
1345
+ * @returns Object with feature groups data and loading state
1346
+ *
1347
+ * @example
1348
+ * ```tsx
1349
+ * function FeatureNav() {
1350
+ * const { featureGroups, isLoading } = useFeatureGroups();
1351
+ *
1352
+ * if (isLoading) return <p>Loading...</p>;
1353
+ *
1354
+ * return (
1355
+ * <nav>
1356
+ * {featureGroups.map(group => (
1357
+ * <div key={group.id}>
1358
+ * <h3>{group.name}</h3>
1359
+ * <ul>
1360
+ * {group.features.map(feature => (
1361
+ * <li key={feature.id}>{feature.name}</li>
1362
+ * ))}
1363
+ * </ul>
1364
+ * </div>
1365
+ * ))}
1366
+ * </nav>
1367
+ * );
1368
+ * }
1369
+ * ```
1370
+ */
1371
+ declare function useFeatureGroups(): {
1372
+ featureGroups: FeatureGroup[];
1373
+ isLoading: boolean;
1374
+ error: Error | null;
1375
+ refetch: () => Promise<void>;
1376
+ };
1232
1377
  /**
1233
1378
  * Hook for fetching the current user's submitted requests.
1234
1379
  *
@@ -1521,6 +1666,26 @@ declare function KnowledgeBase({ showSearch, showCategories, defaultCategory, th
1521
1666
  */
1522
1667
  declare function Requests({ status, type, limit, className, showEmptyState, onRequestClick, }: RequestsProps): react_jsx_runtime.JSX.Element | null;
1523
1668
 
1669
+ /**
1670
+ * Unified help center component with left navigation showing feature groups.
1671
+ *
1672
+ * @example
1673
+ * ```tsx
1674
+ * import { HelpCenter } from '@census-ai/census-sdk/react';
1675
+ *
1676
+ * function HelpPage() {
1677
+ * return (
1678
+ * <HelpCenter
1679
+ * tabs={['articles', 'requests']}
1680
+ * showSearch
1681
+ * />
1682
+ * );
1683
+ * }
1684
+ * ```
1685
+ */
1686
+ declare function HelpCenter({ tabs, defaultTab, tabLabels, showSearch, showCategories: _showCategories, // Reserved for future use
1687
+ theme: themeProp, className, onArticleView, onRequestClick, onTabChange, }: HelpCenterProps): react_jsx_runtime.JSX.Element;
1688
+
1524
1689
  /**
1525
1690
  * Props for the GuideBuilder component
1526
1691
  */
@@ -1936,4 +2101,4 @@ interface GuideRendererProps {
1936
2101
  */
1937
2102
  declare function GuideRenderer({ guide, onComplete, onDismiss, onStepChange, onCustomAction, globalStyle, startStep, zIndex, }: GuideRendererProps): react_jsx_runtime.JSX.Element | null;
1938
2103
 
1939
- export { type AdvanceTrigger, type Article, type ArticlesOptions, Backdrop, BannerStep, CensusProvider, type CensusProviderProps, type CensusTheme, type CreateGuideOptions, type CreateGuideStepOptions, FeedbackButton, type FeedbackButtonProps, type FeedbackOptions, type FeedbackType, type Guide, GuideBuilder, type GuideFormType, GuideRenderer, type GuideStatus, type GuideStep, type GuideStepAdvanceConfig, type GuideStepDisplayConfig, type GuideStepRichContent, type GuideStepStyleConfig, type GuideStepType, type GuideTriggerType, type GuidesOptions, type GuidesResponse, HotspotStep, KnowledgeBase, type KnowledgeBaseProps, ModalStep, type Position, type Request, Requests, type RequestsOptions, type RequestsProps, type SelectorStrategy, SlideoutStep, StepButtons, StepContent, type TooltipPosition, TooltipStep, type UpdateGuideOptions, type UpdateGuideStepOptions, type UserIdentity, useArticle, useArticles, useCensus, useCensusContext, useFeedback, useGuideBuilder, useGuideRenderer, useGuides, useIdentify, useRequests, useTrack };
2104
+ export { type AdvanceTrigger, type Article, type ArticlesOptions, Backdrop, BannerStep, CensusProvider, type CensusProviderProps, type CensusTheme, type CreateGuideOptions, type CreateGuideStepOptions, type Feature, type FeatureGroup, type FeatureGroupsResponse, FeedbackButton, type FeedbackButtonProps, type FeedbackOptions, type FeedbackType, type Guide, GuideBuilder, type GuideFormType, GuideRenderer, type GuideStatus, type GuideStep, type GuideStepAdvanceConfig, type GuideStepDisplayConfig, type GuideStepRichContent, type GuideStepStyleConfig, type GuideStepType, type GuideTriggerType, type GuidesOptions, type GuidesResponse, HelpCenter, type HelpCenterProps, type HelpCenterTab, HotspotStep, KnowledgeBase, type KnowledgeBaseProps, ModalStep, type Position, type Request, Requests, type RequestsOptions, type RequestsProps, type SelectorStrategy, SlideoutStep, StepButtons, StepContent, type TooltipPosition, TooltipStep, type UpdateGuideOptions, type UpdateGuideStepOptions, type UserIdentity, useArticle, useArticles, useCensus, useCensusContext, useFeatureGroups, useFeedback, useGuideBuilder, useGuideRenderer, useGuides, useIdentify, useRequests, useTrack };