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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.21.1] - 2026-03-04

### Changed

- Make models GetFeatureFlagRequest and GetFeatureFlagResponse public by adding them to the index file
- Create and "publish" new model GetFeatureFlagsRequest to have an interface for an array request payload
- Update docs by enhancing description for GET_FEATURE_FLAG event and fixing some typos

## [1.21.0] - 2026-03-03

### Changed
Expand Down
56 changes: 34 additions & 22 deletions docs/events.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# API Documentation

If this is your first time using the Shell-SDK, then we recommend to have a look on our [usage samples](./usage-sample.md).
If this is your first time using the Shell-SDK, then we recommend to have a look at our [usage samples](./usage-sample.md).

## Events

Expand Down Expand Up @@ -64,7 +64,7 @@ Must be sent on application startup to get initial application context from the

The property `extension` is only exposed to extensions. It contains information about the requesting extension. Currently, it only contains the property `deploymentId`.

REQUIRE_CONTEXT will first return the response payload, then trigger individual ViewState object as describe in the ViewState section.
REQUIRE_CONTEXT will first return the response payload, then trigger individual ViewState object as described in the ViewState section.

- ### REQUIRE_AUTHENTICATION

Expand Down Expand Up @@ -245,7 +245,7 @@ Request permissions for specified object from the Shell
}
```

- Listenner
- Listener

```typescript
sdk.on(SHELL_EVENTS.Version1.GET_SETTINGS, (value) => {
Expand Down Expand Up @@ -291,7 +291,7 @@ Request value stored under specified key in cloud storage
}
```

- Listenner
- Listener

```typescript
sdk.on(SHELL_EVENTS.Version2.GET_STORAGE_ITEM, (response) => {
Expand Down Expand Up @@ -334,7 +334,7 @@ Request value stored under specified key in cloud storage
SHELL_EVENTS.Version1.SET_STORAGE_ITEM
```

Save value in cloud staorage under specified key
Save value in cloud storage under specified key

- Request payload

Expand All @@ -355,7 +355,7 @@ Request value stored under specified key in cloud storage

- ### GET_FEATURE_FLAG

Feature flags are in internally used flags in FSM to control some new features when the preview mode is off.
Feature flags are internally used flags in FSM to control some new features when the preview mode is off.

```
SHELL_EVENTS.Version1.GET_FEATURE_FLAG
Expand All @@ -365,6 +365,8 @@ Request value stored under specified key in cloud storage

- Request payload

Payload can either be an object or an array

type: GetFeatureFlagRequest
object containing key name and default value for feature flag to get

Expand All @@ -375,10 +377,20 @@ Request value stored under specified key in cloud storage
}
```

type: GetFeatureFlagsRequest
array of objects containing key name and default value for feature flags to get

```typescript
{
key: string;
defaultValue: boolean;
}[]
```

- Response payload

type: GetFeatureFlagResponse
object containing key name and value for feature flag
object(s) containing key name and value for feature flag

```typescript
{
Expand All @@ -387,7 +399,7 @@ Request value stored under specified key in cloud storage
}
```

- Listenner
- Listener

```typescript
sdk.on(SHELL_EVENTS.Version1.GET_FEATURE_FLAG, (response) => {
Expand Down Expand Up @@ -426,13 +438,13 @@ Request value stored under specified key in cloud storage
Restore document title to the value internally stored during previous SET_TITLE
event handling. If no stored title found, handling this event will do nothing.

- No request payload need to be provided
- No request payload needs to be provided

- No response will be sent

## Modal specific events

Applciations can request do display a modal with a specified URL. Events include opening and closing. You can also use the function `isInsideShellModal()` to know if your application is running inside a Shell modal.
Applications can request do display a modal with a specified URL. Events include opening and closing. You can also use the function `isInsideShellModal()` to know if your application is running inside a Shell modal.

- ### MODAL.OPEN

Expand Down Expand Up @@ -481,7 +493,7 @@ In `modalSettings` you can specify the following properties:

type: `boolean`

Default is `true`. Set to `false` to disable closing teh modal by pressing the ESC key.
Default is `true`. Set to `false` to disable closing the modal by pressing the ESC key.

- `focusTrapped`

Expand Down Expand Up @@ -571,7 +583,7 @@ this.sdk.emit(SHELL_EVENTS.Version2.MODAL.OPEN, {
url: 'https://example.com',
modalSettings: {
title: 'My title', // string
showTitleHeader: true,
showHeader: true,

hasBackdrop: false,
backdropClickCloseable: false,
Expand Down Expand Up @@ -638,13 +650,13 @@ this.sdk.emit(SHELL_EVENTS.Version1.MODAL.OPEN, {

- ### MODAL.CLOSE

Request closing of the open modal using `SHELL_EVENTS.Version1.MODAL.CLOSE` from your application or the opened modal. An object can be passed as parameter to be send back to the application which opened the modal.
Request closing of the open modal using `SHELL_EVENTS.Version1.MODAL.CLOSE` from your application or the opened modal. An object can be passed as parameter to be sent back to the application which opened the modal.

```typescript
this.sdk.emit(SHELL_EVENTS.Version1.MODAL.CLOSE);
```

An application can listen to the same event to trigger code on closing. This event is only received if the application emited the OPEN event.
An application can listen to the same event to trigger code on closing. This event is only received if the application emitted the OPEN event.

```typescript
this.sdk.on(SHELL_EVENTS.Version1.MODAL.CLOSE, (data) => {
Expand All @@ -659,23 +671,23 @@ ShellSdk provide a set of features which are specifically designed to allow comm

- ### VIEW STATE

View State event provide a shared context between all local instance.
View State event provides a shared context between all local instances.

As you might need to share between your application and extensions a general context to provide consistent UI, ShellSdk let applications share any `{ key: value }` object through the ViewState entity. You can update the using the `setViewState(key, value)` method. ViewState is not persistent and will be deleted when user navigate outside of the application. ViewState is not allowed to use in an extension for security reason, and will throw generic error object.
As you might need to share between your application and extensions a general context to provide consistent UI, ShellSdk lets applications share any `{ key: value }` object through the ViewState entity. You can update the using the `setViewState(key, value)` method. ViewState is not persistent and will be deleted when the user navigates outside of the application. ViewState is not allowed to use in an extension for security reasons, and will throw generic error object.

```typescript
this.sdk.setViewState('TECHNICIAN', id);
```

To listen on modification event, use the listenner `onViewState` with the expected key.
To listen on modification event, use the listener `onViewState` with the expected key.

```typescript
this.sdk.onViewState('TECHNICIAN', id => {
this.selectedId = id;
}))
```

To initialise your ViewState, make sure all `.onViewState` listenners are initialise when first emitting the `REQUEST_CONTEXT` event. ShellSdk will first trigger `.on(SHELL_EVENTS.Version1.REQUEST_CONTEXT` to initialize the general context, then individually receive events on `onViewState` listenners.
To initialize your ViewState, make sure all `.onViewState` listeners are initialize when first emitting the `REQUIRE_CONTEXT` event. ShellSdk will first trigger `.on(SHELL_EVENTS.Version1.REQUIRE_CONTEXT` to initialize the general context, then individually receive events on `onViewState` listeners.

- ### TO_APP

Expand Down Expand Up @@ -711,7 +723,7 @@ ShellSdk provide a set of features which are specifically designed to allow comm

## Events versioning

Event name includes version part which allow to keep back compatibility when data formats in request or
Event name includes version part which allows maintaining backward compatibility when data formats in request or
response payload needs to be changed.

Below sample event name for the event which has version 2:
Expand All @@ -723,7 +735,7 @@ SHELL_EVENTS.Version2.GET_PERMISSIONS
Events supporting new data formats will be published under next
version, while previous data formats still available under previous version number. This way application
able to keep using previous event version without immediate need to switch to the new data formats. Switch
to the next event version can be done later when particular application ready for new payload data format.
to the next event version can be done later when a particular application is ready for new payload data format.

Whilst previous event versions can be used in alredy developed applications for back compatibility, it is
recommended to use latest event versions when building new applications which using fsm-shell library.
Whilst previous event versions can be used in already developed applications for back compatibility, it is
recommended to use latest event versions when building new applications that use fsm-shell library.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fsm-shell",
"version": "1.21.0",
"version": "1.21.1",
"description": "client library for FSM shell",
"main": "release/fsm-shell-client.js",
"module": "release/fsm-shell-client.es.js",
Expand Down
84 changes: 45 additions & 39 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,63 +19,69 @@ import { PayloadValidationError } from './validation/payload-validation-error';
export { PayloadValidationError };

import {
RequireContextRequest,
AuthRequest,
AuthResponse,
AuthResponseType,
DialogSettings,
GetFeatureFlagRequest,
GetFeatureFlagsRequest,
GetFeatureFlagResponse,
GetItemResponse,
SetItemRequest,
ModalCloseRequest,
ModalOpenRequest,
ModalOpenRequestV2,
ModalSize,
Outlet,
OutletsDeleteAssignmentRequest,
OutletsDeleteAssignmentResponse,
OutletsRequestContextRequest,
OutletsRequestContextResponse,
OutletsRequestDynamicContextRequest,
OutletsRequestDynamicContextResponse,
Permission,
PermissionRequest,
PermissionResponse,
PermissionRequestV3,
PermissionResponse,
PermissionResponseV3,
UiPermissions,
RequireContextRequest,
SetItemRequest,
SettingsResponse,
SetTitleRequest,
SetViewStateRequest,
SetViewStateResponse,
OutletsRequestContextRequest,
OutletsRequestContextResponse,
OutletsRequestDynamicContextRequest,
OutletsRequestDynamicContextResponse,
OutletsDeleteAssignmentRequest,
OutletsDeleteAssignmentResponse,
SetTitleRequest,
AuthResponseType,
UiPermissions
} from './models/index';

export {
AuthRequest,
AuthResponse,
ModalOpenRequest,
ModalOpenRequestV2,
AuthResponseType,
DialogSettings,
Outlet,
GetFeatureFlagRequest,
GetFeatureFlagsRequest,
GetFeatureFlagResponse,
GetItemResponse,
ModalCloseRequest,
ModalOpenRequest,
ModalOpenRequestV2,
ModalSize,
} from './models/index';

export {
RequireContextRequest,
GetItemResponse,
SetItemRequest,
Outlet,
OutletsDeleteAssignmentRequest,
OutletsDeleteAssignmentResponse,
OutletsRequestContextRequest,
OutletsRequestContextResponse,
OutletsRequestDynamicContextRequest,
OutletsRequestDynamicContextResponse,
Permission,
PermissionRequest,
PermissionResponse,
PermissionRequestV3,
PermissionResponse,
PermissionResponseV3,
UiPermissions,
RequireContextRequest,
SetItemRequest,
SettingsResponse,
SetTitleRequest,
SetViewStateRequest,
SetViewStateResponse,
OutletsRequestContextRequest,
OutletsRequestContextResponse,
OutletsRequestDynamicContextRequest,
OutletsRequestDynamicContextResponse,
OutletsDeleteAssignmentRequest,
OutletsDeleteAssignmentResponse,
SetTitleRequest,
AuthResponseType,
AuthRequest,
AuthResponse,
ModalOpenRequest,
ModalOpenRequestV2,
DialogSettings,
Outlet,
ModalCloseRequest,
ModalSize,
UiPermissions
};
2 changes: 2 additions & 0 deletions src/models/feature-flag/get-feature-flag-request.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ export interface GetFeatureFlagRequest {
key: string;
defaultValue: boolean;
}

export interface GetFeatureFlagsRequest extends Array<GetFeatureFlagRequest>{}
1 change: 1 addition & 0 deletions src/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export { ModalCloseRequest } from './modal/modal-close-request.model';
export { SettingsResponse } from './settings/settings-response.model';

export { GetFeatureFlagRequest } from './feature-flag/get-feature-flag-request.model';
export { GetFeatureFlagsRequest } from './feature-flag/get-feature-flag-request.model';
export { GetFeatureFlagResponse } from './feature-flag/get-feature-flag-response.model';

export { SetViewStateRequest } from './view-state/set-view-state-request.model';
Expand Down
Loading