@bnsights/bbsf-utilities 1.0.36 → 1.0.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/bnsights-bbsf-utilities-1.0.38.tgz +0 -0
- package/bnsights-bbsf-utilities.d.ts +4 -0
- package/bnsights-bbsf-utilities.metadata.json +1 -0
- package/bundles/bnsights-bbsf-utilities.umd.js +4782 -0
- package/bundles/bnsights-bbsf-utilities.umd.js.map +1 -0
- package/esm2015/bnsights-bbsf-utilities.js +5 -0
- package/esm2015/lib/bbsf-utilities.module.js +54 -0
- package/esm2015/lib/shared/authentication/auth.service.js +204 -0
- package/esm2015/lib/shared/config/environment.js +12 -0
- package/esm2015/lib/shared/config/word/constants.js +105 -0
- package/esm2015/lib/shared/config/word/docx-document.js +351 -0
- package/esm2015/lib/shared/config/word/helpers/index.js +4 -0
- package/esm2015/lib/shared/config/word/helpers/render-document-file.js +278 -0
- package/esm2015/lib/shared/config/word/helpers/xml-builder.js +1765 -0
- package/esm2015/lib/shared/config/word/html-to-docx.js +195 -0
- package/esm2015/lib/shared/config/word/index.js +55 -0
- package/esm2015/lib/shared/config/word/namespaces.js +37 -0
- package/esm2015/lib/shared/config/word/schemas/content-types.js +26 -0
- package/esm2015/lib/shared/config/word/schemas/core.js +29 -0
- package/esm2015/lib/shared/config/word/schemas/document-rels.js +16 -0
- package/esm2015/lib/shared/config/word/schemas/document.template.js +109 -0
- package/esm2015/lib/shared/config/word/schemas/font-table.js +40 -0
- package/esm2015/lib/shared/config/word/schemas/generic-rels.js +11 -0
- package/esm2015/lib/shared/config/word/schemas/index.js +13 -0
- package/esm2015/lib/shared/config/word/schemas/numbering.js +19 -0
- package/esm2015/lib/shared/config/word/schemas/rels.js +11 -0
- package/esm2015/lib/shared/config/word/schemas/settings.js +13 -0
- package/esm2015/lib/shared/config/word/schemas/styles.js +149 -0
- package/esm2015/lib/shared/config/word/schemas/theme.js +200 -0
- package/esm2015/lib/shared/config/word/schemas/web-settings.js +9 -0
- package/esm2015/lib/shared/config/word/utils/color-conversion.js +60 -0
- package/esm2015/lib/shared/config/word/utils/list.js +51 -0
- package/esm2015/lib/shared/config/word/utils/unit-conversion.js +30 -0
- package/esm2015/lib/shared/config/word/utils/url.js +9 -0
- package/esm2015/lib/shared/config/word/utils/vnode.js +3 -0
- package/esm2015/lib/shared/config/word/word-work/templates/documentTemplate.js +54 -0
- package/esm2015/lib/shared/config/word/word-work/templates/index.js +4 -0
- package/esm2015/lib/shared/config/word/word-work/templates/mhtDocumentTemplate.js +22 -0
- package/esm2015/lib/shared/config/word/word-work/templates/mhtPartTemplate.js +10 -0
- package/esm2015/lib/shared/config/word/word-work/utils.js +26 -0
- package/esm2015/lib/shared/models/AreaModel.js +3 -0
- package/esm2015/lib/shared/models/ErrorModel.js +3 -0
- package/esm2015/lib/shared/models/RequestOptionsModel.js +11 -0
- package/esm2015/lib/shared/models/UserModel.js +3 -0
- package/esm2015/lib/shared/models/WordDocumentModel.js +8 -0
- package/esm2015/lib/shared/services/AppearanceConfiguration.service.js +37 -0
- package/esm2015/lib/shared/services/configuration.service.js +26 -0
- package/esm2015/lib/shared/services/controlvalidation.service.js +175 -0
- package/esm2015/lib/shared/services/environment.service.js +48 -0
- package/esm2015/lib/shared/services/masterlayout.service.js +89 -0
- package/esm2015/lib/shared/services/requesthandler.service.js +206 -0
- package/esm2015/lib/shared/services/stylesbundle.service.js +56 -0
- package/esm2015/lib/shared/services/translate.service.js +13 -0
- package/esm2015/lib/shared/services/translationresolver.service.js +20 -0
- package/esm2015/lib/shared/services/utility.service.js +96 -0
- package/esm2015/lib/shared/services/word-document.service.js +39 -0
- package/esm2015/public-api.js +20 -0
- package/fesm2015/bnsights-bbsf-utilities.js +4606 -0
- package/fesm2015/bnsights-bbsf-utilities.js.map +1 -0
- package/lib/bbsf-utilities.module.d.ts +6 -0
- package/lib/shared/authentication/auth.service.d.ts +47 -0
- package/lib/shared/config/environment.d.ts +1 -0
- package/lib/shared/config/word/constants.d.ts +124 -0
- package/lib/shared/config/word/docx-document.d.ts +73 -0
- package/lib/shared/config/word/helpers/index.d.ts +1 -0
- package/lib/shared/config/word/helpers/render-document-file.d.ts +4 -0
- package/lib/shared/config/word/helpers/xml-builder.d.ts +14 -0
- package/lib/shared/config/word/html-to-docx.d.ts +1 -0
- package/lib/shared/config/word/index.d.ts +1 -0
- package/lib/shared/config/word/namespaces.d.ts +36 -0
- package/lib/shared/config/word/schemas/content-types.d.ts +1 -0
- package/lib/shared/config/word/schemas/core.d.ts +1 -0
- package/lib/shared/config/word/schemas/document-rels.d.ts +1 -0
- package/lib/shared/config/word/schemas/document.template.d.ts +4 -0
- package/lib/shared/config/word/schemas/font-table.d.ts +1 -0
- package/lib/shared/config/word/schemas/generic-rels.d.ts +1 -0
- package/lib/shared/config/word/schemas/index.d.ts +12 -0
- package/lib/shared/config/word/schemas/numbering.d.ts +1 -0
- package/lib/shared/config/word/schemas/rels.d.ts +1 -0
- package/lib/shared/config/word/schemas/settings.d.ts +1 -0
- package/lib/shared/config/word/schemas/styles.d.ts +1 -0
- package/lib/shared/config/word/schemas/theme.d.ts +1 -0
- package/lib/shared/config/word/schemas/web-settings.d.ts +1 -0
- package/lib/shared/config/word/utils/color-conversion.d.ts +7 -0
- package/lib/shared/config/word/utils/list.d.ts +6 -0
- package/lib/shared/config/word/utils/unit-conversion.d.ts +29 -0
- package/lib/shared/config/word/utils/url.d.ts +1 -0
- package/lib/shared/config/word/utils/vnode.d.ts +1 -0
- package/lib/shared/config/word/word-work/templates/documentTemplate.d.ts +12 -0
- package/lib/shared/config/word/word-work/templates/index.d.ts +3 -0
- package/lib/shared/config/word/word-work/templates/mhtDocumentTemplate.d.ts +1 -0
- package/lib/shared/config/word/word-work/templates/mhtPartTemplate.d.ts +1 -0
- package/lib/shared/config/word/word-work/utils.d.ts +1 -0
- package/lib/shared/models/AreaModel.d.ts +4 -0
- package/{src/lib/shared/models/ErrorModel.ts → lib/shared/models/ErrorModel.d.ts} +2 -5
- package/lib/shared/models/RequestOptionsModel.d.ts +11 -0
- package/lib/shared/models/UserModel.d.ts +6 -0
- package/lib/shared/models/WordDocumentModel.d.ts +16 -0
- package/lib/shared/services/AppearanceConfiguration.service.d.ts +11 -0
- package/lib/shared/services/configuration.service.d.ts +7 -0
- package/lib/shared/services/controlvalidation.service.d.ts +20 -0
- package/lib/shared/services/environment.service.d.ts +13 -0
- package/lib/shared/services/masterlayout.service.d.ts +24 -0
- package/lib/shared/services/requesthandler.service.d.ts +32 -0
- package/lib/shared/services/stylesbundle.service.d.ts +9 -0
- package/lib/shared/services/translate.service.d.ts +3 -0
- package/lib/shared/services/translationresolver.service.d.ts +8 -0
- package/lib/shared/services/utility.service.d.ts +21 -0
- package/lib/shared/services/word-document.service.d.ts +5 -0
- package/package.json +30 -20
- package/public-api.d.ts +16 -0
- package/karma.conf.js +0 -44
- package/ng-package.json +0 -10
- package/src/lib/bbsf-utilities.module.ts +0 -52
- package/src/lib/shared/authentication/auth.service.ts +0 -242
- package/src/lib/shared/config/environment.ts +0 -16
- package/src/lib/shared/config/word/constants.js +0 -133
- package/src/lib/shared/config/word/docx-document.js +0 -482
- package/src/lib/shared/config/word/helpers/index.js +0 -3
- package/src/lib/shared/config/word/helpers/render-document-file.js +0 -334
- package/src/lib/shared/config/word/helpers/xml-builder.js +0 -2165
- package/src/lib/shared/config/word/html-to-docx.js +0 -259
- package/src/lib/shared/config/word/index.js +0 -63
- package/src/lib/shared/config/word/namespaces.js +0 -40
- package/src/lib/shared/config/word/schemas/content-types.js +0 -26
- package/src/lib/shared/config/word/schemas/core.js +0 -44
- package/src/lib/shared/config/word/schemas/document-rels.js +0 -17
- package/src/lib/shared/config/word/schemas/document.template.js +0 -119
- package/src/lib/shared/config/word/schemas/font-table.js +0 -41
- package/src/lib/shared/config/word/schemas/generic-rels.js +0 -11
- package/src/lib/shared/config/word/schemas/index.js +0 -12
- package/src/lib/shared/config/word/schemas/numbering.js +0 -18
- package/src/lib/shared/config/word/schemas/rels.js +0 -12
- package/src/lib/shared/config/word/schemas/settings.js +0 -14
- package/src/lib/shared/config/word/schemas/styles.js +0 -152
- package/src/lib/shared/config/word/schemas/theme.js +0 -199
- package/src/lib/shared/config/word/schemas/web-settings.js +0 -10
- package/src/lib/shared/config/word/utils/color-conversion.js +0 -60
- package/src/lib/shared/config/word/utils/list.js +0 -55
- package/src/lib/shared/config/word/utils/unit-conversion.js +0 -53
- package/src/lib/shared/config/word/utils/url.js +0 -8
- package/src/lib/shared/config/word/utils/vnode.js +0 -3
- package/src/lib/shared/config/word/word-work/assets/contentTypesXml.ts +0 -1
- package/src/lib/shared/config/word/word-work/assets/documentXmlRels.ts +0 -1
- package/src/lib/shared/config/word/word-work/assets/index.ts +0 -3
- package/src/lib/shared/config/word/word-work/assets/relsXml.ts +0 -1
- package/src/lib/shared/config/word/word-work/index.ts +0 -8
- package/src/lib/shared/config/word/word-work/internal.ts +0 -69
- package/src/lib/shared/config/word/word-work/templates/documentTemplate.ts +0 -58
- package/src/lib/shared/config/word/word-work/templates/index.ts +0 -3
- package/src/lib/shared/config/word/word-work/templates/mhtDocumentTemplate.ts +0 -21
- package/src/lib/shared/config/word/word-work/templates/mhtPartTemplate.ts +0 -14
- package/src/lib/shared/config/word/word-work/utils.ts +0 -27
- package/src/lib/shared/models/AreaModel.ts +0 -5
- package/src/lib/shared/models/RequestOptionsModel.ts +0 -13
- package/src/lib/shared/models/WordDocumentModel.ts +0 -19
- package/src/lib/shared/services/AppearanceConfiguration.service.ts +0 -30
- package/src/lib/shared/services/configuration.service.ts +0 -18
- package/src/lib/shared/services/controlvalidation.service.ts +0 -194
- package/src/lib/shared/services/environment.service.ts +0 -56
- package/src/lib/shared/services/masterlayout.service.ts +0 -89
- package/src/lib/shared/services/requesthandler.service.ts +0 -241
- package/src/lib/shared/services/stylesbundle.service.ts +0 -52
- package/src/lib/shared/services/translate.service.ts +0 -8
- package/src/lib/shared/services/translationresolver.service.ts +0 -16
- package/src/lib/shared/services/utility.service.ts +0 -94
- package/src/lib/shared/services/word-document.service.ts +0 -36
- package/src/public-api.ts +0 -27
- package/src/test.ts +0 -26
- package/tsconfig.lib.json +0 -39
- package/tsconfig.lib.prod.json +0 -11
- package/tsconfig.spec.json +0 -17
- package/tslint.json +0 -17
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BBSFTranslateService } from './translate.service';
|
|
2
|
+
export declare class StylesBundleService {
|
|
3
|
+
private document;
|
|
4
|
+
private translateService;
|
|
5
|
+
constructor(document: Document, translateService: BBSFTranslateService);
|
|
6
|
+
loadThemes(lang: string, bundleEnglishName: string, bundleArabicName: string): void;
|
|
7
|
+
loadThemesColor(theme: string, bundleDarkName: string, bundleLightName: string): void;
|
|
8
|
+
loadStyleBundle(styleName: string): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Resolve } from "@angular/router";
|
|
2
|
+
import { Observable } from "rxjs";
|
|
3
|
+
import { BBSFTranslateService } from "./translate.service";
|
|
4
|
+
export declare class TranslationResolverService implements Resolve<any> {
|
|
5
|
+
private translateService;
|
|
6
|
+
constructor(translateService: BBSFTranslateService);
|
|
7
|
+
resolve(): Observable<any>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { NgBlockUI } from 'ng-block-ui';
|
|
2
|
+
import { AuthService } from '../authentication/auth.service';
|
|
3
|
+
import { BBSFTranslateService } from './translate.service';
|
|
4
|
+
import { EnvironmentService } from './environment.service';
|
|
5
|
+
export declare class UtilityService {
|
|
6
|
+
private translator;
|
|
7
|
+
private authService;
|
|
8
|
+
private environmentService;
|
|
9
|
+
isCreatedBefore: boolean;
|
|
10
|
+
blockUI: NgBlockUI;
|
|
11
|
+
constructor(translator: BBSFTranslateService, authService: AuthService, environmentService: EnvironmentService);
|
|
12
|
+
getResourceValue(Key: string): string;
|
|
13
|
+
getCurrentLanguage(): string;
|
|
14
|
+
isCurrentLanguageEnglish(): boolean;
|
|
15
|
+
isCurrentLanguageArabic(): boolean;
|
|
16
|
+
notifySuccessMessage(Message?: string, title?: string, time?: number, showHeader?: boolean): void;
|
|
17
|
+
notifyErrorMessage(Message?: string, title?: string, time?: number, showHeader?: boolean): void;
|
|
18
|
+
notifyWarningMessage(Message?: string, title?: string, time?: number, showHeader?: boolean): void;
|
|
19
|
+
startBlockUI(): void;
|
|
20
|
+
stopBlockUI(): void;
|
|
21
|
+
}
|
package/package.json
CHANGED
|
@@ -1,20 +1,30 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@bnsights/bbsf-utilities",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"peerDependencies": {
|
|
5
|
-
"@angular/common": "~12.2.12",
|
|
6
|
-
"@angular/core": "~12.2.12"
|
|
7
|
-
},
|
|
8
|
-
"dependencies": {
|
|
9
|
-
"@angular/http": "^7.2.16",
|
|
10
|
-
"@
|
|
11
|
-
"@ngx-translate/
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@bnsights/bbsf-utilities",
|
|
3
|
+
"version": "1.0.38",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/common": "~12.2.12",
|
|
6
|
+
"@angular/core": "~12.2.12"
|
|
7
|
+
},
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"@angular/http": "^7.2.16",
|
|
10
|
+
"@auth0/angular-jwt": "^5.2.0",
|
|
11
|
+
"@ngx-translate/core": "^13.0.0",
|
|
12
|
+
"@ngx-translate/http-loader": "^6.0.0",
|
|
13
|
+
"class-transformer": "^0.5.1",
|
|
14
|
+
"ng-block-ui": "^3.0.2",
|
|
15
|
+
"ng-pick-datetime": "^7.0.0",
|
|
16
|
+
"ngx-cookie-service": "12.0.3",
|
|
17
|
+
"ngx-toastr": "^13.2.0",
|
|
18
|
+
"oidc-client": "^1.11.5",
|
|
19
|
+
"reflect-metadata": "^0.1.13",
|
|
20
|
+
"tslib": "^2.0.0"
|
|
21
|
+
},
|
|
22
|
+
"main": "bundles/bnsights-bbsf-utilities.umd.js",
|
|
23
|
+
"module": "fesm2015/bnsights-bbsf-utilities.js",
|
|
24
|
+
"es2015": "fesm2015/bnsights-bbsf-utilities.js",
|
|
25
|
+
"esm2015": "esm2015/bnsights-bbsf-utilities.js",
|
|
26
|
+
"fesm2015": "fesm2015/bnsights-bbsf-utilities.js",
|
|
27
|
+
"typings": "bnsights-bbsf-utilities.d.ts",
|
|
28
|
+
"metadata": "bnsights-bbsf-utilities.metadata.json",
|
|
29
|
+
"sideEffects": false
|
|
30
|
+
}
|
package/public-api.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * from './lib/bbsf-utilities.module';
|
|
2
|
+
export * from './lib/shared/services/utility.service';
|
|
3
|
+
export * from './lib/shared/services/environment.service';
|
|
4
|
+
export * from './lib/shared/services/requesthandler.service';
|
|
5
|
+
export * from './lib/shared/services/stylesbundle.service';
|
|
6
|
+
export * from './lib/shared/services/translate.service';
|
|
7
|
+
export * from './lib/shared/services/controlvalidation.service';
|
|
8
|
+
export * from './lib/shared/services/masterlayout.service';
|
|
9
|
+
export * from './lib/shared/services/translationresolver.service';
|
|
10
|
+
export * from './lib/shared/services/AppearanceConfiguration.service';
|
|
11
|
+
export * from './lib/shared/services/configuration.service';
|
|
12
|
+
export * from './lib/shared/services/word-document.service';
|
|
13
|
+
export * from './lib/shared/config/environment';
|
|
14
|
+
export * from './lib/shared/authentication/auth.service';
|
|
15
|
+
export * from './lib/shared/models/RequestOptionsModel';
|
|
16
|
+
export * from './lib/shared/models/WordDocumentModel';
|
package/karma.conf.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
// Karma configuration file, see link for more information
|
|
2
|
-
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
|
3
|
-
|
|
4
|
-
module.exports = function (config) {
|
|
5
|
-
config.set({
|
|
6
|
-
basePath: '',
|
|
7
|
-
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
|
8
|
-
plugins: [
|
|
9
|
-
require('karma-jasmine'),
|
|
10
|
-
require('karma-chrome-launcher'),
|
|
11
|
-
require('karma-jasmine-html-reporter'),
|
|
12
|
-
require('karma-coverage'),
|
|
13
|
-
require('@angular-devkit/build-angular/plugins/karma')
|
|
14
|
-
],
|
|
15
|
-
client: {
|
|
16
|
-
jasmine: {
|
|
17
|
-
// you can add configuration options for Jasmine here
|
|
18
|
-
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
|
|
19
|
-
// for example, you can disable the random execution with `random: false`
|
|
20
|
-
// or set a specific seed with `seed: 4321`
|
|
21
|
-
},
|
|
22
|
-
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
|
23
|
-
},
|
|
24
|
-
jasmineHtmlReporter: {
|
|
25
|
-
suppressAll: true // removes the duplicated traces
|
|
26
|
-
},
|
|
27
|
-
coverageReporter: {
|
|
28
|
-
dir: require('path').join(__dirname, '../../coverage/@bnsights/bbsf-utilities'),
|
|
29
|
-
subdir: '.',
|
|
30
|
-
reporters: [
|
|
31
|
-
{ type: 'html' },
|
|
32
|
-
{ type: 'text-summary' }
|
|
33
|
-
]
|
|
34
|
-
},
|
|
35
|
-
reporters: ['progress', 'kjhtml'],
|
|
36
|
-
port: 9876,
|
|
37
|
-
colors: true,
|
|
38
|
-
logLevel: config.LOG_INFO,
|
|
39
|
-
autoWatch: true,
|
|
40
|
-
browsers: ['Chrome'],
|
|
41
|
-
singleRun: false,
|
|
42
|
-
restartOnFileChange: true
|
|
43
|
-
});
|
|
44
|
-
};
|
package/ng-package.json
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { CommonModule } from '@angular/common';
|
|
2
|
-
import { HttpClient } from '@angular/common/http';
|
|
3
|
-
import { Injector, NgModule } from '@angular/core';
|
|
4
|
-
import { RouterModule } from '@angular/router';
|
|
5
|
-
import { TranslateService } from '@ngx-translate/core';
|
|
6
|
-
import { BlockUIModule } from 'ng-block-ui';
|
|
7
|
-
import { ToastrModule } from 'ngx-toastr';
|
|
8
|
-
import { HttpModule } from '@angular/http';
|
|
9
|
-
import { UtilityService } from './shared/services/utility.service';
|
|
10
|
-
import { EnvironmentService } from './shared/services/environment.service';
|
|
11
|
-
import { AuthService } from './shared/authentication/auth.service';
|
|
12
|
-
import { RequestHandlerService } from './shared/services/requesthandler.service';
|
|
13
|
-
import { StylesBundleService } from './shared/services/stylesbundle.service';
|
|
14
|
-
import { BBSFTranslateService } from './shared/services/translate.service';
|
|
15
|
-
import { ControlValidationService } from './shared/services/controlvalidation.service';
|
|
16
|
-
import { MasterLayoutService } from './shared/services/masterlayout.service';
|
|
17
|
-
import { ConfigurationService } from './shared/services/configuration.service';
|
|
18
|
-
|
|
19
|
-
export let AppInjector: Injector;
|
|
20
|
-
|
|
21
|
-
@NgModule({
|
|
22
|
-
declarations: [
|
|
23
|
-
],
|
|
24
|
-
imports: [
|
|
25
|
-
CommonModule,
|
|
26
|
-
BlockUIModule.forRoot(),
|
|
27
|
-
HttpModule,
|
|
28
|
-
RouterModule,
|
|
29
|
-
ToastrModule.forRoot(),
|
|
30
|
-
|
|
31
|
-
],
|
|
32
|
-
exports: [
|
|
33
|
-
],
|
|
34
|
-
providers: [
|
|
35
|
-
UtilityService,
|
|
36
|
-
EnvironmentService,
|
|
37
|
-
AuthService,
|
|
38
|
-
RequestHandlerService,
|
|
39
|
-
StylesBundleService,
|
|
40
|
-
TranslateService,
|
|
41
|
-
BBSFTranslateService,
|
|
42
|
-
ControlValidationService,
|
|
43
|
-
MasterLayoutService,
|
|
44
|
-
ConfigurationService
|
|
45
|
-
]
|
|
46
|
-
})
|
|
47
|
-
export class BBSFUtilitiesModule {
|
|
48
|
-
constructor(private injector: Injector) {
|
|
49
|
-
AppInjector = this.injector;
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
}
|
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
import { Injectable, Injector } from '@angular/core';
|
|
2
|
-
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
|
3
|
-
import { UserManager, User, WebStorageStateStore } from 'oidc-client';
|
|
4
|
-
import { BehaviorSubject, Subject } from 'rxjs';
|
|
5
|
-
import { EnvironmentService } from '../services/environment.service';
|
|
6
|
-
import { BBSFTranslateService } from '../services/translate.service';
|
|
7
|
-
import { Router } from '@angular/router';
|
|
8
|
-
import { MasterLayoutService } from '../services/masterlayout.service';
|
|
9
|
-
|
|
10
|
-
@Injectable({
|
|
11
|
-
providedIn: 'root',
|
|
12
|
-
})
|
|
13
|
-
export class AuthService {
|
|
14
|
-
// Observable navItem source
|
|
15
|
-
private _authNavStatusSource = new BehaviorSubject<boolean>(false);
|
|
16
|
-
// Observable navItem stream
|
|
17
|
-
authNavStatus$ = this._authNavStatusSource.asObservable();
|
|
18
|
-
// Observable navItem source
|
|
19
|
-
private _userSource: Subject<User> = new Subject<User>();
|
|
20
|
-
UserStatus$ = this._userSource.asObservable();
|
|
21
|
-
private manager = this.getUserManager();
|
|
22
|
-
public redirectUrl: string = '';
|
|
23
|
-
static user: User | null = null;
|
|
24
|
-
user: User | null;
|
|
25
|
-
static UserClaims: any = null;
|
|
26
|
-
|
|
27
|
-
constructor(private injector: Injector, private http: HttpClient, private environmentService: EnvironmentService, private translateService: BBSFTranslateService, private router: Router) {
|
|
28
|
-
|
|
29
|
-
this.manager.getUser().then(async (user) => {
|
|
30
|
-
this.manager.storeUser(user);
|
|
31
|
-
AuthService.user = user;
|
|
32
|
-
this.user = user;
|
|
33
|
-
this._authNavStatusSource.next(await this.isAuthenticated());
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
this.manager.events.addAccessTokenExpired((_) => {
|
|
37
|
-
this._authNavStatusSource.next(false);
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
getUserManager() {
|
|
42
|
-
let user = null;
|
|
43
|
-
let isExternal =
|
|
44
|
-
this.environmentService.getIsIdentityServerExternal().toLowerCase() ==
|
|
45
|
-
'true';
|
|
46
|
-
if (isExternal) {
|
|
47
|
-
user = new UserManager({
|
|
48
|
-
authority: this.environmentService.getIdentityServerUrl(),
|
|
49
|
-
client_id: this.environmentService.getIsIdentityServerClientId(),
|
|
50
|
-
client_secret:
|
|
51
|
-
this.environmentService.getIsIdentityServerClientSecret(),
|
|
52
|
-
redirect_uri:
|
|
53
|
-
this.environmentService.getBaseUrl() +
|
|
54
|
-
'/Admin/authentication/auth-callback',
|
|
55
|
-
post_logout_redirect_uri: this.environmentService.getBaseUrl(),
|
|
56
|
-
response_type: 'code',
|
|
57
|
-
scope: 'openid profile email',
|
|
58
|
-
filterProtocolClaims: true,
|
|
59
|
-
loadUserInfo: true,
|
|
60
|
-
automaticSilentRenew: true,
|
|
61
|
-
silent_redirect_uri:
|
|
62
|
-
this.environmentService.getBaseUrl() + '/assets/silent-callback.html',
|
|
63
|
-
userStore: new WebStorageStateStore({ store: window.localStorage }),
|
|
64
|
-
});
|
|
65
|
-
} else {
|
|
66
|
-
user = new UserManager({
|
|
67
|
-
authority: this.environmentService.getIdentityServerUrl(),
|
|
68
|
-
client_id: 'angular_spa',
|
|
69
|
-
redirect_uri:
|
|
70
|
-
this.environmentService.getBaseUrl() +
|
|
71
|
-
'/Admin/authentication/auth-callback',
|
|
72
|
-
post_logout_redirect_uri: this.environmentService.getBaseUrl(),
|
|
73
|
-
response_type: 'id_token token',
|
|
74
|
-
scope: 'openid profile email IdentityServerApi',
|
|
75
|
-
filterProtocolClaims: true,
|
|
76
|
-
loadUserInfo: true,
|
|
77
|
-
automaticSilentRenew: true,
|
|
78
|
-
silent_redirect_uri:
|
|
79
|
-
this.environmentService.getBaseUrl() + '/assets/silent-callback.html',
|
|
80
|
-
userStore: new WebStorageStateStore({ store: window.localStorage }),
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
return user;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
login() {
|
|
87
|
-
return this.manager.signinRedirect();
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
getUser() {
|
|
91
|
-
this.manager.getUser().then(async (user) => {
|
|
92
|
-
AuthService.user = user;
|
|
93
|
-
this.user = user;
|
|
94
|
-
this._authNavStatusSource.next(await this.isAuthenticated());
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
storUser(User: any) {
|
|
98
|
-
this.manager.storeUser(User);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
revokeAccessToken() {
|
|
102
|
-
this.manager.revokeAccessToken();
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
signinSilent() {
|
|
106
|
-
let x = this.manager.signinSilentCallback();
|
|
107
|
-
x.then((s) => {
|
|
108
|
-
//console.log(s)
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
async completeAuthentication() {
|
|
113
|
-
this.user = await this.manager.signinRedirectCallback();
|
|
114
|
-
AuthService.user = this.user;
|
|
115
|
-
this._userSource.next(AuthService.user);
|
|
116
|
-
this._authNavStatusSource.next(await this.isAuthenticated());
|
|
117
|
-
let isExternal =
|
|
118
|
-
this.environmentService.getIsIdentityServerExternal().toLowerCase() ==
|
|
119
|
-
'true';
|
|
120
|
-
if (isExternal) {
|
|
121
|
-
const masterLayoutService = this.injector.get(MasterLayoutService);
|
|
122
|
-
|
|
123
|
-
let userClaims = await masterLayoutService.getUserClaims().toPromise()
|
|
124
|
-
.then((e) => {
|
|
125
|
-
AuthService.UserClaims = e;
|
|
126
|
-
}, (error) => {
|
|
127
|
-
console.log(error)
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
AuthService.user.profile = Object.assign(
|
|
131
|
-
AuthService.user.profile,
|
|
132
|
-
AuthService.UserClaims
|
|
133
|
-
);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
this.storUser(AuthService.user);
|
|
137
|
-
if (
|
|
138
|
-
!localStorage.getItem('language') ||
|
|
139
|
-
localStorage.getItem('language') == this.user.profile.locale
|
|
140
|
-
)
|
|
141
|
-
localStorage.setItem('language', this.user.profile.locale);
|
|
142
|
-
|
|
143
|
-
if (this.translateService.currentLang != localStorage.getItem('language')) {
|
|
144
|
-
this.translateService.resetLang(this.translateService.currentLang);
|
|
145
|
-
await this.translateService
|
|
146
|
-
.reloadLang(localStorage.getItem('language'))
|
|
147
|
-
.subscribe((res) => {
|
|
148
|
-
console.log(res);
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
this._userSource.next(AuthService.user);
|
|
152
|
-
this._authNavStatusSource.next(await this.isAuthenticated());
|
|
153
|
-
this.user = AuthService.user;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
async refreshToken(token) {
|
|
157
|
-
const httpOptions = {
|
|
158
|
-
headers: new HttpHeaders({
|
|
159
|
-
'Content-Type': 'application/json',
|
|
160
|
-
Authorization: token,
|
|
161
|
-
}),
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
this.manager.revokeAccessToken();
|
|
165
|
-
return await this.http
|
|
166
|
-
.post<any>(
|
|
167
|
-
`${this.environmentService.getIdentityServerUrl()}/users/refresh-token`,
|
|
168
|
-
httpOptions,
|
|
169
|
-
{ withCredentials: true }
|
|
170
|
-
)
|
|
171
|
-
.subscribe((user) => {
|
|
172
|
-
this._userSource.next(user);
|
|
173
|
-
AuthService.user = user;
|
|
174
|
-
this.user = user;
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
getCurrentUser() {
|
|
179
|
-
return this.manager.getUser();
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
async isAuthenticated(): Promise<boolean> {
|
|
183
|
-
let user = await this.manager.getUser().then((user) => {
|
|
184
|
-
return user;
|
|
185
|
-
});
|
|
186
|
-
return this.user != null && !this.user.expired;
|
|
187
|
-
}
|
|
188
|
-
isUserInRole(allowedPermission: number[]) {
|
|
189
|
-
let selectedPermissionSetID: number = Number.parseInt(
|
|
190
|
-
this.user.profile['selectedpermissionsetid']
|
|
191
|
-
);
|
|
192
|
-
return allowedPermission.includes(selectedPermissionSetID);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
authorizationHeaderValue(): string {
|
|
196
|
-
return AuthService.user
|
|
197
|
-
? `${AuthService.user.token_type} ${AuthService.user.access_token}`
|
|
198
|
-
: '';
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
name(): string {
|
|
202
|
-
return AuthService.user != null ? AuthService.user.profile.given_name : '';
|
|
203
|
-
}
|
|
204
|
-
setUrl(url) {
|
|
205
|
-
localStorage.setItem('redirectUrl', url);
|
|
206
|
-
}
|
|
207
|
-
getUrl() {
|
|
208
|
-
return localStorage.getItem('redirectUrl');
|
|
209
|
-
}
|
|
210
|
-
async signinSilentCallback() {
|
|
211
|
-
let user = await this.manager.signinSilentCallback();
|
|
212
|
-
//await this.manager.storeUser(user);
|
|
213
|
-
AuthService.user = user;
|
|
214
|
-
console.log('Token from signinSilentCallback :' + AuthService.user);
|
|
215
|
-
this.user = user;
|
|
216
|
-
}
|
|
217
|
-
async signout() {
|
|
218
|
-
if (await !this.isAuthenticated())
|
|
219
|
-
this.router.navigate(['/Admin/account/login']), localStorage.clear();
|
|
220
|
-
let isExternal =
|
|
221
|
-
this.environmentService.getIsIdentityServerExternal().toLowerCase() ==
|
|
222
|
-
'true';
|
|
223
|
-
if (isExternal) {
|
|
224
|
-
await this.clearUserSessionClaims()
|
|
225
|
-
.toPromise()
|
|
226
|
-
.then((res) => {
|
|
227
|
-
let result = res;
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
await this.manager.signoutRedirect();
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
clearUserSessionClaims() {
|
|
234
|
-
const httpOptions = {
|
|
235
|
-
headers: new HttpHeaders({
|
|
236
|
-
'Content-Type': 'application/json',
|
|
237
|
-
}),
|
|
238
|
-
};
|
|
239
|
-
let ApiUrl = '/api/Home/';
|
|
240
|
-
return this.http.get(this.environmentService.getBaseUrl() + ApiUrl + 'ClearCurrentUserSession', httpOptions);
|
|
241
|
-
}
|
|
242
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// This file can be replaced during build by using the `fileReplacements` array.
|
|
2
|
-
// `ng build ---prod` replaces `environment.ts` with `environment.prod.ts`.
|
|
3
|
-
// The list of file replacements can be found in `angular.json`.
|
|
4
|
-
|
|
5
|
-
export const environment = Object.assign({
|
|
6
|
-
},
|
|
7
|
-
(window as any).Environment);
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
/*
|
|
11
|
-
* In development mode, to ignore zone related error stack frames such as
|
|
12
|
-
* `zone.run`, `zoneDelegate.invokeTask` for easier debugging, you can
|
|
13
|
-
* import the following file, but please comment it out in production mode
|
|
14
|
-
* because it will have performance impact when throw error
|
|
15
|
-
*/
|
|
16
|
-
// import 'zone.js/dist/zone-error'; // Included with Angular CLI.
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { cloneDeep } from 'lodash';
|
|
2
|
-
|
|
3
|
-
const applicationName = 'html-to-docx';
|
|
4
|
-
const defaultOrientation = 'portrait';
|
|
5
|
-
const landscapeWidth = 15840;
|
|
6
|
-
const landscapeHeight = 12240;
|
|
7
|
-
const landscapeMargins = {
|
|
8
|
-
top: 1800,
|
|
9
|
-
right: 1440,
|
|
10
|
-
bottom: 1800,
|
|
11
|
-
left: 1440,
|
|
12
|
-
header: 720,
|
|
13
|
-
footer: 720,
|
|
14
|
-
gutter: 0,
|
|
15
|
-
};
|
|
16
|
-
const portraitMargins = {
|
|
17
|
-
top: 1440,
|
|
18
|
-
right: 1800,
|
|
19
|
-
bottom: 1440,
|
|
20
|
-
left: 1800,
|
|
21
|
-
header: 720,
|
|
22
|
-
footer: 720,
|
|
23
|
-
gutter: 0,
|
|
24
|
-
};
|
|
25
|
-
const defaultFont = 'Times New Roman';
|
|
26
|
-
const defaultFontSize = 22;
|
|
27
|
-
const defaultDocumentOptions = {
|
|
28
|
-
orientation: defaultOrientation,
|
|
29
|
-
margins: cloneDeep(portraitMargins),
|
|
30
|
-
title: '',
|
|
31
|
-
subject: '',
|
|
32
|
-
creator: applicationName,
|
|
33
|
-
keywords: [applicationName],
|
|
34
|
-
description: '',
|
|
35
|
-
lastModifiedBy: applicationName,
|
|
36
|
-
revision: 1,
|
|
37
|
-
createdAt: new Date(),
|
|
38
|
-
modifiedAt: new Date(),
|
|
39
|
-
headerType: 'default',
|
|
40
|
-
header: false,
|
|
41
|
-
footerType: 'default',
|
|
42
|
-
footer: false,
|
|
43
|
-
font: defaultFont,
|
|
44
|
-
fontSize: defaultFontSize,
|
|
45
|
-
complexScriptFontSize: defaultFontSize,
|
|
46
|
-
table: {
|
|
47
|
-
row: {
|
|
48
|
-
cantSplit: false,
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
pageSize: {
|
|
52
|
-
width: landscapeHeight,
|
|
53
|
-
height: landscapeWidth,
|
|
54
|
-
},
|
|
55
|
-
pageNumber: false,
|
|
56
|
-
skipFirstHeaderFooter: false,
|
|
57
|
-
lineNumber: false,
|
|
58
|
-
lineNumberOptions: {
|
|
59
|
-
countBy: 1,
|
|
60
|
-
start: 0,
|
|
61
|
-
restart: 'continuous',
|
|
62
|
-
},
|
|
63
|
-
numbering: {
|
|
64
|
-
defaultOrderedListStyleType: 'decimal',
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
const defaultHTMLString = '<p></p>';
|
|
68
|
-
const relsFolderName = '_rels';
|
|
69
|
-
const headerFileName = 'header1';
|
|
70
|
-
const footerFileName = 'footer1';
|
|
71
|
-
const themeFileName = 'theme1';
|
|
72
|
-
const documentFileName = 'document';
|
|
73
|
-
const headerType = 'header';
|
|
74
|
-
const footerType = 'footer';
|
|
75
|
-
const themeType = 'theme';
|
|
76
|
-
const hyperlinkType = 'hyperlink';
|
|
77
|
-
const imageType = 'image';
|
|
78
|
-
const internalRelationship = 'Internal';
|
|
79
|
-
const wordFolder = 'word';
|
|
80
|
-
const themeFolder = 'theme';
|
|
81
|
-
const paragraphBordersObject = {
|
|
82
|
-
top: {
|
|
83
|
-
size: 0,
|
|
84
|
-
spacing: 3,
|
|
85
|
-
color: 'FFFFFF',
|
|
86
|
-
},
|
|
87
|
-
left: {
|
|
88
|
-
size: 0,
|
|
89
|
-
spacing: 3,
|
|
90
|
-
color: 'FFFFFF',
|
|
91
|
-
},
|
|
92
|
-
bottom: {
|
|
93
|
-
size: 0,
|
|
94
|
-
spacing: 3,
|
|
95
|
-
color: 'FFFFFF',
|
|
96
|
-
},
|
|
97
|
-
right: {
|
|
98
|
-
size: 0,
|
|
99
|
-
spacing: 3,
|
|
100
|
-
color: 'FFFFFF',
|
|
101
|
-
},
|
|
102
|
-
};
|
|
103
|
-
const colorlessColors = ['transparent', 'auto'];
|
|
104
|
-
const verticalAlignValues = ['top', 'middle', 'bottom'];
|
|
105
|
-
|
|
106
|
-
export {
|
|
107
|
-
defaultDocumentOptions,
|
|
108
|
-
defaultHTMLString,
|
|
109
|
-
relsFolderName,
|
|
110
|
-
headerFileName,
|
|
111
|
-
footerFileName,
|
|
112
|
-
themeFileName,
|
|
113
|
-
documentFileName,
|
|
114
|
-
headerType,
|
|
115
|
-
footerType,
|
|
116
|
-
themeType,
|
|
117
|
-
internalRelationship,
|
|
118
|
-
wordFolder,
|
|
119
|
-
themeFolder,
|
|
120
|
-
landscapeMargins,
|
|
121
|
-
portraitMargins,
|
|
122
|
-
defaultOrientation,
|
|
123
|
-
landscapeWidth,
|
|
124
|
-
landscapeHeight,
|
|
125
|
-
applicationName,
|
|
126
|
-
defaultFont,
|
|
127
|
-
defaultFontSize,
|
|
128
|
-
hyperlinkType,
|
|
129
|
-
imageType,
|
|
130
|
-
paragraphBordersObject,
|
|
131
|
-
colorlessColors,
|
|
132
|
-
verticalAlignValues,
|
|
133
|
-
};
|