UNPKG

@equinor/fusion-react-power-bi

Version:
57 lines 1.65 kB
import { TokenType, Permissions } from 'powerbi-models'; import deepmerge from 'deepmerge'; var ConfigType; (function (ConfigType) { ConfigType["Report"] = "Report"; ConfigType["Dashboard"] = "Dashboard"; })(ConfigType || (ConfigType = {})); export const getConfigId = (config) => { switch (config.embedType) { case ConfigType.Report: return config?.reportId || ''; case ConfigType.Dashboard: return config?.dashboardId || ''; default: return config?.reportId || ''; } }; export const getTokenType = (config) => { switch (config.tokenType) { case 'AAD': return TokenType.Aad; case 'Embed': return TokenType.Embed; } }; const createBaseConfig = (config) => { return { type: config.embedType.toLowerCase(), id: getConfigId(config), embedUrl: config.embedUrl, tokenType: getTokenType(config), permissions: Permissions.All, pageView: 'fitToWidth', settings: { localeSettings: { formatLocale: 'en', language: 'en', }, }, }; }; export const createConfig = (config) => { switch (config.embedType) { case ConfigType.Report: return createReportConfig(config); default: return createBaseConfig(config); } }; export const createReportConfig = (config) => { const settings = { filterPaneEnabled: false, navContentPaneEnabled: false, }; return deepmerge(createBaseConfig(config), { settings }); }; //# sourceMappingURL=embed-config.js.map