@sprucelabs/spruce-heartwood-utils 16.15.10 → 16.16.0

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.
@@ -1,6 +1,8 @@
1
+ /// <reference types="node" />
2
+ import EventEmitter from 'events';
1
3
  import { CachedValue, Device } from '@sprucelabs/heartwood-view-controllers';
2
4
  import { Orientation } from '../types/heartwood.types';
3
- export declare class HeartwoodDevice implements Device {
5
+ export declare class HeartwoodDevice extends EventEmitter implements Device {
4
6
  private storage;
5
7
  private orientation;
6
8
  protected constructor(storage: Storage);
@@ -1,9 +1,15 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.HeartwoodDevice = void 0;
7
+ /* eslint-disable no-undef */
8
+ const events_1 = __importDefault(require("events"));
4
9
  const schema_1 = require("@sprucelabs/schema");
5
- class HeartwoodDevice {
10
+ class HeartwoodDevice extends events_1.default {
6
11
  constructor(storage) {
12
+ super();
7
13
  this.orientation = 'unknown-orientation';
8
14
  this.storage = storage;
9
15
  }
@@ -58,6 +64,7 @@ class HeartwoodDevice {
58
64
  // @ts-ignore
59
65
  window.AndroidInterface.postMessage(JSON.stringify(options));
60
66
  }
67
+ this.emit('command', command, payload);
61
68
  }
62
69
  }
63
70
  exports.HeartwoodDevice = HeartwoodDevice;
@@ -1,6 +1,8 @@
1
+ /// <reference types="node" />
2
+ import EventEmitter from 'events';
1
3
  import { CachedValue, Device } from '@sprucelabs/heartwood-view-controllers';
2
4
  import { Orientation } from '../types/heartwood.types';
3
- export declare class HeartwoodDevice implements Device {
5
+ export declare class HeartwoodDevice extends EventEmitter implements Device {
4
6
  private storage;
5
7
  private orientation;
6
8
  protected constructor(storage: Storage);
@@ -1,6 +1,9 @@
1
+ /* eslint-disable no-undef */
2
+ import EventEmitter from 'events';
1
3
  import { assertOptions } from '@sprucelabs/schema';
2
- export class HeartwoodDevice {
4
+ export class HeartwoodDevice extends EventEmitter {
3
5
  constructor(storage) {
6
+ super();
4
7
  this.orientation = 'unknown-orientation';
5
8
  this.storage = storage;
6
9
  }
@@ -55,5 +58,6 @@ export class HeartwoodDevice {
55
58
  // @ts-ignore
56
59
  window.AndroidInterface.postMessage(JSON.stringify(options));
57
60
  }
61
+ this.emit('command', command, payload);
58
62
  }
59
63
  }
@@ -6,3 +6,4 @@ export { default as fakeGetViews } from './__tests__/support/heartwoodEventFaker
6
6
  export { default as MockRemoteViewControllerFactory } from './__tests__/support/MockRemoteViewControllerFactory';
7
7
  export * from './types/heartwood-module.types';
8
8
  export { default as loadActiveThemeForOrg } from './theming/loadActiveThemeForOrg';
9
+ export { default as AutoLogoutPlugin } from './plugins/AutoLogoutPlugin';
@@ -6,3 +6,4 @@ export { default as fakeGetViews } from './__tests__/support/heartwoodEventFaker
6
6
  export { default as MockRemoteViewControllerFactory } from './__tests__/support/MockRemoteViewControllerFactory.js';
7
7
  export * from './types/heartwood-module.types.js';
8
8
  export { default as loadActiveThemeForOrg } from './theming/loadActiveThemeForOrg.js';
9
+ export { default as AutoLogoutPlugin } from './plugins/AutoLogoutPlugin.js';
@@ -0,0 +1,7 @@
1
+ import { ViewControllerPlugin, ViewControllerPluginOptions } from '@sprucelabs/heartwood-view-controllers';
2
+ export default class AutoLogoutPlugin implements ViewControllerPlugin {
3
+ private device;
4
+ constructor(options: ViewControllerPluginOptions);
5
+ enableAutoLogout(durationSec: number): void;
6
+ disableAutoLogout(): void;
7
+ }
@@ -0,0 +1,14 @@
1
+ export default class AutoLogoutPlugin {
2
+ constructor(options) {
3
+ const { device } = options;
4
+ this.device = device;
5
+ }
6
+ enableAutoLogout(durationSec) {
7
+ this.device.sendCommand('enableAutoLogout', {
8
+ durationSec,
9
+ });
10
+ }
11
+ disableAutoLogout() {
12
+ this.device.sendCommand('disableAutoLogout', {});
13
+ }
14
+ }
@@ -6,3 +6,4 @@ export { default as fakeGetViews } from './__tests__/support/heartwoodEventFaker
6
6
  export { default as MockRemoteViewControllerFactory } from './__tests__/support/MockRemoteViewControllerFactory';
7
7
  export * from './types/heartwood-module.types';
8
8
  export { default as loadActiveThemeForOrg } from './theming/loadActiveThemeForOrg';
9
+ export { default as AutoLogoutPlugin } from './plugins/AutoLogoutPlugin';
@@ -17,7 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.loadActiveThemeForOrg = exports.MockRemoteViewControllerFactory = exports.fakeGetViews = exports.remoteVcAssert = exports.CardRegistrar = exports.RemoteViewControllerFactoryImpl = void 0;
20
+ exports.AutoLogoutPlugin = exports.loadActiveThemeForOrg = exports.MockRemoteViewControllerFactory = exports.fakeGetViews = exports.remoteVcAssert = exports.CardRegistrar = exports.RemoteViewControllerFactoryImpl = void 0;
21
21
  var RemoteViewControllerFactory_1 = require("./skillViews/RemoteViewControllerFactory");
22
22
  Object.defineProperty(exports, "RemoteViewControllerFactoryImpl", { enumerable: true, get: function () { return __importDefault(RemoteViewControllerFactory_1).default; } });
23
23
  __exportStar(require("./skillViews/RemoteViewControllerFactory"), exports);
@@ -32,4 +32,6 @@ Object.defineProperty(exports, "MockRemoteViewControllerFactory", { enumerable:
32
32
  __exportStar(require("./types/heartwood-module.types"), exports);
33
33
  var loadActiveThemeForOrg_1 = require("./theming/loadActiveThemeForOrg");
34
34
  Object.defineProperty(exports, "loadActiveThemeForOrg", { enumerable: true, get: function () { return __importDefault(loadActiveThemeForOrg_1).default; } });
35
+ var AutoLogoutPlugin_1 = require("./plugins/AutoLogoutPlugin");
36
+ Object.defineProperty(exports, "AutoLogoutPlugin", { enumerable: true, get: function () { return __importDefault(AutoLogoutPlugin_1).default; } });
35
37
  //# sourceMappingURL=index-module.js.map
@@ -0,0 +1,7 @@
1
+ import { ViewControllerPlugin, ViewControllerPluginOptions } from '@sprucelabs/heartwood-view-controllers';
2
+ export default class AutoLogoutPlugin implements ViewControllerPlugin {
3
+ private device;
4
+ constructor(options: ViewControllerPluginOptions);
5
+ enableAutoLogout(durationSec: number): void;
6
+ disableAutoLogout(): void;
7
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class AutoLogoutPlugin {
4
+ constructor(options) {
5
+ const { device } = options;
6
+ this.device = device;
7
+ }
8
+ enableAutoLogout(durationSec) {
9
+ this.device.sendCommand('enableAutoLogout', {
10
+ durationSec,
11
+ });
12
+ }
13
+ disableAutoLogout() {
14
+ this.device.sendCommand('disableAutoLogout', {});
15
+ }
16
+ }
17
+ exports.default = AutoLogoutPlugin;
18
+ //# sourceMappingURL=AutoLogoutPlugin.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sprucelabs/spruce-heartwood-utils",
3
3
  "description": "Heartwood Utilities",
4
- "version": "16.15.10",
4
+ "version": "16.16.0",
5
5
  "skill": {
6
6
  "namespace": "heartwood"
7
7
  },
@@ -22,6 +22,10 @@
22
22
  "build/skillViews/RemoteViewControllerFactory.d.ts",
23
23
  "build/esm/skillViews/RemoteViewControllerFactory.js",
24
24
  "build/esm/skillViews/RemoteViewControllerFactory.d.ts",
25
+ "build/plugins/AutoLogoutPlugin.js",
26
+ "build/plugins/AutoLogoutPlugin.d.ts",
27
+ "build/esm/plugins/AutoLogoutPlugin.js",
28
+ "build/esm/plugins/AutoLogoutPlugin.d.ts",
25
29
  "build/skillViews/CardRegistrar.js",
26
30
  "build/skillViews/CardRegistrar.d.ts",
27
31
  "build/esm/skillViews/CardRegistrar.js",