@confidencesystemsinc/sdk 1.2.3 → 1.2.5

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.
Files changed (46) hide show
  1. package/README.md +100 -51
  2. package/dist/components/playbook/confidence-playbook.d.ts +11 -9
  3. package/dist/components/playbook/playbook-header.d.ts +2 -2
  4. package/dist/hooks/usePlaybookExpandedTasks.d.ts +3 -1
  5. package/dist/index.cjs +15 -15
  6. package/dist/index.js +1542 -1508
  7. package/package.json +2 -3
  8. package/src/components/badge.tsx +0 -116
  9. package/src/components/initiate-playbook-modal/InitiatePlaybookModal.tsx +0 -53
  10. package/src/components/playbook/confidence-playbook.tsx +0 -351
  11. package/src/components/playbook/playbook-header.tsx +0 -32
  12. package/src/components/playbook-button/ConfidencePlaybookButton.tsx +0 -79
  13. package/src/components/task/confidence-task.tsx +0 -297
  14. package/src/components/task/task-buttons.tsx +0 -35
  15. package/src/components/task/task-dropdown-badge.tsx +0 -118
  16. package/src/components/task/task-expanded-content.tsx +0 -46
  17. package/src/components/task/task-left-panel.tsx +0 -60
  18. package/src/components/task/task-status-badge.tsx +0 -23
  19. package/src/components/ui/button.tsx +0 -272
  20. package/src/components/ui/input.tsx +0 -39
  21. package/src/components/ui/modal.tsx +0 -88
  22. package/src/components/ui/ui-wrapper.tsx +0 -7
  23. package/src/constants/settings.constants.ts +0 -4
  24. package/src/context/confidence-context.tsx +0 -25
  25. package/src/hooks/task/useCompleteTask.ts +0 -32
  26. package/src/hooks/task/useStartTask.ts +0 -35
  27. package/src/hooks/task/useTaskDetails.ts +0 -42
  28. package/src/hooks/usePlaybook.ts +0 -54
  29. package/src/hooks/usePlaybookActions.ts +0 -69
  30. package/src/hooks/usePlaybookExpandedTasks.ts +0 -35
  31. package/src/hooks/useTaskButtons.ts +0 -47
  32. package/src/index.ts +0 -7
  33. package/src/services/complete-task.service.ts +0 -25
  34. package/src/services/initiate-playbook.service.ts +0 -26
  35. package/src/services/start-task.services.ts +0 -27
  36. package/src/services/task-details.service.ts +0 -17
  37. package/src/stories/confidence-playbook.stories.tsx +0 -125
  38. package/src/stories/confidence-task.stories.tsx +0 -63
  39. package/src/stories/initiate-playbook-modal.stories.tsx +0 -31
  40. package/src/stories/modal.stories.tsx +0 -50
  41. package/src/task-description.css +0 -629
  42. package/src/theme.css +0 -11
  43. package/src/types/playbook.types.ts +0 -22
  44. package/src/types/task.types.ts +0 -20
  45. package/src/utils/cn.ts +0 -6
  46. package/src/vite-env.d.ts +0 -1
package/README.md CHANGED
@@ -1,54 +1,103 @@
1
- # React + TypeScript + Vite
2
-
3
- This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4
-
5
- Currently, two official plugins are available:
6
-
7
- - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) for Fast Refresh
8
- - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9
-
10
- ## Expanding the ESLint configuration
11
-
12
- If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
13
-
14
- ```js
15
- export default tseslint.config({
16
- extends: [
17
- // Remove ...tseslint.configs.recommended and replace with this
18
- ...tseslint.configs.recommendedTypeChecked,
19
- // Alternatively, use this for stricter rules
20
- ...tseslint.configs.strictTypeChecked,
21
- // Optionally, add this for stylistic rules
22
- ...tseslint.configs.stylisticTypeChecked,
23
- ],
24
- languageOptions: {
25
- // other options...
26
- parserOptions: {
27
- project: ['./tsconfig.node.json', './tsconfig.app.json'],
28
- tsconfigRootDir: import.meta.dirname,
29
- },
30
- },
31
- })
1
+ # Confidence Playbook Component Library
2
+
3
+ This package provides a set of React components and utilities for embedding and managing Confidence Playbooks in your application. All exports are available from the `ConfidencePlaybook` module, with several specialized subcomponents for different integration scenarios.
4
+
5
+ ---
6
+
7
+ ## Exports
8
+
9
+ ### 1. `ConfidencePlaybook`
10
+
11
+ The main component for rendering a playbook instance by its ID.
12
+
13
+ **Props:**
14
+ - `playbookInstanceId` (string \| number): The unique instance ID of the playbook to display.
15
+ - `playbookMode` ("list" \| "card"): Display mode for tasks.
16
+ - `playbookStyle` (object, optional): White-label and overlay style configuration.
17
+
18
+ **Example:**
19
+ ```tsx
20
+ <ConfidencePlaybook
21
+ playbookInstanceId={12345}
22
+ playbookMode="list"
23
+ playbookStyle={{
24
+ overlay: { position: "right", size: { width: 500 } },
25
+ whiteLabel: { primaryColor: "#007BFF" },
26
+ }}
27
+ />
32
28
  ```
33
29
 
34
- You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
35
-
36
- ```js
37
- // eslint.config.js
38
- import reactX from 'eslint-plugin-react-x'
39
- import reactDom from 'eslint-plugin-react-dom'
40
-
41
- export default tseslint.config({
42
- plugins: {
43
- // Add the react-x and react-dom plugins
44
- 'react-x': reactX,
45
- 'react-dom': reactDom,
46
- },
47
- rules: {
48
- // other rules...
49
- // Enable its recommended typescript rules
50
- ...reactX.configs['recommended-typescript'].rules,
51
- ...reactDom.configs.recommended.rules,
52
- },
53
- })
30
+ ---
31
+
32
+ ### 2. `ConfidencePlaybook.AutoInstantiated`
33
+
34
+ Automatically initiates a playbook for a given user/email and playbook template, then renders the playbook UI once ready.
35
+
36
+ **Props:**
37
+ - `email` (string): The user's email to initiate the playbook for.
38
+ - `playbookId` (string): The playbook template ID.
39
+ - `playbookMode` ("list" \| "card"): Display mode for tasks.
40
+
41
+ **Example:**
42
+ ```tsx
43
+ <ConfidencePlaybook.AutoInstantiated
44
+ email="user@example.com"
45
+ playbookId="YOUR_PLAYBOOK_ID"
46
+ playbookMode="list"
47
+ />
54
48
  ```
49
+
50
+ ---
51
+
52
+ ### 3. `ConfidencePlaybook.WithInstantiateButton`
53
+
54
+ Renders a button that, when clicked, prompts the user for their email and then instantiates and displays the playbook.
55
+
56
+ **Props:**
57
+ - `playbookId` (string): The playbook template ID.
58
+ - `playbookMode` ("list" \| "card", optional): Display mode for tasks (default: "list").
59
+ - `playbookStyle` (object, optional): White-label and overlay style configuration.
60
+ - `btnLabel` (string, optional): Button label (default: "Start Playbook").
61
+
62
+ **Example:**
63
+ ```tsx
64
+ <ConfidencePlaybook.WithInstantiateButton
65
+ playbookId="YOUR_PLAYBOOK_ID"
66
+ btnLabel="Start Playbook"
67
+ playbookMode="card"
68
+ playbookStyle={{
69
+ overlay: { position: "right", size: { width: 500 } },
70
+ whiteLabel: { primaryColor: "#007BFF" },
71
+ }}
72
+ />
73
+ ```
74
+
75
+ ---
76
+
77
+ ### 4. `ConfidencePlaybook.View`
78
+
79
+ A lower-level component for rendering a playbook UI given a playbook object. Useful for advanced scenarios or custom data sources.
80
+
81
+ **Props:**
82
+ - `playbook` (Playbook): The playbook data object.
83
+ - `playbookMode` ("list" \| "card"): Display mode for tasks.
84
+ - `onTaskButtonClick` (function): Handler for task button actions.
85
+ - `playbookStyle` (object, optional): White-label and overlay style configuration.
86
+
87
+ **Example:**
88
+ ```tsx
89
+ <ConfidencePlaybook.View
90
+ playbook={playbookData}
91
+ playbookMode="list"
92
+ onTaskButtonClick={async (btn, taskId) => {
93
+ // handle action
94
+ }}
95
+ />
96
+ ```
97
+
98
+ ---
99
+
100
+ ## Notes
101
+ - All components are styled with TailwindCSS and scoped under `.confidence-ui`.
102
+ - For more details on the `playbookStyle` prop and available options, see the source code or type definitions.
103
+ - These exports are designed for flexibility: use the high-level components for quick integration, or the lower-level `View` for custom scenarios.
@@ -1,22 +1,23 @@
1
+ import { CSSProperties } from 'react';
1
2
  import { TaskButton } from '../../hooks/useTaskButtons';
2
3
  import { Playbook } from '../../types/playbook.types';
3
4
  export interface ConfidencePlaybookStyleConfiguration {
4
5
  overlay?: {
5
6
  position?: "left" | "right";
6
7
  size?: {
7
- width?: number | string;
8
- height?: number | string;
8
+ width?: CSSProperties["width"];
9
+ height?: CSSProperties["height"];
9
10
  };
10
11
  offset?: {
11
- top?: number | string;
12
- right?: number | string;
13
- left?: number | string;
12
+ top?: CSSProperties["top"];
13
+ right?: CSSProperties["right"];
14
+ left?: CSSProperties["left"];
14
15
  };
15
16
  };
16
17
  whiteLabel?: {
17
- titleBackgroundColor?: string;
18
- titleTextColor?: string;
19
- primaryColor?: string;
18
+ titleBackgroundColor?: CSSProperties["backgroundColor"];
19
+ titleTextColor?: CSSProperties["color"];
20
+ primaryColor?: CSSProperties["color"];
20
21
  };
21
22
  }
22
23
  export declare const ConfidencePlaybook: {
@@ -34,10 +35,11 @@ export declare const ConfidencePlaybook: {
34
35
  onTaskButtonClick: (btn: TaskButton, taskId: number) => Promise<void>;
35
36
  playbookStyle?: ConfidencePlaybookStyleConfiguration;
36
37
  }) => import("react/jsx-runtime").JSX.Element;
37
- AutoInstantiated: ({ email, playbookId, playbookMode, }: {
38
+ AutoInstantiated: ({ email, playbookId, playbookMode, playbookStyle, }: {
38
39
  email: string;
39
40
  playbookId: string;
40
41
  playbookMode: "list" | "card";
42
+ playbookStyle?: ConfidencePlaybookStyleConfiguration;
41
43
  }) => import("react/jsx-runtime").JSX.Element;
42
44
  WithInstantiateButton: ({ playbookId, playbookMode, playbookStyle, btnLabel, }: {
43
45
  playbookId: string;
@@ -1,5 +1,5 @@
1
1
  import { ConfidencePlaybookStyleConfiguration } from './confidence-playbook';
2
- export declare const PlaybookHeader: ({ title, className, playbookStyle, ...props }: React.ComponentProps<"div"> & {
2
+ export declare const PlaybookHeader: import('react').ForwardRefExoticComponent<Omit<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & {
3
3
  title: string;
4
4
  playbookStyle?: ConfidencePlaybookStyleConfiguration;
5
- }) => import("react/jsx-runtime").JSX.Element;
5
+ }, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
@@ -1,4 +1,6 @@
1
- export declare const usePlaybookExpandedTasks: (playbookInstanceId: number | string) => {
1
+ export declare const usePlaybookExpandedTasks: (playbookInstanceId: number | string, triggers?: {
2
+ onTaskExpanded?: (taskId: number | string, expanded: boolean) => void;
3
+ }) => {
2
4
  isTaskExpanded: (taskId: number | string) => boolean;
3
5
  toggleTaskExpanded: (taskId: number | string, expand?: boolean) => void;
4
6
  };