@enspiredigital/xlms-headless 0.0.8 → 0.0.10

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.
@@ -0,0 +1,4 @@
1
+ import { GroupingQuestionType, PropsComponent } from '../types';
2
+ import { useGrouping } from '../hooks';
3
+ export declare function GroupingQuestion({ getData, children, }: PropsComponent<GroupingQuestionType, ReturnType<typeof useGrouping>>): import('react').ReactNode;
4
+ //# sourceMappingURL=Grouping.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Grouping.d.ts","sourceRoot":"","sources":["../../src/components/Grouping.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,wBAAgB,gBAAgB,CAAC,EAC/B,OAAO,EACP,QAAQ,GACT,EAAE,cAAc,CAAC,oBAAoB,EAAE,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC,6BAGtE"}
@@ -0,0 +1,4 @@
1
+ import { PropsComponent, UrlQuestionType } from '../types';
2
+ import { usePowerpoint } from '../hooks';
3
+ export declare function PowerpointQuestion({ getData, children, }: PropsComponent<UrlQuestionType, ReturnType<typeof usePowerpoint>>): import('react').ReactNode;
4
+ //# sourceMappingURL=Powerpoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Powerpoint.d.ts","sourceRoot":"","sources":["../../src/components/Powerpoint.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,wBAAgB,kBAAkB,CAAC,EACjC,OAAO,EACP,QAAQ,GACT,EAAE,cAAc,CAAC,eAAe,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC,6BAGnE"}
@@ -2,4 +2,6 @@ export * from './MultipleChoices';
2
2
  export * from './Matching';
3
3
  export * from './Video';
4
4
  export * from './FillInBlank';
5
+ export * from './Grouping';
6
+ export * from './Powerpoint';
5
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC"}
@@ -3,4 +3,6 @@ export * from './useBaseQuestion';
3
3
  export * from './useMatching';
4
4
  export * from './useVideo';
5
5
  export * from './useFillInBlank';
6
+ export * from './useGrouping';
7
+ export * from './usePowerpoint';
6
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useBaseQuestion.d.ts","sourceRoot":"","sources":["../../src/hooks/useBaseQuestion.ts"],"names":[],"mappings":"AAEA,wBAAgB,eAAe;;;;;gCAKM,OAAO;;EA0B3C"}
1
+ {"version":3,"file":"useBaseQuestion.d.ts","sourceRoot":"","sources":["../../src/hooks/useBaseQuestion.ts"],"names":[],"mappings":"AAEA,wBAAgB,eAAe;;;;;gCAKM,OAAO;;EAwB3C"}
@@ -1,7 +1,7 @@
1
- import { FillInBlankAnswer, FillInBlankQuestionType } from '../types/fillInBlank';
1
+ import { FillInBlankUserAnswer, FillInBlankQuestionType } from '../types/fillInBlank';
2
2
  export declare function useFillInBlank(question: FillInBlankQuestionType): {
3
- targets: import('..').FillInBlankTarget[];
4
- answers: FillInBlankAnswer[];
3
+ groups: import('..').FillInBlankGroup[];
4
+ answers: FillInBlankUserAnswer[];
5
5
  question: FillInBlankQuestionType;
6
6
  submitted: boolean | null;
7
7
  isCorrect: boolean | null;
@@ -1 +1 @@
1
- {"version":3,"file":"useFillInBlank.d.ts","sourceRoot":"","sources":["../../src/hooks/useFillInBlank.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAElF,wBAAgB,cAAc,CAAC,QAAQ,EAAE,uBAAuB;;;;;;;;uBAYpC,MAAM,SAAS,MAAM;;;;;;;EAoEhD"}
1
+ {"version":3,"file":"useFillInBlank.d.ts","sourceRoot":"","sources":["../../src/hooks/useFillInBlank.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAEtF,wBAAgB,cAAc,CAAC,QAAQ,EAAE,uBAAuB;;;;;;;;uBAYpC,MAAM,SAAS,MAAM;;;;;;;EA8EhD"}
@@ -0,0 +1,21 @@
1
+ import { GroupingAnswer, GroupingQuestionType } from '../types/grouping';
2
+ export declare function useGrouping(question: GroupingQuestionType): {
3
+ categories: import('..').GroupingCategory[];
4
+ allItems: import('..').GroupingItem[];
5
+ question: GroupingQuestionType;
6
+ answers: GroupingAnswer[];
7
+ unassignedItems: import('..').GroupingItem[];
8
+ submitted: boolean | null;
9
+ isCorrect: boolean | null;
10
+ attempts: number;
11
+ canAnswer: boolean;
12
+ move: (itemId: string, categoryId: string) => void;
13
+ remove: (itemId: string) => void;
14
+ submit: () => {
15
+ isCorrect: boolean;
16
+ score: number;
17
+ maxScore: number;
18
+ };
19
+ reset: () => void;
20
+ };
21
+ //# sourceMappingURL=useGrouping.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useGrouping.d.ts","sourceRoot":"","sources":["../../src/hooks/useGrouping.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEzE,wBAAgB,WAAW,CAAC,QAAQ,EAAE,oBAAoB;;;;;;;;;;mBAYlC,MAAM,cAAc,MAAM;qBAYxB,MAAM;;;;;;;EA+E/B"}
@@ -0,0 +1,13 @@
1
+ import { UrlQuestionType } from '../types';
2
+ export declare function usePowerpoint(question: UrlQuestionType): {
3
+ question: UrlQuestionType;
4
+ url: string;
5
+ type: string;
6
+ submit: () => void;
7
+ reset: () => void;
8
+ submitted: boolean | null;
9
+ isCorrect: boolean | null;
10
+ attempts: number;
11
+ canAnswer: boolean;
12
+ };
13
+ //# sourceMappingURL=usePowerpoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePowerpoint.d.ts","sourceRoot":"","sources":["../../src/hooks/usePowerpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAG3C,wBAAgB,aAAa,CAAC,QAAQ,EAAE,eAAe;;;;;;;;;;EAmCtD"}
package/dist/index.js CHANGED
@@ -1,54 +1,54 @@
1
- import { useState as C, useEffect as B } from "react";
2
- function S() {
3
- const [t, e] = C(null), [s, i] = C(null), [a, g] = C(0);
4
- function w(c) {
5
- t || (e(!0), i(c), g((A) => A + 1));
1
+ import { useState as I, useEffect as _, useMemo as j } from "react";
2
+ function k() {
3
+ const [t, e] = I(null), [s, f] = I(null), [p, w] = I(0);
4
+ function g(u) {
5
+ e(!0), f(u), w((A) => A + 1);
6
6
  }
7
7
  function r() {
8
- e(!1), i(null);
8
+ e(!1), f(null);
9
9
  }
10
10
  return {
11
11
  // state
12
12
  submitted: t,
13
13
  isCorrect: s,
14
- attempts: a,
14
+ attempts: p,
15
15
  // derived
16
16
  canAnswer: !t,
17
17
  // actions
18
- submitQuestion: w,
18
+ submitQuestion: g,
19
19
  resetQuestion: r
20
20
  };
21
21
  }
22
- function k(t, e) {
22
+ function E(t, e) {
23
23
  if (t.length !== e.length) return !1;
24
- const s = new Set(t), i = new Set(e);
25
- if (s.size !== i.size) return !1;
26
- for (const a of s)
27
- if (!i.has(a)) return !1;
24
+ const s = new Set(t), f = new Set(e);
25
+ if (s.size !== f.size) return !1;
26
+ for (const p of s)
27
+ if (!f.has(p)) return !1;
28
28
  return !0;
29
29
  }
30
- function V(t) {
30
+ function L(t) {
31
31
  const {
32
32
  canAnswer: e,
33
33
  submitted: s,
34
- isCorrect: i,
35
- attempts: a,
36
- resetQuestion: g,
37
- submitQuestion: w
38
- } = S(), [r, c] = C([]);
39
- function A(d) {
40
- c((n) => t.options.allowMultipleAnswers ? n.includes(d) ? n.filter((l) => l !== d) : [...n, d] : [d]);
34
+ isCorrect: f,
35
+ attempts: p,
36
+ resetQuestion: w,
37
+ submitQuestion: g
38
+ } = k(), [r, u] = I([]);
39
+ function A(C) {
40
+ u((l) => t.options.allowMultipleAnswers ? l.includes(C) ? l.filter((d) => d !== C) : [...l, C] : [C]);
41
41
  }
42
42
  function h() {
43
43
  if (r.length === 0) return;
44
- const d = t.options.answers.reduce(
45
- (l, f) => (f.is_correct && l.push(f.id), l),
44
+ const C = t.options.answers.reduce(
45
+ (d, n) => (n.is_correct && d.push(n.id), d),
46
46
  []
47
- ), n = k(r, d);
48
- w(n);
47
+ ), l = E(r, C);
48
+ g(l);
49
49
  }
50
- function I() {
51
- c([]), g();
50
+ function S() {
51
+ u([]), w();
52
52
  }
53
53
  return {
54
54
  // data
@@ -57,71 +57,71 @@ function V(t) {
57
57
  // actions
58
58
  select: A,
59
59
  submit: h,
60
- reset: I,
60
+ reset: S,
61
61
  // base
62
62
  submitted: s,
63
- isCorrect: i,
64
- attempts: a,
63
+ isCorrect: f,
64
+ attempts: p,
65
65
  canAnswer: e
66
66
  };
67
67
  }
68
- function v(t) {
68
+ function O(t) {
69
69
  const {
70
70
  canAnswer: e,
71
71
  submitted: s,
72
- isCorrect: i,
73
- attempts: a,
74
- submitQuestion: g,
75
- resetQuestion: w
76
- } = S(), [r, c] = C([]), [A, h] = C(
72
+ isCorrect: f,
73
+ attempts: p,
74
+ submitQuestion: w,
75
+ resetQuestion: g
76
+ } = k(), [r, u] = I([]), [A, h] = I(
77
77
  []
78
- ), [I, d] = C(
78
+ ), [S, C] = I(
79
79
  []
80
80
  );
81
- function n(o, m) {
82
- c((u) => [
83
- ...u.filter(
84
- (p) => p.targetId !== o && p.sourceId !== m
81
+ function l(o, i) {
82
+ u((c) => [
83
+ ...c.filter(
84
+ (b) => b.targetId !== o && b.sourceId !== i
85
85
  ),
86
- { targetId: o, sourceId: m }
86
+ { targetId: o, sourceId: i }
87
87
  ]);
88
88
  }
89
- function l(o, m) {
90
- c(
91
- (u) => u.filter((p) => p.targetId !== o || p.sourceId !== m)
89
+ function d(o, i) {
90
+ u(
91
+ (c) => c.filter((b) => b.targetId !== o || b.sourceId !== i)
92
92
  );
93
93
  }
94
- function f() {
95
- let o = 0, m = !0;
96
- return t.options.targets.forEach((u) => {
97
- const p = r.find((M) => M.targetId === u.id), x = t.options.sources[u.content.correct_position - 1];
98
- p && x && p.sourceId === x.id ? o += u.content.point : m = !1;
94
+ function n() {
95
+ let o = 0, i = !0;
96
+ return t.options.targets.forEach((c) => {
97
+ const b = r.find((x) => x.targetId === c.id), Q = t.options.sources[c.content.correct_position - 1];
98
+ b && Q && b.sourceId === Q.id ? o += c.content.point : i = !1;
99
99
  }), {
100
- isCorrect: m,
100
+ isCorrect: i,
101
101
  score: o,
102
102
  maxScore: t.options.targets.reduce(
103
- (u, p) => u + p.content.point,
103
+ (c, b) => c + b.content.point,
104
104
  0
105
105
  )
106
106
  };
107
107
  }
108
- function Q() {
109
- const o = f();
110
- return g(o.isCorrect), o;
108
+ function m() {
109
+ const o = n();
110
+ return w(o.isCorrect), o;
111
111
  }
112
- function b() {
113
- c([]), w();
112
+ function a() {
113
+ u([]), g();
114
114
  }
115
- return B(() => {
115
+ return _(() => {
116
116
  const o = t.options.sources.filter(
117
- (m) => !r.some((u) => u.sourceId === m.id)
117
+ (i) => !r.some((c) => c.sourceId === i.id)
118
118
  );
119
119
  h(o);
120
- }, [r, t.options.sources]), B(() => {
120
+ }, [r, t.options.sources]), _(() => {
121
121
  const o = t.options.targets.filter(
122
- (m) => !r.some((u) => u.targetId === m.id)
122
+ (i) => !r.some((c) => c.targetId === i.id)
123
123
  );
124
- d(o);
124
+ C(o);
125
125
  }, [r, t.options.targets]), {
126
126
  // data
127
127
  sources: t.options.sources,
@@ -129,33 +129,33 @@ function v(t) {
129
129
  answers: r,
130
130
  question: t,
131
131
  availableSources: A,
132
- availableTargets: I,
132
+ availableTargets: S,
133
133
  // base
134
134
  submitted: s,
135
- isCorrect: i,
136
- attempts: a,
135
+ isCorrect: f,
136
+ attempts: p,
137
137
  canAnswer: e,
138
138
  // actions
139
- select: n,
140
- remove: l,
141
- submit: Q,
142
- reset: b
139
+ select: l,
140
+ remove: d,
141
+ submit: m,
142
+ reset: a
143
143
  };
144
144
  }
145
145
  function T(t) {
146
146
  const {
147
147
  canAnswer: e,
148
148
  submitted: s,
149
- isCorrect: i,
150
- attempts: a,
151
- resetQuestion: g,
152
- submitQuestion: w
153
- } = S();
149
+ isCorrect: f,
150
+ attempts: p,
151
+ resetQuestion: w,
152
+ submitQuestion: g
153
+ } = k();
154
154
  function r() {
155
- w(!0);
155
+ g(!0);
156
156
  }
157
- function c() {
158
- g();
157
+ function u() {
158
+ w();
159
159
  }
160
160
  return {
161
161
  // data
@@ -164,111 +164,226 @@ function T(t) {
164
164
  type: t.options.urlType,
165
165
  // actions
166
166
  submit: r,
167
- reset: c,
167
+ reset: u,
168
168
  // base
169
169
  submitted: s,
170
- isCorrect: i,
171
- attempts: a,
170
+ isCorrect: f,
171
+ attempts: p,
172
172
  canAnswer: e
173
173
  };
174
174
  }
175
- function _(t) {
175
+ function v(t) {
176
176
  const {
177
177
  canAnswer: e,
178
178
  submitted: s,
179
- isCorrect: i,
180
- attempts: a,
181
- submitQuestion: g,
182
- resetQuestion: w
183
- } = S(), [r, c] = C([]);
184
- function A(n, l) {
185
- e && c((f) => {
186
- const Q = f.findIndex((b) => b.targetId === n);
187
- if (Q >= 0) {
188
- const b = [...f];
189
- return b[Q] = { targetId: n, value: l }, b;
179
+ isCorrect: f,
180
+ attempts: p,
181
+ submitQuestion: w,
182
+ resetQuestion: g
183
+ } = k(), [r, u] = I([]);
184
+ function A(l, d) {
185
+ u((n) => {
186
+ const m = n.findIndex((a) => a.targetId === l);
187
+ if (m >= 0) {
188
+ const a = [...n];
189
+ return a[m] = { targetId: l, value: d }, a;
190
190
  }
191
- return [...f, { targetId: n, value: l }];
191
+ return [...n, { targetId: l, value: d }];
192
192
  });
193
193
  }
194
194
  function h() {
195
- let n = !0;
196
- if (r.length < t.options.targets.length)
197
- n = !1;
198
- else
199
- for (const l of t.options.targets) {
200
- const f = r.find((o) => o.targetId === l.id), Q = f ? f.value.trim() : "", b = l.content.correct_answer.trim();
201
- if (Q.toLowerCase() !== b.toLowerCase()) {
202
- n = !1;
203
- break;
204
- }
205
- }
206
- return {
207
- isCorrect: n,
208
- score: n ? 1 : 0,
209
- maxScore: 1
195
+ let l = 0, d = 0, n = 0;
196
+ const m = t.correct_answers.list || {}, a = Object.keys(m).length;
197
+ Object.entries(m).forEach(([i, c]) => {
198
+ const b = String(c).trim().toLowerCase(), Q = t.options.answers.find(
199
+ (M) => M.correct_position === Number(i)
200
+ ), x = Q && Q.point || 1;
201
+ n += x;
202
+ const B = r.find((M) => M.targetId === i);
203
+ (B ? String(B.value).trim().toLowerCase() : "") === b && (l += x, d++);
204
+ });
205
+ const o = d === a && a > 0;
206
+ return n === 0 && a > 0 && (n = a), {
207
+ isCorrect: o,
208
+ score: Math.round(l * 100) / 100,
209
+ maxScore: Math.round(n * 100) / 100
210
210
  };
211
211
  }
212
- function I() {
213
- const n = h();
214
- return g(n.isCorrect), n;
212
+ function S() {
213
+ const l = h();
214
+ return w(l.isCorrect), l;
215
215
  }
216
- function d() {
217
- c([]), w();
216
+ function C() {
217
+ u([]), g();
218
218
  }
219
219
  return {
220
220
  // data
221
- targets: t.options.targets,
221
+ groups: t.options.groups,
222
222
  answers: r,
223
223
  question: t,
224
224
  // base
225
225
  submitted: s,
226
- isCorrect: i,
227
- attempts: a,
226
+ isCorrect: f,
227
+ attempts: p,
228
228
  canAnswer: e,
229
229
  // actions
230
230
  answer: A,
231
- submit: I,
232
- reset: d
231
+ submit: S,
232
+ reset: C
233
+ };
234
+ }
235
+ function z(t) {
236
+ const {
237
+ canAnswer: e,
238
+ submitted: s,
239
+ isCorrect: f,
240
+ attempts: p,
241
+ submitQuestion: w,
242
+ resetQuestion: g
243
+ } = k(), [r, u] = I([]);
244
+ function A(n, m) {
245
+ u((a) => {
246
+ const o = a.findIndex((i) => i.itemId === n);
247
+ if (o >= 0) {
248
+ const i = [...a];
249
+ return i[o] = { itemId: n, categoryId: m }, i;
250
+ }
251
+ return [...a, { itemId: n, categoryId: m }];
252
+ });
253
+ }
254
+ function h(n) {
255
+ u((m) => m.filter((a) => a.itemId !== n));
256
+ }
257
+ function S() {
258
+ let n = 0, m = 0;
259
+ const o = t.correct_answers.list || {}, i = Object.keys(o).length;
260
+ let c = 0;
261
+ return Object.entries(o).forEach(([Q, x]) => {
262
+ const B = t.options.items.find((y) => y.id === Q), V = B ? B.point : 0;
263
+ c += V;
264
+ const M = r.find((y) => y.itemId === Q);
265
+ M && M.categoryId === x && (n += V, m++);
266
+ }), n = Math.round(n * 100) / 100, c = Math.round(c * 100) / 100, {
267
+ isCorrect: m === i && i > 0,
268
+ score: n,
269
+ maxScore: c
270
+ };
271
+ }
272
+ function C() {
273
+ const n = S();
274
+ return w(n.isCorrect), n;
275
+ }
276
+ function l() {
277
+ u([]), g();
278
+ }
279
+ const d = j(() => t.options.items.filter(
280
+ (n) => !r.some((m) => m.itemId === n.id)
281
+ ), [t.options.items, r]);
282
+ return {
283
+ // data
284
+ categories: t.options.categories,
285
+ allItems: t.options.items,
286
+ question: t,
287
+ // state
288
+ answers: r,
289
+ unassignedItems: d,
290
+ // base
291
+ submitted: s,
292
+ isCorrect: f,
293
+ attempts: p,
294
+ canAnswer: e,
295
+ // actions
296
+ move: A,
297
+ remove: h,
298
+ submit: C,
299
+ reset: l
300
+ };
301
+ }
302
+ function F(t) {
303
+ const {
304
+ canAnswer: e,
305
+ submitted: s,
306
+ isCorrect: f,
307
+ attempts: p,
308
+ resetQuestion: w,
309
+ submitQuestion: g
310
+ } = k();
311
+ function r() {
312
+ s || g(!0);
313
+ }
314
+ function u() {
315
+ w();
316
+ }
317
+ return {
318
+ // data
319
+ question: t,
320
+ url: t.options.url,
321
+ type: t.options.urlType,
322
+ // actions
323
+ submit: r,
324
+ reset: u,
325
+ // base
326
+ submitted: s,
327
+ isCorrect: f,
328
+ attempts: p,
329
+ canAnswer: e
233
330
  };
234
331
  }
235
- function z({
332
+ function P({
236
333
  getData: t,
237
334
  children: e
238
335
  }) {
239
- const s = V(t());
336
+ const s = L(t());
240
337
  return e(s);
241
338
  }
242
- function E({
339
+ function N({
243
340
  getData: t,
244
341
  children: e
245
342
  }) {
246
- const s = v(t());
343
+ const s = O(t());
247
344
  return e(s);
248
345
  }
249
- function F({
346
+ function D({
250
347
  getData: t,
251
348
  children: e
252
349
  }) {
253
350
  const s = T(t());
254
351
  return e(s);
255
352
  }
256
- function L({
353
+ function H({
354
+ getData: t,
355
+ children: e
356
+ }) {
357
+ const s = v(t());
358
+ return e(s);
359
+ }
360
+ function J({
361
+ getData: t,
362
+ children: e
363
+ }) {
364
+ const s = z(t());
365
+ return e(s);
366
+ }
367
+ function R({
257
368
  getData: t,
258
369
  children: e
259
370
  }) {
260
- const s = _(t());
371
+ const s = F(t());
261
372
  return e(s);
262
373
  }
263
374
  export {
264
- L as FillInBlankQuestion,
265
- E as MatchingQuestion,
266
- z as MultipleChoicesQuestion,
267
- F as VideoQuestion,
268
- k as isSameSet,
269
- S as useBaseQuestion,
270
- _ as useFillInBlank,
271
- v as useMatching,
272
- V as useMultipleChoice,
375
+ H as FillInBlankQuestion,
376
+ J as GroupingQuestion,
377
+ N as MatchingQuestion,
378
+ P as MultipleChoicesQuestion,
379
+ R as PowerpointQuestion,
380
+ D as VideoQuestion,
381
+ E as isSameSet,
382
+ k as useBaseQuestion,
383
+ v as useFillInBlank,
384
+ z as useGrouping,
385
+ O as useMatching,
386
+ L as useMultipleChoice,
387
+ F as usePowerpoint,
273
388
  T as useVideo
274
389
  };
@@ -13,7 +13,7 @@ export interface BaseQuestion {
13
13
  correct_answers: {
14
14
  ids: string | number[];
15
15
  } | {
16
- list: Record<string, unknown>;
16
+ list: Record<string, string>;
17
17
  };
18
18
  metadata: {
19
19
  instructions: string;
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/types/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,MAAM,WAAW,KAAK;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE;QACP,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,KAAK,CAAC;QACd,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;KAClB,CAAC;IACF,eAAe,EACX;QACE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;KACxB,GACD;QAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC;IACtC,QAAQ,EAAE;QACR,YAAY,EAAE,MAAM,CAAC;QACrB,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED,MAAM,WAAW,cAAc,CAAC,IAAI,EAAE,GAAG;IACvC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,SAAS,CAAC;CACnC"}
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/types/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,MAAM,WAAW,KAAK;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE;QACP,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,KAAK,CAAC;QACd,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;KAClB,CAAC;IACF,eAAe,EACX;QACE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;KACxB,GACD;QAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,CAAC;IACrC,QAAQ,EAAE;QACR,YAAY,EAAE,MAAM,CAAC;QACrB,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED,MAAM,WAAW,cAAc,CAAC,IAAI,EAAE,GAAG;IACvC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,SAAS,CAAC;CACnC"}
@@ -1,18 +1,29 @@
1
1
  import { BaseQuestion, Media } from './common';
2
2
  export interface FillInBlankQuestionType extends BaseQuestion {
3
3
  options: {
4
- content: string;
5
- targets: FillInBlankTarget[];
4
+ answers: FillInBlankAnswer[];
5
+ groups: FillInBlankGroup[];
6
6
  };
7
- }
8
- export interface FillInBlankTarget {
9
- id: string;
10
- content: {
11
- correct_answer: string;
12
- media?: Media;
7
+ correct_answers: {
8
+ list: Record<string, string>;
13
9
  };
14
10
  }
15
11
  export interface FillInBlankAnswer {
12
+ id: string;
13
+ text: string;
14
+ point: number;
15
+ media: Media;
16
+ correct_position: number;
17
+ group_position?: number | null;
18
+ }
19
+ export interface FillInBlankGroup {
20
+ id: string;
21
+ position: number | null;
22
+ count: number;
23
+ text: string;
24
+ media: Media;
25
+ }
26
+ export interface FillInBlankUserAnswer {
16
27
  targetId: string;
17
28
  value: string;
18
29
  }
@@ -1 +1 @@
1
- {"version":3,"file":"fillInBlank.d.ts","sourceRoot":"","sources":["../../src/types/fillInBlank.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAE/C,MAAM,WAAW,uBAAwB,SAAQ,YAAY;IAC3D,OAAO,EAAE;QACP,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,iBAAiB,EAAE,CAAC;KAC9B,CAAC;CACH;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE;QACP,cAAc,EAAE,MAAM,CAAC;QACvB,KAAK,CAAC,EAAE,KAAK,CAAC;KACf,CAAC;CACH;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf"}
1
+ {"version":3,"file":"fillInBlank.d.ts","sourceRoot":"","sources":["../../src/types/fillInBlank.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAE/C,MAAM,WAAW,uBAAwB,SAAQ,YAAY;IAC3D,OAAO,EAAE;QACP,OAAO,EAAE,iBAAiB,EAAE,CAAC;QAC7B,MAAM,EAAE,gBAAgB,EAAE,CAAC;KAC5B,CAAC;IACF,eAAe,EAAE;QACf,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC9B,CAAC;CACH;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,KAAK,CAAC;IACb,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,KAAK,CAAC;CACd;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf"}
@@ -0,0 +1,24 @@
1
+ import { BaseQuestion, Media } from './common';
2
+ export interface GroupingQuestionType extends BaseQuestion {
3
+ options: {
4
+ categories: GroupingCategory[];
5
+ items: GroupingItem[];
6
+ };
7
+ }
8
+ export interface GroupingCategory {
9
+ id: string;
10
+ name: string;
11
+ media?: Media;
12
+ }
13
+ export interface GroupingItem {
14
+ id: string;
15
+ text: string;
16
+ point: number;
17
+ media?: Media;
18
+ group_position?: number;
19
+ }
20
+ export interface GroupingAnswer {
21
+ itemId: string;
22
+ categoryId: string;
23
+ }
24
+ //# sourceMappingURL=grouping.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grouping.d.ts","sourceRoot":"","sources":["../../src/types/grouping.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAE/C,MAAM,WAAW,oBAAqB,SAAQ,YAAY;IACxD,OAAO,EAAE;QACP,UAAU,EAAE,gBAAgB,EAAE,CAAC;QAC/B,KAAK,EAAE,YAAY,EAAE,CAAC;KACvB,CAAC;CACH;AAED,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB"}
@@ -3,4 +3,5 @@ export * from './common';
3
3
  export * from './matching';
4
4
  export * from './url';
5
5
  export * from './fillInBlank';
6
+ export * from './grouping';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC"}
package/package.json CHANGED
@@ -1,23 +1,23 @@
1
- {
2
- "name": "@enspiredigital/xlms-headless",
3
- "version": "0.0.8",
4
- "type": "module",
5
- "main": "./dist/index.js",
6
- "module": "./dist/index.js",
7
- "types": "./dist/index.d.ts",
8
- "exports": {
9
- "./package.json": "./package.json",
10
- ".": {
11
- "types": "./dist/index.d.ts",
12
- "import": "./dist/index.js",
13
- "default": "./dist/index.js"
14
- }
15
- },
16
- "files": [
17
- "dist",
18
- "!**/*.tsbuildinfo"
19
- ],
20
- "publishConfig": {
21
- "access": "public"
22
- }
23
- }
1
+ {
2
+ "name": "@enspiredigital/xlms-headless",
3
+ "version": "0.0.10",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ "./package.json": "./package.json",
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "default": "./dist/index.js"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "!**/*.tsbuildinfo"
19
+ ],
20
+ "publishConfig": {
21
+ "access": "public"
22
+ }
23
+ }