@linktr.ee/messaging-react 3.12.4-rc-1784100747 → 3.12.4-rc-1784101349

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 (35) hide show
  1. package/dist/{Card-DSS88TWW.js → Card-CEcDWSUV.js} +16 -16
  2. package/dist/Card-CEcDWSUV.js.map +1 -0
  3. package/dist/{Card-CNST04Mf.js → Card-CNVnUwPO.js} +2 -2
  4. package/dist/{Card-CNST04Mf.js.map → Card-CNVnUwPO.js.map} +1 -1
  5. package/dist/{Card-WIKV3qOh.cjs → Card-Ce9FOfFE.cjs} +2 -2
  6. package/dist/{Card-WIKV3qOh.cjs.map → Card-Ce9FOfFE.cjs.map} +1 -1
  7. package/dist/Card-DzatAhX7.cjs +2 -0
  8. package/dist/Card-DzatAhX7.cjs.map +1 -0
  9. package/dist/{index-4V2hVQl1.js → index-CINy7e9F.js} +9 -9
  10. package/dist/index-CINy7e9F.js.map +1 -0
  11. package/dist/index-CuaKXN_X.cjs +2 -0
  12. package/dist/index-CuaKXN_X.cjs.map +1 -0
  13. package/dist/index.cjs +1 -1
  14. package/dist/index.js +1 -1
  15. package/package.json +2 -2
  16. package/src/components/AttachmentCard/AttachmentCard.stories.tsx +6 -2
  17. package/src/components/AttachmentCard/index.tsx +1 -1
  18. package/src/components/CustomMessage/LockedAttachment/LockedAttachment.stories.tsx +1 -1
  19. package/src/components/CustomMessage/LockedAttachment/components/_shared/MediaShell.tsx +1 -1
  20. package/src/components/CustomMessage/LockedAttachment/components/_shared/TextShell.tsx +1 -1
  21. package/src/components/CustomMessage/LockedAttachment/index.tsx +1 -1
  22. package/src/components/CustomMessage/MessageAttachmentConversations.stories.tsx +4 -1
  23. package/src/components/CustomMessage/StreamAttachmentMessage.stories.tsx +1 -1
  24. package/src/components/LinkAttachment/LinkAttachment.stories.tsx +1 -1
  25. package/src/components/LinkAttachment/components/_shared/CardShell.tsx +3 -3
  26. package/src/components/MediaMessage/MediaMessage.stories.tsx +74 -46
  27. package/src/components/MediaMessage/index.tsx +1 -1
  28. package/src/components/MessageAttachment/_shared/Bubble.tsx +3 -3
  29. package/src/components/MessageAttachment/stories/StoryTable.tsx +3 -3
  30. package/dist/Card-BG-imDyV.cjs +0 -2
  31. package/dist/Card-BG-imDyV.cjs.map +0 -1
  32. package/dist/Card-DSS88TWW.js.map +0 -1
  33. package/dist/index-4V2hVQl1.js.map +0 -1
  34. package/dist/index-6x72ZVb8.cjs +0 -2
  35. package/dist/index-6x72ZVb8.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-6x72ZVb8.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-CuaKXN_X.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.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-4V2hVQl1.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-CINy7e9F.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.12.4-rc-1784100747",
3
+ "version": "3.12.4-rc-1784101349",
4
4
  "description": "React messaging components built on messaging-core for web applications",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -50,7 +50,7 @@
50
50
  },
51
51
  "dependencies": {
52
52
  "@linktr.ee/component-library": "11.8.6",
53
- "@linktr.ee/messaging-core": "2.3.0-rc-1784100747",
53
+ "@linktr.ee/messaging-core": "2.3.0-rc-1784101349",
54
54
  "@phosphor-icons/react": "^2.1.10"
55
55
  },
56
56
  "devDependencies": {
@@ -17,7 +17,11 @@ export default meta
17
17
 
18
18
  const IMAGE_URL = '/image-thumbnail.jpg'
19
19
 
20
- const Template: StoryFn<ComponentProps> = (args) => <AttachmentCard {...args} />
20
+ const Template: StoryFn<ComponentProps> = (args) => (
21
+ <div className="w-[280px]">
22
+ <AttachmentCard {...args} />
23
+ </div>
24
+ )
21
25
 
22
26
  // Per-variant stories stay in Storybook for browsing/design review but are
23
27
  // individually covered by cells in AllVariants — skip in Chromatic.
@@ -216,7 +220,7 @@ export const AllVariants: StoryFn = () => {
216
220
  return (
217
221
  <div className="grid grid-cols-2 gap-6 p-6">
218
222
  {cards.map(({ label, props }) => (
219
- <div key={label} className="flex flex-col gap-2">
223
+ <div key={label} className="flex w-[280px] flex-col gap-2">
220
224
  <span className="text-xs text-stone">{label}</span>
221
225
  <AttachmentCard {...props} />
222
226
  </div>
@@ -56,7 +56,7 @@ const AttachmentCard: React.FC<AttachmentCardProps> = ({
56
56
  ref={rootRef}
57
57
  data-testid={dataTestId}
58
58
  className={classNames(
59
- 'relative w-[min(280px,100%)] select-none overflow-hidden rounded-[24px] shadow-[0_0_0_1px_rgba(0,0,0,0.04),0_4px_8px_rgba(0,0,0,0.06)]',
59
+ 'relative w-full max-w-[280px] select-none overflow-hidden rounded-[24px] shadow-[0_0_0_1px_rgba(0,0,0,0.04),0_4px_8px_rgba(0,0,0,0.06)]',
60
60
  isDark ? 'bg-[#1e2330]' : 'bg-white'
61
61
  )}
62
62
  >
@@ -59,7 +59,7 @@ const MatrixTableRow: React.FC<{
59
59
  const MatrixTableCell: React.FC<{
60
60
  isMine: boolean
61
61
  children: React.ReactNode
62
- }> = ({ children }) => <div>{children}</div>
62
+ }> = ({ children }) => <div className="w-[280px]">{children}</div>
63
63
 
64
64
  export const Text: StoryFn = () => {
65
65
  const [isUnlocking, setUnlocking] = useState(false)
@@ -24,7 +24,7 @@ const MediaShell: React.FC<MediaShellProps> = ({
24
24
  ref={rootRef}
25
25
  data-testid={dataTestId}
26
26
  className={classNames(
27
- 'relative w-[min(280px,100%)] select-none overflow-hidden rounded-md',
27
+ 'relative w-full max-w-[280px] select-none overflow-hidden rounded-md',
28
28
  variant === 'dark' ? 'bg-[#1e2330]' : 'bg-white',
29
29
  'shadow-[0_1px_2px_rgba(0,0,0,0.08)]'
30
30
  )}
@@ -14,7 +14,7 @@ const TextShell: React.FC<
14
14
  <div
15
15
  className={classNames(
16
16
  'message-locked-attachment-text',
17
- 'relative flex w-fit max-w-[min(280px,100%)] flex-col gap-1 rounded-[1.5rem] px-4 py-3',
17
+ 'relative flex w-fit max-w-[min(100%,280px)] flex-col gap-1 rounded-[1.5rem] px-4 py-3',
18
18
  'text-[0.875rem] leading-[1.3125rem] tracking-[0.14px]',
19
19
  isMine ? 'bg-[#1e2330] text-white' : 'bg-[#f2f1ef] text-black',
20
20
  'shadow-[0_1px_2px_rgba(0,0,0,0.08)]',
@@ -16,7 +16,7 @@ const MediaCardLazy = React.lazy(() => import('./components/Media/Card'))
16
16
 
17
17
  const LockedAttachmentFallback = () => (
18
18
  <div
19
- className="w-[min(280px,100%)] min-h-[200px] animate-pulse rounded-md bg-black/[0.06] shadow-[0_0_0_1px_rgba(0,0,0,0.04),0_1px_2px_rgba(0,0,0,0.04),0_8px_32px_rgba(0,0,0,0.1)]"
19
+ className="w-full max-w-[280px] min-h-[200px] animate-pulse rounded-md bg-black/[0.06] shadow-[0_0_0_1px_rgba(0,0,0,0.04),0_1px_2px_rgba(0,0,0,0.04),0_8px_32px_rgba(0,0,0,0.1)]"
20
20
  aria-hidden
21
21
  />
22
22
  )
@@ -88,7 +88,10 @@ const ChatRow: React.FC<{
88
88
  ) : null}
89
89
  </div>
90
90
  ) : null}
91
- <div className={role === 'sender' ? 'flex justify-end' : 'flex justify-start'}>
91
+ <div className={classNames(
92
+ 'w-[280px]',
93
+ role === 'sender' ? 'flex justify-end' : 'flex justify-start'
94
+ )}>
92
95
  {children}
93
96
  </div>
94
97
  </div>
@@ -44,7 +44,7 @@ const Bubbles: React.FC<{ isMyMessage: boolean; children: React.ReactNode }> = (
44
44
  : 'str-chat__message--other'
45
45
  )}
46
46
  >
47
- <div className="str-chat__message-inner">{children}</div>
47
+ <div className="str-chat__message-inner w-[280px]">{children}</div>
48
48
  </div>
49
49
  </div>
50
50
  </div>
@@ -220,7 +220,7 @@ export const LinkApps: StoryFn = () => (
220
220
  <tr key={label}>
221
221
  <RowLabel>{label}</RowLabel>
222
222
  {LINK_APPS.map((app) => (
223
- <td key={app.key} className="align-top">
223
+ <td key={app.key} className="w-[280px] align-top">
224
224
  {renderLinkAppCard(layout, state, app)}
225
225
  </td>
226
226
  ))}
@@ -38,7 +38,7 @@ export interface CardShellProps {
38
38
  }
39
39
 
40
40
  const SHELL_CLASS = classNames(
41
- 'relative block w-[min(280px,100%)] select-none overflow-hidden rounded-md',
41
+ 'relative block w-full max-w-[280px] select-none overflow-hidden rounded-md',
42
42
  // 1px hairline border that sits flush with the card chrome — matches
43
43
  // the messaging design system's "small border around link attachments"
44
44
  // treatment from the mobile spec. The drop shadow remains for depth.
@@ -47,8 +47,8 @@ const SHELL_CLASS = classNames(
47
47
  )
48
48
 
49
49
  /**
50
- * Outer chrome for every `LinkAttachment.*` card. Width is
51
- * `min(280px, 100%)`; 16px corner radius + shadow-400 from Figma.
50
+ * Outer chrome for every `LinkAttachment.*` card. Caps at 280px and shrinks
51
+ * with the message row; 16px corner radius + shadow-400 from Figma.
52
52
  */
53
53
  const CardShell: React.FC<CardShellProps> = ({
54
54
  variant,
@@ -138,6 +138,22 @@ const Table: React.FC<{ children: React.ReactNode }> = ({ children }) => (
138
138
  </div>
139
139
  )
140
140
 
141
+ /** Standalone card (Visitor / Creator / link shell) — give it a definite 280px box. */
142
+ const StoryCard: React.FC<{ children: React.ReactNode }> = ({ children }) => (
143
+ <div className="w-[280px]">{children}</div>
144
+ )
145
+
146
+ /**
147
+ * Full `MediaMessage` chrome includes avatar + the chat-list 1/6 open-side
148
+ * reserve. Pin the bubble column to 280px and clear that reserve so story
149
+ * cells show the designed card size instead of a squeezed remnant.
150
+ */
151
+ const StoryMessage: React.FC<{ children: React.ReactNode }> = ({ children }) => (
152
+ <div className="[&_.str-chat__message]:![padding-inline:0] [&_.str-chat__message-inner]:w-[280px]">
153
+ {children}
154
+ </div>
155
+ )
156
+
141
157
  const TableHead: React.FC<{ variants: readonly { label: string }[] }> = ({
142
158
  variants,
143
159
  }) => (
@@ -166,14 +182,16 @@ export const Attachment: StoryFn = () => (
166
182
  </td>
167
183
  {VARIANTS.map(({ label, attachment }) => (
168
184
  <td key={label} className="align-top">
169
- <MediaMessage
170
- isMyMessage={false}
171
- message={base({
172
- attachments: [
173
- attachment as MessageAttachment,
174
- ],
175
- })}
176
- />
185
+ <StoryMessage>
186
+ <MediaMessage
187
+ isMyMessage={false}
188
+ message={base({
189
+ attachments: [
190
+ attachment as MessageAttachment,
191
+ ],
192
+ })}
193
+ />
194
+ </StoryMessage>
177
195
  </td>
178
196
  ))}
179
197
  </tr>
@@ -183,14 +201,16 @@ export const Attachment: StoryFn = () => (
183
201
  </td>
184
202
  {VARIANTS.map(({ label, attachment }) => (
185
203
  <td key={label} className="align-top">
186
- <MediaMessage
187
- isMyMessage={true}
188
- message={base({
189
- attachments: [
190
- attachment as MessageAttachment,
191
- ],
192
- })}
193
- />
204
+ <StoryMessage>
205
+ <MediaMessage
206
+ isMyMessage={true}
207
+ message={base({
208
+ attachments: [
209
+ attachment as MessageAttachment,
210
+ ],
211
+ })}
212
+ />
213
+ </StoryMessage>
194
214
  </td>
195
215
  ))}
196
216
  </tr>
@@ -208,14 +228,16 @@ export const Links: StoryFn = () => (
208
228
  </td>
209
229
  {LINK_VARIANTS.map(({ label, attachment }) => (
210
230
  <td key={label} className="align-top">
211
- <MediaMessage
212
- isMyMessage={false}
213
- message={base({
214
- attachments: [
215
- attachment as MessageAttachment,
216
- ],
217
- })}
218
- />
231
+ <StoryMessage>
232
+ <MediaMessage
233
+ isMyMessage={false}
234
+ message={base({
235
+ attachments: [
236
+ attachment as MessageAttachment,
237
+ ],
238
+ })}
239
+ />
240
+ </StoryMessage>
219
241
  </td>
220
242
  ))}
221
243
  </tr>
@@ -225,14 +247,16 @@ export const Links: StoryFn = () => (
225
247
  </td>
226
248
  {LINK_VARIANTS.map(({ label, attachment }) => (
227
249
  <td key={label} className="align-top">
228
- <MediaMessage
229
- isMyMessage={true}
230
- message={base({
231
- attachments: [
232
- attachment as MessageAttachment,
233
- ],
234
- })}
235
- />
250
+ <StoryMessage>
251
+ <MediaMessage
252
+ isMyMessage={true}
253
+ message={base({
254
+ attachments: [
255
+ attachment as MessageAttachment,
256
+ ],
257
+ })}
258
+ />
259
+ </StoryMessage>
236
260
  </td>
237
261
  ))}
238
262
  </tr>
@@ -251,13 +275,15 @@ export const Compound: StoryFn = () => (
251
275
  </td>
252
276
  {VARIANTS.map(({ label, attachment }) => (
253
277
  <td key={label} className="align-top">
254
- <MediaMessage.Visitor
255
- message={base({
256
- attachments: [
257
- attachment as MessageAttachment,
258
- ],
259
- })}
260
- />
278
+ <StoryCard>
279
+ <MediaMessage.Visitor
280
+ message={base({
281
+ attachments: [
282
+ attachment as MessageAttachment,
283
+ ],
284
+ })}
285
+ />
286
+ </StoryCard>
261
287
  </td>
262
288
  ))}
263
289
  </tr>
@@ -267,13 +293,15 @@ export const Compound: StoryFn = () => (
267
293
  </td>
268
294
  {VARIANTS.map(({ label, attachment }) => (
269
295
  <td key={label} className="align-top">
270
- <MediaMessage.Creator
271
- message={base({
272
- attachments: [
273
- attachment as MessageAttachment,
274
- ],
275
- })}
276
- />
296
+ <StoryCard>
297
+ <MediaMessage.Creator
298
+ message={base({
299
+ attachments: [
300
+ attachment as MessageAttachment,
301
+ ],
302
+ })}
303
+ />
304
+ </StoryCard>
277
305
  </td>
278
306
  ))}
279
307
  </tr>
@@ -17,7 +17,7 @@ function formatBytes(bytes: number): string {
17
17
 
18
18
  function linkCardShellClass(isMyMessage: boolean) {
19
19
  const bg = isMyMessage ? 'bg-[#1e2330]' : 'bg-[#F3F3F1]'
20
- return `w-[min(280px,100%)] select-none overflow-hidden rounded-[24px] ${bg} shadow-[0_0_0_1px_rgba(0,0,0,0.04),0_4px_8px_rgba(0,0,0,0.06)]`
20
+ return `w-full max-w-[280px] select-none overflow-hidden rounded-[24px] ${bg} shadow-[0_0_0_1px_rgba(0,0,0,0.04),0_4px_8px_rgba(0,0,0,0.06)]`
21
21
  }
22
22
 
23
23
  function linkThumbnailBg(isMyMessage: boolean) {
@@ -132,12 +132,12 @@ const Bubble: React.FC<BubbleProps> = ({
132
132
  data-testid={dataTestId}
133
133
  data-group-position={groupPosition}
134
134
  className={classNames(
135
- // Width is min(280px, 100%) so cards cap at the design size and
136
- // shrink with the message row. The 8px / 16px inset matches
135
+ // Caps at 280px and shrinks with the message row so mweb padding
136
+ // can't force horizontal overflow. The 8px / 16px inset matches
137
137
  // `--str-chat__spacing-2 --str-chat__spacing-4` so attachments
138
138
  // share the same hit / negative-space rhythm as surrounding
139
139
  // `CustomMessage` text bubbles.
140
- 'relative w-[min(280px,100%)] overflow-hidden px-2 py-2',
140
+ 'relative w-full max-w-[280px] overflow-hidden px-2 py-2',
141
141
  cornerClasses,
142
142
  BUBBLE_BG_BY_VARIANT[variant],
143
143
  BUBBLE_TEXT_BY_VARIANT[variant],
@@ -51,9 +51,9 @@ export const StoryRow: React.FC<StoryRowProps> = ({
51
51
  }) => (
52
52
  <div className="grid grid-cols-[160px_minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)] items-start gap-6 py-4">
53
53
  <p className="text-xs font-medium text-black/55">{label}</p>
54
- <div>{composer ?? null}</div>
55
- <div>{sent}</div>
56
- <div>{received}</div>
54
+ <div className="w-[280px]">{composer ?? null}</div>
55
+ <div className="w-[280px]">{sent}</div>
56
+ <div className="w-[280px]">{received}</div>
57
57
  </div>
58
58
  )
59
59
 
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("@phosphor-icons/react"),h=require("react"),g=require("classnames"),v=require("./index-6x72ZVb8.cjs"),M=require("./LoadingDots-D9GGphgM.cjs"),I=({variant:t,title:s,placeholderTitle:n="Attachment title",mimeType:i,detail:a,statusBadge:r,action:o,icon:u,trailingAction:d})=>{const l=t==="dark",c=s||n,x=!s,f=u??v.renderTypeIcon(i,{className:g("size-5 shrink-0",l?"text-white/55":"text-black/55"),weight:"regular"});return e.jsxs("div",{className:"px-4 py-3",children:[e.jsxs("div",{className:"flex items-end gap-3",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[c.trim()!==""&&e.jsx("p",{className:g("truncate text-base font-medium leading-6",{"text-black/90":!l&&!x,"text-black/30":!l&&x,"text-white/30":l&&x,"text-white":l&&!x}),children:c}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[f,a!=null&&a!==""&&e.jsx("span",{className:g("text-xs font-medium",l?"text-white/55":"text-black/55"),children:a}),r]})]}),d&&e.jsx("div",{className:"shrink-0",children:d})]}),o]})},S=({paymentStatus:t,mimeType:s,isPlayable:n,isLocked:i})=>{const a=s?v.getSourceType(s):void 0,o=(n??(a==="video"||a==="audio"))&&!i?m.PlayIcon:t==="paid"?m.LockOpenIcon:m.LockSimpleIcon;return e.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:e.jsx("div",{className:g("flex size-12 items-center justify-center rounded-full bg-black/30 text-white",o===m.PlayIcon&&"group-hover:bg-black/40"),children:e.jsx(o,{className:"size-6",weight:"fill"})})})};function q(t){const s=v.getSourceType(t.mimeType);return s==="video"||s==="audio"}const A=({variant:t,gallery:s,title:n,showLocked:i,paymentStatus:a,topRight:r})=>{const[o,u]=h.useState(0),d=s.length,l=Math.min(o,d-1),c=s[l],x=q(c),f=v.optimizeMessagingAttachmentUrl(c.thumbnailUrl),p=k=>{k.stopPropagation(),u(y=>Math.max(0,y-1))},N=k=>{k.stopPropagation(),u(y=>Math.min(d-1,y+1))},b=l===0,j=l===d-1,w=t==="dark";return e.jsxs("div",{className:g("group relative overflow-hidden rounded-t-md",i?"aspect-[337/386]":void 0),children:[i?e.jsx("div",{className:g("absolute inset-0",w?"bg-white/10":"bg-black/5"),children:c.thumbnailUrl&&e.jsx("img",{src:f??c.thumbnailUrl,alt:"","aria-hidden":!0,draggable:!1,className:"absolute inset-0 h-full w-full scale-110 object-cover blur-[40px]"})}):e.jsx(v.AttachmentThumbnail,{mimeType:c.mimeType,sourceUrl:c.sourceUrl,thumbnailUrl:c.thumbnailUrl,title:n,variant:t,mediaPlayerProps:{autoPlay:!0}},l),i&&e.jsx(S,{paymentStatus:a,isPlayable:x,isLocked:i}),d>1&&e.jsxs(h.Fragment,{children:[e.jsx("button",{type:"button",onClick:p,disabled:b,"aria-label":"Previous item",className:g("absolute left-3 top-1/2 -translate-y-1/2 flex size-7 items-center justify-center rounded-full bg-black/30 text-white transition-opacity",b?"opacity-40":"hover:bg-black/40"),children:e.jsx(m.CaretLeftIcon,{className:"size-5",weight:"bold"})}),e.jsx("button",{type:"button",onClick:N,disabled:j,"aria-label":"Next item",className:g("absolute right-3 top-1/2 -translate-y-1/2 flex size-7 items-center justify-center rounded-full bg-black/30 text-white transition-opacity",j?"opacity-40":"hover:bg-black/40"),children:e.jsx(m.CaretRightIcon,{className:"size-5",weight:"bold"})}),e.jsx("div",{className:"pointer-events-none absolute bottom-10 left-1/2 flex size-8 -translate-x-1/2 items-center justify-center rounded-full bg-black/30",children:e.jsxs("span",{className:"text-xs font-medium leading-none text-white",children:[l+1,"/",d]})})]}),r&&e.jsx("div",{className:"pointer-events-auto absolute right-3 top-3 z-10",children:r})]})},O=({variant:t,mimeType:s,thumbnailUrl:n,title:i,source:a,showLocked:r,paymentStatus:o,topRight:u,containedImage:d=!1})=>{const l=r||a==null?void 0:a.sourceUrl,c=r?n:(a==null?void 0:a.thumbnailUrl)??n,x=v.optimizeMessagingAttachmentUrl(c),f=t==="dark";return e.jsxs("div",{className:"relative overflow-hidden rounded-t-md",children:[r?e.jsxs("div",{className:g("relative aspect-video overflow-hidden",f?"bg-white/10":"bg-black/5"),children:[c?e.jsx("img",{src:x??c,alt:"","aria-hidden":!0,draggable:!1,className:"absolute inset-0 h-full w-full scale-110 object-cover blur-[40px]"}):e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:v.renderTypeIcon(s,{className:f?"size-12 text-white/20":"size-12 text-black/20",weight:"regular"})}),e.jsx(S,{paymentStatus:o,mimeType:s,isLocked:r})]}):e.jsx(v.AttachmentThumbnail,{mimeType:s,sourceUrl:l,thumbnailUrl:c,title:i,variant:t,containedImage:d,mediaPlayerProps:l?{autoPlay:!0,loop:!0,controls:!0,muted:!1}:void 0}),u&&e.jsx("div",{className:"pointer-events-auto absolute right-3 top-3 z-10",children:u})]})},P=t=>t.length>=2,z=t=>e.jsx(m.ImagesIcon,{className:t==="dark"?"size-5 shrink-0 text-white/55":"size-5 shrink-0 text-black/55"}),U=({variant:t,gallery:s,title:n,showLocked:i,paymentStatus:a,mimeType:r,thumbnailUrl:o,source:u,containedImage:d,topRight:l})=>P(s)?e.jsx(A,{variant:t,gallery:s,title:n,showLocked:i,paymentStatus:a,topRight:l}):e.jsx(O,{variant:t,mimeType:r,thumbnailUrl:o,title:n,source:u,showLocked:i,paymentStatus:a,topRight:l,containedImage:d}),T=({variant:t,children:s,rootRef:n,"data-testid":i})=>e.jsx("div",{ref:n,"data-testid":i,className:g("relative w-[min(280px,100%)] select-none overflow-hidden rounded-md",t==="dark"?"bg-[#1e2330]":"bg-white","shadow-[0_1px_2px_rgba(0,0,0,0.08)]"),children:s}),C=({onToggle:t,isBusy:s,isPreviewVisible:n,children:i})=>t?e.jsx("div",{role:"button",tabIndex:s?-1:0,"aria-label":"Toggle preview","aria-busy":s,"aria-pressed":n,"aria-disabled":s||void 0,onClick:s?void 0:t,onKeyDown:a=>{s||a.target===a.currentTarget&&(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),t())},className:s?"block w-full text-left":"block w-full cursor-pointer text-left",children:i}):e.jsx(h.Fragment,{children:i});function R({isGallery:t,onFetchSource:s,onPreviewClick:n}){const[i,a]=h.useState(),[r,o]=h.useState(!1),[u,d]=h.useState(!1),l=h.useRef(!1),c=h.useCallback(async()=>{if(n==null||n(),r){o(!1);return}if(t){o(!0);return}if(i){o(!0);return}if(s&&!l.current){l.current=!0,d(!0);try{const f=await s();f&&(a(f),o(!0))}finally{l.current=!1,d(!1)}}},[r,t,i,n,s]),x=t||s!=null||n!=null?c:void 0;return{source:i,isPreviewVisible:r,isLoadingPreview:u,handleToggle:c,togglePreview:x}}function G({paymentStatus:t,onFetchSource:s,onUnlockClick:n}){const[i,a]=h.useState(),r=h.useRef(null),o=h.useRef(!1),u=h.useRef(s);u.current=s;const d=h.useCallback(async()=>{var c;if(!o.current){o.current=!0;try{const x=await((c=u.current)==null?void 0:c.call(u));x&&a(x)}finally{o.current=!1}}},[]),l=h.useCallback(()=>{t==="paid"?d():n==null||n()},[t,d,n]);return h.useEffect(()=>{if(!r.current||t!=="paid"||i!==void 0)return;const c=new IntersectionObserver(([x])=>{x.isIntersecting&&(d(),c.disconnect())},{threshold:1});return c.observe(r.current),()=>c.disconnect()},[t,i,d]),{source:i,cardRef:r,handleUnlockClick:l}}const D="mt-3 inline-flex h-10 w-full items-center justify-center gap-2 rounded-full bg-[#121110] px-4 text-sm font-medium leading-none text-white hover:bg-[#2a2928]",_=({isLocked:t,sourceUrl:s,redeemUrl:n,onUnlockClicked:i,onDownloadClicked:a,isUnlocking:r=!1})=>{if(t&&i!=null)return e.jsx("button",{type:"button",onClick:i,disabled:r,"aria-label":r?"Unlocking":"Unlock","aria-busy":r,title:r?"Unlocking":"Unlock",className:D,children:r?e.jsx(M.LoadingDots,{}):e.jsxs(h.Fragment,{children:[e.jsx(m.LockSimpleIcon,{className:"size-4",weight:"fill"}),"Unlock"]})});if(!t&&a!=null){const o=n??s;return o!=null?e.jsxs("a",{href:o,"aria-label":"Download",target:"_blank",rel:"noopener noreferrer",onClick:a,className:`${D} !text-white`,children:[e.jsx(m.DownloadSimpleIcon,{className:"size-4",weight:"bold"}),"Download"]}):e.jsxs("button",{type:"button",onClick:a,"aria-label":"Download",className:D,children:[e.jsx(m.DownloadSimpleIcon,{className:"size-4",weight:"bold"}),"Download"]})}return null},E=({title:t,mimeType:s="application/octet-stream",thumbnailUrl:n,detail:i,amountText:a,placeholderTitle:r,placeholderAmountText:o,gallery:u=[],onDismiss:d,onPreviewClick:l,onFetchSource:c,onEditClick:x})=>{const f=P(u),{source:p,isPreviewVisible:N,isLoadingPreview:b,togglePreview:j}=R({isGallery:f,onFetchSource:c,onPreviewClick:l}),w=!N,k=b,y=e.jsxs(h.Fragment,{children:[e.jsx("span",{className:"text-xs font-medium text-white/55",children:"•"}),e.jsx("span",{className:a?"text-xs font-medium text-white/55":"text-xs font-medium text-white/30",children:a||o})]}),L=d?e.jsx("button",{type:"button",onClick:V=>{V.stopPropagation(),d()},className:"flex size-6 items-center justify-center rounded-full bg-[#121110] text-white","aria-label":"Dismiss attachment",children:e.jsx(m.XIcon,{className:"size-3",weight:"bold"})}):void 0,B=x?e.jsx("button",{type:"button",onClick:x,"aria-label":"Edit attachment",className:"flex size-10 items-center justify-center rounded-full bg-white/10 text-white hover:bg-white/15",children:e.jsx(m.PencilSimpleIcon,{className:"size-5",weight:"regular"})}):void 0;return e.jsxs(T,{variant:"dark",children:[e.jsx(C,{onToggle:j,isBusy:k,isPreviewVisible:!w,children:e.jsx(U,{variant:"dark",gallery:u,title:t,showLocked:w,mimeType:s,thumbnailUrl:n,source:p,topRight:L})}),e.jsx(I,{variant:"dark",title:t,placeholderTitle:r,mimeType:s,detail:i,statusBadge:y,icon:f?z("dark"):void 0,trailingAction:B})]})},$=({title:t,mimeType:s="application/octet-stream",thumbnailUrl:n,detail:i,amountText:a,placeholderTitle:r,placeholderAmountText:o,gallery:u=[]})=>{const d=P(u),l=e.jsxs(h.Fragment,{children:[e.jsx("span",{className:"text-xs font-medium text-black/55",children:"•"}),e.jsx("span",{className:a?"text-xs font-medium text-black/55":"text-xs font-medium text-black/30",children:a||o})]});return e.jsxs(T,{variant:"light",children:[e.jsx(U,{variant:"light",gallery:u,title:t,showLocked:!0,mimeType:s,thumbnailUrl:n}),e.jsx(I,{variant:"light",title:t,placeholderTitle:r,mimeType:s,detail:i,statusBadge:l,icon:d?z("light"):void 0})]})},K=({title:t,mimeType:s="application/octet-stream",thumbnailUrl:n,detail:i,amountText:a,placeholderTitle:r,paymentStatus:o="pending",gallery:u=[],onPreviewClick:d,onFetchSource:l})=>{const c=P(u),{source:x,isPreviewVisible:f,isLoadingPreview:p,togglePreview:N}=R({isGallery:c,onFetchSource:l,onPreviewClick:d}),b=!f,j=p;return e.jsxs(T,{variant:"dark",children:[e.jsx(C,{onToggle:N,isBusy:j,isPreviewVisible:!b,children:e.jsx(U,{variant:"dark",gallery:u,title:t,showLocked:b,paymentStatus:o,mimeType:s,thumbnailUrl:n,source:x})}),e.jsx(I,{variant:"dark",title:t,placeholderTitle:r,mimeType:s,detail:i,statusBadge:e.jsx(M.PurchaseStatusBadge,{isMine:!0,paymentStatus:o,amountText:a}),icon:c?z("dark"):void 0})]})},X=({title:t,amountText:s,thumbnailUrl:n,mimeType:i="application/octet-stream",detail:a,gallery:r=[],onUnlockClick:o,onFetchSource:u,onDownloadClick:d,paymentStatus:l,isUnlocking:c=!1})=>{const x=P(r),{source:f,cardRef:p,handleUnlockClick:N}=G({paymentStatus:l,onFetchSource:u,onUnlockClick:o}),b=f==null?void 0:f.sourceUrl,j=f==null?void 0:f.redeemUrl,w=x?l!=="paid":b===void 0,k=v.getSourceType(i),y=x?void 0:b;return e.jsxs(T,{variant:"light",rootRef:p,"data-testid":"locked-attachment",children:[e.jsx(U,{variant:"light",gallery:r,title:t,showLocked:w,paymentStatus:l,mimeType:i,thumbnailUrl:n,source:f,containedImage:!w&&k==="document"}),e.jsx(I,{variant:"light",title:t,mimeType:i,detail:a,statusBadge:e.jsx(M.PurchaseStatusBadge,{isMine:!1,paymentStatus:l,amountText:s}),icon:x?z("light"):void 0,action:e.jsx(_,{isLocked:w,isUnlocking:c,sourceUrl:y,redeemUrl:j,onUnlockClicked:N,onDownloadClicked:d})})]})},F=t=>t.isDraft?e.jsx(E,{...t}):t.isPreview?e.jsx($,{...t}):t.isMine?e.jsx(K,{...t}):e.jsx(X,{...t});exports.default=F;
2
- //# sourceMappingURL=Card-BG-imDyV.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Card-BG-imDyV.cjs","sources":["../src/components/CustomMessage/LockedAttachment/components/_shared/CardBody.tsx","../src/components/CustomMessage/LockedAttachment/components/_shared/LockBadge.tsx","../src/components/CustomMessage/LockedAttachment/components/_shared/GalleryThumbnail.tsx","../src/components/CustomMessage/LockedAttachment/components/_shared/SingleThumbnail.tsx","../src/components/CustomMessage/LockedAttachment/components/_shared/CardThumbnail.tsx","../src/components/CustomMessage/LockedAttachment/components/_shared/MediaShell.tsx","../src/components/CustomMessage/LockedAttachment/components/_shared/PreviewToggle.tsx","../src/components/CustomMessage/LockedAttachment/components/_shared/usePreviewToggle.ts","../src/components/CustomMessage/LockedAttachment/components/_shared/useReceivedSource.ts","../src/components/CustomMessage/LockedAttachment/components/Media/CardActions.tsx","../src/components/CustomMessage/LockedAttachment/components/Media/Card.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport React from 'react'\n\nimport { renderTypeIcon } from '../../../../AttachmentCard'\n\nimport type { CardVariant } from './MediaShell'\n\nexport interface CardBodyProps {\n variant: CardVariant\n title?: string\n placeholderTitle?: string\n mimeType: string\n detail?: string\n statusBadge?: React.ReactNode\n action?: React.ReactNode\n /** Overrides the auto-detected type icon (used by Gallery to swap in an `Images` icon). */\n icon?: React.ReactNode\n /** Optional control rendered on the right of the title/status block (e.g. Composer edit pencil). */\n trailingAction?: React.ReactNode\n}\n\n/**\n * Title + status row layout shared by Composer and `LockedAttachment.Media`.\n * Layout matches the Figma `Container > Labels` group (16px h-padding, 12px v-padding,\n * 4px gap between title and status row, 4px gap inside status row).\n */\nconst CardBody: React.FC<CardBodyProps> = ({\n variant,\n title,\n placeholderTitle = 'Attachment title',\n mimeType,\n detail,\n statusBadge,\n action,\n icon,\n trailingAction,\n}) => {\n const isDark = variant === 'dark'\n const displayTitle = title || placeholderTitle\n const titleDimmed = !title\n\n const typeIcon =\n icon ??\n renderTypeIcon(mimeType, {\n className: classNames(\n 'size-5 shrink-0',\n isDark ? 'text-white/55' : 'text-black/55'\n ),\n weight: 'regular',\n })\n\n return (\n <div className=\"px-4 py-3\">\n <div className=\"flex items-end gap-3\">\n <div className=\"flex min-w-0 flex-1 flex-col gap-1\">\n {displayTitle.trim() !== '' && (\n <p\n className={classNames('truncate text-base font-medium leading-6', {\n 'text-black/90': !isDark && !titleDimmed,\n 'text-black/30': !isDark && titleDimmed,\n 'text-white/30': isDark && titleDimmed,\n 'text-white': isDark && !titleDimmed,\n })}\n >\n {displayTitle}\n </p>\n )}\n\n <div className=\"flex flex-wrap items-center gap-1\">\n {typeIcon}\n\n {detail != null && detail !== '' && (\n <span\n className={classNames(\n 'text-xs font-medium',\n isDark ? 'text-white/55' : 'text-black/55'\n )}\n >\n {detail}\n </span>\n )}\n\n {statusBadge}\n </div>\n </div>\n\n {trailingAction && <div className=\"shrink-0\">{trailingAction}</div>}\n </div>\n\n {action}\n </div>\n )\n}\n\nexport default CardBody\n","import { LockOpenIcon, LockSimpleIcon, PlayIcon } from '@phosphor-icons/react'\nimport classNames from 'classnames'\nimport React from 'react'\n\nimport { getSourceType } from '../../../../AttachmentCard'\nimport type { PaymentStatus } from '../../types'\n\nexport interface LockBadgeProps {\n paymentStatus?: PaymentStatus\n mimeType?: string\n /**\n * Overrides the `mimeType`-derived playable check. Lets a caller that\n * already knows per-item playability (e.g. `GalleryThumbnail`, checking a\n * carousel item's own mimeType rather than the card's single `mimeType`)\n * skip re-deriving it.\n */\n isPlayable?: boolean\n /** Whether the item is still locked. Play only ever shows once unlocked —\n * a locked item always shows the lock, even for otherwise-playable media. */\n isLocked: boolean\n}\n\n/**\n * Centered 48x48 lock badge that overlays the thumbnail of any locked attachment.\n * Uses `bg-black/30`. Stays `pointer-events-none` so clicks pass through to\n * the underlying player/toggle; the play state highlights via `group-hover`\n * (same `bg-black/40` as the gallery's prev/next arrows) — the ancestor\n * providing `group` must wrap the actual clickable/hoverable player area.\n *\n * For playable media (video/audio) that's unlocked, the badge shows a play\n * icon instead of a lock — matching the convention used by `GalleryThumbnail`.\n */\nexport const LockBadge: React.FC<LockBadgeProps> = ({\n paymentStatus,\n mimeType,\n isPlayable,\n isLocked,\n}) => {\n const sourceType = mimeType ? getSourceType(mimeType) : undefined\n const resolvedIsPlayable =\n isPlayable ?? (sourceType === 'video' || sourceType === 'audio')\n\n const Icon =\n resolvedIsPlayable && !isLocked\n ? PlayIcon\n : paymentStatus === 'paid'\n ? LockOpenIcon\n : LockSimpleIcon\n return (\n <div className=\"pointer-events-none absolute inset-0 flex items-center justify-center\">\n <div\n className={classNames(\n 'flex size-12 items-center justify-center rounded-full bg-black/30 text-white',\n Icon === PlayIcon && 'group-hover:bg-black/40'\n )}\n >\n <Icon className=\"size-6\" weight=\"fill\" />\n </div>\n </div>\n )\n}\n\nexport default LockBadge\n","import { CaretLeftIcon, CaretRightIcon } from '@phosphor-icons/react'\nimport classNames from 'classnames'\nimport React, { useState } from 'react'\n\nimport { optimizeMessagingAttachmentUrl } from '../../../../../utils/cdnImageUrl'\nimport { AttachmentThumbnail, getSourceType } from '../../../../AttachmentCard'\nimport type {\n LockedAttachmentGalleryItem,\n PaymentStatus,\n} from '../../types'\n\nimport { LockBadge } from './LockBadge'\nimport type { CardVariant } from './MediaShell'\n\nexport interface GalleryThumbnailProps {\n variant: CardVariant\n gallery: LockedAttachmentGalleryItem[]\n title?: string\n /** When true, all items are shown blurred + the locked/play badge is overlaid. */\n showLocked: boolean\n paymentStatus?: PaymentStatus\n /** Top-right slot (e.g. dismiss X on Composer). Rendered inside the thumbnail. */\n topRight?: React.ReactNode\n}\n\nfunction isPlayableItem(item: LockedAttachmentGalleryItem): boolean {\n const sourceType = getSourceType(item.mimeType)\n return sourceType === 'video' || sourceType === 'audio'\n}\n\n/**\n * Mixed-media carousel used by every LockedAttachment card when its `gallery`\n * prop has 2+ items. Matches the \"Gallery\" frames in the Figma design system:\n * 337/386 aspect ratio, prev/next caret buttons, a counter pill, and a center\n * lock / play indicator that swaps based on the current item.\n */\nconst GalleryThumbnail: React.FC<GalleryThumbnailProps> = ({\n variant,\n gallery,\n title,\n showLocked,\n paymentStatus,\n topRight,\n}) => {\n const [index, setIndex] = useState(0)\n const total = gallery.length\n const safeIndex = Math.min(index, total - 1)\n const current = gallery[safeIndex]\n const isVideoItem = isPlayableItem(current)\n const optimizedCurrentThumbnailUrl = optimizeMessagingAttachmentUrl(\n current.thumbnailUrl\n )\n\n // Stop propagation so arrow taps don't bubble up to the outer preview-toggle\n // wrapper on PreviewMediaCard / OwnMediaCard.\n const goPrev = (e: React.MouseEvent) => {\n e.stopPropagation()\n setIndex((i) => Math.max(0, i - 1))\n }\n const goNext = (e: React.MouseEvent) => {\n e.stopPropagation()\n setIndex((i) => Math.min(total - 1, i + 1))\n }\n const atStart = safeIndex === 0\n const atEnd = safeIndex === total - 1\n\n const isDark = variant === 'dark'\n\n // Locked + unlocked render entirely separate trees so the locked state\n // doesn't end up stacking a blurred `<img>` on top of an underlying\n // `AttachmentThumbnail` (whose `bg-white/10` poster shell otherwise\n // shows through as a visible horizontal seam).\n //\n // The locked placeholder is absolutely positioned, so it needs the fixed\n // 337/386 box for height; unlocked content (video, natural-sized image)\n // manages its own height and can expand/shrink per item.\n //\n // The locked branch uses `filter: blur` on a single full-size `<img>`\n // — not `backdrop-filter` — so the rounded corners are clipped\n // normally without any clip-path workarounds (see SingleThumbnail).\n return (\n <div\n className={classNames(\n 'group relative overflow-hidden rounded-t-md',\n showLocked ? 'aspect-[337/386]' : undefined\n )}\n >\n {showLocked ? (\n <div\n className={classNames(\n 'absolute inset-0',\n isDark ? 'bg-white/10' : 'bg-black/5'\n )}\n >\n {current.thumbnailUrl && (\n <img\n src={optimizedCurrentThumbnailUrl ?? current.thumbnailUrl}\n alt=\"\"\n aria-hidden\n draggable={false}\n // `scale-110` hides the fuzzy edge that `filter: blur` leaves\n // around the image bounds.\n className=\"absolute inset-0 h-full w-full scale-110 object-cover blur-[40px]\"\n />\n )}\n </div>\n ) : (\n <AttachmentThumbnail\n key={safeIndex}\n mimeType={current.mimeType}\n sourceUrl={current.sourceUrl}\n thumbnailUrl={current.thumbnailUrl}\n title={title}\n variant={variant}\n mediaPlayerProps={{ autoPlay: true }}\n />\n )}\n\n {/* LOCK while locked. Once unlocked, video/audio autoplays via\n `mediaPlayerProps` and MediaPlayer already has its own inline\n controls, so no separate Play affordance is shown. */}\n {showLocked && (\n <LockBadge\n paymentStatus={paymentStatus}\n isPlayable={isVideoItem}\n isLocked={showLocked}\n />\n )}\n\n {total > 1 && (\n <React.Fragment>\n <button\n type=\"button\"\n onClick={goPrev}\n disabled={atStart}\n aria-label=\"Previous item\"\n className={classNames(\n 'absolute left-3 top-1/2 -translate-y-1/2 flex size-7 items-center justify-center rounded-full bg-black/30 text-white transition-opacity',\n atStart ? 'opacity-40' : 'hover:bg-black/40'\n )}\n >\n <CaretLeftIcon className=\"size-5\" weight=\"bold\" />\n </button>\n <button\n type=\"button\"\n onClick={goNext}\n disabled={atEnd}\n aria-label=\"Next item\"\n className={classNames(\n 'absolute right-3 top-1/2 -translate-y-1/2 flex size-7 items-center justify-center rounded-full bg-black/30 text-white transition-opacity',\n atEnd ? 'opacity-40' : 'hover:bg-black/40'\n )}\n >\n <CaretRightIcon className=\"size-5\" weight=\"bold\" />\n </button>\n\n <div className=\"pointer-events-none absolute bottom-10 left-1/2 flex size-8 -translate-x-1/2 items-center justify-center rounded-full bg-black/30\">\n <span className=\"text-xs font-medium leading-none text-white\">\n {safeIndex + 1}/{total}\n </span>\n </div>\n </React.Fragment>\n )}\n\n {topRight && (\n <div className=\"pointer-events-auto absolute right-3 top-3 z-10\">\n {topRight}\n </div>\n )}\n </div>\n )\n}\n\nexport default GalleryThumbnail\n","import classNames from 'classnames'\nimport React from 'react'\n\nimport { optimizeMessagingAttachmentUrl } from '../../../../../utils/cdnImageUrl'\nimport {\n AttachmentThumbnail,\n renderTypeIcon,\n} from '../../../../AttachmentCard'\nimport type { LockedAttachmentSource, PaymentStatus } from '../../types'\n\nimport { LockBadge } from './LockBadge'\nimport type { CardVariant } from './MediaShell'\n\nexport interface SingleThumbnailProps {\n variant: CardVariant\n mimeType: string\n thumbnailUrl?: string\n title?: string\n /**\n * When provided, the underlying source is shown unblurred (preview / unlocked state).\n * When undefined, the thumbnail is treated as locked: blurred with a central lock badge.\n */\n source?: LockedAttachmentSource\n /**\n * Forces the locked appearance even when a source is provided. Used for the\n * Composer card where the locked treatment is the default and the user toggles\n * a preview in place.\n */\n showLocked: boolean\n paymentStatus?: PaymentStatus\n /** Top-right overlay (e.g. dismiss X on Composer). Rendered inside the thumbnail. */\n topRight?: React.ReactNode\n /** When true, renders the unlocked image with aspect-video + object-contain. */\n containedImage?: boolean\n}\n\n/**\n * Renders the 180px-tall media area for a LockedAttachment card.\n * Handles three visual states:\n * - locked: blurred thumbnail + centered 48px lock badge\n * - preview/paid: clear thumbnail (the underlying source)\n * - empty: type-icon placeholder\n */\nconst SingleThumbnail: React.FC<SingleThumbnailProps> = ({\n variant,\n mimeType,\n thumbnailUrl,\n title,\n source,\n showLocked,\n paymentStatus,\n topRight,\n containedImage = false,\n}) => {\n const effectiveSourceUrl = showLocked ? undefined : source?.sourceUrl\n const effectiveThumbnailUrl = showLocked\n ? thumbnailUrl\n : (source?.thumbnailUrl ?? thumbnailUrl)\n const optimizedThumbnailUrl = optimizeMessagingAttachmentUrl(\n effectiveThumbnailUrl\n )\n\n const isDark = variant === 'dark'\n\n // Locked + unlocked render entirely separate trees so the locked state\n // doesn't end up stacking a blurred `<img>` on top of an underlying\n // `AttachmentThumbnail` (whose `bg-white/10` poster shell otherwise\n // shows through as a visible horizontal seam at the 16:9 boundary).\n //\n // The locked branch uses `filter: blur` on a single full-size `<img>`\n // — not `backdrop-filter` — because `backdrop-filter` paints in its\n // own compositing layer that escapes ancestor `overflow: hidden` on\n // Chrome/Safari and flattens the card's top corners. `filter` is\n // clipped normally, so the rounded corners stay round without any\n // clip-path workarounds.\n return (\n <div className=\"relative overflow-hidden rounded-t-md\">\n {showLocked ? (\n <div\n className={classNames(\n 'relative aspect-video overflow-hidden',\n isDark ? 'bg-white/10' : 'bg-black/5'\n )}\n >\n {effectiveThumbnailUrl ? (\n <img\n src={optimizedThumbnailUrl ?? effectiveThumbnailUrl}\n alt=\"\"\n aria-hidden\n draggable={false}\n // `scale-110` hides the fuzzy semi-transparent edge that\n // `filter: blur` leaves around the image bounds.\n className=\"absolute inset-0 h-full w-full scale-110 object-cover blur-[40px]\"\n />\n ) : (\n <div className=\"absolute inset-0 flex items-center justify-center\">\n {renderTypeIcon(mimeType, {\n className: isDark\n ? 'size-12 text-white/20'\n : 'size-12 text-black/20',\n weight: 'regular',\n })}\n </div>\n )}\n <LockBadge\n paymentStatus={paymentStatus}\n mimeType={mimeType}\n isLocked={showLocked}\n />\n </div>\n ) : (\n <AttachmentThumbnail\n mimeType={mimeType}\n sourceUrl={effectiveSourceUrl}\n thumbnailUrl={effectiveThumbnailUrl}\n title={title}\n variant={variant}\n containedImage={containedImage}\n mediaPlayerProps={\n effectiveSourceUrl\n ? { autoPlay: true, loop: true, controls: true, muted: false }\n : undefined\n }\n />\n )}\n\n {topRight && (\n <div className=\"pointer-events-auto absolute right-3 top-3 z-10\">\n {topRight}\n </div>\n )}\n </div>\n )\n}\n\nexport default SingleThumbnail\n","import { ImagesIcon } from '@phosphor-icons/react'\nimport type React from 'react'\n\nimport type {\n LockedAttachmentGalleryItem,\n LockedAttachmentSource,\n PaymentStatus,\n} from '../../types'\n\nimport GalleryThumbnail from './GalleryThumbnail'\nimport type { CardVariant } from './MediaShell'\nimport SingleThumbnail from './SingleThumbnail'\n\nexport interface CardThumbnailProps {\n variant: CardVariant\n gallery: LockedAttachmentGalleryItem[]\n title?: string\n showLocked: boolean\n paymentStatus?: PaymentStatus\n /** Single-asset props — ignored when the card renders as a gallery. */\n mimeType: string\n thumbnailUrl?: string\n source?: LockedAttachmentSource\n containedImage?: boolean\n /** Top-right overlay (e.g. Composer dismiss X). Rendered inside the thumbnail. */\n topRight?: React.ReactNode\n}\n\n/** True when the card should render as a mixed-media carousel (2+ items). */\nexport const isGalleryCard = (\n gallery: LockedAttachmentGalleryItem[]\n): boolean => gallery.length >= 2\n\n/**\n * The body-row icon a card shows when it renders as a gallery — `CardBody`\n * otherwise auto-detects the icon from `mimeType`. Returned as a ready node so\n * every card shares the same size/tone treatment.\n */\nexport const galleryBodyIcon = (\n variant: CardVariant\n): React.ReactNode => (\n <ImagesIcon\n className={\n variant === 'dark'\n ? 'size-5 shrink-0 text-white/55'\n : 'size-5 shrink-0 text-black/55'\n }\n />\n)\n\n/**\n * Owns the single-vs-gallery thumbnail decision shared by Composer /\n * `LockedAttachment.Media` cards: renders `GalleryThumbnail` for a 2+ item `gallery`,\n * else `SingleThumbnail` for the single asset. Callers pass the superset of\n * props; the unused half is ignored by whichever branch renders.\n */\nconst CardThumbnail: React.FC<CardThumbnailProps> = ({\n variant,\n gallery,\n title,\n showLocked,\n paymentStatus,\n mimeType,\n thumbnailUrl,\n source,\n containedImage,\n topRight,\n}) =>\n isGalleryCard(gallery) ? (\n <GalleryThumbnail\n variant={variant}\n gallery={gallery}\n title={title}\n showLocked={showLocked}\n paymentStatus={paymentStatus}\n topRight={topRight}\n />\n ) : (\n <SingleThumbnail\n variant={variant}\n mimeType={mimeType}\n thumbnailUrl={thumbnailUrl}\n title={title}\n source={source}\n showLocked={showLocked}\n paymentStatus={paymentStatus}\n topRight={topRight}\n containedImage={containedImage}\n />\n )\n\nexport default CardThumbnail\n","import classNames from 'classnames'\nimport React from 'react'\n\nexport type CardVariant = 'dark' | 'light'\n\nexport interface MediaShellProps {\n variant: CardVariant\n children: React.ReactNode\n rootRef?: React.Ref<HTMLDivElement>\n 'data-testid'?: string\n}\n\n/**\n * Outer chrome for every LockedAttachment card.\n * Mirrors the 16px radius treatment from the Figma design system.\n */\nconst MediaShell: React.FC<MediaShellProps> = ({\n variant,\n children,\n rootRef,\n 'data-testid': dataTestId,\n}) => (\n <div\n ref={rootRef}\n data-testid={dataTestId}\n className={classNames(\n 'relative w-[min(280px,100%)] select-none overflow-hidden rounded-md',\n variant === 'dark' ? 'bg-[#1e2330]' : 'bg-white',\n 'shadow-[0_1px_2px_rgba(0,0,0,0.08)]'\n )}\n >\n {children}\n </div>\n)\n\nexport default MediaShell\n","import React from 'react'\n\nexport interface PreviewToggleProps {\n /** Toggles the preview; omit to render `children` with no wrapper at all (nothing to toggle). */\n onToggle: (() => void | Promise<void>) | undefined\n isBusy: boolean\n isPreviewVisible: boolean\n children: React.ReactNode\n}\n\n/**\n * Makes a locked thumbnail clickable to toggle its preview. Uses a\n * `role=\"button\"` div rather than a native `<button>` because the thumbnail\n * it wraps can itself contain interactive children (gallery carousel arrows,\n * a Composer dismiss X) — nesting a real `<button>` around those would\n * produce invalid, inaccessible nested-interactive-element markup.\n */\nconst PreviewToggle: React.FC<PreviewToggleProps> = ({\n onToggle,\n isBusy,\n isPreviewVisible,\n children,\n}) => {\n if (!onToggle) return <React.Fragment>{children}</React.Fragment>\n\n return (\n <div\n role=\"button\"\n tabIndex={isBusy ? -1 : 0}\n aria-label=\"Toggle preview\"\n aria-busy={isBusy}\n aria-pressed={isPreviewVisible}\n aria-disabled={isBusy || undefined}\n onClick={isBusy ? undefined : onToggle}\n onKeyDown={(e) => {\n if (isBusy) return\n // Only handle keys that originate on the wrapper itself, not on\n // inner interactive elements (dismiss X, carousel arrows). Without\n // this guard, pressing Enter/Space on a focused child would bubble\n // up and toggle the preview in addition to activating the child.\n if (e.target !== e.currentTarget) return\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n void onToggle()\n }\n }}\n className={\n !isBusy\n ? 'block w-full cursor-pointer text-left'\n : 'block w-full text-left'\n }\n >\n {children}\n </div>\n )\n}\n\nexport default PreviewToggle\n","import { useCallback, useRef, useState } from 'react'\n\nimport type { LockedAttachmentSource } from '../../types'\n\nexport interface UsePreviewToggleOptions {\n /** Gallery items carry their own per-item sources on the `gallery` prop already, so toggling skips the async fetch entirely. */\n isGallery: boolean\n /**\n * Lazily loads the underlying source; the resolved value is cached in\n * `source` and reused on subsequent toggles.\n */\n onFetchSource?: () => Promise<LockedAttachmentSource | void>\n /** Fired on every toggle tap, before any visibility/fetch logic runs. */\n onPreviewClick?: () => void\n}\n\nexport interface UsePreviewToggleResult {\n source: LockedAttachmentSource | undefined\n isPreviewVisible: boolean\n isLoadingPreview: boolean\n handleToggle: () => Promise<void>\n /**\n * `handleToggle` when the card can actually be previewed (gallery, or a\n * fetch/click handler is wired), else `undefined` — pass straight to\n * `PreviewToggle.onToggle` so a non-previewable card renders no\n * toggle affordance.\n */\n togglePreview: (() => Promise<void>) | undefined\n}\n\n/**\n * Shared preview-toggle state for Composer/Media isMine: flips a locked thumbnail to\n * its unlocked preview, lazily fetching and caching the source on first\n * reveal. Media !isMine doesn't use this — it fetches on scroll-into-view/paid\n * instead of on a toggle tap.\n */\nexport function usePreviewToggle({\n isGallery,\n onFetchSource,\n onPreviewClick,\n}: UsePreviewToggleOptions): UsePreviewToggleResult {\n const [source, setSource] = useState<LockedAttachmentSource | undefined>()\n const [isPreviewVisible, setIsPreviewVisible] = useState(false)\n const [isLoadingPreview, setIsLoadingPreview] = useState(false)\n const fetchingRef = useRef(false)\n\n const handleToggle = useCallback(async () => {\n onPreviewClick?.()\n if (isPreviewVisible) {\n setIsPreviewVisible(false)\n return\n }\n if (isGallery) {\n setIsPreviewVisible(true)\n return\n }\n if (source) {\n setIsPreviewVisible(true)\n return\n }\n if (!onFetchSource) return\n if (fetchingRef.current) return\n fetchingRef.current = true\n setIsLoadingPreview(true)\n try {\n const result = await onFetchSource()\n if (result) {\n setSource(result)\n setIsPreviewVisible(true)\n }\n } finally {\n fetchingRef.current = false\n setIsLoadingPreview(false)\n }\n }, [isPreviewVisible, isGallery, source, onPreviewClick, onFetchSource])\n\n const togglePreview =\n isGallery || onFetchSource != null || onPreviewClick != null\n ? handleToggle\n : undefined\n\n return {\n source,\n isPreviewVisible,\n isLoadingPreview,\n handleToggle,\n togglePreview,\n }\n}\n","import { useCallback, useEffect, useRef, useState } from 'react'\n\nimport type {\n FetchSourceHandler,\n LockedAttachmentSource,\n PaymentStatus,\n} from '../../types'\n\nexport interface UseReceivedSourceOptions {\n paymentStatus?: PaymentStatus\n onFetchSource?: FetchSourceHandler\n /** Called on Unlock click while the card is still unpaid (opens checkout). */\n onUnlockClick?: () => void\n}\n\nexport interface UseReceivedSourceResult {\n source: LockedAttachmentSource | undefined\n /** Attach to the card root so the paid-source auto-fetch can observe it. */\n cardRef: React.RefObject<HTMLDivElement>\n /** Fetches the source when already paid, else defers to `onUnlockClick`. */\n handleUnlockClick: () => void\n}\n\n/**\n * Media !isMine's source-reveal logic: unlike Composer/Media isMine's\n * tap-to-toggle (`usePreviewToggle`), the recipient's card reveals its source\n * by fetching once — on click when already paid, or automatically the first\n * time a paid card scrolls fully into view. The fetch is guarded so it runs\n * at most once in flight.\n */\nexport function useReceivedSource({\n paymentStatus,\n onFetchSource,\n onUnlockClick,\n}: UseReceivedSourceOptions): UseReceivedSourceResult {\n const [source, setSource] = useState<LockedAttachmentSource | undefined>()\n\n const cardRef = useRef<HTMLDivElement>(null)\n const fetchingRef = useRef(false)\n\n const onFetchSourceRef = useRef(onFetchSource)\n onFetchSourceRef.current = onFetchSource\n\n const fetchSource = useCallback(async (): Promise<void> => {\n if (fetchingRef.current) return\n fetchingRef.current = true\n try {\n const result = await onFetchSourceRef.current?.()\n if (result) setSource(result)\n } finally {\n fetchingRef.current = false\n }\n }, [])\n\n const handleUnlockClick = useCallback(() => {\n if (paymentStatus === 'paid') {\n void fetchSource()\n } else {\n onUnlockClick?.()\n }\n }, [paymentStatus, fetchSource, onUnlockClick])\n\n // Auto-fetch the source once the paid card scrolls into view.\n useEffect(() => {\n if (!cardRef.current) return\n if (paymentStatus !== 'paid' || source !== undefined) return\n\n const observer = new IntersectionObserver(\n ([entry]) => {\n if (entry.isIntersecting) {\n void fetchSource()\n observer.disconnect()\n }\n },\n { threshold: 1.0 }\n )\n\n observer.observe(cardRef.current)\n return () => observer.disconnect()\n }, [paymentStatus, source, fetchSource])\n\n return { source, cardRef, handleUnlockClick }\n}\n","import { DownloadSimpleIcon, LockSimpleIcon } from '@phosphor-icons/react'\nimport React from 'react'\n\nimport LoadingDots from '../_shared/LoadingDots'\n\nexport interface ReceivedCardActionsProps {\n /** Whether the card is currently locked. Drives which CTA we render. */\n isLocked: boolean\n /**\n * When unlocked, the URL used as the Download link's `href` (opens in a new\n * tab). When omitted, the Download CTA falls back to a plain `<button>`\n * that just calls `onDownloadClicked` — useful for galleries where the\n * single-source URL doesn't exist.\n */\n sourceUrl?: string\n /** Optional alternate href that takes precedence over `sourceUrl`. */\n redeemUrl?: string\n onUnlockClicked?: () => void\n onDownloadClicked?: () => void\n isUnlocking?: boolean\n}\n\nconst buttonClass =\n 'mt-3 inline-flex h-10 w-full items-center justify-center gap-2 rounded-full bg-[#121110] px-4 text-sm font-medium leading-none text-white hover:bg-[#2a2928]'\n\n/**\n * Renders the primary CTA below the body of a Received card.\n * - Locked + onUnlockClicked → \"Unlock\" button\n * - Unlocked + onDownloadClicked + (redeemUrl || sourceUrl) → \"Download\" link\n * - Unlocked + onDownloadClicked + no URL → \"Download\" button (e.g. gallery)\n * Otherwise renders nothing.\n */\nconst ReceivedCardActions: React.FC<ReceivedCardActionsProps> = ({\n isLocked,\n sourceUrl,\n redeemUrl,\n onUnlockClicked,\n onDownloadClicked,\n isUnlocking = false,\n}) => {\n if (isLocked && onUnlockClicked != null) {\n return (\n <button\n type=\"button\"\n onClick={onUnlockClicked}\n disabled={isUnlocking}\n aria-label={isUnlocking ? 'Unlocking' : 'Unlock'}\n aria-busy={isUnlocking}\n title={isUnlocking ? 'Unlocking' : 'Unlock'}\n className={buttonClass}\n >\n {isUnlocking ? (\n <LoadingDots />\n ) : (\n <React.Fragment>\n <LockSimpleIcon className=\"size-4\" weight=\"fill\" />\n Unlock\n </React.Fragment>\n )}\n </button>\n )\n }\n\n if (!isLocked && onDownloadClicked != null) {\n const href = redeemUrl ?? sourceUrl\n if (href != null) {\n return (\n <a\n href={href}\n aria-label=\"Download\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n onClick={onDownloadClicked}\n className={`${buttonClass} !text-white`}\n >\n <DownloadSimpleIcon className=\"size-4\" weight=\"bold\" />\n Download\n </a>\n )\n }\n\n return (\n <button\n type=\"button\"\n onClick={onDownloadClicked}\n aria-label=\"Download\"\n className={buttonClass}\n >\n <DownloadSimpleIcon className=\"size-4\" weight=\"bold\" />\n Download\n </button>\n )\n }\n\n return null\n}\n\nexport default ReceivedCardActions\n","import { PencilSimpleIcon, XIcon } from '@phosphor-icons/react'\nimport React from 'react'\n\nimport { getSourceType } from '../../../../AttachmentCard'\nimport CardBody from '../_shared/CardBody'\nimport CardThumbnail, {\n galleryBodyIcon,\n isGalleryCard,\n} from '../_shared/CardThumbnail'\nimport MediaShell from '../_shared/MediaShell'\nimport PreviewToggle from '../_shared/PreviewToggle'\nimport PurchaseStatusBadge from '../_shared/PurchaseStatusBadge'\nimport { usePreviewToggle } from '../_shared/usePreviewToggle'\nimport { useReceivedSource } from '../_shared/useReceivedSource'\n\nimport ReceivedCardActions from './CardActions'\nimport type {\n MediaCardDraftProps,\n MediaCardOtherProps,\n MediaCardOwnProps,\n MediaCardPreviewProps,\n MediaCardProps,\n} from './types'\n\nexport type { MediaCardProps } from './types'\n\n/**\n * Media card while still drafting — the locked thumbnail (single or gallery)\n * the composer taps to preview the attachment they're about to send, plus\n * the title/price body with optional dismiss X and edit pencil.\n */\nconst DraftMediaCard: React.FC<MediaCardDraftProps> = ({\n title,\n mimeType = 'application/octet-stream',\n thumbnailUrl,\n detail,\n amountText,\n placeholderTitle,\n placeholderAmountText,\n gallery = [],\n onDismiss,\n onPreviewClick,\n onFetchSource,\n onEditClick,\n}) => {\n const isGallery = isGalleryCard(gallery)\n\n // Gallery is always previewable in the composer because each item's source\n // is already provided up-front via `gallery[*].sourceUrl`.\n const { source, isPreviewVisible, isLoadingPreview, togglePreview } =\n usePreviewToggle({ isGallery, onFetchSource, onPreviewClick })\n\n const showLocked = !isPreviewVisible\n const isBusy = isLoadingPreview\n\n const statusBadge = (\n <React.Fragment>\n <span className=\"text-xs font-medium text-white/55\">&bull;</span>\n <span\n className={\n amountText\n ? 'text-xs font-medium text-white/55'\n : 'text-xs font-medium text-white/30'\n }\n >\n {amountText || placeholderAmountText}\n </span>\n </React.Fragment>\n )\n\n const dismissButton = onDismiss ? (\n <button\n type=\"button\"\n onClick={(e) => {\n // Stop the click from bubbling up into the outer preview-toggle\n // wrapper when both are wired up at the same time.\n e.stopPropagation()\n onDismiss()\n }}\n className=\"flex size-6 items-center justify-center rounded-full bg-[#121110] text-white\"\n aria-label=\"Dismiss attachment\"\n >\n <XIcon className=\"size-3\" weight=\"bold\" />\n </button>\n ) : undefined\n\n const editButton = onEditClick ? (\n <button\n type=\"button\"\n onClick={onEditClick}\n aria-label=\"Edit attachment\"\n className=\"flex size-10 items-center justify-center rounded-full bg-white/10 text-white hover:bg-white/15\"\n >\n <PencilSimpleIcon className=\"size-5\" weight=\"regular\" />\n </button>\n ) : undefined\n\n return (\n <MediaShell variant=\"dark\">\n <PreviewToggle\n onToggle={togglePreview}\n isBusy={isBusy}\n isPreviewVisible={!showLocked}\n >\n <CardThumbnail\n variant=\"dark\"\n gallery={gallery}\n title={title}\n showLocked={showLocked}\n mimeType={mimeType}\n thumbnailUrl={thumbnailUrl}\n source={source}\n topRight={dismissButton}\n />\n </PreviewToggle>\n\n <CardBody\n variant=\"dark\"\n title={title}\n placeholderTitle={placeholderTitle}\n mimeType={mimeType}\n detail={detail}\n statusBadge={statusBadge}\n icon={isGallery ? galleryBodyIcon('dark') : undefined}\n trailingAction={editButton}\n />\n </MediaShell>\n )\n}\n\n/**\n * Static mockup of what the recipient will see before purchase — always\n * locked/blurred (the lock badge renders from `showLocked` alone, no toggle\n * wiring needed), no interactivity, no real content revealed.\n */\nconst PreviewMediaCard: React.FC<MediaCardPreviewProps> = ({\n title,\n mimeType = 'application/octet-stream',\n thumbnailUrl,\n detail,\n amountText,\n placeholderTitle,\n placeholderAmountText,\n gallery = [],\n}) => {\n const isGallery = isGalleryCard(gallery)\n\n const statusBadge = (\n <React.Fragment>\n <span className=\"text-xs font-medium text-black/55\">&bull;</span>\n <span\n className={\n amountText\n ? 'text-xs font-medium text-black/55'\n : 'text-xs font-medium text-black/30'\n }\n >\n {amountText || placeholderAmountText}\n </span>\n </React.Fragment>\n )\n\n return (\n <MediaShell variant=\"light\">\n <CardThumbnail\n variant=\"light\"\n gallery={gallery}\n title={title}\n showLocked\n mimeType={mimeType}\n thumbnailUrl={thumbnailUrl}\n />\n\n <CardBody\n variant=\"light\"\n title={title}\n placeholderTitle={placeholderTitle}\n mimeType={mimeType}\n detail={detail}\n statusBadge={statusBadge}\n icon={isGallery ? galleryBodyIcon('light') : undefined}\n />\n </MediaShell>\n )\n}\n/**\n * The sender's ('mine') view of a paid media attachment: the locked\n * thumbnail (single or gallery) they can tap to preview their own\n * attachment, plus the title/purchase-status body.\n */\nconst OwnMediaCard: React.FC<MediaCardOwnProps> = ({\n title,\n mimeType = 'application/octet-stream',\n thumbnailUrl,\n detail,\n amountText,\n placeholderTitle,\n paymentStatus = 'pending',\n gallery = [],\n onPreviewClick,\n onFetchSource,\n}) => {\n const isGallery = isGalleryCard(gallery)\n\n // Gallery is always previewable for the sender because each item's source\n // is already provided up-front via `gallery[*].sourceUrl`.\n const { source, isPreviewVisible, isLoadingPreview, togglePreview } =\n usePreviewToggle({ isGallery, onFetchSource, onPreviewClick })\n\n const showLocked = !isPreviewVisible\n const isBusy = isLoadingPreview\n\n return (\n <MediaShell variant=\"dark\">\n <PreviewToggle\n onToggle={togglePreview}\n isBusy={isBusy}\n isPreviewVisible={!showLocked}\n >\n <CardThumbnail\n variant=\"dark\"\n gallery={gallery}\n title={title}\n showLocked={showLocked}\n paymentStatus={paymentStatus}\n mimeType={mimeType}\n thumbnailUrl={thumbnailUrl}\n source={source}\n />\n </PreviewToggle>\n\n <CardBody\n variant=\"dark\"\n title={title}\n placeholderTitle={placeholderTitle}\n mimeType={mimeType}\n detail={detail}\n statusBadge={\n <PurchaseStatusBadge\n isMine={true}\n paymentStatus={paymentStatus}\n amountText={amountText}\n />\n }\n icon={isGallery ? galleryBodyIcon('dark') : undefined}\n />\n </MediaShell>\n )\n}\n\n/**\n * The recipient's ('other') view of a paid media attachment: the locked\n * thumbnail (single or gallery) with an Unlock/Download CTA. The source is\n * revealed by fetching once — on click when already paid, or automatically\n * the first time a paid card scrolls into view.\n */\nconst OtherMediaCard: React.FC<MediaCardOtherProps> = ({\n title,\n amountText,\n thumbnailUrl,\n mimeType = 'application/octet-stream',\n detail,\n gallery = [],\n onUnlockClick,\n onFetchSource,\n onDownloadClick,\n paymentStatus,\n isUnlocking = false,\n}) => {\n const isGallery = isGalleryCard(gallery)\n\n const { source, cardRef, handleUnlockClick } = useReceivedSource({\n paymentStatus,\n onFetchSource,\n onUnlockClick,\n })\n\n const effectiveSourceUrl = source?.sourceUrl\n const effectiveRedeemUrl = source?.redeemUrl\n\n // For gallery, the per-item sources are carried by `gallery` itself, so\n // the lock state is driven by paymentStatus rather than the single\n // `effectiveSourceUrl`. Everything else still respects the source fetch.\n const isLocked = isGallery\n ? paymentStatus !== 'paid'\n : effectiveSourceUrl === undefined\n const sourceType = getSourceType(mimeType)\n\n // For gallery, ReceivedCardActions falls back to a plain <button>\n // (no anchor) because the gallery has no single sourceUrl to link to —\n // the per-item sources live on `gallery` itself.\n const actionSourceUrl = isGallery ? undefined : effectiveSourceUrl\n\n return (\n <MediaShell\n variant=\"light\"\n rootRef={cardRef}\n data-testid=\"locked-attachment\"\n >\n <CardThumbnail\n variant=\"light\"\n gallery={gallery}\n title={title}\n showLocked={isLocked}\n paymentStatus={paymentStatus}\n mimeType={mimeType}\n thumbnailUrl={thumbnailUrl}\n source={source}\n containedImage={!isLocked && sourceType === 'document'}\n />\n\n <CardBody\n variant=\"light\"\n title={title}\n mimeType={mimeType}\n detail={detail}\n statusBadge={\n <PurchaseStatusBadge\n isMine={false}\n paymentStatus={paymentStatus}\n amountText={amountText}\n />\n }\n icon={isGallery ? galleryBodyIcon('light') : undefined}\n action={\n <ReceivedCardActions\n isLocked={isLocked}\n isUnlocking={isUnlocking}\n sourceUrl={actionSourceUrl}\n redeemUrl={effectiveRedeemUrl}\n onUnlockClicked={handleUnlockClick}\n onDownloadClicked={onDownloadClick}\n />\n }\n />\n </MediaShell>\n )\n}\n\n/**\n * The card either party sees for a paid media attachment. `isDraft`/`isPreview`\n * select the composer's own drafting view / a static receiver-side mockup;\n * otherwise `isMine` selects the sender's sent view vs. the recipient's\n * unlock/download view.\n */\nconst MediaCard: React.FC<MediaCardProps> = (props) => {\n if (props.isDraft) {\n return <DraftMediaCard {...props} />\n } else if (props.isPreview) {\n return <PreviewMediaCard {...props} />\n } else if (props.isMine) {\n return <OwnMediaCard {...props} />\n } else {\n return <OtherMediaCard {...props} />\n }\n}\n\nexport default MediaCard\n"],"names":["CardBody","variant","title","placeholderTitle","mimeType","detail","statusBadge","action","icon","trailingAction","isDark","displayTitle","titleDimmed","typeIcon","renderTypeIcon","classNames","jsxs","jsx","LockBadge","paymentStatus","isPlayable","isLocked","sourceType","getSourceType","Icon","PlayIcon","LockOpenIcon","LockSimpleIcon","isPlayableItem","item","GalleryThumbnail","gallery","showLocked","topRight","index","setIndex","useState","total","safeIndex","current","isVideoItem","optimizedCurrentThumbnailUrl","optimizeMessagingAttachmentUrl","goPrev","e","i","goNext","atStart","atEnd","AttachmentThumbnail","React","CaretLeftIcon","CaretRightIcon","SingleThumbnail","thumbnailUrl","source","containedImage","effectiveSourceUrl","effectiveThumbnailUrl","optimizedThumbnailUrl","isGalleryCard","galleryBodyIcon","ImagesIcon","CardThumbnail","MediaShell","children","rootRef","dataTestId","PreviewToggle","onToggle","isBusy","isPreviewVisible","usePreviewToggle","isGallery","onFetchSource","onPreviewClick","setSource","setIsPreviewVisible","isLoadingPreview","setIsLoadingPreview","fetchingRef","useRef","handleToggle","useCallback","result","togglePreview","useReceivedSource","onUnlockClick","cardRef","onFetchSourceRef","fetchSource","_a","handleUnlockClick","useEffect","observer","entry","buttonClass","ReceivedCardActions","sourceUrl","redeemUrl","onUnlockClicked","onDownloadClicked","isUnlocking","LoadingDots","href","DownloadSimpleIcon","DraftMediaCard","amountText","placeholderAmountText","onDismiss","onEditClick","dismissButton","XIcon","editButton","PencilSimpleIcon","PreviewMediaCard","OwnMediaCard","PurchaseStatusBadge","OtherMediaCard","onDownloadClick","effectiveRedeemUrl","actionSourceUrl","MediaCard","props"],"mappings":"6QA0BMA,EAAoC,CAAC,CACzC,QAAAC,EACA,MAAAC,EACA,iBAAAC,EAAmB,mBACnB,SAAAC,EACA,OAAAC,EACA,YAAAC,EACA,OAAAC,EACA,KAAAC,EACA,eAAAC,CACF,IAAM,CACJ,MAAMC,EAAST,IAAY,OACrBU,EAAeT,GAASC,EACxBS,EAAc,CAACV,EAEfW,EACJL,GACAM,EAAAA,eAAeV,EAAU,CACvB,UAAWW,EACT,kBACAL,EAAS,gBAAkB,eAAA,EAE7B,OAAQ,SAAA,CACT,EAEH,OACEM,EAAAA,KAAC,MAAA,CAAI,UAAU,YACb,SAAA,CAAAA,EAAAA,KAAC,MAAA,CAAI,UAAU,uBACb,SAAA,CAAAA,EAAAA,KAAC,MAAA,CAAI,UAAU,qCACZ,SAAA,CAAAL,EAAa,SAAW,IACvBM,EAAAA,IAAC,IAAA,CACC,UAAWF,EAAW,2CAA4C,CAChE,gBAAiB,CAACL,GAAU,CAACE,EAC7B,gBAAiB,CAACF,GAAUE,EAC5B,gBAAiBF,GAAUE,EAC3B,aAAcF,GAAU,CAACE,CAAA,CAC1B,EAEA,SAAAD,CAAA,CAAA,EAILK,EAAAA,KAAC,MAAA,CAAI,UAAU,oCACZ,SAAA,CAAAH,EAEAR,GAAU,MAAQA,IAAW,IAC5BY,EAAAA,IAAC,OAAA,CACC,UAAWF,EACT,sBACAL,EAAS,gBAAkB,eAAA,EAG5B,SAAAL,CAAA,CAAA,EAIJC,CAAA,CAAA,CACH,CAAA,EACF,EAECG,GAAkBQ,EAAAA,IAAC,MAAA,CAAI,UAAU,WAAY,SAAAR,CAAA,CAAe,CAAA,EAC/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