/* This file is part of »dali«. Copyright 2025 'kcf' »dali« is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. »dali« is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with »dali«. If not, see . */ namespace _dali.widgets { /** */ export class class_widget_login_oidc implements lib_plankton.zoo_widget.interface_widget { /** */ private preparation_data : any; /** * [hook] */ private action_cancel : (null | (() => void)); /** * [hook] */ private action_success : (null | (() => void)); /** */ public constructor( preparation_data : any, { "action_cancel": action_cancel = null, "action_success": action_success = null, } : { action_cancel ?: (null | (() => void)); action_success ?: (null | (() => void)); } = { } ) { this.preparation_data = preparation_data; this.action_cancel = action_cancel; this.action_success = action_success; } /** * [implementation] */ public async load( target_element : HTMLElement ) : Promise { // structure { target_element.innerHTML = await _dali.helpers.template_coin( "widget-login_oidc", "main", { "label": lib_plankton.string.coin( lib_plankton.translate.get("widget.login.oidc.via"), { "title": this.preparation_data.label, } ), "href": this.preparation_data.url, "cancel": lib_plankton.translate.get("common.cancel"), } ); } // controls { target_element.querySelector(".widget-login_oidc-cancel").addEventListener( "click", () => { this.action_cancel(); } ); } } } }