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

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.
Files changed (27) hide show
  1. package/bundles/senior-gestao-relacionamento-angular-components.umd.js +47 -52
  2. package/bundles/senior-gestao-relacionamento-angular-components.umd.js.map +1 -1
  3. package/bundles/senior-gestao-relacionamento-angular-components.umd.min.js +2 -2
  4. package/bundles/senior-gestao-relacionamento-angular-components.umd.min.js.map +1 -1
  5. package/esm2015/senior-gestao-relacionamento-angular-components.js +1 -2
  6. package/esm2015/services/current-collaborator/current-collaborator.service.js +3 -26
  7. package/esm2015/services/standard-filters/standard-filters.module.js +1 -5
  8. package/esm2015/services/standard-filters/standard-filters.service.js +8 -22
  9. package/esm2015/utils/index.js +2 -1
  10. package/esm2015/utils/resolve-refs.service.js +35 -0
  11. package/esm5/senior-gestao-relacionamento-angular-components.js +1 -2
  12. package/esm5/services/current-collaborator/current-collaborator.service.js +4 -28
  13. package/esm5/services/standard-filters/standard-filters.module.js +1 -5
  14. package/esm5/services/standard-filters/standard-filters.service.js +8 -24
  15. package/esm5/utils/index.js +2 -1
  16. package/esm5/utils/resolve-refs.service.js +39 -0
  17. package/fesm2015/senior-gestao-relacionamento-angular-components.js +44 -48
  18. package/fesm2015/senior-gestao-relacionamento-angular-components.js.map +1 -1
  19. package/fesm5/senior-gestao-relacionamento-angular-components.js +47 -51
  20. package/fesm5/senior-gestao-relacionamento-angular-components.js.map +1 -1
  21. package/package.json +1 -1
  22. package/senior-gestao-relacionamento-angular-components.d.ts +0 -1
  23. package/senior-gestao-relacionamento-angular-components.metadata.json +1 -1
  24. package/services/current-collaborator/current-collaborator.service.d.ts +1 -3
  25. package/services/standard-filters/standard-filters.service.d.ts +4 -6
  26. package/utils/index.d.ts +1 -0
  27. package/utils/resolve-refs.service.d.ts +3 -0
@@ -874,6 +874,44 @@
874
874
  return StorageService;
875
875
  }());
876
876
 
877
+ var ResolveRefsService = /** @class */ (function () {
878
+ function ResolveRefsService() {
879
+ }
880
+ ResolveRefsService.resolveRefs = function (payload) {
881
+ var getDataFromRef = function (ref, rootObj) {
882
+ var regex = /\["(.*?)"\]/g;
883
+ var result = [];
884
+ var match;
885
+ while ((match = regex.exec(ref)) !== null) {
886
+ result.push(match[1]);
887
+ }
888
+ return result.reduce(function (acc, part) { return acc && acc[part]; }, rootObj);
889
+ };
890
+ var resolve = function (obj, rootObj) {
891
+ if (Array.isArray(obj)) {
892
+ obj.forEach(function (item) { return resolve(item, rootObj); });
893
+ }
894
+ else if (obj !== null && typeof obj === 'object') {
895
+ Object.keys(obj).forEach(function (key) {
896
+ if (key === '$ref' && obj[key]) {
897
+ var refPath = obj[key];
898
+ if (refPath !== '$') {
899
+ Object.assign(obj, getDataFromRef(refPath, rootObj));
900
+ }
901
+ delete obj[key];
902
+ }
903
+ else {
904
+ resolve(obj[key], rootObj);
905
+ }
906
+ });
907
+ }
908
+ };
909
+ resolve(payload, payload);
910
+ return payload;
911
+ };
912
+ return ResolveRefsService;
913
+ }());
914
+
877
915
  var CurrentCollaboratorService = /** @class */ (function () {
878
916
  function CurrentCollaboratorService(http, storageService) {
879
917
  this.http = http;
@@ -892,19 +930,6 @@
892
930
  CurrentCollaboratorService.prototype.get = function () {
893
931
  return this.call(true);
894
932
  };
895
- CurrentCollaboratorService.prototype.getE070FilCrmxMaster = function () {
896
- var _this = this;
897
- return new rxjs.Observable(function (observer) {
898
- _this.call(true).subscribe(function (collaborator) {
899
- var e070FilCrmxMaster = __assign({}, collaborator.branches.find(function (branch) { return branch.master; }));
900
- if (e070FilCrmxMaster) {
901
- e070FilCrmxMaster.collaborator = collaborator;
902
- observer.next(e070FilCrmxMaster);
903
- }
904
- observer.complete();
905
- });
906
- });
907
- };
908
933
  CurrentCollaboratorService.prototype.call = function (useCache) {
909
934
  var _this = this;
910
935
  return new rxjs.Observable(function (observer) {
@@ -923,7 +948,7 @@
923
948
  throw err;
924
949
  }))
925
950
  .subscribe(function (collaboratorDto) {
926
- collaboratorDto = _this.removeCircularReferences(collaboratorDto);
951
+ collaboratorDto = ResolveRefsService.resolveRefs(collaboratorDto);
927
952
  _this.storageService.store(_this.COLLABORATOR_KEY, collaboratorDto);
928
953
  observer.next(Collaborator.fromDto(collaboratorDto));
929
954
  });
@@ -934,18 +959,6 @@
934
959
  CurrentCollaboratorService.prototype.redirect = function (page) {
935
960
  location.href = this.storageService.getBaseUrl() + "/gestao-relacionamento/crmx_collaborator/foundation/#/" + page;
936
961
  };
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
- };
949
962
  CurrentCollaboratorService.ctorParameters = function () { return [
950
963
  { type: http.HttpClient },
951
964
  { type: StorageService }
@@ -1251,26 +1264,15 @@
1251
1264
  }());
1252
1265
 
1253
1266
  var StandardFiltersService = /** @class */ (function () {
1254
- function StandardFiltersService(currentCollaboratorService) {
1255
- this.currentCollaboratorService = currentCollaboratorService;
1267
+ function StandardFiltersService() {
1256
1268
  }
1257
- StandardFiltersService.prototype.addFilterE070emp = function (filterQuery, alias) {
1258
- var _this = this;
1259
- return new rxjs.Observable(function (observer) {
1260
- _this.currentCollaboratorService.get().subscribe(function (collaborator) {
1261
- var ids = Array.from(new Set(collaborator.branches.map(function (branch) { return branch.e070filCrmx.e070fil.e070emp.id; })));
1262
- observer.next(_this.addFilterIn(filterQuery, alias, 'id', ids));
1263
- });
1264
- });
1269
+ StandardFiltersService.prototype.addFilterE070emp = function (filterQuery, alias, e070empList) {
1270
+ var ids = Array.from(new Set(e070empList.map(function (e070emp) { return e070emp.id; })));
1271
+ return this.addFilterIn(filterQuery, alias, 'id', ids);
1265
1272
  };
1266
- StandardFiltersService.prototype.addFilterE070fil = function (filterQuery, alias) {
1267
- var _this = this;
1268
- return new rxjs.Observable(function (observer) {
1269
- _this.currentCollaboratorService.get().subscribe(function (collaborator) {
1270
- var ids = Array.from(new Set(collaborator.branches.map(function (branch) { return branch.e070filCrmx.id; })));
1271
- observer.next(_this.addFilterIn(filterQuery, alias, 'id', ids));
1272
- });
1273
- });
1273
+ StandardFiltersService.prototype.addFilterE070fil = function (filterQuery, alias, e070filList) {
1274
+ var ids = Array.from(new Set(e070filList.map(function (e070fil) { return e070fil.id; })));
1275
+ return this.addFilterIn(filterQuery, alias, 'id', ids);
1274
1276
  };
1275
1277
  StandardFiltersService.prototype.addFilterActive = function (filterQuery, alias) {
1276
1278
  var filter = this.addAlias(alias, 'active eq true');
@@ -1287,9 +1289,6 @@
1287
1289
  StandardFiltersService.prototype.addAlias = function (alias, filter) {
1288
1290
  return (alias ? alias + "." : '') + filter;
1289
1291
  };
1290
- StandardFiltersService.ctorParameters = function () { return [
1291
- { type: CurrentCollaboratorService }
1292
- ]; };
1293
1292
  StandardFiltersService = __decorate([
1294
1293
  core.Injectable()
1295
1294
  ], StandardFiltersService);
@@ -1301,9 +1300,6 @@
1301
1300
  }
1302
1301
  StandardFiltersModule = __decorate([
1303
1302
  core.NgModule({
1304
- imports: [
1305
- CurrentCollaboratorModule
1306
- ],
1307
1303
  providers: [
1308
1304
  StandardFiltersService
1309
1305
  ],
@@ -1580,6 +1576,7 @@
1580
1576
  exports.ReportsComponent = ReportsComponent;
1581
1577
  exports.ReportsModule = ReportsModule;
1582
1578
  exports.ReportsService = ReportsService;
1579
+ exports.ResolveRefsService = ResolveRefsService;
1583
1580
  exports.ScheduleFormRulesModule = ScheduleFormRulesModule;
1584
1581
  exports.ScheduleFormRulesService = ScheduleFormRulesService;
1585
1582
  exports.Squad = Squad;
@@ -1594,8 +1591,6 @@
1594
1591
  exports.WebsocketService = WebsocketService;
1595
1592
  exports.fallback = fallback;
1596
1593
  exports.ɵa = StorageModule;
1597
- exports.ɵb = CurrentCollaboratorModule;
1598
- exports.ɵc = CurrentCollaboratorService;
1599
1594
 
1600
1595
  Object.defineProperty(exports, '__esModule', { value: true });
1601
1596