@burdenoff/microfe-buildmyiq 2026.1102.2 → 2026.1102.4
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/buildmyiq/hooks/index.d.ts +1 -0
- package/dist/buildmyiq/hooks/index.d.ts.map +1 -1
- package/dist/buildmyiq/hooks/index.js +1 -0
- package/dist/buildmyiq/hooks/useBuiInteractive.d.ts +139 -0
- package/dist/buildmyiq/hooks/useBuiInteractive.d.ts.map +1 -0
- package/dist/buildmyiq/hooks/useBuiInteractive.js +104 -0
- package/dist/buildmyiq/hooks/useBuiInteractive.js.map +1 -0
- package/dist/buildmyiq/pages/authoring/CourseBuilderPage.d.ts.map +1 -1
- package/dist/buildmyiq/pages/authoring/CourseBuilderPage.js +94 -73
- package/dist/buildmyiq/pages/authoring/CourseBuilderPage.js.map +1 -1
- package/dist/buildmyiq/pages/authoring/InteractivePackageModal.d.ts +7 -0
- package/dist/buildmyiq/pages/authoring/InteractivePackageModal.d.ts.map +1 -0
- package/dist/buildmyiq/pages/authoring/InteractivePackageModal.js +237 -0
- package/dist/buildmyiq/pages/authoring/InteractivePackageModal.js.map +1 -0
- package/dist/buildmyiq/pages/learning/InteractiveActivity.d.ts +22 -0
- package/dist/buildmyiq/pages/learning/InteractiveActivity.d.ts.map +1 -0
- package/dist/buildmyiq/pages/learning/InteractiveActivity.js +259 -0
- package/dist/buildmyiq/pages/learning/InteractiveActivity.js.map +1 -0
- package/dist/buildmyiq/pages/learning/LessonPlayerPage.d.ts.map +1 -1
- package/dist/buildmyiq/pages/learning/LessonPlayerPage.js +125 -96
- package/dist/buildmyiq/pages/learning/LessonPlayerPage.js.map +1 -1
- package/package.json +1 -1
|
@@ -14,6 +14,7 @@ export * from './aiProctoringSignals';
|
|
|
14
14
|
export * from './useBuiCredentials';
|
|
15
15
|
export * from './useBuiAccessibility';
|
|
16
16
|
export * from './useBuiMigration';
|
|
17
|
+
export * from './useBuiInteractive';
|
|
17
18
|
export * from './useScimProvisioning';
|
|
18
19
|
export * from './useBuiLearningObjects';
|
|
19
20
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/buildmyiq/hooks/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/buildmyiq/hooks/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Buildmyiq — H5P-compatible interactive lesson hooks (BOFF-10561).
|
|
3
|
+
* @module buildmyiq/hooks/useBuiInteractive
|
|
4
|
+
*
|
|
5
|
+
* Transport for interactive lessons:
|
|
6
|
+
* - `buiLessonInteractivePackage(lessonId)` — the attached package with its
|
|
7
|
+
* validation details (authoring view).
|
|
8
|
+
* - `buiAttachInteractivePackage` / `buiSetInteractivePassMark` /
|
|
9
|
+
* `buiDetachInteractivePackage` — author the package on a lesson. The
|
|
10
|
+
* `.h5p` file is uploaded PRIVATE through the platform file flow first,
|
|
11
|
+
* because the service only accepts a package the caller uploaded.
|
|
12
|
+
* - `buiInteractivePlayer(lessonId)` — the questions without the answer key.
|
|
13
|
+
* - `buiPreviewInteractiveAttempt` — an author's scored preview, not stored.
|
|
14
|
+
* - `buiSubmitMyInteractiveAttempt` — a learner's scored attempt; a passing
|
|
15
|
+
* attempt completes the lesson on the server.
|
|
16
|
+
*/
|
|
17
|
+
export type BuiInteractiveItemKind = 'MULTIPLE_CHOICE' | 'TRUE_FALSE' | 'FILL_IN_BLANKS';
|
|
18
|
+
export interface BuiInteractiveWarning {
|
|
19
|
+
code: string;
|
|
20
|
+
message: string;
|
|
21
|
+
}
|
|
22
|
+
export interface BuiInteractivePackage {
|
|
23
|
+
id: string;
|
|
24
|
+
lessonId: string;
|
|
25
|
+
fileId: string;
|
|
26
|
+
fileName: string;
|
|
27
|
+
byteSize: number;
|
|
28
|
+
contentType: string;
|
|
29
|
+
contentTypeLabel: string;
|
|
30
|
+
contentTypeVersion: string;
|
|
31
|
+
title: string;
|
|
32
|
+
libraries: string[];
|
|
33
|
+
itemCount: number;
|
|
34
|
+
maxScore: number;
|
|
35
|
+
passPct: number;
|
|
36
|
+
validationStatus: 'VALID' | 'REJECTED';
|
|
37
|
+
warnings: BuiInteractiveWarning[];
|
|
38
|
+
validatedAt: string;
|
|
39
|
+
updatedAt: string;
|
|
40
|
+
}
|
|
41
|
+
export interface BuiInteractiveItem {
|
|
42
|
+
id: string;
|
|
43
|
+
kind: BuiInteractiveItemKind;
|
|
44
|
+
prompt: string;
|
|
45
|
+
multipleAnswers: boolean;
|
|
46
|
+
choices: Array<{
|
|
47
|
+
id: string;
|
|
48
|
+
text: string;
|
|
49
|
+
}>;
|
|
50
|
+
segments: Array<{
|
|
51
|
+
text: string | null;
|
|
52
|
+
blankId: string | null;
|
|
53
|
+
}>;
|
|
54
|
+
blankTips: Array<{
|
|
55
|
+
blankId: string;
|
|
56
|
+
tip: string;
|
|
57
|
+
}>;
|
|
58
|
+
maxScore: number;
|
|
59
|
+
}
|
|
60
|
+
export interface BuiInteractivePlayerConfig {
|
|
61
|
+
packageId: string;
|
|
62
|
+
lessonId: string;
|
|
63
|
+
title: string;
|
|
64
|
+
contentType: string;
|
|
65
|
+
contentTypeLabel: string;
|
|
66
|
+
passPct: number;
|
|
67
|
+
maxScore: number;
|
|
68
|
+
items: BuiInteractiveItem[];
|
|
69
|
+
}
|
|
70
|
+
export interface BuiInteractiveResponse {
|
|
71
|
+
itemId: string;
|
|
72
|
+
choiceIds?: string[];
|
|
73
|
+
answer?: boolean | null;
|
|
74
|
+
blanks?: Array<{
|
|
75
|
+
blankId: string;
|
|
76
|
+
value: string;
|
|
77
|
+
}>;
|
|
78
|
+
}
|
|
79
|
+
export interface BuiInteractiveItemResult {
|
|
80
|
+
itemId: string;
|
|
81
|
+
score: number;
|
|
82
|
+
maxScore: number;
|
|
83
|
+
correct: boolean;
|
|
84
|
+
blanks: Array<{
|
|
85
|
+
blankId: string;
|
|
86
|
+
correct: boolean;
|
|
87
|
+
}>;
|
|
88
|
+
}
|
|
89
|
+
export interface BuiInteractiveAttemptResult {
|
|
90
|
+
attemptId: string | null;
|
|
91
|
+
score: number;
|
|
92
|
+
maxScore: number;
|
|
93
|
+
scaled: number;
|
|
94
|
+
passed: boolean;
|
|
95
|
+
passPct: number;
|
|
96
|
+
lessonCompleted: boolean;
|
|
97
|
+
items: BuiInteractiveItemResult[];
|
|
98
|
+
createdAt: string;
|
|
99
|
+
}
|
|
100
|
+
export interface BuiInteractiveAttemptSummary {
|
|
101
|
+
id: string;
|
|
102
|
+
score: number;
|
|
103
|
+
maxScore: number;
|
|
104
|
+
scaled: number;
|
|
105
|
+
passed: boolean;
|
|
106
|
+
createdAt: string;
|
|
107
|
+
}
|
|
108
|
+
export declare const interactiveKeys: {
|
|
109
|
+
all: readonly ["buildmyiq", "interactive"];
|
|
110
|
+
package: (lessonId: string) => readonly ["buildmyiq", "interactive", "package", string];
|
|
111
|
+
player: (lessonId: string) => readonly ["buildmyiq", "interactive", "player", string];
|
|
112
|
+
attempts: (enrollmentId: string, lessonId: string) => readonly ["buildmyiq", "interactive", "attempts", string, string];
|
|
113
|
+
};
|
|
114
|
+
/** The package attached to a lesson (authoring view); null when none. */
|
|
115
|
+
export declare const useBuiLessonInteractivePackage: (lessonId: string | null | undefined) => import('@tanstack/react-query').UseQueryResult<NoInfer<BuiInteractivePackage | null>, Error>;
|
|
116
|
+
/** Questions of an interactive lesson for playback; null when no package is attached. */
|
|
117
|
+
export declare const useBuiInteractivePlayer: (lessonId: string | null | undefined) => import('@tanstack/react-query').UseQueryResult<NoInfer<BuiInteractivePlayerConfig | null>, Error>;
|
|
118
|
+
/** The learner's recent attempts on a lesson, newest first. */
|
|
119
|
+
export declare const useBuiMyInteractiveAttempts: (enrollmentId: string | null | undefined, lessonId: string | null | undefined) => import('@tanstack/react-query').UseQueryResult<NoInfer<BuiInteractiveAttemptSummary[]>, Error>;
|
|
120
|
+
export declare const useBuiAttachInteractivePackage: () => import('@tanstack/react-query').UseMutationResult<BuiInteractivePackage, Error, {
|
|
121
|
+
lessonId: string;
|
|
122
|
+
fileId: string;
|
|
123
|
+
passPct?: number | null;
|
|
124
|
+
}, unknown>;
|
|
125
|
+
export declare const useBuiSetInteractivePassMark: () => import('@tanstack/react-query').UseMutationResult<BuiInteractivePackage, Error, {
|
|
126
|
+
lessonId: string;
|
|
127
|
+
passPct: number;
|
|
128
|
+
}, unknown>;
|
|
129
|
+
export declare const useBuiDetachInteractivePackage: () => import('@tanstack/react-query').UseMutationResult<boolean, Error, string, unknown>;
|
|
130
|
+
export declare const useBuiPreviewInteractiveAttempt: () => import('@tanstack/react-query').UseMutationResult<BuiInteractiveAttemptResult, Error, {
|
|
131
|
+
lessonId: string;
|
|
132
|
+
responses: BuiInteractiveResponse[];
|
|
133
|
+
}, unknown>;
|
|
134
|
+
export declare const useBuiSubmitMyInteractiveAttempt: () => import('@tanstack/react-query').UseMutationResult<BuiInteractiveAttemptResult, Error, {
|
|
135
|
+
enrollmentId: string;
|
|
136
|
+
lessonId: string;
|
|
137
|
+
responses: BuiInteractiveResponse[];
|
|
138
|
+
}, unknown>;
|
|
139
|
+
//# sourceMappingURL=useBuiInteractive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBuiInteractive.d.ts","sourceRoot":"","sources":["../../../src/buildmyiq/hooks/useBuiInteractive.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAQH,MAAM,MAAM,sBAAsB,GAAG,iBAAiB,GAAG,YAAY,GAAG,gBAAgB,CAAC;AAEzF,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,OAAO,GAAG,UAAU,CAAC;IACvC,QAAQ,EAAE,qBAAqB,EAAE,CAAC;IAClC,WAAW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4BAA4B;cAIA,MAAM;aAAW,MAAM;WAY/D,CAAC;AAEF,eAAO,MAAM,8BAA8B,0FAgB1C,CAAC;AAEF,eAAO,MAAM,+BAA+B;cAGH,MAAM;eAAa,sBAAsB,EAAE;WAWnF,CAAC;AAEF,eAAO,MAAM,gCAAgC;kBAKzB,MAAM;cACV,MAAM;eACL,sBAAsB,EAAE;WAyBxC,CAAC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { useBuildmyiq as e } from "../context/BuildmyiqContext.js";
|
|
2
|
+
import "../context/index.js";
|
|
3
|
+
import { invalidateAfterWrite as t } from "./invalidateAfterWrite.js";
|
|
4
|
+
import { wspaceFetch as n } from "./useBuiFiles.js";
|
|
5
|
+
import { useMutation as r, useQuery as i, useQueryClient as a } from "@tanstack/react-query";
|
|
6
|
+
//#region src/buildmyiq/hooks/useBuiInteractive.ts
|
|
7
|
+
var o = "\n id lessonId fileId fileName byteSize contentType contentTypeLabel contentTypeVersion\n title libraries itemCount maxScore passPct validationStatus\n warnings { code message } validatedAt updatedAt\n", s = "\n packageId lessonId title contentType contentTypeLabel passPct maxScore\n items {\n id kind prompt multipleAnswers maxScore\n choices { id text }\n segments { text blankId }\n blankTips { blankId tip }\n }\n", c = "\n attemptId score maxScore scaled passed passPct lessonCompleted createdAt\n items { itemId score maxScore correct blanks { blankId correct } }\n", l = {
|
|
8
|
+
all: ["buildmyiq", "interactive"],
|
|
9
|
+
package: (e) => [
|
|
10
|
+
"buildmyiq",
|
|
11
|
+
"interactive",
|
|
12
|
+
"package",
|
|
13
|
+
e
|
|
14
|
+
],
|
|
15
|
+
player: (e) => [
|
|
16
|
+
"buildmyiq",
|
|
17
|
+
"interactive",
|
|
18
|
+
"player",
|
|
19
|
+
e
|
|
20
|
+
],
|
|
21
|
+
attempts: (e, t) => [
|
|
22
|
+
"buildmyiq",
|
|
23
|
+
"interactive",
|
|
24
|
+
"attempts",
|
|
25
|
+
e,
|
|
26
|
+
t
|
|
27
|
+
]
|
|
28
|
+
}, u = (t) => {
|
|
29
|
+
let { apiGatewayUrl: r } = e();
|
|
30
|
+
return i({
|
|
31
|
+
queryKey: l.package(t ?? ""),
|
|
32
|
+
enabled: !!t,
|
|
33
|
+
queryFn: async () => (await n(`query BuiLessonInteractivePackage($lessonId: ID!) {
|
|
34
|
+
buiLessonInteractivePackage(lessonId: $lessonId) { ${o} }
|
|
35
|
+
}`, { lessonId: t }, r)).buiLessonInteractivePackage
|
|
36
|
+
});
|
|
37
|
+
}, d = (t) => {
|
|
38
|
+
let { apiGatewayUrl: r } = e();
|
|
39
|
+
return i({
|
|
40
|
+
queryKey: l.player(t ?? ""),
|
|
41
|
+
enabled: !!t,
|
|
42
|
+
queryFn: async () => (await n(`query BuiInteractivePlayer($lessonId: ID!) {
|
|
43
|
+
buiInteractivePlayer(lessonId: $lessonId) { ${s} }
|
|
44
|
+
}`, { lessonId: t }, r)).buiInteractivePlayer
|
|
45
|
+
});
|
|
46
|
+
}, f = (t, r) => {
|
|
47
|
+
let { apiGatewayUrl: a } = e();
|
|
48
|
+
return i({
|
|
49
|
+
queryKey: l.attempts(t ?? "", r ?? ""),
|
|
50
|
+
enabled: !!(t && r),
|
|
51
|
+
queryFn: async () => (await n("query BuiMyInteractiveAttempts($enrollmentId: ID!, $lessonId: ID!) {\n buiMyInteractiveAttempts(enrollmentId: $enrollmentId, lessonId: $lessonId) {\n id score maxScore scaled passed createdAt\n }\n }", {
|
|
52
|
+
enrollmentId: t,
|
|
53
|
+
lessonId: r
|
|
54
|
+
}, a)).buiMyInteractiveAttempts
|
|
55
|
+
});
|
|
56
|
+
}, p = async (e, n) => {
|
|
57
|
+
await Promise.all([t(e, l.package(n)), t(e, l.player(n))]);
|
|
58
|
+
}, m = () => {
|
|
59
|
+
let { apiGatewayUrl: t } = e(), i = a();
|
|
60
|
+
return r({
|
|
61
|
+
mutationFn: async (e) => (await n(`mutation BuiAttachInteractivePackage($input: BuiAttachInteractivePackageInput!) {
|
|
62
|
+
buiAttachInteractivePackage(input: $input) { ${o} }
|
|
63
|
+
}`, { input: e }, t)).buiAttachInteractivePackage,
|
|
64
|
+
onSuccess: (e) => p(i, e.lessonId)
|
|
65
|
+
});
|
|
66
|
+
}, h = () => {
|
|
67
|
+
let { apiGatewayUrl: t } = e(), i = a();
|
|
68
|
+
return r({
|
|
69
|
+
mutationFn: async (e) => (await n(`mutation BuiSetInteractivePassMark($lessonId: ID!, $passPct: Int!) {
|
|
70
|
+
buiSetInteractivePassMark(lessonId: $lessonId, passPct: $passPct) { ${o} }
|
|
71
|
+
}`, e, t)).buiSetInteractivePassMark,
|
|
72
|
+
onSuccess: (e) => p(i, e.lessonId)
|
|
73
|
+
});
|
|
74
|
+
}, g = () => {
|
|
75
|
+
let { apiGatewayUrl: t } = e(), i = a();
|
|
76
|
+
return r({
|
|
77
|
+
mutationFn: async (e) => (await n("mutation BuiDetachInteractivePackage($lessonId: ID!) {\n buiDetachInteractivePackage(lessonId: $lessonId)\n }", { lessonId: e }, t)).buiDetachInteractivePackage,
|
|
78
|
+
onSuccess: (e, t) => p(i, t)
|
|
79
|
+
});
|
|
80
|
+
}, _ = () => {
|
|
81
|
+
let { apiGatewayUrl: t } = e();
|
|
82
|
+
return r({ mutationFn: async (e) => (await n(`mutation BuiPreviewInteractiveAttempt($lessonId: ID!, $responses: [BuiInteractiveResponseInput!]!) {
|
|
83
|
+
buiPreviewInteractiveAttempt(lessonId: $lessonId, responses: $responses) { ${c} }
|
|
84
|
+
}`, e, t)).buiPreviewInteractiveAttempt });
|
|
85
|
+
}, v = () => {
|
|
86
|
+
let { apiGatewayUrl: i } = e(), o = a();
|
|
87
|
+
return r({
|
|
88
|
+
mutationFn: async (e) => (await n(`mutation BuiSubmitMyInteractiveAttempt($input: BuiSubmitInteractiveAttemptInput!) {
|
|
89
|
+
buiSubmitMyInteractiveAttempt(input: $input) { ${c} }
|
|
90
|
+
}`, { input: e }, i)).buiSubmitMyInteractiveAttempt,
|
|
91
|
+
onSuccess: async (e, n) => {
|
|
92
|
+
let r = [t(o, l.attempts(n.enrollmentId, n.lessonId))];
|
|
93
|
+
e.lessonCompleted && (r.push(t(o, [
|
|
94
|
+
"buildmyiq",
|
|
95
|
+
"enrollment",
|
|
96
|
+
n.enrollmentId
|
|
97
|
+
])), r.push(t(o, ["buildmyiq", "enrollments"]))), await Promise.all(r);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
//#endregion
|
|
102
|
+
export { l as interactiveKeys, m as useBuiAttachInteractivePackage, g as useBuiDetachInteractivePackage, d as useBuiInteractivePlayer, u as useBuiLessonInteractivePackage, f as useBuiMyInteractiveAttempts, _ as useBuiPreviewInteractiveAttempt, h as useBuiSetInteractivePassMark, v as useBuiSubmitMyInteractiveAttempt };
|
|
103
|
+
|
|
104
|
+
//# sourceMappingURL=useBuiInteractive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBuiInteractive.js","names":[],"sources":["../../../src/buildmyiq/hooks/useBuiInteractive.ts"],"sourcesContent":["/**\n * Buildmyiq — H5P-compatible interactive lesson hooks (BOFF-10561).\n * @module buildmyiq/hooks/useBuiInteractive\n *\n * Transport for interactive lessons:\n * - `buiLessonInteractivePackage(lessonId)` — the attached package with its\n * validation details (authoring view).\n * - `buiAttachInteractivePackage` / `buiSetInteractivePassMark` /\n * `buiDetachInteractivePackage` — author the package on a lesson. The\n * `.h5p` file is uploaded PRIVATE through the platform file flow first,\n * because the service only accepts a package the caller uploaded.\n * - `buiInteractivePlayer(lessonId)` — the questions without the answer key.\n * - `buiPreviewInteractiveAttempt` — an author's scored preview, not stored.\n * - `buiSubmitMyInteractiveAttempt` — a learner's scored attempt; a passing\n * attempt completes the lesson on the server.\n */\n\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\n\nimport { useBuildmyiq } from '../context';\nimport { invalidateAfterWrite } from './invalidateAfterWrite';\nimport { wspaceFetch } from './useBuiFiles';\n\nexport type BuiInteractiveItemKind = 'MULTIPLE_CHOICE' | 'TRUE_FALSE' | 'FILL_IN_BLANKS';\n\nexport interface BuiInteractiveWarning {\n code: string;\n message: string;\n}\n\nexport interface BuiInteractivePackage {\n id: string;\n lessonId: string;\n fileId: string;\n fileName: string;\n byteSize: number;\n contentType: string;\n contentTypeLabel: string;\n contentTypeVersion: string;\n title: string;\n libraries: string[];\n itemCount: number;\n maxScore: number;\n passPct: number;\n validationStatus: 'VALID' | 'REJECTED';\n warnings: BuiInteractiveWarning[];\n validatedAt: string;\n updatedAt: string;\n}\n\nexport interface BuiInteractiveItem {\n id: string;\n kind: BuiInteractiveItemKind;\n prompt: string;\n multipleAnswers: boolean;\n choices: Array<{ id: string; text: string }>;\n segments: Array<{ text: string | null; blankId: string | null }>;\n blankTips: Array<{ blankId: string; tip: string }>;\n maxScore: number;\n}\n\nexport interface BuiInteractivePlayerConfig {\n packageId: string;\n lessonId: string;\n title: string;\n contentType: string;\n contentTypeLabel: string;\n passPct: number;\n maxScore: number;\n items: BuiInteractiveItem[];\n}\n\nexport interface BuiInteractiveResponse {\n itemId: string;\n choiceIds?: string[];\n answer?: boolean | null;\n blanks?: Array<{ blankId: string; value: string }>;\n}\n\nexport interface BuiInteractiveItemResult {\n itemId: string;\n score: number;\n maxScore: number;\n correct: boolean;\n blanks: Array<{ blankId: string; correct: boolean }>;\n}\n\nexport interface BuiInteractiveAttemptResult {\n attemptId: string | null;\n score: number;\n maxScore: number;\n scaled: number;\n passed: boolean;\n passPct: number;\n lessonCompleted: boolean;\n items: BuiInteractiveItemResult[];\n createdAt: string;\n}\n\nexport interface BuiInteractiveAttemptSummary {\n id: string;\n score: number;\n maxScore: number;\n scaled: number;\n passed: boolean;\n createdAt: string;\n}\n\nconst PACKAGE_FIELDS = `\n id lessonId fileId fileName byteSize contentType contentTypeLabel contentTypeVersion\n title libraries itemCount maxScore passPct validationStatus\n warnings { code message } validatedAt updatedAt\n`;\n\nconst PLAYER_FIELDS = `\n packageId lessonId title contentType contentTypeLabel passPct maxScore\n items {\n id kind prompt multipleAnswers maxScore\n choices { id text }\n segments { text blankId }\n blankTips { blankId tip }\n }\n`;\n\nconst RESULT_FIELDS = `\n attemptId score maxScore scaled passed passPct lessonCompleted createdAt\n items { itemId score maxScore correct blanks { blankId correct } }\n`;\n\nexport const interactiveKeys = {\n all: ['buildmyiq', 'interactive'] as const,\n package: (lessonId: string) => ['buildmyiq', 'interactive', 'package', lessonId] as const,\n player: (lessonId: string) => ['buildmyiq', 'interactive', 'player', lessonId] as const,\n attempts: (enrollmentId: string, lessonId: string) =>\n ['buildmyiq', 'interactive', 'attempts', enrollmentId, lessonId] as const,\n};\n\n/** The package attached to a lesson (authoring view); null when none. */\nexport const useBuiLessonInteractivePackage = (lessonId: string | null | undefined) => {\n const { apiGatewayUrl } = useBuildmyiq();\n return useQuery({\n queryKey: interactiveKeys.package(lessonId ?? ''),\n enabled: Boolean(lessonId),\n queryFn: async () => {\n const data = await wspaceFetch<{ buiLessonInteractivePackage: BuiInteractivePackage | null }>(\n `query BuiLessonInteractivePackage($lessonId: ID!) {\n buiLessonInteractivePackage(lessonId: $lessonId) { ${PACKAGE_FIELDS} }\n }`,\n { lessonId },\n apiGatewayUrl\n );\n return data.buiLessonInteractivePackage;\n },\n });\n};\n\n/** Questions of an interactive lesson for playback; null when no package is attached. */\nexport const useBuiInteractivePlayer = (lessonId: string | null | undefined) => {\n const { apiGatewayUrl } = useBuildmyiq();\n return useQuery({\n queryKey: interactiveKeys.player(lessonId ?? ''),\n enabled: Boolean(lessonId),\n queryFn: async () => {\n const data = await wspaceFetch<{ buiInteractivePlayer: BuiInteractivePlayerConfig | null }>(\n `query BuiInteractivePlayer($lessonId: ID!) {\n buiInteractivePlayer(lessonId: $lessonId) { ${PLAYER_FIELDS} }\n }`,\n { lessonId },\n apiGatewayUrl\n );\n return data.buiInteractivePlayer;\n },\n });\n};\n\n/** The learner's recent attempts on a lesson, newest first. */\nexport const useBuiMyInteractiveAttempts = (\n enrollmentId: string | null | undefined,\n lessonId: string | null | undefined\n) => {\n const { apiGatewayUrl } = useBuildmyiq();\n return useQuery({\n queryKey: interactiveKeys.attempts(enrollmentId ?? '', lessonId ?? ''),\n enabled: Boolean(enrollmentId && lessonId),\n queryFn: async () => {\n const data = await wspaceFetch<{ buiMyInteractiveAttempts: BuiInteractiveAttemptSummary[] }>(\n `query BuiMyInteractiveAttempts($enrollmentId: ID!, $lessonId: ID!) {\n buiMyInteractiveAttempts(enrollmentId: $enrollmentId, lessonId: $lessonId) {\n id score maxScore scaled passed createdAt\n }\n }`,\n { enrollmentId, lessonId },\n apiGatewayUrl\n );\n return data.buiMyInteractiveAttempts;\n },\n });\n};\n\nconst invalidatePackage = async (\n qc: ReturnType<typeof useQueryClient>,\n lessonId: string\n): Promise<void> => {\n await Promise.all([\n invalidateAfterWrite(qc, interactiveKeys.package(lessonId)),\n invalidateAfterWrite(qc, interactiveKeys.player(lessonId)),\n ]);\n};\n\nexport const useBuiAttachInteractivePackage = () => {\n const { apiGatewayUrl } = useBuildmyiq();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (input: { lessonId: string; fileId: string; passPct?: number | null }) => {\n const data = await wspaceFetch<{ buiAttachInteractivePackage: BuiInteractivePackage }>(\n `mutation BuiAttachInteractivePackage($input: BuiAttachInteractivePackageInput!) {\n buiAttachInteractivePackage(input: $input) { ${PACKAGE_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.buiAttachInteractivePackage;\n },\n onSuccess: (pkg) => invalidatePackage(qc, pkg.lessonId),\n });\n};\n\nexport const useBuiSetInteractivePassMark = () => {\n const { apiGatewayUrl } = useBuildmyiq();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (vars: { lessonId: string; passPct: number }) => {\n const data = await wspaceFetch<{ buiSetInteractivePassMark: BuiInteractivePackage }>(\n `mutation BuiSetInteractivePassMark($lessonId: ID!, $passPct: Int!) {\n buiSetInteractivePassMark(lessonId: $lessonId, passPct: $passPct) { ${PACKAGE_FIELDS} }\n }`,\n vars,\n apiGatewayUrl\n );\n return data.buiSetInteractivePassMark;\n },\n onSuccess: (pkg) => invalidatePackage(qc, pkg.lessonId),\n });\n};\n\nexport const useBuiDetachInteractivePackage = () => {\n const { apiGatewayUrl } = useBuildmyiq();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (lessonId: string) => {\n const data = await wspaceFetch<{ buiDetachInteractivePackage: boolean }>(\n `mutation BuiDetachInteractivePackage($lessonId: ID!) {\n buiDetachInteractivePackage(lessonId: $lessonId)\n }`,\n { lessonId },\n apiGatewayUrl\n );\n return data.buiDetachInteractivePackage;\n },\n onSuccess: (_detached, lessonId) => invalidatePackage(qc, lessonId),\n });\n};\n\nexport const useBuiPreviewInteractiveAttempt = () => {\n const { apiGatewayUrl } = useBuildmyiq();\n return useMutation({\n mutationFn: async (vars: { lessonId: string; responses: BuiInteractiveResponse[] }) => {\n const data = await wspaceFetch<{ buiPreviewInteractiveAttempt: BuiInteractiveAttemptResult }>(\n `mutation BuiPreviewInteractiveAttempt($lessonId: ID!, $responses: [BuiInteractiveResponseInput!]!) {\n buiPreviewInteractiveAttempt(lessonId: $lessonId, responses: $responses) { ${RESULT_FIELDS} }\n }`,\n vars,\n apiGatewayUrl\n );\n return data.buiPreviewInteractiveAttempt;\n },\n });\n};\n\nexport const useBuiSubmitMyInteractiveAttempt = () => {\n const { apiGatewayUrl } = useBuildmyiq();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (input: {\n enrollmentId: string;\n lessonId: string;\n responses: BuiInteractiveResponse[];\n }) => {\n const data = await wspaceFetch<{\n buiSubmitMyInteractiveAttempt: BuiInteractiveAttemptResult;\n }>(\n `mutation BuiSubmitMyInteractiveAttempt($input: BuiSubmitInteractiveAttemptInput!) {\n buiSubmitMyInteractiveAttempt(input: $input) { ${RESULT_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.buiSubmitMyInteractiveAttempt;\n },\n onSuccess: async (result, input) => {\n const writes = [\n invalidateAfterWrite(qc, interactiveKeys.attempts(input.enrollmentId, input.lessonId)),\n ];\n if (result.lessonCompleted) {\n // A passing attempt completed the lesson server-side: refresh progress.\n writes.push(invalidateAfterWrite(qc, ['buildmyiq', 'enrollment', input.enrollmentId]));\n writes.push(invalidateAfterWrite(qc, ['buildmyiq', 'enrollments']));\n }\n await Promise.all(writes);\n },\n });\n};\n"],"mappings":";;;;;;AA4GA,IAAM,IAAiB,gNAMjB,IAAgB,oOAUhB,IAAgB,wJAKT,IAAkB;CAC7B,KAAK,CAAC,aAAa,aAAa;CAChC,UAAU,MAAqB;EAAC;EAAa;EAAe;EAAW;CAAQ;CAC/E,SAAS,MAAqB;EAAC;EAAa;EAAe;EAAU;CAAQ;CAC7E,WAAW,GAAsB,MAC/B;EAAC;EAAa;EAAe;EAAY;EAAc;CAAQ;AACnE,GAGa,KAAkC,MAAwC;CACrF,IAAM,EAAE,qBAAkB,EAAa;CACvC,OAAO,EAAS;EACd,UAAU,EAAgB,QAAQ,KAAY,EAAE;EAChD,SAAS,EAAQ;EACjB,SAAS,aAQA,MAPY,EACjB;+DACuD,EAAe;YAEtE,EAAE,YAAS,GACX,CACF,GACY;CAEhB,CAAC;AACH,GAGa,KAA2B,MAAwC;CAC9E,IAAM,EAAE,qBAAkB,EAAa;CACvC,OAAO,EAAS;EACd,UAAU,EAAgB,OAAO,KAAY,EAAE;EAC/C,SAAS,EAAQ;EACjB,SAAS,aAQA,MAPY,EACjB;wDACgD,EAAc;YAE9D,EAAE,YAAS,GACX,CACF,GACY;CAEhB,CAAC;AACH,GAGa,KACX,GACA,MACG;CACH,IAAM,EAAE,qBAAkB,EAAa;CACvC,OAAO,EAAS;EACd,UAAU,EAAgB,SAAS,KAAgB,IAAI,KAAY,EAAE;EACrE,SAAS,GAAQ,KAAgB;EACjC,SAAS,aAUA,MATY,EACjB,+OAKA;GAAE;GAAc;EAAS,GACzB,CACF,GACY;CAEhB,CAAC;AACH,GAEM,IAAoB,OACxB,GACA,MACkB;CAClB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AMA,AALI,EAAO,oBAET,EAAO,KAAK,EAAqB,GAAI;IAAC;IAAa;IAAc,EAAM;GAAY,CAAC,CAAC,GACrF,EAAO,KAAK,EAAqB,GAAI,CAAC,aAAa,aAAa,CAAC,CAAC,IAEpE,MAAM,QAAQ,IAAI,CAAM;EAC1B;CACF,CAAC;AACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CourseBuilderPage.d.ts","sourceRoot":"","sources":["../../../../src/buildmyiq/pages/authoring/CourseBuilderPage.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAa,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"CourseBuilderPage.d.ts","sourceRoot":"","sources":["../../../../src/buildmyiq/pages/authoring/CourseBuilderPage.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAa,MAAM,OAAO,CAAC;AA88B3C,eAAO,MAAM,iBAAiB,EAAE,EAuK/B,CAAC"}
|