@intellectif/lk-react 23.0.1 → 23.1.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.
Files changed (178) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +4 -4
  3. package/dist/{WrittenResponse-CgRrjM4S.d.ts → WrittenResponse-B7A5gHMj.d.ts} +1 -1
  4. package/dist/{WrittenResponse-D2K1VW_V.d.cts → WrittenResponse-BpL9p2Hn.d.cts} +1 -1
  5. package/dist/ai/LkAiProvider.cjs +3 -3
  6. package/dist/ai/LkAiProvider.d.cts +12 -2
  7. package/dist/ai/LkAiProvider.d.ts +12 -2
  8. package/dist/ai/LkAiProvider.js +1 -1
  9. package/dist/ai/useAiHelp.cjs +9 -7
  10. package/dist/ai/useAiHelp.d.cts +82 -3
  11. package/dist/ai/useAiHelp.d.ts +82 -3
  12. package/dist/ai/useAiHelp.js +2 -4
  13. package/dist/{chunk-VPU6UY4O.cjs → chunk-2PNSVBLQ.cjs} +5 -6
  14. package/dist/chunk-2PNSVBLQ.cjs.map +1 -0
  15. package/dist/{chunk-HZIT24BK.js → chunk-4ZZWZSWI.js} +4 -4
  16. package/dist/{chunk-HZIT24BK.js.map → chunk-4ZZWZSWI.js.map} +1 -1
  17. package/dist/{chunk-B7JU52YQ.cjs → chunk-7ALBSPYR.cjs} +34 -35
  18. package/dist/chunk-7ALBSPYR.cjs.map +1 -0
  19. package/dist/{chunk-TGTP5DKF.js → chunk-7NFY3M3W.js} +10 -10
  20. package/dist/{chunk-TGTP5DKF.js.map → chunk-7NFY3M3W.js.map} +1 -1
  21. package/dist/{chunk-E4UF4XZM.js → chunk-7SB2MJA4.js} +4 -4
  22. package/dist/{chunk-E4UF4XZM.js.map → chunk-7SB2MJA4.js.map} +1 -1
  23. package/dist/{chunk-ERV666AR.js → chunk-ABJJ3LII.js} +9 -10
  24. package/dist/chunk-ABJJ3LII.js.map +1 -0
  25. package/dist/{chunk-NFGUJ52G.cjs → chunk-BIGGXHAW.cjs} +8 -2
  26. package/dist/chunk-BIGGXHAW.cjs.map +1 -0
  27. package/dist/{chunk-O7MINPKZ.js → chunk-C7QZE5BI.js} +9 -10
  28. package/dist/chunk-C7QZE5BI.js.map +1 -0
  29. package/dist/{chunk-IYGF7PZY.cjs → chunk-CWTUWNV3.cjs} +25 -26
  30. package/dist/chunk-CWTUWNV3.cjs.map +1 -0
  31. package/dist/{chunk-4MXECBZT.js → chunk-DC4CQCK5.js} +40 -13
  32. package/dist/chunk-DC4CQCK5.js.map +1 -0
  33. package/dist/{chunk-PGAPZ6UE.cjs → chunk-DS6HN3YR.cjs} +34 -35
  34. package/dist/chunk-DS6HN3YR.cjs.map +1 -0
  35. package/dist/{chunk-U5VFJVQ2.js → chunk-FDQR4GAZ.js} +3 -4
  36. package/dist/chunk-FDQR4GAZ.js.map +1 -0
  37. package/dist/{chunk-DPNCCWOV.js → chunk-FKGMSOJF.js} +8 -9
  38. package/dist/chunk-FKGMSOJF.js.map +1 -0
  39. package/dist/{chunk-SPSKDNEE.js → chunk-G6PXJ2SA.js} +11 -12
  40. package/dist/chunk-G6PXJ2SA.js.map +1 -0
  41. package/dist/{chunk-C4PSJ3ZC.js → chunk-HNLRVRQR.js} +8 -2
  42. package/dist/chunk-HNLRVRQR.js.map +1 -0
  43. package/dist/{chunk-FISEZBLF.cjs → chunk-J3C72RPK.cjs} +7 -7
  44. package/dist/{chunk-FISEZBLF.cjs.map → chunk-J3C72RPK.cjs.map} +1 -1
  45. package/dist/{chunk-SHDSOOBF.cjs → chunk-KFLIDTDU.cjs} +25 -26
  46. package/dist/chunk-KFLIDTDU.cjs.map +1 -0
  47. package/dist/{chunk-W6UMY7PF.cjs → chunk-KHKH5LCT.cjs} +7 -8
  48. package/dist/chunk-KHKH5LCT.cjs.map +1 -0
  49. package/dist/{chunk-7F2YQWMW.cjs → chunk-LBEKRN6Y.cjs} +122 -11
  50. package/dist/chunk-LBEKRN6Y.cjs.map +1 -0
  51. package/dist/{chunk-6RIM5EQP.cjs → chunk-LPUWXIPR.cjs} +197 -12
  52. package/dist/chunk-LPUWXIPR.cjs.map +1 -0
  53. package/dist/{chunk-XS6OYYVR.cjs → chunk-MKXEM2C5.cjs} +19 -20
  54. package/dist/chunk-MKXEM2C5.cjs.map +1 -0
  55. package/dist/{chunk-CXIP7ERK.js → chunk-MXNC5UNO.js} +182 -8
  56. package/dist/chunk-MXNC5UNO.js.map +1 -0
  57. package/dist/{chunk-MXZHL4U5.cjs → chunk-NAK55BYU.cjs} +31 -32
  58. package/dist/chunk-NAK55BYU.cjs.map +1 -0
  59. package/dist/{chunk-UKUHVCZX.cjs → chunk-NDBMKGQ5.cjs} +5 -5
  60. package/dist/{chunk-UKUHVCZX.cjs.map → chunk-NDBMKGQ5.cjs.map} +1 -1
  61. package/dist/{chunk-XYJBRKBZ.js → chunk-ORT3KLGI.js} +3 -4
  62. package/dist/chunk-ORT3KLGI.js.map +1 -0
  63. package/dist/{chunk-JMEZYYCE.js → chunk-PWHECW6N.js} +11 -12
  64. package/dist/chunk-PWHECW6N.js.map +1 -0
  65. package/dist/{chunk-6GQLCCGN.js → chunk-RBS5A2DF.js} +9 -10
  66. package/dist/chunk-RBS5A2DF.js.map +1 -0
  67. package/dist/{chunk-B4JRBV56.cjs → chunk-RPWUDXG5.cjs} +6 -6
  68. package/dist/{chunk-B4JRBV56.cjs.map → chunk-RPWUDXG5.cjs.map} +1 -1
  69. package/dist/{chunk-KI6DJ5ZF.js → chunk-TCDJY3H6.js} +9 -10
  70. package/dist/chunk-TCDJY3H6.js.map +1 -0
  71. package/dist/{chunk-DZ7VLLDQ.cjs → chunk-TP5UMRAU.cjs} +66 -39
  72. package/dist/chunk-TP5UMRAU.cjs.map +1 -0
  73. package/dist/{chunk-HYOUMTPW.js → chunk-TS7J6DTY.js} +3 -3
  74. package/dist/{chunk-HYOUMTPW.js.map → chunk-TS7J6DTY.js.map} +1 -1
  75. package/dist/{chunk-OJGTJOWI.cjs → chunk-TUVENMXB.cjs} +2 -2
  76. package/dist/chunk-TUVENMXB.cjs.map +1 -0
  77. package/dist/{chunk-WZ2TBXVB.cjs → chunk-V6BA44DS.cjs} +18 -18
  78. package/dist/{chunk-WZ2TBXVB.cjs.map → chunk-V6BA44DS.cjs.map} +1 -1
  79. package/dist/{chunk-2OP5YHRR.js → chunk-XO5R73Y4.js} +120 -10
  80. package/dist/chunk-XO5R73Y4.js.map +1 -0
  81. package/dist/{chunk-QAZO3ANW.cjs → chunk-YY4PFR3Z.cjs} +34 -35
  82. package/dist/chunk-YY4PFR3Z.cjs.map +1 -0
  83. package/dist/{chunk-RX3A6KIY.js → chunk-ZPI6Q42R.js} +2 -2
  84. package/dist/chunk-ZPI6Q42R.js.map +1 -0
  85. package/dist/components/ActivityPreview.cjs +16 -18
  86. package/dist/components/ActivityPreview.d.cts +2 -2
  87. package/dist/components/ActivityPreview.d.ts +2 -2
  88. package/dist/components/ActivityPreview.js +15 -17
  89. package/dist/components/ActivitySequence.cjs +17 -19
  90. package/dist/components/ActivitySequence.d.cts +2 -2
  91. package/dist/components/ActivitySequence.d.ts +2 -2
  92. package/dist/components/ActivitySequence.js +16 -18
  93. package/dist/components/Dictation.cjs +9 -11
  94. package/dist/components/Dictation.d.cts +1 -1
  95. package/dist/components/Dictation.d.ts +1 -1
  96. package/dist/components/Dictation.js +8 -10
  97. package/dist/components/FillInTheBlanks.cjs +9 -11
  98. package/dist/components/FillInTheBlanks.d.cts +1 -1
  99. package/dist/components/FillInTheBlanks.d.ts +1 -1
  100. package/dist/components/FillInTheBlanks.js +8 -10
  101. package/dist/components/GapSelect.cjs +9 -11
  102. package/dist/components/GapSelect.d.cts +1 -1
  103. package/dist/components/GapSelect.d.ts +1 -1
  104. package/dist/components/GapSelect.js +8 -10
  105. package/dist/components/InteractiveVideo.cjs +16 -18
  106. package/dist/components/InteractiveVideo.d.cts +2 -2
  107. package/dist/components/InteractiveVideo.d.ts +2 -2
  108. package/dist/components/InteractiveVideo.js +14 -16
  109. package/dist/components/MultipleChoice.cjs +9 -11
  110. package/dist/components/MultipleChoice.d.cts +1 -1
  111. package/dist/components/MultipleChoice.d.ts +1 -1
  112. package/dist/components/MultipleChoice.js +8 -10
  113. package/dist/components/PronunciationFeedback.cjs +6 -5
  114. package/dist/components/PronunciationFeedback.d.cts +28 -7
  115. package/dist/components/PronunciationFeedback.d.ts +28 -7
  116. package/dist/components/PronunciationFeedback.js +5 -4
  117. package/dist/components/ReadAloud.cjs +9 -9
  118. package/dist/components/ReadAloud.d.cts +2 -2
  119. package/dist/components/ReadAloud.d.ts +2 -2
  120. package/dist/components/ReadAloud.js +8 -8
  121. package/dist/components/StimulusPanel.cjs +4 -4
  122. package/dist/components/StimulusPanel.d.cts +1 -1
  123. package/dist/components/StimulusPanel.d.ts +1 -1
  124. package/dist/components/StimulusPanel.js +3 -3
  125. package/dist/components/WrittenResponse.cjs +8 -10
  126. package/dist/components/WrittenResponse.d.cts +3 -3
  127. package/dist/components/WrittenResponse.d.ts +3 -3
  128. package/dist/components/WrittenResponse.js +7 -9
  129. package/dist/i18n/LkIntlProvider.cjs +7 -7
  130. package/dist/i18n/LkIntlProvider.d.cts +2 -2
  131. package/dist/i18n/LkIntlProvider.d.ts +2 -2
  132. package/dist/i18n/LkIntlProvider.js +1 -1
  133. package/dist/index.cjs +58 -56
  134. package/dist/index.cjs.map +1 -1
  135. package/dist/index.d.cts +3 -3
  136. package/dist/index.d.ts +3 -3
  137. package/dist/index.js +18 -20
  138. package/dist/index.js.map +1 -1
  139. package/dist/theme/skin.css +46 -1
  140. package/dist/{types-CrtIcRcK.d.ts → types-C4IsUQsK.d.ts} +16 -0
  141. package/dist/{types-CO0XLEN6.d.cts → types-CJgZWtl4.d.cts} +16 -0
  142. package/package.json +3 -3
  143. package/dist/chunk-2OP5YHRR.js.map +0 -1
  144. package/dist/chunk-4MXECBZT.js.map +0 -1
  145. package/dist/chunk-54DX6SLS.cjs +0 -42
  146. package/dist/chunk-54DX6SLS.cjs.map +0 -1
  147. package/dist/chunk-6GQLCCGN.js.map +0 -1
  148. package/dist/chunk-6RIM5EQP.cjs.map +0 -1
  149. package/dist/chunk-7F2YQWMW.cjs.map +0 -1
  150. package/dist/chunk-B7JU52YQ.cjs.map +0 -1
  151. package/dist/chunk-C4PSJ3ZC.js.map +0 -1
  152. package/dist/chunk-CXIP7ERK.js.map +0 -1
  153. package/dist/chunk-DPNCCWOV.js.map +0 -1
  154. package/dist/chunk-DXFCYNST.js +0 -35
  155. package/dist/chunk-DXFCYNST.js.map +0 -1
  156. package/dist/chunk-DZ7VLLDQ.cjs.map +0 -1
  157. package/dist/chunk-ERV666AR.js.map +0 -1
  158. package/dist/chunk-IYGF7PZY.cjs.map +0 -1
  159. package/dist/chunk-J2QIHZ3H.cjs +0 -27
  160. package/dist/chunk-J2QIHZ3H.cjs.map +0 -1
  161. package/dist/chunk-JMEZYYCE.js.map +0 -1
  162. package/dist/chunk-KI6DJ5ZF.js.map +0 -1
  163. package/dist/chunk-MXZHL4U5.cjs.map +0 -1
  164. package/dist/chunk-NFGUJ52G.cjs.map +0 -1
  165. package/dist/chunk-O7MINPKZ.js.map +0 -1
  166. package/dist/chunk-OJGTJOWI.cjs.map +0 -1
  167. package/dist/chunk-PGAPZ6UE.cjs.map +0 -1
  168. package/dist/chunk-QAZO3ANW.cjs.map +0 -1
  169. package/dist/chunk-RX3A6KIY.js.map +0 -1
  170. package/dist/chunk-SHDSOOBF.cjs.map +0 -1
  171. package/dist/chunk-SPSKDNEE.js.map +0 -1
  172. package/dist/chunk-U4KTOH7C.js +0 -22
  173. package/dist/chunk-U4KTOH7C.js.map +0 -1
  174. package/dist/chunk-U5VFJVQ2.js.map +0 -1
  175. package/dist/chunk-VPU6UY4O.cjs.map +0 -1
  176. package/dist/chunk-W6UMY7PF.cjs.map +0 -1
  177. package/dist/chunk-XS6OYYVR.cjs.map +0 -1
  178. package/dist/chunk-XYJBRKBZ.js.map +0 -1
package/dist/index.cjs CHANGED
@@ -3,29 +3,27 @@
3
3
 
4
4
  var chunkPNNUPUH4_cjs = require('./chunk-PNNUPUH4.cjs');
5
5
  var chunkK63VPFOV_cjs = require('./chunk-K63VPFOV.cjs');
6
- var chunkIYGF7PZY_cjs = require('./chunk-IYGF7PZY.cjs');
7
- var chunkWZ2TBXVB_cjs = require('./chunk-WZ2TBXVB.cjs');
8
- var chunkSHDSOOBF_cjs = require('./chunk-SHDSOOBF.cjs');
9
- var chunkB4JRBV56_cjs = require('./chunk-B4JRBV56.cjs');
10
- var chunkXS6OYYVR_cjs = require('./chunk-XS6OYYVR.cjs');
11
- var chunkQAZO3ANW_cjs = require('./chunk-QAZO3ANW.cjs');
12
- var chunkPGAPZ6UE_cjs = require('./chunk-PGAPZ6UE.cjs');
13
- var chunkB7JU52YQ_cjs = require('./chunk-B7JU52YQ.cjs');
14
- var chunkMXZHL4U5_cjs = require('./chunk-MXZHL4U5.cjs');
15
- require('./chunk-W6UMY7PF.cjs');
16
- var chunk6RIM5EQP_cjs = require('./chunk-6RIM5EQP.cjs');
17
- var chunkOJGTJOWI_cjs = require('./chunk-OJGTJOWI.cjs');
18
- var chunkDZ7VLLDQ_cjs = require('./chunk-DZ7VLLDQ.cjs');
19
- var chunk7F2YQWMW_cjs = require('./chunk-7F2YQWMW.cjs');
6
+ var chunkCWTUWNV3_cjs = require('./chunk-CWTUWNV3.cjs');
7
+ var chunkV6BA44DS_cjs = require('./chunk-V6BA44DS.cjs');
8
+ var chunkKFLIDTDU_cjs = require('./chunk-KFLIDTDU.cjs');
9
+ var chunkRPWUDXG5_cjs = require('./chunk-RPWUDXG5.cjs');
10
+ var chunkMKXEM2C5_cjs = require('./chunk-MKXEM2C5.cjs');
11
+ var chunkYY4PFR3Z_cjs = require('./chunk-YY4PFR3Z.cjs');
12
+ var chunkDS6HN3YR_cjs = require('./chunk-DS6HN3YR.cjs');
13
+ var chunk7ALBSPYR_cjs = require('./chunk-7ALBSPYR.cjs');
14
+ var chunkNAK55BYU_cjs = require('./chunk-NAK55BYU.cjs');
15
+ require('./chunk-KHKH5LCT.cjs');
16
+ var chunkTP5UMRAU_cjs = require('./chunk-TP5UMRAU.cjs');
17
+ var chunkLBEKRN6Y_cjs = require('./chunk-LBEKRN6Y.cjs');
20
18
  var chunkUDCQTOVU_cjs = require('./chunk-UDCQTOVU.cjs');
21
19
  require('./chunk-OD65OZIW.cjs');
22
- require('./chunk-VPU6UY4O.cjs');
23
- require('./chunk-J2QIHZ3H.cjs');
24
- require('./chunk-FISEZBLF.cjs');
25
- require('./chunk-54DX6SLS.cjs');
26
- require('./chunk-UKUHVCZX.cjs');
20
+ require('./chunk-2PNSVBLQ.cjs');
21
+ require('./chunk-J3C72RPK.cjs');
22
+ var chunkLPUWXIPR_cjs = require('./chunk-LPUWXIPR.cjs');
23
+ require('./chunk-NDBMKGQ5.cjs');
27
24
  var chunkXOR4MPEN_cjs = require('./chunk-XOR4MPEN.cjs');
28
- var chunkNFGUJ52G_cjs = require('./chunk-NFGUJ52G.cjs');
25
+ var chunkBIGGXHAW_cjs = require('./chunk-BIGGXHAW.cjs');
26
+ var chunkTUVENMXB_cjs = require('./chunk-TUVENMXB.cjs');
29
27
 
30
28
  // src/components/types.ts
31
29
  function asRenderable(redacted) {
@@ -61,79 +59,75 @@ Object.defineProperty(exports, "useTheme", {
61
59
  });
62
60
  Object.defineProperty(exports, "InteractiveVideo", {
63
61
  enumerable: true,
64
- get: function () { return chunkIYGF7PZY_cjs.InteractiveVideo; }
62
+ get: function () { return chunkCWTUWNV3_cjs.InteractiveVideo; }
65
63
  });
66
64
  Object.defineProperty(exports, "resolveCaptionTracks", {
67
65
  enumerable: true,
68
- get: function () { return chunkIYGF7PZY_cjs.resolveCaptionTracks; }
66
+ get: function () { return chunkCWTUWNV3_cjs.resolveCaptionTracks; }
69
67
  });
70
68
  Object.defineProperty(exports, "ActivityPreview", {
71
69
  enumerable: true,
72
- get: function () { return chunkWZ2TBXVB_cjs.ActivityPreview; }
70
+ get: function () { return chunkV6BA44DS_cjs.ActivityPreview; }
73
71
  });
74
72
  Object.defineProperty(exports, "ActivitySequence", {
75
73
  enumerable: true,
76
- get: function () { return chunkSHDSOOBF_cjs.ActivitySequence; }
74
+ get: function () { return chunkKFLIDTDU_cjs.ActivitySequence; }
77
75
  });
78
76
  Object.defineProperty(exports, "StimulusPanel", {
79
77
  enumerable: true,
80
- get: function () { return chunkB4JRBV56_cjs.StimulusPanel; }
78
+ get: function () { return chunkRPWUDXG5_cjs.StimulusPanel; }
81
79
  });
82
80
  Object.defineProperty(exports, "WrittenResponse", {
83
81
  enumerable: true,
84
- get: function () { return chunkXS6OYYVR_cjs.WrittenResponse; }
82
+ get: function () { return chunkMKXEM2C5_cjs.WrittenResponse; }
85
83
  });
86
84
  Object.defineProperty(exports, "MultipleChoice", {
87
85
  enumerable: true,
88
- get: function () { return chunkQAZO3ANW_cjs.MultipleChoice; }
86
+ get: function () { return chunkYY4PFR3Z_cjs.MultipleChoice; }
89
87
  });
90
88
  Object.defineProperty(exports, "FillInTheBlanks", {
91
89
  enumerable: true,
92
- get: function () { return chunkPGAPZ6UE_cjs.FillInTheBlanks; }
90
+ get: function () { return chunkDS6HN3YR_cjs.FillInTheBlanks; }
93
91
  });
94
92
  Object.defineProperty(exports, "GapSelect", {
95
93
  enumerable: true,
96
- get: function () { return chunkB7JU52YQ_cjs.GapSelect; }
94
+ get: function () { return chunk7ALBSPYR_cjs.GapSelect; }
97
95
  });
98
96
  Object.defineProperty(exports, "Dictation", {
99
97
  enumerable: true,
100
- get: function () { return chunkMXZHL4U5_cjs.Dictation; }
98
+ get: function () { return chunkNAK55BYU_cjs.Dictation; }
101
99
  });
102
- Object.defineProperty(exports, "useAiExplanation", {
103
- enumerable: true,
104
- get: function () { return chunk6RIM5EQP_cjs.useAiExplanation; }
105
- });
106
- Object.defineProperty(exports, "useAiHints", {
100
+ Object.defineProperty(exports, "ReadAloud", {
107
101
  enumerable: true,
108
- get: function () { return chunk6RIM5EQP_cjs.useAiHints; }
102
+ get: function () { return chunkTP5UMRAU_cjs.ReadAloud; }
109
103
  });
110
- Object.defineProperty(exports, "useAiWritingFeedback", {
104
+ Object.defineProperty(exports, "PronunciationFeedback", {
111
105
  enumerable: true,
112
- get: function () { return chunk6RIM5EQP_cjs.useAiWritingFeedback; }
106
+ get: function () { return chunkLBEKRN6Y_cjs.PronunciationFeedback; }
113
107
  });
114
- Object.defineProperty(exports, "LkAiProvider", {
108
+ Object.defineProperty(exports, "CAPTURE_PROCESSOR_SOURCE", {
115
109
  enumerable: true,
116
- get: function () { return chunkOJGTJOWI_cjs.LkAiProvider; }
110
+ get: function () { return chunkUDCQTOVU_cjs.CAPTURE_PROCESSOR_SOURCE; }
117
111
  });
118
- Object.defineProperty(exports, "useLearnerAi", {
112
+ Object.defineProperty(exports, "useSpeechRecorder", {
119
113
  enumerable: true,
120
- get: function () { return chunkOJGTJOWI_cjs.useLearnerAi; }
114
+ get: function () { return chunkUDCQTOVU_cjs.useSpeechRecorder; }
121
115
  });
122
- Object.defineProperty(exports, "ReadAloud", {
116
+ Object.defineProperty(exports, "useAiCoaching", {
123
117
  enumerable: true,
124
- get: function () { return chunkDZ7VLLDQ_cjs.ReadAloud; }
118
+ get: function () { return chunkLPUWXIPR_cjs.useAiCoaching; }
125
119
  });
126
- Object.defineProperty(exports, "PronunciationFeedback", {
120
+ Object.defineProperty(exports, "useAiExplanation", {
127
121
  enumerable: true,
128
- get: function () { return chunk7F2YQWMW_cjs.PronunciationFeedback; }
122
+ get: function () { return chunkLPUWXIPR_cjs.useAiExplanation; }
129
123
  });
130
- Object.defineProperty(exports, "CAPTURE_PROCESSOR_SOURCE", {
124
+ Object.defineProperty(exports, "useAiHints", {
131
125
  enumerable: true,
132
- get: function () { return chunkUDCQTOVU_cjs.CAPTURE_PROCESSOR_SOURCE; }
126
+ get: function () { return chunkLPUWXIPR_cjs.useAiHints; }
133
127
  });
134
- Object.defineProperty(exports, "useSpeechRecorder", {
128
+ Object.defineProperty(exports, "useAiWritingFeedback", {
135
129
  enumerable: true,
136
- get: function () { return chunkUDCQTOVU_cjs.useSpeechRecorder; }
130
+ get: function () { return chunkLPUWXIPR_cjs.useAiWritingFeedback; }
137
131
  });
138
132
  Object.defineProperty(exports, "useActivityState", {
139
133
  enumerable: true,
@@ -141,27 +135,35 @@ Object.defineProperty(exports, "useActivityState", {
141
135
  });
142
136
  Object.defineProperty(exports, "DEFAULT_STRINGS", {
143
137
  enumerable: true,
144
- get: function () { return chunkNFGUJ52G_cjs.DEFAULT_STRINGS; }
138
+ get: function () { return chunkBIGGXHAW_cjs.DEFAULT_STRINGS; }
145
139
  });
146
140
  Object.defineProperty(exports, "LkIntlProvider", {
147
141
  enumerable: true,
148
- get: function () { return chunkNFGUJ52G_cjs.LkIntlProvider; }
142
+ get: function () { return chunkBIGGXHAW_cjs.LkIntlProvider; }
149
143
  });
150
144
  Object.defineProperty(exports, "directionForLocale", {
151
145
  enumerable: true,
152
- get: function () { return chunkNFGUJ52G_cjs.directionForLocale; }
146
+ get: function () { return chunkBIGGXHAW_cjs.directionForLocale; }
153
147
  });
154
148
  Object.defineProperty(exports, "mergeStrings", {
155
149
  enumerable: true,
156
- get: function () { return chunkNFGUJ52G_cjs.mergeStrings; }
150
+ get: function () { return chunkBIGGXHAW_cjs.mergeStrings; }
157
151
  });
158
152
  Object.defineProperty(exports, "useLkDirection", {
159
153
  enumerable: true,
160
- get: function () { return chunkNFGUJ52G_cjs.useLkDirection; }
154
+ get: function () { return chunkBIGGXHAW_cjs.useLkDirection; }
161
155
  });
162
156
  Object.defineProperty(exports, "useLkStrings", {
163
157
  enumerable: true,
164
- get: function () { return chunkNFGUJ52G_cjs.useLkStrings; }
158
+ get: function () { return chunkBIGGXHAW_cjs.useLkStrings; }
159
+ });
160
+ Object.defineProperty(exports, "LkAiProvider", {
161
+ enumerable: true,
162
+ get: function () { return chunkTUVENMXB_cjs.LkAiProvider; }
163
+ });
164
+ Object.defineProperty(exports, "useLearnerAi", {
165
+ enumerable: true,
166
+ get: function () { return chunkTUVENMXB_cjs.useLearnerAi; }
165
167
  });
166
168
  exports.asRenderable = asRenderable;
167
169
  exports.asRenderableSequence = asRenderableSequence;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/types.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoOO,SAAS,aACd,QAAA,EACmB;AACnB,EAAA,OAAO,QAAA;AACT;AAoCO,SAAS,qBACd,OAAA,EAC8C;AAC9C,EAAA,OAAO,OAAA;AACT","file":"index.cjs","sourcesContent":["import type {\n ActivityData,\n ActivityResult,\n DeliveryPolicy,\n InteractionEvent,\n ItemGroup,\n ItemOutcome,\n ItemScoringPolicy,\n LearnerResponse,\n MediaPlayClaim,\n MediaPlayGrant,\n MediaPlayLedgerEntry,\n RecordingRef,\n RedactedActivityData,\n SequenceEntry,\n ThemeTokens,\n} from '@intellectif/lk-core';\nimport type { LearnerAi } from '../ai/LkAiProvider.js';\nimport type { RecordedTake } from '../hooks/useSpeechRecorder.js';\nimport type { LkStringsOverride } from '../i18n/strings.js';\nimport type { ReadAloudAssessResult } from './ReadAloud/ReadAloud.js';\n\n/**\n * How an activity is being presented. This is the single switch that decides\n * whether the component may grade, reveal, or submit — the three things a\n * summative exam must take away from the client.\n *\n * - `practice` (default, and the only behaviour before `renderMode` existed):\n * the component owns the attempt. It\n * scores locally on submit, reveals correctness and feedback, and calls\n * `onComplete` with a full {@link ActivityResult}.\n * - `exam`: the component NEVER scores and NEVER reveals correctness. Submit\n * emits the raw learner response through `onSubmit`; the server grades it.\n * Safe to render redacted data, because nothing here needs the answer key.\n * - `review`: read-only. Renders the learner's submitted answer, and marks\n * correctness only from an `outcome` the caller supplies (which the server\n * computed). Nothing is submittable.\n */\nexport type RenderMode = 'practice' | 'exam' | 'review';\n\n/**\n * Makes the answer-key-bearing parts of an activity optional, so a component\n * can render either full activity data OR a `redact()` projection with the\n * same props. Fields the SDK classifies `answer-key` become optional here;\n * a component in `exam` mode must not read them at all.\n */\nexport type Renderable<TData> = Omit<TData, 'scoringStrategy'> & {\n scoringStrategy?: unknown;\n /** Present on a `redact()` projection. */\n redacted?: true;\n};\n\n/**\n * {@link Renderable} DISTRIBUTED over a union of activity types.\n *\n * This distinction is load-bearing, not cosmetic. `Renderable<T>` is built on\n * `Omit`, and `Omit` does not distribute: `Omit<A | B, K>` collapses to the\n * keys A and B have IN COMMON, so `Renderable<ActivityData>` is a single\n * object type carrying only the fields every activity shares. Narrowing it\n * dies with it — after `if (data.type === 'multiple-choice')` the compiler\n * still refuses `data.options`, because the union it would narrow to no\n * longer exists.\n *\n * The conditional below re-distributes, so `RenderableActivity` is a real\n * union of per-type renderables and `.type` narrows again. Anything that\n * accepts \"some renderable activity, I don't know which\" — a custom renderer,\n * a sequence entry — must use THIS, not `Renderable<ActivityData>`.\n */\nexport type RenderableActivity<TData extends ActivityData = ActivityData> = TData extends unknown\n ? Renderable<TData>\n : never;\n\n/**\n * Sanitiser for author-supplied rich text (`questionHtml`, `promptHtml`, and a\n * stimulus's `bodyHtml`). The SDK deliberately ships NO sanitiser — that would\n * add a dependency and, worse, a false promise. Rich text is rendered only when\n * you supply this function; without it the component falls back to the\n * plain-text field, which is always escaped. Fail-safe by construction: the SDK\n * never injects HTML it was not explicitly given a sanitiser for.\n *\n * `FillInTheBlanks.passageHtml` is the one exception, and is **never**\n * rendered: the passage hosts the answer inputs, so it cannot be split at the\n * `{{blank}}` placeholders without voiding the sanitiser. The plain `passage`\n * is always used, and passing `passageHtml` warns in development.\n */\nexport type HtmlSanitizer = (html: string) => string;\n\n/**\n * The prop contract shared by every activity component (Req 3.1). Defined\n * here (React-specific) rather than in lk-core, which is React-free.\n *\n * Controlled / uncontrolled follows the React convention: pass `value` +\n * `onChange` to own the learner's answer (restore an in-progress attempt,\n * autosave a delta, drive a review); pass `defaultValue` to seed an\n * uncontrolled component; pass neither to keep the pre-2.1.0 behaviour, where\n * the component owns the answer outright.\n */\nexport interface ActivityProps<TData extends ActivityData = ActivityData> {\n /** Activity content. Accepts a `redact()` projection in `exam` mode. */\n data: RenderableActivity<TData>;\n /**\n * Called when the component scored the attempt itself. Only ever fires in\n * `practice` mode — in `exam` mode the client does not grade, so there is\n * no `ActivityResult` to give you; use `onSubmit`.\n */\n onComplete?: (result: ActivityResult) => void;\n /**\n * Called on submit with the raw learner response and no grade. Fires in\n * every mode, before `onComplete`, so an exam runner can persist the\n * response and let the server score it.\n */\n onSubmit?: (response: LearnerResponse) => void;\n /** Controlled value: the learner's current response. */\n value?: LearnerResponse;\n /** Initial response for an uncontrolled component (ignored when `value` is set). */\n defaultValue?: LearnerResponse;\n /**\n * Mount the component as already submitted — read at mount only, like any\n * `default*` prop.\n *\n * Restoring an attempt without it reopens a question the learner had already\n * submitted as answerable, so on a summative paper they can change and\n * re-submit it. `AttemptState.submittedSlotIds` is what this consumes.\n */\n defaultSubmitted?: boolean;\n /** Fires on every change to the learner's response. Required for a controlled component. */\n onChange?: (response: LearnerResponse) => void;\n /** Presentation mode. Defaults to `practice`. */\n renderMode?: RenderMode;\n /**\n * Server-computed outcome, used by `review` mode to mark correctness\n * without the client ever scoring. Ignored in other modes.\n */\n outcome?: ItemOutcome;\n /** Renders author-supplied rich text when provided. See {@link HtmlSanitizer}. */\n sanitizeHtml?: HtmlSanitizer;\n /**\n * Binds this activity's own `data.media` to a play budget the consumer\n * persists. Usually supplied by `<ActivitySequence mediaBudget={…}>`; pass it\n * yourself when rendering an activity standalone.\n */\n mediaBudget?: MediaBudgetBinding;\n /** Translations for the audio transport chrome. See {@link MediaTransportStrings}. */\n mediaStrings?: Partial<MediaTransportStrings>;\n /**\n * Overrides the SDK's chrome text for this activity, layered on whatever\n * `LkIntlProvider` supplies. `mediaStrings` still works and is merged after\n * this, so an existing 0.8.x call site keeps behaving as it did.\n */\n strings?: LkStringsOverride;\n onInteraction?: (event: InteractionEvent) => void;\n /**\n * The host's AI ports for this activity — an explanation after grading, hints\n * before submit — overriding `LkAiProvider`'s. Leave a port out to switch\n * that help off. Nothing AI appears in `exam`, and an item whose author\n * switched a feature off (`data.ai`) never shows it. See {@link LearnerAi}.\n */\n ai?: LearnerAi;\n /**\n * What the school running this paper lets a learner see: feedback,\n * solutions, hints, and AI help. Every setting only takes something away\n * from what the mode shows, and an absent policy takes nothing away. Inside\n * `<ActivitySequence>` or `<InteractiveVideo>`, the paper's own policy holds\n * as well, whichever is stricter. See `DeliveryPolicy` in lk-core.\n */\n delivery?: DeliveryPolicy | null;\n /**\n * How this question is scored when the learner can try again or ask for\n * hints: how many tries, which counts, what tries and hints cost. Applies in\n * `practice`, where the component grades — `<MultipleChoice>`,\n * `<FillInTheBlanks>`, `<GapSelect>` and `<Dictation>`. `<ReadAloud>` takes\n * the prop and ignores it: its tries are its own `recording.maxTakes`, and\n * its grade comes from your assessor, not from the component. Inside\n * `<ActivitySequence>` or `<InteractiveVideo>`, the paper's own policy wins\n * over this one. See `ItemScoringPolicy` in lk-core.\n *\n * With tries, `onComplete` fires after every graded try: `score` and\n * `passed` are the question's under the policy so far, and `xapiStatement`\n * records the try just made. A policy `validateItemScoringPolicy` refuses\n * throws at render.\n */\n scoring?: ItemScoringPolicy | null;\n /** Per-instance token overrides, applied as inline CSS vars on the root. */\n theme?: Partial<ThemeTokens>;\n /**\n * BCP 47 tag stamped as `lang` on this component's root. This is the\n * INTERFACE language — the SDK's own chrome renders inside that element — so\n * it should carry the same value you give `<LkIntlProvider locale>`. Passing\n * a different one re-declares the language of every SDK string in this\n * subtree without changing the words.\n *\n * It is NOT `data.locale`, which labels xAPI statements — and, on a\n * dictation, places the dictation's own words: `<Dictation>` puts it, and\n * the direction it names, on its title, hints, marks and solution. Other\n * authored content in another language belongs on `stimulus.locale`, which\n * `<StimulusPanel>` puts on the passage alone.\n */\n locale?: string;\n disabled?: boolean;\n}\n\n/**\n * Bridges a server-produced `redact()` projection into the `data` prop.\n *\n * `RedactedActivityData` is deliberately index-signature typed in lk-core — it\n * proves a payload is learner-safe, not what shape it has — so TypeScript\n * cannot know it still carries the public fields a renderer needs. This is the\n * SDK's single, documented crossing of that gap, so an exam runner does not\n * have to write `as unknown as` at every call site:\n *\n * ```tsx\n * <MultipleChoice\n * data={asRenderable<MultipleChoiceData>(redactedFromServer)}\n * renderMode=\"exam\"\n * onSubmit={persist}\n * />\n * ```\n *\n * Safe because `exam` mode reads only public fields; the answer-key fields the\n * type claims are exactly the ones the component is forbidden to touch there.\n *\n * Per-type redacted interfaces (`RedactedMultipleChoiceData`, …) ship from\n * lk-core since 0.6.0, but they are not yet *assignable* to `data`:\n * {@link Renderable} widens `scoringStrategy` and leaves nested answer-key\n * fields (`options[].isCorrect`, `blanks[].acceptedAnswers`) required, so a\n * real redacted payload still needs this bridge. Closing that gap is tracked\n * in the roadmap.\n */\nexport function asRenderable<TData extends ActivityData>(\n redacted: RedactedActivityData,\n): Renderable<TData> {\n return redacted as unknown as Renderable<TData>;\n}\n\n/**\n * The same bridge as {@link asRenderable}, for a whole sequence: activities\n * and item groups as a server hands them over, ready for `<ActivitySequence>`.\n *\n * Needed for the same reason and no other. `redactItemGroup` returns\n * `ItemGroup<RedactedActivityData>`, and `RedactedActivityData` is an\n * index-signature type whose fields are all `unknown` — so its `question` is\n * not a `string` and it satisfies no per-type renderable, however the prop is\n * widened. Widening alone cannot fix this; a crossing point is required, and\n * having exactly one keeps `as unknown as` out of consumer code.\n *\n * ```tsx\n * const entries = await fetchExam(); // redacted, server-side\n * <ActivitySequence\n * activities={asRenderableSequence(entries)}\n * renderMode=\"exam\" // REQUIRED: see below\n * shuffleSeed={attemptId}\n * onSubmit={persist}\n * />\n * ```\n *\n * Pass `renderMode=\"exam\"` (or `\"review\"`). Redacted data has no answer key, and\n * almost every built-in activity throws at render in the default `practice`\n * mode rather than fail later: `<MultipleChoice>`, `<FillInTheBlanks>`,\n * `<GapSelect>` and `<Dictation>` because they grade locally, and\n * `<WrittenResponse>` because `practice` still runs its local submit path and\n * emits a practice-mode xAPI statement.\n *\n * `<ReadAloud>` is the exception and renders a projection in every mode: a\n * read-aloud item has no answer key to withhold, so `redact()` removes only the\n * authored feedback and leaves the reading, its language and its bounds — which\n * is everything the component puts on screen. It grades nothing locally either;\n * the grade comes back from whatever the application asked to judge the take.\n */\nexport function asRenderableSequence(\n entries: readonly (RedactedActivityData | RedactedItemGroupData)[],\n): readonly SequenceEntry<RenderableActivity>[] {\n return entries as unknown as readonly SequenceEntry<RenderableActivity>[];\n}\n\n/** Structural shape of a `redactItemGroup()` projection, as it arrives from a server. */\ntype RedactedItemGroupData = ItemGroup<RedactedActivityData> & { redacted: true };\n\n/**\n * Every word the SDK's audio transport renders.\n *\n * Words, not characters: the `m:ss / m:ss` clock is digits and punctuation and\n * is formatted by the component, because it reads identically in every locale\n * this SDK targets. The scrubber's SPOKEN value does have a word in it and does\n * have a key ({@link MediaTransportStrings.timeValue}).\n *\n * Supply them to translate it. These are the highest-stakes strings on a\n * listening paper — \"No plays remaining\" decides whether a learner believes\n * they may try again — so shipping them as untranslatable English inside a\n * Spanish panel was not acceptable. Supplying any of them also sets `lang` on\n * the transport chrome, so a screen reader does not read the SDK's own words\n * with the passage's phonetics.\n */\nexport interface MediaTransportStrings {\n play: string;\n pause: string;\n preparing: string;\n mute: string;\n unmute: string;\n volume: string;\n speed: string;\n seek: string;\n /**\n * Spoken value of the scrubber, e.g. `('1:05', '4:30') => '1:05 of 4:30'`.\n * Takes ALREADY-FORMATTED `m:ss` strings: a translation should not have to\n * reimplement the clock to change the word between them.\n */\n timeValue: (elapsed: string, duration: string) => string;\n /** e.g. `(1, 2) => '1 of 2 plays remaining'`. */\n playsRemaining: (remaining: number, max: number) => string;\n noPlaysRemaining: string;\n /** Shown before the LAST play is spent, so a stray press cannot cost it. */\n lastPlayConfirm: string;\n lastPlayStart: string;\n lastPlayCancel: string;\n seekBlocked: string;\n rateBlocked: string;\n playFailed: string;\n}\n\n/**\n * Binds ONE media block to a play budget the consumer persists.\n *\n * The SDK refuses a play; it does not remember one. Everything durable here is\n * the consuming application's — see {@link SequenceMediaBudget.onPlayConsumed}.\n */\nexport interface MediaBudgetBinding {\n /** From `slotMediaKey(slotId)` / `stimulusMediaKey(slotId)` in lk-core. */\n key: string;\n /** Plays already spent, and where playback stood. Read at mount only. */\n entry?: MediaPlayLedgerEntry;\n /** Defaults to `renderMode !== 'review'`. An explicit boolean wins either way. */\n enforced?: boolean;\n /** Slot context stamped onto the claim and the interaction event. */\n slotId: string;\n index: number;\n activityId?: string;\n onPlayConsumed?: (claim: MediaPlayClaim) => undefined | Promise<MediaPlayGrant | undefined>;\n onPlayRefunded?: (claim: MediaPlayClaim) => void;\n onPosition?: (key: string, seconds: number) => void;\n /** Translations for the transport chrome. */\n strings?: Partial<MediaTransportStrings>;\n}\n\n/**\n * The pager-level half of a play budget. One prop, because it is one concept.\n */\nexport interface SequenceMediaBudget {\n /**\n * `MediaPlayLedger.entries` goes straight in. An absent key means nothing\n * spent. Read at mount, like `responses`.\n */\n plays?: Readonly<Record<string, MediaPlayLedgerEntry>>;\n /**\n * Re-seed token. Change this string and the budgets re-seed from `plays`\n * WITHOUT remounting the pager — the invigilator path (\"the audio never\n * started, give her the play back\") that would otherwise cost the learner\n * their focus, their scroll position and an unsaved answer.\n */\n resumeKey?: string;\n /** Explicit override of the default (`renderMode !== 'review'`). */\n enforced?: boolean;\n /**\n * Called the instant a play is claimed, BEFORE any audio is audible.\n *\n * Two tiers, chosen by what you return:\n *\n * - **Return nothing (optimistic).** Playback starts immediately and the\n * count is only as durable as your write. **Do not debounce this, and do\n * not batch it with the answer autosave** — an eight-second debounce is\n * exactly long enough to start a third play and hard-reload. A `pagehide`\n * beacon is a backstop, not the mechanism. A crash between this call and\n * your write landing RETURNS the play to the learner; that is the honest\n * description of what you are buying.\n * - **Return a promise (confirmed).** Playback is held — the button reads\n * \"Preparing…\" and is `aria-busy` — until it settles. Resolve with\n * `{ playsUsed }` from an ATOMIC server write (`UPDATE … SET plays = plays\n * + 1 … RETURNING plays`, or a compare-and-set on\n * `claim.previousPlaysUsed`). A resolved count above `maxPlays` refuses the\n * play, which is how a second tab is caught: two mounts both seeded at 0\n * both claim 1, and only an atomic increment can tell them apart. A\n * rejection charges nothing and lets the learner retry. This is the only\n * tier in which \"consumed before audible\" is true of storage rather than\n * only of memory; use it for summative papers.\n *\n * Never settle the promise and the learner cannot play at all: settle it.\n */\n onPlayConsumed?: (claim: MediaPlayClaim) => undefined | Promise<MediaPlayGrant | undefined>;\n /**\n * Called when a charged play produced no audio — the element errored before\n * playback advanced past 0.25 s, an expired signed URL being the realistic\n * cause. Supply it to give the play back, decrementing with a compare-and-set\n * on `claim.playsUsed`. Omit it and the play stays spent: the SDK will not\n * decrement a ledger it has no channel to correct.\n */\n onPlayRefunded?: (claim: MediaPlayClaim) => void;\n /**\n * Position reports, so a refresh resumes the play the learner already paid\n * for instead of charging them again. Fires on pause, on end (with 0), and at\n * most once per whole second of playback.\n *\n * **This one you MAY throttle** — the granularity you persist is the\n * granularity of the replay a crash grants. Three seconds is sane; three\n * minutes is not.\n */\n onPosition?: (key: string, seconds: number) => void;\n /** Translations for the transport chrome. Defaults are English. */\n strings?: Partial<MediaTransportStrings>;\n}\n\n/**\n * Which slot a recording belongs to, stamped on every call the pager makes.\n *\n * Exactly the shape {@link ActivitySequenceProps.onSubmit} already passes, so\n * one identity travels with the answer and with the take that answer points at\n * — and a consumer writes `slotId` in both places rather than reconciling two\n * spellings of \"which question was this\".\n */\nexport interface SequenceRecordingSlot {\n /** Identity from `flattenSequence` — stable under shuffling. Store against THIS. */\n slotId: string;\n /** Presented position, which moves under shuffling. */\n index: number;\n activityId: string;\n}\n\n/**\n * The pager-level half of a read-aloud recording binding: where every take in\n * this sequence is stored, and how a judgement comes back.\n *\n * One prop at both levels, because it is one concept — the media-budget\n * precedent ({@link SequenceMediaBudget} beside {@link MediaBudgetBinding}).\n * The difference is the second argument: a per-slot binding knows which slot it\n * belongs to, so a sequence-level one is told.\n *\n * The SDK records and hands over; it never judges. `assess` is `practice` only\n * and optional — a sequence that only stores takes gets the \"assessment is not\n * available\" notice rather than a throw — and `playbackUrl` is `review` only.\n * A slot whose activity is not a read-aloud never calls any of them.\n */\nexport interface SequenceRecordingBinding {\n /**\n * Puts the take in your storage and returns its key. **Required** outside\n * `review`: without it a learner can speak into a control that submits\n * nothing, which the component refuses to render. Settle it.\n */\n upload(take: RecordedTake, slot: SequenceRecordingSlot): Promise<RecordingRef>;\n /** Judges the stored take. `practice` only; an exam never assesses on the client. */\n assess?(ref: RecordingRef, slot: SequenceRecordingSlot): Promise<ReadAloudAssessResult>;\n /** A playable link to a stored take. `review` only. */\n playbackUrl?(ref: RecordingRef, slot: SequenceRecordingSlot): Promise<string>;\n}\n"]}
1
+ {"version":3,"sources":["../src/components/types.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAoOO,SAAS,aACd,QAAA,EACmB;AACnB,EAAA,OAAO,QAAA;AACT;AAoCO,SAAS,qBACd,OAAA,EAC8C;AAC9C,EAAA,OAAO,OAAA;AACT","file":"index.cjs","sourcesContent":["import type {\n ActivityData,\n ActivityResult,\n DeliveryPolicy,\n InteractionEvent,\n ItemGroup,\n ItemOutcome,\n ItemScoringPolicy,\n LearnerResponse,\n MediaPlayClaim,\n MediaPlayGrant,\n MediaPlayLedgerEntry,\n RecordingRef,\n RedactedActivityData,\n SequenceEntry,\n ThemeTokens,\n} from '@intellectif/lk-core';\nimport type { LearnerAi } from '../ai/LkAiProvider.js';\nimport type { RecordedTake } from '../hooks/useSpeechRecorder.js';\nimport type { LkStringsOverride } from '../i18n/strings.js';\nimport type { ReadAloudAssessResult } from './ReadAloud/ReadAloud.js';\n\n/**\n * How an activity is being presented. This is the single switch that decides\n * whether the component may grade, reveal, or submit — the three things a\n * summative exam must take away from the client.\n *\n * - `practice` (default, and the only behaviour before `renderMode` existed):\n * the component owns the attempt. It\n * scores locally on submit, reveals correctness and feedback, and calls\n * `onComplete` with a full {@link ActivityResult}.\n * - `exam`: the component NEVER scores and NEVER reveals correctness. Submit\n * emits the raw learner response through `onSubmit`; the server grades it.\n * Safe to render redacted data, because nothing here needs the answer key.\n * - `review`: read-only. Renders the learner's submitted answer, and marks\n * correctness only from an `outcome` the caller supplies (which the server\n * computed). Nothing is submittable.\n */\nexport type RenderMode = 'practice' | 'exam' | 'review';\n\n/**\n * Makes the answer-key-bearing parts of an activity optional, so a component\n * can render either full activity data OR a `redact()` projection with the\n * same props. Fields the SDK classifies `answer-key` become optional here;\n * a component in `exam` mode must not read them at all.\n */\nexport type Renderable<TData> = Omit<TData, 'scoringStrategy'> & {\n scoringStrategy?: unknown;\n /** Present on a `redact()` projection. */\n redacted?: true;\n};\n\n/**\n * {@link Renderable} DISTRIBUTED over a union of activity types.\n *\n * This distinction is load-bearing, not cosmetic. `Renderable<T>` is built on\n * `Omit`, and `Omit` does not distribute: `Omit<A | B, K>` collapses to the\n * keys A and B have IN COMMON, so `Renderable<ActivityData>` is a single\n * object type carrying only the fields every activity shares. Narrowing it\n * dies with it — after `if (data.type === 'multiple-choice')` the compiler\n * still refuses `data.options`, because the union it would narrow to no\n * longer exists.\n *\n * The conditional below re-distributes, so `RenderableActivity` is a real\n * union of per-type renderables and `.type` narrows again. Anything that\n * accepts \"some renderable activity, I don't know which\" — a custom renderer,\n * a sequence entry — must use THIS, not `Renderable<ActivityData>`.\n */\nexport type RenderableActivity<TData extends ActivityData = ActivityData> = TData extends unknown\n ? Renderable<TData>\n : never;\n\n/**\n * Sanitiser for author-supplied rich text (`questionHtml`, `promptHtml`, and a\n * stimulus's `bodyHtml`). The SDK deliberately ships NO sanitiser — that would\n * add a dependency and, worse, a false promise. Rich text is rendered only when\n * you supply this function; without it the component falls back to the\n * plain-text field, which is always escaped. Fail-safe by construction: the SDK\n * never injects HTML it was not explicitly given a sanitiser for.\n *\n * `FillInTheBlanks.passageHtml` is the one exception, and is **never**\n * rendered: the passage hosts the answer inputs, so it cannot be split at the\n * `{{blank}}` placeholders without voiding the sanitiser. The plain `passage`\n * is always used, and passing `passageHtml` warns in development.\n */\nexport type HtmlSanitizer = (html: string) => string;\n\n/**\n * The prop contract shared by every activity component (Req 3.1). Defined\n * here (React-specific) rather than in lk-core, which is React-free.\n *\n * Controlled / uncontrolled follows the React convention: pass `value` +\n * `onChange` to own the learner's answer (restore an in-progress attempt,\n * autosave a delta, drive a review); pass `defaultValue` to seed an\n * uncontrolled component; pass neither to keep the pre-2.1.0 behaviour, where\n * the component owns the answer outright.\n */\nexport interface ActivityProps<TData extends ActivityData = ActivityData> {\n /** Activity content. Accepts a `redact()` projection in `exam` mode. */\n data: RenderableActivity<TData>;\n /**\n * Called when the component scored the attempt itself. Only ever fires in\n * `practice` mode — in `exam` mode the client does not grade, so there is\n * no `ActivityResult` to give you; use `onSubmit`.\n */\n onComplete?: (result: ActivityResult) => void;\n /**\n * Called on submit with the raw learner response and no grade. Fires in\n * every mode, before `onComplete`, so an exam runner can persist the\n * response and let the server score it.\n */\n onSubmit?: (response: LearnerResponse) => void;\n /** Controlled value: the learner's current response. */\n value?: LearnerResponse;\n /** Initial response for an uncontrolled component (ignored when `value` is set). */\n defaultValue?: LearnerResponse;\n /**\n * Mount the component as already submitted — read at mount only, like any\n * `default*` prop.\n *\n * Restoring an attempt without it reopens a question the learner had already\n * submitted as answerable, so on a summative paper they can change and\n * re-submit it. `AttemptState.submittedSlotIds` is what this consumes.\n */\n defaultSubmitted?: boolean;\n /** Fires on every change to the learner's response. Required for a controlled component. */\n onChange?: (response: LearnerResponse) => void;\n /** Presentation mode. Defaults to `practice`. */\n renderMode?: RenderMode;\n /**\n * Server-computed outcome, used by `review` mode to mark correctness\n * without the client ever scoring. Ignored in other modes.\n */\n outcome?: ItemOutcome;\n /** Renders author-supplied rich text when provided. See {@link HtmlSanitizer}. */\n sanitizeHtml?: HtmlSanitizer;\n /**\n * Binds this activity's own `data.media` to a play budget the consumer\n * persists. Usually supplied by `<ActivitySequence mediaBudget={…}>`; pass it\n * yourself when rendering an activity standalone.\n */\n mediaBudget?: MediaBudgetBinding;\n /** Translations for the audio transport chrome. See {@link MediaTransportStrings}. */\n mediaStrings?: Partial<MediaTransportStrings>;\n /**\n * Overrides the SDK's chrome text for this activity, layered on whatever\n * `LkIntlProvider` supplies. `mediaStrings` still works and is merged after\n * this, so an existing 0.8.x call site keeps behaving as it did.\n */\n strings?: LkStringsOverride;\n onInteraction?: (event: InteractionEvent) => void;\n /**\n * The host's AI ports for this activity — an explanation after grading, hints\n * before submit — overriding `LkAiProvider`'s. Leave a port out to switch\n * that help off. Nothing AI appears in `exam`, and an item whose author\n * switched a feature off (`data.ai`) never shows it. See {@link LearnerAi}.\n */\n ai?: LearnerAi;\n /**\n * What the school running this paper lets a learner see: feedback,\n * solutions, hints, and AI help. Every setting only takes something away\n * from what the mode shows, and an absent policy takes nothing away. Inside\n * `<ActivitySequence>` or `<InteractiveVideo>`, the paper's own policy holds\n * as well, whichever is stricter. See `DeliveryPolicy` in lk-core.\n */\n delivery?: DeliveryPolicy | null;\n /**\n * How this question is scored when the learner can try again or ask for\n * hints: how many tries, which counts, what tries and hints cost. Applies in\n * `practice`, where the component grades — `<MultipleChoice>`,\n * `<FillInTheBlanks>`, `<GapSelect>` and `<Dictation>`. `<ReadAloud>` takes\n * the prop and ignores it: its tries are its own `recording.maxTakes`, and\n * its grade comes from your assessor, not from the component. Inside\n * `<ActivitySequence>` or `<InteractiveVideo>`, the paper's own policy wins\n * over this one. See `ItemScoringPolicy` in lk-core.\n *\n * With tries, `onComplete` fires after every graded try: `score` and\n * `passed` are the question's under the policy so far, and `xapiStatement`\n * records the try just made. A policy `validateItemScoringPolicy` refuses\n * throws at render.\n */\n scoring?: ItemScoringPolicy | null;\n /** Per-instance token overrides, applied as inline CSS vars on the root. */\n theme?: Partial<ThemeTokens>;\n /**\n * BCP 47 tag stamped as `lang` on this component's root. This is the\n * INTERFACE language — the SDK's own chrome renders inside that element — so\n * it should carry the same value you give `<LkIntlProvider locale>`. Passing\n * a different one re-declares the language of every SDK string in this\n * subtree without changing the words.\n *\n * It is NOT `data.locale`, which labels xAPI statements — and, on a\n * dictation, places the dictation's own words: `<Dictation>` puts it, and\n * the direction it names, on its title, hints, marks and solution. Other\n * authored content in another language belongs on `stimulus.locale`, which\n * `<StimulusPanel>` puts on the passage alone.\n */\n locale?: string;\n disabled?: boolean;\n}\n\n/**\n * Bridges a server-produced `redact()` projection into the `data` prop.\n *\n * `RedactedActivityData` is deliberately index-signature typed in lk-core — it\n * proves a payload is learner-safe, not what shape it has — so TypeScript\n * cannot know it still carries the public fields a renderer needs. This is the\n * SDK's single, documented crossing of that gap, so an exam runner does not\n * have to write `as unknown as` at every call site:\n *\n * ```tsx\n * <MultipleChoice\n * data={asRenderable<MultipleChoiceData>(redactedFromServer)}\n * renderMode=\"exam\"\n * onSubmit={persist}\n * />\n * ```\n *\n * Safe because `exam` mode reads only public fields; the answer-key fields the\n * type claims are exactly the ones the component is forbidden to touch there.\n *\n * Per-type redacted interfaces (`RedactedMultipleChoiceData`, …) ship from\n * lk-core since 0.6.0, but they are not yet *assignable* to `data`:\n * {@link Renderable} widens `scoringStrategy` and leaves nested answer-key\n * fields (`options[].isCorrect`, `blanks[].acceptedAnswers`) required, so a\n * real redacted payload still needs this bridge. Closing that gap is tracked\n * in the roadmap.\n */\nexport function asRenderable<TData extends ActivityData>(\n redacted: RedactedActivityData,\n): Renderable<TData> {\n return redacted as unknown as Renderable<TData>;\n}\n\n/**\n * The same bridge as {@link asRenderable}, for a whole sequence: activities\n * and item groups as a server hands them over, ready for `<ActivitySequence>`.\n *\n * Needed for the same reason and no other. `redactItemGroup` returns\n * `ItemGroup<RedactedActivityData>`, and `RedactedActivityData` is an\n * index-signature type whose fields are all `unknown` — so its `question` is\n * not a `string` and it satisfies no per-type renderable, however the prop is\n * widened. Widening alone cannot fix this; a crossing point is required, and\n * having exactly one keeps `as unknown as` out of consumer code.\n *\n * ```tsx\n * const entries = await fetchExam(); // redacted, server-side\n * <ActivitySequence\n * activities={asRenderableSequence(entries)}\n * renderMode=\"exam\" // REQUIRED: see below\n * shuffleSeed={attemptId}\n * onSubmit={persist}\n * />\n * ```\n *\n * Pass `renderMode=\"exam\"` (or `\"review\"`). Redacted data has no answer key, and\n * almost every built-in activity throws at render in the default `practice`\n * mode rather than fail later: `<MultipleChoice>`, `<FillInTheBlanks>`,\n * `<GapSelect>` and `<Dictation>` because they grade locally, and\n * `<WrittenResponse>` because `practice` still runs its local submit path and\n * emits a practice-mode xAPI statement.\n *\n * `<ReadAloud>` is the exception and renders a projection in every mode: a\n * read-aloud item has no answer key to withhold, so `redact()` removes only the\n * authored feedback and leaves the reading, its language and its bounds — which\n * is everything the component puts on screen. It grades nothing locally either;\n * the grade comes back from whatever the application asked to judge the take.\n */\nexport function asRenderableSequence(\n entries: readonly (RedactedActivityData | RedactedItemGroupData)[],\n): readonly SequenceEntry<RenderableActivity>[] {\n return entries as unknown as readonly SequenceEntry<RenderableActivity>[];\n}\n\n/** Structural shape of a `redactItemGroup()` projection, as it arrives from a server. */\ntype RedactedItemGroupData = ItemGroup<RedactedActivityData> & { redacted: true };\n\n/**\n * Every word the SDK's audio transport renders.\n *\n * Words, not characters: the `m:ss / m:ss` clock is digits and punctuation and\n * is formatted by the component, because it reads identically in every locale\n * this SDK targets. The scrubber's SPOKEN value does have a word in it and does\n * have a key ({@link MediaTransportStrings.timeValue}).\n *\n * Supply them to translate it. These are the highest-stakes strings on a\n * listening paper — \"No plays remaining\" decides whether a learner believes\n * they may try again — so shipping them as untranslatable English inside a\n * Spanish panel was not acceptable. Supplying any of them also sets `lang` on\n * the transport chrome, so a screen reader does not read the SDK's own words\n * with the passage's phonetics.\n */\nexport interface MediaTransportStrings {\n play: string;\n pause: string;\n preparing: string;\n mute: string;\n unmute: string;\n volume: string;\n speed: string;\n seek: string;\n /**\n * Spoken value of the scrubber, e.g. `('1:05', '4:30') => '1:05 of 4:30'`.\n * Takes ALREADY-FORMATTED `m:ss` strings: a translation should not have to\n * reimplement the clock to change the word between them.\n */\n timeValue: (elapsed: string, duration: string) => string;\n /** e.g. `(1, 2) => '1 of 2 plays remaining'`. */\n playsRemaining: (remaining: number, max: number) => string;\n noPlaysRemaining: string;\n /** Shown before the LAST play is spent, so a stray press cannot cost it. */\n lastPlayConfirm: string;\n lastPlayStart: string;\n lastPlayCancel: string;\n seekBlocked: string;\n rateBlocked: string;\n playFailed: string;\n}\n\n/**\n * Binds ONE media block to a play budget the consumer persists.\n *\n * The SDK refuses a play; it does not remember one. Everything durable here is\n * the consuming application's — see {@link SequenceMediaBudget.onPlayConsumed}.\n */\nexport interface MediaBudgetBinding {\n /** From `slotMediaKey(slotId)` / `stimulusMediaKey(slotId)` in lk-core. */\n key: string;\n /** Plays already spent, and where playback stood. Read at mount only. */\n entry?: MediaPlayLedgerEntry;\n /** Defaults to `renderMode !== 'review'`. An explicit boolean wins either way. */\n enforced?: boolean;\n /** Slot context stamped onto the claim and the interaction event. */\n slotId: string;\n index: number;\n activityId?: string;\n onPlayConsumed?: (claim: MediaPlayClaim) => undefined | Promise<MediaPlayGrant | undefined>;\n onPlayRefunded?: (claim: MediaPlayClaim) => void;\n onPosition?: (key: string, seconds: number) => void;\n /** Translations for the transport chrome. */\n strings?: Partial<MediaTransportStrings>;\n}\n\n/**\n * The pager-level half of a play budget. One prop, because it is one concept.\n */\nexport interface SequenceMediaBudget {\n /**\n * `MediaPlayLedger.entries` goes straight in. An absent key means nothing\n * spent. Read at mount, like `responses`.\n */\n plays?: Readonly<Record<string, MediaPlayLedgerEntry>>;\n /**\n * Re-seed token. Change this string and the budgets re-seed from `plays`\n * WITHOUT remounting the pager — the invigilator path (\"the audio never\n * started, give her the play back\") that would otherwise cost the learner\n * their focus, their scroll position and an unsaved answer.\n */\n resumeKey?: string;\n /** Explicit override of the default (`renderMode !== 'review'`). */\n enforced?: boolean;\n /**\n * Called the instant a play is claimed, BEFORE any audio is audible.\n *\n * Two tiers, chosen by what you return:\n *\n * - **Return nothing (optimistic).** Playback starts immediately and the\n * count is only as durable as your write. **Do not debounce this, and do\n * not batch it with the answer autosave** — an eight-second debounce is\n * exactly long enough to start a third play and hard-reload. A `pagehide`\n * beacon is a backstop, not the mechanism. A crash between this call and\n * your write landing RETURNS the play to the learner; that is the honest\n * description of what you are buying.\n * - **Return a promise (confirmed).** Playback is held — the button reads\n * \"Preparing…\" and is `aria-busy` — until it settles. Resolve with\n * `{ playsUsed }` from an ATOMIC server write (`UPDATE … SET plays = plays\n * + 1 … RETURNING plays`, or a compare-and-set on\n * `claim.previousPlaysUsed`). A resolved count above `maxPlays` refuses the\n * play, which is how a second tab is caught: two mounts both seeded at 0\n * both claim 1, and only an atomic increment can tell them apart. A\n * rejection charges nothing and lets the learner retry. This is the only\n * tier in which \"consumed before audible\" is true of storage rather than\n * only of memory; use it for summative papers.\n *\n * Never settle the promise and the learner cannot play at all: settle it.\n */\n onPlayConsumed?: (claim: MediaPlayClaim) => undefined | Promise<MediaPlayGrant | undefined>;\n /**\n * Called when a charged play produced no audio — the element errored before\n * playback advanced past 0.25 s, an expired signed URL being the realistic\n * cause. Supply it to give the play back, decrementing with a compare-and-set\n * on `claim.playsUsed`. Omit it and the play stays spent: the SDK will not\n * decrement a ledger it has no channel to correct.\n */\n onPlayRefunded?: (claim: MediaPlayClaim) => void;\n /**\n * Position reports, so a refresh resumes the play the learner already paid\n * for instead of charging them again. Fires on pause, on end (with 0), and at\n * most once per whole second of playback.\n *\n * **This one you MAY throttle** — the granularity you persist is the\n * granularity of the replay a crash grants. Three seconds is sane; three\n * minutes is not.\n */\n onPosition?: (key: string, seconds: number) => void;\n /** Translations for the transport chrome. Defaults are English. */\n strings?: Partial<MediaTransportStrings>;\n}\n\n/**\n * Which slot a recording belongs to, stamped on every call the pager makes.\n *\n * Exactly the shape {@link ActivitySequenceProps.onSubmit} already passes, so\n * one identity travels with the answer and with the take that answer points at\n * — and a consumer writes `slotId` in both places rather than reconciling two\n * spellings of \"which question was this\".\n */\nexport interface SequenceRecordingSlot {\n /** Identity from `flattenSequence` — stable under shuffling. Store against THIS. */\n slotId: string;\n /** Presented position, which moves under shuffling. */\n index: number;\n activityId: string;\n}\n\n/**\n * The pager-level half of a read-aloud recording binding: where every take in\n * this sequence is stored, and how a judgement comes back.\n *\n * One prop at both levels, because it is one concept — the media-budget\n * precedent ({@link SequenceMediaBudget} beside {@link MediaBudgetBinding}).\n * The difference is the second argument: a per-slot binding knows which slot it\n * belongs to, so a sequence-level one is told.\n *\n * The SDK records and hands over; it never judges. `assess` is `practice` only\n * and optional — a sequence that only stores takes gets the \"assessment is not\n * available\" notice rather than a throw — and `playbackUrl` is `review` only.\n * A slot whose activity is not a read-aloud never calls any of them.\n */\nexport interface SequenceRecordingBinding {\n /**\n * Puts the take in your storage and returns its key. **Required** outside\n * `review`: without it a learner can speak into a control that submits\n * nothing, which the component refuses to render. Settle it.\n */\n upload(take: RecordedTake, slot: SequenceRecordingSlot): Promise<RecordingRef>;\n /** Judges the stored take. `practice` only; an exam never assesses on the client. */\n assess?(ref: RecordingRef, slot: SequenceRecordingSlot): Promise<ReadAloudAssessResult>;\n /** A playable link to a stored take. `review` only. */\n playbackUrl?(ref: RecordingRef, slot: SequenceRecordingSlot): Promise<string>;\n}\n"]}
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { LearnerAi, LkAiProvider, LkAiProviderProps, useLearnerAi } from './ai/LkAiProvider.cjs';
2
- export { AiExplanationHelp, AiExplanationInput, AiHelpSituation, AiHintsHelp, AiHintsInput, AiWritingFeedbackHelp, AiWritingFeedbackInput, useAiExplanation, useAiHints, useAiWritingFeedback } from './ai/useAiHelp.cjs';
2
+ export { AiCoachingHelp, AiCoachingInput, AiExplanationHelp, AiExplanationInput, AiHelpSituation, AiHintsHelp, AiHintsInput, AiWritingFeedbackHelp, AiWritingFeedbackInput, useAiCoaching, useAiExplanation, useAiHints, useAiWritingFeedback } from './ai/useAiHelp.cjs';
3
3
  export { ActivityPreview, ActivityPreviewProps } from './components/ActivityPreview.cjs';
4
4
  export { ActivityRenderer, ActivitySequence, ActivitySequenceProps, SequenceItemOutcome, SequenceQuestion } from './components/ActivitySequence.cjs';
5
5
  export { Dictation, DictationProps } from './components/Dictation.cjs';
@@ -10,7 +10,7 @@ export { MultipleChoice, MultipleChoiceProps } from './components/MultipleChoice
10
10
  export { PronunciationFeedback, PronunciationFeedbackProps } from './components/PronunciationFeedback.cjs';
11
11
  export { ReadAloud } from './components/ReadAloud.cjs';
12
12
  export { StimulusPanel, StimulusPanelProps } from './components/StimulusPanel.cjs';
13
- export { A as ActivityProps, C as CaptionSize, D as DEFAULT_STRINGS, H as HtmlSanitizer, L as LkStrings, a as LkStringsOverride, M as MediaBudgetBinding, b as MediaTransportStrings, R as ReadAloudAssessResult, c as ReadAloudProps, d as RecordingBinding, e as RenderMode, f as Renderable, g as RenderableActivity, S as SequenceMediaBudget, h as SequenceRecordingBinding, i as SequenceRecordingSlot, V as VideoPreferences, j as asRenderable, k as asRenderableSequence, m as mergeStrings } from './types-CO0XLEN6.cjs';
13
+ export { A as ActivityProps, C as CaptionSize, D as DEFAULT_STRINGS, H as HtmlSanitizer, L as LkStrings, a as LkStringsOverride, M as MediaBudgetBinding, b as MediaTransportStrings, R as ReadAloudAssessResult, c as ReadAloudProps, d as RecordingBinding, e as RenderMode, f as Renderable, g as RenderableActivity, S as SequenceMediaBudget, h as SequenceRecordingBinding, i as SequenceRecordingSlot, V as VideoPreferences, j as asRenderable, k as asRenderableSequence, m as mergeStrings } from './types-CJgZWtl4.cjs';
14
14
  export { WrittenResponse } from './components/WrittenResponse.cjs';
15
15
  export { ActivityState, UseActivityStateResult, useActivityState } from './hooks/useActivityState.cjs';
16
16
  export { CAPTURE_PROCESSOR_SOURCE, SpeechRecorder, SpeechRecorderOptions, useSpeechRecorder } from './hooks/useSpeechRecorder.cjs';
@@ -18,7 +18,7 @@ export { UseXAPIResult, useXAPI } from './hooks/useXAPI.cjs';
18
18
  export { LkDirection, LkIntlProvider, LkIntlProviderProps, directionForLocale, useLkDirection, useLkStrings } from './i18n/LkIntlProvider.cjs';
19
19
  export { TailwindThemeExtension, ThemeProvider, ThemeProviderProps, createTailwindTheme, darkTheme, defaultTheme, useTheme } from './theme/ThemeProvider.cjs';
20
20
  export { R as RecordedTake, S as SpeechRecorderError, a as SpeechRecorderStatus } from './machine-CuwKqWXC.cjs';
21
- export { W as WrittenResponseProps, a as WrittenResponseSubmission } from './WrittenResponse-D2K1VW_V.cjs';
21
+ export { W as WrittenResponseProps, a as WrittenResponseSubmission } from './WrittenResponse-BpL9p2Hn.cjs';
22
22
  import '@intellectif/lk-core';
23
23
  import 'react';
24
24
  import 'react/jsx-runtime';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { LearnerAi, LkAiProvider, LkAiProviderProps, useLearnerAi } from './ai/LkAiProvider.js';
2
- export { AiExplanationHelp, AiExplanationInput, AiHelpSituation, AiHintsHelp, AiHintsInput, AiWritingFeedbackHelp, AiWritingFeedbackInput, useAiExplanation, useAiHints, useAiWritingFeedback } from './ai/useAiHelp.js';
2
+ export { AiCoachingHelp, AiCoachingInput, AiExplanationHelp, AiExplanationInput, AiHelpSituation, AiHintsHelp, AiHintsInput, AiWritingFeedbackHelp, AiWritingFeedbackInput, useAiCoaching, useAiExplanation, useAiHints, useAiWritingFeedback } from './ai/useAiHelp.js';
3
3
  export { ActivityPreview, ActivityPreviewProps } from './components/ActivityPreview.js';
4
4
  export { ActivityRenderer, ActivitySequence, ActivitySequenceProps, SequenceItemOutcome, SequenceQuestion } from './components/ActivitySequence.js';
5
5
  export { Dictation, DictationProps } from './components/Dictation.js';
@@ -10,7 +10,7 @@ export { MultipleChoice, MultipleChoiceProps } from './components/MultipleChoice
10
10
  export { PronunciationFeedback, PronunciationFeedbackProps } from './components/PronunciationFeedback.js';
11
11
  export { ReadAloud } from './components/ReadAloud.js';
12
12
  export { StimulusPanel, StimulusPanelProps } from './components/StimulusPanel.js';
13
- export { A as ActivityProps, C as CaptionSize, D as DEFAULT_STRINGS, H as HtmlSanitizer, L as LkStrings, a as LkStringsOverride, M as MediaBudgetBinding, b as MediaTransportStrings, R as ReadAloudAssessResult, c as ReadAloudProps, d as RecordingBinding, e as RenderMode, f as Renderable, g as RenderableActivity, S as SequenceMediaBudget, h as SequenceRecordingBinding, i as SequenceRecordingSlot, V as VideoPreferences, j as asRenderable, k as asRenderableSequence, m as mergeStrings } from './types-CrtIcRcK.js';
13
+ export { A as ActivityProps, C as CaptionSize, D as DEFAULT_STRINGS, H as HtmlSanitizer, L as LkStrings, a as LkStringsOverride, M as MediaBudgetBinding, b as MediaTransportStrings, R as ReadAloudAssessResult, c as ReadAloudProps, d as RecordingBinding, e as RenderMode, f as Renderable, g as RenderableActivity, S as SequenceMediaBudget, h as SequenceRecordingBinding, i as SequenceRecordingSlot, V as VideoPreferences, j as asRenderable, k as asRenderableSequence, m as mergeStrings } from './types-C4IsUQsK.js';
14
14
  export { WrittenResponse } from './components/WrittenResponse.js';
15
15
  export { ActivityState, UseActivityStateResult, useActivityState } from './hooks/useActivityState.js';
16
16
  export { CAPTURE_PROCESSOR_SOURCE, SpeechRecorder, SpeechRecorderOptions, useSpeechRecorder } from './hooks/useSpeechRecorder.js';
@@ -18,7 +18,7 @@ export { UseXAPIResult, useXAPI } from './hooks/useXAPI.js';
18
18
  export { LkDirection, LkIntlProvider, LkIntlProviderProps, directionForLocale, useLkDirection, useLkStrings } from './i18n/LkIntlProvider.js';
19
19
  export { TailwindThemeExtension, ThemeProvider, ThemeProviderProps, createTailwindTheme, darkTheme, defaultTheme, useTheme } from './theme/ThemeProvider.js';
20
20
  export { R as RecordedTake, S as SpeechRecorderError, a as SpeechRecorderStatus } from './machine-CuwKqWXC.js';
21
- export { W as WrittenResponseProps, a as WrittenResponseSubmission } from './WrittenResponse-CgRrjM4S.js';
21
+ export { W as WrittenResponseProps, a as WrittenResponseSubmission } from './WrittenResponse-B7A5gHMj.js';
22
22
  import '@intellectif/lk-core';
23
23
  import 'react';
24
24
  import 'react/jsx-runtime';
package/dist/index.js CHANGED
@@ -1,29 +1,27 @@
1
1
  'use client';
2
2
  export { useXAPI } from './chunk-2TW6WLBC.js';
3
3
  export { ThemeProvider, createTailwindTheme, darkTheme, defaultTheme, useTheme } from './chunk-UHKZXOXD.js';
4
- export { InteractiveVideo, resolveCaptionTracks } from './chunk-JMEZYYCE.js';
5
- export { ActivityPreview } from './chunk-TGTP5DKF.js';
6
- export { ActivitySequence } from './chunk-SPSKDNEE.js';
7
- export { StimulusPanel } from './chunk-HZIT24BK.js';
8
- export { WrittenResponse } from './chunk-DPNCCWOV.js';
9
- export { MultipleChoice } from './chunk-O7MINPKZ.js';
10
- export { FillInTheBlanks } from './chunk-KI6DJ5ZF.js';
11
- export { GapSelect } from './chunk-ERV666AR.js';
12
- export { Dictation } from './chunk-6GQLCCGN.js';
13
- import './chunk-U5VFJVQ2.js';
14
- export { useAiExplanation, useAiHints, useAiWritingFeedback } from './chunk-CXIP7ERK.js';
15
- export { LkAiProvider, useLearnerAi } from './chunk-RX3A6KIY.js';
16
- export { ReadAloud } from './chunk-4MXECBZT.js';
17
- export { PronunciationFeedback } from './chunk-2OP5YHRR.js';
4
+ export { InteractiveVideo, resolveCaptionTracks } from './chunk-PWHECW6N.js';
5
+ export { ActivityPreview } from './chunk-7NFY3M3W.js';
6
+ export { ActivitySequence } from './chunk-G6PXJ2SA.js';
7
+ export { StimulusPanel } from './chunk-4ZZWZSWI.js';
8
+ export { WrittenResponse } from './chunk-FKGMSOJF.js';
9
+ export { MultipleChoice } from './chunk-C7QZE5BI.js';
10
+ export { FillInTheBlanks } from './chunk-TCDJY3H6.js';
11
+ export { GapSelect } from './chunk-ABJJ3LII.js';
12
+ export { Dictation } from './chunk-RBS5A2DF.js';
13
+ import './chunk-FDQR4GAZ.js';
14
+ export { ReadAloud } from './chunk-DC4CQCK5.js';
15
+ export { PronunciationFeedback } from './chunk-XO5R73Y4.js';
18
16
  export { CAPTURE_PROCESSOR_SOURCE, useSpeechRecorder } from './chunk-MCO52PV5.js';
19
17
  import './chunk-YORQQXGO.js';
20
- import './chunk-XYJBRKBZ.js';
21
- import './chunk-U4KTOH7C.js';
22
- import './chunk-E4UF4XZM.js';
23
- import './chunk-DXFCYNST.js';
24
- import './chunk-HYOUMTPW.js';
18
+ import './chunk-ORT3KLGI.js';
19
+ import './chunk-7SB2MJA4.js';
20
+ export { useAiCoaching, useAiExplanation, useAiHints, useAiWritingFeedback } from './chunk-MXNC5UNO.js';
21
+ import './chunk-TS7J6DTY.js';
25
22
  export { useActivityState } from './chunk-6N43WDVG.js';
26
- export { DEFAULT_STRINGS, LkIntlProvider, directionForLocale, mergeStrings, useLkDirection, useLkStrings } from './chunk-C4PSJ3ZC.js';
23
+ export { DEFAULT_STRINGS, LkIntlProvider, directionForLocale, mergeStrings, useLkDirection, useLkStrings } from './chunk-HNLRVRQR.js';
24
+ export { LkAiProvider, useLearnerAi } from './chunk-ZPI6Q42R.js';
27
25
 
28
26
  // src/components/types.ts
29
27
  function asRenderable(redacted) {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/types.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAoOO,SAAS,aACd,QAAA,EACmB;AACnB,EAAA,OAAO,QAAA;AACT;AAoCO,SAAS,qBACd,OAAA,EAC8C;AAC9C,EAAA,OAAO,OAAA;AACT","file":"index.js","sourcesContent":["import type {\n ActivityData,\n ActivityResult,\n DeliveryPolicy,\n InteractionEvent,\n ItemGroup,\n ItemOutcome,\n ItemScoringPolicy,\n LearnerResponse,\n MediaPlayClaim,\n MediaPlayGrant,\n MediaPlayLedgerEntry,\n RecordingRef,\n RedactedActivityData,\n SequenceEntry,\n ThemeTokens,\n} from '@intellectif/lk-core';\nimport type { LearnerAi } from '../ai/LkAiProvider.js';\nimport type { RecordedTake } from '../hooks/useSpeechRecorder.js';\nimport type { LkStringsOverride } from '../i18n/strings.js';\nimport type { ReadAloudAssessResult } from './ReadAloud/ReadAloud.js';\n\n/**\n * How an activity is being presented. This is the single switch that decides\n * whether the component may grade, reveal, or submit — the three things a\n * summative exam must take away from the client.\n *\n * - `practice` (default, and the only behaviour before `renderMode` existed):\n * the component owns the attempt. It\n * scores locally on submit, reveals correctness and feedback, and calls\n * `onComplete` with a full {@link ActivityResult}.\n * - `exam`: the component NEVER scores and NEVER reveals correctness. Submit\n * emits the raw learner response through `onSubmit`; the server grades it.\n * Safe to render redacted data, because nothing here needs the answer key.\n * - `review`: read-only. Renders the learner's submitted answer, and marks\n * correctness only from an `outcome` the caller supplies (which the server\n * computed). Nothing is submittable.\n */\nexport type RenderMode = 'practice' | 'exam' | 'review';\n\n/**\n * Makes the answer-key-bearing parts of an activity optional, so a component\n * can render either full activity data OR a `redact()` projection with the\n * same props. Fields the SDK classifies `answer-key` become optional here;\n * a component in `exam` mode must not read them at all.\n */\nexport type Renderable<TData> = Omit<TData, 'scoringStrategy'> & {\n scoringStrategy?: unknown;\n /** Present on a `redact()` projection. */\n redacted?: true;\n};\n\n/**\n * {@link Renderable} DISTRIBUTED over a union of activity types.\n *\n * This distinction is load-bearing, not cosmetic. `Renderable<T>` is built on\n * `Omit`, and `Omit` does not distribute: `Omit<A | B, K>` collapses to the\n * keys A and B have IN COMMON, so `Renderable<ActivityData>` is a single\n * object type carrying only the fields every activity shares. Narrowing it\n * dies with it — after `if (data.type === 'multiple-choice')` the compiler\n * still refuses `data.options`, because the union it would narrow to no\n * longer exists.\n *\n * The conditional below re-distributes, so `RenderableActivity` is a real\n * union of per-type renderables and `.type` narrows again. Anything that\n * accepts \"some renderable activity, I don't know which\" — a custom renderer,\n * a sequence entry — must use THIS, not `Renderable<ActivityData>`.\n */\nexport type RenderableActivity<TData extends ActivityData = ActivityData> = TData extends unknown\n ? Renderable<TData>\n : never;\n\n/**\n * Sanitiser for author-supplied rich text (`questionHtml`, `promptHtml`, and a\n * stimulus's `bodyHtml`). The SDK deliberately ships NO sanitiser — that would\n * add a dependency and, worse, a false promise. Rich text is rendered only when\n * you supply this function; without it the component falls back to the\n * plain-text field, which is always escaped. Fail-safe by construction: the SDK\n * never injects HTML it was not explicitly given a sanitiser for.\n *\n * `FillInTheBlanks.passageHtml` is the one exception, and is **never**\n * rendered: the passage hosts the answer inputs, so it cannot be split at the\n * `{{blank}}` placeholders without voiding the sanitiser. The plain `passage`\n * is always used, and passing `passageHtml` warns in development.\n */\nexport type HtmlSanitizer = (html: string) => string;\n\n/**\n * The prop contract shared by every activity component (Req 3.1). Defined\n * here (React-specific) rather than in lk-core, which is React-free.\n *\n * Controlled / uncontrolled follows the React convention: pass `value` +\n * `onChange` to own the learner's answer (restore an in-progress attempt,\n * autosave a delta, drive a review); pass `defaultValue` to seed an\n * uncontrolled component; pass neither to keep the pre-2.1.0 behaviour, where\n * the component owns the answer outright.\n */\nexport interface ActivityProps<TData extends ActivityData = ActivityData> {\n /** Activity content. Accepts a `redact()` projection in `exam` mode. */\n data: RenderableActivity<TData>;\n /**\n * Called when the component scored the attempt itself. Only ever fires in\n * `practice` mode — in `exam` mode the client does not grade, so there is\n * no `ActivityResult` to give you; use `onSubmit`.\n */\n onComplete?: (result: ActivityResult) => void;\n /**\n * Called on submit with the raw learner response and no grade. Fires in\n * every mode, before `onComplete`, so an exam runner can persist the\n * response and let the server score it.\n */\n onSubmit?: (response: LearnerResponse) => void;\n /** Controlled value: the learner's current response. */\n value?: LearnerResponse;\n /** Initial response for an uncontrolled component (ignored when `value` is set). */\n defaultValue?: LearnerResponse;\n /**\n * Mount the component as already submitted — read at mount only, like any\n * `default*` prop.\n *\n * Restoring an attempt without it reopens a question the learner had already\n * submitted as answerable, so on a summative paper they can change and\n * re-submit it. `AttemptState.submittedSlotIds` is what this consumes.\n */\n defaultSubmitted?: boolean;\n /** Fires on every change to the learner's response. Required for a controlled component. */\n onChange?: (response: LearnerResponse) => void;\n /** Presentation mode. Defaults to `practice`. */\n renderMode?: RenderMode;\n /**\n * Server-computed outcome, used by `review` mode to mark correctness\n * without the client ever scoring. Ignored in other modes.\n */\n outcome?: ItemOutcome;\n /** Renders author-supplied rich text when provided. See {@link HtmlSanitizer}. */\n sanitizeHtml?: HtmlSanitizer;\n /**\n * Binds this activity's own `data.media` to a play budget the consumer\n * persists. Usually supplied by `<ActivitySequence mediaBudget={…}>`; pass it\n * yourself when rendering an activity standalone.\n */\n mediaBudget?: MediaBudgetBinding;\n /** Translations for the audio transport chrome. See {@link MediaTransportStrings}. */\n mediaStrings?: Partial<MediaTransportStrings>;\n /**\n * Overrides the SDK's chrome text for this activity, layered on whatever\n * `LkIntlProvider` supplies. `mediaStrings` still works and is merged after\n * this, so an existing 0.8.x call site keeps behaving as it did.\n */\n strings?: LkStringsOverride;\n onInteraction?: (event: InteractionEvent) => void;\n /**\n * The host's AI ports for this activity — an explanation after grading, hints\n * before submit — overriding `LkAiProvider`'s. Leave a port out to switch\n * that help off. Nothing AI appears in `exam`, and an item whose author\n * switched a feature off (`data.ai`) never shows it. See {@link LearnerAi}.\n */\n ai?: LearnerAi;\n /**\n * What the school running this paper lets a learner see: feedback,\n * solutions, hints, and AI help. Every setting only takes something away\n * from what the mode shows, and an absent policy takes nothing away. Inside\n * `<ActivitySequence>` or `<InteractiveVideo>`, the paper's own policy holds\n * as well, whichever is stricter. See `DeliveryPolicy` in lk-core.\n */\n delivery?: DeliveryPolicy | null;\n /**\n * How this question is scored when the learner can try again or ask for\n * hints: how many tries, which counts, what tries and hints cost. Applies in\n * `practice`, where the component grades — `<MultipleChoice>`,\n * `<FillInTheBlanks>`, `<GapSelect>` and `<Dictation>`. `<ReadAloud>` takes\n * the prop and ignores it: its tries are its own `recording.maxTakes`, and\n * its grade comes from your assessor, not from the component. Inside\n * `<ActivitySequence>` or `<InteractiveVideo>`, the paper's own policy wins\n * over this one. See `ItemScoringPolicy` in lk-core.\n *\n * With tries, `onComplete` fires after every graded try: `score` and\n * `passed` are the question's under the policy so far, and `xapiStatement`\n * records the try just made. A policy `validateItemScoringPolicy` refuses\n * throws at render.\n */\n scoring?: ItemScoringPolicy | null;\n /** Per-instance token overrides, applied as inline CSS vars on the root. */\n theme?: Partial<ThemeTokens>;\n /**\n * BCP 47 tag stamped as `lang` on this component's root. This is the\n * INTERFACE language — the SDK's own chrome renders inside that element — so\n * it should carry the same value you give `<LkIntlProvider locale>`. Passing\n * a different one re-declares the language of every SDK string in this\n * subtree without changing the words.\n *\n * It is NOT `data.locale`, which labels xAPI statements — and, on a\n * dictation, places the dictation's own words: `<Dictation>` puts it, and\n * the direction it names, on its title, hints, marks and solution. Other\n * authored content in another language belongs on `stimulus.locale`, which\n * `<StimulusPanel>` puts on the passage alone.\n */\n locale?: string;\n disabled?: boolean;\n}\n\n/**\n * Bridges a server-produced `redact()` projection into the `data` prop.\n *\n * `RedactedActivityData` is deliberately index-signature typed in lk-core — it\n * proves a payload is learner-safe, not what shape it has — so TypeScript\n * cannot know it still carries the public fields a renderer needs. This is the\n * SDK's single, documented crossing of that gap, so an exam runner does not\n * have to write `as unknown as` at every call site:\n *\n * ```tsx\n * <MultipleChoice\n * data={asRenderable<MultipleChoiceData>(redactedFromServer)}\n * renderMode=\"exam\"\n * onSubmit={persist}\n * />\n * ```\n *\n * Safe because `exam` mode reads only public fields; the answer-key fields the\n * type claims are exactly the ones the component is forbidden to touch there.\n *\n * Per-type redacted interfaces (`RedactedMultipleChoiceData`, …) ship from\n * lk-core since 0.6.0, but they are not yet *assignable* to `data`:\n * {@link Renderable} widens `scoringStrategy` and leaves nested answer-key\n * fields (`options[].isCorrect`, `blanks[].acceptedAnswers`) required, so a\n * real redacted payload still needs this bridge. Closing that gap is tracked\n * in the roadmap.\n */\nexport function asRenderable<TData extends ActivityData>(\n redacted: RedactedActivityData,\n): Renderable<TData> {\n return redacted as unknown as Renderable<TData>;\n}\n\n/**\n * The same bridge as {@link asRenderable}, for a whole sequence: activities\n * and item groups as a server hands them over, ready for `<ActivitySequence>`.\n *\n * Needed for the same reason and no other. `redactItemGroup` returns\n * `ItemGroup<RedactedActivityData>`, and `RedactedActivityData` is an\n * index-signature type whose fields are all `unknown` — so its `question` is\n * not a `string` and it satisfies no per-type renderable, however the prop is\n * widened. Widening alone cannot fix this; a crossing point is required, and\n * having exactly one keeps `as unknown as` out of consumer code.\n *\n * ```tsx\n * const entries = await fetchExam(); // redacted, server-side\n * <ActivitySequence\n * activities={asRenderableSequence(entries)}\n * renderMode=\"exam\" // REQUIRED: see below\n * shuffleSeed={attemptId}\n * onSubmit={persist}\n * />\n * ```\n *\n * Pass `renderMode=\"exam\"` (or `\"review\"`). Redacted data has no answer key, and\n * almost every built-in activity throws at render in the default `practice`\n * mode rather than fail later: `<MultipleChoice>`, `<FillInTheBlanks>`,\n * `<GapSelect>` and `<Dictation>` because they grade locally, and\n * `<WrittenResponse>` because `practice` still runs its local submit path and\n * emits a practice-mode xAPI statement.\n *\n * `<ReadAloud>` is the exception and renders a projection in every mode: a\n * read-aloud item has no answer key to withhold, so `redact()` removes only the\n * authored feedback and leaves the reading, its language and its bounds — which\n * is everything the component puts on screen. It grades nothing locally either;\n * the grade comes back from whatever the application asked to judge the take.\n */\nexport function asRenderableSequence(\n entries: readonly (RedactedActivityData | RedactedItemGroupData)[],\n): readonly SequenceEntry<RenderableActivity>[] {\n return entries as unknown as readonly SequenceEntry<RenderableActivity>[];\n}\n\n/** Structural shape of a `redactItemGroup()` projection, as it arrives from a server. */\ntype RedactedItemGroupData = ItemGroup<RedactedActivityData> & { redacted: true };\n\n/**\n * Every word the SDK's audio transport renders.\n *\n * Words, not characters: the `m:ss / m:ss` clock is digits and punctuation and\n * is formatted by the component, because it reads identically in every locale\n * this SDK targets. The scrubber's SPOKEN value does have a word in it and does\n * have a key ({@link MediaTransportStrings.timeValue}).\n *\n * Supply them to translate it. These are the highest-stakes strings on a\n * listening paper — \"No plays remaining\" decides whether a learner believes\n * they may try again — so shipping them as untranslatable English inside a\n * Spanish panel was not acceptable. Supplying any of them also sets `lang` on\n * the transport chrome, so a screen reader does not read the SDK's own words\n * with the passage's phonetics.\n */\nexport interface MediaTransportStrings {\n play: string;\n pause: string;\n preparing: string;\n mute: string;\n unmute: string;\n volume: string;\n speed: string;\n seek: string;\n /**\n * Spoken value of the scrubber, e.g. `('1:05', '4:30') => '1:05 of 4:30'`.\n * Takes ALREADY-FORMATTED `m:ss` strings: a translation should not have to\n * reimplement the clock to change the word between them.\n */\n timeValue: (elapsed: string, duration: string) => string;\n /** e.g. `(1, 2) => '1 of 2 plays remaining'`. */\n playsRemaining: (remaining: number, max: number) => string;\n noPlaysRemaining: string;\n /** Shown before the LAST play is spent, so a stray press cannot cost it. */\n lastPlayConfirm: string;\n lastPlayStart: string;\n lastPlayCancel: string;\n seekBlocked: string;\n rateBlocked: string;\n playFailed: string;\n}\n\n/**\n * Binds ONE media block to a play budget the consumer persists.\n *\n * The SDK refuses a play; it does not remember one. Everything durable here is\n * the consuming application's — see {@link SequenceMediaBudget.onPlayConsumed}.\n */\nexport interface MediaBudgetBinding {\n /** From `slotMediaKey(slotId)` / `stimulusMediaKey(slotId)` in lk-core. */\n key: string;\n /** Plays already spent, and where playback stood. Read at mount only. */\n entry?: MediaPlayLedgerEntry;\n /** Defaults to `renderMode !== 'review'`. An explicit boolean wins either way. */\n enforced?: boolean;\n /** Slot context stamped onto the claim and the interaction event. */\n slotId: string;\n index: number;\n activityId?: string;\n onPlayConsumed?: (claim: MediaPlayClaim) => undefined | Promise<MediaPlayGrant | undefined>;\n onPlayRefunded?: (claim: MediaPlayClaim) => void;\n onPosition?: (key: string, seconds: number) => void;\n /** Translations for the transport chrome. */\n strings?: Partial<MediaTransportStrings>;\n}\n\n/**\n * The pager-level half of a play budget. One prop, because it is one concept.\n */\nexport interface SequenceMediaBudget {\n /**\n * `MediaPlayLedger.entries` goes straight in. An absent key means nothing\n * spent. Read at mount, like `responses`.\n */\n plays?: Readonly<Record<string, MediaPlayLedgerEntry>>;\n /**\n * Re-seed token. Change this string and the budgets re-seed from `plays`\n * WITHOUT remounting the pager — the invigilator path (\"the audio never\n * started, give her the play back\") that would otherwise cost the learner\n * their focus, their scroll position and an unsaved answer.\n */\n resumeKey?: string;\n /** Explicit override of the default (`renderMode !== 'review'`). */\n enforced?: boolean;\n /**\n * Called the instant a play is claimed, BEFORE any audio is audible.\n *\n * Two tiers, chosen by what you return:\n *\n * - **Return nothing (optimistic).** Playback starts immediately and the\n * count is only as durable as your write. **Do not debounce this, and do\n * not batch it with the answer autosave** — an eight-second debounce is\n * exactly long enough to start a third play and hard-reload. A `pagehide`\n * beacon is a backstop, not the mechanism. A crash between this call and\n * your write landing RETURNS the play to the learner; that is the honest\n * description of what you are buying.\n * - **Return a promise (confirmed).** Playback is held — the button reads\n * \"Preparing…\" and is `aria-busy` — until it settles. Resolve with\n * `{ playsUsed }` from an ATOMIC server write (`UPDATE … SET plays = plays\n * + 1 … RETURNING plays`, or a compare-and-set on\n * `claim.previousPlaysUsed`). A resolved count above `maxPlays` refuses the\n * play, which is how a second tab is caught: two mounts both seeded at 0\n * both claim 1, and only an atomic increment can tell them apart. A\n * rejection charges nothing and lets the learner retry. This is the only\n * tier in which \"consumed before audible\" is true of storage rather than\n * only of memory; use it for summative papers.\n *\n * Never settle the promise and the learner cannot play at all: settle it.\n */\n onPlayConsumed?: (claim: MediaPlayClaim) => undefined | Promise<MediaPlayGrant | undefined>;\n /**\n * Called when a charged play produced no audio — the element errored before\n * playback advanced past 0.25 s, an expired signed URL being the realistic\n * cause. Supply it to give the play back, decrementing with a compare-and-set\n * on `claim.playsUsed`. Omit it and the play stays spent: the SDK will not\n * decrement a ledger it has no channel to correct.\n */\n onPlayRefunded?: (claim: MediaPlayClaim) => void;\n /**\n * Position reports, so a refresh resumes the play the learner already paid\n * for instead of charging them again. Fires on pause, on end (with 0), and at\n * most once per whole second of playback.\n *\n * **This one you MAY throttle** — the granularity you persist is the\n * granularity of the replay a crash grants. Three seconds is sane; three\n * minutes is not.\n */\n onPosition?: (key: string, seconds: number) => void;\n /** Translations for the transport chrome. Defaults are English. */\n strings?: Partial<MediaTransportStrings>;\n}\n\n/**\n * Which slot a recording belongs to, stamped on every call the pager makes.\n *\n * Exactly the shape {@link ActivitySequenceProps.onSubmit} already passes, so\n * one identity travels with the answer and with the take that answer points at\n * — and a consumer writes `slotId` in both places rather than reconciling two\n * spellings of \"which question was this\".\n */\nexport interface SequenceRecordingSlot {\n /** Identity from `flattenSequence` — stable under shuffling. Store against THIS. */\n slotId: string;\n /** Presented position, which moves under shuffling. */\n index: number;\n activityId: string;\n}\n\n/**\n * The pager-level half of a read-aloud recording binding: where every take in\n * this sequence is stored, and how a judgement comes back.\n *\n * One prop at both levels, because it is one concept — the media-budget\n * precedent ({@link SequenceMediaBudget} beside {@link MediaBudgetBinding}).\n * The difference is the second argument: a per-slot binding knows which slot it\n * belongs to, so a sequence-level one is told.\n *\n * The SDK records and hands over; it never judges. `assess` is `practice` only\n * and optional — a sequence that only stores takes gets the \"assessment is not\n * available\" notice rather than a throw — and `playbackUrl` is `review` only.\n * A slot whose activity is not a read-aloud never calls any of them.\n */\nexport interface SequenceRecordingBinding {\n /**\n * Puts the take in your storage and returns its key. **Required** outside\n * `review`: without it a learner can speak into a control that submits\n * nothing, which the component refuses to render. Settle it.\n */\n upload(take: RecordedTake, slot: SequenceRecordingSlot): Promise<RecordingRef>;\n /** Judges the stored take. `practice` only; an exam never assesses on the client. */\n assess?(ref: RecordingRef, slot: SequenceRecordingSlot): Promise<ReadAloudAssessResult>;\n /** A playable link to a stored take. `review` only. */\n playbackUrl?(ref: RecordingRef, slot: SequenceRecordingSlot): Promise<string>;\n}\n"]}
1
+ {"version":3,"sources":["../src/components/types.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAoOO,SAAS,aACd,QAAA,EACmB;AACnB,EAAA,OAAO,QAAA;AACT;AAoCO,SAAS,qBACd,OAAA,EAC8C;AAC9C,EAAA,OAAO,OAAA;AACT","file":"index.js","sourcesContent":["import type {\n ActivityData,\n ActivityResult,\n DeliveryPolicy,\n InteractionEvent,\n ItemGroup,\n ItemOutcome,\n ItemScoringPolicy,\n LearnerResponse,\n MediaPlayClaim,\n MediaPlayGrant,\n MediaPlayLedgerEntry,\n RecordingRef,\n RedactedActivityData,\n SequenceEntry,\n ThemeTokens,\n} from '@intellectif/lk-core';\nimport type { LearnerAi } from '../ai/LkAiProvider.js';\nimport type { RecordedTake } from '../hooks/useSpeechRecorder.js';\nimport type { LkStringsOverride } from '../i18n/strings.js';\nimport type { ReadAloudAssessResult } from './ReadAloud/ReadAloud.js';\n\n/**\n * How an activity is being presented. This is the single switch that decides\n * whether the component may grade, reveal, or submit — the three things a\n * summative exam must take away from the client.\n *\n * - `practice` (default, and the only behaviour before `renderMode` existed):\n * the component owns the attempt. It\n * scores locally on submit, reveals correctness and feedback, and calls\n * `onComplete` with a full {@link ActivityResult}.\n * - `exam`: the component NEVER scores and NEVER reveals correctness. Submit\n * emits the raw learner response through `onSubmit`; the server grades it.\n * Safe to render redacted data, because nothing here needs the answer key.\n * - `review`: read-only. Renders the learner's submitted answer, and marks\n * correctness only from an `outcome` the caller supplies (which the server\n * computed). Nothing is submittable.\n */\nexport type RenderMode = 'practice' | 'exam' | 'review';\n\n/**\n * Makes the answer-key-bearing parts of an activity optional, so a component\n * can render either full activity data OR a `redact()` projection with the\n * same props. Fields the SDK classifies `answer-key` become optional here;\n * a component in `exam` mode must not read them at all.\n */\nexport type Renderable<TData> = Omit<TData, 'scoringStrategy'> & {\n scoringStrategy?: unknown;\n /** Present on a `redact()` projection. */\n redacted?: true;\n};\n\n/**\n * {@link Renderable} DISTRIBUTED over a union of activity types.\n *\n * This distinction is load-bearing, not cosmetic. `Renderable<T>` is built on\n * `Omit`, and `Omit` does not distribute: `Omit<A | B, K>` collapses to the\n * keys A and B have IN COMMON, so `Renderable<ActivityData>` is a single\n * object type carrying only the fields every activity shares. Narrowing it\n * dies with it — after `if (data.type === 'multiple-choice')` the compiler\n * still refuses `data.options`, because the union it would narrow to no\n * longer exists.\n *\n * The conditional below re-distributes, so `RenderableActivity` is a real\n * union of per-type renderables and `.type` narrows again. Anything that\n * accepts \"some renderable activity, I don't know which\" — a custom renderer,\n * a sequence entry — must use THIS, not `Renderable<ActivityData>`.\n */\nexport type RenderableActivity<TData extends ActivityData = ActivityData> = TData extends unknown\n ? Renderable<TData>\n : never;\n\n/**\n * Sanitiser for author-supplied rich text (`questionHtml`, `promptHtml`, and a\n * stimulus's `bodyHtml`). The SDK deliberately ships NO sanitiser — that would\n * add a dependency and, worse, a false promise. Rich text is rendered only when\n * you supply this function; without it the component falls back to the\n * plain-text field, which is always escaped. Fail-safe by construction: the SDK\n * never injects HTML it was not explicitly given a sanitiser for.\n *\n * `FillInTheBlanks.passageHtml` is the one exception, and is **never**\n * rendered: the passage hosts the answer inputs, so it cannot be split at the\n * `{{blank}}` placeholders without voiding the sanitiser. The plain `passage`\n * is always used, and passing `passageHtml` warns in development.\n */\nexport type HtmlSanitizer = (html: string) => string;\n\n/**\n * The prop contract shared by every activity component (Req 3.1). Defined\n * here (React-specific) rather than in lk-core, which is React-free.\n *\n * Controlled / uncontrolled follows the React convention: pass `value` +\n * `onChange` to own the learner's answer (restore an in-progress attempt,\n * autosave a delta, drive a review); pass `defaultValue` to seed an\n * uncontrolled component; pass neither to keep the pre-2.1.0 behaviour, where\n * the component owns the answer outright.\n */\nexport interface ActivityProps<TData extends ActivityData = ActivityData> {\n /** Activity content. Accepts a `redact()` projection in `exam` mode. */\n data: RenderableActivity<TData>;\n /**\n * Called when the component scored the attempt itself. Only ever fires in\n * `practice` mode — in `exam` mode the client does not grade, so there is\n * no `ActivityResult` to give you; use `onSubmit`.\n */\n onComplete?: (result: ActivityResult) => void;\n /**\n * Called on submit with the raw learner response and no grade. Fires in\n * every mode, before `onComplete`, so an exam runner can persist the\n * response and let the server score it.\n */\n onSubmit?: (response: LearnerResponse) => void;\n /** Controlled value: the learner's current response. */\n value?: LearnerResponse;\n /** Initial response for an uncontrolled component (ignored when `value` is set). */\n defaultValue?: LearnerResponse;\n /**\n * Mount the component as already submitted — read at mount only, like any\n * `default*` prop.\n *\n * Restoring an attempt without it reopens a question the learner had already\n * submitted as answerable, so on a summative paper they can change and\n * re-submit it. `AttemptState.submittedSlotIds` is what this consumes.\n */\n defaultSubmitted?: boolean;\n /** Fires on every change to the learner's response. Required for a controlled component. */\n onChange?: (response: LearnerResponse) => void;\n /** Presentation mode. Defaults to `practice`. */\n renderMode?: RenderMode;\n /**\n * Server-computed outcome, used by `review` mode to mark correctness\n * without the client ever scoring. Ignored in other modes.\n */\n outcome?: ItemOutcome;\n /** Renders author-supplied rich text when provided. See {@link HtmlSanitizer}. */\n sanitizeHtml?: HtmlSanitizer;\n /**\n * Binds this activity's own `data.media` to a play budget the consumer\n * persists. Usually supplied by `<ActivitySequence mediaBudget={…}>`; pass it\n * yourself when rendering an activity standalone.\n */\n mediaBudget?: MediaBudgetBinding;\n /** Translations for the audio transport chrome. See {@link MediaTransportStrings}. */\n mediaStrings?: Partial<MediaTransportStrings>;\n /**\n * Overrides the SDK's chrome text for this activity, layered on whatever\n * `LkIntlProvider` supplies. `mediaStrings` still works and is merged after\n * this, so an existing 0.8.x call site keeps behaving as it did.\n */\n strings?: LkStringsOverride;\n onInteraction?: (event: InteractionEvent) => void;\n /**\n * The host's AI ports for this activity — an explanation after grading, hints\n * before submit — overriding `LkAiProvider`'s. Leave a port out to switch\n * that help off. Nothing AI appears in `exam`, and an item whose author\n * switched a feature off (`data.ai`) never shows it. See {@link LearnerAi}.\n */\n ai?: LearnerAi;\n /**\n * What the school running this paper lets a learner see: feedback,\n * solutions, hints, and AI help. Every setting only takes something away\n * from what the mode shows, and an absent policy takes nothing away. Inside\n * `<ActivitySequence>` or `<InteractiveVideo>`, the paper's own policy holds\n * as well, whichever is stricter. See `DeliveryPolicy` in lk-core.\n */\n delivery?: DeliveryPolicy | null;\n /**\n * How this question is scored when the learner can try again or ask for\n * hints: how many tries, which counts, what tries and hints cost. Applies in\n * `practice`, where the component grades — `<MultipleChoice>`,\n * `<FillInTheBlanks>`, `<GapSelect>` and `<Dictation>`. `<ReadAloud>` takes\n * the prop and ignores it: its tries are its own `recording.maxTakes`, and\n * its grade comes from your assessor, not from the component. Inside\n * `<ActivitySequence>` or `<InteractiveVideo>`, the paper's own policy wins\n * over this one. See `ItemScoringPolicy` in lk-core.\n *\n * With tries, `onComplete` fires after every graded try: `score` and\n * `passed` are the question's under the policy so far, and `xapiStatement`\n * records the try just made. A policy `validateItemScoringPolicy` refuses\n * throws at render.\n */\n scoring?: ItemScoringPolicy | null;\n /** Per-instance token overrides, applied as inline CSS vars on the root. */\n theme?: Partial<ThemeTokens>;\n /**\n * BCP 47 tag stamped as `lang` on this component's root. This is the\n * INTERFACE language — the SDK's own chrome renders inside that element — so\n * it should carry the same value you give `<LkIntlProvider locale>`. Passing\n * a different one re-declares the language of every SDK string in this\n * subtree without changing the words.\n *\n * It is NOT `data.locale`, which labels xAPI statements — and, on a\n * dictation, places the dictation's own words: `<Dictation>` puts it, and\n * the direction it names, on its title, hints, marks and solution. Other\n * authored content in another language belongs on `stimulus.locale`, which\n * `<StimulusPanel>` puts on the passage alone.\n */\n locale?: string;\n disabled?: boolean;\n}\n\n/**\n * Bridges a server-produced `redact()` projection into the `data` prop.\n *\n * `RedactedActivityData` is deliberately index-signature typed in lk-core — it\n * proves a payload is learner-safe, not what shape it has — so TypeScript\n * cannot know it still carries the public fields a renderer needs. This is the\n * SDK's single, documented crossing of that gap, so an exam runner does not\n * have to write `as unknown as` at every call site:\n *\n * ```tsx\n * <MultipleChoice\n * data={asRenderable<MultipleChoiceData>(redactedFromServer)}\n * renderMode=\"exam\"\n * onSubmit={persist}\n * />\n * ```\n *\n * Safe because `exam` mode reads only public fields; the answer-key fields the\n * type claims are exactly the ones the component is forbidden to touch there.\n *\n * Per-type redacted interfaces (`RedactedMultipleChoiceData`, …) ship from\n * lk-core since 0.6.0, but they are not yet *assignable* to `data`:\n * {@link Renderable} widens `scoringStrategy` and leaves nested answer-key\n * fields (`options[].isCorrect`, `blanks[].acceptedAnswers`) required, so a\n * real redacted payload still needs this bridge. Closing that gap is tracked\n * in the roadmap.\n */\nexport function asRenderable<TData extends ActivityData>(\n redacted: RedactedActivityData,\n): Renderable<TData> {\n return redacted as unknown as Renderable<TData>;\n}\n\n/**\n * The same bridge as {@link asRenderable}, for a whole sequence: activities\n * and item groups as a server hands them over, ready for `<ActivitySequence>`.\n *\n * Needed for the same reason and no other. `redactItemGroup` returns\n * `ItemGroup<RedactedActivityData>`, and `RedactedActivityData` is an\n * index-signature type whose fields are all `unknown` — so its `question` is\n * not a `string` and it satisfies no per-type renderable, however the prop is\n * widened. Widening alone cannot fix this; a crossing point is required, and\n * having exactly one keeps `as unknown as` out of consumer code.\n *\n * ```tsx\n * const entries = await fetchExam(); // redacted, server-side\n * <ActivitySequence\n * activities={asRenderableSequence(entries)}\n * renderMode=\"exam\" // REQUIRED: see below\n * shuffleSeed={attemptId}\n * onSubmit={persist}\n * />\n * ```\n *\n * Pass `renderMode=\"exam\"` (or `\"review\"`). Redacted data has no answer key, and\n * almost every built-in activity throws at render in the default `practice`\n * mode rather than fail later: `<MultipleChoice>`, `<FillInTheBlanks>`,\n * `<GapSelect>` and `<Dictation>` because they grade locally, and\n * `<WrittenResponse>` because `practice` still runs its local submit path and\n * emits a practice-mode xAPI statement.\n *\n * `<ReadAloud>` is the exception and renders a projection in every mode: a\n * read-aloud item has no answer key to withhold, so `redact()` removes only the\n * authored feedback and leaves the reading, its language and its bounds — which\n * is everything the component puts on screen. It grades nothing locally either;\n * the grade comes back from whatever the application asked to judge the take.\n */\nexport function asRenderableSequence(\n entries: readonly (RedactedActivityData | RedactedItemGroupData)[],\n): readonly SequenceEntry<RenderableActivity>[] {\n return entries as unknown as readonly SequenceEntry<RenderableActivity>[];\n}\n\n/** Structural shape of a `redactItemGroup()` projection, as it arrives from a server. */\ntype RedactedItemGroupData = ItemGroup<RedactedActivityData> & { redacted: true };\n\n/**\n * Every word the SDK's audio transport renders.\n *\n * Words, not characters: the `m:ss / m:ss` clock is digits and punctuation and\n * is formatted by the component, because it reads identically in every locale\n * this SDK targets. The scrubber's SPOKEN value does have a word in it and does\n * have a key ({@link MediaTransportStrings.timeValue}).\n *\n * Supply them to translate it. These are the highest-stakes strings on a\n * listening paper — \"No plays remaining\" decides whether a learner believes\n * they may try again — so shipping them as untranslatable English inside a\n * Spanish panel was not acceptable. Supplying any of them also sets `lang` on\n * the transport chrome, so a screen reader does not read the SDK's own words\n * with the passage's phonetics.\n */\nexport interface MediaTransportStrings {\n play: string;\n pause: string;\n preparing: string;\n mute: string;\n unmute: string;\n volume: string;\n speed: string;\n seek: string;\n /**\n * Spoken value of the scrubber, e.g. `('1:05', '4:30') => '1:05 of 4:30'`.\n * Takes ALREADY-FORMATTED `m:ss` strings: a translation should not have to\n * reimplement the clock to change the word between them.\n */\n timeValue: (elapsed: string, duration: string) => string;\n /** e.g. `(1, 2) => '1 of 2 plays remaining'`. */\n playsRemaining: (remaining: number, max: number) => string;\n noPlaysRemaining: string;\n /** Shown before the LAST play is spent, so a stray press cannot cost it. */\n lastPlayConfirm: string;\n lastPlayStart: string;\n lastPlayCancel: string;\n seekBlocked: string;\n rateBlocked: string;\n playFailed: string;\n}\n\n/**\n * Binds ONE media block to a play budget the consumer persists.\n *\n * The SDK refuses a play; it does not remember one. Everything durable here is\n * the consuming application's — see {@link SequenceMediaBudget.onPlayConsumed}.\n */\nexport interface MediaBudgetBinding {\n /** From `slotMediaKey(slotId)` / `stimulusMediaKey(slotId)` in lk-core. */\n key: string;\n /** Plays already spent, and where playback stood. Read at mount only. */\n entry?: MediaPlayLedgerEntry;\n /** Defaults to `renderMode !== 'review'`. An explicit boolean wins either way. */\n enforced?: boolean;\n /** Slot context stamped onto the claim and the interaction event. */\n slotId: string;\n index: number;\n activityId?: string;\n onPlayConsumed?: (claim: MediaPlayClaim) => undefined | Promise<MediaPlayGrant | undefined>;\n onPlayRefunded?: (claim: MediaPlayClaim) => void;\n onPosition?: (key: string, seconds: number) => void;\n /** Translations for the transport chrome. */\n strings?: Partial<MediaTransportStrings>;\n}\n\n/**\n * The pager-level half of a play budget. One prop, because it is one concept.\n */\nexport interface SequenceMediaBudget {\n /**\n * `MediaPlayLedger.entries` goes straight in. An absent key means nothing\n * spent. Read at mount, like `responses`.\n */\n plays?: Readonly<Record<string, MediaPlayLedgerEntry>>;\n /**\n * Re-seed token. Change this string and the budgets re-seed from `plays`\n * WITHOUT remounting the pager — the invigilator path (\"the audio never\n * started, give her the play back\") that would otherwise cost the learner\n * their focus, their scroll position and an unsaved answer.\n */\n resumeKey?: string;\n /** Explicit override of the default (`renderMode !== 'review'`). */\n enforced?: boolean;\n /**\n * Called the instant a play is claimed, BEFORE any audio is audible.\n *\n * Two tiers, chosen by what you return:\n *\n * - **Return nothing (optimistic).** Playback starts immediately and the\n * count is only as durable as your write. **Do not debounce this, and do\n * not batch it with the answer autosave** — an eight-second debounce is\n * exactly long enough to start a third play and hard-reload. A `pagehide`\n * beacon is a backstop, not the mechanism. A crash between this call and\n * your write landing RETURNS the play to the learner; that is the honest\n * description of what you are buying.\n * - **Return a promise (confirmed).** Playback is held — the button reads\n * \"Preparing…\" and is `aria-busy` — until it settles. Resolve with\n * `{ playsUsed }` from an ATOMIC server write (`UPDATE … SET plays = plays\n * + 1 … RETURNING plays`, or a compare-and-set on\n * `claim.previousPlaysUsed`). A resolved count above `maxPlays` refuses the\n * play, which is how a second tab is caught: two mounts both seeded at 0\n * both claim 1, and only an atomic increment can tell them apart. A\n * rejection charges nothing and lets the learner retry. This is the only\n * tier in which \"consumed before audible\" is true of storage rather than\n * only of memory; use it for summative papers.\n *\n * Never settle the promise and the learner cannot play at all: settle it.\n */\n onPlayConsumed?: (claim: MediaPlayClaim) => undefined | Promise<MediaPlayGrant | undefined>;\n /**\n * Called when a charged play produced no audio — the element errored before\n * playback advanced past 0.25 s, an expired signed URL being the realistic\n * cause. Supply it to give the play back, decrementing with a compare-and-set\n * on `claim.playsUsed`. Omit it and the play stays spent: the SDK will not\n * decrement a ledger it has no channel to correct.\n */\n onPlayRefunded?: (claim: MediaPlayClaim) => void;\n /**\n * Position reports, so a refresh resumes the play the learner already paid\n * for instead of charging them again. Fires on pause, on end (with 0), and at\n * most once per whole second of playback.\n *\n * **This one you MAY throttle** — the granularity you persist is the\n * granularity of the replay a crash grants. Three seconds is sane; three\n * minutes is not.\n */\n onPosition?: (key: string, seconds: number) => void;\n /** Translations for the transport chrome. Defaults are English. */\n strings?: Partial<MediaTransportStrings>;\n}\n\n/**\n * Which slot a recording belongs to, stamped on every call the pager makes.\n *\n * Exactly the shape {@link ActivitySequenceProps.onSubmit} already passes, so\n * one identity travels with the answer and with the take that answer points at\n * — and a consumer writes `slotId` in both places rather than reconciling two\n * spellings of \"which question was this\".\n */\nexport interface SequenceRecordingSlot {\n /** Identity from `flattenSequence` — stable under shuffling. Store against THIS. */\n slotId: string;\n /** Presented position, which moves under shuffling. */\n index: number;\n activityId: string;\n}\n\n/**\n * The pager-level half of a read-aloud recording binding: where every take in\n * this sequence is stored, and how a judgement comes back.\n *\n * One prop at both levels, because it is one concept — the media-budget\n * precedent ({@link SequenceMediaBudget} beside {@link MediaBudgetBinding}).\n * The difference is the second argument: a per-slot binding knows which slot it\n * belongs to, so a sequence-level one is told.\n *\n * The SDK records and hands over; it never judges. `assess` is `practice` only\n * and optional — a sequence that only stores takes gets the \"assessment is not\n * available\" notice rather than a throw — and `playbackUrl` is `review` only.\n * A slot whose activity is not a read-aloud never calls any of them.\n */\nexport interface SequenceRecordingBinding {\n /**\n * Puts the take in your storage and returns its key. **Required** outside\n * `review`: without it a learner can speak into a control that submits\n * nothing, which the component refuses to render. Settle it.\n */\n upload(take: RecordedTake, slot: SequenceRecordingSlot): Promise<RecordingRef>;\n /** Judges the stored take. `practice` only; an exam never assesses on the client. */\n assess?(ref: RecordingRef, slot: SequenceRecordingSlot): Promise<ReadAloudAssessResult>;\n /** A playable link to a stored take. `review` only. */\n playbackUrl?(ref: RecordingRef, slot: SequenceRecordingSlot): Promise<string>;\n}\n"]}
@@ -3339,7 +3339,8 @@
3339
3339
  }
3340
3340
 
3341
3341
  @layer lk-skin {
3342
- /* ── AI help: an explanation after grading, hints before submit ─────────
3342
+ /* ── AI help: an explanation after grading, hints before submit, feedback
3343
+ on a draft, and coaching on a reading ────────────────────────────────
3343
3344
  Set apart from the author's own feedback by a dashed rule and a notice
3344
3345
  under it, so a learner can always tell what a model wrote from what a
3345
3346
  teacher did. On the plain surface, where the muted notice is a colour
@@ -3445,6 +3446,50 @@
3445
3446
  font-weight: 600;
3446
3447
  }
3447
3448
 
3449
+ /* Coaching on a reading holds a list of words as well as text, spaced as
3450
+ feedback on a draft is. Each word coached leads with the word as the
3451
+ reading spells it, then the sound, then what to do: the tip takes a line
3452
+ of its own, so a long one never squeezes the word beside it. */
3453
+ .lk-ai-coaching .lk-ai-panel {
3454
+ display: flex;
3455
+ flex-direction: column;
3456
+ gap: var(--lk-spacing-sm);
3457
+ }
3458
+
3459
+ .lk-ai-coaching .lk-ai-panel > * {
3460
+ margin: 0;
3461
+ }
3462
+
3463
+ .lk-ai-coaching-words {
3464
+ display: flex;
3465
+ flex-direction: column;
3466
+ gap: var(--lk-spacing-xs);
3467
+ padding: 0;
3468
+ list-style: none;
3469
+ }
3470
+
3471
+ .lk-ai-coaching-word {
3472
+ display: flex;
3473
+ flex-wrap: wrap;
3474
+ align-items: baseline;
3475
+ gap: var(--lk-spacing-xs) var(--lk-spacing-sm);
3476
+ padding: var(--lk-spacing-xs) var(--lk-spacing-sm);
3477
+ border-inline-start: 3px dashed var(--lk-color-primary);
3478
+ }
3479
+
3480
+ .lk-ai-coaching-target {
3481
+ font-weight: 600;
3482
+ }
3483
+
3484
+ .lk-ai-coaching-sound {
3485
+ font-size: var(--lk-font-size-sm);
3486
+ color: var(--lk-color-text-muted);
3487
+ }
3488
+
3489
+ .lk-ai-coaching-word > .lk-ai-text {
3490
+ flex-basis: 100%;
3491
+ }
3492
+
3448
3493
  @media (prefers-reduced-motion: reduce) {
3449
3494
  .lk-ai-button {
3450
3495
  transition: none;
@@ -456,6 +456,22 @@ interface LkStrings {
456
456
  * percentage — said to be an indication and not a grade, which it is not.
457
457
  */
458
458
  aiIndicativeScore: (percent: number) => string;
459
+ /** The button that asks for coaching on a graded reading aloud. */
460
+ aiCoaching: string;
461
+ /** The same button while the coaching is being written. */
462
+ aiCoachingLoading: string;
463
+ /** The heading over coaching on a reading, and its accessible name. */
464
+ aiCoachingHeading: string;
465
+ /** When no coaching can be shown: the port failed, or its coaching was refused. */
466
+ aiCoachingUnavailable: string;
467
+ /** The accessible name of the list of words the coaching works on. */
468
+ aiCoachingWords: string;
469
+ /**
470
+ * The sound a tip is about, as the speech engine spelt it — in the alphabet
471
+ * it reported, usually IPA — and, when the engine said so, what it was heard
472
+ * as instead.
473
+ */
474
+ aiCoachingSound: (expected: string, heard: string | undefined) => string;
459
475
  /**
460
476
  * The listening-paper transport. Shipped in 0.8.0 as its own `mediaStrings`
461
477
  * prop, which still works — this is the same shape, reachable from the one