@confidencesystemsinc/sdk 1.0.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.
- package/README.md +54 -0
- package/dist/components/badge.d.ts +54 -0
- package/dist/components/initiate-playbook-modal/InitiatePlaybookModal.d.ts +6 -0
- package/dist/components/playbook/confidence-playbook.d.ts +26 -0
- package/dist/components/playbook/playbook-header.d.ts +3 -0
- package/dist/components/playbook-button/ConfidencePlaybookButton.d.ts +8 -0
- package/dist/components/task/confidence-task.d.ts +17 -0
- package/dist/components/task/task-buttons.d.ts +5 -0
- package/dist/components/task/task-dropdown-badge.d.ts +18 -0
- package/dist/components/task/task-left-panel.d.ts +10 -0
- package/dist/components/task/task-status-badge.d.ts +9 -0
- package/dist/components/ui/button.d.ts +38 -0
- package/dist/components/ui/header.d.ts +1 -0
- package/dist/components/ui/input.d.ts +9 -0
- package/dist/components/ui/modal.d.ts +16 -0
- package/dist/constants/settings.constants.d.ts +2 -0
- package/dist/hooks/task-events/useCompleteTask.d.ts +99 -0
- package/dist/hooks/task-events/useStartTask.d.ts +99 -0
- package/dist/hooks/usePlaybook.d.ts +10 -0
- package/dist/hooks/usePlaybookActions.d.ts +6 -0
- package/dist/hooks/useTaskButtons.d.ts +17 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/sdk.cjs +604 -0
- package/dist/sdk.js +12079 -0
- package/dist/services/complete-task.service.d.ts +4 -0
- package/dist/services/initiate-playbook.service.d.ts +11 -0
- package/dist/services/start-task.services.d.ts +4 -0
- package/dist/stories/initiate-playbook-modal.stories.d.ts +19 -0
- package/dist/stories/modal.stories.d.ts +28 -0
- package/dist/stories/playbook-container.stories.d.ts +55 -0
- package/dist/types/playbook.types.d.ts +20 -0
- package/dist/types/task.types.d.ts +18 -0
- package/dist/utils/cn.d.ts +2 -0
- package/dist/vite.svg +1 -0
- package/package.json +66 -0
- package/src/App.css +2 -0
- package/src/components/badge.tsx +116 -0
- package/src/components/initiate-playbook-modal/InitiatePlaybookModal.tsx +53 -0
- package/src/components/playbook/confidence-playbook.tsx +193 -0
- package/src/components/playbook/playbook-header.tsx +13 -0
- package/src/components/playbook-button/ConfidencePlaybookButton.tsx +73 -0
- package/src/components/task/confidence-task.tsx +198 -0
- package/src/components/task/task-buttons.tsx +32 -0
- package/src/components/task/task-dropdown-badge.tsx +121 -0
- package/src/components/task/task-left-panel.tsx +60 -0
- package/src/components/task/task-status-badge.tsx +23 -0
- package/src/components/ui/button.tsx +269 -0
- package/src/components/ui/header.tsx +12 -0
- package/src/components/ui/input.tsx +39 -0
- package/src/components/ui/modal.tsx +88 -0
- package/src/constants/settings.constants.ts +2 -0
- package/src/hooks/task-events/useCompleteTask.ts +26 -0
- package/src/hooks/task-events/useStartTask.ts +29 -0
- package/src/hooks/usePlaybook.ts +48 -0
- package/src/hooks/usePlaybookActions.ts +69 -0
- package/src/hooks/useTaskButtons.ts +46 -0
- package/src/index.ts +6 -0
- package/src/services/complete-task.service.ts +21 -0
- package/src/services/initiate-playbook.service.ts +24 -0
- package/src/services/start-task.services.ts +23 -0
- package/src/stories/initiate-playbook-modal.stories.tsx +31 -0
- package/src/stories/modal.stories.tsx +50 -0
- package/src/stories/playbook-container.stories.tsx +79 -0
- package/src/types/playbook.types.ts +22 -0
- package/src/types/task.types.ts +20 -0
- package/src/utils/cn.ts +6 -0
- package/src/vite-env.d.ts +1 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { TaskStatus } from "../types/task.types";
|
|
2
|
+
|
|
3
|
+
export const startTask = async (
|
|
4
|
+
taskInstanceId: string,
|
|
5
|
+
): Promise<{
|
|
6
|
+
status: TaskStatus;
|
|
7
|
+
}> => {
|
|
8
|
+
const body = {
|
|
9
|
+
taskInstanceId,
|
|
10
|
+
};
|
|
11
|
+
const headers = new Headers();
|
|
12
|
+
headers.append("Content-Type", "application/json");
|
|
13
|
+
const response = await fetch(`/public-api/playbook-task-start`, {
|
|
14
|
+
method: "POST",
|
|
15
|
+
headers,
|
|
16
|
+
body: JSON.stringify(body),
|
|
17
|
+
});
|
|
18
|
+
const data = await response.json();
|
|
19
|
+
|
|
20
|
+
console.log({ data });
|
|
21
|
+
|
|
22
|
+
return data;
|
|
23
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { InitiatePlaybookModal } from "../components/initiate-playbook-modal/InitiatePlaybookModal";
|
|
3
|
+
|
|
4
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
|
5
|
+
const meta = {
|
|
6
|
+
title: "InitiatePlaybookModal",
|
|
7
|
+
component: InitiatePlaybookModal,
|
|
8
|
+
parameters: {
|
|
9
|
+
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
|
10
|
+
layout: "fullscreen",
|
|
11
|
+
},
|
|
12
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
13
|
+
tags: ["autodocs"],
|
|
14
|
+
// More on argTypes: https://storybook.js.org/docs/api/argtypes
|
|
15
|
+
argTypes: {},
|
|
16
|
+
// Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args
|
|
17
|
+
args: {},
|
|
18
|
+
} satisfies Meta<typeof InitiatePlaybookModal>;
|
|
19
|
+
|
|
20
|
+
export default meta;
|
|
21
|
+
type Story = StoryObj<typeof meta>;
|
|
22
|
+
|
|
23
|
+
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
|
24
|
+
export const Default: Story = {
|
|
25
|
+
args: {
|
|
26
|
+
isOpen: true,
|
|
27
|
+
onClose: () => console.log("Modal closed"),
|
|
28
|
+
onConfirm: (email: string) =>
|
|
29
|
+
console.log(`Playbook initiated with email: ${email}`),
|
|
30
|
+
},
|
|
31
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Modal } from "../components/ui/modal";
|
|
3
|
+
|
|
4
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
|
5
|
+
const meta = {
|
|
6
|
+
title: "Modal",
|
|
7
|
+
component: Modal,
|
|
8
|
+
parameters: {
|
|
9
|
+
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
|
10
|
+
layout: "fullscreen",
|
|
11
|
+
},
|
|
12
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
13
|
+
tags: ["autodocs"],
|
|
14
|
+
// More on argTypes: https://storybook.js.org/docs/api/argtypes
|
|
15
|
+
argTypes: {},
|
|
16
|
+
// Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args
|
|
17
|
+
args: {},
|
|
18
|
+
} satisfies Meta<typeof Modal>;
|
|
19
|
+
|
|
20
|
+
export default meta;
|
|
21
|
+
type Story = StoryObj<typeof meta>;
|
|
22
|
+
|
|
23
|
+
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
|
24
|
+
export const Default: Story = {
|
|
25
|
+
args: {
|
|
26
|
+
isOpen: true,
|
|
27
|
+
children: (
|
|
28
|
+
<>
|
|
29
|
+
<p className="text-gray-500">
|
|
30
|
+
Are you sure you want to deactivate this playbook? This action cannot
|
|
31
|
+
be undone.
|
|
32
|
+
</p>
|
|
33
|
+
<p className="text-gray-500">
|
|
34
|
+
Deactivating a playbook will stop all associated tasks and prevent any
|
|
35
|
+
further actions.
|
|
36
|
+
</p>
|
|
37
|
+
</>
|
|
38
|
+
),
|
|
39
|
+
dismissOptions: {
|
|
40
|
+
label: "Cancel",
|
|
41
|
+
onClick: () => console.log("Modal dismissed"),
|
|
42
|
+
},
|
|
43
|
+
confirmOptions: {
|
|
44
|
+
label: "Deactivate",
|
|
45
|
+
onClick: () => console.log("Playbook deactivated"),
|
|
46
|
+
},
|
|
47
|
+
title: "Deactivate Playbook",
|
|
48
|
+
close() {},
|
|
49
|
+
},
|
|
50
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { ConfidencePlaybook } from "../components/playbook/confidence-playbook";
|
|
3
|
+
import { TaskButton } from "../hooks/useTaskButtons";
|
|
4
|
+
|
|
5
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
|
6
|
+
const meta = {
|
|
7
|
+
title: "PlaybookContainer",
|
|
8
|
+
component: ConfidencePlaybook.View,
|
|
9
|
+
parameters: {
|
|
10
|
+
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
|
11
|
+
layout: "fullscreen",
|
|
12
|
+
},
|
|
13
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
14
|
+
tags: ["autodocs"],
|
|
15
|
+
// More on argTypes: https://storybook.js.org/docs/api/argtypes
|
|
16
|
+
argTypes: {},
|
|
17
|
+
// Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args
|
|
18
|
+
args: {
|
|
19
|
+
viewMode: "list",
|
|
20
|
+
playbook: {
|
|
21
|
+
playbookInstanceId: 4771,
|
|
22
|
+
playbookInstanceName: "ACH - Returns - [HORIZON]",
|
|
23
|
+
playbookId: 227718,
|
|
24
|
+
type: "Sequential",
|
|
25
|
+
quickComplete: true,
|
|
26
|
+
autoExpandTask: true,
|
|
27
|
+
autoStart: false,
|
|
28
|
+
leadEmail: "confidence@user.it",
|
|
29
|
+
workflowStatus: "In progress",
|
|
30
|
+
numberofTasks: 3,
|
|
31
|
+
tasks: [
|
|
32
|
+
{
|
|
33
|
+
taskInstanceId: 10949,
|
|
34
|
+
taskId: 1676864,
|
|
35
|
+
sequenceOrder: 0,
|
|
36
|
+
workflowStatus: "Completed",
|
|
37
|
+
taskInstanceName:
|
|
38
|
+
"Identify Return Items [Deposit Operations Specialist]",
|
|
39
|
+
taskStartTime: "2025-05-20 09:06:13",
|
|
40
|
+
taskCompletedTime: "2025-05-20 09:06:20",
|
|
41
|
+
imageRequired: 1,
|
|
42
|
+
hasDescription: true,
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
taskInstanceId: 10951,
|
|
46
|
+
taskId: 1676866,
|
|
47
|
+
sequenceOrder: 1,
|
|
48
|
+
workflowStatus: "Completed",
|
|
49
|
+
taskInstanceName:
|
|
50
|
+
"Review Return Items [Deposit Operations Specialist]",
|
|
51
|
+
taskStartTime: "2025-05-20 09:06:20",
|
|
52
|
+
taskCompletedTime: "2025-05-20 09:06:25",
|
|
53
|
+
imageRequired: 2,
|
|
54
|
+
hasDescription: true,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
taskInstanceId: 10950,
|
|
58
|
+
taskId: 1676865,
|
|
59
|
+
sequenceOrder: 2,
|
|
60
|
+
workflowStatus: "In progress",
|
|
61
|
+
taskInstanceName: "Return Items [Deposit Operations Specialist]",
|
|
62
|
+
imageRequired: 2,
|
|
63
|
+
hasDescription: true,
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
onTaskButtonClick: (btn: TaskButton, taskId: number) => {
|
|
68
|
+
console.log("Button clicked:", btn, "for task ID:", taskId);
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
} satisfies Meta<typeof ConfidencePlaybook.View>;
|
|
72
|
+
|
|
73
|
+
export default meta;
|
|
74
|
+
type Story = StoryObj<typeof meta>;
|
|
75
|
+
|
|
76
|
+
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
|
77
|
+
export const Default: Story = {
|
|
78
|
+
args: {},
|
|
79
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Task } from "./task.types";
|
|
2
|
+
export interface Playbook {
|
|
3
|
+
playbookInstanceId: number;
|
|
4
|
+
playbookInstanceName: string;
|
|
5
|
+
playbookId: number;
|
|
6
|
+
type: string;
|
|
7
|
+
quickComplete: boolean;
|
|
8
|
+
autoExpandTask: boolean;
|
|
9
|
+
autoStart: boolean;
|
|
10
|
+
leadEmail: string;
|
|
11
|
+
workflowStatus: string;
|
|
12
|
+
numberofTasks: number;
|
|
13
|
+
nextTaskId?: number;
|
|
14
|
+
tasks: Task[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const PLAYBOOK_TYPES = {
|
|
18
|
+
NON_SEQUENTIAL: "Non-Sequential",
|
|
19
|
+
SEQUENTIAL: "Sequential",
|
|
20
|
+
} as const;
|
|
21
|
+
|
|
22
|
+
export type PlaybookType = (typeof PLAYBOOK_TYPES)[keyof typeof PLAYBOOK_TYPES];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const TASK_STATUS = {
|
|
2
|
+
OPEN: "Open",
|
|
3
|
+
IN_PROGRESS: "In progress",
|
|
4
|
+
IN_REVIEW: "In review",
|
|
5
|
+
COMPLETED: "Completed",
|
|
6
|
+
} as const;
|
|
7
|
+
|
|
8
|
+
export type TaskStatus = (typeof TASK_STATUS)[keyof typeof TASK_STATUS];
|
|
9
|
+
|
|
10
|
+
export interface Task {
|
|
11
|
+
taskInstanceId: number;
|
|
12
|
+
taskId: number;
|
|
13
|
+
sequenceOrder: number;
|
|
14
|
+
workflowStatus: TaskStatus;
|
|
15
|
+
taskInstanceName: string;
|
|
16
|
+
imageRequired: number;
|
|
17
|
+
hasDescription: boolean;
|
|
18
|
+
taskStartTime?: string;
|
|
19
|
+
taskCompletedTime?: string;
|
|
20
|
+
}
|
package/src/utils/cn.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|