# @equinor/fusion-react-power-bi

> React component for displaying an person information

Latest version **0.3.0-pbi.1** (published 2023-03-28) · ISC license · 0 weekly downloads

## Install

```sh
npm install @equinor/fusion-react-power-bi
pnpm add @equinor/fusion-react-power-bi
yarn add @equinor/fusion-react-power-bi
bun add @equinor/fusion-react-power-bi
```

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high maintenance score.

Warnings: low downloads; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.3.0-pbi.1 |
| Published | 2023-03-28 |
| First published | 2023-03-28 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 7 |
| Unpacked size | 983.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10 |
| Maintainers | gustav-eikaas, eslsa, martinforre, _odin_ |
| Keywords | power-bi, react, fusion, equinor |

## Links

- npm: https://www.npmjs.com/package/@equinor/fusion-react-power-bi
- Repository: https://github.com/equinor/fusion-react-components
- Homepage: https://github.com/equinor/fusion-react-components/edit/feat/person-card/packages/power-bi#readme
- Issues: https://github.com/equinor/fusion-react-components/issues
- npm.io page: https://npm.io/package/@equinor/fusion-react-power-bi

## Dependencies (7)

- [clsx](https://npm.io/package/clsx.md) ^1.2.1
- [typescript](https://npm.io/package/typescript.md) ^5.0.2
- [@equinor/fusion](https://npm.io/package/@equinor/fusion.md) ^3.4.9
- [typesafe-actions](https://npm.io/package/typesafe-actions.md) ^5.1.0
- [powerbi-client-react](https://npm.io/package/powerbi-client-react.md) ^1.3.5
- [@equinor/fusion-react-styles](https://npm.io/package/@equinor/fusion-react-styles.md) ^0.5.5
- [@equinor/fusion-react-progress-indicator](https://npm.io/package/@equinor/fusion-react-progress-indicator.md) ^0.1.6

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.3.0-pbi.1 (latest) — 2023-03-28
- 0.1.0-beta.7 (beta) — 2023-05-24
- 0.3.0-pbi.3 (pbi) — 2023-03-28
- 0.1.0-beta.6 — 2023-05-24
- 0.1.0-beta.4 — 2023-05-08
- 0.1.0-beta.3 — 2023-05-05
- 0.1.0-beta.2 — 2023-04-27
- 0.1.0-beta.1 — 2023-04-27
- 0.1.0-beta.0 — 2023-04-27
- 0.3.0-pbi.2 — 2023-03-28

## README

# Power BI

## Report

Component for displaying an Power BI report.
The context of the provided can be accessed by providing an context ref.

```tsx
const contextRef = React.useRef<PowerBIReportContext>();
return (
    <div style={{ width: '100%', height: '500px' }}>
        <PowerBI reportId={'xxx-xxx-xxxx'} contextRef={contextRef}></PowerBI>
    </div>
);
```

```tsx
// inspect context streams
useEffect(() => {
    if (!context.current) return;
    const { store, metrics, event$ } = context.current;
    const sub = new Subscription();
    metrics && sub.add(metrics.subscribe((a) => console.log('METRIC:', a)));
    sub.add(store.subscribe((a) => console.log('STATE:', a)));
    sub.add(
        store.state$
            .pipe(
                pluck('token'),
                distinctUntilChanged(),
                filter((a) => !!a)
            )
            .subscribe((token) => {
                const expiresIn = Math.floor((token!.expirationUtc.getTime() - Date.now()) / 60000);
                console.log(`TOKEN: expires ${token!.expirationUtc} in ${expiresIn} minutes`);
            })
    );
    sub.add(event$.subscribe((x) => console.log('PBI-EVENT:', x)));
    sub.add(store.action$.subscribe((a) => console.log('ACTION:', a)));
    return () => sub.unsubscribe();
}, [context.current]);
```

```tsx
// access embedded component
const component = context.current?.component?.current;
const reload = () => component && component.reload();
```

### PowerBIReportProvider

Components for containing the context of a report.
This component contains the data store, metrics, embed component and embed event stream.

### PowerBIReportView
Uses the context to create config and displays embedded component

### PowerBIReportErrorBoundry
Wrapper for catching errors from store. on 403 this will display the `PowerBIReportInfo` component

### PowerBIBookmark
Uses context to create and apply bookmark for reports

### PowerBIStatus
displays verbal which phase the store is in
```ts
enum Status {
  LoadingEmbedInfo,
  AcquiringAccessToken,
  AccessCheck,
}
```

## Report Info

displays information about an report, this is usally shown when an user is not authorized to see the report.
```tsx
return (<PowerBIReportInfo id="xxxxx-xxx-xxx" />)
```

---
_Source: https://npm.io/package/@equinor/fusion-react-power-bi · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
