@titus-system/syncdesk 0.5.1 → 0.5.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/api/client.d.ts +7 -0
- package/dist/api/client.d.ts.map +1 -0
- package/dist/api/client.js +105 -0
- package/{src/api/index.ts → dist/api/index.d.ts} +1 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/typings.d.ts +4 -0
- package/dist/api/typings.d.ts.map +1 -0
- package/dist/api/typings.js +1 -0
- package/dist/auth/hooks/useAuth.d.ts +51 -0
- package/dist/auth/hooks/useAuth.d.ts.map +1 -0
- package/dist/auth/hooks/useAuth.js +127 -0
- package/dist/auth/index.d.ts +4 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +1 -0
- package/dist/auth/types/auth.d.ts +51 -0
- package/dist/auth/types/auth.d.ts.map +1 -0
- package/dist/auth/types/auth.js +1 -0
- package/dist/auth/types/session.d.ts +12 -0
- package/dist/auth/types/session.d.ts.map +1 -0
- package/dist/auth/types/session.js +1 -0
- package/dist/config.d.ts +14 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +10 -0
- package/dist/health/hooks/useHealth.d.ts +17 -0
- package/dist/health/hooks/useHealth.d.ts.map +1 -0
- package/dist/health/hooks/useHealth.js +42 -0
- package/dist/health/index.d.ts +3 -0
- package/dist/health/index.d.ts.map +1 -0
- package/dist/health/types/health.d.ts +10 -0
- package/dist/health/types/health.d.ts.map +1 -0
- package/dist/health/types/health.js +1 -0
- package/{src/index.ts → dist/index.d.ts} +1 -1
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/live_chat/hooks/useLiveChat.d.ts +37 -0
- package/dist/live_chat/hooks/useLiveChat.d.ts.map +1 -0
- package/dist/live_chat/hooks/useLiveChat.js +91 -0
- package/dist/live_chat/hooks/useLiveChatWebSocket.d.ts +11 -0
- package/dist/live_chat/hooks/useLiveChatWebSocket.d.ts.map +1 -0
- package/dist/live_chat/hooks/useLiveChatWebSocket.js +68 -0
- package/dist/live_chat/index.d.ts +4 -0
- package/dist/live_chat/index.d.ts.map +1 -0
- package/dist/live_chat/index.js +2 -0
- package/dist/live_chat/types/live_chat.d.ts +45 -0
- package/dist/live_chat/types/live_chat.d.ts.map +1 -0
- package/dist/live_chat/types/live_chat.js +1 -0
- package/dist/permissions/hooks/usePermissions.d.ts +71 -0
- package/dist/permissions/hooks/usePermissions.d.ts.map +1 -0
- package/dist/permissions/hooks/usePermissions.js +147 -0
- package/dist/permissions/index.d.ts +3 -0
- package/dist/permissions/index.d.ts.map +1 -0
- package/dist/permissions/types/index.d.ts +2 -0
- package/dist/permissions/types/index.d.ts.map +1 -0
- package/dist/permissions/types/permission.d.ts +23 -0
- package/dist/permissions/types/permission.d.ts.map +1 -0
- package/dist/permissions/types/permission.js +1 -0
- package/dist/roles/hooks/useRoles.d.ts +62 -0
- package/dist/roles/hooks/useRoles.d.ts.map +1 -0
- package/dist/roles/hooks/useRoles.js +138 -0
- package/dist/roles/index.d.ts +3 -0
- package/dist/roles/index.d.ts.map +1 -0
- package/dist/roles/types/index.d.ts +2 -0
- package/dist/roles/types/index.d.ts.map +1 -0
- package/dist/roles/types/role.d.ts +23 -0
- package/dist/roles/types/role.d.ts.map +1 -0
- package/dist/roles/types/role.js +1 -0
- package/dist/ticket/hooks/useTickets.d.ts +27 -0
- package/dist/ticket/hooks/useTickets.d.ts.map +1 -0
- package/dist/ticket/hooks/useTickets.js +57 -0
- package/dist/ticket/index.d.ts +3 -0
- package/dist/ticket/index.d.ts.map +1 -0
- package/dist/ticket/types/ticket.d.ts +74 -0
- package/dist/ticket/types/ticket.d.ts.map +1 -0
- package/dist/ticket/types/ticket.js +1 -0
- package/dist/users/hooks/useUsers.d.ts +46 -0
- package/dist/users/hooks/useUsers.d.ts.map +1 -0
- package/dist/users/hooks/useUsers.js +105 -0
- package/dist/users/index.d.ts +3 -0
- package/dist/users/index.d.ts.map +1 -0
- package/dist/users/index.js +1 -0
- package/dist/users/types/user.d.ts +30 -0
- package/dist/users/types/user.d.ts.map +1 -0
- package/dist/users/types/user.js +1 -0
- package/package.json +5 -2
- package/.editorconfig +0 -53
- package/.github/workflows/notify-main.yml +0 -17
- package/CHANGELOG.md +0 -29
- package/src/api/client.ts +0 -135
- package/src/api/typings.ts +0 -3
- package/src/auth/hooks/useAuth.ts +0 -173
- package/src/auth/index.ts +0 -12
- package/src/auth/types/auth.ts +0 -61
- package/src/auth/types/session.ts +0 -12
- package/src/config.ts +0 -31
- package/src/health/hooks/useHealth.ts +0 -57
- package/src/health/types/health.ts +0 -10
- package/src/live_chat/hooks/useLiveChat.ts +0 -124
- package/src/live_chat/hooks/useLiveChatWebSocket.ts +0 -86
- package/src/live_chat/index.ts +0 -15
- package/src/live_chat/types/live_chat.ts +0 -48
- package/src/permissions/hooks/usePermissions.ts +0 -196
- package/src/permissions/types/permission.ts +0 -27
- package/src/roles/hooks/useRoles.ts +0 -167
- package/src/roles/types/role.ts +0 -28
- package/src/ticket/hooks/useTickets.ts +0 -89
- package/src/ticket/types/ticket.ts +0 -88
- package/src/users/hooks/useUsers.ts +0 -150
- package/src/users/index.ts +0 -16
- package/src/users/types/user.ts +0 -36
- package/tsconfig.json +0 -29
- package/tsup.config.ts +0 -12
- /package/{src/health/index.ts → dist/health/index.js} +0 -0
- /package/{src/permissions/index.ts → dist/permissions/index.js} +0 -0
- /package/{src/permissions/types/index.ts → dist/permissions/types/index.js} +0 -0
- /package/{src/roles/index.ts → dist/roles/index.js} +0 -0
- /package/{src/roles/types/index.ts → dist/roles/types/index.js} +0 -0
- /package/{src/ticket/index.ts → dist/ticket/index.js} +0 -0
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
export type TicketType = "issue" | "access" | "new_feature";
|
|
2
|
-
export type TicketCriticality = "high" | "medium" | "low";
|
|
3
|
-
export type TicketStatus =
|
|
4
|
-
| "open"
|
|
5
|
-
| "in_progress"
|
|
6
|
-
| "waiting_for_provider"
|
|
7
|
-
| "waiting_for_validation"
|
|
8
|
-
| "finished";
|
|
9
|
-
|
|
10
|
-
export interface CreateTicketRequest {
|
|
11
|
-
triage_id: string; // PydanticObjectId as string
|
|
12
|
-
type: TicketType;
|
|
13
|
-
criticality: TicketCriticality;
|
|
14
|
-
product: string;
|
|
15
|
-
description: string;
|
|
16
|
-
chat_ids: string[]; // List of PydanticObjectId as string
|
|
17
|
-
client_id: string; // UUID as string
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface CreateTicketResponse {
|
|
21
|
-
id: string;
|
|
22
|
-
status: TicketStatus;
|
|
23
|
-
creation_date: string; // ISO datetime
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface TicketSearchFilters {
|
|
27
|
-
ticket_id?: string;
|
|
28
|
-
client_id?: string;
|
|
29
|
-
triage_id?: string;
|
|
30
|
-
status?: TicketStatus;
|
|
31
|
-
criticality?: TicketCriticality;
|
|
32
|
-
type?: TicketType;
|
|
33
|
-
product?: string;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface TicketCompanyResponse {
|
|
37
|
-
id: string;
|
|
38
|
-
name: string;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export interface TicketClientResponse {
|
|
42
|
-
id: string;
|
|
43
|
-
name: string;
|
|
44
|
-
email: string;
|
|
45
|
-
company: TicketCompanyResponse;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export interface TicketHistoryResponse {
|
|
49
|
-
agent_id: string;
|
|
50
|
-
name: string;
|
|
51
|
-
level: string;
|
|
52
|
-
assignment_date: string;
|
|
53
|
-
exit_date: string;
|
|
54
|
-
transfer_reason: string;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export interface TicketCommentResponse {
|
|
58
|
-
comment_id: string;
|
|
59
|
-
author: string;
|
|
60
|
-
text: string;
|
|
61
|
-
date: string;
|
|
62
|
-
internal: boolean;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export interface TicketResponse {
|
|
66
|
-
id: string;
|
|
67
|
-
triage_id: string;
|
|
68
|
-
type: TicketType;
|
|
69
|
-
criticality: TicketCriticality;
|
|
70
|
-
product: string;
|
|
71
|
-
status: TicketStatus;
|
|
72
|
-
creation_date: string;
|
|
73
|
-
description: string;
|
|
74
|
-
chat_ids: string[];
|
|
75
|
-
agent_history: TicketHistoryResponse[];
|
|
76
|
-
client: TicketClientResponse;
|
|
77
|
-
comments: TicketCommentResponse[];
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export interface UpdateTicketStatusRequest {
|
|
81
|
-
status: TicketStatus;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export interface UpdateTicketStatusResponse {
|
|
85
|
-
id: string;
|
|
86
|
-
previous_status: TicketStatus;
|
|
87
|
-
current_status: TicketStatus;
|
|
88
|
-
}
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
|
|
2
|
-
import { apiClient, ApiResponse } from "../../api";
|
|
3
|
-
import {
|
|
4
|
-
User,
|
|
5
|
-
CreateUserDTO,
|
|
6
|
-
ReplaceUserDTO,
|
|
7
|
-
UpdateUserDTO,
|
|
8
|
-
AddUserRolesDTO,
|
|
9
|
-
} from "../types/user";
|
|
10
|
-
|
|
11
|
-
const PATH = "/users";
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Get all users.
|
|
15
|
-
* @returns {UseQueryResult<User[]>} The query result.
|
|
16
|
-
*/
|
|
17
|
-
export const useGetUsers = () => {
|
|
18
|
-
return useQuery({
|
|
19
|
-
queryKey: ["users"],
|
|
20
|
-
queryFn: async (): Promise<User[]> => {
|
|
21
|
-
const response = await apiClient.get<ApiResponse<User[]>>(PATH);
|
|
22
|
-
return response.data.data;
|
|
23
|
-
},
|
|
24
|
-
// staleTime: // ms
|
|
25
|
-
// gcTime: , //
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Get one user.
|
|
31
|
-
* @param {string} id id parameter.
|
|
32
|
-
* @returns {UseQueryResult<User>} The query result.
|
|
33
|
-
*/
|
|
34
|
-
export const useGetUser = (id: string) => {
|
|
35
|
-
return useQuery({
|
|
36
|
-
queryKey: ["users", id],
|
|
37
|
-
queryFn: async (): Promise<User> => {
|
|
38
|
-
const response = await apiClient.get<ApiResponse<User>>(`${PATH}/${id}`);
|
|
39
|
-
return response.data.data;
|
|
40
|
-
},
|
|
41
|
-
enabled: !!id, // Prevent the query from running if the ID is missing
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Create a user.
|
|
47
|
-
* @param {CreateUserDTO} user The user creation details.
|
|
48
|
-
* @returns {UseMutationResult<User, Error, CreateUserDTO>} The mutation result.
|
|
49
|
-
*/
|
|
50
|
-
export const useCreateUser = () => {
|
|
51
|
-
const queryClient = useQueryClient();
|
|
52
|
-
|
|
53
|
-
return useMutation({
|
|
54
|
-
mutationFn: async (user: CreateUserDTO): Promise<User> => {
|
|
55
|
-
const response = await apiClient.post<ApiResponse<User>>(PATH, user);
|
|
56
|
-
return response.data.data;
|
|
57
|
-
},
|
|
58
|
-
// Tell React Query to refresh the 'users' list after a successful creation.
|
|
59
|
-
onSuccess: () => {
|
|
60
|
-
queryClient.invalidateQueries({ queryKey: ["users"] });
|
|
61
|
-
},
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Replace an entire user.
|
|
67
|
-
* @param {{ id: string; data: ReplaceUserDTO }} params The ID and user replacement data.
|
|
68
|
-
* @returns {UseMutationResult<User, Error, { id: string; data: ReplaceUserDTO }>} The mutation result.
|
|
69
|
-
*/
|
|
70
|
-
export const useUpdateUser = () => {
|
|
71
|
-
const queryClient = useQueryClient();
|
|
72
|
-
|
|
73
|
-
return useMutation({
|
|
74
|
-
mutationFn: async ({
|
|
75
|
-
id,
|
|
76
|
-
data,
|
|
77
|
-
}: {
|
|
78
|
-
id: string;
|
|
79
|
-
data: ReplaceUserDTO;
|
|
80
|
-
}): Promise<User> => {
|
|
81
|
-
const response = await apiClient.put<ApiResponse<User>>(
|
|
82
|
-
`${PATH}/${id}`,
|
|
83
|
-
data,
|
|
84
|
-
);
|
|
85
|
-
return response.data.data;
|
|
86
|
-
},
|
|
87
|
-
onSuccess: (_, variables) => {
|
|
88
|
-
queryClient.invalidateQueries({ queryKey: ["users"] });
|
|
89
|
-
queryClient.invalidateQueries({ queryKey: ["users", variables.id] });
|
|
90
|
-
},
|
|
91
|
-
});
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Update specific fields of a user.
|
|
96
|
-
* @param {{ id: string; data: UpdateUserDTO }} params The ID and user update data.
|
|
97
|
-
* @returns {UseMutationResult<User, Error, { id: string; data: UpdateUserDTO }>} The mutation result.
|
|
98
|
-
*/
|
|
99
|
-
export const usePatchUser = () => {
|
|
100
|
-
const queryClient = useQueryClient();
|
|
101
|
-
|
|
102
|
-
return useMutation({
|
|
103
|
-
mutationFn: async ({
|
|
104
|
-
id,
|
|
105
|
-
data,
|
|
106
|
-
}: {
|
|
107
|
-
id: string;
|
|
108
|
-
data: UpdateUserDTO;
|
|
109
|
-
}): Promise<User> => {
|
|
110
|
-
const response = await apiClient.patch<ApiResponse<User>>(
|
|
111
|
-
`${PATH}/${id}`,
|
|
112
|
-
data,
|
|
113
|
-
);
|
|
114
|
-
return response.data.data;
|
|
115
|
-
},
|
|
116
|
-
onSuccess: (_, variables) => {
|
|
117
|
-
queryClient.invalidateQueries({ queryKey: ["users"] });
|
|
118
|
-
queryClient.invalidateQueries({ queryKey: ["users", variables.id] });
|
|
119
|
-
},
|
|
120
|
-
});
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Add roles to a user.
|
|
125
|
-
* @param {{ id: string; data: AddUserRolesDTO }} params The ID and user roles data.
|
|
126
|
-
* @returns {UseMutationResult<User, Error, { id: string; data: AddUserRolesDTO }>} The mutation result.
|
|
127
|
-
*/
|
|
128
|
-
export const useAddUserRoles = () => {
|
|
129
|
-
const queryClient = useQueryClient();
|
|
130
|
-
|
|
131
|
-
return useMutation({
|
|
132
|
-
mutationFn: async ({
|
|
133
|
-
id,
|
|
134
|
-
data,
|
|
135
|
-
}: {
|
|
136
|
-
id: string;
|
|
137
|
-
data: AddUserRolesDTO;
|
|
138
|
-
}): Promise<User> => {
|
|
139
|
-
const response = await apiClient.post<ApiResponse<User>>(
|
|
140
|
-
`${PATH}/${id}/roles`,
|
|
141
|
-
data,
|
|
142
|
-
);
|
|
143
|
-
return response.data.data;
|
|
144
|
-
},
|
|
145
|
-
onSuccess: (_, variables) => {
|
|
146
|
-
queryClient.invalidateQueries({ queryKey: ["users"] });
|
|
147
|
-
queryClient.invalidateQueries({ queryKey: ["users", variables.id] });
|
|
148
|
-
},
|
|
149
|
-
});
|
|
150
|
-
};
|
package/src/users/index.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export {
|
|
2
|
-
useGetUsers,
|
|
3
|
-
useGetUser,
|
|
4
|
-
useCreateUser,
|
|
5
|
-
useUpdateUser,
|
|
6
|
-
usePatchUser,
|
|
7
|
-
useAddUserRoles,
|
|
8
|
-
} from "./hooks/useUsers";
|
|
9
|
-
|
|
10
|
-
export type {
|
|
11
|
-
User,
|
|
12
|
-
CreateUserDTO,
|
|
13
|
-
UpdateUserDTO,
|
|
14
|
-
ReplaceUserDTO,
|
|
15
|
-
AddUserRolesDTO,
|
|
16
|
-
} from "./types/user";
|
package/src/users/types/user.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { OAuthProvider } from "../../auth/types/auth";
|
|
2
|
-
|
|
3
|
-
export interface User {
|
|
4
|
-
id: string;
|
|
5
|
-
email: string;
|
|
6
|
-
username?: string | null;
|
|
7
|
-
name?: string | null;
|
|
8
|
-
oauth_provider?: OAuthProvider | null;
|
|
9
|
-
oauth_provider_id?: string | null;
|
|
10
|
-
is_active: boolean;
|
|
11
|
-
is_verified: boolean;
|
|
12
|
-
roles?: Role[];
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
import type { Role } from "../../roles/types/role";
|
|
16
|
-
import type { Permission } from "../../permissions/types/permission";
|
|
17
|
-
|
|
18
|
-
export interface CreateUserDTO {
|
|
19
|
-
email: string;
|
|
20
|
-
password_hash?: string | null;
|
|
21
|
-
username?: string | null;
|
|
22
|
-
name?: string | null;
|
|
23
|
-
oauth_provider?: OAuthProvider | null;
|
|
24
|
-
oauth_provider_id?: string | null;
|
|
25
|
-
is_active?: boolean;
|
|
26
|
-
is_verified?: boolean;
|
|
27
|
-
role_ids?: number[];
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export type UpdateUserDTO = Partial<CreateUserDTO>;
|
|
31
|
-
|
|
32
|
-
export type ReplaceUserDTO = CreateUserDTO;
|
|
33
|
-
|
|
34
|
-
export interface AddUserRolesDTO {
|
|
35
|
-
role_ids: number[];
|
|
36
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2020",
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
|
6
|
-
|
|
7
|
-
/* React Specifics */
|
|
8
|
-
"jsx": "react-jsx",
|
|
9
|
-
|
|
10
|
-
/* Module Resolution */
|
|
11
|
-
"moduleResolution": "bundler",
|
|
12
|
-
"esModuleInterop": true,
|
|
13
|
-
|
|
14
|
-
/* Strict Type-Checking */
|
|
15
|
-
"strict": true,
|
|
16
|
-
"skipLibCheck": true,
|
|
17
|
-
"forceConsistentCasingInFileNames": true,
|
|
18
|
-
"isolatedModules": true,
|
|
19
|
-
|
|
20
|
-
/* Type Declaration Output */
|
|
21
|
-
"declaration": true,
|
|
22
|
-
"declarationMap": true,
|
|
23
|
-
|
|
24
|
-
"rootDir": "./src",
|
|
25
|
-
"outDir": "./dist",
|
|
26
|
-
},
|
|
27
|
-
"include": ["src"],
|
|
28
|
-
"exclude": ["node_modules", "dist"]
|
|
29
|
-
}
|
package/tsup.config.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'tsup';
|
|
2
|
-
|
|
3
|
-
export default defineConfig({
|
|
4
|
-
entry: ['src/index.ts'],
|
|
5
|
-
format: ['cjs', 'esm'],
|
|
6
|
-
target: 'es2020',
|
|
7
|
-
dts: true,
|
|
8
|
-
splitting: false,
|
|
9
|
-
sourcemap: true,
|
|
10
|
-
clean: true,
|
|
11
|
-
external: ['react', '@tanstack/react-query'], // ignore these libs on the bundle.
|
|
12
|
-
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|