@project-sunbird/collection-editor-react 0.1.20 → 0.1.21
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.
package/dist/index.js
CHANGED
|
@@ -19685,7 +19685,12 @@ function XN(e, t) {
|
|
|
19685
19685
|
}
|
|
19686
19686
|
});
|
|
19687
19687
|
}
|
|
19688
|
-
const sd = "/assets/quml-player/sunbird-quml-player.js", ZN = "/assets/quml-player/styles.css",
|
|
19688
|
+
const sd = "/assets/quml-player/sunbird-quml-player.js", ZN = "/assets/quml-player/styles.css", od = "sunbird-quml-player";
|
|
19689
|
+
function JN(e) {
|
|
19690
|
+
const t = e.children ?? [];
|
|
19691
|
+
return t.length ? t.every((n) => n.objectType === "Question") ? [e] : t : [];
|
|
19692
|
+
}
|
|
19693
|
+
const at = class at {
|
|
19689
19694
|
constructor() {
|
|
19690
19695
|
ui(this, "eventHandlers", /* @__PURE__ */ new WeakMap());
|
|
19691
19696
|
}
|
|
@@ -19700,7 +19705,7 @@ const sd = "/assets/quml-player/sunbird-quml-player.js", ZN = "/assets/quml-play
|
|
|
19700
19705
|
})), at.scriptLoading);
|
|
19701
19706
|
}
|
|
19702
19707
|
loadStyles() {
|
|
19703
|
-
if (
|
|
19708
|
+
if (at.stylesLoaded || document.querySelector('[data-quml-player-styles="true"]')) {
|
|
19704
19709
|
at.stylesLoaded = !0;
|
|
19705
19710
|
return;
|
|
19706
19711
|
}
|
|
@@ -19717,16 +19722,17 @@ const sd = "/assets/quml-player/sunbird-quml-player.js", ZN = "/assets/quml-play
|
|
|
19717
19722
|
* config from the editor context + enriched questionset metadata.
|
|
19718
19723
|
*/
|
|
19719
19724
|
async createConfig(t, r, n) {
|
|
19720
|
-
var o, a
|
|
19721
|
-
await this.loadScript()
|
|
19722
|
-
const i = { ...t };
|
|
19723
|
-
return n != null && n.singleQuestion && (i.maxQuestions = 1, i.showStartPage = "No", i.showTimer = "No", i.requiresSubmit = "No"), {
|
|
19725
|
+
var s, o, a;
|
|
19726
|
+
return await this.loadScript(), {
|
|
19724
19727
|
context: {
|
|
19725
19728
|
mode: (n == null ? void 0 : n.mode) ?? "play",
|
|
19729
|
+
// Same-origin base for the player's identifier self-fetch fallback
|
|
19730
|
+
// (/learner/questionset/v2/hierarchy + /api/question/v2/list).
|
|
19731
|
+
host: "",
|
|
19726
19732
|
pdata: {
|
|
19727
|
-
id: ((
|
|
19728
|
-
ver: ((
|
|
19729
|
-
pid: ((
|
|
19733
|
+
id: ((s = r == null ? void 0 : r.pdata) == null ? void 0 : s.id) ?? "sunbird.portal",
|
|
19734
|
+
ver: ((o = r == null ? void 0 : r.pdata) == null ? void 0 : o.ver) ?? "1.0",
|
|
19735
|
+
pid: ((a = r == null ? void 0 : r.pdata) == null ? void 0 : a.pid) ?? "sunbird-portal"
|
|
19730
19736
|
},
|
|
19731
19737
|
contentId: t.identifier ?? "",
|
|
19732
19738
|
sid: (r == null ? void 0 : r.sid) ?? "",
|
|
@@ -19736,20 +19742,19 @@ const sd = "/assets/quml-player/sunbird-quml-player.js", ZN = "/assets/quml-play
|
|
|
19736
19742
|
tags: (r == null ? void 0 : r.tags) ?? [],
|
|
19737
19743
|
contextRollup: (n == null ? void 0 : n.contextRollup) ?? (r == null ? void 0 : r.rollup) ?? {},
|
|
19738
19744
|
objectRollup: (n == null ? void 0 : n.objectRollup) ?? {},
|
|
19739
|
-
...n != null && n.cdata ? { cdata: n.cdata } : {}
|
|
19740
|
-
...n != null && n.singleQuestion ? { threshold: 1 } : {}
|
|
19745
|
+
...n != null && n.cdata ? { cdata: n.cdata } : {}
|
|
19741
19746
|
},
|
|
19742
|
-
config: {
|
|
19743
|
-
|
|
19744
|
-
|
|
19745
|
-
|
|
19746
|
-
|
|
19747
|
-
|
|
19748
|
-
|
|
19749
|
-
|
|
19750
|
-
...n != null && n.singleQuestion ? { showLegend: !1 } : {}
|
|
19747
|
+
config: { language: "en" },
|
|
19748
|
+
// Inline sections render with no network call — required for draft
|
|
19749
|
+
// preview, since the player's identifier self-fetch hits the published
|
|
19750
|
+
// /learner endpoint. identifier is kept as a graceful fallback should
|
|
19751
|
+
// the inline payload fail to normalize.
|
|
19752
|
+
data: {
|
|
19753
|
+
sections: JN(t),
|
|
19754
|
+
identifier: t.identifier ?? ""
|
|
19751
19755
|
},
|
|
19752
|
-
|
|
19756
|
+
// Used by the player for media basePath resolution.
|
|
19757
|
+
metadata: t
|
|
19753
19758
|
};
|
|
19754
19759
|
}
|
|
19755
19760
|
createElement(t) {
|
|
@@ -20050,7 +20055,7 @@ function Bx({
|
|
|
20050
20055
|
const h = await ys.createConfig(
|
|
20051
20056
|
c,
|
|
20052
20057
|
n == null ? void 0 : n.context,
|
|
20053
|
-
{ mode: t === "edit" ? "edit" : "play"
|
|
20058
|
+
{ mode: t === "edit" ? "edit" : "play" }
|
|
20054
20059
|
);
|
|
20055
20060
|
if (b || !s.current) return;
|
|
20056
20061
|
const m = ys.createElement(h);
|
|
@@ -5,12 +5,12 @@ export interface QumlContextProps {
|
|
|
5
5
|
cdata?: unknown[];
|
|
6
6
|
contextRollup?: Record<string, string>;
|
|
7
7
|
objectRollup?: Record<string, string>;
|
|
8
|
-
/** When true, configures the player to render exactly one question. */
|
|
9
|
-
singleQuestion?: boolean;
|
|
10
8
|
}
|
|
11
9
|
export interface QumlPlayerConfig {
|
|
12
10
|
context: Record<string, unknown>;
|
|
13
11
|
config: Record<string, unknown>;
|
|
12
|
+
/** React-player load source: inline sections (preferred) or identifier self-fetch. */
|
|
13
|
+
data: Record<string, unknown>;
|
|
14
14
|
metadata: Record<string, unknown>;
|
|
15
15
|
}
|
|
16
16
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@project-sunbird/collection-editor-react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.21",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@dnd-kit/core": "^6.1.0",
|
|
36
|
-
"@project-sunbird/sunbird-quml-player-web-component": "^
|
|
36
|
+
"@project-sunbird/sunbird-quml-player-web-component-react": "^0.1.2",
|
|
37
37
|
"@dnd-kit/sortable": "^8.0.0",
|
|
38
38
|
"@dnd-kit/utilities": "^3.2.2",
|
|
39
39
|
"@tanstack/react-query": "^5.51.0",
|