@sambath999/localize-token 12.2.6 → 12.2.8
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 +20 -56
- package/bundles/sambath999-localize-token.umd.js.map +1 -1
- package/esm2015/localize-logindlg/localize-logindlg.component.js +5 -7
- package/esm2015/localize-logindlg/localize-logindlg.service.js +1 -1
- package/esm2015/localize-token/localize.api.service.js +7 -14
- package/esm2015/localize-token/localize.token.js +1 -8
- package/esm2015/localize-token/localize.token.module.js +2 -4
- package/esm2015/localize-token/localize.token.service.js +11 -19
- package/fesm2015/sambath999-localize-token.js +20 -42
- package/fesm2015/sambath999-localize-token.js.map +1 -1
- package/localize-logindlg/localize-logindlg.component.d.ts +2 -4
- package/localize-logindlg/localize-logindlg.service.d.ts +1 -0
- package/localize-token/localize.api.service.d.ts +2 -5
- package/localize-token/localize.token.d.ts +1 -5
- package/localize-token/localize.token.service.d.ts +3 -6
- package/package.json +1 -1
- package/sambath999-localize-token.metadata.json +1 -1
|
@@ -481,17 +481,9 @@
|
|
|
481
481
|
|
|
482
482
|
var LocalizeToken = /** @class */ (function () {
|
|
483
483
|
function LocalizeToken() {
|
|
484
|
-
this.configSubject = new rxjs.BehaviorSubject(LocalizeToken.config);
|
|
485
484
|
}
|
|
486
|
-
Object.defineProperty(LocalizeToken.prototype, "getConfig", {
|
|
487
|
-
get: function () { return this.configSubject.value; },
|
|
488
|
-
enumerable: false,
|
|
489
|
-
configurable: true
|
|
490
|
-
});
|
|
491
485
|
LocalizeToken.init = function (config) {
|
|
492
|
-
var lConfig = new LocalizeToken();
|
|
493
486
|
LocalizeToken.config = Object.assign(Object.assign({}, LocalizeToken.config), config);
|
|
494
|
-
lConfig.configSubject.next(LocalizeToken.config);
|
|
495
487
|
};
|
|
496
488
|
return LocalizeToken;
|
|
497
489
|
}());
|
|
@@ -583,21 +575,14 @@
|
|
|
583
575
|
}
|
|
584
576
|
|
|
585
577
|
var LocalizeTokenService = /** @class */ (function () {
|
|
586
|
-
function LocalizeTokenService(
|
|
587
|
-
this.tokenConfig = tokenConfig;
|
|
578
|
+
function LocalizeTokenService() {
|
|
588
579
|
this.isRevokingTokenSubject = new rxjs.BehaviorSubject(false);
|
|
589
580
|
this.decodeToken = function (token) { return jwt_decode__namespace.jwtDecode(token); };
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
581
|
+
if (!LocalizeToken.config.authTokenName || !LocalizeToken.config.refreshTokenName) {
|
|
582
|
+
throw new Error('authTokenName and refreshTokenName must be defined in LocalizeToken.config');
|
|
583
|
+
}
|
|
584
|
+
this.config = LocalizeToken.config;
|
|
594
585
|
}
|
|
595
|
-
Object.defineProperty(LocalizeTokenService.prototype, "config", {
|
|
596
|
-
// private readonly config: ILocalizeTokenConfig
|
|
597
|
-
get: function () { return this.tokenConfig.getConfig; },
|
|
598
|
-
enumerable: false,
|
|
599
|
-
configurable: true
|
|
600
|
-
});
|
|
601
586
|
Object.defineProperty(LocalizeTokenService.prototype, "authToken", {
|
|
602
587
|
get: function () { return this.storageGet(); },
|
|
603
588
|
set: function (value) {
|
|
@@ -634,7 +619,9 @@
|
|
|
634
619
|
enumerable: false,
|
|
635
620
|
configurable: true
|
|
636
621
|
});
|
|
637
|
-
LocalizeTokenService.prototype.tenantToken = function () {
|
|
622
|
+
LocalizeTokenService.prototype.tenantToken = function (name) {
|
|
623
|
+
return LocalizeToken.storage.get(name);
|
|
624
|
+
};
|
|
638
625
|
LocalizeTokenService.prototype.storageGet = function () {
|
|
639
626
|
try {
|
|
640
627
|
var encoded = LocalizeToken.storage.get(this.config.authTokenName);
|
|
@@ -649,10 +636,6 @@
|
|
|
649
636
|
var base64 = btoa(JSON.stringify(value));
|
|
650
637
|
LocalizeToken.storage.set(this.config.authTokenName, base64);
|
|
651
638
|
};
|
|
652
|
-
LocalizeTokenService.prototype.tokensValid = function () {
|
|
653
|
-
var _a, _b;
|
|
654
|
-
return ((_a = this.refreshToken) === null || _a === void 0 ? void 0 : _a.length) && (!this.config.needTenant || ((_b = this.tenantToken()) === null || _b === void 0 ? void 0 : _b.length));
|
|
655
|
-
};
|
|
656
639
|
Object.defineProperty(LocalizeTokenService.prototype, "decodeRefreshToken", {
|
|
657
640
|
get: function () {
|
|
658
641
|
var token = LocalizeToken.storage.get(this.config.refreshTokenName);
|
|
@@ -665,13 +648,11 @@
|
|
|
665
648
|
});
|
|
666
649
|
return LocalizeTokenService;
|
|
667
650
|
}());
|
|
668
|
-
LocalizeTokenService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function LocalizeTokenService_Factory() { return new LocalizeTokenService(
|
|
651
|
+
LocalizeTokenService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function LocalizeTokenService_Factory() { return new LocalizeTokenService(); }, token: LocalizeTokenService, providedIn: "root" });
|
|
669
652
|
LocalizeTokenService.decorators = [
|
|
670
653
|
{ type: i0.Injectable, args: [{ providedIn: 'root' },] }
|
|
671
654
|
];
|
|
672
|
-
LocalizeTokenService.ctorParameters = function () { return [
|
|
673
|
-
{ type: LocalizeToken }
|
|
674
|
-
]; };
|
|
655
|
+
LocalizeTokenService.ctorParameters = function () { return []; };
|
|
675
656
|
|
|
676
657
|
/**
|
|
677
658
|
* Http method options
|
|
@@ -685,10 +666,9 @@
|
|
|
685
666
|
EMethod[EMethod["PATCH"] = 5] = "PATCH";
|
|
686
667
|
})(exports.EMethod || (exports.EMethod = {}));
|
|
687
668
|
var LocalizeApiService = /** @class */ (function () {
|
|
688
|
-
function LocalizeApiService(httpClient,
|
|
669
|
+
function LocalizeApiService(httpClient, localizeTokenService) {
|
|
689
670
|
var _this = this;
|
|
690
671
|
this.httpClient = httpClient;
|
|
691
|
-
this.tokenConfig = tokenConfig;
|
|
692
672
|
this.localizeTokenService = localizeTokenService;
|
|
693
673
|
this.isRequestingSubject = new rxjs.BehaviorSubject(false);
|
|
694
674
|
this.isResolvedStartupSubject = new rxjs.BehaviorSubject(false);
|
|
@@ -716,20 +696,12 @@
|
|
|
716
696
|
enumerable: false,
|
|
717
697
|
configurable: true
|
|
718
698
|
});
|
|
719
|
-
Object.defineProperty(LocalizeApiService.prototype, "config", {
|
|
720
|
-
get: function () { return this.tokenConfig.getConfig; },
|
|
721
|
-
enumerable: false,
|
|
722
|
-
configurable: true
|
|
723
|
-
});
|
|
724
699
|
/**
|
|
725
700
|
* Initialize the API service.
|
|
726
701
|
* @param apiConfigs - The API configurations.
|
|
727
702
|
*/
|
|
728
703
|
LocalizeApiService.prototype.init = function (apiConfigs) {
|
|
729
704
|
this.apiConfigs = apiConfigs;
|
|
730
|
-
if (apiConfigs.tenantTokenName) {
|
|
731
|
-
this.tokenConfig.configSubject.next(Object.assign(Object.assign({}, this.config), { tenantTokenName: apiConfigs.tenantTokenName }));
|
|
732
|
-
}
|
|
733
705
|
};
|
|
734
706
|
LocalizeApiService.prototype.base = function (baseUrl, path, method, value, isFormData, headers) {
|
|
735
707
|
if (method === void 0) { method = exports.EMethod.GET; }
|
|
@@ -839,7 +811,7 @@
|
|
|
839
811
|
case 2:
|
|
840
812
|
_b.trys.push([2, , 10, 11]);
|
|
841
813
|
this.localizeTokenService.isRevokingToken = true;
|
|
842
|
-
reqUrl_1 =
|
|
814
|
+
reqUrl_1 = LocalizeToken.config.revokeTokenUrl;
|
|
843
815
|
reqHeaders_1 = this.options().append(LocalizeToken.httpHeaders.X_REFRESH_TOKEN, "" + this.localizeTokenService.refreshToken);
|
|
844
816
|
return [4 /*yield*/, new Promise(function (resolve, reject) { return _this.httpClient.get(reqUrl_1, { headers: reqHeaders_1 }).subscribe({ next: resolve, error: reject }); })];
|
|
845
817
|
case 3:
|
|
@@ -877,8 +849,8 @@
|
|
|
877
849
|
if (isFormData === void 0) { isFormData = false; }
|
|
878
850
|
if (headers === void 0) { headers = {}; }
|
|
879
851
|
var defaultHeaders = (_b = {}, _b[LocalizeToken.httpHeaders.AUTHORIZATION] = "Bearer " + this.localizeTokenService.accessToken, _b);
|
|
880
|
-
if (
|
|
881
|
-
defaultHeaders[LocalizeToken.httpHeaders.X_TENANT] = "" + this.localizeTokenService.tenantToken();
|
|
852
|
+
if (LocalizeToken.config.needTenant) {
|
|
853
|
+
defaultHeaders[LocalizeToken.httpHeaders.X_TENANT] = "" + this.localizeTokenService.tenantToken(this.apiConfigs.tenantTokenName);
|
|
882
854
|
}
|
|
883
855
|
if (!isFormData) {
|
|
884
856
|
defaultHeaders[LocalizeToken.httpHeaders.CONTENT_TYPE] = 'application/json';
|
|
@@ -914,7 +886,7 @@
|
|
|
914
886
|
};
|
|
915
887
|
return LocalizeApiService;
|
|
916
888
|
}()); //class
|
|
917
|
-
LocalizeApiService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function LocalizeApiService_Factory() { return new LocalizeApiService(i0__namespace.ɵɵinject(i1__namespace.HttpClient), i0__namespace.ɵɵinject(
|
|
889
|
+
LocalizeApiService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function LocalizeApiService_Factory() { return new LocalizeApiService(i0__namespace.ɵɵinject(i1__namespace.HttpClient), i0__namespace.ɵɵinject(LocalizeTokenService)); }, token: LocalizeApiService, providedIn: "root" });
|
|
918
890
|
LocalizeApiService.decorators = [
|
|
919
891
|
{ type: i0.Injectable, args: [{
|
|
920
892
|
providedIn: 'root'
|
|
@@ -922,7 +894,6 @@
|
|
|
922
894
|
];
|
|
923
895
|
LocalizeApiService.ctorParameters = function () { return [
|
|
924
896
|
{ type: i1.HttpClient },
|
|
925
|
-
{ type: LocalizeToken },
|
|
926
897
|
{ type: LocalizeTokenService }
|
|
927
898
|
]; };
|
|
928
899
|
|
|
@@ -935,14 +906,13 @@
|
|
|
935
906
|
{ type: i0.NgModule, args: [{
|
|
936
907
|
providers: [
|
|
937
908
|
LocalizeTokenService,
|
|
938
|
-
LocalizeApiService
|
|
939
|
-
LocalizeToken
|
|
909
|
+
LocalizeApiService
|
|
940
910
|
],
|
|
941
911
|
},] }
|
|
942
912
|
];
|
|
943
913
|
|
|
944
914
|
var LocalizeLogindlgComponent = /** @class */ (function () {
|
|
945
|
-
function LocalizeLogindlgComponent(messageService, cdt, dlgRef, dlgConfig, tokenService, httpClient
|
|
915
|
+
function LocalizeLogindlgComponent(messageService, cdt, dlgRef, dlgConfig, tokenService, httpClient) {
|
|
946
916
|
var _this = this;
|
|
947
917
|
this.messageService = messageService;
|
|
948
918
|
this.cdt = cdt;
|
|
@@ -950,19 +920,14 @@
|
|
|
950
920
|
this.dlgConfig = dlgConfig;
|
|
951
921
|
this.tokenService = tokenService;
|
|
952
922
|
this.httpClient = httpClient;
|
|
953
|
-
this.tokenConfig = tokenConfig;
|
|
954
923
|
this.messageKey = "$login-dlg";
|
|
955
924
|
this.loading = false;
|
|
956
925
|
this.success = false;
|
|
926
|
+
this.config = LocalizeToken.config;
|
|
957
927
|
this.clickLogout = function () { var _a; return (_a = _this.logout) === null || _a === void 0 ? void 0 : _a.call(_this); };
|
|
958
928
|
this.decodeToken = this.tokenService.decodeRefreshToken;
|
|
959
929
|
this.loginConfig = this.dlgConfig.data.loginConfig;
|
|
960
930
|
}
|
|
961
|
-
Object.defineProperty(LocalizeLogindlgComponent.prototype, "config", {
|
|
962
|
-
get: function () { return this.tokenConfig.getConfig; },
|
|
963
|
-
enumerable: false,
|
|
964
|
-
configurable: true
|
|
965
|
-
});
|
|
966
931
|
LocalizeLogindlgComponent.prototype.ngOnInit = function () {
|
|
967
932
|
var _this = this;
|
|
968
933
|
this.dlgConfig.closable = false;
|
|
@@ -1037,7 +1002,7 @@
|
|
|
1037
1002
|
var _a, _b;
|
|
1038
1003
|
return _c = {},
|
|
1039
1004
|
_c[LocalizeToken.httpHeaders.X_REFRESH_TOKEN] = (_a = LocalizeToken.storage.get(this.config.refreshTokenName)) !== null && _a !== void 0 ? _a : "",
|
|
1040
|
-
_c[LocalizeToken.httpHeaders.X_TENANT] = (_b = LocalizeToken.storage.get(this.
|
|
1005
|
+
_c[LocalizeToken.httpHeaders.X_TENANT] = (_b = LocalizeToken.storage.get(this.loginConfig.tenantTokenName)) !== null && _b !== void 0 ? _b : "",
|
|
1041
1006
|
_c;
|
|
1042
1007
|
};
|
|
1043
1008
|
Object.defineProperty(LocalizeLogindlgComponent.prototype, "isValidPassword", {
|
|
@@ -1069,8 +1034,7 @@
|
|
|
1069
1034
|
{ type: dynamicdialog.DynamicDialogRef },
|
|
1070
1035
|
{ type: dynamicdialog.DynamicDialogConfig },
|
|
1071
1036
|
{ type: LocalizeTokenService },
|
|
1072
|
-
{ type: i1.HttpClient }
|
|
1073
|
-
{ type: LocalizeToken }
|
|
1037
|
+
{ type: i1.HttpClient }
|
|
1074
1038
|
]; };
|
|
1075
1039
|
|
|
1076
1040
|
var LocalizeLogindlgService = /** @class */ (function () {
|