@cleavelandprice/ngx-lib 3.0.4 → 3.0.6

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 (34) hide show
  1. package/esm2020/active-directory/services/active-directory.service.mjs +13 -4
  2. package/esm2020/authentication/services/authentication.service.mjs +5 -2
  3. package/esm2020/lib/services/app-path-config.service.mjs +5 -2
  4. package/esm2020/sharepoint/services/sharepoint.service.mjs +5 -2
  5. package/esm2020/upload/components/upload/upload.component.mjs +3 -3
  6. package/esm2020/upload/components/upload-dialog/upload-dialog.component.mjs +6 -10
  7. package/esm2020/upload/model/default-config.mjs +14 -0
  8. package/esm2020/upload/model/service-config.mjs +14 -1
  9. package/esm2020/upload/services/upload.service.mjs +28 -30
  10. package/fesm2015/cleavelandprice-ngx-lib-active-directory.mjs +3 -4
  11. package/fesm2015/cleavelandprice-ngx-lib-active-directory.mjs.map +1 -1
  12. package/fesm2015/cleavelandprice-ngx-lib-authentication.mjs +1 -2
  13. package/fesm2015/cleavelandprice-ngx-lib-authentication.mjs.map +1 -1
  14. package/fesm2015/cleavelandprice-ngx-lib-sharepoint.mjs +1 -2
  15. package/fesm2015/cleavelandprice-ngx-lib-sharepoint.mjs.map +1 -1
  16. package/fesm2015/cleavelandprice-ngx-lib-upload.mjs +58 -43
  17. package/fesm2015/cleavelandprice-ngx-lib-upload.mjs.map +1 -1
  18. package/fesm2015/cleavelandprice-ngx-lib.mjs +1 -2
  19. package/fesm2015/cleavelandprice-ngx-lib.mjs.map +1 -1
  20. package/fesm2020/cleavelandprice-ngx-lib-active-directory.mjs +12 -3
  21. package/fesm2020/cleavelandprice-ngx-lib-active-directory.mjs.map +1 -1
  22. package/fesm2020/cleavelandprice-ngx-lib-authentication.mjs +4 -1
  23. package/fesm2020/cleavelandprice-ngx-lib-authentication.mjs.map +1 -1
  24. package/fesm2020/cleavelandprice-ngx-lib-sharepoint.mjs +4 -1
  25. package/fesm2020/cleavelandprice-ngx-lib-sharepoint.mjs.map +1 -1
  26. package/fesm2020/cleavelandprice-ngx-lib-upload.mjs +61 -41
  27. package/fesm2020/cleavelandprice-ngx-lib-upload.mjs.map +1 -1
  28. package/fesm2020/cleavelandprice-ngx-lib.mjs +4 -1
  29. package/fesm2020/cleavelandprice-ngx-lib.mjs.map +1 -1
  30. package/package.json +1 -1
  31. package/upload/components/upload-dialog/upload-dialog.component.d.ts +1 -6
  32. package/upload/model/default-config.d.ts +2 -0
  33. package/upload/model/service-config.d.ts +10 -10
  34. package/upload/services/upload.service.d.ts +1 -11
@@ -1 +1 @@
1
- {"version":3,"file":"cleavelandprice-ngx-lib-active-directory.mjs","sources":["../../../../projects/cleavelandprice/ngx-lib/active-directory/src/model/service-config.ts","../../../../projects/cleavelandprice/ngx-lib/active-directory/src/model/default-caching-config.ts","../../../../projects/cleavelandprice/ngx-lib/active-directory/src/model/default-logging-config.ts","../../../../projects/cleavelandprice/ngx-lib/active-directory/src/model/default-config.ts","../../../../projects/cleavelandprice/ngx-lib/active-directory/src/services/active-directory.service.ts","../../../../projects/cleavelandprice/ngx-lib/active-directory/src/active-directory.module.ts","../../../../projects/cleavelandprice/ngx-lib/active-directory/src/cleavelandprice-ngx-lib-active-directory.ts"],"sourcesContent":["import { CachingConfig } from './caching-config';\r\nimport { LoggingConfig } from './logging-config';\r\n\r\nexport class ServiceConfig {\r\n apiUrl!: string;\r\n caching?: CachingConfig;\r\n logging?: LoggingConfig;\r\n}\r\n","import { CachingConfig } from \"./caching-config\";\r\n\r\nexport const defaultCachingConfig: CachingConfig = {\r\n enabled: false,\r\n lifeMinutes: 720\r\n}","import { LoggingConfig } from \"./logging-config\";\r\n\r\nexport const defaultLoggingConfig: LoggingConfig = {\r\n dataCached: false,\r\n cachedDataReturned: false,\r\n freshDataReturned: false,\r\n cacheCleared: false\r\n}","import { ServiceConfig } from \"./service-config\";\r\nimport { defaultCachingConfig } from './default-caching-config';\r\nimport { defaultLoggingConfig } from \"./default-logging-config\";\r\n\r\nexport const defaultConfig: ServiceConfig = {\r\n apiUrl: 'http://utilityapi/users',\r\n caching: defaultCachingConfig,\r\n logging: defaultLoggingConfig\r\n}","//#region Imports\nimport { Injectable, Optional } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { Observable, of } from 'rxjs';\n\nimport { defaultConfig } from '../model/default-config';\nimport { defaultCachingConfig } from '../model/default-caching-config';\nimport { defaultLoggingConfig } from '../model/default-logging-config';\n\nimport { CacheObject } from '../model/cache-object';\nimport { ServiceConfig } from '../model/service-config';\nimport { User } from '../model/user';\n\nimport moment from 'moment';\n//#endregion\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ActiveDirectoryService {\n private cache: CacheObject<User> | null = null;\n private defaultCacheLifeMinutes = 720;\n\n //#region Properties\n private get cacheExpired(): boolean {\n if (!this.cache) {\n return true;\n }\n\n const lifeMinutes = this.config.caching?.lifeMinutes ?? this.defaultCacheLifeMinutes;\n const expiration = moment(this.cache.lastUpdate)\n .add(lifeMinutes, 'minutes');\n\n return moment().isAfter(expiration);\n }\n //#endregion\n\n //#region Initialization\n // If a ServiceConfig object is not provided when the module is imported, then default values are pulled in from default-config.ts.\n constructor(@Optional() private config: ServiceConfig,\n private http: HttpClient) {\n\n this.config = this.config ?? defaultConfig;\n this.config.caching = this.config.caching ?? defaultCachingConfig;\n this.config.logging = this.config.logging ?? defaultLoggingConfig;\n }\n //#endregion\n\n getUsers(includePhoto = false, includeDisabled = false, parentOU?: string): Observable<User[]> {\n // If caching is enabled, there will be two calls to the API if the cache is null/expired\n // One call is to update the cache and the other is to return the data that the user requested\n // Subsequent calls will bypass the API and returned cached data until it expires\n\n const observable$ = this.http.get<User[]>(`${this.config.apiUrl}/${includePhoto}/${includeDisabled}/${parentOU ?? ''}`);\n\n if (this.config.caching?.enabled) {\n if (this.cacheExpired) {\n // Get the data and cache it\n observable$.subscribe(data => {\n this.cache = {\n data,\n lastUpdate: moment()\n };\n\n if (this.config.logging?.dataCached) {\n const lifeMinutes = this.config.caching?.lifeMinutes ?? this.defaultCacheLifeMinutes;\n console.log(`Data cached for ${lifeMinutes} minutes`);\n }\n });\n } else {\n // Cache exists and hasn't expired yet\n if (this.config.logging?.cachedDataReturned) {\n console.log('Returning cached users');\n }\n\n return of(this.cache!.data);\n }\n }\n\n // Cache is either disabled or expired, return data from API\n if (this.config.logging?.freshDataReturned) {\n console.log('Returning fresh users');\n }\n\n return observable$;\n }\n\n getUser(accountName: string, includePhoto = false): Observable<User> {\n return this.http.get<User>(`${this.config.apiUrl}/name/${accountName}/${includePhoto}`);\n }\n\n clearCache(): void {\n this.cache = null;\n\n if (this.config.logging?.cacheCleared) {\n console.log('Cache cleared');\n }\n }\n}\n","import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { ServiceConfig } from './model/service-config';\nimport { ActiveDirectoryService } from './services/active-directory.service';\n\n@NgModule({\n declarations: [],\n imports: [\n CommonModule\n ]\n})\nexport class ActiveDirectoryModule {\n static forRoot(config: ServiceConfig): ModuleWithProviders<ActiveDirectoryModule> {\n return {\n ngModule: ActiveDirectoryModule,\n providers: [\n ActiveDirectoryService,\n { provide: ServiceConfig, useValue: config }\n ]\n };\n }\n\n constructor( @Optional() @SkipSelf() parentModule: ActiveDirectoryModule) {\n if (parentModule) {\n throw new Error(\n 'ActiveDirectoryModule is already loaded. Import it in the AppModule only');\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["i1.ServiceConfig"],"mappings":";;;;;;;MAGa,aAAa,CAAA;AAIzB;;ACLM,MAAM,oBAAoB,GAAkB;AAC/C,IAAA,OAAO,EAAE,KAAK;AACd,IAAA,WAAW,EAAE,GAAG;CACnB;;ACHM,MAAM,oBAAoB,GAAkB;AAC/C,IAAA,UAAU,EAAE,KAAK;AACjB,IAAA,kBAAkB,EAAE,KAAK;AACzB,IAAA,iBAAiB,EAAE,KAAK;AACxB,IAAA,YAAY,EAAE,KAAK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AA;AAX7D,qBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,qBAAqB,YAH9B,YAAY,CAAA,EAAA,CAAA,CAAA;AAGH,qBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,qBAAqB,YAH9B,YAAY,CAAA,EAAA,CAAA,CAAA;2FAGH,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBANjC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,EAAE;AAChB,oBAAA,OAAO,EAAE;wBACP,YAAY;AACb,qBAAA;iBACF,CAAA;;wBAYoD,qBAAqB,EAAA,UAAA,EAAA,CAAA;8BAA1D,QAAQ;;8BAAI,QAAQ;;;;ACtBpC;;AAEG;;;;"}
1
+ {"version":3,"file":"cleavelandprice-ngx-lib-active-directory.mjs","sources":["../../../../projects/cleavelandprice/ngx-lib/active-directory/src/model/service-config.ts","../../../../projects/cleavelandprice/ngx-lib/active-directory/src/model/default-caching-config.ts","../../../../projects/cleavelandprice/ngx-lib/active-directory/src/model/default-logging-config.ts","../../../../projects/cleavelandprice/ngx-lib/active-directory/src/model/default-config.ts","../../../../projects/cleavelandprice/ngx-lib/active-directory/src/services/active-directory.service.ts","../../../../projects/cleavelandprice/ngx-lib/active-directory/src/active-directory.module.ts","../../../../projects/cleavelandprice/ngx-lib/active-directory/src/cleavelandprice-ngx-lib-active-directory.ts"],"sourcesContent":["import { CachingConfig } from './caching-config';\r\nimport { LoggingConfig } from './logging-config';\r\n\r\nexport class ServiceConfig {\r\n apiUrl!: string;\r\n caching?: CachingConfig;\r\n logging?: LoggingConfig;\r\n}\r\n","import { CachingConfig } from \"./caching-config\";\r\n\r\nexport const defaultCachingConfig: CachingConfig = {\r\n enabled: false,\r\n lifeMinutes: 720\r\n}","import { LoggingConfig } from \"./logging-config\";\r\n\r\nexport const defaultLoggingConfig: LoggingConfig = {\r\n dataCached: false,\r\n cachedDataReturned: false,\r\n freshDataReturned: false,\r\n cacheCleared: false\r\n}","import { ServiceConfig } from \"./service-config\";\r\nimport { defaultCachingConfig } from './default-caching-config';\r\nimport { defaultLoggingConfig } from \"./default-logging-config\";\r\n\r\nexport const defaultConfig: ServiceConfig = {\r\n apiUrl: 'http://utilityapi/users',\r\n caching: defaultCachingConfig,\r\n logging: defaultLoggingConfig\r\n}","//#region Imports\nimport { Injectable, Optional } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { Observable, of } from 'rxjs';\n\nimport { defaultConfig } from '../model/default-config';\nimport { defaultCachingConfig } from '../model/default-caching-config';\nimport { defaultLoggingConfig } from '../model/default-logging-config';\n\nimport { CacheObject } from '../model/cache-object';\nimport { ServiceConfig } from '../model/service-config';\nimport { User } from '../model/user';\n\nimport moment from 'moment';\n//#endregion\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ActiveDirectoryService {\n private cache: CacheObject<User> | null = null;\n private defaultCacheLifeMinutes = 720;\n\n //#region Properties\n private get cacheExpired(): boolean {\n if (!this.cache) {\n return true;\n }\n\n const lifeMinutes = this.config.caching?.lifeMinutes ?? this.defaultCacheLifeMinutes;\n const expiration = moment(this.cache.lastUpdate)\n .add(lifeMinutes, 'minutes');\n\n return moment().isAfter(expiration);\n }\n //#endregion\n\n //#region Initialization\n // If a ServiceConfig object is not provided when the module is imported, then default values are pulled in from default-config.ts.\n constructor(@Optional() private config: ServiceConfig,\n private http: HttpClient) {\n\n this.config = {\n ...defaultConfig,\n ...this.config\n };\n\n this.config.caching = {\n ...defaultCachingConfig,\n ...this.config.caching\n };\n\n this.config.logging = {\n ...defaultLoggingConfig,\n ...this.config.logging\n };\n }\n //#endregion\n\n getUsers(includePhoto = false, includeDisabled = false, parentOU?: string): Observable<User[]> {\n // If caching is enabled, there will be two calls to the API if the cache is null/expired\n // One call is to update the cache and the other is to return the data that the user requested\n // Subsequent calls will bypass the API and returned cached data until it expires\n\n const observable$ = this.http.get<User[]>(`${this.config.apiUrl}/${includePhoto}/${includeDisabled}/${parentOU ?? ''}`);\n\n if (this.config.caching?.enabled) {\n if (this.cacheExpired) {\n // Get the data and cache it\n observable$.subscribe(data => {\n this.cache = {\n data,\n lastUpdate: moment()\n };\n\n if (this.config.logging?.dataCached) {\n const lifeMinutes = this.config.caching?.lifeMinutes ?? this.defaultCacheLifeMinutes;\n console.log(`Data cached for ${lifeMinutes} minutes`);\n }\n });\n } else {\n // Cache exists and hasn't expired yet\n if (this.config.logging?.cachedDataReturned) {\n console.log('Returning cached users');\n }\n\n return of(this.cache!.data);\n }\n }\n\n // Cache is either disabled or expired, return data from API\n if (this.config.logging?.freshDataReturned) {\n console.log('Returning fresh users');\n }\n\n return observable$;\n }\n\n getUser(accountName: string, includePhoto = false): Observable<User> {\n return this.http.get<User>(`${this.config.apiUrl}/name/${accountName}/${includePhoto}`);\n }\n\n clearCache(): void {\n this.cache = null;\n\n if (this.config.logging?.cacheCleared) {\n console.log('Cache cleared');\n }\n }\n}\n","import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { ServiceConfig } from './model/service-config';\nimport { ActiveDirectoryService } from './services/active-directory.service';\n\n@NgModule({\n declarations: [],\n imports: [\n CommonModule\n ]\n})\nexport class ActiveDirectoryModule {\n static forRoot(config: ServiceConfig): ModuleWithProviders<ActiveDirectoryModule> {\n return {\n ngModule: ActiveDirectoryModule,\n providers: [\n ActiveDirectoryService,\n { provide: ServiceConfig, useValue: config }\n ]\n };\n }\n\n constructor( @Optional() @SkipSelf() parentModule: ActiveDirectoryModule) {\n if (parentModule) {\n throw new Error(\n 'ActiveDirectoryModule is already loaded. Import it in the AppModule only');\n }\n }\n}\n","/**\n * Generated bundle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AE;AAC7C,aAAA;SACF,CAAC;KACH;;AATU,qBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,kBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,qBAAqB,kBAWmB,qBAAqB,EAAA,QAAA,EAAA,IAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAX7D,qBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,qBAAqB,YAH9B,YAAY,CAAA,EAAA,CAAA,CAAA;AAGH,qBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,qBAAqB,YAH9B,YAAY,CAAA,EAAA,CAAA,CAAA;2FAGH,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBANjC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,EAAE;AAChB,oBAAA,OAAO,EAAE;wBACP,YAAY;AACb,qBAAA;iBACF,CAAA;;wBAYoD,qBAAqB,EAAA,UAAA,EAAA,CAAA;8BAA1D,QAAQ;;8BAAI,QAAQ;;;;ACtBpC;;AAEG;;;;"}
@@ -35,7 +35,6 @@ class AuthenticationService {
35
35
  //#region Lifecycle
36
36
  // If a ServiceConfig object is not provided when the module is imported, then default values are pulled in from default-config.ts.
37
37
  constructor(config, http, sharePointService) {
38
- var _a;
39
38
  this.config = config;
40
39
  this.http = http;
41
40
  this.sharePointService = sharePointService;
@@ -47,7 +46,7 @@ class AuthenticationService {
47
46
  this.authenticating = false;
48
47
  //Flag set to true when the user is successfully authenticated
49
48
  this.authenticated = false;
50
- this.config = (_a = this.config) !== null && _a !== void 0 ? _a : defaultConfig;
49
+ this.config = Object.assign(Object.assign({}, defaultConfig), this.config);
51
50
  this.checkForExistingToken();
52
51
  }
53
52
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"cleavelandprice-ngx-lib-authentication.mjs","sources":["../../../../projects/cleavelandprice/ngx-lib/authentication/src/model/service-config.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/src/model/default-config.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/src/services/authentication.service.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/src/components/login-form/login-form.component.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/src/components/login-form/login-form.component.html","../../../../projects/cleavelandprice/ngx-lib/authentication/src/components/login/login.component.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/src/components/login/login.component.html","../../../../projects/cleavelandprice/ngx-lib/authentication/src/authentication.module.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/src/cleavelandprice-ngx-lib-authentication.ts"],"sourcesContent":["export class ServiceConfig {\r\n apiUrl!: string;\r\n}\r\n","import { ServiceConfig } from \"./service-config\";\r\n\r\nexport const defaultConfig: ServiceConfig = {\r\n apiUrl: 'http://utilityapi/authenticate/token'\r\n}","//#region Imports\nimport { Injectable, Output, EventEmitter, Optional } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { JwtHelperService } from '@auth0/angular-jwt';\n\nimport { defaultConfig } from '../model/default-config';\n\nimport { AuthenticationToken } from '../model/authentication-token';\nimport { ServiceConfig } from '../model/service-config';\nimport { SharepointService } from '@cleavelandprice/ngx-lib/sharepoint';\nimport { AuthenticatedUser } from '../model/authenticated-user';\nimport { AuthenticationRequest } from '../model/authentication-request';\n//#endregion\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AuthenticationService {\n //#region Fields\n @Output() authenticatedChanged = new EventEmitter<boolean>();\n @Output() authenticatingChanged = new EventEmitter<boolean>();\n @Output() authenticationError = new EventEmitter();\n \n // Flag set to true while the service is attempting to authenticate the user\n authenticating = false;\n \n //Flag set to true when the user is successfully authenticated\n authenticated = false;\n \n // Object representing the authenticated user\n authenticatedUser!: AuthenticatedUser | null;\n //#endregion\n \n //#region Lifecycle\n // If a ServiceConfig object is not provided when the module is imported, then default values are pulled in from default-config.ts.\n constructor(@Optional() private config: ServiceConfig,\n private http: HttpClient,\n private sharePointService: SharepointService) {\n\n this.config = this.config ?? defaultConfig;\n \n this.checkForExistingToken();\n }\n //#endregion\n\n //#region Utilities\n //Authenticate the user and store the token in Local Storage\n login(username: string, password: string, adminGroup?: string): void {\n const today = new Date();\n //const expiration = new Date().setFullYear(today.getFullYear() + 10);\n\n const request: AuthenticationRequest = {\n username: username,\n password: password,\n adminGroup: adminGroup\n //expirationDate: expiration // moment().add(10, 'years').toDate()\n };\n\n this.authenticating = true;\n this.authenticatingChanged.emit(this.authenticating);\n\n // Sending a 'raw' POST request so that we can tell HttpClient that we are expecting text instead of Json\n // Otherwise, it would throw an error trying to decode Json from the response\n this.http.request('POST', this.config.apiUrl, { body: request, responseType: 'text' })\n .subscribe({\n next: (token) =>\n this.validateUser(token)\n , error: (err) => {\n //console.log('Authentication error', err);\n this.authenticating = false;\n this.authenticatingChanged.emit(this.authenticating);\n this.authenticationError.emit(err);\n }\n });\n }\n \n //Logout the user and delete the token from Local Storage\n logout(): void {\n if (localStorage.getItem('token')) {\n localStorage.removeItem('token');\n }\n\n this.authenticatedUser = null;\n this.authenticated = false;\n this.authenticatedChanged.emit(false);\n }\n \n private validateUser(token: string | null): void {\n if (!token) { return; }\n\n const jwtHelper = new JwtHelperService();\n const decoded = jwtHelper.decodeToken(token) as AuthenticationToken;\n\n if (jwtHelper.isTokenExpired(token)) {\n this.logout();\n return;\n }\n\n this.authenticatedUser = {\n admin: decoded.role === 'Admin',\n displayName: decoded.displayName,\n accountName: decoded.winaccountname,\n distinguishedName: decoded.distinguishedName,\n employeeNumber: decoded.employeeNumber,\n memberOf: decoded.memberOf\n };\n\n localStorage.setItem('token', token);\n\n this.getPhoto();\n \n this.authenticated = true;\n this.authenticatedChanged.emit(this.authenticated);\n\n this.authenticating = false;\n this.authenticatingChanged.emit(this.authenticating);\n }\n\n private getPhoto(): void {\n this.sharePointService.getPhotos()\n .subscribe(photos => {\n // The user may have been logged out by the time the photos came back\n if (!this.authenticatedUser?.employeeNumber) {\n return;\n }\n\n const photo = photos.find(pic => pic.employeeNumber === +this.authenticatedUser!.employeeNumber);\n\n if (photo) {\n this.authenticatedUser.photoUrl = photo.encodedAbsUrl;\n }\n });\n }\n\n private checkForExistingToken(): void {\n this.validateUser(localStorage.getItem('token'));\n }\n //#endregion\n}\n ","import { Component, Inject, OnInit, OnDestroy } from '@angular/core';\nimport { UntypedFormGroup, UntypedFormControl, Validators } from '@angular/forms';\nimport { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';\nimport { Subscription } from 'rxjs';\n\nimport { AuthenticationService } from '../../services/authentication.service';\nimport { LoginFormData } from '../../model/login-form-data';\n\n@Component({\n selector: 'authentication-login-form',\n templateUrl: './login-form.component.html',\n styleUrls: [\n './login-form.component.css',\n '../../../../styles/mat-icon.css'\n ]\n})\nexport class LoginFormComponent implements OnInit, OnDestroy {\n errorMessage: string | null = null;\n authenticatedChangedSubscription!: Subscription;\n authenticationErrorSubscription!: Subscription;\n\n form = new UntypedFormGroup({\n username: new UntypedFormControl(null, [ Validators.required ]),\n password: new UntypedFormControl(null, [ Validators.required ]),\n adminGroup: new UntypedFormControl()\n });\n\n constructor(@Inject(MAT_DIALOG_DATA) data: LoginFormData,\n public dialogRef: MatDialogRef<LoginFormComponent>,\n public authenticationService: AuthenticationService) {\n\n this.form.get('adminGroup')?.setValue(data.adminGroup);\n }\n\n ngOnInit(): void {\n this.authenticatedChangedSubscription = this.authenticationService.authenticatedChanged\n .subscribe(this.authChangedHandler.bind(this));\n\n this.authenticationErrorSubscription = this.authenticationService.authenticationError\n .subscribe(this.errorHandler.bind(this));\n }\n\n ngOnDestroy(): void {\n this.authenticationErrorSubscription.unsubscribe();\n this.authenticatedChangedSubscription.unsubscribe();\n }\n\n authenticate() {\n this.errorMessage = null;\n const { username, password, adminGroup } = this.form.value;\n this.authenticationService.login(username, password, adminGroup);\n }\n\n private authChangedHandler(authenticated: boolean): void {\n if (authenticated) {\n this.dialogRef.close();\n }\n }\n\n private errorHandler(err: any): void {\n console.log('Authentication error', err);\n this.errorMessage = `${err.name}: ${err.statusText}`;\n }\n}\n","<h2 mat-dialog-title>\n <span *ngIf=\"!authenticationService.authenticating\">Login</span>\n <span *ngIf=\"authenticationService.authenticating\">Authenticating...</span>\n</h2>\n\n<mat-dialog-content>\n <div id=\"spinner\" *ngIf=\"authenticationService.authenticating\">\n <mat-progress-spinner color=\"primary\" mode=\"indeterminate\"></mat-progress-spinner>\n </div>\n\n <form *ngIf=\"!authenticationService.authenticating\" [formGroup]=\"form\">\n <mat-form-field>\n <input matInput formControlName=\"username\" placeholder=\"Username\" (keyup.enter)=\"authenticate()\">\n </mat-form-field>\n\n <mat-form-field>\n <input matInput formControlName=\"password\" type=\"password\" placeholder=\"Password\" (keyup.enter)=\"authenticate()\">\n </mat-form-field>\n </form>\n\n <div *ngIf=\"!authenticationService.authenticating && errorMessage\" id=\"error\">\n {{ errorMessage }}\n </div>\n</mat-dialog-content>\n\n<mat-dialog-actions *ngIf=\"!authenticationService.authenticating\">\n <button mat-raised-button color=\"primary\" (click)=\"authenticate()\"\n [disabled]=\"form.invalid\">\n <mat-icon fontIcon=\"done\"></mat-icon>\n <span>OK</span>\n </button>\n\n <button mat-raised-button (click)=\"dialogRef.close()\">\n <mat-icon fontIcon=\"close\"></mat-icon>\n <span>Cancel</span>\n </button>\n</mat-dialog-actions>","import { Component, Input } from '@angular/core';\nimport { MatDialog } from '@angular/material/dialog';\nimport { ConfirmationComponent } from '@cleavelandprice/ngx-lib/dialog';\nimport { LoginFormComponent } from '../login-form/login-form.component';\nimport { AuthenticationService } from '../../services/authentication.service';\n\n@Component({\n selector: 'authentication-login',\n templateUrl: './login.component.html',\n styleUrls: [\n './login.component.css',\n '../../../../styles/mat-icon.css'\n ]\n})\nexport class LoginComponent {\n @Input() adminGroup!: string;\n\n constructor(private dialog: MatDialog,\n public authenticationService: AuthenticationService) {\n }\n\n login(): void {\n this.dialog.open(LoginFormComponent, {\n data: { adminGroup: this.adminGroup }\n });\n }\n\n confirmLogout(): void {\n this.dialog.open(ConfirmationComponent, {\n data: { message: `Are you sure you want to logout?` }\n })\n .afterClosed()\n .subscribe(result => {\n if (result) {\n this.authenticationService.logout();\n }\n });\n }\n}\n","<div id=\"user-id\">\n <!-- Logged out -->\n <mat-icon *ngIf=\"!authenticationService.authenticated\"\n fontIcon=\"account_circle\"\n matTooltip=\"Login\"\n (click)=\"login()\">\n </mat-icon>\n\n <!-- Logged in -->\n <ng-container *ngIf=\"authenticationService.authenticated\">\n <!-- With photo -->\n <img *ngIf=\"authenticationService.authenticatedUser?.photoUrl\"\n id=\"authenticated-user-image\"\n [src]=\"authenticationService.authenticatedUser?.photoUrl\"\n matTooltip=\"Logout\"\n (click)=\"confirmLogout()\" />\n \n <!-- Without photo -->\n <mat-icon *ngIf=\"!authenticationService.authenticatedUser?.photoUrl\"\n fontIcon=\"account_circle\"\n matTooltip=\"Logout\"\n (click)=\"confirmLogout()\">\n </mat-icon>\n \n <!-- Name -->\n <div id=\"user-name\">\n {{ authenticationService.authenticatedUser?.displayName }}\n </div>\n </ng-container>\n</div>","import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { ReactiveFormsModule } from '@angular/forms';\n\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatDialogModule } from '@angular/material/dialog';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatInputModule } from '@angular/material/input';\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\n\nimport { LoginComponent } from './components/login/login.component';\nimport { LoginFormComponent } from './components/login-form/login-form.component';\nimport { ServiceConfig } from './model/service-config';\nimport { AuthenticationService } from './services/authentication.service';\n\n@NgModule({\n declarations: [\n LoginComponent,\n LoginFormComponent\n ],\n imports: [\n CommonModule,\n ReactiveFormsModule,\n \n MatButtonModule,\n MatDialogModule,\n MatFormFieldModule,\n MatIconModule,\n MatInputModule,\n MatProgressSpinnerModule\n ],\n exports: [\n LoginComponent,\n LoginFormComponent\n ]\n})\nexport class AuthenticationModule {\n static forRoot(config: ServiceConfig): ModuleWithProviders<AuthenticationModule> {\n return {\n ngModule: AuthenticationModule,\n providers: [\n AuthenticationService,\n { provide: ServiceConfig, useValue: config }\n ]\n };\n }\n\n constructor( @Optional() @SkipSelf() parentModule: AuthenticationModule) {\n if (parentModule) {\n throw new Error(\n 'AuthenticationModule is already loaded. Import it in the AppModule only');\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["i1.ServiceConfig","i2.AuthenticationService","i3","i4"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;MAAa,aAAa,CAAA;AAEzB;;ACAM,MAAM,aAAa,GAAkB;AACxC,IAAA,MAAM,EAAE,sCAAsC;CACjD;;ACJD;AAYA;MAKa,qBAAqB,CAAA;;;;AAkBhC,IAAA,WAAA,CAAgC,MAAqB,EACjC,IAAgB,EAChB,iBAAoC,EAAA;;AAFxB,QAAA,IAAM,CAAA,MAAA,GAAN,MAAM,CAAe;AACjC,QAAA,IAAI,CAAA,IAAA,GAAJ,IAAI,CAAY;AAChB,QAAA,IAAiB,CAAA,iBAAA,GAAjB,iBAAiB,CAAmB;;AAlB9C,QAAA,IAAA,CAAA,oBAAoB,GAAG,IAAI,YAAY,EAAW,CAAC;AACnD,QAAA,IAAA,CAAA,qBAAqB,GAAG,IAAI,YAAY,EAAW,CAAC;AACpD,QAAA,IAAA,CAAA,mBAAmB,GAAG,IAAI,YAAY,EAAE,CAA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AAO,EAAE;wBACP,cAAc;wBACd,kBAAkB;AACnB,qBAAA;iBACF,CAAA;;wBAYoD,oBAAoB,EAAA,UAAA,EAAA,CAAA;8BAAzD,QAAQ;;8BAAI,QAAQ;;;;AChDpC;;AAEG;;;;"}
1
+ {"version":3,"file":"cleavelandprice-ngx-lib-authentication.mjs","sources":["../../../../projects/cleavelandprice/ngx-lib/authentication/src/model/service-config.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/src/model/default-config.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/src/services/authentication.service.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/src/components/login-form/login-form.component.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/src/components/login-form/login-form.component.html","../../../../projects/cleavelandprice/ngx-lib/authentication/src/components/login/login.component.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/src/components/login/login.component.html","../../../../projects/cleavelandprice/ngx-lib/authentication/src/authentication.module.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/src/cleavelandprice-ngx-lib-authentication.ts"],"sourcesContent":["export class ServiceConfig {\r\n apiUrl!: string;\r\n}\r\n","import { ServiceConfig } from \"./service-config\";\r\n\r\nexport const defaultConfig: ServiceConfig = {\r\n apiUrl: 'http://utilityapi/authenticate/token'\r\n}","//#region Imports\nimport { Injectable, Output, EventEmitter, Optional } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { JwtHelperService } from '@auth0/angular-jwt';\n\nimport { defaultConfig } from '../model/default-config';\n\nimport { AuthenticationToken } from '../model/authentication-token';\nimport { ServiceConfig } from '../model/service-config';\nimport { SharepointService } from '@cleavelandprice/ngx-lib/sharepoint';\nimport { AuthenticatedUser } from '../model/authenticated-user';\nimport { AuthenticationRequest } from '../model/authentication-request';\n//#endregion\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AuthenticationService {\n //#region Fields\n @Output() authenticatedChanged = new EventEmitter<boolean>();\n @Output() authenticatingChanged = new EventEmitter<boolean>();\n @Output() authenticationError = new EventEmitter();\n \n // Flag set to true while the service is attempting to authenticate the user\n authenticating = false;\n \n //Flag set to true when the user is successfully authenticated\n authenticated = false;\n \n // Object representing the authenticated user\n authenticatedUser!: AuthenticatedUser | null;\n //#endregion\n \n //#region Lifecycle\n // If a ServiceConfig object is not provided when the module is imported, then default values are pulled in from default-config.ts.\n constructor(@Optional() private config: ServiceConfig,\n private http: HttpClient,\n private sharePointService: SharepointService) {\n\n this.config = {\n ...defaultConfig,\n ...this.config\n };\n \n this.checkForExistingToken();\n }\n //#endregion\n\n //#region Utilities\n //Authenticate the user and store the token in Local Storage\n login(username: string, password: string, adminGroup?: string): void {\n const today = new Date();\n //const expiration = new Date().setFullYear(today.getFullYear() + 10);\n\n const request: AuthenticationRequest = {\n username: username,\n password: password,\n adminGroup: adminGroup\n //expirationDate: expiration // moment().add(10, 'years').toDate()\n };\n\n this.authenticating = true;\n this.authenticatingChanged.emit(this.authenticating);\n\n // Sending a 'raw' POST request so that we can tell HttpClient that we are expecting text instead of Json\n // Otherwise, it would throw an error trying to decode Json from the response\n this.http.request('POST', this.config.apiUrl, { body: request, responseType: 'text' })\n .subscribe({\n next: (token) =>\n this.validateUser(token)\n , error: (err) => {\n //console.log('Authentication error', err);\n this.authenticating = false;\n this.authenticatingChanged.emit(this.authenticating);\n this.authenticationError.emit(err);\n }\n });\n }\n \n //Logout the user and delete the token from Local Storage\n logout(): void {\n if (localStorage.getItem('token')) {\n localStorage.removeItem('token');\n }\n\n this.authenticatedUser = null;\n this.authenticated = false;\n this.authenticatedChanged.emit(false);\n }\n \n private validateUser(token: string | null): void {\n if (!token) { return; }\n\n const jwtHelper = new JwtHelperService();\n const decoded = jwtHelper.decodeToken(token) as AuthenticationToken;\n\n if (jwtHelper.isTokenExpired(token)) {\n this.logout();\n return;\n }\n\n this.authenticatedUser = {\n admin: decoded.role === 'Admin',\n displayName: decoded.displayName,\n accountName: decoded.winaccountname,\n distinguishedName: decoded.distinguishedName,\n employeeNumber: decoded.employeeNumber,\n memberOf: decoded.memberOf\n };\n\n localStorage.setItem('token', token);\n\n this.getPhoto();\n \n this.authenticated = true;\n this.authenticatedChanged.emit(this.authenticated);\n\n this.authenticating = false;\n this.authenticatingChanged.emit(this.authenticating);\n }\n\n private getPhoto(): void {\n this.sharePointService.getPhotos()\n .subscribe(photos => {\n // The user may have been logged out by the time the photos came back\n if (!this.authenticatedUser?.employeeNumber) {\n return;\n }\n\n const photo = photos.find(pic => pic.employeeNumber === +this.authenticatedUser!.employeeNumber);\n\n if (photo) {\n this.authenticatedUser.photoUrl = photo.encodedAbsUrl;\n }\n });\n }\n\n private checkForExistingToken(): void {\n this.validateUser(localStorage.getItem('token'));\n }\n //#endregion\n}\n ","import { Component, Inject, OnInit, OnDestroy } from '@angular/core';\nimport { UntypedFormGroup, UntypedFormControl, Validators } from '@angular/forms';\nimport { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';\nimport { Subscription } from 'rxjs';\n\nimport { AuthenticationService } from '../../services/authentication.service';\nimport { LoginFormData } from '../../model/login-form-data';\n\n@Component({\n selector: 'authentication-login-form',\n templateUrl: './login-form.component.html',\n styleUrls: [\n './login-form.component.css',\n '../../../../styles/mat-icon.css'\n ]\n})\nexport class LoginFormComponent implements OnInit, OnDestroy {\n errorMessage: string | null = null;\n authenticatedChangedSubscription!: Subscription;\n authenticationErrorSubscription!: Subscription;\n\n form = new UntypedFormGroup({\n username: new UntypedFormControl(null, [ Validators.required ]),\n password: new UntypedFormControl(null, [ Validators.required ]),\n adminGroup: new UntypedFormControl()\n });\n\n constructor(@Inject(MAT_DIALOG_DATA) data: LoginFormData,\n public dialogRef: MatDialogRef<LoginFormComponent>,\n public authenticationService: AuthenticationService) {\n\n this.form.get('adminGroup')?.setValue(data.adminGroup);\n }\n\n ngOnInit(): void {\n this.authenticatedChangedSubscription = this.authenticationService.authenticatedChanged\n .subscribe(this.authChangedHandler.bind(this));\n\n this.authenticationErrorSubscription = this.authenticationService.authenticationError\n .subscribe(this.errorHandler.bind(this));\n }\n\n ngOnDestroy(): void {\n this.authenticationErrorSubscription.unsubscribe();\n this.authenticatedChangedSubscription.unsubscribe();\n }\n\n authenticate() {\n this.errorMessage = null;\n const { username, password, adminGroup } = this.form.value;\n this.authenticationService.login(username, password, adminGroup);\n }\n\n private authChangedHandler(authenticated: boolean): void {\n if (authenticated) {\n this.dialogRef.close();\n }\n }\n\n private errorHandler(err: any): void {\n console.log('Authentication error', err);\n this.errorMessage = `${err.name}: ${err.statusText}`;\n }\n}\n","<h2 mat-dialog-title>\n <span *ngIf=\"!authenticationService.authenticating\">Login</span>\n <span *ngIf=\"authenticationService.authenticating\">Authenticating...</span>\n</h2>\n\n<mat-dialog-content>\n <div id=\"spinner\" *ngIf=\"authenticationService.authenticating\">\n <mat-progress-spinner color=\"primary\" mode=\"indeterminate\"></mat-progress-spinner>\n </div>\n\n <form *ngIf=\"!authenticationService.authenticating\" [formGroup]=\"form\">\n <mat-form-field>\n <input matInput formControlName=\"username\" placeholder=\"Username\" (keyup.enter)=\"authenticate()\">\n </mat-form-field>\n\n <mat-form-field>\n <input matInput formControlName=\"password\" type=\"password\" placeholder=\"Password\" (keyup.enter)=\"authenticate()\">\n </mat-form-field>\n </form>\n\n <div *ngIf=\"!authenticationService.authenticating && errorMessage\" id=\"error\">\n {{ errorMessage }}\n </div>\n</mat-dialog-content>\n\n<mat-dialog-actions *ngIf=\"!authenticationService.authenticating\">\n <button mat-raised-button color=\"primary\" (click)=\"authenticate()\"\n [disabled]=\"form.invalid\">\n <mat-icon fontIcon=\"done\"></mat-icon>\n <span>OK</span>\n </button>\n\n <button mat-raised-button (click)=\"dialogRef.close()\">\n <mat-icon fontIcon=\"close\"></mat-icon>\n <span>Cancel</span>\n </button>\n</mat-dialog-actions>","import { Component, Input } from '@angular/core';\nimport { MatDialog } from '@angular/material/dialog';\nimport { ConfirmationComponent } from '@cleavelandprice/ngx-lib/dialog';\nimport { LoginFormComponent } from '../login-form/login-form.component';\nimport { AuthenticationService } from '../../services/authentication.service';\n\n@Component({\n selector: 'authentication-login',\n templateUrl: './login.component.html',\n styleUrls: [\n './login.component.css',\n '../../../../styles/mat-icon.css'\n ]\n})\nexport class LoginComponent {\n @Input() adminGroup!: string;\n\n constructor(private dialog: MatDialog,\n public authenticationService: AuthenticationService) {\n }\n\n login(): void {\n this.dialog.open(LoginFormComponent, {\n data: { adminGroup: this.adminGroup }\n });\n }\n\n confirmLogout(): void {\n this.dialog.open(ConfirmationComponent, {\n data: { message: `Are you sure you want to logout?` }\n })\n .afterClosed()\n .subscribe(result => {\n if (result) {\n this.authenticationService.logout();\n }\n });\n }\n}\n","<div id=\"user-id\">\n <!-- Logged out -->\n <mat-icon *ngIf=\"!authenticationService.authenticated\"\n fontIcon=\"account_circle\"\n matTooltip=\"Login\"\n (click)=\"login()\">\n </mat-icon>\n\n <!-- Logged in -->\n <ng-container *ngIf=\"authenticationService.authenticated\">\n <!-- With photo -->\n <img *ngIf=\"authenticationService.authenticatedUser?.photoUrl\"\n id=\"authenticated-user-image\"\n [src]=\"authenticationService.authenticatedUser?.photoUrl\"\n matTooltip=\"Logout\"\n (click)=\"confirmLogout()\" />\n \n <!-- Without photo -->\n <mat-icon *ngIf=\"!authenticationService.authenticatedUser?.photoUrl\"\n fontIcon=\"account_circle\"\n matTooltip=\"Logout\"\n (click)=\"confirmLogout()\">\n </mat-icon>\n \n <!-- Name -->\n <div id=\"user-name\">\n {{ authenticationService.authenticatedUser?.displayName }}\n </div>\n </ng-container>\n</div>","import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { ReactiveFormsModule } from '@angular/forms';\n\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatDialogModule } from '@angular/material/dialog';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatInputModule } from '@angular/material/input';\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\n\nimport { LoginComponent } from './components/login/login.component';\nimport { LoginFormComponent } from './components/login-form/login-form.component';\nimport { ServiceConfig } from './model/service-config';\nimport { AuthenticationService } from './services/authentication.service';\n\n@NgModule({\n declarations: [\n LoginComponent,\n LoginFormComponent\n ],\n imports: [\n CommonModule,\n ReactiveFormsModule,\n \n MatButtonModule,\n MatDialogModule,\n MatFormFieldModule,\n MatIconModule,\n MatInputModule,\n MatProgressSpinnerModule\n ],\n exports: [\n LoginComponent,\n LoginFormComponent\n ]\n})\nexport class AuthenticationModule {\n static forRoot(config: ServiceConfig): ModuleWithProviders<AuthenticationModule> {\n return {\n ngModule: AuthenticationModule,\n providers: [\n AuthenticationService,\n { provide: ServiceConfig, useValue: config }\n ]\n };\n }\n\n constructor( @Optional() @SkipSelf() parentModule: AuthenticationModule) {\n if (parentModule) {\n throw new Error(\n 'AuthenticationModule is already loaded. Import it in the AppModule only');\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["i1.ServiceConfig","i2.AuthenticationService","i3","i4"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;MAAa,aAAa,CAAA;AAEzB;;ACAM,MAAM,aAAa,GAAkB;AACxC,IAAA,MAAM,EAAE,sCAAsC;CACjD;;ACJD;AAYA;MAKa,qBAAqB,CAAA;;;;AAkBhC,IAAA,WAAA,CAAgC,MAAqB,EACjC,IAAgB,EAChB,iBAAoC,EAAA;AAFxB,QAAA,IAAM,CAAA,MAAA,GAAN,MAAM,CAAe;AACjC,QAAA,IAAI,CAAA,IAAA,GAAJ,IAAI,CAAY;AAChB,QAAA,IAAiB,CAAA,iBAAA,GAAjB,iBAAiB,CAAmB;;AAlB9C,QAAA,IAAA,CAAA,oBAAoB,GAAG,IAAI,YAAY,EAAW,CAAC;AACnD,QAAA,IAAA,CAAA,qBAAqB,GAAG,IAAI,YAAY,EAAW,CAAC;AACpD,QAAA,IAAA,CAAA,mBAAmB,GAAG,IAAI,YAAY,EAAE,CAAC;;AAGnD,QAAA,IAA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AAkB;AACnB,qBAAA;iBACF,CAAA;;wBAYoD,oBAAoB,EAAA,UAAA,EAAA,CAAA;8BAAzD,QAAQ;;8BAAI,QAAQ;;;;AChDpC;;AAEG;;;;"}
@@ -40,12 +40,11 @@ class SharepointService {
40
40
  //#region Initialization
41
41
  // If a ServiceConfig object is not provided when the module is imported, then default values are pulled in from default-config.ts.
42
42
  constructor(config, http) {
43
- var _a;
44
43
  this.config = config;
45
44
  this.http = http;
46
45
  this.cache = null;
47
46
  this.defaultCacheLifeMinutes = 720;
48
- this.config = (_a = this.config) !== null && _a !== void 0 ? _a : defaultConfig;
47
+ this.config = Object.assign(Object.assign({}, defaultConfig), this.config);
49
48
  this.configureCaching();
50
49
  this.configureLogging();
51
50
  }
@@ -1 +1 @@
1
- {"version":3,"file":"cleavelandprice-ngx-lib-sharepoint.mjs","sources":["../../../../projects/cleavelandprice/ngx-lib/sharepoint/src/model/service-config.ts","../../../../projects/cleavelandprice/ngx-lib/sharepoint/src/model/default-config.ts","../../../../projects/cleavelandprice/ngx-lib/sharepoint/src/services/sharepoint.service.ts","../../../../projects/cleavelandprice/ngx-lib/sharepoint/src/sharepoint.module.ts","../../../../projects/cleavelandprice/ngx-lib/sharepoint/src/cleavelandprice-ngx-lib-sharepoint.ts"],"sourcesContent":["import { CachingConfig } from \"./caching-config\";\r\nimport { LoggingConfig } from './logging-config';\r\n\r\nexport class ServiceConfig {\r\n apiUrl!: string;\r\n usersEndpoint!: string;\r\n listItemsEndpoint!: string;\r\n username!: string;\r\n password!: string;\r\n photos!: {\r\n site: string;\r\n list: string;\r\n additionalPropertiesToRetrieve?: string[];\r\n };\r\n caching?: CachingConfig;\r\n logging?: LoggingConfig;\r\n}\r\n","// This is the default configuration, which can be overridden by providing a ServiceConfig object to the module\r\nimport { ServiceConfig } from './service-config';\r\n\r\nexport const defaultConfig: ServiceConfig = {\r\n apiUrl: 'http://utilityapi',\r\n usersEndpoint: '/sharepoint/users',\r\n listItemsEndpoint: '/sharepoint/listitems',\r\n username: 'viewer',\r\n password: 'viewer',\r\n photos: {\r\n site: 'https://sharepoint.cleavelandprice.com/digitaldisplay',\r\n list: 'Employee Thumbnail Photos',\r\n additionalPropertiesToRetrieve: [\r\n 'EncodedAbsUrl'\r\n ]\r\n },\r\n caching: {\r\n enabled: true,\r\n lifeMinutes: 720\r\n },\r\n logging: {\r\n dataCached: true,\r\n cachedDataReturned: true,\r\n freshDataReturned: true,\r\n cacheCleared: true\r\n }\r\n};\r\n","//#region Imports\nimport { Injectable, Optional } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { Observable, of } from 'rxjs';\n\nimport { defaultConfig } from '../model/default-config';\n\nimport { CacheObject } from '../model/cache-object';\nimport { ListItem } from '../model/list-item';\nimport { ListItemsRequest } from '../model/list-items-request';\nimport { PhotoItem } from '../model/photo-item';\nimport { ServiceConfig } from '../model/service-config';\nimport { UserRequest } from '../model/user-request';\nimport { User } from '../model/user';\n\nimport moment from 'moment';\n//#endregion\n\n@Injectable({\n providedIn: 'root'\n})\nexport class SharepointService {\n private cache: {\n users: CacheObject<User> | null,\n photos: CacheObject<PhotoItem> | null\n } | null = null;\n\n private defaultCacheLifeMinutes = 720;\n\n //#region Utilities\n private cacheExpired<T>(cache: CacheObject<T>): boolean {\n if (!cache) {\n return true;\n }\n\n const lifeMinutes = this.config.caching?.lifeMinutes ?? this.defaultCacheLifeMinutes;\n const expiration = moment(cache.lastUpdate)\n .add(lifeMinutes, 'minutes');\n\n return moment().isAfter(expiration);\n }\n //#endregion\n\n //#region Initialization\n // If a ServiceConfig object is not provided when the module is imported, then default values are pulled in from default-config.ts.\n constructor(@Optional() private config: ServiceConfig,\n private http: HttpClient) {\n\n this.config = this.config ?? defaultConfig;\n\n this.configureCaching();\n this.configureLogging();\n }\n\n private configureCaching(): void {\n // If caching config is missing entirely, give it a default\n this.config.caching = this.config.caching ?? {\n enabled: false,\n lifeMinutes: this.defaultCacheLifeMinutes\n };\n\n this.cache = {\n photos: null,\n users: null\n };\n }\n\n private configureLogging(): void {\n // If logging config is missing entirely, give it a default\n this.config.logging = this.config.logging ?? {\n dataCached: false,\n cachedDataReturned: false,\n freshDataReturned: false,\n cacheCleared: false\n }\n }\n //#endregion\n\n getListItems(request: ListItemsRequest): Observable<ListItem[]> {\n const apiUrl = this.config?.apiUrl ?? defaultConfig.apiUrl;\n const endpoint = this.config?.listItemsEndpoint ?? defaultConfig.listItemsEndpoint;\n\n return this.http.post<ListItem[]>(`${apiUrl}${endpoint}`, request);\n }\n\n getPhotos(): Observable<PhotoItem[]> {\n const request: ListItemsRequest = {\n username: this.config?.username ?? defaultConfig.username,\n password: this.config?.password ?? defaultConfig.password,\n site: this.config?.photos.site ?? defaultConfig.photos.site,\n list: this.config?.photos.list ?? defaultConfig.photos.list,\n additionalPropertiesToRetrieve: defaultConfig.photos.additionalPropertiesToRetrieve\n };\n\n const observable$ = this.getListItems(request) as Observable<PhotoItem[]>;\n\n if (this.config.caching?.enabled) {\n if (this.cacheExpired<PhotoItem>(this.cache?.photos!)) {\n // Get the data and cache it\n observable$.subscribe(data => {\n this.cache!.photos = {\n data,\n lastUpdate: moment()\n };\n\n if (this.config.logging?.dataCached) {\n const lifeMinutes = this.config.caching?.lifeMinutes ?? this.defaultCacheLifeMinutes;\n console.log(`Photos cached for ${lifeMinutes} minutes`);\n }\n });\n } else {\n // Cache exists and hasn't expired yet\n if (this.config.logging?.cachedDataReturned) {\n console.log('Returning cached photos');\n }\n\n return of(this.cache!.photos!.data);\n }\n }\n\n // Cache is either disabled or expired, return data from API\n if (this.config.logging?.freshDataReturned) {\n console.log('Returning fresh photos');\n }\n\n return observable$;\n }\n\n getUsers(request: UserRequest, id?: number): Observable<User | User[]> {\n const apiUrl = this.config?.apiUrl ?? defaultConfig.apiUrl;\n const endpoint = this.config?.usersEndpoint ?? defaultConfig.usersEndpoint;\n \n const observable$ = this.http.post<User | User[]>(`${apiUrl}${endpoint}/${id ?? ''}`, request);\n\n //#region Single user\n if (id) {\n return observable$;\n }\n //#endregion\n\n //#region Multiple users\n if (this.config.caching?.enabled) {\n if (this.cacheExpired<User>(this.cache!.users!)) {\n // Get the data and cache it\n observable$.subscribe(data => {\n this.cache!.users = {\n data: data as User[],\n lastUpdate: moment()\n };\n\n if (this.config.logging?.dataCached) {\n const lifeMinutes = this.config.caching?.lifeMinutes ?? this.defaultCacheLifeMinutes;\n console.log(`Users cached for ${lifeMinutes} minutes`);\n }\n });\n } else {\n // Cache exists and hasn't expired yet\n if (this.config.logging?.cachedDataReturned) {\n console.log('Returning cached users');\n }\n\n return of(this.cache!.users!.data);\n }\n }\n\n // Cache is either disabled or expired, return data from API\n if (this.config.logging?.freshDataReturned) {\n console.log('Returning fresh users');\n }\n\n return observable$;\n //#endregion\n }\n\n clearCache(): void {\n this.cache = null;\n\n if (this.config.logging?.cacheCleared) {\n console.log('Cache cleared');\n }\n }\n}","import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { ServiceConfig } from './model/service-config';\nimport { SharepointService } from './services/sharepoint.service';\n\n@NgModule({\n declarations: [],\n imports: [\n CommonModule\n ]\n})\nexport class SharepointModule {\n static forRoot(config: ServiceConfig): ModuleWithProviders<SharepointModule> {\n return {\n ngModule: SharepointModule,\n providers: [\n SharepointService,\n { provide: ServiceConfig, useValue: config }\n ]\n };\n }\n\n constructor( @Optional() @SkipSelf() parentModule: SharepointModule) {\n if (parentModule) {\n throw new Error(\n 'SharepointModule is already loaded. Import it in the AppModule only');\n }\n }\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["i1.ServiceConfig"],"mappings":";;;;;;;MAGa,aAAa,CAAA;AAazB;;ACbM,MAAM,aAAa,GAAkB;AACxC,IAAA,MAAM,EAAE,mBAAmB;AAC3B,IAAA,aAAa,EAAE,mBAAmB;AAClC,IAAA,iBAAiB,EAAE,uBAAuB;AAC1C,IAAA,QAAQ,EAAE,QAAQ;AAClB,IAAA,QAAQ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;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,EAAE;AAChB,oBAAA,OAAO,EAAE;wBACP,YAAY;AACb,qBAAA;iBACF,CAAA;;wBAYoD,gBAAgB,EAAA,UAAA,EAAA,CAAA;8BAArD,QAAQ;;8BAAI,QAAQ;;;;ACtBpC;;AAEG;;;;"}
1
+ {"version":3,"file":"cleavelandprice-ngx-lib-sharepoint.mjs","sources":["../../../../projects/cleavelandprice/ngx-lib/sharepoint/src/model/service-config.ts","../../../../projects/cleavelandprice/ngx-lib/sharepoint/src/model/default-config.ts","../../../../projects/cleavelandprice/ngx-lib/sharepoint/src/services/sharepoint.service.ts","../../../../projects/cleavelandprice/ngx-lib/sharepoint/src/sharepoint.module.ts","../../../../projects/cleavelandprice/ngx-lib/sharepoint/src/cleavelandprice-ngx-lib-sharepoint.ts"],"sourcesContent":["import { CachingConfig } from \"./caching-config\";\r\nimport { LoggingConfig } from './logging-config';\r\n\r\nexport class ServiceConfig {\r\n apiUrl!: string;\r\n usersEndpoint!: string;\r\n listItemsEndpoint!: string;\r\n username!: string;\r\n password!: string;\r\n photos!: {\r\n site: string;\r\n list: string;\r\n additionalPropertiesToRetrieve?: string[];\r\n };\r\n caching?: CachingConfig;\r\n logging?: LoggingConfig;\r\n}\r\n","// This is the default configuration, which can be overridden by providing a ServiceConfig object to the module\r\nimport { ServiceConfig } from './service-config';\r\n\r\nexport const defaultConfig: ServiceConfig = {\r\n apiUrl: 'http://utilityapi',\r\n usersEndpoint: '/sharepoint/users',\r\n listItemsEndpoint: '/sharepoint/listitems',\r\n username: 'viewer',\r\n password: 'viewer',\r\n photos: {\r\n site: 'https://sharepoint.cleavelandprice.com/digitaldisplay',\r\n list: 'Employee Thumbnail Photos',\r\n additionalPropertiesToRetrieve: [\r\n 'EncodedAbsUrl'\r\n ]\r\n },\r\n caching: {\r\n enabled: true,\r\n lifeMinutes: 720\r\n },\r\n logging: {\r\n dataCached: true,\r\n cachedDataReturned: true,\r\n freshDataReturned: true,\r\n cacheCleared: true\r\n }\r\n};\r\n","//#region Imports\nimport { Injectable, Optional } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { Observable, of } from 'rxjs';\n\nimport { defaultConfig } from '../model/default-config';\n\nimport { CacheObject } from '../model/cache-object';\nimport { ListItem } from '../model/list-item';\nimport { ListItemsRequest } from '../model/list-items-request';\nimport { PhotoItem } from '../model/photo-item';\nimport { ServiceConfig } from '../model/service-config';\nimport { UserRequest } from '../model/user-request';\nimport { User } from '../model/user';\n\nimport moment from 'moment';\n//#endregion\n\n@Injectable({\n providedIn: 'root'\n})\nexport class SharepointService {\n private cache: {\n users: CacheObject<User> | null,\n photos: CacheObject<PhotoItem> | null\n } | null = null;\n\n private defaultCacheLifeMinutes = 720;\n\n //#region Utilities\n private cacheExpired<T>(cache: CacheObject<T>): boolean {\n if (!cache) {\n return true;\n }\n\n const lifeMinutes = this.config.caching?.lifeMinutes ?? this.defaultCacheLifeMinutes;\n const expiration = moment(cache.lastUpdate)\n .add(lifeMinutes, 'minutes');\n\n return moment().isAfter(expiration);\n }\n //#endregion\n\n //#region Initialization\n // If a ServiceConfig object is not provided when the module is imported, then default values are pulled in from default-config.ts.\n constructor(@Optional() private config: ServiceConfig,\n private http: HttpClient) {\n\n this.config = {\n ...defaultConfig,\n ...this.config\n };\n\n this.configureCaching();\n this.configureLogging();\n }\n\n private configureCaching(): void {\n // If caching config is missing entirely, give it a default\n this.config.caching = this.config.caching ?? {\n enabled: false,\n lifeMinutes: this.defaultCacheLifeMinutes\n };\n\n this.cache = {\n photos: null,\n users: null\n };\n }\n\n private configureLogging(): void {\n // If logging config is missing entirely, give it a default\n this.config.logging = this.config.logging ?? {\n dataCached: false,\n cachedDataReturned: false,\n freshDataReturned: false,\n cacheCleared: false\n }\n }\n //#endregion\n\n getListItems(request: ListItemsRequest): Observable<ListItem[]> {\n const apiUrl = this.config?.apiUrl ?? defaultConfig.apiUrl;\n const endpoint = this.config?.listItemsEndpoint ?? defaultConfig.listItemsEndpoint;\n\n return this.http.post<ListItem[]>(`${apiUrl}${endpoint}`, request);\n }\n\n getPhotos(): Observable<PhotoItem[]> {\n const request: ListItemsRequest = {\n username: this.config?.username ?? defaultConfig.username,\n password: this.config?.password ?? defaultConfig.password,\n site: this.config?.photos.site ?? defaultConfig.photos.site,\n list: this.config?.photos.list ?? defaultConfig.photos.list,\n additionalPropertiesToRetrieve: defaultConfig.photos.additionalPropertiesToRetrieve\n };\n\n const observable$ = this.getListItems(request) as Observable<PhotoItem[]>;\n\n if (this.config.caching?.enabled) {\n if (this.cacheExpired<PhotoItem>(this.cache?.photos!)) {\n // Get the data and cache it\n observable$.subscribe(data => {\n this.cache!.photos = {\n data,\n lastUpdate: moment()\n };\n\n if (this.config.logging?.dataCached) {\n const lifeMinutes = this.config.caching?.lifeMinutes ?? this.defaultCacheLifeMinutes;\n console.log(`Photos cached for ${lifeMinutes} minutes`);\n }\n });\n } else {\n // Cache exists and hasn't expired yet\n if (this.config.logging?.cachedDataReturned) {\n console.log('Returning cached photos');\n }\n\n return of(this.cache!.photos!.data);\n }\n }\n\n // Cache is either disabled or expired, return data from API\n if (this.config.logging?.freshDataReturned) {\n console.log('Returning fresh photos');\n }\n\n return observable$;\n }\n\n getUsers(request: UserRequest, id?: number): Observable<User | User[]> {\n const apiUrl = this.config?.apiUrl ?? defaultConfig.apiUrl;\n const endpoint = this.config?.usersEndpoint ?? defaultConfig.usersEndpoint;\n \n const observable$ = this.http.post<User | User[]>(`${apiUrl}${endpoint}/${id ?? ''}`, request);\n\n //#region Single user\n if (id) {\n return observable$;\n }\n //#endregion\n\n //#region Multiple users\n if (this.config.caching?.enabled) {\n if (this.cacheExpired<User>(this.cache!.users!)) {\n // Get the data and cache it\n observable$.subscribe(data => {\n this.cache!.users = {\n data: data as User[],\n lastUpdate: moment()\n };\n\n if (this.config.logging?.dataCached) {\n const lifeMinutes = this.config.caching?.lifeMinutes ?? this.defaultCacheLifeMinutes;\n console.log(`Users cached for ${lifeMinutes} minutes`);\n }\n });\n } else {\n // Cache exists and hasn't expired yet\n if (this.config.logging?.cachedDataReturned) {\n console.log('Returning cached users');\n }\n\n return of(this.cache!.users!.data);\n }\n }\n\n // Cache is either disabled or expired, return data from API\n if (this.config.logging?.freshDataReturned) {\n console.log('Returning fresh users');\n }\n\n return observable$;\n //#endregion\n }\n\n clearCache(): void {\n this.cache = null;\n\n if (this.config.logging?.cacheCleared) {\n console.log('Cache cleared');\n }\n }\n}","import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { ServiceConfig } from './model/service-config';\nimport { SharepointService } from './services/sharepoint.service';\n\n@NgModule({\n declarations: [],\n imports: [\n CommonModule\n ]\n})\nexport class SharepointModule {\n static forRoot(config: ServiceConfig): ModuleWithProviders<SharepointModule> {\n return {\n ngModule: SharepointModule,\n providers: [\n SharepointService,\n { provide: ServiceConfig, useValue: config }\n ]\n };\n }\n\n constructor( @Optional() @SkipSelf() parentModule: SharepointModule) {\n if (parentModule) {\n throw new Error(\n 'SharepointModule is already loaded. Import it in the AppModule only');\n }\n }\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["i1.ServiceConfig"],"mappings":";;;;;;;MAGa,aAAa,CAAA;AAazB;;ACbM,MAAM,aAAa,GAAkB;AACxC,IAAA,MAAM,EAAE,mBAAmB;AAC3B,IAAA,aAAa,EAAE,mBAAmB;AAClC,IAAA,iBAAiB,EAAE,uBAAuB;AAC1C,IAAA,QAAQ,EAAE,QAAQ;AAClB,IAAA,QAAQ,EAAE,QAAQ;AAClB,IAAA,MAAM,EAAE;AACJ,QAAA,IAAI,EAAE,uDAAuD;AAC7D,QAAA,IAAI,EAAE,2BAA2B;AACjC,QAAA,8BAA8B,EAAE;YAC5B,eAAe;AAClB,SAAA;AACJ,KAAA;AACD,IAAA,OAAO,EAAE;AACL,QAAA,OAAO,EAAE,IAAI;AACb,QAAA,WAAW,EAA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in } from 'rxjs';
4
4
  import * as i1$1 from '@angular/material/dialog';
5
5
  import { MatDialogModule } from '@angular/material/dialog';
6
6
  import * as i1 from '@angular/common/http';
7
- import { HttpRequest, HttpHeaders, HttpEventType, HttpResponse } from '@angular/common/http';
7
+ import { HttpHeaders, HttpRequest, HttpEventType, HttpResponse } from '@angular/common/http';
8
8
  import * as i3 from '@angular/common';
9
9
  import { CommonModule } from '@angular/common';
10
10
  import * as i4 from '@angular/material/list';
@@ -14,25 +14,41 @@ import * as i6 from '@angular/material/progress-bar';
14
14
  import { MatProgressBarModule } from '@angular/material/progress-bar';
15
15
 
16
16
  class ServiceConfig {
17
+ constructor() {
18
+ this.uploadPath = null;
19
+ this.dbAppId = null;
20
+ this.externalReferenceId = null;
21
+ this.comment = null;
22
+ // UI configuration
23
+ this.uploadButtonText = null;
24
+ this.uploadDialogTitle = null;
25
+ this.uploadDialogAddFilesButtonText = null;
26
+ this.uploadDialogCancelButtonText = null;
27
+ this.uploadDialogUploadButtonText = null;
28
+ this.uploadDialogFinishButtonText = null;
29
+ }
17
30
  }
18
31
 
32
+ const defaultConfig = {
33
+ apiUrl: 'http://utilityapi/upload/database',
34
+ uploadDialogTitle: 'Upload Files',
35
+ uploadPath: null,
36
+ comment: null,
37
+ dbAppId: null,
38
+ externalReferenceId: null,
39
+ uploadButtonText: 'Upload',
40
+ uploadDialogCancelButtonText: 'Cancel',
41
+ uploadDialogFinishButtonText: 'Finish',
42
+ uploadDialogUploadButtonText: 'Upload',
43
+ uploadDialogAddFilesButtonText: 'Add Files'
44
+ };
45
+
19
46
  // https://malcoded.com/posts/angular-file-upload-component-with-express
20
47
  class UploadService {
21
48
  constructor(http, config) {
22
- var _a, _b, _c, _d, _e, _f;
23
49
  this.http = http;
24
- this.uploadApiUrl = config.apiUrl;
25
- this.uploadPath = config.uploadPath || '';
26
- this.dbAppId = config.dbAppId || '';
27
- this.externalReferenceId = config.externalReferenceId || '';
28
- this.comment = config.comment || '';
29
- // UI configuration
30
- this.uploadButtonText = (_a = config.uploadButtonText) !== null && _a !== void 0 ? _a : '';
31
- this.uploadDialogTitle = (_b = config.uploadDialogTitle) !== null && _b !== void 0 ? _b : '';
32
- this.uploadDialogAddFilesButtonText = (_c = config.uploadDialogAddFilesButtonText) !== null && _c !== void 0 ? _c : '';
33
- this.uploadDialogCancelButtonText = (_d = config.uploadDialogCancelButtonText) !== null && _d !== void 0 ? _d : '';
34
- this.uploadDialogUploadButtonText = (_e = config.uploadDialogUploadButtonText) !== null && _e !== void 0 ? _e : '';
35
- this.uploadDialogFinishButtonText = (_f = config.uploadDialogFinishButtonText) !== null && _f !== void 0 ? _f : '';
50
+ this.config = config;
51
+ this.config = Object.assign(Object.assign({}, defaultConfig), this.config);
36
52
  }
37
53
  upload(files) {
38
54
  // this will be the our resulting map
@@ -45,19 +61,23 @@ class UploadService {
45
61
  // tell it to report the upload progress
46
62
  // A 'Destination' header is used to optionally configure the file upload destination (filesystem)
47
63
  // A 'DbAppId' header is used to configure the unique identifier of database uploads
48
- const req = new HttpRequest('POST', this.uploadApiUrl, formData, {
64
+ const headers = new HttpHeaders();
65
+ if (this.config.uploadPath) {
66
+ headers.append('Destination', this.config.uploadPath);
67
+ }
68
+ if (this.config.dbAppId) {
69
+ headers.append('DbAppId', this.config.dbAppId);
70
+ }
71
+ if (this.config.externalReferenceId) {
72
+ headers.append('ExternalReferenceId', this.config.externalReferenceId);
73
+ }
74
+ if (this.config.comment) {
75
+ headers.append('Comment', this.config.comment);
76
+ }
77
+ const req = new HttpRequest('POST', this.config.apiUrl, formData, {
49
78
  reportProgress: true,
50
79
  responseType: 'blob',
51
- headers: new HttpHeaders()
52
- .set('Destination', this.uploadPath)
53
- .set('DbAppId', this.dbAppId)
54
- .set('ExternalReferenceId', this.externalReferenceId)
55
- .set('Comment', this.comment)
56
- /*headers: this.uploadPath ?
57
- new HttpHeaders({ 'Destination': this.uploadPath }) :
58
- this.dbAppId ?
59
- new HttpHeaders({ 'DbAppId': this.dbAppId }) :
60
- null*/
80
+ headers
61
81
  });
62
82
  // create a new progress-subject for every file
63
83
  const progress = new Subject();
@@ -85,16 +105,16 @@ class UploadService {
85
105
  return status;
86
106
  }
87
107
  exists(fileName) {
88
- const query = this.uploadApiUrl.toLowerCase().indexOf('filesystem') === -1 ?
89
- { name: fileName, dbAppId: this.dbAppId } :
90
- { name: fileName, destination: this.uploadPath };
91
- return this.http.post(`${this.uploadApiUrl}/exists`, query);
108
+ const query = this.config.apiUrl.toLowerCase().indexOf('filesystem') === -1 ?
109
+ { name: fileName, dbAppId: this.config.dbAppId } :
110
+ { name: fileName, destination: this.config.uploadPath };
111
+ return this.http.post(`${this.config.apiUrl}/exists`, query);
92
112
  }
93
113
  download(request) {
94
- return this.http.post(`${this.uploadApiUrl}/stream`, request, { responseType: 'blob' });
114
+ return this.http.post(`${this.config.apiUrl}/stream`, request, { responseType: 'blob' });
95
115
  }
96
116
  getUploadInfo(request) {
97
- return this.http.post(`${this.uploadApiUrl}/info`, request);
117
+ return this.http.post(`${this.config.apiUrl}/info`, request);
98
118
  }
99
119
  }
100
120
  UploadService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: UploadService, deps: [{ token: i1.HttpClient }, { token: ServiceConfig, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
@@ -114,18 +134,13 @@ class UploadDialogComponent {
114
134
  this.files = new Set();
115
135
  this.existingFileConflict = null;
116
136
  this.canBeClosed = true;
137
+ this.primaryButtonText = null;
117
138
  this.showCancelButton = true;
118
139
  this.uploading = false;
119
140
  this.uploadSuccessful = false;
120
141
  }
121
142
  ngOnInit() {
122
- var _a, _b, _c, _d, _e;
123
- this.uploadDialogTitle = (_a = this.uploadService.uploadDialogTitle) !== null && _a !== void 0 ? _a : 'Upload Files';
124
- this.uploadDialogAddFilesButtonText = (_b = this.uploadService.uploadDialogAddFilesButtonText) !== null && _b !== void 0 ? _b : 'Add Files';
125
- this.uploadDialogCancelButtonText = (_c = this.uploadService.uploadDialogCancelButtonText) !== null && _c !== void 0 ? _c : 'Cancel';
126
- this.uploadDialogUploadButtonText = (_d = this.uploadService.uploadDialogUploadButtonText) !== null && _d !== void 0 ? _d : 'Upload';
127
- this.uploadDialogFinishButtonText = (_e = this.uploadService.uploadDialogFinishButtonText) !== null && _e !== void 0 ? _e : 'Finish';
128
- this.primaryButtonText = this.uploadDialogUploadButtonText;
143
+ this.primaryButtonText = this.uploadService.config.uploadDialogUploadButtonText;
129
144
  }
130
145
  addFiles() {
131
146
  this.file.nativeElement.click();
@@ -163,7 +178,7 @@ class UploadDialogComponent {
163
178
  }
164
179
  // Adjust the state variables
165
180
  // The OK-button should have the text "Finish" now
166
- this.primaryButtonText = this.uploadDialogFinishButtonText;
181
+ this.primaryButtonText = this.uploadService.config.uploadDialogFinishButtonText;
167
182
  // The dialog should not be closed while uploading
168
183
  this.canBeClosed = false;
169
184
  this.dialogRef.disableClose = true;
@@ -182,10 +197,10 @@ class UploadDialogComponent {
182
197
  }
183
198
  }
184
199
  UploadDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: UploadDialogComponent, deps: [{ token: i1$1.MatDialogRef }, { token: UploadService }], target: i0.ɵɵFactoryTarget.Component });
185
- UploadDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: UploadDialogComponent, selector: "cp-upload-dialog", viewQueries: [{ propertyName: "file", first: true, predicate: ["file"], descendants: true, static: true }], ngImport: i0, template: "<input type=\"file\" #file style=\"display: none\" (change)=\"onFilesAdded()\" multiple />\n\n<div mat-dialog-title id=\"title\">\n <div>{{ uploadDialogTitle }}</div>\n <button [disabled]=\"uploading || uploadSuccessful\" mat-raised-button color=\"primary\" class=\"add-files-btn\" (click)=\"addFiles()\">\n {{ uploadDialogAddFilesButtonText }}\n </button>\n</div>\n\n<div id=\"conflict\" *ngIf=\"existingFileConflict\">\n {{ existingFileConflict }} already exists on the server and cannot be overwritten\n</div>\n\n<mat-dialog-content>\n <mat-list>\n <mat-list-item *ngFor=\"let file of files\">\n <h4 mat-line>{{file.name}}</h4>\n <mat-progress-bar *ngIf=\"progress\" mode=\"determinate\" [value]=\"progress[file.name].progress | async\"></mat-progress-bar>\n </mat-list-item>\n </mat-list>\n</mat-dialog-content>\n\n<mat-dialog-actions id=\"actions\">\n <button *ngIf=\"showCancelButton\" mat-button mat-dialog-close>{{ uploadDialogCancelButtonText }}</button>\n <button *ngIf=\"files.size > 0\" mat-raised-button color=\"primary\" [disabled]=\"!canBeClosed\" (click)=\"closeDialog()\">{{ primaryButtonText }}</button>\n</mat-dialog-actions>\n", styles: ["#title{display:flex;justify-content:space-between}#actions{display:flex;justify-content:flex-end}#conflict{font-size:.8em;color:red;margin-top:.5em}\n"], dependencies: [{ kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: i1$1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1$1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: i1$1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "component", type: i4.MatList, selector: "mat-list, mat-action-list", inputs: ["disableRipple", "disabled"], exportAs: ["matList"] }, { kind: "component", type: i4.MatListItem, selector: "mat-list-item, a[mat-list-item], button[mat-list-item]", inputs: ["disableRipple", "disabled"], exportAs: ["matListItem"] }, { kind: "directive", type: i5.MatLine, selector: "[mat-line], [matLine]" }, { kind: "component", type: i6.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }] });
200
+ UploadDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: UploadDialogComponent, selector: "cp-upload-dialog", viewQueries: [{ propertyName: "file", first: true, predicate: ["file"], descendants: true, static: true }], ngImport: i0, template: "<input type=\"file\" #file style=\"display: none\" (change)=\"onFilesAdded()\" multiple />\n\n<div mat-dialog-title id=\"title\">\n <div>{{ uploadService.config.uploadDialogTitle }}</div>\n <button [disabled]=\"uploading || uploadSuccessful\" mat-raised-button color=\"primary\" class=\"add-files-btn\" (click)=\"addFiles()\">\n {{ uploadService.config.uploadDialogAddFilesButtonText }}\n </button>\n</div>\n\n<div id=\"conflict\" *ngIf=\"existingFileConflict\">\n {{ existingFileConflict }} already exists on the server and cannot be overwritten\n</div>\n\n<mat-dialog-content>\n <mat-list>\n <mat-list-item *ngFor=\"let file of files\">\n <h4 mat-line>{{file.name}}</h4>\n <mat-progress-bar *ngIf=\"progress\" mode=\"determinate\" [value]=\"progress[file.name].progress | async\"></mat-progress-bar>\n </mat-list-item>\n </mat-list>\n</mat-dialog-content>\n\n<mat-dialog-actions id=\"actions\">\n <button *ngIf=\"showCancelButton\" mat-button mat-dialog-close>{{ uploadService.config.uploadDialogCancelButtonText }}</button>\n <button *ngIf=\"files.size > 0\" mat-raised-button color=\"primary\" [disabled]=\"!canBeClosed\" (click)=\"closeDialog()\">{{ primaryButtonText }}</button>\n</mat-dialog-actions>\n", styles: ["#title{display:flex;justify-content:space-between}#actions{display:flex;justify-content:flex-end}#conflict{font-size:.8em;color:red;margin-top:.5em}\n"], dependencies: [{ kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: i1$1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1$1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: i1$1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "component", type: i4.MatList, selector: "mat-list, mat-action-list", inputs: ["disableRipple", "disabled"], exportAs: ["matList"] }, { kind: "component", type: i4.MatListItem, selector: "mat-list-item, a[mat-list-item], button[mat-list-item]", inputs: ["disableRipple", "disabled"], exportAs: ["matListItem"] }, { kind: "directive", type: i5.MatLine, selector: "[mat-line], [matLine]" }, { kind: "component", type: i6.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }] });
186
201
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: UploadDialogComponent, decorators: [{
187
202
  type: Component,
188
- args: [{ selector: 'cp-upload-dialog', template: "<input type=\"file\" #file style=\"display: none\" (change)=\"onFilesAdded()\" multiple />\n\n<div mat-dialog-title id=\"title\">\n <div>{{ uploadDialogTitle }}</div>\n <button [disabled]=\"uploading || uploadSuccessful\" mat-raised-button color=\"primary\" class=\"add-files-btn\" (click)=\"addFiles()\">\n {{ uploadDialogAddFilesButtonText }}\n </button>\n</div>\n\n<div id=\"conflict\" *ngIf=\"existingFileConflict\">\n {{ existingFileConflict }} already exists on the server and cannot be overwritten\n</div>\n\n<mat-dialog-content>\n <mat-list>\n <mat-list-item *ngFor=\"let file of files\">\n <h4 mat-line>{{file.name}}</h4>\n <mat-progress-bar *ngIf=\"progress\" mode=\"determinate\" [value]=\"progress[file.name].progress | async\"></mat-progress-bar>\n </mat-list-item>\n </mat-list>\n</mat-dialog-content>\n\n<mat-dialog-actions id=\"actions\">\n <button *ngIf=\"showCancelButton\" mat-button mat-dialog-close>{{ uploadDialogCancelButtonText }}</button>\n <button *ngIf=\"files.size > 0\" mat-raised-button color=\"primary\" [disabled]=\"!canBeClosed\" (click)=\"closeDialog()\">{{ primaryButtonText }}</button>\n</mat-dialog-actions>\n", styles: ["#title{display:flex;justify-content:space-between}#actions{display:flex;justify-content:flex-end}#conflict{font-size:.8em;color:red;margin-top:.5em}\n"] }]
203
+ args: [{ selector: 'cp-upload-dialog', template: "<input type=\"file\" #file style=\"display: none\" (change)=\"onFilesAdded()\" multiple />\n\n<div mat-dialog-title id=\"title\">\n <div>{{ uploadService.config.uploadDialogTitle }}</div>\n <button [disabled]=\"uploading || uploadSuccessful\" mat-raised-button color=\"primary\" class=\"add-files-btn\" (click)=\"addFiles()\">\n {{ uploadService.config.uploadDialogAddFilesButtonText }}\n </button>\n</div>\n\n<div id=\"conflict\" *ngIf=\"existingFileConflict\">\n {{ existingFileConflict }} already exists on the server and cannot be overwritten\n</div>\n\n<mat-dialog-content>\n <mat-list>\n <mat-list-item *ngFor=\"let file of files\">\n <h4 mat-line>{{file.name}}</h4>\n <mat-progress-bar *ngIf=\"progress\" mode=\"determinate\" [value]=\"progress[file.name].progress | async\"></mat-progress-bar>\n </mat-list-item>\n </mat-list>\n</mat-dialog-content>\n\n<mat-dialog-actions id=\"actions\">\n <button *ngIf=\"showCancelButton\" mat-button mat-dialog-close>{{ uploadService.config.uploadDialogCancelButtonText }}</button>\n <button *ngIf=\"files.size > 0\" mat-raised-button color=\"primary\" [disabled]=\"!canBeClosed\" (click)=\"closeDialog()\">{{ primaryButtonText }}</button>\n</mat-dialog-actions>\n", styles: ["#title{display:flex;justify-content:space-between}#actions{display:flex;justify-content:flex-end}#conflict{font-size:.8em;color:red;margin-top:.5em}\n"] }]
189
204
  }], ctorParameters: function () { return [{ type: i1$1.MatDialogRef }, { type: UploadService }]; }, propDecorators: { file: [{
190
205
  type: ViewChild,
191
206
  args: ['file', { static: true }]
@@ -198,8 +213,8 @@ class UploadComponent {
198
213
  this.dialogClosed = new EventEmitter();
199
214
  }
200
215
  ngOnInit() {
201
- this.uploadButtonText = this.uploadService.uploadButtonText ?
202
- this.uploadService.uploadButtonText :
216
+ this.uploadButtonText = this.uploadService.config.uploadButtonText ?
217
+ this.uploadService.config.uploadButtonText :
203
218
  'Upload';
204
219
  }
205
220
  openUploadDialog() {