Skip to content

Commit

Permalink
Merged PR 34725: Prepare iframe for embedding
Browse files Browse the repository at this point in the history
Prepare iframe for embedding
  • Loading branch information
Amit Shuster authored and ali-hamud committed Jul 28, 2019
1 parent 9a4cd71 commit eb3a5c0
Show file tree
Hide file tree
Showing 14 changed files with 768 additions and 348 deletions.
137 changes: 92 additions & 45 deletions dist/powerbi-client.d.ts
@@ -1,4 +1,4 @@
/*! powerbi-client v2.7.5 | (c) 2016 Microsoft Corporation MIT */
/*! powerbi-client v2.9.0 | (c) 2016 Microsoft Corporation MIT */
declare module "util" {
import { HttpPostMessage } from 'http-post-message';
/**
Expand Down Expand Up @@ -82,6 +82,20 @@ declare module "util" {
*/
export function isRDLEmbed(embedUrl: string): boolean;
}
declare module "config" {
const config: {
version: string;
type: string;
};
export default config;
}
declare module "defaults" {
import * as models from 'powerbi-models';
export abstract class Defaults {
static defaultSettings: models.ISettings;
static defaultQnaSettings: models.IQnaSettings;
}
}
declare module "embed" {
import * as service from "service";
import * as models from 'powerbi-models';
Expand All @@ -96,19 +110,30 @@ declare module "embed" {
}
}
/**
* Base Configuration settings for Power BI embed components
* Prepare configuration for Power BI embed components.
*
* @export
* @interface IEmbedConfigurationBase
* @interface IBootstrapEmbedConfiguration
*/
export interface IEmbedConfigurationBase {
settings?: ISettings;
export interface IBootstrapEmbedConfiguration {
hostname?: string;
embedUrl?: string;
settings?: ISettings;
uniqueId?: string;
type?: string;
groupId?: string;
bootstrapped?: boolean;
}
/**
* Base Configuration settings for Power BI embed components
*
* @export
* @interface IEmbedConfigurationBase
* @extends IBootstrapEmbedConfiguration
*/
export interface IEmbedConfigurationBase extends IBootstrapEmbedConfiguration {
accessToken?: string;
tokenType?: models.TokenType;
groupId?: string;
}
/**
* Configuration settings for Power BI embed components
Expand Down Expand Up @@ -173,6 +198,7 @@ declare module "embed" {
static embedUrlAttribute: string;
static nameAttribute: string;
static typeAttribute: string;
static defaultEmbedHostName: string;
static type: string;
static maxFrontLoadTimes: number;
allowedEvents: any[];
Expand Down Expand Up @@ -206,6 +232,12 @@ declare module "embed" {
* @type {IEmbedConfigurationBase}
*/
config: IEmbedConfigurationBase;
/**
* Gets or sets the bootstrap configuration for the Power BI embed component received by powerbi.bootstrap().
*
* @type {IBootstrapEmbedConfiguration}
*/
bootstrapConfig: IBootstrapEmbedConfiguration;
/**
* Gets or sets the configuration settings for creating report.
*
Expand Down Expand Up @@ -238,7 +270,7 @@ declare module "embed" {
* @param {HTMLElement} element
* @param {IEmbedConfigurationBase} config
*/
constructor(service: service.Service, element: HTMLElement, config: IEmbedConfigurationBase, iframe?: HTMLIFrameElement, phasedRender?: boolean);
constructor(service: service.Service, element: HTMLElement, config: IEmbedConfigurationBase, iframe?: HTMLIFrameElement, phasedRender?: boolean, isBootstrap?: boolean);
/**
* Sends createReport configuration data.
*
Expand Down Expand Up @@ -355,7 +387,7 @@ declare module "embed" {
* @param {IEmbedConfiguration}
* @returns {void}
*/
populateConfig(config: IEmbedConfigurationBase): void;
populateConfig(config: IBootstrapEmbedConfiguration, isBootstrap: boolean): void;
/**
* Adds locale parameters to embedUrl
*
Expand All @@ -369,7 +401,8 @@ declare module "embed" {
* @private
* @returns {string}
*/
private getEmbedUrl();
private getEmbedUrl(isBootstrap);
private getDefaultEmbedUrl(hostname);
/**
* Gets a unique ID from the first available location: options, attribute.
* If neither is provided generate a unique string.
Expand All @@ -392,6 +425,20 @@ declare module "embed" {
* @returns {string}
*/
abstract getId(): string;
/**
* Raise a config changed event.
*
* @returns {void}
*/
abstract configChanged(isBootstrap: boolean): void;
/**
* Gets default embed endpoint for each entity.
* For example: report embed endpoint is reportEmbed.
* This will help creating a default embed URL such as: https://app.powerbi.com/reportEmbed
*
* @returns {string} endpoint.
*/
abstract getDefaultEmbedUrlEndpoint(): string;
/**
* Requests the browser to render the component's iframe in fullscreen mode.
*/
Expand All @@ -416,7 +463,7 @@ declare module "embed" {
/**
* Sets Iframe for embed
*/
private setIframe(isLoad, phasedRender?);
private setIframe(isLoad, phasedRender?, isBootstrap?);
/**
* Sets Iframe's title
*/
Expand Down Expand Up @@ -764,13 +811,6 @@ declare module "page" {
hasLayout(layoutType: any): Promise<boolean>;
}
}
declare module "defaults" {
import * as models from 'powerbi-models';
export abstract class Defaults {
static defaultSettings: models.ISettings;
static defaultQnaSettings: models.IQnaSettings;
}
}
declare module "report" {
import * as service from "service";
import * as embed from "embed";
Expand Down Expand Up @@ -814,7 +854,7 @@ declare module "report" {
* @param {HTMLElement} element
* @param {embed.IEmbedConfiguration} config
*/
constructor(service: service.Service, element: HTMLElement, baseConfig: embed.IEmbedConfigurationBase, phasedRender?: boolean, iframe?: HTMLIFrameElement);
constructor(service: service.Service, element: HTMLElement, baseConfig: embed.IEmbedConfigurationBase, phasedRender?: boolean, isBootstrap?: boolean, iframe?: HTMLIFrameElement);
/**
* Adds backwards compatibility for the previous load configuration, which used the reportId query parameter to specify the report ID
* (e.g. http://embedded.powerbi.com/appTokenReportEmbed?reportId=854846ed-2106-4dc2-bc58-eb77533bf2f1).
Expand Down Expand Up @@ -961,12 +1001,12 @@ declare module "report" {
*/
validate(config: embed.IEmbedConfigurationBase): models.IError[];
/**
* Populate config for load config
* Handle config changes.
*
* @param {IEmbedConfigurationBase}
* @returns {void}
*/
populateConfig(baseConfig: embed.IEmbedConfigurationBase): void;
configChanged(isBootstrap: boolean): void;
getDefaultEmbedUrlEndpoint(): string;
/**
* Switch Report view mode.
*
Expand Down Expand Up @@ -1009,14 +1049,15 @@ declare module "report" {
resetTheme(): Promise<void>;
private applyThemeInternal(theme);
private viewModeToString(viewMode);
private isMobileSettings(settings);
}
}
declare module "create" {
import * as service from "service";
import * as models from 'powerbi-models';
import * as embed from "embed";
export class Create extends embed.Embed {
constructor(service: service.Service, element: HTMLElement, config: embed.IEmbedConfiguration, phasedRender?: boolean);
constructor(service: service.Service, element: HTMLElement, config: embed.IEmbedConfiguration, phasedRender?: boolean, isBootstrap?: boolean);
/**
* Gets the dataset ID from the first available location: createConfig or embed url.
*
Expand All @@ -1028,12 +1069,12 @@ declare module "create" {
*/
validate(config: embed.IEmbedConfigurationBase): models.IError[];
/**
* Populate config for create
* Handle config changes.
*
* @param {IEmbedConfigurationBase}
* @returns {void}
*/
populateConfig(baseConfig: embed.IEmbedConfigurationBase): void;
configChanged(isBootstrap: boolean): void;
getDefaultEmbedUrlEndpoint(): string;
/**
* checks if the report is saved.
*
Expand Down Expand Up @@ -1092,7 +1133,7 @@ declare module "dashboard" {
* @param {service.Service} service
* @param {HTMLElement} element
*/
constructor(service: service.Service, element: HTMLElement, config: embed.IEmbedConfigurationBase, phasedRender?: boolean);
constructor(service: service.Service, element: HTMLElement, config: embed.IEmbedConfigurationBase, phasedRender?: boolean, isBootstrap?: boolean);
/**
* This adds backwards compatibility for older config which used the dashboardId query param to specify dashboard id.
* E.g. https://powerbi-df.analysis-df.windows.net/dashboardEmbedHost?dashboardId=e9363c62-edb6-4eac-92d3-2199c5ca2a9e
Expand All @@ -1115,12 +1156,12 @@ declare module "dashboard" {
*/
validate(baseConfig: embed.IEmbedConfigurationBase): models.IError[];
/**
* Populate config for load config
* Handle config changes.
*
* @param {IEmbedConfigurationBase}
* @returns {void}
*/
populateConfig(baseConfig: embed.IEmbedConfigurationBase): void;
configChanged(isBootstrap: boolean): void;
getDefaultEmbedUrlEndpoint(): string;
/**
* Validate that pageView has a legal value: if page view is defined it must have one of the values defined in models.PageView
*/
Expand All @@ -1141,7 +1182,7 @@ declare module "tile" {
export class Tile extends embed.Embed {
static type: string;
static allowedEvents: string[];
constructor(service: service.Service, element: HTMLElement, baseConfig: embed.IEmbedConfigurationBase, phasedRender?: boolean);
constructor(service: service.Service, element: HTMLElement, baseConfig: embed.IEmbedConfigurationBase, phasedRender?: boolean, isBootstrap?: boolean);
/**
* The ID of the tile
*
Expand All @@ -1153,12 +1194,12 @@ declare module "tile" {
*/
validate(config: embed.IEmbedConfigurationBase): models.IError[];
/**
* Populate config for load config
* Handle config changes.
*
* @param {IEmbedConfigurationBase}
* @returns {void}
*/
populateConfig(baseConfig: embed.IEmbedConfigurationBase): void;
configChanged(isBootstrap: boolean): void;
getDefaultEmbedUrlEndpoint(): string;
/**
* Adds the ability to get tileId from url.
* By extracting the ID we can ensure that the ID is always explicitly provided as part of the load configuration.
Expand All @@ -1184,7 +1225,7 @@ declare module "qna" {
export class Qna extends embed.Embed {
static type: string;
static allowedEvents: string[];
constructor(service: service.Service, element: HTMLElement, config: embed.IEmbedConfigurationBase, phasedRender?: boolean);
constructor(service: service.Service, element: HTMLElement, config: embed.IEmbedConfigurationBase, phasedRender?: boolean, isBootstrap?: boolean);
/**
* The ID of the Qna embed component
*
Expand All @@ -1198,6 +1239,13 @@ declare module "qna" {
* @returns {string}
*/
setQuestion(question: string): Promise<void>;
/**
* Handle config changes.
*
* @returns {void}
*/
configChanged(isBootstrap: boolean): void;
getDefaultEmbedUrlEndpoint(): string;
/**
* Validate load configuration.
*/
Expand Down Expand Up @@ -1227,7 +1275,7 @@ declare module "visual" {
* @param {HTMLElement} element
* @param {embed.IEmbedConfiguration} config
*/
constructor(service: service.Service, element: HTMLElement, baseConfig: embed.IEmbedConfigurationBase, phasedRender?: boolean, iframe?: HTMLIFrameElement);
constructor(service: service.Service, element: HTMLElement, baseConfig: embed.IEmbedConfigurationBase, phasedRender?: boolean, isBootstrap?: boolean, iframe?: HTMLIFrameElement);
load(baseConfig: embed.IEmbedConfigurationBase, phasedRender?: boolean): Promise<void>;
/**
* Gets the list of pages within the report - not supported in visual embed.
Expand Down Expand Up @@ -1363,7 +1411,6 @@ declare module "service" {
wpmp: wpmp.WindowPostMessageProxy;
private router;
private uniqueSessionId;
private static DefaultInitEmbedUrl;
/**
* Creates an instance of a Power BI Service.
*
Expand Down Expand Up @@ -1409,7 +1456,14 @@ declare module "service" {
* @returns {embed.Embed}
*/
load(element: HTMLElement, config?: embed.IEmbedConfigurationBase): embed.Embed;
embedInternal(element: HTMLElement, config?: embed.IEmbedConfigurationBase, phasedRender?: boolean): embed.Embed;
/**
* Given an HTML element and entityType, creates a new component instance, and bootstrap the iframe for embedding.
*
* @param {HTMLElement} element
* @param {embed.IBootstrapEmbedConfiguration} config: a bootstrap config which is an embed config without access token.
*/
bootstrap(element: HTMLElement, config: embed.IBootstrapEmbedConfiguration): embed.Embed;
embedInternal(element: HTMLElement, config?: embed.IEmbedConfigurationBase, phasedRender?: boolean, isBootstrap?: boolean): embed.Embed;
getNumberOfComponents(): number;
getSdkSessionId(): string;
/**
Expand All @@ -1420,7 +1474,7 @@ declare module "service" {
* @param {embed.IEmbedConfigurationBase} config
* @returns {embed.Embed}
*/
private embedNew(element, config, phasedRender?);
private embedNew(element, config, phasedRender?, isBootstrap?);
/**
* Given an element that already contains an embed component, load with a new configuration.
*
Expand Down Expand Up @@ -1570,13 +1624,6 @@ declare module "bookmarksManager" {
applyState(state: string): Promise<void>;
}
}
declare module "config" {
const config: {
version: string;
type: string;
};
export default config;
}
declare module "factories" {
/**
* TODO: Need to find better place for these factory functions or refactor how we handle dependency injection
Expand Down

0 comments on commit eb3a5c0

Please sign in to comment.