dmed-voice-assistant 1.2.13 → 1.2.15
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/components/RecordListItem.js +4 -1
- package/dist/index.js +4 -2
- package/dist/recorder.js +17 -16
- package/package.json +1 -1
@@ -60,7 +60,7 @@ const RecordListItem = _ref => {
|
|
60
60
|
const openAnchorEl = Boolean(anchorEl);
|
61
61
|
const [isPlaying, setIsPlaying] = (0, _react.useState)(false);
|
62
62
|
const [isEditing, setIsEditing] = (0, _react.useState)(false);
|
63
|
-
const [newLabel, setNewLabel] = (0, _react.useState)(
|
63
|
+
const [newLabel, setNewLabel] = (0, _react.useState)("");
|
64
64
|
const handlePopoverOpen = event => {
|
65
65
|
setAnchorEl(event.currentTarget);
|
66
66
|
};
|
@@ -111,6 +111,9 @@ const RecordListItem = _ref => {
|
|
111
111
|
}
|
112
112
|
handlePopoverClose();
|
113
113
|
};
|
114
|
+
(0, _react.useEffect)(() => {
|
115
|
+
setNewLabel(label);
|
116
|
+
}, [label]);
|
114
117
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
115
118
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
116
119
|
className: "flex items-center justify-between",
|
package/dist/index.js
CHANGED
@@ -23,7 +23,8 @@ const VoiceAssistant = _ref => {
|
|
23
23
|
recognitionListValue = [],
|
24
24
|
recordStyle = {},
|
25
25
|
onNewRecordEvent,
|
26
|
-
|
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
|
-
|
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
|
-
|
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,21 @@ 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
|
-
setRecordList(
|
154
|
+
// setRecordList((prevList) => prevList.filter((record) => record.union_id !== id));
|
155
|
+
|
156
|
+
if (onRecordDeleteEvent) {
|
157
|
+
onRecordDeleteEvent({
|
158
|
+
id: id
|
159
|
+
});
|
160
|
+
}
|
160
161
|
};
|
161
162
|
const startCounting = () => {
|
162
163
|
if (isRunning) return; // Prevent starting a new interval if already running
|
@@ -198,7 +199,7 @@ const RecorderBox = _ref => {
|
|
198
199
|
fetchAudioInputDevices();
|
199
200
|
}, []);
|
200
201
|
(0, _react.useEffect)(() => {
|
201
|
-
setRecordList(recordHistoryList);
|
202
|
+
setRecordList([...recordHistoryList]);
|
202
203
|
}, [recordHistoryList]);
|
203
204
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
204
205
|
className: "bg-[#0B0B0B] rounded-[5px] border p-[20px] w-[850px]",
|
@@ -590,7 +591,7 @@ const RecorderBox = _ref => {
|
|
590
591
|
time: parseInt(record.voice_duration),
|
591
592
|
createdDate: record.date,
|
592
593
|
onLabelChange: newLabel => handleLabelChange(index, newLabel),
|
593
|
-
onDelete: () => handleDelete(
|
594
|
+
onDelete: () => handleDelete(record.union_id)
|
594
595
|
}, index);
|
595
596
|
})
|
596
597
|
})]
|