@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
@@ -4,7 +4,7 @@ import { CommonModule } from '@angular/common';
4
4
  import { BreadcrumbModule as BreadcrumbModule$1 } from 'primeng/breadcrumb';
5
5
  import { NavigationEnd, PRIMARY_OUTLET, ActivatedRoute, Router, RouterModule } from '@angular/router';
6
6
  import { Subject, throwError, interval, of, ReplaySubject } from 'rxjs';
7
- import { takeUntil, filter, catchError, map, takeWhile, switchMap, take } from 'rxjs/operators';
7
+ import { takeUntil, filter, catchError, map, takeWhile, switchMap, first, take } from 'rxjs/operators';
8
8
  import * as moment_ from 'moment';
9
9
  import { FormField, FieldType } from '@seniorsistemas/angular-components';
10
10
  import { HttpParams, HttpClient } from '@angular/common/http';
@@ -5208,6 +5208,120 @@ BankLookup = __decorate([
5208
5208
  Injectable()
5209
5209
  ], BankLookup);
5210
5210
 
5211
+ let TypeTaxesLookup = class TypeTaxesLookup extends ErpLookups {
5212
+ constructor(lookupService, translate) {
5213
+ super(lookupService, translate, "impostoTipo", [
5214
+ {
5215
+ name: "codigo",
5216
+ type: FieldType.Integer
5217
+ }, {
5218
+ name: "descricao",
5219
+ type: FieldType.String
5220
+ },
5221
+ ], [
5222
+ {
5223
+ name: "codigo",
5224
+ type: FieldType.Integer
5225
+ }, {
5226
+ name: "descricao",
5227
+ type: FieldType.String
5228
+ }, {
5229
+ name: "chave",
5230
+ type: FieldType.String
5231
+ },
5232
+ ], [
5233
+ {
5234
+ name: "codigo",
5235
+ type: FieldType.Integer
5236
+ }, {
5237
+ name: "descricao",
5238
+ type: FieldType.String
5239
+ }, {
5240
+ name: "chave",
5241
+ type: FieldType.String
5242
+ },
5243
+ ], "erpx_cpl_tri", "apuracao_foundation");
5244
+ this.lookupService = lookupService;
5245
+ this.translate = translate;
5246
+ }
5247
+ };
5248
+ TypeTaxesLookup.ctorParameters = () => [
5249
+ { type: ErpLookupsService },
5250
+ { type: TranslateService }
5251
+ ];
5252
+ TypeTaxesLookup = __decorate([
5253
+ Injectable()
5254
+ ], TypeTaxesLookup);
5255
+
5256
+ let ParametersLookup = class ParametersLookup extends ErpLookups {
5257
+ constructor(lookupService, translate) {
5258
+ super(lookupService, translate, "parametros", [
5259
+ {
5260
+ name: "codigo",
5261
+ type: FieldType.Integer
5262
+ }, {
5263
+ name: "imposto",
5264
+ type: FieldType.Enum
5265
+ },
5266
+ ], [
5267
+ {
5268
+ name: "codigo",
5269
+ type: FieldType.Integer
5270
+ }, {
5271
+ name: "imposto",
5272
+ type: FieldType.Enum,
5273
+ }, {
5274
+ name: "codigoArrecadacao",
5275
+ type: FieldType.String
5276
+ }, {
5277
+ name: "regimeControleRetencao",
5278
+ type: FieldType.Enum
5279
+ }, {
5280
+ name: "fornecedor",
5281
+ type: FieldType.String
5282
+ }, {
5283
+ name: "extIntSts",
5284
+ type: FieldType.String
5285
+ }, {
5286
+ name: "extIntMsg",
5287
+ type: FieldType.String
5288
+ },
5289
+ ], [
5290
+ {
5291
+ name: "codigo",
5292
+ type: FieldType.Integer
5293
+ }, {
5294
+ name: "imposto",
5295
+ type: FieldType.Enum,
5296
+ }, {
5297
+ name: "codigoArrecadacao",
5298
+ type: FieldType.String
5299
+ }, {
5300
+ name: "regimeControleRetencao",
5301
+ type: FieldType.Enum
5302
+ }, {
5303
+ name: "fornecedor",
5304
+ type: FieldType.String
5305
+ }, {
5306
+ name: "extIntSts",
5307
+ type: FieldType.String
5308
+ }, {
5309
+ name: "extIntMsg",
5310
+ type: FieldType.String
5311
+ },
5312
+ ], "erpx_cpl_imp", "guias_impostos");
5313
+ this.lookupService = lookupService;
5314
+ this.translate = translate;
5315
+ }
5316
+ };
5317
+ ParametersLookup.ctorParameters = () => [
5318
+ { type: ErpLookupsService },
5319
+ { type: TranslateService }
5320
+ ];
5321
+ ParametersLookup = __decorate([
5322
+ Injectable()
5323
+ ], ParametersLookup);
5324
+
5211
5325
  let ErpLookupsModule = class ErpLookupsModule {
5212
5326
  };
5213
5327
  ErpLookupsModule = __decorate([
@@ -5309,7 +5423,9 @@ ErpLookupsModule = __decorate([
5309
5423
  E048SfcLookup,
5310
5424
  CurrencyLookup,
5311
5425
  CountryLookup,
5312
- BankLookup
5426
+ BankLookup,
5427
+ TypeTaxesLookup,
5428
+ ParametersLookup
5313
5429
  ],
5314
5430
  declarations: [],
5315
5431
  exports: [],
@@ -5906,7 +6022,6 @@ let WebsocketService = WebsocketService_1 = class WebsocketService {
5906
6022
  this.connected = false;
5907
6023
  this.isConnecting = false;
5908
6024
  this.stompSubscriptions = new Map();
5909
- // private primitiveSubjects: Map<string, Subject<any>> = new Map<string, Subject<any>>();
5910
6025
  this.primitiveManagers = new Map();
5911
6026
  this.disconnectSubject = new Subject();
5912
6027
  this.connect$ = new Subject();
@@ -5915,7 +6030,7 @@ let WebsocketService = WebsocketService_1 = class WebsocketService {
5915
6030
  this.connect();
5916
6031
  }
5917
6032
  /**
5918
- * Observable resposável por emitir uma notificação quando a conexão websocket é estabelecida.
6033
+ * Observable responsável por emitir uma notificação quando a conexão websocket é estabelecida.
5919
6034
  * @return Um `Observable<void>` que emite uma notificação quando a conexão websocket é estabelecida ou já está em andamento.
5920
6035
  */
5921
6036
  onConnect() {
@@ -5927,7 +6042,7 @@ let WebsocketService = WebsocketService_1 = class WebsocketService {
5927
6042
  return this.connect$.asObservable();
5928
6043
  }
5929
6044
  /**
5930
- * Observable resposável por emitir uma notificação quando a conexão é finalizada.
6045
+ * Observable responsável por emitir uma notificação quando a conexão é finalizada.
5931
6046
  * @return Um `Observable<void>` que emite uma notificação quando a conexão é finalizada.
5932
6047
  */
5933
6048
  onDisconnect() {
@@ -5953,14 +6068,7 @@ let WebsocketService = WebsocketService_1 = class WebsocketService {
5953
6068
  publishedEvents: [],
5954
6069
  };
5955
6070
  if (this.isConnected()) {
5956
- const url = this.getSubscriptionUserUrl(domain, service, primitive);
5957
- this.primitiveManagers.set(primitive, primitiveManager);
5958
- const stompSubscription = this._stompClient.subscribe(url, (message) => {
5959
- const event = JSON.parse(message.body || "{}");
5960
- this.addPublishedEvent(primitiveManager, event);
5961
- primitiveManager.subject.next(event);
5962
- });
5963
- this.stompSubscriptions.set(primitive, stompSubscription);
6071
+ this.createStompSubscriptions(domain, service, primitive, primitiveManager);
5964
6072
  return primitiveManager.subject.asObservable();
5965
6073
  }
5966
6074
  else {
@@ -5968,22 +6076,15 @@ let WebsocketService = WebsocketService_1 = class WebsocketService {
5968
6076
  this.connect();
5969
6077
  }
5970
6078
  this.onConnect()
5971
- .pipe(take(1))
6079
+ .pipe(first())
5972
6080
  .subscribe(() => {
5973
- const url = this.getSubscriptionUserUrl(domain, service, primitive);
5974
- this.primitiveManagers.set(primitive, primitiveManager);
5975
- const stompSubscription = this._stompClient.subscribe(url, (message) => {
5976
- const event = JSON.parse(message.body || "{}");
5977
- this.addPublishedEvent(primitiveManager, event);
5978
- primitiveManager.subject.next(event);
5979
- });
5980
- this.stompSubscriptions.set(primitive, stompSubscription);
6081
+ this.createStompSubscriptions(domain, service, primitive, primitiveManager);
5981
6082
  });
5982
6083
  return primitiveManager.subject.asObservable();
5983
6084
  }
5984
6085
  }
5985
6086
  /**
5986
- * Retorna todos os eventos ouvidos para a respectiva primitiva.
6087
+ * Retorna todos os eventos ouvidos pela primitiva com os respectivos identificadores.
5987
6088
  * @typeParam `<T>` Tipo do evento retornado pela primitiva.
5988
6089
  * @param primitive Primitiva que será "observada" pelo client.
5989
6090
  * @param identifiers Array com os indentificadores interessados.
@@ -6010,6 +6111,14 @@ let WebsocketService = WebsocketService_1 = class WebsocketService {
6010
6111
  primitiveManager.publishedEvents.push(event);
6011
6112
  }
6012
6113
  }
6114
+ createStompSubscriptions(domain, service, primitive, primitiveManager) {
6115
+ const withTokenUrl = this.getSubscriptionUrlWithToken(domain, service, primitive);
6116
+ this.primitiveManagers.set(primitive, primitiveManager);
6117
+ const stompSubscriptionWithToken = this.createStompSubscription(withTokenUrl, primitiveManager);
6118
+ const withoutTokenUrl = this.getSubscriptionUrlWithoutToken(domain, service, primitive);
6119
+ const stompSubscriptionWithoutToken = this.createStompSubscription(withoutTokenUrl, primitiveManager);
6120
+ this.stompSubscriptions.set(primitive, [stompSubscriptionWithToken, stompSubscriptionWithoutToken]);
6121
+ }
6013
6122
  getIdentifierFromEvent(identifierPath, event) {
6014
6123
  const properties = identifierPath.split(".");
6015
6124
  let identifier = event;
@@ -6023,9 +6132,7 @@ let WebsocketService = WebsocketService_1 = class WebsocketService {
6023
6132
  this.isConnecting = true;
6024
6133
  this._stompClient.connect({}, () => {
6025
6134
  this.setConnected(true);
6026
- // console.log('setou false isConnecting');
6027
6135
  this.isConnecting = false;
6028
- // console.log('connectou dentro do connect cb');
6029
6136
  this.publishOnConnect();
6030
6137
  }, () => {
6031
6138
  this.setConnected(false);
@@ -6048,8 +6155,10 @@ let WebsocketService = WebsocketService_1 = class WebsocketService {
6048
6155
  observersCount += primitiveManager.subject.observers.length;
6049
6156
  }
6050
6157
  if (observersCount === 0) {
6051
- this.stompSubscriptions.forEach(stompSubscription => {
6052
- stompSubscription.unsubscribe();
6158
+ this.stompSubscriptions.forEach(stompSubscriptions => {
6159
+ for (const stompSubscription of stompSubscriptions) {
6160
+ stompSubscription.unsubscribe();
6161
+ }
6053
6162
  });
6054
6163
  for (const primitiveManager of this.primitiveManagers.values()) {
6055
6164
  primitiveManager.subject.complete();
@@ -6069,11 +6178,22 @@ let WebsocketService = WebsocketService_1 = class WebsocketService {
6069
6178
  setConnected(connected) {
6070
6179
  this.connected = connected;
6071
6180
  }
6072
- getSubscriptionUserUrl(domain, service, primitive) {
6181
+ getSubscriptionUrlWithToken(domain, service, primitive) {
6073
6182
  const tenant = WebsocketService_1.TOKEN ? WebsocketService_1.TOKEN.username.split("@")[1] : null;
6074
6183
  const token = WebsocketService_1.TOKEN ? WebsocketService_1.TOKEN.access_token : null;
6075
6184
  return `/topic/${tenant}/${token}/${domain}/${service}/${primitive}`;
6076
6185
  }
6186
+ getSubscriptionUrlWithoutToken(domain, service, primitive) {
6187
+ const tenant = WebsocketService_1.TOKEN ? WebsocketService_1.TOKEN.username.split("@")[1] : null;
6188
+ return `/topic/${tenant}/${domain}/${service}/${primitive}`;
6189
+ }
6190
+ createStompSubscription(destination, primitiveManager) {
6191
+ return this._stompClient.subscribe(destination, (message) => {
6192
+ const event = JSON.parse(message.body || "{}");
6193
+ this.addPublishedEvent(primitiveManager, event);
6194
+ primitiveManager.subject.next(event);
6195
+ });
6196
+ }
6077
6197
  createStompClient() {
6078
6198
  const ws = new SockJS(`${WebsocketService_1.WEBSOCKET_URL}subscription`, null, { timeout: WebsocketService_1.CONNECTION_TIMEOUT });
6079
6199
  this._stompClient = Stomp.over(ws);
@@ -6090,12 +6210,10 @@ let WebsocketService = WebsocketService_1 = class WebsocketService {
6090
6210
  this._stompClient.disconnect();
6091
6211
  const baseUrl = this.getBaseUrl();
6092
6212
  if (this.baseUrl !== null && baseUrl != this.baseUrl) {
6093
- // //console.log('ws disconnected: base url changed', this.baseUrl, ' -> ', baseUrl || 'null');
6094
6213
  return;
6095
6214
  }
6096
6215
  const username = this.getUserName();
6097
6216
  if (this.username !== null && username != this.username) {
6098
- // //console.log('ws disconnected: username changed', this.username, ' -> ', username || 'null');
6099
6217
  return;
6100
6218
  }
6101
6219
  setTimeout(() => {
@@ -6152,18 +6270,20 @@ let VerifyModulePermission = VerifyModulePermission_1 = class VerifyModulePermis
6152
6270
  /**
6153
6271
  * Method to verify if user has permission on a specific module
6154
6272
  * @param module Module to verify the permission
6273
+ * @param requestPermission Indicative if must be call the primitive
6155
6274
  * @returns An boolean Observable
6156
6275
  */
6157
- hasPermission(module) {
6276
+ hasPermission(module, requestPermission) {
6158
6277
  const moduleSubject = VerifyModulePermission_1.subjectsPerModuleMap.get(module);
6159
- if (!moduleSubject) {
6278
+ if (!moduleSubject || requestPermission) {
6160
6279
  const newModuleSubject = new ReplaySubject(1);
6161
6280
  VerifyModulePermission_1.subjectsPerModuleMap.set(module, newModuleSubject);
6162
6281
  this.verifyModulePermissionService
6163
- .queryModule({ modulo: module })
6282
+ .queryModule({ modulo: module, somenteAtivo: true })
6164
6283
  .pipe(take(1))
6165
6284
  .subscribe(response => {
6166
- const hasPermission = !!response.modulos.find(modulo => modulo.ativo && !modulo.empresa);
6285
+ var _a;
6286
+ const hasPermission = ((_a = response === null || response === void 0 ? void 0 : response.modulos) === null || _a === void 0 ? void 0 : _a.length) > 0;
6167
6287
  newModuleSubject.next(hasPermission);
6168
6288
  }, (err) => {
6169
6289
  VerifyModulePermission_1.subjectsPerModuleMap.delete(module);
@@ -6196,5 +6316,5 @@ var ModulesEnum;
6196
6316
  * Generated bundle index. Do not edit.
6197
6317
  */
6198
6318
 
6199
- export { BankLookup, BreadcrumbComponent, BreadcrumbModule, Breakpoints, CountryLookup, CplTriNotaSaidaE001EndLookup, CplTriNotaSaidaE001PesLookup, CplTriNotaSaidaE001TnsLookup, CplTriNotaSaidaE007UfsLookup, CplTriNotaSaidaE008RaiLookup, CplTriNotaSaidaE015MedLookup, CplTriNotaSaidaE020SnfLookup, CplTriNotaSaidaE024MsgLookup, CplTriNotaSaidaE028CpgLookup, CplTriNotaSaidaE032EdcLookup, CplTriNotaSaidaE051DisLookup, CplTriNotaSaidaE066FpgLookup, CplTriNotaSaidaE070EmpLookup, CplTriNotaSaidaE070FilLookup, CplTriNotaSaidaE075DerLookup, CplTriNotaSaidaE080SerLookup, CplTriNotaSaidaNaturezaReceitaPisCofinsLookup, CplTriNotaSaidaNcmLookup, CplTriNotaSaidaNfEntradaLookup, CplTriNotaSaidaNfSaidaLookup, CurrencyLookup, E001EndLookup, E001PesLookup, E001TnsLookup, E001TnsSupEstLookup, E002TptLookup, E007UfsLookup, E008CepLookup, E008RaiLookup, E012FamLookup, E015MedLookup, E020SnfLookup, E021MotLookup, E023CrpLookup, E024MsgLookup, E027EqiLookup, E027StrLookup, E028CpgLookup, E030AgeLookup, E030BanLookup, E031MoeLookup, E032EdcLookup, E035OcrLookup, E036InsLookup, E039PorLookup, E044CcuFinRatDepLookup, E044CcuLookup, E045PlaLookup, E046HpdLookup, E047NtgLookup, E048FctLookup, E048SfcLookup, E051DisLookup, E066FpgLookup, E067FinLookup, E070EmpLookup, E070EntLookup, E070FilLookup, E073PesLookup, E073VeiLookup, E075DerLookup, E080SerLookup, E082TprLookup, E085PesLookup, E090PesLookup, E091PlfFinRatLookup, E095PesLookup, E099UsuComGerLookup, E140InsLookup, E140NfsLookup, E200LotLookup, E200SerLookup, E205DepLookup, E210DxpE075DerLookup, E210DxpLookup, E301TcrLookup, E403FprLookup, E420IcpLookup, E420IpcLookup, E420OcpLookup, E600CcoLookup, E640LotLookup, EnumLogicalOperator, EquipmentLookup, ErpLookups, ErpLookupsModule, ErpPolling, ExportUtils, FiltersStorageService, FormUtilsService, LigacaoItemFornecedorLookup, LookupValidationUtils, ModulesEnum, NcmLookup, NpsService, ProdutoServicoLookup, QuantidadeDisponivelDemandaLookup, RequisicaoLookup, UnidadeMedidaLookup, UtilsModule, VerifyModulePermission, WebsocketService, naturezaReceitaPisCofins, ErpLookupsService as ɵa, StorageService as ɵb, VerifyModulePermissionService as ɵc };
6319
+ export { BankLookup, BreadcrumbComponent, BreadcrumbModule, Breakpoints, CountryLookup, CplTriNotaSaidaE001EndLookup, CplTriNotaSaidaE001PesLookup, CplTriNotaSaidaE001TnsLookup, CplTriNotaSaidaE007UfsLookup, CplTriNotaSaidaE008RaiLookup, CplTriNotaSaidaE015MedLookup, CplTriNotaSaidaE020SnfLookup, CplTriNotaSaidaE024MsgLookup, CplTriNotaSaidaE028CpgLookup, CplTriNotaSaidaE032EdcLookup, CplTriNotaSaidaE051DisLookup, CplTriNotaSaidaE066FpgLookup, CplTriNotaSaidaE070EmpLookup, CplTriNotaSaidaE070FilLookup, CplTriNotaSaidaE075DerLookup, CplTriNotaSaidaE080SerLookup, CplTriNotaSaidaNaturezaReceitaPisCofinsLookup, CplTriNotaSaidaNcmLookup, CplTriNotaSaidaNfEntradaLookup, CplTriNotaSaidaNfSaidaLookup, CurrencyLookup, E001EndLookup, E001PesLookup, E001TnsLookup, E001TnsSupEstLookup, E002TptLookup, E007UfsLookup, E008CepLookup, E008RaiLookup, E012FamLookup, E015MedLookup, E020SnfLookup, E021MotLookup, E023CrpLookup, E024MsgLookup, E027EqiLookup, E027StrLookup, E028CpgLookup, E030AgeLookup, E030BanLookup, E031MoeLookup, E032EdcLookup, E035OcrLookup, E036InsLookup, E039PorLookup, E044CcuFinRatDepLookup, E044CcuLookup, E045PlaLookup, E046HpdLookup, E047NtgLookup, E048FctLookup, E048SfcLookup, E051DisLookup, E066FpgLookup, E067FinLookup, E070EmpLookup, E070EntLookup, E070FilLookup, E073PesLookup, E073VeiLookup, E075DerLookup, E080SerLookup, E082TprLookup, E085PesLookup, E090PesLookup, E091PlfFinRatLookup, E095PesLookup, E099UsuComGerLookup, E140InsLookup, E140NfsLookup, E200LotLookup, E200SerLookup, E205DepLookup, E210DxpE075DerLookup, E210DxpLookup, E301TcrLookup, E403FprLookup, E420IcpLookup, E420IpcLookup, E420OcpLookup, E600CcoLookup, E640LotLookup, EnumLogicalOperator, EquipmentLookup, ErpLookups, ErpLookupsModule, ErpPolling, ExportUtils, FiltersStorageService, FormUtilsService, LigacaoItemFornecedorLookup, LookupValidationUtils, ModulesEnum, NcmLookup, NpsService, ParametersLookup, ProdutoServicoLookup, QuantidadeDisponivelDemandaLookup, RequisicaoLookup, TypeTaxesLookup, UnidadeMedidaLookup, UtilsModule, VerifyModulePermission, WebsocketService, naturezaReceitaPisCofins, ErpLookupsService as ɵa, StorageService as ɵb, VerifyModulePermissionService as ɵc };
6200
6320
  //# sourceMappingURL=senior-gestao-empresarial-angular-components.js.map