@senior-gestao-empresarial/angular-components 5.1.0 → 5.1.1

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 (31) hide show
  1. package/bundles/senior-gestao-empresarial-angular-components.umd.js +48 -43
  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/erp-lookups.d.ts +1 -0
  6. package/components/nps/index.d.ts +1 -0
  7. package/components/nps/nps.service.d.ts +4 -35
  8. package/components/nps/protocols/index.d.ts +3 -0
  9. package/components/nps/protocols/tenant-full-dto.d.ts +3 -0
  10. package/components/nps/protocols/token-senior-x.d.ts +14 -0
  11. package/components/nps/protocols/tracksale-request.d.ts +18 -0
  12. package/esm2015/components/lookups/erp-lookups.js +14 -19
  13. package/esm2015/components/nps/index.js +1 -1
  14. package/esm2015/components/nps/nps.service.js +12 -9
  15. package/esm2015/components/nps/protocols/index.js +1 -0
  16. package/esm2015/components/nps/protocols/tenant-full-dto.js +1 -0
  17. package/esm2015/components/nps/protocols/token-senior-x.js +1 -0
  18. package/esm2015/components/nps/protocols/tracksale-request.js +1 -0
  19. package/esm5/components/lookups/erp-lookups.js +15 -19
  20. package/esm5/components/nps/index.js +1 -1
  21. package/esm5/components/nps/nps.service.js +32 -23
  22. package/esm5/components/nps/protocols/index.js +1 -0
  23. package/esm5/components/nps/protocols/tenant-full-dto.js +1 -0
  24. package/esm5/components/nps/protocols/token-senior-x.js +1 -0
  25. package/esm5/components/nps/protocols/tracksale-request.js +1 -0
  26. package/fesm2015/senior-gestao-empresarial-angular-components.js +24 -26
  27. package/fesm2015/senior-gestao-empresarial-angular-components.js.map +1 -1
  28. package/fesm5/senior-gestao-empresarial-angular-components.js +45 -40
  29. package/fesm5/senior-gestao-empresarial-angular-components.js.map +1 -1
  30. package/package.json +1 -1
  31. package/senior-gestao-empresarial-angular-components.metadata.json +1 -1
@@ -13,8 +13,8 @@ import { TranslateService } from '@ngx-translate/core';
13
13
  import { HttpInterceptorModule } from '@seniorsistemas/platform-components';
14
14
  import { user } from '@seniorsistemas/senior-platform-data';
15
15
  import { FormControl, FormGroup } from '@angular/forms';
16
- import { get } from 'js-cookie';
17
16
  import { Stomp } from '@stomp/stompjs';
17
+ import { get } from 'js-cookie';
18
18
  import * as SockJS from 'sockjs-client';
19
19
 
20
20
  var BreadcrumbComponent = /** @class */ (function () {
@@ -423,15 +423,7 @@ var ErpLookups = /** @class */ (function () {
423
423
  }, this.entity, options.domain || this.domain, options.service || this.service)
424
424
  .pipe(takeUntil(this.ngUnsubscribe))
425
425
  .pipe(map(function (list) {
426
- return list.contents.map(function (item) { return (__assign(__assign({}, item), { label: lookupDisplayFields
427
- .map(function (field) {
428
- if (field.indexOf(".") > 0)
429
- return _this.getProp(item, field, prefix);
430
- return item[field] !== undefined && item[field] !== null
431
- ? item[field]
432
- : _this.translate.instant(prefix + ".empty_label");
433
- })
434
- .join(" - ") })); });
426
+ return list.contents.map(function (item) { return (__assign(__assign({}, item), { label: _this.getItemLabel(item, prefix, lookupDisplayFields) })); });
435
427
  }))
436
428
  .subscribe(function (data) {
437
429
  _this.lookupSuggestionsObservable.next(data);
@@ -500,21 +492,25 @@ var ErpLookups = /** @class */ (function () {
500
492
  .list({ page: page, sort: sort, filterQuery: filterQuery, displayFields: displayFields }, this.entity, options.domain || this.domain, options.service || this.service)
501
493
  .pipe(takeUntil(this.ngUnsubscribe))
502
494
  .pipe(map(function (list) { return ({
503
- gridData: list.contents.map(function (item) { return (__assign(__assign({}, item), { label: lookupDisplayFields
504
- .map(function (field) {
505
- if (field.indexOf(".") > 0)
506
- return _this.getProp(item, field, prefix);
507
- return item[field] !== undefined && item[field] !== null
508
- ? item[field]
509
- : _this.translate.instant(prefix + ".empty_label");
510
- })
511
- .join(" - ") })); }),
495
+ gridData: list.contents.map(function (item) { return (__assign(__assign({}, item), { label: _this.getItemLabel(item, prefix, lookupDisplayFields) })); }),
512
496
  totalRecords: list.totalElements
513
497
  }); }))
514
498
  .subscribe(function (data) {
515
499
  _this.lookupSearchObservable.next(data);
516
500
  });
517
501
  };
502
+ ErpLookups.prototype.getItemLabel = function (item, prefix, lookupDisplayFields) {
503
+ var _this = this;
504
+ return lookupDisplayFields
505
+ .map(function (field) {
506
+ if (field.indexOf(".") > 0)
507
+ return _this.getProp(item, field, prefix);
508
+ return item[field] !== undefined && item[field] !== null
509
+ ? item[field]
510
+ : _this.translate.instant(prefix + ".empty_label");
511
+ })
512
+ .join(" - ");
513
+ };
518
514
  ErpLookups.ctorParameters = function () { return [
519
515
  { type: ErpLookupsService },
520
516
  { type: TranslateService },
@@ -6470,38 +6466,47 @@ var UtilsModule = /** @class */ (function () {
6470
6466
  return UtilsModule;
6471
6467
  }());
6472
6468
 
6469
+ // https://widget.tracksale.co/
6473
6470
  var NpsService = /** @class */ (function () {
6474
6471
  function NpsService() {
6475
6472
  }
6476
- Object.defineProperty(NpsService.prototype, "cookieInformation", {
6477
- get: function () {
6478
- return JSON.parse(get("com.senior.pau.userdata") || "{}");
6479
- },
6480
- enumerable: true,
6481
- configurable: true
6482
- });
6473
+ NpsService.prototype.getUserInformation = function () {
6474
+ return __awaiter(this, void 0, void 0, function () {
6475
+ return __generator(this, function (_a) {
6476
+ switch (_a.label) {
6477
+ case 0: return [4 /*yield*/, user.getToken()];
6478
+ case 1: return [2 /*return*/, _a.sent()];
6479
+ }
6480
+ });
6481
+ });
6482
+ };
6483
6483
  /**
6484
6484
  * Executa o serviço de NPS utilizando os dados do usuário atual, no caso sobreescrevendos os campos name, email, identification,
6485
6485
  * tags.tenant e tags.email fornecidos no request original. Esses serão sobreescritos com os valores retornados pelo cookie
6486
- * com.senior.pau.userdata. *
6486
+ * com.senior.pau.userdata.
6487
+ *
6487
6488
  * @param tracksaleRequest request que será enviado ao serviço de nps
6488
6489
  */
6489
6490
  NpsService.prototype.currentUserInitNPS = function (tracksaleRequest) {
6490
6491
  return __awaiter(this, void 0, void 0, function () {
6491
- var _a, tenantName, email, fullname, id, copyTracksaleRequest;
6492
+ var _a, tenantName, email, fullName, copyTracksaleRequest;
6492
6493
  return __generator(this, function (_b) {
6493
- _a = this.cookieInformation, tenantName = _a.tenantName, email = _a.email, fullname = _a.fullname, id = _a.id;
6494
- copyTracksaleRequest = __assign({}, tracksaleRequest);
6495
- copyTracksaleRequest.tags =
6496
- (tracksaleRequest.tags && __assign({}, tracksaleRequest.tags)) ||
6497
- {};
6498
- copyTracksaleRequest.name = fullname;
6499
- copyTracksaleRequest.email = email;
6500
- copyTracksaleRequest.identification = id;
6501
- copyTracksaleRequest.tags.tenant = tenantName;
6502
- copyTracksaleRequest.tags.email = email;
6503
- this.initNPS(copyTracksaleRequest);
6504
- return [2 /*return*/];
6494
+ switch (_b.label) {
6495
+ case 0: return [4 /*yield*/, this.getUserInformation()];
6496
+ case 1:
6497
+ _a = _b.sent(), tenantName = _a.tenantName, email = _a.email, fullName = _a.fullName;
6498
+ copyTracksaleRequest = __assign({}, tracksaleRequest);
6499
+ copyTracksaleRequest.tags =
6500
+ (tracksaleRequest.tags && __assign({}, tracksaleRequest.tags)) ||
6501
+ {};
6502
+ copyTracksaleRequest.name = fullName;
6503
+ copyTracksaleRequest.email = email;
6504
+ copyTracksaleRequest.identification = email;
6505
+ copyTracksaleRequest.tags.tenant = tenantName;
6506
+ copyTracksaleRequest.tags.email = email;
6507
+ this.initNPS(copyTracksaleRequest);
6508
+ return [2 /*return*/];
6509
+ }
6505
6510
  });
6506
6511
  });
6507
6512
  };