@linktr.ee/messaging-react 3.6.2-rc-1783314663 → 3.6.2-rc-1783317817
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/{Card-CLfoYI1R.cjs → Card-BYdqLBN3.cjs} +2 -2
- package/dist/{Card-CLfoYI1R.cjs.map → Card-BYdqLBN3.cjs.map} +1 -1
- package/dist/{Card-Byosl29s.js → Card-CZDLISxS.js} +3 -3
- package/dist/{Card-Byosl29s.js.map → Card-CZDLISxS.js.map} +1 -1
- package/dist/{Card-ILtY9lfF.js → Card-Ca5OtJh6.js} +2 -2
- package/dist/{Card-ILtY9lfF.js.map → Card-Ca5OtJh6.js.map} +1 -1
- package/dist/{Card-CSkWY9mH.cjs → Card-DuSTf-S8.cjs} +2 -2
- package/dist/{Card-CSkWY9mH.cjs.map → Card-DuSTf-S8.cjs.map} +1 -1
- package/dist/{Card-CqEKHw9S.js → Card-gjy-ib_1.js} +2 -2
- package/dist/{Card-CqEKHw9S.js.map → Card-gjy-ib_1.js.map} +1 -1
- package/dist/{Card-UN0QRlxk.cjs → Card-iHrzL32q.cjs} +2 -2
- package/dist/{Card-UN0QRlxk.cjs.map → Card-iHrzL32q.cjs.map} +1 -1
- package/dist/{LockedThumbnail-BKI_6JUF.js → LockedThumbnail-COK5XPQ9.js} +2 -2
- package/dist/{LockedThumbnail-BKI_6JUF.js.map → LockedThumbnail-COK5XPQ9.js.map} +1 -1
- package/dist/{LockedThumbnail-DZ6C2xsr.cjs → LockedThumbnail-DrWiitE6.cjs} +2 -2
- package/dist/{LockedThumbnail-DZ6C2xsr.cjs.map → LockedThumbnail-DrWiitE6.cjs.map} +1 -1
- package/dist/{index-DPwo1avm.js → index-CnR5N9Co.js} +1155 -1154
- package/dist/index-CnR5N9Co.js.map +1 -0
- package/dist/index-pODWIZCi.cjs +2 -0
- package/dist/index-pODWIZCi.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/src/components/CustomMessage/CustomMessage.stories.tsx +3 -3
- package/src/components/CustomMessage/MessageDeliveryStatus.test.tsx +18 -12
- package/src/components/CustomMessage/MessageDeliveryStatus.tsx +23 -13
- package/src/components/CustomMessage/index.tsx +2 -1
- package/dist/index-DPwo1avm.js.map +0 -1
- package/dist/index-Q0FmgUJF.cjs +0 -2
- package/dist/index-Q0FmgUJF.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-pODWIZCi.cjs");exports.ActionButton=e.ActionButton;exports.Avatar=e.Avatar;exports.ChannelEmptyState=e.ChannelEmptyState;exports.ChannelList=e.ChannelList;exports.ChannelView=e.ChannelView;exports.CustomMessageProvider=e.CustomMessageProvider;exports.FaqList=e.FaqList;exports.FaqListItem=e.FaqListItem;exports.LinkAttachment=e.LinkAttachment;exports.LockedAttachment=e.LockedAttachment;exports.MediaMessage=e.MediaMessage;exports.MessageAttachment=e.MessageAttachment;exports.MessageVoteButtons=e.MessageVoteButtons;exports.MessagingProvider=e.MessagingProvider;exports.MessagingShell=e.MessagingShell;exports.buildCompactMetaLabel=e.buildCompactMetaLabel;exports.formatFileSize=e.formatFileSize;exports.formatRelativeTime=e.formatRelativeTime;exports.getFileExtensionLabel=e.getFileExtensionLabel;exports.getMessageDisplayText=e.getMessageDisplayText;exports.isLinkAttachment=e.isLinkAttachment;exports.isUuidLike=e.isUuidLike;exports.messageAttachmentGroupPositionFromStream=e.bubbleGroupPositionFromStream;exports.normalizeLanguageCode=e.normalizeLanguageCode;exports.resolveConversationParticipant=e.resolveConversationParticipant;exports.resolveLinkAttachment=e.resolveLinkAttachment;exports.resolveMediaFromMessage=e.resolveMediaFromMessage;exports.resolveParticipantDisplayName=e.resolveParticipantDisplayName;exports.useComposerLocked=e.useComposerLocked;exports.useCustomMessage=e.useCustomMessage;exports.useMessageVote=e.useMessageVote;exports.useMessaging=e.useMessaging;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as e, b as t, C as i, c as o, d as n, e as m, F as r, f as g, L as l, h as M, M as c, i as u, j as L, k as h, l as d, m as p, n as v, o as C, p as A, q as k, s as F, t as P, u as b, v as f, w as x, x as y, y as S, z as q, B as z, D as B, E as D, G as E } from "./index-
|
|
1
|
+
import { a as e, b as t, C as i, c as o, d as n, e as m, F as r, f as g, L as l, h as M, M as c, i as u, j as L, k as h, l as d, m as p, n as v, o as C, p as A, q as k, s as F, t as P, u as b, v as f, w as x, x as y, y as S, z as q, B as z, D as B, E as D, G as E } from "./index-CnR5N9Co.js";
|
|
2
2
|
export {
|
|
3
3
|
e as ActionButton,
|
|
4
4
|
t as Avatar,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linktr.ee/messaging-react",
|
|
3
|
-
"version": "3.6.2-rc-
|
|
3
|
+
"version": "3.6.2-rc-1783317817",
|
|
4
4
|
"description": "React messaging components built on messaging-core for web applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@linktr.ee/component-library": "11.8.6",
|
|
41
|
-
"@linktr.ee/messaging-core": "2.3.0-rc-
|
|
41
|
+
"@linktr.ee/messaging-core": "2.3.0-rc-1783317817",
|
|
42
42
|
"@phosphor-icons/react": "^2.1.10"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
@@ -228,9 +228,9 @@ Default.args = {
|
|
|
228
228
|
// MES-1036: "✓✓ Delivered" appears below the last bubble of *every* message
|
|
229
229
|
// group, on both the received (left) and sent (right) sides. Every mock
|
|
230
230
|
// message carries status: 'received'; the indicator is gated on stream's
|
|
231
|
-
// `
|
|
232
|
-
// "Hey there!" (received),
|
|
233
|
-
// run of two).
|
|
231
|
+
// per-message `groupStyles` ('bottom' | 'single'), so it shows once per
|
|
232
|
+
// consecutive same-author run — here below "Hey there!" (received),
|
|
233
|
+
// "Talk soon!" (sent run of two), and "See you then." (sent run of two).
|
|
234
234
|
export const DeliveredStatus: StoryFn<TemplateProps> = Template.bind({})
|
|
235
235
|
DeliveredStatus.args = {
|
|
236
236
|
messages: [
|
|
@@ -12,29 +12,35 @@ const receivedMessage = {
|
|
|
12
12
|
} as unknown as LocalMessage
|
|
13
13
|
|
|
14
14
|
const render = (
|
|
15
|
-
props: Partial<{ message: LocalMessage;
|
|
15
|
+
props: Partial<{ message: LocalMessage; groupStyles: string[] }> = {}
|
|
16
16
|
) =>
|
|
17
17
|
renderWithProviders(
|
|
18
18
|
<MessageDeliveryStatus
|
|
19
19
|
message={props.message ?? receivedMessage}
|
|
20
|
-
|
|
20
|
+
groupStyles={props.groupStyles ?? ['bottom']}
|
|
21
21
|
/>
|
|
22
22
|
)
|
|
23
23
|
|
|
24
24
|
describe('MessageDeliveryStatus', () => {
|
|
25
|
-
it('
|
|
26
|
-
|
|
25
|
+
it.each(['bottom', 'single'] as const)(
|
|
26
|
+
'renders "Delivered" at the end of a group (groupStyle: %s)',
|
|
27
|
+
(style) => {
|
|
28
|
+
render({ groupStyles: [style] })
|
|
27
29
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
expect(screen.getByTestId('message-delivery-status')).toHaveTextContent(
|
|
31
|
+
'Delivered'
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
)
|
|
32
35
|
|
|
33
|
-
it('
|
|
34
|
-
|
|
36
|
+
it.each(['top', 'middle'] as const)(
|
|
37
|
+
'renders nothing for a message that is not the end of its group (groupStyle: %s)',
|
|
38
|
+
(style) => {
|
|
39
|
+
const { container } = render({ groupStyles: [style] })
|
|
35
40
|
|
|
36
|
-
|
|
37
|
-
|
|
41
|
+
expect(container).toBeEmptyDOMElement()
|
|
42
|
+
}
|
|
43
|
+
)
|
|
38
44
|
|
|
39
45
|
it.each(['sending', 'failed'] as const)(
|
|
40
46
|
'renders nothing while the message status is %s',
|
|
@@ -4,30 +4,40 @@ import type { LocalMessage } from 'stream-chat'
|
|
|
4
4
|
interface MessageDeliveryStatusProps {
|
|
5
5
|
message: LocalMessage
|
|
6
6
|
/**
|
|
7
|
-
* stream's
|
|
8
|
-
*
|
|
7
|
+
* stream's per-message group-position styles (`'top' | 'middle' | 'bottom'
|
|
8
|
+
* | 'single'`). We key off this rather than the `endOfGroup` boolean:
|
|
9
|
+
* `endOfGroup` is only supplied by the *virtualized* MessageList, whereas
|
|
10
|
+
* the standard (non-virtualized) MessageList this package renders through
|
|
11
|
+
* passes `groupStyles` only. `getGroupStyles` accounts for author changes
|
|
12
|
+
* and time gaps, so it matches the visual grouping (incl. date breaks).
|
|
9
13
|
*/
|
|
10
|
-
|
|
14
|
+
groupStyles?: string[]
|
|
11
15
|
}
|
|
12
16
|
|
|
17
|
+
/** The last bubble of a group is 'bottom' (a run) or 'single' (standalone). */
|
|
18
|
+
const isEndOfGroup = (groupStyles?: string[]) =>
|
|
19
|
+
!!groupStyles &&
|
|
20
|
+
(groupStyles.includes('bottom') || groupStyles.includes('single'))
|
|
21
|
+
|
|
13
22
|
/**
|
|
14
23
|
* "✓✓ Delivered" status shown beneath the last bubble of every message group,
|
|
15
24
|
* on both the sent (right) and received (left) sides (MES-1036). The design
|
|
16
|
-
* displays the status per group rather than only on the most recent message
|
|
17
|
-
* so it's gated on `endOfGroup` rather than "last own message".
|
|
25
|
+
* displays the status per group rather than only on the most recent message.
|
|
18
26
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* (`status === 'received'`, true for incoming messages too) and never on
|
|
24
|
-
* errors. Left/right alignment comes from the outer grid (see `styles.css`).
|
|
27
|
+
* Renders only once a message is stored (`status === 'received'`, which
|
|
28
|
+
* `formatMessage` sets on every persisted message, incoming included) and
|
|
29
|
+
* never on errors. Left/right alignment comes from the outer grid (see
|
|
30
|
+
* `styles.css`).
|
|
25
31
|
*/
|
|
26
32
|
export const MessageDeliveryStatus = ({
|
|
27
33
|
message,
|
|
28
|
-
|
|
34
|
+
groupStyles,
|
|
29
35
|
}: MessageDeliveryStatusProps) => {
|
|
30
|
-
if (
|
|
36
|
+
if (
|
|
37
|
+
!isEndOfGroup(groupStyles) ||
|
|
38
|
+
message.type === 'error' ||
|
|
39
|
+
message.status !== 'received'
|
|
40
|
+
) {
|
|
31
41
|
return null
|
|
32
42
|
}
|
|
33
43
|
|
|
@@ -69,6 +69,7 @@ const CustomMessageWithContext = (props: CustomMessageWithContextProps) => {
|
|
|
69
69
|
endOfGroup,
|
|
70
70
|
firstOfGroup,
|
|
71
71
|
groupedByUser,
|
|
72
|
+
groupStyles,
|
|
72
73
|
handleAction,
|
|
73
74
|
handleOpenThread,
|
|
74
75
|
handleRetry,
|
|
@@ -398,7 +399,7 @@ const CustomMessageWithContext = (props: CustomMessageWithContextProps) => {
|
|
|
398
399
|
)}
|
|
399
400
|
</div>
|
|
400
401
|
)}
|
|
401
|
-
<MessageDeliveryStatus message={message}
|
|
402
|
+
<MessageDeliveryStatus message={message} groupStyles={groupStyles} />
|
|
402
403
|
{showReplyCountButton && (
|
|
403
404
|
<MessageRepliesCountButton
|
|
404
405
|
onClick={handleOpenThread}
|