@bnsights/bbsf-utilities 1.0.39 → 1.0.41

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 (127) hide show
  1. package/README.md +8 -0
  2. package/bnsights-bbsf-utilities-1.0.41.tgz +0 -0
  3. package/esm2020/lib/bbsf-utilities.module.mjs +59 -0
  4. package/esm2020/lib/shared/authentication/auth.service.mjs +211 -0
  5. package/esm2020/lib/shared/authentication/index.mjs +2 -0
  6. package/{esm2015/lib/shared/config/environment.js → esm2020/lib/shared/config/environment.mjs} +1 -1
  7. package/esm2020/lib/shared/config/word/docx-document.mjs +348 -0
  8. package/esm2020/lib/shared/config/word/helpers/render-document-file.mjs +154 -0
  9. package/esm2020/lib/shared/config/word/helpers/xml-builder.mjs +1836 -0
  10. package/esm2020/lib/shared/config/word/html-to-docx.mjs +187 -0
  11. package/esm2020/lib/shared/config/word/index.mjs +50 -0
  12. package/esm2020/lib/shared/config/word/namespaces.mjs +37 -0
  13. package/{esm2015/lib/shared/config/word/schemas/core.js → esm2020/lib/shared/config/word/schemas/core.mjs} +1 -3
  14. package/esm2020/lib/shared/config/word/schemas/document.template.mjs +107 -0
  15. package/{esm2015/lib/shared/config/word/schemas/numbering.js → esm2020/lib/shared/config/word/schemas/numbering.mjs} +1 -3
  16. package/esm2020/lib/shared/config/word/schemas/styles.mjs +147 -0
  17. package/esm2020/lib/shared/config/word/schemas/theme.mjs +198 -0
  18. package/{esm2015/lib/shared/config/word/utils/url.js → esm2020/lib/shared/config/word/utils/url.mjs} +1 -3
  19. package/esm2020/lib/shared/enums/authentication-modes-enums.mjs +8 -0
  20. package/esm2020/lib/shared/index.mjs +4 -0
  21. package/{esm2015/lib/shared/models/UserModel.js → esm2020/lib/shared/models/UserModel.mjs} +1 -1
  22. package/esm2020/lib/shared/models/area-model.mjs +3 -0
  23. package/esm2020/lib/shared/models/error-model.mjs +3 -0
  24. package/esm2020/lib/shared/models/index.mjs +5 -0
  25. package/esm2020/lib/shared/models/request-options-model.mjs +11 -0
  26. package/esm2020/lib/shared/models/word-document-model.mjs +8 -0
  27. package/esm2020/lib/shared/services/appearance-configuration.service.mjs +35 -0
  28. package/esm2020/lib/shared/services/configuration.service.mjs +24 -0
  29. package/esm2020/lib/shared/services/control-validation.service.mjs +173 -0
  30. package/esm2020/lib/shared/services/environment.service.mjs +75 -0
  31. package/esm2020/lib/shared/services/index.mjs +12 -0
  32. package/esm2020/lib/shared/services/master-layout.service.mjs +72 -0
  33. package/esm2020/lib/shared/services/request-handler.service.mjs +199 -0
  34. package/esm2020/lib/shared/services/styles-bundle.service.mjs +55 -0
  35. package/esm2020/lib/shared/services/translate.service.mjs +14 -0
  36. package/esm2020/lib/shared/services/translation-resolver.service.mjs +7 -0
  37. package/esm2020/lib/shared/services/utility.service.mjs +87 -0
  38. package/esm2020/lib/shared/services/word-document.service.mjs +38 -0
  39. package/esm2020/public-api.mjs +30 -0
  40. package/fesm2015/{bnsights-bbsf-utilities.js → bnsights-bbsf-utilities.mjs} +741 -783
  41. package/fesm2015/bnsights-bbsf-utilities.mjs.map +1 -0
  42. package/fesm2020/bnsights-bbsf-utilities.mjs +4589 -0
  43. package/fesm2020/bnsights-bbsf-utilities.mjs.map +1 -0
  44. package/{bnsights-bbsf-utilities.d.ts → index.d.ts} +1 -0
  45. package/lib/bbsf-utilities.module.d.ts +8 -4
  46. package/lib/shared/authentication/auth.service.d.ts +11 -8
  47. package/lib/shared/authentication/index.d.ts +1 -0
  48. package/lib/shared/config/word/docx-document.d.ts +10 -10
  49. package/lib/shared/config/word/helpers/render-document-file.d.ts +0 -2
  50. package/lib/shared/config/word/helpers/xml-builder.d.ts +12 -10
  51. package/lib/shared/config/word/index.d.ts +1 -1
  52. package/lib/shared/config/word/word-work/templates/documentTemplate.d.ts +2 -2
  53. package/lib/shared/enums/authentication-modes-enums.d.ts +6 -0
  54. package/lib/shared/index.d.ts +3 -0
  55. package/lib/shared/models/area-model.d.ts +4 -0
  56. package/lib/shared/models/index.d.ts +4 -0
  57. package/lib/shared/services/{AppearanceConfiguration.service.d.ts → appearance-configuration.service.d.ts} +4 -1
  58. package/lib/shared/services/configuration.service.d.ts +3 -0
  59. package/lib/shared/services/{controlvalidation.service.d.ts → control-validation.service.d.ts} +8 -5
  60. package/lib/shared/services/environment.service.d.ts +13 -1
  61. package/lib/shared/services/index.d.ts +11 -0
  62. package/lib/shared/services/{masterlayout.service.d.ts → master-layout.service.d.ts} +6 -6
  63. package/lib/shared/services/{requesthandler.service.d.ts → request-handler.service.d.ts} +8 -7
  64. package/lib/shared/services/{stylesbundle.service.d.ts → styles-bundle.service.d.ts} +4 -1
  65. package/lib/shared/services/translate.service.d.ts +3 -0
  66. package/lib/shared/services/translation-resolver.service.d.ts +2 -0
  67. package/lib/shared/services/utility.service.d.ts +7 -3
  68. package/lib/shared/services/word-document.service.d.ts +5 -2
  69. package/package.json +41 -21
  70. package/public-api.d.ts +10 -9
  71. package/bnsights-bbsf-utilities-1.0.39.tgz +0 -0
  72. package/bnsights-bbsf-utilities.metadata.json +0 -1
  73. package/bundles/bnsights-bbsf-utilities.umd.js +0 -4773
  74. package/bundles/bnsights-bbsf-utilities.umd.js.map +0 -1
  75. package/esm2015/lib/bbsf-utilities.module.js +0 -54
  76. package/esm2015/lib/shared/authentication/auth.service.js +0 -199
  77. package/esm2015/lib/shared/config/word/docx-document.js +0 -351
  78. package/esm2015/lib/shared/config/word/helpers/render-document-file.js +0 -278
  79. package/esm2015/lib/shared/config/word/helpers/xml-builder.js +0 -1765
  80. package/esm2015/lib/shared/config/word/html-to-docx.js +0 -195
  81. package/esm2015/lib/shared/config/word/index.js +0 -55
  82. package/esm2015/lib/shared/config/word/namespaces.js +0 -37
  83. package/esm2015/lib/shared/config/word/schemas/document.template.js +0 -109
  84. package/esm2015/lib/shared/config/word/schemas/styles.js +0 -149
  85. package/esm2015/lib/shared/config/word/schemas/theme.js +0 -200
  86. package/esm2015/lib/shared/models/AreaModel.js +0 -3
  87. package/esm2015/lib/shared/models/ErrorModel.js +0 -3
  88. package/esm2015/lib/shared/models/RequestOptionsModel.js +0 -11
  89. package/esm2015/lib/shared/models/WordDocumentModel.js +0 -8
  90. package/esm2015/lib/shared/services/AppearanceConfiguration.service.js +0 -37
  91. package/esm2015/lib/shared/services/configuration.service.js +0 -26
  92. package/esm2015/lib/shared/services/controlvalidation.service.js +0 -175
  93. package/esm2015/lib/shared/services/environment.service.js +0 -48
  94. package/esm2015/lib/shared/services/masterlayout.service.js +0 -89
  95. package/esm2015/lib/shared/services/requesthandler.service.js +0 -206
  96. package/esm2015/lib/shared/services/stylesbundle.service.js +0 -56
  97. package/esm2015/lib/shared/services/translate.service.js +0 -13
  98. package/esm2015/lib/shared/services/translationresolver.service.js +0 -20
  99. package/esm2015/lib/shared/services/utility.service.js +0 -92
  100. package/esm2015/lib/shared/services/word-document.service.js +0 -39
  101. package/esm2015/public-api.js +0 -20
  102. package/fesm2015/bnsights-bbsf-utilities.js.map +0 -1
  103. package/lib/shared/models/AreaModel.d.ts +0 -4
  104. package/lib/shared/services/translationresolver.service.d.ts +0 -8
  105. /package/{esm2015/bnsights-bbsf-utilities.js → esm2020/bnsights-bbsf-utilities.mjs} +0 -0
  106. /package/{esm2015/lib/shared/config/word/constants.js → esm2020/lib/shared/config/word/constants.mjs} +0 -0
  107. /package/{esm2015/lib/shared/config/word/helpers/index.js → esm2020/lib/shared/config/word/helpers/index.mjs} +0 -0
  108. /package/{esm2015/lib/shared/config/word/schemas/content-types.js → esm2020/lib/shared/config/word/schemas/content-types.mjs} +0 -0
  109. /package/{esm2015/lib/shared/config/word/schemas/document-rels.js → esm2020/lib/shared/config/word/schemas/document-rels.mjs} +0 -0
  110. /package/{esm2015/lib/shared/config/word/schemas/font-table.js → esm2020/lib/shared/config/word/schemas/font-table.mjs} +0 -0
  111. /package/{esm2015/lib/shared/config/word/schemas/generic-rels.js → esm2020/lib/shared/config/word/schemas/generic-rels.mjs} +0 -0
  112. /package/{esm2015/lib/shared/config/word/schemas/index.js → esm2020/lib/shared/config/word/schemas/index.mjs} +0 -0
  113. /package/{esm2015/lib/shared/config/word/schemas/rels.js → esm2020/lib/shared/config/word/schemas/rels.mjs} +0 -0
  114. /package/{esm2015/lib/shared/config/word/schemas/settings.js → esm2020/lib/shared/config/word/schemas/settings.mjs} +0 -0
  115. /package/{esm2015/lib/shared/config/word/schemas/web-settings.js → esm2020/lib/shared/config/word/schemas/web-settings.mjs} +0 -0
  116. /package/{esm2015/lib/shared/config/word/utils/color-conversion.js → esm2020/lib/shared/config/word/utils/color-conversion.mjs} +0 -0
  117. /package/{esm2015/lib/shared/config/word/utils/list.js → esm2020/lib/shared/config/word/utils/list.mjs} +0 -0
  118. /package/{esm2015/lib/shared/config/word/utils/unit-conversion.js → esm2020/lib/shared/config/word/utils/unit-conversion.mjs} +0 -0
  119. /package/{esm2015/lib/shared/config/word/utils/vnode.js → esm2020/lib/shared/config/word/utils/vnode.mjs} +0 -0
  120. /package/{esm2015/lib/shared/config/word/word-work/templates/documentTemplate.js → esm2020/lib/shared/config/word/word-work/templates/documentTemplate.mjs} +0 -0
  121. /package/{esm2015/lib/shared/config/word/word-work/templates/index.js → esm2020/lib/shared/config/word/word-work/templates/index.mjs} +0 -0
  122. /package/{esm2015/lib/shared/config/word/word-work/templates/mhtDocumentTemplate.js → esm2020/lib/shared/config/word/word-work/templates/mhtDocumentTemplate.mjs} +0 -0
  123. /package/{esm2015/lib/shared/config/word/word-work/templates/mhtPartTemplate.js → esm2020/lib/shared/config/word/word-work/templates/mhtPartTemplate.mjs} +0 -0
  124. /package/{esm2015/lib/shared/config/word/word-work/utils.js → esm2020/lib/shared/config/word/word-work/utils.mjs} +0 -0
  125. /package/lib/shared/models/{ErrorModel.d.ts → error-model.d.ts} +0 -0
  126. /package/lib/shared/models/{RequestOptionsModel.d.ts → request-options-model.d.ts} +0 -0
  127. /package/lib/shared/models/{WordDocumentModel.d.ts → word-document-model.d.ts} +0 -0
@@ -1,26 +1,26 @@
1
+ import { DOCUMENT, CommonModule } from '@angular/common';
1
2
  import * as i0 from '@angular/core';
2
- import { Injectable, Injector, Inject, NgModule } from '@angular/core';
3
- import * as i4 from '@angular/router';
4
- import { Router, RouterModule } from '@angular/router';
5
- import * as i1 from '@ngx-translate/core';
3
+ import { Injectable, Inject, inject, NgModule } from '@angular/core';
4
+ import * as i1$1 from '@angular/router';
5
+ import { RouterModule } from '@angular/router';
6
+ import * as i4 from '@ngx-translate/core';
6
7
  import { TranslateService } from '@ngx-translate/core';
8
+ import * as i1$2 from 'ng-block-ui';
7
9
  import { BlockUI, BlockUIModule } from 'ng-block-ui';
10
+ import * as i2 from 'ngx-toastr';
8
11
  import { ToastrService, ToastrModule } from 'ngx-toastr';
9
- import { HttpModule } from '@angular/http';
12
+ import * as i4$1 from 'ngx-cookie-service';
13
+ import { CookieService } from 'ngx-cookie-service';
10
14
  import { __decorate, __awaiter, __rest } from 'tslib';
11
- import * as i1$1 from '@angular/common/http';
12
- import { HttpHeaders, HttpClient, HttpParams } from '@angular/common/http';
13
- import { BehaviorSubject, Subject, Observable, throwError } from 'rxjs';
15
+ import * as i1 from '@angular/common/http';
16
+ import { HttpParams, HttpHeaders } from '@angular/common/http';
17
+ import { Subject, Observable, throwError, BehaviorSubject } from 'rxjs';
14
18
  import { JwtHelperService } from '@auth0/angular-jwt';
15
- import * as i5 from 'ngx-cookie-service';
16
- import { CookieService } from 'ngx-cookie-service';
17
- import { takeUntil, tap, map } from 'rxjs/operators';
18
19
  import { plainToClass } from 'class-transformer';
19
- import * as i1$2 from '@angular/common';
20
- import { DOCUMENT, CommonModule } from '@angular/common';
20
+ import { takeUntil, tap, map } from 'rxjs/operators';
21
21
  import JSZip from 'jszip';
22
22
  import { fragment, create } from 'xmlbuilder2';
23
- import VNode from 'virtual-dom/vnode/vnode';
23
+ import VNode$1 from 'virtual-dom/vnode/vnode';
24
24
  import VText from 'virtual-dom/vnode/vtext';
25
25
  import HTMLToVDOM from 'html-to-vdom';
26
26
  import { cloneDeep } from 'lodash';
@@ -28,357 +28,418 @@ import { nanoid } from 'nanoid';
28
28
  import isVNode from 'virtual-dom/vnode/is-vnode';
29
29
  import isVText from 'virtual-dom/vnode/is-vtext';
30
30
  import escape from 'escape-html';
31
- import sizeOf from 'image-size';
31
+ import colorNames from 'color-name';
32
32
  import imageToBase64 from 'image-to-base64';
33
33
  import mimeTypes from 'mime-types';
34
- import colorNames from 'color-name';
34
+ import sizeOf from 'image-size';
35
35
 
36
- class BBSFTranslateService extends TranslateService {
37
- }
38
- BBSFTranslateService.ɵprov = i0.ɵɵdefineInjectable({ factory: function BBSFTranslateService_Factory() { return new BBSFTranslateService(i0.ɵɵinject(i1.TranslateStore), i0.ɵɵinject(i1.TranslateLoader), i0.ɵɵinject(i1.TranslateCompiler), i0.ɵɵinject(i1.TranslateParser), i0.ɵɵinject(i1.MissingTranslationHandler), i0.ɵɵinject(i1.USE_DEFAULT_LANG), i0.ɵɵinject(i1.USE_STORE), i0.ɵɵinject(i1.USE_EXTEND), i0.ɵɵinject(i1.DEFAULT_LANGUAGE)); }, token: BBSFTranslateService, providedIn: "root" });
39
- BBSFTranslateService.decorators = [
40
- { type: Injectable, args: [{
41
- providedIn: 'root'
42
- },] }
43
- ];
36
+ class User {
37
+ }
44
38
 
45
- // This file can be replaced during build by using the `fileReplacements` array.
46
- // `ng build ---prod` replaces `environment.ts` with `environment.prod.ts`.
47
- // The list of file replacements can be found in `angular.json`.
48
- const environment = Object.assign({}, window.Environment);
49
- /*
50
- * In development mode, to ignore zone related error stack frames such as
51
- * `zone.run`, `zoneDelegate.invokeTask` for easier debugging, you can
52
- * import the following file, but please comment it out in production mode
53
- * because it will have performance impact when throw error
54
- */
55
- // import 'zone.js/dist/zone-error'; // Included with Angular CLI.
39
+ var AuthenticationModes;
40
+ (function (AuthenticationModes) {
41
+ AuthenticationModes["Forms"] = "Forms";
42
+ AuthenticationModes["UAEPass"] = "UAEPass";
43
+ AuthenticationModes["WindowsAD"] = "WindowsAD";
44
+ AuthenticationModes["AzureAD"] = "AzureAD";
45
+ })(AuthenticationModes || (AuthenticationModes = {}));
56
46
 
57
- class EnvironmentService {
58
- getEnvironmentObject() {
59
- return environment;
47
+ class AppearanceConfigurationService {
48
+ constructor(configService) {
49
+ this.configService = configService;
60
50
  }
61
- getBaseUrl() {
62
- let Url = environment["BBSF_BaseURL"];
63
- return Url;
51
+ getLayoutTheme() {
52
+ return this.configService.getConfigurationValue('AnonymousLayout_Theme');
64
53
  }
65
- getApiUrl() {
66
- let Url = environment["BBSF_ApiUrl"];
67
- return Url;
54
+ getFooterText() {
55
+ return this.configService.getConfigurationValue('AnonymousLayout_FooterText');
68
56
  }
69
- getProductionMode() {
70
- let Mode = environment["BBSF_IsProduction"];
71
- return Mode;
57
+ getPageTitle() {
58
+ return this.configService.getConfigurationValue('AnonymousLayout_PageTitle');
72
59
  }
73
- getDefaultLanguage() {
74
- let Mode = environment["BBSF_DefaultLanguage"];
75
- return Mode;
60
+ getFavIcon() {
61
+ return this.configService.getConfigurationValue('AnonymousLayout_FavIcon');
76
62
  }
77
- getIdentityServerUrl() {
78
- let Url = environment["BBSF_IdentityServerUrl"];
79
- return Url;
63
+ getCustomStyles() {
64
+ return this.configService.getConfigurationValue('AnonymousLayout_CustomStyles');
80
65
  }
81
- getIsIdentityServerExternal() {
82
- let Mode = environment["BBSF_IsExternalIdentityServer"];
83
- return Mode;
66
+ getLogo() {
67
+ return this.configService.getConfigurationValue('AnonymousLayout_Logo');
84
68
  }
85
- getIsIdentityServerClientId() {
86
- let Mode = environment["BBSF_IdentityServer_Client_Id"];
87
- return Mode;
69
+ }
70
+ AppearanceConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AppearanceConfigurationService, deps: [{ token: ConfigurationService }], target: i0.ɵɵFactoryTarget.Injectable });
71
+ AppearanceConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AppearanceConfigurationService, providedIn: 'root' });
72
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AppearanceConfigurationService, decorators: [{
73
+ type: Injectable,
74
+ args: [{
75
+ providedIn: 'root'
76
+ }]
77
+ }], ctorParameters: function () { return [{ type: ConfigurationService }]; } });
78
+
79
+ class ConfigurationService {
80
+ constructor(httpClient) {
81
+ this.httpClient = httpClient;
82
+ this.httpClient.get("./assets/config/configurations.json").subscribe(data => {
83
+ ConfigurationService.JsonData = data;
84
+ });
88
85
  }
89
- getIsIdentityServerClientSecret() {
90
- let Mode = environment["BBSF_IdentityServer_Client_Secret"];
91
- return Mode;
86
+ getConfigurationValue(key) {
87
+ return ConfigurationService.JsonData[key];
92
88
  }
93
89
  }
94
- EnvironmentService.AreaList = [];
95
- EnvironmentServiceprov = i0.ɵɵdefineInjectable({ factory: function EnvironmentService_Factory() { return new EnvironmentService(); }, token: EnvironmentService, providedIn: "root" });
96
- EnvironmentService.decorators = [
97
- { type: Injectable, args: [{
98
- providedIn: 'root'
99
- },] }
100
- ];
90
+ ConfigurationService.JsonData = [];
91
+ ConfigurationServicefac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ConfigurationService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
92
+ ConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ConfigurationService, providedIn: 'root' });
93
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ConfigurationService, decorators: [{
94
+ type: Injectable,
95
+ args: [{
96
+ providedIn: 'root'
97
+ }]
98
+ }], ctorParameters: function () { return [{ type: i1.HttpClient }]; } });
101
99
 
102
- class UtilityService {
103
- constructor(translator, environmentService) {
104
- this.translator = translator;
105
- this.environmentService = environmentService;
106
- this.isCreatedBefore = false;
100
+ class AreaModel {
101
+ }
102
+
103
+ class ErrorModel {
104
+ }
105
+
106
+ class RequestOptionsModel {
107
+ constructor() {
108
+ this.disableSuccessNotification = false;
109
+ this.disableBlockUI = false;
110
+ this.disableErrorHandler = false;
111
+ this.responseType = "";
112
+ this.formGroup = null;
113
+ this.castResponsetoClass = true;
107
114
  }
108
- getResourceValue(Key) {
109
- let ResourceValue = this.translator.instant(Key);
110
- return ResourceValue;
115
+ }
116
+
117
+ class WordDocumentModel {
118
+ constructor() {
119
+ this.options = new DocumentOptionsModel();
111
120
  }
112
- getCurrentLanguage() {
113
- let currentLanguage = this.environmentService.getDefaultLanguage();
114
- let lang = localStorage.getItem('language');
115
- if (lang)
116
- currentLanguage = lang;
117
- else
118
- localStorage.setItem('language', currentLanguage);
119
- return currentLanguage;
121
+ }
122
+ class DocumentOptionsModel {
123
+ }
124
+
125
+ class ControlValidationService {
126
+ constructor(utilityService) {
127
+ this.utilityService = utilityService;
128
+ this.requestOptions = new RequestOptionsModel();
129
+ this.isCreatedBefor = false;
120
130
  }
121
- isCurrentLanguageEnglish() {
122
- return this.getCurrentLanguage() == "en";
131
+ showGlobalError(errorMessage, formId, deleteOld) {
132
+ let globalErorrElement = document.getElementsByClassName('alert alert-InvalidValidation bg-light-danger text-danger');
133
+ if (globalErorrElement.length > 0) {
134
+ this.removeElementsByClass('alert alert-InvalidValidation bg-light-danger text-danger');
135
+ }
136
+ if (this.isCreatedBefor == true) {
137
+ this.removeElementsByClass('alert alert-InvalidValidation bg-light-danger text-danger');
138
+ }
139
+ // tslint:disable-next-line: prefer-const
140
+ if (!formId)
141
+ formId = "currentForm";
142
+ var object = document.getElementById(formId);
143
+ const tagName = 'div';
144
+ // tslint:disable-next-line: prefer-const
145
+ var elementToAppend = document.createElement(tagName); // Your tag name here
146
+ let message = "";
147
+ if (!errorMessage || (typeof errorMessage == "string")) {
148
+ if (localStorage.getItem('language') == "ar")
149
+ message = errorMessage ? errorMessage : "لديك بعص الأخطاء . من فضلك قم بالمراجعه ";
150
+ else
151
+ message = errorMessage ? errorMessage : "You have some validation errors. Please check below";
152
+ 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>";
153
+ elementToAppend.className += 'alert alert-InvalidValidation bg-light-danger text-danger';
154
+ elementToAppend.id += 'errorId';
155
+ // tslint:disable-next-line: prefer-for-of
156
+ const elementToAppen = elementToAppend.cloneNode(true);
157
+ // let targetElement = object.getElementsByClassName("b-control")[0];
158
+ object.insertBefore(elementToAppen, object.firstChild);
159
+ }
160
+ else {
161
+ let ul = document.createElement("ul");
162
+ elementToAppend.appendChild(ul);
163
+ for (const iterator of errorMessage) {
164
+ let li = document.createElement("li");
165
+ li.innerHTML = iterator;
166
+ ul.appendChild(li);
167
+ }
168
+ elementToAppend.className += 'alert alert-InvalidValidation bg-light-danger text-danger';
169
+ elementToAppend.id += 'errorId';
170
+ // tslint:disable-next-line: prefer-for-of
171
+ const elementToAppen = elementToAppend.cloneNode(true);
172
+ // let targetElement = object.getElementsByClassName("b-control")[0];
173
+ object.insertBefore(elementToAppen, object.firstChild);
174
+ }
175
+ this.isCreatedBefor = true;
123
176
  }
124
- isCurrentLanguageArabic() {
125
- return this.getCurrentLanguage() == "ar";
177
+ removeGlobalError() {
178
+ const removedList = document.getElementsByClassName('alert alert-InvalidValidation bg-light-danger text-danger');
179
+ // tslint:disable-next-line: prefer-for-of
180
+ for (let index = 0; index < removedList.length; index++) {
181
+ const element = removedList[index];
182
+ element.remove();
183
+ }
184
+ this.isCreatedBefor = false;
126
185
  }
127
- notifySuccessMessage(Message, title, time, showHeader = true) {
128
- let MessageTemplate = this.getResourceValue("SuccessMessage");
129
- let titleTemplate;
130
- if (Message) {
131
- MessageTemplate = Message;
186
+ showInputErro(errors) {
187
+ // show error on top of form
188
+ this.showGlobalError();
189
+ // remove old error from server
190
+ this.removeElementsByClass('errortemplet');
191
+ // Looping in error Object
192
+ for (const key in errors) {
193
+ if (errors.hasOwnProperty(key)) {
194
+ for (const iterator of errors[key]) {
195
+ const input = document.querySelectorAll('[ng-reflect-name=' + key + ']')[0];
196
+ if (input.attributes['ng-reflect-name'].value === key) {
197
+ this.removeElementsByClass('erroclass-' + key);
198
+ const tagName = 'p';
199
+ const elementToAppend = document.createElement(tagName); // Your tag name here
200
+ elementToAppend.innerHTML = iterator;
201
+ elementToAppend.style.color = 'red';
202
+ elementToAppend.className += 'errortemplet erroclass-' + key;
203
+ const elementToappen = elementToAppend.cloneNode(true);
204
+ input.parentNode.insertBefore(elementToappen, input.lastChild);
205
+ break;
206
+ }
207
+ }
208
+ }
132
209
  }
133
- if (title) {
134
- titleTemplate = title;
210
+ }
211
+ removeElementsByClass(className) {
212
+ const elements = document.getElementsByClassName(className);
213
+ while (elements.length > 0) {
214
+ elements[0].parentNode.removeChild(elements[0]);
135
215
  }
136
- let toaster = AppInjector.get(ToastrService);
137
- showHeader ? toaster.success(MessageTemplate, titleTemplate) : toaster.success(MessageTemplate);
138
216
  }
139
- notifyErrorMessage(Message, title, time, showHeader = true) {
140
- let MessageTemplate = this.getResourceValue("ErrorMessage");
141
- let titleTemplate = this.getResourceValue("Error");
142
- if (Message) {
143
- MessageTemplate = Message;
217
+ renderServerErrors(form, err, requestOptions, formId) {
218
+ if (err.error == null) {
219
+ return;
144
220
  }
145
- if (title) {
146
- titleTemplate = title;
221
+ let errorsArray = [];
222
+ this.requestOptions = requestOptions;
223
+ if (err.error.validation_errors) {
224
+ err.error.validation_errors.forEach((element) => {
225
+ let fieldName = element.field;
226
+ let controlName = element.controlName;
227
+ let message = element.message;
228
+ if (form == null) {
229
+ this.requestOptions.customErrorMessage ? this.utilityService.notifyErrorMessage(this.requestOptions.customErrorMessage) : this.utilityService.notifyErrorMessage(`${message}`);
230
+ }
231
+ else if (controlName && !this.hasControlName(form, controlName)) {
232
+ errorsArray.push(`${fieldName}: ${message}`);
233
+ }
234
+ else {
235
+ this.setFieldError(form, controlName, fieldName, message);
236
+ this.showGlobalError(null, formId);
237
+ }
238
+ });
239
+ if (errorsArray.length > 0)
240
+ this.showGlobalError(errorsArray, formId);
147
241
  }
148
- const toaster = AppInjector.get(ToastrService);
149
- showHeader ? toaster.error(MessageTemplate, titleTemplate) : toaster.error(MessageTemplate);
150
242
  }
151
- notifyWarningMessage(Message, title, time, showHeader = true) {
152
- let MessageTemplate = this.getResourceValue("WarningMessage");
153
- let titleTemplate = this.getResourceValue("Warning");
154
- if (Message) {
155
- MessageTemplate = Message;
243
+ hasControlName(form, controlName) {
244
+ let control = form.get(controlName);
245
+ return control != null;
246
+ }
247
+ setFieldError(form, controlName, fieldName, message) {
248
+ let control = null;
249
+ if (controlName)
250
+ control = this.getControlFormNameByFieldName(form, controlName);
251
+ else
252
+ control = this.getControlFormNameByFieldName(form, fieldName.split('.')[0]);
253
+ let errors = { "errorMassage": message };
254
+ let fieldNameArray = fieldName.split('.');
255
+ if (fieldNameArray.length >= 1) {
256
+ switch (fieldNameArray[fieldNameArray.length - 1].toLocaleLowerCase()) {
257
+ case "english":
258
+ let englishControl = control.get("English");
259
+ englishControl.setErrors(errors);
260
+ break;
261
+ case "arabic":
262
+ let arabicControl = control.get("Arabic");
263
+ arabicControl.setErrors(errors);
264
+ break;
265
+ default:
266
+ control.setErrors(errors);
267
+ }
156
268
  }
157
- if (title) {
158
- titleTemplate = title;
269
+ else {
270
+ this.requestOptions.customErrorMessage ? this.utilityService.notifyErrorMessage(this.requestOptions.customErrorMessage) : this.utilityService.notifyErrorMessage(`${message}`);
159
271
  }
160
- const toaster = AppInjector.get(ToastrService);
161
- showHeader ? toaster.warning(MessageTemplate, titleTemplate) : toaster.warning(MessageTemplate);
162
- }
163
- startBlockUI() {
164
- this.blockUI.start();
165
272
  }
166
- stopBlockUI() {
167
- this.blockUI.stop();
273
+ getControlFormNameByFieldName(form, fieldName) {
274
+ const formControls = form.controls;
275
+ let controlName = Object.keys(formControls).find(c => c.toLocaleLowerCase() === fieldName.toLocaleLowerCase());
276
+ let control = form.get(controlName);
277
+ return control;
168
278
  }
169
279
  }
170
- UtilityServiceprov = i0.ɵɵdefineInjectable({ factory: function UtilityService_Factory() { return new UtilityService(i0.ɵɵinject(BBSFTranslateService), i0.ɵɵinject(EnvironmentService)); }, token: UtilityService, providedIn: "root" });
171
- UtilityService.decorators = [
172
- { type: Injectable, args: [{
173
- providedIn: 'root'
174
- },] }
175
- ];
176
- UtilityService.ctorParameters = () => [
177
- { type: BBSFTranslateService },
178
- { type: EnvironmentService }
179
- ];
280
+ ControlValidationServicefac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ControlValidationService, deps: [{ token: UtilityService }], target: i0.ɵɵFactoryTarget.Injectable });
281
+ ControlValidationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ControlValidationService, providedIn: 'root' });
180
282
  __decorate([
181
283
  BlockUI()
182
- ], UtilityService.prototype, "blockUI", void 0);
284
+ ], ControlValidationService.prototype, "blockUI", void 0);
285
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ControlValidationService, decorators: [{
286
+ type: Injectable,
287
+ args: [{
288
+ providedIn: 'root'
289
+ }]
290
+ }], ctorParameters: function () { return [{ type: UtilityService }]; }, propDecorators: { blockUI: [] } });
183
291
 
184
- class User {
185
- }
292
+ // This file can be replaced during build by using the `fileReplacements` array.
293
+ // `ng build ---prod` replaces `environment.ts` with `environment.prod.ts`.
294
+ // The list of file replacements can be found in `angular.json`.
295
+ const environment = Object.assign({}, window.Environment);
296
+ /*
297
+ * In development mode, to ignore zone related error stack frames such as
298
+ * `zone.run`, `zoneDelegate.invokeTask` for easier debugging, you can
299
+ * import the following file, but please comment it out in production mode
300
+ * because it will have performance impact when throw error
301
+ */
302
+ // import 'zone.js/dist/zone-error'; // Included with Angular CLI.
186
303
 
187
- const TOKEN_KEY = 'access_token';
188
- class AuthService {
189
- constructor(injector, http, environmentService, translateService, router, cookieService, utilityService) {
190
- this.injector = injector;
191
- this.http = http;
192
- this.environmentService = environmentService;
193
- this.translateService = translateService;
194
- this.router = router;
195
- this.cookieService = cookieService;
196
- this.utilityService = utilityService;
197
- this.redirectUrl = '';
198
- this.jwtHelper = new JwtHelperService();
199
- this.isAuthenticatedSubject = new BehaviorSubject(this.hasToken());
200
- this.isAuthenticate$ = this.isAuthenticatedSubject.asObservable();
201
- this.user = this.getUserManager();
304
+ class EnvironmentService {
305
+ getEnvironmentObject() {
306
+ return environment;
202
307
  }
203
- hasToken() {
204
- const token = this.cookieService.get(TOKEN_KEY);
205
- return token && !this.jwtHelper.isTokenExpired(token);
308
+ getBaseUrl() {
309
+ return environment["BBSF_BaseURL"];
206
310
  }
207
- getUserManager() {
208
- const token = this.cookieService.get(TOKEN_KEY);
209
- if (token)
210
- this.handleAccessTokenWithoutLanguage(token);
211
- return AuthService.user;
311
+ getApiUrl() {
312
+ return environment["BBSF_ApiUrl"];
212
313
  }
213
- getUser() {
214
- this.user = AuthService.user;
314
+ getProductionMode() {
315
+ return environment["BBSF_IsProduction"];
215
316
  }
216
- storUser(User) {
217
- AuthService.user = this.user = this.user;
317
+ getDefaultLanguage() {
318
+ return environment["BBSF_DefaultLanguage"];
218
319
  }
219
- getCurrentUser() {
220
- return AuthService.user;
320
+ getIdentityServerUrl() {
321
+ return environment["BBSF_IdentityServerUrl"];
221
322
  }
222
- isAuthenticated() {
223
- return __awaiter(this, void 0, void 0, function* () {
224
- return AuthService.user != null && !this.jwtHelper.isTokenExpired(AuthService.user.access_token);
225
- });
323
+ getIsIdentityServerExternal() {
324
+ return environment["BBSF_IsExternalIdentityServer"];
226
325
  }
227
- isUserInRole(allowedPermission) {
228
- let selectedPermissionSetID = Number.parseInt(this.user.profile['selectedpermissionsetid']);
229
- return allowedPermission.includes(selectedPermissionSetID);
326
+ getIsIdentityServerClientId() {
327
+ return environment["BBSF_IdentityServer_Client_Id"];
230
328
  }
231
- authorizationHeaderValue() {
232
- return AuthService.user
233
- ? `${AuthService.user.token_type} ${AuthService.user.access_token}`
234
- : '';
329
+ getIsIdentityServerClientSecret() {
330
+ return environment["BBSF_IdentityServer_Client_Secret"];
235
331
  }
236
- name() {
237
- return AuthService.user != null ? AuthService.user.profile.given_name : '';
332
+ getBBSFAuthenticationMode() {
333
+ let Mode = environment["BBSF_AuthenticationMode"];
334
+ return Mode;
238
335
  }
239
- setUrl(url) {
240
- localStorage.setItem('redirectUrl', url);
336
+ getUAEPassBaseUrl() {
337
+ let Mode = environment["UAEPass_BaseUrl"];
338
+ return Mode;
241
339
  }
242
- getUrl() {
243
- var _a;
244
- return (_a = localStorage.getItem('redirectUrl')) !== null && _a !== void 0 ? _a : "/";
340
+ getUAEPassClientID() {
341
+ let Mode = environment["UAEPass_ClientID"];
342
+ return Mode;
245
343
  }
246
- signout() {
247
- AuthService.timers.map(t => clearInterval(t));
248
- AuthService.timers = [];
249
- if (!this.isAuthenticated()) {
250
- this.cookieService.delete(TOKEN_KEY);
251
- this.router.navigate(['/Admin/account/login']);
252
- }
253
- this.logout().subscribe(res => {
254
- this.cookieService.delete(TOKEN_KEY);
255
- this.router.navigate(['/Admin/account/login']);
256
- });
344
+ getUAEPassRedirectUrl() {
345
+ let Mode = environment["UAEPass_RedirectUrl"];
346
+ return Mode;
257
347
  }
258
- logout() {
259
- const httpOptions = {
260
- headers: new HttpHeaders({
261
- 'Content-Type': 'application/json',
262
- }),
263
- };
264
- let ApiUrl = '/Account/';
265
- return this.http.get(this.environmentService.getApiUrl() + ApiUrl + 'Logout', httpOptions);
348
+ getUAEPassAuthorizationEndPoint() {
349
+ let Mode = environment["UAEPass_AuthorizationEndPoint"];
350
+ return Mode;
266
351
  }
267
- clearUserSessionClaims() {
268
- const httpOptions = {
269
- headers: new HttpHeaders({
270
- 'Content-Type': 'application/json',
271
- }),
272
- };
273
- let ApiUrl = '/api/Home/';
274
- return this.http.get(this.environmentService.getBaseUrl() + ApiUrl + 'ClearCurrentUserSession', httpOptions);
352
+ getUAEPassRedirectLogoutUrl() {
353
+ let Mode = environment["UAEPass_RedirectLogoutUrl"];
354
+ return Mode;
275
355
  }
276
- handleAccessToken(response) {
277
- return __awaiter(this, void 0, void 0, function* () {
278
- const token = response;
279
- AuthService.user = new User();
280
- AuthService.user.token_type = "Bearer";
281
- AuthService.user.access_token = token;
282
- AuthService.user.profile = this.jwtHelper.decodeToken(token);
283
- AuthService.user.expires_at = this.jwtHelper.getTokenExpirationDate(token);
284
- AuthService.timers.map(t => clearInterval(t));
285
- AuthService.timers = [];
286
- this.setTokenSeconds();
287
- AuthService.timers.push(this.checkRefreshToken());
288
- this.user = AuthService.user;
289
- yield this.updateLanguage();
290
- this.cookieService.set(TOKEN_KEY, token, null, null, null, true, 'Strict');
291
- this.isAuthenticatedSubject.next(true);
292
- });
356
+ getUAEPassLogoutEndPoint() {
357
+ let Mode = environment["UAEPass_LogoutEndPoint"];
358
+ return Mode;
293
359
  }
294
- handleAccessTokenWithoutLanguage(response) {
295
- const token = response;
296
- AuthService.user = new User();
297
- AuthService.user.token_type = "Bearer";
298
- AuthService.user.access_token = token;
299
- AuthService.user.profile = this.jwtHelper.decodeToken(token);
300
- AuthService.user.expires_at = this.jwtHelper.getTokenExpirationDate(token);
301
- this.setTokenSeconds();
302
- this.user = AuthService.user;
303
- this.cookieService.set(TOKEN_KEY, token, null, null, null, true, 'Strict');
304
- this.isAuthenticatedSubject.next(true);
360
+ getIsEnableWindowsAuthentication() {
361
+ let Mode = environment["BBSF_Enable_WindowsAuthentication"];
362
+ return Mode.toLocaleLowerCase() == 'true';
305
363
  }
306
- updateLanguage() {
307
- return __awaiter(this, void 0, void 0, function* () {
308
- if (!localStorage.getItem('language') ||
309
- localStorage.getItem('language') == this.user.profile.locale)
310
- localStorage.setItem('language', this.user.profile.locale);
311
- if (this.translateService.currentLang != localStorage.getItem('language')) {
312
- this.translateService.resetLang(this.translateService.currentLang);
313
- yield this.translateService
314
- .reloadLang(localStorage.getItem('language'))
315
- .subscribe((res) => {
316
- console.log(res);
317
- });
318
- }
364
+ }
365
+ EnvironmentService.areaList = [];
366
+ EnvironmentService.AreaList = [];
367
+ EnvironmentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: EnvironmentService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
368
+ EnvironmentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: EnvironmentService, providedIn: 'root' });
369
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: EnvironmentService, decorators: [{
370
+ type: Injectable,
371
+ args: [{
372
+ providedIn: 'root'
373
+ }]
374
+ }] });
375
+
376
+ class MasterLayoutService {
377
+ constructor(router, http, authService, stylesBundleService, translate, environmentService) {
378
+ this.router = router;
379
+ this.http = http;
380
+ this.authService = authService;
381
+ this.stylesBundleService = stylesBundleService;
382
+ this.translate = translate;
383
+ this.environmentService = environmentService;
384
+ this.apiUrl = '/api/Home/';
385
+ }
386
+ switchLang(lang, bundleEnglishName, bundleArabicName) {
387
+ this.changeLanguage(lang).subscribe((result) => {
388
+ this.updateUserInfo().subscribe((Value) => {
389
+ let UserInfoObject = Value;
390
+ this.authService.handleAccessToken(UserInfoObject.token);
391
+ this.stylesBundleService.loadThemes(lang, bundleEnglishName, bundleArabicName);
392
+ localStorage.setItem('language', lang);
393
+ this.translate.use(lang);
394
+ });
319
395
  });
320
396
  }
321
- checkRefreshToken() {
322
- let date = new Date();
323
- return setInterval(() => {
324
- if (Math.floor(AuthService.seconds) < 120 && this.isAuthenticated())
325
- this.refresh();
326
- AuthService.seconds--;
327
- }, 1000);
397
+ reloadComponent() {
398
+ let currentUrl = this.router.url;
399
+ this.router.routeReuseStrategy.shouldReuseRoute = () => false;
400
+ this.router.onSameUrlNavigation = 'reload';
401
+ this.router.navigate([currentUrl]);
328
402
  }
329
- setTokenSeconds() {
330
- let date = new Date();
331
- AuthService.seconds = (AuthService.user.expires_at - date) / 1000;
403
+ changeLanguage(key) {
404
+ let params = new HttpParams();
405
+ params = params.append('UserId', this.authService.user.profile.id);
406
+ params = params.append('LanguageKey', key);
407
+ return this.http.post(this.apiUrl + 'UpdateLanguage', null, null, params);
332
408
  }
333
- refresh() {
334
- const httpOptions = {
335
- headers: new HttpHeaders({
336
- 'Content-Type': 'application/json',
337
- 'Authorization': this.authorizationHeaderValue(),
338
- }),
339
- };
340
- let ApiUrl = '/api/Home/';
341
- this.http.get(this.environmentService.getApiUrl() + ApiUrl + 'RefreshAccessToken', httpOptions).subscribe((res) => {
342
- this.cookieService.delete(TOKEN_KEY);
343
- this.handleAccessTokenWithoutLanguage(res.val);
409
+ logError(error) {
410
+ let params = new HttpParams();
411
+ params = params.append('error', error);
412
+ return this.http.post(this.apiUrl + 'LogError', null, null, params);
413
+ }
414
+ updateUserInfo() {
415
+ return this.http.get(this.apiUrl + 'UpdateUserInfo', null, null);
416
+ }
417
+ switchRole(permissionSetID) {
418
+ this.updateRole(permissionSetID).subscribe((result) => {
419
+ this.updateUserInfo().subscribe((Value) => {
420
+ let UserInfoObject = Value;
421
+ this.authService.handleAccessToken(UserInfoObject.token);
422
+ });
344
423
  });
345
424
  }
346
- }
347
- AuthService.user = null;
348
- AuthService.UserClaims = null;
349
- //refresh
350
- AuthService.timers = [];
351
- AuthService.seconds = 0;
352
- AuthService.ɵprov = i0.ɵɵdefineInjectable({ factory: function AuthService_Factory() { return new AuthService(i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(i1$1.HttpClient), i0.ɵɵinject(EnvironmentService), i0.ɵɵinject(BBSFTranslateService), i0.ɵɵinject(i4.Router), i0.ɵɵinject(i5.CookieService), i0.ɵɵinject(UtilityService)); }, token: AuthService, providedIn: "root" });
353
- AuthService.decorators = [
354
- { type: Injectable, args: [{
355
- providedIn: 'root',
356
- },] }
357
- ];
358
- AuthService.ctorParameters = () => [
359
- { type: Injector },
360
- { type: HttpClient },
361
- { type: EnvironmentService },
362
- { type: BBSFTranslateService },
363
- { type: Router },
364
- { type: CookieService },
365
- { type: UtilityService }
366
- ];
367
-
368
- class RequestOptionsModel {
369
- constructor() {
370
- this.disableSuccessNotification = false;
371
- this.disableBlockUI = false;
372
- this.disableErrorHandler = false;
373
- this.responseType = "";
374
- this.formGroup = null;
375
- this.castResponsetoClass = true;
425
+ updateRole(permissionSetID) {
426
+ let params = new HttpParams();
427
+ params = params.append('UserId', this.authService.user.profile.id);
428
+ params = params.append('RoleID', permissionSetID);
429
+ return this.http.post(this.apiUrl + 'SwitchRole', null, null, params);
376
430
  }
377
- }
431
+ }
432
+ MasterLayoutService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MasterLayoutService, deps: [{ token: i1$1.Router }, { token: RequestHandlerService }, { token: AuthService }, { token: StylesBundleService }, { token: i4.TranslateService }, { token: EnvironmentService }], target: i0.ɵɵFactoryTarget.Injectable });
433
+ MasterLayoutService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MasterLayoutService, providedIn: 'root' });
434
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MasterLayoutService, decorators: [{
435
+ type: Injectable,
436
+ args: [{
437
+ providedIn: 'root',
438
+ }]
439
+ }], ctorParameters: function () { return [{ type: i1$1.Router }, { type: RequestHandlerService }, { type: AuthService }, { type: StylesBundleService }, { type: i4.TranslateService }, { type: EnvironmentService }]; } });
378
440
 
379
441
  class RequestHandlerService {
380
442
  constructor(http, authService, environmentService, utilityService, bbsfTranslateService, router) {
381
- //using localStorage to avoid call getCurrentLanguage() because it is not all to use async in constructor
382
443
  this.http = http;
383
444
  this.authService = authService;
384
445
  this.environmentService = environmentService;
@@ -388,6 +449,7 @@ class RequestHandlerService {
388
449
  this.requestOptions = new RequestOptionsModel();
389
450
  this.currentLanguage = "";
390
451
  this.onDestroy$ = new Subject();
452
+ //using localStorage to avoid call getCurrentLanguage() because it is not all to use async in constructor
391
453
  this.bbsfTranslateService.onLangChange.subscribe((event) => {
392
454
  if (this.currentLanguage != event.lang) {
393
455
  this.currentLanguage = event.lang;
@@ -409,7 +471,6 @@ class RequestHandlerService {
409
471
  let headers = this.getHeaders();
410
472
  if (!this.requestOptions.disableBlockUI)
411
473
  this.utilityService.startBlockUI();
412
- let object;
413
474
  return this.http.get(this.environmentService.getApiUrl() + Url, { headers: headers, params: params }).pipe(takeUntil(this.onDestroy$), tap((result) => {
414
475
  if (!this.requestOptions.disableBlockUI)
415
476
  this.utilityService.stopBlockUI();
@@ -559,17 +620,11 @@ class RequestHandlerService {
559
620
  });
560
621
  }
561
622
  }
562
- RequestHandlerService.decorators = [
563
- { type: Injectable }
564
- ];
565
- RequestHandlerService.ctorParameters = () => [
566
- { type: HttpClient },
567
- { type: AuthService },
568
- { type: EnvironmentService },
569
- { type: UtilityService },
570
- { type: BBSFTranslateService },
571
- { type: Router }
572
- ];
623
+ RequestHandlerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: RequestHandlerService, deps: [{ token: i1.HttpClient }, { token: AuthService }, { token: EnvironmentService }, { token: UtilityService }, { token: BBSFTranslateService }, { token: i1$1.Router }], target: i0.ɵɵFactoryTarget.Injectable });
624
+ RequestHandlerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: RequestHandlerService });
625
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: RequestHandlerService, decorators: [{
626
+ type: Injectable
627
+ }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: AuthService }, { type: EnvironmentService }, { type: UtilityService }, { type: BBSFTranslateService }, { type: i1$1.Router }]; } });
573
628
 
574
629
  class StylesBundleService {
575
630
  constructor(document, translateService) {
@@ -610,366 +665,116 @@ class StylesBundleService {
610
665
  head.appendChild(style);
611
666
  }
612
667
  }
613
- StylesBundleService.ɵprov = i0.ɵɵdefineInjectable({ factory: function StylesBundleService_Factory() { return new StylesBundleService(i0.ɵɵinject(i1$2.DOCUMENT), i0.ɵɵinject(BBSFTranslateService)); }, token: StylesBundleService, providedIn: "root" });
614
- StylesBundleService.decorators = [
615
- { type: Injectable, args: [{
616
- providedIn: 'root'
617
- },] }
618
- ];
619
- StylesBundleService.ctorParameters = () => [
620
- { type: Document, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
621
- { type: BBSFTranslateService }
622
- ];
623
-
624
- class ControlValidationService {
625
- constructor(utilityService) {
626
- this.utilityService = utilityService;
627
- this.requestOptions = new RequestOptionsModel();
628
- this.isCreatedBefor = false;
629
- }
630
- showGlobalError(errorMessage, formId, deleteOld) {
631
- let globalErorrElement = document.getElementsByClassName('alert alert-InvalidValidation bg-light-danger text-danger');
632
- if (globalErorrElement.length > 0) {
633
- this.removeElementsByClass('alert alert-InvalidValidation bg-light-danger text-danger');
634
- }
635
- if (this.isCreatedBefor == true) {
636
- this.removeElementsByClass('alert alert-InvalidValidation bg-light-danger text-danger');
637
- }
638
- // tslint:disable-next-line: prefer-const
639
- if (!formId)
640
- formId = "currentForm";
641
- var object = document.getElementById(formId);
642
- const tagName = 'div';
643
- // tslint:disable-next-line: prefer-const
644
- var elementToAppend = document.createElement(tagName); // Your tag name here
645
- let message = "";
646
- if (!errorMessage || (typeof errorMessage == "string")) {
647
- if (localStorage.getItem('language') == "ar")
648
- message = errorMessage ? errorMessage : "لديك بعص الأخطاء . من فضلك قم بالمراجعه ";
649
- else
650
- message = errorMessage ? errorMessage : "You have some validation errors. Please check below";
651
- 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>";
652
- elementToAppend.className += 'alert alert-InvalidValidation bg-light-danger text-danger';
653
- elementToAppend.id += 'errorId';
654
- // tslint:disable-next-line: prefer-for-of
655
- const elementToAppen = elementToAppend.cloneNode(true);
656
- // let targetElement = object.getElementsByClassName("b-control")[0];
657
- object.insertBefore(elementToAppen, object.firstChild);
658
- }
659
- else {
660
- let ul = document.createElement("ul");
661
- elementToAppend.appendChild(ul);
662
- for (const iterator of errorMessage) {
663
- let li = document.createElement("li");
664
- li.innerHTML = iterator;
665
- ul.appendChild(li);
666
- }
667
- elementToAppend.className += 'alert alert-InvalidValidation bg-light-danger text-danger';
668
- elementToAppend.id += 'errorId';
669
- // tslint:disable-next-line: prefer-for-of
670
- const elementToAppen = elementToAppend.cloneNode(true);
671
- // let targetElement = object.getElementsByClassName("b-control")[0];
672
- object.insertBefore(elementToAppen, object.firstChild);
673
- }
674
- this.isCreatedBefor = true;
675
- }
676
- RemoveGlobalError() {
677
- const removedList = document.getElementsByClassName('alert alert-InvalidValidation bg-light-danger text-danger');
678
- // tslint:disable-next-line: prefer-for-of
679
- for (let index = 0; index < removedList.length; index++) {
680
- const element = removedList[index];
681
- element.remove();
682
- }
683
- this.isCreatedBefor = false;
684
- }
685
- showInputErro(errors) {
686
- // show error on top of form
687
- this.showGlobalError();
688
- // remove old error from server
689
- this.removeElementsByClass('errortemplet');
690
- // Looping in error Object
691
- for (const key in errors) {
692
- if (errors.hasOwnProperty(key)) {
693
- for (const iterator of errors[key]) {
694
- const input = document.querySelectorAll('[ng-reflect-name=' + key + ']')[0];
695
- if (input.attributes['ng-reflect-name'].value === key) {
696
- this.removeElementsByClass('erroclass-' + key);
697
- const tagName = 'p';
698
- const elementToAppend = document.createElement(tagName); // Your tag name here
699
- elementToAppend.innerHTML = iterator;
700
- elementToAppend.style.color = 'red';
701
- elementToAppend.className += 'errortemplet erroclass-' + key;
702
- const elementToappen = elementToAppend.cloneNode(true);
703
- input.parentNode.insertBefore(elementToappen, input.lastChild);
704
- break;
705
- }
706
- }
707
- }
708
- }
709
- }
710
- removeElementsByClass(className) {
711
- const elements = document.getElementsByClassName(className);
712
- while (elements.length > 0) {
713
- elements[0].parentNode.removeChild(elements[0]);
714
- }
715
- }
716
- renderServerErrors(form, err, requestOptions, formId) {
717
- if (err.error == null) {
718
- return;
719
- }
720
- let errorsArray = [];
721
- this.requestOptions = requestOptions;
722
- if (err.error.validation_errors) {
723
- err.error.validation_errors.forEach((element) => {
724
- let fieldName = element.field;
725
- let controlName = element.controlName;
726
- let message = element.message;
727
- if (form == null) {
728
- this.requestOptions.customErrorMessage ? this.utilityService.notifyErrorMessage(this.requestOptions.customErrorMessage) : this.utilityService.notifyErrorMessage(`${message}`);
729
- }
730
- else if (controlName && !this.hasControlName(form, controlName)) {
731
- errorsArray.push(`${fieldName}: ${message}`);
732
- }
733
- else {
734
- this.setFieldError(form, controlName, fieldName, message);
735
- this.showGlobalError(null, formId);
736
- }
737
- });
738
- if (errorsArray.length > 0)
739
- this.showGlobalError(errorsArray, formId);
740
- }
741
- }
742
- hasControlName(form, controlName) {
743
- let control = form.get(controlName);
744
- return control != null;
745
- }
746
- setFieldError(form, controlName, fieldName, message) {
747
- let control = null;
748
- if (controlName)
749
- control = this.getControlFormNameByFieldName(form, controlName);
750
- else
751
- control = this.getControlFormNameByFieldName(form, fieldName.split('.')[0]);
752
- let errors = { "errorMassage": message };
753
- let fieldNameArray = fieldName.split('.');
754
- if (fieldNameArray.length >= 1) {
755
- switch (fieldNameArray[fieldNameArray.length - 1].toLocaleLowerCase()) {
756
- case "english":
757
- let englishControl = control.get("English");
758
- englishControl.setErrors(errors);
759
- break;
760
- case "arabic":
761
- let arabicControl = control.get("Arabic");
762
- arabicControl.setErrors(errors);
763
- break;
764
- default:
765
- control.setErrors(errors);
766
- }
767
- }
768
- else {
769
- this.requestOptions.customErrorMessage ? this.utilityService.notifyErrorMessage(this.requestOptions.customErrorMessage) : this.utilityService.notifyErrorMessage(`${message}`);
770
- }
771
- }
772
- getControlFormNameByFieldName(form, fieldName) {
773
- const formControls = form.controls;
774
- let controlName = Object.keys(formControls).find(c => c.toLocaleLowerCase() === fieldName.toLocaleLowerCase());
775
- let control = form.get(controlName);
776
- return control;
777
- }
778
- }
779
- ControlValidationService.ɵprov = i0.ɵɵdefineInjectable({ factory: function ControlValidationService_Factory() { return new ControlValidationService(i0.ɵɵinject(UtilityService)); }, token: ControlValidationService, providedIn: "root" });
780
- ControlValidationService.decorators = [
781
- { type: Injectable, args: [{
782
- providedIn: 'root'
783
- },] }
784
- ];
785
- ControlValidationService.ctorParameters = () => [
786
- { type: UtilityService }
787
- ];
788
- __decorate([
789
- BlockUI()
790
- ], ControlValidationService.prototype, "blockUI", void 0);
668
+ StylesBundleService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: StylesBundleService, deps: [{ token: DOCUMENT }, { token: BBSFTranslateService }], target: i0.ɵɵFactoryTarget.Injectable });
669
+ StylesBundleService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: StylesBundleService, providedIn: 'root' });
670
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: StylesBundleService, decorators: [{
671
+ type: Injectable,
672
+ args: [{
673
+ providedIn: 'root'
674
+ }]
675
+ }], ctorParameters: function () {
676
+ return [{ type: Document, decorators: [{
677
+ type: Inject,
678
+ args: [DOCUMENT]
679
+ }] }, { type: BBSFTranslateService }];
680
+ } });
791
681
 
792
- class MasterLayoutService {
793
- constructor(router, http, authService, stylesBundleService, translate, environmentService) {
794
- this.router = router;
795
- this.http = http;
796
- this.authService = authService;
797
- this.stylesBundleService = stylesBundleService;
798
- this.translate = translate;
799
- this.environmentService = environmentService;
800
- this.ApiUrl = '/api/Home/';
801
- }
802
- switchLang(lang, bundleEnglishName, bundleArabicName) {
803
- this.changeLanguage(lang).subscribe((result) => {
804
- this.updateUserInfo().subscribe((Value) => {
805
- let UserInfoObject = Value;
806
- this.authService.handleAccessToken(UserInfoObject.token);
807
- this.stylesBundleService.loadThemes(lang, bundleEnglishName, bundleArabicName);
808
- localStorage.setItem('language', lang);
809
- this.translate.use(lang);
810
- });
811
- });
812
- }
813
- reloadComponent() {
814
- let currentUrl = this.router.url;
815
- this.router.routeReuseStrategy.shouldReuseRoute = () => false;
816
- this.router.onSameUrlNavigation = 'reload';
817
- this.router.navigate([currentUrl]);
818
- }
819
- changeLanguage(key) {
820
- let params = new HttpParams();
821
- params = params.append('UserId', this.authService.user.profile.id);
822
- params = params.append('LanguageKey', key);
823
- return this.http.post(this.ApiUrl + 'UpdateLanguage', null, null, params);
824
- }
825
- getUserClaims() {
826
- return this.http.get(this.ApiUrl + 'GetUserClaims', null, null);
827
- }
828
- logError(error) {
829
- let params = new HttpParams();
830
- params = params.append('error', error);
831
- return this.http.post(this.ApiUrl + 'LogError', null, null, params);
832
- }
833
- updateUserInfo() {
834
- return this.http.get(this.ApiUrl + 'UpdateUserInfo', null, null);
835
- }
836
- switchRole(permissionSetID) {
837
- this.updateRole(permissionSetID).subscribe((result) => {
838
- this.updateUserInfo().subscribe((Value) => {
839
- let UserInfoObject = Value;
840
- this.authService.handleAccessToken(UserInfoObject.token);
841
- });
842
- });
843
- }
844
- updateRole(permissionSetID) {
845
- let params = new HttpParams();
846
- params = params.append('UserId', this.authService.user.profile.id);
847
- params = params.append('RoleID', permissionSetID);
848
- return this.http.post(this.ApiUrl + 'SwitchRole', null, null, params);
849
- }
682
+ class BBSFTranslateService extends TranslateService {
850
683
  }
851
- MasterLayoutServiceprov = i0.ɵɵdefineInjectable({ factory: function MasterLayoutService_Factory() { return new MasterLayoutService(i0.ɵɵinject(i4.Router), i0.ɵɵinject(RequestHandlerService), i0.ɵɵinject(AuthService), i0.ɵɵinject(StylesBundleService), i0.ɵɵinject(i1.TranslateService), i0.ɵɵinject(EnvironmentService)); }, token: MasterLayoutService, providedIn: "root" });
852
- MasterLayoutService.decorators = [
853
- { type: Injectable, args: [{
854
- providedIn: 'root',
855
- },] }
856
- ];
857
- MasterLayoutService.ctorParameters = () => [
858
- { type: Router },
859
- { type: RequestHandlerService },
860
- { type: AuthService },
861
- { type: StylesBundleService },
862
- { type: TranslateService },
863
- { type: EnvironmentService }
864
- ];
684
+ BBSFTranslateServicefac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: BBSFTranslateService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
685
+ BBSFTranslateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: BBSFTranslateService, providedIn: 'root' });
686
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: BBSFTranslateService, decorators: [{
687
+ type: Injectable,
688
+ args: [{
689
+ providedIn: 'root'
690
+ }]
691
+ }] });
865
692
 
866
- class ConfigurationService {
867
- constructor(httpClient) {
868
- this.httpClient = httpClient;
869
- this.httpClient.get("./assets/config/configurations.json").subscribe(data => {
870
- ConfigurationService.JsonData = data;
871
- });
872
- }
873
- getConfigurationValue(key) {
874
- return ConfigurationService.JsonData[key];
875
- }
876
- }
877
- ConfigurationService.JsonData = [];
878
- ConfigurationService.ɵprov = i0.ɵɵdefineInjectable({ factory: function ConfigurationService_Factory() { return new ConfigurationService(i0.ɵɵinject(i1$1.HttpClient)); }, token: ConfigurationService, providedIn: "root" });
879
- ConfigurationService.decorators = [
880
- { type: Injectable, args: [{
881
- providedIn: 'root'
882
- },] }
883
- ];
884
- ConfigurationService.ctorParameters = () => [
885
- { type: HttpClient }
886
- ];
693
+ const TranslationResolverService = () => {
694
+ let translateService = inject(BBSFTranslateService);
695
+ return translateService.getTranslation(translateService.currentLang);
696
+ };
887
697
 
888
- let AppInjector;
889
- class BBSFUtilitiesModule {
890
- constructor(injector) {
698
+ class UtilityService {
699
+ constructor(translator, environmentService, injector) {
700
+ this.translator = translator;
701
+ this.environmentService = environmentService;
891
702
  this.injector = injector;
892
- AppInjector = this.injector;
893
- }
894
- }
895
- BBSFUtilitiesModule.decorators = [
896
- { type: NgModule, args: [{
897
- declarations: [],
898
- imports: [
899
- CommonModule,
900
- BlockUIModule.forRoot(),
901
- HttpModule,
902
- RouterModule,
903
- ToastrModule.forRoot(),
904
- ],
905
- exports: [],
906
- providers: [
907
- UtilityService,
908
- EnvironmentService,
909
- AuthService,
910
- RequestHandlerService,
911
- StylesBundleService,
912
- TranslateService,
913
- BBSFTranslateService,
914
- ControlValidationService,
915
- MasterLayoutService,
916
- ConfigurationService,
917
- CookieService
918
- ]
919
- },] }
920
- ];
921
- BBSFUtilitiesModule.ctorParameters = () => [
922
- { type: Injector }
923
- ];
924
-
925
- class TranslationResolverService {
926
- constructor(translateService) {
927
- this.translateService = translateService;
703
+ this.isCreatedBefore = false;
928
704
  }
929
- resolve() {
930
- return this.translateService.getTranslation(this.translateService.currentLang);
705
+ getResourceValue(Key) {
706
+ let ResourceValue = this.translator.instant(Key);
707
+ return ResourceValue;
931
708
  }
932
- }
933
- TranslationResolverService.ɵprov = i0.ɵɵdefineInjectable({ factory: function TranslationResolverService_Factory() { return new TranslationResolverService(i0.ɵɵinject(BBSFTranslateService)); }, token: TranslationResolverService, providedIn: "root" });
934
- TranslationResolverService.decorators = [
935
- { type: Injectable, args: [{ providedIn: 'root' },] }
936
- ];
937
- TranslationResolverService.ctorParameters = () => [
938
- { type: BBSFTranslateService }
939
- ];
940
-
941
- class AppearanceConfigurationService {
942
- constructor(configService) {
943
- this.configService = configService;
709
+ getCurrentLanguage() {
710
+ let currentLanguage = this.environmentService.getDefaultLanguage();
711
+ let lang = localStorage.getItem('language');
712
+ if (lang)
713
+ currentLanguage = lang;
714
+ else
715
+ localStorage.setItem('language', currentLanguage);
716
+ return currentLanguage;
944
717
  }
945
- getLayoutTheme() {
946
- return this.configService.getConfigurationValue('AnonymousLayout_Theme');
718
+ isCurrentLanguageEnglish() {
719
+ return this.getCurrentLanguage() == "en";
947
720
  }
948
- getFooterText() {
949
- return this.configService.getConfigurationValue('AnonymousLayout_FooterText');
721
+ isCurrentLanguageArabic() {
722
+ return this.getCurrentLanguage() == "ar";
950
723
  }
951
- getPageTitle() {
952
- return this.configService.getConfigurationValue('AnonymousLayout_PageTitle');
724
+ notifySuccessMessage(Message, title, time, showHeader = true) {
725
+ let MessageTemplate = this.getResourceValue("SuccessMessage");
726
+ let titleTemplate;
727
+ if (Message) {
728
+ MessageTemplate = Message;
729
+ }
730
+ if (title) {
731
+ titleTemplate = title;
732
+ }
733
+ let toaster = this.injector.get(ToastrService);
734
+ showHeader ? toaster.success(MessageTemplate, titleTemplate) : toaster.success(MessageTemplate);
953
735
  }
954
- getFavIcon() {
955
- return this.configService.getConfigurationValue('AnonymousLayout_FavIcon');
736
+ notifyErrorMessage(Message, title, time, showHeader = true) {
737
+ let MessageTemplate = this.getResourceValue("ErrorMessage");
738
+ let titleTemplate = this.getResourceValue("Error");
739
+ if (Message) {
740
+ MessageTemplate = Message;
741
+ }
742
+ if (title) {
743
+ titleTemplate = title;
744
+ }
745
+ const toaster = this.injector.get(ToastrService);
746
+ showHeader ? toaster.error(MessageTemplate, titleTemplate) : toaster.error(MessageTemplate);
956
747
  }
957
- getCustomStyles() {
958
- return this.configService.getConfigurationValue('AnonymousLayout_CustomStyles');
748
+ notifyWarningMessage(Message, title, time, showHeader = true) {
749
+ let MessageTemplate = this.getResourceValue("WarningMessage");
750
+ let titleTemplate = this.getResourceValue("Warning");
751
+ if (Message) {
752
+ MessageTemplate = Message;
753
+ }
754
+ if (title) {
755
+ titleTemplate = title;
756
+ }
757
+ const toaster = this.injector.get(ToastrService);
758
+ showHeader ? toaster.warning(MessageTemplate, titleTemplate) : toaster.warning(MessageTemplate);
959
759
  }
960
- getLogo() {
961
- return this.configService.getConfigurationValue('AnonymousLayout_Logo');
760
+ startBlockUI() {
761
+ this.blockUI.start();
762
+ }
763
+ stopBlockUI() {
764
+ this.blockUI.stop();
962
765
  }
963
766
  }
964
- AppearanceConfigurationServiceprov = i0.ɵɵdefineInjectable({ factory: function AppearanceConfigurationService_Factory() { return new AppearanceConfigurationService(i0.ɵɵinject(ConfigurationService)); }, token: AppearanceConfigurationService, providedIn: "root" });
965
- AppearanceConfigurationService.decorators = [
966
- { type: Injectable, args: [{
967
- providedIn: 'root'
968
- },] }
969
- ];
970
- AppearanceConfigurationService.ctorParameters = () => [
971
- { type: ConfigurationService }
972
- ];
767
+ UtilityServicefac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: UtilityService, deps: [{ token: BBSFTranslateService }, { token: EnvironmentService }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
768
+ UtilityService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: UtilityService, providedIn: 'root' });
769
+ __decorate([
770
+ BlockUI()
771
+ ], UtilityService.prototype, "blockUI", void 0);
772
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: UtilityService, decorators: [{
773
+ type: Injectable,
774
+ args: [{
775
+ providedIn: 'root'
776
+ }]
777
+ }], ctorParameters: function () { return [{ type: BBSFTranslateService }, { type: EnvironmentService }, { type: i0.Injector }]; }, propDecorators: { blockUI: [] } });
973
778
 
974
779
  const contentTypesXML = `
975
780
  <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
@@ -1157,8 +962,7 @@ const generateCoreXML = (title = '', subject = '', creator = applicationName, ke
1157
962
  <dcterms:created xsi:type="dcterms:W3CDTF">${createdAt instanceof Date ? createdAt.toISOString() : new Date().toISOString()}</dcterms:created>
1158
963
  <dcterms:modified xsi:type="dcterms:W3CDTF">${modifiedAt instanceof Date ? modifiedAt.toISOString() : new Date().toISOString()}</dcterms:modified>
1159
964
  </cp:coreProperties>
1160
- `;
1161
- const ɵ0$8 = generateCoreXML;
965
+ `;
1162
966
 
1163
967
  const documentRelsXML = `
1164
968
  <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
@@ -1196,8 +1000,7 @@ const generateNumberingXMLTemplate = () => `
1196
1000
  xmlns:w10="${namespaces.w10}"
1197
1001
  xmlns:wne="${namespaces.wne}">
1198
1002
  </w:numbering>
1199
- `;
1200
- const ɵ0$7 = generateNumberingXMLTemplate;
1003
+ `;
1201
1004
 
1202
1005
  const generateStylesXML = (font = defaultFont, fontSize = defaultFontSize, complexScriptFontSize = defaultFontSize) => `
1203
1006
  <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
@@ -1341,8 +1144,7 @@ const generateStylesXML = (font = defaultFont, fontSize = defaultFontSize, compl
1341
1144
  </w:rPr>
1342
1145
  </w:style>
1343
1146
  </w:styles>
1344
- `;
1345
- const ɵ0$6 = generateStylesXML;
1147
+ `;
1346
1148
 
1347
1149
  const fontTableXML = `
1348
1150
  <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
@@ -1576,8 +1378,7 @@ const generateThemeXML = (font = defaultFont) => `
1576
1378
  </a:fmtScheme>
1577
1379
  </a:themeElements>
1578
1380
  </a:theme>
1579
- `;
1580
- const ɵ0$5 = generateThemeXML;
1381
+ `;
1581
1382
 
1582
1383
  const settingsXML = `
1583
1384
  <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
@@ -1639,7 +1440,6 @@ const generateDocumentTemplate = (width, height, orientation, margins) => `
1639
1440
  </w:body>
1640
1441
  </w:document>
1641
1442
  `;
1642
- const ɵ0$4 = generateDocumentTemplate;
1643
1443
  const generateDocumentTemplateHeader = `
1644
1444
  <w:hdr
1645
1445
  xmlns:a="${namespaces.a}"
@@ -1809,8 +1609,7 @@ const vNodeHasChildren = (vNode) => vNode && vNode.children && Array.isArray(vNo
1809
1609
  const isValidUrl = (urlString) => {
1810
1610
  const urlRegex = /http(s)?:\/\/(\w+:?\w*@)?(\S+)(:\d+)?((?<=\.)\w+)+(\/([\w#!:.?+=&%@!\-/])*)?/gi;
1811
1611
  return Boolean(urlRegex.test(urlString));
1812
- };
1813
- const ɵ0$3 = isValidUrl;
1612
+ };
1814
1613
 
1815
1614
  // eslint-disable-next-line consistent-return
1816
1615
  const fixupColorCode = (colorCodeString) => {
@@ -1847,24 +1646,20 @@ const fixupColorCode = (colorCodeString) => {
1847
1646
  return '000000';
1848
1647
  }
1849
1648
  };
1850
- const ɵ0$2 = fixupColorCode;
1851
1649
  const buildRunFontFragment = (fontName = defaultFont) => fragment({ namespaceAlias: { w: namespaces.w } })
1852
1650
  .ele('@w', 'rFonts')
1853
1651
  .att('@w', 'ascii', fontName)
1854
1652
  .att('@w', 'hAnsi', fontName)
1855
1653
  .up();
1856
- const ɵ1$1 = buildRunFontFragment;
1857
1654
  const buildRunStyleFragment = (type = 'Hyperlink') => fragment({ namespaceAlias: { w: namespaces.w } })
1858
1655
  .ele('@w', 'rStyle')
1859
1656
  .att('@w', 'val', type)
1860
1657
  .up();
1861
- const ɵ2$1 = buildRunStyleFragment;
1862
1658
  const buildTableRowHeight = (tableRowHeight) => fragment({ namespaceAlias: { w: namespaces.w } })
1863
1659
  .ele('@w', 'trHeight')
1864
1660
  .att('@w', 'val', tableRowHeight)
1865
1661
  .att('@w', 'hRule', 'atLeast')
1866
1662
  .up();
1867
- const ɵ3$1 = buildTableRowHeight;
1868
1663
  const buildVerticalAlignment = (verticalAlignment) => {
1869
1664
  if (verticalAlignment.toLowerCase() === 'middle') {
1870
1665
  verticalAlignment = 'center';
@@ -1874,61 +1669,49 @@ const buildVerticalAlignment = (verticalAlignment) => {
1874
1669
  .att('@w', 'val', verticalAlignment)
1875
1670
  .up();
1876
1671
  };
1877
- const ɵ4 = buildVerticalAlignment;
1878
1672
  const buildVerticalMerge = (verticalMerge = 'continue') => fragment({ namespaceAlias: { w: namespaces.w } })
1879
1673
  .ele('@w', 'vMerge')
1880
1674
  .att('@w', 'val', verticalMerge)
1881
1675
  .up();
1882
- const ɵ5 = buildVerticalMerge;
1883
1676
  const buildColor = (colorCode) => fragment({ namespaceAlias: { w: namespaces.w } })
1884
1677
  .ele('@w', 'color')
1885
1678
  .att('@w', 'val', colorCode)
1886
1679
  .up();
1887
- const ɵ6 = buildColor;
1888
1680
  const buildFontSize = (fontSize) => fragment({ namespaceAlias: { w: namespaces.w } })
1889
1681
  .ele('@w', 'sz')
1890
1682
  .att('@w', 'val', fontSize)
1891
1683
  .up();
1892
- const ɵ7 = buildFontSize;
1893
1684
  const buildShading = (colorCode) => fragment({ namespaceAlias: { w: namespaces.w } })
1894
1685
  .ele('@w', 'shd')
1895
1686
  .att('@w', 'val', 'clear')
1896
1687
  .att('@w', 'fill', colorCode)
1897
1688
  .up();
1898
- const ɵ8 = buildShading;
1899
1689
  const buildHighlight = (color = 'yellow') => fragment({ namespaceAlias: { w: namespaces.w } })
1900
1690
  .ele('@w', 'highlight')
1901
1691
  .att('@w', 'val', color)
1902
1692
  .up();
1903
- const ɵ9 = buildHighlight;
1904
1693
  const buildVertAlign = (type = 'baseline') => fragment({ namespaceAlias: { w: namespaces.w } })
1905
1694
  .ele('@w', 'vertAlign')
1906
1695
  .att('@w', 'val', type)
1907
1696
  .up();
1908
- const ɵ10 = buildVertAlign;
1909
1697
  const buildStrike = () => fragment({ namespaceAlias: { w: namespaces.w } })
1910
1698
  .ele('@w', 'strike')
1911
1699
  .att('@w', 'val', true)
1912
1700
  .up();
1913
- const ɵ11 = buildStrike;
1914
1701
  const buildBold = () => fragment({ namespaceAlias: { w: namespaces.w } })
1915
1702
  .ele('@w', 'b')
1916
1703
  .up();
1917
- const ɵ12 = buildBold;
1918
1704
  const buildItalics = () => fragment({ namespaceAlias: { w: namespaces.w } })
1919
1705
  .ele('@w', 'i')
1920
1706
  .up();
1921
- const ɵ13 = buildItalics;
1922
1707
  const buildUnderline = (type = 'single') => fragment({ namespaceAlias: { w: namespaces.w } })
1923
1708
  .ele('@w', 'u')
1924
1709
  .att('@w', 'val', type)
1925
1710
  .up();
1926
- const ɵ14 = buildUnderline;
1927
1711
  const buildLineBreak = (type = 'textWrapping') => fragment({ namespaceAlias: { w: namespaces.w } })
1928
1712
  .ele('@w', 'br')
1929
1713
  .att('@w', 'type', type)
1930
1714
  .up();
1931
- const ɵ15 = buildLineBreak;
1932
1715
  const buildBorder = (borderSide = 'top', borderSize = 0, borderSpacing = 0, borderColor = fixupColorCode('black'), borderStroke = 'single') => fragment({ namespaceAlias: { w: namespaces.w } })
1933
1716
  .ele('@w', borderSide)
1934
1717
  .att('@w', 'val', borderStroke)
@@ -1936,13 +1719,11 @@ const buildBorder = (borderSide = 'top', borderSize = 0, borderSpacing = 0, bord
1936
1719
  .att('@w', 'space', borderSpacing)
1937
1720
  .att('@w', 'color', borderColor)
1938
1721
  .up();
1939
- const ɵ16 = buildBorder;
1940
1722
  const buildTextElement = (text) => fragment({ namespaceAlias: { w: namespaces.w } })
1941
1723
  .ele('@w', 't')
1942
1724
  .att('@xml', 'space', 'preserve')
1943
1725
  .txt(text)
1944
1726
  .up();
1945
- const ɵ17 = buildTextElement;
1946
1727
  // eslint-disable-next-line consistent-return
1947
1728
  const fixupLineHeight = (lineHeight, fontSize) => {
1948
1729
  // FIXME: If line height is anything other than a number
@@ -1962,7 +1743,6 @@ const fixupLineHeight = (lineHeight, fontSize) => {
1962
1743
  return 240;
1963
1744
  }
1964
1745
  };
1965
- const ɵ18 = fixupLineHeight;
1966
1746
  // eslint-disable-next-line consistent-return
1967
1747
  const fixupFontSize$1 = (fontSizeString) => {
1968
1748
  if (pointRegex.test(fontSizeString)) {
@@ -1976,7 +1756,6 @@ const fixupFontSize$1 = (fontSizeString) => {
1976
1756
  return pixelToHIP(matchedParts[1]);
1977
1757
  }
1978
1758
  };
1979
- const ɵ19 = fixupFontSize$1;
1980
1759
  // eslint-disable-next-line consistent-return
1981
1760
  const fixupRowHeight = (rowHeightString) => {
1982
1761
  if (pointRegex.test(rowHeightString)) {
@@ -1998,7 +1777,6 @@ const fixupRowHeight = (rowHeightString) => {
1998
1777
  return inchToTWIP(matchedParts[1]);
1999
1778
  }
2000
1779
  };
2001
- const ɵ20 = fixupRowHeight;
2002
1780
  // eslint-disable-next-line consistent-return
2003
1781
  const fixupColumnWidth = (columnWidthString) => {
2004
1782
  if (pointRegex.test(columnWidthString)) {
@@ -2018,7 +1796,6 @@ const fixupColumnWidth = (columnWidthString) => {
2018
1796
  return inchToTWIP(matchedParts[1]);
2019
1797
  }
2020
1798
  };
2021
- const ɵ21 = fixupColumnWidth;
2022
1799
  // eslint-disable-next-line consistent-return
2023
1800
  const fixupMargin = (marginString) => {
2024
1801
  if (pointRegex.test(marginString)) {
@@ -2032,7 +1809,6 @@ const fixupMargin = (marginString) => {
2032
1809
  return pixelToTWIP(matchedParts[1]);
2033
1810
  }
2034
1811
  };
2035
- const ɵ22 = fixupMargin;
2036
1812
  const modifiedStyleAttributesBuilder = (vNode, attributes, options) => {
2037
1813
  const modifiedAttributes = Object.assign({}, attributes);
2038
1814
  // styles
@@ -2100,7 +1876,6 @@ const modifiedStyleAttributesBuilder = (vNode, attributes, options) => {
2100
1876
  }
2101
1877
  return modifiedAttributes;
2102
1878
  };
2103
- const ɵ23 = modifiedStyleAttributesBuilder;
2104
1879
  // html tag to formatting function
2105
1880
  // options are passed to the formatting function if needed
2106
1881
  const buildFormatting = (htmlTag, options) => {
@@ -2143,7 +1918,6 @@ const buildFormatting = (htmlTag, options) => {
2143
1918
  }
2144
1919
  return null;
2145
1920
  };
2146
- const ɵ24 = buildFormatting;
2147
1921
  const buildRunProperties = (attributes) => {
2148
1922
  const runPropertiesFragment = fragment({ namespaceAlias: { w: namespaces.w } }).ele('@w', 'rPr');
2149
1923
  if (attributes && attributes.constructor === Object) {
@@ -2164,7 +1938,6 @@ const buildRunProperties = (attributes) => {
2164
1938
  runPropertiesFragment.up();
2165
1939
  return runPropertiesFragment;
2166
1940
  };
2167
- const ɵ25 = buildRunProperties;
2168
1941
  const buildRun = (vNode, attributes, docxDocumentInstance) => __awaiter(void 0, void 0, void 0, function* () {
2169
1942
  const runFragment = fragment({ namespaceAlias: { w: namespaces.w } }).ele('@w', 'r');
2170
1943
  const runPropertiesFragment = buildRunProperties(cloneDeep(attributes));
@@ -2314,7 +2087,6 @@ const buildRun = (vNode, attributes, docxDocumentInstance) => __awaiter(void 0,
2314
2087
  runFragment.up();
2315
2088
  return runFragment;
2316
2089
  });
2317
- const ɵ26 = buildRun;
2318
2090
  const buildRunOrRuns = (vNode, attributes, docxDocumentInstance) => __awaiter(void 0, void 0, void 0, function* () {
2319
2091
  if (isVNode(vNode) && vNode.tagName === 'span') {
2320
2092
  let runFragments = [];
@@ -2331,7 +2103,6 @@ const buildRunOrRuns = (vNode, attributes, docxDocumentInstance) => __awaiter(vo
2331
2103
  return tempRunFragments;
2332
2104
  }
2333
2105
  });
2334
- const ɵ27 = buildRunOrRuns;
2335
2106
  const buildRunOrHyperLink = (vNode, attributes, docxDocumentInstance) => __awaiter(void 0, void 0, void 0, function* () {
2336
2107
  if (isVNode(vNode) && vNode.tagName === 'a') {
2337
2108
  const relationshipId = docxDocumentInstance.createDocumentRelationships(docxDocumentInstance.relationshipFilename, hyperlinkType, vNode.properties && vNode.properties.href ? vNode.properties.href : '');
@@ -2356,7 +2127,6 @@ const buildRunOrHyperLink = (vNode, attributes, docxDocumentInstance) => __await
2356
2127
  const runFragments = yield buildRunOrRuns(vNode, attributes, docxDocumentInstance);
2357
2128
  return runFragments;
2358
2129
  });
2359
- const ɵ28 = buildRunOrHyperLink;
2360
2130
  const buildNumberingProperties = (levelId, numberingId) => fragment({ namespaceAlias: { w: namespaces.w } })
2361
2131
  .ele('@w', 'numPr')
2362
2132
  .ele('@w', 'ilvl')
@@ -2366,13 +2136,11 @@ const buildNumberingProperties = (levelId, numberingId) => fragment({ namespaceA
2366
2136
  .att('@w', 'val', String(numberingId))
2367
2137
  .up()
2368
2138
  .up();
2369
- const ɵ29 = buildNumberingProperties;
2370
2139
  const buildNumberingInstances = () => fragment({ namespaceAlias: { w: namespaces.w } })
2371
2140
  .ele('@w', 'num')
2372
2141
  .ele('@w', 'abstractNumId')
2373
2142
  .up()
2374
2143
  .up();
2375
- const ɵ30 = buildNumberingInstances;
2376
2144
  const buildSpacing = (lineSpacing, beforeSpacing, afterSpacing) => {
2377
2145
  const spacingFragment = fragment({ namespaceAlias: { w: namespaces.w } }).ele('@w', 'spacing');
2378
2146
  if (lineSpacing) {
@@ -2387,7 +2155,6 @@ const buildSpacing = (lineSpacing, beforeSpacing, afterSpacing) => {
2387
2155
  spacingFragment.att('@w', 'lineRule', 'auto').up();
2388
2156
  return spacingFragment;
2389
2157
  };
2390
- const ɵ31 = buildSpacing;
2391
2158
  const buildIndentation = ({ left, right }) => {
2392
2159
  const indentationFragment = fragment({
2393
2160
  namespaceAlias: { w: namespaces.w },
@@ -2401,12 +2168,10 @@ const buildIndentation = ({ left, right }) => {
2401
2168
  indentationFragment.up();
2402
2169
  return indentationFragment;
2403
2170
  };
2404
- const ɵ32 = buildIndentation;
2405
2171
  const buildPStyle = (style = 'Normal') => fragment({ namespaceAlias: { w: namespaces.w } })
2406
2172
  .ele('@w', 'pStyle')
2407
2173
  .att('@w', 'val', style)
2408
2174
  .up();
2409
- const ɵ33 = buildPStyle;
2410
2175
  const buildHorizontalAlignment = (horizontalAlignment) => {
2411
2176
  if (horizontalAlignment === 'justify') {
2412
2177
  horizontalAlignment = 'both';
@@ -2416,7 +2181,6 @@ const buildHorizontalAlignment = (horizontalAlignment) => {
2416
2181
  .att('@w', 'val', horizontalAlignment)
2417
2182
  .up();
2418
2183
  };
2419
- const ɵ34 = buildHorizontalAlignment;
2420
2184
  const buildParagraphBorder = () => {
2421
2185
  const paragraphBorderFragment = fragment({ namespaceAlias: { w: namespaces.w } }).ele('@w', 'pBdr');
2422
2186
  const bordersObject = cloneDeep(paragraphBordersObject);
@@ -2430,7 +2194,6 @@ const buildParagraphBorder = () => {
2430
2194
  paragraphBorderFragment.up();
2431
2195
  return paragraphBorderFragment;
2432
2196
  };
2433
- const ɵ35 = buildParagraphBorder;
2434
2197
  const buildParagraphProperties = (attributes) => {
2435
2198
  const paragraphPropertiesFragment = fragment({ namespaceAlias: { w: namespaces.w } }).ele('@w', 'pPr');
2436
2199
  if (attributes && attributes.constructor === Object) {
@@ -2487,7 +2250,6 @@ const buildParagraphProperties = (attributes) => {
2487
2250
  paragraphPropertiesFragment.up();
2488
2251
  return paragraphPropertiesFragment;
2489
2252
  };
2490
- const ɵ36 = buildParagraphProperties;
2491
2253
  const computeImageDimensions = (vNode, attributes) => {
2492
2254
  const { maximumWidth, originalWidth, originalHeight } = attributes;
2493
2255
  const aspectRatio = originalWidth / originalHeight;
@@ -2561,7 +2323,6 @@ const computeImageDimensions = (vNode, attributes) => {
2561
2323
  // eslint-disable-next-line no-param-reassign
2562
2324
  attributes.height = modifiedHeight;
2563
2325
  };
2564
- const ɵ37 = computeImageDimensions;
2565
2326
  const buildParagraph = (vNode, attributes, docxDocumentInstance) => __awaiter(void 0, void 0, void 0, function* () {
2566
2327
  const paragraphFragment = fragment({ namespaceAlias: { w: namespaces.w } }).ele('@w', 'p');
2567
2328
  const modifiedAttributes = modifiedStyleAttributesBuilder(vNode, attributes, {
@@ -2699,18 +2460,15 @@ const buildParagraph = (vNode, attributes, docxDocumentInstance) => __awaiter(vo
2699
2460
  paragraphFragment.up();
2700
2461
  return paragraphFragment;
2701
2462
  });
2702
- const ɵ38 = buildParagraph;
2703
2463
  const buildGridSpanFragment = (spanValue) => fragment({ namespaceAlias: { w: namespaces.w } })
2704
2464
  .ele('@w', 'gridSpan')
2705
2465
  .att('@w', 'val', spanValue)
2706
2466
  .up();
2707
- const ɵ39 = buildGridSpanFragment;
2708
2467
  const buildTableCellSpacing = (cellSpacing = 0) => fragment({ namespaceAlias: { w: namespaces.w } })
2709
2468
  .ele('@w', 'tblCellSpacing')
2710
2469
  .att('@w', 'w', cellSpacing)
2711
2470
  .att('@w', 'type', 'dxa')
2712
2471
  .up();
2713
- const ɵ40 = buildTableCellSpacing;
2714
2472
  const buildTableCellBorders = (tableCellBorder) => {
2715
2473
  const tableCellBordersFragment = fragment({ namespaceAlias: { w: namespaces.w } }).ele('@w', 'tcBorders');
2716
2474
  const { color, stroke } = tableCellBorder, borders = __rest(tableCellBorder, ["color", "stroke"]);
@@ -2723,13 +2481,11 @@ const buildTableCellBorders = (tableCellBorder) => {
2723
2481
  tableCellBordersFragment.up();
2724
2482
  return tableCellBordersFragment;
2725
2483
  };
2726
- const ɵ41 = buildTableCellBorders;
2727
2484
  const buildTableCellWidth = (tableCellWidth) => fragment({ namespaceAlias: { w: namespaces.w } })
2728
2485
  .ele('@w', 'tcW')
2729
2486
  .att('@w', 'w', fixupColumnWidth(tableCellWidth))
2730
2487
  .att('@w', 'type', 'dxa')
2731
2488
  .up();
2732
- const ɵ42 = buildTableCellWidth;
2733
2489
  const buildTableCellProperties = (attributes) => {
2734
2490
  const tableCellPropertiesFragment = fragment({ namespaceAlias: { w: namespaces.w } }).ele('@w', 'tcPr');
2735
2491
  if (attributes && attributes.constructor === Object) {
@@ -2775,7 +2531,6 @@ const buildTableCellProperties = (attributes) => {
2775
2531
  tableCellPropertiesFragment.up();
2776
2532
  return tableCellPropertiesFragment;
2777
2533
  };
2778
- const ɵ43 = buildTableCellProperties;
2779
2534
  const fixupTableCellBorder = (vNode, attributes) => {
2780
2535
  if (Object.prototype.hasOwnProperty.call(vNode.properties.style, 'border')) {
2781
2536
  if (vNode.properties.style.border === 'none' || vNode.properties.style.border === 0) {
@@ -2830,7 +2585,6 @@ const fixupTableCellBorder = (vNode, attributes) => {
2830
2585
  attributes.tableCellBorder = Object.assign(Object.assign({}, attributes.tableCellBorder), { right: borderSize, color: borderColor, stroke: borderStroke });
2831
2586
  }
2832
2587
  };
2833
- const ɵ44 = fixupTableCellBorder;
2834
2588
  const buildTableCell = (vNode, attributes, rowSpanMap, columnIndex, docxDocumentInstance) => __awaiter(void 0, void 0, void 0, function* () {
2835
2589
  const tableCellFragment = fragment({ namespaceAlias: { w: namespaces.w } }).ele('@w', 'tc');
2836
2590
  let modifiedAttributes = Object.assign({}, attributes);
@@ -2913,7 +2667,6 @@ const buildTableCell = (vNode, attributes, rowSpanMap, columnIndex, docxDocument
2913
2667
  tableCellFragment.up();
2914
2668
  return tableCellFragment;
2915
2669
  });
2916
- const ɵ45 = buildTableCell;
2917
2670
  const buildRowSpanCell = (rowSpanMap, columnIndex, attributes) => {
2918
2671
  const rowSpanCellFragments = [];
2919
2672
  let spanObject = rowSpanMap.get(columnIndex.index);
@@ -2941,7 +2694,6 @@ const buildRowSpanCell = (rowSpanMap, columnIndex, attributes) => {
2941
2694
  }
2942
2695
  return rowSpanCellFragments;
2943
2696
  };
2944
- const ɵ46 = buildRowSpanCell;
2945
2697
  const buildTableRowProperties = (attributes) => {
2946
2698
  const tableRowPropertiesFragment = fragment({ namespaceAlias: { w: namespaces.w } }).ele('@w', 'trPr');
2947
2699
  if (attributes && attributes.constructor === Object) {
@@ -2969,7 +2721,6 @@ const buildTableRowProperties = (attributes) => {
2969
2721
  tableRowPropertiesFragment.up();
2970
2722
  return tableRowPropertiesFragment;
2971
2723
  };
2972
- const ɵ47 = buildTableRowProperties;
2973
2724
  const buildTableRow = (vNode, attributes, rowSpanMap, docxDocumentInstance) => __awaiter(void 0, void 0, void 0, function* () {
2974
2725
  const tableRowFragment = fragment({ namespaceAlias: { w: namespaces.w } }).ele('@w', 'tr');
2975
2726
  const modifiedAttributes = Object.assign({}, attributes);
@@ -3024,11 +2775,9 @@ const buildTableRow = (vNode, attributes, rowSpanMap, docxDocumentInstance) => _
3024
2775
  tableRowFragment.up();
3025
2776
  return tableRowFragment;
3026
2777
  });
3027
- const ɵ48 = buildTableRow;
3028
2778
  const buildTableGridCol = (gridWidth) => fragment({ namespaceAlias: { w: namespaces.w } })
3029
2779
  .ele('@w', 'gridCol')
3030
2780
  .att('@w', 'w', String(gridWidth));
3031
- const ɵ49 = buildTableGridCol;
3032
2781
  const buildTableGrid = (vNode, attributes) => {
3033
2782
  const tableGridFragment = fragment({ namespaceAlias: { w: namespaces.w } }).ele('@w', 'tblGrid');
3034
2783
  if (vNodeHasChildren(vNode)) {
@@ -3042,7 +2791,6 @@ const buildTableGrid = (vNode, attributes) => {
3042
2791
  tableGridFragment.up();
3043
2792
  return tableGridFragment;
3044
2793
  };
3045
- const ɵ50 = buildTableGrid;
3046
2794
  const buildTableGridFromTableRow = (vNode, attributes) => {
3047
2795
  const tableGridFragment = fragment({ namespaceAlias: { w: namespaces.w } }).ele('@w', 'tblGrid');
3048
2796
  if (vNodeHasChildren(vNode)) {
@@ -3060,7 +2808,6 @@ const buildTableGridFromTableRow = (vNode, attributes) => {
3060
2808
  tableGridFragment.up();
3061
2809
  return tableGridFragment;
3062
2810
  };
3063
- const ɵ51 = buildTableGridFromTableRow;
3064
2811
  const buildTableBorders = (tableBorder) => {
3065
2812
  const tableBordersFragment = fragment({ namespaceAlias: { w: namespaces.w } }).ele('@w', 'tblBorders');
3066
2813
  const { color, stroke } = tableBorder, borders = __rest(tableBorder, ["color", "stroke"]);
@@ -3073,19 +2820,16 @@ const buildTableBorders = (tableBorder) => {
3073
2820
  tableBordersFragment.up();
3074
2821
  return tableBordersFragment;
3075
2822
  };
3076
- const ɵ52 = buildTableBorders;
3077
2823
  const buildTableWidth = (tableWidth) => fragment({ namespaceAlias: { w: namespaces.w } })
3078
2824
  .ele('@w', 'tblW')
3079
2825
  .att('@w', 'type', 'dxa')
3080
2826
  .att('@w', 'w', String(tableWidth))
3081
2827
  .up();
3082
- const ɵ53 = buildTableWidth;
3083
2828
  const buildCellMargin = (side, margin) => fragment({ namespaceAlias: { w: namespaces.w } })
3084
2829
  .ele('@w', side)
3085
2830
  .att('@w', 'type', 'dxa')
3086
2831
  .att('@w', 'w', String(margin))
3087
2832
  .up();
3088
- const ɵ54 = buildCellMargin;
3089
2833
  const buildTableCellMargins = (margin) => {
3090
2834
  const tableCellMarFragment = fragment({ namespaceAlias: { w: namespaces.w } }).ele('@w', 'tblCellMar');
3091
2835
  ['top', 'bottom'].forEach((side) => {
@@ -3098,7 +2842,6 @@ const buildTableCellMargins = (margin) => {
3098
2842
  });
3099
2843
  return tableCellMarFragment;
3100
2844
  };
3101
- const ɵ55 = buildTableCellMargins;
3102
2845
  const buildTableProperties = (attributes) => {
3103
2846
  const tablePropertiesFragment = fragment({ namespaceAlias: { w: namespaces.w } }).ele('@w', 'tblPr');
3104
2847
  if (attributes && attributes.constructor === Object) {
@@ -3135,7 +2878,6 @@ const buildTableProperties = (attributes) => {
3135
2878
  tablePropertiesFragment.up();
3136
2879
  return tablePropertiesFragment;
3137
2880
  };
3138
- const ɵ56 = buildTableProperties;
3139
2881
  const cssBorderParser = (borderString) => {
3140
2882
  let [size, stroke, color] = borderString.split(' ');
3141
2883
  if (pointRegex.test(size)) {
@@ -3152,7 +2894,6 @@ const cssBorderParser = (borderString) => {
3152
2894
  color = color && fixupColorCode(color).toUpperCase();
3153
2895
  return [size, stroke, color];
3154
2896
  };
3155
- const ɵ57 = cssBorderParser;
3156
2897
  const buildTable = (vNode, attributes, docxDocumentInstance) => __awaiter(void 0, void 0, void 0, function* () {
3157
2898
  const tableFragment = fragment({ namespaceAlias: { w: namespaces.w } }).ele('@w', 'tbl');
3158
2899
  const modifiedAttributes = Object.assign({}, attributes);
@@ -3293,24 +3034,20 @@ const buildTable = (vNode, attributes, docxDocumentInstance) => __awaiter(void 0
3293
3034
  tableFragment.up();
3294
3035
  return tableFragment;
3295
3036
  });
3296
- const ɵ58 = buildTable;
3297
3037
  const buildPresetGeometry = () => fragment({ namespaceAlias: { a: namespaces.a } })
3298
3038
  .ele('@a', 'prstGeom')
3299
3039
  .att('prst', 'rect')
3300
3040
  .up();
3301
- const ɵ59 = buildPresetGeometry;
3302
3041
  const buildExtents = ({ width, height }) => fragment({ namespaceAlias: { a: namespaces.a } })
3303
3042
  .ele('@a', 'ext')
3304
3043
  .att('cx', width)
3305
3044
  .att('cy', height)
3306
3045
  .up();
3307
- const ɵ60 = buildExtents;
3308
3046
  const buildOffset = () => fragment({ namespaceAlias: { a: namespaces.a } })
3309
3047
  .ele('@a', 'off')
3310
3048
  .att('x', '0')
3311
3049
  .att('y', '0')
3312
3050
  .up();
3313
- const ɵ61 = buildOffset;
3314
3051
  const buildGraphicFrameTransform = (attributes) => {
3315
3052
  const graphicFrameTransformFragment = fragment({ namespaceAlias: { a: namespaces.a } }).ele('@a', 'xfrm');
3316
3053
  const offsetFragment = buildOffset();
@@ -3320,7 +3057,6 @@ const buildGraphicFrameTransform = (attributes) => {
3320
3057
  graphicFrameTransformFragment.up();
3321
3058
  return graphicFrameTransformFragment;
3322
3059
  };
3323
- const ɵ62 = buildGraphicFrameTransform;
3324
3060
  const buildShapeProperties = (attributes) => {
3325
3061
  const shapeProperties = fragment({ namespaceAlias: { pic: namespaces.pic } }).ele('@pic', 'spPr');
3326
3062
  const graphicFrameTransformFragment = buildGraphicFrameTransform(attributes);
@@ -3330,11 +3066,9 @@ const buildShapeProperties = (attributes) => {
3330
3066
  shapeProperties.up();
3331
3067
  return shapeProperties;
3332
3068
  };
3333
- const ɵ63 = buildShapeProperties;
3334
3069
  const buildFillRect = () => fragment({ namespaceAlias: { a: namespaces.a } })
3335
3070
  .ele('@a', 'fillRect')
3336
3071
  .up();
3337
- const ɵ64 = buildFillRect;
3338
3072
  const buildStretch = () => {
3339
3073
  const stretchFragment = fragment({ namespaceAlias: { a: namespaces.a } }).ele('@a', 'stretch');
3340
3074
  const fillRectFragment = buildFillRect();
@@ -3342,7 +3076,6 @@ const buildStretch = () => {
3342
3076
  stretchFragment.up();
3343
3077
  return stretchFragment;
3344
3078
  };
3345
- const ɵ65 = buildStretch;
3346
3079
  const buildSrcRectFragment = () => fragment({ namespaceAlias: { a: namespaces.a } })
3347
3080
  .ele('@a', 'srcRect')
3348
3081
  .att('b', '0')
@@ -3350,7 +3083,6 @@ const buildSrcRectFragment = () => fragment({ namespaceAlias: { a: namespaces.a
3350
3083
  .att('r', '0')
3351
3084
  .att('t', '0')
3352
3085
  .up();
3353
- const ɵ66 = buildSrcRectFragment;
3354
3086
  const buildBinaryLargeImageOrPicture = (relationshipId) => fragment({
3355
3087
  namespaceAlias: { a: namespaces.a, r: namespaces.r },
3356
3088
  })
@@ -3359,7 +3091,6 @@ const buildBinaryLargeImageOrPicture = (relationshipId) => fragment({
3359
3091
  // FIXME: possible values 'email', 'none', 'print', 'hqprint', 'screen'
3360
3092
  .att('cstate', 'print')
3361
3093
  .up();
3362
- const ɵ67 = buildBinaryLargeImageOrPicture;
3363
3094
  const buildBinaryLargeImageOrPictureFill = (relationshipId) => {
3364
3095
  const binaryLargeImageOrPictureFillFragment = fragment({
3365
3096
  namespaceAlias: { pic: namespaces.pic },
@@ -3373,18 +3104,15 @@ const buildBinaryLargeImageOrPictureFill = (relationshipId) => {
3373
3104
  binaryLargeImageOrPictureFillFragment.up();
3374
3105
  return binaryLargeImageOrPictureFillFragment;
3375
3106
  };
3376
- const ɵ68 = buildBinaryLargeImageOrPictureFill;
3377
3107
  const buildNonVisualPictureDrawingProperties = () => fragment({ namespaceAlias: { pic: namespaces.pic } })
3378
3108
  .ele('@pic', 'cNvPicPr')
3379
3109
  .up();
3380
- const ɵ69 = buildNonVisualPictureDrawingProperties;
3381
3110
  const buildNonVisualDrawingProperties = (pictureId, pictureNameWithExtension, pictureDescription = '') => fragment({ namespaceAlias: { pic: namespaces.pic } })
3382
3111
  .ele('@pic', 'cNvPr')
3383
3112
  .att('id', pictureId)
3384
3113
  .att('name', pictureNameWithExtension)
3385
3114
  .att('descr', pictureDescription)
3386
3115
  .up();
3387
- const ɵ70 = buildNonVisualDrawingProperties;
3388
3116
  const buildNonVisualPictureProperties = (pictureId, pictureNameWithExtension, pictureDescription) => {
3389
3117
  const nonVisualPicturePropertiesFragment = fragment({
3390
3118
  namespaceAlias: { pic: namespaces.pic },
@@ -3397,7 +3125,6 @@ const buildNonVisualPictureProperties = (pictureId, pictureNameWithExtension, pi
3397
3125
  nonVisualPicturePropertiesFragment.up();
3398
3126
  return nonVisualPicturePropertiesFragment;
3399
3127
  };
3400
- const ɵ71 = buildNonVisualPictureProperties;
3401
3128
  const buildPicture = ({ id, fileNameWithExtension, description, relationshipId, width, height, }) => {
3402
3129
  const pictureFragment = fragment({ namespaceAlias: { pic: namespaces.pic } }).ele('@pic', 'pic');
3403
3130
  const nonVisualPicturePropertiesFragment = buildNonVisualPictureProperties(id, fileNameWithExtension, description);
@@ -3409,7 +3136,6 @@ const buildPicture = ({ id, fileNameWithExtension, description, relationshipId,
3409
3136
  pictureFragment.up();
3410
3137
  return pictureFragment;
3411
3138
  };
3412
- const ɵ72 = buildPicture;
3413
3139
  const buildGraphicData = (graphicType, attributes) => {
3414
3140
  const graphicDataFragment = fragment({ namespaceAlias: { a: namespaces.a } })
3415
3141
  .ele('@a', 'graphicData')
@@ -3421,7 +3147,6 @@ const buildGraphicData = (graphicType, attributes) => {
3421
3147
  graphicDataFragment.up();
3422
3148
  return graphicDataFragment;
3423
3149
  };
3424
- const ɵ73 = buildGraphicData;
3425
3150
  const buildGraphic = (graphicType, attributes) => {
3426
3151
  const graphicFragment = fragment({ namespaceAlias: { a: namespaces.a } }).ele('@a', 'graphic');
3427
3152
  // TODO: Handle drawing type
@@ -3430,13 +3155,11 @@ const buildGraphic = (graphicType, attributes) => {
3430
3155
  graphicFragment.up();
3431
3156
  return graphicFragment;
3432
3157
  };
3433
- const ɵ74 = buildGraphic;
3434
3158
  const buildDrawingObjectNonVisualProperties = (pictureId, pictureName) => fragment({ namespaceAlias: { wp: namespaces.wp } })
3435
3159
  .ele('@wp', 'docPr')
3436
3160
  .att('id', pictureId)
3437
3161
  .att('name', pictureName)
3438
3162
  .up();
3439
- const ɵ75 = buildDrawingObjectNonVisualProperties;
3440
3163
  const buildWrapSquare = () => fragment({ namespaceAlias: { wp: namespaces.wp } })
3441
3164
  .ele('@wp', 'wrapSquare')
3442
3165
  .att('wrapText', 'bothSides')
@@ -3445,12 +3168,10 @@ const buildWrapSquare = () => fragment({ namespaceAlias: { wp: namespaces.wp } }
3445
3168
  .att('distL', '228600')
3446
3169
  .att('distR', '228600')
3447
3170
  .up();
3448
- const ɵ76 = buildWrapSquare;
3449
3171
  // eslint-disable-next-line no-unused-vars
3450
3172
  const buildWrapNone = () => fragment({ namespaceAlias: { wp: namespaces.wp } })
3451
3173
  .ele('@wp', 'wrapNone')
3452
3174
  .up();
3453
- const ɵ77 = buildWrapNone;
3454
3175
  const buildEffectExtentFragment = () => fragment({ namespaceAlias: { wp: namespaces.wp } })
3455
3176
  .ele('@wp', 'effectExtent')
3456
3177
  .att('b', '0')
@@ -3458,13 +3179,11 @@ const buildEffectExtentFragment = () => fragment({ namespaceAlias: { wp: namespa
3458
3179
  .att('r', '0')
3459
3180
  .att('t', '0')
3460
3181
  .up();
3461
- const ɵ78 = buildEffectExtentFragment;
3462
3182
  const buildExtent = ({ width, height }) => fragment({ namespaceAlias: { wp: namespaces.wp } })
3463
3183
  .ele('@wp', 'extent')
3464
3184
  .att('cx', width)
3465
3185
  .att('cy', height)
3466
3186
  .up();
3467
- const ɵ79 = buildExtent;
3468
3187
  const buildPositionV = () => fragment({ namespaceAlias: { wp: namespaces.wp } })
3469
3188
  .ele('@wp', 'positionV')
3470
3189
  .att('relativeFrom', 'paragraph')
@@ -3472,7 +3191,6 @@ const buildPositionV = () => fragment({ namespaceAlias: { wp: namespaces.wp } })
3472
3191
  .txt('19050')
3473
3192
  .up()
3474
3193
  .up();
3475
- const ɵ80 = buildPositionV;
3476
3194
  const buildPositionH = () => fragment({ namespaceAlias: { wp: namespaces.wp } })
3477
3195
  .ele('@wp', 'positionH')
3478
3196
  .att('relativeFrom', 'column')
@@ -3480,13 +3198,11 @@ const buildPositionH = () => fragment({ namespaceAlias: { wp: namespaces.wp } })
3480
3198
  .txt('19050')
3481
3199
  .up()
3482
3200
  .up();
3483
- const ɵ81 = buildPositionH;
3484
3201
  const buildSimplePos = () => fragment({ namespaceAlias: { wp: namespaces.wp } })
3485
3202
  .ele('@wp', 'simplePos')
3486
3203
  .att('x', '0')
3487
3204
  .att('y', '0')
3488
3205
  .up();
3489
- const ɵ82 = buildSimplePos;
3490
3206
  const buildAnchoredDrawing = (graphicType, attributes) => {
3491
3207
  const anchoredDrawingFragment = fragment({ namespaceAlias: { wp: namespaces.wp } })
3492
3208
  .ele('@wp', 'anchor')
@@ -3520,7 +3236,6 @@ const buildAnchoredDrawing = (graphicType, attributes) => {
3520
3236
  anchoredDrawingFragment.up();
3521
3237
  return anchoredDrawingFragment;
3522
3238
  };
3523
- const ɵ83 = buildAnchoredDrawing;
3524
3239
  const buildInlineDrawing = (graphicType, attributes) => {
3525
3240
  const inlineDrawingFragment = fragment({ namespaceAlias: { wp: namespaces.wp } })
3526
3241
  .ele('@wp', 'inline')
@@ -3539,7 +3254,6 @@ const buildInlineDrawing = (graphicType, attributes) => {
3539
3254
  inlineDrawingFragment.up();
3540
3255
  return inlineDrawingFragment;
3541
3256
  };
3542
- const ɵ84 = buildInlineDrawing;
3543
3257
  const buildDrawing = (inlineOrAnchored = false, graphicType, attributes) => {
3544
3258
  const drawingFragment = fragment({ namespaceAlias: { w: namespaces.w } }).ele('@w', 'drawing');
3545
3259
  const inlineOrAnchoredDrawingFragment = inlineOrAnchored
@@ -3549,12 +3263,6 @@ const buildDrawing = (inlineOrAnchored = false, graphicType, attributes) => {
3549
3263
  drawingFragment.up();
3550
3264
  return drawingFragment;
3551
3265
  };
3552
- const ɵ85 = buildDrawing;
3553
-
3554
- const convertHTML$1 = HTMLToVDOM({
3555
- VNode,
3556
- VText,
3557
- });
3558
3266
  // eslint-disable-next-line consistent-return, no-shadow
3559
3267
  const buildImage = (docxDocumentInstance, vNode, maximumWidth = null) => __awaiter(void 0, void 0, void 0, function* () {
3560
3268
  let response = null;
@@ -3590,7 +3298,7 @@ const buildImage = (docxDocumentInstance, vNode, maximumWidth = null) => __await
3590
3298
  const documentRelsId = docxDocumentInstance.createDocumentRelationships(docxDocumentInstance.relationshipFilename, imageType, `media/${response.fileNameWithExtension}`, internalRelationship);
3591
3299
  const imageBuffer = Buffer.from(response.fileContent, 'base64');
3592
3300
  const imageProperties = sizeOf(imageBuffer);
3593
- const imageFragment = yield buildParagraph(vNode, Object.assign(Object.assign({ type: 'picture', inlineOrAnchored: true, relationshipId: documentRelsId }, response), { maximumWidth: maximumWidth || docxDocumentInstance.availableDocumentSpace, originalWidth: imageProperties.width, originalHeight: imageProperties.height }), docxDocumentInstance);
3301
+ const imageFragment = yield xmlBuilder.buildParagraph(vNode, Object.assign(Object.assign({ type: 'picture', inlineOrAnchored: true, relationshipId: documentRelsId }, response), { maximumWidth: maximumWidth || docxDocumentInstance.availableDocumentSpace, originalWidth: imageProperties.width, originalHeight: imageProperties.height }), docxDocumentInstance);
3594
3302
  return imageFragment;
3595
3303
  }
3596
3304
  });
@@ -3608,7 +3316,7 @@ const buildList = (vNode, docxDocumentInstance, xmlFragment) => __awaiter(void 0
3608
3316
  const tempVNodeObject = vNodeObjects.shift();
3609
3317
  if (isVText(tempVNodeObject.node) ||
3610
3318
  (isVNode(tempVNodeObject.node) && !['ul', 'ol', 'li'].includes(tempVNodeObject.node.tagName))) {
3611
- const paragraphFragment = yield buildParagraph(tempVNodeObject.node, {
3319
+ const paragraphFragment = yield xmlBuilder.buildParagraph(tempVNodeObject.node, {
3612
3320
  numbering: { levelId: tempVNodeObject.level, numberingId: tempVNodeObject.numberingId },
3613
3321
  }, docxDocumentInstance);
3614
3322
  xmlFragment.import(paragraphFragment);
@@ -3666,6 +3374,11 @@ const buildList = (vNode, docxDocumentInstance, xmlFragment) => __awaiter(void 0
3666
3374
  }
3667
3375
  }
3668
3376
  return listElements;
3377
+ });
3378
+
3379
+ const convertHTML$1 = HTMLToVDOM({
3380
+ VNode: VNode$1,
3381
+ VText,
3669
3382
  });
3670
3383
  function findXMLEquivalent(docxDocumentInstance, vNode, xmlFragment) {
3671
3384
  return __awaiter(this, void 0, void 0, function* () {
@@ -4314,11 +4027,10 @@ function _prepareImageParts(htmlSource) {
4314
4027
  }
4315
4028
 
4316
4029
  const convertHTML = HTMLToVDOM({
4317
- VNode,
4030
+ VNode: VNode$1,
4318
4031
  VText,
4319
4032
  });
4320
4033
  const mergeOptions = (options, patch) => (Object.assign(Object.assign({}, options), patch));
4321
- const ɵ0$1 = mergeOptions;
4322
4034
  const fixupFontSize = (fontSize) => {
4323
4035
  let normalizedFontSize;
4324
4036
  if (pointRegex.test(fontSize)) {
@@ -4334,7 +4046,6 @@ const fixupFontSize = (fontSize) => {
4334
4046
  }
4335
4047
  return normalizedFontSize;
4336
4048
  };
4337
- const ɵ1 = fixupFontSize;
4338
4049
  const normalizeUnits = (dimensioningObject, defaultDimensionsProperty) => {
4339
4050
  let normalizedUnitResult = {};
4340
4051
  if (typeof dimensioningObject === 'object' && dimensioningObject !== null) {
@@ -4366,7 +4077,6 @@ const normalizeUnits = (dimensioningObject, defaultDimensionsProperty) => {
4366
4077
  }
4367
4078
  return normalizedUnitResult;
4368
4079
  };
4369
- const ɵ2 = normalizeUnits;
4370
4080
  const normalizeDocumentOptions = (documentOptions) => {
4371
4081
  const normalizedDocumentOptions = Object.assign({}, documentOptions);
4372
4082
  Object.keys(documentOptions).forEach((key) => {
@@ -4384,7 +4094,6 @@ const normalizeDocumentOptions = (documentOptions) => {
4384
4094
  });
4385
4095
  return normalizedDocumentOptions;
4386
4096
  };
4387
- const ɵ3 = normalizeDocumentOptions;
4388
4097
  // Ref: https://en.wikipedia.org/wiki/Office_Open_XML_file_formats
4389
4098
  // http://officeopenxml.com/anatomyofOOXML.php
4390
4099
  function addFilesToContainer(zip, htmlString, suppliedDocumentOptions, headerHTMLString, footerHTMLString) {
@@ -4511,7 +4220,6 @@ const minifyHTMLString = (htmlString) => {
4511
4220
  return null;
4512
4221
  }
4513
4222
  };
4514
- const ɵ0 = minifyHTMLString;
4515
4223
  function generateContainer(htmlString, headerHTMLString, documentOptions = {}, footerHTMLString) {
4516
4224
  return __awaiter(this, void 0, void 0, function* () {
4517
4225
  const zip = new JSZip();
@@ -4570,28 +4278,278 @@ class WordDocumentService {
4570
4278
  });
4571
4279
  }
4572
4280
  }
4573
- WordDocumentService.ɵprov = i0.ɵɵdefineInjectable({ factory: function WordDocumentService_Factory() { return new WordDocumentService(); }, token: WordDocumentService, providedIn: "root" });
4574
- WordDocumentService.decorators = [
4575
- { type: Injectable, args: [{
4576
- providedIn: 'root',
4577
- },] }
4578
- ];
4281
+ WordDocumentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: WordDocumentService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4282
+ WordDocumentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: WordDocumentService, providedIn: 'root' });
4283
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: WordDocumentService, decorators: [{
4284
+ type: Injectable,
4285
+ args: [{
4286
+ providedIn: 'root',
4287
+ }]
4288
+ }] });
4579
4289
 
4580
- class WordDocumentModel {
4581
- constructor() {
4582
- this.options = new DocumentOptionsModel();
4290
+ const TOKEN_KEY = 'access_token';
4291
+ class AuthService {
4292
+ constructor(injector, http, environmentService, translateService, router, cookieService, utilityService) {
4293
+ this.injector = injector;
4294
+ this.http = http;
4295
+ this.environmentService = environmentService;
4296
+ this.translateService = translateService;
4297
+ this.router = router;
4298
+ this.cookieService = cookieService;
4299
+ this.utilityService = utilityService;
4300
+ this.redirectUrl = '';
4301
+ this.jwtHelper = new JwtHelperService();
4302
+ this.isAuthenticatedSubject = new BehaviorSubject(this.hasToken());
4303
+ this.isAuthenticate$ = this.isAuthenticatedSubject.asObservable();
4304
+ this.user = this.getUserManager();
4305
+ }
4306
+ hasToken() {
4307
+ const token = this.cookieService.get(TOKEN_KEY);
4308
+ return token && !this.jwtHelper.isTokenExpired(token);
4309
+ }
4310
+ getUserManager() {
4311
+ const token = this.cookieService.get(TOKEN_KEY);
4312
+ if (token)
4313
+ this.handleAccessTokenWithoutLanguage(token);
4314
+ return AuthService.user;
4315
+ }
4316
+ getUser() {
4317
+ this.user = AuthService.user;
4318
+ }
4319
+ storUser(User) {
4320
+ AuthService.user = this.user = this.user;
4321
+ }
4322
+ getCurrentUser() {
4323
+ return AuthService.user;
4324
+ }
4325
+ isAuthenticated() {
4326
+ return __awaiter(this, void 0, void 0, function* () {
4327
+ return AuthService.user != null && !this.jwtHelper.isTokenExpired(AuthService.user.access_token);
4328
+ });
4329
+ }
4330
+ isUserInRole(allowedPermission) {
4331
+ let selectedPermissionSetID = Number.parseInt(this.user.profile['selectedpermissionsetid']);
4332
+ return allowedPermission.includes(selectedPermissionSetID);
4333
+ }
4334
+ authorizationHeaderValue() {
4335
+ return AuthService.user
4336
+ ? `${AuthService.user.token_type} ${AuthService.user.access_token}`
4337
+ : '';
4338
+ }
4339
+ name() {
4340
+ return AuthService.user != null ? AuthService.user.profile.given_name : '';
4341
+ }
4342
+ setUrl(url) {
4343
+ localStorage.setItem('redirectUrl', url);
4344
+ }
4345
+ getUrl() {
4346
+ var _a;
4347
+ return (_a = localStorage.getItem('redirectUrl')) !== null && _a !== void 0 ? _a : "/";
4348
+ }
4349
+ signOut() {
4350
+ AuthService.timers.map(t => clearInterval(t));
4351
+ AuthService.timers = [];
4352
+ if (!this.isAuthenticated()) {
4353
+ this.cookieService.delete(TOKEN_KEY);
4354
+ this.router.navigate(['/Admin/account/login']);
4355
+ }
4356
+ this.logout().subscribe(res => {
4357
+ this.cookieService.delete(TOKEN_KEY);
4358
+ if (this.environmentService.getBBSFAuthenticationMode() == AuthenticationModes.UAEPass)
4359
+ this.logoutFromUAEPass();
4360
+ else
4361
+ this.router.navigate(['/Admin/account/login']);
4362
+ });
4363
+ }
4364
+ logout() {
4365
+ const httpOptions = {
4366
+ headers: new HttpHeaders({
4367
+ 'Content-Type': 'application/json',
4368
+ }),
4369
+ };
4370
+ let ApiUrl = '/Account/';
4371
+ return this.http.get(this.environmentService.getApiUrl() + ApiUrl + 'Logout', httpOptions);
4372
+ }
4373
+ clearUserSessionClaims() {
4374
+ const httpOptions = {
4375
+ headers: new HttpHeaders({
4376
+ 'Content-Type': 'application/json',
4377
+ }),
4378
+ };
4379
+ let ApiUrl = '/api/Home/';
4380
+ return this.http.get(this.environmentService.getBaseUrl() + ApiUrl + 'ClearCurrentUserSession', httpOptions);
4381
+ }
4382
+ handleAccessToken(response) {
4383
+ return __awaiter(this, void 0, void 0, function* () {
4384
+ const token = response;
4385
+ AuthService.user = new User();
4386
+ AuthService.user.token_type = "Bearer";
4387
+ AuthService.user.access_token = token;
4388
+ AuthService.user.profile = this.jwtHelper.decodeToken(token);
4389
+ AuthService.user.expires_at = this.jwtHelper.getTokenExpirationDate(token);
4390
+ AuthService.timers.map(t => clearInterval(t));
4391
+ AuthService.timers = [];
4392
+ this.setTokenSeconds();
4393
+ AuthService.timers.push(this.checkRefreshToken());
4394
+ this.user = AuthService.user;
4395
+ yield this.updateLanguage();
4396
+ this.cookieService.set(TOKEN_KEY, token, null, null, null, true, 'Strict');
4397
+ this.isAuthenticatedSubject.next(true);
4398
+ });
4399
+ }
4400
+ handleAccessTokenWithoutLanguage(response) {
4401
+ const token = response;
4402
+ AuthService.user = new User();
4403
+ AuthService.user.token_type = "Bearer";
4404
+ AuthService.user.access_token = token;
4405
+ AuthService.user.profile = this.jwtHelper.decodeToken(token);
4406
+ AuthService.user.expires_at = this.jwtHelper.getTokenExpirationDate(token);
4407
+ this.setTokenSeconds();
4408
+ this.user = AuthService.user;
4409
+ this.cookieService.set(TOKEN_KEY, token, null, null, null, true, 'Strict');
4410
+ this.isAuthenticatedSubject.next(true);
4411
+ }
4412
+ updateLanguage() {
4413
+ return __awaiter(this, void 0, void 0, function* () {
4414
+ if (!localStorage.getItem('language') ||
4415
+ localStorage.getItem('language') == this.user.profile.locale)
4416
+ localStorage.setItem('language', this.user.profile.locale);
4417
+ if (this.translateService.currentLang != localStorage.getItem('language')) {
4418
+ this.translateService.resetLang(this.translateService.currentLang);
4419
+ yield this.translateService
4420
+ .reloadLang(localStorage.getItem('language'))
4421
+ .subscribe((res) => {
4422
+ console.log(res);
4423
+ });
4424
+ }
4425
+ });
4426
+ }
4427
+ checkRefreshToken() {
4428
+ let date = new Date();
4429
+ return setInterval(() => {
4430
+ if (Math.floor(AuthService.seconds) < 120 && this.isAuthenticated())
4431
+ this.refresh();
4432
+ AuthService.seconds--;
4433
+ }, 1000);
4434
+ }
4435
+ setTokenSeconds() {
4436
+ let date = new Date();
4437
+ AuthService.seconds = (AuthService.user.expires_at - date) / 1000;
4438
+ }
4439
+ refresh() {
4440
+ const httpOptions = {
4441
+ headers: new HttpHeaders({
4442
+ 'Content-Type': 'application/json',
4443
+ 'Authorization': this.authorizationHeaderValue(),
4444
+ }),
4445
+ };
4446
+ let ApiUrl = '/api/Home/';
4447
+ this.http.get(this.environmentService.getApiUrl() + ApiUrl + 'RefreshAccessToken', httpOptions).subscribe((res) => {
4448
+ this.cookieService.delete(TOKEN_KEY);
4449
+ this.handleAccessTokenWithoutLanguage(res.val);
4450
+ });
4451
+ }
4452
+ loginWithUAEPass() {
4453
+ const authEndpoint = `${this.environmentService.getUAEPassBaseUrl()}${this.environmentService.getUAEPassAuthorizationEndPoint()}`;
4454
+ const queryParams = {
4455
+ response_type: 'code',
4456
+ client_id: `${this.environmentService.getUAEPassClientID()}`,
4457
+ redirect_uri: `${this.environmentService.getBaseUrl()}${this.environmentService.getUAEPassRedirectUrl()}`,
4458
+ scope: 'urn:uae:digitalid:profile:general urn:uae:digitalid:profile:general:profileType urn:uae:digitalid:profile:general:unifiedId',
4459
+ state: 'pd3PgezRwk596u2yfRwqOgru',
4460
+ acr_values: 'urn:safelayer:tws:policies:authentication:level:low'
4461
+ };
4462
+ const queryParamsString = Object.entries(queryParams)
4463
+ .map(([key, value]) => `${key}=${encodeURIComponent(value)}`)
4464
+ .join('&');
4465
+ const loginUrl = `${authEndpoint}?${queryParamsString}`;
4466
+ window.location.href = loginUrl;
4467
+ return;
4468
+ }
4469
+ logoutFromUAEPass() {
4470
+ const logoutEndpoint = `${this.environmentService.getUAEPassBaseUrl()}${this.environmentService.getUAEPassLogoutEndPoint()}`;
4471
+ const queryParams = {
4472
+ redirect_uri: `${this.environmentService.getBaseUrl()}`,
4473
+ };
4474
+ const queryParamsString = Object.entries(queryParams)
4475
+ .map(([key, value]) => `${key}=${encodeURIComponent(value)}`)
4476
+ .join('&');
4477
+ const logoutUrl = `${logoutEndpoint}?${queryParamsString}`;
4478
+ window.location.href = logoutUrl;
4479
+ return;
4583
4480
  }
4584
4481
  }
4585
- class DocumentOptionsModel {
4586
- }
4482
+ AuthService.user = null;
4483
+ AuthService.UserClaims = null;
4484
+ //refresh
4485
+ AuthService.timers = [];
4486
+ AuthService.seconds = 0;
4487
+ AuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AuthService, deps: [{ token: i0.Injector }, { token: i1.HttpClient }, { token: EnvironmentService }, { token: BBSFTranslateService }, { token: i1$1.Router }, { token: i4$1.CookieService }, { token: UtilityService }], target: i0.ɵɵFactoryTarget.Injectable });
4488
+ AuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AuthService, providedIn: 'root' });
4489
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AuthService, decorators: [{
4490
+ type: Injectable,
4491
+ args: [{
4492
+ providedIn: 'root',
4493
+ }]
4494
+ }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i1.HttpClient }, { type: EnvironmentService }, { type: BBSFTranslateService }, { type: i1$1.Router }, { type: i4$1.CookieService }, { type: UtilityService }]; } });
4495
+
4496
+ class BBSFUtilitiesModule {
4497
+ }
4498
+ BBSFUtilitiesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: BBSFUtilitiesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4499
+ BBSFUtilitiesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: BBSFUtilitiesModule, imports: [CommonModule,
4500
+ RouterModule, i1$2.BlockUIModule, i2.ToastrModule] });
4501
+ BBSFUtilitiesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: BBSFUtilitiesModule, providers: [
4502
+ UtilityService,
4503
+ EnvironmentService,
4504
+ AuthService,
4505
+ RequestHandlerService,
4506
+ StylesBundleService,
4507
+ TranslateService,
4508
+ BBSFTranslateService,
4509
+ ControlValidationService,
4510
+ MasterLayoutService,
4511
+ ConfigurationService,
4512
+ CookieService
4513
+ ], imports: [CommonModule,
4514
+ RouterModule,
4515
+ BlockUIModule.forRoot(),
4516
+ ToastrModule.forRoot()] });
4517
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: BBSFUtilitiesModule, decorators: [{
4518
+ type: NgModule,
4519
+ args: [{
4520
+ declarations: [],
4521
+ imports: [
4522
+ CommonModule,
4523
+ RouterModule,
4524
+ BlockUIModule.forRoot(),
4525
+ ToastrModule.forRoot(),
4526
+ ],
4527
+ exports: [],
4528
+ providers: [
4529
+ UtilityService,
4530
+ EnvironmentService,
4531
+ AuthService,
4532
+ RequestHandlerService,
4533
+ StylesBundleService,
4534
+ TranslateService,
4535
+ BBSFTranslateService,
4536
+ ControlValidationService,
4537
+ MasterLayoutService,
4538
+ ConfigurationService,
4539
+ CookieService
4540
+ ]
4541
+ }]
4542
+ }] });
4587
4543
 
4588
4544
  /*
4589
4545
  * Public API Surface of @bnsights/bbsf-utilities
4590
- */
4546
+ */
4547
+ //Module
4548
+ //#endregion
4591
4549
 
4592
4550
  /**
4593
4551
  * Generated bundle index. Do not edit.
4594
4552
  */
4595
4553
 
4596
- export { AppInjector, AppearanceConfigurationService, AuthService, BBSFTranslateService, BBSFUtilitiesModule, ConfigurationService, ControlValidationService, DocumentOptionsModel, EnvironmentService, MasterLayoutService, RequestHandlerService, RequestOptionsModel, StylesBundleService, TranslationResolverService, UtilityService, WordDocumentModel, WordDocumentService, environment };
4597
- //# sourceMappingURL=bnsights-bbsf-utilities.js.map
4554
+ export { AppearanceConfigurationService, AuthService, AuthenticationModes, BBSFTranslateService, BBSFUtilitiesModule, ConfigurationService, ControlValidationService, DocumentOptionsModel, EnvironmentService, MasterLayoutService, RequestHandlerService, RequestOptionsModel, StylesBundleService, TranslationResolverService, UtilityService, WordDocumentModel, WordDocumentService, environment };
4555
+ //# sourceMappingURL=bnsights-bbsf-utilities.mjs.map