ng-ipa-library 1.4.7 → 1.4.10
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/esm2020/lib/core/interceptors/error.interceptor.mjs +6 -43
- package/esm2020/lib/core/services/error.service.mjs +38 -5
- package/esm2020/lib/services/common.service.mjs +15 -6
- package/esm2020/lib/share-button/share-button.component.mjs +3 -3
- package/fesm2015/ng-ipa-library.mjs +115 -112
- package/fesm2015/ng-ipa-library.mjs.map +1 -1
- package/fesm2020/ng-ipa-library.mjs +113 -110
- package/fesm2020/ng-ipa-library.mjs.map +1 -1
- package/lib/core/interceptors/error.interceptor.d.ts +1 -7
- package/lib/core/services/error.service.d.ts +10 -1
- package/lib/services/common.service.d.ts +4 -1
- package/package.json +1 -1
|
@@ -1152,10 +1152,10 @@ class ShareButtonComponent {
|
|
|
1152
1152
|
}
|
|
1153
1153
|
}
|
|
1154
1154
|
ShareButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: ShareButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1155
|
-
ShareButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.2", type: ShareButtonComponent, selector: "ipa-share-button", inputs: { title: "title", description: "description", btnLabel: "btnLabel" }, ngImport: i0, template: "<share-popup-button [title]=\"title\" [description]=\"description\" [icon]=\"'share-alt'\"\r\n [include]=\"['facebook','twitter','linkedin','telegram','whatsapp','email','copy']\">\r\n</share-popup-button
|
|
1155
|
+
ShareButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.2", type: ShareButtonComponent, selector: "ipa-share-button", inputs: { title: "title", description: "description", btnLabel: "btnLabel" }, ngImport: i0, template: "<share-popup-button [title]=\"title\" [description]=\"description\" [icon]=\"'share-alt'\"\r\n [include]=\"['facebook','twitter','linkedin','telegram','whatsapp','email','copy']\">\r\n</share-popup-button>", styles: [""], components: [{ type: i1$1.SharePopupComponent, selector: "share-popup-button", inputs: ["theme", "icon", "text", "include", "exclude", "closeIcon", "url", "title", "description", "image", "tags", "autoSetMeta", "show", "showIcon", "showText", "disabled", "hasBackdrop", "backdropClass"], outputs: ["opened", "closed", "popupClosed"] }] });
|
|
1156
1156
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: ShareButtonComponent, decorators: [{
|
|
1157
1157
|
type: Component,
|
|
1158
|
-
args: [{ selector: 'ipa-share-button', template: "<share-popup-button [title]=\"title\" [description]=\"description\" [icon]=\"'share-alt'\"\r\n [include]=\"['facebook','twitter','linkedin','telegram','whatsapp','email','copy']\">\r\n</share-popup-button
|
|
1158
|
+
args: [{ selector: 'ipa-share-button', template: "<share-popup-button [title]=\"title\" [description]=\"description\" [icon]=\"'share-alt'\"\r\n [include]=\"['facebook','twitter','linkedin','telegram','whatsapp','email','copy']\">\r\n</share-popup-button>", styles: [""] }]
|
|
1159
1159
|
}], ctorParameters: function () { return []; }, propDecorators: { title: [{
|
|
1160
1160
|
type: Input
|
|
1161
1161
|
}], description: [{
|
|
@@ -1348,8 +1348,81 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImpor
|
|
|
1348
1348
|
type: Injectable
|
|
1349
1349
|
}], ctorParameters: function () { return [{ type: LoaderService }]; } });
|
|
1350
1350
|
|
|
1351
|
+
class CommonService {
|
|
1352
|
+
constructor(toastrService) {
|
|
1353
|
+
this.toastrService = toastrService;
|
|
1354
|
+
}
|
|
1355
|
+
copyToClipboard(copyText, message) {
|
|
1356
|
+
navigator.clipboard.writeText(copyText.toString());
|
|
1357
|
+
this.toastrService.success(message, '', {
|
|
1358
|
+
positionClass: 'toast-bottom-right',
|
|
1359
|
+
});
|
|
1360
|
+
}
|
|
1361
|
+
print(element, title, classes) {
|
|
1362
|
+
const styles = this.getElementTag('style');
|
|
1363
|
+
const links = this.getElementTag('link');
|
|
1364
|
+
const scripts = this.getElementTag('script');
|
|
1365
|
+
const printContents = document.getElementById(element)?.innerHTML;
|
|
1366
|
+
const popupWin = window.open('', '', 'top=0,left=0,height=100%,width=auto');
|
|
1367
|
+
const data = `
|
|
1368
|
+
<!DOCTYPE html>
|
|
1369
|
+
<head>
|
|
1370
|
+
<title> ${title} </title>
|
|
1371
|
+
<meta charset="utf-8">
|
|
1372
|
+
${links}
|
|
1373
|
+
${styles}
|
|
1374
|
+
<style>
|
|
1375
|
+
@media print {
|
|
1376
|
+
.noPrint{
|
|
1377
|
+
display: none !important;
|
|
1378
|
+
}
|
|
1379
|
+
body {
|
|
1380
|
+
direction: rtl;
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
</style>
|
|
1384
|
+
</head>
|
|
1385
|
+
<body class="${classes}">
|
|
1386
|
+
${printContents}
|
|
1387
|
+
${scripts}
|
|
1388
|
+
</body>
|
|
1389
|
+
|
|
1390
|
+
</html>`;
|
|
1391
|
+
popupWin?.document.open();
|
|
1392
|
+
popupWin?.document.write(data);
|
|
1393
|
+
popupWin?.document.close();
|
|
1394
|
+
popupWin?.focus();
|
|
1395
|
+
popupWin?.addEventListener('focus', () => {
|
|
1396
|
+
setTimeout(() => {
|
|
1397
|
+
if (popupWin.document.hasFocus()) {
|
|
1398
|
+
popupWin.print();
|
|
1399
|
+
popupWin.close();
|
|
1400
|
+
}
|
|
1401
|
+
}, 1000);
|
|
1402
|
+
});
|
|
1403
|
+
}
|
|
1404
|
+
getElementTag(tag) {
|
|
1405
|
+
const html = [];
|
|
1406
|
+
const elements = document.getElementsByTagName(tag);
|
|
1407
|
+
for (let index = 0; index < elements.length; index++) {
|
|
1408
|
+
html.push(elements[index].outerHTML);
|
|
1409
|
+
}
|
|
1410
|
+
return html.join('\r\n');
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
CommonService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: CommonService, deps: [{ token: i1.ToastrService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1414
|
+
CommonService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: CommonService, providedIn: 'root' });
|
|
1415
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: CommonService, decorators: [{
|
|
1416
|
+
type: Injectable,
|
|
1417
|
+
args: [{
|
|
1418
|
+
providedIn: 'root',
|
|
1419
|
+
}]
|
|
1420
|
+
}], ctorParameters: function () { return [{ type: i1.ToastrService }]; } });
|
|
1421
|
+
|
|
1351
1422
|
class ErrorService {
|
|
1352
|
-
constructor() {
|
|
1423
|
+
constructor(toastrService, commonService) {
|
|
1424
|
+
this.toastrService = toastrService;
|
|
1425
|
+
this.commonService = commonService;
|
|
1353
1426
|
this.urls = [];
|
|
1354
1427
|
}
|
|
1355
1428
|
setExceptionUrls(urls) {
|
|
@@ -1358,20 +1431,48 @@ class ErrorService {
|
|
|
1358
1431
|
addExceptionUrl(url) {
|
|
1359
1432
|
this.urls.push(url);
|
|
1360
1433
|
}
|
|
1434
|
+
showErrorMsg(response, toastrConfig) {
|
|
1435
|
+
if (response.errors && response.errors.length > 0) {
|
|
1436
|
+
toastrConfig.enableHtml = true;
|
|
1437
|
+
let msg = '';
|
|
1438
|
+
response.errors.forEach((error) => {
|
|
1439
|
+
msg += `<li>${error}</li>`;
|
|
1440
|
+
});
|
|
1441
|
+
this.toastrService.error(`<ul>${msg}</ul>`, response.message, toastrConfig);
|
|
1442
|
+
}
|
|
1443
|
+
else {
|
|
1444
|
+
this.toastrService.error('', response.message, toastrConfig);
|
|
1445
|
+
}
|
|
1446
|
+
}
|
|
1447
|
+
show500ErrorMsg(response, toastrConfig) {
|
|
1448
|
+
const msg = response.innerException + ' ' + (response.stackTrace ?? '');
|
|
1449
|
+
const toastr = this.toastrService.error(msg, response.message, toastrConfig);
|
|
1450
|
+
toastr.onShown.subscribe(() => {
|
|
1451
|
+
this.addCopyButton(response.message + '\n' + msg);
|
|
1452
|
+
});
|
|
1453
|
+
}
|
|
1454
|
+
addCopyButton(copyText) {
|
|
1455
|
+
const messageToast = document.getElementsByClassName('toast-message')[0];
|
|
1456
|
+
const icon = document.createElement('i');
|
|
1457
|
+
icon.classList.add('ms-2', 'fas', 'fa-copy');
|
|
1458
|
+
icon.addEventListener('click', () => {
|
|
1459
|
+
this.commonService.copyToClipboard(copyText, 'تم نسخ الرسالة إلى الحافظة');
|
|
1460
|
+
});
|
|
1461
|
+
messageToast.appendChild(icon);
|
|
1462
|
+
}
|
|
1361
1463
|
}
|
|
1362
|
-
ErrorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: ErrorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1464
|
+
ErrorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: ErrorService, deps: [{ token: i1.ToastrService }, { token: CommonService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1363
1465
|
ErrorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: ErrorService, providedIn: 'root' });
|
|
1364
1466
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: ErrorService, decorators: [{
|
|
1365
1467
|
type: Injectable,
|
|
1366
1468
|
args: [{
|
|
1367
|
-
providedIn: 'root'
|
|
1469
|
+
providedIn: 'root',
|
|
1368
1470
|
}]
|
|
1369
|
-
}], ctorParameters: function () { return []; } });
|
|
1471
|
+
}], ctorParameters: function () { return [{ type: i1.ToastrService }, { type: CommonService }]; } });
|
|
1370
1472
|
|
|
1371
1473
|
class ErrorInterceptor {
|
|
1372
|
-
constructor(errorService
|
|
1474
|
+
constructor(errorService) {
|
|
1373
1475
|
this.errorService = errorService;
|
|
1374
|
-
this.toastrService = toastrService;
|
|
1375
1476
|
}
|
|
1376
1477
|
intercept(req, next) {
|
|
1377
1478
|
if (this.isException(req)) {
|
|
@@ -1386,10 +1487,10 @@ class ErrorInterceptor {
|
|
|
1386
1487
|
};
|
|
1387
1488
|
switch (response.statusCode) {
|
|
1388
1489
|
case 500:
|
|
1389
|
-
this.show500ErrorMsg(response, toastrConfig);
|
|
1490
|
+
this.errorService.show500ErrorMsg(response, toastrConfig);
|
|
1390
1491
|
break;
|
|
1391
1492
|
default:
|
|
1392
|
-
this.showErrorMsg(response, toastrConfig);
|
|
1493
|
+
this.errorService.showErrorMsg(response, toastrConfig);
|
|
1393
1494
|
break;
|
|
1394
1495
|
}
|
|
1395
1496
|
return throwError(() => error);
|
|
@@ -1403,47 +1504,12 @@ class ErrorInterceptor {
|
|
|
1403
1504
|
}
|
|
1404
1505
|
return false;
|
|
1405
1506
|
}
|
|
1406
|
-
showErrorMsg(response, toastrConfig) {
|
|
1407
|
-
if (response.errors && response.errors.length > 0) {
|
|
1408
|
-
toastrConfig.enableHtml = true;
|
|
1409
|
-
let msg = '';
|
|
1410
|
-
response.errors.forEach((error) => {
|
|
1411
|
-
msg += `<li>${error}</li>`;
|
|
1412
|
-
});
|
|
1413
|
-
this.toastrService.error(`<ul>${msg}</ul>`, response.message, toastrConfig);
|
|
1414
|
-
}
|
|
1415
|
-
else {
|
|
1416
|
-
this.toastrService.error('', response.message, toastrConfig);
|
|
1417
|
-
}
|
|
1418
|
-
}
|
|
1419
|
-
show500ErrorMsg(response, toastrConfig) {
|
|
1420
|
-
const msg = response.innerException + ' ' + (response.stackTrace ?? '');
|
|
1421
|
-
const toastr = this.toastrService.error(msg, response.message, toastrConfig);
|
|
1422
|
-
toastr.onShown.subscribe(() => {
|
|
1423
|
-
this.addCopyButton(response.message + '\n' + msg);
|
|
1424
|
-
});
|
|
1425
|
-
}
|
|
1426
|
-
addCopyButton(message) {
|
|
1427
|
-
const messageToast = document.getElementsByClassName('toast-message')[0];
|
|
1428
|
-
const icon = document.createElement('i');
|
|
1429
|
-
icon.classList.add('ms-2', 'fas', 'fa-copy');
|
|
1430
|
-
icon.addEventListener('click', () => {
|
|
1431
|
-
this.copyToClipboard(message);
|
|
1432
|
-
});
|
|
1433
|
-
messageToast.appendChild(icon);
|
|
1434
|
-
}
|
|
1435
|
-
copyToClipboard(message) {
|
|
1436
|
-
navigator.clipboard.writeText(message);
|
|
1437
|
-
this.toastrService.success('تم نسخ الرسالة إلى الحافظة', '', {
|
|
1438
|
-
positionClass: 'toast-bottom-right',
|
|
1439
|
-
});
|
|
1440
|
-
}
|
|
1441
1507
|
}
|
|
1442
|
-
ErrorInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: ErrorInterceptor, deps: [{ token: ErrorService }
|
|
1508
|
+
ErrorInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: ErrorInterceptor, deps: [{ token: ErrorService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1443
1509
|
ErrorInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: ErrorInterceptor });
|
|
1444
1510
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: ErrorInterceptor, decorators: [{
|
|
1445
1511
|
type: Injectable
|
|
1446
|
-
}], ctorParameters: function () { return [{ type: ErrorService }
|
|
1512
|
+
}], ctorParameters: function () { return [{ type: ErrorService }]; } });
|
|
1447
1513
|
|
|
1448
1514
|
class AuthService {
|
|
1449
1515
|
constructor() {
|
|
@@ -1768,69 +1834,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImpor
|
|
|
1768
1834
|
}]
|
|
1769
1835
|
}], ctorParameters: function () { return []; } });
|
|
1770
1836
|
|
|
1771
|
-
class CommonService {
|
|
1772
|
-
constructor() { }
|
|
1773
|
-
print(element, title, classes) {
|
|
1774
|
-
const styles = this.getElementTag('style');
|
|
1775
|
-
const linkes = this.getElementTag('link');
|
|
1776
|
-
const scripts = this.getElementTag('script');
|
|
1777
|
-
const printContents = document.getElementById(element)?.innerHTML;
|
|
1778
|
-
const popupWin = window.open('', '', 'top=0,left=0,height=100%,width=auto');
|
|
1779
|
-
const data = `
|
|
1780
|
-
<!DOCTYPE html>
|
|
1781
|
-
<head>
|
|
1782
|
-
<title> ${title} </title>
|
|
1783
|
-
<meta charset="utf-8">
|
|
1784
|
-
${linkes}
|
|
1785
|
-
${styles}
|
|
1786
|
-
<style>
|
|
1787
|
-
@media print {
|
|
1788
|
-
.noPrint{
|
|
1789
|
-
display: none !important;
|
|
1790
|
-
}
|
|
1791
|
-
body {
|
|
1792
|
-
direction: rtl;
|
|
1793
|
-
}
|
|
1794
|
-
}
|
|
1795
|
-
</style>
|
|
1796
|
-
</head>
|
|
1797
|
-
<body class="${classes}">
|
|
1798
|
-
${printContents}
|
|
1799
|
-
${scripts}
|
|
1800
|
-
</body>
|
|
1801
|
-
|
|
1802
|
-
</html>`;
|
|
1803
|
-
popupWin?.document.open();
|
|
1804
|
-
popupWin?.document.write(data);
|
|
1805
|
-
popupWin?.document.close();
|
|
1806
|
-
popupWin?.focus();
|
|
1807
|
-
popupWin?.addEventListener('focus', () => {
|
|
1808
|
-
setTimeout(() => {
|
|
1809
|
-
if (popupWin.document.hasFocus()) {
|
|
1810
|
-
popupWin.print();
|
|
1811
|
-
popupWin.close();
|
|
1812
|
-
}
|
|
1813
|
-
}, 1000);
|
|
1814
|
-
});
|
|
1815
|
-
}
|
|
1816
|
-
getElementTag(tag) {
|
|
1817
|
-
const html = [];
|
|
1818
|
-
const elements = document.getElementsByTagName(tag);
|
|
1819
|
-
for (let index = 0; index < elements.length; index++) {
|
|
1820
|
-
html.push(elements[index].outerHTML);
|
|
1821
|
-
}
|
|
1822
|
-
return html.join('\r\n');
|
|
1823
|
-
}
|
|
1824
|
-
}
|
|
1825
|
-
CommonService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: CommonService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1826
|
-
CommonService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: CommonService, providedIn: 'root' });
|
|
1827
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: CommonService, decorators: [{
|
|
1828
|
-
type: Injectable,
|
|
1829
|
-
args: [{
|
|
1830
|
-
providedIn: 'root',
|
|
1831
|
-
}]
|
|
1832
|
-
}], ctorParameters: function () { return []; } });
|
|
1833
|
-
|
|
1834
1837
|
/*
|
|
1835
1838
|
* Public API Surface of ipa-library
|
|
1836
1839
|
*/
|