@larisarozin/dodone-shared 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.
Files changed (66) hide show
  1. package/README.md +116 -0
  2. package/dist/api/routes.d.ts +66 -0
  3. package/dist/api/routes.js +87 -0
  4. package/dist/config/ConfigContext.d.ts +4 -0
  5. package/dist/config/ConfigContext.js +10 -0
  6. package/dist/config/ConfigProvider.d.ts +8 -0
  7. package/dist/config/ConfigProvider.js +8 -0
  8. package/dist/config/useConfig.d.ts +1 -0
  9. package/dist/config/useConfig.js +17 -0
  10. package/dist/config.d.ts +4 -0
  11. package/dist/config.js +6 -0
  12. package/dist/hooks/auth/AuthContext.d.ts +6 -0
  13. package/dist/hooks/auth/AuthContext.js +10 -0
  14. package/dist/hooks/auth/AuthProvider.d.ts +6 -0
  15. package/dist/hooks/auth/AuthProvider.js +83 -0
  16. package/dist/hooks/auth/AuthState.d.ts +20 -0
  17. package/dist/hooks/auth/AuthState.js +7 -0
  18. package/dist/hooks/auth/useAuth.d.ts +3 -0
  19. package/dist/hooks/auth/useAuth.js +17 -0
  20. package/dist/hooks/useAllowanceHistories.d.ts +9 -0
  21. package/dist/hooks/useAllowanceHistories.js +87 -0
  22. package/dist/hooks/useAllowanceHistoryTaskItems.d.ts +7 -0
  23. package/dist/hooks/useAllowanceHistoryTaskItems.js +69 -0
  24. package/dist/hooks/useGrades.d.ts +5 -0
  25. package/dist/hooks/useGrades.js +50 -0
  26. package/dist/hooks/useNotificationPreferences.d.ts +9 -0
  27. package/dist/hooks/useNotificationPreferences.js +107 -0
  28. package/dist/hooks/useTaskCategories.d.ts +7 -0
  29. package/dist/hooks/useTaskCategories.js +70 -0
  30. package/dist/hooks/useTaskComments.d.ts +7 -0
  31. package/dist/hooks/useTaskComments.js +69 -0
  32. package/dist/hooks/useTaskGroups.d.ts +7 -0
  33. package/dist/hooks/useTaskGroups.js +70 -0
  34. package/dist/hooks/useTaskItems.d.ts +7 -0
  35. package/dist/hooks/useTaskItems.js +70 -0
  36. package/dist/hooks/useTaskKinds.d.ts +7 -0
  37. package/dist/hooks/useTaskKinds.js +70 -0
  38. package/dist/hooks/useTeam.d.ts +24 -0
  39. package/dist/hooks/useTeam.js +255 -0
  40. package/dist/index.d.ts +29 -0
  41. package/dist/index.js +50 -0
  42. package/dist/types/AllowanceHistory.d.ts +66 -0
  43. package/dist/types/AllowanceHistory.js +7 -0
  44. package/dist/types/AllowanceInterval.d.ts +29 -0
  45. package/dist/types/AllowanceInterval.js +40 -0
  46. package/dist/types/ApiResponse.d.ts +7 -0
  47. package/dist/types/ApiResponse.js +7 -0
  48. package/dist/types/DeviceRegistration.d.ts +6 -0
  49. package/dist/types/DeviceRegistration.js +7 -0
  50. package/dist/types/TaskItem.d.ts +174 -0
  51. package/dist/types/TaskItem.js +16 -0
  52. package/dist/types/Team.d.ts +76 -0
  53. package/dist/types/Team.js +7 -0
  54. package/dist/types/User.d.ts +91 -0
  55. package/dist/types/User.js +7 -0
  56. package/dist/types/UserNotificationPreferences.d.ts +81 -0
  57. package/dist/types/UserNotificationPreferences.js +68 -0
  58. package/dist/utils/ApiClient.d.ts +204 -0
  59. package/dist/utils/ApiClient.js +608 -0
  60. package/dist/utils/paging.d.ts +305 -0
  61. package/dist/utils/paging.js +428 -0
  62. package/dist/utils/storage.d.ts +7 -0
  63. package/dist/utils/storage.js +37 -0
  64. package/dist/utils/utils.d.ts +0 -0
  65. package/dist/utils/utils.js +6 -0
  66. package/package.json +29 -0
@@ -0,0 +1,204 @@
1
+ import { AllowanceHistoryApprovalRequest, AllowanceHistoryClaimRequest, AllowanceHistoryResponse, AllowanceHistoryTaskItemResponse, PagedAllowanceHistoriesListRequest, PagedAllowanceHistoryTaskItemsListRequest } from "../types/AllowanceHistory";
2
+ import { DataResponse, ResponseBase } from "../types/ApiResponse";
3
+ import { DeviceRegistrationRequest } from "../types/DeviceRegistration";
4
+ import { BonusApprovalRequest, TaskItemAllowanceApprovalRequest, TaskCommentCreateRequest, TaskCommentUpdateRequest, TaskItemTaskDetailsUpdateRequest } from "../types/TaskItem";
5
+ import { TeamAllowanceIntervalCreateRequest, TeamAllowanceIntervalListResponse, TeamAllowanceIntervalResponse, TeamAllowanceIntervalUpdateRequest, TeamDetailsResponse, TeamDetailsUpdateRequest } from "../types/Team";
6
+ import { ForgotPasswordRequest, ForgotPasswordResponse, RegisterRequest, ResetPasswordRequest, ResetPasswordResponse, SendPasswordResetEmailRequest, SendPasswordResetEmailResponse, User } from "../types/User";
7
+ import { BulkNotificationPreferenceCreateRequest, BulkNotificationPreferenceUpdateRequest, UserNotificationPreferenceResponse } from "../types/UserNotificationPreferences";
8
+ import { PagedListRequest, PagedListResponse, PagedTaskCommentListRequest, PagedTaskCommentListResponse, PagedTaskItemDetailsListResponse, PagedTaskItemListRequest, PagedTaskItemListResponse } from "./paging";
9
+ export interface ApiClientConfig {
10
+ baseUrl: string;
11
+ token: string;
12
+ }
13
+ export declare class ApiClient {
14
+ private config;
15
+ constructor(config: ApiClientConfig);
16
+ /**
17
+ * Private helper to process ResponseBase for endpoints that don't return data
18
+ * @param response - The fetch response
19
+ * @param route - API route for error messaging
20
+ * @returns Promise with the parsed ResponseBase
21
+ */
22
+ private processNoDataResponse;
23
+ /**
24
+ * Private helper to process DataResponse for endpoints that return data
25
+ * @param response - The fetch response
26
+ * @param route - API route for error messaging
27
+ * @returns Promise with the unpacked data
28
+ */
29
+ private processDataResponse;
30
+ /**
31
+ * Makes an authenticated GET request with standardized error handling
32
+ * Always processes DataResponse wrapper
33
+ * @param route - API route (will be concatenated with baseUrl)
34
+ * @param options - Additional fetch options
35
+ * @returns Promise with the response data
36
+ */
37
+ get<T>(route: string, options?: RequestInit, processDataResponse?: boolean): Promise<T>;
38
+ /**
39
+ * Makes an authenticated POST request with standardized error handling
40
+ * Always processes DataResponse wrapper
41
+ */
42
+ post<T>(route: string, body?: any, options?: RequestInit, processDataResponse?: boolean): Promise<T>;
43
+ postMultimedia<T>(route: string, body?: any, options?: RequestInit): Promise<T>;
44
+ postNoData(route: string, body?: any, options?: RequestInit): Promise<boolean>;
45
+ postDontProcess<T>(route: string, body?: any, options?: RequestInit): Promise<T>;
46
+ /**
47
+ * Makes an authenticated PUT request with standardized error handling
48
+ * Always processes DataResponse wrapper
49
+ */
50
+ put<T>(route: string, body?: any, options?: RequestInit, processDataResponse?: boolean): Promise<T>;
51
+ /**
52
+ * Makes an authenticated DELETE request with standardized error handling
53
+ * Always processes ResponseBase (no data returned)
54
+ */
55
+ delete(route: string, options?: RequestInit, processResponse?: boolean): Promise<boolean>;
56
+ /**
57
+ * Generic paged list request
58
+ */
59
+ getPagedList<T>(endpoint: string, request: PagedListRequest): Promise<PagedListResponse<T>>;
60
+ getPagedListDetails<T>(endpoint: string, request: PagedListRequest): Promise<PagedListResponse<T>>;
61
+ getPagedTaskItemList<T>(endpoint: string, request: any): Promise<PagedTaskItemListResponse<T>>;
62
+ getPagedTaskItemListDetails<T>(endpoint: string, request: any): Promise<PagedTaskItemListResponse<T>>;
63
+ getPagedTaskCommentList<T>(endpoint: string, request: any): Promise<PagedTaskCommentListResponse<T>>;
64
+ getPagedAllowanceHistoriesList<T>(endpoint: string, request: PagedAllowanceHistoriesListRequest): Promise<PagedListResponse<T>>;
65
+ getPagedAllowanceHistoryTaskItemsList<T>(endpoint: string, request: PagedAllowanceHistoryTaskItemsListRequest): Promise<PagedListResponse<T>>;
66
+ private _tasks?;
67
+ private _comments?;
68
+ private _auth?;
69
+ private _notifications?;
70
+ private _teams?;
71
+ private _avatar?;
72
+ private _allowanceHistories?;
73
+ get clientConfig(): ApiClientConfig;
74
+ get allowanceHistories(): AllowanceHistories;
75
+ get avatar(): Avatar;
76
+ get notifications(): Notifications;
77
+ get teams(): Teams;
78
+ get tasks(): Tasks;
79
+ get comments(): TaskComments;
80
+ get auth(): Auth;
81
+ }
82
+ /**
83
+ * Auth API operations class
84
+ */
85
+ declare class Auth {
86
+ private client;
87
+ constructor(client: ApiClient);
88
+ login(username: string, password: string): Promise<string>;
89
+ logout(): Promise<void>;
90
+ register(registerRequest: RegisterRequest): Promise<ResponseBase>;
91
+ forgotPassword(forgotPasswordRequest: ForgotPasswordRequest): Promise<ForgotPasswordResponse>;
92
+ resetPassword(resetPasswordRequest: ResetPasswordRequest): Promise<ResetPasswordResponse>;
93
+ sendPasswordResetEmail(sendPasswordResetEmailRequest: SendPasswordResetEmailRequest): Promise<SendPasswordResetEmailResponse>;
94
+ }
95
+ /**
96
+ * Teams API operations class
97
+ */
98
+ declare class Teams {
99
+ private client;
100
+ constructor(client: ApiClient);
101
+ getTeamDetails(): Promise<any>;
102
+ updateTeamDetails(teamUpdateRequest: TeamDetailsUpdateRequest): Promise<DataResponse<TeamDetailsResponse>>;
103
+ getTeamMembers(request: PagedListRequest): Promise<PagedListResponse<User>>;
104
+ getTeamAllowanceIntervals(): Promise<TeamAllowanceIntervalListResponse>;
105
+ getTeamAllowanceInterval(id: number): Promise<TeamAllowanceIntervalResponse>;
106
+ createTeamAllowanceInterval(request: TeamAllowanceIntervalCreateRequest): Promise<TeamAllowanceIntervalResponse>;
107
+ updateTeamAllowanceInterval(request: TeamAllowanceIntervalUpdateRequest): Promise<TeamAllowanceIntervalResponse>;
108
+ deleteTeamAllowanceInterval(id: number): Promise<boolean>;
109
+ }
110
+ /**
111
+ * Notifications API operations class
112
+ */
113
+ declare class Notifications {
114
+ private client;
115
+ constructor(client: ApiClient);
116
+ registerDevice(request: DeviceRegistrationRequest): Promise<boolean>;
117
+ unregisterDevice(fcmToken: string): Promise<boolean>;
118
+ updateUserNotificationPreferences(request: BulkNotificationPreferenceUpdateRequest): Promise<ResponseBase>;
119
+ createUserNotificationPreferences(request: BulkNotificationPreferenceCreateRequest): Promise<DataResponse<UserNotificationPreferenceResponse[]>>;
120
+ getUserNotificationPreferences(): Promise<DataResponse<UserNotificationPreferenceResponse[]>>;
121
+ }
122
+ /**
123
+ * Avatar API operations class
124
+ */
125
+ declare class Avatar {
126
+ private client;
127
+ constructor(client: ApiClient);
128
+ uploadAvatar(formData: FormData): Promise<{
129
+ success: boolean;
130
+ fileName?: string;
131
+ }>;
132
+ deleteAvatar(): Promise<boolean>;
133
+ getAvatarUrl(fileName: string): string;
134
+ getAvatar(fileName: string): Promise<File | null>;
135
+ }
136
+ /**
137
+ * Task Comments API operations class
138
+ */
139
+ declare class TaskComments {
140
+ private client;
141
+ constructor(client: ApiClient);
142
+ create(request: TaskCommentCreateRequest): Promise<any>;
143
+ update(request: TaskCommentUpdateRequest): Promise<any>;
144
+ delete(id: number): Promise<any>;
145
+ getList(request: PagedTaskCommentListRequest): Promise<PagedTaskCommentListResponse<any>>;
146
+ }
147
+ /**
148
+ * Allowance Histories API operations class
149
+ */
150
+ declare class AllowanceHistories {
151
+ private client;
152
+ constructor(client: ApiClient);
153
+ getPagedList(request: PagedAllowanceHistoriesListRequest): Promise<PagedListResponse<AllowanceHistoryResponse>>;
154
+ getPagedTaskItemsList(request: PagedAllowanceHistoryTaskItemsListRequest): Promise<PagedListResponse<AllowanceHistoryTaskItemResponse>>;
155
+ approveAllowance(request: AllowanceHistoryApprovalRequest): Promise<AllowanceHistoryResponse>;
156
+ claimAllowance(request: AllowanceHistoryClaimRequest): Promise<AllowanceHistoryResponse>;
157
+ }
158
+ /**
159
+ * Tasks API operations class
160
+ */
161
+ declare class Tasks {
162
+ private client;
163
+ constructor(client: ApiClient);
164
+ create(data: any): Promise<any>;
165
+ update(id: number, data: any): Promise<any>;
166
+ copy(id: number): Promise<any>;
167
+ copyList(body: any): Promise<boolean>;
168
+ delete(id: number): Promise<any>;
169
+ deleteList(body: any): Promise<boolean>;
170
+ pin(id: number, pinning: boolean): Promise<boolean>;
171
+ pinList(pinning: boolean, body: any): Promise<boolean>;
172
+ setActive(id: number, active: boolean): Promise<boolean>;
173
+ setActiveList(activating: boolean, body: any): Promise<boolean>;
174
+ setComplete(id: number, completing: boolean): Promise<boolean>;
175
+ setCompleteList(completing: boolean, body: any): Promise<boolean>;
176
+ archive(id: number, archiving: boolean): Promise<boolean>;
177
+ archiveList(archiving: boolean, body: any): Promise<boolean>;
178
+ approveBonus(request: BonusApprovalRequest): Promise<boolean>;
179
+ approveTaskItemAllowance(request: TaskItemAllowanceApprovalRequest): Promise<boolean>;
180
+ claimBonus(id: number): Promise<boolean>;
181
+ get(id: number): Promise<any>;
182
+ getDetails(id: number): Promise<any>;
183
+ getTaskDetails(id: number): Promise<any>;
184
+ updateTaskDetails(request: TaskItemTaskDetailsUpdateRequest): Promise<ResponseBase>;
185
+ getPagedList(request: PagedTaskItemListRequest): Promise<PagedTaskItemListResponse<any>>;
186
+ getPagedListDetails(request: PagedTaskItemListRequest): Promise<PagedTaskItemDetailsListResponse<any>>;
187
+ }
188
+ /**
189
+ * Functional approach - creates an API client instance
190
+ * @param baseUrl - Base URL for the API
191
+ * @param token - Authentication token
192
+ * @returns ApiClient instance
193
+ */
194
+ export declare function createApiClient(baseUrl: string, token: string): ApiClient;
195
+ /**
196
+ * Hook-friendly function for making authenticated API calls
197
+ * @param baseUrl - Base URL for the API
198
+ * @param token - Authentication token
199
+ * @param route - API route to call
200
+ * @param options - Additional fetch options
201
+ * @returns Promise with the response data
202
+ */
203
+ export declare function apiCall<T>(baseUrl: string, token: string, route: string, options?: RequestInit): Promise<T>;
204
+ export {};