@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,608 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2025 Larisa Rozin
4
+ * dodone-shared - Task Management, Allowance & Bonus Tracking Application Package
5
+ * All rights reserved.
6
+ */
7
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
8
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
9
+ return new (P || (P = Promise))(function (resolve, reject) {
10
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
11
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
12
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
13
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
14
+ });
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.ApiClient = void 0;
18
+ exports.createApiClient = createApiClient;
19
+ exports.apiCall = apiCall;
20
+ class ApiClient {
21
+ constructor(config) {
22
+ this.config = config;
23
+ }
24
+ /**
25
+ * Private helper to process ResponseBase for endpoints that don't return data
26
+ * @param response - The fetch response
27
+ * @param route - API route for error messaging
28
+ * @returns Promise with the parsed ResponseBase
29
+ */
30
+ processNoDataResponse(response, route) {
31
+ return __awaiter(this, void 0, void 0, function* () {
32
+ const baseResponse = yield response.json();
33
+ if (!baseResponse.success) {
34
+ console.error(`Error with ${route}:`, baseResponse.message);
35
+ throw new Error(baseResponse.message || `Failed to process ${route}`);
36
+ }
37
+ return baseResponse.success;
38
+ });
39
+ }
40
+ /**
41
+ * Private helper to process DataResponse for endpoints that return data
42
+ * @param response - The fetch response
43
+ * @param route - API route for error messaging
44
+ * @returns Promise with the unpacked data
45
+ */
46
+ processDataResponse(response, route) {
47
+ return __awaiter(this, void 0, void 0, function* () {
48
+ const dataResponse = yield response.json();
49
+ if (!dataResponse.success) {
50
+ console.error(`Error with ${route}:`, dataResponse.message);
51
+ throw new Error(dataResponse.message || `Failed to process ${route}`);
52
+ }
53
+ return dataResponse.data;
54
+ });
55
+ }
56
+ /**
57
+ * Makes an authenticated GET request with standardized error handling
58
+ * Always processes DataResponse wrapper
59
+ * @param route - API route (will be concatenated with baseUrl)
60
+ * @param options - Additional fetch options
61
+ * @returns Promise with the response data
62
+ */
63
+ get(route_1) {
64
+ return __awaiter(this, arguments, void 0, function* (route, options = {}, processDataResponse = true) {
65
+ const response = yield fetch(this.config.baseUrl + route, Object.assign(Object.assign({}, options), { headers: Object.assign({ Authorization: `Bearer ${this.config.token}` }, options.headers) }));
66
+ if (!response.ok) {
67
+ console.error(`Error fetching ${route}:`, response.statusText);
68
+ throw new Error(`Failed to fetch ${route}`);
69
+ }
70
+ if (processDataResponse)
71
+ return this.processDataResponse(response, route);
72
+ else
73
+ return response.json(); // Skip DataResponse processing if specified
74
+ });
75
+ }
76
+ /**
77
+ * Makes an authenticated POST request with standardized error handling
78
+ * Always processes DataResponse wrapper
79
+ */
80
+ post(route_1, body_1) {
81
+ return __awaiter(this, arguments, void 0, function* (route, body, options = {}, processDataResponse = true) {
82
+ const response = yield fetch(this.config.baseUrl + route, Object.assign(Object.assign({ method: 'POST' }, options), { headers: Object.assign({ 'Content-Type': 'application/json', Authorization: `Bearer ${this.config.token}` }, options.headers), body: body ? JSON.stringify(body) : undefined }));
83
+ if (!response.ok) {
84
+ console.error(`Error posting to ${route}:`, response.statusText);
85
+ throw new Error(`Failed to post to ${route}`);
86
+ }
87
+ if (processDataResponse)
88
+ return this.processDataResponse(response, route);
89
+ else
90
+ return response.json(); // Skip DataResponse processing if specified
91
+ });
92
+ }
93
+ postMultimedia(route_1, body_1) {
94
+ return __awaiter(this, arguments, void 0, function* (route, body, options = {}) {
95
+ const response = yield fetch(this.config.baseUrl + route, Object.assign(Object.assign({ method: 'POST' }, options), { headers: Object.assign({ Authorization: `Bearer ${this.config.token}` }, options.headers), body: body }));
96
+ if (!response.ok) {
97
+ console.error(`Error posting to ${route}:`, response.statusText);
98
+ throw new Error(`Failed to post to ${route}`);
99
+ }
100
+ return response.json();
101
+ });
102
+ }
103
+ postNoData(route_1, body_1) {
104
+ return __awaiter(this, arguments, void 0, function* (route, body, options = {}) {
105
+ const response = yield fetch(this.config.baseUrl + route, Object.assign(Object.assign({ method: 'POST' }, options), { headers: Object.assign({ 'Content-Type': 'application/json', Authorization: `Bearer ${this.config.token}` }, options.headers), body: body ? JSON.stringify(body) : undefined }));
106
+ if (!response.ok) {
107
+ console.error(`Error posting to ${route}:`, response.statusText);
108
+ throw new Error(`Failed to post to ${route}`);
109
+ }
110
+ return this.processNoDataResponse(response, route);
111
+ });
112
+ }
113
+ postDontProcess(route_1, body_1) {
114
+ return __awaiter(this, arguments, void 0, function* (route, body, options = {}) {
115
+ const response = yield fetch(this.config.baseUrl + route, Object.assign(Object.assign({ method: 'POST' }, options), { headers: Object.assign({ 'Content-Type': 'application/json', Authorization: `Bearer ${this.config.token}` }, options.headers), body: body ? JSON.stringify(body) : undefined }));
116
+ if (!response.ok) {
117
+ console.error(`Error posting to ${route}:`, response.statusText);
118
+ throw new Error(`Failed to post to ${route}`);
119
+ }
120
+ return response.json();
121
+ });
122
+ }
123
+ /**
124
+ * Makes an authenticated PUT request with standardized error handling
125
+ * Always processes DataResponse wrapper
126
+ */
127
+ put(route_1, body_1) {
128
+ return __awaiter(this, arguments, void 0, function* (route, body, options = {}, processDataResponse = true) {
129
+ const response = yield fetch(this.config.baseUrl + route, Object.assign(Object.assign({ method: 'PUT' }, options), { headers: Object.assign({ 'Content-Type': 'application/json', Authorization: `Bearer ${this.config.token}` }, options.headers), body: body ? JSON.stringify(body) : undefined }));
130
+ if (!response.ok) {
131
+ console.error(`Error updating ${route}:`, response.statusText);
132
+ throw new Error(`Failed to update ${route}`);
133
+ }
134
+ if (processDataResponse)
135
+ return this.processDataResponse(response, route);
136
+ else
137
+ return response.json(); // Skip DataResponse processing if specified
138
+ });
139
+ }
140
+ /**
141
+ * Makes an authenticated DELETE request with standardized error handling
142
+ * Always processes ResponseBase (no data returned)
143
+ */
144
+ delete(route_1) {
145
+ return __awaiter(this, arguments, void 0, function* (route, options = {}, processResponse = true) {
146
+ const response = yield fetch(this.config.baseUrl + route, Object.assign(Object.assign({ method: 'DELETE' }, options), { headers: Object.assign({ Authorization: `Bearer ${this.config.token}` }, options.headers) }));
147
+ if (!response.ok) {
148
+ console.error(`Error deleting ${route}:`, response.statusText);
149
+ throw new Error(`Failed to delete ${route}`);
150
+ }
151
+ if (processResponse) {
152
+ return this.processNoDataResponse(response, route);
153
+ }
154
+ else {
155
+ return response.json();
156
+ }
157
+ });
158
+ }
159
+ /**
160
+ * Generic paged list request
161
+ */
162
+ getPagedList(endpoint, request) {
163
+ return __awaiter(this, void 0, void 0, function* () {
164
+ return this.post(endpoint, request, {}, false);
165
+ });
166
+ }
167
+ getPagedListDetails(endpoint, request) {
168
+ return __awaiter(this, void 0, void 0, function* () {
169
+ return this.post(endpoint, request, {}, false);
170
+ });
171
+ }
172
+ getPagedTaskItemList(endpoint, request) {
173
+ return __awaiter(this, void 0, void 0, function* () {
174
+ return this.post(endpoint, request, {}, false);
175
+ });
176
+ }
177
+ getPagedTaskItemListDetails(endpoint, request) {
178
+ return __awaiter(this, void 0, void 0, function* () {
179
+ return this.post(endpoint, request, {}, false);
180
+ });
181
+ }
182
+ getPagedTaskCommentList(endpoint, request) {
183
+ return __awaiter(this, void 0, void 0, function* () {
184
+ return this.post(endpoint, request, {}, false);
185
+ });
186
+ }
187
+ getPagedAllowanceHistoriesList(endpoint, request) {
188
+ return __awaiter(this, void 0, void 0, function* () {
189
+ return this.post(endpoint, request, {}, false);
190
+ });
191
+ }
192
+ getPagedAllowanceHistoryTaskItemsList(endpoint, request) {
193
+ return __awaiter(this, void 0, void 0, function* () {
194
+ return this.post(endpoint, request, {}, false);
195
+ });
196
+ }
197
+ get clientConfig() {
198
+ return this.config;
199
+ }
200
+ get allowanceHistories() {
201
+ if (!this._allowanceHistories) {
202
+ this._allowanceHistories = new AllowanceHistories(this);
203
+ }
204
+ return this._allowanceHistories;
205
+ }
206
+ get avatar() {
207
+ if (!this._avatar) {
208
+ this._avatar = new Avatar(this);
209
+ }
210
+ return this._avatar;
211
+ }
212
+ get notifications() {
213
+ if (!this._notifications) {
214
+ this._notifications = new Notifications(this);
215
+ }
216
+ return this._notifications;
217
+ }
218
+ get teams() {
219
+ if (!this._teams) {
220
+ this._teams = new Teams(this);
221
+ }
222
+ return this._teams;
223
+ }
224
+ get tasks() {
225
+ if (!this._tasks) {
226
+ this._tasks = new Tasks(this);
227
+ }
228
+ return this._tasks;
229
+ }
230
+ get comments() {
231
+ if (!this._comments) {
232
+ this._comments = new TaskComments(this);
233
+ }
234
+ return this._comments;
235
+ }
236
+ get auth() {
237
+ if (!this._auth) {
238
+ this._auth = new Auth(this);
239
+ }
240
+ return this._auth;
241
+ }
242
+ }
243
+ exports.ApiClient = ApiClient;
244
+ /**
245
+ * Auth API operations class
246
+ */
247
+ class Auth {
248
+ constructor(client) {
249
+ this.client = client;
250
+ }
251
+ login(username, password) {
252
+ return __awaiter(this, void 0, void 0, function* () {
253
+ const response = yield this.client.post('/api/auth/login', { username, password });
254
+ return response.token;
255
+ });
256
+ }
257
+ logout() {
258
+ return __awaiter(this, void 0, void 0, function* () {
259
+ yield this.client.post('/api/auth/logout');
260
+ });
261
+ }
262
+ register(registerRequest) {
263
+ return __awaiter(this, void 0, void 0, function* () {
264
+ const response = yield this.client.post('/api/auth/register', registerRequest, {}, false);
265
+ return response;
266
+ });
267
+ }
268
+ forgotPassword(forgotPasswordRequest) {
269
+ return __awaiter(this, void 0, void 0, function* () {
270
+ const response = yield this.client.postDontProcess('/api/auth/forgot-password', forgotPasswordRequest);
271
+ return response;
272
+ });
273
+ }
274
+ resetPassword(resetPasswordRequest) {
275
+ return __awaiter(this, void 0, void 0, function* () {
276
+ const response = yield this.client.postDontProcess('/api/auth/reset-password', resetPasswordRequest);
277
+ return response;
278
+ });
279
+ }
280
+ sendPasswordResetEmail(sendPasswordResetEmailRequest) {
281
+ return __awaiter(this, void 0, void 0, function* () {
282
+ const response = yield this.client.postDontProcess('/api/auth/send-password-reset-email', sendPasswordResetEmailRequest);
283
+ return response;
284
+ });
285
+ }
286
+ }
287
+ /**
288
+ * Teams API operations class
289
+ */
290
+ class Teams {
291
+ constructor(client) {
292
+ this.client = client;
293
+ }
294
+ getTeamDetails() {
295
+ return __awaiter(this, void 0, void 0, function* () {
296
+ return this.client.get('/api/team/', {}, false);
297
+ });
298
+ }
299
+ updateTeamDetails(teamUpdateRequest) {
300
+ return __awaiter(this, void 0, void 0, function* () {
301
+ return this.client.put(`/api/team/`, teamUpdateRequest, {}, false);
302
+ });
303
+ }
304
+ getTeamMembers(request) {
305
+ return __awaiter(this, void 0, void 0, function* () {
306
+ return this.client.getPagedListDetails('/api/team/members', request);
307
+ });
308
+ }
309
+ getTeamAllowanceIntervals() {
310
+ return __awaiter(this, void 0, void 0, function* () {
311
+ return this.client.get('/api/team/allowance-intervals', {}, false);
312
+ });
313
+ }
314
+ getTeamAllowanceInterval(id) {
315
+ return __awaiter(this, void 0, void 0, function* () {
316
+ return this.client.get(`/api/team/allowance-intervals/${id}`, {}, false);
317
+ });
318
+ }
319
+ createTeamAllowanceInterval(request) {
320
+ return __awaiter(this, void 0, void 0, function* () {
321
+ return this.client.post('/api/team/allowance-intervals', request, {}, false);
322
+ });
323
+ }
324
+ updateTeamAllowanceInterval(request) {
325
+ return __awaiter(this, void 0, void 0, function* () {
326
+ return this.client.put(`/api/team/allowance-intervals/`, request, {}, false);
327
+ });
328
+ }
329
+ deleteTeamAllowanceInterval(id) {
330
+ return __awaiter(this, void 0, void 0, function* () {
331
+ return this.client.delete(`/api/team/allowance-intervals/${id}`, {}, false);
332
+ });
333
+ }
334
+ }
335
+ /**
336
+ * Notifications API operations class
337
+ */
338
+ class Notifications {
339
+ constructor(client) {
340
+ this.client = client;
341
+ }
342
+ registerDevice(request) {
343
+ return __awaiter(this, void 0, void 0, function* () {
344
+ return this.client.postNoData('/api/userdeviceregistration/register-device', request);
345
+ });
346
+ }
347
+ unregisterDevice(fcmToken) {
348
+ return __awaiter(this, void 0, void 0, function* () {
349
+ return this.client.postNoData('/api/userdeviceregistration/unregister-device', { fcmToken });
350
+ });
351
+ }
352
+ updateUserNotificationPreferences(request) {
353
+ return __awaiter(this, void 0, void 0, function* () {
354
+ return this.client.put('/api/user/update-notification-preferences/bulk', request, {}, false);
355
+ });
356
+ }
357
+ createUserNotificationPreferences(request) {
358
+ return __awaiter(this, void 0, void 0, function* () {
359
+ return this.client.postDontProcess('/api/user/create-notification-preferences/bulk', request);
360
+ });
361
+ }
362
+ getUserNotificationPreferences() {
363
+ return __awaiter(this, void 0, void 0, function* () {
364
+ return this.client.get(`/api/user/notification-preferences/`, {}, false);
365
+ });
366
+ }
367
+ }
368
+ /**
369
+ * Avatar API operations class
370
+ */
371
+ class Avatar {
372
+ constructor(client) {
373
+ this.client = client;
374
+ }
375
+ uploadAvatar(formData) {
376
+ return __awaiter(this, void 0, void 0, function* () {
377
+ const response = yield this.client.postMultimedia(`/api/avatar/upload`, formData);
378
+ return {
379
+ success: response.success,
380
+ fileName: response.data
381
+ };
382
+ });
383
+ }
384
+ deleteAvatar() {
385
+ return __awaiter(this, void 0, void 0, function* () {
386
+ return this.client.delete(`/api/avatar/`);
387
+ });
388
+ }
389
+ getAvatarUrl(fileName) {
390
+ return `${this.client.clientConfig.baseUrl}/api/avatar/${fileName}`;
391
+ }
392
+ getAvatar(fileName) {
393
+ return __awaiter(this, void 0, void 0, function* () {
394
+ const response = yield fetch(this.getAvatarUrl(fileName), {
395
+ headers: {
396
+ Authorization: `Bearer ${this.client.clientConfig.token}`,
397
+ },
398
+ });
399
+ if (!response.ok) {
400
+ return null;
401
+ }
402
+ const blob = yield response.blob();
403
+ return new File([blob], fileName, { type: blob.type });
404
+ });
405
+ }
406
+ }
407
+ /**
408
+ * Task Comments API operations class
409
+ */
410
+ class TaskComments {
411
+ constructor(client) {
412
+ this.client = client;
413
+ }
414
+ create(request) {
415
+ return __awaiter(this, void 0, void 0, function* () {
416
+ return this.client.post('/api/taskcomment/add', request, {}, false);
417
+ });
418
+ }
419
+ update(request) {
420
+ return __awaiter(this, void 0, void 0, function* () {
421
+ return this.client.put(`/api/taskcomment/update`, request, {}, false);
422
+ });
423
+ }
424
+ delete(id) {
425
+ return __awaiter(this, void 0, void 0, function* () {
426
+ return this.client.delete(`/api/taskcomment/delete/${id}`, {}, false);
427
+ });
428
+ }
429
+ getList(request) {
430
+ return __awaiter(this, void 0, void 0, function* () {
431
+ return this.client.getPagedTaskCommentList('/api/taskcomment/paged-list', request);
432
+ });
433
+ }
434
+ }
435
+ /**
436
+ * Allowance Histories API operations class
437
+ */
438
+ class AllowanceHistories {
439
+ constructor(client) {
440
+ this.client = client;
441
+ }
442
+ getPagedList(request) {
443
+ return __awaiter(this, void 0, void 0, function* () {
444
+ return this.client.getPagedAllowanceHistoriesList('/api/allowancehistory/paged-list', request);
445
+ });
446
+ }
447
+ getPagedTaskItemsList(request) {
448
+ return __awaiter(this, void 0, void 0, function* () {
449
+ return this.client.getPagedAllowanceHistoryTaskItemsList('/api/allowancehistory/paged-task-items-list', request);
450
+ });
451
+ }
452
+ approveAllowance(request) {
453
+ return __awaiter(this, void 0, void 0, function* () {
454
+ return this.client.postDontProcess('/api/allowancehistory/approve', request);
455
+ });
456
+ }
457
+ claimAllowance(request) {
458
+ return __awaiter(this, void 0, void 0, function* () {
459
+ return this.client.postDontProcess('/api/allowancehistory/claim', request);
460
+ });
461
+ }
462
+ }
463
+ /**
464
+ * Tasks API operations class
465
+ */
466
+ class Tasks {
467
+ constructor(client) {
468
+ this.client = client;
469
+ }
470
+ create(data) {
471
+ return __awaiter(this, void 0, void 0, function* () {
472
+ return this.client.post('/api/taskitem', data);
473
+ });
474
+ }
475
+ update(id, data) {
476
+ return __awaiter(this, void 0, void 0, function* () {
477
+ return this.client.put(`/api/taskitem/${id}`, data);
478
+ });
479
+ }
480
+ copy(id) {
481
+ return __awaiter(this, void 0, void 0, function* () {
482
+ return this.client.post(`/api/taskitem/copy/${id}`);
483
+ });
484
+ }
485
+ copyList(body) {
486
+ return __awaiter(this, void 0, void 0, function* () {
487
+ return this.client.postNoData(`/api/taskitem/copy-list`, body);
488
+ });
489
+ }
490
+ delete(id) {
491
+ return __awaiter(this, void 0, void 0, function* () {
492
+ return this.client.delete(`/api/taskitem/${id}`);
493
+ });
494
+ }
495
+ deleteList(body) {
496
+ return __awaiter(this, void 0, void 0, function* () {
497
+ return this.client.postNoData(`/api/taskitem/delete-list`, body);
498
+ });
499
+ }
500
+ pin(id, pinning) {
501
+ return __awaiter(this, void 0, void 0, function* () {
502
+ return this.client.post(`/api/taskitem/pin/${id}/${pinning}`);
503
+ });
504
+ }
505
+ pinList(pinning, body) {
506
+ return __awaiter(this, void 0, void 0, function* () {
507
+ return this.client.post(`/api/taskitem/pin-list/${pinning}`, body);
508
+ });
509
+ }
510
+ setActive(id, active) {
511
+ return __awaiter(this, void 0, void 0, function* () {
512
+ return this.client.post(`/api/taskitem/set-active/${id}/${active}`);
513
+ });
514
+ }
515
+ setActiveList(activating, body) {
516
+ return __awaiter(this, void 0, void 0, function* () {
517
+ return this.client.post(`/api/taskitem/set-active-list/${activating}`, body);
518
+ });
519
+ }
520
+ setComplete(id, completing) {
521
+ return __awaiter(this, void 0, void 0, function* () {
522
+ return this.client.post(`/api/taskitem/set-complete/${id}/${completing}`);
523
+ });
524
+ }
525
+ setCompleteList(completing, body) {
526
+ return __awaiter(this, void 0, void 0, function* () {
527
+ return this.client.post(`/api/taskitem/set-complete-list/${completing}`, body);
528
+ });
529
+ }
530
+ archive(id, archiving) {
531
+ return __awaiter(this, void 0, void 0, function* () {
532
+ return this.client.post(`/api/taskitem/archive/${id}/${archiving}`);
533
+ });
534
+ }
535
+ archiveList(archiving, body) {
536
+ return __awaiter(this, void 0, void 0, function* () {
537
+ return this.client.postNoData(`/api/taskitem/archive-list/${archiving}`, body);
538
+ });
539
+ }
540
+ approveBonus(request) {
541
+ return __awaiter(this, void 0, void 0, function* () {
542
+ return this.client.postNoData('/api/taskitem/approve-bonus', request);
543
+ });
544
+ }
545
+ approveTaskItemAllowance(request) {
546
+ return __awaiter(this, void 0, void 0, function* () {
547
+ return this.client.postNoData('/api/taskitem/approve-allowance', request);
548
+ });
549
+ }
550
+ claimBonus(id) {
551
+ return __awaiter(this, void 0, void 0, function* () {
552
+ return this.client.postNoData(`/api/taskitem/claim-bonus/${id}`);
553
+ });
554
+ }
555
+ get(id) {
556
+ return __awaiter(this, void 0, void 0, function* () {
557
+ return this.client.get(`/api/taskitem/${id}`);
558
+ });
559
+ }
560
+ getDetails(id) {
561
+ return __awaiter(this, void 0, void 0, function* () {
562
+ return this.client.get(`/api/taskitem/details/${id}`);
563
+ });
564
+ }
565
+ getTaskDetails(id) {
566
+ return __awaiter(this, void 0, void 0, function* () {
567
+ return this.client.get(`/api/taskitem/get-task-details/${id}`, {}, false);
568
+ });
569
+ }
570
+ updateTaskDetails(request) {
571
+ return __awaiter(this, void 0, void 0, function* () {
572
+ return this.client.post(`/api/taskitem/update-task-details`, request, {}, false);
573
+ });
574
+ }
575
+ getPagedList(request) {
576
+ return __awaiter(this, void 0, void 0, function* () {
577
+ return this.client.getPagedTaskItemList('/api/taskitem/paged-list', request);
578
+ });
579
+ }
580
+ getPagedListDetails(request) {
581
+ return __awaiter(this, void 0, void 0, function* () {
582
+ return this.client.getPagedTaskItemListDetails('/api/taskitem/paged-list-details', request);
583
+ });
584
+ }
585
+ }
586
+ /**
587
+ * Functional approach - creates an API client instance
588
+ * @param baseUrl - Base URL for the API
589
+ * @param token - Authentication token
590
+ * @returns ApiClient instance
591
+ */
592
+ function createApiClient(baseUrl, token) {
593
+ return new ApiClient({ baseUrl, token });
594
+ }
595
+ /**
596
+ * Hook-friendly function for making authenticated API calls
597
+ * @param baseUrl - Base URL for the API
598
+ * @param token - Authentication token
599
+ * @param route - API route to call
600
+ * @param options - Additional fetch options
601
+ * @returns Promise with the response data
602
+ */
603
+ function apiCall(baseUrl_1, token_1, route_1) {
604
+ return __awaiter(this, arguments, void 0, function* (baseUrl, token, route, options = {}) {
605
+ const client = createApiClient(baseUrl, token);
606
+ return client.get(route, options);
607
+ });
608
+ }