Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ziyuhehe committed Sep 13, 2024
1 parent 8b5f4f6 commit fed6c52
Show file tree
Hide file tree
Showing 9 changed files with 172 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -484,3 +484,38 @@ microstrategy.embeddingContexts.embedBotConsumptionPage({
},
});
```

### `settings`

Specify the custom settings on the embedding pages. Including the non-UI settings of bot consumption page.

#### Required?

No

#### Properties

##### `botConsumption`

Use the `botConsumption` object to customize the options on the bot consumption page. The detailed properties contain:

- `disableManipulationsAutoSaving`

- Disable the bot instance manipulation auto saving or not.
- Default value: `false`.

#### Sample

```js
microstrategy.embeddingContexts.embedBotConsumptionPage({
serverUrl: "https://demo.microstrategy.com/MicroStrategyLibrary",
projectId: "B19DEDCC11D4E0EFC000EB9495D0F44F",
objectId: "D9AB379D11EC92C1D9DC0080EFD415BB",
placeholder: document.getElementById("container"),
settings: {
botConsumption: {
disableManipulationsAutoSaving: true,
},
},
});
```
Original file line number Diff line number Diff line change
Expand Up @@ -334,9 +334,15 @@ Use the `dossierConsumption` object to customize the options on the dashboard co
- Default value: "noSelection".

- `disableManipulationsAutoSaving`

- Disable the dashboard instance manipulation auto saving or not.
- Default value: `false`.

- `enablePageSelection`

- Enable dashoard page selection in the TOC panel.
- Default value: `false`.

#### Sample

```js
Expand All @@ -349,6 +355,7 @@ microstrategy.embeddingContexts.embedDossierConsumptionPage({
dossierConsumption: {
componentSelectionMode: "multipleSelection",
disableManipulationsAutoSaving: false,
enablePageSelection: false,
},
},
});
Expand Down
10 changes: 10 additions & 0 deletions docs/embed-library-main-page/embed-custom-ui-on-all-pages.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ microstrategy.embeddingContexts.embedLibraryPage({
bookmark: true,
undoRedo: true,
edit: false,
dockedToc: {
isOpen: false,
isDocked: false,
},
},
},
dossierAuthoring: {
Expand Down Expand Up @@ -268,6 +272,12 @@ Use the `navigationBar` object to customize the navigation bar on the page. All
- `edit`
- Show or hide the edit icon.
- Default value: `false`.
- `dockedToc.isOpen`
- Open or close TOC panel.
- Default value: `false`.
- `dockedToc.isDocked`
- Pin or unpin TOC panel.
- Default value: `false`.

#### Required?

Expand Down
2 changes: 1 addition & 1 deletion docs/embed-library-main-page/embed-library-properties.md
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ Specifies the page on the sidebar entries that you want to embed.
};
```

- `currentPage.key`: This field specifies the key of the page that the user wants to embed. Its available values are the menu items in the sidebar, which could be in ['all', 'myContent', 'favorites', 'recents', 'insights', 'subscriptions', 'defaultGroups', 'myGroups'].
- `currentPage.key`: This field specifies the key of the page that the user wants to embed. Its available values are the menu items in the sidebar, which could be in ['home', 'insights', 'subscriptions', 'defaultGroups', 'myGroups', 'contentDiscovery'].

- `currentPage.targetGroup`: This field is only necessary when `currentPage.key` is 'defaultGroups' or 'myGroups', as on library home page the user can't select these 2 menu items but only could select the group items under them. It specifies which group item the user wants to select.

Expand Down
64 changes: 52 additions & 12 deletions docs/native-embedding-architecture/mstr-dossier.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The object returned from the `MstrEnvironment.loadDossier()` function, which all

#### Function

`async refresh(props)`
`async refresh(props, options)`

#### Input Parameters

Expand All @@ -22,6 +22,8 @@ The object returned from the `MstrEnvironment.loadDossier()` function, which all
| props | Array | This parameter cannot be empty. It describes the visualizations that must appear on the page. Each visualization must have a valid container. If you call `refresh()` for a second time, the visualizations rendered in the former `refresh()` call are destroyed first, then all the visualizations specified in the second `refresh()` call are shown on page by page. | true |
| props[i].key | String | The visualization key id. | true |
| props[i].container | HTMLElement | The HTML element used for displaying the visualization. The HTML element must be in the current DOM tree of the client’s page. All elements must exist and cannot be in iframes. The `Node.contains()` function is used to determine this and is compatible with all browsers. | true |
| options | Object | An object containing optional parameters to control the behavior of the `refresh()` function. | false |
| options.signal | AbortSignal | An `AbortSignal` object that allows you to abort the refresh operation. This signal is typically created by an `AbortController` and can be used to cancel the operation by calling `AbortController.abort()` if needed. | false |

#### Response

Expand Down Expand Up @@ -55,19 +57,57 @@ try {
}
```

With AbortController:

```js
const abortController = new AbortController();
try {
const environment = await microstrategy.embeddingComponent.environments.create({
serverUrl: "https://demo.microstrategy.com/MicroStrategyLibrary",
getAuthToken: () => {
// Logic similar to the existing Native Embedding SDK.
},
});
const dossier = await environment.loadDossier({
projectId: "B19DEDCC11D4E0EFC000EB9495D0F44F",
objectId: "D9AB379D11EC92C1D9DC0080EFD415BB",
});
// Begin here
const containerHtmlElement = document.getElementById("containerA");
// Use the abortController's signal
dossier.refresh(
[
{
key: "K66",
container: containerHtmlElement,
},
],
{ signal: abortController.signal }
);
// Your own code after the visualizations are all loaded
} catch (error) {
// Add your own handling logic here
}

if (shouldAbortRefresh) {
abortController.abort();
}
```

#### API Errors

| Error Case | Error Category | Handling Module | Error Handling |
| ----------------------------------------------------------------------------------- | -------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| The input parameter fails input validation | Invalid input | Native Embedding SDK | Caught by the `catch()` of the promise object |
| The user wants to show more than one visualization in one container in input params | Invalid input | Native Embedding SDK | Caught by the `catch()` of the promise object |
| The user wants to show one visualization in multiple containers | Invalid input | Native Embedding SDK | Caught by the `catch()` of the promise object |
| Visualization key isn't a valid visualization key in the dashboard | Invalid input | Native Embedding SDK | Caught by the `catch()` of the promise object |
| The container isn’t a valid HTML element in the DOM tree | Invalid input | Native Embedding SDK | Caught by the `catch()` of the promise object |
| A container has children that are not shown in the visualization | Invalid input | Native Embedding SDK | Caught by the `catch()` of the promise object |
| A container is occupied by other dossiers | Invalid input | Native Embedding SDK | Caught by the `catch()` of the promise object |
| Other REST API errors | Other | Native Embedding SDK | Caught by the `catch()` of the promise object |
| The key is the visualization key of the visualization in the panel | Invalid input | Native Embedding SDK | console err message in console "The visualization `${VisualizationKey}` is a visualization in a panel, which isn't supported." |
| Error Case | Error Category | Handling Module | Error Handling |
| -------------------------------------------------------------------------------------------------------- | -------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| The input parameter fails input validation | Invalid input | Native Embedding SDK | Caught by the `catch()` of the promise object |
| The user wants to show more than one visualization in one container in input params | Invalid input | Native Embedding SDK | Caught by the `catch()` of the promise object |
| The user wants to show one visualization in multiple containers | Invalid input | Native Embedding SDK | Caught by the `catch()` of the promise object |
| Visualization key isn't a valid visualization key in the dashboard | Invalid input | Native Embedding SDK | Caught by the `catch()` of the promise object |
| The container isn’t a valid HTML element in the DOM tree | Invalid input | Native Embedding SDK | Caught by the `catch()` of the promise object |
| A container has children that are not shown in the visualization | Invalid input | Native Embedding SDK | Caught by the `catch()` of the promise object |
| A container is occupied by other dossiers | Invalid input | Native Embedding SDK | Caught by the `catch()` of the promise object |
| Other REST API errors | Other | Native Embedding SDK | Caught by the `catch()` of the promise object |
| The key is the visualization key of the visualization in the panel | Invalid input | Native Embedding SDK | console err message in console "The visualization `${VisualizationKey}` is a visualization in a panel, which isn't supported." |
| Object you pass to AbortController.abort(), or `AbortError: signal is aborted without reason` otherwise. | Abort Error | Native Embedding SDK | Caught by the `catch()` of the promise object |

### The get information API

Expand Down
47 changes: 38 additions & 9 deletions docs/native-embedding-architecture/mstr-environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ The instance of this class is the object returned from the `microstrategy.embedd

#### Input Parameters

| Parameter Name | Data Type | Description | Is Required |
| ---------------- | --------- | -------------------------------------------------------------------------------------------------------- | ----------- |
| props.projectId | String | The project ID, which must be a GUID. | true |
| props.objectId | String | The dashboard ID, which must be valid. If the ID is a document, report, or bot ID, an error is reported. | true |
| props.instanceId | String | The dashboard instance ID, if it already exists. | false |
| Parameter Name | Data Type | Description | Is Required |
| ------------------- | --------- | -------------------------------------------------------------------------------------------------------- | ----------- |
| props.projectId | String | The project ID, which must be a GUID. | true |
| props.objectId | String | The dashboard ID, which must be valid. If the ID is a document, report, or bot ID, an error is reported. | true |
| props.instanceId | String | The dashboard instance ID, if it already exists. | false |
| props.applicationId | String | the dashboard application ID, if not specified, the default application will be used | false |

The `projectId` + `objectId` is used as the dashboard identifier. If the function is called twice with the same parameter, the same `MstrDossier` object is returned in the callback.

Expand Down Expand Up @@ -97,10 +98,11 @@ try {

#### Input Parameters

| Parameter Name | Data Type | Description | Is Required |
| --------------- | --------- | ------------------------------------------------------------------------------------------------------- | ----------- |
| props.projectId | String | The project ID, which must be a GUID. | true |
| props.objectId | String | The bot ID, which must be valid. If the ID is a dashboard, document or report ID, an error is reported. | true |
| Parameter Name | Data Type | Description | Is Required |
| ------------------- | --------- | ------------------------------------------------------------------------------------------------------- | ----------- |
| props.projectId | String | The project ID, which must be a GUID. | true |
| props.objectId | String | The bot ID, which must be valid. If the ID is a dashboard, document or report ID, an error is reported. | true |
| props.applicationId | String | the bot application ID, if not specified, the default application will be used | false |

The `projectId` + `objectId` is used as the bot identifier. If the function is called twice with the same parameter, the same `MstrBot` object is returned in the callback.

Expand Down Expand Up @@ -134,3 +136,30 @@ try {
| ------------------------------------------ | -------------- | -------------------- | --------------------------------------------- |
| The input parameter fails input validation | Invalid input | Native Embedding SDK | Caught by the `catch()` of the promise object |
| Other REST API errors | Other | Native Embedding SDK | Caught by the `catch()` of the promise object |

### The get authToken API

#### Function

`getAuthToken()`

#### Response

This API returns the authentication token obtained by the MstrEnvironment.

#### Example

```js
try {
const environment = await microstrategy.embeddingComponent.environments.create({
serverUrl: "https://demo.microstrategy.com/MicroStrategyLibrary",
getAuthToken: () => {
// Logic similar to the existing Native Embedding SDK.
},
});
// Get authentication token
const authToken = environment.getAuthToken();
} catch (error) {
// Your own error handling logic
}
```
16 changes: 16 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,22 @@ 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.

## MicroStrategy ONE September 2024

- [Embed MicroStrategy dashboard consumption page.](./embed-dossier-consumption-page/embed-dossier-consumption-page.md)
- Introduce `enablePageSelection` property to customize displaying page selectors in the TOC panel of Microstrategy dashboard consumption page.
- [The customized UI settings in Embedding SDK.](./embed-library-main-page/embed-custom-ui-on-all-pages.md)
- Introduce `customUi` object property `dockedToc` to customize default values of `isOpen` and `isDocked` of the TOC panel in the UI of Microstrategy dashboard consumption page.
- [Embed Dashboard Visualizations with Native Embedding SDK.](./native-embedding-architecture/mstr-dossier.md)
- Introduce `AbortController` support to cancel `MstrDossier.refresh()` calls.
- [Native Embedding MstrEnvironment Class](./native-embedding-architecture/mstr-environment.md)

- Introduce optional `applicationId` input parameter for `MstrEnvironment.loadDossier()` and `MstrEnvironment.loadBot()`.
- Introduce `MstrEnvironment.getAuthToken()` function.

- [Properties for an embedded MicroStrategy Library home page.](./embed-library-main-page/embed-library-properties.md)
- Change the available values of `currentPage.key` according to the Library UI change and new API functionalities: Remove 'all', 'myContent', 'favorites' and 'recents'; add 'home' and 'contentDiscovery'.

## MicroStrategy ONE June 2024

- [Embed MicroStrategy bot consumption page.](./embed-bot-consumption-page/embed-bot-consumption-page.md)
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
"react-dom": "^18.3.1",
"yarn": "^1.22.22"
},
"resolutions": {
"@docusaurus/core/webpack-bundle-analyzer/ws": "7.5.10",
"@docusaurus/core/webpack-dev-server/ws": "8.17.1"
},
"devDependencies": {
"@cmfcmf/docusaurus-search-local": "^1.1.0",
"@docusaurus/eslint-plugin": "^3.3.2",
Expand Down
Loading

0 comments on commit fed6c52

Please sign in to comment.