@linktr.ee/messaging-react 3.20.0 → 3.22.0-rc-1785413501
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-BOrp93Yo.cjs → Card-BiZLzRIQ.cjs} +2 -2
- package/dist/{Card-BOrp93Yo.cjs.map → Card-BiZLzRIQ.cjs.map} +1 -1
- package/dist/{Card-gNYP3vdJ.js → Card-G28kYBkV.js} +2 -2
- package/dist/{Card-gNYP3vdJ.js.map → Card-G28kYBkV.js.map} +1 -1
- package/dist/assets/index.css +1 -1
- package/dist/index-BnBvT5FW.cjs +2 -0
- package/dist/index-BnBvT5FW.cjs.map +1 -0
- package/dist/{index-BuqmY6ae.js → index-DIKyFjPC.js} +1373 -1309
- package/dist/index-DIKyFjPC.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.js +1 -1
- package/dist/testing.d.ts +2 -0
- package/package.json +2 -2
- package/src/components/ChannelView.tsx +6 -1
- package/src/components/CustomMessage/CustomMessage.stories.tsx +46 -1
- package/src/components/CustomMessage/CustomMessage.test.tsx +141 -0
- package/src/components/CustomMessage/SentMessageDeliveryStatus.test.tsx +122 -4
- package/src/components/CustomMessage/SentMessageDeliveryStatus.tsx +89 -7
- package/src/components/CustomMessage/index.tsx +5 -1
- package/src/components/MessagingShell/index.tsx +2 -0
- package/src/index.ts +1 -0
- package/src/stream-custom-data.ts +2 -0
- package/src/styles.css +86 -5
- package/src/types.ts +12 -0
- package/dist/index-BuqmY6ae.js.map +0 -1
- package/dist/index-DSZ8Rxnl.cjs +0 -2
- package/dist/index-DSZ8Rxnl.cjs.map +0 -1
|
@@ -54,11 +54,13 @@ import StreamAttachmentMessage, {
|
|
|
54
54
|
type CustomMessageUIComponentProps = MessageUIComponentProps & {
|
|
55
55
|
chatbotVotingEnabled?: boolean
|
|
56
56
|
viewerLanguage?: string
|
|
57
|
+
onBroadcastClick?: (broadcast: { id: string; name?: string }) => void
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
type CustomMessageWithContextProps = MessageContextValue & {
|
|
60
61
|
chatbotVotingEnabled?: boolean
|
|
61
62
|
viewerLanguage?: string
|
|
63
|
+
onBroadcastClick?: (broadcast: { id: string; name?: string }) => void
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
const CustomMessageWithContext = (props: CustomMessageWithContextProps) => {
|
|
@@ -79,6 +81,7 @@ const CustomMessageWithContext = (props: CustomMessageWithContextProps) => {
|
|
|
79
81
|
renderText,
|
|
80
82
|
threadList,
|
|
81
83
|
viewerLanguage,
|
|
84
|
+
onBroadcastClick,
|
|
82
85
|
} = props
|
|
83
86
|
|
|
84
87
|
const { client } = useChatContext('CustomMessage')
|
|
@@ -423,7 +426,7 @@ const CustomMessageWithContext = (props: CustomMessageWithContextProps) => {
|
|
|
423
426
|
)}
|
|
424
427
|
</div>
|
|
425
428
|
)}
|
|
426
|
-
<SentMessageDeliveryStatus />
|
|
429
|
+
<SentMessageDeliveryStatus onBroadcastClick={onBroadcastClick} />
|
|
427
430
|
{showReplyCountButton && (
|
|
428
431
|
<MessageRepliesCountButton
|
|
429
432
|
onClick={handleOpenThread}
|
|
@@ -443,6 +446,7 @@ const MemoizedCustomMessage = React.memo(
|
|
|
443
446
|
(prev, next) => {
|
|
444
447
|
if (prev.chatbotVotingEnabled !== next.chatbotVotingEnabled) return false
|
|
445
448
|
if (prev.viewerLanguage !== next.viewerLanguage) return false
|
|
449
|
+
if (prev.onBroadcastClick !== next.onBroadcastClick) return false
|
|
446
450
|
return areMessageUIPropsEqual(prev, next)
|
|
447
451
|
}
|
|
448
452
|
) as typeof CustomMessageWithContext
|
|
@@ -38,6 +38,7 @@ export const MessagingShell: React.FC<MessagingShellProps> = ({
|
|
|
38
38
|
customChannelActions,
|
|
39
39
|
renderChannelActions,
|
|
40
40
|
onParticipantNameClick,
|
|
41
|
+
onBroadcastClick,
|
|
41
42
|
renderMessage,
|
|
42
43
|
onMessageLinkClick,
|
|
43
44
|
showChannelInfo,
|
|
@@ -263,6 +264,7 @@ export const MessagingShell: React.FC<MessagingShellProps> = ({
|
|
|
263
264
|
customChannelActions={customChannelActions}
|
|
264
265
|
renderChannelActions={renderChannelActions}
|
|
265
266
|
onParticipantNameClick={onParticipantNameClick}
|
|
267
|
+
onBroadcastClick={onBroadcastClick}
|
|
266
268
|
renderMessage={renderMessage}
|
|
267
269
|
onMessageLinkClick={onMessageLinkClick}
|
|
268
270
|
showChannelInfo={showChannelInfo}
|
package/src/index.ts
CHANGED
package/src/styles.css
CHANGED
|
@@ -480,6 +480,18 @@
|
|
|
480
480
|
position: relative;
|
|
481
481
|
}
|
|
482
482
|
|
|
483
|
+
.sent-message-broadcast-link {
|
|
484
|
+
display: inline-flex;
|
|
485
|
+
align-items: center;
|
|
486
|
+
gap: 0.25rem;
|
|
487
|
+
background: none;
|
|
488
|
+
border: 0;
|
|
489
|
+
padding: 0;
|
|
490
|
+
font: inherit;
|
|
491
|
+
color: inherit;
|
|
492
|
+
cursor: pointer;
|
|
493
|
+
}
|
|
494
|
+
|
|
483
495
|
.str-chat__li .str-chat__message-inner {
|
|
484
496
|
grid-column-gap: 4px;
|
|
485
497
|
}
|
|
@@ -581,11 +593,12 @@
|
|
|
581
593
|
}
|
|
582
594
|
|
|
583
595
|
/* Message delivery status under sent messages (MES-1036/MES-1296).
|
|
584
|
-
`SentMessageDeliveryStatus` renders
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
596
|
+
`SentMessageDeliveryStatus` renders stream's `.str-chat__message-status`
|
|
597
|
+
directly when there is no broadcast label. When a broadcast label is
|
|
598
|
+
present, `.sent-message-status-row` is the grid item and contains the
|
|
599
|
+
stream status span. Both cases are right-aligned via the outer grid's
|
|
600
|
+
`justify-items: end`; stream's empty status span collapses when no state is
|
|
601
|
+
active (i.e. not the last sent message). */
|
|
589
602
|
.str-chat__li .str-chat__message--me .str-chat__message-status {
|
|
590
603
|
grid-area: delivery-status;
|
|
591
604
|
justify-content: flex-end;
|
|
@@ -596,6 +609,36 @@
|
|
|
596
609
|
line-height: 1.4;
|
|
597
610
|
color: var(--str-chat__text-low-emphasis-color, rgba(0, 0, 0, 0.5));
|
|
598
611
|
}
|
|
612
|
+
.str-chat__li .str-chat__message--me .sent-message-status-row {
|
|
613
|
+
--sent-message-broadcast-badge-color: var(
|
|
614
|
+
--str-chat__message-broadcast-badge-color,
|
|
615
|
+
#ed007c
|
|
616
|
+
);
|
|
617
|
+
--sent-message-broadcast-name-color: var(
|
|
618
|
+
--str-chat__message-broadcast-name-color,
|
|
619
|
+
rgba(4, 4, 3, 0.898)
|
|
620
|
+
);
|
|
621
|
+
display: inline-flex;
|
|
622
|
+
grid-area: delivery-status;
|
|
623
|
+
align-items: center;
|
|
624
|
+
justify-content: flex-end;
|
|
625
|
+
gap: 4px;
|
|
626
|
+
padding-block-start: 4px;
|
|
627
|
+
padding-inline-end: 16px;
|
|
628
|
+
font-size: 10px;
|
|
629
|
+
line-height: 1.4;
|
|
630
|
+
color: var(--str-chat__text-low-emphasis-color, rgba(0, 0, 0, 0.5));
|
|
631
|
+
}
|
|
632
|
+
.str-chat__li .str-chat__message--me .sent-message-status-row
|
|
633
|
+
.str-chat__message-status {
|
|
634
|
+
grid-area: auto;
|
|
635
|
+
justify-content: inherit;
|
|
636
|
+
gap: inherit;
|
|
637
|
+
padding: 0;
|
|
638
|
+
font: inherit;
|
|
639
|
+
line-height: inherit;
|
|
640
|
+
color: inherit;
|
|
641
|
+
}
|
|
599
642
|
.str-chat__li .str-chat__message-status:empty {
|
|
600
643
|
display: none;
|
|
601
644
|
}
|
|
@@ -608,6 +651,44 @@
|
|
|
608
651
|
.str-chat__li .str-chat__message--me .str-chat__message-status svg path {
|
|
609
652
|
fill: currentColor;
|
|
610
653
|
}
|
|
654
|
+
.str-chat__li .str-chat__message--me .sent-message-status-row svg {
|
|
655
|
+
width: 14px;
|
|
656
|
+
height: 14px;
|
|
657
|
+
}
|
|
658
|
+
.str-chat__li .str-chat__message--me .sent-message-status-row svg path {
|
|
659
|
+
fill: currentColor;
|
|
660
|
+
}
|
|
661
|
+
.str-chat__li .str-chat__message--me .sent-message-status-row
|
|
662
|
+
.sent-message-broadcast-badge {
|
|
663
|
+
display: inline-flex;
|
|
664
|
+
width: 16px;
|
|
665
|
+
height: 16px;
|
|
666
|
+
align-items: center;
|
|
667
|
+
justify-content: center;
|
|
668
|
+
flex: 0 0 16px;
|
|
669
|
+
border-radius: 50%;
|
|
670
|
+
background: var(--sent-message-broadcast-badge-color);
|
|
671
|
+
color: #fff;
|
|
672
|
+
}
|
|
673
|
+
.str-chat__li .str-chat__message--me .sent-message-status-row
|
|
674
|
+
.sent-message-broadcast-badge svg {
|
|
675
|
+
width: 10px;
|
|
676
|
+
height: 10px;
|
|
677
|
+
}
|
|
678
|
+
.str-chat__li .str-chat__message--me .sent-message-status-row
|
|
679
|
+
.sent-message-broadcast-badge svg path {
|
|
680
|
+
fill: currentColor;
|
|
681
|
+
}
|
|
682
|
+
.str-chat__li .str-chat__message--me .sent-message-status-row
|
|
683
|
+
.sent-message-broadcast-name {
|
|
684
|
+
color: var(--sent-message-broadcast-name-color);
|
|
685
|
+
}
|
|
686
|
+
.str-chat__li .str-chat__message--me .sent-message-status-row
|
|
687
|
+
.sent-message-broadcast-link
|
|
688
|
+
.sent-message-broadcast-name {
|
|
689
|
+
text-decoration: underline;
|
|
690
|
+
text-decoration-skip-ink: auto;
|
|
691
|
+
}
|
|
611
692
|
.str-chat__li .str-chat__message--me .sent-message-status--failed {
|
|
612
693
|
color: var(--str-chat__message-error-color, #d92d20);
|
|
613
694
|
}
|
package/src/types.ts
CHANGED
|
@@ -36,6 +36,11 @@ export type MessageLinkClickHandler = (
|
|
|
36
36
|
message: LocalMessage | undefined
|
|
37
37
|
) => void
|
|
38
38
|
|
|
39
|
+
export type BroadcastClickHandler = (broadcast: {
|
|
40
|
+
id: string
|
|
41
|
+
name?: string
|
|
42
|
+
}) => void
|
|
43
|
+
|
|
39
44
|
export type ChannelPreviewProps = ChannelPreviewUIComponentProps & {
|
|
40
45
|
selectedChannel?: Channel | null
|
|
41
46
|
onChannelSelect: (channel: Channel) => void
|
|
@@ -362,6 +367,12 @@ export interface ChannelViewProps {
|
|
|
362
367
|
*/
|
|
363
368
|
onMessageLinkClick?: MessageLinkClickHandler
|
|
364
369
|
|
|
370
|
+
/**
|
|
371
|
+
* Fired when a broadcast label is clicked on an outgoing broadcast message.
|
|
372
|
+
* Hosts own navigation so this shared package never assumes an admin URL.
|
|
373
|
+
*/
|
|
374
|
+
onBroadcastClick?: BroadcastClickHandler
|
|
375
|
+
|
|
365
376
|
/**
|
|
366
377
|
* Passed to Stream `Channel` as `SendButton`. Required for hosts that replace
|
|
367
378
|
* the send control: `Channel` merges this into `ComponentContext` and an
|
|
@@ -430,6 +441,7 @@ export type ChannelViewPassthroughProps = Pick<
|
|
|
430
441
|
| 'onParticipantNameClick'
|
|
431
442
|
| 'renderMessage'
|
|
432
443
|
| 'onMessageLinkClick'
|
|
444
|
+
| 'onBroadcastClick'
|
|
433
445
|
| 'showChannelInfo'
|
|
434
446
|
| 'composerInput'
|
|
435
447
|
>
|