@powerportalspro/react-powerbi 0.0.0-stage → 12.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/portal-theme.ts","../src/core/embed-report.ts","../src/power-bi-report.tsx"],"names":["channels","token","makeStyles","tokens","usePowerPortalsPro","useLocale","usePrefixedT","useRef","useState","useEffect","PowerBIConnectionRequiredError","PowerPortalsProError","jsxs","mergeClasses","MessageBar","jsx","MessageBarBody","MessageBarActions","Button","Spinner"],"mappings":";;;;;;;;;;;AAqCO,IAAM,oBAAA,GAA0C;AAAA,EACrD,SAAA;AAAA;AAAA,EACA,SAAA;AAAA;AAAA,EACA,SAAA;AAAA;AAAA,EACA,SAAA;AAAA;AAAA,EACA,SAAA;AAAA;AAAA,EACA,SAAA;AAAA;AAAA,EACA,SAAA;AAAA;AAAA,EACA,SAAA;AAAA;AAAA,EACA,SAAA;AAAA;AAAA,EACA,SAAA;AAAA;AAAA,EACA,SAAA;AAAA;AAAA,EACA,SAAA;AAAA;AAAA,EACA,SAAA;AAAA;AAAA,EACA,SAAA;AAAA;AAAA,EACA;AAAA;AACF,CAAA;AAGA,SAAS,MAAM,KAAA,EAA6C;AAC1D,EAAA,OAAO,EAAE,KAAA,EAAO,EAAE,KAAA,EAAM,EAAE;AAC5B;AAGA,SAAS,SAAS,KAAA,EAAyB;AACzC,EAAA,OAAO,CAAC,CAAA,EAAG,CAAA,EAAG,CAAC,CAAA,CAAE,IAAI,CAAC,KAAA,KAAU,QAAA,CAAS,KAAA,CAAM,MAAM,KAAA,EAAO,KAAA,GAAQ,CAAC,CAAA,EAAG,EAAE,CAAC,CAAA;AAC7E;AAOA,SAAS,cAAc,MAAA,EAA8B;AACnD,EAAA,MAAM,OAAA,GAAU,QAAA,CAAS,MAAA,CAAO,OAAO,CAAA;AACvC,EAAA,MAAM,UAAA,GAAa,QAAA,CAAS,MAAA,CAAO,UAAU,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A;AAAA,QACC,GAAA,EAAK,QAAA;AAAA,QACL,WAAWF,4BAAA,CAAa,MAAA,CAAO,KAAA,EAAO,OAAA,IAAW,OAAO,YAAY,CAAA;AAAA,QACpE,QAAQ,OAAA,KAAY;AAAA;AAAA;AACtB,GAAA,EACF,CAAA;AAEJ","file":"index.cjs","sourcesContent":["/**\n * A Power BI report theme made from the page's Fluent design tokens, so an embedded report takes the\n * portal's colors: light or dark, its accent, and the series palette the portal's own charts use.\n *\n * Power BI draws the report in its own frame, where the page's CSS doesn't reach, and a theme takes\n * color values rather than `var()` references. So the tokens are read where the report sits and\n * written into the theme as hex, and read again when the page's theme changes.\n */\n\n/** A Power BI report theme, as its theme JSON. */\nexport type PowerBIThemeJson = Record<string, unknown>;\n\n/** The portal's colors a report theme is made from, each as `#rrggbb`. */\nexport interface PortalColors {\n /** What the report sits on: the nearest background behind it, or the neutral background. */\n surface: string;\n /** A step off the surface, for cards and selected filters. */\n surfaceSubtle: string;\n foreground: string;\n foregroundSecondary: string;\n foregroundTertiary: string;\n /** Strong enough to outline a control. */\n stroke: string;\n /** Faint enough for gridlines. */\n strokeSubtle: string;\n brand: string;\n link: string;\n good: string;\n neutral: string;\n bad: string;\n}\n\n/**\n * The portal charts' series palette after the accent, which comes first. Kept in step with\n * `react-fluent/src/charts/palette.ts` and Blazor's `FluentUIChart.razor.ts`, so a report's series\n * take the colors a portal chart beside it would.\n */\nexport const PORTAL_SERIES_COLORS: readonly string[] = [\n '#d13438', // red\n '#107c10', // green\n '#ffb900', // yellow\n '#5c2d91', // purple\n '#008272', // teal\n '#d83b01', // orange\n '#e3008c', // pink / magenta\n '#4f6bed', // cornflower\n '#498205', // forest\n '#00cc6a', // seafoam\n '#7160e8', // lavender\n '#8e562e', // brown\n '#a4262c', // burgundy\n '#3a96dd', // lightBlue\n '#0099bc', // cyan\n];\n\n/** A color as Power BI takes it in a theme. */\nfunction solid(color: string): { solid: { color: string } } {\n return { solid: { color } };\n}\n\n/** A `#rrggbb` color's red, green and blue. */\nfunction channels(color: string): number[] {\n return [1, 3, 5].map((start) => parseInt(color.slice(start, start + 2), 16));\n}\n\n/**\n * What a tooltip is drawn on. Power BI sets a tooltip off from the report with a dark shadow and\n * nothing else a theme can change — no border — so on a dark surface, where the shadow doesn't show,\n * the tooltip is a step lighter, as raised surfaces are in dark mode. On a light one it is the surface.\n */\nfunction raisedSurface(colors: PortalColors): string {\n const surface = channels(colors.surface);\n const foreground = channels(colors.foreground);\n const brightness = ([red, green, blue]: number[]) => red! * 0.299 + green! * 0.587 + blue! * 0.114;\n if (brightness(surface) >= brightness(foreground)) return colors.surface;\n\n const raised = surface.map((channel, index) => Math.round(channel + (foreground[index]! - channel) * 0.15));\n return `#${raised.map((channel) => channel.toString(16).padStart(2, '0')).join('')}`;\n}\n\n/**\n * The report theme for these colors. It sets what a report would otherwise draw in its own light\n * colors: the structural colors, the text classes, the page and its wallpaper, the filter pane\n * and cards, and visuals' backgrounds. Fonts and sizes stay the report's base theme's.\n *\n * Axes and card figures are also colored visual by visual: the base theme under every report sets\n * them per visual itself, which outranks a structural color, so in dark mode they would stay dark\n * on dark. Only colors are set that way — a visual style that names a part of a visual, such as its\n * legend, can switch that part on, which is the report's design to decide.\n */\nexport function portalTheme(colors: PortalColors, options: { transparent?: boolean } = {}): PowerBIThemeJson {\n const text = (color: string) => ({ color });\n // With the page meant to show through, the page and its visuals take no background of their own.\n const backdrop = options.transparent ? 100 : 0;\n const tooltip = raisedSurface(colors);\n const axis = {\n labelColor: solid(colors.foregroundSecondary),\n titleColor: solid(colors.foregroundSecondary),\n gridlineColor: solid(colors.strokeSubtle),\n };\n\n return {\n name: 'Portal',\n dataColors: [colors.brand, ...PORTAL_SERIES_COLORS],\n firstLevelElements: colors.foreground,\n secondLevelElements: colors.foregroundSecondary,\n thirdLevelElements: colors.strokeSubtle,\n fourthLevelElements: colors.foregroundTertiary,\n background: colors.surface,\n secondaryBackground: colors.stroke,\n tableAccent: colors.brand,\n hyperlink: colors.link,\n visitedHyperlink: colors.link,\n good: colors.good,\n neutral: colors.neutral,\n bad: colors.bad,\n textClasses: {\n callout: text(colors.foreground),\n title: text(colors.foreground),\n header: text(colors.foreground),\n label: text(colors.foreground),\n // Legends, data labels and category labels, which the base theme draws in a light gray.\n lightLabel: text(colors.foregroundSecondary),\n smallLightLabel: text(colors.foregroundSecondary),\n largeLightLabel: text(colors.foregroundSecondary),\n },\n visualStyles: {\n '*': {\n '*': {\n background: [{ show: true, color: solid(colors.surface), transparency: backdrop }],\n categoryAxis: [axis],\n valueAxis: [axis],\n // Tooltips are on unless the report turned them off, so colors alone switch nothing on.\n // Each color twice: the classic tooltip reads the plain one, the modern one the themed.\n visualTooltip: [\n {\n background: solid(tooltip),\n themedBackground: solid(tooltip),\n titleFontColor: solid(colors.foregroundSecondary),\n themedTitleFontColor: solid(colors.foregroundSecondary),\n valueFontColor: solid(colors.foreground),\n themedValueFontColor: solid(colors.foreground),\n },\n ],\n },\n },\n card: {\n '*': {\n labels: [{ color: solid(colors.foreground) }],\n categoryLabels: [{ color: solid(colors.foregroundSecondary) }],\n },\n },\n // Detail labels sit beside the slices, on the page, rather than on them.\n donutChart: { '*': { labels: [{ color: solid(colors.foregroundSecondary) }] } },\n pieChart: { '*': { labels: [{ color: solid(colors.foregroundSecondary) }] } },\n // A funnel names its stages through its category axis's own color, not an axis label color.\n funnel: {\n '*': {\n categoryAxis: [{ color: solid(colors.foregroundSecondary) }],\n percentBarLabel: [{ color: solid(colors.foregroundSecondary) }],\n },\n },\n // Tables and matrices: their text and gridlines, and nothing behind the cells, which show the\n // visual's own background as they do by default. The lines under the headers and over the\n // total stay the accent, from `tableAccent`.\n tableEx: {\n '*': {\n columnHeaders: [{ fontColor: solid(colors.foreground) }],\n values: [{ fontColorPrimary: solid(colors.foreground), fontColorSecondary: solid(colors.foreground) }],\n total: [{ fontColor: solid(colors.foreground) }],\n grid: [{ gridHorizontalColor: solid(colors.strokeSubtle), gridVerticalColor: solid(colors.strokeSubtle) }],\n },\n },\n pivotTable: {\n '*': {\n columnHeaders: [{ fontColor: solid(colors.foreground) }],\n rowHeaders: [\n { fontColor: solid(colors.foreground), expandCollapseButtonsColor: solid(colors.foregroundSecondary) },\n ],\n values: [{ fontColorPrimary: solid(colors.foreground), fontColorSecondary: solid(colors.foreground) }],\n total: [{ fontColor: solid(colors.foreground) }],\n subTotals: [{ fontColor: solid(colors.foreground) }],\n columnTotal: [{ fontColor: solid(colors.foreground) }],\n rowTotal: [{ fontColor: solid(colors.foreground) }],\n grid: [{ gridHorizontalColor: solid(colors.strokeSubtle), gridVerticalColor: solid(colors.strokeSubtle) }],\n },\n },\n slicer: {\n '*': {\n header: [{ fontColor: solid(colors.foreground) }],\n items: [{ fontColor: solid(colors.foreground) }],\n date: [{ fontColor: solid(colors.foreground) }],\n numericInputStyle: [{ fontColor: solid(colors.foreground) }],\n },\n },\n multiRowCard: {\n '*': {\n cardTitle: [{ color: solid(colors.foreground) }],\n dataLabels: [{ color: solid(colors.foreground) }],\n categoryLabels: [{ color: solid(colors.foregroundSecondary) }],\n },\n },\n page: {\n '*': {\n background: [{ color: solid(colors.surface), transparency: backdrop }],\n outspace: [{ color: solid(colors.surface), transparency: backdrop }],\n outspacePane: [\n {\n backgroundColor: solid(colors.surface),\n foregroundColor: solid(colors.foreground),\n borderColor: solid(colors.stroke),\n },\n ],\n filterCard: [\n {\n $id: 'Applied',\n backgroundColor: solid(colors.surfaceSubtle),\n foregroundColor: solid(colors.foreground),\n },\n {\n $id: 'Available',\n backgroundColor: solid(colors.surface),\n foregroundColor: solid(colors.foreground),\n },\n ],\n },\n },\n },\n };\n}\n\n/**\n * A CSS color as `#rrggbb`, or null when it isn't one this can read: hex in any of its lengths, or\n * `rgb()` / `rgba()` in either syntax. Any alpha is dropped — a theme takes opaque colors.\n */\nexport function toHexColor(value: string): string | null {\n const text = value.trim().toLowerCase();\n\n const hex = /^#([0-9a-f]{3,8})$/.exec(text)?.[1];\n if (hex) {\n if (hex.length === 3 || hex.length === 4) return `#${[...hex.slice(0, 3)].map((digit) => digit + digit).join('')}`;\n if (hex.length === 6 || hex.length === 8) return `#${hex.slice(0, 6)}`;\n return null;\n }\n\n const rgb = /^rgba?\\(\\s*([\\d.]+)[\\s,]+([\\d.]+)[\\s,]+([\\d.]+)/.exec(text);\n if (rgb) {\n const channels = rgb.slice(1, 4).map((channel) => Math.max(0, Math.min(255, Math.round(Number(channel)))));\n return `#${channels.map((channel) => channel.toString(16).padStart(2, '0')).join('')}`;\n }\n\n return null;\n}\n\n/** A color the browser can draw, as hex: written as hex or rgb already, or resolved through a probe. */\nfunction resolveColor(value: string, scope: HTMLElement): string | null {\n const direct = toHexColor(value);\n if (direct || !value.trim()) return direct;\n\n // Any other notation — a named color, hsl(), color-mix() — the browser resolves to rgb() for us.\n const probe = scope.ownerDocument.createElement('span');\n probe.style.color = value;\n probe.style.display = 'none';\n scope.appendChild(probe);\n try {\n return toHexColor(getComputedStyle(probe).color);\n } finally {\n probe.remove();\n }\n}\n\nfunction token(styles: CSSStyleDeclaration, scope: HTMLElement, ...names: string[]): string | null {\n for (const name of names) {\n const color = resolveColor(styles.getPropertyValue(name), scope);\n if (color) return color;\n }\n\n return null;\n}\n\n/** The background the report sits on: the nearest ancestor's that isn't transparent. */\nfunction surfaceBehind(element: HTMLElement): string | null {\n for (let current = element.parentElement; current; current = current.parentElement) {\n const background = getComputedStyle(current).backgroundColor;\n const alpha = /^rgba\\([^)]*,\\s*([\\d.]+)\\s*\\)$/.exec(background)?.[1];\n if (background && background !== 'transparent' && (alpha === undefined || Number(alpha) > 0)) {\n return toHexColor(background);\n }\n }\n\n return null;\n}\n\n/**\n * The portal's colors where `element` is — inside the Fluent provider, which on React scopes its\n * tokens to its own element — or null on a page whose Fluent tokens aren't set.\n */\nexport function readPortalColors(element: HTMLElement): PortalColors | null {\n const styles = getComputedStyle(element);\n const foreground = token(styles, element, '--colorNeutralForeground1');\n const background = token(styles, element, '--colorNeutralBackground1');\n if (!foreground || !background) return null;\n\n const surface = surfaceBehind(element) ?? background;\n const or = (color: string | null, fallback: string) => color ?? fallback;\n\n return {\n surface,\n surfaceSubtle: or(token(styles, element, '--colorNeutralBackground3', '--colorNeutralBackground2'), surface),\n foreground,\n foregroundSecondary: or(token(styles, element, '--colorNeutralForeground2'), foreground),\n foregroundTertiary: or(token(styles, element, '--colorNeutralForeground3'), foreground),\n stroke: or(token(styles, element, '--colorNeutralStroke1'), foreground),\n strokeSubtle: or(token(styles, element, '--colorNeutralStroke3', '--colorNeutralStroke2'), surface),\n brand: or(token(styles, element, '--colorBrandBackground'), foreground),\n link: or(token(styles, element, '--colorBrandForegroundLink', '--colorBrandForeground1'), foreground),\n good: or(token(styles, element, '--colorStatusSuccessForeground1', '--colorPaletteGreenForeground1'), foreground),\n neutral: or(token(styles, element, '--colorStatusWarningForeground1', '--colorPaletteMarigoldForeground1'), foreground),\n bad: or(token(styles, element, '--colorStatusDangerForeground1', '--colorPaletteRedForeground1'), foreground),\n };\n}\n\n/**\n * Calls `onChange`, at most once a frame, whenever the page's theme may have changed for `element`:\n * an attribute changing on one of its ancestors — a theme reaches it through them, as a Fluent\n * provider's class or style or the root's — or the system's light or dark preference. Nothing else\n * on the page is watched, so a grid scrolling or a panel being dragged costs nothing. Says nothing\n * about what changed: the caller reads the colors again and compares. Returns the function that\n * stops watching.\n */\nexport function watchPortalTheme(element: HTMLElement, onChange: () => void): () => void {\n let pending = false;\n const notify = () => {\n if (pending) return;\n pending = true;\n requestAnimationFrame(() => {\n pending = false;\n onChange();\n });\n };\n\n const observer = new MutationObserver(notify);\n for (let ancestor = element.parentElement; ancestor; ancestor = ancestor.parentElement) {\n observer.observe(ancestor, { attributes: true });\n }\n\n const scheme = globalThis.matchMedia?.('(prefers-color-scheme: dark)');\n scheme?.addEventListener('change', notify);\n\n return () => {\n observer.disconnect();\n scheme?.removeEventListener('change', notify);\n };\n}\n","/**\n * Embeds one Power BI report and keeps its token current.\n *\n * Framework-free on purpose: React's `PowerBIReport` drives it, and Blazor's bundles this same\n * source through the `@ppp/powerbi-core` alias, so both stacks configure a report, renew its\n * token and report its events the same way. Keep it free of React, and keep `powerbi-client` at\n * the same version in both package.json files.\n */\n\nimport type { Embed, IEmbedConfiguration, models, Report, service } from 'powerbi-client';\nimport { portalTheme, readPortalColors, watchPortalTheme, type PowerBIThemeJson } from './portal-theme.js';\n\n// powerbi-client reaches for the browser window as soon as it is imported, so it is loaded only\n// when a report is shown — which also keeps it out of pages that show none. The pure parts below\n// use its enum values directly; they are Power BI's wire values and don't change.\nconst TokenTypeAad = 0 as models.TokenType;\nconst TokenTypeEmbed = 1 as models.TokenType;\nconst PermissionsRead = 0 as models.Permissions;\nconst ViewModeView = 0 as models.ViewMode;\nconst FilterTypeBasic = 1 as models.FilterType;\nconst BackgroundDefault = 0 as models.BackgroundType;\nconst BackgroundTransparent = 1 as models.BackgroundType;\nconst FiltersReplaceAll = 1 as models.FiltersOperations;\n\n/**\n * Where Power BI's frame is started before a report's embed URL is known: Power BI's commercial\n * cloud. A report in another — a government cloud, say — gets a fresh frame when it is embedded.\n */\nconst POWER_BI_HOST = 'https://app.powerbi.com';\n\n// The host each prepared element's frame was started on.\nconst preparedHosts = new WeakMap<HTMLElement, string>();\n\nfunction originOf(url: string): string | null {\n try {\n return new URL(url).origin;\n } catch {\n return null;\n }\n}\n\n/** What the portal's embed-token endpoint returns: a token for one report, dashboard or tile. */\nexport interface PowerBIEmbedToken {\n /** `report`, `dashboard` or `tile`: what the key's registration names. */\n itemType: string;\n /** The report's, dashboard's or tile's id. */\n itemId: string;\n /** The dashboard a tile is on; null for a report or a dashboard. */\n dashboardId?: string | null | undefined;\n embedUrl: string;\n embedToken: string;\n /**\n * `embed`, a token the portal issued for this item, or `aad`, the viewer's own access token, for an\n * item shown with their own Power BI access. `embed` when absent.\n */\n tokenType?: string | null | undefined;\n /** ISO 8601. */\n expiresOn: string;\n}\n\n/** A tile the viewer clicked, on a dashboard or on its own. */\nexport interface PowerBITileClick {\n tileId: string;\n /** Where the tile leads — the report it was pinned from, or a link set on it — or null. */\n navigationUrl: string | null;\n}\n\n/**\n * Narrows the report to rows whose column holds one of the values.\n *\n * A convenience, not security: the viewer can remove it in their browser. What a viewer may see is\n * decided by the report's row-level security, from the token.\n */\nexport interface PowerBIFilter {\n table: string;\n column: string;\n values: Array<string | number | boolean>;\n}\n\nexport interface PowerBIReportSettings {\n /** The page to open on, by its name (not its display name). The report's own first page when unset. */\n pageName?: string | null | undefined;\n filters?: readonly PowerBIFilter[] | null | undefined;\n filterPaneVisible?: boolean | undefined;\n pageNavigationVisible?: boolean | undefined;\n /** Let the page behind the report show through, instead of the report's own background. */\n transparentBackground?: boolean | undefined;\n /** The language the report's own text is shown in, such as `fr-FR`. */\n language?: string | null | undefined;\n /** How numbers and dates are written, such as `fr-FR`. */\n formatLocale?: string | null | undefined;\n /**\n * Give the report the portal's colors — its light or dark theme, accent and chart palette — and\n * keep them in step as the theme changes. Default `true`. Ignored when `themeJson` is set; with\n * neither, the report shows the theme it was saved with.\n */\n usePortalTheme?: boolean | undefined;\n /**\n * A report theme of your own, as Power BI's theme JSON or its text. It replaces the report's saved\n * theme, as any theme applied to an embedded report does, rather than adding to it.\n */\n themeJson?: string | PowerBIThemeJson | null | undefined;\n}\n\nexport interface PowerBIPage {\n name: string;\n displayName: string;\n}\n\n/** One value a viewer selected in a visual: a category, not a measure. */\nexport interface PowerBISelectedValue {\n table: string;\n column: string;\n value: string | number | boolean | null;\n}\n\nexport interface PowerBIDataSelection {\n visualTitle: string | null;\n values: PowerBISelectedValue[];\n}\n\nexport interface PowerBIReportEvents {\n loaded?: () => void;\n rendered?: () => void;\n error?: (message: string) => void;\n pageChanged?: (page: PowerBIPage) => void;\n dataSelected?: (selection: PowerBIDataSelection) => void;\n /** A dashboard's or tile's tile was clicked. */\n tileClicked?: (click: PowerBITileClick) => void;\n}\n\nexport interface EmbeddedPowerBIReport {\n /**\n * Applies changed settings to the report already shown, without reloading it. Before the report\n * has loaded, they are kept and applied when it loads.\n */\n update(settings: PowerBIReportSettings): Promise<void>;\n /**\n * Reads the portal's colors again and applies them if they changed. The report watches the page\n * for a theme change itself; this is for a host that knows of one the page doesn't show, such as\n * Blazor's theme provider announcing it.\n */\n refreshTheme(): Promise<void>;\n dispose(): void;\n}\n\n/** How long before a token expires it is renewed. */\nexport const RENEW_BEFORE_MS = 5 * 60 * 1000;\n\n/** How long to wait before trying again after a renewal fails. */\nexport const RENEW_RETRY_MS = 60 * 1000;\n\nlet sharedService: Promise<service.Service> | undefined;\n\nfunction powerBIService(): Promise<service.Service> {\n return (sharedService ??= import('powerbi-client').then(\n ({ factories, service }) =>\n new service.Service(factories.hpmFactory, factories.wpmpFactory, factories.routerFactory),\n ));\n}\n\n/** The filters as Power BI's basic `In` filters. */\nexport function toBasicFilters(filters: readonly PowerBIFilter[] | null | undefined): models.IBasicFilter[] {\n return (filters ?? []).map((filter) => ({\n $schema: 'http://powerbi.com/product/schema#basic',\n target: { table: filter.table, column: filter.column },\n operator: 'In',\n values: [...filter.values],\n filterType: FilterTypeBasic,\n requireSingleSelection: false,\n }));\n}\n\n/** The settings Power BI takes for the panes, background and locale. */\nexport function toSettings(settings: PowerBIReportSettings): models.ISettings {\n return {\n panes: {\n filters: { visible: settings.filterPaneVisible ?? false },\n pageNavigation: { visible: settings.pageNavigationVisible ?? true },\n },\n background: settings.transparentBackground ? BackgroundTransparent : BackgroundDefault,\n ...(settings.language || settings.formatLocale\n ? {\n localeSettings: {\n ...(settings.language ? { language: settings.language } : {}),\n ...(settings.formatLocale ? { formatLocale: settings.formatLocale } : {}),\n },\n }\n : {}),\n };\n}\n\n/**\n * The embed configuration for what the token is for. A dashboard or a tile takes none of a report's\n * settings — it has no pages, filters or panes to set, and Power BI applies themes to reports only.\n */\nexport function buildEmbedConfiguration(\n token: PowerBIEmbedToken,\n settings: PowerBIReportSettings,\n theme?: PowerBIThemeJson | null,\n): IEmbedConfiguration | models.IDashboardEmbedConfiguration | models.ITileEmbedConfiguration {\n const common = {\n id: token.itemId,\n embedUrl: token.embedUrl,\n accessToken: token.embedToken,\n tokenType: token.tokenType === 'aad' ? TokenTypeAad : TokenTypeEmbed,\n };\n\n if (token.itemType === 'dashboard') return { type: 'dashboard', ...common, pageView: 'fitToWidth' };\n if (token.itemType === 'tile') return { type: 'tile', ...common, dashboardId: token.dashboardId ?? '' };\n\n return {\n type: 'report',\n ...common,\n permissions: PermissionsRead,\n viewMode: ViewModeView,\n ...(settings.pageName ? { pageName: settings.pageName } : {}),\n filters: toBasicFilters(settings.filters),\n settings: toSettings(settings),\n ...(theme ? { theme: { themeJson: theme } } : {}),\n };\n}\n\n/**\n * The theme the settings ask for: the host's own, the portal's colors read where the report sits,\n * or null for the report's saved theme — which is also what a page without Fluent's tokens, or a\n * theme that isn't valid JSON, gets. The second is reported, since it is the host's mistake.\n */\nexport function themeFor(\n settings: PowerBIReportSettings,\n element: HTMLElement,\n events: Pick<PowerBIReportEvents, 'error'> = {},\n): PowerBIThemeJson | null {\n if (settings.themeJson) {\n if (typeof settings.themeJson !== 'string') return settings.themeJson;\n try {\n return JSON.parse(settings.themeJson) as PowerBIThemeJson;\n } catch (error) {\n events.error?.(`The report's theme isn't valid JSON: ${messageOf(error)}`);\n return null;\n }\n }\n\n if (!wantsPortalTheme(settings)) return null;\n\n const colors = readPortalColors(element);\n return colors ? portalTheme(colors, { transparent: settings.transparentBackground === true }) : null;\n}\n\n/** Whether the settings ask for the portal's colors: by default, unless the host gave its own theme. */\nfunction wantsPortalTheme(settings: PowerBIReportSettings): boolean {\n return !settings.themeJson && settings.usePortalTheme !== false;\n}\n\n/**\n * Starts Power BI's frame in `element` before the report's token has arrived, so the frame loads\n * while the portal issues the token rather than after; `embedPowerBIReport` then loads the report\n * into it. Only a head start: when it can't be had — the element already holds a report — nothing\n * is lost.\n */\nexport async function preparePowerBIFrame(element: HTMLElement, signal?: AbortSignal): Promise<void> {\n const powerBI = await powerBIService();\n if (signal?.aborted) return;\n\n try {\n powerBI.bootstrap(element, { type: 'report', hostname: POWER_BI_HOST });\n preparedHosts.set(element, POWER_BI_HOST);\n } catch {\n // Already a Power BI element: the embed reuses what is there.\n }\n}\n\n/** Takes Power BI's frame out of `element` again, for a report that was prepared but won't be shown. */\nexport async function clearPowerBIFrame(element: HTMLElement): Promise<void> {\n const powerBI = await powerBIService();\n preparedHosts.delete(element);\n powerBI.reset(element);\n}\n\n/** Milliseconds until a token expiring at `expiresOn` should be renewed; zero when it's due. */\nexport function renewDelay(expiresOn: string, now: number): number {\n return Math.max(0, Date.parse(expiresOn) - now - RENEW_BEFORE_MS);\n}\n\n/** The categories selected in a `dataSelected` event, from each data point's identity. */\nexport function toDataSelection(detail: unknown): PowerBIDataSelection {\n const event = (detail ?? {}) as {\n visual?: { title?: string };\n dataPoints?: Array<{\n identity?: Array<{ target?: { table?: string; column?: string }; equals?: unknown }>;\n }>;\n };\n\n const values: PowerBISelectedValue[] = [];\n for (const point of event.dataPoints ?? []) {\n for (const identity of point.identity ?? []) {\n const table = identity.target?.table;\n const column = identity.target?.column;\n if (!table || !column) continue;\n\n const equals = identity.equals;\n values.push({\n table,\n column,\n value:\n typeof equals === 'string' || typeof equals === 'number' || typeof equals === 'boolean'\n ? equals\n : null,\n });\n }\n }\n\n return { visualTitle: event.visual?.title || null, values };\n}\n\nexport function sameFilters(\n a: readonly PowerBIFilter[] | null | undefined,\n b: readonly PowerBIFilter[] | null | undefined,\n): boolean {\n return JSON.stringify(a ?? []) === JSON.stringify(b ?? []);\n}\n\nfunction sameSettings(a: PowerBIReportSettings, b: PowerBIReportSettings): boolean {\n return JSON.stringify(toSettings(a)) === JSON.stringify(toSettings(b));\n}\n\nfunction messageOf(error: unknown): string {\n if (error instanceof Error) return error.message;\n if (typeof error === 'string') return error;\n const detail = error as { detailedMessage?: string; message?: string } | null | undefined;\n return detail?.detailedMessage || detail?.message || 'The report reported an error.';\n}\n\n/**\n * Shows the report in `element`, and renews its token shortly before each one expires by calling\n * `renewToken`. The report keeps its state across a renewal, so the viewer notices nothing.\n */\nexport async function embedPowerBIReport(\n element: HTMLElement,\n token: PowerBIEmbedToken,\n settings: PowerBIReportSettings,\n events: PowerBIReportEvents,\n renewToken: () => Promise<PowerBIEmbedToken>,\n): Promise<EmbeddedPowerBIReport> {\n const powerBI = await powerBIService();\n\n // What the report shows, and what it was last asked to show. Changing the page or filters before\n // the report has loaded fails, so until it loads an update only records what it wants: the load\n // applies it. A report that never loads — its token refused, say — then never holds one up.\n let shown: PowerBIReportSettings = { ...settings };\n let wanted: PowerBIReportSettings = shown;\n let loaded = false;\n let expiresOn = token.expiresOn;\n let timer: ReturnType<typeof setTimeout> | undefined;\n let renewing: Promise<void> | undefined;\n let disposed = false;\n let stopWatchingTheme: (() => void) | undefined;\n\n // The theme is read again whenever the page's theme may have changed, so a host's invalid one is\n // reported once — and not before the report has loaded, since an error ends a host's spinner and\n // this one doesn't stop the report loading, in the theme it was saved with.\n let reportedThemeError: string | undefined;\n let pendingThemeError: string | undefined;\n const themeEvents = {\n error: (message: string) => {\n if (message === reportedThemeError) return;\n reportedThemeError = message;\n if (loaded) events.error?.(message);\n else pendingThemeError = message;\n },\n };\n\n // Only a report takes settings and a theme; a dashboard or tile shows itself as it is.\n const isReport = token.itemType !== 'dashboard' && token.itemType !== 'tile';\n const isTile = token.itemType === 'tile';\n\n // The frame started early is a report's on the commercial host: anything else gets a fresh one,\n // since Power BI won't load a dashboard into a report's frame, nor a report from another cloud.\n const preparedHost = preparedHosts.get(element);\n preparedHosts.delete(element);\n if (preparedHost && (originOf(token.embedUrl) !== preparedHost || !isReport)) powerBI.reset(element);\n\n const theme = isReport ? themeFor(settings, element, themeEvents) : null;\n const embedded = powerBI.embed(element, buildEmbedConfiguration(token, settings, theme)) as Embed;\n const report = embedded as Report;\n\n // The theme shown, as its JSON: what a change of settings or of the page's theme is compared to.\n let shownTheme = JSON.stringify(theme);\n\n async function apply(): Promise<void> {\n const previous = shown;\n const next = wanted;\n shown = next;\n if (!isReport) return;\n\n if (next.pageName && next.pageName !== previous.pageName) await report.setPage(next.pageName);\n\n if (!sameFilters(previous.filters, next.filters)) {\n await report.updateFilters(FiltersReplaceAll, toBasicFilters(next.filters));\n }\n\n if (!sameSettings(previous, next)) await report.updateSettings(toSettings(next));\n\n const nextTheme = themeFor(next, element, themeEvents);\n // Mid-switch, the page's tokens can be unreadable for a frame: keep what is shown rather than\n // flash the report's saved theme before the new one.\n if (nextTheme === null && wantsPortalTheme(next)) return;\n\n const nextThemeKey = JSON.stringify(nextTheme);\n if (nextThemeKey !== shownTheme) {\n shownTheme = nextThemeKey;\n await (nextTheme ? report.applyTheme({ themeJson: nextTheme }) : report.resetTheme());\n }\n }\n\n function applyNow(): void {\n if (loaded && !disposed) void apply().catch((error: unknown) => events.error?.(messageOf(error)));\n }\n\n // Watched only while the portal's colors are wanted: a host's own theme, or the report's, can't\n // change with the page.\n function watchTheme(next: PowerBIReportSettings): void {\n if (isReport && wantsPortalTheme(next)) {\n stopWatchingTheme ??= watchPortalTheme(element, applyNow);\n } else {\n stopWatchingTheme?.();\n stopWatchingTheme = undefined;\n }\n }\n\n function schedule(delay: number): void {\n clearTimeout(timer);\n timer = setTimeout(() => void renew(), delay);\n }\n\n function renew(): Promise<void> {\n return (renewing ??= (async () => {\n try {\n const next = await renewToken();\n if (disposed) return;\n\n await embedded.setAccessToken(next.embedToken);\n expiresOn = next.expiresOn;\n schedule(renewDelay(expiresOn, Date.now()));\n } catch (error) {\n if (disposed) return;\n\n events.error?.(messageOf(error));\n schedule(RENEW_RETRY_MS);\n } finally {\n renewing = undefined;\n }\n })());\n }\n\n // A background tab's timers are slowed, so a tab coming back to the front checks the clock.\n function onVisibilityChange(): void {\n if (document.visibilityState === 'visible' && renewDelay(expiresOn, Date.now()) === 0) void renew();\n }\n\n document.addEventListener('visibilitychange', onVisibilityChange);\n schedule(renewDelay(expiresOn, Date.now()));\n watchTheme(settings);\n\n // Applies what changed while the report loaded: settings it was sent, or the page's theme.\n function onLoaded(): void {\n if (loaded) return;\n loaded = true;\n events.loaded?.();\n\n if (pendingThemeError) {\n events.error?.(pendingThemeError);\n pendingThemeError = undefined;\n }\n\n applyNow();\n }\n\n // Each kind takes only its own events: powerbi-client throws for one it doesn't raise. A tile\n // says it has loaded with its own event.\n embedded.on('loaded', onLoaded);\n embedded.on('rendered', () => events.rendered?.());\n embedded.on('error', (event) => events.error?.(messageOf(event?.detail)));\n\n if (isReport) {\n report.on('pageChanged', (event) => {\n const page = (event?.detail as { newPage?: PowerBIPage } | undefined)?.newPage;\n if (page) events.pageChanged?.({ name: page.name, displayName: page.displayName });\n });\n report.on('dataSelected', (event) => events.dataSelected?.(toDataSelection(event?.detail)));\n } else {\n if (isTile) embedded.on('tileLoaded', onLoaded);\n embedded.on('tileClicked', (event) => {\n const detail = (event?.detail ?? {}) as { tileId?: string; navigationUrl?: string };\n events.tileClicked?.({ tileId: detail.tileId ?? token.itemId, navigationUrl: detail.navigationUrl || null });\n });\n }\n\n return {\n async update(next) {\n wanted = { ...next };\n if (!disposed) watchTheme(wanted);\n if (loaded && !disposed) await apply();\n },\n\n async refreshTheme() {\n if (loaded && !disposed) await apply();\n },\n\n dispose() {\n disposed = true;\n clearTimeout(timer);\n document.removeEventListener('visibilitychange', onVisibilityChange);\n stopWatchingTheme?.();\n powerBI.reset(element);\n },\n };\n}\n","import { useEffect, useRef, useState, type CSSProperties } from 'react';\nimport {\n Button,\n MessageBar,\n MessageBarActions,\n MessageBarBody,\n Spinner,\n makeStyles,\n mergeClasses,\n tokens,\n} from '@fluentui/react-components';\nimport { PowerBIConnectionRequiredError, PowerPortalsProError } from '@powerportalspro/core';\nimport { useLocale, usePowerPortalsPro, usePrefixedT } from '@powerportalspro/react';\nimport {\n clearPowerBIFrame,\n embedPowerBIReport,\n preparePowerBIFrame,\n type EmbeddedPowerBIReport,\n type PowerBIDataSelection,\n type PowerBIFilter,\n type PowerBIPage,\n type PowerBIReportSettings,\n type PowerBIThemeJson,\n type PowerBITileClick,\n} from './core/index.js';\n\nconst STRINGS_PREFIX = 'app.components.powerbi-report';\n\nexport interface PowerBIReportProps {\n /**\n * The report's key: the Key of its Portal Power BI Report row in Dataverse. Who may see the\n * report, and the row-level security roles they get, come from that row's access rows.\n */\n reportKey: string;\n /** The page to open on, by its name (not its display name). The report's first page when unset. */\n pageName?: string;\n /**\n * Narrows the report to rows whose column holds one of the values — the current record on a\n * detail page, say. A convenience, not security: the viewer can remove it in their browser. What\n * they may see is decided by the report's row-level security.\n */\n filters?: readonly PowerBIFilter[];\n /** Show Power BI's filter pane. Default `false`. */\n filterPaneVisible?: boolean;\n /** Show the report's page tabs. Default `true`. */\n pageNavigationVisible?: boolean;\n /** Let the page behind the report show through its background. Default `false`. */\n transparentBackground?: boolean;\n /**\n * Give the report the portal's colors — its light or dark theme, accent color and chart palette\n * — and follow the theme as it changes. Default `true`. Ignored when `themeJson` is set; with\n * `false` and no `themeJson`, the report shows the theme it was saved with.\n */\n usePortalTheme?: boolean;\n /**\n * A report theme of your own: Power BI's theme JSON, as an object or its text. It replaces the\n * report's saved theme rather than adding to it, and is used in place of the portal's colors.\n */\n themeJson?: string | PowerBIThemeJson;\n /** CSS height of the report. Default `600px`. */\n height?: string | number;\n /** CSS width of the report. Default `100%`. */\n width?: string | number;\n className?: string;\n style?: CSSProperties;\n /** The report has loaded. */\n onLoaded?: () => void;\n /** The report has drawn its visuals — after loading, and again after each change. */\n onRendered?: () => void;\n /** The report, or a renewal of its token, failed. */\n onError?: (message: string) => void;\n onPageChanged?: (page: PowerBIPage) => void;\n /** The viewer selected data points in a visual. */\n onDataSelected?: (selection: PowerBIDataSelection) => void;\n /** The viewer clicked a tile, when the key names a dashboard or a tile. */\n onTileClicked?: (click: PowerBITileClick) => void;\n}\n\nconst useStyles = makeStyles({\n root: {\n position: 'relative',\n minWidth: 0,\n },\n // Power BI sizes its frame to the element it is given, so the element is what takes the size.\n frame: {\n width: '100%',\n height: '100%',\n '& iframe': { border: 'none' },\n },\n // Kept in the layout, so Power BI sizes its frame as it loads, but not shown until the report is.\n frameLoading: {\n visibility: 'hidden',\n },\n // The grid's loading overlay: a spinner over a tinted pane, the tint behind so the spinner stays\n // at full strength.\n overlay: {\n position: 'absolute',\n inset: 0,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n zIndex: 1,\n '::before': {\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n backgroundColor: tokens.colorNeutralBackground2,\n opacity: 0.7,\n zIndex: -1,\n },\n },\n});\n\n// `connect`: shown with the viewer's own Power BI access, which they haven't connected yet.\ntype Failure = 'unavailable' | 'failed' | 'connect';\n\n/**\n * Shows a Power BI report, dashboard or dashboard tile registered in the portal — whichever the\n * key's registration names. The portal issues a token for the signed-in viewer, filtered by the\n * row-level security of the models behind it, and renews it before it expires. Page, filters and\n * the portal's colors apply to a report; a dashboard or tile shows as it is.\n *\n * A registration can instead show the item with each viewer's own Power BI access, as they would see\n * it in Power BI. A viewer who hasn't connected their work account to Power BI yet is offered a\n * button that does, and comes back to the page to see it.\n */\nexport function PowerBIReport(props: PowerBIReportProps) {\n const {\n reportKey,\n pageName,\n filters,\n filterPaneVisible,\n pageNavigationVisible,\n transparentBackground,\n usePortalTheme,\n themeJson,\n height = '600px',\n width = '100%',\n className,\n style,\n } = props;\n\n const { ppp } = usePowerPortalsPro();\n const { locale } = useLocale();\n const t = usePrefixedT(STRINGS_PREFIX);\n const styles = useStyles();\n\n const frameRef = useRef<HTMLDivElement>(null);\n const embeddedRef = useRef<EmbeddedPowerBIReport | null>(null);\n const [failure, setFailure] = useState<Failure | null>(null);\n // From the first render until the report has loaded or failed, so the space it will fill shows a\n // spinner rather than nothing, or Power BI's own logo.\n const [loading, setLoading] = useState(true);\n\n // Handlers change identity on every render; the report keeps the latest without re-embedding.\n const propsRef = useRef(props);\n propsRef.current = props;\n\n const settings: PowerBIReportSettings = {\n pageName: pageName ?? null,\n filters: filters ?? null,\n filterPaneVisible,\n pageNavigationVisible,\n transparentBackground,\n language: locale,\n formatLocale: locale,\n usePortalTheme,\n themeJson,\n };\n const settingsRef = useRef(settings);\n settingsRef.current = settings;\n\n // Embedding is keyed on the report alone: everything else is applied to the report in place.\n useEffect(() => {\n const element = frameRef.current;\n if (!element) return;\n\n const controller = new AbortController();\n let embedded: EmbeddedPowerBIReport | null = null;\n setFailure(null);\n setLoading(true);\n\n const issue = () => ppp.getPowerBIEmbedTokenAsync({ reportKey }, controller.signal);\n\n // Power BI's frame starts loading while the token is issued, rather than after it arrives.\n void preparePowerBIFrame(element, controller.signal).catch(() => undefined);\n\n issue()\n .then(async (token) => {\n if (controller.signal.aborted) return;\n\n const report = await embedPowerBIReport(\n element,\n token,\n settingsRef.current,\n {\n loaded: () => {\n setLoading(false);\n propsRef.current.onLoaded?.();\n },\n rendered: () => propsRef.current.onRendered?.(),\n // One before the report loads is Power BI's to show, in its frame, so the frame comes out.\n error: (message) => {\n setLoading(false);\n propsRef.current.onError?.(message);\n },\n pageChanged: (page) => propsRef.current.onPageChanged?.(page),\n dataSelected: (selection) => propsRef.current.onDataSelected?.(selection),\n tileClicked: (click) => propsRef.current.onTileClicked?.(click),\n },\n issue,\n );\n\n // Unmounted, or the key changed, while powerbi-client was loading.\n if (controller.signal.aborted) {\n report.dispose();\n return;\n }\n\n embedded = report;\n embeddedRef.current = report;\n\n // Settings that changed while the token was on its way.\n await report.update(settingsRef.current);\n })\n .catch((error: unknown) => {\n if (controller.signal.aborted) return;\n\n setFailure(\n error instanceof PowerBIConnectionRequiredError\n ? 'connect'\n : error instanceof PowerPortalsProError && error.status === 403\n ? 'unavailable'\n : 'failed',\n );\n setLoading(false);\n propsRef.current.onError?.(error instanceof Error ? error.message : String(error));\n void clearPowerBIFrame(element).catch(() => undefined);\n });\n\n return () => {\n controller.abort();\n if (embedded) embedded.dispose();\n else void clearPowerBIFrame(element).catch(() => undefined);\n embeddedRef.current = null;\n };\n }, [ppp, reportKey]);\n\n const settingsKey = JSON.stringify(settings);\n useEffect(() => {\n void embeddedRef.current?.update(settingsRef.current).catch((error: unknown) =>\n propsRef.current.onError?.(error instanceof Error ? error.message : String(error)),\n );\n }, [settingsKey]);\n\n return (\n <div className={mergeClasses('ppp-powerbi-report', styles.root, className)} style={{ height, width, ...style }}>\n {failure === 'connect' ? (\n <MessageBar intent=\"info\">\n <MessageBarBody>{t('connect-description')}</MessageBarBody>\n <MessageBarActions>\n {/* A full page load: Microsoft Entra's sign-in page comes in between. */}\n <Button\n size=\"small\"\n appearance=\"primary\"\n onClick={() =>\n window.location.assign(\n ppp.powerBIConnectUrl(window.location.pathname + window.location.search + window.location.hash),\n )\n }\n >\n {t('connect')}\n </Button>\n </MessageBarActions>\n </MessageBar>\n ) : failure ? (\n <MessageBar intent={failure === 'unavailable' ? 'warning' : 'error'}>\n <MessageBarBody>{t(failure)}</MessageBarBody>\n </MessageBar>\n ) : null}\n {loading && failure === null ? (\n <div className={styles.overlay}>\n <Spinner size=\"large\" label={t('loading')} />\n </div>\n ) : null}\n <div\n ref={frameRef}\n className={mergeClasses(styles.frame, loading && styles.frameLoading)}\n hidden={failure !== null}\n />\n </div>\n );\n}\n"]}
@@ -0,0 +1,117 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { CSSProperties } from 'react';
3
+
4
+ /**
5
+ * A Power BI report theme made from the page's Fluent design tokens, so an embedded report takes the
6
+ * portal's colors: light or dark, its accent, and the series palette the portal's own charts use.
7
+ *
8
+ * Power BI draws the report in its own frame, where the page's CSS doesn't reach, and a theme takes
9
+ * color values rather than `var()` references. So the tokens are read where the report sits and
10
+ * written into the theme as hex, and read again when the page's theme changes.
11
+ */
12
+ /** A Power BI report theme, as its theme JSON. */
13
+ type PowerBIThemeJson = Record<string, unknown>;
14
+
15
+ /**
16
+ * Embeds one Power BI report and keeps its token current.
17
+ *
18
+ * Framework-free on purpose: React's `PowerBIReport` drives it, and Blazor's bundles this same
19
+ * source through the `@ppp/powerbi-core` alias, so both stacks configure a report, renew its
20
+ * token and report its events the same way. Keep it free of React, and keep `powerbi-client` at
21
+ * the same version in both package.json files.
22
+ */
23
+
24
+ /** A tile the viewer clicked, on a dashboard or on its own. */
25
+ interface PowerBITileClick {
26
+ tileId: string;
27
+ /** Where the tile leads — the report it was pinned from, or a link set on it — or null. */
28
+ navigationUrl: string | null;
29
+ }
30
+ /**
31
+ * Narrows the report to rows whose column holds one of the values.
32
+ *
33
+ * A convenience, not security: the viewer can remove it in their browser. What a viewer may see is
34
+ * decided by the report's row-level security, from the token.
35
+ */
36
+ interface PowerBIFilter {
37
+ table: string;
38
+ column: string;
39
+ values: Array<string | number | boolean>;
40
+ }
41
+ interface PowerBIPage {
42
+ name: string;
43
+ displayName: string;
44
+ }
45
+ /** One value a viewer selected in a visual: a category, not a measure. */
46
+ interface PowerBISelectedValue {
47
+ table: string;
48
+ column: string;
49
+ value: string | number | boolean | null;
50
+ }
51
+ interface PowerBIDataSelection {
52
+ visualTitle: string | null;
53
+ values: PowerBISelectedValue[];
54
+ }
55
+
56
+ interface PowerBIReportProps {
57
+ /**
58
+ * The report's key: the Key of its Portal Power BI Report row in Dataverse. Who may see the
59
+ * report, and the row-level security roles they get, come from that row's access rows.
60
+ */
61
+ reportKey: string;
62
+ /** The page to open on, by its name (not its display name). The report's first page when unset. */
63
+ pageName?: string;
64
+ /**
65
+ * Narrows the report to rows whose column holds one of the values — the current record on a
66
+ * detail page, say. A convenience, not security: the viewer can remove it in their browser. What
67
+ * they may see is decided by the report's row-level security.
68
+ */
69
+ filters?: readonly PowerBIFilter[];
70
+ /** Show Power BI's filter pane. Default `false`. */
71
+ filterPaneVisible?: boolean;
72
+ /** Show the report's page tabs. Default `true`. */
73
+ pageNavigationVisible?: boolean;
74
+ /** Let the page behind the report show through its background. Default `false`. */
75
+ transparentBackground?: boolean;
76
+ /**
77
+ * Give the report the portal's colors — its light or dark theme, accent color and chart palette
78
+ * — and follow the theme as it changes. Default `true`. Ignored when `themeJson` is set; with
79
+ * `false` and no `themeJson`, the report shows the theme it was saved with.
80
+ */
81
+ usePortalTheme?: boolean;
82
+ /**
83
+ * A report theme of your own: Power BI's theme JSON, as an object or its text. It replaces the
84
+ * report's saved theme rather than adding to it, and is used in place of the portal's colors.
85
+ */
86
+ themeJson?: string | PowerBIThemeJson;
87
+ /** CSS height of the report. Default `600px`. */
88
+ height?: string | number;
89
+ /** CSS width of the report. Default `100%`. */
90
+ width?: string | number;
91
+ className?: string;
92
+ style?: CSSProperties;
93
+ /** The report has loaded. */
94
+ onLoaded?: () => void;
95
+ /** The report has drawn its visuals — after loading, and again after each change. */
96
+ onRendered?: () => void;
97
+ /** The report, or a renewal of its token, failed. */
98
+ onError?: (message: string) => void;
99
+ onPageChanged?: (page: PowerBIPage) => void;
100
+ /** The viewer selected data points in a visual. */
101
+ onDataSelected?: (selection: PowerBIDataSelection) => void;
102
+ /** The viewer clicked a tile, when the key names a dashboard or a tile. */
103
+ onTileClicked?: (click: PowerBITileClick) => void;
104
+ }
105
+ /**
106
+ * Shows a Power BI report, dashboard or dashboard tile registered in the portal — whichever the
107
+ * key's registration names. The portal issues a token for the signed-in viewer, filtered by the
108
+ * row-level security of the models behind it, and renews it before it expires. Page, filters and
109
+ * the portal's colors apply to a report; a dashboard or tile shows as it is.
110
+ *
111
+ * A registration can instead show the item with each viewer's own Power BI access, as they would see
112
+ * it in Power BI. A viewer who hasn't connected their work account to Power BI yet is offered a
113
+ * button that does, and comes back to the page to see it.
114
+ */
115
+ declare function PowerBIReport(props: PowerBIReportProps): react_jsx_runtime.JSX.Element;
116
+
117
+ export { type PowerBIDataSelection, type PowerBIFilter, type PowerBIPage, PowerBIReport, type PowerBIReportProps, type PowerBISelectedValue, type PowerBIThemeJson, type PowerBITileClick };
@@ -0,0 +1,117 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { CSSProperties } from 'react';
3
+
4
+ /**
5
+ * A Power BI report theme made from the page's Fluent design tokens, so an embedded report takes the
6
+ * portal's colors: light or dark, its accent, and the series palette the portal's own charts use.
7
+ *
8
+ * Power BI draws the report in its own frame, where the page's CSS doesn't reach, and a theme takes
9
+ * color values rather than `var()` references. So the tokens are read where the report sits and
10
+ * written into the theme as hex, and read again when the page's theme changes.
11
+ */
12
+ /** A Power BI report theme, as its theme JSON. */
13
+ type PowerBIThemeJson = Record<string, unknown>;
14
+
15
+ /**
16
+ * Embeds one Power BI report and keeps its token current.
17
+ *
18
+ * Framework-free on purpose: React's `PowerBIReport` drives it, and Blazor's bundles this same
19
+ * source through the `@ppp/powerbi-core` alias, so both stacks configure a report, renew its
20
+ * token and report its events the same way. Keep it free of React, and keep `powerbi-client` at
21
+ * the same version in both package.json files.
22
+ */
23
+
24
+ /** A tile the viewer clicked, on a dashboard or on its own. */
25
+ interface PowerBITileClick {
26
+ tileId: string;
27
+ /** Where the tile leads — the report it was pinned from, or a link set on it — or null. */
28
+ navigationUrl: string | null;
29
+ }
30
+ /**
31
+ * Narrows the report to rows whose column holds one of the values.
32
+ *
33
+ * A convenience, not security: the viewer can remove it in their browser. What a viewer may see is
34
+ * decided by the report's row-level security, from the token.
35
+ */
36
+ interface PowerBIFilter {
37
+ table: string;
38
+ column: string;
39
+ values: Array<string | number | boolean>;
40
+ }
41
+ interface PowerBIPage {
42
+ name: string;
43
+ displayName: string;
44
+ }
45
+ /** One value a viewer selected in a visual: a category, not a measure. */
46
+ interface PowerBISelectedValue {
47
+ table: string;
48
+ column: string;
49
+ value: string | number | boolean | null;
50
+ }
51
+ interface PowerBIDataSelection {
52
+ visualTitle: string | null;
53
+ values: PowerBISelectedValue[];
54
+ }
55
+
56
+ interface PowerBIReportProps {
57
+ /**
58
+ * The report's key: the Key of its Portal Power BI Report row in Dataverse. Who may see the
59
+ * report, and the row-level security roles they get, come from that row's access rows.
60
+ */
61
+ reportKey: string;
62
+ /** The page to open on, by its name (not its display name). The report's first page when unset. */
63
+ pageName?: string;
64
+ /**
65
+ * Narrows the report to rows whose column holds one of the values — the current record on a
66
+ * detail page, say. A convenience, not security: the viewer can remove it in their browser. What
67
+ * they may see is decided by the report's row-level security.
68
+ */
69
+ filters?: readonly PowerBIFilter[];
70
+ /** Show Power BI's filter pane. Default `false`. */
71
+ filterPaneVisible?: boolean;
72
+ /** Show the report's page tabs. Default `true`. */
73
+ pageNavigationVisible?: boolean;
74
+ /** Let the page behind the report show through its background. Default `false`. */
75
+ transparentBackground?: boolean;
76
+ /**
77
+ * Give the report the portal's colors — its light or dark theme, accent color and chart palette
78
+ * — and follow the theme as it changes. Default `true`. Ignored when `themeJson` is set; with
79
+ * `false` and no `themeJson`, the report shows the theme it was saved with.
80
+ */
81
+ usePortalTheme?: boolean;
82
+ /**
83
+ * A report theme of your own: Power BI's theme JSON, as an object or its text. It replaces the
84
+ * report's saved theme rather than adding to it, and is used in place of the portal's colors.
85
+ */
86
+ themeJson?: string | PowerBIThemeJson;
87
+ /** CSS height of the report. Default `600px`. */
88
+ height?: string | number;
89
+ /** CSS width of the report. Default `100%`. */
90
+ width?: string | number;
91
+ className?: string;
92
+ style?: CSSProperties;
93
+ /** The report has loaded. */
94
+ onLoaded?: () => void;
95
+ /** The report has drawn its visuals — after loading, and again after each change. */
96
+ onRendered?: () => void;
97
+ /** The report, or a renewal of its token, failed. */
98
+ onError?: (message: string) => void;
99
+ onPageChanged?: (page: PowerBIPage) => void;
100
+ /** The viewer selected data points in a visual. */
101
+ onDataSelected?: (selection: PowerBIDataSelection) => void;
102
+ /** The viewer clicked a tile, when the key names a dashboard or a tile. */
103
+ onTileClicked?: (click: PowerBITileClick) => void;
104
+ }
105
+ /**
106
+ * Shows a Power BI report, dashboard or dashboard tile registered in the portal — whichever the
107
+ * key's registration names. The portal issues a token for the signed-in viewer, filtered by the
108
+ * row-level security of the models behind it, and renews it before it expires. Page, filters and
109
+ * the portal's colors apply to a report; a dashboard or tile shows as it is.
110
+ *
111
+ * A registration can instead show the item with each viewer's own Power BI access, as they would see
112
+ * it in Power BI. A viewer who hasn't connected their work account to Power BI yet is offered a
113
+ * button that does, and comes back to the page to see it.
114
+ */
115
+ declare function PowerBIReport(props: PowerBIReportProps): react_jsx_runtime.JSX.Element;
116
+
117
+ export { type PowerBIDataSelection, type PowerBIFilter, type PowerBIPage, PowerBIReport, type PowerBIReportProps, type PowerBISelectedValue, type PowerBIThemeJson, type PowerBITileClick };