@hmcts/ccd-case-ui-toolkit 7.3.98-pofcc-156 → 7.3.99-cot-1286

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.
@@ -12,11 +12,11 @@ import { BehaviorSubject, throwError, Subject, EMPTY, concat, defer, timer, Obse
12
12
  import { distinctUntilChanged, catchError, map, switchMap, repeat, retry, publish, refCount, debounceTime, delay, finalize, timeout, mergeMap, retryWhen, tap, delayWhen, publishReplay, take, first, takeUntil, filter } from 'rxjs/operators';
13
13
  import * as i1$2 from '@angular/common/http';
14
14
  import { HttpErrorResponse, HttpHeaders, HttpParams, HttpStatusCode } from '@angular/common/http';
15
- import { __decorate, __metadata } from 'tslib';
16
15
  import { Type, Exclude, Expose, plainToClassFromExist, plainToClass } from 'class-transformer';
16
+ import moment from 'moment';
17
+ import { __decorate, __metadata } from 'tslib';
17
18
  import * as _ from 'underscore';
18
19
  import 'reflect-metadata';
19
- import moment from 'moment';
20
20
  import { StateMachine } from '@edium/fsm';
21
21
  import * as i1$3 from '@angular/material/legacy-dialog';
22
22
  import { MAT_LEGACY_DIALOG_DATA, MatLegacyDialogModule } from '@angular/material/legacy-dialog';
@@ -1860,2505 +1860,2407 @@ class SessionStorageGuard {
1860
1860
  args: [SessionJsonErrorLogger]
1861
1861
  }] }], null); })();
1862
1862
 
1863
- // tslint:disable:variable-name
1864
- class AddressModel {
1865
- AddressLine1 = '';
1866
- AddressLine2 = '';
1867
- AddressLine3 = '';
1868
- PostTown = '';
1869
- County = '';
1870
- PostCode = '';
1871
- Country = '';
1872
- }
1873
-
1874
- class Alert {
1875
- level;
1876
- message;
1877
- }
1878
-
1879
- // tslint:disable:variable-name
1880
- class CaseDetails {
1881
- id;
1882
- jurisdiction;
1883
- case_type_id;
1884
- state;
1885
- created_date;
1886
- last_modified;
1887
- locked_by_user_id;
1888
- security_level;
1889
- case_data;
1890
- }
1891
-
1892
- // tslint:disable:variable-name
1893
- class CaseEventData {
1894
- event;
1895
- data;
1896
- event_data; // full event data
1897
- event_token;
1898
- ignore_warning;
1899
- draft_id;
1900
- case_reference;
1901
- }
1902
-
1903
- class WizardPageField {
1904
- case_field_id;
1905
- order;
1906
- page_column_no;
1907
- complex_field_overrides;
1863
+ const USER_DETAILS = 'userDetails';
1864
+ const PUI_CASE_MANAGER = 'pui-case-manager';
1865
+ const JUDGE = 'judge';
1866
+ function getUserDetails(sessionStorageService) {
1867
+ const item = sessionStorageService?.getItem(USER_DETAILS);
1868
+ return safeJsonParse(item, null);
1908
1869
  }
1909
-
1910
- class FixedListItem {
1911
- code;
1912
- label;
1913
- order;
1870
+ function isInternalUser(sessionStorageService) {
1871
+ const userDetails = getUserDetails(sessionStorageService);
1872
+ return !!userDetails?.roles
1873
+ && !(userDetails.roles.includes(PUI_CASE_MANAGER)
1874
+ || userDetails.roles.some((role) => role.toLowerCase().includes(JUDGE)));
1914
1875
  }
1915
-
1916
- // @dynamic
1917
- class FieldType {
1918
- id;
1919
- type;
1920
- min;
1921
- max;
1922
- regular_expression;
1923
- fixed_list_items;
1924
- complex_fields;
1925
- collection_field_type;
1876
+ function isJudiciaryUser(sessionStorageService) {
1877
+ const userDetails = getUserDetails(sessionStorageService);
1878
+ return !!userDetails?.roles
1879
+ && (userDetails.roles.some((role) => role.toLowerCase().includes(JUDGE)));
1926
1880
  }
1927
- __decorate([
1928
- Type(() => FixedListItem),
1929
- __metadata("design:type", Array)
1930
- ], FieldType.prototype, "fixed_list_items", void 0);
1931
- __decorate([
1932
- Type(() => CaseField),
1933
- __metadata("design:type", Array)
1934
- ], FieldType.prototype, "complex_fields", void 0);
1935
- __decorate([
1936
- Type(() => FieldType),
1937
- __metadata("design:type", FieldType)
1938
- ], FieldType.prototype, "collection_field_type", void 0);
1939
1881
 
1940
1882
  // @dynamic
1941
- class CaseField {
1942
- static logger = new StructuredLoggerService();
1943
- id;
1944
- hidden;
1945
- hiddenCannotChange;
1946
- label;
1947
- originalLabel;
1948
- noCacheLabel;
1949
- order;
1950
- parent;
1951
- field_type;
1952
- hint_text;
1953
- security_label;
1954
- display_context;
1955
- display_context_parameter;
1956
- month_format;
1957
- show_condition;
1958
- show_summary_change_option;
1959
- show_summary_content_option;
1960
- acls;
1961
- metadata;
1962
- formatted_value;
1963
- retain_hidden_value;
1964
- wizardProps;
1965
- _value;
1966
- _list_items = [];
1967
- isTranslatedFlag = false;
1968
- get value() {
1969
- if (this.field_type && (this.field_type.type === 'DynamicList' || this.field_type.type === 'DynamicRadioList')) {
1970
- return this._value && this._value.value ? this._value.value.code : this._value;
1971
- }
1972
- else if (this.field_type && this.field_type.type === 'DynamicMultiSelectList') {
1973
- return this._value && this._value.value ? this._value.value : this._value;
1974
- }
1975
- else {
1976
- return this._value;
1977
- }
1883
+ class ActivityService {
1884
+ http;
1885
+ appConfig;
1886
+ sessionStorageService;
1887
+ static get ACTIVITY_VIEW() { return 'view'; }
1888
+ static get ACTIVITY_EDIT() { return 'edit'; }
1889
+ logger = new StructuredLoggerService();
1890
+ constructor(http, appConfig, sessionStorageService) {
1891
+ this.http = http;
1892
+ this.appConfig = appConfig;
1893
+ this.sessionStorageService = sessionStorageService;
1978
1894
  }
1979
- set value(value) {
1980
- if (this.isDynamic()) {
1981
- if (value && value instanceof Object && value.list_items) {
1982
- this._list_items = value.list_items;
1983
- }
1984
- else if (!this._list_items || this._list_items.length === 0) {
1985
- // Extract the list items from the current value if that's the only place they exist.
1986
- this._list_items = this.list_items;
1987
- if (!value || !value.value) {
1988
- value = null;
1989
- }
1990
- }
1991
- }
1992
- this._value = value;
1895
+ get isEnabled() {
1896
+ return this.activityUrl() && this.userAuthorised;
1993
1897
  }
1994
- get list_items() {
1995
- if (this.isDynamic()) {
1996
- return this._value && this._value.list_items ? this._value.list_items : this._list_items;
1997
- }
1998
- else {
1999
- return this.field_type.fixed_list_items;
1898
+ static DUMMY_CASE_REFERENCE = '0';
1899
+ userAuthorised = undefined;
1900
+ static handleHttpError(response) {
1901
+ const error = HttpErrorService.convertToHttpError(response);
1902
+ if (response?.status !== error.status) {
1903
+ error.status = response.status;
2000
1904
  }
1905
+ return error;
2001
1906
  }
2002
- set list_items(items) {
2003
- if ((items && !this._list_items) || (items?.length > this._list_items?.length)) {
2004
- this._list_items = items;
1907
+ getOptions() {
1908
+ const userDetails = safeJsonParse(this.sessionStorageService.getItem(USER_DETAILS));
1909
+ let headers = new HttpHeaders().set('Content-Type', 'application/json');
1910
+ if (userDetails?.token) {
1911
+ headers = headers.set('Authorization', userDetails.token);
2005
1912
  }
1913
+ return {
1914
+ headers,
1915
+ withCredentials: true,
1916
+ observe: 'body',
1917
+ };
2006
1918
  }
2007
- get dateTimeEntryFormat() {
2008
- if (this.isComplexDisplay()) {
2009
- return null;
1919
+ getActivities(...caseId) {
1920
+ try {
1921
+ const options = this.getOptions();
1922
+ const url = `${this.activityUrl()}/cases/${caseId.join(',')}/activity`;
1923
+ return this.http
1924
+ .get(url, options, false, ActivityService.handleHttpError)
1925
+ .pipe(map(response => response));
2010
1926
  }
2011
- if (this.display_context_parameter) {
2012
- return this.extractBracketValue(this.display_context_parameter, '#DATETIMEENTRY');
1927
+ catch (error) {
1928
+ this.logUserMayNotBeAuthenticated(error);
2013
1929
  }
2014
- return null;
2015
1930
  }
2016
- get dateTimeDisplayFormat() {
2017
- if (this.isComplexEntry()) {
2018
- return null;
1931
+ postActivity(caseId, activity) {
1932
+ try {
1933
+ const options = this.getOptions();
1934
+ const url = `${this.activityUrl()}/cases/${caseId}/activity`;
1935
+ const body = { activity };
1936
+ return this.http
1937
+ .post(url, body, options, false)
1938
+ .pipe(map(response => response));
2019
1939
  }
2020
- if (this.display_context_parameter) {
2021
- return this.extractBracketValue(this.display_context_parameter, '#DATETIMEDISPLAY');
1940
+ catch (error) {
1941
+ this.logUserMayNotBeAuthenticated(error);
2022
1942
  }
2023
- return null;
2024
1943
  }
2025
- isComplexDisplay() {
2026
- return (this.isComplex() || this.isCollection()) && this.isReadonly();
1944
+ verifyUserIsAuthorized() {
1945
+ if (this.sessionStorageService.getItem(USER_DETAILS) && this.activityUrl() && this.userAuthorised === undefined) {
1946
+ this.getActivities(ActivityService.DUMMY_CASE_REFERENCE).subscribe(() => this.userAuthorised = true, error => {
1947
+ this.userAuthorised = [401, 403].indexOf(error.status) <= -1;
1948
+ });
1949
+ }
2027
1950
  }
2028
- isComplexEntry() {
2029
- return (this.isComplex() || this.isCollection()) && (this.isOptional() || this.isMandatory());
1951
+ activityUrl() {
1952
+ return this.appConfig.getActivityUrl();
2030
1953
  }
2031
- isReadonly() {
2032
- return !_.isEmpty(this.display_context)
2033
- && this.display_context.toUpperCase() === 'READONLY';
1954
+ logUserMayNotBeAuthenticated(error) {
1955
+ this.logger.error('User may not be authenticated. Activity request was not sent.', { error });
2034
1956
  }
2035
- isOptional() {
2036
- return !_.isEmpty(this.display_context)
2037
- && this.display_context.toUpperCase() === 'OPTIONAL';
1957
+ static ɵfac = function ActivityService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ActivityService)(i0.ɵɵinject(HttpService), i0.ɵɵinject(AbstractAppConfig), i0.ɵɵinject(SessionStorageService)); };
1958
+ static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: ActivityService, factory: ActivityService.ɵfac });
1959
+ }
1960
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ActivityService, [{
1961
+ type: Injectable
1962
+ }], () => [{ type: HttpService }, { type: AbstractAppConfig }, { type: SessionStorageService }], null); })();
1963
+
1964
+ // @dynamic
1965
+ class ActivityPollingService {
1966
+ activityService;
1967
+ ngZone;
1968
+ config;
1969
+ logger = new StructuredLoggerService();
1970
+ pendingRequests = new Map();
1971
+ currentTimeoutHandle;
1972
+ pollActivitiesSubscription;
1973
+ pollConfig;
1974
+ batchCollectionDelayMs;
1975
+ maxRequestsPerBatch;
1976
+ constructor(activityService, ngZone, config) {
1977
+ this.activityService = activityService;
1978
+ this.ngZone = ngZone;
1979
+ this.config = config;
1980
+ this.pollConfig = {
1981
+ interval: config.getActivityNexPollRequestMs(),
1982
+ attempts: config.getActivityRetry()
1983
+ };
1984
+ this.batchCollectionDelayMs = config.getActivityBatchCollectionDelayMs();
1985
+ this.maxRequestsPerBatch = config.getActivityMaxRequestPerBatch();
2038
1986
  }
2039
- isMandatory() {
2040
- return !_.isEmpty(this.display_context)
2041
- && this.display_context.toUpperCase() === 'MANDATORY';
1987
+ get isEnabled() {
1988
+ return this.activityService.isEnabled;
2042
1989
  }
2043
- isCollection() {
2044
- return this.field_type && this.field_type.type === 'Collection';
1990
+ subscribeToActivity(caseId, done) {
1991
+ if (!this.isEnabled) {
1992
+ return new Subject();
1993
+ }
1994
+ let subject = this.pendingRequests.get(caseId);
1995
+ if (subject) {
1996
+ subject.subscribe(done);
1997
+ }
1998
+ else {
1999
+ // Only the first pending request should start the batch collection timer.
2000
+ const wasEmpty = this.pendingRequests.size === 0;
2001
+ subject = new Subject();
2002
+ subject.subscribe(done);
2003
+ this.addPendingRequest(caseId, subject);
2004
+ if (wasEmpty) {
2005
+ this.ngZone.runOutsideAngular(() => {
2006
+ this.currentTimeoutHandle = setTimeout(() => this.ngZone.run(() => {
2007
+ this.flushRequests();
2008
+ }), this.batchCollectionDelayMs);
2009
+ });
2010
+ }
2011
+ }
2012
+ if (this.pendingRequests.size >= this.maxRequestsPerBatch) {
2013
+ this.flushRequests();
2014
+ }
2015
+ return subject;
2045
2016
  }
2046
- isComplex() {
2047
- return this.field_type && this.field_type.type === 'Complex';
2017
+ stopPolling() {
2018
+ if (this.pollActivitiesSubscription) {
2019
+ this.pollActivitiesSubscription.unsubscribe();
2020
+ }
2048
2021
  }
2049
- isDynamic() {
2050
- const dynamicFieldTypes = ['DynamicList', 'DynamicRadioList', 'DynamicMultiSelectList'];
2051
- if (!this.field_type) {
2052
- return false;
2022
+ flushRequests() {
2023
+ if (this.currentTimeoutHandle) {
2024
+ clearTimeout(this.currentTimeoutHandle);
2025
+ this.currentTimeoutHandle = undefined;
2053
2026
  }
2054
- return dynamicFieldTypes.some(t => t === this.field_type.type);
2027
+ if (!this.pendingRequests.size) {
2028
+ return;
2029
+ }
2030
+ const requests = new Map(this.pendingRequests);
2031
+ this.pendingRequests.clear();
2032
+ this.performBatchRequest(requests);
2055
2033
  }
2056
- isCaseLink() {
2057
- return this.isComplex()
2058
- && this.field_type.id === 'CaseLink'
2059
- && this.field_type.complex_fields.some(cf => cf.id === 'CaseReference');
2034
+ pollActivities(...caseIds) {
2035
+ if (!this.isEnabled) {
2036
+ return EMPTY;
2037
+ }
2038
+ return this.polling(this.activityService.getActivities(...caseIds), this.pollConfig);
2060
2039
  }
2061
- extractBracketValue(fmt, paramName, leftBracket = '(', rightBracket = ')') {
2062
- fmt = fmt.split(',')
2063
- .find(a => a.trim().startsWith(paramName));
2064
- if (fmt) {
2065
- const s = fmt.indexOf(leftBracket) + 1;
2066
- const e = fmt.indexOf(rightBracket, s);
2067
- if (e > s && s >= 0) {
2068
- return fmt.substr(s, (e - s));
2069
- }
2040
+ postViewActivity(caseId) {
2041
+ return this.postActivity(caseId, ActivityService.ACTIVITY_VIEW);
2042
+ }
2043
+ postEditActivity(caseId) {
2044
+ return this.postActivity(caseId, ActivityService.ACTIVITY_EDIT);
2045
+ }
2046
+ performBatchRequest(requests) {
2047
+ const caseIds = Array.from(requests.keys()).join();
2048
+ this.ngZone.runOutsideAngular(() => {
2049
+ // run polling outside angular zone so it does not trigger change detection
2050
+ this.pollActivitiesSubscription = this.pollActivities(caseIds).subscribe({
2051
+ // process activity inside zone so it triggers change detection for activity.component.ts
2052
+ next: (activities) => this.ngZone.run(() => {
2053
+ activities.forEach((activity) => {
2054
+ // Ignore activities returned for cases outside this local batch.
2055
+ requests.get(activity.caseId)?.next(activity);
2056
+ });
2057
+ }),
2058
+ error: (err) => this.ngZone.run(() => {
2059
+ this.logger.error('Error while polling activities.', { error: err });
2060
+ Array.from(requests.values()).forEach((subject) => subject.error(err));
2061
+ })
2062
+ });
2063
+ });
2064
+ }
2065
+ postActivity(caseId, activityType) {
2066
+ if (!this.isEnabled) {
2067
+ return EMPTY;
2070
2068
  }
2071
- return null;
2069
+ const pollingConfig = {
2070
+ ...this.pollConfig,
2071
+ interval: 5000 // inline with CCD Backend
2072
+ };
2073
+ return this.polling(this.activityService.postActivity(caseId, activityType), pollingConfig);
2072
2074
  }
2073
- // Ascend the hierarchy to get the full path of the field
2074
- getHierachicalId(curr) {
2075
- const prefix = curr ? curr + "_" : "";
2076
- if (prefix.length < 1024) {
2077
- if (this.parent) {
2078
- return this.parent.getHierachicalId(prefix + this.id);
2079
- }
2080
- else {
2081
- return prefix + this.id;
2082
- }
2075
+ addPendingRequest(caseId, subject) {
2076
+ this.pendingRequests.set(caseId, subject);
2077
+ // Components complete their returned Subject on destroy; remove it so a later same-case subscription gets a fresh Subject.
2078
+ subject.subscribe({
2079
+ complete: () => this.removePendingRequest(caseId, subject),
2080
+ error: () => this.removePendingRequest(caseId, subject)
2081
+ });
2082
+ }
2083
+ removePendingRequest(caseId, subject) {
2084
+ if (this.pendingRequests.get(caseId) !== subject) {
2085
+ return;
2083
2086
  }
2084
- else {
2085
- CaseField.logger.error('Path too long, possible circular reference in case field hierarchy.');
2086
- return this.id;
2087
+ this.pendingRequests.delete(caseId);
2088
+ if (!this.pendingRequests.size && this.currentTimeoutHandle) {
2089
+ clearTimeout(this.currentTimeoutHandle);
2090
+ this.currentTimeoutHandle = undefined;
2087
2091
  }
2088
2092
  }
2089
- set isTranslated(val) {
2090
- this.isTranslatedFlag = val;
2093
+ polling(request$, options) {
2094
+ const pollingOptions = {
2095
+ interval: options.interval,
2096
+ attempts: options.attempts ?? 9,
2097
+ exponentialUnit: options.exponentialUnit ?? 1000
2098
+ };
2099
+ return concat(request$, defer(() => timer(pollingOptions.interval).pipe(switchMap(() => request$))).pipe(repeat())).pipe(
2100
+ // Preserve consecutive-failure retry behaviour using the current RxJS retry config.
2101
+ retry({
2102
+ count: pollingOptions.attempts,
2103
+ delay: (_error, retryCount) => timer(this.getExponentialRetryDelay(retryCount, pollingOptions.exponentialUnit)),
2104
+ resetOnSuccess: true
2105
+ }));
2091
2106
  }
2092
- get isTranslated() {
2093
- return this.isTranslatedFlag;
2107
+ getExponentialRetryDelay(consecutiveErrorsCount, exponentialUnit) {
2108
+ return Math.pow(2, consecutiveErrorsCount - 1) * exponentialUnit;
2094
2109
  }
2110
+ static ɵfac = function ActivityPollingService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ActivityPollingService)(i0.ɵɵinject(ActivityService), i0.ɵɵinject(i0.NgZone), i0.ɵɵinject(AbstractAppConfig)); };
2111
+ static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: ActivityPollingService, factory: ActivityPollingService.ɵfac });
2095
2112
  }
2096
- __decorate([
2097
- Exclude(),
2098
- __metadata("design:type", CaseField)
2099
- ], CaseField.prototype, "parent", void 0);
2100
- __decorate([
2101
- Type(() => FieldType),
2102
- __metadata("design:type", FieldType)
2103
- ], CaseField.prototype, "field_type", void 0);
2104
- __decorate([
2105
- Type(() => WizardPageField),
2106
- __metadata("design:type", WizardPageField)
2107
- ], CaseField.prototype, "wizardProps", void 0);
2108
- __decorate([
2109
- Expose(),
2110
- __metadata("design:type", Object),
2111
- __metadata("design:paramtypes", [Object])
2112
- ], CaseField.prototype, "value", null);
2113
- __decorate([
2114
- Expose(),
2115
- __metadata("design:type", Object),
2116
- __metadata("design:paramtypes", [Object])
2117
- ], CaseField.prototype, "list_items", null);
2118
- __decorate([
2119
- Expose(),
2120
- __metadata("design:type", String),
2121
- __metadata("design:paramtypes", [])
2122
- ], CaseField.prototype, "dateTimeEntryFormat", null);
2123
- __decorate([
2124
- Expose(),
2125
- __metadata("design:type", String),
2126
- __metadata("design:paramtypes", [])
2127
- ], CaseField.prototype, "dateTimeDisplayFormat", null);
2128
- __decorate([
2129
- Expose(),
2130
- __metadata("design:type", Function),
2131
- __metadata("design:paramtypes", []),
2132
- __metadata("design:returntype", void 0)
2133
- ], CaseField.prototype, "isComplexDisplay", null);
2134
- __decorate([
2135
- Expose(),
2136
- __metadata("design:type", Function),
2137
- __metadata("design:paramtypes", []),
2138
- __metadata("design:returntype", void 0)
2139
- ], CaseField.prototype, "isComplexEntry", null);
2140
- __decorate([
2141
- Expose(),
2142
- __metadata("design:type", Function),
2143
- __metadata("design:paramtypes", []),
2144
- __metadata("design:returntype", void 0)
2145
- ], CaseField.prototype, "isReadonly", null);
2146
- __decorate([
2147
- Expose(),
2148
- __metadata("design:type", Function),
2149
- __metadata("design:paramtypes", []),
2150
- __metadata("design:returntype", void 0)
2151
- ], CaseField.prototype, "isOptional", null);
2152
- __decorate([
2153
- Expose(),
2154
- __metadata("design:type", Function),
2155
- __metadata("design:paramtypes", []),
2156
- __metadata("design:returntype", void 0)
2157
- ], CaseField.prototype, "isMandatory", null);
2158
- __decorate([
2159
- Expose(),
2160
- __metadata("design:type", Function),
2161
- __metadata("design:paramtypes", []),
2162
- __metadata("design:returntype", Boolean)
2163
- ], CaseField.prototype, "isCollection", null);
2164
- __decorate([
2165
- Expose(),
2166
- __metadata("design:type", Function),
2167
- __metadata("design:paramtypes", []),
2168
- __metadata("design:returntype", Boolean)
2169
- ], CaseField.prototype, "isComplex", null);
2170
- __decorate([
2171
- Expose(),
2172
- __metadata("design:type", Function),
2173
- __metadata("design:paramtypes", []),
2174
- __metadata("design:returntype", Boolean)
2175
- ], CaseField.prototype, "isDynamic", null);
2176
- __decorate([
2177
- Expose(),
2178
- __metadata("design:type", Function),
2179
- __metadata("design:paramtypes", []),
2180
- __metadata("design:returntype", Boolean)
2181
- ], CaseField.prototype, "isCaseLink", null);
2182
- __decorate([
2183
- Expose(),
2184
- __metadata("design:type", Function),
2185
- __metadata("design:paramtypes", [String]),
2186
- __metadata("design:returntype", String)
2187
- ], CaseField.prototype, "getHierachicalId", null);
2113
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ActivityPollingService, [{
2114
+ type: Injectable
2115
+ }], () => [{ type: ActivityService }, { type: i0.NgZone }, { type: AbstractAppConfig }], null); })();
2188
2116
 
2189
- // @dynamic
2190
- class WizardPage {
2191
- id;
2192
- label;
2193
- order;
2194
- wizard_page_fields;
2195
- case_fields;
2196
- show_condition;
2197
- parsedShowCondition;
2198
- getCol1Fields() {
2199
- return this.case_fields?.filter(f => !f.wizardProps.page_column_no || f.wizardProps.page_column_no === 1);
2117
+ function ActivityComponent_div_0_div_1_Template(rf, ctx) { if (rf & 1) {
2118
+ i0.ɵɵelementStart(0, "div");
2119
+ i0.ɵɵelement(1, "ccd-activity-icon", 5);
2120
+ i0.ɵɵpipe(2, "rpxTranslate");
2121
+ i0.ɵɵelementEnd();
2122
+ } if (rf & 2) {
2123
+ const ctx_r0 = i0.ɵɵnextContext(2);
2124
+ i0.ɵɵclassProp("activityEditorsAndViewersIcons", ctx_r0.viewersPresent())("activityEditorsIcon", !ctx_r0.viewersPresent());
2125
+ i0.ɵɵadvance();
2126
+ i0.ɵɵproperty("description", i0.ɵɵpipeBind1(2, 5, ctx_r0.editorsText));
2127
+ } }
2128
+ function ActivityComponent_div_0_div_2_Template(rf, ctx) { if (rf & 1) {
2129
+ i0.ɵɵelementStart(0, "div", 6);
2130
+ i0.ɵɵelement(1, "ccd-activity-icon", 7);
2131
+ i0.ɵɵpipe(2, "rpxTranslate");
2132
+ i0.ɵɵelementEnd();
2133
+ } if (rf & 2) {
2134
+ const ctx_r0 = i0.ɵɵnextContext(2);
2135
+ i0.ɵɵadvance();
2136
+ i0.ɵɵproperty("description", i0.ɵɵpipeBind1(2, 1, ctx_r0.viewersText));
2137
+ } }
2138
+ function ActivityComponent_div_0_div_3_Template(rf, ctx) { if (rf & 1) {
2139
+ i0.ɵɵelementStart(0, "div");
2140
+ i0.ɵɵelement(1, "ccd-activity-banner", 8);
2141
+ i0.ɵɵpipe(2, "rpxTranslate");
2142
+ i0.ɵɵelementEnd();
2143
+ } if (rf & 2) {
2144
+ const ctx_r0 = i0.ɵɵnextContext(2);
2145
+ i0.ɵɵadvance();
2146
+ i0.ɵɵproperty("description", i0.ɵɵpipeBind1(2, 1, ctx_r0.editorsText));
2147
+ } }
2148
+ function ActivityComponent_div_0_div_4_Template(rf, ctx) { if (rf & 1) {
2149
+ i0.ɵɵelementStart(0, "div");
2150
+ i0.ɵɵelement(1, "ccd-activity-banner", 9);
2151
+ i0.ɵɵpipe(2, "rpxTranslate");
2152
+ i0.ɵɵelementEnd();
2153
+ } if (rf & 2) {
2154
+ const ctx_r0 = i0.ɵɵnextContext(2);
2155
+ i0.ɵɵadvance();
2156
+ i0.ɵɵproperty("description", i0.ɵɵpipeBind1(2, 1, ctx_r0.viewersText));
2157
+ } }
2158
+ function ActivityComponent_div_0_Template(rf, ctx) { if (rf & 1) {
2159
+ i0.ɵɵelementStart(0, "div", 1);
2160
+ i0.ɵɵtemplate(1, ActivityComponent_div_0_div_1_Template, 3, 7, "div", 2)(2, ActivityComponent_div_0_div_2_Template, 3, 3, "div", 3)(3, ActivityComponent_div_0_div_3_Template, 3, 3, "div", 4)(4, ActivityComponent_div_0_div_4_Template, 3, 3, "div", 4);
2161
+ i0.ɵɵelementEnd();
2162
+ } if (rf & 2) {
2163
+ const ctx_r0 = i0.ɵɵnextContext();
2164
+ i0.ɵɵadvance();
2165
+ i0.ɵɵproperty("ngIf", ctx_r0.displayMode === ctx_r0.dspMode.ICON && ctx_r0.editorsPresent());
2166
+ i0.ɵɵadvance();
2167
+ i0.ɵɵproperty("ngIf", ctx_r0.displayMode === ctx_r0.dspMode.ICON && ctx_r0.viewersPresent());
2168
+ i0.ɵɵadvance();
2169
+ i0.ɵɵproperty("ngIf", ctx_r0.displayMode === ctx_r0.dspMode.BANNER && ctx_r0.editorsPresent());
2170
+ i0.ɵɵadvance();
2171
+ i0.ɵɵproperty("ngIf", ctx_r0.displayMode === ctx_r0.dspMode.BANNER && ctx_r0.viewersPresent());
2172
+ } }
2173
+ class ActivityComponent {
2174
+ activityPollingService;
2175
+ activity;
2176
+ dspMode = DisplayMode;
2177
+ viewersText;
2178
+ editorsText;
2179
+ subscription;
2180
+ caseId;
2181
+ displayMode;
2182
+ VIEWERS_PREFIX = '';
2183
+ VIEWERS_SUFFIX = 'viewing this case';
2184
+ EDITORS_PREFIX = 'This case is being updated by ';
2185
+ EDITORS_SUFFIX = '';
2186
+ constructor(activityPollingService) {
2187
+ this.activityPollingService = activityPollingService;
2200
2188
  }
2201
- getCol2Fields() {
2202
- return this.case_fields?.filter(f => f.wizardProps.page_column_no === 2);
2189
+ ngOnInit() {
2190
+ this.activity = new Activity();
2191
+ this.activity.caseId = this.caseId;
2192
+ this.activity.editors = [];
2193
+ this.activity.unknownEditors = 0;
2194
+ this.activity.viewers = [];
2195
+ this.activity.unknownViewers = 0;
2196
+ this.viewersText = '';
2197
+ this.editorsText = '';
2198
+ this.subscription = this.activityPollingService.subscribeToActivity(this.caseId, newActivity => this.onActivityChange(newActivity));
2203
2199
  }
2204
- isMultiColumn() {
2205
- return this.getCol2Fields()?.length > 0;
2200
+ onActivityChange(newActivity) {
2201
+ this.activity = newActivity;
2202
+ this.viewersText = this.generateDescription(this.VIEWERS_PREFIX, this.VIEWERS_SUFFIX, this.activity.viewers, this.activity.unknownViewers);
2203
+ this.editorsText = this.generateDescription(this.EDITORS_PREFIX, this.EDITORS_SUFFIX, this.activity.editors, this.activity.unknownEditors);
2206
2204
  }
2207
- }
2208
- __decorate([
2209
- Type(() => WizardPageField),
2210
- __metadata("design:type", Array)
2211
- ], WizardPage.prototype, "wizard_page_fields", void 0);
2212
- __decorate([
2213
- Type(() => CaseField),
2214
- __metadata("design:type", Array)
2215
- ], WizardPage.prototype, "case_fields", void 0);
2216
-
2217
- // @dynamic
2218
- class CaseEventTrigger {
2219
- id;
2220
- name;
2221
- description;
2222
- case_id;
2223
- case_fields;
2224
- event_token;
2225
- wizard_pages;
2226
- show_summary;
2227
- show_event_notes;
2228
- end_button_label;
2229
- can_save_draft;
2230
- hasFields() {
2231
- return this.case_fields && this.case_fields.length !== 0;
2205
+ isActivityEnabled() {
2206
+ return this.activityPollingService.isEnabled;
2232
2207
  }
2233
- hasPages() {
2234
- return this.wizard_pages && this.wizard_pages.length !== 0;
2208
+ isActiveCase() {
2209
+ return this.activity.editors.length || this.activity.viewers.length || this.activity.unknownEditors || this.activity.unknownViewers;
2235
2210
  }
2236
- }
2237
- __decorate([
2238
- Type(() => CaseField),
2239
- __metadata("design:type", Array)
2240
- ], CaseEventTrigger.prototype, "case_fields", void 0);
2241
- __decorate([
2242
- Type(() => WizardPage),
2243
- __metadata("design:type", Array)
2244
- ], CaseEventTrigger.prototype, "wizard_pages", void 0);
2245
-
2246
- // tslint:disable:variable-name
2247
- class CaseViewEvent {
2248
- id;
2249
- timestamp;
2250
- summary;
2251
- comment;
2252
- event_id;
2253
- event_name;
2254
- state_id;
2255
- state_name;
2256
- user_id;
2257
- user_last_name;
2258
- user_first_name;
2259
- significant_item;
2260
- }
2261
-
2262
- class CaseViewTrigger {
2263
- id;
2264
- name;
2265
- description;
2266
- order;
2267
- }
2268
-
2269
- class CaseEvent {
2270
- id;
2271
- name;
2272
- post_state;
2273
- pre_states;
2274
- case_fields;
2275
- description;
2276
- order;
2277
- acls;
2278
- }
2279
-
2280
- class CaseState {
2281
- id;
2282
- name;
2283
- description;
2284
- order;
2285
- }
2286
-
2287
- // Light clone of CaseType to be used in Jurisdiction class
2288
- // to avoid cyclic dependency
2289
- class CaseTypeLite {
2290
- id;
2291
- name;
2292
- events;
2293
- states;
2294
- description;
2295
- }
2296
-
2297
- // @dynamics
2298
- class CaseType {
2299
- id;
2300
- name;
2301
- events;
2302
- states;
2303
- case_fields;
2304
- description;
2305
- jurisdiction;
2306
- printEnabled;
2307
- }
2308
- __decorate([
2309
- Type(() => CaseField),
2310
- __metadata("design:type", Array)
2311
- ], CaseType.prototype, "case_fields", void 0);
2312
-
2313
- // tslint:disable:variable-name
2314
- class EventCaseField {
2315
- case_field_id;
2316
- showCondition;
2317
- }
2318
-
2319
- class Jurisdiction {
2320
- id;
2321
- name;
2322
- description;
2323
- caseTypes;
2324
- currentCaseType;
2325
- }
2326
-
2327
- class Banner {
2328
- bannerDescription;
2329
- bannerUrlText;
2330
- bannerUrl;
2331
- bannerViewed;
2332
- bannerEnabled;
2333
- }
2334
-
2335
- // @dynamic
2336
- class CaseTab {
2337
- id;
2338
- label;
2339
- order;
2340
- fields;
2341
- show_condition;
2342
- }
2343
- __decorate([
2344
- Type(() => CaseField),
2345
- __metadata("design:type", Array)
2346
- ], CaseTab.prototype, "fields", void 0);
2347
-
2348
- // @dynamic
2349
- class CaseView {
2350
- case_id;
2351
- case_type;
2352
- state;
2353
- channels;
2354
- tabs;
2355
- triggers;
2356
- events;
2357
- metadataFields;
2358
- basicFields;
2359
- case_flag;
2360
- }
2361
- __decorate([
2362
- Type(() => CaseTab),
2363
- __metadata("design:type", Array)
2364
- ], CaseView.prototype, "tabs", void 0);
2365
- __decorate([
2366
- Type(() => CaseField),
2367
- __metadata("design:type", Array)
2368
- ], CaseView.prototype, "metadataFields", void 0);
2369
-
2370
- class CasePrintDocument {
2371
- name;
2372
- type;
2373
- url;
2374
- }
2375
-
2376
- var RoleCategory;
2377
- (function (RoleCategory) {
2378
- RoleCategory["JUDICIAL"] = "JUDICIAL";
2379
- RoleCategory["LEGAL_OPERATIONS"] = "LEGAL_OPERATIONS";
2380
- RoleCategory["ADMIN"] = "ADMIN";
2381
- RoleCategory["CTSC"] = "CTSC";
2382
- RoleCategory["PROFESSIONAL"] = "PROFESSIONAL";
2383
- RoleCategory["CITIZEN"] = "CITIZEN";
2384
- RoleCategory["ENFORCEMENT"] = "ENFORCEMENT";
2385
- })(RoleCategory || (RoleCategory = {}));
2386
- var AMRoleSuffix;
2387
- (function (AMRoleSuffix) {
2388
- AMRoleSuffix["JUDICIARY"] = "judiciary";
2389
- AMRoleSuffix["ADMIN"] = "admin";
2390
- AMRoleSuffix["PROFESSIONAL"] = "professional";
2391
- AMRoleSuffix["LEGAL_OPERATIONS"] = "legal-ops";
2392
- AMRoleSuffix["CITIZEN"] = "citizen";
2393
- AMRoleSuffix["CTSC"] = "ctsc";
2394
- AMRoleSuffix["ENFORCEMENT"] = "enforcement";
2395
- })(AMRoleSuffix || (AMRoleSuffix = {}));
2396
- var RoleKeyword;
2397
- (function (RoleKeyword) {
2398
- RoleKeyword["JUDGE"] = "judge";
2399
- RoleKeyword["ADMIN"] = "admin";
2400
- RoleKeyword["SOLICITOR"] = "solicitor";
2401
- RoleKeyword["CITIZEN"] = "citizen";
2402
- RoleKeyword["CTSC"] = "ctsc";
2403
- RoleKeyword["CASEWORKER"] = "caseworker";
2404
- RoleKeyword["ENFORCEMENT"] = "enforcement";
2405
- })(RoleKeyword || (RoleKeyword = {}));
2406
-
2407
- // tslint:disable:variable-name
2408
- class HRef {
2409
- href;
2410
- }
2411
- class DocumentLinks {
2412
- self;
2413
- binary;
2414
- }
2415
- class Document {
2416
- _links;
2417
- originalDocumentName;
2418
- hashToken;
2419
- }
2420
- class Embedded {
2421
- documents;
2422
- }
2423
- class DocumentData {
2424
- _embedded;
2425
- documents;
2426
- }
2427
- class FormDocument {
2428
- document_url;
2429
- document_binary_url;
2430
- document_filename;
2431
- document_hash;
2432
- upload_timestamp;
2433
- }
2434
-
2435
- const DRAFT_PREFIX = 'DRAFT';
2436
- const DRAFT_QUERY_PARAM = 'draft';
2437
- class Draft {
2438
- id;
2439
- document;
2440
- type;
2441
- created;
2442
- updated;
2443
- static stripDraftId(draftId) {
2444
- return draftId.slice(DRAFT_PREFIX.length);
2211
+ viewersPresent() {
2212
+ return (this.activity.viewers.length > 0 || this.activity.unknownViewers > 0);
2445
2213
  }
2446
- static isDraft(id) {
2447
- return String(id).startsWith(DRAFT_PREFIX);
2214
+ editorsPresent() {
2215
+ return (this.activity.editors.length > 0 || this.activity.unknownEditors > 0);
2448
2216
  }
2449
- }
2450
-
2451
- class OrganisationConverter {
2452
- static toSimpleAddress(organisationModel) {
2453
- let simpleAddress = '';
2454
- if (organisationModel.addressLine1) {
2455
- simpleAddress += `${organisationModel.addressLine1}<br>`;
2456
- }
2457
- if (organisationModel.addressLine2) {
2458
- simpleAddress += `${organisationModel.addressLine2}<br>`;
2459
- }
2460
- if (organisationModel.addressLine3) {
2461
- simpleAddress += `${organisationModel.addressLine3}<br>`;
2462
- }
2463
- if (organisationModel.townCity) {
2464
- simpleAddress += `${organisationModel.townCity}<br>`;
2217
+ ngOnDestroy() {
2218
+ if (this.subscription) {
2219
+ this.subscription.complete();
2465
2220
  }
2466
- if (organisationModel.county) {
2467
- simpleAddress += `${organisationModel.county}<br>`;
2221
+ this.activityPollingService.stopPolling();
2222
+ }
2223
+ generateDescription(prefix, suffix, namesArray, unknownCount) {
2224
+ let resultText = prefix;
2225
+ resultText += namesArray.map(activityInfo => `${activityInfo.forename} ${activityInfo.surname}`).join(', ');
2226
+ if (unknownCount > 0) {
2227
+ resultText += (namesArray.length > 0 ? ` and ${unknownCount} other` : `${unknownCount} user`);
2228
+ resultText += (unknownCount > 1 ? 's' : '');
2468
2229
  }
2469
- if (organisationModel.country) {
2470
- simpleAddress += `${organisationModel.country}<br>`;
2230
+ else {
2231
+ resultText = this.replaceLastCommaWithAnd(resultText);
2471
2232
  }
2472
- if (organisationModel.postCode) {
2473
- simpleAddress += `${organisationModel.postCode}<br>`;
2233
+ if (suffix.length > 0) {
2234
+ if (namesArray.length + unknownCount > 1) {
2235
+ resultText += ` are ${suffix}`;
2236
+ }
2237
+ else {
2238
+ resultText += ` is ${suffix}`;
2239
+ }
2474
2240
  }
2475
- return simpleAddress;
2241
+ return resultText;
2476
2242
  }
2477
- toSimpleOrganisationModel(organisationModel) {
2478
- return {
2479
- organisationIdentifier: organisationModel.organisationIdentifier,
2480
- name: organisationModel.name,
2481
- address: OrganisationConverter.toSimpleAddress(organisationModel)
2482
- };
2243
+ replaceLastCommaWithAnd(str) {
2244
+ return str.trim().replace(/,([^,]*)$/, ' and $1').split(' ').join(' ');
2483
2245
  }
2484
- static ɵfac = function OrganisationConverter_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || OrganisationConverter)(); };
2485
- static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: OrganisationConverter, factory: OrganisationConverter.ɵfac });
2246
+ static ɵfac = function ActivityComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ActivityComponent)(i0.ɵɵdirectiveInject(ActivityPollingService)); };
2247
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ActivityComponent, selectors: [["ccd-activity"]], inputs: { caseId: "caseId", displayMode: "displayMode" }, standalone: false, decls: 1, vars: 1, consts: [["class", "activityComponent", 4, "ngIf"], [1, "activityComponent"], [3, "activityEditorsAndViewersIcons", "activityEditorsIcon", 4, "ngIf"], ["class", "activityViewersIcon", 4, "ngIf"], [4, "ngIf"], ["imageLink", "assets/img/editor.png", 3, "description"], [1, "activityViewersIcon"], ["imageLink", "assets/img/viewer.png", 3, "description"], ["imageLink", "assets/img/editorBanner.png", "bannerType", "editor", 3, "description"], ["imageLink", "assets/img/viewerBanner.png", "bannerType", "viewer", 3, "description"]], template: function ActivityComponent_Template(rf, ctx) { if (rf & 1) {
2248
+ i0.ɵɵtemplate(0, ActivityComponent_div_0_Template, 5, 4, "div", 0);
2249
+ } if (rf & 2) {
2250
+ i0.ɵɵproperty("ngIf", ctx.isActivityEnabled());
2251
+ } }, dependencies: [i5.NgIf, ActivityBannerComponent, ActivityIconComponent, i1.RpxTranslatePipe], styles: [".activityEditorsIcon[_ngcontent-%COMP%]{margin-left:14px}.activityEditorsAndViewersIcons[_ngcontent-%COMP%], .activityViewersIcon[_ngcontent-%COMP%]{float:left;margin-left:14px}"] });
2486
2252
  }
2487
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(OrganisationConverter, [{
2488
- type: Injectable
2489
- }], null, null); })();
2253
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ActivityComponent, [{
2254
+ type: Component,
2255
+ args: [{ selector: 'ccd-activity', standalone: false, template: "<div class=\"activityComponent\" *ngIf=\"isActivityEnabled()\">\n <div *ngIf=\"displayMode === dspMode.ICON && editorsPresent()\" [class.activityEditorsAndViewersIcons]=\"viewersPresent()\" [class.activityEditorsIcon]=\"!viewersPresent()\">\n <ccd-activity-icon imageLink=\"assets/img/editor.png\" [description]=\"editorsText | rpxTranslate\"></ccd-activity-icon>\n </div>\n <div *ngIf=\"displayMode === dspMode.ICON && viewersPresent()\" class=\"activityViewersIcon\">\n <ccd-activity-icon imageLink=\"assets/img/viewer.png\" [description]=\"viewersText | rpxTranslate\"></ccd-activity-icon>\n </div>\n <div *ngIf=\"displayMode === dspMode.BANNER && editorsPresent()\">\n <ccd-activity-banner imageLink=\"assets/img/editorBanner.png\" [description]=\"editorsText | rpxTranslate\" bannerType=\"editor\">\n </ccd-activity-banner>\n </div>\n <div *ngIf=\"displayMode === dspMode.BANNER && viewersPresent()\">\n <ccd-activity-banner imageLink=\"assets/img/viewerBanner.png\" [description]=\"viewersText | rpxTranslate\" bannerType=\"viewer\">\n </ccd-activity-banner>\n </div>\n</div>\n", styles: [".activityEditorsIcon{margin-left:14px}.activityEditorsAndViewersIcons,.activityViewersIcon{float:left;margin-left:14px}\n"] }]
2256
+ }], () => [{ type: ActivityPollingService }], { caseId: [{
2257
+ type: Input
2258
+ }], displayMode: [{
2259
+ type: Input
2260
+ }] }); })();
2261
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ActivityComponent, { className: "ActivityComponent", filePath: "lib/shared/components/activity/activity.component.ts", lineNumber: 12 }); })();
2490
2262
 
2491
- class PaginationMetadata {
2492
- totalResultsCount;
2493
- totalPagesCount;
2263
+ class ActivityModule {
2264
+ static ɵfac = function ActivityModule_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ActivityModule)(); };
2265
+ static ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: ActivityModule });
2266
+ static ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ providers: [
2267
+ ActivityService,
2268
+ ActivityPollingService,
2269
+ SessionStorageService,
2270
+ ], imports: [CommonModule,
2271
+ RouterModule,
2272
+ RpxTranslationModule.forChild()] });
2494
2273
  }
2274
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ActivityModule, [{
2275
+ type: NgModule,
2276
+ args: [{
2277
+ imports: [
2278
+ CommonModule,
2279
+ RouterModule,
2280
+ RpxTranslationModule.forChild()
2281
+ ],
2282
+ declarations: [
2283
+ ActivityComponent,
2284
+ ActivityBannerComponent,
2285
+ ActivityIconComponent,
2286
+ ],
2287
+ exports: [
2288
+ ActivityComponent,
2289
+ ActivityBannerComponent,
2290
+ ActivityIconComponent,
2291
+ ],
2292
+ providers: [
2293
+ ActivityService,
2294
+ ActivityPollingService,
2295
+ SessionStorageService,
2296
+ ]
2297
+ }]
2298
+ }], null, null); })();
2299
+ (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(ActivityModule, { declarations: [ActivityComponent,
2300
+ ActivityBannerComponent,
2301
+ ActivityIconComponent], imports: [CommonModule,
2302
+ RouterModule, i1.RpxTranslationModule], exports: [ActivityComponent,
2303
+ ActivityBannerComponent,
2304
+ ActivityIconComponent] }); })();
2495
2305
 
2496
- function hasRoles(profile) {
2497
- if (profile.user && profile.user.idam && Array.isArray(profile.user.idam.roles)) {
2498
- return profile.user.idam.roles.length > 0;
2499
- }
2500
- return false;
2501
- }
2502
- // @dynamic
2503
- class Profile {
2504
- user;
2505
- channels;
2506
- jurisdictions;
2507
- default;
2508
- isSolicitor() {
2509
- if (hasRoles(this)) {
2510
- return this.user.idam.roles.find(r => r.endsWith('-solicitor')) !== undefined;
2511
- }
2512
- return false;
2513
- }
2514
- isCourtAdmin() {
2515
- if (hasRoles(this)) {
2516
- return this.user.idam.roles.find(r => r.endsWith('-courtadmin')) !== undefined;
2517
- }
2518
- return false;
2306
+ class AlertService {
2307
+ router;
2308
+ rpxTranslationService;
2309
+ // the preserved messages
2310
+ preservedError = '';
2311
+ preservedWarning = '';
2312
+ preservedSuccess = '';
2313
+ // TODO: Remove
2314
+ message;
2315
+ level;
2316
+ successes;
2317
+ errors;
2318
+ warnings;
2319
+ // TODO: Remove
2320
+ alerts;
2321
+ successObserver;
2322
+ errorObserver;
2323
+ warningObserver;
2324
+ // TODO: Remove
2325
+ alertObserver;
2326
+ preserveAlerts = false;
2327
+ constructor(router, rpxTranslationService) {
2328
+ this.router = router;
2329
+ this.rpxTranslationService = rpxTranslationService;
2330
+ this.successes = Observable
2331
+ .create(observer => this.successObserver = observer).pipe(publish(), refCount());
2332
+ this.successes.subscribe();
2333
+ this.errors = Observable
2334
+ .create(observer => this.errorObserver = observer).pipe(publish(), refCount());
2335
+ this.errors.subscribe();
2336
+ this.warnings = Observable
2337
+ .create(observer => this.warningObserver = observer).pipe(publish(), refCount());
2338
+ this.warnings.subscribe();
2339
+ // TODO: Remove
2340
+ this.alerts = Observable
2341
+ .create(observer => this.alertObserver = observer).pipe(publish(), refCount());
2342
+ this.alerts.subscribe();
2343
+ this.router
2344
+ .events
2345
+ .subscribe(event => {
2346
+ if (event instanceof NavigationStart) {
2347
+ // if there is no longer a preserve alerts setting for the page then clear all observers and preserved messages
2348
+ if (!this.preserveAlerts) {
2349
+ this.clear();
2350
+ }
2351
+ // if not, then set the preserving of alerts to false so rendering to a new page
2352
+ this.preserveAlerts = false;
2353
+ }
2354
+ });
2519
2355
  }
2520
- }
2521
- __decorate([
2522
- Type(() => Jurisdiction),
2523
- __metadata("design:type", Array)
2524
- ], Profile.prototype, "jurisdictions", void 0);
2525
-
2526
- class Field {
2527
- id;
2528
- field_type;
2529
- elementPath;
2530
- value;
2531
- label;
2532
- metadata;
2533
- constructor(id, field_type, elementPath, value, label, metadata) {
2534
- this.id = id;
2535
- this.field_type = field_type;
2536
- this.elementPath = elementPath;
2537
- this.value = value;
2538
- this.label = label;
2539
- this.metadata = metadata;
2356
+ clear() {
2357
+ this.successObserver.next(null);
2358
+ this.errorObserver.next(null);
2359
+ this.warningObserver.next(null);
2360
+ this.preservedError = '';
2361
+ this.preservedWarning = '';
2362
+ this.preservedSuccess = '';
2363
+ // EUI-3381.
2364
+ this.alertObserver.next(null);
2365
+ this.message = '';
2540
2366
  }
2541
- }
2542
-
2543
- class SearchResultViewColumn {
2544
- case_field_id;
2545
- case_field_type;
2546
- display_context;
2547
- display_context_parameter;
2548
- label;
2549
- order;
2550
- }
2551
-
2552
- // @dynamic
2553
- class SearchResultViewItem {
2554
- case_id;
2555
- case_fields;
2556
- hydrated_case_fields;
2557
- columns;
2558
- supplementary_data;
2559
- display_context_parameter;
2560
- }
2561
- __decorate([
2562
- Type(() => CaseField),
2563
- __metadata("design:type", Array)
2564
- ], SearchResultViewItem.prototype, "hydrated_case_fields", void 0);
2565
-
2566
- // @dynamic
2567
- class SearchResultView {
2568
- columns;
2569
- results;
2570
- result_error;
2571
- hasDrafts() {
2572
- return this.results[0]
2573
- && this.results[0].case_id
2574
- && Draft.isDraft(this.results[0].case_id);
2367
+ error({ phrase, replacements }) {
2368
+ const message = this.getTranslationWithReplacements(phrase, replacements);
2369
+ this.preservedError = this.preserveMessages(message);
2370
+ const alert = { level: 'error', message };
2371
+ this.errorObserver.next(alert);
2372
+ // EUI-3381.
2373
+ this.push(alert);
2575
2374
  }
2576
- }
2577
- __decorate([
2578
- Type(() => SearchResultViewColumn),
2579
- __metadata("design:type", Array)
2580
- ], SearchResultView.prototype, "columns", void 0);
2581
- __decorate([
2582
- Type(() => SearchResultViewItem),
2583
- __metadata("design:type", Array)
2584
- ], SearchResultView.prototype, "results", void 0);
2585
-
2586
- class SortParameters {
2587
- comparator;
2588
- sortOrder;
2589
- constructor(comparator, sortOrder) {
2590
- this.comparator = comparator;
2591
- this.sortOrder = sortOrder;
2375
+ warning({ phrase, replacements }) {
2376
+ const message = this.getTranslationWithReplacements(phrase, replacements);
2377
+ this.preservedWarning = this.preserveMessages(message);
2378
+ const alert = { level: 'warning', message };
2379
+ this.warningObserver.next(alert);
2380
+ // EUI-3381.
2381
+ this.push(alert);
2592
2382
  }
2593
- }
2594
-
2595
- var SortOrder$1;
2596
- (function (SortOrder) {
2597
- SortOrder[SortOrder["ASCENDING"] = 0] = "ASCENDING";
2598
- SortOrder[SortOrder["DESCENDING"] = 1] = "DESCENDING";
2599
- SortOrder[SortOrder["UNSORTED"] = 2] = "UNSORTED";
2600
- })(SortOrder$1 || (SortOrder$1 = {}));
2601
-
2602
- const STAFF_CACHE_ROLE_CATEGORIES = new Set([
2603
- RoleCategory.ADMIN,
2604
- RoleCategory.CTSC,
2605
- RoleCategory.LEGAL_OPERATIONS
2606
- ]);
2607
- const SUPPORTED_ROLE_CATEGORIES = new Set([
2608
- ...STAFF_CACHE_ROLE_CATEGORIES,
2609
- RoleCategory.JUDICIAL,
2610
- ]);
2611
- // Aliases allow the definition to use the shorter, hyphenated form within #ARGUMENT(...)
2612
- const ROLE_CATEGORY_ALIASES = {
2613
- LEGAL_OPS: RoleCategory.LEGAL_OPERATIONS
2614
- };
2615
- const ARGUMENT_REGEX = /#ARGUMENT\(([^)]*)\)/;
2616
- const CATEGORY_PREFIX = 'CATEGORY-';
2617
- const REGION_PREFIX = 'REGION-';
2618
- /**
2619
- * Parses the `display_context_parameter` of a StaffUser field to determine the filters to apply
2620
- * when searching reference data.
2621
- *
2622
- * Expected format: `#ARGUMENT(CATEGORY-LEGAL-OPS,CATEGORY-ADMIN,REGION-1235)`
2623
- */
2624
- function parseStaffUserSearchConfiguration(displayContextParameter) {
2625
- if (!displayContextParameter) {
2626
- return invalidConfiguration();
2383
+ success({ preserve, phrase, replacements }) {
2384
+ const message = this.getTranslationWithReplacements(phrase, replacements);
2385
+ this.preserveAlerts = preserve || this.preserveAlerts;
2386
+ const alert = { level: 'success', message };
2387
+ this.preservedSuccess = this.preserveMessages(message);
2388
+ this.successObserver.next(alert);
2389
+ // EUI-3381.
2390
+ this.push(alert);
2627
2391
  }
2628
- const match = ARGUMENT_REGEX.exec(displayContextParameter);
2629
- if (!match?.[1]) {
2630
- return invalidConfiguration();
2392
+ getTranslationWithReplacements(phrase, replacements) {
2393
+ let message;
2394
+ if (replacements) {
2395
+ this.rpxTranslationService.getTranslationWithReplacements$(phrase, replacements).subscribe(translation => {
2396
+ message = translation;
2397
+ });
2398
+ }
2399
+ else {
2400
+ this.rpxTranslationService.getTranslation$(phrase).subscribe(translation => {
2401
+ message = translation;
2402
+ });
2403
+ }
2404
+ return message;
2631
2405
  }
2632
- const tokens = match[1].split(',').map(token => token.trim());
2633
- if (tokens.some(token => !token)) {
2634
- return invalidConfiguration();
2406
+ setPreserveAlerts(preserve, urlInfo) {
2407
+ // if there is no url setting then just preserve the messages
2408
+ if (!urlInfo) {
2409
+ this.preserveAlerts = preserve;
2410
+ }
2411
+ else {
2412
+ // check if the url includes the sting given
2413
+ this.preserveAlerts = this.currentUrlIncludesInfo(preserve, urlInfo);
2414
+ }
2635
2415
  }
2636
- const roleCategories = [];
2637
- for (const token of tokens) {
2638
- if (token.startsWith(CATEGORY_PREFIX)) {
2639
- const category = normaliseRoleCategory(token.substring(CATEGORY_PREFIX.length));
2640
- if (!isStaffUserRoleCategory(category)) {
2641
- return invalidConfiguration();
2642
- }
2643
- if (!roleCategories.includes(category)) {
2644
- roleCategories.push(category);
2416
+ currentUrlIncludesInfo(preserve, urlInfo) {
2417
+ // loop through the list of strings and check the router includes all of them
2418
+ for (const urlSnip of urlInfo) {
2419
+ if (!this.router.url.includes(urlSnip)) {
2420
+ // return the opposite boolean value if the router does not include one of the strings
2421
+ return !preserve;
2645
2422
  }
2646
2423
  }
2647
- else if (token.startsWith(REGION_PREFIX)) {
2648
- // Region filtering is not supported in this version; REGION- tokens are silently ignored
2424
+ // return the boolean value if all strings are in the url
2425
+ return preserve;
2426
+ }
2427
+ isPreserveAlerts() {
2428
+ return this.preserveAlerts;
2429
+ }
2430
+ preserveMessages(message) {
2431
+ // preserve the messages if set to preserve them
2432
+ if (this.isPreserveAlerts()) {
2433
+ return message;
2649
2434
  }
2650
2435
  else {
2651
- return invalidConfiguration();
2436
+ return '';
2652
2437
  }
2653
2438
  }
2654
- if (!roleCategories.length) {
2655
- return invalidConfiguration();
2439
+ // TODO: Remove
2440
+ push(msgObject) {
2441
+ this.message = msgObject.message;
2442
+ this.level = msgObject.level;
2443
+ this.alertObserver.next({
2444
+ level: this.level,
2445
+ message: this.message
2446
+ });
2656
2447
  }
2657
- return {
2658
- valid: true,
2659
- configuration: {
2660
- roleCategories,
2661
- staffRoleCategories: roleCategories.filter(isStaffCacheRoleCategory),
2662
- includesJudicial: roleCategories.includes(RoleCategory.JUDICIAL)
2663
- }
2664
- };
2665
- }
2666
- function normaliseRoleCategory(category) {
2667
- const normalised = category.replaceAll('-', '_');
2668
- return ROLE_CATEGORY_ALIASES[normalised] || normalised;
2669
- }
2670
- function isStaffUserRoleCategory(category) {
2671
- return SUPPORTED_ROLE_CATEGORIES.has(category);
2672
- }
2673
- function isStaffCacheRoleCategory(category) {
2674
- return STAFF_CACHE_ROLE_CATEGORIES.has(category);
2675
- }
2676
- function invalidConfiguration() {
2677
- return { valid: false, error: 'INVALID_ROLE_CATEGORIES' };
2678
- }
2679
-
2680
- class WorkbasketInputModel {
2681
- label;
2682
- order;
2683
- field;
2684
- metadata;
2685
- display_context_parameter;
2686
- }
2687
- class WorkbasketInput {
2688
- workbasketInputs;
2689
- }
2690
-
2691
- const USER_DETAILS = 'userDetails';
2692
- const PUI_CASE_MANAGER = 'pui-case-manager';
2693
- function getUserDetails(sessionStorageService) {
2694
- const item = sessionStorageService?.getItem(USER_DETAILS);
2695
- return safeJsonParse(item, null);
2696
- }
2697
- function isInternalUser(sessionStorageService) {
2698
- const userDetails = getUserDetails(sessionStorageService);
2699
- return !!userDetails?.roles &&
2700
- !userDetails.roles.includes(PUI_CASE_MANAGER) &&
2701
- !userDetails.roles.some(role => role.toLowerCase().includes(RoleKeyword.JUDGE));
2702
- }
2703
- function isJudiciaryUser(sessionStorageService) {
2704
- const userDetails = getUserDetails(sessionStorageService);
2705
- return !!userDetails?.roles
2706
- && (userDetails.roles.some((role) => role.toLowerCase().includes(RoleKeyword.JUDGE)));
2707
- }
2708
- function roleHasKeyword(keyword, roleWords) {
2709
- return roleWords.includes(keyword);
2710
- }
2711
- function isWorkAllocationUser(sessionStorageService) {
2712
- const userDetails = getUserDetails(sessionStorageService);
2713
- return userDetails?.roles
2714
- && !userDetails.roles.includes(PUI_CASE_MANAGER)
2715
- &&
2716
- (userDetails.roles.includes('caseworker-ia-iacjudge')
2717
- || userDetails.roles.includes('caseworker-ia-caseofficer')
2718
- || userDetails.roles.includes('caseworker-ia-admofficer')
2719
- || userDetails.roles.includes('caseworker-civil')
2720
- || userDetails.roles.includes('caseworker-privatelaw'));
2721
- }
2722
- // fallback purely if roleCategories is not available in
2723
- function getMappedRoleCategories(roles = []) {
2724
- const roleKeywords = roles.join().split('-').join().split(',');
2725
- const roleCategoryList = [];
2726
- if (roleHasKeyword(RoleKeyword.JUDGE, roleKeywords)) {
2727
- roleCategoryList.push(RoleCategory.JUDICIAL);
2728
- }
2729
- if (roleHasKeyword(RoleKeyword.SOLICITOR, roleKeywords)) {
2730
- roleCategoryList.push(RoleCategory.PROFESSIONAL);
2731
- }
2732
- if (roleHasKeyword(RoleKeyword.CITIZEN, roleKeywords)) {
2733
- roleCategoryList.push(RoleCategory.CITIZEN);
2734
- }
2735
- if (roleHasKeyword(RoleKeyword.ADMIN, roleKeywords)) {
2736
- roleCategoryList.push(RoleCategory.ADMIN);
2737
- }
2738
- if (roleHasKeyword(RoleKeyword.CTSC, roleKeywords)) {
2739
- roleCategoryList.push(RoleCategory.CTSC);
2740
- }
2741
- if (roleHasKeyword(RoleKeyword.CASEWORKER, roleKeywords)) {
2742
- roleCategoryList.push(RoleCategory.LEGAL_OPERATIONS);
2743
- }
2744
- if (roleHasKeyword(RoleKeyword.ENFORCEMENT, roleKeywords)) {
2745
- roleCategoryList.push(RoleCategory.ENFORCEMENT);
2746
- }
2747
- return roleCategoryList;
2748
- }
2749
- function getAMRoleName(accessType, aMRole) {
2750
- let roleName = '';
2751
- switch (aMRole) {
2752
- case RoleCategory.JUDICIAL:
2753
- roleName = `${accessType}-access-${AMRoleSuffix.JUDICIARY}`;
2754
- break;
2755
- case RoleCategory.PROFESSIONAL:
2756
- roleName = `${accessType}-access-${AMRoleSuffix.PROFESSIONAL}`;
2757
- break;
2758
- case RoleCategory.CITIZEN:
2759
- roleName = `${accessType}-access-${AMRoleSuffix.CITIZEN}`;
2760
- break;
2761
- case RoleCategory.ADMIN:
2762
- roleName = `${accessType}-access-${AMRoleSuffix.ADMIN}`;
2763
- break;
2764
- case RoleCategory.CTSC:
2765
- roleName = `${accessType}-access-${AMRoleSuffix.CTSC}`;
2766
- break;
2767
- case RoleCategory.ENFORCEMENT:
2768
- roleName = `${accessType}-access-${AMRoleSuffix.ENFORCEMENT}`;
2769
- break;
2770
- default:
2771
- roleName = `${accessType}-access-${AMRoleSuffix.LEGAL_OPERATIONS}`;
2772
- break;
2448
+ static ɵfac = function AlertService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || AlertService)(i0.ɵɵinject(i1$1.Router), i0.ɵɵinject(i1.RpxTranslationService)); };
2449
+ static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AlertService, factory: AlertService.ɵfac });
2450
+ }
2451
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AlertService, [{
2452
+ type: Injectable
2453
+ }], () => [{ type: i1$1.Router }, { type: i1.RpxTranslationService }], null); })();
2454
+
2455
+ const DRAFT_PREFIX = 'DRAFT';
2456
+ const DRAFT_QUERY_PARAM = 'draft';
2457
+ class Draft {
2458
+ id;
2459
+ document;
2460
+ type;
2461
+ created;
2462
+ updated;
2463
+ static stripDraftId(draftId) {
2464
+ return draftId.slice(DRAFT_PREFIX.length);
2465
+ }
2466
+ static isDraft(id) {
2467
+ return String(id).startsWith(DRAFT_PREFIX);
2773
2468
  }
2774
- return roleName;
2775
2469
  }
2776
2470
 
2777
- // @dynamic
2778
- class ActivityService {
2471
+ class DraftService {
2779
2472
  http;
2780
2473
  appConfig;
2781
- sessionStorageService;
2782
- static get ACTIVITY_VIEW() { return 'view'; }
2783
- static get ACTIVITY_EDIT() { return 'edit'; }
2784
- logger = new StructuredLoggerService();
2785
- constructor(http, appConfig, sessionStorageService) {
2474
+ errorService;
2475
+ static V2_MEDIATYPE_DRAFT_CREATE = 'application/vnd.uk.gov.hmcts.ccd-data-store-api.ui-draft-create.v2+json;charset=UTF-8';
2476
+ static V2_MEDIATYPE_DRAFT_UPDATE = 'application/vnd.uk.gov.hmcts.ccd-data-store-api.ui-draft-update.v2+json;charset=UTF-8';
2477
+ static V2_MEDIATYPE_DRAFT_READ = 'application/vnd.uk.gov.hmcts.ccd-data-store-api.ui-draft-read.v2+json;charset=UTF-8';
2478
+ static V2_MEDIATYPE_DRAFT_DELETE = 'application/vnd.uk.gov.hmcts.ccd-data-store-api.ui-draft-delete.v2+json;charset=UTF-8';
2479
+ constructor(http, appConfig, errorService) {
2786
2480
  this.http = http;
2787
2481
  this.appConfig = appConfig;
2788
- this.sessionStorageService = sessionStorageService;
2482
+ this.errorService = errorService;
2789
2483
  }
2790
- get isEnabled() {
2791
- return this.activityUrl() && this.userAuthorised;
2484
+ createDraft(ctid, eventData) {
2485
+ const saveDraftEndpoint = this.appConfig.getCreateOrUpdateDraftsUrl(ctid);
2486
+ const headers = new HttpHeaders()
2487
+ .set('experimental', 'true')
2488
+ .set('Accept', DraftService.V2_MEDIATYPE_DRAFT_CREATE)
2489
+ .set('Content-Type', 'application/json');
2490
+ return this.http
2491
+ .post(saveDraftEndpoint, eventData, { headers, observe: 'body' })
2492
+ .pipe(catchError((error) => {
2493
+ this.errorService.setError(error);
2494
+ return throwError(error);
2495
+ }));
2792
2496
  }
2793
- static DUMMY_CASE_REFERENCE = '0';
2794
- userAuthorised = undefined;
2795
- static handleHttpError(response) {
2796
- const error = HttpErrorService.convertToHttpError(response);
2797
- if (response?.status !== error.status) {
2798
- error.status = response.status;
2799
- }
2800
- return error;
2497
+ updateDraft(ctid, draftId, eventData) {
2498
+ const saveDraftEndpoint = `${this.appConfig.getCreateOrUpdateDraftsUrl(ctid)}/${draftId}`;
2499
+ const headers = new HttpHeaders()
2500
+ .set('experimental', 'true')
2501
+ .set('Accept', DraftService.V2_MEDIATYPE_DRAFT_UPDATE)
2502
+ .set('Content-Type', 'application/json');
2503
+ return this.http
2504
+ .put(saveDraftEndpoint, eventData, { headers, observe: 'body' })
2505
+ .pipe(catchError((error) => {
2506
+ this.errorService.setError(error);
2507
+ return throwError(error);
2508
+ }));
2801
2509
  }
2802
- getOptions() {
2803
- const userDetails = safeJsonParse(this.sessionStorageService.getItem(USER_DETAILS));
2804
- let headers = new HttpHeaders().set('Content-Type', 'application/json');
2805
- if (userDetails?.token) {
2806
- headers = headers.set('Authorization', userDetails.token);
2807
- }
2808
- return {
2809
- headers,
2810
- withCredentials: true,
2811
- observe: 'body',
2812
- };
2510
+ getDraft(draftId) {
2511
+ const url = this.appConfig.getViewOrDeleteDraftsUrl(draftId.slice(DRAFT_PREFIX.length));
2512
+ const headers = new HttpHeaders()
2513
+ .set('experimental', 'true')
2514
+ .set('Accept', DraftService.V2_MEDIATYPE_DRAFT_READ)
2515
+ .set('Content-Type', 'application/json');
2516
+ return this.http
2517
+ .get(url, { headers, observe: 'body' })
2518
+ .pipe(catchError((error) => {
2519
+ this.errorService.setError(error);
2520
+ return throwError(error);
2521
+ }));
2813
2522
  }
2814
- getActivities(...caseId) {
2815
- try {
2816
- const options = this.getOptions();
2817
- const url = `${this.activityUrl()}/cases/${caseId.join(',')}/activity`;
2818
- return this.http
2819
- .get(url, options, false, ActivityService.handleHttpError)
2820
- .pipe(map(response => response));
2523
+ deleteDraft(draftId) {
2524
+ const url = this.appConfig.getViewOrDeleteDraftsUrl(draftId.slice(DRAFT_PREFIX.length));
2525
+ const headers = new HttpHeaders()
2526
+ .set('experimental', 'true')
2527
+ .set('Accept', DraftService.V2_MEDIATYPE_DRAFT_DELETE)
2528
+ .set('Content-Type', 'application/json');
2529
+ return this.http
2530
+ .delete(url, { headers, observe: 'body' }).pipe(catchError((error) => {
2531
+ this.errorService.setError(error);
2532
+ return throwError(error);
2533
+ }));
2534
+ }
2535
+ createOrUpdateDraft(caseTypeId, draftId, caseEventData) {
2536
+ if (!draftId) {
2537
+ return this.createDraft(caseTypeId, caseEventData);
2821
2538
  }
2822
- catch (error) {
2823
- this.logUserMayNotBeAuthenticated(error);
2539
+ else {
2540
+ return this.updateDraft(caseTypeId, Draft.stripDraftId(draftId), caseEventData);
2824
2541
  }
2825
2542
  }
2826
- postActivity(caseId, activity) {
2827
- try {
2828
- const options = this.getOptions();
2829
- const url = `${this.activityUrl()}/cases/${caseId}/activity`;
2830
- const body = { activity };
2831
- return this.http
2832
- .post(url, body, options, false)
2833
- .pipe(map(response => response));
2834
- }
2835
- catch (error) {
2836
- this.logUserMayNotBeAuthenticated(error);
2543
+ static ɵfac = function DraftService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || DraftService)(i0.ɵɵinject(HttpService), i0.ɵɵinject(AbstractAppConfig), i0.ɵɵinject(HttpErrorService)); };
2544
+ static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: DraftService, factory: DraftService.ɵfac });
2545
+ }
2546
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(DraftService, [{
2547
+ type: Injectable
2548
+ }], () => [{ type: HttpService }, { type: AbstractAppConfig }, { type: HttpErrorService }], null); })();
2549
+
2550
+ class ConditionalShowRegistrarService {
2551
+ registeredDirectives = [];
2552
+ register(newDirective) {
2553
+ this.registeredDirectives.push(newDirective);
2554
+ }
2555
+ reset() {
2556
+ this.registeredDirectives = [];
2557
+ }
2558
+ static ɵfac = function ConditionalShowRegistrarService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ConditionalShowRegistrarService)(); };
2559
+ static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: ConditionalShowRegistrarService, factory: ConditionalShowRegistrarService.ɵfac });
2560
+ }
2561
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ConditionalShowRegistrarService, [{
2562
+ type: Injectable
2563
+ }], null, null); })();
2564
+
2565
+ /** Keeps track of initially hidden fields that toggle to show on the page (parent page).
2566
+ * Used to decide whether to redisplay the grey bar when returning to the page during
2567
+ * navigation between pages.
2568
+ */
2569
+ class GreyBarService {
2570
+ fieldsToggledToShow = [];
2571
+ renderer;
2572
+ constructor(rendererFactory) {
2573
+ this.renderer = rendererFactory.createRenderer(null, null);
2574
+ }
2575
+ showGreyBar(field, el) {
2576
+ if (!field.isCollection()) {
2577
+ this.addGreyBar(el);
2837
2578
  }
2838
2579
  }
2839
- verifyUserIsAuthorized() {
2840
- if (this.sessionStorageService.getItem(USER_DETAILS) && this.activityUrl() && this.userAuthorised === undefined) {
2841
- this.getActivities(ActivityService.DUMMY_CASE_REFERENCE).subscribe(() => this.userAuthorised = true, error => {
2842
- this.userAuthorised = [401, 403].indexOf(error.status) <= -1;
2843
- });
2580
+ removeGreyBar(el) {
2581
+ const divSelector = el.nativeElement.querySelector('div');
2582
+ if (divSelector) {
2583
+ this.renderer.removeClass(divSelector, 'show-condition-grey-bar');
2844
2584
  }
2845
2585
  }
2846
- activityUrl() {
2847
- return this.appConfig.getActivityUrl();
2586
+ addToggledToShow(fieldId) {
2587
+ this.fieldsToggledToShow.push(fieldId);
2848
2588
  }
2849
- logUserMayNotBeAuthenticated(error) {
2850
- this.logger.error('User may not be authenticated. Activity request was not sent.', { error });
2589
+ removeToggledToShow(fieldId) {
2590
+ this.fieldsToggledToShow = this.fieldsToggledToShow.filter(id => id !== fieldId);
2851
2591
  }
2852
- static ɵfac = function ActivityService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ActivityService)(i0.ɵɵinject(HttpService), i0.ɵɵinject(AbstractAppConfig), i0.ɵɵinject(SessionStorageService)); };
2853
- static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: ActivityService, factory: ActivityService.ɵfac });
2592
+ wasToggledToShow(fieldId) {
2593
+ return this.fieldsToggledToShow.find(id => id === fieldId) !== undefined;
2594
+ }
2595
+ reset() {
2596
+ this.fieldsToggledToShow = [];
2597
+ }
2598
+ addGreyBar(el) {
2599
+ const divSelector = el.nativeElement.querySelector('div');
2600
+ if (divSelector) {
2601
+ this.renderer.addClass(divSelector, 'show-condition-grey-bar');
2602
+ }
2603
+ }
2604
+ static ɵfac = function GreyBarService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || GreyBarService)(i0.ɵɵinject(i0.RendererFactory2)); };
2605
+ static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: GreyBarService, factory: GreyBarService.ɵfac });
2854
2606
  }
2855
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ActivityService, [{
2607
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(GreyBarService, [{
2856
2608
  type: Injectable
2857
- }], () => [{ type: HttpService }, { type: AbstractAppConfig }, { type: SessionStorageService }], null); })();
2609
+ }], () => [{ type: i0.RendererFactory2 }], null); })();
2858
2610
 
2859
- // @dynamic
2860
- class ActivityPollingService {
2861
- activityService;
2862
- ngZone;
2863
- config;
2864
- logger = new StructuredLoggerService();
2865
- pendingRequests = new Map();
2866
- currentTimeoutHandle;
2867
- pollActivitiesSubscription;
2868
- pollConfig;
2869
- batchCollectionDelayMs;
2870
- maxRequestsPerBatch;
2871
- constructor(activityService, ngZone, config) {
2872
- this.activityService = activityService;
2873
- this.ngZone = ngZone;
2874
- this.config = config;
2875
- this.pollConfig = {
2876
- interval: config.getActivityNexPollRequestMs(),
2877
- attempts: config.getActivityRetry()
2611
+ var AddCommentsErrorMessage;
2612
+ (function (AddCommentsErrorMessage) {
2613
+ AddCommentsErrorMessage["FLAG_COMMENTS_NOT_ENTERED"] = "Please enter comments for this flag";
2614
+ AddCommentsErrorMessage["FLAG_COMMENTS_NOT_ENTERED_EXTERNAL"] = "Please enter comments for this support request";
2615
+ AddCommentsErrorMessage["FLAG_COMMENTS_CHAR_LIMIT_EXCEEDED"] = "Comments for this flag must be 200 characters or fewer";
2616
+ })(AddCommentsErrorMessage || (AddCommentsErrorMessage = {}));
2617
+
2618
+ var AddCommentsStep;
2619
+ (function (AddCommentsStep) {
2620
+ AddCommentsStep["HINT_TEXT"] = "Explain why you are creating this flag. Do not include any sensitive information such as personal details.";
2621
+ AddCommentsStep["HINT_TEXT_EXTERNAL"] = "Explain why you are creating this support request. Do not include any sensitive information such as personal details.";
2622
+ AddCommentsStep["CHARACTER_LIMIT_INFO"] = "You can enter up to 200 characters";
2623
+ AddCommentsStep["WARNING_TEXT"] = "The details entered here MAY be visible to the party in the future.";
2624
+ })(AddCommentsStep || (AddCommentsStep = {}));
2625
+
2626
+ var CaseFlagCheckYourAnswersPageStep;
2627
+ (function (CaseFlagCheckYourAnswersPageStep) {
2628
+ CaseFlagCheckYourAnswersPageStep["CASE_LEVEL_LOCATION"] = "Case level";
2629
+ CaseFlagCheckYourAnswersPageStep["ADD_FLAG_HEADER_TEXT"] = "Add flag to";
2630
+ CaseFlagCheckYourAnswersPageStep["ADD_FLAG_HEADER_TEXT_EXTERNAL"] = "Add support to";
2631
+ CaseFlagCheckYourAnswersPageStep["UPDATE_FLAG_HEADER_TEXT"] = "Update flag for";
2632
+ CaseFlagCheckYourAnswersPageStep["UPDATE_FLAG_HEADER_TEXT_EXTERNAL"] = "Update support for";
2633
+ CaseFlagCheckYourAnswersPageStep["FLAG_TYPE_HEADER_TEXT"] = "Flag type";
2634
+ CaseFlagCheckYourAnswersPageStep["FLAG_TYPE_HEADER_TEXT_EXTERNAL"] = "Support type";
2635
+ CaseFlagCheckYourAnswersPageStep["NONE"] = "";
2636
+ })(CaseFlagCheckYourAnswersPageStep || (CaseFlagCheckYourAnswersPageStep = {}));
2637
+
2638
+ /**
2639
+ * Create and update contexts for external users are, by definition, part of Case Flags 2.1 - thus there is no enum
2640
+ * value for these.
2641
+ */
2642
+ var CaseFlagDisplayContextParameter;
2643
+ (function (CaseFlagDisplayContextParameter) {
2644
+ CaseFlagDisplayContextParameter["CREATE"] = "#ARGUMENT(CREATE)";
2645
+ CaseFlagDisplayContextParameter["CREATE_EXTERNAL"] = "#ARGUMENT(CREATE,EXTERNAL)";
2646
+ CaseFlagDisplayContextParameter["CREATE_2_POINT_1"] = "#ARGUMENT(CREATE,VERSION2.1)";
2647
+ CaseFlagDisplayContextParameter["READ_EXTERNAL"] = "#ARGUMENT(READ,EXTERNAL)";
2648
+ CaseFlagDisplayContextParameter["UPDATE"] = "#ARGUMENT(UPDATE)";
2649
+ CaseFlagDisplayContextParameter["UPDATE_EXTERNAL"] = "#ARGUMENT(UPDATE,EXTERNAL)";
2650
+ CaseFlagDisplayContextParameter["UPDATE_2_POINT_1"] = "#ARGUMENT(UPDATE,VERSION2.1)";
2651
+ })(CaseFlagDisplayContextParameter || (CaseFlagDisplayContextParameter = {}));
2652
+
2653
+ var CaseFlagFormFields;
2654
+ (function (CaseFlagFormFields) {
2655
+ CaseFlagFormFields["FLAG_TYPE"] = "flagType";
2656
+ CaseFlagFormFields["COMMENTS"] = "flagComment";
2657
+ CaseFlagFormFields["COMMENTS_WELSH"] = "flagComment_cy";
2658
+ CaseFlagFormFields["OTHER_FLAG_DESCRIPTION"] = "otherDescription";
2659
+ CaseFlagFormFields["OTHER_FLAG_DESCRIPTION_WELSH"] = "otherDescription_cy";
2660
+ CaseFlagFormFields["STATUS"] = "status";
2661
+ CaseFlagFormFields["STATUS_CHANGE_REASON"] = "flagStatusReasonChange";
2662
+ CaseFlagFormFields["IS_WELSH_TRANSLATION_NEEDED"] = "flagIsWelshTranslationNeeded";
2663
+ CaseFlagFormFields["IS_VISIBLE_INTERNALLY_ONLY"] = "flagIsVisibleInternallyOnly";
2664
+ })(CaseFlagFormFields || (CaseFlagFormFields = {}));
2665
+
2666
+ var CaseFlagStatus;
2667
+ (function (CaseFlagStatus) {
2668
+ CaseFlagStatus["REQUESTED"] = "Requested";
2669
+ CaseFlagStatus["ACTIVE"] = "Active";
2670
+ CaseFlagStatus["INACTIVE"] = "Inactive";
2671
+ CaseFlagStatus["NOT_APPROVED"] = "Not approved";
2672
+ })(CaseFlagStatus || (CaseFlagStatus = {}));
2673
+
2674
+ var CaseFlagSummaryListDisplayMode;
2675
+ (function (CaseFlagSummaryListDisplayMode) {
2676
+ CaseFlagSummaryListDisplayMode[CaseFlagSummaryListDisplayMode["CREATE"] = 0] = "CREATE";
2677
+ CaseFlagSummaryListDisplayMode[CaseFlagSummaryListDisplayMode["MANAGE"] = 1] = "MANAGE";
2678
+ })(CaseFlagSummaryListDisplayMode || (CaseFlagSummaryListDisplayMode = {}));
2679
+
2680
+ var CaseFlagWizardStepTitle;
2681
+ (function (CaseFlagWizardStepTitle) {
2682
+ CaseFlagWizardStepTitle["SELECT_FLAG_LOCATION"] = "Where should this flag be added?";
2683
+ CaseFlagWizardStepTitle["SELECT_FLAG_LOCATION_EXTERNAL"] = "Who is the support for?";
2684
+ CaseFlagWizardStepTitle["SELECT_CASE_FLAG"] = "Select flag type";
2685
+ CaseFlagWizardStepTitle["SELECT_CASE_FLAG_EXTERNAL"] = "Select support type";
2686
+ CaseFlagWizardStepTitle["OTHER_FLAG_TYPE_DESCRIPTION"] = "Enter a flag type";
2687
+ CaseFlagWizardStepTitle["OTHER_FLAG_TYPE_DESCRIPTION_EXTERNAL"] = "Enter a support type";
2688
+ CaseFlagWizardStepTitle["ADD_FLAG_COMMENTS"] = "Add comments for this flag";
2689
+ CaseFlagWizardStepTitle["ADD_FLAG_COMMENTS_EXTERNAL_MODE"] = "Tell us more about the request";
2690
+ CaseFlagWizardStepTitle["CONFIRM_FLAG_STATUS"] = "Confirm the status of the flag";
2691
+ CaseFlagWizardStepTitle["FLAG_STATUS"] = "Flag status";
2692
+ CaseFlagWizardStepTitle["MANAGE_CASE_FLAGS"] = "Manage case flags";
2693
+ CaseFlagWizardStepTitle["MANAGE_SUPPORT"] = "Which support is no longer needed?";
2694
+ CaseFlagWizardStepTitle["UPDATE_FLAG_TITLE"] = "Update flag";
2695
+ CaseFlagWizardStepTitle["UPDATE_FLAG_TITLE_EXTERNAL"] = "Tell us why the support is no longer needed";
2696
+ CaseFlagWizardStepTitle["UPDATE_FLAG_ADD_TRANSLATION"] = "Add translations to flag";
2697
+ CaseFlagWizardStepTitle["NONE"] = "";
2698
+ })(CaseFlagWizardStepTitle || (CaseFlagWizardStepTitle = {}));
2699
+
2700
+ var ConfirmStatusErrorMessage;
2701
+ (function (ConfirmStatusErrorMessage) {
2702
+ ConfirmStatusErrorMessage["STATUS_REASON_NOT_ENTERED"] = "Comments and/or the name of the person approving the decision should be entered";
2703
+ ConfirmStatusErrorMessage["STATUS_REASON_CHAR_LIMIT_EXCEEDED"] = "Comments must be 200 characters or fewer";
2704
+ })(ConfirmStatusErrorMessage || (ConfirmStatusErrorMessage = {}));
2705
+
2706
+ var ConfirmStatusStep;
2707
+ (function (ConfirmStatusStep) {
2708
+ ConfirmStatusStep["HINT_TEXT"] = "Describe reason for status; if choosing 'Not approved' provide name of person approving decision.";
2709
+ ConfirmStatusStep["CHARACTER_LIMIT_INFO"] = "You can enter up to 200 characters";
2710
+ })(ConfirmStatusStep || (ConfirmStatusStep = {}));
2711
+
2712
+ var SearchLanguageInterpreterErrorMessage;
2713
+ (function (SearchLanguageInterpreterErrorMessage) {
2714
+ SearchLanguageInterpreterErrorMessage["LANGUAGE_NOT_ENTERED"] = "Enter the language that will need to be interpreted";
2715
+ SearchLanguageInterpreterErrorMessage["LANGUAGE_CHAR_LIMIT_EXCEEDED"] = "You can enter up to 80 characters for the required language";
2716
+ SearchLanguageInterpreterErrorMessage["LANGUAGE_ENTERED_IN_BOTH_FIELDS"] = "The language can only be entered in one of the fields";
2717
+ })(SearchLanguageInterpreterErrorMessage || (SearchLanguageInterpreterErrorMessage = {}));
2718
+
2719
+ var SearchLanguageInterpreterStep;
2720
+ (function (SearchLanguageInterpreterStep) {
2721
+ SearchLanguageInterpreterStep["HINT_TEXT"] = "Enter the language that will need to be interpreted. If this language is not listed, you can enter it manually.";
2722
+ SearchLanguageInterpreterStep["SIGN_HINT_TEXT"] = "Enter the sign language that will need to be interpreted. If this language is not listed, you can enter it manually.";
2723
+ SearchLanguageInterpreterStep["CHECKBOX_LABEL"] = "Enter the language manually";
2724
+ SearchLanguageInterpreterStep["INPUT_LABEL"] = "Enter the language";
2725
+ })(SearchLanguageInterpreterStep || (SearchLanguageInterpreterStep = {}));
2726
+
2727
+ var SelectFlagErrorMessage;
2728
+ (function (SelectFlagErrorMessage) {
2729
+ SelectFlagErrorMessage["MANAGE_CASE_FLAGS_FLAG_NOT_SELECTED"] = "Please make a selection";
2730
+ SelectFlagErrorMessage["MANAGE_SUPPORT_FLAG_NOT_SELECTED"] = "Select which support is no longer needed";
2731
+ SelectFlagErrorMessage["NO_FLAGS"] = "This case has no flags";
2732
+ })(SelectFlagErrorMessage || (SelectFlagErrorMessage = {}));
2733
+
2734
+ var SelectFlagLocationErrorMessage;
2735
+ (function (SelectFlagLocationErrorMessage) {
2736
+ SelectFlagLocationErrorMessage["FLAG_LOCATION_NOT_SELECTED"] = "Please make a selection";
2737
+ SelectFlagLocationErrorMessage["FLAGS_NOT_CONFIGURED"] = "Flags have not been configured for this case type";
2738
+ })(SelectFlagLocationErrorMessage || (SelectFlagLocationErrorMessage = {}));
2739
+
2740
+ var SelectFlagTypeErrorMessage;
2741
+ (function (SelectFlagTypeErrorMessage) {
2742
+ SelectFlagTypeErrorMessage["FLAG_TYPE_NOT_SELECTED"] = "Please select a flag type";
2743
+ SelectFlagTypeErrorMessage["FLAG_TYPE_NOT_SELECTED_EXTERNAL"] = "Please select a support type";
2744
+ SelectFlagTypeErrorMessage["FLAG_TYPE_OPTION_NOT_SELECTED"] = "Select an option";
2745
+ SelectFlagTypeErrorMessage["FLAG_TYPE_NOT_ENTERED"] = "Please enter a flag type";
2746
+ SelectFlagTypeErrorMessage["FLAG_TYPE_NOT_ENTERED_EXTERNAL"] = "Please enter a support type";
2747
+ SelectFlagTypeErrorMessage["FLAG_TYPE_LIMIT_EXCEEDED"] = "You can enter up to 80 characters only";
2748
+ })(SelectFlagTypeErrorMessage || (SelectFlagTypeErrorMessage = {}));
2749
+
2750
+ var UpdateFlagAddTranslationErrorMessage;
2751
+ (function (UpdateFlagAddTranslationErrorMessage) {
2752
+ UpdateFlagAddTranslationErrorMessage["DESCRIPTION_CHAR_LIMIT_EXCEEDED"] = "Original description or translation must be 200 characters or fewer";
2753
+ UpdateFlagAddTranslationErrorMessage["COMMENTS_CHAR_LIMIT_EXCEEDED"] = "Original comments or translation must be 200 characters or fewer";
2754
+ })(UpdateFlagAddTranslationErrorMessage || (UpdateFlagAddTranslationErrorMessage = {}));
2755
+
2756
+ var UpdateFlagAddTranslationStep;
2757
+ (function (UpdateFlagAddTranslationStep) {
2758
+ UpdateFlagAddTranslationStep["HINT_TEXT"] = "Write translation for flag description or comments in the boxes provided.";
2759
+ UpdateFlagAddTranslationStep["CHARACTER_LIMIT_INFO"] = "You can enter up to 200 characters";
2760
+ })(UpdateFlagAddTranslationStep || (UpdateFlagAddTranslationStep = {}));
2761
+
2762
+ var UpdateFlagErrorMessage;
2763
+ (function (UpdateFlagErrorMessage) {
2764
+ UpdateFlagErrorMessage["FLAG_COMMENTS_NOT_ENTERED"] = "Please enter comments for this flag";
2765
+ UpdateFlagErrorMessage["FLAG_COMMENTS_CHAR_LIMIT_EXCEEDED"] = "Comments for this flag must be 200 characters or fewer";
2766
+ UpdateFlagErrorMessage["STATUS_REASON_NOT_ENTERED"] = "Comments and/or the name of the person approving the decision should be entered";
2767
+ UpdateFlagErrorMessage["STATUS_REASON_NOT_ENTERED_EXTERNAL"] = "You must explain why the support is no longer needed";
2768
+ UpdateFlagErrorMessage["STATUS_REASON_CHAR_LIMIT_EXCEEDED"] = "Comments must be 200 characters or fewer";
2769
+ UpdateFlagErrorMessage["NONE"] = "";
2770
+ })(UpdateFlagErrorMessage || (UpdateFlagErrorMessage = {}));
2771
+
2772
+ var UpdateFlagStep;
2773
+ (function (UpdateFlagStep) {
2774
+ UpdateFlagStep["COMMENT_HINT_TEXT_INTERNAL"] = "Explain why you are updating this flag. Do not include any sensitive information such as personal details.";
2775
+ UpdateFlagStep["COMMENT_HINT_TEXT_INTERNAL_2_POINT_1"] = "Update the comments describing the user's support needs or flag description. Do not include any sensitive information such as personal details.";
2776
+ UpdateFlagStep["COMMENT_HINT_TEXT_EXTERNAL"] = "Do not include any sensitive information such as personal details.";
2777
+ UpdateFlagStep["COMMENT_FIELD_LABEL_EXTERNAL"] = "Please provide your comments below";
2778
+ UpdateFlagStep["CHARACTER_LIMIT_INFO"] = "You can enter up to 200 characters";
2779
+ UpdateFlagStep["STATUS_HINT_TEXT"] = "Describe reason for status change.";
2780
+ UpdateFlagStep["WARNING_TEXT"] = "The details entered here MAY be visible to the party in the future.";
2781
+ })(UpdateFlagStep || (UpdateFlagStep = {}));
2782
+
2783
+ var CaseFlagFieldState;
2784
+ (function (CaseFlagFieldState) {
2785
+ CaseFlagFieldState[CaseFlagFieldState["FLAG_LOCATION"] = 0] = "FLAG_LOCATION";
2786
+ CaseFlagFieldState[CaseFlagFieldState["FLAG_TYPE"] = 1] = "FLAG_TYPE";
2787
+ CaseFlagFieldState[CaseFlagFieldState["FLAG_LANGUAGE_INTERPRETER"] = 2] = "FLAG_LANGUAGE_INTERPRETER";
2788
+ CaseFlagFieldState[CaseFlagFieldState["FLAG_COMMENTS"] = 3] = "FLAG_COMMENTS";
2789
+ CaseFlagFieldState[CaseFlagFieldState["FLAG_STATUS"] = 4] = "FLAG_STATUS";
2790
+ CaseFlagFieldState[CaseFlagFieldState["FLAG_MANAGE_CASE_FLAGS"] = 5] = "FLAG_MANAGE_CASE_FLAGS";
2791
+ CaseFlagFieldState[CaseFlagFieldState["FLAG_UPDATE"] = 6] = "FLAG_UPDATE";
2792
+ CaseFlagFieldState[CaseFlagFieldState["FLAG_UPDATE_WELSH_TRANSLATION"] = 7] = "FLAG_UPDATE_WELSH_TRANSLATION";
2793
+ })(CaseFlagFieldState || (CaseFlagFieldState = {}));
2794
+ var CaseFlagErrorMessage;
2795
+ (function (CaseFlagErrorMessage) {
2796
+ CaseFlagErrorMessage["NO_EXTERNAL_FLAGS_COLLECTION"] = "External collection for storing this case flag has not been configured for this case type";
2797
+ CaseFlagErrorMessage["NO_INTERNAL_FLAGS_COLLECTION"] = "Internal collection for storing this case flag has not been configured for this case type";
2798
+ })(CaseFlagErrorMessage || (CaseFlagErrorMessage = {}));
2799
+
2800
+ class DashPipe {
2801
+ transform(value) {
2802
+ return value ? value : '-';
2803
+ }
2804
+ static ɵfac = function DashPipe_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || DashPipe)(); };
2805
+ static ɵpipe = /*@__PURE__*/ i0.ɵɵdefinePipe({ name: "ccdDash", type: DashPipe, pure: true, standalone: false });
2806
+ }
2807
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(DashPipe, [{
2808
+ type: Pipe,
2809
+ args: [{
2810
+ name: 'ccdDash',
2811
+ standalone: false
2812
+ }]
2813
+ }], null, null); })();
2814
+
2815
+ /*
2816
+ Translate a date time format string from the Java format provided by CCD to the format supported by Angular formatDate()
2817
+ Very simple translator that maps unsupported chars to the nearest equivalent.
2818
+ If there is no equivalent puts ***x*** into the output where x is the unsupported character
2819
+
2820
+ Java format
2821
+ G era text AD; Anno Domini; A
2822
+ u year year 2004; 04
2823
+ y year-of-era year 2004; 04
2824
+ D day-of-year number 189
2825
+ M/L month-of-year number/text 7; 07; Jul; July; J
2826
+ d day-of-month number 10
2827
+
2828
+ Q/q quarter-of-year number/text 3; 03; Q3; 3rd quarter
2829
+ Y week-based-year year 1996; 96
2830
+ w week-of-week-based-year number 27
2831
+ W week-of-month number 4
2832
+ E day-of-week text Tue; Tuesday; T
2833
+ e/c localized day-of-week number/text 2; 02; Tue; Tuesday; T
2834
+ F week-of-month number 3
2835
+
2836
+ a am-pm-of-day text PM
2837
+ h clock-hour-of-am-pm (1-12) number 12
2838
+ K hour-of-am-pm (0-11) number 0
2839
+ k clock-hour-of-am-pm (1-24) number 0
2840
+
2841
+ H hour-of-day (0-23) number 0
2842
+ m minute-of-hour number 30
2843
+ s second-of-minute number 55
2844
+ S fraction-of-second fraction 978
2845
+ A milli-of-day number 1234
2846
+ n nano-of-second number 987654321
2847
+ N nano-of-day number 1234000000
2848
+
2849
+ V time-zone ID zone-id America/Los_Angeles; Z; -08:30
2850
+ z time-zone name zone-name Pacific Standard Time; PST
2851
+ O localized zone-offset offset-O GMT+8; GMT+08:00; UTC-08:00;
2852
+ X zone-offset 'Z' for zero offset-X Z; -08; -0830; -08:30; -083015; -08:30:15;
2853
+ x zone-offset offset-x +0000; -08; -0830; -08:30; -083015; -08:30:15;
2854
+ Z zone-offset offset-Z +0000; -0800; -08:00;
2855
+
2856
+ p pad next pad modifier 1
2857
+
2858
+ ' escape for text delimiter
2859
+ '' single quote literal '
2860
+ [ optional section start
2861
+ ] optional section end
2862
+ # reserved for future use
2863
+ { reserved for future use
2864
+ } reserved for future use
2865
+
2866
+ Angular dateFormat characters
2867
+ Era G, GG & GGG Abbreviated AD
2868
+ GGGG Wide Anno Domini
2869
+ GGGGG Narrow A
2870
+ Year y Numeric: minimum digits 2, 20, 201, 2017, 20173
2871
+ yy Numeric: 2 digits + zero padded 02, 20, 01, 17, 73
2872
+ yyy Numeric: 3 digits + zero padded 002, 020, 201, 2017, 20173
2873
+ yyyy Numeric: 4 digits or more + zero padded 0002, 0020, 0201, 2017, 20173
2874
+ Month M Numeric: 1 digit 9, 12
2875
+ MM Numeric: 2 digits + zero padded 09, 12
2876
+ MMM Abbreviated Sep
2877
+ MMMM Wide September
2878
+ MMMMM Narrow S
2879
+ Month standalone L Numeric: 1 digit 9, 12
2880
+ LL Numeric: 2 digits + zero padded 09, 12
2881
+ LLL Abbreviated Sep
2882
+ LLLL Wide September
2883
+ LLLLL Narrow S
2884
+ Week of year w Numeric: minimum digits 1... 53
2885
+ ww Numeric: 2 digits + zero padded 01... 53
2886
+ Week of month W Numeric: 1 digit 1... 5
2887
+ Day of month d Numeric: minimum digits 1
2888
+ dd Numeric: 2 digits + zero padded 01
2889
+ Week day E, EE & EEE Abbreviated Tue
2890
+ EEEE Wide Tuesday
2891
+ EEEEE Narrow T
2892
+ EEEEEE Short Tu
2893
+ Period a, aa & aaa Abbreviated am/pm or AM/PM
2894
+ aaaa Wide (fallback to a when missing) ante meridiem/post meridiem
2895
+ aaaaa Narrow a/p
2896
+ Period* B, BB & BBB Abbreviated mid.
2897
+ BBBB Wide am, pm, midnight, noon, morning, afternoon, evening, night
2898
+ BBBBB Narrow md
2899
+ Period standalone* b, bb & bbb Abbreviated mid.
2900
+ bbbb Wide am, pm, midnight, noon, morning, afternoon, evening, night
2901
+ bbbbb Narrow md
2902
+ Hour 1-12 h Numeric: minimum digits 1, 12
2903
+ hh Numeric: 2 digits + zero padded 01, 12
2904
+ Hour 0-23 H Numeric: minimum digits 0, 23
2905
+ HH Numeric: 2 digits + zero padded 00, 23
2906
+ Minute m Numeric: minimum digits 8, 59
2907
+ mm Numeric: 2 digits + zero padded 08, 59
2908
+ Second s Numeric: minimum digits 0... 59
2909
+ ss Numeric: 2 digits + zero padded 00... 59
2910
+ Fractional seconds S Numeric: 1 digit 0... 9
2911
+ SS Numeric: 2 digits + zero padded 00... 99
2912
+ SSS Numeric: 3 digits + zero padded (= milliseconds) 000... 999
2913
+ Zone z, zz & zzz Short specific non location format (fallback to O) GMT-8
2914
+ zzzz Long specific non location format (fallback to OOOO) GMT-08:00
2915
+ Z, ZZ & ZZZ ISO8601 basic format -0800
2916
+ ZZZZ Long localized GMT format GMT-8:00
2917
+ ZZZZZ ISO8601 extended format + Z indicator for offset 0 (= XXXXX) -08:00
2918
+ O, OO & OOO Short localized GMT format GMT-8
2919
+ OOOO Long localized GMT format GMT-08:00
2920
+ */
2921
+ class FormatTranslatorService {
2922
+ translate(javaFormat) {
2923
+ const result = [];
2924
+ let prev = '\0';
2925
+ let inQuote = false;
2926
+ const maybePush = (target, obj, flag) => {
2927
+ if (!flag) {
2928
+ target.push(obj);
2929
+ }
2878
2930
  };
2879
- this.batchCollectionDelayMs = config.getActivityBatchCollectionDelayMs();
2880
- this.maxRequestsPerBatch = config.getActivityMaxRequestPerBatch();
2881
- }
2882
- get isEnabled() {
2883
- return this.activityService.isEnabled;
2884
- }
2885
- subscribeToActivity(caseId, done) {
2886
- if (!this.isEnabled) {
2887
- return new Subject();
2888
- }
2889
- let subject = this.pendingRequests.get(caseId);
2890
- if (subject) {
2891
- subject.subscribe(done);
2892
- }
2893
- else {
2894
- // Only the first pending request should start the batch collection timer.
2895
- const wasEmpty = this.pendingRequests.size === 0;
2896
- subject = new Subject();
2897
- subject.subscribe(done);
2898
- this.addPendingRequest(caseId, subject);
2899
- if (wasEmpty) {
2900
- this.ngZone.runOutsideAngular(() => {
2901
- this.currentTimeoutHandle = setTimeout(() => this.ngZone.run(() => {
2902
- this.flushRequests();
2903
- }), this.batchCollectionDelayMs);
2904
- });
2931
+ for (const c of javaFormat) {
2932
+ switch (c) {
2933
+ case '\'':
2934
+ if (prev === '\'') {
2935
+ // literal single quote - ignore
2936
+ inQuote = false;
2937
+ }
2938
+ else {
2939
+ inQuote = !inQuote;
2940
+ }
2941
+ break;
2942
+ // Due to formatting constraints on the webapp, all 'd' characters should be replaced with 'D' (for Moment library)
2943
+ // This is because we want the date, not the day (this format will need to be converted back)
2944
+ case 'd':
2945
+ maybePush(result, 'D', inQuote);
2946
+ break;
2947
+ // moment library defines year as capital y
2948
+ case 'y':
2949
+ maybePush(result, 'Y', inQuote);
2950
+ break;
2951
+ case 'e':
2952
+ case 'c':
2953
+ maybePush(result, 'E', inQuote); // no lower case E
2954
+ break;
2955
+ case 'F':
2956
+ maybePush(result, 'W', inQuote);
2957
+ break;
2958
+ case 'K':
2959
+ maybePush(result, 'H', inQuote);
2960
+ break;
2961
+ case 'k':
2962
+ maybePush(result, 'h', inQuote);
2963
+ break;
2964
+ // commented out A change to '***' due to use in moment library for AM/PM
2965
+ // added 'a' specification to stop discrepancy in am/AM pm/PM formatting
2966
+ case 'a':
2967
+ maybePush(result, 'A', inQuote);
2968
+ break;
2969
+ case 'n':
2970
+ case 'N':
2971
+ maybePush(result, `***${c}***`, inQuote); // No way to support A - millisec of day, n - nano of second, N - nano of Day
2972
+ break;
2973
+ case 'V':
2974
+ case 'O':
2975
+ maybePush(result, 'z', inQuote);
2976
+ break;
2977
+ case 'x':
2978
+ case 'X':
2979
+ maybePush(result, 'Z', inQuote);
2980
+ break;
2981
+ default:
2982
+ maybePush(result, c, inQuote);
2905
2983
  }
2984
+ prev = c;
2906
2985
  }
2907
- if (this.pendingRequests.size >= this.maxRequestsPerBatch) {
2908
- this.flushRequests();
2909
- }
2910
- return subject;
2911
- }
2912
- stopPolling() {
2913
- if (this.pollActivitiesSubscription) {
2914
- this.pollActivitiesSubscription.unsubscribe();
2915
- }
2986
+ return result.join('');
2916
2987
  }
2917
- flushRequests() {
2918
- if (this.currentTimeoutHandle) {
2919
- clearTimeout(this.currentTimeoutHandle);
2920
- this.currentTimeoutHandle = undefined;
2988
+ showOnlyDates(dateFormat) {
2989
+ // replace 'd' character with 'D' for the moment library
2990
+ // This ensures only dates allowed
2991
+ while (dateFormat.includes('d')) {
2992
+ dateFormat = dateFormat.replace('d', 'D');
2921
2993
  }
2922
- if (!this.pendingRequests.size) {
2923
- return;
2994
+ while (dateFormat.includes('y')) {
2995
+ dateFormat = dateFormat.replace('y', 'Y');
2924
2996
  }
2925
- const requests = new Map(this.pendingRequests);
2926
- this.pendingRequests.clear();
2927
- this.performBatchRequest(requests);
2997
+ return dateFormat;
2928
2998
  }
2929
- pollActivities(...caseIds) {
2930
- if (!this.isEnabled) {
2931
- return EMPTY;
2999
+ removeTime(dateFormat) {
3000
+ // remove hours irrelevant of whether 12 or 24 hour clock
3001
+ while (dateFormat.includes('H') || dateFormat.includes('h')) {
3002
+ dateFormat = dateFormat.replace('H', '');
3003
+ dateFormat = dateFormat.replace('h', '');
2932
3004
  }
2933
- return this.polling(this.activityService.getActivities(...caseIds), this.pollConfig);
2934
- }
2935
- postViewActivity(caseId) {
2936
- return this.postActivity(caseId, ActivityService.ACTIVITY_VIEW);
2937
- }
2938
- postEditActivity(caseId) {
2939
- return this.postActivity(caseId, ActivityService.ACTIVITY_EDIT);
2940
- }
2941
- performBatchRequest(requests) {
2942
- const caseIds = Array.from(requests.keys()).join();
2943
- this.ngZone.runOutsideAngular(() => {
2944
- // run polling outside angular zone so it does not trigger change detection
2945
- this.pollActivitiesSubscription = this.pollActivities(caseIds).subscribe({
2946
- // process activity inside zone so it triggers change detection for activity.component.ts
2947
- next: (activities) => this.ngZone.run(() => {
2948
- activities.forEach((activity) => {
2949
- // Ignore activities returned for cases outside this local batch.
2950
- requests.get(activity.caseId)?.next(activity);
2951
- });
2952
- }),
2953
- error: (err) => this.ngZone.run(() => {
2954
- this.logger.error('Error while polling activities.', { error: err });
2955
- Array.from(requests.values()).forEach((subject) => subject.error(err));
2956
- })
2957
- });
2958
- });
2959
- }
2960
- postActivity(caseId, activityType) {
2961
- if (!this.isEnabled) {
2962
- return EMPTY;
3005
+ // remove minutes
3006
+ while (dateFormat.includes('m')) {
3007
+ dateFormat = dateFormat.replace('m', '');
2963
3008
  }
2964
- const pollingConfig = {
2965
- ...this.pollConfig,
2966
- interval: 5000 // inline with CCD Backend
2967
- };
2968
- return this.polling(this.activityService.postActivity(caseId, activityType), pollingConfig);
2969
- }
2970
- addPendingRequest(caseId, subject) {
2971
- this.pendingRequests.set(caseId, subject);
2972
- // Components complete their returned Subject on destroy; remove it so a later same-case subscription gets a fresh Subject.
2973
- subject.subscribe({
2974
- complete: () => this.removePendingRequest(caseId, subject),
2975
- error: () => this.removePendingRequest(caseId, subject)
2976
- });
2977
- }
2978
- removePendingRequest(caseId, subject) {
2979
- if (this.pendingRequests.get(caseId) !== subject) {
2980
- return;
3009
+ // remove seconds (s) and micro seconds (S)
3010
+ while (dateFormat.includes('S') || dateFormat.includes('s')) {
3011
+ dateFormat = dateFormat.replace('S', '');
3012
+ dateFormat = dateFormat.replace('s', '');
2981
3013
  }
2982
- this.pendingRequests.delete(caseId);
2983
- if (!this.pendingRequests.size && this.currentTimeoutHandle) {
2984
- clearTimeout(this.currentTimeoutHandle);
2985
- this.currentTimeoutHandle = undefined;
3014
+ // because there is time removal algorithm can make reasonable assumption to remove colons
3015
+ while (dateFormat.includes(':')) {
3016
+ dateFormat = dateFormat.replace(':', '');
2986
3017
  }
3018
+ return dateFormat.trim();
2987
3019
  }
2988
- polling(request$, options) {
2989
- const pollingOptions = {
2990
- interval: options.interval,
2991
- attempts: options.attempts ?? 9,
2992
- exponentialUnit: options.exponentialUnit ?? 1000
2993
- };
2994
- return concat(request$, defer(() => timer(pollingOptions.interval).pipe(switchMap(() => request$))).pipe(repeat())).pipe(
2995
- // Preserve consecutive-failure retry behaviour using the current RxJS retry config.
2996
- retry({
2997
- count: pollingOptions.attempts,
2998
- delay: (_error, retryCount) => timer(this.getExponentialRetryDelay(retryCount, pollingOptions.exponentialUnit)),
2999
- resetOnSuccess: true
3000
- }));
3001
- }
3002
- getExponentialRetryDelay(consecutiveErrorsCount, exponentialUnit) {
3003
- return Math.pow(2, consecutiveErrorsCount - 1) * exponentialUnit;
3004
- }
3005
- static ɵfac = function ActivityPollingService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ActivityPollingService)(i0.ɵɵinject(ActivityService), i0.ɵɵinject(i0.NgZone), i0.ɵɵinject(AbstractAppConfig)); };
3006
- static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: ActivityPollingService, factory: ActivityPollingService.ɵfac });
3007
- }
3008
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ActivityPollingService, [{
3009
- type: Injectable
3010
- }], () => [{ type: ActivityService }, { type: i0.NgZone }, { type: AbstractAppConfig }], null); })();
3011
-
3012
- function ActivityComponent_div_0_div_1_Template(rf, ctx) { if (rf & 1) {
3013
- i0.ɵɵelementStart(0, "div");
3014
- i0.ɵɵelement(1, "ccd-activity-icon", 5);
3015
- i0.ɵɵpipe(2, "rpxTranslate");
3016
- i0.ɵɵelementEnd();
3017
- } if (rf & 2) {
3018
- const ctx_r0 = i0.ɵɵnextContext(2);
3019
- i0.ɵɵclassProp("activityEditorsAndViewersIcons", ctx_r0.viewersPresent())("activityEditorsIcon", !ctx_r0.viewersPresent());
3020
- i0.ɵɵadvance();
3021
- i0.ɵɵproperty("description", i0.ɵɵpipeBind1(2, 5, ctx_r0.editorsText));
3022
- } }
3023
- function ActivityComponent_div_0_div_2_Template(rf, ctx) { if (rf & 1) {
3024
- i0.ɵɵelementStart(0, "div", 6);
3025
- i0.ɵɵelement(1, "ccd-activity-icon", 7);
3026
- i0.ɵɵpipe(2, "rpxTranslate");
3027
- i0.ɵɵelementEnd();
3028
- } if (rf & 2) {
3029
- const ctx_r0 = i0.ɵɵnextContext(2);
3030
- i0.ɵɵadvance();
3031
- i0.ɵɵproperty("description", i0.ɵɵpipeBind1(2, 1, ctx_r0.viewersText));
3032
- } }
3033
- function ActivityComponent_div_0_div_3_Template(rf, ctx) { if (rf & 1) {
3034
- i0.ɵɵelementStart(0, "div");
3035
- i0.ɵɵelement(1, "ccd-activity-banner", 8);
3036
- i0.ɵɵpipe(2, "rpxTranslate");
3037
- i0.ɵɵelementEnd();
3038
- } if (rf & 2) {
3039
- const ctx_r0 = i0.ɵɵnextContext(2);
3040
- i0.ɵɵadvance();
3041
- i0.ɵɵproperty("description", i0.ɵɵpipeBind1(2, 1, ctx_r0.editorsText));
3042
- } }
3043
- function ActivityComponent_div_0_div_4_Template(rf, ctx) { if (rf & 1) {
3044
- i0.ɵɵelementStart(0, "div");
3045
- i0.ɵɵelement(1, "ccd-activity-banner", 9);
3046
- i0.ɵɵpipe(2, "rpxTranslate");
3047
- i0.ɵɵelementEnd();
3048
- } if (rf & 2) {
3049
- const ctx_r0 = i0.ɵɵnextContext(2);
3050
- i0.ɵɵadvance();
3051
- i0.ɵɵproperty("description", i0.ɵɵpipeBind1(2, 1, ctx_r0.viewersText));
3052
- } }
3053
- function ActivityComponent_div_0_Template(rf, ctx) { if (rf & 1) {
3054
- i0.ɵɵelementStart(0, "div", 1);
3055
- i0.ɵɵtemplate(1, ActivityComponent_div_0_div_1_Template, 3, 7, "div", 2)(2, ActivityComponent_div_0_div_2_Template, 3, 3, "div", 3)(3, ActivityComponent_div_0_div_3_Template, 3, 3, "div", 4)(4, ActivityComponent_div_0_div_4_Template, 3, 3, "div", 4);
3056
- i0.ɵɵelementEnd();
3057
- } if (rf & 2) {
3058
- const ctx_r0 = i0.ɵɵnextContext();
3059
- i0.ɵɵadvance();
3060
- i0.ɵɵproperty("ngIf", ctx_r0.displayMode === ctx_r0.dspMode.ICON && ctx_r0.editorsPresent());
3061
- i0.ɵɵadvance();
3062
- i0.ɵɵproperty("ngIf", ctx_r0.displayMode === ctx_r0.dspMode.ICON && ctx_r0.viewersPresent());
3063
- i0.ɵɵadvance();
3064
- i0.ɵɵproperty("ngIf", ctx_r0.displayMode === ctx_r0.dspMode.BANNER && ctx_r0.editorsPresent());
3065
- i0.ɵɵadvance();
3066
- i0.ɵɵproperty("ngIf", ctx_r0.displayMode === ctx_r0.dspMode.BANNER && ctx_r0.viewersPresent());
3067
- } }
3068
- class ActivityComponent {
3069
- activityPollingService;
3070
- activity;
3071
- dspMode = DisplayMode;
3072
- viewersText;
3073
- editorsText;
3074
- subscription;
3075
- caseId;
3076
- displayMode;
3077
- VIEWERS_PREFIX = '';
3078
- VIEWERS_SUFFIX = 'viewing this case';
3079
- EDITORS_PREFIX = 'This case is being updated by ';
3080
- EDITORS_SUFFIX = '';
3081
- constructor(activityPollingService) {
3082
- this.activityPollingService = activityPollingService;
3083
- }
3084
- ngOnInit() {
3085
- this.activity = new Activity();
3086
- this.activity.caseId = this.caseId;
3087
- this.activity.editors = [];
3088
- this.activity.unknownEditors = 0;
3089
- this.activity.viewers = [];
3090
- this.activity.unknownViewers = 0;
3091
- this.viewersText = '';
3092
- this.editorsText = '';
3093
- this.subscription = this.activityPollingService.subscribeToActivity(this.caseId, newActivity => this.onActivityChange(newActivity));
3094
- }
3095
- onActivityChange(newActivity) {
3096
- this.activity = newActivity;
3097
- this.viewersText = this.generateDescription(this.VIEWERS_PREFIX, this.VIEWERS_SUFFIX, this.activity.viewers, this.activity.unknownViewers);
3098
- this.editorsText = this.generateDescription(this.EDITORS_PREFIX, this.EDITORS_SUFFIX, this.activity.editors, this.activity.unknownEditors);
3099
- }
3100
- isActivityEnabled() {
3101
- return this.activityPollingService.isEnabled;
3020
+ hasDate(value) {
3021
+ return this.translate(value).length &&
3022
+ value.toLowerCase().indexOf('d') >= 0 &&
3023
+ value.indexOf('M') >= 0 && value.toLowerCase().indexOf('y') >= 0;
3102
3024
  }
3103
- isActiveCase() {
3104
- return this.activity.editors.length || this.activity.viewers.length || this.activity.unknownEditors || this.activity.unknownViewers;
3025
+ is24Hour(value) {
3026
+ return this.translate(value).length &&
3027
+ value.indexOf('H') >= 0;
3105
3028
  }
3106
- viewersPresent() {
3107
- return (this.activity.viewers.length > 0 || this.activity.unknownViewers > 0);
3029
+ hasNoDay(value) {
3030
+ return this.translate(value).length && value.toLowerCase().indexOf('d') === -1 &&
3031
+ value.indexOf('M') >= 0 && value.toLowerCase().indexOf('y') >= 0;
3108
3032
  }
3109
- editorsPresent() {
3110
- return (this.activity.editors.length > 0 || this.activity.unknownEditors > 0);
3033
+ hasNoDayAndMonth(value) {
3034
+ return this.translate(value).length &&
3035
+ value.toLowerCase().indexOf('d') === -1 &&
3036
+ value.indexOf('M') === -1 &&
3037
+ value.toLowerCase().indexOf('y') >= 0;
3111
3038
  }
3112
- ngOnDestroy() {
3113
- if (this.subscription) {
3114
- this.subscription.complete();
3115
- }
3116
- this.activityPollingService.stopPolling();
3039
+ hasHours(value) {
3040
+ return this.translate(value).length && value.toLowerCase().indexOf('h') >= 0 && value.indexOf('m') === -1;
3117
3041
  }
3118
- generateDescription(prefix, suffix, namesArray, unknownCount) {
3119
- let resultText = prefix;
3120
- resultText += namesArray.map(activityInfo => `${activityInfo.forename} ${activityInfo.surname}`).join(', ');
3121
- if (unknownCount > 0) {
3122
- resultText += (namesArray.length > 0 ? ` and ${unknownCount} other` : `${unknownCount} user`);
3123
- resultText += (unknownCount > 1 ? 's' : '');
3124
- }
3125
- else {
3126
- resultText = this.replaceLastCommaWithAnd(resultText);
3127
- }
3128
- if (suffix.length > 0) {
3129
- if (namesArray.length + unknownCount > 1) {
3130
- resultText += ` are ${suffix}`;
3131
- }
3132
- else {
3133
- resultText += ` is ${suffix}`;
3134
- }
3135
- }
3136
- return resultText;
3042
+ hasMinutes(value) {
3043
+ return this.translate(value).length && value.indexOf('m') >= 0 && value.toLowerCase().indexOf('h') >= 0;
3137
3044
  }
3138
- replaceLastCommaWithAnd(str) {
3139
- return str.trim().replace(/,([^,]*)$/, ' and $1').split(' ').join(' ');
3045
+ hasSeconds(value) {
3046
+ return this.translate(value).length && value.toLowerCase().indexOf('s') >= 0;
3140
3047
  }
3141
- static ɵfac = function ActivityComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ActivityComponent)(i0.ɵɵdirectiveInject(ActivityPollingService)); };
3142
- static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ActivityComponent, selectors: [["ccd-activity"]], inputs: { caseId: "caseId", displayMode: "displayMode" }, standalone: false, decls: 1, vars: 1, consts: [["class", "activityComponent", 4, "ngIf"], [1, "activityComponent"], [3, "activityEditorsAndViewersIcons", "activityEditorsIcon", 4, "ngIf"], ["class", "activityViewersIcon", 4, "ngIf"], [4, "ngIf"], ["imageLink", "assets/img/editor.png", 3, "description"], [1, "activityViewersIcon"], ["imageLink", "assets/img/viewer.png", 3, "description"], ["imageLink", "assets/img/editorBanner.png", "bannerType", "editor", 3, "description"], ["imageLink", "assets/img/viewerBanner.png", "bannerType", "viewer", 3, "description"]], template: function ActivityComponent_Template(rf, ctx) { if (rf & 1) {
3143
- i0.ɵɵtemplate(0, ActivityComponent_div_0_Template, 5, 4, "div", 0);
3144
- } if (rf & 2) {
3145
- i0.ɵɵproperty("ngIf", ctx.isActivityEnabled());
3146
- } }, dependencies: [i5.NgIf, ActivityBannerComponent, ActivityIconComponent, i1.RpxTranslatePipe], styles: [".activityEditorsIcon[_ngcontent-%COMP%]{margin-left:14px}.activityEditorsAndViewersIcons[_ngcontent-%COMP%], .activityViewersIcon[_ngcontent-%COMP%]{float:left;margin-left:14px}"] });
3147
- }
3148
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ActivityComponent, [{
3149
- type: Component,
3150
- args: [{ selector: 'ccd-activity', standalone: false, template: "<div class=\"activityComponent\" *ngIf=\"isActivityEnabled()\">\n <div *ngIf=\"displayMode === dspMode.ICON && editorsPresent()\" [class.activityEditorsAndViewersIcons]=\"viewersPresent()\" [class.activityEditorsIcon]=\"!viewersPresent()\">\n <ccd-activity-icon imageLink=\"assets/img/editor.png\" [description]=\"editorsText | rpxTranslate\"></ccd-activity-icon>\n </div>\n <div *ngIf=\"displayMode === dspMode.ICON && viewersPresent()\" class=\"activityViewersIcon\">\n <ccd-activity-icon imageLink=\"assets/img/viewer.png\" [description]=\"viewersText | rpxTranslate\"></ccd-activity-icon>\n </div>\n <div *ngIf=\"displayMode === dspMode.BANNER && editorsPresent()\">\n <ccd-activity-banner imageLink=\"assets/img/editorBanner.png\" [description]=\"editorsText | rpxTranslate\" bannerType=\"editor\">\n </ccd-activity-banner>\n </div>\n <div *ngIf=\"displayMode === dspMode.BANNER && viewersPresent()\">\n <ccd-activity-banner imageLink=\"assets/img/viewerBanner.png\" [description]=\"viewersText | rpxTranslate\" bannerType=\"viewer\">\n </ccd-activity-banner>\n </div>\n</div>\n", styles: [".activityEditorsIcon{margin-left:14px}.activityEditorsAndViewersIcons,.activityViewersIcon{float:left;margin-left:14px}\n"] }]
3151
- }], () => [{ type: ActivityPollingService }], { caseId: [{
3152
- type: Input
3153
- }], displayMode: [{
3154
- type: Input
3155
- }] }); })();
3156
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ActivityComponent, { className: "ActivityComponent", filePath: "lib/shared/components/activity/activity.component.ts", lineNumber: 12 }); })();
3157
-
3158
- class ActivityModule {
3159
- static ɵfac = function ActivityModule_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ActivityModule)(); };
3160
- static ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: ActivityModule });
3161
- static ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ providers: [
3162
- ActivityService,
3163
- ActivityPollingService,
3164
- SessionStorageService,
3165
- ], imports: [CommonModule,
3166
- RouterModule,
3167
- RpxTranslationModule.forChild()] });
3048
+ static ɵfac = function FormatTranslatorService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || FormatTranslatorService)(); };
3049
+ static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: FormatTranslatorService, factory: FormatTranslatorService.ɵfac });
3168
3050
  }
3169
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ActivityModule, [{
3170
- type: NgModule,
3171
- args: [{
3172
- imports: [
3173
- CommonModule,
3174
- RouterModule,
3175
- RpxTranslationModule.forChild()
3176
- ],
3177
- declarations: [
3178
- ActivityComponent,
3179
- ActivityBannerComponent,
3180
- ActivityIconComponent,
3181
- ],
3182
- exports: [
3183
- ActivityComponent,
3184
- ActivityBannerComponent,
3185
- ActivityIconComponent,
3186
- ],
3187
- providers: [
3188
- ActivityService,
3189
- ActivityPollingService,
3190
- SessionStorageService,
3191
- ]
3192
- }]
3051
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(FormatTranslatorService, [{
3052
+ type: Injectable
3193
3053
  }], null, null); })();
3194
- (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(ActivityModule, { declarations: [ActivityComponent,
3195
- ActivityBannerComponent,
3196
- ActivityIconComponent], imports: [CommonModule,
3197
- RouterModule, i1.RpxTranslationModule], exports: [ActivityComponent,
3198
- ActivityBannerComponent,
3199
- ActivityIconComponent] }); })();
3200
3054
 
3201
- class AlertService {
3202
- router;
3203
- rpxTranslationService;
3204
- // the preserved messages
3205
- preservedError = '';
3206
- preservedWarning = '';
3207
- preservedSuccess = '';
3208
- // TODO: Remove
3209
- message;
3210
- level;
3211
- successes;
3212
- errors;
3213
- warnings;
3214
- // TODO: Remove
3215
- alerts;
3216
- successObserver;
3217
- errorObserver;
3218
- warningObserver;
3219
- // TODO: Remove
3220
- alertObserver;
3221
- preserveAlerts = false;
3222
- constructor(router, rpxTranslationService) {
3223
- this.router = router;
3224
- this.rpxTranslationService = rpxTranslationService;
3225
- this.successes = Observable
3226
- .create(observer => this.successObserver = observer).pipe(publish(), refCount());
3227
- this.successes.subscribe();
3228
- this.errors = Observable
3229
- .create(observer => this.errorObserver = observer).pipe(publish(), refCount());
3230
- this.errors.subscribe();
3231
- this.warnings = Observable
3232
- .create(observer => this.warningObserver = observer).pipe(publish(), refCount());
3233
- this.warnings.subscribe();
3234
- // TODO: Remove
3235
- this.alerts = Observable
3236
- .create(observer => this.alertObserver = observer).pipe(publish(), refCount());
3237
- this.alerts.subscribe();
3238
- this.router
3239
- .events
3240
- .subscribe(event => {
3241
- if (event instanceof NavigationStart) {
3242
- // if there is no longer a preserve alerts setting for the page then clear all observers and preserved messages
3243
- if (!this.preserveAlerts) {
3244
- this.clear();
3055
+ class DatePipe {
3056
+ formatTrans;
3057
+ static DATE_FORMAT_REGEXP = new RegExp('^(\\d{4})-?(\\d\\d)-?(\\d\\d)(?:T(\\d\\d)(?::?(\\d\\d)(?::?(\\d\\d)(?:\\.(\\d+))?)?)?(Z|([+-])(\\d\\d):?(\\d\\d))?|Z)?$');
3058
+ // 1 2 3 4 5 6 7 8 9 10 11
3059
+ static MONTHS = [
3060
+ ['Jan'], ['Feb'], ['Mar'], ['Apr'], ['May'], ['Jun'], ['Jul'], ['Aug'], ['Sep'], ['Oct'], ['Nov'], ['Dec'],
3061
+ ];
3062
+ /**
3063
+ * constructor to allow format translator to be injected
3064
+ * @param formatTrans format translator
3065
+ */
3066
+ constructor(formatTrans) {
3067
+ this.formatTrans = formatTrans;
3068
+ }
3069
+ transform(value, zone, format) {
3070
+ let resultDate = null;
3071
+ const ISO_FORMAT = 'YYYY-MM-DDTHH:mm:ss.SSSZ';
3072
+ if (value) {
3073
+ // included to avoid editing the hour twice on second pass through
3074
+ // this occurs on case details when datepipe is applied twice
3075
+ if (!value.includes('T')) {
3076
+ zone = 'utc';
3077
+ }
3078
+ const match = value.match(DatePipe.DATE_FORMAT_REGEXP);
3079
+ // Make sure we actually have a match.
3080
+ if (match) {
3081
+ let offsetDate = null;
3082
+ const date = this.getDate(match);
3083
+ if (zone === 'local') {
3084
+ offsetDate = this.getOffsetDate(date);
3085
+ }
3086
+ else {
3087
+ offsetDate = this.getDate(match);
3088
+ }
3089
+ // 'short' format is meaningful to formatDate, but not the same meaning as in the unit tests
3090
+ if (this.formatTrans && format && format !== 'short') {
3091
+ // support for java style formatting strings for dates
3092
+ format = this.translateDateFormat(format);
3093
+ resultDate = moment(offsetDate).format(format);
3094
+ }
3095
+ else {
3096
+ // RDM-1149 changed the pipe logic so that it doesn't add an hour to 'Summer Time' dates on DateTime field type
3097
+ resultDate = `${offsetDate.getDate()} ${DatePipe.MONTHS[offsetDate.getMonth()]} ${offsetDate.getFullYear()}`;
3098
+ if (match[4] && match[5] && match[6] && format !== 'short') {
3099
+ resultDate += ', ';
3100
+ resultDate += `${this.getHour(offsetDate.getHours().toString())}:`;
3101
+ resultDate += `${this.pad(offsetDate.getMinutes())}:`;
3102
+ resultDate += `${this.pad(offsetDate.getSeconds())} `;
3103
+ resultDate += (this.toInt(offsetDate.getHours().toString()) >= 12) ? 'PM' : 'AM';
3104
+ }
3245
3105
  }
3246
- // if not, then set the preserving of alerts to false so rendering to a new page
3247
- this.preserveAlerts = false;
3248
3106
  }
3249
- });
3250
- }
3251
- clear() {
3252
- this.successObserver.next(null);
3253
- this.errorObserver.next(null);
3254
- this.warningObserver.next(null);
3255
- this.preservedError = '';
3256
- this.preservedWarning = '';
3257
- this.preservedSuccess = '';
3258
- // EUI-3381.
3259
- this.alertObserver.next(null);
3260
- this.message = '';
3261
- }
3262
- error({ phrase, replacements }) {
3263
- const message = this.getTranslationWithReplacements(phrase, replacements);
3264
- this.preservedError = this.preserveMessages(message);
3265
- const alert = { level: 'error', message };
3266
- this.errorObserver.next(alert);
3267
- // EUI-3381.
3268
- this.push(alert);
3269
- }
3270
- warning({ phrase, replacements }) {
3271
- const message = this.getTranslationWithReplacements(phrase, replacements);
3272
- this.preservedWarning = this.preserveMessages(message);
3273
- const alert = { level: 'warning', message };
3274
- this.warningObserver.next(alert);
3275
- // EUI-3381.
3276
- this.push(alert);
3277
- }
3278
- success({ preserve, phrase, replacements }) {
3279
- const message = this.getTranslationWithReplacements(phrase, replacements);
3280
- this.preserveAlerts = preserve || this.preserveAlerts;
3281
- const alert = { level: 'success', message };
3282
- this.preservedSuccess = this.preserveMessages(message);
3283
- this.successObserver.next(alert);
3284
- // EUI-3381.
3285
- this.push(alert);
3107
+ else {
3108
+ // EUI-2667. See if what we've been given is actually a formatted date that
3109
+ // we could attempt to do something with.
3110
+ const parsedDate = Date.parse(value);
3111
+ // We successfully parsed it so let's use it.
3112
+ if (!isNaN(parsedDate)) {
3113
+ const d = new Date(parsedDate);
3114
+ // If what we received didn't include time, don't include it here either.
3115
+ if (value.indexOf(':') < 0) {
3116
+ const shortDate = d.toLocaleDateString('en-GB');
3117
+ const shortISO = shortDate.split('/').reverse().join('-');
3118
+ return this.transform(shortISO, zone, format);
3119
+ }
3120
+ // If it did include time, we want a full ISO string.
3121
+ const thisMoment = moment(d).format(ISO_FORMAT);
3122
+ return this.transform(thisMoment, zone, format);
3123
+ }
3124
+ }
3125
+ }
3126
+ return resultDate;
3286
3127
  }
3287
- getTranslationWithReplacements(phrase, replacements) {
3288
- let message;
3289
- if (replacements) {
3290
- this.rpxTranslationService.getTranslationWithReplacements$(phrase, replacements).subscribe(translation => {
3291
- message = translation;
3292
- });
3128
+ translateDateFormat(format) {
3129
+ if (this.formatTrans) {
3130
+ return this.formatTrans.translate(format);
3293
3131
  }
3294
3132
  else {
3295
- this.rpxTranslationService.getTranslation$(phrase).subscribe(translation => {
3296
- message = translation;
3297
- });
3133
+ return format;
3298
3134
  }
3299
- return message;
3300
3135
  }
3301
- setPreserveAlerts(preserve, urlInfo) {
3302
- // if there is no url setting then just preserve the messages
3303
- if (!urlInfo) {
3304
- this.preserveAlerts = preserve;
3136
+ getOffsetDate(date) {
3137
+ const localOffset = -date.getTimezoneOffset() / 60;
3138
+ return new Date(date.getTime() + localOffset * 3600 * 1000);
3139
+ }
3140
+ getDate(match) {
3141
+ const year = this.toInt(match[1]);
3142
+ const month = this.toInt(match[2]) - 1;
3143
+ const day = this.toInt(match[3]);
3144
+ let resultDate;
3145
+ if (match[4] && match[5] && match[6]) {
3146
+ const hour = this.toInt(match[4]);
3147
+ const minutes = this.toInt(match[5]);
3148
+ const seconds = this.toInt(match[6]);
3149
+ resultDate = new Date(year, month, day, hour, minutes, seconds, 0);
3305
3150
  }
3306
3151
  else {
3307
- // check if the url includes the sting given
3308
- this.preserveAlerts = this.currentUrlIncludesInfo(preserve, urlInfo);
3309
- }
3310
- }
3311
- currentUrlIncludesInfo(preserve, urlInfo) {
3312
- // loop through the list of strings and check the router includes all of them
3313
- for (const urlSnip of urlInfo) {
3314
- if (!this.router.url.includes(urlSnip)) {
3315
- // return the opposite boolean value if the router does not include one of the strings
3316
- return !preserve;
3317
- }
3152
+ resultDate = new Date(year, month, day);
3318
3153
  }
3319
- // return the boolean value if all strings are in the url
3320
- return preserve;
3321
- }
3322
- isPreserveAlerts() {
3323
- return this.preserveAlerts;
3154
+ return resultDate;
3324
3155
  }
3325
- preserveMessages(message) {
3326
- // preserve the messages if set to preserve them
3327
- if (this.isPreserveAlerts()) {
3328
- return message;
3156
+ getHour(hourStr) {
3157
+ let hourNum = this.toInt(hourStr);
3158
+ if (hourNum > 12) {
3159
+ hourNum = hourNum - 12;
3329
3160
  }
3330
- else {
3331
- return '';
3161
+ else if (hourNum === 0) {
3162
+ hourNum = 12;
3332
3163
  }
3164
+ return hourNum;
3333
3165
  }
3334
- // TODO: Remove
3335
- push(msgObject) {
3336
- this.message = msgObject.message;
3337
- this.level = msgObject.level;
3338
- this.alertObserver.next({
3339
- level: this.level,
3340
- message: this.message
3341
- });
3166
+ toInt(str) {
3167
+ return parseInt(str, 10);
3342
3168
  }
3343
- static ɵfac = function AlertService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || AlertService)(i0.ɵɵinject(i1$1.Router), i0.ɵɵinject(i1.RpxTranslationService)); };
3344
- static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AlertService, factory: AlertService.ɵfac });
3169
+ pad(num, padNum = 2) {
3170
+ const val = num !== undefined ? num.toString() : '';
3171
+ return val.length >= padNum ? val : new Array(padNum - val.length + 1).join('0') + val;
3172
+ }
3173
+ static ɵfac = function DatePipe_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || DatePipe)(i0.ɵɵdirectiveInject(FormatTranslatorService, 16)); };
3174
+ static ɵpipe = /*@__PURE__*/ i0.ɵɵdefinePipe({ name: "ccdDate", type: DatePipe, pure: true, standalone: false });
3345
3175
  }
3346
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AlertService, [{
3347
- type: Injectable
3348
- }], () => [{ type: i1$1.Router }, { type: i1.RpxTranslationService }], null); })();
3176
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(DatePipe, [{
3177
+ type: Pipe,
3178
+ args: [{
3179
+ name: 'ccdDate',
3180
+ standalone: false
3181
+ }]
3182
+ }], () => [{ type: FormatTranslatorService }], null); })();
3349
3183
 
3350
- class DraftService {
3351
- http;
3352
- appConfig;
3353
- errorService;
3354
- static V2_MEDIATYPE_DRAFT_CREATE = 'application/vnd.uk.gov.hmcts.ccd-data-store-api.ui-draft-create.v2+json;charset=UTF-8';
3355
- static V2_MEDIATYPE_DRAFT_UPDATE = 'application/vnd.uk.gov.hmcts.ccd-data-store-api.ui-draft-update.v2+json;charset=UTF-8';
3356
- static V2_MEDIATYPE_DRAFT_READ = 'application/vnd.uk.gov.hmcts.ccd-data-store-api.ui-draft-read.v2+json;charset=UTF-8';
3357
- static V2_MEDIATYPE_DRAFT_DELETE = 'application/vnd.uk.gov.hmcts.ccd-data-store-api.ui-draft-delete.v2+json;charset=UTF-8';
3358
- constructor(http, appConfig, errorService) {
3359
- this.http = http;
3360
- this.appConfig = appConfig;
3361
- this.errorService = errorService;
3362
- }
3363
- createDraft(ctid, eventData) {
3364
- const saveDraftEndpoint = this.appConfig.getCreateOrUpdateDraftsUrl(ctid);
3365
- const headers = new HttpHeaders()
3366
- .set('experimental', 'true')
3367
- .set('Accept', DraftService.V2_MEDIATYPE_DRAFT_CREATE)
3368
- .set('Content-Type', 'application/json');
3369
- return this.http
3370
- .post(saveDraftEndpoint, eventData, { headers, observe: 'body' })
3371
- .pipe(catchError((error) => {
3372
- this.errorService.setError(error);
3373
- return throwError(error);
3374
- }));
3375
- }
3376
- updateDraft(ctid, draftId, eventData) {
3377
- const saveDraftEndpoint = `${this.appConfig.getCreateOrUpdateDraftsUrl(ctid)}/${draftId}`;
3378
- const headers = new HttpHeaders()
3379
- .set('experimental', 'true')
3380
- .set('Accept', DraftService.V2_MEDIATYPE_DRAFT_UPDATE)
3381
- .set('Content-Type', 'application/json');
3382
- return this.http
3383
- .put(saveDraftEndpoint, eventData, { headers, observe: 'body' })
3384
- .pipe(catchError((error) => {
3385
- this.errorService.setError(error);
3386
- return throwError(error);
3387
- }));
3388
- }
3389
- getDraft(draftId) {
3390
- const url = this.appConfig.getViewOrDeleteDraftsUrl(draftId.slice(DRAFT_PREFIX.length));
3391
- const headers = new HttpHeaders()
3392
- .set('experimental', 'true')
3393
- .set('Accept', DraftService.V2_MEDIATYPE_DRAFT_READ)
3394
- .set('Content-Type', 'application/json');
3395
- return this.http
3396
- .get(url, { headers, observe: 'body' })
3397
- .pipe(catchError((error) => {
3398
- this.errorService.setError(error);
3399
- return throwError(error);
3400
- }));
3184
+ class FieldLabelPipe {
3185
+ rpxTranslationPipe;
3186
+ constructor(rpxTranslationPipe) {
3187
+ this.rpxTranslationPipe = rpxTranslationPipe;
3401
3188
  }
3402
- deleteDraft(draftId) {
3403
- const url = this.appConfig.getViewOrDeleteDraftsUrl(draftId.slice(DRAFT_PREFIX.length));
3404
- const headers = new HttpHeaders()
3405
- .set('experimental', 'true')
3406
- .set('Accept', DraftService.V2_MEDIATYPE_DRAFT_DELETE)
3407
- .set('Content-Type', 'application/json');
3408
- return this.http
3409
- .delete(url, { headers, observe: 'body' }).pipe(catchError((error) => {
3410
- this.errorService.setError(error);
3411
- return throwError(error);
3412
- }));
3189
+ transform(field) {
3190
+ if (!field || !field.label) {
3191
+ return '';
3192
+ }
3193
+ else if (!field.display_context) {
3194
+ return this.getTranslatedLabel(field);
3195
+ }
3196
+ return this.getTranslatedLabel(field) + (field.display_context.toUpperCase() === 'OPTIONAL' ?
3197
+ ' (' + this.rpxTranslationPipe.transform('Optional') + ')' : '');
3413
3198
  }
3414
- createOrUpdateDraft(caseTypeId, draftId, caseEventData) {
3415
- if (!draftId) {
3416
- return this.createDraft(caseTypeId, caseEventData);
3199
+ getTranslatedLabel(field) {
3200
+ if (!field.isTranslated) {
3201
+ return this.rpxTranslationPipe.transform(field.label);
3417
3202
  }
3418
3203
  else {
3419
- return this.updateDraft(caseTypeId, Draft.stripDraftId(draftId), caseEventData);
3204
+ return field.label;
3420
3205
  }
3421
3206
  }
3422
- static ɵfac = function DraftService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || DraftService)(i0.ɵɵinject(HttpService), i0.ɵɵinject(AbstractAppConfig), i0.ɵɵinject(HttpErrorService)); };
3423
- static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: DraftService, factory: DraftService.ɵfac });
3424
- }
3425
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(DraftService, [{
3426
- type: Injectable
3427
- }], () => [{ type: HttpService }, { type: AbstractAppConfig }, { type: HttpErrorService }], null); })();
3428
-
3429
- class ConditionalShowRegistrarService {
3430
- registeredDirectives = [];
3431
- register(newDirective) {
3432
- this.registeredDirectives.push(newDirective);
3433
- }
3434
- reset() {
3435
- this.registeredDirectives = [];
3207
+ getOriginalLabelForYesNoTranslation(field) {
3208
+ return field.originalLabel || field.label;
3436
3209
  }
3437
- static ɵfac = function ConditionalShowRegistrarService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ConditionalShowRegistrarService)(); };
3438
- static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: ConditionalShowRegistrarService, factory: ConditionalShowRegistrarService.ɵfac });
3210
+ static ɵfac = function FieldLabelPipe_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || FieldLabelPipe)(i0.ɵɵdirectiveInject(i1.RpxTranslatePipe, 16)); };
3211
+ static ɵpipe = /*@__PURE__*/ i0.ɵɵdefinePipe({ name: "ccdFieldLabel", type: FieldLabelPipe, pure: false, standalone: false });
3439
3212
  }
3440
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ConditionalShowRegistrarService, [{
3441
- type: Injectable
3442
- }], null, null); })();
3213
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(FieldLabelPipe, [{
3214
+ type: Pipe,
3215
+ args: [{
3216
+ name: 'ccdFieldLabel',
3217
+ pure: false,
3218
+ standalone: false
3219
+ }]
3220
+ }], () => [{ type: i1.RpxTranslatePipe }], null); })();
3443
3221
 
3444
- /** Keeps track of initially hidden fields that toggle to show on the page (parent page).
3445
- * Used to decide whether to redisplay the grey bar when returning to the page during
3446
- * navigation between pages.
3447
- */
3448
- class GreyBarService {
3449
- fieldsToggledToShow = [];
3450
- renderer;
3451
- constructor(rendererFactory) {
3452
- this.renderer = rendererFactory.createRenderer(null, null);
3222
+ class FirstErrorPipe {
3223
+ rpxTranslationService;
3224
+ injector;
3225
+ asyncPipe;
3226
+ constructor(rpxTranslationService, injector) {
3227
+ this.rpxTranslationService = rpxTranslationService;
3228
+ this.injector = injector;
3229
+ this.asyncPipe = new AsyncPipe(this.injector.get(ChangeDetectorRef));
3453
3230
  }
3454
- showGreyBar(field, el) {
3455
- if (!field.isCollection()) {
3456
- this.addGreyBar(el);
3231
+ transform(value, args) {
3232
+ if (!value) {
3233
+ return '';
3457
3234
  }
3458
- }
3459
- removeGreyBar(el) {
3460
- const divSelector = el.nativeElement.querySelector('div');
3461
- if (divSelector) {
3462
- this.renderer.removeClass(divSelector, 'show-condition-grey-bar');
3235
+ if (!args) {
3236
+ args = 'Field';
3463
3237
  }
3464
- }
3465
- addToggledToShow(fieldId) {
3466
- this.fieldsToggledToShow.push(fieldId);
3467
- }
3468
- removeToggledToShow(fieldId) {
3469
- this.fieldsToggledToShow = this.fieldsToggledToShow.filter(id => id !== fieldId);
3470
- }
3471
- wasToggledToShow(fieldId) {
3472
- return this.fieldsToggledToShow.find(id => id === fieldId) !== undefined;
3473
- }
3474
- reset() {
3475
- this.fieldsToggledToShow = [];
3476
- }
3477
- addGreyBar(el) {
3478
- const divSelector = el.nativeElement.querySelector('div');
3479
- if (divSelector) {
3480
- this.renderer.addClass(divSelector, 'show-condition-grey-bar');
3238
+ const keys = Object.keys(value);
3239
+ if (!keys.length) {
3240
+ return '';
3241
+ }
3242
+ let errorMessage;
3243
+ if (keys[0] === 'required') {
3244
+ errorMessage = '%FIELDLABEL% is required';
3245
+ }
3246
+ else if (keys[0] === 'pattern') {
3247
+ errorMessage = 'The data entered is not valid for %FIELDLABEL%';
3248
+ }
3249
+ else if (keys[0] === 'markDownPattern') {
3250
+ errorMessage = 'The data entered is not valid for %FIELDLABEL%. Link mark up characters are not allowed in this field';
3251
+ }
3252
+ else if (keys[0] === 'unsafeRichText') {
3253
+ errorMessage = 'The data entered is not valid for %FIELDLABEL%. Potentially unsafe HTML content is not allowed in this field';
3254
+ }
3255
+ else if (keys[0] === 'minlength') {
3256
+ errorMessage = '%FIELDLABEL% is below the minimum length';
3257
+ }
3258
+ else if (keys[0] === 'maxlength') {
3259
+ errorMessage = '%FIELDLABEL% exceeds the maximum length';
3260
+ }
3261
+ else if (value.hasOwnProperty('matDatetimePickerParse')) {
3262
+ errorMessage = 'The date entered is not valid. Please provide a valid date';
3263
+ }
3264
+ else {
3265
+ errorMessage = value[keys[0]];
3481
3266
  }
3267
+ const o = this.rpxTranslationService.getTranslation$(args).pipe(switchMap(fieldLabel => this.rpxTranslationService.getTranslationWithReplacements$(errorMessage, { FIELDLABEL: fieldLabel })));
3268
+ return this.asyncPipe.transform(o);
3482
3269
  }
3483
- static ɵfac = function GreyBarService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || GreyBarService)(i0.ɵɵinject(i0.RendererFactory2)); };
3484
- static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: GreyBarService, factory: GreyBarService.ɵfac });
3270
+ ngOnDestroy() {
3271
+ this.asyncPipe.ngOnDestroy();
3272
+ }
3273
+ static ɵfac = function FirstErrorPipe_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || FirstErrorPipe)(i0.ɵɵdirectiveInject(i1.RpxTranslationService, 16), i0.ɵɵdirectiveInject(i0.Injector, 16)); };
3274
+ static ɵpipe = /*@__PURE__*/ i0.ɵɵdefinePipe({ name: "ccdFirstError", type: FirstErrorPipe, pure: false, standalone: false });
3485
3275
  }
3486
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(GreyBarService, [{
3487
- type: Injectable
3488
- }], () => [{ type: i0.RendererFactory2 }], null); })();
3489
-
3490
- var AddCommentsErrorMessage;
3491
- (function (AddCommentsErrorMessage) {
3492
- AddCommentsErrorMessage["FLAG_COMMENTS_NOT_ENTERED"] = "Please enter comments for this flag";
3493
- AddCommentsErrorMessage["FLAG_COMMENTS_NOT_ENTERED_EXTERNAL"] = "Please enter comments for this support request";
3494
- AddCommentsErrorMessage["FLAG_COMMENTS_CHAR_LIMIT_EXCEEDED"] = "Comments for this flag must be 200 characters or fewer";
3495
- })(AddCommentsErrorMessage || (AddCommentsErrorMessage = {}));
3496
-
3497
- var AddCommentsStep;
3498
- (function (AddCommentsStep) {
3499
- AddCommentsStep["HINT_TEXT"] = "Explain why you are creating this flag. Do not include any sensitive information such as personal details.";
3500
- AddCommentsStep["HINT_TEXT_EXTERNAL"] = "Explain why you are creating this support request. Do not include any sensitive information such as personal details.";
3501
- AddCommentsStep["CHARACTER_LIMIT_INFO"] = "You can enter up to 200 characters";
3502
- AddCommentsStep["WARNING_TEXT"] = "The details entered here MAY be visible to the party in the future.";
3503
- })(AddCommentsStep || (AddCommentsStep = {}));
3504
-
3505
- var CaseFlagCheckYourAnswersPageStep;
3506
- (function (CaseFlagCheckYourAnswersPageStep) {
3507
- CaseFlagCheckYourAnswersPageStep["CASE_LEVEL_LOCATION"] = "Case level";
3508
- CaseFlagCheckYourAnswersPageStep["ADD_FLAG_HEADER_TEXT"] = "Add flag to";
3509
- CaseFlagCheckYourAnswersPageStep["ADD_FLAG_HEADER_TEXT_EXTERNAL"] = "Add support to";
3510
- CaseFlagCheckYourAnswersPageStep["UPDATE_FLAG_HEADER_TEXT"] = "Update flag for";
3511
- CaseFlagCheckYourAnswersPageStep["UPDATE_FLAG_HEADER_TEXT_EXTERNAL"] = "Update support for";
3512
- CaseFlagCheckYourAnswersPageStep["FLAG_TYPE_HEADER_TEXT"] = "Flag type";
3513
- CaseFlagCheckYourAnswersPageStep["FLAG_TYPE_HEADER_TEXT_EXTERNAL"] = "Support type";
3514
- CaseFlagCheckYourAnswersPageStep["NONE"] = "";
3515
- })(CaseFlagCheckYourAnswersPageStep || (CaseFlagCheckYourAnswersPageStep = {}));
3516
-
3517
- /**
3518
- * Create and update contexts for external users are, by definition, part of Case Flags 2.1 - thus there is no enum
3519
- * value for these.
3520
- */
3521
- var CaseFlagDisplayContextParameter;
3522
- (function (CaseFlagDisplayContextParameter) {
3523
- CaseFlagDisplayContextParameter["CREATE"] = "#ARGUMENT(CREATE)";
3524
- CaseFlagDisplayContextParameter["CREATE_EXTERNAL"] = "#ARGUMENT(CREATE,EXTERNAL)";
3525
- CaseFlagDisplayContextParameter["CREATE_2_POINT_1"] = "#ARGUMENT(CREATE,VERSION2.1)";
3526
- CaseFlagDisplayContextParameter["READ_EXTERNAL"] = "#ARGUMENT(READ,EXTERNAL)";
3527
- CaseFlagDisplayContextParameter["UPDATE"] = "#ARGUMENT(UPDATE)";
3528
- CaseFlagDisplayContextParameter["UPDATE_EXTERNAL"] = "#ARGUMENT(UPDATE,EXTERNAL)";
3529
- CaseFlagDisplayContextParameter["UPDATE_2_POINT_1"] = "#ARGUMENT(UPDATE,VERSION2.1)";
3530
- })(CaseFlagDisplayContextParameter || (CaseFlagDisplayContextParameter = {}));
3531
-
3532
- var CaseFlagFormFields;
3533
- (function (CaseFlagFormFields) {
3534
- CaseFlagFormFields["FLAG_TYPE"] = "flagType";
3535
- CaseFlagFormFields["COMMENTS"] = "flagComment";
3536
- CaseFlagFormFields["COMMENTS_WELSH"] = "flagComment_cy";
3537
- CaseFlagFormFields["OTHER_FLAG_DESCRIPTION"] = "otherDescription";
3538
- CaseFlagFormFields["OTHER_FLAG_DESCRIPTION_WELSH"] = "otherDescription_cy";
3539
- CaseFlagFormFields["STATUS"] = "status";
3540
- CaseFlagFormFields["STATUS_CHANGE_REASON"] = "flagStatusReasonChange";
3541
- CaseFlagFormFields["IS_WELSH_TRANSLATION_NEEDED"] = "flagIsWelshTranslationNeeded";
3542
- CaseFlagFormFields["IS_VISIBLE_INTERNALLY_ONLY"] = "flagIsVisibleInternallyOnly";
3543
- })(CaseFlagFormFields || (CaseFlagFormFields = {}));
3544
-
3545
- var CaseFlagStatus;
3546
- (function (CaseFlagStatus) {
3547
- CaseFlagStatus["REQUESTED"] = "Requested";
3548
- CaseFlagStatus["ACTIVE"] = "Active";
3549
- CaseFlagStatus["INACTIVE"] = "Inactive";
3550
- CaseFlagStatus["NOT_APPROVED"] = "Not approved";
3551
- })(CaseFlagStatus || (CaseFlagStatus = {}));
3552
-
3553
- var CaseFlagSummaryListDisplayMode;
3554
- (function (CaseFlagSummaryListDisplayMode) {
3555
- CaseFlagSummaryListDisplayMode[CaseFlagSummaryListDisplayMode["CREATE"] = 0] = "CREATE";
3556
- CaseFlagSummaryListDisplayMode[CaseFlagSummaryListDisplayMode["MANAGE"] = 1] = "MANAGE";
3557
- })(CaseFlagSummaryListDisplayMode || (CaseFlagSummaryListDisplayMode = {}));
3558
-
3559
- var CaseFlagWizardStepTitle;
3560
- (function (CaseFlagWizardStepTitle) {
3561
- CaseFlagWizardStepTitle["SELECT_FLAG_LOCATION"] = "Where should this flag be added?";
3562
- CaseFlagWizardStepTitle["SELECT_FLAG_LOCATION_EXTERNAL"] = "Who is the support for?";
3563
- CaseFlagWizardStepTitle["SELECT_CASE_FLAG"] = "Select flag type";
3564
- CaseFlagWizardStepTitle["SELECT_CASE_FLAG_EXTERNAL"] = "Select support type";
3565
- CaseFlagWizardStepTitle["OTHER_FLAG_TYPE_DESCRIPTION"] = "Enter a flag type";
3566
- CaseFlagWizardStepTitle["OTHER_FLAG_TYPE_DESCRIPTION_EXTERNAL"] = "Enter a support type";
3567
- CaseFlagWizardStepTitle["ADD_FLAG_COMMENTS"] = "Add comments for this flag";
3568
- CaseFlagWizardStepTitle["ADD_FLAG_COMMENTS_EXTERNAL_MODE"] = "Tell us more about the request";
3569
- CaseFlagWizardStepTitle["CONFIRM_FLAG_STATUS"] = "Confirm the status of the flag";
3570
- CaseFlagWizardStepTitle["FLAG_STATUS"] = "Flag status";
3571
- CaseFlagWizardStepTitle["MANAGE_CASE_FLAGS"] = "Manage case flags";
3572
- CaseFlagWizardStepTitle["MANAGE_SUPPORT"] = "Which support is no longer needed?";
3573
- CaseFlagWizardStepTitle["UPDATE_FLAG_TITLE"] = "Update flag";
3574
- CaseFlagWizardStepTitle["UPDATE_FLAG_TITLE_EXTERNAL"] = "Tell us why the support is no longer needed";
3575
- CaseFlagWizardStepTitle["UPDATE_FLAG_ADD_TRANSLATION"] = "Add translations to flag";
3576
- CaseFlagWizardStepTitle["NONE"] = "";
3577
- })(CaseFlagWizardStepTitle || (CaseFlagWizardStepTitle = {}));
3578
-
3579
- var ConfirmStatusErrorMessage;
3580
- (function (ConfirmStatusErrorMessage) {
3581
- ConfirmStatusErrorMessage["STATUS_REASON_NOT_ENTERED"] = "Comments and/or the name of the person approving the decision should be entered";
3582
- ConfirmStatusErrorMessage["STATUS_REASON_CHAR_LIMIT_EXCEEDED"] = "Comments must be 200 characters or fewer";
3583
- })(ConfirmStatusErrorMessage || (ConfirmStatusErrorMessage = {}));
3584
-
3585
- var ConfirmStatusStep;
3586
- (function (ConfirmStatusStep) {
3587
- ConfirmStatusStep["HINT_TEXT"] = "Describe reason for status; if choosing 'Not approved' provide name of person approving decision.";
3588
- ConfirmStatusStep["CHARACTER_LIMIT_INFO"] = "You can enter up to 200 characters";
3589
- })(ConfirmStatusStep || (ConfirmStatusStep = {}));
3590
-
3591
- var SearchLanguageInterpreterErrorMessage;
3592
- (function (SearchLanguageInterpreterErrorMessage) {
3593
- SearchLanguageInterpreterErrorMessage["LANGUAGE_NOT_ENTERED"] = "Enter the language that will need to be interpreted";
3594
- SearchLanguageInterpreterErrorMessage["LANGUAGE_CHAR_LIMIT_EXCEEDED"] = "You can enter up to 80 characters for the required language";
3595
- SearchLanguageInterpreterErrorMessage["LANGUAGE_ENTERED_IN_BOTH_FIELDS"] = "The language can only be entered in one of the fields";
3596
- })(SearchLanguageInterpreterErrorMessage || (SearchLanguageInterpreterErrorMessage = {}));
3597
-
3598
- var SearchLanguageInterpreterStep;
3599
- (function (SearchLanguageInterpreterStep) {
3600
- SearchLanguageInterpreterStep["HINT_TEXT"] = "Enter the language that will need to be interpreted. If this language is not listed, you can enter it manually.";
3601
- SearchLanguageInterpreterStep["SIGN_HINT_TEXT"] = "Enter the sign language that will need to be interpreted. If this language is not listed, you can enter it manually.";
3602
- SearchLanguageInterpreterStep["CHECKBOX_LABEL"] = "Enter the language manually";
3603
- SearchLanguageInterpreterStep["INPUT_LABEL"] = "Enter the language";
3604
- })(SearchLanguageInterpreterStep || (SearchLanguageInterpreterStep = {}));
3605
-
3606
- var SelectFlagErrorMessage;
3607
- (function (SelectFlagErrorMessage) {
3608
- SelectFlagErrorMessage["MANAGE_CASE_FLAGS_FLAG_NOT_SELECTED"] = "Please make a selection";
3609
- SelectFlagErrorMessage["MANAGE_SUPPORT_FLAG_NOT_SELECTED"] = "Select which support is no longer needed";
3610
- SelectFlagErrorMessage["NO_FLAGS"] = "This case has no flags";
3611
- })(SelectFlagErrorMessage || (SelectFlagErrorMessage = {}));
3612
-
3613
- var SelectFlagLocationErrorMessage;
3614
- (function (SelectFlagLocationErrorMessage) {
3615
- SelectFlagLocationErrorMessage["FLAG_LOCATION_NOT_SELECTED"] = "Please make a selection";
3616
- SelectFlagLocationErrorMessage["FLAGS_NOT_CONFIGURED"] = "Flags have not been configured for this case type";
3617
- })(SelectFlagLocationErrorMessage || (SelectFlagLocationErrorMessage = {}));
3618
-
3619
- var SelectFlagTypeErrorMessage;
3620
- (function (SelectFlagTypeErrorMessage) {
3621
- SelectFlagTypeErrorMessage["FLAG_TYPE_NOT_SELECTED"] = "Please select a flag type";
3622
- SelectFlagTypeErrorMessage["FLAG_TYPE_NOT_SELECTED_EXTERNAL"] = "Please select a support type";
3623
- SelectFlagTypeErrorMessage["FLAG_TYPE_OPTION_NOT_SELECTED"] = "Select an option";
3624
- SelectFlagTypeErrorMessage["FLAG_TYPE_NOT_ENTERED"] = "Please enter a flag type";
3625
- SelectFlagTypeErrorMessage["FLAG_TYPE_NOT_ENTERED_EXTERNAL"] = "Please enter a support type";
3626
- SelectFlagTypeErrorMessage["FLAG_TYPE_LIMIT_EXCEEDED"] = "You can enter up to 80 characters only";
3627
- })(SelectFlagTypeErrorMessage || (SelectFlagTypeErrorMessage = {}));
3628
-
3629
- var UpdateFlagAddTranslationErrorMessage;
3630
- (function (UpdateFlagAddTranslationErrorMessage) {
3631
- UpdateFlagAddTranslationErrorMessage["DESCRIPTION_CHAR_LIMIT_EXCEEDED"] = "Original description or translation must be 200 characters or fewer";
3632
- UpdateFlagAddTranslationErrorMessage["COMMENTS_CHAR_LIMIT_EXCEEDED"] = "Original comments or translation must be 200 characters or fewer";
3633
- })(UpdateFlagAddTranslationErrorMessage || (UpdateFlagAddTranslationErrorMessage = {}));
3276
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(FirstErrorPipe, [{
3277
+ type: Pipe,
3278
+ args: [{
3279
+ name: 'ccdFirstError',
3280
+ pure: false,
3281
+ standalone: false
3282
+ }]
3283
+ }], () => [{ type: i1.RpxTranslationService }, { type: i0.Injector }], null); })();
3634
3284
 
3635
- var UpdateFlagAddTranslationStep;
3636
- (function (UpdateFlagAddTranslationStep) {
3637
- UpdateFlagAddTranslationStep["HINT_TEXT"] = "Write translation for flag description or comments in the boxes provided.";
3638
- UpdateFlagAddTranslationStep["CHARACTER_LIMIT_INFO"] = "You can enter up to 200 characters";
3639
- })(UpdateFlagAddTranslationStep || (UpdateFlagAddTranslationStep = {}));
3285
+ class IsCompoundPipe {
3286
+ static COMPOUND_TYPES = [
3287
+ 'Complex',
3288
+ 'Label',
3289
+ 'AddressGlobal',
3290
+ 'AddressUK',
3291
+ 'AddressGlobalUK',
3292
+ 'CasePaymentHistoryViewer',
3293
+ 'CaseHistoryViewer',
3294
+ 'Organisation',
3295
+ 'WaysToPay',
3296
+ 'ComponentLauncher',
3297
+ 'FlagLauncher',
3298
+ 'CaseFlag'
3299
+ ];
3300
+ static EXCLUDE = [
3301
+ 'CaseLink',
3302
+ 'JudicialUser'
3303
+ ];
3304
+ transform(field) {
3305
+ if (!field || !field.field_type || !field.field_type.type) {
3306
+ return false;
3307
+ }
3308
+ if (IsCompoundPipe.COMPOUND_TYPES.indexOf(field.field_type.type) !== -1) {
3309
+ if (IsCompoundPipe.EXCLUDE.indexOf(field.field_type.id) !== -1) {
3310
+ return false;
3311
+ }
3312
+ return true;
3313
+ }
3314
+ return false;
3315
+ }
3316
+ static ɵfac = function IsCompoundPipe_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || IsCompoundPipe)(); };
3317
+ static ɵpipe = /*@__PURE__*/ i0.ɵɵdefinePipe({ name: "ccdIsCompound", type: IsCompoundPipe, pure: true, standalone: false });
3318
+ }
3319
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IsCompoundPipe, [{
3320
+ type: Pipe,
3321
+ args: [{
3322
+ name: 'ccdIsCompound',
3323
+ standalone: false
3324
+ }]
3325
+ }], null, null); })();
3640
3326
 
3641
- var UpdateFlagErrorMessage;
3642
- (function (UpdateFlagErrorMessage) {
3643
- UpdateFlagErrorMessage["FLAG_COMMENTS_NOT_ENTERED"] = "Please enter comments for this flag";
3644
- UpdateFlagErrorMessage["FLAG_COMMENTS_CHAR_LIMIT_EXCEEDED"] = "Comments for this flag must be 200 characters or fewer";
3645
- UpdateFlagErrorMessage["STATUS_REASON_NOT_ENTERED"] = "Comments and/or the name of the person approving the decision should be entered";
3646
- UpdateFlagErrorMessage["STATUS_REASON_NOT_ENTERED_EXTERNAL"] = "You must explain why the support is no longer needed";
3647
- UpdateFlagErrorMessage["STATUS_REASON_CHAR_LIMIT_EXCEEDED"] = "Comments must be 200 characters or fewer";
3648
- UpdateFlagErrorMessage["NONE"] = "";
3649
- })(UpdateFlagErrorMessage || (UpdateFlagErrorMessage = {}));
3327
+ class CaseFieldService {
3328
+ isOptional(field) {
3329
+ if (!field || !field.display_context) {
3330
+ return false;
3331
+ }
3332
+ return field.display_context.toUpperCase() === 'OPTIONAL';
3333
+ }
3334
+ isReadOnly(field) {
3335
+ if (!field || !field.display_context) {
3336
+ return false;
3337
+ }
3338
+ return field.display_context.toUpperCase() === 'READONLY';
3339
+ }
3340
+ isMandatory(field) {
3341
+ if (!field || !field.display_context) {
3342
+ return false;
3343
+ }
3344
+ return field.display_context.toUpperCase() === 'MANDATORY';
3345
+ }
3346
+ isLabel(field) {
3347
+ if (!field || !field.field_type) {
3348
+ return false;
3349
+ }
3350
+ return field.field_type.type === 'Label';
3351
+ }
3352
+ static ɵfac = function CaseFieldService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CaseFieldService)(); };
3353
+ static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: CaseFieldService, factory: CaseFieldService.ɵfac });
3354
+ }
3355
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaseFieldService, [{
3356
+ type: Injectable
3357
+ }], null, null); })();
3650
3358
 
3651
- var UpdateFlagStep;
3652
- (function (UpdateFlagStep) {
3653
- UpdateFlagStep["COMMENT_HINT_TEXT_INTERNAL"] = "Explain why you are updating this flag. Do not include any sensitive information such as personal details.";
3654
- UpdateFlagStep["COMMENT_HINT_TEXT_INTERNAL_2_POINT_1"] = "Update the comments describing the user's support needs or flag description. Do not include any sensitive information such as personal details.";
3655
- UpdateFlagStep["COMMENT_HINT_TEXT_EXTERNAL"] = "Do not include any sensitive information such as personal details.";
3656
- UpdateFlagStep["COMMENT_FIELD_LABEL_EXTERNAL"] = "Please provide your comments below";
3657
- UpdateFlagStep["CHARACTER_LIMIT_INFO"] = "You can enter up to 200 characters";
3658
- UpdateFlagStep["STATUS_HINT_TEXT"] = "Describe reason for status change.";
3659
- UpdateFlagStep["WARNING_TEXT"] = "The details entered here MAY be visible to the party in the future.";
3660
- })(UpdateFlagStep || (UpdateFlagStep = {}));
3359
+ class IsMandatoryPipe {
3360
+ caseFieldService;
3361
+ constructor(caseFieldService) {
3362
+ this.caseFieldService = caseFieldService;
3363
+ }
3364
+ transform(field) {
3365
+ return this.caseFieldService.isMandatory(field);
3366
+ }
3367
+ static ɵfac = function IsMandatoryPipe_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || IsMandatoryPipe)(i0.ɵɵdirectiveInject(CaseFieldService, 16)); };
3368
+ static ɵpipe = /*@__PURE__*/ i0.ɵɵdefinePipe({ name: "ccdIsMandatory", type: IsMandatoryPipe, pure: true, standalone: false });
3369
+ }
3370
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IsMandatoryPipe, [{
3371
+ type: Pipe,
3372
+ args: [{
3373
+ name: 'ccdIsMandatory',
3374
+ standalone: false
3375
+ }]
3376
+ }], () => [{ type: CaseFieldService }], null); })();
3661
3377
 
3662
- var CaseFlagFieldState;
3663
- (function (CaseFlagFieldState) {
3664
- CaseFlagFieldState[CaseFlagFieldState["FLAG_LOCATION"] = 0] = "FLAG_LOCATION";
3665
- CaseFlagFieldState[CaseFlagFieldState["FLAG_TYPE"] = 1] = "FLAG_TYPE";
3666
- CaseFlagFieldState[CaseFlagFieldState["FLAG_LANGUAGE_INTERPRETER"] = 2] = "FLAG_LANGUAGE_INTERPRETER";
3667
- CaseFlagFieldState[CaseFlagFieldState["FLAG_COMMENTS"] = 3] = "FLAG_COMMENTS";
3668
- CaseFlagFieldState[CaseFlagFieldState["FLAG_STATUS"] = 4] = "FLAG_STATUS";
3669
- CaseFlagFieldState[CaseFlagFieldState["FLAG_MANAGE_CASE_FLAGS"] = 5] = "FLAG_MANAGE_CASE_FLAGS";
3670
- CaseFlagFieldState[CaseFlagFieldState["FLAG_UPDATE"] = 6] = "FLAG_UPDATE";
3671
- CaseFlagFieldState[CaseFlagFieldState["FLAG_UPDATE_WELSH_TRANSLATION"] = 7] = "FLAG_UPDATE_WELSH_TRANSLATION";
3672
- })(CaseFlagFieldState || (CaseFlagFieldState = {}));
3673
- var CaseFlagErrorMessage;
3674
- (function (CaseFlagErrorMessage) {
3675
- CaseFlagErrorMessage["NO_EXTERNAL_FLAGS_COLLECTION"] = "External collection for storing this case flag has not been configured for this case type";
3676
- CaseFlagErrorMessage["NO_INTERNAL_FLAGS_COLLECTION"] = "Internal collection for storing this case flag has not been configured for this case type";
3677
- })(CaseFlagErrorMessage || (CaseFlagErrorMessage = {}));
3378
+ class IsReadOnlyPipe {
3379
+ caseFieldService;
3380
+ constructor(caseFieldService) {
3381
+ this.caseFieldService = caseFieldService;
3382
+ }
3383
+ transform(field) {
3384
+ return this.caseFieldService.isReadOnly(field);
3385
+ }
3386
+ static ɵfac = function IsReadOnlyPipe_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || IsReadOnlyPipe)(i0.ɵɵdirectiveInject(CaseFieldService, 16)); };
3387
+ static ɵpipe = /*@__PURE__*/ i0.ɵɵdefinePipe({ name: "ccdIsReadOnly", type: IsReadOnlyPipe, pure: true, standalone: false });
3388
+ }
3389
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IsReadOnlyPipe, [{
3390
+ type: Pipe,
3391
+ args: [{
3392
+ name: 'ccdIsReadOnly',
3393
+ standalone: false
3394
+ }]
3395
+ }], () => [{ type: CaseFieldService }], null); })();
3678
3396
 
3679
- class DashPipe {
3680
- transform(value) {
3681
- return value ? value : '-';
3397
+ class IsReadOnlyAndNotCollectionPipe {
3398
+ caseFieldService;
3399
+ constructor(caseFieldService) {
3400
+ this.caseFieldService = caseFieldService;
3682
3401
  }
3683
- static ɵfac = function DashPipe_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || DashPipe)(); };
3684
- static ɵpipe = /*@__PURE__*/ i0.ɵɵdefinePipe({ name: "ccdDash", type: DashPipe, pure: true, standalone: false });
3402
+ transform(field) {
3403
+ if (!field || !field.field_type || !field.field_type.type) {
3404
+ return false;
3405
+ }
3406
+ if (this.isCollection(field)) {
3407
+ return false;
3408
+ }
3409
+ return this.caseFieldService.isReadOnly(field);
3410
+ }
3411
+ // CaseField @Expose() doesn't work with the pipe in here, so leaving the manual check
3412
+ isCollection(field) {
3413
+ return field.field_type && field.field_type.type === 'Collection';
3414
+ }
3415
+ static ɵfac = function IsReadOnlyAndNotCollectionPipe_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || IsReadOnlyAndNotCollectionPipe)(i0.ɵɵdirectiveInject(CaseFieldService, 16)); };
3416
+ static ɵpipe = /*@__PURE__*/ i0.ɵɵdefinePipe({ name: "ccdIsReadOnlyAndNotCollection", type: IsReadOnlyAndNotCollectionPipe, pure: true, standalone: false });
3685
3417
  }
3686
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(DashPipe, [{
3418
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IsReadOnlyAndNotCollectionPipe, [{
3687
3419
  type: Pipe,
3688
3420
  args: [{
3689
- name: 'ccdDash',
3421
+ name: 'ccdIsReadOnlyAndNotCollection',
3690
3422
  standalone: false
3691
3423
  }]
3692
- }], null, null); })();
3424
+ }], () => [{ type: CaseFieldService }], null); })();
3693
3425
 
3694
- /*
3695
- Translate a date time format string from the Java format provided by CCD to the format supported by Angular formatDate()
3696
- Very simple translator that maps unsupported chars to the nearest equivalent.
3697
- If there is no equivalent puts ***x*** into the output where x is the unsupported character
3426
+ class PaletteUtilsModule {
3427
+ static ɵfac = function PaletteUtilsModule_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || PaletteUtilsModule)(); };
3428
+ static ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: PaletteUtilsModule });
3429
+ static ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ providers: [
3430
+ IsCompoundPipe,
3431
+ RpxTranslatePipe
3432
+ ], imports: [CommonModule,
3433
+ RpxTranslationModule.forChild()] });
3434
+ }
3435
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(PaletteUtilsModule, [{
3436
+ type: NgModule,
3437
+ args: [{
3438
+ imports: [
3439
+ CommonModule,
3440
+ RpxTranslationModule.forChild()
3441
+ ],
3442
+ declarations: [
3443
+ DatePipe,
3444
+ FieldLabelPipe,
3445
+ FirstErrorPipe,
3446
+ IsCompoundPipe,
3447
+ IsMandatoryPipe,
3448
+ IsReadOnlyPipe,
3449
+ IsReadOnlyAndNotCollectionPipe,
3450
+ DashPipe
3451
+ ],
3452
+ exports: [
3453
+ DatePipe,
3454
+ FieldLabelPipe,
3455
+ FirstErrorPipe,
3456
+ IsCompoundPipe,
3457
+ IsMandatoryPipe,
3458
+ IsReadOnlyPipe,
3459
+ IsReadOnlyAndNotCollectionPipe,
3460
+ DashPipe
3461
+ ],
3462
+ providers: [
3463
+ IsCompoundPipe,
3464
+ RpxTranslatePipe
3465
+ ]
3466
+ }]
3467
+ }], null, null); })();
3468
+ (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(PaletteUtilsModule, { declarations: [DatePipe,
3469
+ FieldLabelPipe,
3470
+ FirstErrorPipe,
3471
+ IsCompoundPipe,
3472
+ IsMandatoryPipe,
3473
+ IsReadOnlyPipe,
3474
+ IsReadOnlyAndNotCollectionPipe,
3475
+ DashPipe], imports: [CommonModule, i1.RpxTranslationModule], exports: [DatePipe,
3476
+ FieldLabelPipe,
3477
+ FirstErrorPipe,
3478
+ IsCompoundPipe,
3479
+ IsMandatoryPipe,
3480
+ IsReadOnlyPipe,
3481
+ IsReadOnlyAndNotCollectionPipe,
3482
+ DashPipe] }); })();
3698
3483
 
3699
- Java format
3700
- G era text AD; Anno Domini; A
3701
- u year year 2004; 04
3702
- y year-of-era year 2004; 04
3703
- D day-of-year number 189
3704
- M/L month-of-year number/text 7; 07; Jul; July; J
3705
- d day-of-month number 10
3484
+ // tslint:disable:variable-name
3485
+ class AddressModel {
3486
+ AddressLine1 = '';
3487
+ AddressLine2 = '';
3488
+ AddressLine3 = '';
3489
+ PostTown = '';
3490
+ County = '';
3491
+ PostCode = '';
3492
+ Country = '';
3493
+ }
3706
3494
 
3707
- Q/q quarter-of-year number/text 3; 03; Q3; 3rd quarter
3708
- Y week-based-year year 1996; 96
3709
- w week-of-week-based-year number 27
3710
- W week-of-month number 4
3711
- E day-of-week text Tue; Tuesday; T
3712
- e/c localized day-of-week number/text 2; 02; Tue; Tuesday; T
3713
- F week-of-month number 3
3495
+ class Alert {
3496
+ level;
3497
+ message;
3498
+ }
3714
3499
 
3715
- a am-pm-of-day text PM
3716
- h clock-hour-of-am-pm (1-12) number 12
3717
- K hour-of-am-pm (0-11) number 0
3718
- k clock-hour-of-am-pm (1-24) number 0
3500
+ // tslint:disable:variable-name
3501
+ class CaseDetails {
3502
+ id;
3503
+ jurisdiction;
3504
+ case_type_id;
3505
+ state;
3506
+ created_date;
3507
+ last_modified;
3508
+ locked_by_user_id;
3509
+ security_level;
3510
+ case_data;
3511
+ }
3719
3512
 
3720
- H hour-of-day (0-23) number 0
3721
- m minute-of-hour number 30
3722
- s second-of-minute number 55
3723
- S fraction-of-second fraction 978
3724
- A milli-of-day number 1234
3725
- n nano-of-second number 987654321
3726
- N nano-of-day number 1234000000
3513
+ // tslint:disable:variable-name
3514
+ class CaseEventData {
3515
+ event;
3516
+ data;
3517
+ event_data; // full event data
3518
+ event_token;
3519
+ ignore_warning;
3520
+ draft_id;
3521
+ case_reference;
3522
+ }
3727
3523
 
3728
- V time-zone ID zone-id America/Los_Angeles; Z; -08:30
3729
- z time-zone name zone-name Pacific Standard Time; PST
3730
- O localized zone-offset offset-O GMT+8; GMT+08:00; UTC-08:00;
3731
- X zone-offset 'Z' for zero offset-X Z; -08; -0830; -08:30; -083015; -08:30:15;
3732
- x zone-offset offset-x +0000; -08; -0830; -08:30; -083015; -08:30:15;
3733
- Z zone-offset offset-Z +0000; -0800; -08:00;
3524
+ class WizardPageField {
3525
+ case_field_id;
3526
+ order;
3527
+ page_column_no;
3528
+ complex_field_overrides;
3529
+ }
3734
3530
 
3735
- p pad next pad modifier 1
3531
+ class FixedListItem {
3532
+ code;
3533
+ label;
3534
+ order;
3535
+ }
3736
3536
 
3737
- ' escape for text delimiter
3738
- '' single quote literal '
3739
- [ optional section start
3740
- ] optional section end
3741
- # reserved for future use
3742
- { reserved for future use
3743
- } reserved for future use
3537
+ // @dynamic
3538
+ class FieldType {
3539
+ id;
3540
+ type;
3541
+ min;
3542
+ max;
3543
+ regular_expression;
3544
+ fixed_list_items;
3545
+ complex_fields;
3546
+ collection_field_type;
3547
+ }
3548
+ __decorate([
3549
+ Type(() => FixedListItem),
3550
+ __metadata("design:type", Array)
3551
+ ], FieldType.prototype, "fixed_list_items", void 0);
3552
+ __decorate([
3553
+ Type(() => CaseField),
3554
+ __metadata("design:type", Array)
3555
+ ], FieldType.prototype, "complex_fields", void 0);
3556
+ __decorate([
3557
+ Type(() => FieldType),
3558
+ __metadata("design:type", FieldType)
3559
+ ], FieldType.prototype, "collection_field_type", void 0);
3744
3560
 
3745
- Angular dateFormat characters
3746
- Era G, GG & GGG Abbreviated AD
3747
- GGGG Wide Anno Domini
3748
- GGGGG Narrow A
3749
- Year y Numeric: minimum digits 2, 20, 201, 2017, 20173
3750
- yy Numeric: 2 digits + zero padded 02, 20, 01, 17, 73
3751
- yyy Numeric: 3 digits + zero padded 002, 020, 201, 2017, 20173
3752
- yyyy Numeric: 4 digits or more + zero padded 0002, 0020, 0201, 2017, 20173
3753
- Month M Numeric: 1 digit 9, 12
3754
- MM Numeric: 2 digits + zero padded 09, 12
3755
- MMM Abbreviated Sep
3756
- MMMM Wide September
3757
- MMMMM Narrow S
3758
- Month standalone L Numeric: 1 digit 9, 12
3759
- LL Numeric: 2 digits + zero padded 09, 12
3760
- LLL Abbreviated Sep
3761
- LLLL Wide September
3762
- LLLLL Narrow S
3763
- Week of year w Numeric: minimum digits 1... 53
3764
- ww Numeric: 2 digits + zero padded 01... 53
3765
- Week of month W Numeric: 1 digit 1... 5
3766
- Day of month d Numeric: minimum digits 1
3767
- dd Numeric: 2 digits + zero padded 01
3768
- Week day E, EE & EEE Abbreviated Tue
3769
- EEEE Wide Tuesday
3770
- EEEEE Narrow T
3771
- EEEEEE Short Tu
3772
- Period a, aa & aaa Abbreviated am/pm or AM/PM
3773
- aaaa Wide (fallback to a when missing) ante meridiem/post meridiem
3774
- aaaaa Narrow a/p
3775
- Period* B, BB & BBB Abbreviated mid.
3776
- BBBB Wide am, pm, midnight, noon, morning, afternoon, evening, night
3777
- BBBBB Narrow md
3778
- Period standalone* b, bb & bbb Abbreviated mid.
3779
- bbbb Wide am, pm, midnight, noon, morning, afternoon, evening, night
3780
- bbbbb Narrow md
3781
- Hour 1-12 h Numeric: minimum digits 1, 12
3782
- hh Numeric: 2 digits + zero padded 01, 12
3783
- Hour 0-23 H Numeric: minimum digits 0, 23
3784
- HH Numeric: 2 digits + zero padded 00, 23
3785
- Minute m Numeric: minimum digits 8, 59
3786
- mm Numeric: 2 digits + zero padded 08, 59
3787
- Second s Numeric: minimum digits 0... 59
3788
- ss Numeric: 2 digits + zero padded 00... 59
3789
- Fractional seconds S Numeric: 1 digit 0... 9
3790
- SS Numeric: 2 digits + zero padded 00... 99
3791
- SSS Numeric: 3 digits + zero padded (= milliseconds) 000... 999
3792
- Zone z, zz & zzz Short specific non location format (fallback to O) GMT-8
3793
- zzzz Long specific non location format (fallback to OOOO) GMT-08:00
3794
- Z, ZZ & ZZZ ISO8601 basic format -0800
3795
- ZZZZ Long localized GMT format GMT-8:00
3796
- ZZZZZ ISO8601 extended format + Z indicator for offset 0 (= XXXXX) -08:00
3797
- O, OO & OOO Short localized GMT format GMT-8
3798
- OOOO Long localized GMT format GMT-08:00
3799
- */
3800
- class FormatTranslatorService {
3801
- translate(javaFormat) {
3802
- const result = [];
3803
- let prev = '\0';
3804
- let inQuote = false;
3805
- const maybePush = (target, obj, flag) => {
3806
- if (!flag) {
3807
- target.push(obj);
3808
- }
3809
- };
3810
- for (const c of javaFormat) {
3811
- switch (c) {
3812
- case '\'':
3813
- if (prev === '\'') {
3814
- // literal single quote - ignore
3815
- inQuote = false;
3816
- }
3817
- else {
3818
- inQuote = !inQuote;
3819
- }
3820
- break;
3821
- // Due to formatting constraints on the webapp, all 'd' characters should be replaced with 'D' (for Moment library)
3822
- // This is because we want the date, not the day (this format will need to be converted back)
3823
- case 'd':
3824
- maybePush(result, 'D', inQuote);
3825
- break;
3826
- // moment library defines year as capital y
3827
- case 'y':
3828
- maybePush(result, 'Y', inQuote);
3829
- break;
3830
- case 'e':
3831
- case 'c':
3832
- maybePush(result, 'E', inQuote); // no lower case E
3833
- break;
3834
- case 'F':
3835
- maybePush(result, 'W', inQuote);
3836
- break;
3837
- case 'K':
3838
- maybePush(result, 'H', inQuote);
3839
- break;
3840
- case 'k':
3841
- maybePush(result, 'h', inQuote);
3842
- break;
3843
- // commented out A change to '***' due to use in moment library for AM/PM
3844
- // added 'a' specification to stop discrepancy in am/AM pm/PM formatting
3845
- case 'a':
3846
- maybePush(result, 'A', inQuote);
3847
- break;
3848
- case 'n':
3849
- case 'N':
3850
- maybePush(result, `***${c}***`, inQuote); // No way to support A - millisec of day, n - nano of second, N - nano of Day
3851
- break;
3852
- case 'V':
3853
- case 'O':
3854
- maybePush(result, 'z', inQuote);
3855
- break;
3856
- case 'x':
3857
- case 'X':
3858
- maybePush(result, 'Z', inQuote);
3859
- break;
3860
- default:
3861
- maybePush(result, c, inQuote);
3561
+ // @dynamic
3562
+ class CaseField {
3563
+ static logger = new StructuredLoggerService();
3564
+ id;
3565
+ hidden;
3566
+ hiddenCannotChange;
3567
+ label;
3568
+ originalLabel;
3569
+ noCacheLabel;
3570
+ order;
3571
+ parent;
3572
+ field_type;
3573
+ hint_text;
3574
+ security_label;
3575
+ display_context;
3576
+ display_context_parameter;
3577
+ month_format;
3578
+ show_condition;
3579
+ show_summary_change_option;
3580
+ show_summary_content_option;
3581
+ acls;
3582
+ metadata;
3583
+ formatted_value;
3584
+ retain_hidden_value;
3585
+ wizardProps;
3586
+ _value;
3587
+ _list_items = [];
3588
+ isTranslatedFlag = false;
3589
+ get value() {
3590
+ if (this.field_type && (this.field_type.type === 'DynamicList' || this.field_type.type === 'DynamicRadioList')) {
3591
+ return this._value && this._value.value ? this._value.value.code : this._value;
3592
+ }
3593
+ else if (this.field_type && this.field_type.type === 'DynamicMultiSelectList') {
3594
+ return this._value && this._value.value ? this._value.value : this._value;
3595
+ }
3596
+ else {
3597
+ return this._value;
3598
+ }
3599
+ }
3600
+ set value(value) {
3601
+ if (this.isDynamic()) {
3602
+ if (value && value instanceof Object && value.list_items) {
3603
+ this._list_items = value.list_items;
3604
+ }
3605
+ else if (!this._list_items || this._list_items.length === 0) {
3606
+ // Extract the list items from the current value if that's the only place they exist.
3607
+ this._list_items = this.list_items;
3608
+ if (!value || !value.value) {
3609
+ value = null;
3610
+ }
3862
3611
  }
3863
- prev = c;
3864
3612
  }
3865
- return result.join('');
3613
+ this._value = value;
3866
3614
  }
3867
- showOnlyDates(dateFormat) {
3868
- // replace 'd' character with 'D' for the moment library
3869
- // This ensures only dates allowed
3870
- while (dateFormat.includes('d')) {
3871
- dateFormat = dateFormat.replace('d', 'D');
3615
+ get list_items() {
3616
+ if (this.isDynamic()) {
3617
+ return this._value && this._value.list_items ? this._value.list_items : this._list_items;
3872
3618
  }
3873
- while (dateFormat.includes('y')) {
3874
- dateFormat = dateFormat.replace('y', 'Y');
3619
+ else {
3620
+ return this.field_type.fixed_list_items;
3875
3621
  }
3876
- return dateFormat;
3877
3622
  }
3878
- removeTime(dateFormat) {
3879
- // remove hours irrelevant of whether 12 or 24 hour clock
3880
- while (dateFormat.includes('H') || dateFormat.includes('h')) {
3881
- dateFormat = dateFormat.replace('H', '');
3882
- dateFormat = dateFormat.replace('h', '');
3623
+ set list_items(items) {
3624
+ if ((items && !this._list_items) || (items?.length > this._list_items?.length)) {
3625
+ this._list_items = items;
3883
3626
  }
3884
- // remove minutes
3885
- while (dateFormat.includes('m')) {
3886
- dateFormat = dateFormat.replace('m', '');
3627
+ }
3628
+ get dateTimeEntryFormat() {
3629
+ if (this.isComplexDisplay()) {
3630
+ return null;
3887
3631
  }
3888
- // remove seconds (s) and micro seconds (S)
3889
- while (dateFormat.includes('S') || dateFormat.includes('s')) {
3890
- dateFormat = dateFormat.replace('S', '');
3891
- dateFormat = dateFormat.replace('s', '');
3632
+ if (this.display_context_parameter) {
3633
+ return this.extractBracketValue(this.display_context_parameter, '#DATETIMEENTRY');
3892
3634
  }
3893
- // because there is time removal algorithm can make reasonable assumption to remove colons
3894
- while (dateFormat.includes(':')) {
3895
- dateFormat = dateFormat.replace(':', '');
3635
+ return null;
3636
+ }
3637
+ get dateTimeDisplayFormat() {
3638
+ if (this.isComplexEntry()) {
3639
+ return null;
3896
3640
  }
3897
- return dateFormat.trim();
3641
+ if (this.display_context_parameter) {
3642
+ return this.extractBracketValue(this.display_context_parameter, '#DATETIMEDISPLAY');
3643
+ }
3644
+ return null;
3898
3645
  }
3899
- hasDate(value) {
3900
- return this.translate(value).length &&
3901
- value.toLowerCase().indexOf('d') >= 0 &&
3902
- value.indexOf('M') >= 0 && value.toLowerCase().indexOf('y') >= 0;
3646
+ isComplexDisplay() {
3647
+ return (this.isComplex() || this.isCollection()) && this.isReadonly();
3903
3648
  }
3904
- is24Hour(value) {
3905
- return this.translate(value).length &&
3906
- value.indexOf('H') >= 0;
3649
+ isComplexEntry() {
3650
+ return (this.isComplex() || this.isCollection()) && (this.isOptional() || this.isMandatory());
3907
3651
  }
3908
- hasNoDay(value) {
3909
- return this.translate(value).length && value.toLowerCase().indexOf('d') === -1 &&
3910
- value.indexOf('M') >= 0 && value.toLowerCase().indexOf('y') >= 0;
3652
+ isReadonly() {
3653
+ return !_.isEmpty(this.display_context)
3654
+ && this.display_context.toUpperCase() === 'READONLY';
3911
3655
  }
3912
- hasNoDayAndMonth(value) {
3913
- return this.translate(value).length &&
3914
- value.toLowerCase().indexOf('d') === -1 &&
3915
- value.indexOf('M') === -1 &&
3916
- value.toLowerCase().indexOf('y') >= 0;
3656
+ isOptional() {
3657
+ return !_.isEmpty(this.display_context)
3658
+ && this.display_context.toUpperCase() === 'OPTIONAL';
3917
3659
  }
3918
- hasHours(value) {
3919
- return this.translate(value).length && value.toLowerCase().indexOf('h') >= 0 && value.indexOf('m') === -1;
3660
+ isMandatory() {
3661
+ return !_.isEmpty(this.display_context)
3662
+ && this.display_context.toUpperCase() === 'MANDATORY';
3920
3663
  }
3921
- hasMinutes(value) {
3922
- return this.translate(value).length && value.indexOf('m') >= 0 && value.toLowerCase().indexOf('h') >= 0;
3664
+ isCollection() {
3665
+ return this.field_type && this.field_type.type === 'Collection';
3923
3666
  }
3924
- hasSeconds(value) {
3925
- return this.translate(value).length && value.toLowerCase().indexOf('s') >= 0;
3667
+ isComplex() {
3668
+ return this.field_type && this.field_type.type === 'Complex';
3926
3669
  }
3927
- static ɵfac = function FormatTranslatorService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || FormatTranslatorService)(); };
3928
- static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: FormatTranslatorService, factory: FormatTranslatorService.ɵfac });
3929
- }
3930
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(FormatTranslatorService, [{
3931
- type: Injectable
3932
- }], null, null); })();
3933
-
3934
- class DatePipe {
3935
- formatTrans;
3936
- static DATE_FORMAT_REGEXP = new RegExp('^(\\d{4})-?(\\d\\d)-?(\\d\\d)(?:T(\\d\\d)(?::?(\\d\\d)(?::?(\\d\\d)(?:\\.(\\d+))?)?)?(Z|([+-])(\\d\\d):?(\\d\\d))?|Z)?$');
3937
- // 1 2 3 4 5 6 7 8 9 10 11
3938
- static MONTHS = [
3939
- ['Jan'], ['Feb'], ['Mar'], ['Apr'], ['May'], ['Jun'], ['Jul'], ['Aug'], ['Sep'], ['Oct'], ['Nov'], ['Dec'],
3940
- ];
3941
- /**
3942
- * constructor to allow format translator to be injected
3943
- * @param formatTrans format translator
3944
- */
3945
- constructor(formatTrans) {
3946
- this.formatTrans = formatTrans;
3670
+ isDynamic() {
3671
+ const dynamicFieldTypes = ['DynamicList', 'DynamicRadioList', 'DynamicMultiSelectList'];
3672
+ if (!this.field_type) {
3673
+ return false;
3674
+ }
3675
+ return dynamicFieldTypes.some(t => t === this.field_type.type);
3947
3676
  }
3948
- transform(value, zone, format) {
3949
- let resultDate = null;
3950
- const ISO_FORMAT = 'YYYY-MM-DDTHH:mm:ss.SSSZ';
3951
- if (value) {
3952
- // included to avoid editing the hour twice on second pass through
3953
- // this occurs on case details when datepipe is applied twice
3954
- if (!value.includes('T')) {
3955
- zone = 'utc';
3677
+ isCaseLink() {
3678
+ return this.isComplex()
3679
+ && this.field_type.id === 'CaseLink'
3680
+ && this.field_type.complex_fields.some(cf => cf.id === 'CaseReference');
3681
+ }
3682
+ extractBracketValue(fmt, paramName, leftBracket = '(', rightBracket = ')') {
3683
+ fmt = fmt.split(',')
3684
+ .find(a => a.trim().startsWith(paramName));
3685
+ if (fmt) {
3686
+ const s = fmt.indexOf(leftBracket) + 1;
3687
+ const e = fmt.indexOf(rightBracket, s);
3688
+ if (e > s && s >= 0) {
3689
+ return fmt.substr(s, (e - s));
3956
3690
  }
3957
- const match = value.match(DatePipe.DATE_FORMAT_REGEXP);
3958
- // Make sure we actually have a match.
3959
- if (match) {
3960
- let offsetDate = null;
3961
- const date = this.getDate(match);
3962
- if (zone === 'local') {
3963
- offsetDate = this.getOffsetDate(date);
3964
- }
3965
- else {
3966
- offsetDate = this.getDate(match);
3967
- }
3968
- // 'short' format is meaningful to formatDate, but not the same meaning as in the unit tests
3969
- if (this.formatTrans && format && format !== 'short') {
3970
- // support for java style formatting strings for dates
3971
- format = this.translateDateFormat(format);
3972
- resultDate = moment(offsetDate).format(format);
3973
- }
3974
- else {
3975
- // RDM-1149 changed the pipe logic so that it doesn't add an hour to 'Summer Time' dates on DateTime field type
3976
- resultDate = `${offsetDate.getDate()} ${DatePipe.MONTHS[offsetDate.getMonth()]} ${offsetDate.getFullYear()}`;
3977
- if (match[4] && match[5] && match[6] && format !== 'short') {
3978
- resultDate += ', ';
3979
- resultDate += `${this.getHour(offsetDate.getHours().toString())}:`;
3980
- resultDate += `${this.pad(offsetDate.getMinutes())}:`;
3981
- resultDate += `${this.pad(offsetDate.getSeconds())} `;
3982
- resultDate += (this.toInt(offsetDate.getHours().toString()) >= 12) ? 'PM' : 'AM';
3983
- }
3984
- }
3691
+ }
3692
+ return null;
3693
+ }
3694
+ // Ascend the hierarchy to get the full path of the field
3695
+ getHierachicalId(curr) {
3696
+ const prefix = curr ? curr + "_" : "";
3697
+ if (prefix.length < 1024) {
3698
+ if (this.parent) {
3699
+ return this.parent.getHierachicalId(prefix + this.id);
3985
3700
  }
3986
3701
  else {
3987
- // EUI-2667. See if what we've been given is actually a formatted date that
3988
- // we could attempt to do something with.
3989
- const parsedDate = Date.parse(value);
3990
- // We successfully parsed it so let's use it.
3991
- if (!isNaN(parsedDate)) {
3992
- const d = new Date(parsedDate);
3993
- // If what we received didn't include time, don't include it here either.
3994
- if (value.indexOf(':') < 0) {
3995
- const shortDate = d.toLocaleDateString('en-GB');
3996
- const shortISO = shortDate.split('/').reverse().join('-');
3997
- return this.transform(shortISO, zone, format);
3998
- }
3999
- // If it did include time, we want a full ISO string.
4000
- const thisMoment = moment(d).format(ISO_FORMAT);
4001
- return this.transform(thisMoment, zone, format);
4002
- }
3702
+ return prefix + this.id;
4003
3703
  }
4004
3704
  }
4005
- return resultDate;
4006
- }
4007
- translateDateFormat(format) {
4008
- if (this.formatTrans) {
4009
- return this.formatTrans.translate(format);
4010
- }
4011
3705
  else {
4012
- return format;
3706
+ CaseField.logger.error('Path too long, possible circular reference in case field hierarchy.');
3707
+ return this.id;
4013
3708
  }
4014
3709
  }
4015
- getOffsetDate(date) {
4016
- const localOffset = -date.getTimezoneOffset() / 60;
4017
- return new Date(date.getTime() + localOffset * 3600 * 1000);
3710
+ set isTranslated(val) {
3711
+ this.isTranslatedFlag = val;
4018
3712
  }
4019
- getDate(match) {
4020
- const year = this.toInt(match[1]);
4021
- const month = this.toInt(match[2]) - 1;
4022
- const day = this.toInt(match[3]);
4023
- let resultDate;
4024
- if (match[4] && match[5] && match[6]) {
4025
- const hour = this.toInt(match[4]);
4026
- const minutes = this.toInt(match[5]);
4027
- const seconds = this.toInt(match[6]);
4028
- resultDate = new Date(year, month, day, hour, minutes, seconds, 0);
4029
- }
4030
- else {
4031
- resultDate = new Date(year, month, day);
4032
- }
4033
- return resultDate;
3713
+ get isTranslated() {
3714
+ return this.isTranslatedFlag;
4034
3715
  }
4035
- getHour(hourStr) {
4036
- let hourNum = this.toInt(hourStr);
4037
- if (hourNum > 12) {
4038
- hourNum = hourNum - 12;
4039
- }
4040
- else if (hourNum === 0) {
4041
- hourNum = 12;
4042
- }
4043
- return hourNum;
3716
+ }
3717
+ __decorate([
3718
+ Exclude(),
3719
+ __metadata("design:type", CaseField)
3720
+ ], CaseField.prototype, "parent", void 0);
3721
+ __decorate([
3722
+ Type(() => FieldType),
3723
+ __metadata("design:type", FieldType)
3724
+ ], CaseField.prototype, "field_type", void 0);
3725
+ __decorate([
3726
+ Type(() => WizardPageField),
3727
+ __metadata("design:type", WizardPageField)
3728
+ ], CaseField.prototype, "wizardProps", void 0);
3729
+ __decorate([
3730
+ Expose(),
3731
+ __metadata("design:type", Object),
3732
+ __metadata("design:paramtypes", [Object])
3733
+ ], CaseField.prototype, "value", null);
3734
+ __decorate([
3735
+ Expose(),
3736
+ __metadata("design:type", Object),
3737
+ __metadata("design:paramtypes", [Object])
3738
+ ], CaseField.prototype, "list_items", null);
3739
+ __decorate([
3740
+ Expose(),
3741
+ __metadata("design:type", String),
3742
+ __metadata("design:paramtypes", [])
3743
+ ], CaseField.prototype, "dateTimeEntryFormat", null);
3744
+ __decorate([
3745
+ Expose(),
3746
+ __metadata("design:type", String),
3747
+ __metadata("design:paramtypes", [])
3748
+ ], CaseField.prototype, "dateTimeDisplayFormat", null);
3749
+ __decorate([
3750
+ Expose(),
3751
+ __metadata("design:type", Function),
3752
+ __metadata("design:paramtypes", []),
3753
+ __metadata("design:returntype", void 0)
3754
+ ], CaseField.prototype, "isComplexDisplay", null);
3755
+ __decorate([
3756
+ Expose(),
3757
+ __metadata("design:type", Function),
3758
+ __metadata("design:paramtypes", []),
3759
+ __metadata("design:returntype", void 0)
3760
+ ], CaseField.prototype, "isComplexEntry", null);
3761
+ __decorate([
3762
+ Expose(),
3763
+ __metadata("design:type", Function),
3764
+ __metadata("design:paramtypes", []),
3765
+ __metadata("design:returntype", void 0)
3766
+ ], CaseField.prototype, "isReadonly", null);
3767
+ __decorate([
3768
+ Expose(),
3769
+ __metadata("design:type", Function),
3770
+ __metadata("design:paramtypes", []),
3771
+ __metadata("design:returntype", void 0)
3772
+ ], CaseField.prototype, "isOptional", null);
3773
+ __decorate([
3774
+ Expose(),
3775
+ __metadata("design:type", Function),
3776
+ __metadata("design:paramtypes", []),
3777
+ __metadata("design:returntype", void 0)
3778
+ ], CaseField.prototype, "isMandatory", null);
3779
+ __decorate([
3780
+ Expose(),
3781
+ __metadata("design:type", Function),
3782
+ __metadata("design:paramtypes", []),
3783
+ __metadata("design:returntype", Boolean)
3784
+ ], CaseField.prototype, "isCollection", null);
3785
+ __decorate([
3786
+ Expose(),
3787
+ __metadata("design:type", Function),
3788
+ __metadata("design:paramtypes", []),
3789
+ __metadata("design:returntype", Boolean)
3790
+ ], CaseField.prototype, "isComplex", null);
3791
+ __decorate([
3792
+ Expose(),
3793
+ __metadata("design:type", Function),
3794
+ __metadata("design:paramtypes", []),
3795
+ __metadata("design:returntype", Boolean)
3796
+ ], CaseField.prototype, "isDynamic", null);
3797
+ __decorate([
3798
+ Expose(),
3799
+ __metadata("design:type", Function),
3800
+ __metadata("design:paramtypes", []),
3801
+ __metadata("design:returntype", Boolean)
3802
+ ], CaseField.prototype, "isCaseLink", null);
3803
+ __decorate([
3804
+ Expose(),
3805
+ __metadata("design:type", Function),
3806
+ __metadata("design:paramtypes", [String]),
3807
+ __metadata("design:returntype", String)
3808
+ ], CaseField.prototype, "getHierachicalId", null);
3809
+
3810
+ // @dynamic
3811
+ class WizardPage {
3812
+ id;
3813
+ label;
3814
+ order;
3815
+ wizard_page_fields;
3816
+ case_fields;
3817
+ show_condition;
3818
+ parsedShowCondition;
3819
+ getCol1Fields() {
3820
+ return this.case_fields?.filter(f => !f.wizardProps.page_column_no || f.wizardProps.page_column_no === 1);
4044
3821
  }
4045
- toInt(str) {
4046
- return parseInt(str, 10);
3822
+ getCol2Fields() {
3823
+ return this.case_fields?.filter(f => f.wizardProps.page_column_no === 2);
4047
3824
  }
4048
- pad(num, padNum = 2) {
4049
- const val = num !== undefined ? num.toString() : '';
4050
- return val.length >= padNum ? val : new Array(padNum - val.length + 1).join('0') + val;
3825
+ isMultiColumn() {
3826
+ return this.getCol2Fields()?.length > 0;
4051
3827
  }
4052
- static ɵfac = function DatePipe_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || DatePipe)(i0.ɵɵdirectiveInject(FormatTranslatorService, 16)); };
4053
- static ɵpipe = /*@__PURE__*/ i0.ɵɵdefinePipe({ name: "ccdDate", type: DatePipe, pure: true, standalone: false });
4054
3828
  }
4055
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(DatePipe, [{
4056
- type: Pipe,
4057
- args: [{
4058
- name: 'ccdDate',
4059
- standalone: false
4060
- }]
4061
- }], () => [{ type: FormatTranslatorService }], null); })();
3829
+ __decorate([
3830
+ Type(() => WizardPageField),
3831
+ __metadata("design:type", Array)
3832
+ ], WizardPage.prototype, "wizard_page_fields", void 0);
3833
+ __decorate([
3834
+ Type(() => CaseField),
3835
+ __metadata("design:type", Array)
3836
+ ], WizardPage.prototype, "case_fields", void 0);
3837
+
3838
+ // @dynamic
3839
+ class CaseEventTrigger {
3840
+ id;
3841
+ name;
3842
+ description;
3843
+ case_id;
3844
+ case_fields;
3845
+ event_token;
3846
+ wizard_pages;
3847
+ show_summary;
3848
+ show_event_notes;
3849
+ end_button_label;
3850
+ can_save_draft;
3851
+ hasFields() {
3852
+ return this.case_fields && this.case_fields.length !== 0;
3853
+ }
3854
+ hasPages() {
3855
+ return this.wizard_pages && this.wizard_pages.length !== 0;
3856
+ }
3857
+ }
3858
+ __decorate([
3859
+ Type(() => CaseField),
3860
+ __metadata("design:type", Array)
3861
+ ], CaseEventTrigger.prototype, "case_fields", void 0);
3862
+ __decorate([
3863
+ Type(() => WizardPage),
3864
+ __metadata("design:type", Array)
3865
+ ], CaseEventTrigger.prototype, "wizard_pages", void 0);
3866
+
3867
+ // tslint:disable:variable-name
3868
+ class CaseViewEvent {
3869
+ id;
3870
+ timestamp;
3871
+ summary;
3872
+ comment;
3873
+ event_id;
3874
+ event_name;
3875
+ state_id;
3876
+ state_name;
3877
+ user_id;
3878
+ user_last_name;
3879
+ user_first_name;
3880
+ significant_item;
3881
+ }
3882
+
3883
+ class CaseViewTrigger {
3884
+ id;
3885
+ name;
3886
+ description;
3887
+ order;
3888
+ }
3889
+
3890
+ class CaseEvent {
3891
+ id;
3892
+ name;
3893
+ post_state;
3894
+ pre_states;
3895
+ case_fields;
3896
+ description;
3897
+ order;
3898
+ acls;
3899
+ }
3900
+
3901
+ class CaseState {
3902
+ id;
3903
+ name;
3904
+ description;
3905
+ order;
3906
+ }
3907
+
3908
+ // Light clone of CaseType to be used in Jurisdiction class
3909
+ // to avoid cyclic dependency
3910
+ class CaseTypeLite {
3911
+ id;
3912
+ name;
3913
+ events;
3914
+ states;
3915
+ description;
3916
+ }
3917
+
3918
+ // @dynamics
3919
+ class CaseType {
3920
+ id;
3921
+ name;
3922
+ events;
3923
+ states;
3924
+ case_fields;
3925
+ description;
3926
+ jurisdiction;
3927
+ printEnabled;
3928
+ }
3929
+ __decorate([
3930
+ Type(() => CaseField),
3931
+ __metadata("design:type", Array)
3932
+ ], CaseType.prototype, "case_fields", void 0);
3933
+
3934
+ // tslint:disable:variable-name
3935
+ class EventCaseField {
3936
+ case_field_id;
3937
+ showCondition;
3938
+ }
3939
+
3940
+ class Jurisdiction {
3941
+ id;
3942
+ name;
3943
+ description;
3944
+ caseTypes;
3945
+ currentCaseType;
3946
+ }
3947
+
3948
+ class Banner {
3949
+ bannerDescription;
3950
+ bannerUrlText;
3951
+ bannerUrl;
3952
+ bannerViewed;
3953
+ bannerEnabled;
3954
+ }
3955
+
3956
+ // @dynamic
3957
+ class CaseTab {
3958
+ id;
3959
+ label;
3960
+ order;
3961
+ fields;
3962
+ show_condition;
3963
+ }
3964
+ __decorate([
3965
+ Type(() => CaseField),
3966
+ __metadata("design:type", Array)
3967
+ ], CaseTab.prototype, "fields", void 0);
3968
+
3969
+ // @dynamic
3970
+ class CaseView {
3971
+ case_id;
3972
+ case_type;
3973
+ state;
3974
+ channels;
3975
+ tabs;
3976
+ triggers;
3977
+ events;
3978
+ metadataFields;
3979
+ basicFields;
3980
+ case_flag;
3981
+ }
3982
+ __decorate([
3983
+ Type(() => CaseTab),
3984
+ __metadata("design:type", Array)
3985
+ ], CaseView.prototype, "tabs", void 0);
3986
+ __decorate([
3987
+ Type(() => CaseField),
3988
+ __metadata("design:type", Array)
3989
+ ], CaseView.prototype, "metadataFields", void 0);
3990
+
3991
+ class CasePrintDocument {
3992
+ name;
3993
+ type;
3994
+ url;
3995
+ }
4062
3996
 
4063
- class FieldLabelPipe {
4064
- rpxTranslationPipe;
4065
- constructor(rpxTranslationPipe) {
4066
- this.rpxTranslationPipe = rpxTranslationPipe;
4067
- }
4068
- transform(field) {
4069
- if (!field || !field.label) {
4070
- return '';
4071
- }
4072
- else if (!field.display_context) {
4073
- return this.getTranslatedLabel(field);
4074
- }
4075
- return this.getTranslatedLabel(field) + (field.display_context.toUpperCase() === 'OPTIONAL' ?
4076
- ' (' + this.rpxTranslationPipe.transform('Optional') + ')' : '');
4077
- }
4078
- getTranslatedLabel(field) {
4079
- if (!field.isTranslated) {
4080
- return this.rpxTranslationPipe.transform(field.label);
4081
- }
4082
- else {
4083
- return field.label;
4084
- }
4085
- }
4086
- getOriginalLabelForYesNoTranslation(field) {
4087
- return field.originalLabel || field.label;
4088
- }
4089
- static ɵfac = function FieldLabelPipe_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || FieldLabelPipe)(i0.ɵɵdirectiveInject(i1.RpxTranslatePipe, 16)); };
4090
- static ɵpipe = /*@__PURE__*/ i0.ɵɵdefinePipe({ name: "ccdFieldLabel", type: FieldLabelPipe, pure: false, standalone: false });
3997
+ // tslint:disable:variable-name
3998
+ class HRef {
3999
+ href;
4000
+ }
4001
+ class DocumentLinks {
4002
+ self;
4003
+ binary;
4004
+ }
4005
+ class Document {
4006
+ _links;
4007
+ originalDocumentName;
4008
+ hashToken;
4009
+ }
4010
+ class Embedded {
4011
+ documents;
4012
+ }
4013
+ class DocumentData {
4014
+ _embedded;
4015
+ documents;
4016
+ }
4017
+ class FormDocument {
4018
+ document_url;
4019
+ document_binary_url;
4020
+ document_filename;
4021
+ document_hash;
4022
+ upload_timestamp;
4091
4023
  }
4092
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(FieldLabelPipe, [{
4093
- type: Pipe,
4094
- args: [{
4095
- name: 'ccdFieldLabel',
4096
- pure: false,
4097
- standalone: false
4098
- }]
4099
- }], () => [{ type: i1.RpxTranslatePipe }], null); })();
4100
4024
 
4101
- class FirstErrorPipe {
4102
- rpxTranslationService;
4103
- injector;
4104
- asyncPipe;
4105
- constructor(rpxTranslationService, injector) {
4106
- this.rpxTranslationService = rpxTranslationService;
4107
- this.injector = injector;
4108
- this.asyncPipe = new AsyncPipe(this.injector.get(ChangeDetectorRef));
4109
- }
4110
- transform(value, args) {
4111
- if (!value) {
4112
- return '';
4113
- }
4114
- if (!args) {
4115
- args = 'Field';
4116
- }
4117
- const keys = Object.keys(value);
4118
- if (!keys.length) {
4119
- return '';
4120
- }
4121
- let errorMessage;
4122
- if (keys[0] === 'required') {
4123
- errorMessage = '%FIELDLABEL% is required';
4124
- }
4125
- else if (keys[0] === 'pattern') {
4126
- errorMessage = 'The data entered is not valid for %FIELDLABEL%';
4025
+ class OrganisationConverter {
4026
+ static toSimpleAddress(organisationModel) {
4027
+ let simpleAddress = '';
4028
+ if (organisationModel.addressLine1) {
4029
+ simpleAddress += `${organisationModel.addressLine1}<br>`;
4127
4030
  }
4128
- else if (keys[0] === 'markDownPattern') {
4129
- errorMessage = 'The data entered is not valid for %FIELDLABEL%. Link mark up characters are not allowed in this field';
4031
+ if (organisationModel.addressLine2) {
4032
+ simpleAddress += `${organisationModel.addressLine2}<br>`;
4130
4033
  }
4131
- else if (keys[0] === 'unsafeRichText') {
4132
- errorMessage = 'The data entered is not valid for %FIELDLABEL%. Potentially unsafe HTML content is not allowed in this field';
4034
+ if (organisationModel.addressLine3) {
4035
+ simpleAddress += `${organisationModel.addressLine3}<br>`;
4133
4036
  }
4134
- else if (keys[0] === 'minlength') {
4135
- errorMessage = '%FIELDLABEL% is below the minimum length';
4037
+ if (organisationModel.townCity) {
4038
+ simpleAddress += `${organisationModel.townCity}<br>`;
4136
4039
  }
4137
- else if (keys[0] === 'maxlength') {
4138
- errorMessage = '%FIELDLABEL% exceeds the maximum length';
4040
+ if (organisationModel.county) {
4041
+ simpleAddress += `${organisationModel.county}<br>`;
4139
4042
  }
4140
- else if (value.hasOwnProperty('matDatetimePickerParse')) {
4141
- errorMessage = 'The date entered is not valid. Please provide a valid date';
4043
+ if (organisationModel.country) {
4044
+ simpleAddress += `${organisationModel.country}<br>`;
4142
4045
  }
4143
- else {
4144
- errorMessage = value[keys[0]];
4046
+ if (organisationModel.postCode) {
4047
+ simpleAddress += `${organisationModel.postCode}<br>`;
4145
4048
  }
4146
- const o = this.rpxTranslationService.getTranslation$(args).pipe(switchMap(fieldLabel => this.rpxTranslationService.getTranslationWithReplacements$(errorMessage, { FIELDLABEL: fieldLabel })));
4147
- return this.asyncPipe.transform(o);
4049
+ return simpleAddress;
4148
4050
  }
4149
- ngOnDestroy() {
4150
- this.asyncPipe.ngOnDestroy();
4051
+ toSimpleOrganisationModel(organisationModel) {
4052
+ return {
4053
+ organisationIdentifier: organisationModel.organisationIdentifier,
4054
+ name: organisationModel.name,
4055
+ address: OrganisationConverter.toSimpleAddress(organisationModel)
4056
+ };
4151
4057
  }
4152
- static ɵfac = function FirstErrorPipe_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || FirstErrorPipe)(i0.ɵɵdirectiveInject(i1.RpxTranslationService, 16), i0.ɵɵdirectiveInject(i0.Injector, 16)); };
4153
- static ɵpipe = /*@__PURE__*/ i0.ɵɵdefinePipe({ name: "ccdFirstError", type: FirstErrorPipe, pure: false, standalone: false });
4058
+ static ɵfac = function OrganisationConverter_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || OrganisationConverter)(); };
4059
+ static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: OrganisationConverter, factory: OrganisationConverter.ɵfac });
4154
4060
  }
4155
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(FirstErrorPipe, [{
4156
- type: Pipe,
4157
- args: [{
4158
- name: 'ccdFirstError',
4159
- pure: false,
4160
- standalone: false
4161
- }]
4162
- }], () => [{ type: i1.RpxTranslationService }, { type: i0.Injector }], null); })();
4061
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(OrganisationConverter, [{
4062
+ type: Injectable
4063
+ }], null, null); })();
4163
4064
 
4164
- class IsCompoundPipe {
4165
- static COMPOUND_TYPES = [
4166
- 'Complex',
4167
- 'Label',
4168
- 'AddressGlobal',
4169
- 'AddressUK',
4170
- 'AddressGlobalUK',
4171
- 'CasePaymentHistoryViewer',
4172
- 'CaseHistoryViewer',
4173
- 'Organisation',
4174
- 'WaysToPay',
4175
- 'ComponentLauncher',
4176
- 'FlagLauncher',
4177
- 'CaseFlag'
4178
- ];
4179
- static EXCLUDE = [
4180
- 'CaseLink',
4181
- 'JudicialUser'
4182
- ];
4183
- transform(field) {
4184
- if (!field || !field.field_type || !field.field_type.type) {
4185
- return false;
4186
- }
4187
- if (IsCompoundPipe.COMPOUND_TYPES.indexOf(field.field_type.type) !== -1) {
4188
- if (IsCompoundPipe.EXCLUDE.indexOf(field.field_type.id) !== -1) {
4189
- return false;
4190
- }
4191
- return true;
4192
- }
4193
- return false;
4194
- }
4195
- static ɵfac = function IsCompoundPipe_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || IsCompoundPipe)(); };
4196
- static ɵpipe = /*@__PURE__*/ i0.ɵɵdefinePipe({ name: "ccdIsCompound", type: IsCompoundPipe, pure: true, standalone: false });
4065
+ class PaginationMetadata {
4066
+ totalResultsCount;
4067
+ totalPagesCount;
4197
4068
  }
4198
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IsCompoundPipe, [{
4199
- type: Pipe,
4200
- args: [{
4201
- name: 'ccdIsCompound',
4202
- standalone: false
4203
- }]
4204
- }], null, null); })();
4205
4069
 
4206
- class CaseFieldService {
4207
- isOptional(field) {
4208
- if (!field || !field.display_context) {
4209
- return false;
4210
- }
4211
- return field.display_context.toUpperCase() === 'OPTIONAL';
4212
- }
4213
- isReadOnly(field) {
4214
- if (!field || !field.display_context) {
4215
- return false;
4216
- }
4217
- return field.display_context.toUpperCase() === 'READONLY';
4070
+ function hasRoles(profile) {
4071
+ if (profile.user && profile.user.idam && Array.isArray(profile.user.idam.roles)) {
4072
+ return profile.user.idam.roles.length > 0;
4218
4073
  }
4219
- isMandatory(field) {
4220
- if (!field || !field.display_context) {
4221
- return false;
4074
+ return false;
4075
+ }
4076
+ // @dynamic
4077
+ class Profile {
4078
+ user;
4079
+ channels;
4080
+ jurisdictions;
4081
+ default;
4082
+ isSolicitor() {
4083
+ if (hasRoles(this)) {
4084
+ return this.user.idam.roles.find(r => r.endsWith('-solicitor')) !== undefined;
4222
4085
  }
4223
- return field.display_context.toUpperCase() === 'MANDATORY';
4086
+ return false;
4224
4087
  }
4225
- isLabel(field) {
4226
- if (!field || !field.field_type) {
4227
- return false;
4088
+ isCourtAdmin() {
4089
+ if (hasRoles(this)) {
4090
+ return this.user.idam.roles.find(r => r.endsWith('-courtadmin')) !== undefined;
4228
4091
  }
4229
- return field.field_type.type === 'Label';
4092
+ return false;
4230
4093
  }
4231
- static ɵfac = function CaseFieldService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CaseFieldService)(); };
4232
- static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: CaseFieldService, factory: CaseFieldService.ɵfac });
4233
4094
  }
4234
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaseFieldService, [{
4235
- type: Injectable
4236
- }], null, null); })();
4095
+ __decorate([
4096
+ Type(() => Jurisdiction),
4097
+ __metadata("design:type", Array)
4098
+ ], Profile.prototype, "jurisdictions", void 0);
4237
4099
 
4238
- class IsMandatoryPipe {
4239
- caseFieldService;
4240
- constructor(caseFieldService) {
4241
- this.caseFieldService = caseFieldService;
4242
- }
4243
- transform(field) {
4244
- return this.caseFieldService.isMandatory(field);
4100
+ class Field {
4101
+ id;
4102
+ field_type;
4103
+ elementPath;
4104
+ value;
4105
+ label;
4106
+ metadata;
4107
+ constructor(id, field_type, elementPath, value, label, metadata) {
4108
+ this.id = id;
4109
+ this.field_type = field_type;
4110
+ this.elementPath = elementPath;
4111
+ this.value = value;
4112
+ this.label = label;
4113
+ this.metadata = metadata;
4245
4114
  }
4246
- static ɵfac = function IsMandatoryPipe_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || IsMandatoryPipe)(i0.ɵɵdirectiveInject(CaseFieldService, 16)); };
4247
- static ɵpipe = /*@__PURE__*/ i0.ɵɵdefinePipe({ name: "ccdIsMandatory", type: IsMandatoryPipe, pure: true, standalone: false });
4248
4115
  }
4249
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IsMandatoryPipe, [{
4250
- type: Pipe,
4251
- args: [{
4252
- name: 'ccdIsMandatory',
4253
- standalone: false
4254
- }]
4255
- }], () => [{ type: CaseFieldService }], null); })();
4256
4116
 
4257
- class IsReadOnlyPipe {
4258
- caseFieldService;
4259
- constructor(caseFieldService) {
4260
- this.caseFieldService = caseFieldService;
4117
+ class SearchResultViewColumn {
4118
+ case_field_id;
4119
+ case_field_type;
4120
+ display_context;
4121
+ display_context_parameter;
4122
+ label;
4123
+ order;
4124
+ }
4125
+
4126
+ // @dynamic
4127
+ class SearchResultViewItem {
4128
+ case_id;
4129
+ case_fields;
4130
+ hydrated_case_fields;
4131
+ columns;
4132
+ supplementary_data;
4133
+ display_context_parameter;
4134
+ }
4135
+ __decorate([
4136
+ Type(() => CaseField),
4137
+ __metadata("design:type", Array)
4138
+ ], SearchResultViewItem.prototype, "hydrated_case_fields", void 0);
4139
+
4140
+ // @dynamic
4141
+ class SearchResultView {
4142
+ columns;
4143
+ results;
4144
+ result_error;
4145
+ hasDrafts() {
4146
+ return this.results[0]
4147
+ && this.results[0].case_id
4148
+ && Draft.isDraft(this.results[0].case_id);
4261
4149
  }
4262
- transform(field) {
4263
- return this.caseFieldService.isReadOnly(field);
4150
+ }
4151
+ __decorate([
4152
+ Type(() => SearchResultViewColumn),
4153
+ __metadata("design:type", Array)
4154
+ ], SearchResultView.prototype, "columns", void 0);
4155
+ __decorate([
4156
+ Type(() => SearchResultViewItem),
4157
+ __metadata("design:type", Array)
4158
+ ], SearchResultView.prototype, "results", void 0);
4159
+
4160
+ class SortParameters {
4161
+ comparator;
4162
+ sortOrder;
4163
+ constructor(comparator, sortOrder) {
4164
+ this.comparator = comparator;
4165
+ this.sortOrder = sortOrder;
4264
4166
  }
4265
- static ɵfac = function IsReadOnlyPipe_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || IsReadOnlyPipe)(i0.ɵɵdirectiveInject(CaseFieldService, 16)); };
4266
- static ɵpipe = /*@__PURE__*/ i0.ɵɵdefinePipe({ name: "ccdIsReadOnly", type: IsReadOnlyPipe, pure: true, standalone: false });
4267
4167
  }
4268
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IsReadOnlyPipe, [{
4269
- type: Pipe,
4270
- args: [{
4271
- name: 'ccdIsReadOnly',
4272
- standalone: false
4273
- }]
4274
- }], () => [{ type: CaseFieldService }], null); })();
4275
4168
 
4276
- class IsReadOnlyAndNotCollectionPipe {
4277
- caseFieldService;
4278
- constructor(caseFieldService) {
4279
- this.caseFieldService = caseFieldService;
4169
+ var SortOrder$1;
4170
+ (function (SortOrder) {
4171
+ SortOrder[SortOrder["ASCENDING"] = 0] = "ASCENDING";
4172
+ SortOrder[SortOrder["DESCENDING"] = 1] = "DESCENDING";
4173
+ SortOrder[SortOrder["UNSORTED"] = 2] = "UNSORTED";
4174
+ })(SortOrder$1 || (SortOrder$1 = {}));
4175
+
4176
+ const STAFF_CACHE_ROLE_CATEGORIES = new Set([
4177
+ 'ADMIN',
4178
+ 'CTSC',
4179
+ 'LEGAL_OPERATIONS'
4180
+ ]);
4181
+ const SUPPORTED_ROLE_CATEGORIES = new Set([
4182
+ ...STAFF_CACHE_ROLE_CATEGORIES,
4183
+ 'JUDICIAL',
4184
+ ]);
4185
+ // Aliases allow the definition to use the shorter, hyphenated form within #ARGUMENT(...)
4186
+ const ROLE_CATEGORY_ALIASES = {
4187
+ LEGAL_OPS: 'LEGAL_OPERATIONS'
4188
+ };
4189
+ const ARGUMENT_REGEX = /#ARGUMENT\(([^)]*)\)/;
4190
+ const CATEGORY_PREFIX = 'CATEGORY-';
4191
+ const REGION_PREFIX = 'REGION-';
4192
+ /**
4193
+ * Parses the `display_context_parameter` of a StaffUser field to determine the filters to apply
4194
+ * when searching reference data.
4195
+ *
4196
+ * Expected format: `#ARGUMENT(CATEGORY-LEGAL-OPS,CATEGORY-ADMIN,REGION-1235)`
4197
+ */
4198
+ function parseStaffUserSearchConfiguration(displayContextParameter) {
4199
+ if (!displayContextParameter) {
4200
+ return invalidConfiguration();
4280
4201
  }
4281
- transform(field) {
4282
- if (!field || !field.field_type || !field.field_type.type) {
4283
- return false;
4202
+ const match = ARGUMENT_REGEX.exec(displayContextParameter);
4203
+ if (!match?.[1]) {
4204
+ return invalidConfiguration();
4205
+ }
4206
+ const tokens = match[1].split(',').map(token => token.trim());
4207
+ if (tokens.some(token => !token)) {
4208
+ return invalidConfiguration();
4209
+ }
4210
+ const roleCategories = [];
4211
+ for (const token of tokens) {
4212
+ if (token.startsWith(CATEGORY_PREFIX)) {
4213
+ const category = normaliseRoleCategory(token.substring(CATEGORY_PREFIX.length));
4214
+ if (!isStaffUserRoleCategory(category)) {
4215
+ return invalidConfiguration();
4216
+ }
4217
+ if (!roleCategories.includes(category)) {
4218
+ roleCategories.push(category);
4219
+ }
4284
4220
  }
4285
- if (this.isCollection(field)) {
4286
- return false;
4221
+ else if (token.startsWith(REGION_PREFIX)) {
4222
+ // Region filtering is not supported in this version; REGION- tokens are silently ignored
4223
+ }
4224
+ else {
4225
+ return invalidConfiguration();
4287
4226
  }
4288
- return this.caseFieldService.isReadOnly(field);
4289
4227
  }
4290
- // CaseField @Expose() doesn't work with the pipe in here, so leaving the manual check
4291
- isCollection(field) {
4292
- return field.field_type && field.field_type.type === 'Collection';
4228
+ if (!roleCategories.length) {
4229
+ return invalidConfiguration();
4293
4230
  }
4294
- static ɵfac = function IsReadOnlyAndNotCollectionPipe_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || IsReadOnlyAndNotCollectionPipe)(i0.ɵɵdirectiveInject(CaseFieldService, 16)); };
4295
- static ɵpipe = /*@__PURE__*/ i0.ɵɵdefinePipe({ name: "ccdIsReadOnlyAndNotCollection", type: IsReadOnlyAndNotCollectionPipe, pure: true, standalone: false });
4231
+ return {
4232
+ valid: true,
4233
+ configuration: {
4234
+ roleCategories,
4235
+ staffRoleCategories: roleCategories.filter(isStaffCacheRoleCategory),
4236
+ includesJudicial: roleCategories.includes('JUDICIAL')
4237
+ }
4238
+ };
4239
+ }
4240
+ function normaliseRoleCategory(category) {
4241
+ const normalised = category.replaceAll('-', '_');
4242
+ return ROLE_CATEGORY_ALIASES[normalised] || normalised;
4243
+ }
4244
+ function isStaffUserRoleCategory(category) {
4245
+ return SUPPORTED_ROLE_CATEGORIES.has(category);
4246
+ }
4247
+ function isStaffCacheRoleCategory(category) {
4248
+ return STAFF_CACHE_ROLE_CATEGORIES.has(category);
4249
+ }
4250
+ function invalidConfiguration() {
4251
+ return { valid: false, error: 'INVALID_ROLE_CATEGORIES' };
4296
4252
  }
4297
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IsReadOnlyAndNotCollectionPipe, [{
4298
- type: Pipe,
4299
- args: [{
4300
- name: 'ccdIsReadOnlyAndNotCollection',
4301
- standalone: false
4302
- }]
4303
- }], () => [{ type: CaseFieldService }], null); })();
4304
4253
 
4305
- class PaletteUtilsModule {
4306
- static ɵfac = function PaletteUtilsModule_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || PaletteUtilsModule)(); };
4307
- static ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: PaletteUtilsModule });
4308
- static ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ providers: [
4309
- IsCompoundPipe,
4310
- RpxTranslatePipe
4311
- ], imports: [CommonModule,
4312
- RpxTranslationModule.forChild()] });
4254
+ class WorkbasketInputModel {
4255
+ label;
4256
+ order;
4257
+ field;
4258
+ metadata;
4259
+ display_context_parameter;
4260
+ }
4261
+ class WorkbasketInput {
4262
+ workbasketInputs;
4313
4263
  }
4314
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(PaletteUtilsModule, [{
4315
- type: NgModule,
4316
- args: [{
4317
- imports: [
4318
- CommonModule,
4319
- RpxTranslationModule.forChild()
4320
- ],
4321
- declarations: [
4322
- DatePipe,
4323
- FieldLabelPipe,
4324
- FirstErrorPipe,
4325
- IsCompoundPipe,
4326
- IsMandatoryPipe,
4327
- IsReadOnlyPipe,
4328
- IsReadOnlyAndNotCollectionPipe,
4329
- DashPipe
4330
- ],
4331
- exports: [
4332
- DatePipe,
4333
- FieldLabelPipe,
4334
- FirstErrorPipe,
4335
- IsCompoundPipe,
4336
- IsMandatoryPipe,
4337
- IsReadOnlyPipe,
4338
- IsReadOnlyAndNotCollectionPipe,
4339
- DashPipe
4340
- ],
4341
- providers: [
4342
- IsCompoundPipe,
4343
- RpxTranslatePipe
4344
- ]
4345
- }]
4346
- }], null, null); })();
4347
- (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(PaletteUtilsModule, { declarations: [DatePipe,
4348
- FieldLabelPipe,
4349
- FirstErrorPipe,
4350
- IsCompoundPipe,
4351
- IsMandatoryPipe,
4352
- IsReadOnlyPipe,
4353
- IsReadOnlyAndNotCollectionPipe,
4354
- DashPipe], imports: [CommonModule, i1.RpxTranslationModule], exports: [DatePipe,
4355
- FieldLabelPipe,
4356
- FirstErrorPipe,
4357
- IsCompoundPipe,
4358
- IsMandatoryPipe,
4359
- IsReadOnlyPipe,
4360
- IsReadOnlyAndNotCollectionPipe,
4361
- DashPipe] }); })();
4362
4264
 
4363
4265
  // @dynamic
4364
4266
  class FieldsUtils {
@@ -9740,6 +9642,76 @@ class BrowserService {
9740
9642
  }], null, null); })();
9741
9643
 
9742
9644
  class CaseAccessUtils {
9645
+ // User role mapping
9646
+ static JUDGE_ROLE = 'judge';
9647
+ static JUDGE_ROLE_CATEGORY = 'JUDICIAL';
9648
+ static JUDGE_ROLE_NAME = 'judiciary';
9649
+ static ADMIN_ROLE = 'admin';
9650
+ static ADMIN_ROLE_CATEGORY = 'ADMIN';
9651
+ static ADMIN_ROLE_NAME = 'admin';
9652
+ static PROFESSIONAL_ROLE = 'solicitor';
9653
+ static PROFESSIONAL_ROLE_CATEGORY = 'PROFESSIONAL';
9654
+ static PROFESSIONAL_ROLE_NAME = 'professional';
9655
+ static LEGAL_OPERATIONS_ROLE = 'caseworker';
9656
+ static LEGAL_OPERATIONS_ROLE_CATEGORY = 'LEGAL_OPERATIONS';
9657
+ static LEGAL_OPERATIONS_ROLE_NAME = 'legal-ops';
9658
+ static CITIZEN_ROLE = 'citizen';
9659
+ static CITIZEN_ROLE_CATEGORY = 'CITIZEN';
9660
+ static CITIZEN_ROLE_NAME = 'citizen';
9661
+ static CTSC_ROLE = 'ctsc';
9662
+ static CTSC_ROLE_CATEGORY = 'CTSC';
9663
+ static CTSC_ROLE_NAME = 'ctsc';
9664
+ // fallback purely if roleCategories is not available in
9665
+ getMappedRoleCategories(roles = []) {
9666
+ const roleKeywords = roles.join().split('-').join().split(',');
9667
+ const roleCategoryList = [];
9668
+ if (this.roleHasKeyword(CaseAccessUtils.JUDGE_ROLE, roleKeywords)) {
9669
+ roleCategoryList.push(CaseAccessUtils.JUDGE_ROLE_CATEGORY);
9670
+ }
9671
+ if (this.roleHasKeyword(CaseAccessUtils.PROFESSIONAL_ROLE, roleKeywords)) {
9672
+ roleCategoryList.push(CaseAccessUtils.PROFESSIONAL_ROLE_CATEGORY);
9673
+ }
9674
+ if (this.roleHasKeyword(CaseAccessUtils.CITIZEN_ROLE, roleKeywords)) {
9675
+ roleCategoryList.push(CaseAccessUtils.CITIZEN_ROLE_CATEGORY);
9676
+ }
9677
+ if (this.roleHasKeyword(CaseAccessUtils.ADMIN_ROLE, roleKeywords)) {
9678
+ roleCategoryList.push(CaseAccessUtils.ADMIN_ROLE_CATEGORY);
9679
+ }
9680
+ if (this.roleHasKeyword(CaseAccessUtils.CTSC_ROLE, roleKeywords)) {
9681
+ roleCategoryList.push(CaseAccessUtils.CTSC_ROLE_CATEGORY);
9682
+ }
9683
+ if (this.roleHasKeyword(CaseAccessUtils.LEGAL_OPERATIONS_ROLE, roleKeywords)) {
9684
+ roleCategoryList.push(CaseAccessUtils.LEGAL_OPERATIONS_ROLE_CATEGORY);
9685
+ }
9686
+ return roleCategoryList;
9687
+ }
9688
+ roleHasKeyword(keyword, roleWords) {
9689
+ return roleWords.includes(keyword);
9690
+ }
9691
+ getAMRoleName(accessType, aMRole) {
9692
+ let roleName = '';
9693
+ switch (aMRole) {
9694
+ case CaseAccessUtils.JUDGE_ROLE_CATEGORY:
9695
+ roleName = `${accessType}-access-${CaseAccessUtils.JUDGE_ROLE_NAME}`;
9696
+ break;
9697
+ case CaseAccessUtils.PROFESSIONAL_ROLE_CATEGORY:
9698
+ roleName = `${accessType}-access-${CaseAccessUtils.PROFESSIONAL_ROLE_NAME}`;
9699
+ break;
9700
+ case CaseAccessUtils.CITIZEN_ROLE_CATEGORY:
9701
+ roleName = `${accessType}-access-${CaseAccessUtils.CITIZEN_ROLE_NAME}`;
9702
+ break;
9703
+ case CaseAccessUtils.ADMIN_ROLE_CATEGORY:
9704
+ roleName = `${accessType}-access-${CaseAccessUtils.ADMIN_ROLE_NAME}`;
9705
+ break;
9706
+ case CaseAccessUtils.CTSC_ROLE_CATEGORY:
9707
+ roleName = `${accessType}-access-${CaseAccessUtils.CTSC_ROLE_NAME}`;
9708
+ break;
9709
+ default:
9710
+ roleName = `${accessType}-access-${CaseAccessUtils.LEGAL_OPERATIONS_ROLE_NAME}`;
9711
+ break;
9712
+ }
9713
+ return roleName;
9714
+ }
9743
9715
  getAMPayload(assignerId, actorId, roleName, roleCategory, grantType, caseId, details, beginTime = null, endTime = null, isNew = false) {
9744
9716
  const process = details.caseReference !== undefined ? 'challenged-access' : 'specific-access';
9745
9717
  const payload = {
@@ -11633,9 +11605,9 @@ class CasesService {
11633
11605
  }
11634
11606
  // EXUI-4758 - getMappedRoleCategories no longer returns a single string, checks all roles to get the most likely roleCategory
11635
11607
  // Unsure whether we should be using mapped role categories any more - should trust the roleCategories from userInfo if they exist
11636
- const roleCategories = userInfo.roleCategories || getMappedRoleCategories(userInfo.roles);
11608
+ const roleCategories = userInfo.roleCategories || camUtils.getMappedRoleCategories(userInfo.roles);
11637
11609
  // If user has no role categories, default to LEGAL_OPERATIONS
11638
- const roleName = getAMRoleName('challenged', roleCategories?.length > 0 ? roleCategories[0] : RoleCategory.LEGAL_OPERATIONS);
11610
+ const roleName = camUtils.getAMRoleName('challenged', roleCategories?.length > 0 ? roleCategories[0] : "LEGAL_OPERATIONS");
11639
11611
  const beginTime = new Date();
11640
11612
  const endTime = new Date(new Date().setUTCHours(23, 59, 59, 999));
11641
11613
  const id = userInfo.id ? userInfo.id : userInfo.uid;
@@ -11652,10 +11624,10 @@ class CasesService {
11652
11624
  return throwError(() => new Error('User info not found in session storage'));
11653
11625
  }
11654
11626
  // EXUI-4758 - See above comment
11655
- const roleCategories = userInfo.roleCategories || getMappedRoleCategories(userInfo.roles);
11627
+ const roleCategories = userInfo.roleCategories || camUtils.getMappedRoleCategories(userInfo.roles);
11656
11628
  // EXUI-4758 - Return first roleCategory as the roleCategory for now, unless not present, in which case default to LEGAL_OPERATIONS
11657
- const roleCategory = roleCategories?.length > 0 ? roleCategories[0] : RoleCategory.LEGAL_OPERATIONS;
11658
- const roleName = getAMRoleName('specific', roleCategory);
11629
+ const roleCategory = roleCategories?.length > 0 ? roleCategories[0] : "LEGAL_OPERATIONS";
11630
+ const roleName = camUtils.getAMRoleName('specific', roleCategory);
11659
11631
  const id = userInfo.id ? userInfo.id : userInfo.uid;
11660
11632
  const payload = camUtils.getAMPayload(null, id, roleName, roleCategory, 'SPECIFIC', caseId, sar, null, null, true);
11661
11633
  payload.roleRequest = {
@@ -40129,8 +40101,16 @@ class CaseResolver {
40129
40101
  }
40130
40102
  // as discussed for EUI-5456, need functionality to go to default page
40131
40103
  goToDefaultPage() {
40132
- isWorkAllocationUser(this.sessionStorage) ?
40133
- this.router.navigate([CaseResolver.defaultWAPage]) : this.router.navigate([CaseResolver.defaultPage]);
40104
+ const userDetails = safeJsonParse(this.sessionStorage.getItem(USER_DETAILS));
40105
+ userDetails && userDetails.roles
40106
+ && !userDetails.roles.includes(PUI_CASE_MANAGER)
40107
+ &&
40108
+ (userDetails.roles.includes('caseworker-ia-iacjudge')
40109
+ || userDetails.roles.includes('caseworker-ia-caseofficer')
40110
+ || userDetails.roles.includes('caseworker-ia-admofficer')
40111
+ || userDetails.roles.includes('caseworker-civil')
40112
+ || userDetails.roles.includes('caseworker-privatelaw'))
40113
+ ? this.router.navigate([CaseResolver.defaultWAPage]) : this.router.navigate([CaseResolver.defaultPage]);
40134
40114
  }
40135
40115
  static ɵfac = function CaseResolver_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CaseResolver)(i0.ɵɵinject(CaseNotifier), i0.ɵɵinject(DraftService), i0.ɵɵinject(NavigationNotifierService), i0.ɵɵinject(i1$1.Router), i0.ɵɵinject(SessionStorageService)); };
40136
40116
  static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: CaseResolver, factory: CaseResolver.ɵfac });
@@ -42639,9 +42619,12 @@ class EventStartStateMachineService {
42639
42619
  }
42640
42620
  entryActionForStateNoTask(state, context) {
42641
42621
  // Trigger final state to complete processing of state machine
42622
+ const task = context.tasks[0];
42623
+ const jurisdiction = task?.jurisdiction ?? context.caseDetails?.case_type?.jurisdiction?.id;
42624
+ const caseTypeId = task?.case_type_id ?? context.caseDetails?.case_type?.id;
42642
42625
  state.trigger(EventStartStates.FINAL);
42643
42626
  // Navigate to no tasks available error page
42644
- context.router.navigate([`/cases/case-details/${context.tasks[0]?.jurisdiction}/${context.tasks[0]?.case_type_id}/${context.caseId}/no-tasks-available`], { relativeTo: context.route });
42627
+ context.router.navigate([`/cases/case-details/${jurisdiction}/${caseTypeId}/${context.caseId}/no-tasks-available`], { relativeTo: context.route });
42645
42628
  }
42646
42629
  entryActionForStateOneOrMoreTasks(state, context) {
42647
42630
  state.trigger(EventStartStates.TASK_ASSIGNED_TO_USER);
@@ -42799,8 +42782,9 @@ class EventStartComponent {
42799
42782
  }
42800
42783
  ngOnInit() {
42801
42784
  // Get task and case id payload from route data
42785
+ const caseDetails = this.route.snapshot.data.case;
42802
42786
  const tasks = this.route.snapshot.data.tasks;
42803
- const caseId = this.route.snapshot.data.case.case_id;
42787
+ const caseId = caseDetails.case_id;
42804
42788
  const eventId = this.route.snapshot.queryParams['eventId'];
42805
42789
  const taskId = this.route.snapshot.queryParams['taskId'];
42806
42790
  // Setup the context
@@ -42809,6 +42793,7 @@ class EventStartComponent {
42809
42793
  caseId,
42810
42794
  eventId,
42811
42795
  taskId,
42796
+ caseDetails,
42812
42797
  router: this.router,
42813
42798
  route: this.route,
42814
42799
  sessionStorageService: this.sessionStorageService,
@@ -46203,5 +46188,5 @@ class TestRouteSnapshotBuilder {
46203
46188
  * Generated bundle index. Do not edit.
46204
46189
  */
46205
46190
 
46206
- export { AMRoleSuffix, AbstractAppConfig, AbstractFieldReadComponent, AbstractFieldWriteComponent, AbstractFieldWriteJourneyComponent, AbstractJourneyComponent, Activity, ActivityBannerComponent, ActivityComponent, ActivityIconComponent, ActivityInfo, ActivityModule, ActivityPollingService, ActivityService, AddCommentsComponent, AddCommentsErrorMessage, AddCommentsStep, AddressModel, AddressOption, AddressesService, Alert, AlertComponent, AlertIconClassPipe, AlertMessageType, AlertModule, AlertService, AuthService, Banner, BannersService, BeforeYouStartComponent, BodyComponent, BrowserService, CCDCaseLinkType, COMPONENT_PORTAL_INJECTION_TOKEN, CallbackErrorsComponent, CallbackErrorsContext, CaseAccessUtils, CaseBasicAccessViewComponent, CaseChallengedAccessRequestComponent, CaseChallengedAccessSuccessComponent, CaseCreateComponent, CaseDetails, CaseEditComponent, CaseEditConfirmComponent, CaseEditDataModule, CaseEditDataService, CaseEditFormComponent, CaseEditPageComponent, CaseEditSubmitComponent, CaseEditWizardGuard, CaseEditorConfig, CaseEditorModule, CaseEvent, CaseEventCompletionComponent, CaseEventCompletionTaskCancelledComponent, CaseEventCompletionTaskReassignedComponent, CaseEventData, CaseEventTrigger, CaseEventTriggerComponent, CaseField, CaseFieldService, CaseFileViewFieldComponent, CaseFileViewFolderComponent, CaseFileViewFolderDocumentActionsComponent, CaseFileViewFolderSelectorComponent, CaseFileViewFolderSortComponent, CaseFileViewFolderToggleComponent, CaseFileViewOverlayMenuComponent, CaseFileViewService, CaseFlagCheckYourAnswersPageStep, CaseFlagDisplayContextParameter, CaseFlagErrorMessage, CaseFlagFieldState, CaseFlagFormFields, CaseFlagRefdataService, CaseFlagStatus, CaseFlagSummaryListComponent, CaseFlagSummaryListDisplayMode, CaseFlagTableComponent, CaseFlagWizardStepTitle, CaseFullAccessViewComponent, CaseHeaderComponent, CaseHeaderModule, CaseHistoryViewerFieldComponent, CaseLink, CaseLinkResponse, CaseListComponent, CaseListFiltersComponent, CaseListFiltersModule, CaseListModule, CaseNotifier, CasePaymentHistoryViewerFieldComponent, CasePrintDocument, CasePrinterComponent, CaseProgressComponent, CaseReferencePipe, CaseResolver, CaseSpecificAccessRequestComponent, CaseSpecificAccessSuccessComponent, CaseState, CaseTab, CaseTimelineComponent, CaseTimelineDisplayMode, CaseTimelineModule, CaseType, CaseTypeLite, CaseView, CaseViewComponent, CaseViewEvent, CaseViewTrigger, CaseViewerComponent, CaseViewerModule, CasesService, CaseworkerService, CcdCYAPageLabelFilterPipe, CcdCaseTitlePipe, CcdCollectionTableCaseFieldsFilterPipe, CcdPageFieldsPipe, CcdTabFieldsPipe, CheckYourAnswersComponent, CloseQueryComponent, ConditionalShowFormDirective, ConditionalShowModule, ConditionalShowRegistrarService, ConfirmFlagStatusComponent, ConfirmStatusErrorMessage, ConfirmStatusStep, Confirmation, ConvertHrefToRouterService, CreateCaseFiltersComponent, CreateCaseFiltersModule, CreateCaseFiltersSelection, DRAFT_PREFIX, DRAFT_QUERY_PARAM, DashPipe, DateInputComponent, DatePipe, DateTimeFormatUtils, DatetimePickerComponent, DefinitionsModule, DefinitionsService, DeleteOrCancelDialogComponent, DialogsModule, DisplayMode, Document, DocumentData, DocumentDialogComponent, DocumentLinks, DocumentManagementService, DocumentUrlPipe, Draft, DraftService, DynamicListPipe, DynamicRadioListPipe, ESQueryType, Embedded, EnumDisplayDescriptionPipe, ErrorMessageComponent, ErrorNotifierService, EventCaseField, EventCompletionReturnStates, EventCompletionStateMachineService, EventCompletionStates, EventLogComponent, EventLogDetailsComponent, EventLogTableComponent, EventMessageModule, EventStartComponent, EventStartModule, EventStartStateMachineService, EventStatusService, EventTriggerResolver, EventTriggerService, Fee, FeeValue, Field, FieldLabelPipe, FieldReadComponent, FieldReadLabelComponent, FieldType, FieldTypeSanitiser, FieldWriteComponent, FieldsFilterPipe, FieldsPurger, FieldsUtils, FirstErrorPipe, FixedListItem, FixedListPipe, FixedRadioListPipe, FlagFieldDisplayPipe, FocusElementDirective, FocusElementModule, FocusService, FooterComponent, FormDocument, FormErrorService, FormValidatorsService, FormValueService, FormatTranslatorService, GreyBarService, HRef, HeaderBarComponent, HeadersModule, HttpError, HttpErrorService, HttpService, IsCompoundPipe, IsMandatoryPipe, IsReadOnlyAndNotCollectionPipe, IsReadOnlyPipe, JudicialworkerService, Jurisdiction, JurisdictionService, LabelFieldComponent, LabelSubstitutorDirective, LabelSubstitutorModule, LanguageInterpreterDisplayPipe, LinkCaseReason, LinkCasesComponent, LinkCasesFromReasonValuePipe, LinkCasesReasonValuePipe, LinkDetails, LinkFromReason, LinkReason, LinkedCasesErrorMessages, LinkedCasesEventTriggers, LinkedCasesFromTableComponent, LinkedCasesPages, LinkedCasesResponse, LinkedCasesToTableComponent, LoadingModule, LoadingService, LoadingSpinnerComponent, LoadingSpinnerModule, MEDIA_VIEWER_LOCALSTORAGE_KEY, MULTIPLE_TASKS_FOUND, ManageCaseFlagsComponent, ManageCaseFlagsLabelDisplayPipe, MarkdownComponent, MarkdownComponentModule, MoneyGbpInputComponent, MultipageComponentStateService, MultipleTasksExistComponent, NavigationComponent, NavigationItemComponent, NavigationNotifierService, NavigationOrigin, NoLinkedCasesComponent, NoTasksAvailableComponent, NotificationBannerComponent, NotificationBannerHeaderClass, NotificationBannerType, OrderService, OrderSummary, OrganisationConverter, OrganisationService, PageValidationService, PaginationComponent, PaginationMetadata, PaginationModule, PaletteContext, PaletteModule, PaletteService, PaletteUtilsModule, Patterns, PaymentField, PhaseComponent, PipesModule, PlaceholderService, PrintUrlPipe, Profile, ProfileNotifier, ProfileService, QualifyingQuestionDetailComponent, QualifyingQuestionOptionsComponent, QualifyingQuestionService, QualifyingQuestionsErrorMessage, QueryAttachmentsReadComponent, QueryCaseDetailsHeaderComponent, QueryCheckYourAnswersComponent, QueryConfirmationComponent, QueryCreateContext, QueryDetailsComponent, QueryEventCompletionComponent, QueryItemResponseStatus, QueryListComponent, QueryListData, QueryListItem, QueryManagementService, QueryWriteAddDocumentsComponent, QueryWriteDateInputComponent, QueryWriteRaiseQueryComponent, QueryWriteRespondToQueryComponent, RaiseQueryErrorMessage, ReadCaseFlagFieldComponent, ReadCaseLinkFieldComponent, ReadCollectionFieldComponent, ReadComplexFieldCollectionTableComponent, ReadComplexFieldComponent, ReadComplexFieldRawComponent, ReadComplexFieldTableComponent, ReadCookieService, ReadDateFieldComponent, ReadDocumentFieldComponent, ReadDynamicListFieldComponent, ReadDynamicMultiSelectListFieldComponent, ReadDynamicRadioListFieldComponent, ReadEmailFieldComponent, ReadFieldsFilterPipe, ReadFixedListFieldComponent, ReadFixedRadioListFieldComponent, ReadJudicialUserFieldComponent, ReadLinkedCasesFieldComponent, ReadMoneyGbpFieldComponent, ReadMultiSelectListFieldComponent, ReadNumberFieldComponent, ReadOrderSummaryFieldComponent, ReadOrderSummaryRowComponent, ReadOrganisationFieldComponent, ReadOrganisationFieldRawComponent, ReadOrganisationFieldTableComponent, ReadPhoneUKFieldComponent, ReadQueryManagementFieldComponent, ReadRichTextAreaFieldComponent, ReadStaffUserFieldComponent, ReadTextAreaFieldComponent, ReadTextFieldComponent, ReadYesNoFieldComponent, RefdataCaseFlagType, RemoveDialogComponent, RequestOptionsBuilder, RespondToQueryErrorMessages, RetryUtil, RoleCategory, RoleKeyword, RouterHelperService, RouterLinkComponent, SaveOrDiscardDialogComponent, SearchFiltersComponent, SearchFiltersModule, SearchFiltersWrapperComponent, SearchInput, SearchLanguageInterpreterComponent, SearchLanguageInterpreterErrorMessage, SearchLanguageInterpreterStep, SearchResultComponent, SearchResultModule, SearchResultView, SearchResultViewColumn, SearchResultViewItem, SearchResultViewItemComparatorFactory, SearchService, SelectFlagErrorMessage, SelectFlagLocationComponent, SelectFlagLocationErrorMessage, SelectFlagTypeComponent, SelectFlagTypeErrorMessage, SessionErrorPageComponent, SessionErrorRoute, SessionJsonErrorLogger, SessionStorageGuard, SessionStorageService, ShowCondition, SortOrder$1 as SortOrder, SortParameters, SortSearchResultPipe, StructuredLoggerService, TabComponent, TableColumnConfig, TableConfig, TabsComponent, TabsModule, TaskAssignedComponent, TaskCancelledComponent, TaskConflictComponent, TaskUnassignedComponent, Terms, TestRouteSnapshotBuilder, TranslatedMarkdownDirective, TranslatedMarkdownModule, UnLinkCasesComponent, UnsupportedFieldComponent, UpdateFlagAddTranslationErrorMessage, UpdateFlagAddTranslationFormComponent, UpdateFlagAddTranslationStep, UpdateFlagComponent, UpdateFlagErrorMessage, UpdateFlagStep, UpdateFlagTitleDisplayPipe, WaysToPayFieldComponent, WindowService, Wizard, WizardFactoryService, WizardPage, WizardPageField, WorkAllocationService, WorkbasketFiltersComponent, WorkbasketFiltersModule, WorkbasketInput, WorkbasketInputFilterService, WorkbasketInputModel, WriteAddressFieldComponent, WriteCaseFlagFieldComponent, WriteCaseLinkFieldComponent, WriteCollectionFieldComponent, WriteComplexFieldComponent, WriteDateContainerFieldComponent, WriteDateFieldComponent, WriteDocumentFieldComponent, WriteDynamicListFieldComponent, WriteDynamicMultiSelectListFieldComponent, WriteDynamicRadioListFieldComponent, WriteEmailFieldComponent, WriteFixedListFieldComponent, WriteFixedRadioListFieldComponent, WriteJudicialUserFieldComponent, WriteLinkedCasesFieldComponent, WriteMoneyGbpFieldComponent, WriteMultiSelectListFieldComponent, WriteNumberFieldComponent, WriteOrderSummaryFieldComponent, WriteOrganisationComplexFieldComponent, WriteOrganisationFieldComponent, WritePhoneUKFieldComponent, WriteRichTextAreaFieldComponent, WriteStaffUserFieldComponent, WriteTextAreaFieldComponent, WriteTextFieldComponent, WriteYesNoFieldComponent, YesNoService, aCaseField, caseMessagesMockData, createACL, createCaseEventTrigger, createCaseField, createComplexFieldOverride, createFieldType, createFixedListFieldType, createHiddenComplexFieldOverride, createMultiSelectListFieldType, createWizardPage, createWizardPageField, editorRouting, initDialog, newCaseField, parseStaffUserSearchConfiguration, safeJsonParse, textFieldType, viewerRouting };
46191
+ export { AbstractAppConfig, AbstractFieldReadComponent, AbstractFieldWriteComponent, AbstractFieldWriteJourneyComponent, AbstractJourneyComponent, Activity, ActivityBannerComponent, ActivityComponent, ActivityIconComponent, ActivityInfo, ActivityModule, ActivityPollingService, ActivityService, AddCommentsComponent, AddCommentsErrorMessage, AddCommentsStep, AddressModel, AddressOption, AddressesService, Alert, AlertComponent, AlertIconClassPipe, AlertMessageType, AlertModule, AlertService, AuthService, Banner, BannersService, BeforeYouStartComponent, BodyComponent, BrowserService, CCDCaseLinkType, COMPONENT_PORTAL_INJECTION_TOKEN, CallbackErrorsComponent, CallbackErrorsContext, CaseAccessUtils, CaseBasicAccessViewComponent, CaseChallengedAccessRequestComponent, CaseChallengedAccessSuccessComponent, CaseCreateComponent, CaseDetails, CaseEditComponent, CaseEditConfirmComponent, CaseEditDataModule, CaseEditDataService, CaseEditFormComponent, CaseEditPageComponent, CaseEditSubmitComponent, CaseEditWizardGuard, CaseEditorConfig, CaseEditorModule, CaseEvent, CaseEventCompletionComponent, CaseEventCompletionTaskCancelledComponent, CaseEventCompletionTaskReassignedComponent, CaseEventData, CaseEventTrigger, CaseEventTriggerComponent, CaseField, CaseFieldService, CaseFileViewFieldComponent, CaseFileViewFolderComponent, CaseFileViewFolderDocumentActionsComponent, CaseFileViewFolderSelectorComponent, CaseFileViewFolderSortComponent, CaseFileViewFolderToggleComponent, CaseFileViewOverlayMenuComponent, CaseFileViewService, CaseFlagCheckYourAnswersPageStep, CaseFlagDisplayContextParameter, CaseFlagErrorMessage, CaseFlagFieldState, CaseFlagFormFields, CaseFlagRefdataService, CaseFlagStatus, CaseFlagSummaryListComponent, CaseFlagSummaryListDisplayMode, CaseFlagTableComponent, CaseFlagWizardStepTitle, CaseFullAccessViewComponent, CaseHeaderComponent, CaseHeaderModule, CaseHistoryViewerFieldComponent, CaseLink, CaseLinkResponse, CaseListComponent, CaseListFiltersComponent, CaseListFiltersModule, CaseListModule, CaseNotifier, CasePaymentHistoryViewerFieldComponent, CasePrintDocument, CasePrinterComponent, CaseProgressComponent, CaseReferencePipe, CaseResolver, CaseSpecificAccessRequestComponent, CaseSpecificAccessSuccessComponent, CaseState, CaseTab, CaseTimelineComponent, CaseTimelineDisplayMode, CaseTimelineModule, CaseType, CaseTypeLite, CaseView, CaseViewComponent, CaseViewEvent, CaseViewTrigger, CaseViewerComponent, CaseViewerModule, CasesService, CaseworkerService, CcdCYAPageLabelFilterPipe, CcdCaseTitlePipe, CcdCollectionTableCaseFieldsFilterPipe, CcdPageFieldsPipe, CcdTabFieldsPipe, CheckYourAnswersComponent, CloseQueryComponent, ConditionalShowFormDirective, ConditionalShowModule, ConditionalShowRegistrarService, ConfirmFlagStatusComponent, ConfirmStatusErrorMessage, ConfirmStatusStep, Confirmation, ConvertHrefToRouterService, CreateCaseFiltersComponent, CreateCaseFiltersModule, CreateCaseFiltersSelection, DRAFT_PREFIX, DRAFT_QUERY_PARAM, DashPipe, DateInputComponent, DatePipe, DateTimeFormatUtils, DatetimePickerComponent, DefinitionsModule, DefinitionsService, DeleteOrCancelDialogComponent, DialogsModule, DisplayMode, Document, DocumentData, DocumentDialogComponent, DocumentLinks, DocumentManagementService, DocumentUrlPipe, Draft, DraftService, DynamicListPipe, DynamicRadioListPipe, ESQueryType, Embedded, EnumDisplayDescriptionPipe, ErrorMessageComponent, ErrorNotifierService, EventCaseField, EventCompletionReturnStates, EventCompletionStateMachineService, EventCompletionStates, EventLogComponent, EventLogDetailsComponent, EventLogTableComponent, EventMessageModule, EventStartComponent, EventStartModule, EventStartStateMachineService, EventStatusService, EventTriggerResolver, EventTriggerService, Fee, FeeValue, Field, FieldLabelPipe, FieldReadComponent, FieldReadLabelComponent, FieldType, FieldTypeSanitiser, FieldWriteComponent, FieldsFilterPipe, FieldsPurger, FieldsUtils, FirstErrorPipe, FixedListItem, FixedListPipe, FixedRadioListPipe, FlagFieldDisplayPipe, FocusElementDirective, FocusElementModule, FocusService, FooterComponent, FormDocument, FormErrorService, FormValidatorsService, FormValueService, FormatTranslatorService, GreyBarService, HRef, HeaderBarComponent, HeadersModule, HttpError, HttpErrorService, HttpService, IsCompoundPipe, IsMandatoryPipe, IsReadOnlyAndNotCollectionPipe, IsReadOnlyPipe, JudicialworkerService, Jurisdiction, JurisdictionService, LabelFieldComponent, LabelSubstitutorDirective, LabelSubstitutorModule, LanguageInterpreterDisplayPipe, LinkCaseReason, LinkCasesComponent, LinkCasesFromReasonValuePipe, LinkCasesReasonValuePipe, LinkDetails, LinkFromReason, LinkReason, LinkedCasesErrorMessages, LinkedCasesEventTriggers, LinkedCasesFromTableComponent, LinkedCasesPages, LinkedCasesResponse, LinkedCasesToTableComponent, LoadingModule, LoadingService, LoadingSpinnerComponent, LoadingSpinnerModule, MEDIA_VIEWER_LOCALSTORAGE_KEY, MULTIPLE_TASKS_FOUND, ManageCaseFlagsComponent, ManageCaseFlagsLabelDisplayPipe, MarkdownComponent, MarkdownComponentModule, MoneyGbpInputComponent, MultipageComponentStateService, MultipleTasksExistComponent, NavigationComponent, NavigationItemComponent, NavigationNotifierService, NavigationOrigin, NoLinkedCasesComponent, NoTasksAvailableComponent, NotificationBannerComponent, NotificationBannerHeaderClass, NotificationBannerType, OrderService, OrderSummary, OrganisationConverter, OrganisationService, PageValidationService, PaginationComponent, PaginationMetadata, PaginationModule, PaletteContext, PaletteModule, PaletteService, PaletteUtilsModule, Patterns, PaymentField, PhaseComponent, PipesModule, PlaceholderService, PrintUrlPipe, Profile, ProfileNotifier, ProfileService, QualifyingQuestionDetailComponent, QualifyingQuestionOptionsComponent, QualifyingQuestionService, QualifyingQuestionsErrorMessage, QueryAttachmentsReadComponent, QueryCaseDetailsHeaderComponent, QueryCheckYourAnswersComponent, QueryConfirmationComponent, QueryCreateContext, QueryDetailsComponent, QueryEventCompletionComponent, QueryItemResponseStatus, QueryListComponent, QueryListData, QueryListItem, QueryManagementService, QueryWriteAddDocumentsComponent, QueryWriteDateInputComponent, QueryWriteRaiseQueryComponent, QueryWriteRespondToQueryComponent, RaiseQueryErrorMessage, ReadCaseFlagFieldComponent, ReadCaseLinkFieldComponent, ReadCollectionFieldComponent, ReadComplexFieldCollectionTableComponent, ReadComplexFieldComponent, ReadComplexFieldRawComponent, ReadComplexFieldTableComponent, ReadCookieService, ReadDateFieldComponent, ReadDocumentFieldComponent, ReadDynamicListFieldComponent, ReadDynamicMultiSelectListFieldComponent, ReadDynamicRadioListFieldComponent, ReadEmailFieldComponent, ReadFieldsFilterPipe, ReadFixedListFieldComponent, ReadFixedRadioListFieldComponent, ReadJudicialUserFieldComponent, ReadLinkedCasesFieldComponent, ReadMoneyGbpFieldComponent, ReadMultiSelectListFieldComponent, ReadNumberFieldComponent, ReadOrderSummaryFieldComponent, ReadOrderSummaryRowComponent, ReadOrganisationFieldComponent, ReadOrganisationFieldRawComponent, ReadOrganisationFieldTableComponent, ReadPhoneUKFieldComponent, ReadQueryManagementFieldComponent, ReadRichTextAreaFieldComponent, ReadStaffUserFieldComponent, ReadTextAreaFieldComponent, ReadTextFieldComponent, ReadYesNoFieldComponent, RefdataCaseFlagType, RemoveDialogComponent, RequestOptionsBuilder, RespondToQueryErrorMessages, RetryUtil, RouterHelperService, RouterLinkComponent, SaveOrDiscardDialogComponent, SearchFiltersComponent, SearchFiltersModule, SearchFiltersWrapperComponent, SearchInput, SearchLanguageInterpreterComponent, SearchLanguageInterpreterErrorMessage, SearchLanguageInterpreterStep, SearchResultComponent, SearchResultModule, SearchResultView, SearchResultViewColumn, SearchResultViewItem, SearchResultViewItemComparatorFactory, SearchService, SelectFlagErrorMessage, SelectFlagLocationComponent, SelectFlagLocationErrorMessage, SelectFlagTypeComponent, SelectFlagTypeErrorMessage, SessionErrorPageComponent, SessionErrorRoute, SessionJsonErrorLogger, SessionStorageGuard, SessionStorageService, ShowCondition, SortOrder$1 as SortOrder, SortParameters, SortSearchResultPipe, StructuredLoggerService, TabComponent, TableColumnConfig, TableConfig, TabsComponent, TabsModule, TaskAssignedComponent, TaskCancelledComponent, TaskConflictComponent, TaskUnassignedComponent, Terms, TestRouteSnapshotBuilder, TranslatedMarkdownDirective, TranslatedMarkdownModule, UnLinkCasesComponent, UnsupportedFieldComponent, UpdateFlagAddTranslationErrorMessage, UpdateFlagAddTranslationFormComponent, UpdateFlagAddTranslationStep, UpdateFlagComponent, UpdateFlagErrorMessage, UpdateFlagStep, UpdateFlagTitleDisplayPipe, WaysToPayFieldComponent, WindowService, Wizard, WizardFactoryService, WizardPage, WizardPageField, WorkAllocationService, WorkbasketFiltersComponent, WorkbasketFiltersModule, WorkbasketInput, WorkbasketInputFilterService, WorkbasketInputModel, WriteAddressFieldComponent, WriteCaseFlagFieldComponent, WriteCaseLinkFieldComponent, WriteCollectionFieldComponent, WriteComplexFieldComponent, WriteDateContainerFieldComponent, WriteDateFieldComponent, WriteDocumentFieldComponent, WriteDynamicListFieldComponent, WriteDynamicMultiSelectListFieldComponent, WriteDynamicRadioListFieldComponent, WriteEmailFieldComponent, WriteFixedListFieldComponent, WriteFixedRadioListFieldComponent, WriteJudicialUserFieldComponent, WriteLinkedCasesFieldComponent, WriteMoneyGbpFieldComponent, WriteMultiSelectListFieldComponent, WriteNumberFieldComponent, WriteOrderSummaryFieldComponent, WriteOrganisationComplexFieldComponent, WriteOrganisationFieldComponent, WritePhoneUKFieldComponent, WriteRichTextAreaFieldComponent, WriteStaffUserFieldComponent, WriteTextAreaFieldComponent, WriteTextFieldComponent, WriteYesNoFieldComponent, YesNoService, aCaseField, caseMessagesMockData, createACL, createCaseEventTrigger, createCaseField, createComplexFieldOverride, createFieldType, createFixedListFieldType, createHiddenComplexFieldOverride, createMultiSelectListFieldType, createWizardPage, createWizardPageField, editorRouting, initDialog, newCaseField, parseStaffUserSearchConfiguration, safeJsonParse, textFieldType, viewerRouting };
46207
46192
  //# sourceMappingURL=hmcts-ccd-case-ui-toolkit.mjs.map