@vived/host 3.10.0 → 3.11.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.
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.makeStartAppUC = exports.StartAppUC = void 0;
4
4
  const HostAppObject_1 = require("../../../HostAppObject");
5
+ const AppSandbox_1 = require("../../AppSandbox");
5
6
  const Dispatcher_1 = require("../../Dispatcher");
6
7
  const Entities_1 = require("../../StateMachine/Entities");
7
8
  class StartAppUC extends HostAppObject_1.HostAppObjectUC {
@@ -35,18 +36,19 @@ class StartAppUCImp extends StartAppUC {
35
36
  constructor(appObject) {
36
37
  super(appObject, StartAppUC.type);
37
38
  this.start = (container) => {
38
- var _a, _b, _c, _d, _e;
39
+ var _a, _b, _c, _d;
39
40
  if (!this.stateMachine)
40
41
  return;
41
42
  if (!this.dispatchStart)
42
43
  return;
43
44
  if (!this.editStateEntity)
44
45
  return;
46
+ if (!this.sandbox)
47
+ return;
45
48
  this.dispatchStart.doDispatch(container);
46
- let state = {};
47
- if (this.stateMachine.activeState && this.stateMachine.activeState) {
48
- state =
49
- (_b = (_a = this.stateMachine.getStateByID(this.stateMachine.activeState)) === null || _a === void 0 ? void 0 : _a.stateData) !== null && _b !== void 0 ? _b : {};
49
+ let state;
50
+ if (this.stateMachine.activeState) {
51
+ state = (_a = this.stateMachine.getStateByID(this.stateMachine.activeState)) === null || _a === void 0 ? void 0 : _a.stateData;
50
52
  }
51
53
  const hideNavigation = this.stateMachine.states.length <= 1;
52
54
  const hasNextSlide = this.stateMachine.nextState !== undefined;
@@ -57,13 +59,21 @@ class StartAppUCImp extends StartAppUC {
57
59
  hasNextSlide,
58
60
  hasPreviousSlide
59
61
  };
60
- (_c = this.dispatchSetState) === null || _c === void 0 ? void 0 : _c.doDispatch(dto);
62
+ (_b = this.dispatchSetState) === null || _b === void 0 ? void 0 : _b.doDispatch(dto);
61
63
  let isAuthoring = this.editStateEntity.isEditing;
62
64
  if (this.stateMachine.activeState === undefined) {
63
65
  isAuthoring = true;
64
66
  }
65
- (_d = this.dispatchSetIsAuthoring) === null || _d === void 0 ? void 0 : _d.doDispatch(isAuthoring);
66
- (_e = this.dispatchThemeColors) === null || _e === void 0 ? void 0 : _e.doDispatch();
67
+ (_c = this.dispatchSetIsAuthoring) === null || _c === void 0 ? void 0 : _c.doDispatch(isAuthoring);
68
+ (_d = this.dispatchThemeColors) === null || _d === void 0 ? void 0 : _d.doDispatch();
69
+ console.log(this.sandbox.enableDevFeatures);
70
+ console.log(this.sandbox.devFeatures);
71
+ if (this.sandbox.enableDevFeatures) {
72
+ this.sandbox.devFeatures.forEach((feature) => {
73
+ var _a;
74
+ (_a = this.dispatchEnableFeature) === null || _a === void 0 ? void 0 : _a.doDispatch(feature);
75
+ });
76
+ }
67
77
  };
68
78
  }
69
79
  get stateMachine() {
@@ -84,4 +94,10 @@ class StartAppUCImp extends StartAppUC {
84
94
  get dispatchThemeColors() {
85
95
  return this.getCachedLocalComponent(Dispatcher_1.DispatchThemeUC.type);
86
96
  }
97
+ get dispatchEnableFeature() {
98
+ return this.getCachedLocalComponent(Dispatcher_1.DispatchEnableFeatureUC.type);
99
+ }
100
+ get sandbox() {
101
+ return this.getCachedSingleton(AppSandbox_1.AppSandboxEntity.type);
102
+ }
87
103
  }
@@ -1,6 +1,6 @@
1
1
  import { HostAppObject, HostAppObjectRepo, HostAppObjectUC } from "../../../HostAppObject";
2
2
  export interface DispatchStateDTO {
3
- finalState: object;
3
+ finalState?: object;
4
4
  hideNavigation: boolean;
5
5
  hasNextSlide: boolean;
6
6
  hasPreviousSlide: boolean;
@@ -19,9 +19,9 @@ export interface SetStatePayloadV2 {
19
19
  duration?: number;
20
20
  }
21
21
  export interface SetStatePayloadV3 {
22
- finalState: object;
23
22
  hideNavigation: boolean;
24
23
  hasNextSlide: boolean;
25
24
  hasPreviousSlide: boolean;
26
25
  duration?: number;
26
+ finalState?: object;
27
27
  }
@@ -54,8 +54,9 @@ class DispatchSetStateUCImp extends DispatchSetStateUC {
54
54
  }
55
55
  dispatchV2(state, duration) {
56
56
  var _a;
57
+ const finalState = state ? JSON.stringify(state) : "";
57
58
  const payload = {
58
- finalState: JSON.stringify(state),
59
+ finalState,
59
60
  duration
60
61
  };
61
62
  (_a = this.dispatcher) === null || _a === void 0 ? void 0 : _a.formRequestAndDispatch(this.requestType, 2, payload);
@@ -4,6 +4,7 @@ exports.setupStandardHostDispatchers = void 0;
4
4
  const UCs_1 = require("./UCs");
5
5
  function setupStandardHostDispatchers(appObject) {
6
6
  UCs_1.makeDispatchDisposeAppUC(appObject);
7
+ UCs_1.makeDispatchEnableFeatureUC(appObject);
7
8
  UCs_1.makeDispatchIsAuthoringUC(appObject);
8
9
  UCs_1.makeDispatchSetStateUC(appObject);
9
10
  UCs_1.makeDispatchShowBabylonInspectorUC(appObject);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vived/host",
3
- "version": "3.10.0",
3
+ "version": "3.11.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",