@sambath999/localize-token 12.4.0 → 12.4.2

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/sambath999-localize-token.umd.js +290 -239
  2. package/bundles/sambath999-localize-token.umd.js.map +1 -1
  3. package/esm2015/localize-api-token/localize-api-token.module.js +21 -0
  4. package/esm2015/localize-api-token/localize-api-token.service.js +34 -0
  5. package/esm2015/localize-logindlg/localize-logindlg.component.js +4 -4
  6. package/esm2015/localize-logindlg/localize-logindlg.module.js +1 -1
  7. package/esm2015/localize-logindlg/localize-logindlg.service.js +1 -1
  8. package/esm2015/localize-token/helpers/interfaces.js +1 -1
  9. package/esm2015/localize-token/helpers/localize.api.assets.js +1 -1
  10. package/esm2015/localize-token/helpers/loccalize.api.helper.js +1 -1
  11. package/esm2015/localize-token/localize.api.service.js +3 -3
  12. package/esm2015/localize-token/localize.token.js +1 -1
  13. package/esm2015/localize-token/localize.token.module.js +1 -1
  14. package/esm2015/localize-token/localize.token.service.js +3 -6
  15. package/esm2015/localize-token/localize.token.storage.js +1 -1
  16. package/esm2015/public-api.js +17 -3
  17. package/esm2015/sambath999-localize-token.js +1 -1
  18. package/fesm2015/sambath999-localize-token.js +946 -905
  19. package/fesm2015/sambath999-localize-token.js.map +1 -1
  20. package/localize-api-token/localize-api-token.module.d.ts +2 -0
  21. package/localize-api-token/localize-api-token.service.d.ts +12 -0
  22. package/localize-logindlg/localize-logindlg.service.d.ts +0 -1
  23. package/localize-token/localize.token.service.d.ts +1 -1
  24. package/package.json +1 -1
  25. package/public-api.d.ts +13 -2
  26. package/sambath999-localize-token.metadata.json +1 -1
  27. package/esm2015/localize-logindlg/public-api.js +0 -4
  28. package/esm2015/localize-token/public-api.js +0 -9
  29. package/localize-logindlg/public-api.d.ts +0 -3
  30. package/localize-token/public-api.d.ts +0 -8
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('jwt-decode'), require('@angular/common/http'), require('primeng/api'), require('primeng/dynamicdialog'), require('@angular/platform-browser'), require('@angular/common'), require('primeng/toast'), require('primeng/inputtext'), require('primeng/button'), require('@angular/forms')) :
3
- typeof define === 'function' && define.amd ? define('@sambath999/localize-token', ['exports', '@angular/core', 'rxjs', 'jwt-decode', '@angular/common/http', 'primeng/api', 'primeng/dynamicdialog', '@angular/platform-browser', '@angular/common', 'primeng/toast', 'primeng/inputtext', 'primeng/button', '@angular/forms'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.sambath999 = global.sambath999 || {}, global.sambath999["localize-token"] = {}), global.ng.core, global.rxjs, global.jwt_decode, global.ng.common.http, global.api, global.dynamicdialog, global.ng.platformBrowser, global.ng.common, global.toast, global.inputtext, global.button, global.ng.forms));
5
- })(this, (function (exports, i0, rxjs, jwt_decode, i1, api, dynamicdialog, platformBrowser, common, toast, inputtext, button, forms) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common/http'), require('@angular/core'), require('primeng/api'), require('primeng/dynamicdialog'), require('rxjs'), require('jwt-decode'), require('@angular/platform-browser'), require('@angular/common'), require('primeng/toast'), require('primeng/inputtext'), require('primeng/button'), require('@angular/forms')) :
3
+ typeof define === 'function' && define.amd ? define('@sambath999/localize-token', ['exports', '@angular/common/http', '@angular/core', 'primeng/api', 'primeng/dynamicdialog', 'rxjs', 'jwt-decode', '@angular/platform-browser', '@angular/common', 'primeng/toast', 'primeng/inputtext', 'primeng/button', '@angular/forms'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.sambath999 = global.sambath999 || {}, global.sambath999["localize-token"] = {}), global.ng.common.http, global.ng.core, global.api, global.dynamicdialog, global.rxjs, global.jwt_decode, global.ng.platformBrowser, global.ng.common, global.toast, global.inputtext, global.button, global.ng.forms));
5
+ })(this, (function (exports, i1, i0, api, dynamicdialog, rxjs, jwt_decode, platformBrowser, common, toast, inputtext, button, forms) { 'use strict';
6
6
 
7
7
  function _interopNamespace(e) {
8
8
  if (e && e.__esModule) return e;
@@ -22,15 +22,9 @@
22
22
  return Object.freeze(n);
23
23
  }
24
24
 
25
+ var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
25
26
  var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
26
27
  var jwt_decode__namespace = /*#__PURE__*/_interopNamespace(jwt_decode);
27
- var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
28
-
29
- var LOCALIZE_API_ASSETS = {
30
- network: {
31
- noConnection: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <svg id=\"lze-no-connection\" data-name=\"Layer 2\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 77.29 70.98\">\n <defs>\n <style> .cls-1 { fill: #fff; } .cls-2, .cls-3 { fill: #e30613; } .cls-3 { stroke: #e30613; stroke-miterlimit: 10; stroke-width: .25px; } </style>\n </defs>\n <g id=\"Layer_3\" data-name=\"Layer 3\">\n <g>\n <path class=\"cls-1\" d=\"m73.29,35c-1.2,0-2.33-.53-3.09-1.46-.48-.57-11.23-13.2-31.55-13.2s-31.11,12.66-31.56,13.2c-1.4,1.71-3.92,1.95-5.63.55-1.71-1.4-1.95-3.92-.55-5.63.54-.66,13.47-16.12,37.74-16.12s37.2,15.46,37.74,16.12c1.4,1.71,1.15,4.23-.56,5.62-.71.58-1.61.9-2.53.9Z\"/>\n <path class=\"cls-1\" d=\"m63.96,45.66c-1.19,0-2.32-.53-3.08-1.44-5.79-6.05-13.86-9.39-22.24-9.21-8.38-.18-16.45,3.16-22.24,9.22-1.46,1.65-3.99,1.81-5.64.35-1.57-1.39-1.8-3.77-.52-5.43,7.32-7.89,17.64-12.29,28.4-12.12,10.76-.17,21.08,4.24,28.4,12.12,1.4,1.71,1.15,4.23-.56,5.62-.71.58-1.6.9-2.53.9Z\"/>\n <path class=\"cls-1\" d=\"m53.3,56.32c-1.24,0-2.41-.57-3.16-1.55-5.73-6.35-15.52-6.85-21.87-1.13-.4.36-.77.73-1.13,1.13-1.36,1.73-3.88,2.03-5.61.67-1.71-1.34-2.03-3.8-.73-5.54,8.39-9.85,23.18-11.04,33.03-2.65.95.81,1.84,1.69,2.65,2.65,1.34,1.75,1,4.26-.75,5.6-.7.53-1.55.82-2.43.82Z\"/>\n </g>\n <path class=\"cls-2\" d=\"m47.21,9.45l-4.06,41.36c-.64,5.42-8.39,5.39-9.01,0,0,0-4.06-41.36-4.06-41.36-.46-4.73,2.99-8.94,7.72-9.4,5.33-.58,9.97,4.09,9.4,9.4h0Z\"/>\n <circle class=\"cls-3\" cx=\"38.64\" cy=\"64.79\" r=\"6.07\"/>\n </g>\n </svg>"
32
- }
33
- };
34
28
 
35
29
  /*! *****************************************************************************
36
30
  Copyright (c) Microsoft Corporation.
@@ -614,6 +608,11 @@
614
608
  enumerable: false,
615
609
  configurable: true
616
610
  });
611
+ Object.defineProperty(LocalizeTokenService.prototype, "tenantToken", {
612
+ get: function () { var _a; return LocalizeToken.storage.get(((_a = this.config.tenantToken) === null || _a === void 0 ? void 0 : _a.name) || ''); },
613
+ enumerable: false,
614
+ configurable: true
615
+ });
617
616
  Object.defineProperty(LocalizeTokenService.prototype, "refreshToken", {
618
617
  get: function () { var _a; return LocalizeToken.storage.get(((_a = this.config.refreshToken) === null || _a === void 0 ? void 0 : _a.name) || ''); },
619
618
  enumerable: false,
@@ -636,10 +635,6 @@
636
635
  enumerable: false,
637
636
  configurable: true
638
637
  });
639
- LocalizeTokenService.prototype.tenantToken = function () {
640
- var _a;
641
- return LocalizeToken.storage.get(((_a = this.config.tenantToken) === null || _a === void 0 ? void 0 : _a.name) || '');
642
- };
643
638
  LocalizeTokenService.prototype.storageGet = function () {
644
639
  var _a;
645
640
  try {
@@ -659,7 +654,7 @@
659
654
  LocalizeTokenService.prototype.tokensValid = function () {
660
655
  var _a, _b;
661
656
  return !!((_a = this.refreshToken) === null || _a === void 0 ? void 0 : _a.length)
662
- && (!this.config.tenantToken || !!((_b = this.tenantToken()) === null || _b === void 0 ? void 0 : _b.length));
657
+ && (!this.config.tenantToken || !!((_b = this.tenantToken) === null || _b === void 0 ? void 0 : _b.length));
663
658
  };
664
659
  Object.defineProperty(LocalizeTokenService.prototype, "decodeRefreshToken", {
665
660
  get: function () {
@@ -681,6 +676,252 @@
681
676
  { type: i0.Injectable, args: [{ providedIn: 'root' },] }
682
677
  ];
683
678
 
679
+ var LocalizeLogindlgComponent = /** @class */ (function () {
680
+ function LocalizeLogindlgComponent(messageService, cdt, dlgRef, dlgConfig, tokenService, httpClient, sanitizer) {
681
+ var _this = this;
682
+ this.messageService = messageService;
683
+ this.cdt = cdt;
684
+ this.dlgRef = dlgRef;
685
+ this.dlgConfig = dlgConfig;
686
+ this.tokenService = tokenService;
687
+ this.httpClient = httpClient;
688
+ this.sanitizer = sanitizer;
689
+ this.messageKey = "$login-dlg";
690
+ this.loading = false;
691
+ this.success = false;
692
+ this.clickLogout = function () { var _a; return (_a = _this.logout) === null || _a === void 0 ? void 0 : _a.call(_this); };
693
+ this.decodeToken = this.tokenService.decodeRefreshToken;
694
+ this.loginConfig = this.dlgConfig.data.loginConfig;
695
+ this.properties = this.loginConfig.properties;
696
+ }
697
+ Object.defineProperty(LocalizeLogindlgComponent.prototype, "config", {
698
+ get: function () { return this.tokenService.config; },
699
+ enumerable: false,
700
+ configurable: true
701
+ });
702
+ LocalizeLogindlgComponent.prototype.ngOnInit = function () {
703
+ var _this = this;
704
+ this.dlgConfig.closable = false;
705
+ this.logout = this.loginConfig.logoutFunc;
706
+ this.loginUrl = this.loginConfig.loginUrl;
707
+ if (!this.decodeToken) {
708
+ this.showMessage("error", "Token is invalid");
709
+ setTimeout(function () { var _a; return (_a = _this.logout) === null || _a === void 0 ? void 0 : _a.call(_this); }, 2000);
710
+ }
711
+ };
712
+ LocalizeLogindlgComponent.prototype.ngAfterViewInit = function () {
713
+ this.cdt.detectChanges();
714
+ };
715
+ LocalizeLogindlgComponent.prototype.clickLogin = function () {
716
+ var _a, _b, _c;
717
+ return __awaiter(this, void 0, void 0, function () {
718
+ var loginRes, cookieOptions;
719
+ var _this = this;
720
+ return __generator(this, function (_d) {
721
+ switch (_d.label) {
722
+ case 0:
723
+ if (!this.isValidPassword) {
724
+ return [2 /*return*/, this.showMessage("error", "Password is required and must be at least 6 characters")];
725
+ }
726
+ this.loading = true;
727
+ return [4 /*yield*/, this.login()];
728
+ case 1:
729
+ loginRes = _d.sent();
730
+ if (!(loginRes === null || loginRes === void 0 ? void 0 : loginRes.status)) {
731
+ return [2 /*return*/, this.showMessage("error", (_a = loginRes.message) !== null && _a !== void 0 ? _a : "An error occurred")];
732
+ }
733
+ this.tokenService.accessToken = loginRes.tokens.accessToken;
734
+ cookieOptions = { expires: (_b = this.loginConfig.expire) !== null && _b !== void 0 ? _b : 365 };
735
+ LocalizeToken.storage.set(((_c = this.config.refreshToken) === null || _c === void 0 ? void 0 : _c.name) || '', loginRes.tokens.refreshToken, cookieOptions);
736
+ this.success = true;
737
+ setTimeout(function () {
738
+ _this.dlgConfig.dismissableMask = true;
739
+ _this.dlgConfig.modal = false;
740
+ _this.dlgRef.close(true);
741
+ }, 2000);
742
+ return [2 /*return*/];
743
+ }
744
+ });
745
+ });
746
+ };
747
+ LocalizeLogindlgComponent.prototype.login = function () {
748
+ var _a, _b, _c;
749
+ return __awaiter(this, void 0, void 0, function () {
750
+ var e_1;
751
+ var _this = this;
752
+ return __generator(this, function (_d) {
753
+ switch (_d.label) {
754
+ case 0:
755
+ if (!((_a = this.loginUrl) === null || _a === void 0 ? void 0 : _a.trim().length)) {
756
+ this.showMessage("error", "Login url is required");
757
+ throw new Error("Login url is required");
758
+ }
759
+ _d.label = 1;
760
+ case 1:
761
+ _d.trys.push([1, 5, , 6]);
762
+ if (!this.loginConfig.loginFunction) return [3 /*break*/, 3];
763
+ console.log("Using custom login function");
764
+ return [4 /*yield*/, this.loginConfig.loginFunction((_c = (_b = this.decodeToken) === null || _b === void 0 ? void 0 : _b.email) !== null && _c !== void 0 ? _c : '', this.password.trim(), this.getHeaders())];
765
+ case 2: return [2 /*return*/, _d.sent()];
766
+ case 3: return [4 /*yield*/, new Promise(function (resolve, reject) { return _this.httpClient.post(_this.loginUrl, { password: _this.password.trim() }, { headers: _this.getHeaders() }).subscribe({ next: resolve, error: reject }); })];
767
+ case 4: return [2 /*return*/, _d.sent()];
768
+ case 5:
769
+ e_1 = _d.sent();
770
+ this.showMessage("error", e_1.message);
771
+ return [2 /*return*/, null];
772
+ case 6: return [2 /*return*/];
773
+ }
774
+ });
775
+ });
776
+ };
777
+ LocalizeLogindlgComponent.prototype.getHeaders = function () {
778
+ var _d;
779
+ var _a, _b;
780
+ return _d = {},
781
+ _d[LocalizeToken.httpHeaders.X_REFRESH_TOKEN] = (_a = this.tokenService.refreshToken) !== null && _a !== void 0 ? _a : "",
782
+ _d[LocalizeToken.httpHeaders.X_TENANT] = (_b = this.tokenService.tenantToken) !== null && _b !== void 0 ? _b : "",
783
+ _d;
784
+ };
785
+ Object.defineProperty(LocalizeLogindlgComponent.prototype, "isValidPassword", {
786
+ get: function () {
787
+ this.loading = false;
788
+ return this.properties.passwordValidator
789
+ ? this.properties.passwordValidator(this.password)
790
+ : this.password && this.password.trim().length >= 6 && this.password.trim().length <= 50;
791
+ },
792
+ enumerable: false,
793
+ configurable: true
794
+ });
795
+ LocalizeLogindlgComponent.prototype.showMessage = function (severity, summary) {
796
+ this.messageService.add({ key: this.messageKey, severity: severity, summary: summary });
797
+ this.loading = false;
798
+ };
799
+ Object.defineProperty(LocalizeLogindlgComponent.prototype, "sanitizedTitle", {
800
+ get: function () {
801
+ var _a;
802
+ return this.sanitizer.bypassSecurityTrustHtml((_a = this.properties.title) !== null && _a !== void 0 ? _a : '');
803
+ },
804
+ enumerable: false,
805
+ configurable: true
806
+ });
807
+ return LocalizeLogindlgComponent;
808
+ }());
809
+ LocalizeLogindlgComponent.decorators = [
810
+ { type: i0.Component, args: [{
811
+ template: "<p-toast key=\"$login-dlg\" position=\"top-center\"></p-toast>\n <div id=\"login-dlg-wrap\">\n <div id=\"login-dlg-header\">\n <div id=\"login-logo\" class=\"p-mb-2\" style=\"background: url('{{properties.logoImage}}') no-repeat\"></div>\n <h3 *ngIf=\"!success\" [innerHTML]=\"sanitizedTitle\"></h3>\n <h3 *ngIf=\"success\" style=\"color:green !important;\">{{properties.loginSuccessMessage}}</h3>\n </div>\n <div id=\"login-dlg-content\">\n <ng-container *ngIf=\"!success\">\n <div *ngIf=\"loading\" class=\"loader-wrap\">\n <div class=\"login-dlg-loader\"></div>\n </div>\n <div class=\"login-dlg-elm\">\n <div class=\"p-inputgroup\">\n <span class=\"p-inputgroup-addon\">\n <i class=\"material-icons-round\">person</i>\n </span>\n <input disabled pInputText type=\"text\" placeholder=\"{{properties.username?.placeHolder}}\" [value]=\"decodeToken?.email\" />\n </div>\n </div>\n \n <div class=\"login-dlg-elm\">\n <div class=\"p-inputgroup\">\n <span class=\"p-inputgroup-addon\">\n <i class=\"material-icons-round\">lock</i>\n </span>\n <input [disabled]=\"loading\" (keydown.enter)=\"clickLogin()\" pInputText type=\"password\" \n placeholder=\"{{properties.password?.placeHolder}}\" [(ngModel)]=\"password\"\n autofocus />\n </div>\n </div>\n <div class=\"login-dlg-elm\">\n <button style=\"width: 100%;\" pButton type=\"button\" label=\"{{properties.loginButton?.placeHolder}}\" (click)=\"clickLogin()\"\n [disabled]=\"!password || loading\"></button>\n </div>\n \n <div class=\"login-dlg-elm login-dlg-suggest\" style=\"display:flex;align-items: center;user-select: none;\">\n <span>{{properties.logoutButton?.message}}</span>\n <button class=\"p-button-text\" pButton type=\"button\" label=\"{{properties.logoutButton?.placeHolder}}\" \n (click)=\"clickLogout()\"></button>\n </div>\n </ng-container>\n \n <ng-container *ngIf=\"success\">\n <div style=\"margin-top:35px;\"></div>\n <div class=\"check-animation-wrap\">\n <div class=\"check-main-container\">\n <div class=\"check-container\">\n <div class=\"check-background\">\n <svg viewBox=\"0 0 65 51\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M7 25L27.3077 44L58.5 7\" stroke=\"white\" stroke-width=\"13\" stroke-linecap=\"round\"\n stroke-linejoin=\"round\"></path>\n </svg>\n </div>\n </div>\n </div>\n </div>\n </ng-container>\n </div>\n </div>",
812
+ selector: "app-localize-logindlg",
813
+ providers: [api.MessageService],
814
+ encapsulation: i0.ViewEncapsulation.None,
815
+ styles: ["\n #login-dlg-wrap {\n width: 100%;\n max-width: 400px;\n margin: 0 auto;\n padding: 30px;\n height: 100%;\n }\n \n .login-dlg-elm {\n margin-top: 1rem;\n }\n\n .login-dlg-elm.login-dlg-suggest {\n display: flex ;\n align-items: center;\n user-select: none;\n border-bottom: solid 1px #ddd;\n border-radius: 5px;\n padding: 5px 10px;\n background: #f9f9f9;\n box-shadow: 1px 5px 10px -12px #000;\n }\n \n #login-dlg-header {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n }\n \n #login-dlg-header h3 {\n font-weight: bold;\n font-size: 0.9rem;\n color: orange;\n text-align: center;\n }\n \n #login-logo {\n height: 55px;\n width: 55px;\n /* background: url(\"/assets/images/logo-300px.png\") no-repeat; */\n background-size: contain !important;\n }\n \n #login-dlg-content .p-inputgroup {\n height: 45px;\n }\n \n #login-dlg-content .p-inputgroup .p-inputgroup-addon {\n height: 45px;\n border-radius: 15px 0 0 15px;\n width: 50px;\n }\n #login-dlg-content *{\n font-size: .9rem;\n /* font-family: 'Lexend', 'Roboto', sans-serif, 'material-icons-round'; */\n }\n \n #login-dlg-content .p-inputgroup .p-inputgroup-addon * {\n font-size: 1rem;\n }\n \n #login-dlg-content .p-inputgroup input {\n height: 45px;\n border-radius: 0 15px 15px 0;\n }\n \n #login-dlg-content button {\n height: 45px;\n border-radius: 15px;\n }\n \n /*check animation block*/\n \n .check-animation-wrap {\n top: 0;\n left: 0;\n position: absolute;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: calc(100% - 200px);\n min-height: 400px;\n }\n \n .check-main-container {\n width: 100%;\n height: 100vh;\n display: flex;\n flex-flow: column;\n justify-content: center;\n align-items: center;\n }\n \n .check-container {\n width: 6.25rem;\n height: 7.5rem;\n display: flex;\n flex-flow: column;\n align-items: center;\n justify-content: space-between;\n }\n \n .check-container .check-background {\n width: 100%;\n height: calc(100% - 1.25rem);\n background: linear-gradient(to bottom right, #5de593, #41d67c);\n box-shadow: 0px 0px 0px 65px rgba(255, 255, 255, 0.25) inset, 0px 0px 0px 65px rgba(255, 255, 255, 0.25) inset;\n transform: scale(0.84);\n border-radius: 50%;\n animation: animateContainer 0.75s ease-out forwards 0.75s;\n display: flex;\n align-items: center;\n justify-content: center;\n opacity: 0;\n }\n \n .check-container .check-background svg {\n width: 65%;\n transform: translateY(0.25rem);\n stroke-dasharray: 80;\n stroke-dashoffset: 80;\n animation: animateCheck 0.35s forwards 1.25s ease-out;\n min-width: auto !important;\n }\n \n .check-container .check-shadow {\n bottom: calc(-15% - 5px);\n left: 0;\n border-radius: 50%;\n background: radial-gradient(closest-side, rgba(73, 218, 131, 1), transparent);\n animation: animateShadow 0.75s ease-out forwards 0.75s;\n }\n \n @keyframes animateContainer {\n 0% {\n opacity: 0;\n transform: scale(0);\n box-shadow: 0px 0px 0px 65px rgba(255, 255, 255, 0.25) inset, 0px 0px 0px 65px rgba(255, 255, 255, 0.25) inset;\n }\n \n 25% {\n opacity: 1;\n transform: scale(0.9);\n box-shadow: 0px 0px 0px 65px rgba(255, 255, 255, 0.25) inset, 0px 0px 0px 65px rgba(255, 255, 255, 0.25) inset;\n }\n \n 43.75% {\n transform: scale(1.15);\n box-shadow: 0px 0px 0px 43.334px rgba(255, 255, 255, 0.25) inset, 0px 0px 0px 65px rgba(255, 255, 255, 0.25) inset;\n }\n \n 62.5% {\n transform: scale(1);\n box-shadow: 0px 0px 0px 0px rgba(255, 255, 255, 0.25) inset, 0px 0px 0px 21.667px rgba(255, 255, 255, 0.25) inset;\n }\n \n 81.25% {\n box-shadow: 0px 0px 0px 0px rgba(255, 255, 255, 0.25) inset, 0px 0px 0px 0px rgba(255, 255, 255, 0.25) inset;\n }\n \n 100% {\n opacity: 1;\n box-shadow: 0px 0px 0px 0px rgba(255, 255, 255, 0.25) inset, 0px 0px 0px 0px rgba(255, 255, 255, 0.25) inset;\n }\n }\n \n @keyframes animateCheck {\n from {\n stroke-dashoffset: 80;\n }\n \n to {\n stroke-dashoffset: 0;\n }\n }\n \n @keyframes animateShadow {\n 0% {\n opacity: 0;\n width: 100%;\n height: 15%;\n }\n \n 25% {\n opacity: 0.25;\n }\n \n 43.75% {\n width: 40%;\n height: 7%;\n opacity: 0.35;\n }\n \n 100% {\n width: 85%;\n height: 15%;\n opacity: 0.25;\n }\n }\n #login-dlg-wrap .loader-wrap {\n display: flex;\n justify-content: center;\n align-items: center;\n height:100%;\n width:100%;\n position: absolute;\n top: 0;\n left: 0;\n z-index: 100;\n background: #ffffff42;\n backdrop-filter: blur(1px);\n }\n\n #login-dlg-wrap .login-dlg-loader {\n border: 15px solid #e7e7e7;\n border-top: 15px solid #52dba1;\n border-radius: 50%;\n width: 100px;\n height: 100px;\n animation: spinloader 2s linear infinite;\n }\n\n #login-dlg-wrap .loader-wrap::before {\n content: \"\";\n position: absolute;\n width: 70px;\n height: 70px;\n transform: translate(-50%, -50%);\n z-index: 1;\n border: 15px solid #e7e7e700;\n border-top: 15px solid #52dba1c9;\n border-radius: 50%;\n animation: spinloader .75s linear infinite;\n }\n\n @keyframes spinloader {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "]
816
+ },] }
817
+ ];
818
+ LocalizeLogindlgComponent.ctorParameters = function () { return [
819
+ { type: api.MessageService },
820
+ { type: i0.ChangeDetectorRef },
821
+ { type: dynamicdialog.DynamicDialogRef },
822
+ { type: dynamicdialog.DynamicDialogConfig },
823
+ { type: LocalizeTokenService },
824
+ { type: i1.HttpClient },
825
+ { type: platformBrowser.DomSanitizer }
826
+ ]; };
827
+
828
+ var LocalizeLogindlgService = /** @class */ (function () {
829
+ function LocalizeLogindlgService(injector) {
830
+ this.injector = injector;
831
+ }
832
+ LocalizeLogindlgService.prototype.openLoginDialog = function (loginConfig, config) {
833
+ return __awaiter(this, void 0, void 0, function () {
834
+ var dialogService, dialog;
835
+ return __generator(this, function (_b) {
836
+ switch (_b.label) {
837
+ case 0:
838
+ config = this.intercepDialogConfig(config);
839
+ this.initConfig(loginConfig);
840
+ config.data = Object.assign(Object.assign({}, (config.data || {})), { loginConfig: loginConfig });
841
+ dialogService = this.injector.get(dynamicdialog.DialogService);
842
+ dialog = dialogService.open(LocalizeLogindlgComponent, config);
843
+ return [4 /*yield*/, new Promise(function (resolve) { return dialog.onClose.subscribe(function (res) {
844
+ if (res) {
845
+ resolve();
846
+ }
847
+ }); })];
848
+ case 1:
849
+ _b.sent();
850
+ return [2 /*return*/];
851
+ }
852
+ });
853
+ });
854
+ };
855
+ LocalizeLogindlgService.prototype.intercepDialogConfig = function (config) {
856
+ config !== null && config !== void 0 ? config : (config = {
857
+ header: 'Login',
858
+ style: { 'max-width': '400px', width: '100%', 'height': '650px' },
859
+ modal: true,
860
+ closable: false,
861
+ showHeader: false,
862
+ });
863
+ config = Object.assign(Object.assign({}, config), {
864
+ contentStyle: { 'height': '100%', 'border-radius': '20px' }
865
+ });
866
+ config.style = Object.assign(Object.assign({}, config.style), { 'border-radius': '20px' });
867
+ return config;
868
+ };
869
+ LocalizeLogindlgService.prototype.initConfig = function (loginConfig) {
870
+ var _a;
871
+ loginConfig !== null && loginConfig !== void 0 ? loginConfig : (loginConfig = {});
872
+ (_a = loginConfig.properties) !== null && _a !== void 0 ? _a : (loginConfig.properties = {
873
+ title: 'Your session is expired!<br/> Please login again to continue.',
874
+ loginSuccessMessage: 'You have successfully logged in.',
875
+ logoImage: '/assets/images/logo-300px.png',
876
+ username: { placeHolder: 'Username' },
877
+ password: { placeHolder: 'Password' },
878
+ loginButton: { placeHolder: 'Login' },
879
+ logoutButton: {
880
+ message: 'No, I want to login with another user.',
881
+ placeHolder: 'Logout'
882
+ }
883
+ });
884
+ };
885
+ return LocalizeLogindlgService;
886
+ }());
887
+ LocalizeLogindlgService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function LocalizeLogindlgService_Factory() { return new LocalizeLogindlgService(i0__namespace.ɵɵinject(i0__namespace.INJECTOR)); }, token: LocalizeLogindlgService, providedIn: "root" });
888
+ LocalizeLogindlgService.decorators = [
889
+ { type: i0.Injectable, args: [{
890
+ providedIn: 'root'
891
+ },] }
892
+ ];
893
+ LocalizeLogindlgService.ctorParameters = function () { return [
894
+ { type: i0.Injector }
895
+ ]; };
896
+
897
+ var LocalizeLogindlgModule = /** @class */ (function () {
898
+ function LocalizeLogindlgModule() {
899
+ }
900
+ return LocalizeLogindlgModule;
901
+ }());
902
+ LocalizeLogindlgModule.decorators = [
903
+ { type: i0.NgModule, args: [{
904
+ declarations: [LocalizeLogindlgComponent],
905
+ exports: [LocalizeLogindlgComponent],
906
+ imports: [
907
+ common.CommonModule,
908
+ toast.ToastModule,
909
+ inputtext.InputTextModule,
910
+ platformBrowser.BrowserModule,
911
+ forms.FormsModule,
912
+ button.ButtonModule,
913
+ ],
914
+ providers: [LocalizeLogindlgService],
915
+ schemas: [i0.CUSTOM_ELEMENTS_SCHEMA],
916
+ },] }
917
+ ];
918
+
919
+ var LOCALIZE_API_ASSETS = {
920
+ network: {
921
+ noConnection: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <svg id=\"lze-no-connection\" data-name=\"Layer 2\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 77.29 70.98\">\n <defs>\n <style> .cls-1 { fill: #fff; } .cls-2, .cls-3 { fill: #e30613; } .cls-3 { stroke: #e30613; stroke-miterlimit: 10; stroke-width: .25px; } </style>\n </defs>\n <g id=\"Layer_3\" data-name=\"Layer 3\">\n <g>\n <path class=\"cls-1\" d=\"m73.29,35c-1.2,0-2.33-.53-3.09-1.46-.48-.57-11.23-13.2-31.55-13.2s-31.11,12.66-31.56,13.2c-1.4,1.71-3.92,1.95-5.63.55-1.71-1.4-1.95-3.92-.55-5.63.54-.66,13.47-16.12,37.74-16.12s37.2,15.46,37.74,16.12c1.4,1.71,1.15,4.23-.56,5.62-.71.58-1.61.9-2.53.9Z\"/>\n <path class=\"cls-1\" d=\"m63.96,45.66c-1.19,0-2.32-.53-3.08-1.44-5.79-6.05-13.86-9.39-22.24-9.21-8.38-.18-16.45,3.16-22.24,9.22-1.46,1.65-3.99,1.81-5.64.35-1.57-1.39-1.8-3.77-.52-5.43,7.32-7.89,17.64-12.29,28.4-12.12,10.76-.17,21.08,4.24,28.4,12.12,1.4,1.71,1.15,4.23-.56,5.62-.71.58-1.6.9-2.53.9Z\"/>\n <path class=\"cls-1\" d=\"m53.3,56.32c-1.24,0-2.41-.57-3.16-1.55-5.73-6.35-15.52-6.85-21.87-1.13-.4.36-.77.73-1.13,1.13-1.36,1.73-3.88,2.03-5.61.67-1.71-1.34-2.03-3.8-.73-5.54,8.39-9.85,23.18-11.04,33.03-2.65.95.81,1.84,1.69,2.65,2.65,1.34,1.75,1,4.26-.75,5.6-.7.53-1.55.82-2.43.82Z\"/>\n </g>\n <path class=\"cls-2\" d=\"m47.21,9.45l-4.06,41.36c-.64,5.42-8.39,5.39-9.01,0,0,0-4.06-41.36-4.06-41.36-.46-4.73,2.99-8.94,7.72-9.4,5.33-.58,9.97,4.09,9.4,9.4h0Z\"/>\n <circle class=\"cls-3\" cx=\"38.64\" cy=\"64.79\" r=\"6.07\"/>\n </g>\n </svg>"
922
+ }
923
+ };
924
+
684
925
  /**
685
926
  * Http method options
686
927
  */
@@ -964,7 +1205,7 @@
964
1205
  configurable: true
965
1206
  });
966
1207
  Object.defineProperty(LocalizeApiService.prototype, "tenantToken", {
967
- get: function () { return this.localizeTokenService.tenantToken(); },
1208
+ get: function () { return this.localizeTokenService.tenantToken; },
968
1209
  enumerable: false,
969
1210
  configurable: true
970
1211
  });
@@ -1253,246 +1494,54 @@
1253
1494
  },] }
1254
1495
  ];
1255
1496
 
1256
- var LocalizeLogindlgComponent = /** @class */ (function () {
1257
- function LocalizeLogindlgComponent(messageService, cdt, dlgRef, dlgConfig, tokenService, httpClient, sanitizer) {
1258
- var _this = this;
1259
- this.messageService = messageService;
1260
- this.cdt = cdt;
1261
- this.dlgRef = dlgRef;
1262
- this.dlgConfig = dlgConfig;
1263
- this.tokenService = tokenService;
1264
- this.httpClient = httpClient;
1265
- this.sanitizer = sanitizer;
1266
- this.messageKey = "$login-dlg";
1267
- this.loading = false;
1268
- this.success = false;
1269
- this.clickLogout = function () { var _a; return (_a = _this.logout) === null || _a === void 0 ? void 0 : _a.call(_this); };
1270
- this.decodeToken = this.tokenService.decodeRefreshToken;
1271
- this.loginConfig = this.dlgConfig.data.loginConfig;
1272
- this.properties = this.loginConfig.properties;
1273
- }
1274
- Object.defineProperty(LocalizeLogindlgComponent.prototype, "config", {
1275
- get: function () { return this.tokenService.config; },
1276
- enumerable: false,
1277
- configurable: true
1278
- });
1279
- LocalizeLogindlgComponent.prototype.ngOnInit = function () {
1280
- var _this = this;
1281
- this.dlgConfig.closable = false;
1282
- this.logout = this.loginConfig.logoutFunc;
1283
- this.loginUrl = this.loginConfig.loginUrl;
1284
- if (!this.decodeToken) {
1285
- this.showMessage("error", "Token is invalid");
1286
- setTimeout(function () { var _a; return (_a = _this.logout) === null || _a === void 0 ? void 0 : _a.call(_this); }, 2000);
1287
- }
1288
- };
1289
- LocalizeLogindlgComponent.prototype.ngAfterViewInit = function () {
1290
- this.cdt.detectChanges();
1291
- };
1292
- LocalizeLogindlgComponent.prototype.clickLogin = function () {
1293
- var _a, _b, _c;
1294
- return __awaiter(this, void 0, void 0, function () {
1295
- var loginRes, cookieOptions;
1296
- var _this = this;
1297
- return __generator(this, function (_d) {
1298
- switch (_d.label) {
1299
- case 0:
1300
- if (!this.isValidPassword) {
1301
- return [2 /*return*/, this.showMessage("error", "Password is required and must be at least 6 characters")];
1302
- }
1303
- this.loading = true;
1304
- return [4 /*yield*/, this.login()];
1305
- case 1:
1306
- loginRes = _d.sent();
1307
- if (!(loginRes === null || loginRes === void 0 ? void 0 : loginRes.status)) {
1308
- return [2 /*return*/, this.showMessage("error", (_a = loginRes.message) !== null && _a !== void 0 ? _a : "An error occurred")];
1309
- }
1310
- this.tokenService.accessToken = loginRes.tokens.accessToken;
1311
- cookieOptions = { expires: (_b = this.loginConfig.expire) !== null && _b !== void 0 ? _b : 365 };
1312
- LocalizeToken.storage.set(((_c = this.config.refreshToken) === null || _c === void 0 ? void 0 : _c.name) || '', loginRes.tokens.refreshToken, cookieOptions);
1313
- this.success = true;
1314
- setTimeout(function () {
1315
- _this.dlgConfig.dismissableMask = true;
1316
- _this.dlgConfig.modal = false;
1317
- _this.dlgRef.close(true);
1318
- }, 2000);
1319
- return [2 /*return*/];
1320
- }
1321
- });
1322
- });
1323
- };
1324
- LocalizeLogindlgComponent.prototype.login = function () {
1325
- var _a, _b, _c;
1326
- return __awaiter(this, void 0, void 0, function () {
1327
- var e_1;
1328
- var _this = this;
1329
- return __generator(this, function (_d) {
1330
- switch (_d.label) {
1331
- case 0:
1332
- if (!((_a = this.loginUrl) === null || _a === void 0 ? void 0 : _a.trim().length)) {
1333
- this.showMessage("error", "Login url is required");
1334
- throw new Error("Login url is required");
1335
- }
1336
- _d.label = 1;
1337
- case 1:
1338
- _d.trys.push([1, 5, , 6]);
1339
- if (!this.loginConfig.loginFunction) return [3 /*break*/, 3];
1340
- console.log("Using custom login function");
1341
- return [4 /*yield*/, this.loginConfig.loginFunction((_c = (_b = this.decodeToken) === null || _b === void 0 ? void 0 : _b.email) !== null && _c !== void 0 ? _c : '', this.password.trim(), this.getHeaders())];
1342
- case 2: return [2 /*return*/, _d.sent()];
1343
- case 3: return [4 /*yield*/, new Promise(function (resolve, reject) { return _this.httpClient.post(_this.loginUrl, { password: _this.password.trim() }, { headers: _this.getHeaders() }).subscribe({ next: resolve, error: reject }); })];
1344
- case 4: return [2 /*return*/, _d.sent()];
1345
- case 5:
1346
- e_1 = _d.sent();
1347
- this.showMessage("error", e_1.message);
1348
- return [2 /*return*/, null];
1349
- case 6: return [2 /*return*/];
1350
- }
1351
- });
1352
- });
1353
- };
1354
- LocalizeLogindlgComponent.prototype.getHeaders = function () {
1355
- var _d;
1356
- var _a, _b, _c;
1357
- return _d = {},
1358
- _d[LocalizeToken.httpHeaders.X_REFRESH_TOKEN] = (_b = LocalizeToken.storage.get(((_a = this.config.refreshToken) === null || _a === void 0 ? void 0 : _a.name) || '')) !== null && _b !== void 0 ? _b : "",
1359
- _d[LocalizeToken.httpHeaders.X_TENANT] = (_c = LocalizeToken.storage.get(this.loginConfig.tenantTokenName)) !== null && _c !== void 0 ? _c : "",
1360
- _d;
1361
- };
1362
- Object.defineProperty(LocalizeLogindlgComponent.prototype, "isValidPassword", {
1363
- get: function () {
1364
- this.loading = false;
1365
- return this.properties.passwordValidator
1366
- ? this.properties.passwordValidator(this.password)
1367
- : this.password && this.password.trim().length >= 6 && this.password.trim().length <= 50;
1368
- },
1369
- enumerable: false,
1370
- configurable: true
1371
- });
1372
- LocalizeLogindlgComponent.prototype.showMessage = function (severity, summary) {
1373
- this.messageService.add({ key: this.messageKey, severity: severity, summary: summary });
1374
- this.loading = false;
1375
- };
1376
- Object.defineProperty(LocalizeLogindlgComponent.prototype, "sanitizedTitle", {
1377
- get: function () {
1378
- var _a;
1379
- return this.sanitizer.bypassSecurityTrustHtml((_a = this.properties.title) !== null && _a !== void 0 ? _a : '');
1380
- },
1381
- enumerable: false,
1382
- configurable: true
1383
- });
1384
- return LocalizeLogindlgComponent;
1385
- }());
1386
- LocalizeLogindlgComponent.decorators = [
1387
- { type: i0.Component, args: [{
1388
- template: "<p-toast key=\"$login-dlg\" position=\"top-center\"></p-toast>\n <div id=\"login-dlg-wrap\">\n <div id=\"login-dlg-header\">\n <div id=\"login-logo\" class=\"p-mb-2\" style=\"background: url('{{properties.logoImage}}') no-repeat\"></div>\n <h3 *ngIf=\"!success\" [innerHTML]=\"sanitizedTitle\"></h3>\n <h3 *ngIf=\"success\" style=\"color:green !important;\">{{properties.loginSuccessMessage}}</h3>\n </div>\n <div id=\"login-dlg-content\">\n <ng-container *ngIf=\"!success\">\n <div *ngIf=\"loading\" class=\"loader-wrap\">\n <div class=\"login-dlg-loader\"></div>\n </div>\n <div class=\"login-dlg-elm\">\n <div class=\"p-inputgroup\">\n <span class=\"p-inputgroup-addon\">\n <i class=\"material-icons-round\">person</i>\n </span>\n <input disabled pInputText type=\"text\" placeholder=\"{{properties.username?.placeHolder}}\" [value]=\"decodeToken?.email\" />\n </div>\n </div>\n \n <div class=\"login-dlg-elm\">\n <div class=\"p-inputgroup\">\n <span class=\"p-inputgroup-addon\">\n <i class=\"material-icons-round\">lock</i>\n </span>\n <input [disabled]=\"loading\" (keydown.enter)=\"clickLogin()\" pInputText type=\"password\" \n placeholder=\"{{properties.password?.placeHolder}}\" [(ngModel)]=\"password\"\n autofocus />\n </div>\n </div>\n <div class=\"login-dlg-elm\">\n <button style=\"width: 100%;\" pButton type=\"button\" label=\"{{properties.loginButton?.placeHolder}}\" (click)=\"clickLogin()\"\n [disabled]=\"!password || loading\"></button>\n </div>\n \n <div class=\"login-dlg-elm login-dlg-suggest\" style=\"display:flex;align-items: center;user-select: none;\">\n <span>{{properties.logoutButton?.message}}</span>\n <button class=\"p-button-text\" pButton type=\"button\" label=\"{{properties.logoutButton?.placeHolder}}\" \n (click)=\"clickLogout()\"></button>\n </div>\n </ng-container>\n \n <ng-container *ngIf=\"success\">\n <div style=\"margin-top:35px;\"></div>\n <div class=\"check-animation-wrap\">\n <div class=\"check-main-container\">\n <div class=\"check-container\">\n <div class=\"check-background\">\n <svg viewBox=\"0 0 65 51\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M7 25L27.3077 44L58.5 7\" stroke=\"white\" stroke-width=\"13\" stroke-linecap=\"round\"\n stroke-linejoin=\"round\"></path>\n </svg>\n </div>\n </div>\n </div>\n </div>\n </ng-container>\n </div>\n </div>",
1389
- selector: "app-localize-logindlg",
1390
- providers: [api.MessageService],
1391
- encapsulation: i0.ViewEncapsulation.None,
1392
- styles: ["\n #login-dlg-wrap {\n width: 100%;\n max-width: 400px;\n margin: 0 auto;\n padding: 30px;\n height: 100%;\n }\n \n .login-dlg-elm {\n margin-top: 1rem;\n }\n\n .login-dlg-elm.login-dlg-suggest {\n display: flex ;\n align-items: center;\n user-select: none;\n border-bottom: solid 1px #ddd;\n border-radius: 5px;\n padding: 5px 10px;\n background: #f9f9f9;\n box-shadow: 1px 5px 10px -12px #000;\n }\n \n #login-dlg-header {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n }\n \n #login-dlg-header h3 {\n font-weight: bold;\n font-size: 0.9rem;\n color: orange;\n text-align: center;\n }\n \n #login-logo {\n height: 55px;\n width: 55px;\n /* background: url(\"/assets/images/logo-300px.png\") no-repeat; */\n background-size: contain !important;\n }\n \n #login-dlg-content .p-inputgroup {\n height: 45px;\n }\n \n #login-dlg-content .p-inputgroup .p-inputgroup-addon {\n height: 45px;\n border-radius: 15px 0 0 15px;\n width: 50px;\n }\n #login-dlg-content *{\n font-size: .9rem;\n /* font-family: 'Lexend', 'Roboto', sans-serif, 'material-icons-round'; */\n }\n \n #login-dlg-content .p-inputgroup .p-inputgroup-addon * {\n font-size: 1rem;\n }\n \n #login-dlg-content .p-inputgroup input {\n height: 45px;\n border-radius: 0 15px 15px 0;\n }\n \n #login-dlg-content button {\n height: 45px;\n border-radius: 15px;\n }\n \n /*check animation block*/\n \n .check-animation-wrap {\n top: 0;\n left: 0;\n position: absolute;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: calc(100% - 200px);\n min-height: 400px;\n }\n \n .check-main-container {\n width: 100%;\n height: 100vh;\n display: flex;\n flex-flow: column;\n justify-content: center;\n align-items: center;\n }\n \n .check-container {\n width: 6.25rem;\n height: 7.5rem;\n display: flex;\n flex-flow: column;\n align-items: center;\n justify-content: space-between;\n }\n \n .check-container .check-background {\n width: 100%;\n height: calc(100% - 1.25rem);\n background: linear-gradient(to bottom right, #5de593, #41d67c);\n box-shadow: 0px 0px 0px 65px rgba(255, 255, 255, 0.25) inset, 0px 0px 0px 65px rgba(255, 255, 255, 0.25) inset;\n transform: scale(0.84);\n border-radius: 50%;\n animation: animateContainer 0.75s ease-out forwards 0.75s;\n display: flex;\n align-items: center;\n justify-content: center;\n opacity: 0;\n }\n \n .check-container .check-background svg {\n width: 65%;\n transform: translateY(0.25rem);\n stroke-dasharray: 80;\n stroke-dashoffset: 80;\n animation: animateCheck 0.35s forwards 1.25s ease-out;\n min-width: auto !important;\n }\n \n .check-container .check-shadow {\n bottom: calc(-15% - 5px);\n left: 0;\n border-radius: 50%;\n background: radial-gradient(closest-side, rgba(73, 218, 131, 1), transparent);\n animation: animateShadow 0.75s ease-out forwards 0.75s;\n }\n \n @keyframes animateContainer {\n 0% {\n opacity: 0;\n transform: scale(0);\n box-shadow: 0px 0px 0px 65px rgba(255, 255, 255, 0.25) inset, 0px 0px 0px 65px rgba(255, 255, 255, 0.25) inset;\n }\n \n 25% {\n opacity: 1;\n transform: scale(0.9);\n box-shadow: 0px 0px 0px 65px rgba(255, 255, 255, 0.25) inset, 0px 0px 0px 65px rgba(255, 255, 255, 0.25) inset;\n }\n \n 43.75% {\n transform: scale(1.15);\n box-shadow: 0px 0px 0px 43.334px rgba(255, 255, 255, 0.25) inset, 0px 0px 0px 65px rgba(255, 255, 255, 0.25) inset;\n }\n \n 62.5% {\n transform: scale(1);\n box-shadow: 0px 0px 0px 0px rgba(255, 255, 255, 0.25) inset, 0px 0px 0px 21.667px rgba(255, 255, 255, 0.25) inset;\n }\n \n 81.25% {\n box-shadow: 0px 0px 0px 0px rgba(255, 255, 255, 0.25) inset, 0px 0px 0px 0px rgba(255, 255, 255, 0.25) inset;\n }\n \n 100% {\n opacity: 1;\n box-shadow: 0px 0px 0px 0px rgba(255, 255, 255, 0.25) inset, 0px 0px 0px 0px rgba(255, 255, 255, 0.25) inset;\n }\n }\n \n @keyframes animateCheck {\n from {\n stroke-dashoffset: 80;\n }\n \n to {\n stroke-dashoffset: 0;\n }\n }\n \n @keyframes animateShadow {\n 0% {\n opacity: 0;\n width: 100%;\n height: 15%;\n }\n \n 25% {\n opacity: 0.25;\n }\n \n 43.75% {\n width: 40%;\n height: 7%;\n opacity: 0.35;\n }\n \n 100% {\n width: 85%;\n height: 15%;\n opacity: 0.25;\n }\n }\n #login-dlg-wrap .loader-wrap {\n display: flex;\n justify-content: center;\n align-items: center;\n height:100%;\n width:100%;\n position: absolute;\n top: 0;\n left: 0;\n z-index: 100;\n background: #ffffff42;\n backdrop-filter: blur(1px);\n }\n\n #login-dlg-wrap .login-dlg-loader {\n border: 15px solid #e7e7e7;\n border-top: 15px solid #52dba1;\n border-radius: 50%;\n width: 100px;\n height: 100px;\n animation: spinloader 2s linear infinite;\n }\n\n #login-dlg-wrap .loader-wrap::before {\n content: \"\";\n position: absolute;\n width: 70px;\n height: 70px;\n transform: translate(-50%, -50%);\n z-index: 1;\n border: 15px solid #e7e7e700;\n border-top: 15px solid #52dba1c9;\n border-radius: 50%;\n animation: spinloader .75s linear infinite;\n }\n\n @keyframes spinloader {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "]
1393
- },] }
1394
- ];
1395
- LocalizeLogindlgComponent.ctorParameters = function () { return [
1396
- { type: api.MessageService },
1397
- { type: i0.ChangeDetectorRef },
1398
- { type: dynamicdialog.DynamicDialogRef },
1399
- { type: dynamicdialog.DynamicDialogConfig },
1400
- { type: LocalizeTokenService },
1401
- { type: i1.HttpClient },
1402
- { type: platformBrowser.DomSanitizer }
1403
- ]; };
1404
-
1405
- var LocalizeLogindlgService = /** @class */ (function () {
1406
- function LocalizeLogindlgService(injector) {
1407
- this.injector = injector;
1497
+ var LocalizeApiTokenService = /** @class */ (function () {
1498
+ function LocalizeApiTokenService(tokenService, apiService, loginDialogService) {
1499
+ this.api = apiService;
1500
+ this.token = tokenService;
1501
+ this.loginDialog = loginDialogService;
1408
1502
  }
1409
- LocalizeLogindlgService.prototype.openLoginDialog = function (loginConfig, config) {
1410
- return __awaiter(this, void 0, void 0, function () {
1411
- var dialogService, dialog;
1412
- return __generator(this, function (_b) {
1413
- switch (_b.label) {
1414
- case 0:
1415
- config = this.intercepDialogConfig(config);
1416
- this.initConfig(loginConfig);
1417
- config.data = Object.assign(Object.assign({}, (config.data || {})), { loginConfig: loginConfig });
1418
- dialogService = this.injector.get(dynamicdialog.DialogService);
1419
- dialog = dialogService.open(LocalizeLogindlgComponent, config);
1420
- return [4 /*yield*/, new Promise(function (resolve) { return dialog.onClose.subscribe(function (res) {
1421
- if (res) {
1422
- resolve();
1423
- }
1424
- }); })];
1425
- case 1:
1426
- _b.sent();
1427
- return [2 /*return*/];
1428
- }
1429
- });
1430
- });
1431
- };
1432
- LocalizeLogindlgService.prototype.intercepDialogConfig = function (config) {
1433
- config !== null && config !== void 0 ? config : (config = {
1434
- header: 'Login',
1435
- style: { 'max-width': '400px', width: '100%', 'height': '650px' },
1436
- modal: true,
1437
- closable: false,
1438
- showHeader: false,
1439
- });
1440
- config = Object.assign(Object.assign({}, config), {
1441
- contentStyle: { 'height': '100%', 'border-radius': '20px' }
1442
- });
1443
- config.style = Object.assign(Object.assign({}, config.style), { 'border-radius': '20px' });
1444
- return config;
1445
- };
1446
- LocalizeLogindlgService.prototype.initConfig = function (loginConfig) {
1447
- var _a;
1448
- loginConfig !== null && loginConfig !== void 0 ? loginConfig : (loginConfig = {});
1449
- (_a = loginConfig.properties) !== null && _a !== void 0 ? _a : (loginConfig.properties = {
1450
- title: 'Your session is expired!<br/> Please login again to continue.',
1451
- loginSuccessMessage: 'You have successfully logged in.',
1452
- logoImage: '/assets/images/logo-300px.png',
1453
- username: { placeHolder: 'Username' },
1454
- password: { placeHolder: 'Password' },
1455
- loginButton: { placeHolder: 'Login' },
1456
- logoutButton: {
1457
- message: 'No, I want to login with another user.',
1458
- placeHolder: 'Logout'
1459
- }
1460
- });
1503
+ LocalizeApiTokenService.prototype.initialize = function (tokenConfig, apiConfig) {
1504
+ // Initialize the LocalizeTokenService with the provided token configuration
1505
+ this.token.init(tokenConfig);
1506
+ // Initialize the LocalizeApiService with the provided API configuration
1507
+ this.api.init(apiConfig);
1508
+ console.log('LocalizeApiTokenService initialized with token and API configurations.');
1461
1509
  };
1462
- return LocalizeLogindlgService;
1510
+ return LocalizeApiTokenService;
1463
1511
  }());
1464
- LocalizeLogindlgService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function LocalizeLogindlgService_Factory() { return new LocalizeLogindlgService(i0__namespace.ɵɵinject(i0__namespace.INJECTOR)); }, token: LocalizeLogindlgService, providedIn: "root" });
1465
- LocalizeLogindlgService.decorators = [
1512
+ LocalizeApiTokenService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function LocalizeApiTokenService_Factory() { return new LocalizeApiTokenService(i0__namespace.ɵɵinject(LocalizeTokenService), i0__namespace.ɵɵinject(LocalizeApiService), i0__namespace.ɵɵinject(LocalizeLogindlgService)); }, token: LocalizeApiTokenService, providedIn: "root" });
1513
+ LocalizeApiTokenService.decorators = [
1466
1514
  { type: i0.Injectable, args: [{
1467
1515
  providedIn: 'root'
1468
1516
  },] }
1469
1517
  ];
1470
- LocalizeLogindlgService.ctorParameters = function () { return [
1471
- { type: i0.Injector }
1518
+ LocalizeApiTokenService.ctorParameters = function () { return [
1519
+ { type: LocalizeTokenService },
1520
+ { type: LocalizeApiService },
1521
+ { type: LocalizeLogindlgService }
1472
1522
  ]; };
1473
1523
 
1474
- var LocalizeLogindlgModule = /** @class */ (function () {
1475
- function LocalizeLogindlgModule() {
1524
+ var LocalizeApiTokenModule = /** @class */ (function () {
1525
+ function LocalizeApiTokenModule() {
1476
1526
  }
1477
- return LocalizeLogindlgModule;
1527
+ return LocalizeApiTokenModule;
1478
1528
  }());
1479
- LocalizeLogindlgModule.decorators = [
1529
+ LocalizeApiTokenModule.decorators = [
1480
1530
  { type: i0.NgModule, args: [{
1481
- declarations: [LocalizeLogindlgComponent],
1482
- exports: [LocalizeLogindlgComponent],
1531
+ declarations: [],
1483
1532
  imports: [
1484
1533
  common.CommonModule,
1485
- toast.ToastModule,
1486
- inputtext.InputTextModule,
1487
- platformBrowser.BrowserModule,
1488
- forms.FormsModule,
1489
- button.ButtonModule,
1534
+ LocalizeTokenModule,
1535
+ LocalizeLogindlgModule
1490
1536
  ],
1491
- providers: [LocalizeLogindlgService],
1492
- schemas: [i0.CUSTOM_ELEMENTS_SCHEMA],
1537
+ providers: [
1538
+ LocalizeApiTokenService
1539
+ ]
1493
1540
  },] }
1494
1541
  ];
1495
1542
 
1543
+ //#region login dialog
1544
+
1496
1545
  /**
1497
1546
  * Generated bundle index. Do not edit.
1498
1547
  */
@@ -1500,6 +1549,8 @@
1500
1549
  exports.ApiHelper = ApiHelper;
1501
1550
  exports.LOCALIZE_API_ASSETS = LOCALIZE_API_ASSETS;
1502
1551
  exports.LocalizeApiService = LocalizeApiService;
1552
+ exports.LocalizeApiTokenModule = LocalizeApiTokenModule;
1553
+ exports.LocalizeApiTokenService = LocalizeApiTokenService;
1503
1554
  exports.LocalizeLogindlgComponent = LocalizeLogindlgComponent;
1504
1555
  exports.LocalizeLogindlgModule = LocalizeLogindlgModule;
1505
1556
  exports.LocalizeLogindlgService = LocalizeLogindlgService;