@hmcts/rpx-xui-common-lib 3.2.22-exui-5389-rc2 → 3.2.23
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.
|
@@ -2150,12 +2150,8 @@ class FilterService {
|
|
|
2150
2150
|
this.streams = {};
|
|
2151
2151
|
}
|
|
2152
2152
|
persist(setting, persistence) {
|
|
2153
|
-
setting = { ...setting };
|
|
2154
|
-
delete setting.idamId;
|
|
2155
2153
|
switch (persistence) {
|
|
2156
2154
|
case 'local':
|
|
2157
|
-
this.persistLocal(setting);
|
|
2158
|
-
break;
|
|
2159
2155
|
case 'session':
|
|
2160
2156
|
this.persistSession(setting);
|
|
2161
2157
|
break;
|
|
@@ -2167,33 +2163,14 @@ class FilterService {
|
|
|
2167
2163
|
}
|
|
2168
2164
|
get(id) {
|
|
2169
2165
|
if (this.filterSettings[id]) {
|
|
2170
|
-
|
|
2171
|
-
return !setting.ownerHash || this.isSameUser(setting) ? setting : null;
|
|
2172
|
-
}
|
|
2173
|
-
const localSetting = localStorage.getItem(id);
|
|
2174
|
-
if (localSetting) {
|
|
2175
|
-
const setting = JSON.parse(localSetting);
|
|
2176
|
-
if (this.isSameUser(setting)) {
|
|
2177
|
-
// A legacy session entry must not override the restored local filter.
|
|
2178
|
-
sessionStorage.removeItem(id);
|
|
2179
|
-
return setting;
|
|
2180
|
-
}
|
|
2181
|
-
localStorage.removeItem(id);
|
|
2166
|
+
return this.filterSettings[id];
|
|
2182
2167
|
}
|
|
2183
|
-
const
|
|
2184
|
-
if (
|
|
2185
|
-
return JSON.parse(
|
|
2168
|
+
const storedSetting = sessionStorage.getItem(id);
|
|
2169
|
+
if (storedSetting) {
|
|
2170
|
+
return JSON.parse(storedSetting);
|
|
2186
2171
|
}
|
|
2187
2172
|
return null;
|
|
2188
2173
|
}
|
|
2189
|
-
isSameUser(setting) {
|
|
2190
|
-
const ownerHash = this.getOwnerHash();
|
|
2191
|
-
return !!ownerHash && setting.ownerHash === ownerHash;
|
|
2192
|
-
}
|
|
2193
|
-
getOwnerHash() {
|
|
2194
|
-
const userInfoStr = window.sessionStorage.getItem('userDetails');
|
|
2195
|
-
return userInfoStr ? JSON.parse(userInfoStr).filterOwnerHash : undefined;
|
|
2196
|
-
}
|
|
2197
2174
|
getStream(id) {
|
|
2198
2175
|
if (!this.streams[id]) {
|
|
2199
2176
|
this.streams[id] = new BehaviorSubject(this.get(id));
|
|
@@ -2202,7 +2179,6 @@ class FilterService {
|
|
|
2202
2179
|
}
|
|
2203
2180
|
clearSessionAndLocalPersistance(id) {
|
|
2204
2181
|
sessionStorage.removeItem(id);
|
|
2205
|
-
localStorage.removeItem(id);
|
|
2206
2182
|
if (this.filterSettings[id] !== undefined) {
|
|
2207
2183
|
this.filterSettings[id] = null;
|
|
2208
2184
|
}
|
|
@@ -2210,21 +2186,8 @@ class FilterService {
|
|
|
2210
2186
|
this.streams[id].next(null);
|
|
2211
2187
|
}
|
|
2212
2188
|
}
|
|
2213
|
-
persistLocal(setting) {
|
|
2214
|
-
const ownerHash = this.getOwnerHash();
|
|
2215
|
-
if (!ownerHash) {
|
|
2216
|
-
// Without an owner reference, retain selections only in this session.
|
|
2217
|
-
delete setting.ownerHash;
|
|
2218
|
-
this.persistSession(setting);
|
|
2219
|
-
return;
|
|
2220
|
-
}
|
|
2221
|
-
setting.ownerHash = ownerHash;
|
|
2222
|
-
window.localStorage.setItem(setting.id, JSON.stringify(setting));
|
|
2223
|
-
sessionStorage.removeItem(setting.id);
|
|
2224
|
-
}
|
|
2225
2189
|
persistSession(setting) {
|
|
2226
2190
|
sessionStorage.setItem(setting.id, JSON.stringify(setting));
|
|
2227
|
-
localStorage.removeItem(setting.id);
|
|
2228
2191
|
}
|
|
2229
2192
|
persistMemory(setting) {
|
|
2230
2193
|
this.filterSettings[setting.id] = setting;
|
|
@@ -4689,6 +4652,7 @@ class GenericFilterComponent {
|
|
|
4689
4652
|
if (form.valid) {
|
|
4690
4653
|
this._settings = {
|
|
4691
4654
|
id: this.config.id,
|
|
4655
|
+
idamId: this.filterService.getUserId(),
|
|
4692
4656
|
fields: this.getSelectedValues(form.value, this.config)
|
|
4693
4657
|
};
|
|
4694
4658
|
this.cdr.markForCheck();
|