ng-ipa-library 1.4.0 → 1.4.3

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.
@@ -143,7 +143,8 @@ class IPAFormService {
143
143
  const config = {
144
144
  required: isArabic ? 'هذا الحقل مطلوب' : 'this field required',
145
145
  pattern: `${validatorValue.message}`,
146
- Email: 'خطأ في البريد الالكتروني (example@ipa.edu.sa)',
146
+ Email: (isArabic ? 'خطأ في البريد الالكتروني ' : 'Invalid email ') +
147
+ '(example@example.com)',
147
148
  maxlength: isArabic
148
149
  ? `تجاوز عدد الحقل المسموح بها (${validatorValue.requiredLength}) حرف`
149
150
  : `this field is more than (${validatorValue.requiredLength}) letter`,
@@ -157,10 +158,15 @@ class IPAFormService {
157
158
  ? `رقم اصغر من أو يساوي ${validatorValue.max}`
158
159
  : `number less than or equal (${validatorValue.min})`,
159
160
  ngbDate: this.getNgbDatepickerErrorMsg(validatorValue),
160
- checkId: 'رقم الهوية أو الاقامة غير صحيح',
161
- link: 'الرابط غير صحيح (http://google.com)',
162
- linkMP4: 'الرابط غير صحيح (http://example.com/a.mp4)',
163
- mobileNo: 'خطأ في رقم الجوال (05xxxxxxxx)',
161
+ checkId: isArabic
162
+ ? 'رقم الهوية أو الاقامة غير صحيح'
163
+ : 'Wrong ID or Iqama number',
164
+ link: (isArabic ? 'الرابط غير صحيح ' : 'Wrong link ') +
165
+ '(http://example.com)',
166
+ linkMP4: (isArabic ? 'رابط MP4 غير صحيح ' : 'Wrong MP4 link ') +
167
+ '(http://example.com/example.mp4)',
168
+ mobileNo: (isArabic ? 'خطأ في رقم الجوال ' : 'Wrong mobile number ') +
169
+ '(05xxxxxxxx)',
164
170
  };
165
171
  return config[validatorName];
166
172
  }
@@ -1337,13 +1343,19 @@ class ErrorInterceptor {
1337
1343
  const response = error.error;
1338
1344
  const toastrConfig = {
1339
1345
  disableTimeOut: true,
1346
+ closeButton: true,
1347
+ tapToDismiss: false,
1340
1348
  };
1341
1349
  switch (response.statusCode) {
1342
1350
  case 500:
1343
- this.toastrService.error(response?.innerException + ' ' + response?.stackTrace, response.message, toastrConfig);
1351
+ const msg = response.innerException + ' ' + (response.stackTrace ?? '');
1352
+ const toastr = this.toastrService.error(msg, response.message, toastrConfig);
1353
+ toastr.onShown.subscribe(() => {
1354
+ this.addCopyButton(response.message + '\n' + msg);
1355
+ });
1344
1356
  break;
1345
1357
  default:
1346
- this.toastrService.error(response.message, '', toastrConfig);
1358
+ this.toastrService.error('', response.message, toastrConfig);
1347
1359
  break;
1348
1360
  }
1349
1361
  return throwError(error);
@@ -1357,6 +1369,21 @@ class ErrorInterceptor {
1357
1369
  }
1358
1370
  return false;
1359
1371
  }
1372
+ addCopyButton(message) {
1373
+ const messageToast = document.getElementsByClassName('toast-message')[0];
1374
+ const icon = document.createElement('i');
1375
+ icon.classList.add('ms-2', 'fas', 'fa-copy');
1376
+ icon.addEventListener('click', () => {
1377
+ this.copyToClipboard(message);
1378
+ });
1379
+ messageToast.appendChild(icon);
1380
+ }
1381
+ copyToClipboard(message) {
1382
+ navigator.clipboard.writeText(message);
1383
+ this.toastrService.success('تم نسخ الرسالة إلى الحافظة', '', {
1384
+ positionClass: 'toast-bottom-right',
1385
+ });
1386
+ }
1360
1387
  }
1361
1388
  ErrorInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: ErrorInterceptor, deps: [{ token: ErrorService }, { token: i1.ToastrService }], target: i0.ɵɵFactoryTarget.Injectable });
1362
1389
  ErrorInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: ErrorInterceptor });