All files / landing-page/login-single-sign-on si-login-single-sign-on.component.ts

100% Statements 6/6
100% Branches 0/0
100% Functions 2/2
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56                                                        1x                 3x 3x             3x       3x     1x      
/**
 * Copyright (c) Siemens 2016 - 2025
 * SPDX-License-Identifier: MIT
 */
import { ChangeDetectionStrategy, Component, input, output } from '@angular/core';
import { SiTranslatePipe, t } from '@siemens/element-translate-ng/translate';
 
/**
 * A single sign-on (SSO) login component that provides a button for SSO authentication.
 *
 * This component renders a simple button that users can click to initiate
 * single sign-on authentication flow.
 *
 * @example
 * ```html
 * <si-login-single-sign-on
 *   [ssoButtonLabel]="customLabel"
 *   [disableSso]="isLoading"
 *   (ssoEvent)="handleSsoLogin()">
 * </si-login-single-sign-on>
 * ```
 */
@Component({
  selector: 'si-login-single-sign-on',
  imports: [SiTranslatePipe],
  templateUrl: './si-login-single-sign-on.component.html',
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class SiLoginSingleSignOnComponent {
  /**
   * Label for login button.
   *
   * @defaultValue
   * ```
   * t(() => $localize`:@@SI_LOGIN_SINGLE-SIGN-ON.LOGIN_SIGN_UP:Login / Sign un`)
   * ```
   */
  readonly ssoButtonLabel = input(
    t(() => $localize`:@@SI_LOGIN_SINGLE-SIGN-ON.LOGIN_SIGN_UP:Login / Sign un`)
  );
  /**
   * Disables the sso button.
   *
   * @defaultValue false
   */
  readonly disableSso = input(false);
  /**
   * Emits username and password on login event.
   */
  readonly ssoEvent = output<void>();
 
  protected ssoClick(): void {
    this.ssoEvent.emit();
  }
}