@senior-gestao-empresarial/angular-components 4.20.4 → 4.22.0-5b65c0a7-384a-4f22-b4d9-413308f621ab

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 (30) hide show
  1. package/bundles/senior-gestao-empresarial-angular-components.umd.js +174 -36
  2. package/bundles/senior-gestao-empresarial-angular-components.umd.js.map +1 -1
  3. package/bundles/senior-gestao-empresarial-angular-components.umd.min.js +2 -2
  4. package/bundles/senior-gestao-empresarial-angular-components.umd.min.js.map +1 -1
  5. package/components/lookups/entities/apuracao-foundation/parameters-lookup.d.ts +8 -0
  6. package/components/lookups/entities/apuracao-foundation/type-taxes-lookup.d.ts +8 -0
  7. package/components/lookups/index.d.ts +2 -0
  8. package/components/permissions/protocols/query-module.d.ts +1 -0
  9. package/components/permissions/verify-module-permission.d.ts +2 -1
  10. package/components/websocket/websocket.service.d.ts +7 -4
  11. package/esm2015/components/lookups/entities/apuracao-foundation/parameters-lookup.js +76 -0
  12. package/esm2015/components/lookups/entities/apuracao-foundation/type-taxes-lookup.js +52 -0
  13. package/esm2015/components/lookups/erp-lookups.module.js +6 -2
  14. package/esm2015/components/lookups/index.js +3 -1
  15. package/esm2015/components/permissions/protocols/query-module.js +1 -1
  16. package/esm2015/components/permissions/verify-module-permission.js +7 -5
  17. package/esm2015/components/websocket/websocket.service.js +32 -30
  18. package/esm5/components/lookups/entities/apuracao-foundation/parameters-lookup.js +79 -0
  19. package/esm5/components/lookups/entities/apuracao-foundation/type-taxes-lookup.js +55 -0
  20. package/esm5/components/lookups/erp-lookups.module.js +6 -2
  21. package/esm5/components/lookups/index.js +3 -1
  22. package/esm5/components/permissions/protocols/query-module.js +1 -1
  23. package/esm5/components/permissions/verify-module-permission.js +7 -5
  24. package/esm5/components/websocket/websocket.service.js +45 -33
  25. package/fesm2015/senior-gestao-empresarial-angular-components.js +155 -35
  26. package/fesm2015/senior-gestao-empresarial-angular-components.js.map +1 -1
  27. package/fesm5/senior-gestao-empresarial-angular-components.js +174 -38
  28. package/fesm5/senior-gestao-empresarial-angular-components.js.map +1 -1
  29. package/package.json +1 -1
  30. package/senior-gestao-empresarial-angular-components.metadata.json +1 -1
@@ -5715,6 +5715,126 @@
5715
5715
  return BankLookup;
5716
5716
  }(ErpLookups));
5717
5717
 
5718
+ var TypeTaxesLookup = /** @class */ (function (_super) {
5719
+ __extends(TypeTaxesLookup, _super);
5720
+ function TypeTaxesLookup(lookupService, translate) {
5721
+ var _this = _super.call(this, lookupService, translate, "impostoTipo", [
5722
+ {
5723
+ name: "codigo",
5724
+ type: angularComponents.FieldType.Integer
5725
+ }, {
5726
+ name: "descricao",
5727
+ type: angularComponents.FieldType.String
5728
+ },
5729
+ ], [
5730
+ {
5731
+ name: "codigo",
5732
+ type: angularComponents.FieldType.Integer
5733
+ }, {
5734
+ name: "descricao",
5735
+ type: angularComponents.FieldType.String
5736
+ }, {
5737
+ name: "chave",
5738
+ type: angularComponents.FieldType.String
5739
+ },
5740
+ ], [
5741
+ {
5742
+ name: "codigo",
5743
+ type: angularComponents.FieldType.Integer
5744
+ }, {
5745
+ name: "descricao",
5746
+ type: angularComponents.FieldType.String
5747
+ }, {
5748
+ name: "chave",
5749
+ type: angularComponents.FieldType.String
5750
+ },
5751
+ ], "erpx_cpl_tri", "apuracao_foundation") || this;
5752
+ _this.lookupService = lookupService;
5753
+ _this.translate = translate;
5754
+ return _this;
5755
+ }
5756
+ TypeTaxesLookup.ctorParameters = function () { return [
5757
+ { type: ErpLookupsService },
5758
+ { type: core$1.TranslateService }
5759
+ ]; };
5760
+ TypeTaxesLookup = __decorate([
5761
+ core.Injectable()
5762
+ ], TypeTaxesLookup);
5763
+ return TypeTaxesLookup;
5764
+ }(ErpLookups));
5765
+
5766
+ var ParametersLookup = /** @class */ (function (_super) {
5767
+ __extends(ParametersLookup, _super);
5768
+ function ParametersLookup(lookupService, translate) {
5769
+ var _this = _super.call(this, lookupService, translate, "parametros", [
5770
+ {
5771
+ name: "codigo",
5772
+ type: angularComponents.FieldType.Integer
5773
+ }, {
5774
+ name: "imposto",
5775
+ type: angularComponents.FieldType.Enum
5776
+ },
5777
+ ], [
5778
+ {
5779
+ name: "codigo",
5780
+ type: angularComponents.FieldType.Integer
5781
+ }, {
5782
+ name: "imposto",
5783
+ type: angularComponents.FieldType.Enum,
5784
+ }, {
5785
+ name: "codigoArrecadacao",
5786
+ type: angularComponents.FieldType.String
5787
+ }, {
5788
+ name: "regimeControleRetencao",
5789
+ type: angularComponents.FieldType.Enum
5790
+ }, {
5791
+ name: "fornecedor",
5792
+ type: angularComponents.FieldType.String
5793
+ }, {
5794
+ name: "extIntSts",
5795
+ type: angularComponents.FieldType.String
5796
+ }, {
5797
+ name: "extIntMsg",
5798
+ type: angularComponents.FieldType.String
5799
+ },
5800
+ ], [
5801
+ {
5802
+ name: "codigo",
5803
+ type: angularComponents.FieldType.Integer
5804
+ }, {
5805
+ name: "imposto",
5806
+ type: angularComponents.FieldType.Enum,
5807
+ }, {
5808
+ name: "codigoArrecadacao",
5809
+ type: angularComponents.FieldType.String
5810
+ }, {
5811
+ name: "regimeControleRetencao",
5812
+ type: angularComponents.FieldType.Enum
5813
+ }, {
5814
+ name: "fornecedor",
5815
+ type: angularComponents.FieldType.String
5816
+ }, {
5817
+ name: "extIntSts",
5818
+ type: angularComponents.FieldType.String
5819
+ }, {
5820
+ name: "extIntMsg",
5821
+ type: angularComponents.FieldType.String
5822
+ },
5823
+ ], "erpx_cpl_imp", "guias_impostos") || this;
5824
+ _this.lookupService = lookupService;
5825
+ _this.translate = translate;
5826
+ return _this;
5827
+ }
5828
+ ParametersLookup.ctorParameters = function () { return [
5829
+ { type: ErpLookupsService },
5830
+ { type: core$1.TranslateService }
5831
+ ]; };
5832
+ ParametersLookup = __decorate([
5833
+ core.Injectable()
5834
+ ], ParametersLookup);
5835
+ return ParametersLookup;
5836
+ }(ErpLookups));
5837
+
5718
5838
  var ErpLookupsModule = /** @class */ (function () {
5719
5839
  function ErpLookupsModule() {
5720
5840
  }
@@ -5817,7 +5937,9 @@
5817
5937
  E048SfcLookup,
5818
5938
  CurrencyLookup,
5819
5939
  CountryLookup,
5820
- BankLookup
5940
+ BankLookup,
5941
+ TypeTaxesLookup,
5942
+ ParametersLookup
5821
5943
  ],
5822
5944
  declarations: [],
5823
5945
  exports: [],
@@ -6495,7 +6617,6 @@
6495
6617
  this.connected = false;
6496
6618
  this.isConnecting = false;
6497
6619
  this.stompSubscriptions = new Map();
6498
- // private primitiveSubjects: Map<string, Subject<any>> = new Map<string, Subject<any>>();
6499
6620
  this.primitiveManagers = new Map();
6500
6621
  this.disconnectSubject = new rxjs.Subject();
6501
6622
  this.connect$ = new rxjs.Subject();
@@ -6505,7 +6626,7 @@
6505
6626
  }
6506
6627
  WebsocketService_1 = WebsocketService;
6507
6628
  /**
6508
- * Observable resposável por emitir uma notificação quando a conexão websocket é estabelecida.
6629
+ * Observable responsável por emitir uma notificação quando a conexão websocket é estabelecida.
6509
6630
  * @return Um `Observable<void>` que emite uma notificação quando a conexão websocket é estabelecida ou já está em andamento.
6510
6631
  */
6511
6632
  WebsocketService.prototype.onConnect = function () {
@@ -6518,7 +6639,7 @@
6518
6639
  return this.connect$.asObservable();
6519
6640
  };
6520
6641
  /**
6521
- * Observable resposável por emitir uma notificação quando a conexão é finalizada.
6642
+ * Observable responsável por emitir uma notificação quando a conexão é finalizada.
6522
6643
  * @return Um `Observable<void>` que emite uma notificação quando a conexão é finalizada.
6523
6644
  */
6524
6645
  WebsocketService.prototype.onDisconnect = function () {
@@ -6545,14 +6666,7 @@
6545
6666
  publishedEvents: [],
6546
6667
  };
6547
6668
  if (this.isConnected()) {
6548
- var url = this.getSubscriptionUserUrl(domain, service, primitive);
6549
- this.primitiveManagers.set(primitive, primitiveManager);
6550
- var stompSubscription = this._stompClient.subscribe(url, function (message) {
6551
- var event = JSON.parse(message.body || "{}");
6552
- _this.addPublishedEvent(primitiveManager, event);
6553
- primitiveManager.subject.next(event);
6554
- });
6555
- this.stompSubscriptions.set(primitive, stompSubscription);
6669
+ this.createStompSubscriptions(domain, service, primitive, primitiveManager);
6556
6670
  return primitiveManager.subject.asObservable();
6557
6671
  }
6558
6672
  else {
@@ -6560,22 +6674,15 @@
6560
6674
  this.connect();
6561
6675
  }
6562
6676
  this.onConnect()
6563
- .pipe(operators.take(1))
6677
+ .pipe(operators.first())
6564
6678
  .subscribe(function () {
6565
- var url = _this.getSubscriptionUserUrl(domain, service, primitive);
6566
- _this.primitiveManagers.set(primitive, primitiveManager);
6567
- var stompSubscription = _this._stompClient.subscribe(url, function (message) {
6568
- var event = JSON.parse(message.body || "{}");
6569
- _this.addPublishedEvent(primitiveManager, event);
6570
- primitiveManager.subject.next(event);
6571
- });
6572
- _this.stompSubscriptions.set(primitive, stompSubscription);
6679
+ _this.createStompSubscriptions(domain, service, primitive, primitiveManager);
6573
6680
  });
6574
6681
  return primitiveManager.subject.asObservable();
6575
6682
  }
6576
6683
  };
6577
6684
  /**
6578
- * Retorna todos os eventos ouvidos para a respectiva primitiva.
6685
+ * Retorna todos os eventos ouvidos pela primitiva com os respectivos identificadores.
6579
6686
  * @typeParam `<T>` Tipo do evento retornado pela primitiva.
6580
6687
  * @param primitive Primitiva que será "observada" pelo client.
6581
6688
  * @param identifiers Array com os indentificadores interessados.
@@ -6610,9 +6717,7 @@
6610
6717
  WebsocketService.prototype.addPublishedEvent = function (primitiveManager, event) {
6611
6718
  var _this = this;
6612
6719
  var identifier = this.getIdentifierFromEvent(primitiveManager.identifierPath, event);
6613
- var eventIndex = primitiveManager.publishedEvents.findIndex(function (x) {
6614
- return _this.getIdentifierFromEvent(primitiveManager.identifierPath, x) === identifier;
6615
- });
6720
+ var eventIndex = primitiveManager.publishedEvents.findIndex(function (x) { return _this.getIdentifierFromEvent(primitiveManager.identifierPath, x) === identifier; });
6616
6721
  if (eventIndex !== -1) {
6617
6722
  primitiveManager.publishedEvents[eventIndex] = __assign(__assign({}, primitiveManager.publishedEvents[eventIndex]), event);
6618
6723
  }
@@ -6620,6 +6725,14 @@
6620
6725
  primitiveManager.publishedEvents.push(event);
6621
6726
  }
6622
6727
  };
6728
+ WebsocketService.prototype.createStompSubscriptions = function (domain, service, primitive, primitiveManager) {
6729
+ var withTokenUrl = this.getSubscriptionUrlWithToken(domain, service, primitive);
6730
+ this.primitiveManagers.set(primitive, primitiveManager);
6731
+ var stompSubscriptionWithToken = this.createStompSubscription(withTokenUrl, primitiveManager);
6732
+ var withoutTokenUrl = this.getSubscriptionUrlWithoutToken(domain, service, primitive);
6733
+ var stompSubscriptionWithoutToken = this.createStompSubscription(withoutTokenUrl, primitiveManager);
6734
+ this.stompSubscriptions.set(primitive, [stompSubscriptionWithToken, stompSubscriptionWithoutToken]);
6735
+ };
6623
6736
  WebsocketService.prototype.getIdentifierFromEvent = function (identifierPath, event) {
6624
6737
  var e_2, _a;
6625
6738
  var properties = identifierPath.split(".");
@@ -6645,9 +6758,7 @@
6645
6758
  this.isConnecting = true;
6646
6759
  this._stompClient.connect({}, function () {
6647
6760
  _this.setConnected(true);
6648
- // console.log('setou false isConnecting');
6649
6761
  _this.isConnecting = false;
6650
- // console.log('connectou dentro do connect cb');
6651
6762
  _this.publishOnConnect();
6652
6763
  }, function () {
6653
6764
  _this.setConnected(false);
@@ -6681,8 +6792,21 @@
6681
6792
  finally { if (e_3) throw e_3.error; }
6682
6793
  }
6683
6794
  if (observersCount === 0) {
6684
- this.stompSubscriptions.forEach(function (stompSubscription) {
6685
- stompSubscription.unsubscribe();
6795
+ this.stompSubscriptions.forEach(function (stompSubscriptions) {
6796
+ var e_5, _a;
6797
+ try {
6798
+ for (var stompSubscriptions_1 = __values(stompSubscriptions), stompSubscriptions_1_1 = stompSubscriptions_1.next(); !stompSubscriptions_1_1.done; stompSubscriptions_1_1 = stompSubscriptions_1.next()) {
6799
+ var stompSubscription = stompSubscriptions_1_1.value;
6800
+ stompSubscription.unsubscribe();
6801
+ }
6802
+ }
6803
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
6804
+ finally {
6805
+ try {
6806
+ if (stompSubscriptions_1_1 && !stompSubscriptions_1_1.done && (_a = stompSubscriptions_1.return)) _a.call(stompSubscriptions_1);
6807
+ }
6808
+ finally { if (e_5) throw e_5.error; }
6809
+ }
6686
6810
  });
6687
6811
  try {
6688
6812
  for (var _e = __values(this.primitiveManagers.values()), _f = _e.next(); !_f.done; _f = _e.next()) {
@@ -6712,11 +6836,23 @@
6712
6836
  WebsocketService.prototype.setConnected = function (connected) {
6713
6837
  this.connected = connected;
6714
6838
  };
6715
- WebsocketService.prototype.getSubscriptionUserUrl = function (domain, service, primitive) {
6839
+ WebsocketService.prototype.getSubscriptionUrlWithToken = function (domain, service, primitive) {
6716
6840
  var tenant = WebsocketService_1.TOKEN ? WebsocketService_1.TOKEN.username.split("@")[1] : null;
6717
6841
  var token = WebsocketService_1.TOKEN ? WebsocketService_1.TOKEN.access_token : null;
6718
6842
  return "/topic/" + tenant + "/" + token + "/" + domain + "/" + service + "/" + primitive;
6719
6843
  };
6844
+ WebsocketService.prototype.getSubscriptionUrlWithoutToken = function (domain, service, primitive) {
6845
+ var tenant = WebsocketService_1.TOKEN ? WebsocketService_1.TOKEN.username.split("@")[1] : null;
6846
+ return "/topic/" + tenant + "/" + domain + "/" + service + "/" + primitive;
6847
+ };
6848
+ WebsocketService.prototype.createStompSubscription = function (destination, primitiveManager) {
6849
+ var _this = this;
6850
+ return this._stompClient.subscribe(destination, function (message) {
6851
+ var event = JSON.parse(message.body || "{}");
6852
+ _this.addPublishedEvent(primitiveManager, event);
6853
+ primitiveManager.subject.next(event);
6854
+ });
6855
+ };
6720
6856
  WebsocketService.prototype.createStompClient = function () {
6721
6857
  var ws = new SockJS(WebsocketService_1.WEBSOCKET_URL + "subscription", null, { timeout: WebsocketService_1.CONNECTION_TIMEOUT });
6722
6858
  this._stompClient = stompjs.Stomp.over(ws);
@@ -6734,12 +6870,10 @@
6734
6870
  this._stompClient.disconnect();
6735
6871
  var baseUrl = this.getBaseUrl();
6736
6872
  if (this.baseUrl !== null && baseUrl != this.baseUrl) {
6737
- // //console.log('ws disconnected: base url changed', this.baseUrl, ' -> ', baseUrl || 'null');
6738
6873
  return;
6739
6874
  }
6740
6875
  var username = this.getUserName();
6741
6876
  if (this.username !== null && username != this.username) {
6742
- // //console.log('ws disconnected: username changed', this.username, ' -> ', username || 'null');
6743
6877
  return;
6744
6878
  }
6745
6879
  setTimeout(function () {
@@ -6800,18 +6934,20 @@
6800
6934
  /**
6801
6935
  * Method to verify if user has permission on a specific module
6802
6936
  * @param module Module to verify the permission
6937
+ * @param requestPermission Indicative if must be call the primitive
6803
6938
  * @returns An boolean Observable
6804
6939
  */
6805
- VerifyModulePermission.prototype.hasPermission = function (module) {
6940
+ VerifyModulePermission.prototype.hasPermission = function (module, requestPermission) {
6806
6941
  var moduleSubject = VerifyModulePermission_1.subjectsPerModuleMap.get(module);
6807
- if (!moduleSubject) {
6942
+ if (!moduleSubject || requestPermission) {
6808
6943
  var newModuleSubject_1 = new rxjs.ReplaySubject(1);
6809
6944
  VerifyModulePermission_1.subjectsPerModuleMap.set(module, newModuleSubject_1);
6810
6945
  this.verifyModulePermissionService
6811
- .queryModule({ modulo: module })
6946
+ .queryModule({ modulo: module, somenteAtivo: true })
6812
6947
  .pipe(operators.take(1))
6813
6948
  .subscribe(function (response) {
6814
- var hasPermission = !!response.modulos.find(function (modulo) { return modulo.ativo && !modulo.empresa; });
6949
+ var _a;
6950
+ var hasPermission = ((_a = response === null || response === void 0 ? void 0 : response.modulos) === null || _a === void 0 ? void 0 : _a.length) > 0;
6815
6951
  newModuleSubject_1.next(hasPermission);
6816
6952
  }, function (err) {
6817
6953
  VerifyModulePermission_1.subjectsPerModuleMap.delete(module);
@@ -6940,9 +7076,11 @@
6940
7076
  exports.LookupValidationUtils = LookupValidationUtils;
6941
7077
  exports.NcmLookup = NcmLookup;
6942
7078
  exports.NpsService = NpsService;
7079
+ exports.ParametersLookup = ParametersLookup;
6943
7080
  exports.ProdutoServicoLookup = ProdutoServicoLookup;
6944
7081
  exports.QuantidadeDisponivelDemandaLookup = QuantidadeDisponivelDemandaLookup;
6945
7082
  exports.RequisicaoLookup = RequisicaoLookup;
7083
+ exports.TypeTaxesLookup = TypeTaxesLookup;
6946
7084
  exports.UnidadeMedidaLookup = UnidadeMedidaLookup;
6947
7085
  exports.UtilsModule = UtilsModule;
6948
7086
  exports.VerifyModulePermission = VerifyModulePermission;