intelica-library-ui 0.1.217 → 0.1.219
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.
|
@@ -89,7 +89,7 @@ class TermService {
|
|
|
89
89
|
_http = inject(HttpClient);
|
|
90
90
|
_config = inject(ConfigService);
|
|
91
91
|
GetTerms(languageCode, pageRoot) {
|
|
92
|
-
return this._http.get(`${this._config.environment?.
|
|
92
|
+
return this._http.get(`${this._config.environment?.securityPath}/Term/ignore/page/${pageRoot}/language/${languageCode}`);
|
|
93
93
|
}
|
|
94
94
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: TermService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
95
95
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: TermService, providedIn: "root" });
|
|
@@ -170,32 +170,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImpor
|
|
|
170
170
|
|
|
171
171
|
class FormatAmountPipe {
|
|
172
172
|
transform(value, shortFormat = false, decimalPlaces = 2) {
|
|
173
|
-
if (value === null || value === undefined)
|
|
173
|
+
if (value === null || value === undefined)
|
|
174
174
|
return "0";
|
|
175
|
-
}
|
|
176
175
|
const numericValue = typeof value === "string" ? parseFloat(value) : value;
|
|
177
|
-
if (isNaN(numericValue))
|
|
176
|
+
if (isNaN(numericValue))
|
|
178
177
|
return "0";
|
|
179
|
-
|
|
180
|
-
let formattedValue;
|
|
181
|
-
if (shortFormat) {
|
|
182
|
-
formattedValue = this.getShortFormat(numericValue, decimalPlaces);
|
|
183
|
-
}
|
|
184
|
-
else {
|
|
185
|
-
formattedValue = this.formatWithThousandSeparators(numericValue, decimalPlaces);
|
|
186
|
-
}
|
|
187
|
-
return formattedValue;
|
|
178
|
+
return shortFormat ? this.getShortFormat(numericValue, decimalPlaces) : this.formatWithThousandSeparators(numericValue, decimalPlaces);
|
|
188
179
|
}
|
|
189
180
|
getShortFormat(value, decimalPlaces) {
|
|
190
181
|
const suffixes = ["", "K", "M", "B", "T"];
|
|
191
182
|
const factor = Math.pow(10, decimalPlaces);
|
|
192
183
|
const rounded = Math.round(value * factor) / factor;
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
return rounded.toFixed(decimalPlaces);
|
|
196
|
-
}
|
|
184
|
+
let tier = Math.floor(Math.log10(Math.abs(rounded || 1)) / 3);
|
|
185
|
+
tier = Math.max(0, Math.min(tier, suffixes.length - 1));
|
|
197
186
|
const scaled = rounded / Math.pow(10, tier * 3);
|
|
198
|
-
return
|
|
187
|
+
return this.formatWithThousandSeparators(scaled, decimalPlaces) + suffixes[tier];
|
|
199
188
|
}
|
|
200
189
|
formatWithThousandSeparators(value, decimalPlaces) {
|
|
201
190
|
return new Intl.NumberFormat("en-US", {
|
|
@@ -419,29 +408,32 @@ const ErrorInterceptor = (req, next) => {
|
|
|
419
408
|
HeaderSettings["PageRoot"] = commonFeatureFlagService.GetPageRoot();
|
|
420
409
|
HeaderSettings["LanguageCode"] = getCookie("language") ?? "";
|
|
421
410
|
HeaderSettings["Environment"] = configService.environment?.environment ?? "";
|
|
422
|
-
HeaderSettings["Access"] = authenticationClientID == "" ? "" : getCookie(authenticationClientID) ?? "";
|
|
411
|
+
HeaderSettings["Access"] = authenticationClientID == "" ? "" : (getCookie(authenticationClientID) ?? "");
|
|
423
412
|
}
|
|
424
413
|
let _request = req.clone({ headers: new HttpHeaders(HeaderSettings) });
|
|
425
414
|
return next(_request).pipe(catchError(handleErrorResponse));
|
|
426
415
|
function handleErrorResponse(error) {
|
|
427
|
-
console.log(error, "error");
|
|
416
|
+
console.log(error, "error", error.status);
|
|
428
417
|
spinnerService.hide();
|
|
429
|
-
|
|
430
|
-
sweetAlertService.messageBox(error.error.message);
|
|
431
|
-
if (error.status == 400)
|
|
432
|
-
sweetAlertService.messageBox(error.error.message);
|
|
433
|
-
if (error.status == 409)
|
|
434
|
-
sweetAlertService.messageBox(error.error.message);
|
|
435
|
-
if (error.status == 401)
|
|
436
|
-
sweetAlertService.messageBox(error.error.message);
|
|
418
|
+
const authenticationLocation = `${configService.environment?.authenticationWeb}?callback=${window.location.href}&clientID=${configService.environment?.clientID}`;
|
|
437
419
|
if (error.status == 503 || error.status == 0)
|
|
438
420
|
sweetAlertService.messageBox("El servicio que se necesita consumir no esta activo o no responde.");
|
|
439
|
-
if (error.status == 405)
|
|
421
|
+
else if (error.status == 405)
|
|
440
422
|
sweetAlertService.messageBox("Los parametros enviados al servicio no coinciden.");
|
|
441
|
-
if (error.status == 404)
|
|
423
|
+
else if (error.status == 404)
|
|
442
424
|
sweetAlertService.messageBox("Recurso no encontrado.");
|
|
425
|
+
else if (error.status == 401) {
|
|
426
|
+
sweetAlertService.messageBox(error.error.Error);
|
|
427
|
+
window.location.href = authenticationLocation;
|
|
428
|
+
}
|
|
429
|
+
else if (error.status == 403) {
|
|
430
|
+
sweetAlertService.messageBox(error.error.Error);
|
|
431
|
+
window.location.href = window.location.origin;
|
|
432
|
+
}
|
|
433
|
+
else
|
|
434
|
+
sweetAlertService.messageBox(error.error.Message);
|
|
443
435
|
return throwError(() => {
|
|
444
|
-
error.error, error.message;
|
|
436
|
+
(error.error, error.message);
|
|
445
437
|
});
|
|
446
438
|
}
|
|
447
439
|
};
|