monkey-front-core 0.0.300 → 0.0.301

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.
@@ -24,7 +24,7 @@ import { datadogRum } from '@datadog/browser-rum';
24
24
  import * as i1$5 from '@angular/service-worker';
25
25
  import { ServiceWorkerModule } from '@angular/service-worker';
26
26
  import { initialize } from 'launchdarkly-js-client-sdk';
27
- import { createAction, props, createReducer, on } from '@ngrx/store';
27
+ import { createAction, props, INIT, UPDATE, createReducer, on } from '@ngrx/store';
28
28
  import { createEntityAdapter } from '@ngrx/entity';
29
29
 
30
30
  class AlertsComponent {
@@ -5445,25 +5445,40 @@ var index$2 = /*#__PURE__*/Object.freeze({
5445
5445
  monkeyecxStorage: monkeyecxStorage_actions
5446
5446
  });
5447
5447
 
5448
- const seederReducer = (reducer) => {
5449
- return (state, action) => {
5450
- /* if (action.type === INIT || action.type === UPDATE) {
5451
- const storageValue = localStorage.getItem('state');
5452
- if (storageValue) {
5448
+ const seederReducer = (keys) => {
5449
+ return (reducer) => {
5450
+ return (state, action) => {
5451
+ const handledState = reducer(state, action);
5452
+ if (action.type === INIT || action.type === UPDATE) {
5453
+ const storageValue = localStorage.getItem('state');
5454
+ if (storageValue) {
5455
+ try {
5456
+ const handled = {
5457
+ ...handledState,
5458
+ ...JSON.parse(atob(storageValue))
5459
+ };
5460
+ return handled;
5461
+ }
5462
+ catch {
5463
+ localStorage.removeItem('state');
5464
+ }
5465
+ }
5466
+ }
5467
+ let data = null;
5453
5468
  try {
5454
- return JSON.parse(storageValue);
5455
- } catch {
5456
- localStorage.removeItem('state');
5469
+ keys.forEach((key) => {
5470
+ data = {
5471
+ ...data,
5472
+ [key]: handledState[key]
5473
+ };
5474
+ });
5475
+ localStorage.setItem('state', btoa(JSON.stringify(data)));
5457
5476
  }
5458
- }
5459
- } */
5460
- const nextState = reducer(state, action);
5461
- const data = nextState?.['shared-companies'];
5462
- console.log('@#@@@@@');
5463
- console.log(data);
5464
- console.log('@#@@@@@');
5465
- localStorage.setItem('state', JSON.stringify(nextState));
5466
- return nextState;
5477
+ catch (e) {
5478
+ localStorage.removeItem('state');
5479
+ }
5480
+ return data || handledState;
5481
+ };
5467
5482
  };
5468
5483
  };
5469
5484