dmed-voice-assistant 1.2.13 → 1.2.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -23,7 +23,8 @@ const VoiceAssistant = _ref => {
23
23
  recognitionListValue = [],
24
24
  recordStyle = {},
25
25
  onNewRecordEvent,
26
- onRecordDataChange,
26
+ onRecordLabelChangeEvent,
27
+ onRecordDeleteEvent,
27
28
  onNewRecognitionEvent,
28
29
  onRecognitionDataChange,
29
30
  onCloseRecognition,
@@ -42,7 +43,8 @@ const VoiceAssistant = _ref => {
42
43
  recordHistoryList: recordListValue,
43
44
  recordStyle: recordStyle,
44
45
  onNewRecordEvent: onNewRecordEvent,
45
- onRecordDataChange: onRecordDataChange
46
+ onRecordLabelChangeEvent: onRecordLabelChangeEvent,
47
+ onRecordDeleteEvent: onRecordDeleteEvent
46
48
  }), mode === 'recognition' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_recognition.default, {
47
49
  mode: mode,
48
50
  setMode: setMode,
package/dist/recorder.js CHANGED
@@ -51,7 +51,8 @@ const RecorderBox = _ref => {
51
51
  recordStyle,
52
52
  setMode,
53
53
  onNewRecordEvent,
54
- onRecordDataChange
54
+ onRecordLabelChangeEvent,
55
+ onRecordDeleteEvent
55
56
  } = _ref;
56
57
  const [isVoiceMode, setIsVoiceMode] = (0, _react.useState)(false);
57
58
  const [isStartedRecord, setIsStartedRecord] = (0, _react.useState)(false);
@@ -102,15 +103,6 @@ const RecorderBox = _ref => {
102
103
  let {
103
104
  blob
104
105
  } = _ref2;
105
- let temp = [...recordList];
106
- const newVoice = {
107
- voice_file: URL.createObjectURL(blob),
108
- file_name: newRecordFileName,
109
- voice_size: blob.size,
110
- voice_duration: await getAudioDuration(blob)
111
- };
112
- temp.push(newVoice);
113
- setRecordList(temp);
114
106
  if (onNewRecordEvent) {
115
107
  onNewRecordEvent({
116
108
  fileName: getVoiceFileName(new Date()),
@@ -119,9 +111,6 @@ const RecorderBox = _ref => {
119
111
  date: new Date()
120
112
  });
121
113
  }
122
- if (onRecordDataChange) {
123
- onRecordDataChange(temp);
124
- }
125
114
  });
126
115
  setIsStartedRecord(false);
127
116
  stopCounting();
@@ -154,9 +143,20 @@ const RecorderBox = _ref => {
154
143
  ...record,
155
144
  label: newLabel
156
145
  } : record));
146
+ if (onRecordLabelChangeEvent) {
147
+ onRecordLabelChangeEvent({
148
+ id: recordList[id].union_id,
149
+ newName: newLabel
150
+ });
151
+ }
157
152
  };
158
153
  const handleDelete = id => {
159
154
  setRecordList(prevRecords => prevRecords.filter((record, index) => index !== id));
155
+ if (onRecordDeleteEvent) {
156
+ onRecordDeleteEvent({
157
+ id: recordList[id].union_id
158
+ });
159
+ }
160
160
  };
161
161
  const startCounting = () => {
162
162
  if (isRunning) return; // Prevent starting a new interval if already running
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dmed-voice-assistant",
3
- "version": "1.2.13",
3
+ "version": "1.2.14",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist"