Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions docs/add-functionality/methods-and-properties.md
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,42 @@ No

No visualization needs to be maximized or restored during initial loading.

### `raiseSilentError`

Some errors are ignored by the Library, meaning the error handler registered through the embedding SDK will not catch them. To capture these errors, use the raiseSilentError object to enable them to be raised to the error handler.

Currently, silent errors only include refresh errors that occur during dashboard auto-refresh.

- `enabled` - Whether to raise silent errors.

#### Required?

No

#### Default value

`null`

Silent errors are not raised.

#### Sample

Capture silent errors using a custom error handler. Ensure the error handler is registered with showErrorPopup set to false, as no popup will be displayed for silent errors.

```js
const dossier = await microstrategy.dossier.create({
placeholder: placeholderDiv,
url: "http://{host}:{port}/{Library}/app/{ProjectID}/{DossierID}",
raiseSilentError: {
enabled: true,
},
});
dossier.addCustomErrorHandler((error) => {
console.log(`catch error: ${error.message}`);
// Do something to handle the error
}, false);
```

### `authoring`

The `authoring` object controls the dashboard interface in authoring mode. See [Author an embedded dashboard](./authoring-library.md#api-for-controlling-the-authoring-ui) for details.
Expand Down
23 changes: 23 additions & 0 deletions docs/native-embedding-architecture/dossier-info-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,29 @@ try {

</details>

## Get dashboard instance Id

You can use the `MstrDossier.getDossierInstanceId()` function in the Native Embedding SDK to retrieve the dashboard instance Id.

| `getDossierDefinition()` | |
| ------------------------ | ------------------------------ |
| Class | `MstrDossier` |
| Return Type | `string` |
| Description | Get the dashboard instance Id. |

### `MstrDossier.getDossierInstanceId` examples

```js
try {
const instanceId = mstrDossier.getDossierInstanceId();
// Your own code
} catch (error) {
// Your own error handling code
}
```

The returned `instanceId` is a GUID string.

## Get visualization data

You can use the `MstrDossier.getVisualizationData()` function in the Native Embedding SDK to retrieve the data of a single visualization.
Expand Down
10 changes: 6 additions & 4 deletions docs/native-embedding-architecture/embedding-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ This is the entry point of the Native Embedding SDK.

#### Input Parameters

| Parameter Name | Data Type | Description | Is Required |
| ------------------ | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
| props.serverUrl | String | The base URL of the Library server | true |
| props.getAuthToken | function | The function for getting the login token. <br/>This function is similar to `getAuthToken` in `microstrategy.dossier.create`. <br />In 2021 Update 9, Strategy only supports auth token. You can get the auth token with any auth mode. | true |
| Parameter Name | Data Type | Description | Is Required |
| -------------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
| props.serverUrl | String | The base URL of the Library server | true |
| props.getAuthToken | function | The function for getting the login token. <br/>This function is similar to `getAuthToken` in `microstrategy.dossier.create`. <br />In 2021 Update 9, Strategy only supports auth token. You can get the auth token with any auth mode. | true |
| props.suppressAutoRecovery | String | Whether suppressing the session and instance auto recovery logic before each API call. Setting this flag to `true` can improve the initial loading performance, but the customer need to deal with the session and instance expiration by himself. | false |

#### Response

Expand All @@ -37,6 +38,7 @@ try {
getAuthToken: () => {
// Logic similar to the existing Native Embedding SDK.
},
suppressAutoRecovery: false,
});
// Your own code
} catch (error) {
Expand Down
92 changes: 92 additions & 0 deletions docs/native-embedding-architecture/feature-flags.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
---
title: Native Embedding SDK Feature Flags
description: Native Embedding SDK Feature Flags
---

The Native Embedding SDK has some client-side feature flags, which enables the customer open or close some functionalites flexibly. These feature flags can be set via js global variables.

## Feature Flags

### MULTIPLE_DOSSIERS

When this feature flag is set to `true`, the Native Embedding SDK allows the user to embed the visualizations from different dossiers.

This feature flag can be set by:

```js
window.microstrategy.nativeEmbedding.featureFlags.multipleDossiers = true;
```

A full example can be seen in [Embed multiple dossier visualizations on a page](http://localhost:3000/native-embedding-architecture/embed-multiple-viz#embed-visualizations-from-multiple-dossiers)

### ENABLE_PROFILE

When this feature flag is set to `true`, the Native Embedding SDK will generate a detailed performance profile in the global variable `window.mstrEmbedProfile`.

This feature flag can be set by:

```js
window.microstrategy.nativeEmbedding.featureFlags.enableProfile = true;
```

A full example is as below:

```js
try {
window.microstrategy.nativeEmbedding.featureFlags.enableProfile = true;
// configuration for the target dossier
const configs = {
projectId: "EC70648611E7A2F962E90080EFD58751",
objectId: "27D332AC6D43352E0928B9A1FCAF4AB0",
};
const environment = await microstrategy.embeddingComponent.environments.create({
serverUrl: `https://demo.microstrategy.com/MicroStrategyLibrary`,
getAuthToken() {
return fetch(`https://demo.microstrategy.com/MicroStrategyLibrary/api/auth/login`, {
method: "POST",
credentials: "include", // including cookie
mode: "cors", // setting as CORS mode for cross origin
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
// here we login as guest user, you can log in as normal user with `username` and `password` as well
// username: "input your username",
// password: "input your password",
loginMode: 8, // 8 means guest login, use `1` if you log in as normal user
}),
})
.then((response) => {
if (response && response.ok) {
return response.headers.get("X-MSTR-authToken");
}
throw Error("Failed to fetch auth token.");
})
.catch((error) => {
console.log("Error:", error);
});
},
});
const mstrBot = await environment.loadBot({
projectId: configs.projectId,
objectId: configs.objectId,
});
// the data id can be obtained from the `mstrBot.getQuestions() API`
const dataIdAndContainers = [
{
dataId: "A1F3431F2CA2481BB966EC8F35A9AC3A",
container: document.getElementById("container1"),
},
{
dataId: "B1F3431F2CA2481BB966EC8F35A9AC3A",
container: document.getElementById("container2"),
},
];
const botVizList = await Promise.all(
dataIdAndContainers.map((dataIdAndContainer) => {
const { dataId, container } = dataIdAndContainer;
return mstrBot.renderVisualization(dataId, container);
})
);
} catch (e) {
console.error(e.message);
}
```
9 changes: 9 additions & 0 deletions docs/whats-new-in-the-embedding-sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ description: In each release, changes are made to make the MicroStrategy SDK mor

In each release, changes are made to make the MicroStrategy SDK more powerful and easier to use.

## Strategy ONE July 2025

- [Get the dashboard instance ID](./native-embedding-architecture/dossier-info-api#get-dashboard-instance-id)
- Support to get the dashboard instance id via the new API `MstrDossier.getDossierInstanceId()` in Native Embedding SDK.
- [Add a new parameter to improve performance](./native-embedding-architecture/embedding-components)
- Add `suppressAutoRecovery` parameter in `microstrategy.embeddingComponent.environments.create()` function to improve the initial load performance.
- [Add a new feature flag to get performance profiles](./native-embedding-architecture/feature-flags#enable_profile)
- Add a new feature flag `window.microstrategy.nativeEmbedding.featureFlags.enableProfile` to record the performance profiles in Native Embedding SDK.

## Strategy ONE June 2025

- [Information Window](./native-embedding-architecture/information-window.md)
Expand Down
1 change: 1 addition & 0 deletions sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ const sidebars = {
"native-embedding-architecture/apply-filter",
"native-embedding-architecture/event-handling",
"native-embedding-architecture/information-window",
"native-embedding-architecture/feature-flags",
],
},
"samples",
Expand Down