http-request-manager 18.13.12 → 18.13.13

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.
@@ -910,9 +910,9 @@ const DEFAULT_TRACKER_OPTIONS = SettingOptions.adapt({
910
910
  });
911
911
  class QueryParamsTrackerService {
912
912
  constructor() {
913
+ this.localStorageManager = inject(LocalStorageManagerService);
913
914
  this.state = { paths: {} };
914
915
  this.stateRestored = false;
915
- this.localStorageManager = inject(LocalStorageManagerService);
916
916
  }
917
917
  clearTracking(resetSessionInit = false) {
918
918
  this.state = { paths: {} };
@@ -1159,7 +1159,7 @@ class QueryParamsTrackerService {
1159
1159
  sessionStorage.setItem(TRACKER_SESSION_INIT_KEY, '1');
1160
1160
  }
1161
1161
  restoreState() {
1162
- const syncState = this.localStorageManager.getStoreSync(TRACKER_STORE_NAME);
1162
+ const syncState = this.localStorageManager.getPersistedStoreSync(TRACKER_STORE_NAME);
1163
1163
  if (this.isTrackerState(syncState)) {
1164
1164
  this.state = QueryTrackerStateModel.adapt(syncState);
1165
1165
  this.cleanupExpiredEntries();
@@ -5463,6 +5463,59 @@ class LocalStorageManagerService extends ComponentStore {
5463
5463
  return storageData;
5464
5464
  }
5465
5465
  }
5466
+ getPersistedStoreSync(storeName) {
5467
+ storeName = this.validStoreName(String(storeName || ''));
5468
+ if (!storeName || !this.app?.appID) {
5469
+ return null;
5470
+ }
5471
+ const settingsStr = localStorage.getItem(this.storageSettingsName);
5472
+ if (!settingsStr) {
5473
+ return null;
5474
+ }
5475
+ let settings = [];
5476
+ try {
5477
+ const decryptedSettings = this.encryption.decrypt(settingsStr, this.app.appID);
5478
+ settings = decryptedSettings ? JSON.parse(decryptedSettings) : [];
5479
+ }
5480
+ catch {
5481
+ return null;
5482
+ }
5483
+ const foundSetting = settings.find(item => item.name === storeName);
5484
+ if (!foundSetting) {
5485
+ return null;
5486
+ }
5487
+ const rawStores = foundSetting.options?.storage === StorageType.GLOBAL
5488
+ ? localStorage.getItem(this.storageName)
5489
+ : sessionStorage.getItem(this.storageName);
5490
+ if (!rawStores) {
5491
+ return null;
5492
+ }
5493
+ let stores = [];
5494
+ try {
5495
+ stores = JSON.parse(rawStores);
5496
+ }
5497
+ catch {
5498
+ return null;
5499
+ }
5500
+ const foundStore = stores.find(item => item.id === foundSetting.id);
5501
+ if (!foundStore) {
5502
+ return null;
5503
+ }
5504
+ const options = SettingOptions.adapt(foundSetting.options);
5505
+ let storageData = foundStore.data;
5506
+ if (options.encrypted) {
5507
+ const decryptedData = this.encryption.decrypt(foundStore.data, this.app.appID);
5508
+ if (decryptedData !== null) {
5509
+ storageData = decryptedData;
5510
+ }
5511
+ }
5512
+ try {
5513
+ return this.isString(storageData) ? JSON.parse(storageData) : storageData;
5514
+ }
5515
+ catch {
5516
+ return storageData;
5517
+ }
5518
+ }
5466
5519
  startTimer() {
5467
5520
  const timer$ = interval(1000 * 3).pipe(withLatestFrom(this.data$), map(([_, state]) => state), tap((state) => {
5468
5521
  const expired = this.expired(state) ? this.expired(state) : [];