{"version":3,"file":"studiohyperdrive-ngx-auth.mjs","sources":["../../../../../libs/angular/authentication/src/lib/abstracts/authentication.service.ts","../../../../../libs/angular/authentication/src/lib/utils/convert-to-array.util.ts","../../../../../libs/angular/authentication/src/lib/tokens/authentication-configuration.token.ts","../../../../../libs/angular/authentication/src/lib/directives/has-feature/has-feature.directive.ts","../../../../../libs/angular/authentication/src/lib/directives/has-permission/has-permission.directive.ts","../../../../../libs/angular/authentication/src/lib/directives/is-authenticated/is-authenticated.directive.ts","../../../../../libs/angular/authentication/src/lib/guards/has-feature/has-feature.guard.ts","../../../../../libs/angular/authentication/src/lib/guards/has-permission/has-permission.guard.ts","../../../../../libs/angular/authentication/src/lib/guards/is-authenticated/is-authenticated.guard.ts","../../../../../libs/angular/authentication/src/lib/pipes/has-feature/has-feature.pipe.ts","../../../../../libs/angular/authentication/src/lib/pipes/has-permission/has-permission.pipe.ts","../../../../../libs/angular/authentication/src/lib/interceptors/authentication/authentication.interceptor.ts","../../../../../libs/angular/authentication/src/lib/providers/authentication-configuration.provider.ts","../../../../../libs/angular/authentication/src/lib/mocks/authentication.service.mock.ts","../../../../../libs/angular/authentication/src/lib/mocks/authentication.response.mock.ts","../../../../../libs/angular/authentication/src/lib/mocks/authenticated-http-client.mock.ts","../../../../../libs/angular/authentication/src/lib/services/authenticated-http-client/authenticated-http-client.service.ts","../../../../../libs/angular/authentication/src/studiohyperdrive-ngx-auth.ts"],"sourcesContent":["import {\n\tBehaviorSubject,\n\tcombineLatest,\n\tdistinctUntilChanged,\n\tfilter,\n\tmap,\n\tObservable,\n\tof,\n\tswitchMap,\n\ttap,\n} from 'rxjs';\n\nimport { AuthenticationResponse } from '@studiohyperdrive/types-auth';\nimport { NgxAuthenticationResponseFeature, NgxAuthenticationStatus } from '../types';\n\n/**\n * An abstract service used by the directives, guards and other components of @studiohyperdrive/ngx-auth\n *\n * @template AuthenticationResponseType - The type of authentication response\n * @template SignInDataType - The data type used to sign in a user\n * @template SignoutDataType - The data type used to sign out a user\n * @template SignOutResponseType - The data type you get when signing out a user\n */\nexport abstract class NgxAuthenticationAbstractService<\n\tAuthenticationResponseType extends\n\t\tAuthenticationResponse<unknown> = AuthenticationResponse<any>,\n\tSignInDataType = any,\n\tSignoutDataType = any,\n\tSignOutResponseType = void,\n> {\n\t/**\n\t * A subject to store the authentication response if no other state implementation was provided\n\t */\n\tprivate readonly authenticationResponseSubject: BehaviorSubject<AuthenticationResponseType> =\n\t\tnew BehaviorSubject<AuthenticationResponseType>(undefined);\n\n\t/**\n\t * A subject to store whether we've authenticated already\n\t */\n\tprivate readonly authenticationStatusSubject: BehaviorSubject<NgxAuthenticationStatus> =\n\t\tnew BehaviorSubject<NgxAuthenticationStatus>('unset');\n\n\t/**\n\t * A subject to store global features that are available for all users, regardless of their authenticated state\n\t */\n\tprivate readonly globalFeaturesSubject: BehaviorSubject<\n\t\tNgxAuthenticationResponseFeature<AuthenticationResponseType>[]\n\t> = new BehaviorSubject<NgxAuthenticationResponseFeature<AuthenticationResponseType>[]>([]);\n\n\t/**\n\t * Whether an authentication attempt has been made\n\t */\n\tpublic readonly hasAuthenticated$: Observable<boolean> = this.authenticationStatusSubject.pipe(\n\t\tdistinctUntilChanged(),\n\t\tmap((status) => status !== 'unset')\n\t);\n\n\t/**\n\t * Whether the user is authenticated\n\t */\n\tpublic readonly isAuthenticated$: Observable<boolean> = this.authenticationStatusSubject.pipe(\n\t\tdistinctUntilChanged(),\n\t\tmap((status) => status === 'signed-in')\n\t);\n\n\t/**\n\t * The call required to sign in a user\n\t *\n\t * @param signInData - The data needed to sign in a user\n\t */\n\tprotected abstract signInUser(\n\t\tsignInData: SignInDataType\n\t): Observable<AuthenticationResponseType>;\n\n\t/**\n\t * The call required to sign out a user\n\t *\n\t * @param signoutDataType - Optional data needed to sign out a user\n\t */\n\tprotected abstract signOutUser(\n\t\tsignoutDataType?: SignoutDataType\n\t): Observable<SignOutResponseType>;\n\n\t/**\n\t * Stores the authentication response in the state\n\t *\n\t * @param response - The authentication response\n\t */\n\tprotected storeAuthenticationResponse(response: AuthenticationResponseType): void {\n\t\tthis.authenticationResponseSubject.next(response);\n\t}\n\n\t/**\n\t * Returns the authentication response from the state\n\t */\n\tprotected getAuthenticationResponse(): Observable<AuthenticationResponseType> {\n\t\treturn this.authenticationResponseSubject.asObservable();\n\t}\n\n\t/**\n\t * The authenticated user\n\t */\n\tpublic get user$(): Observable<AuthenticationResponseType['user']> {\n\t\treturn this.getAuthenticationResponse().pipe(\n\t\t\tfilter(Boolean),\n\t\t\tmap((response) => response.user),\n\t\t\tdistinctUntilChanged()\n\t\t);\n\t}\n\n\t/**\n\t * The session of the authenticated user\n\t */\n\tpublic get session$(): Observable<AuthenticationResponseType['session']> {\n\t\treturn this.getAuthenticationResponse().pipe(\n\t\t\tfilter(Boolean),\n\t\t\tmap(({ session }: AuthenticationResponseType) => session),\n\t\t\tdistinctUntilChanged()\n\t\t);\n\t}\n\n\t/**\n\t * The metadata of the authenticated user\n\t */\n\tpublic get metadata$(): Observable<AuthenticationResponseType['metadata']> {\n\t\treturn this.getAuthenticationResponse().pipe(\n\t\t\tfilter(Boolean),\n\t\t\tmap(({ metadata }: AuthenticationResponseType) => metadata),\n\t\t\tdistinctUntilChanged()\n\t\t);\n\t}\n\n\t/**\n\t * Signs in a user and stores the authentication response\n\t *\n\t * @param signInData - The data needed to sign in a user\n\t */\n\tpublic signIn(signInData: SignInDataType): Observable<void> {\n\t\t// Iben: Perform the call to sign in a user\n\t\treturn this.signInUser(signInData).pipe(\n\t\t\ttap((response: AuthenticationResponseType) => {\n\t\t\t\t// Iben: Set the user as signed in\n\t\t\t\tthis.authenticationStatusSubject.next('signed-in');\n\n\t\t\t\t// Iben: Store the authentication response\n\t\t\t\tthis.storeAuthenticationResponse(response);\n\t\t\t}),\n\t\t\t// Iben: Convert to void\n\t\t\tmap(() => undefined)\n\t\t);\n\t}\n\n\t/**\n\t * Signs out a user and removes the stored authentication response\n\t *\n\t * @param signoutDataType - Optional data needed to sign out a use\n\t */\n\tpublic signOut(signoutDataType?: SignoutDataType): Observable<SignOutResponseType> {\n\t\t// Iben: Perform the call to sign out a user\n\t\treturn this.signOutUser(signoutDataType).pipe(\n\t\t\ttap(() => {\n\t\t\t\t// Iben: Set the user as signed out\n\t\t\t\tthis.authenticationStatusSubject.next('signed-out');\n\n\t\t\t\t// Iben: Remove the stored authentication response\n\t\t\t\tthis.storeAuthenticationResponse(undefined);\n\t\t\t})\n\t\t);\n\t}\n\n\t/**\n\t * Returns whether the user has the required features.\n\t *\n\t * @param requiredFeatures - An array of required features\n\t * @param shouldHaveAllFeatures - Whether all features in the array are required, by default true\n\t */\n\tpublic hasFeature(\n\t\trequiredFeatures: NgxAuthenticationResponseFeature<AuthenticationResponseType>[],\n\t\tshouldHaveAllFeatures: boolean = true\n\t): Observable<boolean> {\n\t\t// Iben: Get the session\n\t\treturn combineLatest([this.getSession(), this.globalFeaturesSubject.asObservable()]).pipe(\n\t\t\tmap(([{ features }, globalFeatures]) => {\n\t\t\t\tconst sessionFeatures = new Set([...(features || []), ...(globalFeatures || [])]);\n\t\t\t\t// Iben: Return whether the user has the required features\n\t\t\t\t// We cast to strings here to make the typing work\n\t\t\t\treturn shouldHaveAllFeatures\n\t\t\t\t\t? requiredFeatures.every((feature) => sessionFeatures.has(`${feature}`))\n\t\t\t\t\t: requiredFeatures.some((feature) => sessionFeatures.has(`${feature}`));\n\t\t\t})\n\t\t);\n\t}\n\n\t/**\n\t * Sets a set of global features that are always present, regardless of the authenticated state of the user\n\t *\n\t * @param  features - A list of features\n\t */\n\tpublic setGlobalFeatures(\n\t\tfeatures: NgxAuthenticationResponseFeature<AuthenticationResponseType>[]\n\t): void {\n\t\tthis.globalFeaturesSubject.next(features);\n\t}\n\n\t/**\n\t * Returns whether the user has the required permissions.\n\t *\n\t * @param requiredPermissions - An array of required permissions\n\t * @param shouldHaveAllPermissions - Whether all permissions in the array are required, by default true\n\t */\n\tpublic hasPermission(\n\t\trequiredPermissions: AuthenticationResponseType['session']['permissions'],\n\t\tshouldHaveAllPermissions: boolean = true\n\t): Observable<boolean> {\n\t\t// Iben: Get the session\n\t\treturn this.getSession().pipe(\n\t\t\tfilter(Boolean),\n\t\t\tmap(({ permissions }) => {\n\t\t\t\tconst sessionPermissions = new Set([...permissions]);\n\n\t\t\t\t// Iben: Return whether the user has the required permissions\n\t\t\t\treturn shouldHaveAllPermissions\n\t\t\t\t\t? requiredPermissions.every((permission) => sessionPermissions.has(permission))\n\t\t\t\t\t: requiredPermissions.some((permission) => sessionPermissions.has(permission));\n\t\t\t})\n\t\t);\n\t}\n\n\t/**\n\t * Returns a session or an empty session depending on the authenticated state\n\t */\n\tprivate getSession(): Observable<AuthenticationResponseType['session']> {\n\t\treturn this.isAuthenticated$.pipe(\n\t\t\tswitchMap((isAuthenticated) => {\n\t\t\t\t// Iben: If the user is authenticated, we return the session, if not, we return an empty version for the hasPermission and hasFeature methods\n\t\t\t\t// This ensures we always get a response\n\t\t\t\treturn isAuthenticated\n\t\t\t\t\t? this.session$\n\t\t\t\t\t: of({\n\t\t\t\t\t\t\tfeatures: [],\n\t\t\t\t\t\t\tpermissions: [],\n\t\t\t\t\t\t});\n\t\t\t})\n\t\t);\n\t}\n}\n","/**\n * Converts an single item to an array or returns the array as is. This is to help the guards, directives and pipes in this feature due to the typing in the abstract service\n */\nexport const convertToArray = <DataType>(item: DataType | DataType[]): DataType[] => {\n\treturn Array.isArray(item) ? item : [item];\n};\n","import { InjectionToken } from '@angular/core';\nimport { NgxAuthenticatedHttpClientConfiguration } from '../types';\nimport { NgxAuthenticationAbstractService } from '../abstracts';\n\n/**\n * A token to provide the necessary service to the directives/guard\n */\nexport const NgxAuthenticationServiceToken = new InjectionToken<NgxAuthenticationAbstractService>(\n\t'NgxAuthenticationServiceToken'\n);\n\n/**\n * A token to provide the necessary urlHandler to the NgxAuthenticatedHttpClient\n */\nexport const NgxAuthenticationUrlHandlerToken = new InjectionToken<\n\tNgxAuthenticatedHttpClientConfiguration['baseUrl']\n>('NgxAuthenticationUrlHandlerToken');\n\n/**\n * A token to provide the necessary handler to the NgxAuthenticatedHttpInterceptor\n */\nexport const NgxAuthenticationInterceptorToken = new InjectionToken<\n\tNgxAuthenticatedHttpClientConfiguration['authenticatedCallHandler']\n>('NgxAuthenticationInterceptorToken');\n","import {\n\tChangeDetectorRef,\n\tDirective,\n\tEmbeddedViewRef,\n\tInject,\n\tInput,\n\tOnDestroy,\n\tTemplateRef,\n\tViewContainerRef,\n} from '@angular/core';\nimport { Subject, takeUntil, tap } from 'rxjs';\nimport { NgxAuthenticationAbstractService } from '../../abstracts';\nimport { convertToArray } from '../../utils';\nimport { NgxAuthenticationServiceToken } from '../../tokens';\n\n/**\n * A directive that will render a part of the template based on whether the required feature(s) are provided.\n *\n * Based upon `*ngIf`. See https://github.com/angular/angular/blob/master/packages/common/src/directives/ng_if.ts\n */\n\n//TODO: Iben: Implement Cypress/PlayWright tests\n@Directive({\n\tselector: '[ngxHasFeature]',\n})\nexport class NgxHasFeatureDirective<FeatureType extends string> implements OnDestroy {\n\t/**\n\t * The destroyed state of the directive\n\t */\n\tprivate destroyed$: Subject<void>;\n\n\t/**\n\t * The needed templateRefs\n\t */\n\tprivate thenTemplateRef: TemplateRef<any> | null = null;\n\tprivate thenViewRef: EmbeddedViewRef<any> | null = null;\n\tprivate elseTemplateRef: TemplateRef<any> | null = null;\n\tprivate elseViewRef: EmbeddedViewRef<any> | null = null;\n\n\t/**\n\t * The (list of) feature(s) we need to check\n\t */\n\tprivate feature: FeatureType | FeatureType[] = [];\n\n\t/**\n\t * Whether the feature should be enabled\n\t */\n\tprivate shouldHaveFeature: boolean = true;\n\n\t/**\n\t * Whether all features should be enabled\n\t */\n\tprivate shouldHaveAllFeatures: boolean = true;\n\n\t/**\n\t * A feature or list of features the item should have\n\t */\n\t@Input() public set ngxHasFeature(feature: FeatureType | FeatureType[]) {\n\t\tthis.feature = feature;\n\t\tthis.updateView();\n\t}\n\n\t/**\n\t * The else template in case the feature is not enabled\n\t */\n\t@Input() public set ngxHasFeatureElse(ngTemplate: TemplateRef<any>) {\n\t\tthis.elseTemplateRef = ngTemplate;\n\t\tthis.elseViewRef = null;\n\t\tthis.updateView();\n\t}\n\n\t/**\n\t * Whether the feature should be enabled, by default this is true\n\t */\n\t@Input() public set ngxHasFeatureShouldHaveFeature(shouldHaveFeatureEnabled: boolean) {\n\t\tthis.shouldHaveFeature = shouldHaveFeatureEnabled;\n\t\tthis.updateView();\n\t}\n\n\t/**\n\t * Whether all features should be enabled, by default this is true\n\t */\n\t@Input() public set ngxHasFeatureShouldHaveAllFeatures(shouldHaveAllFeatures: boolean) {\n\t\tthis.shouldHaveAllFeatures = shouldHaveAllFeatures;\n\t\tthis.updateView();\n\t}\n\n\tconstructor(\n\t\tpublic templateRef: TemplateRef<any>,\n\t\tprivate viewContainer: ViewContainerRef,\n\t\t@Inject(NgxAuthenticationServiceToken)\n\t\tprivate readonly authenticationService: NgxAuthenticationAbstractService,\n\t\tprivate readonly cdRef: ChangeDetectorRef\n\t) {\n\t\tthis.thenTemplateRef = templateRef;\n\t}\n\n\tpublic ngOnDestroy(): void {\n\t\tthis.dispose();\n\t}\n\n\t/**\n\t * Updates the view and hides/renders the template as needed\n\t */\n\tprivate updateView(): void {\n\t\t// Iben: Dispose the current subscription\n\t\tthis.dispose();\n\n\t\t// Iben: Create a new onDestroyed handler\n\t\tthis.destroyed$ = new Subject();\n\n\t\t// Iben: Render the views based on the correct state\n\t\tthis.authenticationService\n\t\t\t.hasFeature(convertToArray<FeatureType>(this.feature), this.shouldHaveAllFeatures)\n\t\t\t.pipe(\n\t\t\t\ttap((hasFeature) => {\n\t\t\t\t\t// Iben: Clear the current view\n\t\t\t\t\tthis.viewContainer.clear();\n\n\t\t\t\t\t// Iben: Check if we should render the view\n\t\t\t\t\tconst shouldRender: boolean = this.shouldHaveFeature ? hasFeature : !hasFeature;\n\n\t\t\t\t\t// Iben: Render the correct templates\n\t\t\t\t\tif (shouldRender) {\n\t\t\t\t\t\tthis.viewContainer.clear();\n\t\t\t\t\t\tthis.elseViewRef = null;\n\n\t\t\t\t\t\tif (this.thenTemplateRef) {\n\t\t\t\t\t\t\tthis.thenViewRef = this.viewContainer.createEmbeddedView(\n\t\t\t\t\t\t\t\tthis.thenTemplateRef\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (!this.elseViewRef) {\n\t\t\t\t\t\t\tthis.viewContainer.clear();\n\t\t\t\t\t\t\tthis.thenViewRef = null;\n\n\t\t\t\t\t\t\tif (this.elseTemplateRef) {\n\t\t\t\t\t\t\t\tthis.elseViewRef = this.viewContainer.createEmbeddedView(\n\t\t\t\t\t\t\t\t\tthis.elseTemplateRef\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Iben: Detect the changes so that the view gets updated\n\t\t\t\t\tthis.cdRef.detectChanges();\n\t\t\t\t}),\n\t\t\t\ttakeUntil(this.destroyed$)\n\t\t\t)\n\t\t\t.subscribe();\n\t}\n\n\t/**\n\t * Dispose the current subscription\n\t */\n\tprivate dispose(): void {\n\t\tif (this.destroyed$) {\n\t\t\tthis.destroyed$.next();\n\t\t\tthis.destroyed$.complete();\n\t\t}\n\t}\n}\n","import {\n\tChangeDetectorRef,\n\tDirective,\n\tEmbeddedViewRef,\n\tInject,\n\tInput,\n\tOnDestroy,\n\tTemplateRef,\n\tViewContainerRef,\n} from '@angular/core';\nimport { Subject, takeUntil, tap } from 'rxjs';\nimport { NgxAuthenticationAbstractService } from '../../abstracts';\nimport { convertToArray } from '../../utils';\nimport { NgxAuthenticationServiceToken } from '../../tokens';\n\n/**\n * A directive that will render a part of the template based on whether the required permissions(s) are provided.\n *\n * Based upon `*ngIf`. See https://github.com/angular/angular/blob/master/packages/common/src/directives/ng_if.ts\n */\n\n//TODO: Iben: Implement Cypress/PlayWright tests\n@Directive({\n\tselector: '[ngxHasPermission]',\n})\nexport class NgxHasPermissionDirective<PermissionType extends string> implements OnDestroy {\n\t/**\n\t * The destroyed state of the directive\n\t */\n\tprivate destroyed$: Subject<void>;\n\n\t/**\n\t * The needed templateRefs\n\t */\n\tprivate thenTemplateRef: TemplateRef<any> | null = null;\n\tprivate thenViewRef: EmbeddedViewRef<any> | null = null;\n\tprivate elseTemplateRef: TemplateRef<any> | null = null;\n\tprivate elseViewRef: EmbeddedViewRef<any> | null = null;\n\n\t/**\n\t * The (list of) permission(s) we need to check\n\t */\n\tprivate permission: PermissionType | PermissionType[] = [];\n\n\t/**\n\t * Whether the permission should be enabled\n\t */\n\tprivate shouldHavePermission: boolean = true;\n\n\t/**\n\t * Whether all permissions should be enabled\n\t */\n\tprivate shouldHaveAllPermissions: boolean = true;\n\n\t/**\n\t * A permission or list of permissions the item should have\n\t */\n\t@Input() public set ngxHasPermission(permission: PermissionType | PermissionType[]) {\n\t\tthis.permission = permission;\n\t\tthis.updateView();\n\t}\n\n\t/**\n\t * The else template in case the permission is not enabled\n\t */\n\t@Input() public set ngxHasPermissionElse(ngTemplate: TemplateRef<any>) {\n\t\tthis.elseTemplateRef = ngTemplate;\n\t\tthis.elseViewRef = null;\n\t\tthis.updateView();\n\t}\n\n\t/**\n\t * Whether the permission should be enabled, by default this is true\n\t */\n\t@Input() public set ngxHasPermissionShouldHavePermission(shouldHavePermissionEnabled: boolean) {\n\t\tthis.shouldHavePermission = shouldHavePermissionEnabled;\n\t\tthis.updateView();\n\t}\n\n\t/**\n\t * Whether all permissions should be enabled, by default this is true\n\t */\n\t@Input() public set ngxHasPermissionShouldHaveAllPermissions(\n\t\tshouldHaveAllPermissions: boolean\n\t) {\n\t\tthis.shouldHaveAllPermissions = shouldHaveAllPermissions;\n\t\tthis.updateView();\n\t}\n\n\tconstructor(\n\t\ttemplateRef: TemplateRef<any>,\n\t\tprivate viewContainer: ViewContainerRef,\n\t\t@Inject(NgxAuthenticationServiceToken)\n\t\tprivate readonly authenticationService: NgxAuthenticationAbstractService,\n\t\tprivate readonly cdRef: ChangeDetectorRef\n\t) {\n\t\tthis.thenTemplateRef = templateRef;\n\t}\n\n\tpublic ngOnDestroy(): void {\n\t\tthis.dispose();\n\t}\n\n\t/**\n\t * Updates the view and hides/renders the template as needed\n\t */\n\tprivate updateView(): void {\n\t\t// Iben: Dispose the current subscription\n\t\tthis.dispose();\n\n\t\t// Iben: Create a new onDestroyed handler\n\t\tthis.destroyed$ = new Subject();\n\n\t\t// Iben: Render the views based on the correct state\n\t\tthis.authenticationService\n\t\t\t.hasPermission(\n\t\t\t\tconvertToArray<PermissionType>(this.permission),\n\t\t\t\tthis.shouldHaveAllPermissions\n\t\t\t)\n\t\t\t.pipe(\n\t\t\t\ttap((hasPermission) => {\n\t\t\t\t\t// Iben: Clear the current view\n\t\t\t\t\tthis.viewContainer.clear();\n\n\t\t\t\t\t// Iben: Check if we should render the view\n\t\t\t\t\tconst shouldRender: boolean = this.shouldHavePermission\n\t\t\t\t\t\t? hasPermission\n\t\t\t\t\t\t: !hasPermission;\n\n\t\t\t\t\t// Iben: Render the correct templates\n\t\t\t\t\tif (shouldRender) {\n\t\t\t\t\t\tthis.viewContainer.clear();\n\t\t\t\t\t\tthis.elseViewRef = null;\n\n\t\t\t\t\t\tif (this.thenTemplateRef) {\n\t\t\t\t\t\t\tthis.thenViewRef = this.viewContainer.createEmbeddedView(\n\t\t\t\t\t\t\t\tthis.thenTemplateRef\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (!this.elseViewRef) {\n\t\t\t\t\t\t\tthis.viewContainer.clear();\n\t\t\t\t\t\t\tthis.thenViewRef = null;\n\n\t\t\t\t\t\t\tif (this.elseTemplateRef) {\n\t\t\t\t\t\t\t\tthis.elseViewRef = this.viewContainer.createEmbeddedView(\n\t\t\t\t\t\t\t\t\tthis.elseTemplateRef\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Iben: Detect the changes so that the view gets updated\n\t\t\t\t\tthis.cdRef.detectChanges();\n\t\t\t\t}),\n\t\t\t\ttakeUntil(this.destroyed$)\n\t\t\t)\n\t\t\t.subscribe();\n\t}\n\n\t/**\n\t * Dispose the current subscription\n\t */\n\tprivate dispose(): void {\n\t\tif (this.destroyed$) {\n\t\t\tthis.destroyed$.next();\n\t\t\tthis.destroyed$.complete();\n\t\t}\n\t}\n}\n","import {\n\tDirective,\n\tEmbeddedViewRef,\n\tInject,\n\tInput,\n\tOnDestroy,\n\tTemplateRef,\n\tViewContainerRef,\n} from '@angular/core';\nimport { Subject } from 'rxjs';\nimport { takeUntil, tap } from 'rxjs/operators';\nimport { NgxAuthenticationServiceToken } from '../../tokens';\nimport { NgxAuthenticationAbstractService } from '../../abstracts';\n\n/**\n *  * A directive that will render a part of the template based on whether the user is authenticated.\n *\n * Based upon `*ngIf`. See https://github.com/angular/angular/blob/master/packages/common/src/directives/ng_if.ts\n */\n@Directive({\n\tselector: '[ngxIsAuthenticated]',\n})\nexport class NgxIsAuthenticatedDirective implements OnDestroy {\n\t/**\n\t * The destroyed state of the directive\n\t */\n\tprivate destroyed$: Subject<void>;\n\n\t/**\n\t * The needed templateRefs\n\t */\n\tprivate thenTemplateRef: TemplateRef<any> | null = null;\n\tprivate thenViewRef: EmbeddedViewRef<any> | null = null;\n\tprivate elseTemplateRef: TemplateRef<any> | null = null;\n\tprivate elseViewRef: EmbeddedViewRef<any> | null = null;\n\n\t/**\n\t * Whether the user has to be authenticated\n\t */\n\tprivate shouldBeAuthenticated: boolean = true;\n\n\tconstructor(\n\t\t@Inject(NgxAuthenticationServiceToken)\n\t\tprivate readonly authenticationService: NgxAuthenticationAbstractService,\n\t\ttemplateRef: TemplateRef<any>,\n\t\tprivate viewContainer: ViewContainerRef\n\t) {\n\t\tthis.thenTemplateRef = templateRef;\n\t}\n\n\t/**\n\t * Whether the user has to be authenticated\n\t */\n\t@Input()\n\tpublic set ngxIsAuthenticated(authenticated: boolean) {\n\t\tthis.shouldBeAuthenticated = authenticated;\n\t\tthis.updateView();\n\t}\n\t/**\n\t * The else template in case the condition is not matched\n\t */\n\t@Input()\n\tpublic set ngxIsAuthenticatedElse(ngTemplate: TemplateRef<any>) {\n\t\tthis.elseTemplateRef = ngTemplate;\n\t\tthis.elseViewRef = null;\n\t\tthis.updateView();\n\t}\n\n\tpublic ngOnDestroy(): void {\n\t\tthis.dispose();\n\t}\n\n\tprivate updateView(): void {\n\t\t// Iben: Dispose the current subscription\n\t\tthis.dispose();\n\n\t\t// Iben: Create a new onDestroyed handler\n\t\tthis.destroyed$ = new Subject();\n\n\t\t// Iben: Render the views based on the correct state\n\t\tthis.authenticationService.isAuthenticated$\n\t\t\t.pipe(\n\t\t\t\ttap((isAuthenticated) => {\n\t\t\t\t\t// Iben: Check if we should render the view\n\t\t\t\t\tif (\n\t\t\t\t\t\t(isAuthenticated && this.shouldBeAuthenticated) ||\n\t\t\t\t\t\t(!isAuthenticated && !this.shouldBeAuthenticated)\n\t\t\t\t\t) {\n\t\t\t\t\t\tif (!this.thenViewRef) {\n\t\t\t\t\t\t\tthis.viewContainer.clear();\n\t\t\t\t\t\t\tthis.elseViewRef = null;\n\t\t\t\t\t\t\tif (this.thenTemplateRef) {\n\t\t\t\t\t\t\t\tthis.thenViewRef = this.viewContainer.createEmbeddedView(\n\t\t\t\t\t\t\t\t\tthis.thenTemplateRef\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (!this.elseViewRef) {\n\t\t\t\t\t\t\tthis.viewContainer.clear();\n\t\t\t\t\t\t\tthis.thenViewRef = null;\n\t\t\t\t\t\t\tif (this.elseTemplateRef) {\n\t\t\t\t\t\t\t\tthis.elseViewRef = this.viewContainer.createEmbeddedView(\n\t\t\t\t\t\t\t\t\tthis.elseTemplateRef\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t\ttakeUntil(this.destroyed$)\n\t\t\t)\n\t\t\t.subscribe();\n\t}\n\n\t/**\n\t * Dispose the current subscription\n\t */\n\tprivate dispose(): void {\n\t\tif (this.destroyed$) {\n\t\t\tthis.destroyed$.next();\n\t\t\tthis.destroyed$.complete();\n\t\t}\n\t}\n}\n","import { inject } from '@angular/core';\nimport {\n\tActivatedRoute,\n\tActivatedRouteSnapshot,\n\tCanActivateFn,\n\tRouter,\n\tcreateUrlTreeFromSnapshot,\n} from '@angular/router';\nimport { combineLatest, filter, map, Observable, of, tap } from 'rxjs';\n\nimport { NgxAuthenticationAbstractService } from '../../abstracts';\nimport { NgxAuthenticatedRoute } from '../../types';\nimport { convertToArray } from '../../utils';\nimport { NgxAuthenticationServiceToken } from '../../tokens';\n\n/**\n * Check if we can route to this route based on the provided feature\n *\n * @param  routeSnapshot - The provided route snapshot\n */\nexport const NgxHasFeatureGuard: CanActivateFn = <FeatureType extends string>(\n\trouteSnapshot: ActivatedRouteSnapshot\n): Observable<boolean> => {\n\t// Iben: Fetch all injectables\n\tconst authenticationService: NgxAuthenticationAbstractService = inject(\n\t\tNgxAuthenticationServiceToken\n\t);\n\tconst route: ActivatedRoute = inject(ActivatedRoute);\n\tconst router: Router = inject(Router);\n\n\t// Iben: Check if the feature is enabled for the environment\n\tconst snapshot: NgxAuthenticatedRoute<FeatureType> =\n\t\trouteSnapshot as NgxAuthenticatedRoute<FeatureType>;\n\tconst feature: FeatureType | FeatureType[] = snapshot.data?.feature;\n\tconst allFeatures: boolean =\n\t\tsnapshot.data?.shouldHaveAllFeatures === undefined\n\t\t\t? true\n\t\t\t: snapshot.data?.shouldHaveAllFeatures;\n\n\t// Wouter: The path to redirect to when the right conditions are met.\n\tconst redirectTo: string[] = snapshot.data?.redirect;\n\t/**\n\t * Whether we should navigate away if the feature exists.\n\t * * If this is set to `true`, a redirect path has been provided, and the feature is enabled, we navigate away\n\t * from the route this guard is set upon.\n\t * * If this is set to `false`, the feature flag must be enabled. If not, the guard will not allow for the route\n\t * this guard is set upon to be navigated to and will redirect to either the provided paths or the home page.\n\t *\n\t * Default value is `false`.\n\t */\n\tconst shouldNavigateOnFeature: boolean = Boolean(snapshot.data?.shouldNavigateOnFeature);\n\n\t// Iben: Early exit if there's no feature provided\n\tif (!feature) {\n\t\treturn of(true);\n\t}\n\n\t// Wouter: Early exit if we should navigate when the feature is enabled but no navigation was provided\n\tif (shouldNavigateOnFeature && !redirectTo.length) {\n\t\treturn of(true);\n\t}\n\n\t// Iben: If there's a feature provided, we check if we have the feature\n\treturn combineLatest([\n\t\tauthenticationService.isAuthenticated$,\n\t\tauthenticationService.hasFeature(convertToArray<FeatureType>(feature), allFeatures),\n\t]).pipe(\n\t\tfilter(([featuresHaveBeenSet]) => featuresHaveBeenSet),\n\t\ttap(([, canNavigate]) => {\n\t\t\t// Wouter: Continue if we should navigate when the FF is enabled\n\t\t\tif (shouldNavigateOnFeature) {\n\t\t\t\t// Wouter: Continue only if the feature is enabled\n\t\t\t\tif (canNavigate) {\n\t\t\t\t\t// Wouter: Snapshot is needed to navigate relatively.\n\t\t\t\t\treturn router.navigateByUrl(\n\t\t\t\t\t\tcreateUrlTreeFromSnapshot(routeSnapshot, redirectTo)\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Wouter: Continue if we should navigate when the feature is disabled\n\t\t\t// Wouter: If the feature is enabled, we shouldn't redirect.\n\t\t\tif (canNavigate) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t// Iben: Redirect if the feature is disabled\n\t\t\treturn router.navigate([...redirectTo], {\n\t\t\t\trelativeTo: route,\n\t\t\t});\n\t\t}),\n\t\t// Wouter: If we should navigate when the feature exists, the guard returns false as we have already navigated away.\n\t\t// If we should allow this guard's route when the feature exists, we can safely do so.\n\t\tmap(([, canNavigate]) => (shouldNavigateOnFeature ? !canNavigate : canNavigate))\n\t);\n};\n","import { inject } from '@angular/core';\nimport {\n\tActivatedRoute,\n\tActivatedRouteSnapshot,\n\tCanActivateFn,\n\tRouter,\n\tcreateUrlTreeFromSnapshot,\n} from '@angular/router';\nimport { combineLatest, filter, map, Observable, of, tap } from 'rxjs';\n\nimport { NgxAuthenticationAbstractService } from '../../abstracts';\nimport { NgxAuthenticatedRoute } from '../../types';\nimport { convertToArray } from '../../utils';\nimport { NgxAuthenticationServiceToken } from '../../tokens';\n\n/**\n * Check if we can route to this route based on the provided permission\n *\n * @param  routeSnapshot - The provided route snapshot\n */\nexport const NgxHasPermissionGuard: CanActivateFn = <PermissionType extends string>(\n\trouteSnapshot: ActivatedRouteSnapshot\n): Observable<boolean> => {\n\t// Iben: Fetch all injectables\n\tconst authenticationService: NgxAuthenticationAbstractService = inject(\n\t\tNgxAuthenticationServiceToken\n\t);\n\tconst route: ActivatedRoute = inject(ActivatedRoute);\n\tconst router: Router = inject(Router);\n\n\t// Iben: Check if the permission is enabled for the environment\n\tconst snapshot: NgxAuthenticatedRoute<string, PermissionType> =\n\t\trouteSnapshot as NgxAuthenticatedRoute<string, PermissionType>;\n\tconst permission: PermissionType | PermissionType[] = snapshot.data?.permission;\n\tconst allPermissions: boolean =\n\t\tsnapshot.data?.shouldHaveAllPermissions === undefined\n\t\t\t? true\n\t\t\t: snapshot.data?.shouldHaveAllPermissions;\n\n\t// Wouter: The path to redirect to when the right conditions are met.\n\tconst redirectTo: string[] = snapshot.data?.redirect;\n\t/**\n\t * Whether we should navigate away if the permission exists.\n\t * * If this is set to `true`, a redirect path has been provided, and the permission is enabled, we navigate away\n\t * from the route this guard is set upon.\n\t * * If this is set to `false`, the permission flag must be enabled. If not, the guard will not allow for the route\n\t * this guard is set upon to be navigated to and will redirect to either the provided paths or the home page.\n\t *\n\t * Default value is `false`.\n\t */\n\tconst shouldNavigateOnPermission: boolean = Boolean(snapshot.data?.shouldNavigateOnPermission);\n\n\t// Iben: Early exit if there's no permission provided\n\tif (!permission) {\n\t\treturn of(true);\n\t}\n\n\t// Wouter: Early exit if we should navigate when the permission is enabled but no navigation was provided\n\tif (shouldNavigateOnPermission && !redirectTo.length) {\n\t\treturn of(true);\n\t}\n\n\t// Iben: If there's a permission provided, we check if we have the permission\n\treturn combineLatest([\n\t\tauthenticationService.isAuthenticated$,\n\t\tauthenticationService.hasPermission(\n\t\t\tconvertToArray<PermissionType>(permission),\n\t\t\tallPermissions\n\t\t),\n\t]).pipe(\n\t\tfilter(([permissionsHaveBeenSet]) => permissionsHaveBeenSet),\n\t\ttap(([, canNavigate]) => {\n\t\t\t// Wouter: Continue if we should navigate when the FF is enabled\n\t\t\tif (shouldNavigateOnPermission) {\n\t\t\t\t// Wouter: Continue only if the permission is enabled\n\t\t\t\tif (canNavigate) {\n\t\t\t\t\t// Wouter: Snapshot is needed to navigate relatively.\n\t\t\t\t\treturn router.navigateByUrl(\n\t\t\t\t\t\tcreateUrlTreeFromSnapshot(routeSnapshot, redirectTo)\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Wouter: Continue if we should navigate when the permission is disabled\n\t\t\t// Wouter: If the permission is enabled, we shouldn't redirect.\n\t\t\tif (canNavigate) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t// Iben: Redirect if the permission is disabled\n\t\t\treturn router.navigate([...redirectTo], {\n\t\t\t\trelativeTo: route,\n\t\t\t});\n\t\t}),\n\t\t// Wouter: If we should navigate when the permission exists, the guard returns false as we have already navigated away.\n\t\t// If we should allow this guard's route when the permission exists, we can safely do so.\n\t\tmap(([, canNavigate]) => (shouldNavigateOnPermission ? !canNavigate : canNavigate))\n\t);\n};\n","import { inject } from '@angular/core';\nimport { ActivatedRoute, ActivatedRouteSnapshot, CanActivateFn, Router } from '@angular/router';\nimport { map, Observable } from 'rxjs';\n\nimport { NgxAuthenticationAbstractService } from '../../abstracts';\nimport { NgxAuthenticatedRoute } from '../../types';\nimport { NgxAuthenticationServiceToken } from '../../tokens';\n\n/**\n * Check if we can route to this route based on the provided permission\n *\n * @param  routeSnapshot - The provided route snapshot\n */\nexport const NgxIsAuthenticatedGuard: CanActivateFn = (\n\trouteSnapshot: ActivatedRouteSnapshot\n): Observable<boolean> => {\n\t// Iben: Fetch all injectables\n\tconst authenticationService: NgxAuthenticationAbstractService = inject(\n\t\tNgxAuthenticationServiceToken\n\t);\n\tconst route: ActivatedRoute = inject(ActivatedRoute);\n\tconst router: Router = inject(Router);\n\n\t// Iben: Check if the permission is enabled for the environment\n\tconst snapshot: NgxAuthenticatedRoute = routeSnapshot as NgxAuthenticatedRoute;\n\n\t// Wouter: The path to redirect to when the right conditions are met.\n\tconst redirectTo: string[] = snapshot.data?.redirect;\n\t/**\n\t * Whether we should navigate away if the user is not authenticated\n\t * Default value is `false`.\n\t */\n\tconst shouldBeAuthenticated: boolean = Boolean(snapshot.data?.shouldBeAuthenticated);\n\n\t// Iben: If there's a permission provided, we check if we have the permission\n\treturn authenticationService.isAuthenticated$.pipe(\n\t\tmap((isAuthenticated) => {\n\t\t\t// Wouter: Continue if we are authenticated and we should be authenticated or vice-versa\n\t\t\tif (\n\t\t\t\t(isAuthenticated && shouldBeAuthenticated) ||\n\t\t\t\t(!isAuthenticated && !shouldBeAuthenticated)\n\t\t\t) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t// Iben: Redirect if the previous check has failed\n\t\t\trouter.navigate([...redirectTo], {\n\t\t\t\trelativeTo: route,\n\t\t\t});\n\n\t\t\treturn false;\n\t\t})\n\t);\n};\n","import { ChangeDetectorRef, Inject, OnDestroy, Pipe, PipeTransform } from '@angular/core';\nimport { Observable, Subject, takeUntil, tap } from 'rxjs';\nimport { NgxAuthenticationAbstractService } from '../../abstracts';\nimport { convertToArray } from '../../utils';\nimport { NgxAuthenticationServiceToken } from '../../tokens';\n\n/**\n * A pipe that returns whether a (list of) feature(s) has been provided\n */\n@Pipe({\n\tname: 'ngxHasFeature',\n\tpure: false,\n})\nexport class NgxHasFeaturePipe<FeatureType extends string> implements PipeTransform, OnDestroy {\n\t/**\n\t * Subject to hold the destroyed state of the current observable\n\t */\n\tprivate destroyed$: Subject<void>;\n\t/**\n\t * The latest value of the Observable, whether or not the feature is provided\n\t */\n\tprivate hasFeature: boolean;\n\t/**\n\t * Instance of the change detector ref, implemented like this according to the async pipe implementation\n\t * https://github.com/angular/angular/blob/main/packages/common/src/pipes/async_pipe.ts\n\t */\n\tprivate changeDetectorRef: ChangeDetectorRef | null;\n\n\tconstructor(\n\t\t@Inject(NgxAuthenticationServiceToken)\n\t\tprivate readonly authenticationService: NgxAuthenticationAbstractService,\n\t\tprivate readonly cdRef: ChangeDetectorRef\n\t) {\n\t\t// Iben: Use instance of cdRef like this to prevent memory leaks (see Angular async Pipe implementation)\n\t\tthis.changeDetectorRef = cdRef;\n\t}\n\n\tpublic ngOnDestroy(): void {\n\t\t// Iben: Call the dispose when the component is destroyed so we have no running subscriptions left\n\t\tthis.dispose();\n\n\t\t// Iben: Clear instance of cdRef like this to prevent memory leaks (see Angular async Pipe implementation)\n\t\tthis.changeDetectorRef = null;\n\t}\n\n\t/**\n\t * Returns whether or not a feature is provided for the environment\n\t *\n\t * @param feature - The provided feature\n\t */\n\tpublic transform(feature: FeatureType | FeatureType[]): boolean {\n\t\tthis.subscribe(this.authenticationService.hasFeature(convertToArray<FeatureType>(feature)));\n\n\t\treturn this.hasFeature;\n\t}\n\n\t/**\n\t * Handles the changeDetection, latest value and dispose of the hasFeature observable\n\t *\n\t * @param observable - The hasFeature observable\n\t */\n\tprivate subscribe(observable: Observable<boolean>): void {\n\t\t// Iben: Dispose the current subscription\n\t\tthis.dispose();\n\n\t\t// Iben: Create a new destroyed subject to handle the destruction when needed\n\t\tthis.destroyed$ = new Subject();\n\n\t\tobservable\n\t\t\t.pipe(\n\t\t\t\ttap((value) => {\n\t\t\t\t\t// Iben: Update the latest value when it a new value is provided\n\t\t\t\t\tthis.hasFeature = value;\n\n\t\t\t\t\t// Iben: Mark the component as ready for check\n\t\t\t\t\tthis.changeDetectorRef.markForCheck();\n\t\t\t\t}),\n\t\t\t\ttakeUntil(this.destroyed$)\n\t\t\t)\n\t\t\t.subscribe();\n\t}\n\n\t/**\n\t * Dispose of the feature observable when existing\n\t */\n\tprivate dispose(): void {\n\t\t// Iben: In case there's a destroyed, we have an observable and we destroy the subscription and reset the observable\n\t\tif (this.destroyed$) {\n\t\t\tthis.destroyed$.next();\n\t\t\tthis.destroyed$.complete();\n\t\t}\n\t}\n}\n","import { ChangeDetectorRef, Inject, OnDestroy, Pipe, PipeTransform } from '@angular/core';\nimport { Observable, Subject, takeUntil, tap } from 'rxjs';\nimport { NgxAuthenticationAbstractService } from '../../abstracts';\nimport { convertToArray } from '../../utils';\nimport { NgxAuthenticationServiceToken } from '../../tokens';\n\n/**\n * A pipe that returns whether a (list of) permission(s) has been provided\n */\n@Pipe({\n\tname: 'ngxHasPermission',\n\tpure: false,\n})\nexport class NgxHasPermissionPipe<PermissionType extends string>\n\timplements PipeTransform, OnDestroy\n{\n\t/**\n\t * Subject to hold the destroyed state of the current observable\n\t */\n\tprivate destroyed$: Subject<void>;\n\t/**\n\t * The latest value of the Observable, whether or not the permission is provided\n\t */\n\tprivate hasPermission: boolean;\n\t/**\n\t * Instance of the change detector ref, implemented like this according to the async pipe implementation\n\t * https://github.com/angular/angular/blob/main/packages/common/src/pipes/async_pipe.ts\n\t */\n\tprivate changeDetectorRef: ChangeDetectorRef | null;\n\n\tconstructor(\n\t\t@Inject(NgxAuthenticationServiceToken)\n\t\tprivate readonly authenticationService: NgxAuthenticationAbstractService,\n\t\tprivate readonly cdRef: ChangeDetectorRef\n\t) {\n\t\t// Iben: Use instance of cdRef like this to prevent memory leaks (see Angular async Pipe implementation)\n\t\tthis.changeDetectorRef = cdRef;\n\t}\n\n\tpublic ngOnDestroy(): void {\n\t\t// Iben: Call the dispose when the component is destroyed so we have no running subscriptions left\n\t\tthis.dispose();\n\n\t\t// Iben: Clear instance of cdRef like this to prevent memory leaks (see Angular async Pipe implementation)\n\t\tthis.changeDetectorRef = null;\n\t}\n\n\t/**\n\t * Returns whether or not a permission is provided for the environment\n\t *\n\t * @param permission - The provided permission\n\t */\n\tpublic transform(permission: PermissionType | PermissionType[]): boolean {\n\t\tthis.subscribe(\n\t\t\tthis.authenticationService.hasPermission(convertToArray<PermissionType>(permission))\n\t\t);\n\n\t\treturn this.hasPermission;\n\t}\n\n\t/**\n\t * Handles the changeDetection, latest value and dispose of the hasPermission observable\n\t *\n\t * @param observable - The hasPermission observable\n\t */\n\tprivate subscribe(observable: Observable<boolean>): void {\n\t\t// Iben: Dispose the current subscription\n\t\tthis.dispose();\n\n\t\t// Iben: Create a new destroyed subject to handle the destruction when needed\n\t\tthis.destroyed$ = new Subject();\n\n\t\tobservable\n\t\t\t.pipe(\n\t\t\t\ttap((value) => {\n\t\t\t\t\t// Iben: Update the latest value when it a new value is provided\n\t\t\t\t\tthis.hasPermission = value;\n\n\t\t\t\t\t// Iben: Mark the component as ready for check\n\t\t\t\t\tthis.changeDetectorRef.markForCheck();\n\t\t\t\t}),\n\t\t\t\ttakeUntil(this.destroyed$)\n\t\t\t)\n\t\t\t.subscribe();\n\t}\n\n\t/**\n\t * Dispose of the permission observable when existing\n\t */\n\tprivate dispose(): void {\n\t\t// Iben: In case there's a destroyed, we have an observable and we destroy the subscription and reset the observable\n\t\tif (this.destroyed$) {\n\t\t\tthis.destroyed$.next();\n\t\t\tthis.destroyed$.complete();\n\t\t}\n\t}\n}\n","import { HttpEvent, HttpHandlerFn, HttpRequest } from '@angular/common/http';\nimport { Observable } from 'rxjs';\nimport { inject } from '@angular/core';\n\nimport { NgxAuthenticationInterceptorToken } from '../../tokens';\n\n/**\n * An interceptor that will handle any request that needs to be authenticated\n *\n * @param request - The provided request\n * @param next - The HttpHandler\n */\nexport function NgxAuthenticatedHttpInterceptor(\n\trequest: HttpRequest<unknown>,\n\tnext: HttpHandlerFn\n): Observable<HttpEvent<unknown>> {\n\t// Iben: Get the authenticatedCallHandler\n\tconst authenticatedCallHandler = inject(NgxAuthenticationInterceptorToken);\n\n\t// Iben: If the request does not need to be made in an authenticated state or if no authenticatedCallHandler was provided, we return the request as is\n\tif (!request.withCredentials || !authenticatedCallHandler) {\n\t\treturn next(request);\n\t}\n\n\t// Iben: Handle the authenticated call\n\treturn next(authenticatedCallHandler(request));\n}\n","import { EnvironmentProviders, Provider } from '@angular/core';\nimport { provideHttpClient, withInterceptors } from '@angular/common/http';\n\nimport {\n\tNgxAuthenticationInterceptorToken,\n\tNgxAuthenticationServiceToken,\n\tNgxAuthenticationUrlHandlerToken,\n} from '../tokens';\nimport { NgxAuthenticationConfiguration } from '../types';\nimport { NgxAuthenticatedHttpInterceptor } from '../interceptors';\n/**\n * Configures the provided implementation of the NgxAuthenticationAbstract service to the application\n *\n * @param configuration - The configuration with the provided service implementation\n */\nexport const provideNgxAuthenticationConfiguration = (\n\tconfiguration: NgxAuthenticationConfiguration\n): Provider | EnvironmentProviders[] => {\n\treturn [\n\t\t{\n\t\t\tprovide: NgxAuthenticationServiceToken,\n\t\t\tuseExisting: configuration.service,\n\t\t},\n\t\t// Iben: If the HttpClientConfiguration is provided, we assume the user wants to use the NgxAuthenticatedHttpClient\n\t\t...(!configuration.httpClientConfiguration\n\t\t\t? []\n\t\t\t: [\n\t\t\t\t\t{\n\t\t\t\t\t\tprovide: NgxAuthenticationUrlHandlerToken,\n\t\t\t\t\t\tuseValue: configuration.httpClientConfiguration.baseUrl,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tprovide: NgxAuthenticationInterceptorToken,\n\t\t\t\t\t\tuseValue: configuration.httpClientConfiguration.authenticatedCallHandler,\n\t\t\t\t\t},\n\t\t\t\t\tprovideHttpClient(\n\t\t\t\t\t\twithInterceptors([\n\t\t\t\t\t\t\tNgxAuthenticatedHttpInterceptor,\n\t\t\t\t\t\t\t...(configuration.httpClientConfiguration.interceptors || []),\n\t\t\t\t\t\t])\n\t\t\t\t\t),\n\t\t\t\t]),\n\t];\n};\n","import { AuthenticationResponse } from '@studiohyperdrive/types-auth';\nimport { map, Subject } from 'rxjs';\nimport { NgxAuthenticationStatus } from '../types';\n/**\n * Returns a mock version of the authentication service\n *\n * @param  configuration - The configuration of the mock\n */\nexport const NgxAuthenticationServiceMock = <\n\tAuthenticationResponseType extends AuthenticationResponse<any> = AuthenticationResponse<any>,\n>(configuration: {\n\thasFeatureSpy: unknown;\n\thasPermissionSpy: unknown;\n\tsignInSpy: unknown;\n\tsignOutSpy: unknown;\n\tauthenticationResponse: Subject<AuthenticationResponseType>;\n\thasAuthenticated: Subject<NgxAuthenticationStatus>;\n}): any => {\n\treturn {\n\t\thasFeature: configuration.hasFeatureSpy,\n\t\thasPermission: configuration.hasPermissionSpy,\n\t\tsignIn: configuration.signInSpy,\n\t\tsignOut: configuration.signOutSpy,\n\t\tisAuthenticated$: configuration.hasAuthenticated\n\t\t\t.asObservable()\n\t\t\t.pipe(map((status) => status === 'signed-in')),\n\t\thasAuthenticated$: configuration.hasAuthenticated\n\t\t\t.asObservable()\n\t\t\t.pipe(map((status) => status !== 'unset')),\n\t\tuser$: configuration.authenticationResponse\n\t\t\t.asObservable()\n\t\t\t.pipe(map((response) => response?.user)),\n\t\tsession$: configuration.authenticationResponse\n\t\t\t.asObservable()\n\t\t\t.pipe(map((response) => response?.session)),\n\t\tmetadata$: configuration.authenticationResponse\n\t\t\t.asObservable()\n\t\t\t.pipe(map((response) => response?.metadata)),\n\t};\n};\n","import { AuthenticatedUserSession, AuthenticationResponse } from '@studiohyperdrive/types-auth';\n/**\n * Returns a mock authentication response\n */\nexport const NgxAuthenticationResponseMock: AuthenticationResponse<\n\t{ name: string },\n\tAuthenticatedUserSession<'A' | 'B', 'Admin' | 'User'>,\n\t{ requestPassword: boolean }\n> = {\n\tuser: {\n\t\tname: 'Test',\n\t},\n\tsession: {\n\t\tfeatures: ['A'],\n\t\tpermissions: ['User'],\n\t},\n\tmetadata: {\n\t\trequestPassword: true,\n\t},\n};\n","import { of } from 'rxjs';\n\nexport /**\n * Returns a mock for the NgxAuthenticatedHttpClient. By default each methods returns an empty observable\n *\n * @param  configuration - Configuration to replace one of the methods with a custom method\n */\nconst NgxMockAuthenticatedHttpClient = (configuration: {\n\tdownload?: unknown;\n\tget?: unknown;\n\tpatch?: unknown;\n\tput?: unknown;\n\tdelete?: unknown;\n\tpost?: unknown;\n}) => {\n\tconst defaultFunction = () => of();\n\treturn {\n\t\tget: configuration.get || defaultFunction,\n\t\tdownload: configuration.download || defaultFunction,\n\t\tdelete: configuration.delete || defaultFunction,\n\t\tpatch: configuration.patch || defaultFunction,\n\t\tpost: configuration.post || defaultFunction,\n\t\tput: configuration.put || defaultFunction,\n\t};\n};\n","import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http';\nimport { Inject, Injectable } from '@angular/core';\nimport clean from 'obj-clean';\n\nimport { map, Observable } from 'rxjs';\nimport { NgxAuthenticatedHttpClientConfiguration } from '../../types';\nimport { NgxAuthenticationUrlHandlerToken } from '../../tokens';\n\n/**\n * An opinionated wrapper of the HttpClient providing easy ways to make authenticated and unauthenticated calls\n */\n@Injectable({ providedIn: 'root' })\nexport class NgxAuthenticatedHttpClient {\n\tprivate baseUrl: string;\n\n\tconstructor(\n\t\tprivate readonly httpClient: HttpClient,\n\t\t@Inject(NgxAuthenticationUrlHandlerToken)\n\t\tbaseUrlHandler: NgxAuthenticatedHttpClientConfiguration['baseUrl']\n\t) {\n\t\t// Iben: Setup the base url\n\t\tthis.baseUrl = baseUrlHandler ? baseUrlHandler() : '';\n\t}\n\n\t/**\n\t * Adds a base-url to every request\n\t * @param {string} url - The url of the request\n\t */\n\tprivate handleUrl(url: string): string {\n\t\treturn `${this.baseUrl}/${url}`;\n\t}\n\n\t/**\n\t * Constructs a GET request to the provided API\n\t *\n\t * @param  url - The url of the API\n\t * @param params - An optional set of params we wish to send to the API\n\t * @param withCredentials - Whether the call is made by an authenticated user, by default true\n\t * @param context - An optional HTTPContext\n\t */\n\tpublic get<DataType = unknown>(\n\t\turl: string,\n\t\tparams?: Parameters<HttpClient['get']>[1]['params'],\n\t\twithCredentials: boolean = true,\n\t\tcontext?: HttpContext\n\t): Observable<DataType> {\n\t\treturn this.httpClient.get<DataType>(\n\t\t\tthis.handleUrl(url),\n\t\t\tclean({ withCredentials, params, context }) as Parameters<HttpClient['get']>[1]\n\t\t);\n\t}\n\n\t/**\n\t * Constructs a GET request tailored to downloading to the provided API\n\t *\n\t * @param  url - The url of the API\n\t * @param params - An optional set of params we wish to send to the API\n\t * @param withCredentials - Whether the call is made by an authenticated user, by default true\n\t * @param context - An optional HTTPContext\n\t */\n\tpublic download(\n\t\turl: string,\n\t\tparams?: Parameters<HttpClient['get']>[1]['params'],\n\t\twithCredentials: boolean = true,\n\t\tcontext?: HttpContext\n\t): Observable<{\n\t\tfileType: string;\n\t\tblob: Blob;\n\t}> {\n\t\treturn this.httpClient\n\t\t\t.get(\n\t\t\t\tthis.handleUrl(url),\n\t\t\t\tclean({\n\t\t\t\t\twithCredentials,\n\t\t\t\t\tparams,\n\t\t\t\t\tresponseType: 'blob',\n\t\t\t\t\tobserve: 'response',\n\t\t\t\t\tcontext,\n\t\t\t\t}) as Parameters<HttpClient['get']>[1]\n\t\t\t)\n\t\t\t.pipe(\n\t\t\t\tmap((response: HttpResponse<Blob>) => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tfileType: response.headers.get('content-disposition').split('.')[1],\n\t\t\t\t\t\tblob: response.body as Blob,\n\t\t\t\t\t};\n\t\t\t\t})\n\t\t\t);\n\t}\n\n\t/**\n\t * Constructs a DELETE request to the provided API\n\t *\n\t * @param  url - The url of the API\n\t * @param params - An optional set of params we wish to send to the API\n\t * @param withCredentials - Whether the call is made by an authenticated user, by default true\n\t * @param context - An optional HTTPContext\n\t */\n\tpublic delete<DataType = void>(\n\t\turl: string,\n\t\tparams?: Parameters<HttpClient['delete']>[1]['params'],\n\t\twithCredentials: boolean = true,\n\t\tcontext?: HttpContext\n\t): Observable<DataType> {\n\t\treturn this.httpClient.delete<DataType>(\n\t\t\tthis.handleUrl(url),\n\t\t\tclean({ params, withCredentials, context }) as Parameters<HttpClient['delete']>[1]\n\t\t);\n\t}\n\n\t/**\n\t * Constructs a POST request to the provided API\n\t *\n\t * @param  url - The url of the API\n\t * @param body - The body we wish to send\n\t * @param params - An optional set of params we wish to send to the API\n\t * @param withCredentials - Whether the call is made by an authenticated user, by default true\n\t * @param context - An optional HTTPContext\n\t */\n\tpublic post<DataType = void>(\n\t\turl: string,\n\t\tbody: any,\n\t\tparams?: Parameters<HttpClient['post']>[1]['params'],\n\t\twithCredentials: boolean = true,\n\t\tcontext?: HttpContext\n\t): Observable<DataType> {\n\t\treturn this.httpClient.post<DataType>(\n\t\t\tthis.handleUrl(url),\n\t\t\tbody,\n\t\t\tclean({ params, withCredentials, context }) as Parameters<HttpClient['post']>[2]\n\t\t);\n\t}\n\n\t/**\n\t * Constructs a PUT request to the provided API\n\t *\n\t * @param  url - The url of the API\n\t * @param body - The body we wish to send\n\t * @param params - An optional set of params we wish to send to the API\n\t * @param withCredentials - Whether the call is made by an authenticated user, by default true\n\t * @param context - An optional HTTPContext\n\t */\n\tpublic put<DataType = void>(\n\t\turl: string,\n\t\tbody?: any,\n\t\tparams?: Parameters<HttpClient['put']>[1]['params'],\n\t\twithCredentials: boolean = true,\n\t\tcontext?: HttpContext\n\t): Observable<DataType> {\n\t\treturn this.httpClient.put<DataType>(\n\t\t\tthis.handleUrl(url),\n\t\t\tbody,\n\t\t\tclean({ params, withCredentials, context }) as Parameters<HttpClient['put']>[2]\n\t\t);\n\t}\n\n\t/**\n\t * Constructs a PATCH request to the provided API\n\t *\n\t * @param  url - The url of the API\n\t * @param body - The body we wish to send\n\t * @param params - An optional set of params we wish to send to the API\n\t * @param withCredentials - Whether the call is made by an authenticated user, by default true\n\t * @param context - An optional HTTPContext\n\t */\n\tpublic patch<DataType = void>(\n\t\turl: string,\n\t\tbody: any,\n\t\tparams?: Parameters<HttpClient['patch']>[1]['params'],\n\t\twithCredentials: boolean = true,\n\t\tcontext?: HttpContext\n\t): Observable<DataType> {\n\t\treturn this.httpClient.patch<DataType>(\n\t\t\tthis.handleUrl(url),\n\t\t\tbody,\n\t\t\tclean({ params, withCredentials, context }) as Parameters<HttpClient['patch']>[2]\n\t\t);\n\t}\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["tap","takeUntil"],"mappings":";;;;;;;;;AAeA;;;;;;;AAOG;MACmB,gCAAgC,CAAA;AAAtD,IAAA,WAAA,GAAA;AAOC;;AAEG;AACc,QAAA,IAAA,CAAA,6BAA6B,GAC7C,IAAI,eAAe,CAA6B,SAAS,CAAC;AAE3D;;AAEG;AACc,QAAA,IAAA,CAAA,2BAA2B,GAC3C,IAAI,eAAe,CAA0B,OAAO,CAAC;AAEtD;;AAEG;AACc,QAAA,IAAA,CAAA,qBAAqB,GAElC,IAAI,eAAe,CAAiE,EAAE,CAAC;AAE3F;;AAEG;QACa,IAAiB,CAAA,iBAAA,GAAwB,IAAI,CAAC,2BAA2B,CAAC,IAAI,CAC7F,oBAAoB,EAAE,EACtB,GAAG,CAAC,CAAC,MAAM,KAAK,MAAM,KAAK,OAAO,CAAC,CACnC;AAED;;AAEG;QACa,IAAgB,CAAA,gBAAA,GAAwB,IAAI,CAAC,2BAA2B,CAAC,IAAI,CAC5F,oBAAoB,EAAE,EACtB,GAAG,CAAC,CAAC,MAAM,KAAK,MAAM,KAAK,WAAW,CAAC,CACvC;;AAoBD;;;;AAIG;AACO,IAAA,2BAA2B,CAAC,QAAoC,EAAA;AACzE,QAAA,IAAI,CAAC,6BAA6B,CAAC,IAAI,CAAC,QAAQ,CAAC;;AAGlD;;AAEG;IACO,yBAAyB,GAAA;AAClC,QAAA,OAAO,IAAI,CAAC,6BAA6B,CAAC,YAAY,EAAE;;AAGzD;;AAEG;AACH,IAAA,IAAW,KAAK,GAAA;QACf,OAAO,IAAI,CAAC,yBAAyB,EAAE,C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