/*! * Copyright (c) Microsoft. All rights reserved. */ import { PowerAppsData, PowerAppsSchema } from "../../common/helpers/DataContract"; import { EventHook } from "../../common/helpers/eventhooks/EventHook"; import { TelemetryProperties } from "../../common/telemetryclient"; import { ServerEventReceivedEventArgs } from "../external/universal-remote"; import { MakerSessionAppInfo } from "./AppInfo"; import { CreateAppOptions, CreateAppWithSQLConnectionOptions } from "./CreateAppOptions"; import { EditAppOptions } from "./EditAppOptions"; import { MakerSessionError } from "./Errors"; export declare class MakerSession { static editAppAsync(editAppOptions: EditAppOptions): Promise; static createAppAsync(createOptions: CreateAppOptions): Promise; static createAppWithSQLConnectionAsync(createOptions: CreateAppWithSQLConnectionOptions): Promise; /** * * Starts a new maker session, in a new browser tab (https://create.powerapps.com). * Depending on the options specified, the Maker will be instantiated for a blank new app * or for editing an existing application. * * @returns * A promise which when resolved provides the MakerSession instance. * The user can use this instance to subscribe/unsubscribe to the Maker events */ protected static startAsync(queryParams: string, externalCv: string, telemetryProperties?: TelemetryProperties, endpoint?: string): Promise; protected static _setMakerInstance_TestOnly(instance: MakerSession): void; protected static _getQueryParamsToEditApp(editAppOptions: EditAppOptions): string; protected static _getQueryParamsToCreateApp(createOptions: CreateAppOptions): string; protected static _getQueryParamsToCreateAppWithSQLConnection(createOptions: CreateAppWithSQLConnectionOptions): string; private static _sessionInstance; private static readonly prodEndpoint; private static readonly makerAppIdPrefix; private static _getCreateAppCommonParams; private static _getCommonQueryParams; private static _getTelemetryPropertiesForCommonAppInfo; private static _getTelemetryPropertiesForEditApp; private static _getTelemetryPropertiesForCreateApp; private static _getTelemetryPropertiesForCreateAppWithSQLConnection; private static _validateCommonAppInfo; private static _validateCreateAppOptions; /** * Triggered when the user saves the app */ appSaved: EventHook; /** * Triggered when the user publishes the app */ appPublished: EventHook; protected _launchedStudioResolver: (session: MakerSession) => void; protected _launchedStudioRejector: (reason: MakerSessionError) => void; private _automationClient; private _automationChannel; private _studioWindow; private _currentAppId; private _appCreated; private _checkStudioWindowClosedInterval; private _studioWindowName; private _cv; private _options; protected constructor(); /** * Host application can pass data to the PowerApp being edited. * This method sets the schema for the data (replacing any previous schema). */ setSchemaAsync(schema: PowerAppsSchema): Promise; /** * This method allows the host to set data which can be used by the PowerApp which is being edited. * Caller should set the schema using setSchemaAsync before using this method. * The data which is provided should conform to the schema which was set. * This method will replace any data that was previously provided. * The returned promise is resolved when data is successfully sent to PowerApp, this method will not * check if the data conforms to the set schema. * Accessing data members which do not conform to the schema will show up as error on the PowerApp. * Callers can access this data on the PowerApp as 'hostName.Data', where hostName is from * SdkInitializer interface used in initAsync call. */ setDataAsync(data: PowerAppsData): Promise; /** * Set the schema of a particular message, specified by WADL XML. */ setHostMethodDefinitionAsync(hostMethodDef: string): Promise; /** * Dispose the Maker Session.
* Runs crucial cleaning-up methods, * including disconnecting any open PowerApps Maker Studio Session. */ disposeAsync(): Promise; protected _isSessionActive(): boolean; protected _launchStudioAsync(endpoint: string, queryParams: string): Promise; protected _handleAutomationServerEvent(eventArgs: ServerEventReceivedEventArgs): void; private _removeProviderPrefix; private _init; private _resetAsync; private _getStudioURL; private _checkStudioWindowClosed; private _disposeAutomationClientAsync; private _setupAutomationClientAsync; private _stopCheckingForStudioWindowClosed; private _onAppCreated; private _onAppSaved; private _onAppPublished; private _getAppPropertiesForTelemetry; }