@hmcts/ccd-case-ui-toolkit 7.3.76 → 7.3.77-4923
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -0
- package/core/index.d.ts +110 -0
- package/core/index.d.ts.map +1 -0
- package/fesm2022/hmcts-ccd-case-ui-toolkit-core.mjs +177 -0
- package/fesm2022/hmcts-ccd-case-ui-toolkit-core.mjs.map +1 -0
- package/fesm2022/hmcts-ccd-case-ui-toolkit-json-utils.mjs +20 -0
- package/fesm2022/hmcts-ccd-case-ui-toolkit-json-utils.mjs.map +1 -0
- package/fesm2022/hmcts-ccd-case-ui-toolkit.mjs +312 -165
- package/fesm2022/hmcts-ccd-case-ui-toolkit.mjs.map +1 -1
- package/index.d.ts +35 -15
- package/index.d.ts.map +1 -1
- package/json-utils/index.d.ts +4 -0
- package/json-utils/index.d.ts.map +1 -0
- package/package.json +11 -3
package/README.md
CHANGED
|
@@ -7,6 +7,18 @@
|
|
|
7
7
|
|
|
8
8
|
# Quick Start (for local development and testing)
|
|
9
9
|
|
|
10
|
+
## Lightweight entry points
|
|
11
|
+
|
|
12
|
+
Import lightweight utilities from their focused entry point so consumers do not
|
|
13
|
+
make the complete component library reachable from application-shell code:
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { safeJsonParse } from '@hmcts/ccd-case-ui-toolkit/json-utils';
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
The root `@hmcts/ccd-case-ui-toolkit` export remains supported for backwards
|
|
20
|
+
compatibility.
|
|
21
|
+
|
|
10
22
|
```bash
|
|
11
23
|
# Install all dependencies
|
|
12
24
|
yarn install
|
package/core/index.d.ts
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken } from '@angular/core';
|
|
3
|
+
import { CanActivate, Router } from '@angular/router';
|
|
4
|
+
|
|
5
|
+
declare abstract class AbstractAppConfig {
|
|
6
|
+
abstract load(): Promise<void>;
|
|
7
|
+
abstract getLoginUrl(): string;
|
|
8
|
+
abstract getApiUrl(): string;
|
|
9
|
+
abstract getCaseDataUrl(): string;
|
|
10
|
+
abstract getDocumentManagementUrl(): string;
|
|
11
|
+
abstract getDocumentManagementUrlV2(): string;
|
|
12
|
+
abstract getCdamExclusionList(): string;
|
|
13
|
+
abstract getDocumentSecureModeCaseTypeExclusions(): string;
|
|
14
|
+
abstract getRemoteDocumentManagementUrl(): string;
|
|
15
|
+
abstract getHrsUrl(): string;
|
|
16
|
+
abstract getRemoteHrsUrl(): string;
|
|
17
|
+
abstract getAnnotationApiUrl(): string;
|
|
18
|
+
abstract getPostcodeLookupUrl(): string;
|
|
19
|
+
abstract getOAuth2ClientId(): string;
|
|
20
|
+
abstract getPaymentsUrl(): string;
|
|
21
|
+
abstract getPayBulkScanBaseUrl(): string;
|
|
22
|
+
abstract getCreateOrUpdateDraftsUrl(ctid: string): string;
|
|
23
|
+
abstract getViewOrDeleteDraftsUrl(did: string): string;
|
|
24
|
+
abstract getActivityUrl(): string;
|
|
25
|
+
abstract getActivityNexPollRequestMs(): number;
|
|
26
|
+
abstract getActivityRetry(): number;
|
|
27
|
+
abstract getTimeoutsForCaseRetrieval(): number[];
|
|
28
|
+
abstract getTimeoutsCaseRetrievalArtificialDelay(): number;
|
|
29
|
+
abstract getActivityBatchCollectionDelayMs(): number;
|
|
30
|
+
abstract getActivityMaxRequestPerBatch(): number;
|
|
31
|
+
abstract getCaseHistoryUrl(caseId: string, eventId: string): string;
|
|
32
|
+
abstract getPrintServiceUrl(): string;
|
|
33
|
+
abstract getIcpEnable(): boolean;
|
|
34
|
+
abstract getIcpJurisdictions(): string[];
|
|
35
|
+
abstract logMessage(logMessage: string): void;
|
|
36
|
+
abstract getEnableServiceSpecificMultiFollowups(): string[];
|
|
37
|
+
abstract getPaginationPageSize(): number;
|
|
38
|
+
abstract getBannersUrl(): string;
|
|
39
|
+
abstract getPrdUrl(): string;
|
|
40
|
+
abstract getCacheTimeOut(): number;
|
|
41
|
+
abstract getWorkAllocationApiUrl(): string;
|
|
42
|
+
abstract getRefundsUrl(): string;
|
|
43
|
+
abstract getNotificationUrl(): string;
|
|
44
|
+
abstract getPaymentReturnUrl(): string;
|
|
45
|
+
abstract getCategoriesAndDocumentsUrl(): string;
|
|
46
|
+
abstract getDocumentDataUrl(): string;
|
|
47
|
+
abstract getCaseFlagsRefdataApiUrl(): string;
|
|
48
|
+
abstract getRDCommonDataApiUrl(): string;
|
|
49
|
+
abstract getCaseDataStoreApiUrl(): string;
|
|
50
|
+
abstract getEventsToHide(): string[];
|
|
51
|
+
getRemotePrintServiceUrl(): string;
|
|
52
|
+
getUserInfoApiUrl(): string;
|
|
53
|
+
getWAServiceConfig(): any;
|
|
54
|
+
getAccessManagementBasicViewMock(): any;
|
|
55
|
+
getAccessManagementRequestReviewMockModel(): any;
|
|
56
|
+
getLocationRefApiUrl(): string;
|
|
57
|
+
getCamRoleAssignmentsApiUrl(): string;
|
|
58
|
+
getEnvironment(): string;
|
|
59
|
+
}
|
|
60
|
+
declare class CaseEditorConfig {
|
|
61
|
+
[key: string]: any;
|
|
62
|
+
}
|
|
63
|
+
declare class WindowService {
|
|
64
|
+
locationAssign(url: string): void;
|
|
65
|
+
setLocalStorage(key: string, value: string): void;
|
|
66
|
+
getLocalStorage(key: string): string | null;
|
|
67
|
+
clearLocalStorage(): void;
|
|
68
|
+
removeLocalStorage(key: string): void;
|
|
69
|
+
setSessionStorage(key: string, value: string): void;
|
|
70
|
+
getSessionStorage(key: string): string | null;
|
|
71
|
+
openOnNewTab(url: string): void;
|
|
72
|
+
confirm(message: string): boolean;
|
|
73
|
+
alert(message: string): void;
|
|
74
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WindowService, never>;
|
|
75
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<WindowService>;
|
|
76
|
+
}
|
|
77
|
+
declare class FocusService {
|
|
78
|
+
readonly elementIdToFocus = "focusService-elementIdToFocus";
|
|
79
|
+
focus(): void;
|
|
80
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FocusService, never>;
|
|
81
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<FocusService>;
|
|
82
|
+
}
|
|
83
|
+
declare class SessionStorageService {
|
|
84
|
+
getItem(key: string): string | null;
|
|
85
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SessionStorageService, never>;
|
|
86
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<SessionStorageService>;
|
|
87
|
+
}
|
|
88
|
+
declare const SessionErrorRoute: InjectionToken<string>;
|
|
89
|
+
type SessionJsonErrorLogger = (error: unknown) => void;
|
|
90
|
+
declare const SessionJsonErrorLogger: InjectionToken<SessionJsonErrorLogger>;
|
|
91
|
+
declare class SessionStorageGuard implements CanActivate {
|
|
92
|
+
private readonly sessionStorageService;
|
|
93
|
+
private readonly router;
|
|
94
|
+
private readonly errorRoute?;
|
|
95
|
+
private readonly errorLogger?;
|
|
96
|
+
constructor(sessionStorageService: SessionStorageService, router: Router, errorRoute?: string, errorLogger?: SessionJsonErrorLogger);
|
|
97
|
+
canActivate(): boolean;
|
|
98
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SessionStorageGuard, [null, null, { optional: true; }, { optional: true; }]>;
|
|
99
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<SessionStorageGuard>;
|
|
100
|
+
}
|
|
101
|
+
declare class SessionErrorPageComponent {
|
|
102
|
+
title: string;
|
|
103
|
+
primaryMessage: string;
|
|
104
|
+
secondaryMessage: string;
|
|
105
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SessionErrorPageComponent, never>;
|
|
106
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SessionErrorPageComponent, "ccd-session-error-page", never, { "title": { "alias": "title"; "required": false; }; "primaryMessage": { "alias": "primaryMessage"; "required": false; }; "secondaryMessage": { "alias": "secondaryMessage"; "required": false; }; }, {}, never, never, true, never>;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export { AbstractAppConfig, CaseEditorConfig, FocusService, SessionErrorPageComponent, SessionErrorRoute, SessionJsonErrorLogger, SessionStorageGuard, WindowService };
|
|
110
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sources":["../../../projects/ccd-case-ui-toolkit/core/src/core.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAIA,uBAAA,iBAAA;AACkB,qBAAA,OAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGT;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAOR;AAED,cAAA,gBAAA;AACE;AACD;AAED,cAAA,aAAA;AAES;;AAEA;AACA;AACA;;AAEA;AACA;AAIA;AACA;;;AACR;AAED,cAAA,YAAA;AAEE;AACO;;;AAGR;AAED,cAAA,qBAAA;AAES;;;AACR;AAGD,cAAA,iBAAA,EAAA,cAAA;AADM,KAAA,sBAAA;AAEN,cAAA,sBAAA,EAAA,cAAA,CAAA,sBAAA;AAEA,cAAA,mBAAA,YAAA,WAAA;;;AAK2C;AACK;AAH3B,uCAAA,qBAAA,UAAA,MAAA,qCAAA,sBAAA;AAMZ;;;AAaR;AAED,cAAA,yBAAA;AAiBkB;AACA;AACA;;;AACjB;;;;"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { Injectable, InjectionToken, Optional, Inject, Component, Input } from '@angular/core';
|
|
4
|
+
import * as i1 from '@angular/router';
|
|
5
|
+
|
|
6
|
+
class AbstractAppConfig {
|
|
7
|
+
getRemotePrintServiceUrl() { return undefined; }
|
|
8
|
+
getUserInfoApiUrl() { return undefined; }
|
|
9
|
+
getWAServiceConfig() { return undefined; }
|
|
10
|
+
getAccessManagementBasicViewMock() { return undefined; }
|
|
11
|
+
getAccessManagementRequestReviewMockModel() { return undefined; }
|
|
12
|
+
getLocationRefApiUrl() { return undefined; }
|
|
13
|
+
getCamRoleAssignmentsApiUrl() { return undefined; }
|
|
14
|
+
getEnvironment() {
|
|
15
|
+
if (this.getActivityUrl()?.includes('.aat.'))
|
|
16
|
+
return 'aat';
|
|
17
|
+
if (this.getActivityUrl()?.includes('.preview.'))
|
|
18
|
+
return 'preview';
|
|
19
|
+
if (this.getActivityUrl()?.includes('.demo.'))
|
|
20
|
+
return 'demo';
|
|
21
|
+
if (this.getActivityUrl()?.includes('.ithc.'))
|
|
22
|
+
return 'ithc';
|
|
23
|
+
return 'prod';
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
class CaseEditorConfig {
|
|
27
|
+
}
|
|
28
|
+
class WindowService {
|
|
29
|
+
locationAssign(url) { window.location.assign(url); }
|
|
30
|
+
setLocalStorage(key, value) { window.localStorage.setItem(key, value); }
|
|
31
|
+
getLocalStorage(key) { return window.localStorage.getItem(key); }
|
|
32
|
+
clearLocalStorage() { window.localStorage.clear(); }
|
|
33
|
+
removeLocalStorage(key) { window.localStorage.removeItem(key); }
|
|
34
|
+
setSessionStorage(key, value) { window.sessionStorage.setItem(key, value); }
|
|
35
|
+
getSessionStorage(key) { return window.sessionStorage.getItem(key); }
|
|
36
|
+
openOnNewTab(url) {
|
|
37
|
+
const openedWindow = window.open(url, '_blank', 'noopener,noreferrer');
|
|
38
|
+
if (openedWindow)
|
|
39
|
+
openedWindow.opener = null;
|
|
40
|
+
}
|
|
41
|
+
confirm(message) { return window.confirm(message); }
|
|
42
|
+
alert(message) { window.alert(message); }
|
|
43
|
+
static ɵfac = function WindowService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || WindowService)(); };
|
|
44
|
+
static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: WindowService, factory: WindowService.ɵfac });
|
|
45
|
+
}
|
|
46
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(WindowService, [{
|
|
47
|
+
type: Injectable
|
|
48
|
+
}], null, null); })();
|
|
49
|
+
class FocusService {
|
|
50
|
+
elementIdToFocus = 'focusService-elementIdToFocus';
|
|
51
|
+
focus() {
|
|
52
|
+
document.getElementById(this.elementIdToFocus)?.focus();
|
|
53
|
+
}
|
|
54
|
+
static ɵfac = function FocusService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || FocusService)(); };
|
|
55
|
+
static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: FocusService, factory: FocusService.ɵfac });
|
|
56
|
+
}
|
|
57
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(FocusService, [{
|
|
58
|
+
type: Injectable
|
|
59
|
+
}], null, null); })();
|
|
60
|
+
class SessionStorageService {
|
|
61
|
+
getItem(key) { return sessionStorage.getItem(key); }
|
|
62
|
+
static ɵfac = function SessionStorageService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || SessionStorageService)(); };
|
|
63
|
+
static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: SessionStorageService, factory: SessionStorageService.ɵfac, providedIn: 'root' });
|
|
64
|
+
}
|
|
65
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SessionStorageService, [{
|
|
66
|
+
type: Injectable,
|
|
67
|
+
args: [{ providedIn: 'root' }]
|
|
68
|
+
}], null, null); })();
|
|
69
|
+
const SessionErrorRoute = new InjectionToken('SessionErrorRoute');
|
|
70
|
+
const SessionJsonErrorLogger = new InjectionToken('SessionJsonErrorLogger');
|
|
71
|
+
class SessionStorageGuard {
|
|
72
|
+
sessionStorageService;
|
|
73
|
+
router;
|
|
74
|
+
errorRoute;
|
|
75
|
+
errorLogger;
|
|
76
|
+
constructor(sessionStorageService, router, errorRoute, errorLogger) {
|
|
77
|
+
this.sessionStorageService = sessionStorageService;
|
|
78
|
+
this.router = router;
|
|
79
|
+
this.errorRoute = errorRoute;
|
|
80
|
+
this.errorLogger = errorLogger;
|
|
81
|
+
}
|
|
82
|
+
canActivate() {
|
|
83
|
+
const userInfo = this.sessionStorageService.getItem('userDetails');
|
|
84
|
+
if (!userInfo)
|
|
85
|
+
return true;
|
|
86
|
+
try {
|
|
87
|
+
JSON.parse(userInfo);
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
const error = new Error('Invalid userDetails in session storage');
|
|
92
|
+
this.errorLogger?.(error);
|
|
93
|
+
this.router.navigate([this.errorRoute || '/session-error']);
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
static ɵfac = function SessionStorageGuard_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || SessionStorageGuard)(i0.ɵɵinject(SessionStorageService), i0.ɵɵinject(i1.Router), i0.ɵɵinject(SessionErrorRoute, 8), i0.ɵɵinject(SessionJsonErrorLogger, 8)); };
|
|
98
|
+
static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: SessionStorageGuard, factory: SessionStorageGuard.ɵfac, providedIn: 'root' });
|
|
99
|
+
}
|
|
100
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SessionStorageGuard, [{
|
|
101
|
+
type: Injectable,
|
|
102
|
+
args: [{ providedIn: 'root' }]
|
|
103
|
+
}], () => [{ type: SessionStorageService }, { type: i1.Router }, { type: undefined, decorators: [{
|
|
104
|
+
type: Optional
|
|
105
|
+
}, {
|
|
106
|
+
type: Inject,
|
|
107
|
+
args: [SessionErrorRoute]
|
|
108
|
+
}] }, { type: SessionJsonErrorLogger, decorators: [{
|
|
109
|
+
type: Optional
|
|
110
|
+
}, {
|
|
111
|
+
type: Inject,
|
|
112
|
+
args: [SessionJsonErrorLogger]
|
|
113
|
+
}] }], null); })();
|
|
114
|
+
class SessionErrorPageComponent {
|
|
115
|
+
title = 'There is a problem with your session';
|
|
116
|
+
primaryMessage = 'Go to landing page. Refreshing the page. If the problem persists, sign out and sign in again.';
|
|
117
|
+
secondaryMessage = 'If you still cannot access the service, clear your browser data for this website.';
|
|
118
|
+
static ɵfac = function SessionErrorPageComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || SessionErrorPageComponent)(); };
|
|
119
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: SessionErrorPageComponent, selectors: [["ccd-session-error-page"]], inputs: { title: "title", primaryMessage: "primaryMessage", secondaryMessage: "secondaryMessage" }, decls: 10, vars: 3, consts: [[1, "govuk-width-container"], ["id", "content", "role", "main", 1, "govuk-main-wrapper", "govuk-main-wrapper--l"], [1, "govuk-grid-row"], [1, "govuk-grid-column-two-thirds"], [1, "govuk-heading-xl"], [1, "govuk-body"]], template: function SessionErrorPageComponent_Template(rf, ctx) { if (rf & 1) {
|
|
120
|
+
i0.ɵɵdomElementStart(0, "div", 0)(1, "main", 1)(2, "div", 2)(3, "div", 3)(4, "h1", 4);
|
|
121
|
+
i0.ɵɵtext(5);
|
|
122
|
+
i0.ɵɵdomElementEnd();
|
|
123
|
+
i0.ɵɵdomElementStart(6, "p", 5);
|
|
124
|
+
i0.ɵɵtext(7);
|
|
125
|
+
i0.ɵɵdomElementEnd();
|
|
126
|
+
i0.ɵɵdomElementStart(8, "p", 5);
|
|
127
|
+
i0.ɵɵtext(9);
|
|
128
|
+
i0.ɵɵdomElementEnd()()()()();
|
|
129
|
+
} if (rf & 2) {
|
|
130
|
+
i0.ɵɵadvance(5);
|
|
131
|
+
i0.ɵɵtextInterpolate(ctx.title);
|
|
132
|
+
i0.ɵɵadvance(2);
|
|
133
|
+
i0.ɵɵtextInterpolate(ctx.primaryMessage);
|
|
134
|
+
i0.ɵɵadvance(2);
|
|
135
|
+
i0.ɵɵtextInterpolate(ctx.secondaryMessage);
|
|
136
|
+
} }, dependencies: [CommonModule], encapsulation: 2 });
|
|
137
|
+
}
|
|
138
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SessionErrorPageComponent, [{
|
|
139
|
+
type: Component,
|
|
140
|
+
args: [{
|
|
141
|
+
selector: 'ccd-session-error-page',
|
|
142
|
+
standalone: true,
|
|
143
|
+
imports: [CommonModule],
|
|
144
|
+
template: `
|
|
145
|
+
<div class="govuk-width-container">
|
|
146
|
+
<main class="govuk-main-wrapper govuk-main-wrapper--l" id="content" role="main">
|
|
147
|
+
<div class="govuk-grid-row"><div class="govuk-grid-column-two-thirds">
|
|
148
|
+
<h1 class="govuk-heading-xl">{{ title }}</h1>
|
|
149
|
+
<p class="govuk-body">{{ primaryMessage }}</p>
|
|
150
|
+
<p class="govuk-body">{{ secondaryMessage }}</p>
|
|
151
|
+
</div></div>
|
|
152
|
+
</main>
|
|
153
|
+
</div>
|
|
154
|
+
`,
|
|
155
|
+
}]
|
|
156
|
+
}], null, { title: [{
|
|
157
|
+
type: Input
|
|
158
|
+
}], primaryMessage: [{
|
|
159
|
+
type: Input
|
|
160
|
+
}], secondaryMessage: [{
|
|
161
|
+
type: Input
|
|
162
|
+
}] }); })();
|
|
163
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(SessionErrorPageComponent, { className: "SessionErrorPageComponent", filePath: "src/core.ts", lineNumber: 147 }); })();
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Lightweight application-shell APIs.
|
|
167
|
+
*
|
|
168
|
+
* Prefer this entry point over the package root for guards, session handling,
|
|
169
|
+
* browser services and application configuration.
|
|
170
|
+
*/
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Generated bundle index. Do not edit.
|
|
174
|
+
*/
|
|
175
|
+
|
|
176
|
+
export { AbstractAppConfig, CaseEditorConfig, FocusService, SessionErrorPageComponent, SessionErrorRoute, SessionJsonErrorLogger, SessionStorageGuard, WindowService };
|
|
177
|
+
//# sourceMappingURL=hmcts-ccd-case-ui-toolkit-core.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hmcts-ccd-case-ui-toolkit-core.mjs","sources":["../../../projects/ccd-case-ui-toolkit/core/src/core.ts","../../../projects/ccd-case-ui-toolkit/core/public-api.ts","../../../projects/ccd-case-ui-toolkit/core/hmcts-ccd-case-ui-toolkit-core.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { Component, Inject, Injectable, InjectionToken, Input, Optional } from '@angular/core';\nimport { CanActivate, Router } from '@angular/router';\n\nexport abstract class AbstractAppConfig {\n public abstract load(): Promise<void>;\n public abstract getLoginUrl(): string;\n public abstract getApiUrl(): string;\n public abstract getCaseDataUrl(): string;\n public abstract getDocumentManagementUrl(): string;\n public abstract getDocumentManagementUrlV2(): string;\n public abstract getCdamExclusionList(): string;\n public abstract getDocumentSecureModeCaseTypeExclusions(): string;\n public abstract getRemoteDocumentManagementUrl(): string;\n public abstract getHrsUrl(): string;\n public abstract getRemoteHrsUrl(): string;\n public abstract getAnnotationApiUrl(): string;\n public abstract getPostcodeLookupUrl(): string;\n public abstract getOAuth2ClientId(): string;\n public abstract getPaymentsUrl(): string;\n public abstract getPayBulkScanBaseUrl(): string;\n public abstract getCreateOrUpdateDraftsUrl(ctid: string): string;\n public abstract getViewOrDeleteDraftsUrl(did: string): string;\n public abstract getActivityUrl(): string;\n public abstract getActivityNexPollRequestMs(): number;\n public abstract getActivityRetry(): number;\n public abstract getTimeoutsForCaseRetrieval(): number[];\n public abstract getTimeoutsCaseRetrievalArtificialDelay(): number;\n public abstract getActivityBatchCollectionDelayMs(): number;\n public abstract getActivityMaxRequestPerBatch(): number;\n public abstract getCaseHistoryUrl(caseId: string, eventId: string): string;\n public abstract getPrintServiceUrl(): string;\n public abstract getIcpEnable(): boolean;\n public abstract getIcpJurisdictions(): string[];\n public abstract logMessage(logMessage: string): void;\n public abstract getEnableServiceSpecificMultiFollowups(): string[];\n public abstract getPaginationPageSize(): number;\n public abstract getBannersUrl(): string;\n public abstract getPrdUrl(): string;\n public abstract getCacheTimeOut(): number;\n public abstract getWorkAllocationApiUrl(): string;\n public abstract getRefundsUrl(): string;\n public abstract getNotificationUrl(): string;\n public abstract getPaymentReturnUrl(): string;\n public abstract getCategoriesAndDocumentsUrl(): string;\n public abstract getDocumentDataUrl(): string;\n public abstract getCaseFlagsRefdataApiUrl(): string;\n public abstract getRDCommonDataApiUrl(): string;\n public abstract getCaseDataStoreApiUrl(): string;\n public abstract getEventsToHide(): string[];\n\n public getRemotePrintServiceUrl(): string { return undefined; }\n public getUserInfoApiUrl(): string { return undefined; }\n public getWAServiceConfig(): any { return undefined; }\n public getAccessManagementBasicViewMock(): any { return undefined; }\n public getAccessManagementRequestReviewMockModel(): any { return undefined; }\n public getLocationRefApiUrl(): string { return undefined; }\n public getCamRoleAssignmentsApiUrl(): string { return undefined; }\n\n public getEnvironment(): string {\n if (this.getActivityUrl()?.includes('.aat.')) return 'aat';\n if (this.getActivityUrl()?.includes('.preview.')) return 'preview';\n if (this.getActivityUrl()?.includes('.demo.')) return 'demo';\n if (this.getActivityUrl()?.includes('.ithc.')) return 'ithc';\n return 'prod';\n }\n}\n\nexport class CaseEditorConfig {\n [key: string]: any;\n}\n\n@Injectable()\nexport class WindowService {\n public locationAssign(url: string): void { window.location.assign(url); }\n public setLocalStorage(key: string, value: string): void { window.localStorage.setItem(key, value); }\n public getLocalStorage(key: string): string | null { return window.localStorage.getItem(key); }\n public clearLocalStorage(): void { window.localStorage.clear(); }\n public removeLocalStorage(key: string): void { window.localStorage.removeItem(key); }\n public setSessionStorage(key: string, value: string): void { window.sessionStorage.setItem(key, value); }\n public getSessionStorage(key: string): string | null { return window.sessionStorage.getItem(key); }\n public openOnNewTab(url: string): void {\n const openedWindow = window.open(url, '_blank', 'noopener,noreferrer');\n if (openedWindow) openedWindow.opener = null;\n }\n public confirm(message: string): boolean { return window.confirm(message); }\n public alert(message: string): void { window.alert(message); }\n}\n\n@Injectable()\nexport class FocusService {\n public readonly elementIdToFocus = 'focusService-elementIdToFocus';\n public focus(): void {\n document.getElementById(this.elementIdToFocus)?.focus();\n }\n}\n\n@Injectable({ providedIn: 'root' })\nclass SessionStorageService {\n public getItem(key: string): string | null { return sessionStorage.getItem(key); }\n}\n\nexport type SessionJsonErrorLogger = (error: unknown) => void;\nexport const SessionErrorRoute = new InjectionToken<string>('SessionErrorRoute');\nexport const SessionJsonErrorLogger = new InjectionToken<SessionJsonErrorLogger>('SessionJsonErrorLogger');\n\n@Injectable({ providedIn: 'root' })\nexport class SessionStorageGuard implements CanActivate {\n constructor(\n private readonly sessionStorageService: SessionStorageService,\n private readonly router: Router,\n @Optional() @Inject(SessionErrorRoute) private readonly errorRoute?: string,\n @Optional() @Inject(SessionJsonErrorLogger) private readonly errorLogger?: SessionJsonErrorLogger\n ) {}\n\n public canActivate(): boolean {\n const userInfo = this.sessionStorageService.getItem('userDetails');\n if (!userInfo) return true;\n try {\n JSON.parse(userInfo);\n return true;\n } catch {\n const error = new Error('Invalid userDetails in session storage');\n this.errorLogger?.(error);\n this.router.navigate([this.errorRoute || '/session-error']);\n return false;\n }\n }\n}\n\n@Component({\n selector: 'ccd-session-error-page',\n standalone: true,\n imports: [CommonModule],\n template: `\n <div class=\"govuk-width-container\">\n <main class=\"govuk-main-wrapper govuk-main-wrapper--l\" id=\"content\" role=\"main\">\n <div class=\"govuk-grid-row\"><div class=\"govuk-grid-column-two-thirds\">\n <h1 class=\"govuk-heading-xl\">{{ title }}</h1>\n <p class=\"govuk-body\">{{ primaryMessage }}</p>\n <p class=\"govuk-body\">{{ secondaryMessage }}</p>\n </div></div>\n </main>\n </div>\n `,\n})\nexport class SessionErrorPageComponent {\n @Input() public title = 'There is a problem with your session';\n @Input() public primaryMessage = 'Go to landing page. Refreshing the page. If the problem persists, sign out and sign in again.';\n @Input() public secondaryMessage = 'If you still cannot access the service, clear your browser data for this website.';\n}\n","/**\n * Lightweight application-shell APIs.\n *\n * Prefer this entry point over the package root for guards, session handling,\n * browser services and application configuration.\n */\nexport * from './src/core';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAIsB,iBAAiB,CAAA;AA+C9B,IAAA,wBAAwB,GAAA,EAAa,OAAO,SAAS,CAAC,CAAC;AACvD,IAAA,iBAAiB,GAAA,EAAa,OAAO,SAAS,CAAC,CAAC;AAChD,IAAA,kBAAkB,GAAA,EAAU,OAAO,SAAS,CAAC,CAAC;AAC9C,IAAA,gCAAgC,GAAA,EAAU,OAAO,SAAS,CAAC,CAAC;AAC5D,IAAA,yCAAyC,GAAA,EAAU,OAAO,SAAS,CAAC,CAAC;AACrE,IAAA,oBAAoB,GAAA,EAAa,OAAO,SAAS,CAAC,CAAC;AACnD,IAAA,2BAA2B,GAAA,EAAa,OAAO,SAAS,CAAC,CAAC;IAE1D,cAAc,GAAA;QACnB,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,QAAQ,CAAC,OAAO,CAAC;AAAE,YAAA,OAAO,KAAK;QAC1D,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,QAAQ,CAAC,WAAW,CAAC;AAAE,YAAA,OAAO,SAAS;QAClE,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,QAAQ,CAAC,QAAQ,CAAC;AAAE,YAAA,OAAO,MAAM;QAC5D,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,QAAQ,CAAC,QAAQ,CAAC;AAAE,YAAA,OAAO,MAAM;AAC5D,QAAA,OAAO,MAAM;IACf;AACD;MAEY,gBAAgB,CAAA;AAE5B;MAGY,aAAa,CAAA;AACjB,IAAA,cAAc,CAAC,GAAW,EAAA,EAAU,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;AACjE,IAAA,eAAe,CAAC,GAAW,EAAE,KAAa,EAAA,EAAU,MAAM,CAAC,YA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AAyB,EAAA,CAAA;cAhBrC,SAAS;AAAC,QAAA,IAAA,EAAA,CAAA;AACT,gBAAA,QAAQ,EAAE,wBAAwB;AAClC,gBAAA,UAAU,EAAE,IAAI;gBAChB,OAAO,EAAE,CAAC,YAAY,CAAC;AACvB,gBAAA,QAAQ,EAAE;;;;;;;;;;AAUT,EAAA,CAAA;AACF,aAAA;;kBAEE;;kBACA;;kBACA;;kFAHU,yBAAyB,EAAA,EAAA,SAAA,EAAA,2BAAA,EAAA,QAAA,EAAA,aAAA,EAAA,UAAA,EAAA,GAAA,EAAA,CAAA,CAAA,CAAA,CAAA,GAAA;;AClJtC;;;;;AAKG;;ACLH;;AAEG;;;;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
function safeJsonParse(value, fallback = null) {
|
|
2
|
+
if (!value) {
|
|
3
|
+
return fallback;
|
|
4
|
+
}
|
|
5
|
+
try {
|
|
6
|
+
return JSON.parse(value);
|
|
7
|
+
}
|
|
8
|
+
catch {
|
|
9
|
+
// Do not include the input or parser error because either may contain user data.
|
|
10
|
+
console.error('safeJsonParse failed to parse JSON.');
|
|
11
|
+
return fallback;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Generated bundle index. Do not edit.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
export { safeJsonParse };
|
|
20
|
+
//# sourceMappingURL=hmcts-ccd-case-ui-toolkit-json-utils.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hmcts-ccd-case-ui-toolkit-json-utils.mjs","sources":["../../../projects/ccd-case-ui-toolkit/json-utils/src/json-utils.ts","../../../projects/ccd-case-ui-toolkit/json-utils/hmcts-ccd-case-ui-toolkit-json-utils.ts"],"sourcesContent":["export function safeJsonParse<T>(value: string | null, fallback: T | null = null): T | null {\n if (!value) {\n return fallback;\n }\n\n try {\n return JSON.parse(value) as T;\n } catch {\n // Do not include the input or parser error because either may contain user data.\n console.error('safeJsonParse failed to parse JSON.');\n return fallback;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"SAAgB,aAAa,CAAI,KAAoB,EAAE,WAAqB,IAAI,EAAA;IAC9E,IAAI,CAAC,KAAK,EAAE;AACV,QAAA,OAAO,QAAQ;IACjB;AAEA,IAAA,IAAI;AACF,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAM;IAC/B;AAAE,IAAA,MAAM;;AAEN,QAAA,OAAO,CAAC,KAAK,CAAC,qCAAqC,CAAC;AACpD,QAAA,OAAO,QAAQ;IACjB;AACF;;ACZA;;AAEG;;;;"}
|