# @microsoft/immersive-reader-sdk

> The Immersive Reader JavaScript SDK is a JavaScript library that allows you to easily and quickly integrate the [Immersive Reader](https://azure.microsoft.com/services/immersive-reader) into your web application.

Latest version **1.4.0** (published 2023-06-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install @microsoft/immersive-reader-sdk
pnpm add @microsoft/immersive-reader-sdk
yarn add @microsoft/immersive-reader-sdk
bun add @microsoft/immersive-reader-sdk
```

## Health

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

Positive: has types; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.4.0 |
| Published | 2023-06-28 |
| First published | 2019-05-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 41.4 KB |
| Known vulnerabilities | 0 (+5 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 111 |
| Maintainers | microsoft1es, sharmas, ashwanibansal, cristobalb, rwallerms, tycitrin, sahirboghani, dylankil |

## Links

- npm: https://www.npmjs.com/package/@microsoft/immersive-reader-sdk
- Repository: https://github.com/microsoft/immersive-reader-sdk
- Homepage: https://github.com/Microsoft/immersive-reader-sdk
- Issues: https://github.com/microsoft/immersive-reader-sdk/issues
- npm.io page: https://npm.io/package/@microsoft/immersive-reader-sdk

## Dependencies (6)

- [terser](https://npm.io/package/terser.md) ^5.14.2
- [minimatch](https://npm.io/package/minimatch.md) 3.0.5
- [json-schema](https://npm.io/package/json-schema.md) ^0.4.0
- [loader-utils](https://npm.io/package/loader-utils.md) ^3.2.1
- [string_decoder](https://npm.io/package/string_decoder.md) ^1.3.0
- [decode-uri-component](https://npm.io/package/decode-uri-component.md) 0.2.1

## Recent versions

- 1.4.0 (latest) — 2023-06-28
- 1.3.0 — 2023-01-20
- 1.2.0 — 2021-12-17
- 0.6.4 — 2021-09-02
- 0.6.3 — 2021-08-30
- 0.6.2 — 2021-08-27
- 0.6.1 — 2021-07-09
- 0.6.0 — 2021-06-07
- 0.5.9 — 2021-05-25
- 0.5.8 — 2021-05-21
- 0.5.7 — 2021-05-20
- 0.5.6 — 2021-04-27
- 0.5.5 — 2021-04-02
- 0.5.4 — 2021-03-19
- 0.5.3 — 2021-03-18
- … 12 more at https://npm.io/package/@microsoft/immersive-reader-sdk/versions

## README

# Azure Applied AI Immersive Reader - Immersive Reader SDK

The Immersive Reader JavaScript SDK is a JavaScript library that allows you to easily and quickly integrate the [Immersive Reader](https://azure.microsoft.com/services/immersive-reader) into your web application.

## Usage

Usage of this SDK requires an Azure subscription to Immersive Reader. Follow [these instructions](https://docs.microsoft.com/azure/applied-ai-services/immersive-reader/how-to-create-immersive-reader) to create an Immersive Reader resource and configure Azure Active Directory authentication. Save the output of your session into a text file for future reference.

You can find examples of how to acquire an authentication token in the [samples](./samples).

Include the library of the stable build in your web application:

```html
<script type='text/javascript' src='https://ircdname.azureedge.net/immersivereadersdk/immersive-reader-sdk.1.3.0.js'></script>
```

```bash
npm install @microsoft/immersive-reader-sdk
```

```bash
yarn add @microsoft/immersive-reader-sdk
```

Add an HTML element to your webpage with the `immersive-reader-button` class attribute.

```html
<div class='immersive-reader-button' onclick='launchImmersiveReader()'></div>
```

Next, invoke the Immersive Reader when the button is clicked:

```javascript
function launchImmersiveReader() {
    const content = {
        title: 'Immersive Reader',
        chunks: [ {
            content: 'Hello, world!'
        } ]
    };
    ImmersiveReader.launchAsync(YOUR_TOKEN, YOUR_SUBDOMAIN, content);
}
```

Take a look at the [samples](./samples) for examples of a full end-to-end integration.

The Immersive Reader may use persistent cookies to maintain user preferences and track feature usage. When embedding the Immersive Reader into applications, please consider the requirements of EU Cookie Compliance Policy. Setting the [cookiePolicy option](./src/options.ts) to **CookiePolicy.Enable** will enable the Immersive Reader to use cookies. It is the responsibility of the host application to obtain any necessary user consent in accordance with EU Cookie Compliance Policy.

## Building

In order to build the SDK, ensure that you have [Git](https://git-scm.com/downloads), [Node.js](https://nodejs.org/), and [Yarn](https://yarnpkg.com/) installed.

Clone a copy of the repo:

```bash
git clone https://github.com/microsoft/immersive-reader-sdk
```

Change to the immersive-reader-sdk directory:

```bash
cd immersive-reader-sdk
```

Install dependencies:

```bash
yarn
```

Build and test:

```bash
yarn run build
yarn run test
```

---
_Source: https://npm.io/package/@microsoft/immersive-reader-sdk · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
