@hmcts/opal-frontend-common 0.0.81 → 0.0.82
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/hmcts-opal-frontend-common-services-app-initializer-service.mjs +7 -0
- package/fesm2022/hmcts-opal-frontend-common-services-launch-darkly-service.mjs +16 -0
- package/fesm2022/hmcts-opal-frontend-common-services-transfer-state-service-mocks.mjs +10 -1
- package/fesm2022/hmcts-opal-frontend-common-services-transfer-state-service.mjs +10 -0
- package/fesm2022/hmcts-opal-frontend-common-stores-global.mjs +4 -0
- package/package.json +1 -1
- package/types/hmcts-opal-frontend-common-components-abstract-abstract-account-summary-base.d.ts +3 -0
- package/types/hmcts-opal-frontend-common-pages-dashboard-page.d.ts +3 -0
- package/types/hmcts-opal-frontend-common-services-app-initializer-service.d.ts +4 -0
- package/types/hmcts-opal-frontend-common-services-launch-darkly-service.d.ts +5 -0
- package/types/hmcts-opal-frontend-common-services-transfer-state-service-interfaces.d.ts +9 -1
- package/types/hmcts-opal-frontend-common-services-transfer-state-service-mocks.d.ts +4 -2
- package/types/hmcts-opal-frontend-common-services-transfer-state-service.d.ts +4 -0
- package/types/hmcts-opal-frontend-common-stores-global.d.ts +4 -1
|
@@ -37,6 +37,12 @@ class AppInitializerService {
|
|
|
37
37
|
initializeUserStateDomain() {
|
|
38
38
|
this.transferStateService.initializeUserStateDomain();
|
|
39
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Initializes the feature flag override configuration.
|
|
42
|
+
*/
|
|
43
|
+
initializeFeatureFlagConfig() {
|
|
44
|
+
this.transferStateService.initializeFeatureFlagConfig();
|
|
45
|
+
}
|
|
40
46
|
/**
|
|
41
47
|
* Initializes the application.
|
|
42
48
|
* This method calls the necessary initialization functions.
|
|
@@ -47,6 +53,7 @@ class AppInitializerService {
|
|
|
47
53
|
this.initializeAppInsights();
|
|
48
54
|
this.initializeUserStateCacheExpirationMilliseconds();
|
|
49
55
|
this.initializeUserStateDomain();
|
|
56
|
+
this.initializeFeatureFlagConfig();
|
|
50
57
|
await this.appInsightsService.initialize();
|
|
51
58
|
}
|
|
52
59
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: AppInitializerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
@@ -6,6 +6,13 @@ import { initialize } from 'launchdarkly-js-client-sdk';
|
|
|
6
6
|
class LaunchDarklyService {
|
|
7
7
|
globalStore = inject(GlobalStore);
|
|
8
8
|
ldClient;
|
|
9
|
+
/**
|
|
10
|
+
* Checks if the feature flag override is enabled in the global store's feature flag configuration.
|
|
11
|
+
* @returns A boolean indicating whether the feature flag override is enabled or not.
|
|
12
|
+
*/
|
|
13
|
+
isFeatureFlagOverrideEnabled() {
|
|
14
|
+
return this.globalStore.featureFlagConfig()?.override === true;
|
|
15
|
+
}
|
|
9
16
|
/**
|
|
10
17
|
* Sets the LaunchDarkly flags by updating the featureFlags in the state service.
|
|
11
18
|
*/
|
|
@@ -39,6 +46,9 @@ class LaunchDarklyService {
|
|
|
39
46
|
* This method listens for changes in feature flags and updates the state accordingly.
|
|
40
47
|
*/
|
|
41
48
|
initializeLaunchDarklyChangeListener() {
|
|
49
|
+
if (this.isFeatureFlagOverrideEnabled()) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
42
52
|
if (this.ldClient && this.globalStore.launchDarklyConfig().stream) {
|
|
43
53
|
this.ldClient.on('change', (flags) => {
|
|
44
54
|
const updatedFlags = { ...this.globalStore.featureFlags(), ...this.formatChangeFlags(flags) };
|
|
@@ -53,6 +63,9 @@ class LaunchDarklyService {
|
|
|
53
63
|
* @returns A promise that resolves when the flags are set.
|
|
54
64
|
*/
|
|
55
65
|
async initializeLaunchDarklyFlags() {
|
|
66
|
+
if (this.isFeatureFlagOverrideEnabled()) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
56
69
|
if (this.ldClient) {
|
|
57
70
|
return this.ldClient
|
|
58
71
|
.waitForInitialization(5)
|
|
@@ -67,6 +80,9 @@ class LaunchDarklyService {
|
|
|
67
80
|
* If a stored LaunchDarkly client ID exists, it initializes the client with the ID and anonymous mode enabled.
|
|
68
81
|
*/
|
|
69
82
|
initializeLaunchDarklyClient() {
|
|
83
|
+
if (this.isFeatureFlagOverrideEnabled()) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
70
86
|
if (this.ldClient) {
|
|
71
87
|
return;
|
|
72
88
|
}
|
|
@@ -10,17 +10,26 @@ const TRANSFER_STATE_LAUNCH_DARKLY_CONFIG_MOCK = {
|
|
|
10
10
|
stream: true,
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
+
const TRANSFER_STATE_FEATURE_FLAG_CONFIG_MOCK = {
|
|
14
|
+
override: true,
|
|
15
|
+
releases: {
|
|
16
|
+
'release-1a': true,
|
|
17
|
+
'release-1b': true,
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
|
|
13
21
|
const TRANSFER_STATE_MOCK = {
|
|
14
22
|
launchDarklyConfig: TRANSFER_STATE_LAUNCH_DARKLY_CONFIG_MOCK,
|
|
15
23
|
ssoEnabled: true,
|
|
16
24
|
appInsightsConfig: TRANSFER_STATE_APP_INSIGHTS_CONFIG_MOCK,
|
|
17
25
|
userStateCacheExpirationMilliseconds: 1800000,
|
|
18
26
|
userStateDomain: 'configured-domain',
|
|
27
|
+
featureFlagConfig: TRANSFER_STATE_FEATURE_FLAG_CONFIG_MOCK,
|
|
19
28
|
};
|
|
20
29
|
|
|
21
30
|
/**
|
|
22
31
|
* Generated bundle index. Do not edit.
|
|
23
32
|
*/
|
|
24
33
|
|
|
25
|
-
export { TRANSFER_STATE_APP_INSIGHTS_CONFIG_MOCK, TRANSFER_STATE_LAUNCH_DARKLY_CONFIG_MOCK, TRANSFER_STATE_MOCK };
|
|
34
|
+
export { TRANSFER_STATE_APP_INSIGHTS_CONFIG_MOCK, TRANSFER_STATE_FEATURE_FLAG_CONFIG_MOCK, TRANSFER_STATE_LAUNCH_DARKLY_CONFIG_MOCK, TRANSFER_STATE_MOCK };
|
|
26
35
|
//# sourceMappingURL=hmcts-opal-frontend-common-services-transfer-state-service-mocks.mjs.map
|
|
@@ -72,6 +72,16 @@ class TransferStateService {
|
|
|
72
72
|
}
|
|
73
73
|
this.globalStore.setUserStateDomain(userStateDomain.trim());
|
|
74
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Initializes feature flag override config and applies release flags when override mode is enabled.
|
|
77
|
+
*/
|
|
78
|
+
initializeFeatureFlagConfig() {
|
|
79
|
+
const featureFlagConfig = this.storedServerTransferState?.featureFlagConfig;
|
|
80
|
+
this.globalStore.setFeatureFlagConfig(featureFlagConfig);
|
|
81
|
+
if (featureFlagConfig?.override) {
|
|
82
|
+
this.globalStore.setFeatureFlags(featureFlagConfig.releases);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
75
85
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: TransferStateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
76
86
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: TransferStateService, providedIn: 'root' });
|
|
77
87
|
}
|
|
@@ -12,6 +12,7 @@ const GlobalStore = signalStore({ providedIn: 'root' }, withState(() => ({
|
|
|
12
12
|
tokenExpiry: {},
|
|
13
13
|
userStateCacheExpirationMilliseconds: 1800000,
|
|
14
14
|
userStateDomain: undefined,
|
|
15
|
+
featureFlagConfig: {},
|
|
15
16
|
})), withMethods((store) => ({
|
|
16
17
|
setAuthenticated: (authenticated) => {
|
|
17
18
|
patchState(store, { authenticated });
|
|
@@ -46,6 +47,9 @@ const GlobalStore = signalStore({ providedIn: 'root' }, withState(() => ({
|
|
|
46
47
|
setUserStateDomain: (domain) => {
|
|
47
48
|
patchState(store, { userStateDomain: domain });
|
|
48
49
|
},
|
|
50
|
+
setFeatureFlagConfig: (config) => {
|
|
51
|
+
patchState(store, { featureFlagConfig: config });
|
|
52
|
+
},
|
|
49
53
|
})));
|
|
50
54
|
|
|
51
55
|
/**
|
package/package.json
CHANGED
package/types/hmcts-opal-frontend-common-components-abstract-abstract-account-summary-base.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ declare abstract class AbstractAccountSummaryBaseComponent<THeader, TTab extends
|
|
|
32
32
|
tokenExpiry: _ngrx_signals.DeepSignal<_hmcts_opal_frontend_common_services_session_service_interfaces.ISessionTokenExpiry>;
|
|
33
33
|
userStateCacheExpirationMilliseconds: _angular_core.Signal<number>;
|
|
34
34
|
userStateDomain: _angular_core.Signal<string | undefined>;
|
|
35
|
+
featureFlagConfig: _ngrx_signals.DeepSignal<_hmcts_opal_frontend_common_services_transfer_state_service_interfaces.ITransferStateFeatureFlagConfig>;
|
|
35
36
|
setAuthenticated: (authenticated: boolean) => void;
|
|
36
37
|
setBannerError: (error: _hmcts_opal_frontend_common_stores_global_interfaces.IGlobalErrorState) => void;
|
|
37
38
|
resetBannerError: () => void;
|
|
@@ -43,6 +44,7 @@ declare abstract class AbstractAccountSummaryBaseComponent<THeader, TTab extends
|
|
|
43
44
|
setTokenExpiry: (tokenExpiry: _hmcts_opal_frontend_common_services_session_service_interfaces.ISessionTokenExpiry) => void;
|
|
44
45
|
setUserStateCacheExpirationMilliseconds: (milliseconds: number) => void;
|
|
45
46
|
setUserStateDomain: (domain: string) => void;
|
|
47
|
+
setFeatureFlagConfig: (config: _hmcts_opal_frontend_common_services_transfer_state_service_interfaces.ITransferStateFeatureFlagConfig) => void;
|
|
46
48
|
} & _ngrx_signals.StateSource<{
|
|
47
49
|
authenticated: boolean;
|
|
48
50
|
bannerError: {
|
|
@@ -59,6 +61,7 @@ declare abstract class AbstractAccountSummaryBaseComponent<THeader, TTab extends
|
|
|
59
61
|
tokenExpiry: _hmcts_opal_frontend_common_services_session_service_interfaces.ISessionTokenExpiry;
|
|
60
62
|
userStateCacheExpirationMilliseconds: number;
|
|
61
63
|
userStateDomain: string | undefined;
|
|
64
|
+
featureFlagConfig: _hmcts_opal_frontend_common_services_transfer_state_service_interfaces.ITransferStateFeatureFlagConfig;
|
|
62
65
|
}>;
|
|
63
66
|
protected readonly userState: _hmcts_opal_frontend_common_services_opal_user_service_interfaces.IOpalUserState;
|
|
64
67
|
accountData: THeader;
|
|
@@ -46,6 +46,7 @@ declare class DashboardPage {
|
|
|
46
46
|
tokenExpiry: _ngrx_signals.DeepSignal<_hmcts_opal_frontend_common_services_session_service_interfaces.ISessionTokenExpiry>;
|
|
47
47
|
userStateCacheExpirationMilliseconds: _angular_core.Signal<number>;
|
|
48
48
|
userStateDomain: _angular_core.Signal<string | undefined>;
|
|
49
|
+
featureFlagConfig: _ngrx_signals.DeepSignal<_hmcts_opal_frontend_common_services_transfer_state_service_interfaces.ITransferStateFeatureFlagConfig>;
|
|
49
50
|
setAuthenticated: (authenticated: boolean) => void;
|
|
50
51
|
setBannerError: (error: _hmcts_opal_frontend_common_stores_global_interfaces.IGlobalErrorState) => void;
|
|
51
52
|
resetBannerError: () => void;
|
|
@@ -57,6 +58,7 @@ declare class DashboardPage {
|
|
|
57
58
|
setTokenExpiry: (tokenExpiry: _hmcts_opal_frontend_common_services_session_service_interfaces.ISessionTokenExpiry) => void;
|
|
58
59
|
setUserStateCacheExpirationMilliseconds: (milliseconds: number) => void;
|
|
59
60
|
setUserStateDomain: (domain: string) => void;
|
|
61
|
+
setFeatureFlagConfig: (config: _hmcts_opal_frontend_common_services_transfer_state_service_interfaces.ITransferStateFeatureFlagConfig) => void;
|
|
60
62
|
} & _ngrx_signals.StateSource<{
|
|
61
63
|
authenticated: boolean;
|
|
62
64
|
bannerError: {
|
|
@@ -73,6 +75,7 @@ declare class DashboardPage {
|
|
|
73
75
|
tokenExpiry: _hmcts_opal_frontend_common_services_session_service_interfaces.ISessionTokenExpiry;
|
|
74
76
|
userStateCacheExpirationMilliseconds: number;
|
|
75
77
|
userStateDomain: string | undefined;
|
|
78
|
+
featureFlagConfig: _hmcts_opal_frontend_common_services_transfer_state_service_interfaces.ITransferStateFeatureFlagConfig;
|
|
76
79
|
}>;
|
|
77
80
|
dashboardConfig: IDashboardPageConfiguration;
|
|
78
81
|
/**
|
|
@@ -24,6 +24,10 @@ declare class AppInitializerService {
|
|
|
24
24
|
* Initializes the user-state domain used for permission lookup.
|
|
25
25
|
*/
|
|
26
26
|
private initializeUserStateDomain;
|
|
27
|
+
/**
|
|
28
|
+
* Initializes the feature flag override configuration.
|
|
29
|
+
*/
|
|
30
|
+
private initializeFeatureFlagConfig;
|
|
27
31
|
/**
|
|
28
32
|
* Initializes the application.
|
|
29
33
|
* This method calls the necessary initialization functions.
|
|
@@ -4,6 +4,11 @@ import { OnDestroy } from '@angular/core';
|
|
|
4
4
|
declare class LaunchDarklyService implements OnDestroy {
|
|
5
5
|
private readonly globalStore;
|
|
6
6
|
private ldClient;
|
|
7
|
+
/**
|
|
8
|
+
* Checks if the feature flag override is enabled in the global store's feature flag configuration.
|
|
9
|
+
* @returns A boolean indicating whether the feature flag override is enabled or not.
|
|
10
|
+
*/
|
|
11
|
+
private isFeatureFlagOverrideEnabled;
|
|
7
12
|
/**
|
|
8
13
|
* Sets the LaunchDarkly flags by updating the featureFlags in the state service.
|
|
9
14
|
*/
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { LDFlagSet } from 'launchdarkly-js-client-sdk';
|
|
2
|
+
|
|
1
3
|
interface ITransferStateAppInsightsConfig {
|
|
2
4
|
enabled: boolean;
|
|
3
5
|
connectionString: string;
|
|
@@ -10,12 +12,18 @@ interface ITransferStateLaunchDarklyConfig {
|
|
|
10
12
|
stream: boolean | null;
|
|
11
13
|
}
|
|
12
14
|
|
|
15
|
+
interface ITransferStateFeatureFlagConfig {
|
|
16
|
+
override: boolean | null;
|
|
17
|
+
releases: LDFlagSet;
|
|
18
|
+
}
|
|
19
|
+
|
|
13
20
|
interface ITransferStateServerState {
|
|
14
21
|
launchDarklyConfig: ITransferStateLaunchDarklyConfig;
|
|
15
22
|
ssoEnabled: boolean;
|
|
16
23
|
appInsightsConfig: ITransferStateAppInsightsConfig;
|
|
17
24
|
userStateCacheExpirationMilliseconds: number;
|
|
18
25
|
userStateDomain: string;
|
|
26
|
+
featureFlagConfig: ITransferStateFeatureFlagConfig;
|
|
19
27
|
}
|
|
20
28
|
|
|
21
|
-
export type { ITransferStateAppInsightsConfig, ITransferStateLaunchDarklyConfig, ITransferStateServerState };
|
|
29
|
+
export type { ITransferStateAppInsightsConfig, ITransferStateFeatureFlagConfig, ITransferStateLaunchDarklyConfig, ITransferStateServerState };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ITransferStateServerState } from '@hmcts/opal-frontend-common/services/transfer-state-service/interfaces';
|
|
1
|
+
import { ITransferStateFeatureFlagConfig, ITransferStateServerState } from '@hmcts/opal-frontend-common/services/transfer-state-service/interfaces';
|
|
2
2
|
|
|
3
3
|
declare const TRANSFER_STATE_APP_INSIGHTS_CONFIG_MOCK: {
|
|
4
4
|
enabled: boolean;
|
|
@@ -12,6 +12,8 @@ declare const TRANSFER_STATE_LAUNCH_DARKLY_CONFIG_MOCK: {
|
|
|
12
12
|
stream: boolean;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
+
declare const TRANSFER_STATE_FEATURE_FLAG_CONFIG_MOCK: ITransferStateFeatureFlagConfig;
|
|
16
|
+
|
|
15
17
|
declare const TRANSFER_STATE_MOCK: ITransferStateServerState;
|
|
16
18
|
|
|
17
|
-
export { TRANSFER_STATE_APP_INSIGHTS_CONFIG_MOCK, TRANSFER_STATE_LAUNCH_DARKLY_CONFIG_MOCK, TRANSFER_STATE_MOCK };
|
|
19
|
+
export { TRANSFER_STATE_APP_INSIGHTS_CONFIG_MOCK, TRANSFER_STATE_FEATURE_FLAG_CONFIG_MOCK, TRANSFER_STATE_LAUNCH_DARKLY_CONFIG_MOCK, TRANSFER_STATE_MOCK };
|
|
@@ -36,6 +36,10 @@ declare class TransferStateService {
|
|
|
36
36
|
* Initializes the user-state domain used to select permissions from the domain-scoped user-state response.
|
|
37
37
|
*/
|
|
38
38
|
initializeUserStateDomain(): void;
|
|
39
|
+
/**
|
|
40
|
+
* Initializes feature flag override config and applies release flags when override mode is enabled.
|
|
41
|
+
*/
|
|
42
|
+
initializeFeatureFlagConfig(): void;
|
|
39
43
|
static ɵfac: i0.ɵɵFactoryDeclaration<TransferStateService, never>;
|
|
40
44
|
static ɵprov: i0.ɵɵInjectableDeclaration<TransferStateService>;
|
|
41
45
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _ngrx_signals from '@ngrx/signals';
|
|
2
2
|
import * as _angular_core from '@angular/core';
|
|
3
3
|
import { LDFlagSet } from 'launchdarkly-js-client-sdk';
|
|
4
|
-
import { ITransferStateLaunchDarklyConfig, ITransferStateAppInsightsConfig } from '@hmcts/opal-frontend-common/services/transfer-state-service/interfaces';
|
|
4
|
+
import { ITransferStateLaunchDarklyConfig, ITransferStateAppInsightsConfig, ITransferStateFeatureFlagConfig } from '@hmcts/opal-frontend-common/services/transfer-state-service/interfaces';
|
|
5
5
|
import { ISessionTokenExpiry } from '@hmcts/opal-frontend-common/services/session-service/interfaces';
|
|
6
6
|
import { IGlobalErrorState } from '@hmcts/opal-frontend-common/stores/global/interfaces';
|
|
7
7
|
import { IOpalUserState } from '@hmcts/opal-frontend-common/services/opal-user-service/interfaces';
|
|
@@ -22,6 +22,7 @@ declare const GlobalStore: _angular_core.Type<{
|
|
|
22
22
|
tokenExpiry: _ngrx_signals.DeepSignal<ISessionTokenExpiry>;
|
|
23
23
|
userStateCacheExpirationMilliseconds: _angular_core.Signal<number>;
|
|
24
24
|
userStateDomain: _angular_core.Signal<string | undefined>;
|
|
25
|
+
featureFlagConfig: _ngrx_signals.DeepSignal<ITransferStateFeatureFlagConfig>;
|
|
25
26
|
setAuthenticated: (authenticated: boolean) => void;
|
|
26
27
|
setBannerError: (error: IGlobalErrorState) => void;
|
|
27
28
|
resetBannerError: () => void;
|
|
@@ -33,6 +34,7 @@ declare const GlobalStore: _angular_core.Type<{
|
|
|
33
34
|
setTokenExpiry: (tokenExpiry: ISessionTokenExpiry) => void;
|
|
34
35
|
setUserStateCacheExpirationMilliseconds: (milliseconds: number) => void;
|
|
35
36
|
setUserStateDomain: (domain: string) => void;
|
|
37
|
+
setFeatureFlagConfig: (config: ITransferStateFeatureFlagConfig) => void;
|
|
36
38
|
} & _ngrx_signals.StateSource<{
|
|
37
39
|
authenticated: boolean;
|
|
38
40
|
bannerError: {
|
|
@@ -49,6 +51,7 @@ declare const GlobalStore: _angular_core.Type<{
|
|
|
49
51
|
tokenExpiry: ISessionTokenExpiry;
|
|
50
52
|
userStateCacheExpirationMilliseconds: number;
|
|
51
53
|
userStateDomain: string | undefined;
|
|
54
|
+
featureFlagConfig: ITransferStateFeatureFlagConfig;
|
|
52
55
|
}>>;
|
|
53
56
|
|
|
54
57
|
export { GlobalStore };
|