@vived/host 3.7.0 → 3.8.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.
@@ -0,0 +1,7 @@
1
+ /// <reference types="jest" />
2
+ import { HostAppObject } from "../../../HostAppObject";
3
+ import { DispatchEnableFeatureUC } from "../UCs";
4
+ export declare class DispatchEnableFeatureUCMock extends DispatchEnableFeatureUC {
5
+ doDispatch: jest.Mock<any, any>;
6
+ constructor(appObject: HostAppObject);
7
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DispatchEnableFeatureUCMock = void 0;
4
+ const UCs_1 = require("../UCs");
5
+ class DispatchEnableFeatureUCMock extends UCs_1.DispatchEnableFeatureUC {
6
+ constructor(appObject) {
7
+ super(appObject, UCs_1.DispatchEnableFeatureUC.type);
8
+ this.doDispatch = jest.fn();
9
+ }
10
+ }
11
+ exports.DispatchEnableFeatureUCMock = DispatchEnableFeatureUCMock;
@@ -1,3 +1,4 @@
1
+ export * from "./DispatchEnableFeatureUCMock";
1
2
  export * from "./MockDispatchAppDispatcherUC";
2
3
  export * from "./MockDispatchIsAuthoringUC";
3
4
  export * from "./MockDispatchSetStateUC";
@@ -10,6 +10,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
10
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./DispatchEnableFeatureUCMock"), exports);
13
14
  __exportStar(require("./MockDispatchAppDispatcherUC"), exports);
14
15
  __exportStar(require("./MockDispatchIsAuthoringUC"), exports);
15
16
  __exportStar(require("./MockDispatchSetStateUC"), exports);
@@ -0,0 +1,9 @@
1
+ import { HostAppObject, HostAppObjectRepo, HostAppObjectUC } from "../../../HostAppObject";
2
+ export declare abstract class DispatchEnableFeatureUC extends HostAppObjectUC {
3
+ static readonly type = "DispatchEnableFeatureUC";
4
+ readonly requestType = "ENABLE_FEATURE";
5
+ abstract doDispatch(featureFlag: string): void;
6
+ static get(appObject: HostAppObject): DispatchEnableFeatureUC | undefined;
7
+ static getByID(id: string, appObjects: HostAppObjectRepo): DispatchEnableFeatureUC | undefined;
8
+ }
9
+ export declare function makeDispatchEnableFeatureUC(appObject: HostAppObject): DispatchEnableFeatureUC;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeDispatchEnableFeatureUC = exports.DispatchEnableFeatureUC = void 0;
4
+ const HostAppObject_1 = require("../../../HostAppObject");
5
+ const Entities_1 = require("../Entities");
6
+ class DispatchEnableFeatureUC extends HostAppObject_1.HostAppObjectUC {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.requestType = "ENABLE_FEATURE";
10
+ }
11
+ static get(appObject) {
12
+ const uc = appObject.getComponent(DispatchEnableFeatureUC.type);
13
+ if (!uc) {
14
+ appObject.appObjectRepo.submitWarning("DispatchEnableFeatureUC.get", "Unable to find DispatchEnableFeatureUC on app object " + appObject.id);
15
+ }
16
+ return uc;
17
+ }
18
+ static getByID(id, appObjects) {
19
+ const appObject = appObjects.get(id);
20
+ if (!appObject) {
21
+ appObjects.submitWarning("DispatchEnableFeatureUC.getByID", "Unable to find App Object by id " + id);
22
+ return undefined;
23
+ }
24
+ return DispatchEnableFeatureUC.get(appObject);
25
+ }
26
+ }
27
+ exports.DispatchEnableFeatureUC = DispatchEnableFeatureUC;
28
+ DispatchEnableFeatureUC.type = "DispatchEnableFeatureUC";
29
+ function makeDispatchEnableFeatureUC(appObject) {
30
+ return new DispatchAddChannelModelUCImp(appObject);
31
+ }
32
+ exports.makeDispatchEnableFeatureUC = makeDispatchEnableFeatureUC;
33
+ class DispatchAddChannelModelUCImp extends DispatchEnableFeatureUC {
34
+ constructor(appObject) {
35
+ super(appObject, DispatchEnableFeatureUC.type);
36
+ this.requestVersion = 1;
37
+ if (!this.dispatcher) {
38
+ this.error("UC has been added to an App Object that does not have a HostDispatchEntity. Add a dispatcher first");
39
+ this.dispose();
40
+ }
41
+ }
42
+ get dispatcher() {
43
+ return this.getCachedLocalComponent(Entities_1.HostDispatchEntity.type);
44
+ }
45
+ doDispatch(featureFlag) {
46
+ if (!this.dispatcher)
47
+ return;
48
+ const payload = {
49
+ featureFlag
50
+ };
51
+ this.dispatcher.formRequestAndDispatch(this.requestType, this.requestVersion, payload);
52
+ }
53
+ }
@@ -1,4 +1,5 @@
1
1
  export * from "./DispatchDisposeAppUC";
2
+ export * from "./DispatchEnableFeatureUC";
2
3
  export * from "./DispatchIsAuthoringUC";
3
4
  export * from "./DispatchSetStateUC";
4
5
  export * from "./DispatchShowBabylonInspectorUC";
@@ -11,6 +11,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  __exportStar(require("./DispatchDisposeAppUC"), exports);
14
+ __exportStar(require("./DispatchEnableFeatureUC"), exports);
14
15
  __exportStar(require("./DispatchIsAuthoringUC"), exports);
15
16
  __exportStar(require("./DispatchSetStateUC"), exports);
16
17
  __exportStar(require("./DispatchShowBabylonInspectorUC"), exports);
@@ -1,6 +1,6 @@
1
1
  /// <reference types="jest" />
2
2
  import { HostAppObject, HostAppObjectRepo } from "../../../HostAppObject";
3
- import { PatchAssetMetaUC } from "../UCs/PatchAssetMetaUC";
3
+ import { PatchAssetMetaUC } from "../UCs";
4
4
  export declare class MockPatchAssetMetaUC extends PatchAssetMetaUC {
5
5
  doPatch: jest.Mock<any, any>;
6
6
  constructor(appObject: HostAppObject);
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.makeMockPatchAssetMetaUC = exports.MockPatchAssetMetaUC = void 0;
4
- const PatchAssetMetaUC_1 = require("../UCs/PatchAssetMetaUC");
5
- class MockPatchAssetMetaUC extends PatchAssetMetaUC_1.PatchAssetMetaUC {
4
+ const UCs_1 = require("../UCs");
5
+ const PatchAssetUC_1 = require("../UCs/PatchAssetUC");
6
+ class MockPatchAssetMetaUC extends UCs_1.PatchAssetMetaUC {
6
7
  constructor(appObject) {
7
- super(appObject, PatchAssetMetaUC_1.PatchAssetMetaUC.type);
8
+ super(appObject, PatchAssetUC_1.PatchAssetUC.type);
8
9
  this.doPatch = jest.fn().mockResolvedValue(undefined);
9
10
  }
10
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vived/host",
3
- "version": "3.7.0",
3
+ "version": "3.8.0",
4
4
  "description": "Public Host package for the VIVED Learning App system",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",