@census-ai/census-sdk 0.2.0 → 0.4.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.
@@ -1,4 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as react from 'react';
3
+ import { ReactNode } from 'react';
2
4
 
3
5
  /**
4
6
  * Configuration options for the Census SDK
@@ -105,7 +107,7 @@ interface Article {
105
107
  read_time_minutes: number | null;
106
108
  published_at: string | null;
107
109
  sort_order: number;
108
- content?: unknown;
110
+ content?: string;
109
111
  content_html?: string;
110
112
  features?: {
111
113
  id: string;
@@ -113,6 +115,36 @@ interface Article {
113
115
  slug: string;
114
116
  };
115
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
+ }
116
148
  /**
117
149
  * Options for fetching articles
118
150
  */
@@ -224,6 +256,272 @@ interface RequestsResponse {
224
256
  hasMore: boolean;
225
257
  };
226
258
  }
259
+ /**
260
+ * Step types for guides
261
+ */
262
+ type GuideStepType = 'tooltip' | 'modal' | 'slideout' | 'hotspot' | 'banner';
263
+ /**
264
+ * Tooltip position options
265
+ */
266
+ type TooltipPosition = 'auto' | 'top' | 'bottom' | 'left' | 'right';
267
+ /**
268
+ * Step advancement trigger types
269
+ */
270
+ type AdvanceTrigger = 'button' | 'click' | 'delay' | 'form-submit';
271
+ /**
272
+ * Form types for guide steps
273
+ */
274
+ type GuideFormType = 'nps' | 'rating' | 'text' | 'select' | 'multi-select';
275
+ /**
276
+ * Rich content for guide steps
277
+ */
278
+ interface GuideStepRichContent {
279
+ title?: string;
280
+ body?: string;
281
+ media?: {
282
+ type: 'image' | 'video';
283
+ url: string;
284
+ alt?: string;
285
+ };
286
+ buttons?: Array<{
287
+ label: string;
288
+ action: 'next' | 'prev' | 'dismiss' | 'url' | 'custom';
289
+ url?: string;
290
+ customAction?: string;
291
+ style?: 'primary' | 'secondary' | 'text';
292
+ }>;
293
+ form?: {
294
+ type: GuideFormType;
295
+ question: string;
296
+ options?: string[];
297
+ required?: boolean;
298
+ submitLabel?: string;
299
+ };
300
+ }
301
+ /**
302
+ * Display configuration for guide steps
303
+ */
304
+ interface GuideStepDisplayConfig {
305
+ position?: TooltipPosition | 'center';
306
+ offset?: {
307
+ x: number;
308
+ y: number;
309
+ };
310
+ width?: number;
311
+ backdrop?: boolean;
312
+ spotlightPadding?: number;
313
+ bannerPosition?: 'top' | 'bottom';
314
+ }
315
+ /**
316
+ * Advancement configuration for guide steps
317
+ */
318
+ interface GuideStepAdvanceConfig {
319
+ trigger: AdvanceTrigger;
320
+ delay?: number;
321
+ clickSelector?: string;
322
+ }
323
+ /**
324
+ * Style configuration for guide steps
325
+ */
326
+ interface GuideStepStyleConfig {
327
+ backgroundColor?: string;
328
+ textColor?: string;
329
+ accentColor?: string;
330
+ borderRadius?: number;
331
+ customCSS?: string;
332
+ }
333
+ /**
334
+ * Selector strategy for targeting elements
335
+ */
336
+ interface SelectorStrategy {
337
+ css?: string;
338
+ xpath?: string;
339
+ text?: string;
340
+ testId?: string;
341
+ }
342
+ /**
343
+ * Guide step definition
344
+ */
345
+ interface GuideStep {
346
+ id: string;
347
+ guide_id?: string;
348
+ sort_order: number;
349
+ step_type: GuideStepType;
350
+ selector_strategy: SelectorStrategy | null;
351
+ title: string | null;
352
+ content: string | null;
353
+ tooltip_position: TooltipPosition;
354
+ actions: Array<Record<string, unknown>>;
355
+ wait_for: 'click' | 'next_button' | 'delay' | 'custom';
356
+ wait_config: Record<string, unknown>;
357
+ rich_content: GuideStepRichContent;
358
+ display_config: GuideStepDisplayConfig;
359
+ advance_config: GuideStepAdvanceConfig;
360
+ style_config: GuideStepStyleConfig;
361
+ created_at?: string;
362
+ updated_at?: string;
363
+ }
364
+ /**
365
+ * Guide trigger types
366
+ */
367
+ type GuideTriggerType = 'manual' | 'url_match' | 'first_visit' | 'event';
368
+ /**
369
+ * Guide status
370
+ */
371
+ type GuideStatus = 'draft' | 'published' | 'archived';
372
+ /**
373
+ * Guide definition
374
+ */
375
+ interface Guide {
376
+ id: string;
377
+ name: string;
378
+ slug: string;
379
+ description: string | null;
380
+ trigger_type: GuideTriggerType;
381
+ trigger_config: Record<string, unknown>;
382
+ theme: Record<string, unknown>;
383
+ allow_skip: boolean;
384
+ show_progress: boolean;
385
+ status?: GuideStatus;
386
+ published_at?: string | null;
387
+ created_at?: string;
388
+ updated_at?: string;
389
+ guide_steps: GuideStep[];
390
+ }
391
+ /**
392
+ * Options for creating a guide
393
+ */
394
+ interface CreateGuideOptions {
395
+ /**
396
+ * Name of the guide
397
+ */
398
+ name: string;
399
+ /**
400
+ * URL-friendly slug (lowercase, hyphens only)
401
+ */
402
+ slug: string;
403
+ /**
404
+ * Description of the guide
405
+ */
406
+ description?: string;
407
+ /**
408
+ * Project ID to associate with
409
+ */
410
+ projectId?: string;
411
+ /**
412
+ * When to trigger the guide
413
+ * @default "manual"
414
+ */
415
+ triggerType?: GuideTriggerType;
416
+ /**
417
+ * Configuration for the trigger (e.g., url_pattern for url_match)
418
+ */
419
+ triggerConfig?: Record<string, unknown>;
420
+ /**
421
+ * Theme customization
422
+ */
423
+ theme?: Record<string, unknown>;
424
+ /**
425
+ * Allow users to skip the guide
426
+ * @default true
427
+ */
428
+ allowSkip?: boolean;
429
+ /**
430
+ * Show progress indicator
431
+ * @default true
432
+ */
433
+ showProgress?: boolean;
434
+ }
435
+ /**
436
+ * Options for updating a guide
437
+ */
438
+ interface UpdateGuideOptions {
439
+ name?: string;
440
+ slug?: string;
441
+ description?: string;
442
+ triggerType?: GuideTriggerType;
443
+ triggerConfig?: Record<string, unknown>;
444
+ theme?: Record<string, unknown>;
445
+ allowSkip?: boolean;
446
+ showProgress?: boolean;
447
+ status?: GuideStatus;
448
+ }
449
+ /**
450
+ * Options for creating a guide step
451
+ */
452
+ interface CreateGuideStepOptions {
453
+ /**
454
+ * Type of step
455
+ * @default "tooltip"
456
+ */
457
+ stepType?: GuideStepType;
458
+ /**
459
+ * Order position (auto-assigned if not provided)
460
+ */
461
+ sortOrder?: number;
462
+ /**
463
+ * Element selector strategy
464
+ */
465
+ selectorStrategy?: SelectorStrategy;
466
+ /**
467
+ * Simple title (legacy, use richContent.title instead)
468
+ */
469
+ title?: string;
470
+ /**
471
+ * Simple content (legacy, use richContent.body instead)
472
+ */
473
+ content?: string;
474
+ /**
475
+ * Tooltip position
476
+ * @default "auto"
477
+ */
478
+ tooltipPosition?: TooltipPosition;
479
+ /**
480
+ * Rich content configuration
481
+ */
482
+ richContent?: GuideStepRichContent;
483
+ /**
484
+ * Display configuration
485
+ */
486
+ displayConfig?: GuideStepDisplayConfig;
487
+ /**
488
+ * Advancement configuration
489
+ */
490
+ advanceConfig?: GuideStepAdvanceConfig;
491
+ /**
492
+ * Style overrides
493
+ */
494
+ styleConfig?: GuideStepStyleConfig;
495
+ }
496
+ /**
497
+ * Options for updating a guide step
498
+ */
499
+ interface UpdateGuideStepOptions extends Partial<CreateGuideStepOptions> {
500
+ }
501
+ /**
502
+ * Options for fetching guides
503
+ */
504
+ interface GuidesOptions {
505
+ /**
506
+ * Filter by project ID
507
+ */
508
+ projectId?: string;
509
+ /**
510
+ * Current page URL (for trigger matching)
511
+ */
512
+ url?: string;
513
+ /**
514
+ * User ID (to get completion status)
515
+ */
516
+ userId?: string;
517
+ }
518
+ /**
519
+ * Response from guides list endpoint
520
+ */
521
+ interface GuidesResponse {
522
+ guides: Guide[];
523
+ completedGuides: string[];
524
+ }
227
525
  /**
228
526
  * Position for floating UI elements
229
527
  */
@@ -360,6 +658,70 @@ interface RequestsProps {
360
658
  */
361
659
  onRequestClick?: (request: Request) => void;
362
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
+ }
363
725
  /**
364
726
  * Props for the CensusProvider component
365
727
  */
@@ -389,58 +751,6 @@ interface CensusProviderProps {
389
751
  */
390
752
  children: React.ReactNode;
391
753
  }
392
- interface GuideStep {
393
- id: string;
394
- sort_order: number;
395
- selector_strategy: SelectorStrategy;
396
- title: string | null;
397
- content: string | null;
398
- tooltip_position: TooltipPosition;
399
- actions: GuideAction[];
400
- wait_for: WaitForType;
401
- wait_config: Record<string, unknown>;
402
- }
403
- interface SelectorStrategy {
404
- css?: string;
405
- xpath?: string;
406
- text?: string;
407
- testId?: string;
408
- }
409
- type TooltipPosition = 'auto' | 'top' | 'bottom' | 'left' | 'right';
410
- type WaitForType = 'click' | 'next_button' | 'delay' | 'custom';
411
- interface GuideAction {
412
- type: 'click' | 'input' | 'navigate' | 'custom';
413
- config: Record<string, unknown>;
414
- }
415
- interface Guide {
416
- id: string;
417
- name: string;
418
- slug: string;
419
- description: string | null;
420
- trigger_type: GuideTriggerType;
421
- trigger_config: TriggerConfig;
422
- theme: GuideTheme;
423
- allow_skip: boolean;
424
- show_progress: boolean;
425
- guide_steps: GuideStep[];
426
- }
427
- type GuideTriggerType = 'manual' | 'url_match' | 'first_visit' | 'event';
428
- interface TriggerConfig {
429
- url_pattern?: string;
430
- event_name?: string;
431
- delay_ms?: number;
432
- }
433
- interface GuideTheme {
434
- primaryColor?: string;
435
- backgroundColor?: string;
436
- textColor?: string;
437
- borderRadius?: string;
438
- fontFamily?: string;
439
- }
440
- interface GuidesResponse {
441
- guides: Guide[];
442
- completedGuides: string[];
443
- }
444
754
  type GuideEventType = 'started' | 'step_viewed' | 'step_completed' | 'completed' | 'skipped' | 'dismissed';
445
755
  interface GuideAnalyticsEvent {
446
756
  guideId: string;
@@ -563,6 +873,21 @@ declare class CensusClient {
563
873
  * ```
564
874
  */
565
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>;
566
891
  /**
567
892
  * Fetch the current user's submitted requests (feedback, bugs, feature requests).
568
893
  * Requires a user to be identified first.
@@ -617,60 +942,193 @@ declare class CensusClient {
617
942
  */
618
943
  trackBatch(options: BatchEventsOptions): Promise<void>;
619
944
  /**
620
- * Fetch available guides for the current user.
621
- * Returns guides that match the user's context and haven't been completed.
945
+ * Get published guides.
622
946
  *
623
- * @returns Guides and list of completed guide IDs
947
+ * @param options - Query options
948
+ * @returns Guides and completion status
624
949
  *
625
950
  * @example
626
951
  * ```typescript
627
- * const { guides, completedGuides } = await census.getGuides();
628
- * guides.forEach(guide => console.log(guide.name));
952
+ * const { guides, completedGuides } = await census.getGuides({
953
+ * url: window.location.href,
954
+ * userId: 'user_123',
955
+ * });
629
956
  * ```
630
957
  */
631
- getGuides(): Promise<GuidesResponse>;
958
+ getGuides(options?: GuidesOptions): Promise<GuidesResponse>;
632
959
  /**
633
- * Fetch a single guide by slug or ID.
960
+ * Get a single guide by ID.
634
961
  *
635
- * @param slugOrId - Guide slug or ID
636
- * @returns Guide or null if not found
962
+ * @param guideId - Guide ID
963
+ * @returns Guide with steps or null if not found
637
964
  *
638
965
  * @example
639
966
  * ```typescript
640
- * const guide = await census.getGuide('onboarding-tour');
967
+ * const guide = await census.getGuide('guide_123');
641
968
  * if (guide) {
642
969
  * console.log(guide.name, guide.guide_steps.length);
643
970
  * }
644
971
  * ```
645
972
  */
646
- getGuide(slugOrId: string): Promise<Guide | null>;
973
+ getGuide(guideId: string): Promise<Guide | null>;
647
974
  /**
648
- * Track a guide analytics event.
649
- * Used to track user progress through guides.
975
+ * Create a new guide.
976
+ * Requires guides:create or guides:admin scope.
650
977
  *
651
- * @param event - Guide analytics event
978
+ * @param options - Guide creation options
979
+ * @returns Created guide
652
980
  *
653
981
  * @example
654
982
  * ```typescript
655
- * await census.trackGuideEvent({
656
- * guideId: 'guide_123',
657
- * eventType: 'step_completed',
658
- * stepId: 'step_456',
659
- * stepIndex: 2,
660
- * sessionId: 'session_789',
983
+ * const guide = await census.createGuide({
984
+ * name: 'Welcome Tour',
985
+ * slug: 'welcome-tour',
986
+ * description: 'Introduction to the app',
987
+ * triggerType: 'first_visit',
661
988
  * });
662
989
  * ```
663
990
  */
664
- trackGuideEvent(event: GuideAnalyticsEvent): Promise<void>;
991
+ createGuide(options: CreateGuideOptions): Promise<Guide>;
665
992
  /**
666
- * Mark a guide as completed for the current user.
667
- * Prevents the guide from showing again.
993
+ * Update an existing guide.
994
+ * Requires guides:create or guides:admin scope.
668
995
  *
669
- * @param guideId - ID of the guide to mark as completed
996
+ * @param guideId - Guide ID to update
997
+ * @param options - Update options
998
+ * @returns Updated guide
670
999
  *
671
1000
  * @example
672
1001
  * ```typescript
673
- * await census.markGuideCompleted('guide_123');
1002
+ * const guide = await census.updateGuide('guide_123', {
1003
+ * name: 'Updated Tour Name',
1004
+ * status: 'published',
1005
+ * });
1006
+ * ```
1007
+ */
1008
+ updateGuide(guideId: string, options: UpdateGuideOptions): Promise<Guide>;
1009
+ /**
1010
+ * Delete a guide.
1011
+ * Requires guides:admin scope.
1012
+ *
1013
+ * @param guideId - Guide ID to delete
1014
+ *
1015
+ * @example
1016
+ * ```typescript
1017
+ * await census.deleteGuide('guide_123');
1018
+ * ```
1019
+ */
1020
+ deleteGuide(guideId: string): Promise<void>;
1021
+ /**
1022
+ * Get steps for a guide.
1023
+ *
1024
+ * @param guideId - Guide ID
1025
+ * @returns Array of steps
1026
+ *
1027
+ * @example
1028
+ * ```typescript
1029
+ * const steps = await census.getGuideSteps('guide_123');
1030
+ * ```
1031
+ */
1032
+ getGuideSteps(guideId: string): Promise<GuideStep[]>;
1033
+ /**
1034
+ * Add a step to a guide.
1035
+ * Requires guides:create or guides:admin scope.
1036
+ *
1037
+ * @param guideId - Guide ID
1038
+ * @param options - Step creation options
1039
+ * @returns Created step
1040
+ *
1041
+ * @example
1042
+ * ```typescript
1043
+ * const step = await census.addGuideStep('guide_123', {
1044
+ * stepType: 'tooltip',
1045
+ * selectorStrategy: { css: '.welcome-button' },
1046
+ * richContent: {
1047
+ * title: 'Welcome!',
1048
+ * body: 'Click here to get started',
1049
+ * },
1050
+ * });
1051
+ * ```
1052
+ */
1053
+ addGuideStep(guideId: string, options: CreateGuideStepOptions): Promise<GuideStep>;
1054
+ /**
1055
+ * Update a guide step.
1056
+ * Requires guides:create or guides:admin scope.
1057
+ *
1058
+ * @param guideId - Guide ID
1059
+ * @param stepId - Step ID
1060
+ * @param options - Update options
1061
+ * @returns Updated step
1062
+ *
1063
+ * @example
1064
+ * ```typescript
1065
+ * const step = await census.updateGuideStep('guide_123', 'step_456', {
1066
+ * richContent: { title: 'Updated title' },
1067
+ * });
1068
+ * ```
1069
+ */
1070
+ updateGuideStep(guideId: string, stepId: string, options: UpdateGuideStepOptions): Promise<GuideStep>;
1071
+ /**
1072
+ * Delete a guide step.
1073
+ * Requires guides:create or guides:admin scope.
1074
+ *
1075
+ * @param guideId - Guide ID
1076
+ * @param stepId - Step ID
1077
+ *
1078
+ * @example
1079
+ * ```typescript
1080
+ * await census.deleteGuideStep('guide_123', 'step_456');
1081
+ * ```
1082
+ */
1083
+ deleteGuideStep(guideId: string, stepId: string): Promise<void>;
1084
+ /**
1085
+ * Reorder steps in a guide.
1086
+ * Requires guides:create or guides:admin scope.
1087
+ *
1088
+ * @param guideId - Guide ID
1089
+ * @param stepOrder - Array of { id, sort_order } to define new order
1090
+ * @returns Updated steps
1091
+ *
1092
+ * @example
1093
+ * ```typescript
1094
+ * const steps = await census.reorderGuideSteps('guide_123', [
1095
+ * { id: 'step_a', sort_order: 0 },
1096
+ * { id: 'step_b', sort_order: 1 },
1097
+ * { id: 'step_c', sort_order: 2 },
1098
+ * ]);
1099
+ * ```
1100
+ */
1101
+ reorderGuideSteps(guideId: string, stepOrder: Array<{
1102
+ id: string;
1103
+ sort_order: number;
1104
+ }>): Promise<GuideStep[]>;
1105
+ /**
1106
+ * Track a guide analytics event.
1107
+ * Used to track user progress through guides.
1108
+ *
1109
+ * @param event - Guide analytics event
1110
+ *
1111
+ * @example
1112
+ * ```typescript
1113
+ * await census.trackGuideEvent({
1114
+ * guideId: 'guide_123',
1115
+ * eventType: 'step_completed',
1116
+ * stepId: 'step_456',
1117
+ * stepIndex: 2,
1118
+ * sessionId: 'session_789',
1119
+ * });
1120
+ * ```
1121
+ */
1122
+ trackGuideEvent(event: GuideAnalyticsEvent): Promise<void>;
1123
+ /**
1124
+ * Mark a guide as completed for the current user.
1125
+ * Prevents the guide from showing again.
1126
+ *
1127
+ * @param guideId - ID of the guide to mark as completed
1128
+ *
1129
+ * @example
1130
+ * ```typescript
1131
+ * await census.markGuideCompleted('guide_123');
674
1132
  * ```
675
1133
  */
676
1134
  markGuideCompleted(guideId: string): Promise<void>;
@@ -880,6 +1338,42 @@ declare function useArticle(slugOrId: string): {
880
1338
  error: Error | null;
881
1339
  refetch: () => Promise<void>;
882
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
+ };
883
1377
  /**
884
1378
  * Hook for fetching the current user's submitted requests.
885
1379
  *
@@ -943,6 +1437,168 @@ declare function useTrack(): {
943
1437
  properties?: Record<string, unknown>;
944
1438
  }>) => Promise<void>;
945
1439
  };
1440
+ /**
1441
+ * Hook for fetching guides.
1442
+ *
1443
+ * @param options - Query options (optional)
1444
+ * @returns Object with guides data and loading state
1445
+ *
1446
+ * @example
1447
+ * ```tsx
1448
+ * function GuidesList() {
1449
+ * const { guides, isLoading, completedGuides } = useGuides({
1450
+ * url: window.location.href,
1451
+ * });
1452
+ *
1453
+ * if (isLoading) return <p>Loading...</p>;
1454
+ *
1455
+ * return (
1456
+ * <ul>
1457
+ * {guides.map(guide => (
1458
+ * <li key={guide.id}>
1459
+ * {guide.name}
1460
+ * {completedGuides.includes(guide.id) && ' (completed)'}
1461
+ * </li>
1462
+ * ))}
1463
+ * </ul>
1464
+ * );
1465
+ * }
1466
+ * ```
1467
+ */
1468
+ declare function useGuides(options?: GuidesOptions): {
1469
+ guides: Guide[];
1470
+ completedGuides: string[];
1471
+ isLoading: boolean;
1472
+ error: Error | null;
1473
+ refetch: () => Promise<void>;
1474
+ };
1475
+ /**
1476
+ * Hook for the Guide Builder - manages creation and editing of guides.
1477
+ *
1478
+ * @returns Object with guide builder state and actions
1479
+ *
1480
+ * @example
1481
+ * ```tsx
1482
+ * function GuideBuilderUI() {
1483
+ * const {
1484
+ * guide,
1485
+ * steps,
1486
+ * isLoading,
1487
+ * isSaving,
1488
+ * createGuide,
1489
+ * updateGuide,
1490
+ * addStep,
1491
+ * updateStep,
1492
+ * deleteStep,
1493
+ * reorderSteps,
1494
+ * publishGuide,
1495
+ * } = useGuideBuilder();
1496
+ *
1497
+ * const handleCreateGuide = async () => {
1498
+ * await createGuide({
1499
+ * name: 'My Tour',
1500
+ * slug: 'my-tour',
1501
+ * });
1502
+ * };
1503
+ *
1504
+ * return (
1505
+ * <div>
1506
+ * <button onClick={handleCreateGuide} disabled={isSaving}>
1507
+ * Create Guide
1508
+ * </button>
1509
+ * {guide && (
1510
+ * <div>
1511
+ * <h2>{guide.name}</h2>
1512
+ * <p>{steps.length} steps</p>
1513
+ * </div>
1514
+ * )}
1515
+ * </div>
1516
+ * );
1517
+ * }
1518
+ * ```
1519
+ */
1520
+ declare function useGuideBuilder(): {
1521
+ guide: Guide | null;
1522
+ steps: GuideStep[];
1523
+ selectedStep: GuideStep | null;
1524
+ selectedStepId: string | null;
1525
+ isLoading: boolean;
1526
+ isSaving: boolean;
1527
+ error: Error | null;
1528
+ isReady: boolean;
1529
+ hasUnsavedChanges: boolean;
1530
+ loadGuide: (guideId: string) => Promise<Guide | null>;
1531
+ createGuide: (options: CreateGuideOptions) => Promise<Guide>;
1532
+ updateGuide: (options: UpdateGuideOptions) => Promise<Guide>;
1533
+ publishGuide: () => Promise<Guide>;
1534
+ unpublishGuide: () => Promise<Guide>;
1535
+ deleteGuide: () => Promise<void>;
1536
+ addStep: (options: CreateGuideStepOptions) => Promise<GuideStep>;
1537
+ updateStep: (stepId: string, options: UpdateGuideStepOptions) => Promise<GuideStep>;
1538
+ deleteStep: (stepId: string) => Promise<void>;
1539
+ reorderSteps: (newOrder: Array<{
1540
+ id: string;
1541
+ sort_order: number;
1542
+ }>) => Promise<GuideStep[]>;
1543
+ moveStepUp: (stepId: string) => Promise<GuideStep[] | undefined>;
1544
+ moveStepDown: (stepId: string) => Promise<GuideStep[] | undefined>;
1545
+ setSelectedStepId: react.Dispatch<react.SetStateAction<string | null>>;
1546
+ reset: () => void;
1547
+ };
1548
+ /**
1549
+ * Hook for rendering guides - manages playback state for the GuideRenderer.
1550
+ *
1551
+ * @returns Object with guide renderer state and controls
1552
+ *
1553
+ * @example
1554
+ * ```tsx
1555
+ * function GuidePlayer() {
1556
+ * const {
1557
+ * activeGuide,
1558
+ * currentStepIndex,
1559
+ * isPlaying,
1560
+ * startGuide,
1561
+ * nextStep,
1562
+ * prevStep,
1563
+ * dismiss,
1564
+ * } = useGuideRenderer();
1565
+ *
1566
+ * if (!activeGuide || !isPlaying) return null;
1567
+ *
1568
+ * return (
1569
+ * <GuideRenderer
1570
+ * guide={activeGuide}
1571
+ * onComplete={() => dismiss()}
1572
+ * onDismiss={() => dismiss()}
1573
+ * />
1574
+ * );
1575
+ * }
1576
+ * ```
1577
+ */
1578
+ declare function useGuideRenderer(): {
1579
+ activeGuide: Guide | null;
1580
+ currentStep: GuideStep | null;
1581
+ currentStepIndex: number;
1582
+ totalSteps: number;
1583
+ isPlaying: boolean;
1584
+ isFirstStep: boolean;
1585
+ isLastStep: boolean;
1586
+ isReady: boolean;
1587
+ startGuide: (guide: Guide, startStep?: number) => void;
1588
+ nextStep: () => void;
1589
+ prevStep: () => void;
1590
+ goToStep: (stepIndex: number) => void;
1591
+ dismiss: () => void;
1592
+ pause: () => void;
1593
+ resume: () => void;
1594
+ trackStepView: (guide: Guide, stepIndex: number) => Promise<void>;
1595
+ trackGuideComplete: (guide: Guide) => Promise<void>;
1596
+ trackGuideDismiss: (guide: Guide, stepIndex: number) => Promise<void>;
1597
+ completedGuideIds: string[];
1598
+ dismissedGuideIds: string[];
1599
+ isGuideCompleted: (guideId: string) => boolean;
1600
+ isGuideDismissed: (guideId: string) => boolean;
1601
+ };
946
1602
 
947
1603
  /**
948
1604
  * Floating feedback button component.
@@ -1010,4 +1666,439 @@ declare function KnowledgeBase({ showSearch, showCategories, defaultCategory, th
1010
1666
  */
1011
1667
  declare function Requests({ status, type, limit, className, showEmptyState, onRequestClick, }: RequestsProps): react_jsx_runtime.JSX.Element | null;
1012
1668
 
1013
- export { type Article, type ArticlesOptions, CensusProvider, type CensusProviderProps, type CensusTheme, FeedbackButton, type FeedbackButtonProps, type FeedbackOptions, type FeedbackType, KnowledgeBase, type KnowledgeBaseProps, type Position, type Request, Requests, type RequestsOptions, type RequestsProps, type UserIdentity, useArticle, useArticles, useCensus, useCensusContext, useFeedback, useIdentify, useRequests, useTrack };
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
+
1689
+ /**
1690
+ * Props for the GuideBuilder component
1691
+ */
1692
+ interface GuideBuilderProps {
1693
+ /**
1694
+ * Whether the builder is open
1695
+ */
1696
+ isOpen?: boolean;
1697
+ /**
1698
+ * Callback when builder is closed
1699
+ */
1700
+ onClose?: () => void;
1701
+ /**
1702
+ * Guide ID to edit (optional - if not provided, creates new guide)
1703
+ */
1704
+ guideId?: string;
1705
+ /**
1706
+ * Callback when guide is saved
1707
+ */
1708
+ onSave?: (guide: Guide) => void;
1709
+ /**
1710
+ * Callback when guide is published
1711
+ */
1712
+ onPublish?: (guide: Guide) => void;
1713
+ /**
1714
+ * Custom trigger element
1715
+ */
1716
+ trigger?: ReactNode;
1717
+ /**
1718
+ * Custom CSS class for the modal
1719
+ */
1720
+ className?: string;
1721
+ }
1722
+ /**
1723
+ * Guide Builder Component
1724
+ *
1725
+ * A full-screen overlay for creating and editing guides.
1726
+ * This is a shell component - the full UI will be implemented in Phase 3.
1727
+ *
1728
+ * @example
1729
+ * ```tsx
1730
+ * // Controlled mode
1731
+ * <GuideBuilder
1732
+ * isOpen={showBuilder}
1733
+ * onClose={() => setShowBuilder(false)}
1734
+ * onSave={(guide) => console.log('Saved:', guide)}
1735
+ * />
1736
+ *
1737
+ * // With trigger
1738
+ * <GuideBuilder
1739
+ * trigger={<button>Create Guide</button>}
1740
+ * onSave={(guide) => console.log('Saved:', guide)}
1741
+ * />
1742
+ * ```
1743
+ */
1744
+ declare function GuideBuilder({ isOpen: controlledIsOpen, onClose, guideId, onSave, onPublish, trigger, className, }: GuideBuilderProps): react_jsx_runtime.JSX.Element | null;
1745
+
1746
+ interface TooltipStepProps {
1747
+ /**
1748
+ * The step data
1749
+ */
1750
+ step: GuideStep;
1751
+ /**
1752
+ * Current step index (0-based)
1753
+ */
1754
+ currentStep: number;
1755
+ /**
1756
+ * Total number of steps
1757
+ */
1758
+ totalSteps: number;
1759
+ /**
1760
+ * Callback when advancing to next step
1761
+ */
1762
+ onNext: () => void;
1763
+ /**
1764
+ * Callback when going to previous step
1765
+ */
1766
+ onPrev: () => void;
1767
+ /**
1768
+ * Callback when dismissing the guide
1769
+ */
1770
+ onDismiss: () => void;
1771
+ /**
1772
+ * Callback for custom button actions
1773
+ */
1774
+ onCustomAction?: (actionName: string) => void;
1775
+ /**
1776
+ * Whether to show progress indicator
1777
+ */
1778
+ showProgress?: boolean;
1779
+ /**
1780
+ * Global style overrides
1781
+ */
1782
+ globalStyle?: GuideStepStyleConfig;
1783
+ /**
1784
+ * Z-index for the tooltip
1785
+ */
1786
+ zIndex?: number;
1787
+ }
1788
+ declare function TooltipStep({ step, currentStep, totalSteps, onNext, onPrev, onDismiss, onCustomAction, showProgress, globalStyle, zIndex, }: TooltipStepProps): react_jsx_runtime.JSX.Element;
1789
+
1790
+ interface ModalStepProps {
1791
+ /**
1792
+ * The step data
1793
+ */
1794
+ step: GuideStep;
1795
+ /**
1796
+ * Current step index (0-based)
1797
+ */
1798
+ currentStep: number;
1799
+ /**
1800
+ * Total number of steps
1801
+ */
1802
+ totalSteps: number;
1803
+ /**
1804
+ * Callback when advancing to next step
1805
+ */
1806
+ onNext: () => void;
1807
+ /**
1808
+ * Callback when going to previous step
1809
+ */
1810
+ onPrev: () => void;
1811
+ /**
1812
+ * Callback when dismissing the guide
1813
+ */
1814
+ onDismiss: () => void;
1815
+ /**
1816
+ * Callback for custom button actions
1817
+ */
1818
+ onCustomAction?: (actionName: string) => void;
1819
+ /**
1820
+ * Whether to show progress indicator
1821
+ */
1822
+ showProgress?: boolean;
1823
+ /**
1824
+ * Global style overrides
1825
+ */
1826
+ globalStyle?: GuideStepStyleConfig;
1827
+ /**
1828
+ * Z-index for the modal
1829
+ */
1830
+ zIndex?: number;
1831
+ }
1832
+ declare function ModalStep({ step, currentStep, totalSteps, onNext, onPrev, onDismiss, onCustomAction, showProgress, globalStyle, zIndex, }: ModalStepProps): react_jsx_runtime.JSX.Element;
1833
+
1834
+ interface SlideoutStepProps {
1835
+ /**
1836
+ * The step data
1837
+ */
1838
+ step: GuideStep;
1839
+ /**
1840
+ * Current step index (0-based)
1841
+ */
1842
+ currentStep: number;
1843
+ /**
1844
+ * Total number of steps
1845
+ */
1846
+ totalSteps: number;
1847
+ /**
1848
+ * Callback when advancing to next step
1849
+ */
1850
+ onNext: () => void;
1851
+ /**
1852
+ * Callback when going to previous step
1853
+ */
1854
+ onPrev: () => void;
1855
+ /**
1856
+ * Callback when dismissing the guide
1857
+ */
1858
+ onDismiss: () => void;
1859
+ /**
1860
+ * Callback for custom button actions
1861
+ */
1862
+ onCustomAction?: (actionName: string) => void;
1863
+ /**
1864
+ * Whether to show progress indicator
1865
+ */
1866
+ showProgress?: boolean;
1867
+ /**
1868
+ * Global style overrides
1869
+ */
1870
+ globalStyle?: GuideStepStyleConfig;
1871
+ /**
1872
+ * Z-index for the slideout
1873
+ */
1874
+ zIndex?: number;
1875
+ }
1876
+ declare function SlideoutStep({ step, currentStep, totalSteps, onNext, onPrev, onDismiss, onCustomAction, showProgress, globalStyle, zIndex, }: SlideoutStepProps): react_jsx_runtime.JSX.Element;
1877
+
1878
+ interface HotspotStepProps {
1879
+ /**
1880
+ * The step data
1881
+ */
1882
+ step: GuideStep;
1883
+ /**
1884
+ * Current step index (0-based)
1885
+ */
1886
+ currentStep: number;
1887
+ /**
1888
+ * Total number of steps
1889
+ */
1890
+ totalSteps: number;
1891
+ /**
1892
+ * Callback when advancing to next step
1893
+ */
1894
+ onNext: () => void;
1895
+ /**
1896
+ * Callback when going to previous step
1897
+ */
1898
+ onPrev: () => void;
1899
+ /**
1900
+ * Callback when dismissing the guide
1901
+ */
1902
+ onDismiss: () => void;
1903
+ /**
1904
+ * Callback for custom button actions
1905
+ */
1906
+ onCustomAction?: (actionName: string) => void;
1907
+ /**
1908
+ * Whether to show progress indicator
1909
+ */
1910
+ showProgress?: boolean;
1911
+ /**
1912
+ * Global style overrides
1913
+ */
1914
+ globalStyle?: GuideStepStyleConfig;
1915
+ /**
1916
+ * Z-index for the hotspot
1917
+ */
1918
+ zIndex?: number;
1919
+ }
1920
+ declare function HotspotStep({ step, currentStep, totalSteps, onNext, onPrev, onDismiss, onCustomAction, showProgress, globalStyle, zIndex, }: HotspotStepProps): react_jsx_runtime.JSX.Element | null;
1921
+
1922
+ interface BannerStepProps {
1923
+ /**
1924
+ * The step data
1925
+ */
1926
+ step: GuideStep;
1927
+ /**
1928
+ * Current step index (0-based)
1929
+ */
1930
+ currentStep: number;
1931
+ /**
1932
+ * Total number of steps
1933
+ */
1934
+ totalSteps: number;
1935
+ /**
1936
+ * Callback when advancing to next step
1937
+ */
1938
+ onNext: () => void;
1939
+ /**
1940
+ * Callback when going to previous step
1941
+ */
1942
+ onPrev: () => void;
1943
+ /**
1944
+ * Callback when dismissing the guide
1945
+ */
1946
+ onDismiss: () => void;
1947
+ /**
1948
+ * Callback for custom button actions
1949
+ */
1950
+ onCustomAction?: (actionName: string) => void;
1951
+ /**
1952
+ * Whether to show progress indicator
1953
+ */
1954
+ showProgress?: boolean;
1955
+ /**
1956
+ * Global style overrides
1957
+ */
1958
+ globalStyle?: GuideStepStyleConfig;
1959
+ /**
1960
+ * Z-index for the banner
1961
+ */
1962
+ zIndex?: number;
1963
+ }
1964
+ declare function BannerStep({ step, currentStep, totalSteps, onNext, onPrev, onDismiss, onCustomAction, showProgress, globalStyle, zIndex, }: BannerStepProps): react_jsx_runtime.JSX.Element | null;
1965
+
1966
+ interface BackdropProps {
1967
+ /**
1968
+ * Whether the backdrop is visible
1969
+ */
1970
+ visible: boolean;
1971
+ /**
1972
+ * Element to spotlight (cut out of backdrop)
1973
+ */
1974
+ spotlightElement?: Element | null;
1975
+ /**
1976
+ * Padding around the spotlighted element
1977
+ */
1978
+ spotlightPadding?: number;
1979
+ /**
1980
+ * Callback when clicking the backdrop (outside spotlight)
1981
+ */
1982
+ onClick?: () => void;
1983
+ /**
1984
+ * Whether clicking backdrop dismisses the guide
1985
+ */
1986
+ dismissOnClick?: boolean;
1987
+ /**
1988
+ * Custom z-index
1989
+ */
1990
+ zIndex?: number;
1991
+ /**
1992
+ * Backdrop opacity (0-1)
1993
+ */
1994
+ opacity?: number;
1995
+ }
1996
+ declare function Backdrop({ visible, spotlightElement, spotlightPadding, onClick, dismissOnClick, zIndex, opacity, }: BackdropProps): react_jsx_runtime.JSX.Element | null;
1997
+
1998
+ interface StepButtonsProps {
1999
+ /**
2000
+ * Button configuration from step
2001
+ */
2002
+ buttons?: GuideStepRichContent['buttons'];
2003
+ /**
2004
+ * Current step index
2005
+ */
2006
+ currentStep: number;
2007
+ /**
2008
+ * Total number of steps
2009
+ */
2010
+ totalSteps: number;
2011
+ /**
2012
+ * Whether this is the last step
2013
+ */
2014
+ isLastStep: boolean;
2015
+ /**
2016
+ * Callback for next action
2017
+ */
2018
+ onNext: () => void;
2019
+ /**
2020
+ * Callback for previous action
2021
+ */
2022
+ onPrev: () => void;
2023
+ /**
2024
+ * Callback for dismiss action
2025
+ */
2026
+ onDismiss: () => void;
2027
+ /**
2028
+ * Callback for custom actions
2029
+ */
2030
+ onCustomAction?: (actionName: string) => void;
2031
+ /**
2032
+ * Accent color for primary buttons
2033
+ */
2034
+ accentColor?: string;
2035
+ }
2036
+ declare function StepButtons({ buttons, currentStep, isLastStep, onNext, onPrev, onDismiss, onCustomAction, accentColor, }: StepButtonsProps): react_jsx_runtime.JSX.Element;
2037
+
2038
+ interface StepContentProps {
2039
+ /**
2040
+ * The step data
2041
+ */
2042
+ step: GuideStep;
2043
+ /**
2044
+ * Text color for content
2045
+ */
2046
+ textColor?: string;
2047
+ /**
2048
+ * Whether to show the title
2049
+ */
2050
+ showTitle?: boolean;
2051
+ }
2052
+ declare function StepContent({ step, textColor, showTitle, }: StepContentProps): react_jsx_runtime.JSX.Element;
2053
+
2054
+ interface GuideRendererProps {
2055
+ /**
2056
+ * The guide to render
2057
+ */
2058
+ guide: Guide;
2059
+ /**
2060
+ * Callback when guide is completed
2061
+ */
2062
+ onComplete?: (guide: Guide) => void;
2063
+ /**
2064
+ * Callback when guide is dismissed (skipped)
2065
+ */
2066
+ onDismiss?: (guide: Guide, step: number) => void;
2067
+ /**
2068
+ * Callback when a step changes
2069
+ */
2070
+ onStepChange?: (step: number, totalSteps: number) => void;
2071
+ /**
2072
+ * Callback for custom button actions
2073
+ */
2074
+ onCustomAction?: (actionName: string, step: GuideStep) => void;
2075
+ /**
2076
+ * Global style overrides
2077
+ */
2078
+ globalStyle?: GuideStepStyleConfig;
2079
+ /**
2080
+ * Starting step index
2081
+ */
2082
+ startStep?: number;
2083
+ /**
2084
+ * Z-index base for guide elements
2085
+ */
2086
+ zIndex?: number;
2087
+ }
2088
+ /**
2089
+ * GuideRenderer - Displays a guide step by step
2090
+ *
2091
+ * Renders the appropriate step type component based on the step's step_type field.
2092
+ *
2093
+ * @example
2094
+ * ```tsx
2095
+ * <GuideRenderer
2096
+ * guide={myGuide}
2097
+ * onComplete={(guide) => console.log('Completed:', guide.name)}
2098
+ * onDismiss={(guide, step) => console.log('Dismissed at step:', step)}
2099
+ * />
2100
+ * ```
2101
+ */
2102
+ declare function GuideRenderer({ guide, onComplete, onDismiss, onStepChange, onCustomAction, globalStyle, startStep, zIndex, }: GuideRendererProps): react_jsx_runtime.JSX.Element | null;
2103
+
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 };