import { Component, h, Host, Prop } from '@stencil/core';
import appConfigurationService from '../services/app-configuration.service';
import oidcService from '../services/authentication.service';
export class OidcCallbackPage {
  async componentWillLoad() {
    switch (this.callbackMode) {
      case 'sign-in':
        await oidcService.signInRedirectCallbackAsync();
        this.navigateToHomePage();
        break;
      case 'sign-out':
        await oidcService.signOutRedirectCallbackAsync();
        break;
      case 'silent-refresh':
        await oidcService.silentRefreshCallbackAsync();
        break;
    }
  }
  render() {
    return h(Host, null);
  }
  navigateToHomePage() {
    this.history.replace(appConfigurationService.getAppRootUrl());
  }
  static get is() { return "ap-ben-oidc-callback-page"; }
  static get properties() { return {
    "history": {
      "type": "unknown",
      "mutable": false,
      "complexType": {
        "original": "RouterHistory",
        "resolved": "RouterHistory",
        "references": {
          "RouterHistory": {
            "location": "import",
            "path": "@stencil/router"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      }
    },
    "callbackMode": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "'sign-in' | 'sign-out' | 'silent-refresh'",
        "resolved": "\"sign-in\" | \"sign-out\" | \"silent-refresh\"",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "callback-mode",
      "reflect": false
    }
  }; }
}
