@vived/app 4.11.2 → 4.11.3

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,9 @@
1
+ /// <reference types="jest" />
2
+ import { AppObjectRepo } from "../../../AppObject";
3
+ import { AppObject } from "../../../AppObject/AppObject";
4
+ import { GetAssetFolderURLUC } from "../UC";
5
+ export declare class MockGetAssetFolderURL extends GetAssetFolderURLUC {
6
+ doDispatch: jest.Mock<any, any>;
7
+ constructor(appObject: AppObject);
8
+ }
9
+ export declare function makeMockGetAssetFolderURL(appObjects: AppObjectRepo): MockGetAssetFolderURL;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeMockGetAssetFolderURL = exports.MockGetAssetFolderURL = void 0;
4
+ const UC_1 = require("../UC");
5
+ class MockGetAssetFolderURL extends UC_1.GetAssetFolderURLUC {
6
+ constructor(appObject) {
7
+ super(appObject, UC_1.GetAssetFolderURLUC.type);
8
+ this.doDispatch = jest.fn();
9
+ }
10
+ }
11
+ exports.MockGetAssetFolderURL = MockGetAssetFolderURL;
12
+ function makeMockGetAssetFolderURL(appObjects) {
13
+ return new MockGetAssetFolderURL(appObjects.getOrCreate("MockGetAssetFolderURL"));
14
+ }
15
+ exports.makeMockGetAssetFolderURL = makeMockGetAssetFolderURL;
@@ -39,31 +39,31 @@ class DispatchStateChangeUCImp extends DispatchStateChangeUC {
39
39
  this.getStateAssets = () => {
40
40
  return [];
41
41
  };
42
+ this.doDispatch = () => {
43
+ var _a;
44
+ const stateMachine = StateMachine_1.StateMachineEntity.get(this.appObject.appObjectRepo);
45
+ if (!stateMachine) {
46
+ this.warn("Could not find StateMachineEntity");
47
+ return;
48
+ }
49
+ const baseApp = App_1.BaseAppState.get(this.appObject.appObjectRepo);
50
+ if (!baseApp) {
51
+ this.warn("Could not find BaseAppState");
52
+ return;
53
+ }
54
+ if (!baseApp.isAuthoring)
55
+ return;
56
+ const payload = {
57
+ stateObject: stateMachine.getSerializedStates(),
58
+ assets: this.getStateAssets(),
59
+ validationErrorMessage: this.validateState(),
60
+ };
61
+ (_a = this.appDispatcher) === null || _a === void 0 ? void 0 : _a.formRequestAndDispatch(this.requestType, this.requestVersion, payload);
62
+ };
42
63
  this.appDispatcher = appObject.getComponent(AppDispatcher_1.AppDispatcher.type);
43
64
  if (!this.appDispatcher) {
44
65
  this.warn("DispatchStateChangeUC has been added to an App Object that does not have a AppDispatcher. Add a dispatcher first");
45
66
  this.dispose();
46
67
  }
47
68
  }
48
- doDispatch() {
49
- var _a;
50
- const stateMachine = StateMachine_1.StateMachineEntity.get(this.appObject.appObjectRepo);
51
- if (!stateMachine) {
52
- this.warn("Could not find StateMachineEntity");
53
- return;
54
- }
55
- const baseApp = App_1.BaseAppState.get(this.appObject.appObjectRepo);
56
- if (!baseApp) {
57
- this.warn("Could not find BaseAppState");
58
- return;
59
- }
60
- if (!baseApp.isAuthoring)
61
- return;
62
- const payload = {
63
- stateObject: stateMachine.getSerializedStates(),
64
- assets: this.getStateAssets(),
65
- validationErrorMessage: this.validateState(),
66
- };
67
- (_a = this.appDispatcher) === null || _a === void 0 ? void 0 : _a.formRequestAndDispatch(this.requestType, this.requestVersion, payload);
68
- }
69
69
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vived/app",
3
- "version": "4.11.2",
3
+ "version": "4.11.3",
4
4
  "description": "Public package for the VIVED Learning App system",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",