dts-backoffice-util 19.5.0 → 19.6.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.
package/README.md CHANGED
@@ -12,7 +12,7 @@ Segue abaixo as últimas versões da Biblioteca, conforme a versão do PO-UI e A
12
12
 
13
13
  | PO-UI | Angular | Versão dtsBackofficeUtil |
14
14
  |-|-|-|
15
- | v19 | v19 | 19.5.0 |
15
+ | v19 | v19 | 19.6.0 |
16
16
  | v18 | v18 | 18.3.0 |
17
17
  | v17 | v17 | 17.1.0 |
18
18
  | v16 | v16 | 16.1.0 |
@@ -272,6 +272,15 @@ class MenuDatasulService {
272
272
  this.openHTMLProgram('THF1', externalName, params, parent);
273
273
  }
274
274
  openHTMLProgram(type, HTMLProgram, params, parent) {
275
+ const backendType = sessionStorage.getItem('totvs.product.backend.type');
276
+ if (backendType === 'DSS') {
277
+ this.openOnDSS(type, HTMLProgram, params, parent);
278
+ }
279
+ else {
280
+ this.openOnDTS4THF(type, HTMLProgram, params, parent);
281
+ }
282
+ }
283
+ openOnDTS4THF(type, HTMLProgram, params, parent) {
275
284
  const datasulPath = document.referrer.indexOf('totvs-menu') > 0 ? 'totvs-menu' : 'menu-html';
276
285
  HTMLProgram = HTMLProgram.replace(/\\/g, '/');
277
286
  if (HTMLProgram.charAt(0) === '/') {
@@ -291,8 +300,33 @@ class MenuDatasulService {
291
300
  if (baseUrl.charAt(baseUrl.length - 1) === '/') {
292
301
  baseUrl = baseUrl.slice(0, -1);
293
302
  }
294
- baseUrl = `${baseUrl}/#/${params}`;
303
+ if (type === 'THF2') {
304
+ baseUrl = `${baseUrl}/#`;
305
+ }
306
+ baseUrl = `${baseUrl}/${params}`;
307
+ }
308
+ this.openWindow(baseUrl, parent);
309
+ }
310
+ openOnDSS(type, HTMLProgram, params, parent) {
311
+ let baseUrl = `${HTMLProgram}`;
312
+ if (params) {
313
+ baseUrl = `${baseUrl}/${params}`;
295
314
  }
315
+ try {
316
+ if (window.top && typeof window.top.navigateSmartX === 'function') {
317
+ window.top.navigateSmartX(baseUrl);
318
+ }
319
+ else {
320
+ // Se falhar e precisar do window.open, a barra na frente e o smart-x
321
+ // são necessários para o navegador não emendar na URL atual do iframe
322
+ this.openWindow(`/smart-x/${baseUrl}`, parent);
323
+ }
324
+ }
325
+ catch (e) {
326
+ this.openWindow(`/smart-x/${baseUrl}`, parent);
327
+ }
328
+ }
329
+ openWindow(baseUrl, parent) {
296
330
  if (parent) {
297
331
  window.open(baseUrl, '_parent');
298
332
  }
@@ -319,7 +353,7 @@ class MenuDatasulService {
319
353
  }
320
354
  const aRequest = [];
321
355
  programList.forEach(programSearch => {
322
- aRequest.push(this.http.post(this.urlMenuPrograms, { search: programSearch }));
356
+ aRequest.push(this.http.post(this.urlMenuPrograms, this.getPayloadSearchProg(programSearch)));
323
357
  });
324
358
  return forkJoin(aRequest).pipe(map$1((response) => {
325
359
  if (!response) {
@@ -349,6 +383,9 @@ class MenuDatasulService {
349
383
  return responseReturn;
350
384
  }));
351
385
  }
386
+ getPayloadSearchProg(programSearch) {
387
+ return { 'codModul': null, 'search': programSearch, 'typeProg': '4,3,1,2', 'groupAplicat': [] };
388
+ }
352
389
  /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: MenuDatasulService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
353
390
  /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: MenuDatasulService }); }
354
391
  }