sceyt-chat-react-uikit 1.7.3 → 1.7.4-beta.1
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.
|
@@ -53,6 +53,7 @@ export interface IChatClientProps {
|
|
|
53
53
|
logLevel?: 'silent' | 'trace' | 'debug' | 'info' | 'warn' | 'error';
|
|
54
54
|
memberCount?: number;
|
|
55
55
|
disableFrowardMentionsCount?: boolean;
|
|
56
|
+
chatMinWidth?: string;
|
|
56
57
|
}
|
|
57
|
-
declare const SceytChatContainer: ({ client, theme, themeMode, avatarColors, children, showOnlyContactUsers, handleNewMessages, sendAttachmentsAsSeparateMessages, membersDisplayTextByChannelTypesMap, defaultRolesByChannelTypesMap, channelTypeFilter, logoSrc, CustomUploader, showNotifications, hideUserPresence, openChatOnUserInteraction, autoSelectFirstChannel, logLevel, memberCount, disableFrowardMentionsCount }: IChatClientProps) => React.JSX.Element;
|
|
58
|
+
declare const SceytChatContainer: ({ client, theme, themeMode, avatarColors, children, showOnlyContactUsers, handleNewMessages, sendAttachmentsAsSeparateMessages, membersDisplayTextByChannelTypesMap, defaultRolesByChannelTypesMap, channelTypeFilter, logoSrc, CustomUploader, showNotifications, hideUserPresence, openChatOnUserInteraction, autoSelectFirstChannel, logLevel, memberCount, disableFrowardMentionsCount, chatMinWidth }: IChatClientProps) => React.JSX.Element;
|
|
58
59
|
export default SceytChatContainer;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { IChatClientProps } from '../ChatContainer';
|
|
3
|
-
declare const SceytChat: ({ client, theme, themeMode, avatarColors, children, showOnlyContactUsers, logoSrc, CustomUploader, handleNewMessages, sendAttachmentsAsSeparateMessages, membersDisplayTextByChannelTypesMap, channelTypeFilter, defaultRolesByChannelTypesMap, hideUserPresence, showNotifications, openChatOnUserInteraction, autoSelectFirstChannel, memberCount, disableFrowardMentionsCount }: IChatClientProps) => React.JSX.Element;
|
|
3
|
+
declare const SceytChat: ({ client, theme, themeMode, avatarColors, children, showOnlyContactUsers, logoSrc, CustomUploader, handleNewMessages, sendAttachmentsAsSeparateMessages, membersDisplayTextByChannelTypesMap, channelTypeFilter, defaultRolesByChannelTypesMap, hideUserPresence, showNotifications, openChatOnUserInteraction, autoSelectFirstChannel, memberCount, disableFrowardMentionsCount, chatMinWidth }: IChatClientProps) => React.JSX.Element;
|
|
4
4
|
export default SceytChat;
|
|
5
5
|
export declare const Container: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -67,6 +67,7 @@ interface SendMessageProps {
|
|
|
67
67
|
textSelectionBackgroundColor?: string;
|
|
68
68
|
placeholderText?: string;
|
|
69
69
|
placeholderTextColor?: string;
|
|
70
|
+
audioRecordingMaxDuration?: number;
|
|
70
71
|
}
|
|
71
72
|
declare const SendMessageInput: React.FC<SendMessageProps>;
|
|
72
73
|
export default SendMessageInput;
|
package/index.js
CHANGED
|
@@ -20661,7 +20661,8 @@ var SceytChat = function SceytChat(_ref) {
|
|
|
20661
20661
|
autoSelectFirstChannel = _ref$autoSelectFirstC === void 0 ? false : _ref$autoSelectFirstC,
|
|
20662
20662
|
memberCount = _ref.memberCount,
|
|
20663
20663
|
_ref$disableFrowardMe = _ref.disableFrowardMentionsCount,
|
|
20664
|
-
disableFrowardMentionsCount = _ref$disableFrowardMe === void 0 ? false : _ref$disableFrowardMe
|
|
20664
|
+
disableFrowardMentionsCount = _ref$disableFrowardMe === void 0 ? false : _ref$disableFrowardMe,
|
|
20665
|
+
chatMinWidth = _ref.chatMinWidth;
|
|
20665
20666
|
var _useColor = useColors(),
|
|
20666
20667
|
backgroundColor = _useColor[THEME_COLORS.BACKGROUND],
|
|
20667
20668
|
highlightedBackground = _useColor[THEME_COLORS.HIGHLIGHTED_BACKGROUND];
|
|
@@ -20876,12 +20877,13 @@ var SceytChat = function SceytChat(_ref) {
|
|
|
20876
20877
|
withChannelsList: channelsListWidth && channelsListWidth > 0,
|
|
20877
20878
|
backgroundColor: backgroundColor,
|
|
20878
20879
|
highlightedBackground: highlightedBackground,
|
|
20879
|
-
id: 'sceyt_chat_container'
|
|
20880
|
+
id: 'sceyt_chat_container',
|
|
20881
|
+
chatMinWidth: chatMinWidth
|
|
20880
20882
|
}, children)) : '');
|
|
20881
20883
|
};
|
|
20882
20884
|
var Container = styled__default.div(_templateObject$2 || (_templateObject$2 = _taggedTemplateLiteralLoose(["\n display: flex;\n height: 100vh;\n"])));
|
|
20883
20885
|
var ChatContainer = styled__default.div(_templateObject2$2 || (_templateObject2$2 = _taggedTemplateLiteralLoose(["\n display: flex;\n height: 100%;\n max-height: 100vh;\n min-width: ", ";\n background-color: ", ";\n\n /* Global highlighted background styles */\n ::selection {\n background-color: ", ";\n }\n\n ::-moz-selection {\n background-color: ", ";\n }\n\n /* For text selection highlighting */\n *::selection {\n background-color: ", ";\n }\n\n *::-moz-selection {\n background-color: ", ";\n }\n"])), function (props) {
|
|
20884
|
-
return props.withChannelsList && '1200px';
|
|
20886
|
+
return props.withChannelsList && (props.chatMinWidth || '1200px');
|
|
20885
20887
|
}, function (props) {
|
|
20886
20888
|
return props.backgroundColor;
|
|
20887
20889
|
}, function (props) {
|
|
@@ -20916,7 +20918,8 @@ var SceytChatContainer = function SceytChatContainer(_ref) {
|
|
|
20916
20918
|
_ref$logLevel = _ref.logLevel,
|
|
20917
20919
|
logLevel = _ref$logLevel === void 0 ? 'silent' : _ref$logLevel,
|
|
20918
20920
|
memberCount = _ref.memberCount,
|
|
20919
|
-
disableFrowardMentionsCount = _ref.disableFrowardMentionsCount
|
|
20921
|
+
disableFrowardMentionsCount = _ref.disableFrowardMentionsCount,
|
|
20922
|
+
chatMinWidth = _ref.chatMinWidth;
|
|
20920
20923
|
React.useEffect(function () {
|
|
20921
20924
|
log.setLevel(logLevel);
|
|
20922
20925
|
}, []);
|
|
@@ -20942,7 +20945,8 @@ var SceytChatContainer = function SceytChatContainer(_ref) {
|
|
|
20942
20945
|
autoSelectFirstChannel: autoSelectFirstChannel,
|
|
20943
20946
|
channelTypeFilter: channelTypeFilter,
|
|
20944
20947
|
memberCount: memberCount,
|
|
20945
|
-
disableFrowardMentionsCount: disableFrowardMentionsCount
|
|
20948
|
+
disableFrowardMentionsCount: disableFrowardMentionsCount,
|
|
20949
|
+
chatMinWidth: chatMinWidth
|
|
20946
20950
|
}));
|
|
20947
20951
|
};
|
|
20948
20952
|
|
|
@@ -31609,7 +31613,7 @@ var MessageStatusAndTimeContainer = styled__default.span(_templateObject3$o || (
|
|
|
31609
31613
|
}, function (props) {
|
|
31610
31614
|
return props.bottomOfMessage && props.rtlDirection && 'flex-end';
|
|
31611
31615
|
}, HiddenMessageTime, function (props) {
|
|
31612
|
-
return props.withAttachment ? props.messageTimeColorOnAttachment : '';
|
|
31616
|
+
return props.withAttachment && !props.fileAttachment ? props.messageTimeColorOnAttachment : '';
|
|
31613
31617
|
}, function (props) {
|
|
31614
31618
|
return props.withAttachment && "\n position: absolute;\n z-index: 10;\n right: " + (props.fileAttachment ? '6px' : '10px') + ";\n bottom: " + (props.fileAttachment ? '9px' : '14px') + ";\n ";
|
|
31615
31619
|
});
|
|
@@ -32288,13 +32292,13 @@ var MessageBody = function MessageBody(_ref) {
|
|
|
32288
32292
|
messageTimeVisible: !!messageTimeVisible,
|
|
32289
32293
|
messageStatusVisible: !!messageStatusVisible,
|
|
32290
32294
|
leftMargin: true,
|
|
32291
|
-
messageTimeColorOnAttachment: messageTimeColorOnAttachment ||
|
|
32295
|
+
messageTimeColorOnAttachment: messageTimeColorOnAttachment || textSecondary
|
|
32292
32296
|
})) : null), notLinkAttachment && messageStatusAndTimePosition === 'onMessage' && (messageStatusVisible || messageTimeVisible) && (/*#__PURE__*/React__default.createElement(MessageStatusAndTime$1, {
|
|
32293
32297
|
message: message,
|
|
32294
32298
|
showMessageTimeAndStatusOnlyOnHover: showMessageTimeAndStatusOnlyOnHover,
|
|
32295
32299
|
messageStatusDisplayingType: messageStatusDisplayingType,
|
|
32296
32300
|
messageStatusSize: messageStatusSize,
|
|
32297
|
-
messageStatusColor: message.attachments[0].type
|
|
32301
|
+
messageStatusColor: message.attachments[0].type === 'voice' ? textSecondary : message.attachments[0].type === 'image' || message.attachments[0].type === 'video' ? textOnPrimary : messageStateColor || textSecondary,
|
|
32298
32302
|
messageReadStatusColor: messageReadStatusColor,
|
|
32299
32303
|
messageStateFontSize: messageStateFontSize,
|
|
32300
32304
|
messageStateColor: messageStateColor,
|
|
@@ -32306,7 +32310,7 @@ var MessageBody = function MessageBody(_ref) {
|
|
|
32306
32310
|
withAttachment: withAttachments,
|
|
32307
32311
|
leftMargin: true,
|
|
32308
32312
|
fileAttachment: withAttachments && (message.attachments[0].type === 'file' || message.attachments[0].type === 'voice'),
|
|
32309
|
-
messageTimeColorOnAttachment:
|
|
32313
|
+
messageTimeColorOnAttachment: message.attachments[0].type === 'voice' ? textSecondary : message.attachments[0].type === 'image' || message.attachments[0].type === 'video' ? textOnPrimary : textSecondary
|
|
32310
32314
|
})), withAttachments && message.attachments.map(function (attachment) {
|
|
32311
32315
|
return /*#__PURE__*/React__default.createElement(Attachment$1, {
|
|
32312
32316
|
key: attachment.tid || attachment.url,
|
|
@@ -36752,11 +36756,14 @@ function SvgRecordButton(props) {
|
|
|
36752
36756
|
|
|
36753
36757
|
var _templateObject$I, _templateObject2$D, _templateObject3$w, _templateObject4$s, _templateObject5$o, _templateObject6$k, _templateObject7$i;
|
|
36754
36758
|
var shouldDraw = false;
|
|
36759
|
+
var DEFAULT_MAX_RECORDING_DURATION = 600;
|
|
36755
36760
|
var AudioRecord = function AudioRecord(_ref) {
|
|
36756
36761
|
var sendRecordedFile = _ref.sendRecordedFile,
|
|
36757
36762
|
setShowRecording = _ref.setShowRecording,
|
|
36758
36763
|
showRecording = _ref.showRecording,
|
|
36759
|
-
channelId = _ref.channelId
|
|
36764
|
+
channelId = _ref.channelId,
|
|
36765
|
+
_ref$maxRecordingDura = _ref.maxRecordingDuration,
|
|
36766
|
+
maxRecordingDuration = _ref$maxRecordingDura === void 0 ? DEFAULT_MAX_RECORDING_DURATION : _ref$maxRecordingDura;
|
|
36760
36767
|
var _useColor = useColors(),
|
|
36761
36768
|
accentColor = _useColor[THEME_COLORS.ACCENT],
|
|
36762
36769
|
textSecondary = _useColor[THEME_COLORS.TEXT_SECONDARY],
|
|
@@ -37111,12 +37118,13 @@ var AudioRecord = function AudioRecord(_ref) {
|
|
|
37111
37118
|
}
|
|
37112
37119
|
setStartRecording(false);
|
|
37113
37120
|
var objectUrl = URL.createObjectURL(blob);
|
|
37121
|
+
var durationInt = Math.round(audioBuffer.duration);
|
|
37114
37122
|
if (send) {
|
|
37115
37123
|
sendRecordedFile({
|
|
37116
37124
|
file: file,
|
|
37117
37125
|
objectUrl: objectUrl,
|
|
37118
37126
|
thumb: waveform,
|
|
37119
|
-
dur:
|
|
37127
|
+
dur: durationInt
|
|
37120
37128
|
}, id);
|
|
37121
37129
|
setShowRecording(false);
|
|
37122
37130
|
removeAudioRecordingFromMap(id);
|
|
@@ -37127,14 +37135,14 @@ var AudioRecord = function AudioRecord(_ref) {
|
|
|
37127
37135
|
file: file,
|
|
37128
37136
|
objectUrl: objectUrl,
|
|
37129
37137
|
thumb: waveform,
|
|
37130
|
-
dur:
|
|
37138
|
+
dur: durationInt
|
|
37131
37139
|
});
|
|
37132
37140
|
}
|
|
37133
37141
|
var audioRecording = {
|
|
37134
37142
|
file: file,
|
|
37135
37143
|
objectUrl: objectUrl,
|
|
37136
37144
|
thumb: waveform,
|
|
37137
|
-
dur:
|
|
37145
|
+
dur: durationInt
|
|
37138
37146
|
};
|
|
37139
37147
|
setAudioRecordingToMap(id, audioRecording);
|
|
37140
37148
|
if (draft) {
|
|
@@ -37167,29 +37175,39 @@ var AudioRecord = function AudioRecord(_ref) {
|
|
|
37167
37175
|
}
|
|
37168
37176
|
};
|
|
37169
37177
|
React.useEffect(function () {
|
|
37170
|
-
var MAX_RECORDER_TIME = 1800;
|
|
37171
37178
|
var recordingInterval = null;
|
|
37179
|
+
var backupTimeout = null;
|
|
37172
37180
|
if (recording) {
|
|
37173
|
-
setTimeout(function () {
|
|
37174
|
-
|
|
37175
|
-
|
|
37176
|
-
|
|
37177
|
-
|
|
37178
|
-
|
|
37179
|
-
|
|
37180
|
-
|
|
37181
|
-
|
|
37182
|
-
|
|
37183
|
-
|
|
37184
|
-
|
|
37185
|
-
|
|
37181
|
+
backupTimeout = setTimeout(function () {
|
|
37182
|
+
stopRecording(false, currentChannelId, false, recorder);
|
|
37183
|
+
}, (maxRecordingDuration + 0.5) * 1000);
|
|
37184
|
+
recordingInterval = setInterval(function () {
|
|
37185
|
+
setCurrentTime(function (prevState) {
|
|
37186
|
+
if (prevState >= maxRecordingDuration) {
|
|
37187
|
+
clearInterval(recordingInterval);
|
|
37188
|
+
clearTimeout(backupTimeout);
|
|
37189
|
+
stopRecording(false, currentChannelId, false, recorder);
|
|
37190
|
+
return 0;
|
|
37191
|
+
}
|
|
37192
|
+
return prevState + 1;
|
|
37193
|
+
});
|
|
37194
|
+
}, 1000);
|
|
37195
|
+
} else {
|
|
37196
|
+
clearInterval(recordingInterval);
|
|
37197
|
+
clearTimeout(backupTimeout);
|
|
37198
|
+
}
|
|
37186
37199
|
return function () {
|
|
37187
37200
|
if (sendingInterval) {
|
|
37188
37201
|
clearInterval(sendingInterval);
|
|
37189
37202
|
}
|
|
37190
|
-
|
|
37203
|
+
if (recordingInterval) {
|
|
37204
|
+
clearInterval(recordingInterval);
|
|
37205
|
+
}
|
|
37206
|
+
if (backupTimeout) {
|
|
37207
|
+
clearTimeout(backupTimeout);
|
|
37208
|
+
}
|
|
37191
37209
|
};
|
|
37192
|
-
}, [recording]);
|
|
37210
|
+
}, [recording, maxRecordingDuration]);
|
|
37193
37211
|
React.useEffect(function () {
|
|
37194
37212
|
if (currentRecordedFile) {
|
|
37195
37213
|
_initWaveSurfer();
|
|
@@ -37518,7 +37536,8 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
37518
37536
|
_ref3$voiceMessage = _ref3.voiceMessage,
|
|
37519
37537
|
voiceMessage = _ref3$voiceMessage === void 0 ? true : _ref3$voiceMessage,
|
|
37520
37538
|
placeholderText = _ref3.placeholderText,
|
|
37521
|
-
placeholderTextColor = _ref3.placeholderTextColor
|
|
37539
|
+
placeholderTextColor = _ref3.placeholderTextColor,
|
|
37540
|
+
audioRecordingMaxDuration = _ref3.audioRecordingMaxDuration;
|
|
37522
37541
|
var _useColor = useColors(),
|
|
37523
37542
|
accentColor = _useColor[THEME_COLORS.ACCENT],
|
|
37524
37543
|
backgroundSections = _useColor[THEME_COLORS.BACKGROUND_SECTIONS],
|
|
@@ -38417,10 +38436,10 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
38417
38436
|
upload: true,
|
|
38418
38437
|
size: recordedFile.file.size,
|
|
38419
38438
|
attachmentUrl: recordedFile.objectUrl,
|
|
38420
|
-
metadata: {
|
|
38439
|
+
metadata: JSON.stringify({
|
|
38421
38440
|
tmb: recordedFile.thumb,
|
|
38422
38441
|
dur: recordedFile.dur
|
|
38423
|
-
},
|
|
38442
|
+
}),
|
|
38424
38443
|
type: attachmentTypes.voice
|
|
38425
38444
|
}],
|
|
38426
38445
|
type: 'text'
|
|
@@ -38969,7 +38988,8 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
38969
38988
|
sendRecordedFile: sendRecordedFile,
|
|
38970
38989
|
setShowRecording: setShowRecording,
|
|
38971
38990
|
showRecording: showRecording,
|
|
38972
|
-
channelId: activeChannel.id
|
|
38991
|
+
channelId: activeChannel.id,
|
|
38992
|
+
maxRecordingDuration: audioRecordingMaxDuration
|
|
38973
38993
|
}))))))))));
|
|
38974
38994
|
};
|
|
38975
38995
|
var SendMessageWrapper = styled__default.div(_templateObject$K || (_templateObject$K = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n position: relative;\n z-index: 15;\n"])), function (props) {
|
package/index.modern.js
CHANGED
|
@@ -20659,7 +20659,8 @@ var SceytChat = function SceytChat(_ref) {
|
|
|
20659
20659
|
autoSelectFirstChannel = _ref$autoSelectFirstC === void 0 ? false : _ref$autoSelectFirstC,
|
|
20660
20660
|
memberCount = _ref.memberCount,
|
|
20661
20661
|
_ref$disableFrowardMe = _ref.disableFrowardMentionsCount,
|
|
20662
|
-
disableFrowardMentionsCount = _ref$disableFrowardMe === void 0 ? false : _ref$disableFrowardMe
|
|
20662
|
+
disableFrowardMentionsCount = _ref$disableFrowardMe === void 0 ? false : _ref$disableFrowardMe,
|
|
20663
|
+
chatMinWidth = _ref.chatMinWidth;
|
|
20663
20664
|
var _useColor = useColors(),
|
|
20664
20665
|
backgroundColor = _useColor[THEME_COLORS.BACKGROUND],
|
|
20665
20666
|
highlightedBackground = _useColor[THEME_COLORS.HIGHLIGHTED_BACKGROUND];
|
|
@@ -20874,12 +20875,13 @@ var SceytChat = function SceytChat(_ref) {
|
|
|
20874
20875
|
withChannelsList: channelsListWidth && channelsListWidth > 0,
|
|
20875
20876
|
backgroundColor: backgroundColor,
|
|
20876
20877
|
highlightedBackground: highlightedBackground,
|
|
20877
|
-
id: 'sceyt_chat_container'
|
|
20878
|
+
id: 'sceyt_chat_container',
|
|
20879
|
+
chatMinWidth: chatMinWidth
|
|
20878
20880
|
}, children)) : '');
|
|
20879
20881
|
};
|
|
20880
20882
|
var Container = styled.div(_templateObject$2 || (_templateObject$2 = _taggedTemplateLiteralLoose(["\n display: flex;\n height: 100vh;\n"])));
|
|
20881
20883
|
var ChatContainer = styled.div(_templateObject2$2 || (_templateObject2$2 = _taggedTemplateLiteralLoose(["\n display: flex;\n height: 100%;\n max-height: 100vh;\n min-width: ", ";\n background-color: ", ";\n\n /* Global highlighted background styles */\n ::selection {\n background-color: ", ";\n }\n\n ::-moz-selection {\n background-color: ", ";\n }\n\n /* For text selection highlighting */\n *::selection {\n background-color: ", ";\n }\n\n *::-moz-selection {\n background-color: ", ";\n }\n"])), function (props) {
|
|
20882
|
-
return props.withChannelsList && '1200px';
|
|
20884
|
+
return props.withChannelsList && (props.chatMinWidth || '1200px');
|
|
20883
20885
|
}, function (props) {
|
|
20884
20886
|
return props.backgroundColor;
|
|
20885
20887
|
}, function (props) {
|
|
@@ -20914,7 +20916,8 @@ var SceytChatContainer = function SceytChatContainer(_ref) {
|
|
|
20914
20916
|
_ref$logLevel = _ref.logLevel,
|
|
20915
20917
|
logLevel = _ref$logLevel === void 0 ? 'silent' : _ref$logLevel,
|
|
20916
20918
|
memberCount = _ref.memberCount,
|
|
20917
|
-
disableFrowardMentionsCount = _ref.disableFrowardMentionsCount
|
|
20919
|
+
disableFrowardMentionsCount = _ref.disableFrowardMentionsCount,
|
|
20920
|
+
chatMinWidth = _ref.chatMinWidth;
|
|
20918
20921
|
useEffect(function () {
|
|
20919
20922
|
log.setLevel(logLevel);
|
|
20920
20923
|
}, []);
|
|
@@ -20940,7 +20943,8 @@ var SceytChatContainer = function SceytChatContainer(_ref) {
|
|
|
20940
20943
|
autoSelectFirstChannel: autoSelectFirstChannel,
|
|
20941
20944
|
channelTypeFilter: channelTypeFilter,
|
|
20942
20945
|
memberCount: memberCount,
|
|
20943
|
-
disableFrowardMentionsCount: disableFrowardMentionsCount
|
|
20946
|
+
disableFrowardMentionsCount: disableFrowardMentionsCount,
|
|
20947
|
+
chatMinWidth: chatMinWidth
|
|
20944
20948
|
}));
|
|
20945
20949
|
};
|
|
20946
20950
|
|
|
@@ -31607,7 +31611,7 @@ var MessageStatusAndTimeContainer = styled.span(_templateObject3$o || (_template
|
|
|
31607
31611
|
}, function (props) {
|
|
31608
31612
|
return props.bottomOfMessage && props.rtlDirection && 'flex-end';
|
|
31609
31613
|
}, HiddenMessageTime, function (props) {
|
|
31610
|
-
return props.withAttachment ? props.messageTimeColorOnAttachment : '';
|
|
31614
|
+
return props.withAttachment && !props.fileAttachment ? props.messageTimeColorOnAttachment : '';
|
|
31611
31615
|
}, function (props) {
|
|
31612
31616
|
return props.withAttachment && "\n position: absolute;\n z-index: 10;\n right: " + (props.fileAttachment ? '6px' : '10px') + ";\n bottom: " + (props.fileAttachment ? '9px' : '14px') + ";\n ";
|
|
31613
31617
|
});
|
|
@@ -32286,13 +32290,13 @@ var MessageBody = function MessageBody(_ref) {
|
|
|
32286
32290
|
messageTimeVisible: !!messageTimeVisible,
|
|
32287
32291
|
messageStatusVisible: !!messageStatusVisible,
|
|
32288
32292
|
leftMargin: true,
|
|
32289
|
-
messageTimeColorOnAttachment: messageTimeColorOnAttachment ||
|
|
32293
|
+
messageTimeColorOnAttachment: messageTimeColorOnAttachment || textSecondary
|
|
32290
32294
|
})) : null), notLinkAttachment && messageStatusAndTimePosition === 'onMessage' && (messageStatusVisible || messageTimeVisible) && (/*#__PURE__*/React__default.createElement(MessageStatusAndTime$1, {
|
|
32291
32295
|
message: message,
|
|
32292
32296
|
showMessageTimeAndStatusOnlyOnHover: showMessageTimeAndStatusOnlyOnHover,
|
|
32293
32297
|
messageStatusDisplayingType: messageStatusDisplayingType,
|
|
32294
32298
|
messageStatusSize: messageStatusSize,
|
|
32295
|
-
messageStatusColor: message.attachments[0].type
|
|
32299
|
+
messageStatusColor: message.attachments[0].type === 'voice' ? textSecondary : message.attachments[0].type === 'image' || message.attachments[0].type === 'video' ? textOnPrimary : messageStateColor || textSecondary,
|
|
32296
32300
|
messageReadStatusColor: messageReadStatusColor,
|
|
32297
32301
|
messageStateFontSize: messageStateFontSize,
|
|
32298
32302
|
messageStateColor: messageStateColor,
|
|
@@ -32304,7 +32308,7 @@ var MessageBody = function MessageBody(_ref) {
|
|
|
32304
32308
|
withAttachment: withAttachments,
|
|
32305
32309
|
leftMargin: true,
|
|
32306
32310
|
fileAttachment: withAttachments && (message.attachments[0].type === 'file' || message.attachments[0].type === 'voice'),
|
|
32307
|
-
messageTimeColorOnAttachment:
|
|
32311
|
+
messageTimeColorOnAttachment: message.attachments[0].type === 'voice' ? textSecondary : message.attachments[0].type === 'image' || message.attachments[0].type === 'video' ? textOnPrimary : textSecondary
|
|
32308
32312
|
})), withAttachments && message.attachments.map(function (attachment) {
|
|
32309
32313
|
return /*#__PURE__*/React__default.createElement(Attachment$1, {
|
|
32310
32314
|
key: attachment.tid || attachment.url,
|
|
@@ -36750,11 +36754,14 @@ function SvgRecordButton(props) {
|
|
|
36750
36754
|
|
|
36751
36755
|
var _templateObject$I, _templateObject2$D, _templateObject3$w, _templateObject4$s, _templateObject5$o, _templateObject6$k, _templateObject7$i;
|
|
36752
36756
|
var shouldDraw = false;
|
|
36757
|
+
var DEFAULT_MAX_RECORDING_DURATION = 600;
|
|
36753
36758
|
var AudioRecord = function AudioRecord(_ref) {
|
|
36754
36759
|
var sendRecordedFile = _ref.sendRecordedFile,
|
|
36755
36760
|
setShowRecording = _ref.setShowRecording,
|
|
36756
36761
|
showRecording = _ref.showRecording,
|
|
36757
|
-
channelId = _ref.channelId
|
|
36762
|
+
channelId = _ref.channelId,
|
|
36763
|
+
_ref$maxRecordingDura = _ref.maxRecordingDuration,
|
|
36764
|
+
maxRecordingDuration = _ref$maxRecordingDura === void 0 ? DEFAULT_MAX_RECORDING_DURATION : _ref$maxRecordingDura;
|
|
36758
36765
|
var _useColor = useColors(),
|
|
36759
36766
|
accentColor = _useColor[THEME_COLORS.ACCENT],
|
|
36760
36767
|
textSecondary = _useColor[THEME_COLORS.TEXT_SECONDARY],
|
|
@@ -37109,12 +37116,13 @@ var AudioRecord = function AudioRecord(_ref) {
|
|
|
37109
37116
|
}
|
|
37110
37117
|
setStartRecording(false);
|
|
37111
37118
|
var objectUrl = URL.createObjectURL(blob);
|
|
37119
|
+
var durationInt = Math.round(audioBuffer.duration);
|
|
37112
37120
|
if (send) {
|
|
37113
37121
|
sendRecordedFile({
|
|
37114
37122
|
file: file,
|
|
37115
37123
|
objectUrl: objectUrl,
|
|
37116
37124
|
thumb: waveform,
|
|
37117
|
-
dur:
|
|
37125
|
+
dur: durationInt
|
|
37118
37126
|
}, id);
|
|
37119
37127
|
setShowRecording(false);
|
|
37120
37128
|
removeAudioRecordingFromMap(id);
|
|
@@ -37125,14 +37133,14 @@ var AudioRecord = function AudioRecord(_ref) {
|
|
|
37125
37133
|
file: file,
|
|
37126
37134
|
objectUrl: objectUrl,
|
|
37127
37135
|
thumb: waveform,
|
|
37128
|
-
dur:
|
|
37136
|
+
dur: durationInt
|
|
37129
37137
|
});
|
|
37130
37138
|
}
|
|
37131
37139
|
var audioRecording = {
|
|
37132
37140
|
file: file,
|
|
37133
37141
|
objectUrl: objectUrl,
|
|
37134
37142
|
thumb: waveform,
|
|
37135
|
-
dur:
|
|
37143
|
+
dur: durationInt
|
|
37136
37144
|
};
|
|
37137
37145
|
setAudioRecordingToMap(id, audioRecording);
|
|
37138
37146
|
if (draft) {
|
|
@@ -37165,29 +37173,39 @@ var AudioRecord = function AudioRecord(_ref) {
|
|
|
37165
37173
|
}
|
|
37166
37174
|
};
|
|
37167
37175
|
useEffect(function () {
|
|
37168
|
-
var MAX_RECORDER_TIME = 1800;
|
|
37169
37176
|
var recordingInterval = null;
|
|
37177
|
+
var backupTimeout = null;
|
|
37170
37178
|
if (recording) {
|
|
37171
|
-
setTimeout(function () {
|
|
37172
|
-
|
|
37173
|
-
|
|
37174
|
-
|
|
37175
|
-
|
|
37176
|
-
|
|
37177
|
-
|
|
37178
|
-
|
|
37179
|
-
|
|
37180
|
-
|
|
37181
|
-
|
|
37182
|
-
|
|
37183
|
-
|
|
37179
|
+
backupTimeout = setTimeout(function () {
|
|
37180
|
+
stopRecording(false, currentChannelId, false, recorder);
|
|
37181
|
+
}, (maxRecordingDuration + 0.5) * 1000);
|
|
37182
|
+
recordingInterval = setInterval(function () {
|
|
37183
|
+
setCurrentTime(function (prevState) {
|
|
37184
|
+
if (prevState >= maxRecordingDuration) {
|
|
37185
|
+
clearInterval(recordingInterval);
|
|
37186
|
+
clearTimeout(backupTimeout);
|
|
37187
|
+
stopRecording(false, currentChannelId, false, recorder);
|
|
37188
|
+
return 0;
|
|
37189
|
+
}
|
|
37190
|
+
return prevState + 1;
|
|
37191
|
+
});
|
|
37192
|
+
}, 1000);
|
|
37193
|
+
} else {
|
|
37194
|
+
clearInterval(recordingInterval);
|
|
37195
|
+
clearTimeout(backupTimeout);
|
|
37196
|
+
}
|
|
37184
37197
|
return function () {
|
|
37185
37198
|
if (sendingInterval) {
|
|
37186
37199
|
clearInterval(sendingInterval);
|
|
37187
37200
|
}
|
|
37188
|
-
|
|
37201
|
+
if (recordingInterval) {
|
|
37202
|
+
clearInterval(recordingInterval);
|
|
37203
|
+
}
|
|
37204
|
+
if (backupTimeout) {
|
|
37205
|
+
clearTimeout(backupTimeout);
|
|
37206
|
+
}
|
|
37189
37207
|
};
|
|
37190
|
-
}, [recording]);
|
|
37208
|
+
}, [recording, maxRecordingDuration]);
|
|
37191
37209
|
useEffect(function () {
|
|
37192
37210
|
if (currentRecordedFile) {
|
|
37193
37211
|
_initWaveSurfer();
|
|
@@ -37516,7 +37534,8 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
37516
37534
|
_ref3$voiceMessage = _ref3.voiceMessage,
|
|
37517
37535
|
voiceMessage = _ref3$voiceMessage === void 0 ? true : _ref3$voiceMessage,
|
|
37518
37536
|
placeholderText = _ref3.placeholderText,
|
|
37519
|
-
placeholderTextColor = _ref3.placeholderTextColor
|
|
37537
|
+
placeholderTextColor = _ref3.placeholderTextColor,
|
|
37538
|
+
audioRecordingMaxDuration = _ref3.audioRecordingMaxDuration;
|
|
37520
37539
|
var _useColor = useColors(),
|
|
37521
37540
|
accentColor = _useColor[THEME_COLORS.ACCENT],
|
|
37522
37541
|
backgroundSections = _useColor[THEME_COLORS.BACKGROUND_SECTIONS],
|
|
@@ -38415,10 +38434,10 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
38415
38434
|
upload: true,
|
|
38416
38435
|
size: recordedFile.file.size,
|
|
38417
38436
|
attachmentUrl: recordedFile.objectUrl,
|
|
38418
|
-
metadata: {
|
|
38437
|
+
metadata: JSON.stringify({
|
|
38419
38438
|
tmb: recordedFile.thumb,
|
|
38420
38439
|
dur: recordedFile.dur
|
|
38421
|
-
},
|
|
38440
|
+
}),
|
|
38422
38441
|
type: attachmentTypes.voice
|
|
38423
38442
|
}],
|
|
38424
38443
|
type: 'text'
|
|
@@ -38967,7 +38986,8 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
38967
38986
|
sendRecordedFile: sendRecordedFile,
|
|
38968
38987
|
setShowRecording: setShowRecording,
|
|
38969
38988
|
showRecording: showRecording,
|
|
38970
|
-
channelId: activeChannel.id
|
|
38989
|
+
channelId: activeChannel.id,
|
|
38990
|
+
maxRecordingDuration: audioRecordingMaxDuration
|
|
38971
38991
|
}))))))))));
|
|
38972
38992
|
};
|
|
38973
38993
|
var SendMessageWrapper = styled.div(_templateObject$K || (_templateObject$K = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n position: relative;\n z-index: 15;\n"])), function (props) {
|