@vived/app 4.20.0 → 4.22.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.
Files changed (80) hide show
  1. package/lib/Components/ChannelModel/Adapters/activeModelAdapter.d.ts +2 -0
  2. package/lib/Components/ChannelModel/Adapters/activeModelAdapter.js +23 -0
  3. package/lib/Components/ChannelModel/Adapters/index.d.ts +1 -0
  4. package/lib/Components/ChannelModel/Adapters/index.js +1 -0
  5. package/lib/Components/ChannelModel/Controllers/clickSelectChannelModel.d.ts +2 -0
  6. package/lib/Components/ChannelModel/Controllers/clickSelectChannelModel.js +13 -0
  7. package/lib/Components/ChannelModel/Controllers/index.d.ts +1 -0
  8. package/lib/Components/ChannelModel/Controllers/index.js +1 -0
  9. package/lib/Components/ChannelModel/Entities/ChannelModelRepo.d.ts +2 -2
  10. package/lib/Components/ChannelModel/Entities/ChannelModelRepo.js +3 -3
  11. package/lib/Components/ChannelModel/Mocks/ActiveModelMock.d.ts +8 -0
  12. package/lib/Components/ChannelModel/Mocks/ActiveModelMock.js +15 -0
  13. package/lib/Components/ChannelModel/Mocks/LoadChannelModelMock.d.ts +9 -0
  14. package/lib/Components/ChannelModel/Mocks/LoadChannelModelMock.js +16 -0
  15. package/lib/Components/ChannelModel/Mocks/SelectChannelModelUCMock.d.ts +8 -0
  16. package/lib/Components/ChannelModel/Mocks/SelectChannelModelUCMock.js +15 -0
  17. package/lib/Components/ChannelModel/Mocks/index.d.ts +3 -0
  18. package/lib/Components/ChannelModel/Mocks/index.js +3 -0
  19. package/lib/Components/ChannelModel/PMs/ActiveModelPM.d.ts +13 -0
  20. package/lib/Components/ChannelModel/PMs/ActiveModelPM.js +36 -0
  21. package/lib/Components/ChannelModel/PMs/index.d.ts +1 -0
  22. package/lib/Components/ChannelModel/PMs/index.js +1 -0
  23. package/lib/Components/ChannelModel/UC/LoadChannelModelUC.d.ts +10 -0
  24. package/lib/Components/ChannelModel/UC/LoadChannelModelUC.js +132 -0
  25. package/lib/Components/ChannelModel/UC/SelectChannelModelUC.js +34 -34
  26. package/lib/Components/ChannelModel/UC/SerializeActiveModel.d.ts +26 -0
  27. package/lib/Components/ChannelModel/UC/SerializeActiveModel.js +80 -0
  28. package/lib/Components/ChannelModel/UC/index.d.ts +3 -0
  29. package/lib/Components/ChannelModel/UC/index.js +3 -0
  30. package/lib/Components/Dispatcher/Mocks/GetAssetBlobURLUCMock.d.ts +8 -0
  31. package/lib/Components/Dispatcher/Mocks/GetAssetBlobURLUCMock.js +15 -0
  32. package/lib/Components/Dispatcher/Mocks/GetLinkedAssetsUCMock.d.ts +8 -0
  33. package/lib/Components/Dispatcher/Mocks/GetLinkedAssetsUCMock.js +15 -0
  34. package/lib/Components/Dispatcher/Mocks/MockGetAssetFolderURL.d.ts +1 -1
  35. package/lib/Components/Dispatcher/Mocks/MockGetAssetFolderURL.js +3 -3
  36. package/lib/Components/Dispatcher/Mocks/MockShowAlert.d.ts +1 -1
  37. package/lib/Components/Dispatcher/Mocks/MockShowAlert.js +3 -3
  38. package/lib/Components/Dispatcher/Mocks/MockShowConfirm.d.ts +1 -1
  39. package/lib/Components/Dispatcher/Mocks/MockShowConfirm.js +3 -3
  40. package/lib/Components/Dispatcher/Mocks/MockShowMarkdown.d.ts +1 -1
  41. package/lib/Components/Dispatcher/Mocks/MockShowMarkdown.js +3 -3
  42. package/lib/Components/Dispatcher/Mocks/MockShowSpinner.d.ts +8 -0
  43. package/lib/Components/Dispatcher/Mocks/MockShowSpinner.js +15 -0
  44. package/lib/Components/Dispatcher/Mocks/MockSubmitResult.d.ts +1 -1
  45. package/lib/Components/Dispatcher/Mocks/MockSubmitResult.js +3 -3
  46. package/lib/Components/Dispatcher/Mocks/ShowSelectModelUCMock.d.ts +8 -0
  47. package/lib/Components/Dispatcher/Mocks/ShowSelectModelUCMock.js +15 -0
  48. package/lib/Components/Dispatcher/Mocks/index.d.ts +6 -1
  49. package/lib/Components/Dispatcher/Mocks/index.js +6 -1
  50. package/lib/Components/Dispatcher/UC/AppIsReadyUC.js +5 -5
  51. package/lib/Components/Dispatcher/UC/DispatchStartZSpaceUC.js +5 -5
  52. package/lib/Components/Dispatcher/UC/DispatchStateChangeUC.js +4 -4
  53. package/lib/Components/Dispatcher/UC/DispatchStopZSpaceUC.js +5 -5
  54. package/lib/Components/Dispatcher/UC/GetAssetBlobURLUC.js +21 -21
  55. package/lib/Components/Dispatcher/UC/GetAssetFolderURLUC.js +20 -20
  56. package/lib/Components/Dispatcher/UC/GetAssetMetaUC.js +21 -21
  57. package/lib/Components/Dispatcher/UC/GetAssetsForOwnerUC.js +21 -21
  58. package/lib/Components/Dispatcher/UC/GetLinkedAssetsUC.js +22 -22
  59. package/lib/Components/Dispatcher/UC/GoToNextStateUC.js +5 -5
  60. package/lib/Components/Dispatcher/UC/GoToPreviousStateUC.js +5 -5
  61. package/lib/Components/Dispatcher/UC/HasNextStateUC.js +15 -15
  62. package/lib/Components/Dispatcher/UC/HasPreviousStateUC.js +15 -15
  63. package/lib/Components/Dispatcher/UC/IsAssetFetchedUC.js +16 -16
  64. package/lib/Components/Dispatcher/UC/IsZSpaceAvailableUC.js +15 -15
  65. package/lib/Components/Dispatcher/UC/LogUC.js +12 -12
  66. package/lib/Components/Dispatcher/UC/RegisterExternalStylesheetsUC.js +7 -7
  67. package/lib/Components/Dispatcher/UC/RestoreCurrentStateUC.js +5 -5
  68. package/lib/Components/Dispatcher/UC/ShowAlertUC.js +11 -11
  69. package/lib/Components/Dispatcher/UC/ShowConfirmUC.js +13 -13
  70. package/lib/Components/Dispatcher/UC/ShowMarkdownEditorUC.js +13 -13
  71. package/lib/Components/Dispatcher/UC/ShowSelectModelUC.js +15 -15
  72. package/lib/Components/Dispatcher/UC/StateIsCompleteUC.js +5 -5
  73. package/lib/Components/Dispatcher/UC/SubmitActivityAssetUC.js +21 -21
  74. package/lib/Components/Dispatcher/UC/SubmitResultResultUC.js +69 -69
  75. package/lib/Components/Dispatcher/index.d.ts +1 -0
  76. package/lib/Components/Dispatcher/index.js +1 -0
  77. package/lib/Components/GLBModel/Mocks/LoadGlbFileUCMock.d.ts +1 -0
  78. package/lib/Components/GLBModel/Mocks/LoadGlbFileUCMock.js +1 -0
  79. package/lib/Components/GLBModel/UCs/LoadGlbFileUC.d.ts +1 -0
  80. package/package.json +1 -1
@@ -21,25 +21,25 @@ class DispatchStateChangeUCImp extends HasNextStateUC {
21
21
  constructor(appObject) {
22
22
  super(appObject, HasNextStateUC.type);
23
23
  this.requestVersion = 1;
24
+ this.doDispatch = () => {
25
+ return new Promise((resolve, reject) => {
26
+ const callback = (hasNextState) => {
27
+ resolve(hasNextState);
28
+ };
29
+ const payload = {
30
+ callback,
31
+ };
32
+ if (!this.appDispatcher)
33
+ return reject(new Error("No host handler has been registered"));
34
+ else {
35
+ this.appDispatcher.formRequestAndDispatch(this.requestType, this.requestVersion, payload);
36
+ }
37
+ });
38
+ };
24
39
  this.appDispatcher = appObject.getComponent(AppDispatcher_1.AppDispatcher.type);
25
40
  if (!this.appDispatcher) {
26
41
  this.warn("HasNextStateUC has been added to an App Object that does not have a AppDispatcher. Add a dispatcher first");
27
42
  this.dispose();
28
43
  }
29
44
  }
30
- doDispatch() {
31
- return new Promise((resolve, reject) => {
32
- const callback = (hasNextState) => {
33
- resolve(hasNextState);
34
- };
35
- const payload = {
36
- callback,
37
- };
38
- if (!this.appDispatcher)
39
- return reject(new Error("No host handler has been registered"));
40
- else {
41
- this.appDispatcher.formRequestAndDispatch(this.requestType, this.requestVersion, payload);
42
- }
43
- });
44
- }
45
45
  }
@@ -21,25 +21,25 @@ class DispatchStateChangeUCImp extends HasPreviousStateUC {
21
21
  constructor(appObject) {
22
22
  super(appObject, HasPreviousStateUC.type);
23
23
  this.requestVersion = 1;
24
+ this.doDispatch = () => {
25
+ return new Promise((resolve, reject) => {
26
+ const callback = (hasNextState) => {
27
+ resolve(hasNextState);
28
+ };
29
+ const payload = {
30
+ callback,
31
+ };
32
+ if (!this.appDispatcher)
33
+ return reject(new Error("No host handler has been registered"));
34
+ else {
35
+ this.appDispatcher.formRequestAndDispatch(this.requestType, this.requestVersion, payload);
36
+ }
37
+ });
38
+ };
24
39
  this.appDispatcher = appObject.getComponent(AppDispatcher_1.AppDispatcher.type);
25
40
  if (!this.appDispatcher) {
26
41
  console.warn("HasPreviousStateUC has been added to an App Object that does not have a AppDispatcher. Add a dispatcher first");
27
42
  this.dispose();
28
43
  }
29
44
  }
30
- doDispatch() {
31
- return new Promise((resolve, reject) => {
32
- const callback = (hasNextState) => {
33
- resolve(hasNextState);
34
- };
35
- const payload = {
36
- callback,
37
- };
38
- if (!this.appDispatcher)
39
- return reject(new Error("No host handler has been registered"));
40
- else {
41
- this.appDispatcher.formRequestAndDispatch(this.requestType, this.requestVersion, payload);
42
- }
43
- });
44
- }
45
45
  }
@@ -32,26 +32,26 @@ class GetAppAssetsURLUCImp extends IsAssetFetchedUC {
32
32
  constructor(appObject) {
33
33
  super(appObject, IsAssetFetchedUC.type);
34
34
  this.requestVersion = 1;
35
+ this.doDispatch = (assetID) => {
36
+ return new Promise((resolve, reject) => {
37
+ const callback = (isFetched) => {
38
+ resolve(isFetched);
39
+ };
40
+ const payload = {
41
+ assetID,
42
+ callback,
43
+ };
44
+ if (!this.appDispatcher)
45
+ return reject(new Error("No host handler has been registered"));
46
+ else {
47
+ this.appDispatcher.formRequestAndDispatch(this.requestType, this.requestVersion, payload);
48
+ }
49
+ });
50
+ };
35
51
  this.appDispatcher = appObject.getComponent(AppDispatcher_1.AppDispatcher.type);
36
52
  if (!this.appDispatcher) {
37
53
  this.warn("IsAssetFetchedUC has been added to an App Object that does not have a AppDispatcher. Add a dispatcher first");
38
54
  this.dispose();
39
55
  }
40
56
  }
41
- doDispatch(assetID) {
42
- return new Promise((resolve, reject) => {
43
- const callback = (isFetched) => {
44
- resolve(isFetched);
45
- };
46
- const payload = {
47
- assetID,
48
- callback,
49
- };
50
- if (!this.appDispatcher)
51
- return reject(new Error("No host handler has been registered"));
52
- else {
53
- this.appDispatcher.formRequestAndDispatch(this.requestType, this.requestVersion, payload);
54
- }
55
- });
56
- }
57
57
  }
@@ -21,25 +21,25 @@ class DispatchStateChangeUCImp extends IsZSpaceAvailableUC {
21
21
  constructor(appObject) {
22
22
  super(appObject, IsZSpaceAvailableUC.type);
23
23
  this.requestVersion = 1;
24
+ this.doDispatch = () => {
25
+ return new Promise((resolve, reject) => {
26
+ const callback = (IsZSpaceAvailable) => {
27
+ resolve(IsZSpaceAvailable);
28
+ };
29
+ const payload = {
30
+ callback,
31
+ };
32
+ if (!this.appDispatcher)
33
+ return reject(new Error("No host handler has been registered"));
34
+ else {
35
+ this.appDispatcher.formRequestAndDispatch(this.requestType, this.requestVersion, payload);
36
+ }
37
+ });
38
+ };
24
39
  this.appDispatcher = appObject.getComponent(AppDispatcher_1.AppDispatcher.type);
25
40
  if (!this.appDispatcher) {
26
41
  this.warn("IsZSpaceAvailableUC has been added to an App Object that does not have a AppDispatcher. Add a dispatcher first");
27
42
  this.dispose();
28
43
  }
29
44
  }
30
- doDispatch() {
31
- return new Promise((resolve, reject) => {
32
- const callback = (IsZSpaceAvailable) => {
33
- resolve(IsZSpaceAvailable);
34
- };
35
- const payload = {
36
- callback,
37
- };
38
- if (!this.appDispatcher)
39
- return reject(new Error("No host handler has been registered"));
40
- else {
41
- this.appDispatcher.formRequestAndDispatch(this.requestType, this.requestVersion, payload);
42
- }
43
- });
44
- }
45
45
  }
@@ -21,23 +21,23 @@ class LogUCImp extends LogUC {
21
21
  constructor(appObject) {
22
22
  super(appObject, LogUC.type);
23
23
  this.requestVersion = 1;
24
+ this.dispatchLog = (sender, message) => {
25
+ this.doDispatch(sender, message, "LOG");
26
+ };
27
+ this.dispatchWarn = (sender, message) => {
28
+ this.doDispatch(sender, message, "WARNING");
29
+ };
30
+ this.dispatchError = (sender, message) => {
31
+ this.doDispatch(sender, message, "ERROR");
32
+ };
33
+ this.dispatchFatal = (sender, message) => {
34
+ this.doDispatch(sender, message, "FATAL");
35
+ };
24
36
  this.appDispatcher = appObject.getComponent(AppDispatcher_1.AppDispatcher.type);
25
37
  if (!this.appDispatcher) {
26
38
  this.warn(`${LogUC.type} has been added to an App Object that does not have a AppDispatcher. Add a dispatcher first`);
27
39
  }
28
40
  }
29
- dispatchLog(sender, message) {
30
- this.doDispatch(sender, message, "LOG");
31
- }
32
- dispatchWarn(sender, message) {
33
- this.doDispatch(sender, message, "WARNING");
34
- }
35
- dispatchError(sender, message) {
36
- this.doDispatch(sender, message, "ERROR");
37
- }
38
- dispatchFatal(sender, message) {
39
- this.doDispatch(sender, message, "FATAL");
40
- }
41
41
  doDispatch(sender, message, severity) {
42
42
  if (!this.appDispatcher)
43
43
  return;
@@ -31,17 +31,17 @@ class RegisterExternalStylesheetsUCImp extends RegisterExternalStylesheetsUC {
31
31
  constructor(appObject) {
32
32
  super(appObject, RegisterExternalStylesheetsUC.type);
33
33
  this.requestVersion = 1;
34
+ this.doDispatch = (stylesheets) => {
35
+ var _a;
36
+ const payload = {
37
+ stylesheets,
38
+ };
39
+ (_a = this.appDispatcher) === null || _a === void 0 ? void 0 : _a.formRequestAndDispatch(this.requestType, this.requestVersion, payload);
40
+ };
34
41
  this.appDispatcher = appObject.getComponent(AppDispatcher_1.AppDispatcher.type);
35
42
  if (!this.appDispatcher) {
36
43
  this.warn("DispatchStateChangeUC has been added to an App Object that does not have a AppDispatcher. Add a dispatcher first");
37
44
  this.dispose();
38
45
  }
39
46
  }
40
- doDispatch(stylesheets) {
41
- var _a;
42
- const payload = {
43
- stylesheets,
44
- };
45
- (_a = this.appDispatcher) === null || _a === void 0 ? void 0 : _a.formRequestAndDispatch(this.requestType, this.requestVersion, payload);
46
- }
47
47
  }
@@ -21,15 +21,15 @@ class DispatchStateChangeUCImp extends RestoreCurrentStateUC {
21
21
  constructor(appObject) {
22
22
  super(appObject, RestoreCurrentStateUC.type);
23
23
  this.requestVersion = 1;
24
+ this.doDispatch = () => {
25
+ if (!this.appDispatcher)
26
+ return;
27
+ this.appDispatcher.formRequestAndDispatch(this.requestType, this.requestVersion);
28
+ };
24
29
  this.appDispatcher = appObject.getComponent(AppDispatcher_1.AppDispatcher.type);
25
30
  if (!this.appDispatcher) {
26
31
  this.warn("RestoreCurrentStateUC has been added to an App Object that does not have a AppDispatcher. Add a dispatcher first");
27
32
  this.dispose();
28
33
  }
29
34
  }
30
- doDispatch() {
31
- if (!this.appDispatcher)
32
- return;
33
- this.appDispatcher.formRequestAndDispatch(this.requestType, this.requestVersion);
34
- }
35
35
  }
@@ -21,21 +21,21 @@ class ShowAlertUCImp extends ShowAlertUC {
21
21
  constructor(appObject) {
22
22
  super(appObject, ShowAlertUC.type);
23
23
  this.requestVersion = 1;
24
+ this.showAlert = (data) => {
25
+ if (!this.appDispatcher)
26
+ return;
27
+ const payload = {
28
+ title: data.title,
29
+ message: data.message,
30
+ closeButtonLabel: data.closeButtonLabel,
31
+ closeCallback: data.closeCallback,
32
+ };
33
+ this.appDispatcher.formRequestAndDispatch(this.requestType, this.requestVersion, payload);
34
+ };
24
35
  this.appDispatcher = appObject.getComponent(AppDispatcher_1.AppDispatcher.type);
25
36
  if (!this.appDispatcher) {
26
37
  this.warn(`${ShowAlertUC.type} has been added to an App Object that does not have a AppDispatcher. Add a dispatcher first`);
27
38
  this.dispose();
28
39
  }
29
40
  }
30
- showAlert(data) {
31
- if (!this.appDispatcher)
32
- return;
33
- const payload = {
34
- title: data.title,
35
- message: data.message,
36
- closeButtonLabel: data.closeButtonLabel,
37
- closeCallback: data.closeCallback,
38
- };
39
- this.appDispatcher.formRequestAndDispatch(this.requestType, this.requestVersion, payload);
40
- }
41
41
  }
@@ -21,23 +21,23 @@ class ShowAlertUCImp extends ShowConfirmUC {
21
21
  constructor(appObject) {
22
22
  super(appObject, ShowConfirmUC.type);
23
23
  this.requestVersion = 1;
24
+ this.showConfirm = (data) => {
25
+ if (!this.appDispatcher)
26
+ return;
27
+ const payload = {
28
+ title: data.title,
29
+ message: data.message,
30
+ confirmCallback: data.confirmCallback,
31
+ cancelButtonLabel: data.cancelButtonLabel,
32
+ cancelCallback: data.cancelCallback,
33
+ confirmButtonLabel: data.confirmButtonLabel,
34
+ };
35
+ this.appDispatcher.formRequestAndDispatch(this.requestType, this.requestVersion, payload);
36
+ };
24
37
  this.appDispatcher = appObject.getComponent(AppDispatcher_1.AppDispatcher.type);
25
38
  if (!this.appDispatcher) {
26
39
  this.warn(`${ShowConfirmUC.type} has been added to an App Object that does not have a AppDispatcher. Add a dispatcher first`);
27
40
  this.dispose();
28
41
  }
29
42
  }
30
- showConfirm(data) {
31
- if (!this.appDispatcher)
32
- return;
33
- const payload = {
34
- title: data.title,
35
- message: data.message,
36
- confirmCallback: data.confirmCallback,
37
- cancelButtonLabel: data.cancelButtonLabel,
38
- cancelCallback: data.cancelCallback,
39
- confirmButtonLabel: data.confirmButtonLabel,
40
- };
41
- this.appDispatcher.formRequestAndDispatch(this.requestType, this.requestVersion, payload);
42
- }
43
43
  }
@@ -21,23 +21,23 @@ class ShowMarkdownEditorUCImp extends ShowMarkdownEditorUC {
21
21
  constructor(appObject) {
22
22
  super(appObject, ShowMarkdownEditorUC.type);
23
23
  this.requestVersion = 1;
24
+ this.showMarkdownEditor = (data) => {
25
+ var _a;
26
+ if (!this.appDispatcher)
27
+ return;
28
+ const payload = {
29
+ initialText: (_a = data.initialText) !== null && _a !== void 0 ? _a : "",
30
+ submitCallback: data.submitCallback,
31
+ };
32
+ if (data.validateString) {
33
+ payload.validateString = data.validateString;
34
+ }
35
+ this.appDispatcher.formRequestAndDispatch(this.requestType, this.requestVersion, payload);
36
+ };
24
37
  this.appDispatcher = appObject.getComponent(AppDispatcher_1.AppDispatcher.type);
25
38
  if (!this.appDispatcher) {
26
39
  console.warn(`${ShowMarkdownEditorUC.type} has been added to an App Object that does not have a AppDispatcher. Add a dispatcher first`);
27
40
  this.dispose();
28
41
  }
29
42
  }
30
- showMarkdownEditor(data) {
31
- var _a;
32
- if (!this.appDispatcher)
33
- return;
34
- const payload = {
35
- initialText: (_a = data.initialText) !== null && _a !== void 0 ? _a : "",
36
- submitCallback: data.submitCallback,
37
- };
38
- if (data.validateString) {
39
- payload.validateString = data.validateString;
40
- }
41
- this.appDispatcher.formRequestAndDispatch(this.requestType, this.requestVersion, payload);
42
- }
43
43
  }
@@ -21,25 +21,25 @@ class ShowSelectModelUCImp extends ShowSelectModelUC {
21
21
  constructor(appObject) {
22
22
  super(appObject, ShowSelectModelUC.type);
23
23
  this.requestVersion = 1;
24
+ this.doDispatch = () => {
25
+ return new Promise((resolve, reject) => {
26
+ const callback = (modelId, dataId) => {
27
+ resolve({ modelId, dataId });
28
+ };
29
+ const payload = {
30
+ callback,
31
+ };
32
+ if (!this.appDispatcher)
33
+ return reject(new Error("No host handler has been registered"));
34
+ else {
35
+ this.appDispatcher.formRequestAndDispatch(this.requestType, this.requestVersion, payload);
36
+ }
37
+ });
38
+ };
24
39
  this.appDispatcher = appObject.getComponent(AppDispatcher_1.AppDispatcher.type);
25
40
  if (!this.appDispatcher) {
26
41
  this.warn(`${ShowSelectModelUC.type} has been added to an App Object that does not have a AppDispatcher. Add a dispatcher first`);
27
42
  this.dispose();
28
43
  }
29
44
  }
30
- doDispatch() {
31
- return new Promise((resolve, reject) => {
32
- const callback = (modelId, dataId) => {
33
- resolve({ modelId, dataId });
34
- };
35
- const payload = {
36
- callback,
37
- };
38
- if (!this.appDispatcher)
39
- return reject(new Error("No host handler has been registered"));
40
- else {
41
- this.appDispatcher.formRequestAndDispatch(this.requestType, this.requestVersion, payload);
42
- }
43
- });
44
- }
45
45
  }
@@ -31,15 +31,15 @@ class StateIsCompleteUCImp extends StateIsCompleteUC {
31
31
  constructor(appObject) {
32
32
  super(appObject, StateIsCompleteUC.type);
33
33
  this.requestVersion = 1;
34
+ this.doDispatch = () => {
35
+ if (!this.appDispatcher)
36
+ return;
37
+ this.appDispatcher.formRequestAndDispatch(this.requestType, this.requestVersion);
38
+ };
34
39
  this.appDispatcher = appObject.getComponent(AppDispatcher_1.AppDispatcher.type);
35
40
  if (!this.appDispatcher) {
36
41
  this.warn("GoToNextStateUC has been added to an App Object that does not have a AppDispatcher. Add a dispatcher first");
37
42
  this.dispose();
38
43
  }
39
44
  }
40
- doDispatch() {
41
- if (!this.appDispatcher)
42
- return;
43
- this.appDispatcher.formRequestAndDispatch(this.requestType, this.requestVersion);
44
- }
45
45
  }
@@ -31,6 +31,27 @@ class SubmitActivityAssetUCImp extends SubmitActivityAssetUC {
31
31
  constructor(appObject) {
32
32
  super(appObject, SubmitActivityAssetUC.type);
33
33
  this.requestVersion = 1;
34
+ this.doDispatch = (assetFile) => {
35
+ return new Promise((resolve, reject) => {
36
+ const callback = (assetID) => {
37
+ if (assetID === undefined) {
38
+ reject(exports.NO_ASSET_ID_ERROR);
39
+ }
40
+ else {
41
+ resolve(assetID);
42
+ }
43
+ };
44
+ const payload = {
45
+ assetFile,
46
+ callback
47
+ };
48
+ if (!this.appDispatcher)
49
+ return reject(new Error("No host handler has been registered"));
50
+ else {
51
+ this.appDispatcher.formRequestAndDispatch(this.requestType, this.requestVersion, payload);
52
+ }
53
+ });
54
+ };
34
55
  this.appDispatcher = appObject.getComponent(Entities_1.AppDispatcher.type);
35
56
  if (!this.appDispatcher) {
36
57
  this.warn("SubmitActivityAssetUC has been added to an App Object that does not have a AppDispatcher. Add a dispatcher first");
@@ -38,26 +59,5 @@ class SubmitActivityAssetUCImp extends SubmitActivityAssetUC {
38
59
  }
39
60
  this.appObjects.registerSingleton(this);
40
61
  }
41
- doDispatch(assetFile) {
42
- return new Promise((resolve, reject) => {
43
- const callback = (assetID) => {
44
- if (assetID === undefined) {
45
- reject(exports.NO_ASSET_ID_ERROR);
46
- }
47
- else {
48
- resolve(assetID);
49
- }
50
- };
51
- const payload = {
52
- assetFile,
53
- callback
54
- };
55
- if (!this.appDispatcher)
56
- return reject(new Error("No host handler has been registered"));
57
- else {
58
- this.appDispatcher.formRequestAndDispatch(this.requestType, this.requestVersion, payload);
59
- }
60
- });
61
- }
62
62
  }
63
63
  exports.NO_ASSET_ID_ERROR = new Error("Asset ID is undefined");
@@ -71,79 +71,79 @@ class SubmitResultResultUCImp extends SubmitResultResultUC {
71
71
  constructor(appObject) {
72
72
  super(appObject, SubmitResultResultUC.type);
73
73
  this.requestVersion = 3;
74
- this.appDispatcher = appObject.getComponent(AppDispatcher_1.AppDispatcher.type);
75
- if (!this.appDispatcher) {
76
- this.warn("DispatchStateChangeUC has been added to an App Object that does not have a AppDispatcher. Add a dispatcher first");
77
- this.dispose();
78
- }
79
- }
80
- submitHitResult(data) {
81
- if (!this.appDispatcher)
82
- return;
83
- const { description, success } = data;
84
- const payload = {
85
- resultType: "HIT_V1",
86
- description,
87
- result: {
88
- success,
89
- },
74
+ this.submitHitResult = (data) => {
75
+ if (!this.appDispatcher)
76
+ return;
77
+ const { description, success } = data;
78
+ const payload = {
79
+ resultType: "HIT_V1",
80
+ description,
81
+ result: {
82
+ success,
83
+ },
84
+ };
85
+ this.appDispatcher.formRequestAndDispatch("SUBMIT_RESULTS", 3, payload);
90
86
  };
91
- this.appDispatcher.formRequestAndDispatch("SUBMIT_RESULTS", 3, payload);
92
- }
93
- submitProgressResult(data) {
94
- if (!this.appDispatcher)
95
- return;
96
- const { description, progress } = data;
97
- const payload = {
98
- resultType: "PROGRESS_V1",
99
- description,
100
- result: {
101
- progress,
102
- },
87
+ this.submitProgressResult = (data) => {
88
+ if (!this.appDispatcher)
89
+ return;
90
+ const { description, progress } = data;
91
+ const payload = {
92
+ resultType: "PROGRESS_V1",
93
+ description,
94
+ result: {
95
+ progress,
96
+ },
97
+ };
98
+ this.appDispatcher.formRequestAndDispatch("SUBMIT_RESULTS", 3, payload);
103
99
  };
104
- this.appDispatcher.formRequestAndDispatch("SUBMIT_RESULTS", 3, payload);
105
- }
106
- submitMultiHitResult(data) {
107
- if (!this.appDispatcher)
108
- return;
109
- const { description, hits, misses, unanswered } = data;
110
- const payload = {
111
- resultType: "MULTIHIT_V1",
112
- description,
113
- result: {
114
- hits,
115
- misses,
116
- unanswered,
117
- },
100
+ this.submitMultiHitResult = (data) => {
101
+ if (!this.appDispatcher)
102
+ return;
103
+ const { description, hits, misses, unanswered } = data;
104
+ const payload = {
105
+ resultType: "MULTIHIT_V1",
106
+ description,
107
+ result: {
108
+ hits,
109
+ misses,
110
+ unanswered,
111
+ },
112
+ };
113
+ this.appDispatcher.formRequestAndDispatch("SUBMIT_RESULTS", 3, payload);
118
114
  };
119
- this.appDispatcher.formRequestAndDispatch("SUBMIT_RESULTS", 3, payload);
120
- }
121
- submitQualityResult(data) {
122
- if (!this.appDispatcher)
123
- return;
124
- const { description, stars, maxStars } = data;
125
- const payload = {
126
- resultType: "QUALITY_V1",
127
- description,
128
- result: {
129
- stars,
130
- maxStars,
131
- },
115
+ this.submitQualityResult = (data) => {
116
+ if (!this.appDispatcher)
117
+ return;
118
+ const { description, stars, maxStars } = data;
119
+ const payload = {
120
+ resultType: "QUALITY_V1",
121
+ description,
122
+ result: {
123
+ stars,
124
+ maxStars,
125
+ },
126
+ };
127
+ this.appDispatcher.formRequestAndDispatch("SUBMIT_RESULTS", 3, payload);
132
128
  };
133
- this.appDispatcher.formRequestAndDispatch("SUBMIT_RESULTS", 3, payload);
134
- }
135
- submitScoreResult(data) {
136
- if (!this.appDispatcher)
137
- return;
138
- const { description, score, maxScore } = data;
139
- const payload = {
140
- resultType: "SCORE_V1",
141
- description,
142
- result: {
143
- score,
144
- maxScore,
145
- },
129
+ this.submitScoreResult = (data) => {
130
+ if (!this.appDispatcher)
131
+ return;
132
+ const { description, score, maxScore } = data;
133
+ const payload = {
134
+ resultType: "SCORE_V1",
135
+ description,
136
+ result: {
137
+ score,
138
+ maxScore,
139
+ },
140
+ };
141
+ this.appDispatcher.formRequestAndDispatch("SUBMIT_RESULTS", 3, payload);
146
142
  };
147
- this.appDispatcher.formRequestAndDispatch("SUBMIT_RESULTS", 3, payload);
143
+ this.appDispatcher = appObject.getComponent(AppDispatcher_1.AppDispatcher.type);
144
+ if (!this.appDispatcher) {
145
+ this.warn("DispatchStateChangeUC has been added to an App Object that does not have a AppDispatcher. Add a dispatcher first");
146
+ this.dispose();
147
+ }
148
148
  }
149
149
  }
@@ -1,3 +1,4 @@
1
1
  export * from "./Controllers";
2
2
  export * from "./Entities";
3
+ export * from "./Mocks";
3
4
  export * from "./UC";
@@ -12,4 +12,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  __exportStar(require("./Controllers"), exports);
14
14
  __exportStar(require("./Entities"), exports);
15
+ __exportStar(require("./Mocks"), exports);
15
16
  __exportStar(require("./UC"), exports);
@@ -2,6 +2,7 @@
2
2
  import { AppObject, AppObjectRepo } from "../../../AppObject";
3
3
  import { LoadGlbFileUC } from "../UCs/LoadGlbFileUC";
4
4
  export declare class LoadGlbFileUCMock extends LoadGlbFileUC {
5
+ loadBlobURL: jest.Mock<any, any>;
5
6
  loadFile: jest.Mock<any, any>;
6
7
  constructor(appObject: AppObject);
7
8
  }
@@ -5,6 +5,7 @@ const LoadGlbFileUC_1 = require("../UCs/LoadGlbFileUC");
5
5
  class LoadGlbFileUCMock extends LoadGlbFileUC_1.LoadGlbFileUC {
6
6
  constructor(appObject) {
7
7
  super(appObject, LoadGlbFileUC_1.LoadGlbFileUC.type);
8
+ this.loadBlobURL = jest.fn().mockResolvedValue(undefined);
8
9
  this.loadFile = jest.fn().mockResolvedValue(undefined);
9
10
  }
10
11
  }