@sambath999/localize-token 12.4.1 → 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.
- package/bundles/sambath999-localize-token.umd.js +283 -233
- package/bundles/sambath999-localize-token.umd.js.map +1 -1
- package/esm2015/localize-api-token/localize-api-token.module.js +21 -0
- package/esm2015/localize-api-token/localize-api-token.service.js +34 -0
- package/esm2015/localize-logindlg/localize-logindlg.component.js +1 -1
- package/esm2015/localize-logindlg/localize-logindlg.module.js +1 -1
- package/esm2015/localize-logindlg/localize-logindlg.service.js +1 -1
- package/esm2015/localize-token/helpers/interfaces.js +1 -1
- package/esm2015/localize-token/helpers/localize.api.assets.js +1 -1
- package/esm2015/localize-token/helpers/loccalize.api.helper.js +1 -1
- package/esm2015/localize-token/localize.api.service.js +2 -2
- package/esm2015/localize-token/localize.token.js +1 -1
- package/esm2015/localize-token/localize.token.module.js +1 -1
- package/esm2015/localize-token/localize.token.service.js +1 -1
- package/esm2015/localize-token/localize.token.storage.js +1 -1
- package/esm2015/public-api.js +17 -3
- package/esm2015/sambath999-localize-token.js +1 -1
- package/fesm2015/sambath999-localize-token.js +944 -900
- package/fesm2015/sambath999-localize-token.js.map +1 -1
- package/localize-api-token/localize-api-token.module.d.ts +2 -0
- package/localize-api-token/localize-api-token.service.d.ts +12 -0
- package/package.json +1 -1
- package/public-api.d.ts +13 -2
- package/sambath999-localize-token.metadata.json +1 -1
- package/esm2015/localize-logindlg/public-api.js +0 -4
- package/esm2015/localize-token/public-api.js +0 -9
- package/localize-logindlg/public-api.d.ts +0 -3
- 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/
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@sambath999/localize-token', ['exports', '@angular/
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.sambath999 = global.sambath999 || {}, global.sambath999["localize-token"] = {}), global.ng.
|
|
5
|
-
})(this, (function (exports,
|
|
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.
|
|
@@ -682,6 +676,252 @@
|
|
|
682
676
|
{ type: i0.Injectable, args: [{ providedIn: 'root' },] }
|
|
683
677
|
];
|
|
684
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
|
+
|
|
685
925
|
/**
|
|
686
926
|
* Http method options
|
|
687
927
|
*/
|
|
@@ -1254,246 +1494,54 @@
|
|
|
1254
1494
|
},] }
|
|
1255
1495
|
];
|
|
1256
1496
|
|
|
1257
|
-
var
|
|
1258
|
-
function
|
|
1259
|
-
|
|
1260
|
-
this.
|
|
1261
|
-
this.
|
|
1262
|
-
this.dlgRef = dlgRef;
|
|
1263
|
-
this.dlgConfig = dlgConfig;
|
|
1264
|
-
this.tokenService = tokenService;
|
|
1265
|
-
this.httpClient = httpClient;
|
|
1266
|
-
this.sanitizer = sanitizer;
|
|
1267
|
-
this.messageKey = "$login-dlg";
|
|
1268
|
-
this.loading = false;
|
|
1269
|
-
this.success = false;
|
|
1270
|
-
this.clickLogout = function () { var _a; return (_a = _this.logout) === null || _a === void 0 ? void 0 : _a.call(_this); };
|
|
1271
|
-
this.decodeToken = this.tokenService.decodeRefreshToken;
|
|
1272
|
-
this.loginConfig = this.dlgConfig.data.loginConfig;
|
|
1273
|
-
this.properties = this.loginConfig.properties;
|
|
1274
|
-
}
|
|
1275
|
-
Object.defineProperty(LocalizeLogindlgComponent.prototype, "config", {
|
|
1276
|
-
get: function () { return this.tokenService.config; },
|
|
1277
|
-
enumerable: false,
|
|
1278
|
-
configurable: true
|
|
1279
|
-
});
|
|
1280
|
-
LocalizeLogindlgComponent.prototype.ngOnInit = function () {
|
|
1281
|
-
var _this = this;
|
|
1282
|
-
this.dlgConfig.closable = false;
|
|
1283
|
-
this.logout = this.loginConfig.logoutFunc;
|
|
1284
|
-
this.loginUrl = this.loginConfig.loginUrl;
|
|
1285
|
-
if (!this.decodeToken) {
|
|
1286
|
-
this.showMessage("error", "Token is invalid");
|
|
1287
|
-
setTimeout(function () { var _a; return (_a = _this.logout) === null || _a === void 0 ? void 0 : _a.call(_this); }, 2000);
|
|
1288
|
-
}
|
|
1289
|
-
};
|
|
1290
|
-
LocalizeLogindlgComponent.prototype.ngAfterViewInit = function () {
|
|
1291
|
-
this.cdt.detectChanges();
|
|
1292
|
-
};
|
|
1293
|
-
LocalizeLogindlgComponent.prototype.clickLogin = function () {
|
|
1294
|
-
var _a, _b, _c;
|
|
1295
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1296
|
-
var loginRes, cookieOptions;
|
|
1297
|
-
var _this = this;
|
|
1298
|
-
return __generator(this, function (_d) {
|
|
1299
|
-
switch (_d.label) {
|
|
1300
|
-
case 0:
|
|
1301
|
-
if (!this.isValidPassword) {
|
|
1302
|
-
return [2 /*return*/, this.showMessage("error", "Password is required and must be at least 6 characters")];
|
|
1303
|
-
}
|
|
1304
|
-
this.loading = true;
|
|
1305
|
-
return [4 /*yield*/, this.login()];
|
|
1306
|
-
case 1:
|
|
1307
|
-
loginRes = _d.sent();
|
|
1308
|
-
if (!(loginRes === null || loginRes === void 0 ? void 0 : loginRes.status)) {
|
|
1309
|
-
return [2 /*return*/, this.showMessage("error", (_a = loginRes.message) !== null && _a !== void 0 ? _a : "An error occurred")];
|
|
1310
|
-
}
|
|
1311
|
-
this.tokenService.accessToken = loginRes.tokens.accessToken;
|
|
1312
|
-
cookieOptions = { expires: (_b = this.loginConfig.expire) !== null && _b !== void 0 ? _b : 365 };
|
|
1313
|
-
LocalizeToken.storage.set(((_c = this.config.refreshToken) === null || _c === void 0 ? void 0 : _c.name) || '', loginRes.tokens.refreshToken, cookieOptions);
|
|
1314
|
-
this.success = true;
|
|
1315
|
-
setTimeout(function () {
|
|
1316
|
-
_this.dlgConfig.dismissableMask = true;
|
|
1317
|
-
_this.dlgConfig.modal = false;
|
|
1318
|
-
_this.dlgRef.close(true);
|
|
1319
|
-
}, 2000);
|
|
1320
|
-
return [2 /*return*/];
|
|
1321
|
-
}
|
|
1322
|
-
});
|
|
1323
|
-
});
|
|
1324
|
-
};
|
|
1325
|
-
LocalizeLogindlgComponent.prototype.login = function () {
|
|
1326
|
-
var _a, _b, _c;
|
|
1327
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1328
|
-
var e_1;
|
|
1329
|
-
var _this = this;
|
|
1330
|
-
return __generator(this, function (_d) {
|
|
1331
|
-
switch (_d.label) {
|
|
1332
|
-
case 0:
|
|
1333
|
-
if (!((_a = this.loginUrl) === null || _a === void 0 ? void 0 : _a.trim().length)) {
|
|
1334
|
-
this.showMessage("error", "Login url is required");
|
|
1335
|
-
throw new Error("Login url is required");
|
|
1336
|
-
}
|
|
1337
|
-
_d.label = 1;
|
|
1338
|
-
case 1:
|
|
1339
|
-
_d.trys.push([1, 5, , 6]);
|
|
1340
|
-
if (!this.loginConfig.loginFunction) return [3 /*break*/, 3];
|
|
1341
|
-
console.log("Using custom login function");
|
|
1342
|
-
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())];
|
|
1343
|
-
case 2: return [2 /*return*/, _d.sent()];
|
|
1344
|
-
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 }); })];
|
|
1345
|
-
case 4: return [2 /*return*/, _d.sent()];
|
|
1346
|
-
case 5:
|
|
1347
|
-
e_1 = _d.sent();
|
|
1348
|
-
this.showMessage("error", e_1.message);
|
|
1349
|
-
return [2 /*return*/, null];
|
|
1350
|
-
case 6: return [2 /*return*/];
|
|
1351
|
-
}
|
|
1352
|
-
});
|
|
1353
|
-
});
|
|
1354
|
-
};
|
|
1355
|
-
LocalizeLogindlgComponent.prototype.getHeaders = function () {
|
|
1356
|
-
var _d;
|
|
1357
|
-
var _a, _b;
|
|
1358
|
-
return _d = {},
|
|
1359
|
-
_d[LocalizeToken.httpHeaders.X_REFRESH_TOKEN] = (_a = this.tokenService.refreshToken) !== null && _a !== void 0 ? _a : "",
|
|
1360
|
-
_d[LocalizeToken.httpHeaders.X_TENANT] = (_b = this.tokenService.tenantToken) !== null && _b !== void 0 ? _b : "",
|
|
1361
|
-
_d;
|
|
1362
|
-
};
|
|
1363
|
-
Object.defineProperty(LocalizeLogindlgComponent.prototype, "isValidPassword", {
|
|
1364
|
-
get: function () {
|
|
1365
|
-
this.loading = false;
|
|
1366
|
-
return this.properties.passwordValidator
|
|
1367
|
-
? this.properties.passwordValidator(this.password)
|
|
1368
|
-
: this.password && this.password.trim().length >= 6 && this.password.trim().length <= 50;
|
|
1369
|
-
},
|
|
1370
|
-
enumerable: false,
|
|
1371
|
-
configurable: true
|
|
1372
|
-
});
|
|
1373
|
-
LocalizeLogindlgComponent.prototype.showMessage = function (severity, summary) {
|
|
1374
|
-
this.messageService.add({ key: this.messageKey, severity: severity, summary: summary });
|
|
1375
|
-
this.loading = false;
|
|
1376
|
-
};
|
|
1377
|
-
Object.defineProperty(LocalizeLogindlgComponent.prototype, "sanitizedTitle", {
|
|
1378
|
-
get: function () {
|
|
1379
|
-
var _a;
|
|
1380
|
-
return this.sanitizer.bypassSecurityTrustHtml((_a = this.properties.title) !== null && _a !== void 0 ? _a : '');
|
|
1381
|
-
},
|
|
1382
|
-
enumerable: false,
|
|
1383
|
-
configurable: true
|
|
1384
|
-
});
|
|
1385
|
-
return LocalizeLogindlgComponent;
|
|
1386
|
-
}());
|
|
1387
|
-
LocalizeLogindlgComponent.decorators = [
|
|
1388
|
-
{ type: i0.Component, args: [{
|
|
1389
|
-
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>",
|
|
1390
|
-
selector: "app-localize-logindlg",
|
|
1391
|
-
providers: [api.MessageService],
|
|
1392
|
-
encapsulation: i0.ViewEncapsulation.None,
|
|
1393
|
-
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 "]
|
|
1394
|
-
},] }
|
|
1395
|
-
];
|
|
1396
|
-
LocalizeLogindlgComponent.ctorParameters = function () { return [
|
|
1397
|
-
{ type: api.MessageService },
|
|
1398
|
-
{ type: i0.ChangeDetectorRef },
|
|
1399
|
-
{ type: dynamicdialog.DynamicDialogRef },
|
|
1400
|
-
{ type: dynamicdialog.DynamicDialogConfig },
|
|
1401
|
-
{ type: LocalizeTokenService },
|
|
1402
|
-
{ type: i1.HttpClient },
|
|
1403
|
-
{ type: platformBrowser.DomSanitizer }
|
|
1404
|
-
]; };
|
|
1405
|
-
|
|
1406
|
-
var LocalizeLogindlgService = /** @class */ (function () {
|
|
1407
|
-
function LocalizeLogindlgService(injector) {
|
|
1408
|
-
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;
|
|
1409
1502
|
}
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
config = this.intercepDialogConfig(config);
|
|
1417
|
-
this.initConfig(loginConfig);
|
|
1418
|
-
config.data = Object.assign(Object.assign({}, (config.data || {})), { loginConfig: loginConfig });
|
|
1419
|
-
dialogService = this.injector.get(dynamicdialog.DialogService);
|
|
1420
|
-
dialog = dialogService.open(LocalizeLogindlgComponent, config);
|
|
1421
|
-
return [4 /*yield*/, new Promise(function (resolve) { return dialog.onClose.subscribe(function (res) {
|
|
1422
|
-
if (res) {
|
|
1423
|
-
resolve();
|
|
1424
|
-
}
|
|
1425
|
-
}); })];
|
|
1426
|
-
case 1:
|
|
1427
|
-
_b.sent();
|
|
1428
|
-
return [2 /*return*/];
|
|
1429
|
-
}
|
|
1430
|
-
});
|
|
1431
|
-
});
|
|
1432
|
-
};
|
|
1433
|
-
LocalizeLogindlgService.prototype.intercepDialogConfig = function (config) {
|
|
1434
|
-
config !== null && config !== void 0 ? config : (config = {
|
|
1435
|
-
header: 'Login',
|
|
1436
|
-
style: { 'max-width': '400px', width: '100%', 'height': '650px' },
|
|
1437
|
-
modal: true,
|
|
1438
|
-
closable: false,
|
|
1439
|
-
showHeader: false,
|
|
1440
|
-
});
|
|
1441
|
-
config = Object.assign(Object.assign({}, config), {
|
|
1442
|
-
contentStyle: { 'height': '100%', 'border-radius': '20px' }
|
|
1443
|
-
});
|
|
1444
|
-
config.style = Object.assign(Object.assign({}, config.style), { 'border-radius': '20px' });
|
|
1445
|
-
return config;
|
|
1446
|
-
};
|
|
1447
|
-
LocalizeLogindlgService.prototype.initConfig = function (loginConfig) {
|
|
1448
|
-
var _a;
|
|
1449
|
-
loginConfig !== null && loginConfig !== void 0 ? loginConfig : (loginConfig = {});
|
|
1450
|
-
(_a = loginConfig.properties) !== null && _a !== void 0 ? _a : (loginConfig.properties = {
|
|
1451
|
-
title: 'Your session is expired!<br/> Please login again to continue.',
|
|
1452
|
-
loginSuccessMessage: 'You have successfully logged in.',
|
|
1453
|
-
logoImage: '/assets/images/logo-300px.png',
|
|
1454
|
-
username: { placeHolder: 'Username' },
|
|
1455
|
-
password: { placeHolder: 'Password' },
|
|
1456
|
-
loginButton: { placeHolder: 'Login' },
|
|
1457
|
-
logoutButton: {
|
|
1458
|
-
message: 'No, I want to login with another user.',
|
|
1459
|
-
placeHolder: 'Logout'
|
|
1460
|
-
}
|
|
1461
|
-
});
|
|
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.');
|
|
1462
1509
|
};
|
|
1463
|
-
return
|
|
1510
|
+
return LocalizeApiTokenService;
|
|
1464
1511
|
}());
|
|
1465
|
-
|
|
1466
|
-
|
|
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 = [
|
|
1467
1514
|
{ type: i0.Injectable, args: [{
|
|
1468
1515
|
providedIn: 'root'
|
|
1469
1516
|
},] }
|
|
1470
1517
|
];
|
|
1471
|
-
|
|
1472
|
-
{ type:
|
|
1518
|
+
LocalizeApiTokenService.ctorParameters = function () { return [
|
|
1519
|
+
{ type: LocalizeTokenService },
|
|
1520
|
+
{ type: LocalizeApiService },
|
|
1521
|
+
{ type: LocalizeLogindlgService }
|
|
1473
1522
|
]; };
|
|
1474
1523
|
|
|
1475
|
-
var
|
|
1476
|
-
function
|
|
1524
|
+
var LocalizeApiTokenModule = /** @class */ (function () {
|
|
1525
|
+
function LocalizeApiTokenModule() {
|
|
1477
1526
|
}
|
|
1478
|
-
return
|
|
1527
|
+
return LocalizeApiTokenModule;
|
|
1479
1528
|
}());
|
|
1480
|
-
|
|
1529
|
+
LocalizeApiTokenModule.decorators = [
|
|
1481
1530
|
{ type: i0.NgModule, args: [{
|
|
1482
|
-
declarations: [
|
|
1483
|
-
exports: [LocalizeLogindlgComponent],
|
|
1531
|
+
declarations: [],
|
|
1484
1532
|
imports: [
|
|
1485
1533
|
common.CommonModule,
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
platformBrowser.BrowserModule,
|
|
1489
|
-
forms.FormsModule,
|
|
1490
|
-
button.ButtonModule,
|
|
1534
|
+
LocalizeTokenModule,
|
|
1535
|
+
LocalizeLogindlgModule
|
|
1491
1536
|
],
|
|
1492
|
-
providers: [
|
|
1493
|
-
|
|
1537
|
+
providers: [
|
|
1538
|
+
LocalizeApiTokenService
|
|
1539
|
+
]
|
|
1494
1540
|
},] }
|
|
1495
1541
|
];
|
|
1496
1542
|
|
|
1543
|
+
//#region login dialog
|
|
1544
|
+
|
|
1497
1545
|
/**
|
|
1498
1546
|
* Generated bundle index. Do not edit.
|
|
1499
1547
|
*/
|
|
@@ -1501,6 +1549,8 @@
|
|
|
1501
1549
|
exports.ApiHelper = ApiHelper;
|
|
1502
1550
|
exports.LOCALIZE_API_ASSETS = LOCALIZE_API_ASSETS;
|
|
1503
1551
|
exports.LocalizeApiService = LocalizeApiService;
|
|
1552
|
+
exports.LocalizeApiTokenModule = LocalizeApiTokenModule;
|
|
1553
|
+
exports.LocalizeApiTokenService = LocalizeApiTokenService;
|
|
1504
1554
|
exports.LocalizeLogindlgComponent = LocalizeLogindlgComponent;
|
|
1505
1555
|
exports.LocalizeLogindlgModule = LocalizeLogindlgModule;
|
|
1506
1556
|
exports.LocalizeLogindlgService = LocalizeLogindlgService;
|