Skip to content

Commit 75c9532

Browse files
ziyuhehezhe
andauthored
Update (#31)
* Update * update * Update --------- Co-authored-by: zhe <[email protected]>
1 parent 1d54c97 commit 75c9532

File tree

6 files changed

+167
-4
lines changed

6 files changed

+167
-4
lines changed

docs/add-functionality/methods-and-properties.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -943,6 +943,42 @@ No
943943

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

946+
### `raiseSilentError`
947+
948+
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.
949+
950+
Currently, silent errors only include refresh errors that occur during dashboard auto-refresh.
951+
952+
- `enabled` - Whether to raise silent errors.
953+
954+
#### Required?
955+
956+
No
957+
958+
#### Default value
959+
960+
`null`
961+
962+
Silent errors are not raised.
963+
964+
#### Sample
965+
966+
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.
967+
968+
```js
969+
const dossier = await microstrategy.dossier.create({
970+
placeholder: placeholderDiv,
971+
url: "http://{host}:{port}/{Library}/app/{ProjectID}/{DossierID}",
972+
raiseSilentError: {
973+
enabled: true,
974+
},
975+
});
976+
dossier.addCustomErrorHandler((error) => {
977+
console.log(`catch error: ${error.message}`);
978+
// Do something to handle the error
979+
}, false);
980+
```
981+
946982
### `authoring`
947983

948984
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.

docs/native-embedding-architecture/dossier-info-api.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,29 @@ try {
108108

109109
</details>
110110

111+
## Get dashboard instance Id
112+
113+
You can use the `MstrDossier.getDossierInstanceId()` function in the Native Embedding SDK to retrieve the dashboard instance Id.
114+
115+
| `getDossierDefinition()` | |
116+
| ------------------------ | ------------------------------ |
117+
| Class | `MstrDossier` |
118+
| Return Type | `string` |
119+
| Description | Get the dashboard instance Id. |
120+
121+
### `MstrDossier.getDossierInstanceId` examples
122+
123+
```js
124+
try {
125+
const instanceId = mstrDossier.getDossierInstanceId();
126+
// Your own code
127+
} catch (error) {
128+
// Your own error handling code
129+
}
130+
```
131+
132+
The returned `instanceId` is a GUID string.
133+
111134
## Get visualization data
112135

113136
You can use the `MstrDossier.getVisualizationData()` function in the Native Embedding SDK to retrieve the data of a single visualization.

docs/native-embedding-architecture/embedding-components.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@ This is the entry point of the Native Embedding SDK.
1717

1818
#### Input Parameters
1919

20-
| Parameter Name | Data Type | Description | Is Required |
21-
| ------------------ | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
22-
| props.serverUrl | String | The base URL of the Library server | true |
23-
| 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 |
20+
| Parameter Name | Data Type | Description | Is Required |
21+
| -------------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
22+
| props.serverUrl | String | The base URL of the Library server | true |
23+
| 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 |
24+
| 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 |
2425

2526
#### Response
2627

@@ -37,6 +38,7 @@ try {
3738
getAuthToken: () => {
3839
// Logic similar to the existing Native Embedding SDK.
3940
},
41+
suppressAutoRecovery: false,
4042
});
4143
// Your own code
4244
} catch (error) {
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
---
2+
title: Native Embedding SDK Feature Flags
3+
description: Native Embedding SDK Feature Flags
4+
---
5+
6+
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.
7+
8+
## Feature Flags
9+
10+
### MULTIPLE_DOSSIERS
11+
12+
When this feature flag is set to `true`, the Native Embedding SDK allows the user to embed the visualizations from different dossiers.
13+
14+
This feature flag can be set by:
15+
16+
```js
17+
window.microstrategy.nativeEmbedding.featureFlags.multipleDossiers = true;
18+
```
19+
20+
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)
21+
22+
### ENABLE_PROFILE
23+
24+
When this feature flag is set to `true`, the Native Embedding SDK will generate a detailed performance profile in the global variable `window.mstrEmbedProfile`.
25+
26+
This feature flag can be set by:
27+
28+
```js
29+
window.microstrategy.nativeEmbedding.featureFlags.enableProfile = true;
30+
```
31+
32+
A full example is as below:
33+
34+
```js
35+
try {
36+
window.microstrategy.nativeEmbedding.featureFlags.enableProfile = true;
37+
// configuration for the target dossier
38+
const configs = {
39+
projectId: "EC70648611E7A2F962E90080EFD58751",
40+
objectId: "27D332AC6D43352E0928B9A1FCAF4AB0",
41+
};
42+
const environment = await microstrategy.embeddingComponent.environments.create({
43+
serverUrl: `https://demo.microstrategy.com/MicroStrategyLibrary`,
44+
getAuthToken() {
45+
return fetch(`https://demo.microstrategy.com/MicroStrategyLibrary/api/auth/login`, {
46+
method: "POST",
47+
credentials: "include", // including cookie
48+
mode: "cors", // setting as CORS mode for cross origin
49+
headers: { "Content-Type": "application/json" },
50+
body: JSON.stringify({
51+
// here we login as guest user, you can log in as normal user with `username` and `password` as well
52+
// username: "input your username",
53+
// password: "input your password",
54+
loginMode: 8, // 8 means guest login, use `1` if you log in as normal user
55+
}),
56+
})
57+
.then((response) => {
58+
if (response && response.ok) {
59+
return response.headers.get("X-MSTR-authToken");
60+
}
61+
throw Error("Failed to fetch auth token.");
62+
})
63+
.catch((error) => {
64+
console.log("Error:", error);
65+
});
66+
},
67+
});
68+
const mstrBot = await environment.loadBot({
69+
projectId: configs.projectId,
70+
objectId: configs.objectId,
71+
});
72+
// the data id can be obtained from the `mstrBot.getQuestions() API`
73+
const dataIdAndContainers = [
74+
{
75+
dataId: "A1F3431F2CA2481BB966EC8F35A9AC3A",
76+
container: document.getElementById("container1"),
77+
},
78+
{
79+
dataId: "B1F3431F2CA2481BB966EC8F35A9AC3A",
80+
container: document.getElementById("container2"),
81+
},
82+
];
83+
const botVizList = await Promise.all(
84+
dataIdAndContainers.map((dataIdAndContainer) => {
85+
const { dataId, container } = dataIdAndContainer;
86+
return mstrBot.renderVisualization(dataId, container);
87+
})
88+
);
89+
} catch (e) {
90+
console.error(e.message);
91+
}
92+
```

docs/whats-new-in-the-embedding-sdk.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ description: In each release, changes are made to make the MicroStrategy SDK mor
55

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

8+
## Strategy ONE July 2025
9+
10+
- [Get the dashboard instance ID](./native-embedding-architecture/dossier-info-api#get-dashboard-instance-id)
11+
- Support to get the dashboard instance id via the new API `MstrDossier.getDossierInstanceId()` in Native Embedding SDK.
12+
- [Add a new parameter to improve performance](./native-embedding-architecture/embedding-components)
13+
- Add `suppressAutoRecovery` parameter in `microstrategy.embeddingComponent.environments.create()` function to improve the initial load performance.
14+
- [Add a new feature flag to get performance profiles](./native-embedding-architecture/feature-flags#enable_profile)
15+
- Add a new feature flag `window.microstrategy.nativeEmbedding.featureFlags.enableProfile` to record the performance profiles in Native Embedding SDK.
16+
817
## Strategy ONE June 2025
918

1019
- [Information Window](./native-embedding-architecture/information-window.md)

sidebars.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ const sidebars = {
142142
"native-embedding-architecture/apply-filter",
143143
"native-embedding-architecture/event-handling",
144144
"native-embedding-architecture/information-window",
145+
"native-embedding-architecture/feature-flags",
145146
],
146147
},
147148
"samples",

0 commit comments

Comments
 (0)