@24i/bigscreen-sdk 1.0.48 → 1.0.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@24i/bigscreen-sdk",
3
- "version": "1.0.48",
3
+ "version": "1.0.50",
4
4
  "description": "SmartApps BIGscreen SDK monorepo",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -41,7 +41,7 @@
41
41
  "@24i/appstage-shared-analytics": "1.0.22",
42
42
  "@24i/appstage-shared-events-manager": "1.0.11",
43
43
  "@24i/appstage-shared-perf-utils": "1.0.11",
44
- "@24i/bigscreen-players-engine-base": "4.0.11",
44
+ "@24i/bigscreen-players-engine-base": "4.1.0",
45
45
  "@24i/smartapps-datalayer": "3.0.18",
46
46
  "@sentry/browser": "7.35.0",
47
47
  "@sentry/types": "7.35.0",
@@ -16,6 +16,7 @@ It will take care of route switching based on hash changes. It also supports par
16
16
  - `children` - Routes
17
17
  - `defaultPath` - optional path to which go after Router is mounted (default: `/`)
18
18
  - `detachInactiveRoutes` - optional flag if routes should detach from DOM entirely during route switching (default: `true`)
19
+ - `canBack` - optional function whether the router can route back
19
20
 
20
21
  ### Interface
21
22
  - `getActiveRoute()`*: Route | null* - Returns active route component
@@ -10,6 +10,7 @@ type Props = {
10
10
  children: JSX.Element[],
11
11
  defaultPath?: string,
12
12
  detachInactiveRoutes?: boolean,
13
+ canBack?: (event: KeyboardEvent) => boolean,
13
14
  };
14
15
 
15
16
  type RoutePath = {
@@ -33,6 +34,7 @@ export class Router extends Component<Props> {
33
34
  static defaultProps = {
34
35
  defaultPath: '/',
35
36
  detachInactiveRoutes: true,
37
+ canBack: () => true,
36
38
  };
37
39
 
38
40
  declare props: DeclareProps<Props, typeof Router.defaultProps>;
@@ -61,7 +63,8 @@ export class Router extends Component<Props> {
61
63
  };
62
64
 
63
65
  onKeyDown = (event: KeyboardEvent) => {
64
- if (history.length > 1 && device.isBackOrEscape(event)) {
66
+ const { canBack } = this.props;
67
+ if (history.length > 1 && device.isBackOrEscape(event) && canBack(event)) {
65
68
  back();
66
69
  stopEventImmediately(event);
67
70
  }