@vived/app 2.38.1 → 2.40.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.
@@ -23,6 +23,15 @@ export interface ShowMarkDownEditorDTO {
23
23
  submitCallback: (text: string) => void;
24
24
  validateString?: (text: string) => string | null;
25
25
  }
26
+ export interface IsAssetFetchedDTO {
27
+ assetId: string;
28
+ callback: (isFetched: boolean) => void;
29
+ }
30
+ export interface SpinnerDTO {
31
+ message: string;
32
+ title: string;
33
+ closeCallback: (closeSpinner: () => void) => void;
34
+ }
26
35
  export declare abstract class AppDispatcher {
27
36
  abstract registerHostHandler: (hostHandler: Handler) => void;
28
37
  abstract dispatch: (request: Request) => void;
@@ -48,11 +57,13 @@ export declare abstract class AppDispatcher {
48
57
  abstract getAssetMeta: (assetID: string) => Promise<AssetMetaDTO>;
49
58
  abstract getLinkedAssets: (assetID: string, type: string) => Promise<AssetMetaDTO[]>;
50
59
  abstract getAssetsForOwner: (ownerID: string) => Promise<AssetMetaDTO[]>;
60
+ abstract isAssetFetched: (data: IsAssetFetchedDTO) => void;
51
61
  abstract submitNewActivityAsset: (file: File) => Promise<string>;
52
62
  abstract stopZSpace: () => void;
53
63
  abstract showAlert: (data: ShowAlertDTO) => void;
54
64
  abstract showConfirm: (data: ShowConfirmDTO) => void;
55
65
  abstract showMarkDownEditor: (data: ShowMarkDownEditorDTO) => void;
56
- abstract showSelectModel(callback: (modelId: string) => void): void;
66
+ abstract showSelectModel(callback: (modelId: string, dataId: string) => void): void;
67
+ abstract showSpinner(data: SpinnerDTO): void;
57
68
  }
58
69
  export declare function makeAppDispatcher(): AppDispatcher;
@@ -338,6 +338,21 @@ class AppDistpatcherImp extends AppDispatcher {
338
338
  };
339
339
  this.formRequestAndDispatch("SHOW_SELECT_MODEL", 1, payload);
340
340
  };
341
+ this.isAssetFetched = (data) => {
342
+ const payload = {
343
+ assetId: data.assetId,
344
+ callback: data.callback,
345
+ };
346
+ this.formRequestAndDispatch("IS_ASSET_FILE_FETCHED", 1, payload);
347
+ };
348
+ this.showSpinner = (data) => {
349
+ const payload = {
350
+ message: data.message,
351
+ title: data.title,
352
+ closeCallback: data.closeCallback,
353
+ };
354
+ this.formRequestAndDispatch("SHOW_SPINNER", 1, payload);
355
+ };
341
356
  }
342
357
  formRequestAndDispatch(type, version, payload) {
343
358
  const request = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vived/app",
3
- "version": "2.38.1",
3
+ "version": "2.40.0",
4
4
  "description": "Public package for the VIVED Learning App system",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -1,9 +0,0 @@
1
- import { BaseApp } from "../Entities";
2
- import { PresentionManager } from "./PresentationManager";
3
- export declare class IsRenderingPM extends PresentionManager {
4
- private baseApp;
5
- private updateView;
6
- private lastSetState?;
7
- doUpdateView: () => void;
8
- constructor(baseApp: BaseApp, updateView: (isAuthoring: boolean) => void);
9
- }
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IsRenderingPM = void 0;
4
- const PresentationManager_1 = require("./PresentationManager");
5
- class IsRenderingPM extends PresentationManager_1.PresentionManager {
6
- constructor(baseApp, updateView) {
7
- super(baseApp);
8
- this.baseApp = baseApp;
9
- this.updateView = updateView;
10
- this.doUpdateView = () => {
11
- const isRendering = this.baseApp.isRendering;
12
- if (isRendering === this.lastSetState)
13
- return;
14
- this.updateView(isRendering);
15
- this.lastSetState = isRendering;
16
- };
17
- this.doUpdateView();
18
- }
19
- }
20
- exports.IsRenderingPM = IsRenderingPM;
@@ -1,10 +0,0 @@
1
- import { AppHandler, RequestHandler } from "../../Entities";
2
- export declare type SetZSpaceEnabledAction = (isEnabled: boolean) => void;
3
- export declare class SetZSpaceEnabledBase extends RequestHandler {
4
- readonly requestType = "SET_ZSPACE_ENABLED";
5
- readonly payloadVersion = 1;
6
- action: SetZSpaceEnabledAction;
7
- handleRequest: (version: number, payload: unknown) => void;
8
- private castPayloadV1;
9
- constructor(handler: AppHandler);
10
- }
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SetZSpaceEnabledBase = void 0;
4
- const Entities_1 = require("../../Entities");
5
- class SetZSpaceEnabledBase extends Entities_1.RequestHandler {
6
- constructor(handler) {
7
- super();
8
- this.requestType = "SET_ZSPACE_ENABLED";
9
- this.payloadVersion = 1;
10
- this.action = () => {
11
- throw new Entities_1.ActionNotImplemented(this.requestType);
12
- };
13
- this.handleRequest = (version, payload) => {
14
- if (version === this.payloadVersion) {
15
- const { isEnabled } = this.castPayloadV1(payload);
16
- this.action(isEnabled);
17
- }
18
- else {
19
- throw new Entities_1.UnsupportedRequestVerion(this.requestType, version);
20
- }
21
- };
22
- handler.registerRequestHandler(this);
23
- }
24
- castPayloadV1(payload) {
25
- const castPayload = payload;
26
- if (castPayload.isEnabled === undefined) {
27
- throw new Entities_1.UnableToParsePayload(this.requestType, 1, JSON.stringify(payload));
28
- }
29
- return castPayload;
30
- }
31
- }
32
- exports.SetZSpaceEnabledBase = SetZSpaceEnabledBase;