@sprucelabs/heartwood-view-controllers 119.1.2 → 119.2.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,6 @@
1
1
  import { MercuryClient } from '@sprucelabs/mercury-client';
2
2
  import { LockScreenSkillViewControllerOptions } from '../skillViewControllers/LockScreen.svc';
3
- import { AppController, AppControllerLoadOptions, ControllerOptions, ToastOptions, ViewControllerId, ViewControllerMap, ViewControllerOptions, ViewControllerPlugins } from '../types/heartwood.types';
3
+ import { AppController, AppControllerLoadOptions, ControllerOptions, ToastOptions, ViewControllerId, ViewControllerMap, ViewControllerOptions, ViewControllerPlugins, VoteOptions } from '../types/heartwood.types';
4
4
  export default abstract class AbstractAppController implements AppController {
5
5
  static id: string;
6
6
  protected plugins: ViewControllerPlugins;
@@ -8,9 +8,11 @@ export default abstract class AbstractAppController implements AppController {
8
8
  private renderLockScreenHandler;
9
9
  protected connectToApi: () => Promise<MercuryClient>;
10
10
  private toastHandler;
11
+ private voteHandler;
11
12
  constructor(options: ViewControllerOptions);
12
13
  load(options: AppControllerLoadOptions): Promise<void>;
13
14
  protected renderLockScreen(options: LockScreenSkillViewControllerOptions): import("../skillViewControllers/LockScreen.svc").default;
14
15
  protected toast(options: ToastOptions): void;
16
+ protected askForAVote(options: VoteOptions): Promise<void>;
15
17
  Controller<N extends ViewControllerId, O extends ControllerOptions<N>>(id: N, options: O): ViewControllerMap[N];
16
18
  }
@@ -9,10 +9,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  export default class AbstractAppController {
11
11
  constructor(options) {
12
- const { plugins, vcFactory, renderLockScreenHandler, connectToApi, toastHandler, } = options;
12
+ const { plugins, vcFactory, renderLockScreenHandler, connectToApi, toastHandler, voteHandler, } = options;
13
13
  this.plugins = plugins;
14
14
  this.views = vcFactory;
15
15
  this.toastHandler = toastHandler;
16
+ this.voteHandler = voteHandler;
16
17
  this.renderLockScreenHandler = renderLockScreenHandler;
17
18
  this.connectToApi = connectToApi;
18
19
  }
@@ -28,6 +29,11 @@ export default class AbstractAppController {
28
29
  toast(options) {
29
30
  this.toastHandler(options);
30
31
  }
32
+ askForAVote(options) {
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ yield this.voteHandler(options);
35
+ });
36
+ }
31
37
  Controller(id, options) {
32
38
  return this.views.Controller(id, options);
33
39
  }
@@ -27,13 +27,13 @@ export default class ViewControllerFactory {
27
27
  setAppController(App: AppControllerConstructor): void;
28
28
  private importPlugins;
29
29
  BuildPlugin<P extends ViewControllerPlugin>(Plugin: new (options: ViewControllerPluginOptions) => P): P;
30
- BuildApp<A extends AppController>(App: new (options: ViewControllerOptions) => A): A;
30
+ BuildApp<A extends AppController>(App: new (options: ViewControllerOptions) => A, options?: Partial<ViewControllerOptions>): A;
31
31
  hasController(name: string): boolean;
32
32
  hasApp(namespace: string): boolean;
33
33
  getController<N extends ViewControllerId>(name: N): any;
34
34
  setDates(dates: DateUtil): void;
35
35
  addPlugin(named: string, plugin: ViewControllerPlugin): void;
36
- App<Id extends AppControllerId>(namespace: Id): AppControllerMap[Id];
36
+ App<Id extends AppControllerId>(namespace: Id, options?: Partial<ViewControllerOptions>): AppControllerMap[Id];
37
37
  Controller<N extends ViewControllerId, O extends ControllerOptions<N>>(id: N, options: O): ViewControllerMap[N];
38
38
  protected buildViewContructorOptions(name: string, options?: Record<string, any>): ViewControllerOptions;
39
39
  private sharedConstructorOptions;
@@ -84,8 +84,8 @@ export default class ViewControllerFactory {
84
84
  BuildPlugin(Plugin) {
85
85
  return new Plugin(this.sharedConstructorOptions());
86
86
  }
87
- BuildApp(App) {
88
- const app = new App(this.buildViewContructorOptions('App'));
87
+ BuildApp(App, options) {
88
+ const app = new App(Object.assign(Object.assign({}, this.buildViewContructorOptions('App')), options));
89
89
  //@ts-ignore
90
90
  if (app.id) {
91
91
  throw new SpruceError({
@@ -116,7 +116,7 @@ export default class ViewControllerFactory {
116
116
  //@ts-ignore
117
117
  this.plugins[named] = plugin;
118
118
  }
119
- App(namespace) {
119
+ App(namespace, options) {
120
120
  const App = this.AppMap[namespace];
121
121
  if (!App) {
122
122
  throw new SpruceError({
@@ -124,7 +124,7 @@ export default class ViewControllerFactory {
124
124
  namespace,
125
125
  });
126
126
  }
127
- return this.BuildApp(App);
127
+ return this.BuildApp(App, options);
128
128
  }
129
129
  Controller(id, options) {
130
130
  const Class = this.controllerMap[id];
@@ -1,6 +1,6 @@
1
1
  import { MercuryClient } from '@sprucelabs/mercury-client';
2
2
  import { LockScreenSkillViewControllerOptions } from '../skillViewControllers/LockScreen.svc';
3
- import { AppController, AppControllerLoadOptions, ControllerOptions, ToastOptions, ViewControllerId, ViewControllerMap, ViewControllerOptions, ViewControllerPlugins } from '../types/heartwood.types';
3
+ import { AppController, AppControllerLoadOptions, ControllerOptions, ToastOptions, ViewControllerId, ViewControllerMap, ViewControllerOptions, ViewControllerPlugins, VoteOptions } from '../types/heartwood.types';
4
4
  export default abstract class AbstractAppController implements AppController {
5
5
  static id: string;
6
6
  protected plugins: ViewControllerPlugins;
@@ -8,9 +8,11 @@ export default abstract class AbstractAppController implements AppController {
8
8
  private renderLockScreenHandler;
9
9
  protected connectToApi: () => Promise<MercuryClient>;
10
10
  private toastHandler;
11
+ private voteHandler;
11
12
  constructor(options: ViewControllerOptions);
12
13
  load(options: AppControllerLoadOptions): Promise<void>;
13
14
  protected renderLockScreen(options: LockScreenSkillViewControllerOptions): import("../skillViewControllers/LockScreen.svc").default;
14
15
  protected toast(options: ToastOptions): void;
16
+ protected askForAVote(options: VoteOptions): Promise<void>;
15
17
  Controller<N extends ViewControllerId, O extends ControllerOptions<N>>(id: N, options: O): ViewControllerMap[N];
16
18
  }
@@ -2,10 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  class AbstractAppController {
4
4
  constructor(options) {
5
- const { plugins, vcFactory, renderLockScreenHandler, connectToApi, toastHandler, } = options;
5
+ const { plugins, vcFactory, renderLockScreenHandler, connectToApi, toastHandler, voteHandler, } = options;
6
6
  this.plugins = plugins;
7
7
  this.views = vcFactory;
8
8
  this.toastHandler = toastHandler;
9
+ this.voteHandler = voteHandler;
9
10
  this.renderLockScreenHandler = renderLockScreenHandler;
10
11
  this.connectToApi = connectToApi;
11
12
  }
@@ -18,6 +19,9 @@ class AbstractAppController {
18
19
  toast(options) {
19
20
  this.toastHandler(options);
20
21
  }
22
+ async askForAVote(options) {
23
+ await this.voteHandler(options);
24
+ }
21
25
  Controller(id, options) {
22
26
  return this.views.Controller(id, options);
23
27
  }
@@ -27,13 +27,13 @@ export default class ViewControllerFactory {
27
27
  setAppController(App: AppControllerConstructor): void;
28
28
  private importPlugins;
29
29
  BuildPlugin<P extends ViewControllerPlugin>(Plugin: new (options: ViewControllerPluginOptions) => P): P;
30
- BuildApp<A extends AppController>(App: new (options: ViewControllerOptions) => A): A;
30
+ BuildApp<A extends AppController>(App: new (options: ViewControllerOptions) => A, options?: Partial<ViewControllerOptions>): A;
31
31
  hasController(name: string): boolean;
32
32
  hasApp(namespace: string): boolean;
33
33
  getController<N extends ViewControllerId>(name: N): any;
34
34
  setDates(dates: DateUtil): void;
35
35
  addPlugin(named: string, plugin: ViewControllerPlugin): void;
36
- App<Id extends AppControllerId>(namespace: Id): AppControllerMap[Id];
36
+ App<Id extends AppControllerId>(namespace: Id, options?: Partial<ViewControllerOptions>): AppControllerMap[Id];
37
37
  Controller<N extends ViewControllerId, O extends ControllerOptions<N>>(id: N, options: O): ViewControllerMap[N];
38
38
  protected buildViewContructorOptions(name: string, options?: Record<string, any>): ViewControllerOptions;
39
39
  private sharedConstructorOptions;
@@ -82,8 +82,11 @@ class ViewControllerFactory {
82
82
  BuildPlugin(Plugin) {
83
83
  return new Plugin(this.sharedConstructorOptions());
84
84
  }
85
- BuildApp(App) {
86
- const app = new App(this.buildViewContructorOptions('App'));
85
+ BuildApp(App, options) {
86
+ const app = new App({
87
+ ...this.buildViewContructorOptions('App'),
88
+ ...options,
89
+ });
87
90
  //@ts-ignore
88
91
  if (app.id) {
89
92
  throw new SpruceError_1.default({
@@ -114,7 +117,7 @@ class ViewControllerFactory {
114
117
  //@ts-ignore
115
118
  this.plugins[named] = plugin;
116
119
  }
117
- App(namespace) {
120
+ App(namespace, options) {
118
121
  const App = this.AppMap[namespace];
119
122
  if (!App) {
120
123
  throw new SpruceError_1.default({
@@ -122,7 +125,7 @@ class ViewControllerFactory {
122
125
  namespace,
123
126
  });
124
127
  }
125
- return this.BuildApp(App);
128
+ return this.BuildApp(App, options);
126
129
  }
127
130
  Controller(id, options) {
128
131
  const Class = this.controllerMap[id];
package/package.json CHANGED
@@ -13,7 +13,7 @@
13
13
  "sideEffects": false,
14
14
  "license": "MIT",
15
15
  "description": "All the power of Heartwood in one, convenient package.",
16
- "version": "119.1.2",
16
+ "version": "119.2.0",
17
17
  "skill": {
18
18
  "namespace": "HeartwoodViewControllers",
19
19
  "commandOverrides": {