movius-chats 1.3.13 → 1.4.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 (32) hide show
  1. package/lib/commonjs/index.js +5 -3
  2. package/lib/commonjs/index.js.map +1 -1
  3. package/lib/module/index.js +5 -3
  4. package/lib/module/index.js.map +1 -1
  5. package/lib/typescript/assets/Icons/ChevronUpIcon.d.ts +5 -0
  6. package/lib/typescript/assets/Icons/LockIcon.d.ts +5 -0
  7. package/lib/typescript/assets/Icons/TrashIcon.d.ts +5 -0
  8. package/lib/typescript/components/AudioPlayer/types.d.ts +1 -0
  9. package/lib/typescript/components/ChatInput/types.d.ts +2 -2
  10. package/lib/typescript/components/VoiceRecorder/LongPressRecording.d.ts +13 -0
  11. package/lib/typescript/components/VoiceRecorder/NormalRecording.d.ts +20 -0
  12. package/lib/typescript/components/VoiceRecorder/WaveformAnimation.d.ts +10 -0
  13. package/lib/typescript/hooks/useVoiceRecorder.d.ts +19 -0
  14. package/lib/typescript/types/index.d.ts +74 -1
  15. package/package.json +12 -2
  16. package/scripts/patchSound.js +48 -23
  17. package/src/assets/Icons/ChevronUpIcon.tsx +20 -0
  18. package/src/assets/Icons/LockIcon.tsx +28 -0
  19. package/src/assets/Icons/TrashIcon.tsx +26 -0
  20. package/src/components/AudioPlayer/AudioPlayer.tsx +147 -163
  21. package/src/components/AudioPlayer/types.ts +1 -0
  22. package/src/components/ChatBubble/MediaGrid.tsx +4 -1
  23. package/src/components/ChatBubble/MessageContent.tsx +1 -0
  24. package/src/components/ChatInput/ChatInput.tsx +296 -62
  25. package/src/components/ChatInput/FilePreview.tsx +3 -0
  26. package/src/components/ChatInput/types.ts +2 -2
  27. package/src/components/MediaViewer/MediaViewer.tsx +45 -10
  28. package/src/components/VoiceRecorder/LongPressRecording.tsx +195 -0
  29. package/src/components/VoiceRecorder/NormalRecording.tsx +156 -0
  30. package/src/components/VoiceRecorder/WaveformAnimation.tsx +56 -0
  31. package/src/hooks/useVoiceRecorder.ts +206 -0
  32. package/src/types/index.ts +80 -1
@@ -1,5 +1,66 @@
1
1
  import { ImageStyle, TextStyle, ViewStyle } from 'react-native';
2
2
 
3
+ // ─── Voice recording ──────────────────────────────────────────────────────────
4
+
5
+ /** Returned by the recorder when a recording successfully completes. */
6
+ export interface RecordingResult {
7
+ uri: string;
8
+ duration: number;
9
+ size?: number;
10
+ mimeType?: string;
11
+ }
12
+
13
+ /** Passed to `renderVoiceRecorder` so a custom UI has full control. */
14
+ export interface VoiceRecorderExposedState {
15
+ isRecording: boolean;
16
+ isPaused: boolean;
17
+ duration: number;
18
+ isLocked: boolean;
19
+ slideOffset: { x: number; y: number };
20
+ waveformData: number[];
21
+ startRecording: () => void;
22
+ stopRecording: () => Promise<RecordingResult | null>;
23
+ pauseRecording: () => void;
24
+ resumeRecording: () => void;
25
+ cancelRecording: () => void;
26
+ }
27
+
28
+ /** Feature flags / limits for the built-in recorder. */
29
+ export interface VoiceRecorderConfig {
30
+ maxDuration?: number;
31
+ enableSlideToCancel?: boolean;
32
+ enableLockRecording?: boolean;
33
+ enableWaveform?: boolean;
34
+ autoSendOnRelease?: boolean;
35
+ enablePauseResume?: boolean;
36
+ recordingFormat?: string;
37
+ recordingQuality?: string;
38
+ animationDuration?: number;
39
+ }
40
+
41
+ /** Style overrides for each section of the recording UI. */
42
+ export interface VoiceRecorderStyleOverrides {
43
+ container?: ViewStyle;
44
+ timer?: TextStyle;
45
+ waveform?: ViewStyle;
46
+ micButton?: ViewStyle;
47
+ slideText?: TextStyle;
48
+ lockContainer?: ViewStyle;
49
+ trashButton?: ViewStyle;
50
+ }
51
+
52
+ /** Color / size tweaks for the default recording UI. */
53
+ export interface RecordingUIProps {
54
+ iconSize?: number;
55
+ recordingIconSize?: number;
56
+ sendIconSize?: number;
57
+ timerTextStyle?: TextStyle;
58
+ waveformColor?: string;
59
+ recordingBackground?: string;
60
+ cancelTextColor?: string;
61
+ micPulseColor?: string;
62
+ }
63
+
3
64
  /** Single image or video inside a message bubble (use `mediaItems` for albums). */
4
65
  export interface MessageMediaItem {
5
66
  uri: string;
@@ -41,11 +102,21 @@ export interface ChatScreenProps {
41
102
  onSendMessage: (message: Omit<Message, 'id' | 'time' | 'status'>) => void;
42
103
  onMessageLongPress?: (message: Message) => void;
43
104
  onAttachmentPress?: () => void;
44
- onAudioRecordEnd?: () => void;
105
+ onAudioRecordEnd?: (audio?: RecordingResult) => void;
45
106
  onAudioRecordStart?: () => void;
46
107
  onCameraPress?: () => void;
47
108
  onFileAttachmentPress?: (file: MessageFileAttachment) => void;
48
109
 
110
+ // ── Voice recorder ──────────────────────────────────────────────────────────
111
+ /** Replace the default recording UI with a fully custom component. */
112
+ renderVoiceRecorder?: (state: VoiceRecorderExposedState) => React.ReactNode;
113
+ /** Feature flags / limits for the built-in recorder. */
114
+ voiceRecorderProps?: VoiceRecorderConfig;
115
+ /** Style overrides for the built-in recording UI sections. */
116
+ voiceRecorderStyles?: VoiceRecorderStyleOverrides;
117
+ /** Color and size tweaks for the built-in recording UI. */
118
+ recordingUIProps?: RecordingUIProps;
119
+
49
120
  keyboardVerticalOffset?: number;
50
121
  disableKeyboardAvoiding?: boolean;
51
122
 
@@ -75,6 +146,14 @@ export interface ChatScreenProps {
75
146
  audioPlayIconColor?: string;
76
147
  audioPauseIconColor?: string;
77
148
  videoPlayIconColor?: string;
149
+ /** Inactive (unplayed) waveform bar color */
150
+ audioWaveformColor?: string;
151
+ /** Active (played) waveform bar color */
152
+ audioWaveformActiveColor?: string;
153
+ /** Playback-time text color for sent audio messages */
154
+ sentAudioTimestampColor?: string;
155
+ /** Playback-time text color for received audio messages */
156
+ receivedAudioTimestampColor?: string;
78
157
  inputTextColor?: string;
79
158
  sentIconColor?: string;
80
159
  deliveredIconColor?: string;