@senior-gestao-relacionamento/angular-components 1.7.0-fix-crmdev-11254-e8e30855 → 1.7.0

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.
@@ -831,7 +831,7 @@
831
831
  };
832
832
  StorageService.prototype.store = function (key, value) {
833
833
  var userId = this.getUserId();
834
- localStorage.setItem(userId + "_" + key, this.safeStringify(value));
834
+ localStorage.setItem(userId + "_" + key, JSON.stringify(value));
835
835
  };
836
836
  StorageService.prototype.get = function (key) {
837
837
  var userId = this.getUserId();
@@ -865,18 +865,6 @@
865
865
  StorageService.prototype.isUserAdmin = function () {
866
866
  return this.getUsername() === 'admin';
867
867
  };
868
- StorageService.prototype.safeStringify = function (obj) {
869
- var seen = new WeakSet();
870
- return JSON.stringify(obj, function (key, value) {
871
- if (value && typeof value === "object") {
872
- if (seen.has(value)) {
873
- return __assign({}, value);
874
- }
875
- seen.add(value);
876
- }
877
- return value;
878
- });
879
- };
880
868
  StorageService.ctorParameters = function () { return [
881
869
  { type: ngxCookieService.CookieService }
882
870
  ]; };
@@ -935,6 +923,7 @@
935
923
  throw err;
936
924
  }))
937
925
  .subscribe(function (collaboratorDto) {
926
+ collaboratorDto = _this.removeCircularReferences(collaboratorDto);
938
927
  _this.storageService.store(_this.COLLABORATOR_KEY, collaboratorDto);
939
928
  observer.next(Collaborator.fromDto(collaboratorDto));
940
929
  });
@@ -945,6 +934,18 @@
945
934
  CurrentCollaboratorService.prototype.redirect = function (page) {
946
935
  location.href = this.storageService.getBaseUrl() + "/gestao-relacionamento/crmx_collaborator/foundation/#/" + page;
947
936
  };
937
+ CurrentCollaboratorService.prototype.removeCircularReferences = function (obj) {
938
+ var seen = new WeakSet();
939
+ return JSON.parse(JSON.stringify(obj, function (key, value) {
940
+ if (typeof value === 'object') {
941
+ if (seen.has(value)) {
942
+ return undefined;
943
+ }
944
+ seen.add(value);
945
+ }
946
+ return value;
947
+ }));
948
+ };
948
949
  CurrentCollaboratorService.ctorParameters = function () { return [
949
950
  { type: http.HttpClient },
950
951
  { type: StorageService }
@@ -980,7 +981,7 @@
980
981
  StorageModule,
981
982
  ],
982
983
  providers: [
983
- CurrentCollaboratorService,
984
+ CurrentCollaboratorService
984
985
  ],
985
986
  })
986
987
  ], CurrentCollaboratorModule);