@vived/host 3.1.0 → 3.3.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 (182) hide show
  1. package/lib/Components/Apps/Adapters/activeAppPMAdapter.d.ts +3 -0
  2. package/lib/Components/Apps/Adapters/activeAppPMAdapter.js +23 -0
  3. package/lib/Components/Apps/Adapters/appListPMAdapter.d.ts +2 -0
  4. package/lib/Components/Apps/Adapters/appListPMAdapter.js +23 -0
  5. package/lib/Components/Apps/Adapters/appPMAdapter.d.ts +3 -0
  6. package/lib/Components/Apps/Adapters/appPMAdapter.js +23 -0
  7. package/lib/Components/Apps/Adapters/index.d.ts +3 -0
  8. package/lib/Components/Apps/Adapters/index.js +15 -0
  9. package/lib/Components/Apps/Controllers/index.d.ts +1 -0
  10. package/lib/Components/Apps/Controllers/index.js +13 -0
  11. package/lib/Components/Apps/Controllers/updateApp.d.ts +2 -0
  12. package/lib/Components/Apps/Controllers/updateApp.js +13 -0
  13. package/lib/Components/Apps/Entities/AppEntity.d.ts +28 -0
  14. package/lib/Components/Apps/Entities/AppEntity.js +93 -0
  15. package/lib/Components/Apps/Entities/AppRepo.d.ts +19 -0
  16. package/lib/Components/Apps/Entities/AppRepo.js +57 -0
  17. package/lib/Components/Apps/Entities/index.d.ts +2 -0
  18. package/lib/Components/Apps/Entities/index.js +14 -0
  19. package/lib/Components/Apps/Mocks/MockActiveAppPM.d.ts +8 -0
  20. package/lib/Components/Apps/Mocks/MockActiveAppPM.js +15 -0
  21. package/lib/Components/Apps/Mocks/MockAppListPM.d.ts +8 -0
  22. package/lib/Components/Apps/Mocks/MockAppListPM.js +15 -0
  23. package/lib/Components/Apps/Mocks/MockAppMounterUC.d.ts +10 -0
  24. package/lib/Components/Apps/Mocks/MockAppMounterUC.js +14 -0
  25. package/lib/Components/Apps/Mocks/MockAppPM.d.ts +7 -0
  26. package/lib/Components/Apps/Mocks/MockAppPM.js +11 -0
  27. package/lib/Components/Apps/Mocks/MockStartAppUC.d.ts +7 -0
  28. package/lib/Components/Apps/Mocks/MockStartAppUC.js +11 -0
  29. package/lib/Components/Apps/Mocks/MockStopAppUC.d.ts +7 -0
  30. package/lib/Components/Apps/Mocks/MockStopAppUC.js +11 -0
  31. package/lib/Components/Apps/Mocks/MockUpdateAppUC.d.ts +7 -0
  32. package/lib/Components/Apps/Mocks/MockUpdateAppUC.js +11 -0
  33. package/lib/Components/Apps/Mocks/index.d.ts +7 -0
  34. package/lib/Components/Apps/Mocks/index.js +19 -0
  35. package/lib/Components/Apps/PMs/ActiveAppPM.d.ts +10 -0
  36. package/lib/Components/Apps/PMs/ActiveAppPM.js +15 -0
  37. package/lib/Components/Apps/PMs/AppPM.d.ts +13 -0
  38. package/lib/Components/Apps/PMs/AppPM.js +57 -0
  39. package/lib/Components/Apps/PMs/AppsListPM.d.ts +6 -0
  40. package/lib/Components/Apps/PMs/AppsListPM.js +51 -0
  41. package/lib/Components/Apps/PMs/index.d.ts +3 -0
  42. package/lib/Components/Apps/PMs/index.js +15 -0
  43. package/lib/Components/Apps/UCs/MounterUC.d.ts +12 -0
  44. package/lib/Components/Apps/UCs/MounterUC.js +15 -0
  45. package/lib/Components/Apps/UCs/StartAppUC.d.ts +8 -0
  46. package/lib/Components/Apps/UCs/StartAppUC.js +27 -0
  47. package/lib/Components/Apps/UCs/StopAppUC.d.ts +8 -0
  48. package/lib/Components/Apps/UCs/StopAppUC.js +27 -0
  49. package/lib/Components/Apps/UCs/UpdateAppUC.d.ts +7 -0
  50. package/lib/Components/Apps/UCs/UpdateAppUC.js +23 -0
  51. package/lib/Components/Apps/UCs/appIDWithVersion.d.ts +3 -0
  52. package/lib/Components/Apps/UCs/appIDWithVersion.js +8 -0
  53. package/lib/Components/Apps/UCs/index.d.ts +5 -0
  54. package/lib/Components/Apps/UCs/index.js +17 -0
  55. package/lib/Components/Apps/index.d.ts +6 -0
  56. package/lib/Components/Apps/index.js +18 -0
  57. package/lib/Components/AssetPlugin/Adapters/assetPluginPMAdapter.d.ts +3 -0
  58. package/lib/Components/AssetPlugin/Adapters/assetPluginPMAdapter.js +23 -0
  59. package/lib/Components/AssetPlugin/Adapters/index.d.ts +1 -0
  60. package/lib/Components/AssetPlugin/Adapters/index.js +13 -0
  61. package/lib/Components/AssetPlugin/Controllers/clearAssetPluginContainer.d.ts +2 -0
  62. package/lib/Components/AssetPlugin/Controllers/clearAssetPluginContainer.js +14 -0
  63. package/lib/Components/AssetPlugin/Controllers/index.d.ts +2 -0
  64. package/lib/Components/AssetPlugin/Controllers/index.js +14 -0
  65. package/lib/Components/AssetPlugin/Controllers/setAssetPluginContainer.d.ts +2 -0
  66. package/lib/Components/AssetPlugin/Controllers/setAssetPluginContainer.js +14 -0
  67. package/lib/Components/AssetPlugin/Entities/AssetPluginEntity.d.ts +14 -0
  68. package/lib/Components/AssetPlugin/Entities/AssetPluginEntity.js +40 -0
  69. package/lib/Components/AssetPlugin/Entities/index.d.ts +1 -0
  70. package/lib/Components/AssetPlugin/Entities/index.js +13 -0
  71. package/lib/Components/AssetPlugin/Mocks/MockAssetPluginContainerUC.d.ts +9 -0
  72. package/lib/Components/AssetPlugin/Mocks/MockAssetPluginContainerUC.js +16 -0
  73. package/lib/Components/AssetPlugin/Mocks/MockAssetPluginPM.d.ts +8 -0
  74. package/lib/Components/AssetPlugin/Mocks/MockAssetPluginPM.js +15 -0
  75. package/lib/Components/AssetPlugin/Mocks/index.d.ts +2 -0
  76. package/lib/Components/AssetPlugin/Mocks/index.js +14 -0
  77. package/lib/Components/AssetPlugin/PM/AssetPluginPM.d.ts +12 -0
  78. package/lib/Components/AssetPlugin/PM/AssetPluginPM.js +68 -0
  79. package/lib/Components/AssetPlugin/PM/index.d.ts +1 -0
  80. package/lib/Components/AssetPlugin/PM/index.js +13 -0
  81. package/lib/Components/AssetPlugin/UCs/AssetPluginContainerUC.d.ts +7 -0
  82. package/lib/Components/AssetPlugin/UCs/AssetPluginContainerUC.js +11 -0
  83. package/lib/Components/AssetPlugin/UCs/index.d.ts +1 -0
  84. package/lib/Components/AssetPlugin/UCs/index.js +13 -0
  85. package/lib/Components/AssetPlugin/index.d.ts +6 -0
  86. package/lib/Components/AssetPlugin/index.js +18 -0
  87. package/lib/Components/Assets/UCs/ArchiveAssetUC.js +6 -16
  88. package/lib/Components/Assets/UCs/DeleteAssetUC.js +7 -19
  89. package/lib/Components/Assets/UCs/DownloadAssetFileUC.js +5 -13
  90. package/lib/Components/Assets/UCs/UpdateAssetFileUC.js +5 -13
  91. package/lib/Components/Dialog/Adapters/alertDialogAdapter.d.ts +3 -0
  92. package/lib/Components/Dialog/Adapters/alertDialogAdapter.js +23 -0
  93. package/lib/Components/Dialog/Adapters/confirmDialogAdapter.d.ts +3 -0
  94. package/lib/Components/Dialog/Adapters/confirmDialogAdapter.js +23 -0
  95. package/lib/Components/Dialog/Adapters/dialogQueueAdapter.d.ts +3 -0
  96. package/lib/Components/Dialog/Adapters/dialogQueueAdapter.js +23 -0
  97. package/lib/Components/Dialog/Adapters/index.d.ts +5 -0
  98. package/lib/Components/Dialog/Adapters/index.js +17 -0
  99. package/lib/Components/Dialog/Adapters/markDownEditorDialogAdapters.d.ts +3 -0
  100. package/lib/Components/Dialog/Adapters/markDownEditorDialogAdapters.js +23 -0
  101. package/lib/Components/Dialog/Adapters/spinnerDialogAdapter.d.ts +3 -0
  102. package/lib/Components/Dialog/Adapters/spinnerDialogAdapter.js +23 -0
  103. package/lib/Components/Dialog/Entities/DialogQueue.d.ts +1 -11
  104. package/lib/Components/Dialog/Entities/DialogQueue.js +1 -21
  105. package/lib/Components/Dialog/Factories/alertDialogFactory.js +1 -1
  106. package/lib/Components/Dialog/Factories/confirmDialogFactory.js +1 -1
  107. package/lib/Components/Dialog/Factories/markdownDialogEditorFactory.js +1 -1
  108. package/lib/Components/Dialog/Factories/spinnerDialogFactory.js +1 -1
  109. package/lib/Components/Dialog/Mocks/MockAlertDialogPM.d.ts +7 -0
  110. package/lib/Components/Dialog/Mocks/MockAlertDialogPM.js +11 -0
  111. package/lib/Components/Dialog/Mocks/MockConfirmDialogPM.d.ts +7 -0
  112. package/lib/Components/Dialog/Mocks/MockConfirmDialogPM.js +11 -0
  113. package/lib/Components/Dialog/Mocks/MockDialogQueuePM.d.ts +8 -0
  114. package/lib/Components/Dialog/Mocks/MockDialogQueuePM.js +15 -0
  115. package/lib/Components/Dialog/Mocks/MockMakeAlertDialogUC.d.ts +9 -0
  116. package/lib/Components/Dialog/Mocks/MockMakeAlertDialogUC.js +16 -0
  117. package/lib/Components/Dialog/Mocks/MockMakeConfirmDialogUC.d.ts +9 -0
  118. package/lib/Components/Dialog/Mocks/MockMakeConfirmDialogUC.js +16 -0
  119. package/lib/Components/Dialog/Mocks/MockMakeMarkdownDialogUC.d.ts +9 -0
  120. package/lib/Components/Dialog/Mocks/MockMakeMarkdownDialogUC.js +16 -0
  121. package/lib/Components/Dialog/Mocks/MockMakeSelectModelDialogUC.d.ts +9 -0
  122. package/lib/Components/Dialog/Mocks/MockMakeSelectModelDialogUC.js +16 -0
  123. package/lib/Components/Dialog/Mocks/MockMakeSpinnerDialogUC.d.ts +9 -0
  124. package/lib/Components/Dialog/Mocks/MockMakeSpinnerDialogUC.js +16 -0
  125. package/lib/Components/Dialog/Mocks/MockMarkDownEditorDialogPM.d.ts +7 -0
  126. package/lib/Components/Dialog/Mocks/MockMarkDownEditorDialogPM.js +11 -0
  127. package/lib/Components/Dialog/Mocks/MockSpinnerDialogPM.d.ts +7 -0
  128. package/lib/Components/Dialog/Mocks/MockSpinnerDialogPM.js +11 -0
  129. package/lib/Components/Dialog/Mocks/index.d.ts +10 -0
  130. package/lib/Components/Dialog/Mocks/index.js +22 -0
  131. package/lib/Components/Dialog/PMs/AlertDialogPM.d.ts +5 -8
  132. package/lib/Components/Dialog/PMs/AlertDialogPM.js +32 -26
  133. package/lib/Components/Dialog/PMs/ConfirmDialogPM.d.ts +4 -7
  134. package/lib/Components/Dialog/PMs/ConfirmDialogPM.js +30 -24
  135. package/lib/Components/Dialog/PMs/DialogQueuePM.d.ts +5 -8
  136. package/lib/Components/Dialog/PMs/DialogQueuePM.js +16 -10
  137. package/lib/Components/Dialog/PMs/MarkDownEditorDialogPM.d.ts +3 -6
  138. package/lib/Components/Dialog/PMs/MarkDownEditorDialogPM.js +27 -21
  139. package/lib/Components/Dialog/PMs/SpinnerDialogPM.d.ts +3 -6
  140. package/lib/Components/Dialog/PMs/SpinnerDialogPM.js +26 -20
  141. package/lib/Components/Dialog/UCs/MakeAlertDialogUC.d.ts +10 -0
  142. package/lib/Components/Dialog/UCs/MakeAlertDialogUC.js +41 -0
  143. package/lib/Components/Dialog/UCs/MakeConfirmDialogUC.d.ts +10 -0
  144. package/lib/Components/Dialog/UCs/MakeConfirmDialogUC.js +41 -0
  145. package/lib/Components/Dialog/UCs/MakeMarkdownDialogUC.d.ts +10 -0
  146. package/lib/Components/Dialog/UCs/MakeMarkdownDialogUC.js +41 -0
  147. package/lib/Components/Dialog/UCs/MakeSelectModelDialogUC.d.ts +10 -0
  148. package/lib/Components/Dialog/UCs/MakeSelectModelDialogUC.js +41 -0
  149. package/lib/Components/Dialog/UCs/MakeSpinnerDialogUC.d.ts +10 -0
  150. package/lib/Components/Dialog/UCs/MakeSpinnerDialogUC.js +42 -0
  151. package/lib/Components/Dialog/UCs/index.d.ts +5 -0
  152. package/lib/Components/Dialog/UCs/index.js +17 -0
  153. package/lib/Components/Dialog/index.d.ts +6 -3
  154. package/lib/Components/Dialog/index.js +3 -0
  155. package/lib/Components/Dispatcher/Entities/HostDispatchEntity.js +7 -2
  156. package/lib/Components/Dispatcher/UCs/DispatchStartBrowseChannelsUC.d.ts +1 -1
  157. package/lib/Components/Dispatcher/UCs/DispatchStartBrowseChannelsUC.js +1 -1
  158. package/lib/Components/Handler/UCs/CloseAssetSystemPlugin.d.ts +17 -0
  159. package/lib/Components/Handler/UCs/CloseAssetSystemPlugin.js +67 -0
  160. package/lib/Components/Handler/UCs/GetAssetFolderURLHandler.js +12 -2
  161. package/lib/Components/Handler/UCs/OnAppIsReadyHandler.js +9 -1
  162. package/lib/Components/Handler/UCs/RegisterExternalStyleSheetsHandler.js +11 -1
  163. package/lib/Components/Handler/UCs/ShowAlertHandler.js +2 -9
  164. package/lib/Components/Handler/UCs/ShowConfirmHandler.js +2 -9
  165. package/lib/Components/Handler/UCs/ShowMarkDownEditorHandler.d.ts +0 -1
  166. package/lib/Components/Handler/UCs/ShowMarkDownEditorHandler.js +2 -9
  167. package/lib/Components/Handler/UCs/ShowSelectModelHandler.js +11 -2
  168. package/lib/Components/Handler/UCs/ShowSpinnerHandler.js +3 -13
  169. package/lib/Components/Handler/UCs/index.d.ts +1 -0
  170. package/lib/Components/Handler/UCs/index.js +1 -0
  171. package/lib/Components/StateMachine/Adapters/hostStateMachinePMAdapter.d.ts +2 -2
  172. package/lib/Components/StateMachine/Adapters/index.d.ts +0 -1
  173. package/lib/Components/StateMachine/Adapters/index.js +0 -1
  174. package/lib/Components/index.d.ts +2 -0
  175. package/lib/Components/index.js +2 -0
  176. package/lib/Types/PmAdapter.d.ts +6 -0
  177. package/lib/Types/PmAdapter.js +2 -0
  178. package/lib/Types/SingletonPmAdapter.d.ts +6 -0
  179. package/lib/Types/SingletonPmAdapter.js +2 -0
  180. package/lib/Types/index.d.ts +3 -2
  181. package/lib/Types/index.js +2 -1
  182. package/package.json +1 -1
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeAssetPluginPM = exports.AssetPluginPM = exports.defaultAssetPluginVM = void 0;
4
+ const HostAppObject_1 = require("../../../HostAppObject");
5
+ const Apps_1 = require("../../Apps");
6
+ const AssetPluginEntity_1 = require("../Entities/AssetPluginEntity");
7
+ exports.defaultAssetPluginVM = {
8
+ show: false,
9
+ loading: false,
10
+ styleSheets: []
11
+ };
12
+ class AssetPluginPM extends HostAppObject_1.HostAppObjectPM {
13
+ static get(appObjects) {
14
+ return HostAppObject_1.getSingletonComponent(AssetPluginPM.type, appObjects);
15
+ }
16
+ }
17
+ exports.AssetPluginPM = AssetPluginPM;
18
+ AssetPluginPM.type = "AssetSystemPluginPM";
19
+ function makeAssetPluginPM(appObject) {
20
+ return new AssetPluginPMImp(appObject);
21
+ }
22
+ exports.makeAssetPluginPM = makeAssetPluginPM;
23
+ class AssetPluginPMImp extends AssetPluginPM {
24
+ constructor(appObject) {
25
+ var _a;
26
+ super(appObject, AssetPluginPM.type);
27
+ this.onChange = () => {
28
+ var _a, _b, _c, _d;
29
+ if (!this.assetPlugin)
30
+ return;
31
+ const show = this.assetPlugin.show;
32
+ let loading = false;
33
+ if (show && ((_a = this.assetPlugin.app) === null || _a === void 0 ? void 0 : _a.state) === Apps_1.AppState.INIT) {
34
+ loading = true;
35
+ }
36
+ else if (show && ((_b = this.assetPlugin.app) === null || _b === void 0 ? void 0 : _b.state) === Apps_1.AppState.LOADING) {
37
+ loading = true;
38
+ }
39
+ const vm = {
40
+ show,
41
+ loading,
42
+ styleSheets: (_d = (_c = this.assetPlugin.app) === null || _c === void 0 ? void 0 : _c.styles) !== null && _d !== void 0 ? _d : []
43
+ };
44
+ this.doUpdateView(vm);
45
+ };
46
+ (_a = this.assetPlugin) === null || _a === void 0 ? void 0 : _a.addChangeObserver(this.onChange);
47
+ this.onChange();
48
+ this.appObjects.registerSingleton(this);
49
+ }
50
+ get assetPlugin() {
51
+ return this.getCachedSingleton(AssetPluginEntity_1.AssetPluginEntity.type);
52
+ }
53
+ vmsAreEqual(a, b) {
54
+ if (a.loading !== b.loading)
55
+ return false;
56
+ if (a.show !== b.show)
57
+ return false;
58
+ if (a.styleSheets.length !== b.styleSheets.length)
59
+ return false;
60
+ let stylesMatch = true;
61
+ a.styleSheets.forEach((styleA, i) => {
62
+ const styleB = b.styleSheets[i];
63
+ if (styleA !== styleB)
64
+ stylesMatch = false;
65
+ });
66
+ return stylesMatch;
67
+ }
68
+ }
@@ -0,0 +1 @@
1
+ export * from "./AssetPluginPM";
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./AssetPluginPM"), exports);
@@ -0,0 +1,7 @@
1
+ import { HostAppObjectRepo, HostAppObjectUC } from "../../../HostAppObject";
2
+ export declare abstract class AssetPluginContainerUC extends HostAppObjectUC {
3
+ static type: string;
4
+ static get(appObjects: HostAppObjectRepo): AssetPluginContainerUC | undefined;
5
+ abstract setContainer(container: HTMLElement): Promise<void>;
6
+ abstract clearContainer(): void;
7
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AssetPluginContainerUC = void 0;
4
+ const HostAppObject_1 = require("../../../HostAppObject");
5
+ class AssetPluginContainerUC extends HostAppObject_1.HostAppObjectUC {
6
+ static get(appObjects) {
7
+ return HostAppObject_1.getSingletonComponent(AssetPluginContainerUC.type, appObjects);
8
+ }
9
+ }
10
+ exports.AssetPluginContainerUC = AssetPluginContainerUC;
11
+ AssetPluginContainerUC.type = "AssetPluginContainerUC";
@@ -0,0 +1 @@
1
+ export * from "./AssetPluginContainerUC";
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./AssetPluginContainerUC"), exports);
@@ -0,0 +1,6 @@
1
+ export * from "./Adapters";
2
+ export * from "./Controllers";
3
+ export * from "./Entities";
4
+ export * from "./Mocks";
5
+ export * from "./PM";
6
+ export * from "./UCs";
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./Adapters"), exports);
14
+ __exportStar(require("./Controllers"), exports);
15
+ __exportStar(require("./Entities"), exports);
16
+ __exportStar(require("./Mocks"), exports);
17
+ __exportStar(require("./PM"), exports);
18
+ __exportStar(require("./UCs"), exports);
@@ -39,19 +39,14 @@ class ArchiveAssetUCImp extends ArchiveAssetUC {
39
39
  return Promise.resolve();
40
40
  }
41
41
  const patchAssetIsArchived = this.patchAssetIsArchived;
42
- const dialogQueue = this.dialogQueue;
43
- if (!patchAssetIsArchived || !dialogQueue) {
42
+ if (!patchAssetIsArchived) {
44
43
  return Promise.reject();
45
44
  }
46
- const title = archived ? "Archiving Asset" : "Unarchiving Asset";
47
- const spinner = dialogQueue.spinnerDialogFactory({
45
+ const title = archived ? "Archiving Asset" : "Unarchive Asset";
46
+ const spinner = Dialog_1.MakeSpinnerDialogUC.make({
48
47
  title,
49
48
  message: "Updating asset's archived flag..."
50
- });
51
- if (!spinner) {
52
- return Promise.reject();
53
- }
54
- dialogQueue.submitDialog(spinner);
49
+ }, this.appObjects);
55
50
  return new Promise((resolve, reject) => {
56
51
  patchAssetIsArchived(asset.id, archived)
57
52
  .then(() => {
@@ -64,15 +59,13 @@ class ArchiveAssetUCImp extends ArchiveAssetUC {
64
59
  })
65
60
  .catch((e) => {
66
61
  this.error("Archive asset error: " + e.message);
67
- spinner.close();
62
+ spinner === null || spinner === void 0 ? void 0 : spinner.close();
68
63
  const dialogDTO = {
69
64
  buttonLabel: "OK",
70
65
  message: `Something went wrong when setting the asset's archived flag. Check the console. ${e.message}`,
71
66
  title: "Archive Asset Error",
72
67
  };
73
- const confirmDialog = dialogQueue.alertDialogFactory(dialogDTO);
74
- if (confirmDialog)
75
- dialogQueue.submitDialog(confirmDialog);
68
+ Dialog_1.MakeAlertDialogUC.make(dialogDTO, this.appObjects);
76
69
  resolve();
77
70
  });
78
71
  });
@@ -89,7 +82,4 @@ class ArchiveAssetUCImp extends ArchiveAssetUC {
89
82
  get appAssets() {
90
83
  return this.getCachedSingleton(AppAssetsEntity_1.AppAssetsEntity.type);
91
84
  }
92
- get dialogQueue() {
93
- return this.getCachedSingleton(Dialog_1.DialogQueue.type);
94
- }
95
85
  }
@@ -32,17 +32,13 @@ class DeleteAssetUCImp extends DeleteAssetUC {
32
32
  constructor(appObject) {
33
33
  super(appObject, DeleteAssetUC.type);
34
34
  this.deleteWithConfirm = () => {
35
- if (!this.dialogQueue)
36
- return;
37
- const confirmDialog = this.dialogQueue.confirmDialogFactory({
35
+ Dialog_1.MakeConfirmDialogUC.make({
38
36
  cancelButtonLabel: "Cancel",
39
37
  confirmButtonLabel: "Delete Asset",
40
38
  message: "Are you sure you want to delete this asset. This cannot be undone and could affect users. Consider archiving it instead",
41
39
  title: "Delete Asset",
42
40
  onConfirm: this.delete
43
- });
44
- if (confirmDialog)
45
- this.dialogQueue.submitDialog(confirmDialog);
41
+ }, this.appObjects);
46
42
  };
47
43
  this.delete = () => {
48
44
  const asset = this.asset;
@@ -50,17 +46,14 @@ class DeleteAssetUCImp extends DeleteAssetUC {
50
46
  return Promise.reject(new Error("No Asset Entity"));
51
47
  }
52
48
  const doDelete = this.doDelete;
53
- const dialogQueue = this.dialogQueue;
54
- if (!doDelete || !dialogQueue) {
49
+ if (!doDelete) {
55
50
  return Promise.reject();
56
51
  }
57
52
  const title = "Delete Asset";
58
- const spinnerDialog = dialogQueue.spinnerDialogFactory({
53
+ const spinnerDialog = Dialog_1.MakeSpinnerDialogUC.make({
59
54
  title,
60
55
  message: "Deleting asset..."
61
- });
62
- if (spinnerDialog)
63
- dialogQueue.submitDialog(spinnerDialog);
56
+ }, this.appObjects);
64
57
  return new Promise((resolve) => {
65
58
  doDelete(asset.id)
66
59
  .then(() => {
@@ -79,11 +72,9 @@ class DeleteAssetUCImp extends DeleteAssetUC {
79
72
  const dialogDTO = {
80
73
  buttonLabel: "OK",
81
74
  message: `Something went wrong when setting the asset's archived flag. Check the console. ${e.message}`,
82
- title: "Archive Asset Error",
75
+ title: "Archive Asset Error"
83
76
  };
84
- const confirmDialog = dialogQueue.alertDialogFactory(dialogDTO);
85
- if (confirmDialog)
86
- dialogQueue.submitDialog(confirmDialog);
77
+ Dialog_1.MakeAlertDialogUC.make(dialogDTO, this.appObjects);
87
78
  resolve();
88
79
  });
89
80
  });
@@ -103,7 +94,4 @@ class DeleteAssetUCImp extends DeleteAssetUC {
103
94
  get assetRepo() {
104
95
  return this.getCachedSingleton(AssetRepo_1.AssetRepo.type);
105
96
  }
106
- get dialogQueue() {
107
- return this.getCachedSingleton(Dialog_1.DialogQueue.type);
108
- }
109
97
  }
@@ -39,17 +39,14 @@ class DownloadAssetFileUCImp extends DownloadAssetFileUC {
39
39
  return Promise.resolve();
40
40
  }
41
41
  const getAssetFile = this.getAssetFile;
42
- const dialogQueue = this.dialogQueue;
43
- if (!getAssetFile || !dialogQueue) {
42
+ if (!getAssetFile) {
44
43
  return Promise.reject();
45
44
  }
46
45
  const title = "Download Asset";
47
- const spinnerDialog = dialogQueue.spinnerDialogFactory({
46
+ const spinnerDialog = Dialog_1.MakeSpinnerDialogUC.make({
48
47
  title,
49
48
  message: "Downloading asset..."
50
- });
51
- if (spinnerDialog)
52
- dialogQueue.submitDialog(spinnerDialog);
49
+ }, this.appObjects);
53
50
  return new Promise((resolve) => {
54
51
  getAssetFile(asset.id)
55
52
  .then(() => {
@@ -63,11 +60,9 @@ class DownloadAssetFileUCImp extends DownloadAssetFileUC {
63
60
  const dialogDTO = {
64
61
  buttonLabel: "OK",
65
62
  message: `Something went wrong when setting the asset's archived flag. Check the console. ${e.message}`,
66
- title: "Archive Asset Error",
63
+ title: "Archive Asset Error"
67
64
  };
68
- const confirmDialog = dialogQueue.alertDialogFactory(dialogDTO);
69
- if (confirmDialog)
70
- dialogQueue.submitDialog(confirmDialog);
65
+ Dialog_1.MakeAlertDialogUC.make(dialogDTO, this.appObjects);
71
66
  resolve();
72
67
  });
73
68
  });
@@ -95,7 +90,4 @@ class DownloadAssetFileUCImp extends DownloadAssetFileUC {
95
90
  var _a;
96
91
  return (_a = this.getCachedSingleton(GetAssetFileUC_1.GetAssetFileUC.type)) === null || _a === void 0 ? void 0 : _a.getAssetFile;
97
92
  }
98
- get dialogQueue() {
99
- return this.getCachedSingleton(Dialog_1.DialogQueue.type);
100
- }
101
93
  }
@@ -35,16 +35,13 @@ class UpdateAssetFileUCImp extends UpdateAssetFileUC {
35
35
  return Promise.reject(new Error("No Asset Entity"));
36
36
  }
37
37
  const patchAssetFile = this.patchAssetFile;
38
- const dialogQueue = this.dialogQueue;
39
- if (!patchAssetFile || !dialogQueue) {
38
+ if (!patchAssetFile) {
40
39
  return Promise.reject();
41
40
  }
42
- const spinnerDialog = dialogQueue.spinnerDialogFactory({
41
+ const spinnerDialog = Dialog_1.MakeSpinnerDialogUC.make({
43
42
  title: "Asset File",
44
43
  message: "Updating asset's file..."
45
- });
46
- if (spinnerDialog)
47
- dialogQueue.submitDialog(spinnerDialog);
44
+ }, this.appObjects);
48
45
  return new Promise((resolve, reject) => {
49
46
  patchAssetFile(asset.id, file)
50
47
  .then((newFilename) => {
@@ -59,11 +56,9 @@ class UpdateAssetFileUCImp extends UpdateAssetFileUC {
59
56
  const dialogDTO = {
60
57
  buttonLabel: "OK",
61
58
  message: `Something went wrong when updating the asset's file. Check the console. ${e.message}`,
62
- title: "Update Asset File Error",
59
+ title: "Update Asset File Error"
63
60
  };
64
- const confirmDialog = dialogQueue.alertDialogFactory(dialogDTO);
65
- if (confirmDialog)
66
- dialogQueue.submitDialog(confirmDialog);
61
+ Dialog_1.MakeAlertDialogUC.make(dialogDTO, this.appObjects);
67
62
  resolve();
68
63
  });
69
64
  });
@@ -77,7 +72,4 @@ class UpdateAssetFileUCImp extends UpdateAssetFileUC {
77
72
  var _a;
78
73
  return (_a = this.getCachedSingleton(VivedAPI_1.PatchAssetFileUC.type)) === null || _a === void 0 ? void 0 : _a.doPatch;
79
74
  }
80
- get dialogQueue() {
81
- return this.getCachedSingleton(Dialog_1.DialogQueue.type);
82
- }
83
75
  }
@@ -0,0 +1,3 @@
1
+ import { PmAdapter } from "../../../Types/PmAdapter";
2
+ import { AlertDialogVM } from "../PMs";
3
+ export declare const alertDialogAdapter: PmAdapter<AlertDialogVM>;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.alertDialogAdapter = void 0;
4
+ const PMs_1 = require("../PMs");
5
+ exports.alertDialogAdapter = {
6
+ defaultVM: PMs_1.defaultAlertDialogVM,
7
+ subscribe: (id, appObjects, setVM) => {
8
+ const pm = PMs_1.AlertDialogPM.get(id, appObjects);
9
+ if (!pm) {
10
+ appObjects.submitError("alertDialogAdapter", "Unable to find PM");
11
+ return;
12
+ }
13
+ pm.addView(setVM);
14
+ },
15
+ unsubscribe: (id, appObjects, setVM) => {
16
+ const pm = PMs_1.AlertDialogPM.get(id, appObjects);
17
+ if (!pm) {
18
+ appObjects.submitError("alertDialogAdapter", "Unable to find PM");
19
+ return;
20
+ }
21
+ pm.removeView(setVM);
22
+ }
23
+ };
@@ -0,0 +1,3 @@
1
+ import { PmAdapter } from "../../../Types/PmAdapter";
2
+ import { ConfirmDialogVM } from "../PMs";
3
+ export declare const confirmDialogAdapter: PmAdapter<ConfirmDialogVM>;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.confirmDialogAdapter = void 0;
4
+ const PMs_1 = require("../PMs");
5
+ exports.confirmDialogAdapter = {
6
+ defaultVM: PMs_1.defaultConfirmDialogVM,
7
+ subscribe: (id, appObjects, setVM) => {
8
+ const pm = PMs_1.ConfirmDialogPM.get(id, appObjects);
9
+ if (!pm) {
10
+ appObjects.submitError("confirmDialogAdapter", "Unable to find PM");
11
+ return;
12
+ }
13
+ pm.addView(setVM);
14
+ },
15
+ unsubscribe: (id, appObjects, setVM) => {
16
+ const pm = PMs_1.ConfirmDialogPM.get(id, appObjects);
17
+ if (!pm) {
18
+ appObjects.submitError("confirmDialogAdapter", "Unable to find PM");
19
+ return;
20
+ }
21
+ pm.removeView(setVM);
22
+ }
23
+ };
@@ -0,0 +1,3 @@
1
+ import { SingletonPmAdapter } from "../../../Types";
2
+ import { DialogQueueVM } from "../PMs";
3
+ export declare const dialogQueueAdapter: SingletonPmAdapter<DialogQueueVM>;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dialogQueueAdapter = void 0;
4
+ const PMs_1 = require("../PMs");
5
+ exports.dialogQueueAdapter = {
6
+ defaultVM: PMs_1.defaultDialogVM,
7
+ subscribe: (appObjects, setVM) => {
8
+ const pm = PMs_1.DialogQueuePM.get(appObjects);
9
+ if (!pm) {
10
+ appObjects.submitError("dialogQueueAdapter", "Unable to find DialogQueuePM");
11
+ return;
12
+ }
13
+ pm.addView(setVM);
14
+ },
15
+ unsubscribe: (appObjects, setVM) => {
16
+ const pm = PMs_1.DialogQueuePM.get(appObjects);
17
+ if (!pm) {
18
+ appObjects.submitError("dialogQueueAdapter", "Unable to find DialogQueuePM");
19
+ return;
20
+ }
21
+ pm.removeView(setVM);
22
+ }
23
+ };
@@ -0,0 +1,5 @@
1
+ export * from "./alertDialogAdapter";
2
+ export * from "./confirmDialogAdapter";
3
+ export * from "./dialogQueueAdapter";
4
+ export * from "./markDownEditorDialogAdapters";
5
+ export * from "./spinnerDialogAdapter";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./alertDialogAdapter"), exports);
14
+ __exportStar(require("./confirmDialogAdapter"), exports);
15
+ __exportStar(require("./dialogQueueAdapter"), exports);
16
+ __exportStar(require("./markDownEditorDialogAdapters"), exports);
17
+ __exportStar(require("./spinnerDialogAdapter"), exports);
@@ -0,0 +1,3 @@
1
+ import { PmAdapter } from "../../../Types/PmAdapter";
2
+ import { MarkDownEditorDialogVM } from "../PMs";
3
+ export declare const markDownEditorDialogAdapters: PmAdapter<MarkDownEditorDialogVM>;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.markDownEditorDialogAdapters = void 0;
4
+ const PMs_1 = require("../PMs");
5
+ exports.markDownEditorDialogAdapters = {
6
+ defaultVM: PMs_1.defaultMarkDownEditorDialogVM,
7
+ subscribe: (id, appObjects, setVM) => {
8
+ const pm = PMs_1.MarkDownEditorDialogPM.get(id, appObjects);
9
+ if (!pm) {
10
+ appObjects.submitError("markDownEditorDialogAdapters", "Unable to find PM");
11
+ return;
12
+ }
13
+ pm.addView(setVM);
14
+ },
15
+ unsubscribe: (id, appObjects, setVM) => {
16
+ const pm = PMs_1.MarkDownEditorDialogPM.get(id, appObjects);
17
+ if (!pm) {
18
+ appObjects.submitError("markDownEditorDialogAdapters", "Unable to find PM");
19
+ return;
20
+ }
21
+ pm.removeView(setVM);
22
+ }
23
+ };
@@ -0,0 +1,3 @@
1
+ import { PmAdapter } from "../../../Types/PmAdapter";
2
+ import { SpinnerDialogVM } from "../PMs";
3
+ export declare const spinnerDialogAdapter: PmAdapter<SpinnerDialogVM>;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.spinnerDialogAdapter = void 0;
4
+ const PMs_1 = require("../PMs");
5
+ exports.spinnerDialogAdapter = {
6
+ defaultVM: PMs_1.defaultSpinnerDialogVM,
7
+ subscribe: (id, appObjects, setVM) => {
8
+ const pm = PMs_1.SpinnerDialogPM.get(id, appObjects);
9
+ if (!pm) {
10
+ appObjects.submitError("spinnerDialogAdapter", "Unable to find PM");
11
+ return;
12
+ }
13
+ pm.addView(setVM);
14
+ },
15
+ unsubscribe: (id, appObjects, setVM) => {
16
+ const pm = PMs_1.SpinnerDialogPM.get(id, appObjects);
17
+ if (!pm) {
18
+ appObjects.submitError("spinnerDialogAdapter", "Unable to find PM");
19
+ return;
20
+ }
21
+ pm.removeView(setVM);
22
+ }
23
+ };
@@ -1,9 +1,4 @@
1
- import { HostAppObject, HostAppObjectEntity, HostAppObjectRepo } from '../../../HostAppObject';
2
- import { DialogAlertDTO, AlertDialogEntity } from './Alert';
3
- import { DialogConfirmDTO, ConfirmDialogEntity } from './Confirm';
4
- import { DialogMarkDownEditorDTO, MarkDownEditorDialogEntity } from './MarkDownEditor';
5
- import { SelectModelDialogEntity } from './SelectModel';
6
- import { DialogSpinnerDTO, SpinnerDialogEntity } from './Spinner';
1
+ import { HostAppObject, HostAppObjectEntity, HostAppObjectRepo } from "../../../HostAppObject";
7
2
  export declare abstract class Dialog extends HostAppObjectEntity {
8
3
  abstract dialogType: string;
9
4
  abstract preventOutsideDismiss: boolean;
@@ -14,11 +9,6 @@ export declare abstract class DialogQueue extends HostAppObjectEntity {
14
9
  abstract get activeDialog(): Dialog | null;
15
10
  abstract submitDialog(dialog: Dialog): void;
16
11
  abstract activeDialogHasClosed(): void;
17
- abstract alertDialogFactory(dto: DialogAlertDTO): AlertDialogEntity | undefined;
18
- abstract confirmDialogFactory(dto: DialogConfirmDTO): ConfirmDialogEntity | undefined;
19
- abstract markDownDialogFactory(dto: DialogMarkDownEditorDTO): MarkDownEditorDialogEntity | undefined;
20
- abstract selectModelDialogFactory(): SelectModelDialogEntity | undefined;
21
- abstract spinnerDialogFactory(dto: DialogSpinnerDTO): SpinnerDialogEntity | undefined;
22
12
  static get(appObjects: HostAppObjectRepo): DialogQueue | undefined;
23
13
  }
24
14
  export declare function makeDialogQueue(appObject: HostAppObject): DialogQueue;
@@ -11,7 +11,7 @@ class DialogQueue extends HostAppObject_1.HostAppObjectEntity {
11
11
  }
12
12
  }
13
13
  exports.DialogQueue = DialogQueue;
14
- DialogQueue.type = 'DialogQueue';
14
+ DialogQueue.type = "DialogQueue";
15
15
  function makeDialogQueue(appObject) {
16
16
  return new DialogRepoImp(appObject);
17
17
  }
@@ -40,29 +40,9 @@ class DialogRepoImp extends DialogQueue {
40
40
  this.notifyOnChange();
41
41
  }
42
42
  };
43
- this.alertDialogFactory = (dto) => {
44
- this.error('Alert factory has not been injected');
45
- return;
46
- };
47
- this.confirmDialogFactory = (dto) => {
48
- this.error('Confirm factory has not been injected');
49
- return;
50
- };
51
- this.markDownDialogFactory = (dto) => {
52
- this.error('Mark Down factory has not been injected');
53
- return;
54
- };
55
- this.spinnerDialogFactory = (dto) => {
56
- this.error('Spinner factory has not been injected');
57
- return;
58
- };
59
43
  this.appObjects.registerSingleton(this);
60
44
  }
61
45
  get activeDialog() {
62
46
  return this.dialogQueue.length > 0 ? this.dialogQueue[0] : null;
63
47
  }
64
- selectModelDialogFactory() {
65
- this.error('Select Model factory has not been injected');
66
- return;
67
- }
68
48
  }
@@ -8,7 +8,7 @@ function makeAlertFactory(appObjects) {
8
8
  return function alertFactory(data) {
9
9
  const ao = appObjects.getOrCreate(Utilities_1.generateUniqueID());
10
10
  const entity = new Entities_1.AlertDialogEntity(data, ao);
11
- new PMs_1.AlertDialogPM(ao);
11
+ PMs_1.makeAlertDialogPM(ao);
12
12
  return entity;
13
13
  };
14
14
  }
@@ -8,7 +8,7 @@ function makeConfirmFactory(appObjects) {
8
8
  return function confirmFactory(data) {
9
9
  const ao = appObjects.getOrCreate(Utilities_1.generateUniqueID());
10
10
  const entity = new Entities_1.ConfirmDialogEntity(data, ao);
11
- new PMs_1.ConfirmDialogPM(ao);
11
+ PMs_1.makeConfirmDialogPM(ao);
12
12
  return entity;
13
13
  };
14
14
  }
@@ -8,7 +8,7 @@ function makeMarkdownEditorFactory(appObjects) {
8
8
  return function markdownEditorFactory(data) {
9
9
  const ao = appObjects.getOrCreate(Utilities_1.generateUniqueID());
10
10
  const entity = new Entities_1.MarkDownEditorDialogEntity(data, ao);
11
- new PMs_1.MarkDownEditorDialogPM(ao);
11
+ PMs_1.makeMarkDownEditorDialogPM(ao);
12
12
  return entity;
13
13
  };
14
14
  }
@@ -8,7 +8,7 @@ function makeSpinnerFactory(appObjects) {
8
8
  return function spinnerFactory(data) {
9
9
  const ao = appObjects.getOrCreate(Utilities_1.generateUniqueID());
10
10
  const entity = new Entities_1.SpinnerDialogEntity(data, ao);
11
- new PMs_1.SpinnerDialogPM(ao);
11
+ PMs_1.makeSpinnerDialogPM(ao);
12
12
  return entity;
13
13
  };
14
14
  }
@@ -0,0 +1,7 @@
1
+ /// <reference types="jest" />
2
+ import { HostAppObject } from "../../../HostAppObject";
3
+ import { AlertDialogPM } from "../PMs";
4
+ export declare class MockAlertDialogPM extends AlertDialogPM {
5
+ vmsAreEqual: 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.MockAlertDialogPM = void 0;
4
+ const PMs_1 = require("../PMs");
5
+ class MockAlertDialogPM extends PMs_1.AlertDialogPM {
6
+ constructor(appObject) {
7
+ super(appObject, PMs_1.AlertDialogPM.type);
8
+ this.vmsAreEqual = jest.fn();
9
+ }
10
+ }
11
+ exports.MockAlertDialogPM = MockAlertDialogPM;