/* Copyright 2023 Mikhail Aheichyk Copyright 2023 Nordeck IT + Consulting GmbH. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ export enum WidgetLifecycle { CapabilitiesRequest = "capabilities_request", PreLoadRequest = "preload_request", IdentityRequest = "identity_request", } export type CapabilitiesOpts = { approvedCapabilities: Set | undefined; }; export type ApprovalOpts = { approved: boolean | undefined; }; export type CapabilitiesListener = ( capabilitiesOpts: CapabilitiesOpts, widgetInfo: WidgetInfo, requestedCapabilities: Set, ) => void; /** * Listener for PreLoad and Identity requests */ export type ApprovalListener = (approvalOpts: ApprovalOpts, widgetInfo: WidgetInfo) => void; /** * Represents the widget */ export interface WidgetInfo { /** * The user ID who created the widget. */ creatorUserId: string; /** * The type of widget. */ type: string; /** * The ID of the widget. */ id: string; /** * The name of the widget, or null if not set. */ name: string | null; /** * The title for the widget, or null if not set. */ title: string | null; /** * The templated URL for the widget. */ templateUrl: string; /** * The origin for this widget. */ origin: string; }