@vived/app 2.37.0 → 2.38.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.
@@ -20,7 +20,8 @@ export interface ShowConfirmDTO {
20
20
  }
21
21
  export interface ShowMarkDownEditorDTO {
22
22
  initialText: string;
23
- confirmCallback: () => void;
23
+ submitCallback: (text: string) => void;
24
+ validateString?: (text: string) => string | null;
24
25
  }
25
26
  export declare abstract class AppDispatcher {
26
27
  abstract registerHostHandler: (hostHandler: Handler) => void;
@@ -43,8 +44,9 @@ export declare abstract class AppDispatcher {
43
44
  abstract submitMultiHitResult: (hits: number, misses: number, unanswered: number, description: string) => void;
44
45
  abstract submitQualityResult: (stars: number, maxStars: number, description: string) => void;
45
46
  abstract submitScoreResult: (score: number, maxScore: number, description: string) => void;
46
- abstract getAssetBlob: (assetID: string) => Promise<string>;
47
+ abstract getAssetBlobURL: (assetID: string) => Promise<string>;
47
48
  abstract getAssetMeta: (assetID: string) => Promise<AssetMetaDTO>;
49
+ abstract getLinkedAssets: (assetID: string, type: string) => Promise<AssetMetaDTO[]>;
48
50
  abstract getAssetsForOwner: (ownerID: string) => Promise<AssetMetaDTO[]>;
49
51
  abstract submitNewActivityAsset: (file: File) => Promise<string>;
50
52
  abstract stopZSpace: () => void;
@@ -155,7 +155,7 @@ class AppDistpatcherImp extends AppDispatcher {
155
155
  };
156
156
  this.formRequestAndDispatch("SUBMIT_RESULTS", 3, payload);
157
157
  };
158
- this.getAssetBlob = (assetID) => {
158
+ this.getAssetBlobURL = (assetID) => {
159
159
  return new Promise((resolve, reject) => {
160
160
  const callback = (blobURL) => {
161
161
  if (blobURL === undefined) {
@@ -199,6 +199,29 @@ class AppDistpatcherImp extends AppDispatcher {
199
199
  }
200
200
  });
201
201
  };
202
+ this.getLinkedAssets = (assetID, type) => {
203
+ return new Promise((resolve, reject) => {
204
+ const callback = (linkedAssets) => {
205
+ if (linkedAssets === undefined) {
206
+ reject(new Error("Linked asset list is missing"));
207
+ }
208
+ else {
209
+ resolve(linkedAssets);
210
+ }
211
+ };
212
+ const payload = {
213
+ assetID,
214
+ type,
215
+ callback,
216
+ };
217
+ if (!this.hostHandler) {
218
+ reject(new Error("No host handler has been registered"));
219
+ }
220
+ else {
221
+ this.formRequestAndDispatch("GET_LINKED_ASSETS", 1, payload);
222
+ }
223
+ });
224
+ };
202
225
  this.getAssetsForOwner = (ownerID) => {
203
226
  return new Promise((resolve, reject) => {
204
227
  const callback = (assetMetas) => {
@@ -302,13 +325,16 @@ class AppDistpatcherImp extends AppDispatcher {
302
325
  this.showMarkDownEditor = (data) => {
303
326
  const payload = {
304
327
  initialText: data.initialText,
305
- confirmCallback: data.confirmCallback,
328
+ submitCallback: data.submitCallback,
306
329
  };
330
+ if (data.validateString) {
331
+ payload.validateString = data.validateString;
332
+ }
307
333
  this.formRequestAndDispatch("SHOW_MARKDOWN_EDITOR", 1, payload);
308
334
  };
309
335
  this.showSelectModel = (callback) => {
310
336
  const payload = {
311
- callback
337
+ callback,
312
338
  };
313
339
  this.formRequestAndDispatch("SHOW_SELECT_MODEL", 1, payload);
314
340
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vived/app",
3
- "version": "2.37.0",
3
+ "version": "2.38.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",