@hmcts/opal-frontend-common 0.0.6 → 0.0.7

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.
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Adds necessary CSS classes to the document body for GDS (Government Digital Service) support.
3
+ */
4
+ export declare function addGdsBodyClass(): void;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ /// <amd-module name="@hmcts/opal-frontend-common/components/govuk/helpers" />
5
+ export * from './public-api';
@@ -0,0 +1 @@
1
+ export * from './add-gds-body-class';
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Adds necessary CSS classes to the document body for GDS (Government Digital Service) support.
3
+ */
4
+ function addGdsBodyClass() {
5
+ const bodyClassList = document.body.classList;
6
+ if (!bodyClassList.contains('govuk-frontend-supported')) {
7
+ bodyClassList.add('govuk-frontend-supported');
8
+ }
9
+ if (!bodyClassList.contains('js-enabled')) {
10
+ bodyClassList.add('js-enabled');
11
+ }
12
+ }
13
+
14
+ /**
15
+ * Generated bundle index. Do not edit.
16
+ */
17
+
18
+ export { addGdsBodyClass };
19
+ //# sourceMappingURL=hmcts-opal-frontend-common-components-govuk-helpers.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hmcts-opal-frontend-common-components-govuk-helpers.mjs","sources":["../../../projects/opal-frontend-common/components/govuk/helpers/add-gds-body-class.ts","../../../projects/opal-frontend-common/components/govuk/helpers/hmcts-opal-frontend-common-components-govuk-helpers.ts"],"sourcesContent":["/**\n * Adds necessary CSS classes to the document body for GDS (Government Digital Service) support.\n */\nexport function addGdsBodyClass() {\n const bodyClassList = document.body.classList;\n\n if (!bodyClassList.contains('govuk-frontend-supported')) {\n bodyClassList.add('govuk-frontend-supported');\n }\n\n if (!bodyClassList.contains('js-enabled')) {\n bodyClassList.add('js-enabled');\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"AAAA;;AAEG;SACa,eAAe,GAAA;AAC7B,IAAA,MAAM,aAAa,GAAG,QAAQ,CAAC,IAAI,CAAC,SAAS;IAE7C,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,0BAA0B,CAAC,EAAE;AACvD,QAAA,aAAa,CAAC,GAAG,CAAC,0BAA0B,CAAC;;IAG/C,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE;AACzC,QAAA,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC;;AAEnC;;ACbA;;AAEG;;;;"}
@@ -4,6 +4,7 @@ import { inject, EventEmitter, afterNextRender, Input, Output, ChangeDetectionSt
4
4
  import * as i1 from '@angular/forms';
5
5
  import { ReactiveFormsModule } from '@angular/forms';
6
6
  import { DateService } from '@hmcts/opal-frontend-common/services/date-service';
7
+ import { addGdsBodyClass } from '@hmcts/opal-frontend-common/components/govuk/helpers';
7
8
 
8
9
  class MojDatePickerComponent {
9
10
  _control;
@@ -60,6 +61,7 @@ class MojDatePickerComponent {
60
61
  */
61
62
  configureDatePicker() {
62
63
  import('@ministryofjustice/frontend/moj/all').then((datePicker) => {
64
+ addGdsBodyClass();
63
65
  datePicker.initAll();
64
66
  });
65
67
  }
@@ -1 +1 @@
1
- {"version":3,"file":"hmcts-opal-frontend-common-components-moj-moj-date-picker.mjs","sources":["../../../projects/opal-frontend-common/components/moj/moj-date-picker/moj-date-picker.component.ts","../../../projects/opal-frontend-common/components/moj/moj-date-picker/moj-date-picker.component.html","../../../projects/opal-frontend-common/components/moj/moj-date-picker/hmcts-opal-frontend-common-components-moj-moj-date-picker.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n EventEmitter,\n Input,\n OnInit,\n Output,\n afterNextRender,\n inject,\n} from '@angular/core';\nimport { FormControl, AbstractControl, ReactiveFormsModule } from '@angular/forms';\nimport { DateService } from '@hmcts/opal-frontend-common/services/date-service';\n\n@Component({\n selector: 'opal-lib-moj-date-picker',\n imports: [CommonModule, ReactiveFormsModule],\n templateUrl: './moj-date-picker.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MojDatePickerComponent implements OnInit {\n private _control!: FormControl;\n public disabledDatesConcatenated!: string;\n\n private readonly dateService = inject(DateService);\n\n @Input({ required: true }) labelText!: string;\n @Input({ required: false }) labelClasses!: string;\n @Input({ required: false }) hintText!: string;\n @Input({ required: true }) inputId!: string;\n @Input({ required: true }) inputName!: string;\n @Input({ required: false }) inputClasses!: string;\n @Input({ required: false }) minDate!: string;\n @Input({ required: false }) maxDate!: string;\n @Input({ required: false }) disabledDates!: string[];\n @Input({ required: false }) disabledDays!: string;\n @Input({ required: false }) errors: string | null = null;\n @Output() dateChange = new EventEmitter<string>();\n\n @Input({ required: true }) set control(abstractControl: AbstractControl) {\n // Form controls are passed in as abstract controls, we need to re-cast it.\n this._control = abstractControl as FormControl;\n }\n\n get getControl() {\n return this._control;\n }\n\n constructor() {\n afterNextRender(() => {\n // Only trigger the render of the component in the browser\n this.configureDatePicker();\n });\n }\n\n /**\n * Retrieves the disabled dates and concatenates them into a single string.\n */\n private concatenateDisabledDates(): void {\n this.disabledDatesConcatenated = this.disabledDates ? this.disabledDates.join(' ') : '';\n }\n\n /**\n * Sets the date value and emits the updated value through the `dateChange` event.\n *\n * @param value - The new date value to set.\n */\n protected setDateValue(value: string) {\n const parsedDate = this.dateService.getFromFormat(value, 'd/M/yyyy');\n if (parsedDate.isValid) {\n const formattedDate = parsedDate.toFormat('dd/MM/yyyy'); // Formats with leading zeros\n this.dateChange.emit(formattedDate);\n } else {\n this.dateChange.emit(value);\n }\n }\n\n /**\n * Configures the date picker functionality using the moj library.\n */\n public configureDatePicker(): void {\n import('@ministryofjustice/frontend/moj/all').then((datePicker) => {\n datePicker.initAll();\n });\n }\n\n public ngOnInit(): void {\n this.concatenateDisabledDates();\n }\n}\n","<div\n class=\"moj-datepicker\"\n data-module=\"moj-date-picker\"\n [attr.data-min-date]=\"minDate\"\n [attr.data-max-date]=\"maxDate\"\n [attr.data-excluded-dates]=\"disabledDatesConcatenated\"\n [attr.data-excluded-days]=\"disabledDays\"\n>\n <div class=\"govuk-form-group\" [class.govuk-form-group--error]=\"!!errors\">\n <label class=\"govuk-label {{ labelClasses }}\" [for]=\"inputId\"> {{ labelText }} </label>\n\n @if (hintText) {\n <div id=\"date-hint\" class=\"govuk-hint\">{{ hintText }}</div>\n }\n\n @if (errors) {\n <p id=\"{{ inputId }}-date-error\" class=\"govuk-error-message\">\n <span class=\"govuk-visually-hidden\">Error: </span> {{ errors }}\n </p>\n }\n\n <input\n class=\"govuk-input moj-js-datepicker-input {{ inputClasses }}\"\n [id]=\"inputId\"\n [name]=\"inputName\"\n type=\"text\"\n aria-describedby=\"date-hint\"\n autocomplete=\"off\"\n [formControl]=\"getControl\"\n (change)=\"setDateValue($any($event).target.value)\"\n />\n </div>\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;MAoBa,sBAAsB,CAAA;AACzB,IAAA,QAAQ;AACT,IAAA,yBAAyB;AAEf,IAAA,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;AAEvB,IAAA,SAAS;AACR,IAAA,YAAY;AACZ,IAAA,QAAQ;AACT,IAAA,OAAO;AACP,IAAA,SAAS;AACR,IAAA,YAAY;AACZ,IAAA,OAAO;AACP,IAAA,OAAO;AACP,IAAA,aAAa;AACb,IAAA,YAAY;IACZ,MAAM,GAAkB,IAAI;AAC9C,IAAA,UAAU,GAAG,IAAI,YAAY,EAAU;IAEjD,IAA+B,OAAO,CAAC,eAAgC,EAAA;;AAErE,QAAA,IAAI,CAAC,QAAQ,GAAG,eAA8B;;AAGhD,IAAA,IAAI,UAAU,GAAA;QACZ,OAAO,IAAI,CAAC,QAAQ;;AAGtB,IAAA,WAAA,GAAA;QACE,eAAe,CAAC,MAAK;;YAEnB,IAAI,CAAC,mBAAmB,EAAE;AAC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BACC,OAAO,EAAA,CAAA;sBAAjC,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;gBACE,SAAS,EAAA,CAAA;sBAAnC,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;gBACG,YAAY,EAAA,CAAA;sBAAvC,KAAK;uBAAC,EAAE,QAAQ,EAAE,KAAK,EAAE;gBACE,OAAO,EAAA,CAAA;sBAAlC,KAAK;uBAAC,EAAE,QAAQ,EAAE,KAAK,EAAE;gBACE,OAAO,EAAA,CAAA;sBAAlC,KAAK;uBAAC,EAAE,QAAQ,EAAE,KAAK,EAAE;gBACE,aAAa,EAAA,CAAA;sBAAxC,KAAK;uBAAC,EAAE,QAAQ,EAAE,KAAK,EAAE;gBACE,YAAY,EAAA,CAAA;sBAAvC,KAAK;uBAAC,EAAE,QAAQ,EAAE,KAAK,EAAE;gBACE,MAAM,EAAA,CAAA;sBAAjC,KAAK;uBAAC,EAAE,QAAQ,EAAE,KAAK,EAAE;gBAChB,UAAU,EAAA,CAAA;sBAAnB;gBAE8B,OAAO,EAAA,CAAA;sBAArC,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;;AEvC3B;;AAEG;;;;"}
1
+ {"version":3,"file":"hmcts-opal-frontend-common-components-moj-moj-date-picker.mjs","sources":["../../../projects/opal-frontend-common/components/moj/moj-date-picker/moj-date-picker.component.ts","../../../projects/opal-frontend-common/components/moj/moj-date-picker/moj-date-picker.component.html","../../../projects/opal-frontend-common/components/moj/moj-date-picker/hmcts-opal-frontend-common-components-moj-moj-date-picker.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n EventEmitter,\n Input,\n OnInit,\n Output,\n afterNextRender,\n inject,\n} from '@angular/core';\nimport { FormControl, AbstractControl, ReactiveFormsModule } from '@angular/forms';\nimport { DateService } from '@hmcts/opal-frontend-common/services/date-service';\nimport { addGdsBodyClass } from '@hmcts/opal-frontend-common/components/govuk/helpers';\n\n@Component({\n selector: 'opal-lib-moj-date-picker',\n imports: [CommonModule, ReactiveFormsModule],\n templateUrl: './moj-date-picker.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MojDatePickerComponent implements OnInit {\n private _control!: FormControl;\n public disabledDatesConcatenated!: string;\n\n private readonly dateService = inject(DateService);\n\n @Input({ required: true }) labelText!: string;\n @Input({ required: false }) labelClasses!: string;\n @Input({ required: false }) hintText!: string;\n @Input({ required: true }) inputId!: string;\n @Input({ required: true }) inputName!: string;\n @Input({ required: false }) inputClasses!: string;\n @Input({ required: false }) minDate!: string;\n @Input({ required: false }) maxDate!: string;\n @Input({ required: false }) disabledDates!: string[];\n @Input({ required: false }) disabledDays!: string;\n @Input({ required: false }) errors: string | null = null;\n @Output() dateChange = new EventEmitter<string>();\n\n @Input({ required: true }) set control(abstractControl: AbstractControl) {\n // Form controls are passed in as abstract controls, we need to re-cast it.\n this._control = abstractControl as FormControl;\n }\n\n get getControl() {\n return this._control;\n }\n\n constructor() {\n afterNextRender(() => {\n // Only trigger the render of the component in the browser\n this.configureDatePicker();\n });\n }\n\n /**\n * Retrieves the disabled dates and concatenates them into a single string.\n */\n private concatenateDisabledDates(): void {\n this.disabledDatesConcatenated = this.disabledDates ? this.disabledDates.join(' ') : '';\n }\n\n /**\n * Sets the date value and emits the updated value through the `dateChange` event.\n *\n * @param value - The new date value to set.\n */\n protected setDateValue(value: string) {\n const parsedDate = this.dateService.getFromFormat(value, 'd/M/yyyy');\n if (parsedDate.isValid) {\n const formattedDate = parsedDate.toFormat('dd/MM/yyyy'); // Formats with leading zeros\n this.dateChange.emit(formattedDate);\n } else {\n this.dateChange.emit(value);\n }\n }\n\n /**\n * Configures the date picker functionality using the moj library.\n */\n public configureDatePicker(): void {\n import('@ministryofjustice/frontend/moj/all').then((datePicker) => {\n addGdsBodyClass();\n datePicker.initAll();\n });\n }\n\n public ngOnInit(): void {\n this.concatenateDisabledDates();\n }\n}\n","<div\n class=\"moj-datepicker\"\n data-module=\"moj-date-picker\"\n [attr.data-min-date]=\"minDate\"\n [attr.data-max-date]=\"maxDate\"\n [attr.data-excluded-dates]=\"disabledDatesConcatenated\"\n [attr.data-excluded-days]=\"disabledDays\"\n>\n <div class=\"govuk-form-group\" [class.govuk-form-group--error]=\"!!errors\">\n <label class=\"govuk-label {{ labelClasses }}\" [for]=\"inputId\"> {{ labelText }} </label>\n\n @if (hintText) {\n <div id=\"date-hint\" class=\"govuk-hint\">{{ hintText }}</div>\n }\n\n @if (errors) {\n <p id=\"{{ inputId }}-date-error\" class=\"govuk-error-message\">\n <span class=\"govuk-visually-hidden\">Error: </span> {{ errors }}\n </p>\n }\n\n <input\n class=\"govuk-input moj-js-datepicker-input {{ inputClasses }}\"\n [id]=\"inputId\"\n [name]=\"inputName\"\n type=\"text\"\n aria-describedby=\"date-hint\"\n autocomplete=\"off\"\n [formControl]=\"getControl\"\n (change)=\"setDateValue($any($event).target.value)\"\n />\n </div>\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;MAqBa,sBAAsB,CAAA;AACzB,IAAA,QAAQ;AACT,IAAA,yBAAyB;AAEf,IAAA,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;AAEvB,IAAA,SAAS;AACR,IAAA,YAAY;AACZ,IAAA,QAAQ;AACT,IAAA,OAAO;AACP,IAAA,SAAS;AACR,IAAA,YAAY;AACZ,IAAA,OAAO;AACP,IAAA,OAAO;AACP,IAAA,aAAa;AACb,IAAA,YAAY;IACZ,MAAM,GAAkB,IAAI;AAC9C,IAAA,UAAU,GAAG,IAAI,YAAY,EAAU;IAEjD,IAA+B,OAAO,CAAC,eAAgC,EAAA;;AAErE,QAAA,IAAI,CAAC,QAAQ,GAAG,eAA8B;;AAGhD,IAAA,IAAI,UAAU,GAAA;QACZ,OAAO,IAAI,CAAC,QAAQ;;AAGtB,IAAA,WAAA,GAAA;QACE,eAAe,CAAC,MAAK;;YA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AA;sBAAnC,KAAK;uBAAC,EAAE,QAAQ,EAAE,KAAK,EAAE;gBACC,OAAO,EAAA,CAAA;sBAAjC,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;gBACE,SAAS,EAAA,CAAA;sBAAnC,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;gBACG,YAAY,EAAA,CAAA;sBAAvC,KAAK;uBAAC,EAAE,QAAQ,EAAE,KAAK,EAAE;gBACE,OAAO,EAAA,CAAA;sBAAlC,KAAK;uBAAC,EAAE,QAAQ,EAAE,KAAK,EAAE;gBACE,OAAO,EAAA,CAAA;sBAAlC,KAAK;uBAAC,EAAE,QAAQ,EAAE,KAAK,EAAE;gBACE,aAAa,EAAA,CAAA;sBAAxC,KAAK;uBAAC,EAAE,QAAQ,EAAE,KAAK,EAAE;gBACE,YAAY,EAAA,CAAA;sBAAvC,KAAK;uBAAC,EAAE,QAAQ,EAAE,KAAK,EAAE;gBACE,MAAM,EAAA,CAAA;sBAAjC,KAAK;uBAAC,EAAE,QAAQ,EAAE,KAAK,EAAE;gBAChB,UAAU,EAAA,CAAA;sBAAnB;gBAE8B,OAAO,EAAA,CAAA;sBAArC,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;;AExC3B;;AAEG;;;;"}
@@ -1,20 +1,31 @@
1
1
  import { Router } from '@angular/router';
2
- import { inject } from '@angular/core';
2
+ import { InjectionToken, inject } from '@angular/core';
3
3
  import { map, catchError, of } from 'rxjs';
4
4
  import { PAGES_ROUTING_PATHS } from '@hmcts/opal-frontend-common/pages/routing/constants';
5
5
  import { AuthService } from '@hmcts/opal-frontend-common/services/auth-service';
6
+ import { GlobalStore } from '@hmcts/opal-frontend-common/stores/global';
7
+ import { SSO_ENDPOINTS } from '@hmcts/opal-frontend-common/services/auth-service/constants';
6
8
 
7
- /**
8
- * A guard that checks if the user is authenticated before allowing access to a route.
9
- * @returns An Observable that emits a boolean value indicating whether the user is authenticated.
10
- */
9
+ const REDIRECT_TO_SSO = new InjectionToken('redirectToSsoLogin', {
10
+ providedIn: 'root',
11
+ factory: () => () => {
12
+ window.location.href = SSO_ENDPOINTS.login;
13
+ },
14
+ });
11
15
  const authGuard = () => {
12
16
  const authService = inject(AuthService);
17
+ const globalStore = inject(GlobalStore);
13
18
  const router = inject(Router);
19
+ const redirectToSsoLogin = inject(REDIRECT_TO_SSO);
14
20
  return authService.checkAuthenticated().pipe(map((resp) => {
15
21
  return resp;
16
22
  }), catchError(() => {
17
- router.navigate([PAGES_ROUTING_PATHS.children.signIn]);
23
+ if (globalStore.ssoEnabled()) {
24
+ redirectToSsoLogin();
25
+ }
26
+ else {
27
+ router.navigate([PAGES_ROUTING_PATHS.children.signIn]);
28
+ }
18
29
  return of(false);
19
30
  }));
20
31
  };
@@ -23,5 +34,5 @@ const authGuard = () => {
23
34
  * Generated bundle index. Do not edit.
24
35
  */
25
36
 
26
- export { authGuard };
37
+ export { REDIRECT_TO_SSO, authGuard };
27
38
  //# sourceMappingURL=hmcts-opal-frontend-common-guards-auth.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"hmcts-opal-frontend-common-guards-auth.mjs","sources":["../../../projects/opal-frontend-common/guards/auth/auth.guard.ts","../../../projects/opal-frontend-common/guards/auth/hmcts-opal-frontend-common-guards-auth.ts"],"sourcesContent":["import { CanActivateFn, Router } from '@angular/router';\nimport { inject } from '@angular/core';\nimport { map, catchError, of } from 'rxjs';\nimport { PAGES_ROUTING_PATHS } from '@hmcts/opal-frontend-common/pages/routing/constants';\nimport { AuthService } from '@hmcts/opal-frontend-common/services/auth-service';\n\n/**\n * A guard that checks if the user is authenticated before allowing access to a route.\n * @returns An Observable that emits a boolean value indicating whether the user is authenticated.\n */\nexport const authGuard: CanActivateFn = () => {\n const authService: AuthService = inject(AuthService);\n const router = inject(Router);\n\n return authService.checkAuthenticated().pipe(\n map((resp) => {\n return resp;\n }),\n catchError(() => {\n router.navigate([PAGES_ROUTING_PATHS.children.signIn]);\n return of(false);\n }),\n );\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAMA;;;AAGG;AACI,MAAM,SAAS,GAAkB,MAAK;AAC3C,IAAA,MAAM,WAAW,GAAgB,MAAM,CAAC,WAAW,CAAC;AACpD,IAAA,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AAE7B,IAAA,OAAO,WAAW,CAAC,kBAAkB,EAAE,CAAC,IAAI,CAC1C,GAAG,CAAC,CAAC,IAAI,KAAI;AACX,QAAA,OAAO,IAAI;AACb,KAAC,CAAC,EACF,UAAU,CAAC,MAAK;QACd,MAAM,CAAC,QAAQ,CAAC,CAAC,mBAAmB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AACtD,QAAA,OAAO,EAAE,CAAC,KAAK,CAAC;KACjB,CAAC,CACH;AACH;;ACvBA;;AAEG;;;;"}
1
+ {"version":3,"file":"hmcts-opal-frontend-common-guards-auth.mjs","sources":["../../../projects/opal-frontend-common/guards/auth/auth.guard.ts","../../../projects/opal-frontend-common/guards/auth/hmcts-opal-frontend-common-guards-auth.ts"],"sourcesContent":["import { CanActivateFn, Router } from '@angular/router';\nimport { inject, InjectionToken } from '@angular/core';\nimport { map, catchError, of } from 'rxjs';\nimport { PAGES_ROUTING_PATHS } from '@hmcts/opal-frontend-common/pages/routing/constants';\nimport { AuthService } from '@hmcts/opal-frontend-common/services/auth-service';\nimport { GlobalStore } from '@hmcts/opal-frontend-common/stores/global';\nimport { GlobalStoreType } from '@hmcts/opal-frontend-common/stores/global/types';\nimport { SSO_ENDPOINTS } from '@hmcts/opal-frontend-common/services/auth-service/constants';\n\nexport const REDIRECT_TO_SSO = new InjectionToken<() => void>('redirectToSsoLogin', {\n providedIn: 'root',\n factory: () => () => {\n window.location.href = SSO_ENDPOINTS.login;\n },\n});\n\nexport const authGuard: CanActivateFn = () => {\n const authService: AuthService = inject(AuthService);\n const globalStore: GlobalStoreType = inject(GlobalStore);\n const router = inject(Router);\n const redirectToSsoLogin = inject(REDIRECT_TO_SSO);\n\n return authService.checkAuthenticated().pipe(\n map((resp) => {\n return resp;\n }),\n catchError(() => {\n if (globalStore.ssoEnabled()) {\n redirectToSsoLogin();\n } else {\n router.navigate([PAGES_ROUTING_PATHS.children.signIn]);\n }\n return of(false);\n }),\n );\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;MASa,eAAe,GAAG,IAAI,cAAc,CAAa,oBAAoB,EAAE;AAClF,IAAA,UAAU,EAAE,MAAM;AAClB,IAAA,OAAO,EAAE,MAAM,MAAK;QAClB,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,aAAa,CAAC,KAAK;KAC3C;AACF,CAAA;AAEM,MAAM,SAAS,GAAkB,MAAK;AAC3C,IAAA,MAAM,WAAW,GAAgB,MAAM,CAAC,WAAW,CAAC;AACpD,IAAA,MAAM,WAAW,GAAoB,MAAM,CAAC,WAAW,CAAC;AACxD,IAAA,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AAC7B,IAAA,MAAM,kBAAkB,GAAG,MAAM,CAAC,eAAe,CAAC;AAElD,IAAA,OAAO,WAAW,CAAC,kBAAkB,EAAE,CAAC,IAAI,CAC1C,GAAG,CAAC,CAAC,IAAI,KAAI;AACX,QAAA,OAAO,IAAI;AACb,KAAC,CAAC,EACF,UAAU,CAAC,MAAK;AACd,QAAA,IAAI,WAAW,CAAC,UAAU,EAAE,EAAE;AAC5B,YAAA,kBAAkB,EAAE;;aACf;YACL,MAAM,CAAC,QAAQ,CAAC,CAAC,mBAAmB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;;AAExD,QAAA,OAAO,EAAE,CAAC,KAAK,CAAC;KACjB,CAAC,CACH;AACH;;ACnCA;;AAEG;;;;"}
@@ -0,0 +1,28 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import { DOCUMENT, CommonModule } from '@angular/common';
4
+ import { GlobalStore } from '@hmcts/opal-frontend-common/stores/global';
5
+ import { SSO_ENDPOINTS } from '@hmcts/opal-frontend-common/services/auth-service/constants';
6
+
7
+ class SignInComponent {
8
+ globalStore = inject(GlobalStore);
9
+ ssoEnabled = true;
10
+ document = inject(DOCUMENT);
11
+ /**
12
+ * Handles the submission of the stub sign-in form.
13
+ * Redirects the user to the SSO login page with the provided email.
14
+ * @param formData - The form data containing the email.
15
+ */
16
+ handleStubSignInFormSubmit(formData) {
17
+ this.document.location.href = `${SSO_ENDPOINTS.login}?email=${formData.email}`;
18
+ }
19
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: SignInComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
20
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.6", type: SignInComponent, isStandalone: true, selector: "opal-lib-sign-in", ngImport: i0, template: "@defer (when !globalStore.ssoEnabled()) {\n <opal-lib-sign-in-stub (signInFormSubmit)=\"handleStubSignInFormSubmit($event)\"></opal-lib-sign-in-stub>\n}\n", dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush, deferBlockDependencies: [() => [import('./hmcts-opal-frontend-common-pages-sign-in-stub.component-EPZmMG9z.mjs').then(m => m.SignInStubComponent)]] });
21
+ }
22
+ i0.ɵɵngDeclareClassMetadataAsync({ minVersion: "18.0.0", version: "19.2.6", ngImport: i0, type: SignInComponent, resolveDeferredDeps: () => [import('./hmcts-opal-frontend-common-pages-sign-in-stub.component-EPZmMG9z.mjs').then(m => m.SignInStubComponent)], resolveMetadata: SignInStubComponent => ({ decorators: [{
23
+ type: Component,
24
+ args: [{ selector: 'opal-lib-sign-in', imports: [CommonModule, SignInStubComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "@defer (when !globalStore.ssoEnabled()) {\n <opal-lib-sign-in-stub (signInFormSubmit)=\"handleStubSignInFormSubmit($event)\"></opal-lib-sign-in-stub>\n}\n" }]
25
+ }], ctorParameters: null, propDecorators: null }) });
26
+
27
+ export { SignInComponent };
28
+ //# sourceMappingURL=hmcts-opal-frontend-common-pages-sign-in.component-C94FFph9.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hmcts-opal-frontend-common-pages-sign-in.component-C94FFph9.mjs","sources":["../../../projects/opal-frontend-common/pages/sign-in/sign-in.component.ts","../../../projects/opal-frontend-common/pages/sign-in/sign-in.component.html"],"sourcesContent":["import { ChangeDetectionStrategy, Component, inject } from '@angular/core';\nimport { CommonModule, DOCUMENT } from '@angular/common';\nimport { SignInStubComponent } from './sign-in-stub/sign-in-stub.component';\nimport { ISignInStubForm } from './interfaces';\nimport { GlobalStore } from '@hmcts/opal-frontend-common/stores/global';\nimport { SSO_ENDPOINTS } from '@hmcts/opal-frontend-common/services/auth-service/constants';\n\n@Component({\n selector: 'opal-lib-sign-in',\n imports: [CommonModule, SignInStubComponent],\n templateUrl: './sign-in.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SignInComponent {\n public readonly globalStore = inject(GlobalStore);\n public ssoEnabled: boolean | null = true;\n private readonly document = inject(DOCUMENT);\n\n /**\n * Handles the submission of the stub sign-in form.\n * Redirects the user to the SSO login page with the provided email.\n * @param formData - The form data containing the email.\n */\n public handleStubSignInFormSubmit(formData: ISignInStubForm): void {\n this.document.location.href = `${SSO_ENDPOINTS.login}?email=${formData.email}`;\n }\n}\n","@defer (when !globalStore.ssoEnabled()) {\n <opal-lib-sign-in-stub (signInFormSubmit)=\"handleStubSignInFormSubmit($event)\"></opal-lib-sign-in-stub>\n}\n"],"names":[],"mappings":";;;;;;MAaa,eAAe,CAAA;AACV,IAAA,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;IAC1C,UAAU,GAAmB,IAAI;AACvB,IAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;AAE5C;;;;AAIG;AACI,IAAA,0BAA0B,CAAC,QAAyB,EAAA;AACzD,QAAA,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAA,EAAG,aAAa,CAAC,KAAK,CAAU,OAAA,EAAA,QAAQ,CAAC,KAAK,EAAE;;uGAXrE,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAAf,eAAe,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,kBAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,ECb5B,6JAGA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EDMY,YAAY,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,sBAAA,EAAA,CAAA,MAAA,CAAA,OAAA,wEAAA,CAAA,CAAA,IAAA,CAAA,CAAA,IAAA,CAAA,CAAA,mBAAA,CAAA,CAAA,CAAA,EAAA,CAAA;;gGAIX,eAAe,EAAA,mBAAA,EAAA,MAAA,CAAA,OAAA,wEAAA,CAAA,CAAA,IAAA,CAAA,CAAA,IAAA,CAAA,CAAA,mBAAA,CAAA,CAAA,EAAA,eAAA,EAAA,mBAAA,KAAA,EAAA,UAAA,EAAA,CAAA;sBAN3B,SAAS;mCACE,kBAAkB,EAAA,OAAA,EACnB,CAAC,YAAY,EAAE,mBAAmB,CAAC,EAAA,eAAA,EAE3B,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,6JAAA,EAAA;;;;;"}
@@ -15,7 +15,7 @@ const routing = [
15
15
  },
16
16
  {
17
17
  path: PAGES_ROUTING_PATHS.children.signIn,
18
- loadComponent: () => import('./hmcts-opal-frontend-common-pages-sign-in.component-Dp6-CUf9.mjs').then((c) => c.SignInComponent),
18
+ loadComponent: () => import('./hmcts-opal-frontend-common-pages-sign-in.component-C94FFph9.mjs').then((c) => c.SignInComponent),
19
19
  canActivate: [signedInGuard],
20
20
  data: { title: PAGES_ROUTING_TITLES.children.signIn },
21
21
  resolve: { title: TitleResolver },
@@ -1,6 +1,4 @@
1
1
  import { CanActivateFn } from '@angular/router';
2
- /**
3
- * A guard that checks if the user is authenticated before allowing access to a route.
4
- * @returns An Observable that emits a boolean value indicating whether the user is authenticated.
5
- */
2
+ import { InjectionToken } from '@angular/core';
3
+ export declare const REDIRECT_TO_SSO: InjectionToken<() => void>;
6
4
  export declare const authGuard: CanActivateFn;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hmcts/opal-frontend-common",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^18.2.0 || ^19.0.0",
6
6
  "@angular/core": "^18.2.0 || ^19.0.0"
@@ -258,6 +258,11 @@
258
258
  "types": "./components/govuk/govuk-text-input-prefix-suffix/index.d.ts",
259
259
  "default": "./fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-text-input-prefix-suffix.mjs"
260
260
  },
261
+ "./components/govuk/helpers": {
262
+ "import": "./fesm2022/hmcts-opal-frontend-common-components-govuk-helpers.mjs",
263
+ "types": "./components/govuk/helpers/index.d.ts",
264
+ "default": "./fesm2022/hmcts-opal-frontend-common-components-govuk-helpers.mjs"
265
+ },
261
266
  "./components/moj/moj-badge": {
262
267
  "import": "./fesm2022/hmcts-opal-frontend-common-components-moj-moj-badge.mjs",
263
268
  "types": "./components/moj/moj-badge/index.d.ts",
@@ -1,7 +1,6 @@
1
- import { OnInit } from '@angular/core';
2
1
  import { ISignInStubForm } from './interfaces';
3
2
  import * as i0 from "@angular/core";
4
- export declare class SignInComponent implements OnInit {
3
+ export declare class SignInComponent {
5
4
  readonly globalStore: {
6
5
  authenticated: import("@angular/core").Signal<boolean>;
7
6
  error: import("@ngrx/signals").DeepSignal<{
@@ -37,18 +36,12 @@ export declare class SignInComponent implements OnInit {
37
36
  }>;
38
37
  ssoEnabled: boolean | null;
39
38
  private readonly document;
40
- private readonly changeDetectorRef;
41
- /**
42
- * Handles the login button click event.
43
- */
44
- handleSsoSignInButtonClick(): void;
45
39
  /**
46
40
  * Handles the submission of the stub sign-in form.
47
41
  * Redirects the user to the SSO login page with the provided email.
48
42
  * @param formData - The form data containing the email.
49
43
  */
50
44
  handleStubSignInFormSubmit(formData: ISignInStubForm): void;
51
- ngOnInit(): void;
52
45
  static ɵfac: i0.ɵɵFactoryDeclaration<SignInComponent, never>;
53
46
  static ɵcmp: i0.ɵɵComponentDeclaration<SignInComponent, "opal-lib-sign-in", never, {}, {}, never, never, true, never>;
54
47
  }
@@ -1,60 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { EventEmitter, Output, ChangeDetectionStrategy, Component, inject, ChangeDetectorRef } from '@angular/core';
3
- import { CommonModule, DOCUMENT } from '@angular/common';
4
- import { GovukButtonComponent } from '@hmcts/opal-frontend-common/components/govuk/govuk-button';
5
- import { GlobalStore } from '@hmcts/opal-frontend-common/stores/global';
6
- import { SSO_ENDPOINTS } from '@hmcts/opal-frontend-common/services/auth-service/constants';
7
-
8
- class SignInSsoComponent {
9
- signInButtonClick = new EventEmitter();
10
- /**
11
- * Handles the button click event.
12
- * Emits the `signInButtonClick` event.
13
- */
14
- handleButtonClick() {
15
- this.signInButtonClick.emit();
16
- }
17
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: SignInSsoComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
18
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.6", type: SignInSsoComponent, isStandalone: true, selector: "opal-lib-sign-in-sso", outputs: { signInButtonClick: "signInButtonClick" }, ngImport: i0, template: "<div class=\"govuk-grid-column-two-thirds\">\n <h1 class=\"govuk-heading-m\">Sign in</h1>\n <p class=\"govuk-body\">Please sign in to continue using the application</p>\n\n <p class=\"govuk-body\">\n <opal-lib-govuk-button buttonId=\"signInButton\" (buttonClickEvent)=\"handleButtonClick()\">\n Sign in</opal-lib-govuk-button\n >\n </p>\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: GovukButtonComponent, selector: "opal-lib-govuk-button", inputs: ["buttonId", "type", "buttonClasses"], outputs: ["buttonClickEvent"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
19
- }
20
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: SignInSsoComponent, decorators: [{
21
- type: Component,
22
- args: [{ selector: 'opal-lib-sign-in-sso', imports: [CommonModule, GovukButtonComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"govuk-grid-column-two-thirds\">\n <h1 class=\"govuk-heading-m\">Sign in</h1>\n <p class=\"govuk-body\">Please sign in to continue using the application</p>\n\n <p class=\"govuk-body\">\n <opal-lib-govuk-button buttonId=\"signInButton\" (buttonClickEvent)=\"handleButtonClick()\">\n Sign in</opal-lib-govuk-button\n >\n </p>\n</div>\n" }]
23
- }], propDecorators: { signInButtonClick: [{
24
- type: Output
25
- }] } });
26
-
27
- class SignInComponent {
28
- globalStore = inject(GlobalStore);
29
- ssoEnabled = true;
30
- document = inject(DOCUMENT);
31
- changeDetectorRef = inject(ChangeDetectorRef);
32
- /**
33
- * Handles the login button click event.
34
- */
35
- handleSsoSignInButtonClick() {
36
- this.document.location.href = SSO_ENDPOINTS.login;
37
- }
38
- /**
39
- * Handles the submission of the stub sign-in form.
40
- * Redirects the user to the SSO login page with the provided email.
41
- * @param formData - The form data containing the email.
42
- */
43
- handleStubSignInFormSubmit(formData) {
44
- this.document.location.href = `${SSO_ENDPOINTS.login}?email=${formData.email}`;
45
- }
46
- ngOnInit() {
47
- // This is to prevent a load flicker when switching between sso/stub sign in
48
- this.ssoEnabled = this.globalStore.ssoEnabled();
49
- this.changeDetectorRef.detectChanges();
50
- }
51
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: SignInComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
52
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.6", type: SignInComponent, isStandalone: true, selector: "opal-lib-sign-in", ngImport: i0, template: "@defer (when !ssoEnabled) {\n <opal-lib-sign-in-stub (signInFormSubmit)=\"handleStubSignInFormSubmit($event)\"></opal-lib-sign-in-stub>\n} @placeholder {\n <opal-lib-sign-in-sso (signInButtonClick)=\"handleSsoSignInButtonClick()\"></opal-lib-sign-in-sso>\n}\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: SignInSsoComponent, selector: "opal-lib-sign-in-sso", outputs: ["signInButtonClick"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, deferBlockDependencies: [() => [import('./hmcts-opal-frontend-common-pages-sign-in-stub.component-EPZmMG9z.mjs').then(m => m.SignInStubComponent)]] });
53
- }
54
- i0.ɵɵngDeclareClassMetadataAsync({ minVersion: "18.0.0", version: "19.2.6", ngImport: i0, type: SignInComponent, resolveDeferredDeps: () => [import('./hmcts-opal-frontend-common-pages-sign-in-stub.component-EPZmMG9z.mjs').then(m => m.SignInStubComponent)], resolveMetadata: SignInStubComponent => ({ decorators: [{
55
- type: Component,
56
- args: [{ selector: 'opal-lib-sign-in', imports: [CommonModule, SignInSsoComponent, SignInStubComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "@defer (when !ssoEnabled) {\n <opal-lib-sign-in-stub (signInFormSubmit)=\"handleStubSignInFormSubmit($event)\"></opal-lib-sign-in-stub>\n} @placeholder {\n <opal-lib-sign-in-sso (signInButtonClick)=\"handleSsoSignInButtonClick()\"></opal-lib-sign-in-sso>\n}\n" }]
57
- }], ctorParameters: null, propDecorators: null }) });
58
-
59
- export { SignInComponent };
60
- //# sourceMappingURL=hmcts-opal-frontend-common-pages-sign-in.component-Dp6-CUf9.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hmcts-opal-frontend-common-pages-sign-in.component-Dp6-CUf9.mjs","sources":["../../../projects/opal-frontend-common/pages/sign-in/sign-in-sso/sign-in-sso.component.ts","../../../projects/opal-frontend-common/pages/sign-in/sign-in-sso/sign-in-sso.component.html","../../../projects/opal-frontend-common/pages/sign-in/sign-in.component.ts","../../../projects/opal-frontend-common/pages/sign-in/sign-in.component.html"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, EventEmitter, Output } from '@angular/core';\nimport { GovukButtonComponent } from '@hmcts/opal-frontend-common/components/govuk/govuk-button';\n\n@Component({\n selector: 'opal-lib-sign-in-sso',\n imports: [CommonModule, GovukButtonComponent],\n templateUrl: './sign-in-sso.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SignInSsoComponent {\n @Output() private readonly signInButtonClick = new EventEmitter();\n\n /**\n * Handles the button click event.\n * Emits the `signInButtonClick` event.\n */\n public handleButtonClick(): void {\n this.signInButtonClick.emit();\n }\n}\n","<div class=\"govuk-grid-column-two-thirds\">\n <h1 class=\"govuk-heading-m\">Sign in</h1>\n <p class=\"govuk-body\">Please sign in to continue using the application</p>\n\n <p class=\"govuk-body\">\n <opal-lib-govuk-button buttonId=\"signInButton\" (buttonClickEvent)=\"handleButtonClick()\">\n Sign in</opal-lib-govuk-button\n >\n </p>\n</div>\n","import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit, inject } from '@angular/core';\nimport { CommonModule, DOCUMENT } from '@angular/common';\nimport { SignInSsoComponent } from './sign-in-sso/sign-in-sso.component';\nimport { SignInStubComponent } from './sign-in-stub/sign-in-stub.component';\nimport { ISignInStubForm } from './interfaces';\nimport { GlobalStore } from '@hmcts/opal-frontend-common/stores/global';\nimport { SSO_ENDPOINTS } from '@hmcts/opal-frontend-common/services/auth-service/constants';\n\n@Component({\n selector: 'opal-lib-sign-in',\n imports: [CommonModule, SignInSsoComponent, SignInStubComponent],\n templateUrl: './sign-in.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SignInComponent implements OnInit {\n public readonly globalStore = inject(GlobalStore);\n public ssoEnabled: boolean | null = true;\n private readonly document = inject(DOCUMENT);\n private readonly changeDetectorRef = inject(ChangeDetectorRef);\n\n /**\n * Handles the login button click event.\n */\n public handleSsoSignInButtonClick(): void {\n this.document.location.href = SSO_ENDPOINTS.login;\n }\n\n /**\n * Handles the submission of the stub sign-in form.\n * Redirects the user to the SSO login page with the provided email.\n * @param formData - The form data containing the email.\n */\n public handleStubSignInFormSubmit(formData: ISignInStubForm): void {\n this.document.location.href = `${SSO_ENDPOINTS.login}?email=${formData.email}`;\n }\n\n ngOnInit(): void {\n // This is to prevent a load flicker when switching between sso/stub sign in\n this.ssoEnabled = this.globalStore.ssoEnabled();\n this.changeDetectorRef.detectChanges();\n }\n}\n","@defer (when !ssoEnabled) {\n <opal-lib-sign-in-stub (signInFormSubmit)=\"handleStubSignInFormSubmit($event)\"></opal-lib-sign-in-stub>\n} @placeholder {\n <opal-lib-sign-in-sso (signInButtonClick)=\"handleSsoSignInButtonClick()\"></opal-lib-sign-in-sso>\n}\n"],"names":[],"mappings":";;;;;;;MAUa,kBAAkB,CAAA;AACF,IAAA,iBAAiB,GAAG,IAAI,YAAY,EAAE;AAEjE;;;AAGG;IACI,iBAAiB,GAAA;AACtB,QAAA,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE;;uGARpB,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAlB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,kBAAkB,ECV/B,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,sBAAA,EAAA,OAAA,EAAA,EAAA,iBAAA,EAAA,mBAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EA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AAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAf,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,eAAe,ECd5B,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,kBAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAAA,uQAKA,EDKY,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAA,YAAY,+BAAE,kBAAkB,EAAA,QAAA,EAAA,sBAAA,EAAA,OAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,sBAAA,EAAA,CAAA,MAAA,CAAA,OAAA,wEAAA,CAAA,CAAA,IAAA,CAAA,CAAA,IAAA,CAAA,CAAA,mBAAA,CAAA,CAAA,CAAA,EAAA,CAAA;;gGAI/B,eAAe,EAAA,mBAAA,EAAA,MAAA,CAAA,OAAA,wEAAA,CAAA,CAAA,IAAA,CAAA,CAAA,IAAA,CAAA,CAAA,mBAAA,CAAA,CAAA,EAAA,eAAA,EAAA,mBAAA,KAAA,EAAA,UAAA,EAAA,CAAA;sBAN3B,SAAS;mCACE,kBAAkB,EAAA,OAAA,EACnB,CAAC,YAAY,EAAE,kBAAkB,EAAE,mBAAmB,CAAC,EAAA,eAAA,EAE/C,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,uQAAA,EAAA;;;;;"}
@@ -1,11 +0,0 @@
1
- import * as i0 from "@angular/core";
2
- export declare class SignInSsoComponent {
3
- private readonly signInButtonClick;
4
- /**
5
- * Handles the button click event.
6
- * Emits the `signInButtonClick` event.
7
- */
8
- handleButtonClick(): void;
9
- static ɵfac: i0.ɵɵFactoryDeclaration<SignInSsoComponent, never>;
10
- static ɵcmp: i0.ɵɵComponentDeclaration<SignInSsoComponent, "opal-lib-sign-in-sso", never, {}, { "signInButtonClick": "signInButtonClick"; }, never, never, true, never>;
11
- }