@actschurch/ccms-sdk 0.0.26 → 0.0.27
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/models/accounselling/ModelView/CareSessionModelView.d.ts +7 -0
- package/dist/models/accounselling/ModelView/CareSessionModelView.d.ts.map +1 -1
- package/dist/models/analytics/KnowledgeSearch.d.ts +10 -0
- package/dist/models/analytics/KnowledgeSearch.d.ts.map +1 -1
- package/dist/models/dashboard/index.d.ts +282 -3
- package/dist/models/dashboard/index.d.ts.map +1 -1
- package/dist/models/dashboard/index.js +315 -3
- package/dist/models/dashboard/index.js.map +1 -1
- package/dist/models/resources/ModelView/CourseModelView.d.ts +17 -0
- package/dist/models/resources/ModelView/CourseModelView.d.ts.map +1 -1
- package/dist/models/resources/ResourceSettings.d.ts +31 -0
- package/dist/models/resources/ResourceSettings.d.ts.map +1 -0
- package/dist/models/resources/ResourceSettings.js +2 -0
- package/dist/models/resources/ResourceSettings.js.map +1 -0
- package/dist/models/resources/SessionNote.d.ts +30 -0
- package/dist/models/resources/SessionNote.d.ts.map +1 -0
- package/dist/models/resources/SessionNote.js +2 -0
- package/dist/models/resources/SessionNote.js.map +1 -0
- package/dist/models/resources/index.d.ts +2 -0
- package/dist/models/resources/index.d.ts.map +1 -1
- package/dist/models/resources/index.js +3 -0
- package/dist/models/resources/index.js.map +1 -1
- package/dist/react/hooks/services/useResourcesServices.d.ts +5 -1
- package/dist/react/hooks/services/useResourcesServices.d.ts.map +1 -1
- package/dist/react/hooks/services/useResourcesServices.js +6 -0
- package/dist/react/hooks/services/useResourcesServices.js.map +1 -1
- package/dist/realtime/dashboards/DashboardAggregatorClient.d.ts +48 -0
- package/dist/realtime/dashboards/DashboardAggregatorClient.d.ts.map +1 -0
- package/dist/realtime/dashboards/DashboardAggregatorClient.js +65 -0
- package/dist/realtime/dashboards/DashboardAggregatorClient.js.map +1 -0
- package/dist/realtime/dashboards/index.d.ts +1 -0
- package/dist/realtime/dashboards/index.d.ts.map +1 -1
- package/dist/realtime/dashboards/index.js +3 -0
- package/dist/realtime/dashboards/index.js.map +1 -1
- package/dist/services/accounselling/CareCaseService.d.ts +45 -1
- package/dist/services/accounselling/CareCaseService.d.ts.map +1 -1
- package/dist/services/accounselling/CareCaseService.js +65 -0
- package/dist/services/accounselling/CareCaseService.js.map +1 -1
- package/dist/services/dashboard/DashboardAggregatorService.d.ts +73 -0
- package/dist/services/dashboard/DashboardAggregatorService.d.ts.map +1 -0
- package/dist/services/dashboard/DashboardAggregatorService.js +145 -0
- package/dist/services/dashboard/DashboardAggregatorService.js.map +1 -0
- package/dist/services/dashboard/DashboardLayoutService.d.ts +46 -0
- package/dist/services/dashboard/DashboardLayoutService.d.ts.map +1 -0
- package/dist/services/dashboard/DashboardLayoutService.js +75 -0
- package/dist/services/dashboard/DashboardLayoutService.js.map +1 -0
- package/dist/services/dashboard/DashboardServices.d.ts +38 -0
- package/dist/services/dashboard/DashboardServices.d.ts.map +1 -0
- package/dist/services/dashboard/DashboardServices.js +28 -0
- package/dist/services/dashboard/DashboardServices.js.map +1 -0
- package/dist/services/dashboard/index.d.ts +11 -0
- package/dist/services/dashboard/index.d.ts.map +1 -0
- package/dist/services/dashboard/index.js +10 -0
- package/dist/services/dashboard/index.js.map +1 -0
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +2 -0
- package/dist/services/index.js.map +1 -1
- package/dist/services/knowledgebase/KnowledgeBaseQAService.d.ts +7 -1
- package/dist/services/knowledgebase/KnowledgeBaseQAService.d.ts.map +1 -1
- package/dist/services/knowledgebase/KnowledgeBaseQAService.js +11 -0
- package/dist/services/knowledgebase/KnowledgeBaseQAService.js.map +1 -1
- package/dist/services/members/MemberService.d.ts +17 -0
- package/dist/services/members/MemberService.d.ts.map +1 -1
- package/dist/services/members/MemberService.js +27 -0
- package/dist/services/members/MemberService.js.map +1 -1
- package/dist/services/resources/PublicCoursesService.d.ts +7 -0
- package/dist/services/resources/PublicCoursesService.d.ts.map +1 -1
- package/dist/services/resources/PublicCoursesService.js +12 -0
- package/dist/services/resources/PublicCoursesService.js.map +1 -1
- package/dist/services/resources/ResourceSettingsService.d.ts +26 -0
- package/dist/services/resources/ResourceSettingsService.d.ts.map +1 -0
- package/dist/services/resources/ResourceSettingsService.js +43 -0
- package/dist/services/resources/ResourceSettingsService.js.map +1 -0
- package/dist/services/resources/SessionNoteService.d.ts +27 -0
- package/dist/services/resources/SessionNoteService.d.ts.map +1 -0
- package/dist/services/resources/SessionNoteService.js +44 -0
- package/dist/services/resources/SessionNoteService.js.map +1 -0
- package/dist/services/resources/UserCourseProgressService.d.ts +9 -0
- package/dist/services/resources/UserCourseProgressService.d.ts.map +1 -1
- package/dist/services/resources/UserCourseProgressService.js +13 -0
- package/dist/services/resources/UserCourseProgressService.js.map +1 -1
- package/dist/services/resources/index.d.ts +6 -0
- package/dist/services/resources/index.d.ts.map +1 -1
- package/dist/services/resources/index.js +6 -0
- package/dist/services/resources/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DashboardAggregatorClient
|
|
3
|
+
* SignalR client for the Dashboard-Aggregator realtime hub (`/hubs/dashboard`).
|
|
4
|
+
*
|
|
5
|
+
* The aggregator exposes ONE hub the Hub app connects to instead of N per-domain
|
|
6
|
+
* connections. Server → client messages:
|
|
7
|
+
* - `WidgetDelta` — a single refreshed {@link DashboardWidget}; merge by `widgetId`.
|
|
8
|
+
* - `WidgetInvalidated` — `{ widgetIds: string[] }`; re-fetch just those widgets.
|
|
9
|
+
*
|
|
10
|
+
* Mirrors the iOS `DashboardRealtimeClient` and the Kotlin
|
|
11
|
+
* `DashboardAggregatorHubClient`. Distinct from {@link DomainDashboardClient}
|
|
12
|
+
* (the admin per-domain `/hubs/dashboard/{domain}` client) — kept separate.
|
|
13
|
+
*
|
|
14
|
+
* Local events emitted (subscribe via {@link BaseSignalRClient.on}):
|
|
15
|
+
* - `'widgetDelta'` → {@link DashboardWidget}
|
|
16
|
+
* - `'widgetInvalidated'` → `string[]` (the invalidated widget ids)
|
|
17
|
+
*/
|
|
18
|
+
import { BaseSignalRClient } from '../shared/BaseSignalRClient';
|
|
19
|
+
/**
|
|
20
|
+
* Client for the cross-domain dashboard aggregator hub.
|
|
21
|
+
* Connects to `/hubs/dashboard` on the aggregator WebSocket service.
|
|
22
|
+
*/
|
|
23
|
+
export class DashboardAggregatorClient extends BaseSignalRClient {
|
|
24
|
+
constructor(baseUrl, getToken, options = {}) {
|
|
25
|
+
const hubUrl = baseUrl.endsWith('/hubs/dashboard')
|
|
26
|
+
? baseUrl
|
|
27
|
+
: `${baseUrl.replace(/\/+$/, '')}/hubs/dashboard`;
|
|
28
|
+
super(hubUrl, getToken, options);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Register server-to-client event handlers.
|
|
32
|
+
*/
|
|
33
|
+
setupServerMethods() {
|
|
34
|
+
if (!this.connection)
|
|
35
|
+
return;
|
|
36
|
+
// A single refreshed widget — the Hub merges it by widgetId.
|
|
37
|
+
this.connection.on('WidgetDelta', (widget) => {
|
|
38
|
+
this.emit('widgetDelta', widget);
|
|
39
|
+
});
|
|
40
|
+
// A set of widget ids the server marked stale — the Hub re-fetches them.
|
|
41
|
+
this.connection.on('WidgetInvalidated', (payload) => {
|
|
42
|
+
const ids = payload?.widgetIds ?? [];
|
|
43
|
+
if (ids.length > 0) {
|
|
44
|
+
this.emit('widgetInvalidated', ids);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Subscribe to refreshed widgets pushed by the hub.
|
|
50
|
+
* @param handler - Invoked with each refreshed {@link DashboardWidget}.
|
|
51
|
+
* @returns An unsubscribe handle.
|
|
52
|
+
*/
|
|
53
|
+
onWidgetDelta(handler) {
|
|
54
|
+
return this.on('widgetDelta', handler);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Subscribe to widget-invalidation notifications pushed by the hub.
|
|
58
|
+
* @param handler - Invoked with the list of invalidated widget ids.
|
|
59
|
+
* @returns An unsubscribe handle.
|
|
60
|
+
*/
|
|
61
|
+
onWidgetInvalidated(handler) {
|
|
62
|
+
return this.on('widgetInvalidated', handler);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=DashboardAggregatorClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DashboardAggregatorClient.js","sourceRoot":"","sources":["../../../src/realtime/dashboards/DashboardAggregatorClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAShE;;;GAGG;AACH,MAAM,OAAO,yBAA0B,SAAQ,iBAAiB;IAC9D,YACE,OAAe,EACf,QAAsC,EACtC,UAAgC,EAAE;QAElC,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC;YAChD,CAAC,CAAC,OAAO;YACT,CAAC,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,iBAAiB,CAAC;QACpD,KAAK,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IACnC,CAAC;IAED;;OAEG;IACO,kBAAkB;QAC1B,IAAI,CAAC,IAAI,CAAC,UAAU;YAAE,OAAO;QAE7B,6DAA6D;QAC7D,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC,MAAuB,EAAE,EAAE;YAC5D,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;QAEH,yEAAyE;QACzE,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,OAAiC,EAAE,EAAE;YAC5E,MAAM,GAAG,GAAG,OAAO,EAAE,SAAS,IAAI,EAAE,CAAC;YACrC,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACnB,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,GAAG,CAAC,CAAC;YACtC,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACI,aAAa,CAAC,OAA0C;QAC7D,OAAO,IAAI,CAAC,EAAE,CAAkB,aAAa,EAAE,OAAO,CAAC,CAAC;IAC1D,CAAC;IAED;;;;OAIG;IACI,mBAAmB,CAAC,OAAsC;QAC/D,OAAO,IAAI,CAAC,EAAE,CAAW,mBAAmB,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;CACF"}
|
|
@@ -5,4 +5,5 @@
|
|
|
5
5
|
export * from './types';
|
|
6
6
|
export { DomainDashboardClient } from './DomainDashboardClient';
|
|
7
7
|
export { useDomainDashboard } from './hooks/useDomainDashboard';
|
|
8
|
+
export { DashboardAggregatorClient, type WidgetInvalidatedPayload, } from './DashboardAggregatorClient';
|
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/realtime/dashboards/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/realtime/dashboards/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAIhE,OAAO,EACL,yBAAyB,EACzB,KAAK,wBAAwB,GAC9B,MAAM,6BAA6B,CAAC"}
|
|
@@ -5,4 +5,7 @@
|
|
|
5
5
|
export * from './types';
|
|
6
6
|
export { DomainDashboardClient } from './DomainDashboardClient';
|
|
7
7
|
export { useDomainDashboard } from './hooks/useDomainDashboard';
|
|
8
|
+
// Cross-domain "my day at CCMS" dashboard aggregator hub (/hubs/dashboard).
|
|
9
|
+
// Distinct from the admin per-domain DomainDashboardClient above.
|
|
10
|
+
export { DashboardAggregatorClient, } from './DashboardAggregatorClient';
|
|
8
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/realtime/dashboards/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/realtime/dashboards/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,4EAA4E;AAC5E,kEAAkE;AAClE,OAAO,EACL,yBAAyB,GAE1B,MAAM,6BAA6B,CAAC"}
|
|
@@ -7,7 +7,7 @@ import { CrudService } from '../base/CrudService';
|
|
|
7
7
|
import type { HttpClient } from '../../core/HttpClient';
|
|
8
8
|
import type { ResponseData } from '../../models/common';
|
|
9
9
|
import type { ServiceConfig } from '../types';
|
|
10
|
-
import type { CareCase, CareCaseFile, CareCaseNote, CreateCareCase, UpdateCareCaseRequest, CareCaseFilterModel, CareCaseListViewResponse, CareCaseModelView, CareDashboardStats, CreateCareCaseNote } from '../../models/accounselling';
|
|
10
|
+
import type { CareCase, CareCaseFile, CareCaseNote, CreateCareCase, UpdateCareCaseRequest, CareCaseFilterModel, CareCaseListViewResponse, CareCaseModelView, CareDashboardStats, CreateCareCaseNote, UpdateCareCaseNoteRequest } from '../../models/accounselling';
|
|
11
11
|
/**
|
|
12
12
|
* Service for care case CRUD operations, paged list views, detail views,
|
|
13
13
|
* leader/member assignment, the case note audit trail and file attachments
|
|
@@ -122,6 +122,36 @@ export declare class CareCaseService extends CrudService<CareCase, CreateCareCas
|
|
|
122
122
|
* @returns ResponseData with the created case note
|
|
123
123
|
*/
|
|
124
124
|
addNoteRaw(caseId: number, data: CreateCareCaseNote): Promise<ResponseData<CareCaseNote>>;
|
|
125
|
+
/**
|
|
126
|
+
* Update a case note
|
|
127
|
+
* @param caseId - The case ID
|
|
128
|
+
* @param noteId - The note ID
|
|
129
|
+
* @param data - Partial note payload (only supplied fields are applied)
|
|
130
|
+
* @returns The updated case note
|
|
131
|
+
*/
|
|
132
|
+
updateNote(caseId: number, noteId: number, data: UpdateCareCaseNoteRequest): Promise<CareCaseNote>;
|
|
133
|
+
/**
|
|
134
|
+
* Update a case note with full response
|
|
135
|
+
* @param caseId - The case ID
|
|
136
|
+
* @param noteId - The note ID
|
|
137
|
+
* @param data - Partial note payload
|
|
138
|
+
* @returns ResponseData with the updated case note
|
|
139
|
+
*/
|
|
140
|
+
updateNoteRaw(caseId: number, noteId: number, data: UpdateCareCaseNoteRequest): Promise<ResponseData<CareCaseNote>>;
|
|
141
|
+
/**
|
|
142
|
+
* Delete a case note
|
|
143
|
+
* @param caseId - The case ID
|
|
144
|
+
* @param noteId - The note ID
|
|
145
|
+
* @returns True if deleted successfully
|
|
146
|
+
*/
|
|
147
|
+
deleteNote(caseId: number, noteId: number): Promise<boolean>;
|
|
148
|
+
/**
|
|
149
|
+
* Delete a case note with full response
|
|
150
|
+
* @param caseId - The case ID
|
|
151
|
+
* @param noteId - The note ID
|
|
152
|
+
* @returns ResponseData (success/fail)
|
|
153
|
+
*/
|
|
154
|
+
deleteNoteRaw(caseId: number, noteId: number): Promise<ResponseData<void>>;
|
|
125
155
|
/**
|
|
126
156
|
* Attach a file to a case
|
|
127
157
|
* @param caseId - The case ID
|
|
@@ -136,5 +166,19 @@ export declare class CareCaseService extends CrudService<CareCase, CreateCareCas
|
|
|
136
166
|
* @returns ResponseData with the created case file
|
|
137
167
|
*/
|
|
138
168
|
addFileRaw(caseId: number, file: Partial<CareCaseFile>): Promise<ResponseData<CareCaseFile>>;
|
|
169
|
+
/**
|
|
170
|
+
* Delete a case file
|
|
171
|
+
* @param caseId - The case ID
|
|
172
|
+
* @param fileId - The file ID
|
|
173
|
+
* @returns True if deleted successfully
|
|
174
|
+
*/
|
|
175
|
+
deleteFile(caseId: number, fileId: number): Promise<boolean>;
|
|
176
|
+
/**
|
|
177
|
+
* Delete a case file with full response
|
|
178
|
+
* @param caseId - The case ID
|
|
179
|
+
* @param fileId - The file ID
|
|
180
|
+
* @returns ResponseData (success/fail)
|
|
181
|
+
*/
|
|
182
|
+
deleteFileRaw(caseId: number, fileId: number): Promise<ResponseData<void>>;
|
|
139
183
|
}
|
|
140
184
|
//# sourceMappingURL=CareCaseService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CareCaseService.d.ts","sourceRoot":"","sources":["../../../src/services/accounselling/CareCaseService.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EACV,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,qBAAqB,EACrB,mBAAmB,EACnB,wBAAwB,EACxB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"CareCaseService.d.ts","sourceRoot":"","sources":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C,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;IAKzF;;;;;;OAMG;IACG,UAAU,CACd,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,yBAAyB,GAC9B,OAAO,CAAC,YAAY,CAAC;IAQxB;;;;;;OAMG;IACH,aAAa,CACX,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,yBAAyB,GAC9B,OAAO,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;IAKtC;;;;;OAKG;IACG,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKlE;;;;;OAKG;IACH,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAK1E;;;;;OAKG;IACG,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC;IAQjF;;;;;OAKG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;IAK5F;;;;;OAKG;IACG,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKlE;;;;;OAKG;IACH,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;CAI3E"}
|
|
@@ -186,6 +186,51 @@ export class CareCaseService extends CrudService {
|
|
|
186
186
|
const url = this.buildUrl(`${caseId}/notes`);
|
|
187
187
|
return this.http.post(url, data);
|
|
188
188
|
}
|
|
189
|
+
/**
|
|
190
|
+
* Update a case note
|
|
191
|
+
* @param caseId - The case ID
|
|
192
|
+
* @param noteId - The note ID
|
|
193
|
+
* @param data - Partial note payload (only supplied fields are applied)
|
|
194
|
+
* @returns The updated case note
|
|
195
|
+
*/
|
|
196
|
+
async updateNote(caseId, noteId, data) {
|
|
197
|
+
const response = await this.updateNoteRaw(caseId, noteId, data);
|
|
198
|
+
if (!response.data) {
|
|
199
|
+
throw new Error(`Failed to update note ${noteId} on care case ${caseId}`);
|
|
200
|
+
}
|
|
201
|
+
return response.data;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Update a case note with full response
|
|
205
|
+
* @param caseId - The case ID
|
|
206
|
+
* @param noteId - The note ID
|
|
207
|
+
* @param data - Partial note payload
|
|
208
|
+
* @returns ResponseData with the updated case note
|
|
209
|
+
*/
|
|
210
|
+
updateNoteRaw(caseId, noteId, data) {
|
|
211
|
+
const url = this.buildUrl(`${caseId}/notes/${noteId}`);
|
|
212
|
+
return this.http.put(url, data);
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Delete a case note
|
|
216
|
+
* @param caseId - The case ID
|
|
217
|
+
* @param noteId - The note ID
|
|
218
|
+
* @returns True if deleted successfully
|
|
219
|
+
*/
|
|
220
|
+
async deleteNote(caseId, noteId) {
|
|
221
|
+
const response = await this.deleteNoteRaw(caseId, noteId);
|
|
222
|
+
return response.success;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Delete a case note with full response
|
|
226
|
+
* @param caseId - The case ID
|
|
227
|
+
* @param noteId - The note ID
|
|
228
|
+
* @returns ResponseData (success/fail)
|
|
229
|
+
*/
|
|
230
|
+
deleteNoteRaw(caseId, noteId) {
|
|
231
|
+
const url = this.buildUrl(`${caseId}/notes/${noteId}`);
|
|
232
|
+
return this.http.delete(url);
|
|
233
|
+
}
|
|
189
234
|
/**
|
|
190
235
|
* Attach a file to a case
|
|
191
236
|
* @param caseId - The case ID
|
|
@@ -209,6 +254,26 @@ export class CareCaseService extends CrudService {
|
|
|
209
254
|
const url = this.buildUrl(`${caseId}/files`);
|
|
210
255
|
return this.http.post(url, file);
|
|
211
256
|
}
|
|
257
|
+
/**
|
|
258
|
+
* Delete a case file
|
|
259
|
+
* @param caseId - The case ID
|
|
260
|
+
* @param fileId - The file ID
|
|
261
|
+
* @returns True if deleted successfully
|
|
262
|
+
*/
|
|
263
|
+
async deleteFile(caseId, fileId) {
|
|
264
|
+
const response = await this.deleteFileRaw(caseId, fileId);
|
|
265
|
+
return response.success;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Delete a case file with full response
|
|
269
|
+
* @param caseId - The case ID
|
|
270
|
+
* @param fileId - The file ID
|
|
271
|
+
* @returns ResponseData (success/fail)
|
|
272
|
+
*/
|
|
273
|
+
deleteFileRaw(caseId, fileId) {
|
|
274
|
+
const url = this.buildUrl(`${caseId}/files/${fileId}`);
|
|
275
|
+
return this.http.delete(url);
|
|
276
|
+
}
|
|
212
277
|
}
|
|
213
278
|
CareCaseService.DEFAULT_SERVICE_PATH = 'ac-counselling';
|
|
214
279
|
CareCaseService.BASE_PATH = 'api/care-cases';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CareCaseService.js","sourceRoot":"","sources":["../../../src/services/accounselling/CareCaseService.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"CareCaseService.js","sourceRoot":"","sources":["../../../src/services/accounselling/CareCaseService.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAkBlD;;;GAGG;AACH,MAAM,OAAO,eAAgB,SAAQ,WAA4D;IAI/F,YAAY,IAAgB,EAAE,MAAsB;QAClD,KAAK,CAAC,IAAI,EAAE;YACV,WAAW,EAAE,MAAM,EAAE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irror of the Kotlin
|
|
6
|
+
* `DashboardAggregatorService` / Swift `DashboardAggregatorService`.
|
|
7
|
+
*
|
|
8
|
+
* Like the {@link ApplicationCatalogueService}, the aggregator is **not** behind
|
|
9
|
+
* a microservice path prefix — it is reached directly at `/api/dashboard`
|
|
10
|
+
* (nginx `location /api/dashboard/`). It therefore does not extend
|
|
11
|
+
* {@link BaseService}; it builds its own paths.
|
|
12
|
+
*
|
|
13
|
+
* Routes:
|
|
14
|
+
* - GET /api/dashboard/me?widgets=&refresh=
|
|
15
|
+
* - GET /api/dashboard/detail?widget=&item=
|
|
16
|
+
*
|
|
17
|
+
* The aggregator always answers `200` — per-widget failures are isolated inside
|
|
18
|
+
* the payload as {@link DashboardWidget.error}, so the Hub renders an error tile
|
|
19
|
+
* for one widget without losing the whole dashboard.
|
|
20
|
+
*
|
|
21
|
+
* Decoding tolerates both the standard {@link ResponseData} envelope (the
|
|
22
|
+
* documented shape) and a bare-object payload (a deployment that drops the
|
|
23
|
+
* envelope) — matching the Kotlin/Swift unknown-tolerant decoding.
|
|
24
|
+
*/
|
|
25
|
+
import type { HttpClient } from '../../core/HttpClient';
|
|
26
|
+
import type { ServiceConfig } from '../types';
|
|
27
|
+
import type { DashboardResponse, WidgetCatalogItem, WidgetDetailResult } from '../../models/dashboard';
|
|
28
|
+
export declare class DashboardAggregatorService {
|
|
29
|
+
private readonly http;
|
|
30
|
+
/** Base path of the dashboard API. `servicePath` override relocates it. */
|
|
31
|
+
private readonly basePath;
|
|
32
|
+
constructor(http: HttpClient, config?: ServiceConfig);
|
|
33
|
+
/**
|
|
34
|
+
* Fetch the calling user's composed dashboard via `GET /api/dashboard/me`.
|
|
35
|
+
*
|
|
36
|
+
* @param widgets - The widget ids to request. An empty list omits the
|
|
37
|
+
* `widgets` query param entirely, so the server returns the role-based
|
|
38
|
+
* Phase-1 defaults (`task.my-open-count`, `task.due-today`,
|
|
39
|
+
* `task.recently-assigned`, `hr.next-leave`, `proc.pending-approvals`).
|
|
40
|
+
* @param refresh - When `true`, appends `refresh=true` to bypass the server
|
|
41
|
+
* cache — the pull-to-refresh path.
|
|
42
|
+
*/
|
|
43
|
+
fetchDashboard(widgets?: string[], refresh?: boolean): Promise<DashboardResponse>;
|
|
44
|
+
/**
|
|
45
|
+
* Fetch the enriched detail for one tapped widget row via
|
|
46
|
+
* `GET /api/dashboard/detail?widget=&item=`. Resolves to `null` when the domain
|
|
47
|
+
* has no richer detail (HTTP 404) — the Hub keeps the inline row detail.
|
|
48
|
+
*/
|
|
49
|
+
fetchWidgetDetail(widgetId: string, itemId: string): Promise<WidgetDetailResult | null>;
|
|
50
|
+
/**
|
|
51
|
+
* Fetch the widget catalog via `GET /api/dashboard/widgets` — every addable
|
|
52
|
+
* widget with its title, description, kind, category, supported containers,
|
|
53
|
+
* and settings schema. Drives the Hub's add-picker + settings sheet.
|
|
54
|
+
*
|
|
55
|
+
* Envelope-tolerant exactly like {@link fetchDashboard}: unwraps a
|
|
56
|
+
* {@link ResponseData} envelope's `data`, falls back to a bare array.
|
|
57
|
+
*
|
|
58
|
+
* Falls back to the **bundled catalog** ({@link BUNDLED_WIDGET_CATALOG}) when
|
|
59
|
+
* the server returns nothing or the endpoint is unavailable (e.g. an aggregator
|
|
60
|
+
* deployment that predates `GET /widgets`) — so the editor keeps working before
|
|
61
|
+
* the catalog endpoint ships. Never rejects.
|
|
62
|
+
*/
|
|
63
|
+
fetchWidgetCatalog(): Promise<WidgetCatalogItem[]>;
|
|
64
|
+
/** Raw server fetch — used by {@link fetchWidgetCatalog}, which adds the bundled fallback. */
|
|
65
|
+
private fetchWidgetCatalogFromServer;
|
|
66
|
+
/**
|
|
67
|
+
* GET `url` and decode tolerantly: try the bare/raw body first (which also
|
|
68
|
+
* unwraps a `ResponseData` envelope's `data`), so both the documented
|
|
69
|
+
* envelope and an envelope-less deployment resolve to a {@link DashboardResponse}.
|
|
70
|
+
*/
|
|
71
|
+
private fetchTolerant;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=DashboardAggregatorService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DashboardAggregatorService.d.ts","sourceRoot":"","sources":["../../../src/services/dashboard/DashboardAggregatorService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,wBAAwB,CAAC;AAMhC,qBAAa,0BAA0B;IACrC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAa;IAClC,2EAA2E;IAC3E,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;gBAEtB,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,aAAa;IAQpD;;;;;;;;;OASG;IACG,cAAc,CAClB,OAAO,GAAE,MAAM,EAAO,EACtB,OAAO,UAAQ,GACd,OAAO,CAAC,iBAAiB,CAAC;IAiB7B;;;;OAIG;IACG,iBAAiB,CACrB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;IAsBrC;;;;;;;;;;;;OAYG;IACG,kBAAkB,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC;IASxD,8FAA8F;YAChF,4BAA4B;IAgB1C;;;;OAIG;YACW,aAAa;CAQ5B"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DashboardAggregatorService
|
|
3
|
+
*
|
|
4
|
+
* Reads the cross-domain "my day at CCMS" dashboard composed by the new
|
|
5
|
+
* `CCMS.Api.DashboardAggregator` service. The TS mirror of the Kotlin
|
|
6
|
+
* `DashboardAggregatorService` / Swift `DashboardAggregatorService`.
|
|
7
|
+
*
|
|
8
|
+
* Like the {@link ApplicationCatalogueService}, the aggregator is **not** behind
|
|
9
|
+
* a microservice path prefix — it is reached directly at `/api/dashboard`
|
|
10
|
+
* (nginx `location /api/dashboard/`). It therefore does not extend
|
|
11
|
+
* {@link BaseService}; it builds its own paths.
|
|
12
|
+
*
|
|
13
|
+
* Routes:
|
|
14
|
+
* - GET /api/dashboard/me?widgets=&refresh=
|
|
15
|
+
* - GET /api/dashboard/detail?widget=&item=
|
|
16
|
+
*
|
|
17
|
+
* The aggregator always answers `200` — per-widget failures are isolated inside
|
|
18
|
+
* the payload as {@link DashboardWidget.error}, so the Hub renders an error tile
|
|
19
|
+
* for one widget without losing the whole dashboard.
|
|
20
|
+
*
|
|
21
|
+
* Decoding tolerates both the standard {@link ResponseData} envelope (the
|
|
22
|
+
* documented shape) and a bare-object payload (a deployment that drops the
|
|
23
|
+
* envelope) — matching the Kotlin/Swift unknown-tolerant decoding.
|
|
24
|
+
*/
|
|
25
|
+
import { BUNDLED_WIDGET_CATALOG } from '../../models/dashboard';
|
|
26
|
+
/** Default base path of the dashboard API (not microservice-prefixed). */
|
|
27
|
+
const DEFAULT_BASE_PATH = 'api/dashboard';
|
|
28
|
+
export class DashboardAggregatorService {
|
|
29
|
+
constructor(http, config) {
|
|
30
|
+
this.http = http;
|
|
31
|
+
this.basePath =
|
|
32
|
+
config?.servicePath && config.servicePath.trim() !== ''
|
|
33
|
+
? config.servicePath
|
|
34
|
+
: DEFAULT_BASE_PATH;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Fetch the calling user's composed dashboard via `GET /api/dashboard/me`.
|
|
38
|
+
*
|
|
39
|
+
* @param widgets - The widget ids to request. An empty list omits the
|
|
40
|
+
* `widgets` query param entirely, so the server returns the role-based
|
|
41
|
+
* Phase-1 defaults (`task.my-open-count`, `task.due-today`,
|
|
42
|
+
* `task.recently-assigned`, `hr.next-leave`, `proc.pending-approvals`).
|
|
43
|
+
* @param refresh - When `true`, appends `refresh=true` to bypass the server
|
|
44
|
+
* cache — the pull-to-refresh path.
|
|
45
|
+
*/
|
|
46
|
+
async fetchDashboard(widgets = [], refresh = false) {
|
|
47
|
+
const params = [];
|
|
48
|
+
const cleaned = widgets.filter((w) => w.trim() !== '');
|
|
49
|
+
if (cleaned.length > 0) {
|
|
50
|
+
params.push(`widgets=${encodeURIComponent(cleaned.join(','))}`);
|
|
51
|
+
}
|
|
52
|
+
if (refresh) {
|
|
53
|
+
params.push('refresh=true');
|
|
54
|
+
}
|
|
55
|
+
const suffix = params.length === 0 ? '' : `?${params.join('&')}`;
|
|
56
|
+
const url = `/${this.basePath}/me${suffix}`;
|
|
57
|
+
return this.fetchTolerant(url);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Fetch the enriched detail for one tapped widget row via
|
|
61
|
+
* `GET /api/dashboard/detail?widget=&item=`. Resolves to `null` when the domain
|
|
62
|
+
* has no richer detail (HTTP 404) — the Hub keeps the inline row detail.
|
|
63
|
+
*/
|
|
64
|
+
async fetchWidgetDetail(widgetId, itemId) {
|
|
65
|
+
const url = `/${this.basePath}/detail` +
|
|
66
|
+
`?widget=${encodeURIComponent(widgetId)}&item=${encodeURIComponent(itemId)}`;
|
|
67
|
+
try {
|
|
68
|
+
const raw = await this.http.getRaw(url);
|
|
69
|
+
const maybeEnvelope = raw;
|
|
70
|
+
if (typeof maybeEnvelope.success === 'boolean') {
|
|
71
|
+
return maybeEnvelope.data ?? null;
|
|
72
|
+
}
|
|
73
|
+
return raw ?? null;
|
|
74
|
+
}
|
|
75
|
+
catch (err) {
|
|
76
|
+
// 404 = no detail for this item; any other error also degrades to inline.
|
|
77
|
+
const status = err?.status
|
|
78
|
+
?? err?.statusCode;
|
|
79
|
+
if (status === 404)
|
|
80
|
+
return null;
|
|
81
|
+
throw err;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Fetch the widget catalog via `GET /api/dashboard/widgets` — every addable
|
|
86
|
+
* widget with its title, description, kind, category, supported containers,
|
|
87
|
+
* and settings schema. Drives the Hub's add-picker + settings sheet.
|
|
88
|
+
*
|
|
89
|
+
* Envelope-tolerant exactly like {@link fetchDashboard}: unwraps a
|
|
90
|
+
* {@link ResponseData} envelope's `data`, falls back to a bare array.
|
|
91
|
+
*
|
|
92
|
+
* Falls back to the **bundled catalog** ({@link BUNDLED_WIDGET_CATALOG}) when
|
|
93
|
+
* the server returns nothing or the endpoint is unavailable (e.g. an aggregator
|
|
94
|
+
* deployment that predates `GET /widgets`) — so the editor keeps working before
|
|
95
|
+
* the catalog endpoint ships. Never rejects.
|
|
96
|
+
*/
|
|
97
|
+
async fetchWidgetCatalog() {
|
|
98
|
+
try {
|
|
99
|
+
const items = await this.fetchWidgetCatalogFromServer();
|
|
100
|
+
return items.length > 0 ? items : BUNDLED_WIDGET_CATALOG;
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
return BUNDLED_WIDGET_CATALOG;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/** Raw server fetch — used by {@link fetchWidgetCatalog}, which adds the bundled fallback. */
|
|
107
|
+
async fetchWidgetCatalogFromServer() {
|
|
108
|
+
const url = `/${this.basePath}/widgets`;
|
|
109
|
+
const raw = await this.http.getRaw(url);
|
|
110
|
+
const maybeEnvelope = raw;
|
|
111
|
+
// Standard CCMS envelope — the documented shape.
|
|
112
|
+
if (typeof maybeEnvelope.success === 'boolean') {
|
|
113
|
+
return maybeEnvelope.data ?? [];
|
|
114
|
+
}
|
|
115
|
+
// Bare-array fallback (a deployment that drops the envelope).
|
|
116
|
+
return Array.isArray(raw) ? raw : [];
|
|
117
|
+
}
|
|
118
|
+
// ---- Decoding helper (tolerates both enveloped and bare payloads) ----
|
|
119
|
+
/**
|
|
120
|
+
* GET `url` and decode tolerantly: try the bare/raw body first (which also
|
|
121
|
+
* unwraps a `ResponseData` envelope's `data`), so both the documented
|
|
122
|
+
* envelope and an envelope-less deployment resolve to a {@link DashboardResponse}.
|
|
123
|
+
*/
|
|
124
|
+
async fetchTolerant(url) {
|
|
125
|
+
// `getRaw` returns the parsed body without enforcing the envelope, so it
|
|
126
|
+
// tolerates a bare-object payload as well as the standard envelope.
|
|
127
|
+
const raw = await this.http.getRaw(url);
|
|
128
|
+
return unwrapDashboardEnvelope(raw);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Resolve a {@link DashboardResponse} from either the standard
|
|
133
|
+
* {@link ResponseData} envelope or a bare object.
|
|
134
|
+
*/
|
|
135
|
+
function unwrapDashboardEnvelope(raw) {
|
|
136
|
+
const maybeEnvelope = raw;
|
|
137
|
+
// Standard CCMS envelope — the documented shape.
|
|
138
|
+
if (typeof maybeEnvelope.success === 'boolean' &&
|
|
139
|
+
maybeEnvelope.data != null) {
|
|
140
|
+
return maybeEnvelope.data;
|
|
141
|
+
}
|
|
142
|
+
// Bare-object fallback (a deployment that drops the envelope).
|
|
143
|
+
return raw;
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=DashboardAggregatorService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DashboardAggregatorService.js","sourceRoot":"","sources":["../../../src/services/dashboard/DashboardAggregatorService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAWH,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,0EAA0E;AAC1E,MAAM,iBAAiB,GAAG,eAAe,CAAC;AAE1C,MAAM,OAAO,0BAA0B;IAKrC,YAAY,IAAgB,EAAE,MAAsB;QAClD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ;YACX,MAAM,EAAE,WAAW,IAAI,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE;gBACrD,CAAC,CAAC,MAAM,CAAC,WAAW;gBACpB,CAAC,CAAC,iBAAiB,CAAC;IAC1B,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK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,CAEhC,GAAG,CAAC,CAAC;QACP,OAAO,uBAAuB,CAAC,GAAG,CAAC,CAAC;IACtC,CAAC;CACF;AAED;;;GAGG;AACH,SAAS,uBAAuB,CAC9B,GAAwD;IAExD,MAAM,aAAa,GAAG,GAA+C,CAAC;IACtE,iDAAiD;IACjD,IACE,OAAO,aAAa,CAAC,OAAO,KAAK,SAAS;QAC1C,aAAa,CAAC,IAAI,IAAI,IAAI,EAC1B,CAAC;QACD,OAAO,aAAa,CAAC,IAAI,CAAC;IAC5B,CAAC;IACD,+DAA+D;IAC/D,OAAO,GAAwB,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DashboardLayoutService
|
|
3
|
+
*
|
|
4
|
+
* Reads and writes the calling user's personalised dashboard layout (widget
|
|
5
|
+
* set, order, per-widget settings) via the new `CCMS.Api.DashboardAggregator`
|
|
6
|
+
* endpoints. The TS mirror of the Kotlin `DashboardLayoutService` / Swift
|
|
7
|
+
* `DashboardLayoutService`.
|
|
8
|
+
*
|
|
9
|
+
* Like {@link DashboardAggregatorService}, this service is **not** behind a
|
|
10
|
+
* microservice path prefix — the layout endpoints sit directly under
|
|
11
|
+
* `/api/dashboard/me/layout` (nginx `location /api/dashboard/`). It therefore
|
|
12
|
+
* does not extend {@link BaseService}; it builds its own paths.
|
|
13
|
+
*
|
|
14
|
+
* Locked cross-platform contract (`05_DASHBOARD_EXPERIENCE.md`):
|
|
15
|
+
* - GET /api/dashboard/me/layout → `ResponseData<DashboardLayout>`
|
|
16
|
+
* - PUT /api/dashboard/me/layout body `DashboardLayout` → `ResponseData<DashboardLayout>`
|
|
17
|
+
*
|
|
18
|
+
* Decoding tolerates both the standard {@link ResponseData} envelope (the
|
|
19
|
+
* documented shape) and a bare-object payload — matching the Kotlin/Swift
|
|
20
|
+
* unknown-tolerant decoding.
|
|
21
|
+
*/
|
|
22
|
+
import type { HttpClient } from '../../core/HttpClient';
|
|
23
|
+
import type { ServiceConfig } from '../types';
|
|
24
|
+
import type { DashboardLayout } from '../../models/dashboard';
|
|
25
|
+
export declare class DashboardLayoutService {
|
|
26
|
+
private readonly http;
|
|
27
|
+
/** Base path of the dashboard API. `servicePath` override relocates it. */
|
|
28
|
+
private readonly basePath;
|
|
29
|
+
constructor(http: HttpClient, config?: ServiceConfig);
|
|
30
|
+
/**
|
|
31
|
+
* Fetch the calling user's saved dashboard layout via
|
|
32
|
+
* `GET /api/dashboard/me/layout`.
|
|
33
|
+
*
|
|
34
|
+
* A first-time user with no saved layout still gets a `200` — the server
|
|
35
|
+
* returns the role-based default layout — so callers never special-case a
|
|
36
|
+
* `404`.
|
|
37
|
+
*/
|
|
38
|
+
fetchLayout(): Promise<DashboardLayout>;
|
|
39
|
+
/**
|
|
40
|
+
* Persist `layout` via `PUT /api/dashboard/me/layout` and return the
|
|
41
|
+
* server-canonical layout (the server re-stamps {@link DashboardLayout.updatedAt}
|
|
42
|
+
* and may normalise widget order).
|
|
43
|
+
*/
|
|
44
|
+
saveLayout(layout: DashboardLayout): Promise<DashboardLayout>;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=DashboardLayoutService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DashboardLayoutService.d.ts","sourceRoot":"","sources":["../../../src/services/dashboard/DashboardLayoutService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAK9D,qBAAa,sBAAsB;IACjC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAa;IAClC,2EAA2E;IAC3E,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;gBAEtB,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,aAAa;IAQpD;;;;;;;OAOG;IACG,WAAW,IAAI,OAAO,CAAC,eAAe,CAAC;IAU7C;;;;OAIG;IACG,UAAU,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;CASpE"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DashboardLayoutService
|
|
3
|
+
*
|
|
4
|
+
* Reads and writes the calling user's personalised dashboard layout (widget
|
|
5
|
+
* set, order, per-widget settings) via the new `CCMS.Api.DashboardAggregator`
|
|
6
|
+
* endpoints. The TS mirror of the Kotlin `DashboardLayoutService` / Swift
|
|
7
|
+
* `DashboardLayoutService`.
|
|
8
|
+
*
|
|
9
|
+
* Like {@link DashboardAggregatorService}, this service is **not** behind a
|
|
10
|
+
* microservice path prefix — the layout endpoints sit directly under
|
|
11
|
+
* `/api/dashboard/me/layout` (nginx `location /api/dashboard/`). It therefore
|
|
12
|
+
* does not extend {@link BaseService}; it builds its own paths.
|
|
13
|
+
*
|
|
14
|
+
* Locked cross-platform contract (`05_DASHBOARD_EXPERIENCE.md`):
|
|
15
|
+
* - GET /api/dashboard/me/layout → `ResponseData<DashboardLayout>`
|
|
16
|
+
* - PUT /api/dashboard/me/layout body `DashboardLayout` → `ResponseData<DashboardLayout>`
|
|
17
|
+
*
|
|
18
|
+
* Decoding tolerates both the standard {@link ResponseData} envelope (the
|
|
19
|
+
* documented shape) and a bare-object payload — matching the Kotlin/Swift
|
|
20
|
+
* unknown-tolerant decoding.
|
|
21
|
+
*/
|
|
22
|
+
/** Default base path of the dashboard API (not microservice-prefixed). */
|
|
23
|
+
const DEFAULT_BASE_PATH = 'api/dashboard';
|
|
24
|
+
export class DashboardLayoutService {
|
|
25
|
+
constructor(http, config) {
|
|
26
|
+
this.http = http;
|
|
27
|
+
this.basePath =
|
|
28
|
+
config?.servicePath && config.servicePath.trim() !== ''
|
|
29
|
+
? config.servicePath
|
|
30
|
+
: DEFAULT_BASE_PATH;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Fetch the calling user's saved dashboard layout via
|
|
34
|
+
* `GET /api/dashboard/me/layout`.
|
|
35
|
+
*
|
|
36
|
+
* A first-time user with no saved layout still gets a `200` — the server
|
|
37
|
+
* returns the role-based default layout — so callers never special-case a
|
|
38
|
+
* `404`.
|
|
39
|
+
*/
|
|
40
|
+
async fetchLayout() {
|
|
41
|
+
const url = `/${this.basePath}/me/layout`;
|
|
42
|
+
// `getRaw` returns the parsed body without enforcing the envelope, so it
|
|
43
|
+
// tolerates a bare-object payload as well as the standard envelope.
|
|
44
|
+
const raw = await this.http.getRaw(url);
|
|
45
|
+
return unwrapLayoutEnvelope(raw);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Persist `layout` via `PUT /api/dashboard/me/layout` and return the
|
|
49
|
+
* server-canonical layout (the server re-stamps {@link DashboardLayout.updatedAt}
|
|
50
|
+
* and may normalise widget order).
|
|
51
|
+
*/
|
|
52
|
+
async saveLayout(layout) {
|
|
53
|
+
const url = `/${this.basePath}/me/layout`;
|
|
54
|
+
// The documented PUT contract is the standard envelope; `put` unwraps it.
|
|
55
|
+
const response = await this.http.put(url, layout);
|
|
56
|
+
if (response.data == null) {
|
|
57
|
+
throw new Error(response.message ?? 'Failed to save dashboard layout');
|
|
58
|
+
}
|
|
59
|
+
return response.data;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Resolve a {@link DashboardLayout} from either the standard
|
|
64
|
+
* {@link ResponseData} envelope or a bare object.
|
|
65
|
+
*/
|
|
66
|
+
function unwrapLayoutEnvelope(raw) {
|
|
67
|
+
const maybeEnvelope = raw;
|
|
68
|
+
// Standard CCMS envelope — the documented shape.
|
|
69
|
+
if (typeof maybeEnvelope.success === 'boolean' && maybeEnvelope.data != null) {
|
|
70
|
+
return maybeEnvelope.data;
|
|
71
|
+
}
|
|
72
|
+
// Bare-object fallback (a deployment that drops the envelope).
|
|
73
|
+
return raw;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=DashboardLayoutService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DashboardLayoutService.js","sourceRoot":"","sources":["../../../src/services/dashboard/DashboardLayoutService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAOH,0EAA0E;AAC1E,MAAM,iBAAiB,GAAG,eAAe,CAAC;AAE1C,MAAM,OAAO,sBAAsB;IAKjC,YAAY,IAAgB,EAAE,MAAsB;QAClD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ;YACX,MAAM,EAAE,WAAW,IAAI,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE;gBACrD,CAAC,CAAC,MAAM,CAAC,WAAW;gBACpB,CAAC,CAAC,iBAAiB,CAAC;IAC1B,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,WAAW;QACf,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,QAAQ,YAAY,CAAC;QAC1C,yEAAyE;QACzE,oEAAoE;QACpE,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAEhC,GAAG,CAAC,CAAC;QACP,OAAO,oBAAoB,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,UAAU,CAAC,MAAuB;QACtC,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,QAAQ,YAAY,CAAC;QAC1C,0EAA0E;QAC1E,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAkB,GAAG,EAAE,MAAM,CAAC,CAAC;QACnE,IAAI,QAAQ,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,OAAO,IAAI,iCAAiC,CAAC,CAAC;QACzE,CAAC;QACD,OAAO,QAAQ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