@linktr.ee/messaging-react 3.26.0-rc-1785465283 → 3.26.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.
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-Do2nl8Qo.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.MessageBubble=e.MessageBubble;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.optimizeMessagingAttachmentUrl=e.optimizeMessagingAttachmentUrl;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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-QulHlER7.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.MessageBubble=e.MessageBubble;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.optimizeMessagingAttachmentUrl=e.optimizeMessagingAttachmentUrl;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.d.ts CHANGED
@@ -87,8 +87,6 @@ export declare type BroadcastClickHandler = (broadcast: {
87
87
  name?: string;
88
88
  }) => void;
89
89
 
90
- export declare type BroadcastNameResolver = (broadcastId: string) => string | undefined;
91
-
92
90
  /**
93
91
  * Build the meta line shown under the title in compact document / file
94
92
  * attachments — `EXT · SIZE` (`PDF · 379.5 KB`). Either part is dropped
@@ -212,7 +210,7 @@ export declare const ChannelView: default_2.NamedExoticComponent<ChannelViewProp
212
210
  * Props that MessagingShell passes through to ChannelView.
213
211
  * ChannelViewProps is the source of truth for these props.
214
212
  */
215
- declare type ChannelViewPassthroughProps = Pick<ChannelViewProps, 'renderMessageInputActions' | 'renderConversationFooter' | 'CustomChannelEmptyState' | 'onBlockParticipantClick' | 'onReportParticipantClick' | 'dmAgentEnabled' | 'onMessageSent' | 'chatbotVotingEnabled' | 'viewerLanguage' | 'renderChannelBanner' | 'customChannelActions' | 'renderChannelActions' | 'onParticipantNameClick' | 'renderMessage' | 'onMessageLinkClick' | 'onBroadcastClick' | 'resolveBroadcastName' | 'showChannelInfo' | 'composerInput'>;
213
+ declare type ChannelViewPassthroughProps = Pick<ChannelViewProps, 'renderMessageInputActions' | 'renderConversationFooter' | 'CustomChannelEmptyState' | 'onBlockParticipantClick' | 'onReportParticipantClick' | 'dmAgentEnabled' | 'onMessageSent' | 'chatbotVotingEnabled' | 'viewerLanguage' | 'renderChannelBanner' | 'customChannelActions' | 'renderChannelActions' | 'onParticipantNameClick' | 'renderMessage' | 'onMessageLinkClick' | 'onBroadcastClick' | 'showChannelInfo' | 'composerInput'>;
216
214
 
217
215
  /**
218
216
  * ChannelView component props
@@ -403,11 +401,6 @@ export declare interface ChannelViewProps {
403
401
  * Hosts own navigation so this shared package never assumes an admin URL.
404
402
  */
405
403
  onBroadcastClick?: BroadcastClickHandler;
406
- /**
407
- * Resolves the current campaign name for a broadcast label. The stamped
408
- * message name remains the fallback when this returns undefined.
409
- */
410
- resolveBroadcastName?: BroadcastNameResolver;
411
404
  /**
412
405
  * Passed to Stream `Channel` as `SendButton`. Required for hosts that replace
413
406
  * the send control: `Channel` merges this into `ComponentContext` and an
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 p, m as d, n as v, p as C, q as A, s as k, t as F, u as b, v as P, w as f, x, o as y, y as z, z as B, B as S, D as q, E as D, G as E, H as V, I as w } from "./index-CX2t-UMh.js";
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 p, m as d, n as v, p as C, q as A, s as k, t as F, u as b, v as P, w as f, x, o as y, y as z, z as B, B as S, D as q, E as D, G as E, H as V, I as w } from "./index-CitR7B66.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.26.0-rc-1785465283",
3
+ "version": "3.26.0",
4
4
  "description": "React messaging components built on messaging-core for web applications",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -50,8 +50,8 @@
50
50
  },
51
51
  "dependencies": {
52
52
  "@linktr.ee/component-library": "11.8.6",
53
- "@linktr.ee/messaging-core": "2.3.0-rc-1785465283",
54
- "@linktr.ee/messaging-taxonomy": "^0.3.0",
53
+ "@linktr.ee/messaging-core": "^2.2.0",
54
+ "@linktr.ee/messaging-taxonomy": "^0.5.0",
55
55
  "@phosphor-icons/react": "^2.1.10",
56
56
  "culori": "^4.0.2"
57
57
  },
@@ -57,7 +57,6 @@ const ChannelViewInner: React.FC<{
57
57
  showChannelInfo?: boolean
58
58
  onParticipantNameClick?: () => void
59
59
  onBroadcastClick?: ChannelViewProps['onBroadcastClick']
60
- resolveBroadcastName?: ChannelViewProps['resolveBroadcastName']
61
60
  composerInput?: ChannelViewProps['composerInput']
62
61
  }> = ({
63
62
  onBack,
@@ -85,7 +84,6 @@ const ChannelViewInner: React.FC<{
85
84
  showChannelInfo = true,
86
85
  onParticipantNameClick,
87
86
  onBroadcastClick,
88
- resolveBroadcastName,
89
87
  composerInput,
90
88
  }) => {
91
89
  const { channel } = useChannelStateContext()
@@ -101,16 +99,6 @@ const ChannelViewInner: React.FC<{
101
99
  const messageBroadcastClick = onBroadcastClick
102
100
  ? stableOnBroadcastClick
103
101
  : undefined
104
- const resolveBroadcastNameRef = useRef(resolveBroadcastName)
105
- useEffect(() => {
106
- resolveBroadcastNameRef.current = resolveBroadcastName
107
- }, [resolveBroadcastName])
108
- const stableResolveBroadcastName = useCallback<
109
- NonNullable<ChannelViewProps['resolveBroadcastName']>
110
- >((broadcastId) => resolveBroadcastNameRef.current?.(broadcastId), [])
111
- const messageBroadcastName = resolveBroadcastName
112
- ? stableResolveBroadcastName
113
- : undefined
114
102
 
115
103
  const hasVisibleMessages = channel.state.messages.some(
116
104
  (message) => message.type !== 'deleted'
@@ -152,7 +140,6 @@ const ChannelViewInner: React.FC<{
152
140
  chatbotVotingEnabled={chatbotVotingEnabled}
153
141
  viewerLanguage={viewerLanguage}
154
142
  onBroadcastClick={messageBroadcastClick}
155
- resolveBroadcastName={messageBroadcastName}
156
143
  />
157
144
  )
158
145
 
@@ -162,9 +149,6 @@ const ChannelViewInner: React.FC<{
162
149
 
163
150
  return renderMessage(messageNode, message)
164
151
  },
165
- // The resolver wrapper is intentionally stable; its ref reads the latest
166
- // host resolver without changing MessageOverride's component identity.
167
- // eslint-disable-next-line react-hooks/exhaustive-deps
168
152
  [chatbotVotingEnabled, messageBroadcastClick, renderMessage, viewerLanguage]
169
153
  )
170
154
 
@@ -324,7 +308,6 @@ export const ChannelView = React.memo<ChannelViewProps>(
324
308
  showChannelInfo = true,
325
309
  onParticipantNameClick,
326
310
  onBroadcastClick,
327
- resolveBroadcastName,
328
311
  composerInput,
329
312
  }) => {
330
313
  // Custom send message handler that:
@@ -439,7 +422,6 @@ export const ChannelView = React.memo<ChannelViewProps>(
439
422
  showChannelInfo={showChannelInfo}
440
423
  onParticipantNameClick={onParticipantNameClick}
441
424
  onBroadcastClick={onBroadcastClick}
442
- resolveBroadcastName={resolveBroadcastName}
443
425
  composerInput={composerInput}
444
426
  />
445
427
  </Channel>
@@ -108,7 +108,6 @@ const createMockChannel = async (
108
108
  interface TemplateProps {
109
109
  currentUser: StoryUser
110
110
  typingUser?: StoryUser
111
- resolveBroadcastName?: (broadcastId: string) => string | undefined
112
111
  messages: Array<{
113
112
  id: string
114
113
  text: string
@@ -139,8 +138,7 @@ const TemplateInner: React.FC<{
139
138
  currentUser: StoryUser
140
139
  typingUser?: StoryUser
141
140
  messages: TemplateProps['messages']
142
- resolveBroadcastName?: (broadcastId: string) => string | undefined
143
- }> = ({ currentUser, typingUser, messages, resolveBroadcastName }) => {
141
+ }> = ({ currentUser, typingUser, messages }) => {
144
142
  const [client] = React.useState(() => createMockStreamChatClient(currentUser))
145
143
 
146
144
  const [channel, setChannel] = React.useState<ChannelType | null>(null)
@@ -172,11 +170,10 @@ const TemplateInner: React.FC<{
172
170
  <CustomMessage
173
171
  {...props}
174
172
  onBroadcastClick={() => undefined}
175
- resolveBroadcastName={resolveBroadcastName}
176
173
  />
177
174
  )
178
175
  }
179
- }, [resolveBroadcastName])
176
+ }, [])
180
177
 
181
178
  if (!channel) {
182
179
  return <div className="p-4">Loading...</div>
@@ -203,14 +200,12 @@ const Template: StoryFn<TemplateProps> = ({
203
200
  currentUser = storyUsers.creator,
204
201
  typingUser,
205
202
  messages,
206
- resolveBroadcastName,
207
203
  }) => (
208
204
  <TemplateInner
209
205
  key={currentUser.id}
210
206
  currentUser={currentUser}
211
207
  typingUser={typingUser}
212
208
  messages={messages}
213
- resolveBroadcastName={resolveBroadcastName}
214
209
  />
215
210
  )
216
211
 
@@ -307,12 +302,6 @@ BroadcastStatusNonLatest.args = {
307
302
  ],
308
303
  }
309
304
 
310
- export const BroadcastStatusResolved: StoryFn<TemplateProps> = Template.bind({})
311
- BroadcastStatusResolved.args = {
312
- ...BroadcastStatus.args,
313
- resolveBroadcastName: () => 'July 9th Class absentee',
314
- }
315
-
316
305
  export const WithTipTag: StoryFn<TemplateProps> = Template.bind({})
317
306
  WithTipTag.args = {
318
307
  messages: [
@@ -138,39 +138,4 @@ describe('CustomMessage', () => {
138
138
  name: 'July 9th Class attendees',
139
139
  })
140
140
  })
141
-
142
- it('prefers a resolved broadcast name over the stamped name', () => {
143
- renderWithProviders(
144
- <CustomMessage
145
- resolveBroadcastName={() => 'July 9th Class absentee'}
146
- />
147
- )
148
-
149
- expect(
150
- screen.getByTestId('sent-message-broadcast-status')
151
- ).toHaveTextContent('July 9th Class absentee')
152
- })
153
-
154
- it('falls back to the stamped broadcast name when resolution is unavailable', () => {
155
- renderWithProviders(<CustomMessage resolveBroadcastName={() => undefined} />)
156
-
157
- expect(
158
- screen.getByTestId('sent-message-broadcast-status')
159
- ).toHaveTextContent('July 9th Class attendees')
160
- })
161
-
162
- it('renders a later resolved name when the resolver value changes', () => {
163
- const resolvedName: { current?: string } = {}
164
- const resolveBroadcastName = () => resolvedName.current
165
- const { rerender } = renderWithProviders(
166
- <CustomMessage resolveBroadcastName={resolveBroadcastName} />
167
- )
168
-
169
- resolvedName.current = 'July 9th Class absentee'
170
- rerender(<CustomMessage resolveBroadcastName={resolveBroadcastName} />)
171
-
172
- expect(
173
- screen.getByTestId('sent-message-broadcast-status')
174
- ).toHaveTextContent('July 9th Class absentee')
175
- })
176
141
  })
@@ -97,21 +97,13 @@ const SendingStatus = () => {
97
97
  const BroadcastStatus = ({
98
98
  broadcastId,
99
99
  broadcastName,
100
- resolveBroadcastName,
101
- resolvedBroadcastName,
102
100
  onBroadcastClick,
103
101
  }: {
104
102
  broadcastId: string
105
103
  broadcastName?: string
106
- resolveBroadcastName?: (broadcastId: string) => string | undefined
107
- resolvedBroadcastName?: string
108
104
  onBroadcastClick?: (broadcast: { id: string; name?: string }) => void
109
105
  }) => {
110
- const name =
111
- resolvedBroadcastName ||
112
- resolveBroadcastName?.(broadcastId) ||
113
- broadcastName ||
114
- 'Broadcast'
106
+ const name = broadcastName || 'Broadcast'
115
107
  const content = (
116
108
  <>
117
109
  <span className="sent-message-broadcast-badge" aria-hidden="true">
@@ -168,12 +160,8 @@ const FailedStatus = () => (
168
160
  */
169
161
  export const SentMessageDeliveryStatus = ({
170
162
  onBroadcastClick,
171
- resolveBroadcastName,
172
- resolvedBroadcastName,
173
163
  }: {
174
164
  onBroadcastClick?: (broadcast: { id: string; name?: string }) => void
175
- resolveBroadcastName?: (broadcastId: string) => string | undefined
176
- resolvedBroadcastName?: string
177
165
  }) => {
178
166
  const { isMyMessage, message, threadList } = useMessageContext(
179
167
  'SentMessageDeliveryStatus'
@@ -204,8 +192,6 @@ export const SentMessageDeliveryStatus = ({
204
192
  <BroadcastStatus
205
193
  broadcastId={broadcastId}
206
194
  broadcastName={broadcastName}
207
- resolveBroadcastName={resolveBroadcastName}
208
- resolvedBroadcastName={resolvedBroadcastName}
209
195
  onBroadcastClick={onBroadcastClick}
210
196
  />
211
197
  ) : null
@@ -55,15 +55,12 @@ type CustomMessageUIComponentProps = MessageUIComponentProps & {
55
55
  chatbotVotingEnabled?: boolean
56
56
  viewerLanguage?: string
57
57
  onBroadcastClick?: (broadcast: { id: string; name?: string }) => void
58
- resolveBroadcastName?: (broadcastId: string) => string | undefined
59
58
  }
60
59
 
61
60
  type CustomMessageWithContextProps = MessageContextValue & {
62
61
  chatbotVotingEnabled?: boolean
63
62
  viewerLanguage?: string
64
63
  onBroadcastClick?: (broadcast: { id: string; name?: string }) => void
65
- resolveBroadcastName?: (broadcastId: string) => string | undefined
66
- resolvedBroadcastName?: string
67
64
  }
68
65
 
69
66
  const CustomMessageWithContext = (props: CustomMessageWithContextProps) => {
@@ -85,8 +82,6 @@ const CustomMessageWithContext = (props: CustomMessageWithContextProps) => {
85
82
  threadList,
86
83
  viewerLanguage,
87
84
  onBroadcastClick,
88
- resolveBroadcastName,
89
- resolvedBroadcastName,
90
85
  } = props
91
86
 
92
87
  const { client } = useChatContext('CustomMessage')
@@ -431,11 +426,7 @@ const CustomMessageWithContext = (props: CustomMessageWithContextProps) => {
431
426
  )}
432
427
  </div>
433
428
  )}
434
- <SentMessageDeliveryStatus
435
- onBroadcastClick={onBroadcastClick}
436
- resolveBroadcastName={resolveBroadcastName}
437
- resolvedBroadcastName={resolvedBroadcastName}
438
- />
429
+ <SentMessageDeliveryStatus onBroadcastClick={onBroadcastClick} />
439
430
  {showReplyCountButton && (
440
431
  <MessageRepliesCountButton
441
432
  onClick={handleOpenThread}
@@ -456,24 +447,11 @@ const MemoizedCustomMessage = React.memo(
456
447
  if (prev.chatbotVotingEnabled !== next.chatbotVotingEnabled) return false
457
448
  if (prev.viewerLanguage !== next.viewerLanguage) return false
458
449
  if (prev.onBroadcastClick !== next.onBroadcastClick) return false
459
- if (prev.resolveBroadcastName !== next.resolveBroadcastName) return false
460
- if (prev.resolvedBroadcastName !== next.resolvedBroadcastName) return false
461
450
  return areMessageUIPropsEqual(prev, next)
462
451
  }
463
452
  ) as typeof CustomMessageWithContext
464
453
 
465
454
  export const CustomMessage = (props: CustomMessageUIComponentProps) => {
466
455
  const messageContext = useMessageContext('CustomMessage')
467
- const broadcastId = messageContext.message.metadata?.broadcast_id
468
- const resolvedBroadcastName = broadcastId
469
- ? props.resolveBroadcastName?.(broadcastId)
470
- : undefined
471
-
472
- return (
473
- <MemoizedCustomMessage
474
- {...messageContext}
475
- {...props}
476
- resolvedBroadcastName={resolvedBroadcastName}
477
- />
478
- )
456
+ return <MemoizedCustomMessage {...messageContext} {...props} />
479
457
  }
@@ -39,7 +39,6 @@ export const MessagingShell: React.FC<MessagingShellProps> = ({
39
39
  renderChannelActions,
40
40
  onParticipantNameClick,
41
41
  onBroadcastClick,
42
- resolveBroadcastName,
43
42
  renderMessage,
44
43
  onMessageLinkClick,
45
44
  showChannelInfo,
@@ -266,7 +265,6 @@ export const MessagingShell: React.FC<MessagingShellProps> = ({
266
265
  renderChannelActions={renderChannelActions}
267
266
  onParticipantNameClick={onParticipantNameClick}
268
267
  onBroadcastClick={onBroadcastClick}
269
- resolveBroadcastName={resolveBroadcastName}
270
268
  renderMessage={renderMessage}
271
269
  onMessageLinkClick={onMessageLinkClick}
272
270
  showChannelInfo={showChannelInfo}
package/src/index.ts CHANGED
@@ -61,7 +61,6 @@ export type {
61
61
  MessagingCapabilities,
62
62
  MessageLinkClickHandler,
63
63
  BroadcastClickHandler,
64
- BroadcastNameResolver,
65
64
  Participant,
66
65
  LockedAttachmentSource,
67
66
  } from './types'
package/src/types.ts CHANGED
@@ -41,8 +41,6 @@ export type BroadcastClickHandler = (broadcast: {
41
41
  name?: string
42
42
  }) => void
43
43
 
44
- export type BroadcastNameResolver = (broadcastId: string) => string | undefined
45
-
46
44
  export type ChannelPreviewProps = ChannelPreviewUIComponentProps & {
47
45
  selectedChannel?: Channel | null
48
46
  onChannelSelect: (channel: Channel) => void
@@ -375,12 +373,6 @@ export interface ChannelViewProps {
375
373
  */
376
374
  onBroadcastClick?: BroadcastClickHandler
377
375
 
378
- /**
379
- * Resolves the current campaign name for a broadcast label. The stamped
380
- * message name remains the fallback when this returns undefined.
381
- */
382
- resolveBroadcastName?: BroadcastNameResolver
383
-
384
376
  /**
385
377
  * Passed to Stream `Channel` as `SendButton`. Required for hosts that replace
386
378
  * the send control: `Channel` merges this into `ComponentContext` and an
@@ -450,7 +442,6 @@ export type ChannelViewPassthroughProps = Pick<
450
442
  | 'renderMessage'
451
443
  | 'onMessageLinkClick'
452
444
  | 'onBroadcastClick'
453
- | 'resolveBroadcastName'
454
445
  | 'showChannelInfo'
455
446
  | 'composerInput'
456
447
  >