tnx-shared 5.0.49 → 5.0.50
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/tnx-shared.umd.js +62 -0
- package/bundles/tnx-shared.umd.js.map +1 -1
- package/bundles/tnx-shared.umd.min.js +1 -1
- package/bundles/tnx-shared.umd.min.js.map +1 -1
- package/esm2015/public-api.js +2 -1
- package/esm2015/services/organization-base.service.js +57 -0
- package/fesm2015/tnx-shared.js +49 -1
- package/fesm2015/tnx-shared.js.map +1 -1
- package/package.json +2 -2
- package/public-api.d.ts +1 -0
- package/public-api.d.ts.map +1 -1
- package/services/organization-base.service.d.ts +16 -0
- package/services/organization-base.service.d.ts.map +1 -0
- package/services/organization-base.service.ngfactory.d.ts.map +1 -0
- package/tnx-shared.metadata.json +1 -1
|
@@ -47131,6 +47131,67 @@
|
|
|
47131
47131
|
{ type: ModuleConfigService }
|
|
47132
47132
|
]; };
|
|
47133
47133
|
|
|
47134
|
+
var OrganizationBaseService = /** @class */ (function (_super) {
|
|
47135
|
+
__extends(OrganizationBaseService, _super);
|
|
47136
|
+
function OrganizationBaseService(http, injector, _moduleConfigService) {
|
|
47137
|
+
var _this = _super.call(this, http, injector, _moduleConfigService.getConfig().environment.apiDomain.organizationEndpoint + "/organization") || this;
|
|
47138
|
+
_this.ORGANIZATION_INFO_KEY = 'organization_info';
|
|
47139
|
+
_this.RETRY_COUNT = 0;
|
|
47140
|
+
_this.REPLAY_COUNT = 10;
|
|
47141
|
+
_this.endPoint = _moduleConfigService.getConfig().environment.apiDomain.organizationEndpoint;
|
|
47142
|
+
_this._moduleConfig = _moduleConfigService.getConfig();
|
|
47143
|
+
_this.organizationEndpoint = _this._moduleConfig.environment.apiDomain.organizationEndpoint + "/organization/";
|
|
47144
|
+
return _this;
|
|
47145
|
+
}
|
|
47146
|
+
OrganizationBaseService.prototype.getOrganizationInfo = function (organizationId) {
|
|
47147
|
+
var _this = this;
|
|
47148
|
+
var storageItem = localStorage.getItem(this.ORGANIZATION_INFO_KEY + "_" + organizationId);
|
|
47149
|
+
var organization = JSON.parse(storageItem);
|
|
47150
|
+
if (organization) {
|
|
47151
|
+
return new Promise(function (resolve, reject) { return resolve(organization); });
|
|
47152
|
+
}
|
|
47153
|
+
else {
|
|
47154
|
+
return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
47155
|
+
var svUrl, result;
|
|
47156
|
+
var _this = this;
|
|
47157
|
+
return __generator(this, function (_a) {
|
|
47158
|
+
switch (_a.label) {
|
|
47159
|
+
case 0:
|
|
47160
|
+
if (!(organizationId == null)) return [3 /*break*/, 1];
|
|
47161
|
+
reject({});
|
|
47162
|
+
return [3 /*break*/, 3];
|
|
47163
|
+
case 1:
|
|
47164
|
+
if (!(organizationId > 0)) return [3 /*break*/, 3];
|
|
47165
|
+
svUrl = this.serviceUri + "/GetOrganizationInfo?id=" + organizationId;
|
|
47166
|
+
return [4 /*yield*/, this._http.get(svUrl).pipe(operators.shareReplay(this.REPLAY_COUNT), operators.retry(this.RETRY_COUNT), operators.map(function (repsonse) {
|
|
47167
|
+
// save response to local storage here
|
|
47168
|
+
localStorage.setItem(_this.ORGANIZATION_INFO_KEY + "_" + repsonse.data.id, JSON.stringify(repsonse.data));
|
|
47169
|
+
return repsonse.data;
|
|
47170
|
+
}, operators.catchError(function (err) { return _this.handleError(err, _this._injector); }))).toPromise()];
|
|
47171
|
+
case 2:
|
|
47172
|
+
result = _a.sent();
|
|
47173
|
+
resolve(result);
|
|
47174
|
+
_a.label = 3;
|
|
47175
|
+
case 3: return [2 /*return*/];
|
|
47176
|
+
}
|
|
47177
|
+
});
|
|
47178
|
+
}); });
|
|
47179
|
+
}
|
|
47180
|
+
};
|
|
47181
|
+
return OrganizationBaseService;
|
|
47182
|
+
}(BaseService));
|
|
47183
|
+
OrganizationBaseService.ɵprov = i0.ɵɵdefineInjectable({ factory: function OrganizationBaseService_Factory() { return new OrganizationBaseService(i0.ɵɵinject(i1$1.HttpClient), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(ModuleConfigService)); }, token: OrganizationBaseService, providedIn: "root" });
|
|
47184
|
+
OrganizationBaseService.decorators = [
|
|
47185
|
+
{ type: i0.Injectable, args: [{
|
|
47186
|
+
providedIn: 'root'
|
|
47187
|
+
},] }
|
|
47188
|
+
];
|
|
47189
|
+
OrganizationBaseService.ctorParameters = function () { return [
|
|
47190
|
+
{ type: i1$1.HttpClient },
|
|
47191
|
+
{ type: i0.Injector },
|
|
47192
|
+
{ type: ModuleConfigService }
|
|
47193
|
+
]; };
|
|
47194
|
+
|
|
47134
47195
|
var ErrorType = /** @class */ (function () {
|
|
47135
47196
|
function ErrorType() {
|
|
47136
47197
|
}
|
|
@@ -47669,6 +47730,7 @@
|
|
|
47669
47730
|
exports.NumberCompareValidator = NumberCompareValidator;
|
|
47670
47731
|
exports.NumberOnlyValidator = NumberOnlyValidator;
|
|
47671
47732
|
exports.NumberRangeControlSchema = NumberRangeControlSchema;
|
|
47733
|
+
exports.OrganizationBaseService = OrganizationBaseService;
|
|
47672
47734
|
exports.OrganizationFormatPipe = OrganizationFormatPipe;
|
|
47673
47735
|
exports.OrganizationNameFormatPipe = OrganizationNameFormatPipe;
|
|
47674
47736
|
exports.OrganizationPickerControlSchema = OrganizationPickerControlSchema;
|