@digabi/exam-engine-core 23.10.1-alpha.1 → 23.10.1-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ interface AudioContext {
3
+ bitRate?: number;
4
+ saveInterval?: number;
5
+ }
6
+ export declare const AudioContext: React.Context<AudioContext>;
7
+ export declare const withAudioContext: (Component: React.ComponentType<any>) => React.ComponentType<any>;
8
+ export {};
9
+ //# sourceMappingURL=AudioContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AudioContext.d.ts","sourceRoot":"","sources":["../../../src/components/context/AudioContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,UAAU,YAAY;IACpB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,eAAO,MAAM,YAAY,6BAAwD,CAAA;AAEjF,eAAO,MAAM,gBAAgB,mEAG1B,CAAA"}
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { getNumericAttribute } from '../../dom-utils';
3
+ import { withContext } from './withContext';
4
+ export const AudioContext = React.createContext({});
5
+ export const withAudioContext = withContext(AudioContext, ({ element }) => ({
6
+ bitRate: getNumericAttribute(element, 'bit-rate'),
7
+ saveInterval: getNumericAttribute(element, 'save-interval')
8
+ }));
9
+ //# sourceMappingURL=AudioContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AudioContext.js","sourceRoot":"","sources":["../../../src/components/context/AudioContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAQ3C,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,CAAC,aAAa,CAAe,EAAkB,CAAC,CAAA;AAEjF,MAAM,CAAC,MAAM,gBAAgB,GAAG,WAAW,CAAmC,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;IAC5G,OAAO,EAAE,mBAAmB,CAAC,OAAO,EAAE,UAAU,CAAC;IACjD,YAAY,EAAE,mBAAmB,CAAC,OAAO,EAAE,eAAe,CAAC;CAC5D,CAAC,CAAC,CAAA"}
@@ -1,7 +1,4 @@
1
1
  import React from 'react';
2
- import { ExamComponentProps } from '../../createRenderChildNodes';
3
- import type { AudioAnswer } from '../../types/ExamAnswer';
4
- declare function AudioAnswer(audioAnswerProps: ExamComponentProps): React.JSX.Element;
5
- declare const _default: React.MemoExoticComponent<typeof AudioAnswer>;
2
+ declare const _default: React.MemoExoticComponent<React.ComponentType<any>>;
6
3
  export default _default;
7
4
  //# sourceMappingURL=AudioAnswer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AudioAnswer.d.ts","sourceRoot":"","sources":["../../../src/components/exam/AudioAnswer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AAMjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAGzD,iBAAS,WAAW,CAAC,gBAAgB,EAAE,kBAAkB,qBAoCxD;;AAED,wBAAsC"}
1
+ {"version":3,"file":"AudioAnswer.d.ts","sourceRoot":"","sources":["../../../src/components/exam/AudioAnswer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;;AAqDzC,wBAAwD"}
@@ -4,6 +4,7 @@ import { saveAnswer } from '../../store/answers/actions';
4
4
  import { useDispatch, useSelector } from 'react-redux';
5
5
  import { ExamContext } from '../context/ExamContext';
6
6
  import { AudioRecorder } from './internal/AudioRecorder';
7
+ import { AudioContext, withAudioContext } from '../context/AudioContext';
7
8
  function AudioAnswer(audioAnswerProps) {
8
9
  const { element } = audioAnswerProps;
9
10
  const questionId = getNumericAttribute(element, 'question-id');
@@ -11,6 +12,7 @@ function AudioAnswer(audioAnswerProps) {
11
12
  const displayNumber = element.getAttribute('display-number');
12
13
  const dispatch = useDispatch();
13
14
  const { examServerApi } = useContext(ExamContext);
15
+ const { bitRate, saveInterval } = useContext(AudioContext);
14
16
  return (React.createElement("div", { className: "audio-answer" },
15
17
  React.createElement("span", { className: "anchor", id: `question-nr-${displayNumber}` }),
16
18
  React.createElement(AudioRecorder, { audioUrl: (answer === null || answer === void 0 ? void 0 : answer.value) === '' ? undefined : answer === null || answer === void 0 ? void 0 : answer.value, onSave: audio => {
@@ -28,7 +30,10 @@ function AudioAnswer(audioAnswerProps) {
28
30
  const answerObj = { questionId, type: 'audio', value: '' };
29
31
  dispatch(saveAnswer(answerObj));
30
32
  })();
31
- }, audioRecorderOptions: { audioBitsPerSecond: 65536, saveIntervalMs: 1000 } })));
33
+ }, audioRecorderOptions: {
34
+ audioBitsPerSecond: bitRate !== null && bitRate !== void 0 ? bitRate : 65536,
35
+ saveIntervalMs: saveInterval
36
+ } })));
32
37
  }
33
- export default React.memo(AudioAnswer);
38
+ export default React.memo(withAudioContext(AudioAnswer));
34
39
  //# sourceMappingURL=AudioAnswer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AudioAnswer.js","sourceRoot":"","sources":["../../../src/components/exam/AudioAnswer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAGpD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAExD,SAAS,WAAW,CA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