@bnsights/bbsf-utilities 1.0.32 → 1.0.33

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.
Files changed (124) hide show
  1. package/README.md +4 -4
  2. package/bnsights-bbsf-utilities-1.0.33.tgz +0 -0
  3. package/bnsights-bbsf-utilities.d.ts +0 -1
  4. package/bnsights-bbsf-utilities.metadata.json +1 -0
  5. package/bundles/bnsights-bbsf-utilities.umd.js +4865 -0
  6. package/bundles/bnsights-bbsf-utilities.umd.js.map +1 -0
  7. package/esm2015/lib/bbsf-utilities.module.js +52 -0
  8. package/esm2015/lib/shared/authentication/auth.service.js +236 -0
  9. package/esm2015/lib/shared/config/word/constants.js +105 -0
  10. package/esm2015/lib/shared/config/word/docx-document.js +351 -0
  11. package/esm2015/lib/shared/config/word/helpers/index.js +4 -0
  12. package/esm2015/lib/shared/config/word/helpers/render-document-file.js +278 -0
  13. package/esm2015/lib/shared/config/word/helpers/xml-builder.js +1765 -0
  14. package/esm2015/lib/shared/config/word/html-to-docx.js +195 -0
  15. package/esm2015/lib/shared/config/word/index.js +55 -0
  16. package/esm2015/lib/shared/config/word/namespaces.js +37 -0
  17. package/esm2015/lib/shared/config/word/schemas/content-types.js +26 -0
  18. package/esm2015/lib/shared/config/word/schemas/core.js +29 -0
  19. package/esm2015/lib/shared/config/word/schemas/document-rels.js +16 -0
  20. package/esm2015/lib/shared/config/word/schemas/document.template.js +109 -0
  21. package/esm2015/lib/shared/config/word/schemas/font-table.js +40 -0
  22. package/esm2015/lib/shared/config/word/schemas/generic-rels.js +11 -0
  23. package/esm2015/lib/shared/config/word/schemas/index.js +13 -0
  24. package/esm2015/lib/shared/config/word/schemas/numbering.js +19 -0
  25. package/esm2015/lib/shared/config/word/schemas/rels.js +11 -0
  26. package/esm2015/lib/shared/config/word/schemas/settings.js +13 -0
  27. package/esm2015/lib/shared/config/word/schemas/styles.js +149 -0
  28. package/esm2015/lib/shared/config/word/schemas/theme.js +200 -0
  29. package/esm2015/lib/shared/config/word/schemas/web-settings.js +9 -0
  30. package/esm2015/lib/shared/config/word/utils/color-conversion.js +60 -0
  31. package/esm2015/lib/shared/config/word/utils/list.js +51 -0
  32. package/esm2015/lib/shared/config/word/utils/unit-conversion.js +30 -0
  33. package/esm2015/lib/shared/config/word/utils/url.js +9 -0
  34. package/esm2015/lib/shared/config/word/utils/vnode.js +3 -0
  35. package/esm2015/lib/shared/config/word/word-work/templates/documentTemplate.js +54 -0
  36. package/esm2015/lib/shared/config/word/word-work/templates/index.js +4 -0
  37. package/esm2015/lib/shared/config/word/word-work/templates/mhtDocumentTemplate.js +22 -0
  38. package/esm2015/lib/shared/config/word/word-work/templates/mhtPartTemplate.js +10 -0
  39. package/esm2015/lib/shared/config/word/word-work/utils.js +26 -0
  40. package/esm2015/lib/shared/models/WordDocumentModel.js +8 -0
  41. package/esm2015/lib/shared/services/AppearanceConfiguration.service.js +37 -0
  42. package/esm2015/lib/shared/services/configuration.service.js +26 -0
  43. package/esm2015/lib/shared/services/controlvalidation.service.js +168 -0
  44. package/esm2015/lib/shared/services/environment.service.js +48 -0
  45. package/esm2015/lib/shared/services/masterlayout.service.js +96 -0
  46. package/esm2015/lib/shared/services/requesthandler.service.js +206 -0
  47. package/esm2015/lib/shared/services/stylesbundle.service.js +56 -0
  48. package/esm2015/lib/shared/services/translate.service.js +13 -0
  49. package/esm2015/lib/shared/services/translationresolver.service.js +20 -0
  50. package/esm2015/lib/shared/services/utility.service.js +96 -0
  51. package/esm2015/lib/shared/services/word-document.service.js +39 -0
  52. package/esm2015/public-api.js +20 -0
  53. package/fesm2015/bnsights-bbsf-utilities.js +4634 -0
  54. package/fesm2015/bnsights-bbsf-utilities.js.map +1 -0
  55. package/lib/bbsf-utilities.module.d.ts +0 -9
  56. package/lib/shared/authentication/auth.service.d.ts +0 -3
  57. package/lib/shared/config/word/constants.d.ts +124 -0
  58. package/lib/shared/config/word/docx-document.d.ts +73 -0
  59. package/lib/shared/config/word/helpers/index.d.ts +1 -0
  60. package/lib/shared/config/word/helpers/render-document-file.d.ts +4 -0
  61. package/lib/shared/config/word/helpers/xml-builder.d.ts +14 -0
  62. package/lib/shared/config/word/html-to-docx.d.ts +1 -0
  63. package/lib/shared/config/word/index.d.ts +1 -0
  64. package/lib/shared/config/word/namespaces.d.ts +36 -0
  65. package/lib/shared/config/word/schemas/content-types.d.ts +1 -0
  66. package/lib/shared/config/word/schemas/core.d.ts +1 -0
  67. package/lib/shared/config/word/schemas/document-rels.d.ts +1 -0
  68. package/lib/shared/config/word/schemas/document.template.d.ts +4 -0
  69. package/lib/shared/config/word/schemas/font-table.d.ts +1 -0
  70. package/lib/shared/config/word/schemas/generic-rels.d.ts +1 -0
  71. package/lib/shared/config/word/schemas/index.d.ts +12 -0
  72. package/lib/shared/config/word/schemas/numbering.d.ts +1 -0
  73. package/lib/shared/config/word/schemas/rels.d.ts +1 -0
  74. package/lib/shared/config/word/schemas/settings.d.ts +1 -0
  75. package/lib/shared/config/word/schemas/styles.d.ts +1 -0
  76. package/lib/shared/config/word/schemas/theme.d.ts +1 -0
  77. package/lib/shared/config/word/schemas/web-settings.d.ts +1 -0
  78. package/lib/shared/config/word/utils/color-conversion.d.ts +7 -0
  79. package/lib/shared/config/word/utils/list.d.ts +6 -0
  80. package/lib/shared/config/word/utils/unit-conversion.d.ts +29 -0
  81. package/lib/shared/config/word/utils/url.d.ts +1 -0
  82. package/lib/shared/config/word/utils/vnode.d.ts +1 -0
  83. package/lib/shared/config/word/word-work/templates/documentTemplate.d.ts +12 -0
  84. package/lib/shared/config/word/word-work/templates/index.d.ts +3 -0
  85. package/lib/shared/config/word/word-work/templates/mhtDocumentTemplate.d.ts +1 -0
  86. package/lib/shared/config/word/word-work/templates/mhtPartTemplate.d.ts +1 -0
  87. package/lib/shared/config/word/word-work/utils.d.ts +1 -0
  88. package/lib/shared/models/WordDocumentModel.d.ts +16 -0
  89. package/lib/shared/services/AppearanceConfiguration.service.d.ts +0 -3
  90. package/lib/shared/services/configuration.service.d.ts +0 -3
  91. package/lib/shared/services/controlvalidation.service.d.ts +0 -3
  92. package/lib/shared/services/environment.service.d.ts +0 -3
  93. package/lib/shared/services/masterlayout.service.d.ts +0 -3
  94. package/lib/shared/services/requesthandler.service.d.ts +0 -3
  95. package/lib/shared/services/stylesbundle.service.d.ts +0 -3
  96. package/lib/shared/services/translate.service.d.ts +0 -3
  97. package/lib/shared/services/translationresolver.service.d.ts +0 -3
  98. package/lib/shared/services/utility.service.d.ts +0 -3
  99. package/lib/shared/services/word-document.service.d.ts +5 -0
  100. package/package.json +7 -19
  101. package/public-api.d.ts +2 -0
  102. package/bnsights-bbsf-utilities-1.0.32.tgz +0 -0
  103. package/esm2020/lib/bbsf-utilities.module.mjs +0 -74
  104. package/esm2020/lib/shared/authentication/auth.service.mjs +0 -217
  105. package/esm2020/lib/shared/services/AppearanceConfiguration.service.mjs +0 -35
  106. package/esm2020/lib/shared/services/configuration.service.mjs +0 -24
  107. package/esm2020/lib/shared/services/controlvalidation.service.mjs +0 -166
  108. package/esm2020/lib/shared/services/environment.service.mjs +0 -50
  109. package/esm2020/lib/shared/services/masterlayout.service.mjs +0 -84
  110. package/esm2020/lib/shared/services/requesthandler.service.mjs +0 -202
  111. package/esm2020/lib/shared/services/stylesbundle.service.mjs +0 -55
  112. package/esm2020/lib/shared/services/translate.service.mjs +0 -14
  113. package/esm2020/lib/shared/services/translationresolver.service.mjs +0 -18
  114. package/esm2020/lib/shared/services/utility.service.mjs +0 -90
  115. package/esm2020/public-api.mjs +0 -18
  116. package/fesm2015/bnsights-bbsf-utilities.mjs +0 -1009
  117. package/fesm2015/bnsights-bbsf-utilities.mjs.map +0 -1
  118. package/fesm2020/bnsights-bbsf-utilities.mjs +0 -997
  119. package/fesm2020/bnsights-bbsf-utilities.mjs.map +0 -1
  120. /package/{esm2020/bnsights-bbsf-utilities.mjs → esm2015/bnsights-bbsf-utilities.js} +0 -0
  121. /package/{esm2020/lib/shared/config/environment.mjs → esm2015/lib/shared/config/environment.js} +0 -0
  122. /package/{esm2020/lib/shared/models/AreaModel.mjs → esm2015/lib/shared/models/AreaModel.js} +0 -0
  123. /package/{esm2020/lib/shared/models/ErrorModel.mjs → esm2015/lib/shared/models/ErrorModel.js} +0 -0
  124. /package/{esm2020/lib/shared/models/RequestOptionsModel.mjs → esm2015/lib/shared/models/RequestOptionsModel.js} +0 -0
@@ -1,1009 +0,0 @@
1
- import { DOCUMENT, CommonModule } from '@angular/common';
2
- import * as i0 from '@angular/core';
3
- import { Injectable, Inject, NgModule } from '@angular/core';
4
- import * as i6 from '@angular/router';
5
- import { RouterModule } from '@angular/router';
6
- import * as i5 from '@ngx-translate/core';
7
- import { TranslateService } from '@ngx-translate/core';
8
- import * as i1$1 from 'ng-block-ui';
9
- import { BlockUI, BlockUIModule } from 'ng-block-ui';
10
- import * as i2 from 'ngx-toastr';
11
- import { ToastrService, ToastrModule } from 'ngx-toastr';
12
- import { HttpModule } from '@angular/http';
13
- import { __awaiter, __decorate } from 'tslib';
14
- import * as i1 from '@angular/common/http';
15
- import { HttpHeaders, HttpParams } from '@angular/common/http';
16
- import { UserManager, WebStorageStateStore } from 'oidc-client';
17
- import { Subject, Observable, throwError, BehaviorSubject } from 'rxjs';
18
- import { takeUntil, tap, map } from 'rxjs/operators';
19
- import { plainToClass } from 'class-transformer';
20
-
21
- class BBSFTranslateService extends TranslateService {
22
- }
23
- BBSFTranslateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: BBSFTranslateService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
24
- BBSFTranslateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: BBSFTranslateService, providedIn: 'root' });
25
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: BBSFTranslateService, decorators: [{
26
- type: Injectable,
27
- args: [{
28
- providedIn: 'root'
29
- }]
30
- }] });
31
-
32
- class RequestOptionsModel {
33
- constructor() {
34
- this.disableSuccessNotification = false;
35
- this.disableBlockUI = false;
36
- this.disableErrorHandler = false;
37
- this.responseType = "";
38
- this.formGroup = null;
39
- this.castResponsetoClass = true;
40
- }
41
- }
42
-
43
- // This file can be replaced during build by using the `fileReplacements` array.
44
- // `ng build ---prod` replaces `environment.ts` with `environment.prod.ts`.
45
- // The list of file replacements can be found in `angular.json`.
46
- const environment = Object.assign({}, window.Environment);
47
- /*
48
- * In development mode, to ignore zone related error stack frames such as
49
- * `zone.run`, `zoneDelegate.invokeTask` for easier debugging, you can
50
- * import the following file, but please comment it out in production mode
51
- * because it will have performance impact when throw error
52
- */
53
- // import 'zone.js/dist/zone-error'; // Included with Angular CLI.
54
-
55
- class EnvironmentService {
56
- getEnvironmentObject() {
57
- return environment;
58
- }
59
- getBaseUrl() {
60
- let Url = environment["BBSF_BaseURL"];
61
- return Url;
62
- }
63
- getApiUrl() {
64
- let Url = environment["BBSF_ApiUrl"];
65
- return Url;
66
- }
67
- getProductionMode() {
68
- let Mode = environment["BBSF_IsProduction"];
69
- return Mode;
70
- }
71
- getDefaultLanguage() {
72
- let Mode = environment["BBSF_DefaultLanguage"];
73
- return Mode;
74
- }
75
- getIdentityServerUrl() {
76
- let Url = environment["BBSF_IdentityServerUrl"];
77
- return Url;
78
- }
79
- getIsIdentityServerExternal() {
80
- let Mode = environment["BBSF_IsExternalIdentityServer"];
81
- return Mode;
82
- }
83
- getIsIdentityServerClientId() {
84
- let Mode = environment["BBSF_IdentityServer_Client_Id"];
85
- return Mode;
86
- }
87
- getIsIdentityServerClientSecret() {
88
- let Mode = environment["BBSF_IdentityServer_Client_Secret"];
89
- return Mode;
90
- }
91
- }
92
- EnvironmentService.AreaList = [];
93
- EnvironmentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: EnvironmentService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
94
- EnvironmentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: EnvironmentService, providedIn: 'root' });
95
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: EnvironmentService, decorators: [{
96
- type: Injectable,
97
- args: [{
98
- providedIn: 'root'
99
- }]
100
- }] });
101
-
102
- class RequestHandlerService {
103
- constructor(http, authService, environmentService, utilityService, bbsfTranslateService, router) {
104
- //using localStorage to avoid call getCurrentLanguage() because it is not all to use async in constructor
105
- this.http = http;
106
- this.authService = authService;
107
- this.environmentService = environmentService;
108
- this.utilityService = utilityService;
109
- this.bbsfTranslateService = bbsfTranslateService;
110
- this.router = router;
111
- this.requestOptions = new RequestOptionsModel();
112
- this.currentLanguage = "";
113
- this.onDestroy$ = new Subject();
114
- this.bbsfTranslateService.onLangChange.subscribe((event) => {
115
- if (this.currentLanguage != event.lang) {
116
- this.currentLanguage = event.lang;
117
- }
118
- });
119
- }
120
- getLuckyNumber() {
121
- return Observable.create((subject) => {
122
- setInterval(() => {
123
- const number = Math.floor(Math.random() * 10);
124
- console.log(number);
125
- subject.next(number);
126
- }, 1000);
127
- }).pipe(takeUntil(this.onDestroy$));
128
- }
129
- get(Url, params, responseType, requestOptions) {
130
- if (requestOptions)
131
- this.requestOptions = requestOptions;
132
- let headers = this.getHeaders();
133
- if (!this.requestOptions.disableBlockUI)
134
- this.utilityService.startBlockUI();
135
- let object;
136
- return this.http.get(this.environmentService.getApiUrl() + Url, { headers: headers, params: params }).pipe(takeUntil(this.onDestroy$), tap((result) => {
137
- if (!this.requestOptions.disableBlockUI)
138
- this.utilityService.stopBlockUI();
139
- }, error => {
140
- if (!this.requestOptions.disableErrorHandler)
141
- this.handleError(error);
142
- }), map((data) => {
143
- if (this.requestOptions.castResponsetoClass)
144
- return plainToClass(responseType, data, { excludeExtraneousValues: true });
145
- else
146
- return data;
147
- }));
148
- }
149
- post(Url, model, responseType, params, requestOptions) {
150
- if (requestOptions)
151
- this.requestOptions = requestOptions;
152
- let headers = this.getHeaders();
153
- if (!this.requestOptions.disableBlockUI)
154
- this.utilityService.startBlockUI();
155
- return this.http.post(this.environmentService.getApiUrl() + Url, model, { headers: headers, params: params, responseType: this.requestOptions.responseType }).pipe(takeUntil(this.onDestroy$), tap((result) => {
156
- if (!this.requestOptions.disableBlockUI)
157
- this.utilityService.stopBlockUI();
158
- }, error => {
159
- if (!this.requestOptions.disableErrorHandler)
160
- this.handleError(error);
161
- }), map((data) => {
162
- if (this.requestOptions.castResponsetoClass)
163
- return plainToClass(responseType, data, { excludeExtraneousValues: true });
164
- else
165
- return data;
166
- }));
167
- }
168
- delete(Url, deletedId, requestOptions, responseType, params) {
169
- if (requestOptions)
170
- this.requestOptions = requestOptions;
171
- let headers = this.getHeaders();
172
- if (!this.requestOptions.disableBlockUI)
173
- this.utilityService.startBlockUI();
174
- return this.http.delete(this.environmentService.getApiUrl() + Url + `/${deletedId}`, { headers: headers, params: params }).pipe(takeUntil(this.onDestroy$), tap((result) => {
175
- if (!this.requestOptions.disableBlockUI)
176
- this.utilityService.stopBlockUI();
177
- }, error => {
178
- if (!this.requestOptions.disableErrorHandler)
179
- this.handleError(error);
180
- }), map((data) => {
181
- if (this.requestOptions.castResponsetoClass)
182
- return plainToClass(responseType, data, { excludeExtraneousValues: true });
183
- else
184
- return data;
185
- }));
186
- }
187
- put(Url, model, params, responseType, requestOptions) {
188
- if (requestOptions)
189
- this.requestOptions = requestOptions;
190
- let headers = this.getHeaders();
191
- if (!this.requestOptions.disableBlockUI)
192
- this.utilityService.startBlockUI();
193
- return this.http.put(this.environmentService.getApiUrl() + Url, model, { headers: headers, params: params, responseType: this.requestOptions.responseType }).pipe(takeUntil(this.onDestroy$), tap((result) => {
194
- if (!this.requestOptions.disableBlockUI)
195
- this.utilityService.stopBlockUI();
196
- }, error => {
197
- if (!this.requestOptions.disableErrorHandler)
198
- this.handleError(error);
199
- }), map((data) => {
200
- if (this.requestOptions.castResponsetoClass)
201
- return plainToClass(responseType, data, { excludeExtraneousValues: true });
202
- else
203
- return data;
204
- }));
205
- }
206
- patch(Url, model, responseType, params, requestOptions) {
207
- if (requestOptions)
208
- this.requestOptions = requestOptions;
209
- let headers = new HttpHeaders({
210
- 'Content-Type': 'application/json',
211
- 'Authorization': this.authService.authorizationHeaderValue(),
212
- });
213
- this.currentLanguage = localStorage.getItem('language');
214
- headers = headers.set('Accept-Language', this.currentLanguage.toString());
215
- headers = headers.set('ignore-cookies', 'true');
216
- if (!this.requestOptions.disableBlockUI)
217
- this.utilityService.startBlockUI();
218
- return this.http.patch(this.environmentService.getApiUrl() + Url, model, { headers: headers, params: params, responseType: this.requestOptions.responseType }).pipe(takeUntil(this.onDestroy$), tap((result) => {
219
- if (!this.requestOptions.disableBlockUI)
220
- this.utilityService.stopBlockUI();
221
- }, error => {
222
- if (!this.requestOptions.disableErrorHandler)
223
- this.handleError(error);
224
- }), map((data) => {
225
- if (this.requestOptions.castResponsetoClass)
226
- return plainToClass(responseType, data, { excludeExtraneousValues: true });
227
- else
228
- return data;
229
- }));
230
- }
231
- download(Url, params, requestOptions) {
232
- if (requestOptions)
233
- this.requestOptions = requestOptions;
234
- let headers = this.getHeaders();
235
- if (!this.requestOptions.disableBlockUI)
236
- this.utilityService.startBlockUI();
237
- return this.http.get(this.environmentService.getApiUrl() + Url, { headers: headers, params: params, responseType: this.requestOptions.responseType }).pipe(takeUntil(this.onDestroy$), tap((result) => {
238
- if (!this.requestOptions.disableBlockUI)
239
- this.utilityService.stopBlockUI();
240
- }, error => {
241
- if (!this.requestOptions.disableErrorHandler)
242
- this.handleError(error);
243
- }));
244
- }
245
- destroyHandler() {
246
- this.onDestroy$.next();
247
- }
248
- ngOnDestroy() {
249
- console.log("clearInterval");
250
- this.destroyHandler();
251
- }
252
- handleError(err) {
253
- var isEnglish = this.utilityService.getCurrentLanguage() == "en";
254
- if (err.error instanceof ErrorEvent) {
255
- this.utilityService.notifyErrorMessage();
256
- }
257
- else {
258
- if (err.status == 400)
259
- throwError(err); //error 400 is thrown to be catch by the Form component to handle Fluent validation errors
260
- else if (err.status == 401)
261
- this.router.navigate(["/Admin/account/login"]);
262
- else if (err.status == 403)
263
- this.utilityService.notifyErrorMessage(isEnglish ? "Sorry, You're not authorized to access this action" : "عذرا ليس لديك الصلاحيه لهذا الطلب");
264
- else if (err.status == 510)
265
- this.utilityService.notifyErrorMessage(isEnglish ? "Can not delete this item as it is related to others" : "لا يمكن حذف هذا العنصر لأنه مرتبط بعناصر أخرى");
266
- else if (err.status == 515)
267
- this.utilityService.notifyErrorMessage((err.error ? err.error.Message : err.message));
268
- else {
269
- console.log(`error message is: ${err.error ? err.error.Message : err.message}`);
270
- this.utilityService.notifyErrorMessage(this.utilityService.getResourceValue("ErrorMassage"));
271
- }
272
- }
273
- this.utilityService.stopBlockUI();
274
- }
275
- getHeaders() {
276
- return new HttpHeaders({
277
- 'Content-Type': 'application/json',
278
- 'Authorization': this.authService.authorizationHeaderValue(),
279
- 'Client-Local-Time-Zone': Intl.DateTimeFormat().resolvedOptions().timeZone,
280
- 'Accept-Language': localStorage.getItem('language'),
281
- 'ignore-cookies': 'true'
282
- });
283
- }
284
- }
285
- RequestHandlerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: RequestHandlerService, deps: [{ token: i1.HttpClient }, { token: AuthService }, { token: EnvironmentService }, { token: UtilityService }, { token: BBSFTranslateService }, { token: i6.Router }], target: i0.ɵɵFactoryTarget.Injectable });
286
- RequestHandlerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: RequestHandlerService });
287
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: RequestHandlerService, decorators: [{
288
- type: Injectable
289
- }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: AuthService }, { type: EnvironmentService }, { type: UtilityService }, { type: BBSFTranslateService }, { type: i6.Router }]; } });
290
-
291
- class StylesBundleService {
292
- constructor(document, translateService) {
293
- this.document = document;
294
- this.translateService = translateService;
295
- }
296
- loadThemes(lang, bundleEnglishName, bundleArabicName) {
297
- if (lang == "ar") {
298
- this.loadStyleBundle(bundleArabicName.toString());
299
- document.querySelector('html').setAttribute("b-lang", "ar"); //use b-lang instead of lang to fix firefox number inputs in Arabic locale
300
- document.querySelector('html').setAttribute("dir", "rtl");
301
- }
302
- else {
303
- this.loadStyleBundle(bundleEnglishName.toString());
304
- document.querySelector('html').setAttribute("b-lang", "en");
305
- document.querySelector('html').setAttribute("dir", "ltr");
306
- }
307
- }
308
- loadThemesColor(theme, bundleDarkName, bundleLightName) {
309
- if (theme == "Light")
310
- this.loadStyleBundle(bundleLightName.toString());
311
- else
312
- this.loadStyleBundle(bundleDarkName.toString());
313
- }
314
- loadStyleBundle(styleName) {
315
- const head = this.document.getElementsByTagName('head')[0];
316
- let themeLink = this.document.getElementById('client-theme');
317
- if (themeLink && themeLink.href.includes(styleName)) {
318
- return;
319
- }
320
- else if (themeLink && !themeLink.href.includes(styleName)) {
321
- themeLink.remove();
322
- }
323
- const style = this.document.createElement('link');
324
- style.id = 'client-theme';
325
- style.rel = 'stylesheet';
326
- style.href = `${styleName}`;
327
- head.appendChild(style);
328
- }
329
- }
330
- StylesBundleService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: StylesBundleService, deps: [{ token: DOCUMENT }, { token: BBSFTranslateService }], target: i0.ɵɵFactoryTarget.Injectable });
331
- StylesBundleService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: StylesBundleService, providedIn: 'root' });
332
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: StylesBundleService, decorators: [{
333
- type: Injectable,
334
- args: [{
335
- providedIn: 'root'
336
- }]
337
- }], ctorParameters: function () {
338
- return [{ type: Document, decorators: [{
339
- type: Inject,
340
- args: [DOCUMENT]
341
- }] }, { type: BBSFTranslateService }];
342
- } });
343
-
344
- class MasterLayoutService {
345
- constructor(router, http, authService, stylesBundleService, translate, environmentService) {
346
- this.router = router;
347
- this.http = http;
348
- this.authService = authService;
349
- this.stylesBundleService = stylesBundleService;
350
- this.translate = translate;
351
- this.environmentService = environmentService;
352
- this.ApiUrl = '/api/Home/';
353
- }
354
- switchLang(lang, bundleEnglishName, bundleArabicName) {
355
- this.changeLanguage(lang).subscribe((result) => {
356
- this.updateUserInfo().subscribe((Value) => {
357
- let UserInfoObject = Value;
358
- this.authService.getUser();
359
- this.authService.user.profile = Object.assign(this.authService.user.profile, UserInfoObject);
360
- this.authService.storUser(this.authService.user);
361
- this.stylesBundleService.loadThemes(lang, bundleEnglishName, bundleArabicName);
362
- localStorage.setItem('language', lang);
363
- this.translate.use(lang);
364
- });
365
- });
366
- }
367
- reloadComponent() {
368
- let currentUrl = this.router.url;
369
- this.router.routeReuseStrategy.shouldReuseRoute = () => false;
370
- this.router.onSameUrlNavigation = 'reload';
371
- this.router.navigate([currentUrl]);
372
- }
373
- changeLanguage(key) {
374
- let params = new HttpParams();
375
- params = params.append('UserId', this.authService.user.profile.id);
376
- params = params.append('LanguageKey', key);
377
- return this.http.post(this.ApiUrl + 'UpdateLanguage', null, null, params);
378
- }
379
- getUserClaims() {
380
- return this.http.get(this.ApiUrl + 'GetUserClaims', null, null);
381
- }
382
- logError(error) {
383
- let params = new HttpParams();
384
- params = params.append('error', error);
385
- return this.http.post(this.ApiUrl + 'LogError', null, null, params);
386
- }
387
- updateUserInfo() {
388
- let isExternal = this.environmentService.getIsIdentityServerExternal().toLowerCase() == 'true';
389
- if (isExternal)
390
- return this.getUserClaims();
391
- return this.http.get('/connect/userinfo');
392
- }
393
- switchRole(permissionSetID) {
394
- this.updateRole(permissionSetID).subscribe((result) => {
395
- this.updateUserInfo().subscribe((Value) => {
396
- let UserInfoObject = Value;
397
- this.authService.getUser();
398
- this.authService.user.profile = Object.assign(this.authService.user.profile, UserInfoObject);
399
- this.authService.storUser(this.authService.user);
400
- });
401
- });
402
- }
403
- updateRole(permissionSetID) {
404
- let params = new HttpParams();
405
- params = params.append('UserId', this.authService.user.profile.id);
406
- params = params.append('RoleID', permissionSetID);
407
- return this.http.post(this.ApiUrl + 'SwitchRole', null, null, params);
408
- }
409
- }
410
- MasterLayoutService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: MasterLayoutService, deps: [{ token: i6.Router }, { token: RequestHandlerService }, { token: AuthService }, { token: StylesBundleService }, { token: i5.TranslateService }, { token: EnvironmentService }], target: i0.ɵɵFactoryTarget.Injectable });
411
- MasterLayoutService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: MasterLayoutService, providedIn: 'root' });
412
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: MasterLayoutService, decorators: [{
413
- type: Injectable,
414
- args: [{
415
- providedIn: 'root',
416
- }]
417
- }], ctorParameters: function () { return [{ type: i6.Router }, { type: RequestHandlerService }, { type: AuthService }, { type: StylesBundleService }, { type: i5.TranslateService }, { type: EnvironmentService }]; } });
418
-
419
- class AuthService {
420
- constructor(injector, http, environmentService, translateService, router) {
421
- this.injector = injector;
422
- this.http = http;
423
- this.environmentService = environmentService;
424
- this.translateService = translateService;
425
- this.router = router;
426
- // Observable navItem source
427
- this._authNavStatusSource = new BehaviorSubject(false);
428
- // Observable navItem stream
429
- this.authNavStatus$ = this._authNavStatusSource.asObservable();
430
- // Observable navItem source
431
- this._userSource = new Subject();
432
- this.UserStatus$ = this._userSource.asObservable();
433
- this.manager = this.getUserManager();
434
- this.redirectUrl = '';
435
- this.manager.getUser().then((user) => __awaiter(this, void 0, void 0, function* () {
436
- this.manager.storeUser(user);
437
- AuthService.user = user;
438
- this.user = user;
439
- this._authNavStatusSource.next(yield this.isAuthenticated());
440
- }));
441
- this.manager.events.addAccessTokenExpired((_) => {
442
- this._authNavStatusSource.next(false);
443
- });
444
- }
445
- getUserManager() {
446
- let user = null;
447
- let isExternal = this.environmentService.getIsIdentityServerExternal().toLowerCase() ==
448
- 'true';
449
- if (isExternal) {
450
- user = new UserManager({
451
- authority: this.environmentService.getIdentityServerUrl(),
452
- client_id: this.environmentService.getIsIdentityServerClientId(),
453
- client_secret: this.environmentService.getIsIdentityServerClientSecret(),
454
- redirect_uri: this.environmentService.getBaseUrl() +
455
- '/Admin/authentication/auth-callback',
456
- post_logout_redirect_uri: this.environmentService.getBaseUrl(),
457
- response_type: 'code',
458
- scope: 'openid profile email',
459
- filterProtocolClaims: true,
460
- loadUserInfo: true,
461
- automaticSilentRenew: true,
462
- silent_redirect_uri: this.environmentService.getBaseUrl() + '/assets/silent-callback.html',
463
- userStore: new WebStorageStateStore({ store: window.localStorage }),
464
- });
465
- }
466
- else {
467
- user = new UserManager({
468
- authority: this.environmentService.getIdentityServerUrl(),
469
- client_id: 'angular_spa',
470
- redirect_uri: this.environmentService.getBaseUrl() +
471
- '/Admin/authentication/auth-callback',
472
- post_logout_redirect_uri: this.environmentService.getBaseUrl(),
473
- response_type: 'id_token token',
474
- scope: 'openid profile email IdentityServerApi',
475
- filterProtocolClaims: true,
476
- loadUserInfo: true,
477
- automaticSilentRenew: true,
478
- silent_redirect_uri: this.environmentService.getBaseUrl() + '/assets/silent-callback.html',
479
- userStore: new WebStorageStateStore({ store: window.localStorage }),
480
- });
481
- }
482
- return user;
483
- }
484
- login() {
485
- return this.manager.signinRedirect();
486
- }
487
- getUser() {
488
- this.manager.getUser().then((user) => __awaiter(this, void 0, void 0, function* () {
489
- AuthService.user = user;
490
- this.user = user;
491
- this._authNavStatusSource.next(yield this.isAuthenticated());
492
- }));
493
- }
494
- storUser(User) {
495
- this.manager.storeUser(User);
496
- }
497
- revokeAccessToken() {
498
- this.manager.revokeAccessToken();
499
- }
500
- signinSilent() {
501
- let x = this.manager.signinSilentCallback();
502
- x.then((s) => {
503
- //console.log(s)
504
- });
505
- }
506
- completeAuthentication() {
507
- return __awaiter(this, void 0, void 0, function* () {
508
- this.user = yield this.manager.signinRedirectCallback();
509
- AuthService.user = this.user;
510
- this._userSource.next(AuthService.user);
511
- this._authNavStatusSource.next(yield this.isAuthenticated());
512
- let isExternal = this.environmentService.getIsIdentityServerExternal().toLowerCase() ==
513
- 'true';
514
- if (isExternal) {
515
- const masterLayoutService = this.injector.get(MasterLayoutService);
516
- let userClaims = yield masterLayoutService
517
- .getUserClaims()
518
- .toPromise()
519
- .then((e) => {
520
- AuthService.UserClaims = e;
521
- }, (error) => {
522
- console.log(error);
523
- });
524
- AuthService.user.profile = Object.assign(AuthService.user.profile, AuthService.UserClaims);
525
- }
526
- this.storUser(AuthService.user);
527
- if (!localStorage.getItem('language') ||
528
- localStorage.getItem('language') == this.user.profile.locale)
529
- localStorage.setItem('language', this.user.profile.locale);
530
- if (this.translateService.currentLang != localStorage.getItem('language')) {
531
- this.translateService.resetLang(this.translateService.currentLang);
532
- yield this.translateService
533
- .reloadLang(localStorage.getItem('language'))
534
- .subscribe((res) => {
535
- console.log(res);
536
- });
537
- }
538
- this._userSource.next(AuthService.user);
539
- this._authNavStatusSource.next(yield this.isAuthenticated());
540
- this.user = AuthService.user;
541
- });
542
- }
543
- refreshToken(token) {
544
- return __awaiter(this, void 0, void 0, function* () {
545
- const httpOptions = {
546
- headers: new HttpHeaders({
547
- 'Content-Type': 'application/json',
548
- Authorization: token,
549
- }),
550
- };
551
- this.manager.revokeAccessToken();
552
- return yield this.http
553
- .post(`${this.environmentService.getIdentityServerUrl()}/users/refresh-token`, httpOptions, { withCredentials: true })
554
- .subscribe((user) => {
555
- this._userSource.next(user);
556
- AuthService.user = user;
557
- this.user = user;
558
- });
559
- });
560
- }
561
- getCurrentUser() {
562
- return this.manager.getUser();
563
- }
564
- isAuthenticated() {
565
- return __awaiter(this, void 0, void 0, function* () {
566
- let user = yield this.manager.getUser().then((user) => {
567
- return user;
568
- });
569
- return this.user != null && !this.user.expired;
570
- });
571
- }
572
- isUserInRole(allowedPermission) {
573
- let selectedPermissionSetID = Number.parseInt(this.user.profile['selectedpermissionsetid']);
574
- return allowedPermission.includes(selectedPermissionSetID);
575
- }
576
- authorizationHeaderValue() {
577
- return AuthService.user
578
- ? `${AuthService.user.token_type} ${AuthService.user.access_token}`
579
- : '';
580
- }
581
- name() {
582
- return AuthService.user != null ? AuthService.user.profile.given_name : '';
583
- }
584
- setUrl(url) {
585
- localStorage.setItem('redirectUrl', url);
586
- }
587
- getUrl() {
588
- return localStorage.getItem('redirectUrl');
589
- }
590
- signinSilentCallback() {
591
- return __awaiter(this, void 0, void 0, function* () {
592
- let user = yield this.manager.signinSilentCallback();
593
- //await this.manager.storeUser(user);
594
- AuthService.user = user;
595
- console.log('Token from signinSilentCallback :' + AuthService.user);
596
- this.user = user;
597
- });
598
- }
599
- signout() {
600
- return __awaiter(this, void 0, void 0, function* () {
601
- if (yield !this.isAuthenticated())
602
- this.router.navigate(['/Admin/account/login']), localStorage.clear();
603
- let isExternal = this.environmentService.getIsIdentityServerExternal().toLowerCase() ==
604
- 'true';
605
- if (isExternal) {
606
- yield this.clearUserSessionClaims()
607
- .toPromise()
608
- .then((res) => {
609
- let result = res;
610
- });
611
- }
612
- yield this.manager.signoutRedirect();
613
- });
614
- }
615
- clearUserSessionClaims() {
616
- const httpOptions = {
617
- headers: new HttpHeaders({
618
- 'Content-Type': 'application/json',
619
- }),
620
- };
621
- let ApiUrl = '/api/Home/';
622
- return this.http.get(this.environmentService.getBaseUrl() + ApiUrl + 'ClearCurrentUserSession', httpOptions);
623
- }
624
- }
625
- AuthService.user = null;
626
- AuthService.UserClaims = null;
627
- AuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AuthService, deps: [{ token: i0.Injector }, { token: i1.HttpClient }, { token: EnvironmentService }, { token: BBSFTranslateService }, { token: i6.Router }], target: i0.ɵɵFactoryTarget.Injectable });
628
- AuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AuthService, providedIn: 'root' });
629
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AuthService, decorators: [{
630
- type: Injectable,
631
- args: [{
632
- providedIn: 'root',
633
- }]
634
- }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i1.HttpClient }, { type: EnvironmentService }, { type: BBSFTranslateService }, { type: i6.Router }]; } });
635
-
636
- class UtilityService {
637
- constructor(translator, authService, environmentService) {
638
- this.translator = translator;
639
- this.authService = authService;
640
- this.environmentService = environmentService;
641
- this.isCreatedBefore = false;
642
- }
643
- getResourceValue(Key) {
644
- let ResourceValue = this.translator.instant(Key);
645
- return ResourceValue;
646
- }
647
- getCurrentLanguage() {
648
- let currentLanguage = this.environmentService.getDefaultLanguage();
649
- let lang = localStorage.getItem('language');
650
- if (lang)
651
- currentLanguage = lang;
652
- else
653
- localStorage.setItem('language', currentLanguage);
654
- return currentLanguage;
655
- }
656
- isCurrentLanguageEnglish() {
657
- return this.getCurrentLanguage() == "en";
658
- }
659
- isCurrentLanguageArabic() {
660
- return this.getCurrentLanguage() == "ar";
661
- }
662
- notifySuccessMessage(Message, title, time, showHeader = true) {
663
- let MessageTemplate = this.getResourceValue("SuccessMessage");
664
- let titleTemplate;
665
- if (Message) {
666
- MessageTemplate = Message;
667
- }
668
- if (title) {
669
- titleTemplate = title;
670
- }
671
- let toaster = AppInjector.get(ToastrService);
672
- showHeader ? toaster.success(MessageTemplate, titleTemplate) : toaster.success(MessageTemplate);
673
- }
674
- notifyErrorMessage(Message, title, time, showHeader = true) {
675
- let MessageTemplate = this.getResourceValue("ErrorMessage");
676
- let titleTemplate = this.getResourceValue("Error");
677
- if (Message) {
678
- MessageTemplate = Message;
679
- }
680
- if (title) {
681
- titleTemplate = title;
682
- }
683
- const toaster = AppInjector.get(ToastrService);
684
- showHeader ? toaster.error(MessageTemplate, titleTemplate) : toaster.error(MessageTemplate);
685
- }
686
- notifyWarningMessage(Message, title, time, showHeader = true) {
687
- let MessageTemplate = this.getResourceValue("WarningMessage");
688
- let titleTemplate = this.getResourceValue("Warning");
689
- if (Message) {
690
- MessageTemplate = Message;
691
- }
692
- if (title) {
693
- titleTemplate = title;
694
- }
695
- const toaster = AppInjector.get(ToastrService);
696
- showHeader ? toaster.warning(MessageTemplate, titleTemplate) : toaster.warning(MessageTemplate);
697
- }
698
- startBlockUI() {
699
- this.blockUI.start();
700
- }
701
- stopBlockUI() {
702
- this.blockUI.stop();
703
- }
704
- }
705
- UtilityService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UtilityService, deps: [{ token: BBSFTranslateService }, { token: AuthService }, { token: EnvironmentService }], target: i0.ɵɵFactoryTarget.Injectable });
706
- UtilityService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UtilityService, providedIn: 'root' });
707
- __decorate([
708
- BlockUI()
709
- ], UtilityService.prototype, "blockUI", void 0);
710
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UtilityService, decorators: [{
711
- type: Injectable,
712
- args: [{
713
- providedIn: 'root'
714
- }]
715
- }], ctorParameters: function () { return [{ type: BBSFTranslateService }, { type: AuthService }, { type: EnvironmentService }]; }, propDecorators: { blockUI: [] } });
716
-
717
- class ControlValidationService {
718
- constructor(utilityService) {
719
- this.utilityService = utilityService;
720
- this.requestOptions = new RequestOptionsModel();
721
- this.isCreatedBefor = false;
722
- }
723
- showGlobalError(errorMessage, formId, deleteOld) {
724
- let globalErorrElement = document.getElementsByClassName('alert alert-InvalidValidation bg-light-danger text-danger');
725
- if (globalErorrElement.length > 0) {
726
- this.removeElementsByClass('alert alert-InvalidValidation bg-light-danger text-danger');
727
- }
728
- if (this.isCreatedBefor == true) {
729
- this.removeElementsByClass('alert alert-InvalidValidation bg-light-danger text-danger');
730
- }
731
- // tslint:disable-next-line: prefer-const
732
- if (!formId)
733
- formId = "currentForm";
734
- var object = document.getElementById(formId);
735
- const tagName = 'div';
736
- // tslint:disable-next-line: prefer-const
737
- var elementToAppend = document.createElement(tagName); // Your tag name here
738
- let message = "";
739
- if (!errorMessage || (typeof errorMessage == "string")) {
740
- if (localStorage.getItem('language') == "ar")
741
- message = errorMessage ? errorMessage : "لديك بعص الأخطاء . من فضلك قم بالمراجعه ";
742
- else
743
- message = errorMessage ? errorMessage : "You have some validation errors. Please check below";
744
- elementToAppend.innerHTML = "<ul class='list-unstyled m-0 py-3 d-flex align-items-center fs-6'><li><i class='fa fa-times-circle text-danger me-3 fs-2'></i>" + message + "</li></ul>";
745
- elementToAppend.className += 'alert alert-InvalidValidation bg-light-danger text-danger';
746
- elementToAppend.id += 'errorId';
747
- // tslint:disable-next-line: prefer-for-of
748
- const elementToAppen = elementToAppend.cloneNode(true);
749
- // let targetElement = object.getElementsByClassName("b-control")[0];
750
- object.insertBefore(elementToAppen, object.firstChild);
751
- }
752
- else {
753
- elementToAppend.innerHTML = "<ul>";
754
- for (const iterator of errorMessage) {
755
- elementToAppend.innerHTML = "<li>" + iterator + "</li>";
756
- }
757
- elementToAppend.innerHTML = "</ul>";
758
- elementToAppend.className += 'alert alert-InvalidValidation bg-light-danger text-danger';
759
- elementToAppend.id += 'errorId';
760
- // tslint:disable-next-line: prefer-for-of
761
- const elementToAppen = elementToAppend.cloneNode(true);
762
- // let targetElement = object.getElementsByClassName("b-control")[0];
763
- object.insertBefore(elementToAppen, object.firstChild);
764
- }
765
- this.isCreatedBefor = true;
766
- }
767
- RemoveGlobalError() {
768
- const removedList = document.getElementsByClassName('alert alert-InvalidValidation bg-light-danger text-danger');
769
- // tslint:disable-next-line: prefer-for-of
770
- for (let index = 0; index < removedList.length; index++) {
771
- const element = removedList[index];
772
- element.remove();
773
- }
774
- this.isCreatedBefor = false;
775
- }
776
- showInputErro(errors) {
777
- // show error on top of form
778
- this.showGlobalError();
779
- // remove old error from server
780
- this.removeElementsByClass('errortemplet');
781
- // Looping in error Object
782
- for (const key in errors) {
783
- if (errors.hasOwnProperty(key)) {
784
- for (const iterator of errors[key]) {
785
- const input = document.querySelectorAll('[ng-reflect-name=' + key + ']')[0];
786
- if (input.attributes['ng-reflect-name'].value === key) {
787
- this.removeElementsByClass('erroclass-' + key);
788
- const tagName = 'p';
789
- const elementToAppend = document.createElement(tagName); // Your tag name here
790
- elementToAppend.innerHTML = iterator;
791
- elementToAppend.style.color = 'red';
792
- elementToAppend.className += 'errortemplet erroclass-' + key;
793
- const elementToappen = elementToAppend.cloneNode(true);
794
- input.parentNode.insertBefore(elementToappen, input.lastChild);
795
- break;
796
- }
797
- }
798
- }
799
- }
800
- }
801
- removeElementsByClass(className) {
802
- const elements = document.getElementsByClassName(className);
803
- while (elements.length > 0) {
804
- elements[0].parentNode.removeChild(elements[0]);
805
- }
806
- }
807
- renderServerErrors(form, err, requestOptions, formId) {
808
- if (err.error == null) {
809
- return;
810
- }
811
- let errorsArray = [];
812
- this.requestOptions = requestOptions;
813
- err.error.validation_errors.forEach((element) => {
814
- let fieldName = element.field;
815
- let controlName = element.controlName;
816
- let message = element.message;
817
- if (form == null) {
818
- this.requestOptions.customErrorMessage ? this.utilityService.notifyErrorMessage(this.requestOptions.customErrorMessage) : this.utilityService.notifyErrorMessage(`${message}`);
819
- }
820
- else if (controlName && !this.hasControlName(form, controlName)) {
821
- errorsArray.push(`${fieldName}: ${message}`);
822
- // this.showGlobalError(`${fieldName}: ${message}`,formId )
823
- }
824
- else {
825
- this.setFieldError(form, controlName, fieldName, message);
826
- }
827
- });
828
- if (errorsArray.length > 0)
829
- this.showGlobalError(errorsArray, formId);
830
- }
831
- hasControlName(form, controlName) {
832
- let control = form.get(controlName);
833
- return control != null;
834
- }
835
- setFieldError(form, controlName, fieldName, message) {
836
- let control = null;
837
- if (controlName)
838
- control = form.get(controlName);
839
- else
840
- control = form.get(fieldName.split('.')[0]);
841
- let errors = { "errorMassage": message };
842
- let fieldNameArray = fieldName.split('.');
843
- if (fieldNameArray.length >= 1) {
844
- switch (fieldNameArray[fieldNameArray.length - 1].toLocaleLowerCase()) {
845
- case "english":
846
- let englishControl = control.get("English");
847
- englishControl.setErrors(errors);
848
- break;
849
- case "arabic":
850
- let arabicControl = control.get("Arabic");
851
- arabicControl.setErrors(errors);
852
- break;
853
- default:
854
- control.setErrors(errors);
855
- }
856
- }
857
- else if (fieldNameArray.length == 1) {
858
- control.setErrors(errors);
859
- }
860
- else {
861
- this.requestOptions.customErrorMessage ? this.utilityService.notifyErrorMessage(this.requestOptions.customErrorMessage) : this.utilityService.notifyErrorMessage(`${message}`);
862
- }
863
- }
864
- }
865
- ControlValidationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ControlValidationService, deps: [{ token: UtilityService }], target: i0.ɵɵFactoryTarget.Injectable });
866
- ControlValidationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ControlValidationService, providedIn: 'root' });
867
- __decorate([
868
- BlockUI()
869
- ], ControlValidationService.prototype, "blockUI", void 0);
870
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ControlValidationService, decorators: [{
871
- type: Injectable,
872
- args: [{
873
- providedIn: 'root'
874
- }]
875
- }], ctorParameters: function () { return [{ type: UtilityService }]; }, propDecorators: { blockUI: [] } });
876
-
877
- class ConfigurationService {
878
- constructor(httpClient) {
879
- this.httpClient = httpClient;
880
- this.httpClient.get("./assets/config/configurations.json").subscribe(data => {
881
- ConfigurationService.JsonData = data;
882
- });
883
- }
884
- getConfigurationValue(key) {
885
- return ConfigurationService.JsonData[key];
886
- }
887
- }
888
- ConfigurationService.JsonData = [];
889
- ConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ConfigurationService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
890
- ConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ConfigurationService, providedIn: 'root' });
891
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ConfigurationService, decorators: [{
892
- type: Injectable,
893
- args: [{
894
- providedIn: 'root'
895
- }]
896
- }], ctorParameters: function () { return [{ type: i1.HttpClient }]; } });
897
-
898
- let AppInjector;
899
- class BBSFUtilitiesModule {
900
- constructor(injector) {
901
- this.injector = injector;
902
- AppInjector = this.injector;
903
- }
904
- }
905
- BBSFUtilitiesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: BBSFUtilitiesModule, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.NgModule });
906
- BBSFUtilitiesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: BBSFUtilitiesModule, imports: [CommonModule, i1$1.BlockUIModule, HttpModule,
907
- RouterModule, i2.ToastrModule] });
908
- BBSFUtilitiesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: BBSFUtilitiesModule, providers: [
909
- UtilityService,
910
- EnvironmentService,
911
- AuthService,
912
- RequestHandlerService,
913
- StylesBundleService,
914
- TranslateService,
915
- BBSFTranslateService,
916
- ControlValidationService,
917
- MasterLayoutService,
918
- ConfigurationService
919
- ], imports: [[
920
- CommonModule,
921
- BlockUIModule.forRoot(),
922
- HttpModule,
923
- RouterModule,
924
- ToastrModule.forRoot(),
925
- ]] });
926
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: BBSFUtilitiesModule, decorators: [{
927
- type: NgModule,
928
- args: [{
929
- declarations: [],
930
- imports: [
931
- CommonModule,
932
- BlockUIModule.forRoot(),
933
- HttpModule,
934
- RouterModule,
935
- ToastrModule.forRoot(),
936
- ],
937
- exports: [],
938
- providers: [
939
- UtilityService,
940
- EnvironmentService,
941
- AuthService,
942
- RequestHandlerService,
943
- StylesBundleService,
944
- TranslateService,
945
- BBSFTranslateService,
946
- ControlValidationService,
947
- MasterLayoutService,
948
- ConfigurationService
949
- ]
950
- }]
951
- }], ctorParameters: function () { return [{ type: i0.Injector }]; } });
952
-
953
- class TranslationResolverService {
954
- constructor(translateService) {
955
- this.translateService = translateService;
956
- }
957
- resolve() {
958
- return this.translateService.getTranslation(this.translateService.currentLang);
959
- }
960
- }
961
- TranslationResolverService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: TranslationResolverService, deps: [{ token: BBSFTranslateService }], target: i0.ɵɵFactoryTarget.Injectable });
962
- TranslationResolverService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: TranslationResolverService, providedIn: 'root' });
963
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: TranslationResolverService, decorators: [{
964
- type: Injectable,
965
- args: [{ providedIn: 'root' }]
966
- }], ctorParameters: function () { return [{ type: BBSFTranslateService }]; } });
967
-
968
- class AppearanceConfigurationService {
969
- constructor(configService) {
970
- this.configService = configService;
971
- }
972
- getLayoutTheme() {
973
- return this.configService.getConfigurationValue('AnonymousLayout_Theme');
974
- }
975
- getFooterText() {
976
- return this.configService.getConfigurationValue('AnonymousLayout_FooterText');
977
- }
978
- getPageTitle() {
979
- return this.configService.getConfigurationValue('AnonymousLayout_PageTitle');
980
- }
981
- getFavIcon() {
982
- return this.configService.getConfigurationValue('AnonymousLayout_FavIcon');
983
- }
984
- getCustomStyles() {
985
- return this.configService.getConfigurationValue('AnonymousLayout_CustomStyles');
986
- }
987
- getLogo() {
988
- return this.configService.getConfigurationValue('AnonymousLayout_Logo');
989
- }
990
- }
991
- AppearanceConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AppearanceConfigurationService, deps: [{ token: ConfigurationService }], target: i0.ɵɵFactoryTarget.Injectable });
992
- AppearanceConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AppearanceConfigurationService, providedIn: 'root' });
993
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AppearanceConfigurationService, decorators: [{
994
- type: Injectable,
995
- args: [{
996
- providedIn: 'root'
997
- }]
998
- }], ctorParameters: function () { return [{ type: ConfigurationService }]; } });
999
-
1000
- /*
1001
- * Public API Surface of @bnsights/bbsf-utilities
1002
- */
1003
-
1004
- /**
1005
- * Generated bundle index. Do not edit.
1006
- */
1007
-
1008
- export { AppInjector, AppearanceConfigurationService, AuthService, BBSFTranslateService, BBSFUtilitiesModule, ConfigurationService, ControlValidationService, EnvironmentService, MasterLayoutService, RequestHandlerService, RequestOptionsModel, StylesBundleService, TranslationResolverService, UtilityService, environment };
1009
- //# sourceMappingURL=bnsights-bbsf-utilities.mjs.map