@linktr.ee/messaging-react 4.2.0-rc-1787325521 → 4.2.0-rc-1787599724

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 (96) hide show
  1. package/dist/{Card-BYJyA83X.js → Card-D7UPq5-g.js} +2 -2
  2. package/dist/{Card-BYJyA83X.js.map → Card-D7UPq5-g.js.map} +1 -1
  3. package/dist/{Card-BplJtZao.cjs → Card-DcBZqMBt.cjs} +2 -2
  4. package/dist/{Card-BplJtZao.cjs.map → Card-DcBZqMBt.cjs.map} +1 -1
  5. package/dist/assets/index.css +1 -1
  6. package/dist/{index-BUC9vqhJ.js → index-CSkr_CO5.js} +2089 -1952
  7. package/dist/index-CSkr_CO5.js.map +1 -0
  8. package/dist/index-CwkY7QwT.cjs +3 -0
  9. package/dist/index-CwkY7QwT.cjs.map +1 -0
  10. package/dist/index.cjs +1 -1
  11. package/dist/index.d.ts +59 -78
  12. package/dist/index.js +26 -30
  13. package/dist/testing.cjs +1 -1
  14. package/dist/testing.cjs.map +1 -1
  15. package/dist/testing.js +2 -2
  16. package/dist/testing.js.map +1 -1
  17. package/package.json +13 -11
  18. package/src/components/AttachmentCard/utils/icons.ts +7 -6
  19. package/src/components/Avatar/Avatar.test.tsx +0 -126
  20. package/src/components/Avatar/getAvatarEmoji.test.ts +0 -39
  21. package/src/components/ChannelList/CustomChannelPreview.test.tsx +3 -410
  22. package/src/components/ChannelList/index.test.tsx +1 -132
  23. package/src/components/ChannelView.stories.tsx +0 -4
  24. package/src/components/ChannelView.test.tsx +3 -9
  25. package/src/components/CustomMessage/CustomMessage.stories.tsx +314 -6
  26. package/src/components/CustomMessage/CustomMessage.test.tsx +2 -56
  27. package/src/components/CustomMessage/MessageTag.stories.tsx +53 -17
  28. package/src/components/CustomMessage/MessageTag.test.tsx +40 -7
  29. package/src/components/CustomMessage/MessageTag.tsx +39 -7
  30. package/src/components/CustomMessage/SentMessageDeliveryStatus.test.tsx +7 -8
  31. package/src/components/CustomMessage/SentMessageDeliveryStatus.tsx +1 -2
  32. package/src/components/CustomMessage/StreamAttachmentMessage.test.tsx +33 -0
  33. package/src/components/CustomMessage/StreamAttachmentMessage.tsx +12 -5
  34. package/src/components/CustomMessage/index.tsx +19 -22
  35. package/src/components/CustomMessageInput/index.tsx +1 -1
  36. package/src/components/CustomSystemMessage/index.tsx +2 -3
  37. package/src/components/LinkAttachment/LinkAttachment.test.tsx +0 -327
  38. package/src/components/MessageAttachment/Audio/AudioAttachment.stories.tsx +165 -58
  39. package/src/components/MessageAttachment/Audio/WaveformAudioRow.test.tsx +153 -0
  40. package/src/components/MessageAttachment/Audio/WaveformAudioRow.tsx +450 -0
  41. package/src/components/MessageAttachment/Audio/audioRowRequester.test.ts +24 -0
  42. package/src/components/MessageAttachment/Audio/audioRowRequester.ts +16 -0
  43. package/src/components/MessageAttachment/Audio/index.tsx +83 -77
  44. package/src/components/MessageAttachment/MessageAttachment.test.tsx +176 -74
  45. package/src/components/MessageAttachment/_shared/fileMeta.test.ts +0 -44
  46. package/src/components/MessageAttachment/_shared/useIsClient.ts +23 -0
  47. package/src/components/MessageAttachment/index.tsx +25 -9
  48. package/src/components/MessageAttachment/types.ts +19 -9
  49. package/src/components/MessagingShell/MessagingShell.test.tsx +0 -20
  50. package/src/components/MessagingShell/index.tsx +0 -2
  51. package/src/components/RichCard/RichCard.test.tsx +1 -3
  52. package/src/index.ts +0 -4
  53. package/src/providers/MessagingProvider.test.tsx +2 -130
  54. package/src/providers/MessagingProvider.tsx +15 -26
  55. package/src/styles.css +210 -57
  56. package/src/testing/createMockMessagingClient.ts +2 -2
  57. package/src/types.ts +0 -9
  58. package/dist/index-BUC9vqhJ.js.map +0 -1
  59. package/dist/index-BkqyKPJP.cjs +0 -3
  60. package/dist/index-BkqyKPJP.cjs.map +0 -1
  61. package/src/components/AttachmentCard/MediaPlayer.test.tsx +0 -346
  62. package/src/components/AttachmentCard/Thumbnail.test.tsx +0 -215
  63. package/src/components/AttachmentCard/index.test.tsx +0 -160
  64. package/src/components/ChannelList/ChannelListContext.test.tsx +0 -87
  65. package/src/components/CustomMessage/Locked.stories.tsx +0 -108
  66. package/src/components/CustomMessage/PaidMessage.stories.tsx +0 -42
  67. package/src/components/CustomMessage/Tip.stories.tsx +0 -48
  68. package/src/components/CustomMessage/TipMessage/TipMessage.stories.tsx +0 -51
  69. package/src/components/CustomMessage/TipMessage/TipMessage.test.tsx +0 -65
  70. package/src/components/CustomMessage/TipMessage/index.tsx +0 -27
  71. package/src/components/FaqList/FaqList.test.tsx +0 -204
  72. package/src/components/LinkAttachment/components/_shared/BubbleTail.test.tsx +0 -76
  73. package/src/components/LinkAttachment/components/_shared/CardBody.test.tsx +0 -248
  74. package/src/components/LinkAttachment/components/_shared/CardCta.test.tsx +0 -123
  75. package/src/components/LinkAttachment/components/_shared/CardShell.test.tsx +0 -193
  76. package/src/components/LinkAttachment/components/_shared/CardThumbnail.test.tsx +0 -242
  77. package/src/components/LinkAttachment/components/_shared/hex.test.ts +0 -37
  78. package/src/components/LinkAttachment/components/_shared/normalizeExternalHref.test.ts +0 -72
  79. package/src/components/LinkAttachment/components/_shared/useChinPalette.test.ts +0 -162
  80. package/src/components/MessageAttachment/MessageAttachment.behavior.test.tsx +0 -182
  81. package/src/components/MessageAttachment/_shared/Bubble.test.tsx +0 -111
  82. package/src/components/MessageAttachment/_shared/CarouselNav.test.tsx +0 -36
  83. package/src/components/MessageAttachment/_shared/CompactDocumentRow.test.tsx +0 -114
  84. package/src/components/MessageAttachment/_shared/DismissButton.test.tsx +0 -42
  85. package/src/components/MessageAttachment/_shared/DownloadAction.test.tsx +0 -168
  86. package/src/components/MessageAttachment/_shared/ImageViewer.test.tsx +0 -52
  87. package/src/components/MessageAttachment/_shared/MediaStackGrid.test.tsx +0 -69
  88. package/src/components/MessageAttachment/_shared/PdfViewer.test.tsx +0 -45
  89. package/src/components/MessageAttachment/_shared/VideoViewer.test.tsx +0 -55
  90. package/src/components/MessageAttachment/_shared/ViewerShell.test.tsx +0 -246
  91. package/src/components/MessageAttachment/_shared/triggerDownload.test.ts +0 -113
  92. package/src/components/MessageAttachment/_shared/useCarousel.test.tsx +0 -68
  93. package/src/components/MessageAttachment/_shared/viewerChromeClasses.test.ts +0 -16
  94. package/src/logging/index.test.tsx +0 -136
  95. package/src/logging/index.tsx +0 -48
  96. package/src/stories/customMessageStoryTemplate.tsx +0 -202
package/src/styles.css CHANGED
@@ -120,6 +120,10 @@
120
120
  }
121
121
  }
122
122
 
123
+ .messaging-channel-layout {
124
+ --messaging-composer-fade-height: 2rem;
125
+ }
126
+
123
127
  .messaging-composer-chrome--floating {
124
128
  position: relative;
125
129
  right: 0;
@@ -134,10 +138,21 @@
134
138
 
135
139
  .messaging-composer-chrome--floating .messaging-composer-backdrop {
136
140
  position: absolute;
137
- inset: 0;
141
+ top: calc(-1 * var(--messaging-composer-fade-height));
142
+ right: 0;
143
+ bottom: 0;
144
+ left: 0;
138
145
  overflow: hidden;
139
146
  isolation: isolate;
140
147
  pointer-events: none;
148
+ /* Frosted band height, from the backdrop's top edge down to the composer
149
+ pill: the fade-height above the chrome plus the chrome's own top padding
150
+ (p-4 = 1rem). Blur/gradient stops are anchored to this fixed band so the
151
+ frosting stays in the gap above the composer and does not scale with the
152
+ (opaque) composer height. */
153
+ --messaging-composer-fade-band: calc(
154
+ var(--messaging-composer-fade-height) + 1rem
155
+ );
141
156
  }
142
157
 
143
158
  .messaging-composer-backdrop-blur {
@@ -146,71 +161,99 @@
146
161
  pointer-events: none;
147
162
  }
148
163
 
149
- /* Figma progressive background blur: (50%, 0%) → (50%, 100%), 0 → 16.
150
- CSS has no spatially-varying blur, so five evenly spaced masked layers
151
- approximate the linear ramp across the full parent height. */
152
164
  .messaging-composer-backdrop-blur:nth-child(1) {
153
- --messaging-composer-blur-mask: linear-gradient(
165
+ backdrop-filter: blur(2px);
166
+ -webkit-backdrop-filter: blur(2px);
167
+ mask: linear-gradient(
154
168
  to bottom,
155
- transparent 0%,
156
- black 20%,
157
- transparent 40%
169
+ transparent 0,
170
+ black calc(var(--messaging-composer-fade-band) * 0.12),
171
+ black calc(var(--messaging-composer-fade-band) * 0.32),
172
+ transparent calc(var(--messaging-composer-fade-band) * 0.5)
173
+ );
174
+ -webkit-mask: linear-gradient(
175
+ to bottom,
176
+ transparent 0,
177
+ black calc(var(--messaging-composer-fade-band) * 0.12),
178
+ black calc(var(--messaging-composer-fade-band) * 0.32),
179
+ transparent calc(var(--messaging-composer-fade-band) * 0.5)
158
180
  );
159
- backdrop-filter: blur(3.2px);
160
- -webkit-backdrop-filter: blur(3.2px);
161
- mask: var(--messaging-composer-blur-mask);
162
- -webkit-mask: var(--messaging-composer-blur-mask);
163
181
  }
164
182
 
165
183
  .messaging-composer-backdrop-blur:nth-child(2) {
166
- --messaging-composer-blur-mask: linear-gradient(
184
+ backdrop-filter: blur(4px);
185
+ -webkit-backdrop-filter: blur(4px);
186
+ mask: linear-gradient(
167
187
  to bottom,
168
- transparent 20%,
169
- black 40%,
170
- transparent 60%
188
+ transparent calc(var(--messaging-composer-fade-band) * 0.2),
189
+ black calc(var(--messaging-composer-fade-band) * 0.38),
190
+ black calc(var(--messaging-composer-fade-band) * 0.55),
191
+ transparent calc(var(--messaging-composer-fade-band) * 0.7)
192
+ );
193
+ -webkit-mask: linear-gradient(
194
+ to bottom,
195
+ transparent calc(var(--messaging-composer-fade-band) * 0.2),
196
+ black calc(var(--messaging-composer-fade-band) * 0.38),
197
+ black calc(var(--messaging-composer-fade-band) * 0.55),
198
+ transparent calc(var(--messaging-composer-fade-band) * 0.7)
171
199
  );
172
- backdrop-filter: blur(6.4px);
173
- -webkit-backdrop-filter: blur(6.4px);
174
- mask: var(--messaging-composer-blur-mask);
175
- -webkit-mask: var(--messaging-composer-blur-mask);
176
200
  }
177
201
 
178
202
  .messaging-composer-backdrop-blur:nth-child(3) {
179
- --messaging-composer-blur-mask: linear-gradient(
203
+ backdrop-filter: blur(8px);
204
+ -webkit-backdrop-filter: blur(8px);
205
+ mask: linear-gradient(
206
+ to bottom,
207
+ transparent calc(var(--messaging-composer-fade-band) * 0.4),
208
+ black calc(var(--messaging-composer-fade-band) * 0.58),
209
+ black calc(var(--messaging-composer-fade-band) * 0.72),
210
+ transparent calc(var(--messaging-composer-fade-band) * 0.85)
211
+ );
212
+ -webkit-mask: linear-gradient(
180
213
  to bottom,
181
- transparent 40%,
182
- black 60%,
183
- transparent 80%
214
+ transparent calc(var(--messaging-composer-fade-band) * 0.4),
215
+ black calc(var(--messaging-composer-fade-band) * 0.58),
216
+ black calc(var(--messaging-composer-fade-band) * 0.72),
217
+ transparent calc(var(--messaging-composer-fade-band) * 0.85)
184
218
  );
185
- backdrop-filter: blur(9.6px);
186
- -webkit-backdrop-filter: blur(9.6px);
187
- mask: var(--messaging-composer-blur-mask);
188
- -webkit-mask: var(--messaging-composer-blur-mask);
189
219
  }
190
220
 
191
221
  .messaging-composer-backdrop-blur:nth-child(4) {
192
- --messaging-composer-blur-mask: linear-gradient(
222
+ backdrop-filter: blur(12px);
223
+ -webkit-backdrop-filter: blur(12px);
224
+ mask: linear-gradient(
225
+ to bottom,
226
+ transparent calc(var(--messaging-composer-fade-band) * 0.55),
227
+ black calc(var(--messaging-composer-fade-band) * 0.72),
228
+ black calc(var(--messaging-composer-fade-band) * 0.88),
229
+ transparent var(--messaging-composer-fade-band)
230
+ );
231
+ -webkit-mask: linear-gradient(
193
232
  to bottom,
194
- transparent 60%,
195
- black 80%,
196
- transparent 100%
233
+ transparent calc(var(--messaging-composer-fade-band) * 0.55),
234
+ black calc(var(--messaging-composer-fade-band) * 0.72),
235
+ black calc(var(--messaging-composer-fade-band) * 0.88),
236
+ transparent var(--messaging-composer-fade-band)
197
237
  );
198
- backdrop-filter: blur(12.8px);
199
- -webkit-backdrop-filter: blur(12.8px);
200
- mask: var(--messaging-composer-blur-mask);
201
- -webkit-mask: var(--messaging-composer-blur-mask);
202
238
  }
203
239
 
204
240
  .messaging-composer-backdrop-blur:nth-child(5) {
205
- --messaging-composer-blur-mask: linear-gradient(
206
- to bottom,
207
- transparent 80%,
208
- black 100%
209
- );
210
241
  backdrop-filter: blur(16px);
211
242
  -webkit-backdrop-filter: blur(16px);
212
- mask: var(--messaging-composer-blur-mask);
213
- -webkit-mask: var(--messaging-composer-blur-mask);
243
+ mask: linear-gradient(
244
+ to bottom,
245
+ transparent calc(var(--messaging-composer-fade-band) * 0.7),
246
+ black calc(var(--messaging-composer-fade-band) * 0.9),
247
+ black var(--messaging-composer-fade-band),
248
+ transparent var(--messaging-composer-fade-band)
249
+ );
250
+ -webkit-mask: linear-gradient(
251
+ to bottom,
252
+ transparent calc(var(--messaging-composer-fade-band) * 0.7),
253
+ black calc(var(--messaging-composer-fade-band) * 0.9),
254
+ black var(--messaging-composer-fade-band),
255
+ transparent var(--messaging-composer-fade-band)
256
+ );
214
257
  }
215
258
 
216
259
  .messaging-composer-backdrop-gradient {
@@ -218,9 +261,9 @@
218
261
  inset: 0;
219
262
  pointer-events: none;
220
263
  background: linear-gradient(
221
- to bottom,
222
- rgba(251, 250, 249, 0) 0%,
223
- #fbfaf9 100%
264
+ 180deg,
265
+ rgba(251, 250, 249, 0) 0,
266
+ #fbfaf9 var(--messaging-composer-fade-band)
224
267
  );
225
268
  }
226
269
 
@@ -881,22 +924,12 @@
881
924
  align-items: flex-start;
882
925
  }
883
926
 
884
- /* Gap between a wrapper's stacked bubbles (e.g. StreamAttachmentMessage's
885
- media + caption, MediaMessage's card + text) */
927
+ /* Gap between locked attachment card and accompanying text bubble */
886
928
  .str-chat__message-bubble-wrapper
887
929
  > .str-chat__message-bubble:not(:first-child) {
888
930
  margin-top: 4px;
889
931
  }
890
932
 
891
- /* Tighter gap for the locked-attachment card + text bubble and the tip
892
- pill + text bubble — same margin-top mechanism, smaller value. Must come
893
- after the rule above: equal specificity, so source order decides. */
894
- .message-locked-attachment-wrapper
895
- > .str-chat__message-bubble:not(:first-child),
896
- .message-tip-wrapper > .str-chat__message-bubble:not(:first-child) {
897
- margin-top: 2px;
898
- }
899
-
900
933
  /** Remove padding from the text inside the locked attachment text shell,
901
934
  and inherit TextShell's explicit colour — stream-chat-react's own
902
935
  `MessageText` sets its own (black) colour that only gets overridden by
@@ -908,3 +941,123 @@
908
941
  .message-locked-attachment-text .str-chat__message-text-inner {
909
942
  color: inherit;
910
943
  }
944
+
945
+ /* Audio attachment waveform — `MessageAttachment.Audio` (MES-1360).
946
+
947
+ Plain CSS rather than Tailwind utilities for two reasons: the per-bar
948
+ height is a floored custom property that has to be authored once
949
+ rather than repeated on 35 elements, and the played / unplayed fills
950
+ are the one design decision Figma left open (it draws the idle state
951
+ only), so keeping them in a single place is what makes them reviewable.
952
+ Follows the existing `.mes-media-viewer*` / `.mes-dialog` convention:
953
+ the package's shipped stylesheet is enough, with no Tailwind
954
+ dependency in the consumer.
955
+
956
+ Geometry is Figma `2754:17710` → `sound-wave` (`…;2754:8065`): a
957
+ 138×30 track holding 35 bars at 2px with 2px gaps
958
+ (35 x 2 + 34 x 2 = 138). Bars flex from a zero basis, so the exact
959
+ 2px falls out of the 138px track and a narrower container degrades
960
+ proportionally instead of clipping. */
961
+ .mes-audio-wave {
962
+ position: relative;
963
+ display: flex;
964
+ flex: 1 1 0;
965
+ min-width: 0;
966
+ align-items: center;
967
+ height: 30px;
968
+ }
969
+
970
+ .mes-audio-wave__track {
971
+ display: flex;
972
+ width: 100%;
973
+ height: 100%;
974
+ align-items: center;
975
+ gap: 2px;
976
+ }
977
+
978
+ /* Figma's bars run 4px..30px on a 30px track, so the amplitude
979
+ percentage is floored at that 4px minimum: a silent sample — or the
980
+ all-zero fallback used when no waveform could be produced — still
981
+ draws the shortest bar the design already contains, keeping the
982
+ card's silhouette identical instead of collapsing it. */
983
+ .mes-audio-wave__bar {
984
+ flex: 1 1 0;
985
+ min-width: 0;
986
+ height: max(4px, var(--mes-audio-wave-bar, 0%));
987
+ border-radius: 9999px;
988
+ background: rgb(255 255 255 / 0.4);
989
+ }
990
+
991
+ .mes-audio-wave__bar--played {
992
+ background: #ffffff;
993
+ }
994
+
995
+ .mes-audio-wave--light .mes-audio-wave__bar {
996
+ background: rgb(4 4 3 / 0.5);
997
+ }
998
+
999
+ .mes-audio-wave--light .mes-audio-wave__bar--played {
1000
+ background: #040403;
1001
+ }
1002
+
1003
+ /* Seek is a real `<input type="range">` stretched over the bars, which
1004
+ supplies click, drag, arrow keys, Home / End and a screen-reader
1005
+ slider role natively. The bars are the visible track, so the input
1006
+ itself must not paint — but it must stay focusable, which is why the
1007
+ thumb and track are cleared individually rather than the whole input
1008
+ being given `opacity: 0`. */
1009
+ .mes-audio-wave__seek {
1010
+ position: absolute;
1011
+ inset: 0;
1012
+ width: 100%;
1013
+ height: 100%;
1014
+ margin: 0;
1015
+ padding: 0;
1016
+ cursor: pointer;
1017
+ background: transparent;
1018
+ -webkit-appearance: none;
1019
+ appearance: none;
1020
+ }
1021
+
1022
+ .mes-audio-wave__seek:disabled {
1023
+ cursor: default;
1024
+ }
1025
+
1026
+ .mes-audio-wave__seek::-webkit-slider-runnable-track {
1027
+ background: transparent;
1028
+ }
1029
+
1030
+ .mes-audio-wave__seek::-webkit-slider-thumb {
1031
+ -webkit-appearance: none;
1032
+ appearance: none;
1033
+ width: 1px;
1034
+ height: 100%;
1035
+ opacity: 0;
1036
+ }
1037
+
1038
+ .mes-audio-wave__seek::-moz-range-track {
1039
+ background: transparent;
1040
+ }
1041
+
1042
+ .mes-audio-wave__seek::-moz-range-thumb {
1043
+ width: 1px;
1044
+ height: 100%;
1045
+ border: 0;
1046
+ opacity: 0;
1047
+ }
1048
+
1049
+ .mes-audio-wave__seek:focus {
1050
+ outline: none;
1051
+ }
1052
+
1053
+ /* The input is transparent, so the focus ring has to render on the
1054
+ wrapper that actually has pixels. */
1055
+ .mes-audio-wave:has(.mes-audio-wave__seek:focus-visible) {
1056
+ outline: 2px solid rgb(255 255 255 / 0.6);
1057
+ outline-offset: 4px;
1058
+ border-radius: 4px;
1059
+ }
1060
+
1061
+ .mes-audio-wave--light:has(.mes-audio-wave__seek:focus-visible) {
1062
+ outline-color: rgb(4 4 3 / 0.6);
1063
+ }
@@ -141,11 +141,11 @@ export function createMockMessagingClient({
141
141
  })
142
142
  // Read/unread bookkeeping consults channel mute status; without a live
143
143
  // connection the real method throws, so report "not muted".
144
- channel.muteStatus = () => ({
144
+ channel.muteStatus = (() => ({
145
145
  muted: false,
146
146
  createdAt: null,
147
147
  expiresAt: null,
148
- })
148
+ })) as any
149
149
 
150
150
  // Neutralise the rest of the connection-dependent channel API that
151
151
  // stream-chat-react calls during the chat lifecycle. Each of these POSTs to
package/src/types.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import type {
2
- Logger,
3
2
  MessagingUser,
4
3
  StreamChatServiceConfig,
5
4
  } from '@linktr.ee/messaging-core'
@@ -454,7 +453,6 @@ export type ChannelViewPassthroughProps = Pick<
454
453
  | 'resolveOutbound'
455
454
  | 'showChannelInfo'
456
455
  | 'composerInput'
457
- | 'attachmentPreviewList'
458
456
  >
459
457
 
460
458
  /**
@@ -502,13 +500,6 @@ interface MessagingProviderBaseProps {
502
500
  user: MessagingUser | null
503
501
  capabilities?: MessagingCapabilities
504
502
  debug?: boolean
505
- /**
506
- * Optional sink for the package's own log output. Levels left undefined fall
507
- * back to console, which is also the default when the prop is omitted. In
508
- * apiKey mode it is forwarded to the underlying StreamChatService unless
509
- * `serviceConfig.logger` is set, which wins.
510
- */
511
- logger?: Logger
512
503
  }
513
504
 
514
505
  /**