@linktr.ee/messaging-react 1.10.0 → 1.11.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.
- package/dist/index.d.ts +12 -0
- package/dist/index.js +297 -287
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ChannelView.tsx +2 -1
- package/src/components/CustomSystemMessage/index.tsx +16 -0
- package/src/components/FaqList/index.tsx +1 -2
- package/src/stream-custom-data.ts +28 -0
- package/src/types.ts +2 -0
package/package.json
CHANGED
|
@@ -23,6 +23,7 @@ import ActionButton from './ActionButton'
|
|
|
23
23
|
import { Avatar } from './Avatar'
|
|
24
24
|
import { CloseButton } from './CloseButton'
|
|
25
25
|
import { CustomMessageInput } from './CustomMessageInput'
|
|
26
|
+
import { CustomSystemMessage } from './CustomSystemMessage'
|
|
26
27
|
import { ChannelEmptyState } from './MessagingShell/ChannelEmptyState'
|
|
27
28
|
|
|
28
29
|
// Custom user type with email and username
|
|
@@ -529,7 +530,7 @@ export const ChannelView: React.FC<ChannelViewProps> = ({
|
|
|
529
530
|
className
|
|
530
531
|
)}
|
|
531
532
|
>
|
|
532
|
-
<Channel channel={channel}>
|
|
533
|
+
<Channel channel={channel} MessageSystem={CustomSystemMessage}>
|
|
533
534
|
<ChannelViewInner
|
|
534
535
|
onBack={onBack}
|
|
535
536
|
showBackButton={showBackButton}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MessageTimestamp, type EventComponentProps } from 'stream-chat-react'
|
|
2
|
+
|
|
3
|
+
export const CustomSystemMessage: React.FC<EventComponentProps> = (props) => {
|
|
4
|
+
const isDateHidden = props.message.hide_date === true
|
|
5
|
+
|
|
6
|
+
return (
|
|
7
|
+
<div className="str-chat__message--system" data-testid="message-system">
|
|
8
|
+
<div className="str-chat__message--system__text">
|
|
9
|
+
<div className="str-chat__message--system__line"></div>
|
|
10
|
+
<p>{props.message.text}</p>
|
|
11
|
+
<div className="str-chat__message--system__line"></div>
|
|
12
|
+
</div>
|
|
13
|
+
{!isDateHidden && <MessageTimestamp message={props.message} />}
|
|
14
|
+
</div>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import classNames from 'classnames'
|
|
2
1
|
import React from 'react'
|
|
3
2
|
|
|
4
3
|
import { Avatar } from '../Avatar'
|
|
@@ -41,7 +40,7 @@ export const FaqList: React.FC<FaqListProps> = ({
|
|
|
41
40
|
}
|
|
42
41
|
|
|
43
42
|
return (
|
|
44
|
-
<div className={
|
|
43
|
+
<div className={className}>
|
|
45
44
|
<div className="flex gap-3 items-end">
|
|
46
45
|
{/* Avatar at bottom-left, outside grey background */}
|
|
47
46
|
{(avatarImage || avatarName) && (
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stream Chat custom data type augmentation.
|
|
3
|
+
*
|
|
4
|
+
* This file extends Stream Chat's type system by augmenting their empty
|
|
5
|
+
* CustomMessageData interface with our custom properties.
|
|
6
|
+
*
|
|
7
|
+
* @see https://getstream.io/chat/docs/sdk/react/guides/typescript_and_custom_data_types/
|
|
8
|
+
*
|
|
9
|
+
* Note: We use a .ts extension instead of .d.ts so that this file can be
|
|
10
|
+
* imported as a module and included in the build. Declaration files (.d.ts)
|
|
11
|
+
* are ambient and cannot be imported - they require manual build configuration
|
|
12
|
+
* to be included in the distributed types.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import 'stream-chat'
|
|
16
|
+
|
|
17
|
+
declare module 'stream-chat' {
|
|
18
|
+
interface CustomMessageData {
|
|
19
|
+
/**
|
|
20
|
+
* When true, hides the date timestamp in system messages.
|
|
21
|
+
* Used by CustomSystemMessage component.
|
|
22
|
+
*/
|
|
23
|
+
hide_date?: boolean
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Required to make this a module (enables the module augmentation above)
|
|
28
|
+
export {}
|
package/src/types.ts
CHANGED