@linktr.ee/messaging-react 1.30.0 → 1.31.0-rc-1776677746
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/{Creator-77XnrIxc.js → Creator-DGe3CQ_j.js} +131 -138
- package/dist/Creator-DGe3CQ_j.js.map +1 -0
- package/dist/{MediaPlayer-Bf-xPB8Z.js → MediaPlayer-BCsdmsON.js} +83 -89
- package/dist/MediaPlayer-BCsdmsON.js.map +1 -0
- package/dist/Visitor-DyJTWB2_.js +204 -0
- package/dist/Visitor-DyJTWB2_.js.map +1 -0
- package/dist/index.d.ts +33 -19
- package/dist/index.js +775 -767
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ChannelView.tsx +15 -13
- package/src/components/CustomMessage/CustomMessage.stories.tsx +12 -20
- package/src/components/CustomMessage/index.tsx +20 -18
- package/src/components/LockedAttachment/LockedAttachment.stories.tsx +49 -140
- package/src/components/LockedAttachment/components/Creator.tsx +45 -58
- package/src/components/LockedAttachment/components/MediaPlayer.tsx +7 -17
- package/src/components/LockedAttachment/components/Visitor.tsx +99 -88
- package/src/components/LockedAttachment/index.tsx +4 -4
- package/src/components/LockedAttachment/types.ts +9 -4
- package/src/components/MessagingShell/index.tsx +6 -4
- package/src/types.ts +18 -13
- package/dist/Creator-77XnrIxc.js.map +0 -1
- package/dist/MediaPlayer-Bf-xPB8Z.js.map +0 -1
- package/dist/Visitor-C9HSYm3D.js +0 -196
- package/dist/Visitor-C9HSYm3D.js.map +0 -1
|
@@ -4,33 +4,35 @@ import {
|
|
|
4
4
|
LockOpenIcon,
|
|
5
5
|
LockSimpleIcon,
|
|
6
6
|
} from '@phosphor-icons/react'
|
|
7
|
-
import React, { useEffect, useState } from 'react'
|
|
7
|
+
import React, { useCallback, useEffect, useState } from 'react'
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
import type {
|
|
11
|
-
LockedAttachmentBaseProps,
|
|
12
|
-
LockedAttachmentSource,
|
|
13
|
-
PaymentStatus,
|
|
14
|
-
} from '../types'
|
|
9
|
+
import type { LockedAttachmentBaseProps, LockedAttachmentSource, PaymentStatus } from '../types'
|
|
15
10
|
import { renderTypeIcon } from '../utils/icons'
|
|
16
11
|
import { getSourceType } from '../utils/mimeType'
|
|
17
12
|
|
|
18
13
|
import MediaPlayer from './MediaPlayer'
|
|
19
14
|
|
|
20
15
|
export interface VisitorCardProps extends LockedAttachmentBaseProps {
|
|
16
|
+
/**
|
|
17
|
+
* Called when the visitor clicks Unlock. Omit to hide the Unlock button.
|
|
18
|
+
*/
|
|
19
|
+
onUnlockClick?: () => void
|
|
20
|
+
/**
|
|
21
|
+
* Called when the visitor clicks Download on an unlocked card.
|
|
22
|
+
* Omit to hide the Download button.
|
|
23
|
+
*/
|
|
24
|
+
onDownloadClick?: () => void
|
|
21
25
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
26
|
+
* Returns current unlock state — sourceUrl (for playback) and redeemUrl (for download).
|
|
27
|
+
* Bound to the message by the host before being passed down,
|
|
28
|
+
* so this component receives no Stream Chat types.
|
|
25
29
|
*/
|
|
26
|
-
|
|
27
|
-
/** Called when the visitor clicks Download on an unlocked card. */
|
|
28
|
-
onDownload?: () => void
|
|
30
|
+
onUnlocked?: () => LockedAttachmentSource
|
|
29
31
|
}
|
|
30
32
|
|
|
31
|
-
const getLockIcon = (paymentStatus?: PaymentStatus): React.ElementType =>
|
|
32
|
-
paymentStatus === 'paid' ? LockOpenIcon : LockSimpleIcon
|
|
33
|
-
|
|
33
|
+
const getLockIcon = (paymentStatus?: PaymentStatus): React.ElementType => {
|
|
34
|
+
return paymentStatus === 'paid' ? LockOpenIcon : LockSimpleIcon
|
|
35
|
+
}
|
|
34
36
|
|
|
35
37
|
interface LockOverlayProps {
|
|
36
38
|
icon: React.ElementType
|
|
@@ -48,18 +50,18 @@ const LockOverlay: React.FC<LockOverlayProps> = (props) => {
|
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
interface LockedPreviewProps {
|
|
51
|
-
|
|
53
|
+
thumbnailUrl?: string
|
|
52
54
|
mimeType: string
|
|
53
55
|
LockIcon: React.ElementType
|
|
54
56
|
}
|
|
55
57
|
|
|
56
58
|
const LockedPreview: React.FC<LockedPreviewProps> = (props) => {
|
|
57
|
-
const {
|
|
59
|
+
const { thumbnailUrl, mimeType, LockIcon } = props
|
|
58
60
|
return (
|
|
59
61
|
<div className="relative aspect-video overflow-hidden bg-black/5">
|
|
60
|
-
{
|
|
62
|
+
{thumbnailUrl ? (
|
|
61
63
|
<img
|
|
62
|
-
src={
|
|
64
|
+
src={thumbnailUrl}
|
|
63
65
|
alt=""
|
|
64
66
|
className="absolute inset-0 h-full w-full object-cover"
|
|
65
67
|
/>
|
|
@@ -76,10 +78,9 @@ const LockedPreview: React.FC<LockedPreviewProps> = (props) => {
|
|
|
76
78
|
)
|
|
77
79
|
}
|
|
78
80
|
|
|
79
|
-
|
|
80
81
|
interface ImagePreviewProps {
|
|
81
|
-
|
|
82
|
-
|
|
82
|
+
sourceUrl?: string
|
|
83
|
+
thumbnailUrl?: string
|
|
83
84
|
mimeType: string
|
|
84
85
|
title?: string
|
|
85
86
|
paymentStatus?: PaymentStatus
|
|
@@ -87,17 +88,13 @@ interface ImagePreviewProps {
|
|
|
87
88
|
}
|
|
88
89
|
|
|
89
90
|
const ImagePreview: React.FC<ImagePreviewProps> = (props) => {
|
|
90
|
-
const {
|
|
91
|
+
const { sourceUrl, thumbnailUrl, mimeType, title, paymentStatus, isLocked } = props
|
|
91
92
|
const [sourceReady, setSourceReady] = useState(false)
|
|
92
93
|
|
|
93
|
-
useEffect(() => {
|
|
94
|
-
setSourceReady(false)
|
|
95
|
-
}, [source])
|
|
96
|
-
|
|
97
94
|
if (isLocked) {
|
|
98
95
|
return (
|
|
99
96
|
<LockedPreview
|
|
100
|
-
|
|
97
|
+
thumbnailUrl={thumbnailUrl}
|
|
101
98
|
mimeType={mimeType}
|
|
102
99
|
LockIcon={getLockIcon(paymentStatus)}
|
|
103
100
|
/>
|
|
@@ -107,7 +104,7 @@ const ImagePreview: React.FC<ImagePreviewProps> = (props) => {
|
|
|
107
104
|
return (
|
|
108
105
|
<div className="relative overflow-hidden bg-black/5">
|
|
109
106
|
<img
|
|
110
|
-
src={
|
|
107
|
+
src={sourceUrl}
|
|
111
108
|
alt={title}
|
|
112
109
|
className={`block w-full transition-opacity duration-300 ${sourceReady ? 'opacity-100' : 'opacity-0'}`}
|
|
113
110
|
onLoad={() => setSourceReady(true)}
|
|
@@ -117,19 +114,19 @@ const ImagePreview: React.FC<ImagePreviewProps> = (props) => {
|
|
|
117
114
|
}
|
|
118
115
|
|
|
119
116
|
interface DocumentPreviewProps {
|
|
120
|
-
|
|
117
|
+
thumbnailUrl?: string
|
|
121
118
|
mimeType: string
|
|
122
119
|
paymentStatus?: PaymentStatus
|
|
123
120
|
isLocked: boolean
|
|
124
121
|
}
|
|
125
122
|
|
|
126
123
|
const DocumentPreview: React.FC<DocumentPreviewProps> = (props) => {
|
|
127
|
-
const {
|
|
124
|
+
const { thumbnailUrl, mimeType, paymentStatus, isLocked } = props
|
|
128
125
|
return (
|
|
129
126
|
<div className="relative aspect-video overflow-hidden bg-black/5">
|
|
130
|
-
{
|
|
127
|
+
{thumbnailUrl ? (
|
|
131
128
|
<img
|
|
132
|
-
src={
|
|
129
|
+
src={thumbnailUrl}
|
|
133
130
|
alt=""
|
|
134
131
|
className="absolute inset-0 h-full w-full object-cover"
|
|
135
132
|
/>
|
|
@@ -147,28 +144,33 @@ const DocumentPreview: React.FC<DocumentPreviewProps> = (props) => {
|
|
|
147
144
|
}
|
|
148
145
|
|
|
149
146
|
interface MediaPreviewProps {
|
|
150
|
-
|
|
151
|
-
|
|
147
|
+
sourceUrl?: string
|
|
148
|
+
thumbnailUrl?: string
|
|
152
149
|
mimeType: string
|
|
153
150
|
paymentStatus?: PaymentStatus
|
|
154
151
|
isLocked: boolean
|
|
155
152
|
}
|
|
156
153
|
|
|
157
154
|
const MediaPreview: React.FC<MediaPreviewProps> = (props) => {
|
|
158
|
-
const {
|
|
155
|
+
const { sourceUrl, thumbnailUrl, mimeType, paymentStatus, isLocked } = props
|
|
159
156
|
if (isLocked) {
|
|
160
157
|
return (
|
|
161
158
|
<LockedPreview
|
|
162
|
-
|
|
159
|
+
thumbnailUrl={thumbnailUrl}
|
|
163
160
|
mimeType={mimeType}
|
|
164
161
|
LockIcon={getLockIcon(paymentStatus)}
|
|
165
162
|
/>
|
|
166
163
|
)
|
|
167
164
|
}
|
|
168
|
-
return
|
|
165
|
+
return (
|
|
166
|
+
<MediaPlayer
|
|
167
|
+
source={sourceUrl!}
|
|
168
|
+
mimeType={mimeType}
|
|
169
|
+
poster={thumbnailUrl}
|
|
170
|
+
/>
|
|
171
|
+
)
|
|
169
172
|
}
|
|
170
173
|
|
|
171
|
-
|
|
172
174
|
const LoadingDots = () => (
|
|
173
175
|
<span className="flex items-center gap-1">
|
|
174
176
|
<span className="size-1 rounded-full bg-white animate-bounce [animation-delay:-0.3s]" />
|
|
@@ -179,24 +181,32 @@ const LoadingDots = () => (
|
|
|
179
181
|
|
|
180
182
|
interface CardActionsProps {
|
|
181
183
|
isLocked: boolean
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
184
|
+
isUnlocking?: boolean
|
|
185
|
+
sourceUrl?: string
|
|
186
|
+
redeemUrl?: string
|
|
187
|
+
onUnlockClicked?: () => void
|
|
188
|
+
onDownloadClicked?: () => void
|
|
186
189
|
}
|
|
187
190
|
|
|
188
191
|
const CardActions: React.FC<CardActionsProps> = (props) => {
|
|
189
|
-
const {
|
|
192
|
+
const {
|
|
193
|
+
isLocked,
|
|
194
|
+
isUnlocking,
|
|
195
|
+
sourceUrl,
|
|
196
|
+
redeemUrl,
|
|
197
|
+
onUnlockClicked,
|
|
198
|
+
onDownloadClicked,
|
|
199
|
+
} = props
|
|
190
200
|
|
|
191
|
-
if (isLocked &&
|
|
201
|
+
if (isLocked && onUnlockClicked) {
|
|
192
202
|
return (
|
|
193
203
|
<button
|
|
194
204
|
type="button"
|
|
195
|
-
onClick={
|
|
196
|
-
disabled={
|
|
205
|
+
onClick={onUnlockClicked}
|
|
206
|
+
disabled={isUnlocking}
|
|
197
207
|
className="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] disabled:opacity-70"
|
|
198
208
|
>
|
|
199
|
-
{
|
|
209
|
+
{isUnlocking ? (
|
|
200
210
|
<LoadingDots />
|
|
201
211
|
) : (
|
|
202
212
|
<>
|
|
@@ -208,11 +218,13 @@ const CardActions: React.FC<CardActionsProps> = (props) => {
|
|
|
208
218
|
)
|
|
209
219
|
}
|
|
210
220
|
|
|
211
|
-
if (!isLocked &&
|
|
221
|
+
if (!isLocked && onDownloadClicked && sourceUrl) {
|
|
212
222
|
return (
|
|
213
223
|
<a
|
|
214
|
-
href={
|
|
215
|
-
|
|
224
|
+
href={redeemUrl ?? sourceUrl}
|
|
225
|
+
target="_blank"
|
|
226
|
+
rel="noopener noreferrer"
|
|
227
|
+
onClick={onDownloadClicked}
|
|
216
228
|
className="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]"
|
|
217
229
|
>
|
|
218
230
|
<DownloadSimpleIcon className="size-4" weight="bold" />
|
|
@@ -224,48 +236,45 @@ const CardActions: React.FC<CardActionsProps> = (props) => {
|
|
|
224
236
|
return null
|
|
225
237
|
}
|
|
226
238
|
|
|
227
|
-
|
|
228
239
|
const VisitorCard: React.FC<VisitorCardProps> = (props) => {
|
|
229
240
|
const {
|
|
230
241
|
title,
|
|
231
242
|
amountText,
|
|
232
|
-
|
|
233
|
-
source: sourceProp,
|
|
243
|
+
thumbnailUrl,
|
|
234
244
|
mimeType = 'application/octet-stream',
|
|
235
245
|
detail,
|
|
236
|
-
|
|
237
|
-
|
|
246
|
+
onUnlocked,
|
|
247
|
+
onUnlockClick,
|
|
248
|
+
onDownloadClick,
|
|
238
249
|
paymentStatus,
|
|
239
250
|
} = props
|
|
240
|
-
const [source, setSource] = useState(sourceProp)
|
|
241
|
-
const [unlockLoading, setUnlockLoading] = useState(false)
|
|
242
251
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
}, [sourceProp])
|
|
252
|
+
const { sourceUrl, redeemUrl } = onUnlocked?.() ?? {}
|
|
253
|
+
const [isUnlocking, setUnlocking] = useState(false)
|
|
246
254
|
|
|
247
|
-
const isLocked =
|
|
255
|
+
const isLocked = sourceUrl === undefined
|
|
248
256
|
const sourceType = getSourceType(mimeType)
|
|
249
257
|
|
|
250
|
-
|
|
251
|
-
if (
|
|
252
|
-
|
|
253
|
-
try {
|
|
254
|
-
const result = await onUnlock()
|
|
255
|
-
setSource(result.source)
|
|
256
|
-
} catch (err) {
|
|
257
|
-
if (isDevBuild()) console.debug('[LockedAttachment] onUnlock failed', err)
|
|
258
|
-
} finally {
|
|
259
|
-
setUnlockLoading(false)
|
|
258
|
+
useEffect(() => {
|
|
259
|
+
if (sourceUrl !== undefined) {
|
|
260
|
+
setUnlocking(false)
|
|
260
261
|
}
|
|
261
|
-
}
|
|
262
|
+
}, [sourceUrl])
|
|
263
|
+
|
|
264
|
+
const onUnlockClicked = useCallback(() => {
|
|
265
|
+
if (onUnlockClick) {
|
|
266
|
+
setUnlocking(true)
|
|
267
|
+
onUnlockClick()
|
|
268
|
+
}
|
|
269
|
+
}, [onUnlockClick])
|
|
262
270
|
|
|
263
271
|
let mediaPreview: React.ReactNode
|
|
264
272
|
if (sourceType === 'image') {
|
|
265
273
|
mediaPreview = (
|
|
266
274
|
<ImagePreview
|
|
267
|
-
|
|
268
|
-
|
|
275
|
+
key={sourceUrl}
|
|
276
|
+
sourceUrl={sourceUrl}
|
|
277
|
+
thumbnailUrl={thumbnailUrl}
|
|
269
278
|
mimeType={mimeType}
|
|
270
279
|
title={title}
|
|
271
280
|
paymentStatus={paymentStatus}
|
|
@@ -275,7 +284,7 @@ const VisitorCard: React.FC<VisitorCardProps> = (props) => {
|
|
|
275
284
|
} else if (sourceType === 'document') {
|
|
276
285
|
mediaPreview = (
|
|
277
286
|
<DocumentPreview
|
|
278
|
-
|
|
287
|
+
thumbnailUrl={thumbnailUrl}
|
|
279
288
|
mimeType={mimeType}
|
|
280
289
|
paymentStatus={paymentStatus}
|
|
281
290
|
isLocked={isLocked}
|
|
@@ -284,8 +293,9 @@ const VisitorCard: React.FC<VisitorCardProps> = (props) => {
|
|
|
284
293
|
} else {
|
|
285
294
|
mediaPreview = (
|
|
286
295
|
<MediaPreview
|
|
287
|
-
|
|
288
|
-
|
|
296
|
+
key={sourceUrl}
|
|
297
|
+
sourceUrl={sourceUrl}
|
|
298
|
+
thumbnailUrl={thumbnailUrl}
|
|
289
299
|
mimeType={mimeType}
|
|
290
300
|
paymentStatus={paymentStatus}
|
|
291
301
|
isLocked={isLocked}
|
|
@@ -294,7 +304,7 @@ const VisitorCard: React.FC<VisitorCardProps> = (props) => {
|
|
|
294
304
|
}
|
|
295
305
|
|
|
296
306
|
return (
|
|
297
|
-
<div className="w-[280px] select-none overflow-hidden rounded-[24px] bg-white shadow-
|
|
307
|
+
<div className="w-[280px] select-none overflow-hidden rounded-[24px] bg-white shadow-[0_0_0_1px_rgba(0,0,0,0.04),0_4px_8px_rgba(0,0,0,0.06)]">
|
|
298
308
|
{mediaPreview}
|
|
299
309
|
<div className="px-4 pb-3 pt-3">
|
|
300
310
|
<p className="mb-1.5 truncate text-base font-medium text-black">
|
|
@@ -309,7 +319,7 @@ const VisitorCard: React.FC<VisitorCardProps> = (props) => {
|
|
|
309
319
|
<span className="text-xs font-medium text-black/55">{detail}</span>
|
|
310
320
|
)}
|
|
311
321
|
{paymentStatus === 'paid' ? (
|
|
312
|
-
|
|
322
|
+
<React.Fragment>
|
|
313
323
|
<span className="text-xs font-medium text-black/55">•</span>
|
|
314
324
|
<span className="text-xs font-medium text-[#008236]">
|
|
315
325
|
Purchased
|
|
@@ -318,24 +328,25 @@ const VisitorCard: React.FC<VisitorCardProps> = (props) => {
|
|
|
318
328
|
className="size-4 text-[#008236]"
|
|
319
329
|
weight="bold"
|
|
320
330
|
/>
|
|
321
|
-
|
|
331
|
+
</React.Fragment>
|
|
322
332
|
) : (
|
|
323
333
|
amountText && (
|
|
324
|
-
|
|
334
|
+
<React.Fragment>
|
|
325
335
|
<span className="text-xs font-medium text-black/55">•</span>
|
|
326
336
|
<span className="text-xs font-medium text-black/55">
|
|
327
337
|
{amountText}
|
|
328
338
|
</span>
|
|
329
|
-
|
|
339
|
+
</React.Fragment>
|
|
330
340
|
)
|
|
331
341
|
)}
|
|
332
342
|
</div>
|
|
333
343
|
<CardActions
|
|
334
344
|
isLocked={isLocked}
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
345
|
+
isUnlocking={isUnlocking}
|
|
346
|
+
sourceUrl={sourceUrl}
|
|
347
|
+
redeemUrl={redeemUrl}
|
|
348
|
+
onUnlockClicked={onUnlockClicked}
|
|
349
|
+
onDownloadClicked={onDownloadClick}
|
|
339
350
|
/>
|
|
340
351
|
</div>
|
|
341
352
|
</div>
|
|
@@ -8,7 +8,7 @@ const VisitorCardLazy = React.lazy(() => import('./components/Visitor'))
|
|
|
8
8
|
|
|
9
9
|
const LockedAttachmentFallback = () => (
|
|
10
10
|
<div
|
|
11
|
-
className="w-[280px] min-h-[200px] animate-pulse rounded-[24px] bg-black/[0.06] shadow-[
|
|
11
|
+
className="w-[280px] min-h-[200px] animate-pulse rounded-[24px] bg-black/[0.06] shadow-[0_0_0_1px_rgba(0,0,0,0.04),0_4px_8px_rgba(0,0,0,0.06)]"
|
|
12
12
|
aria-hidden
|
|
13
13
|
/>
|
|
14
14
|
)
|
|
@@ -16,11 +16,11 @@ const LockedAttachmentFallback = () => (
|
|
|
16
16
|
type Never<T, K extends keyof T = keyof T> = { [P in K]?: never }
|
|
17
17
|
|
|
18
18
|
export type LockedAttachmentProps =
|
|
19
|
-
| (CreatorCardProps & Never<VisitorCardProps, '
|
|
20
|
-
| (VisitorCardProps & Never<CreatorCardProps, 'isPreview' | 'placeholderTitle' | 'placeholderAmountText' | 'onDismiss'>)
|
|
19
|
+
| (CreatorCardProps & Never<VisitorCardProps, 'onUnlockClick' | 'onDownloadClick' | 'onUnlocked'>)
|
|
20
|
+
| (VisitorCardProps & Never<CreatorCardProps, 'isPreview' | 'placeholderTitle' | 'placeholderAmountText' | 'sourceUrl' | 'onDismiss'>)
|
|
21
21
|
|
|
22
22
|
const LockedAttachment = (props: LockedAttachmentProps) => {
|
|
23
|
-
if (props.
|
|
23
|
+
if (props.onUnlockClick != null || props.onDownloadClick != null || props.onUnlocked != null) {
|
|
24
24
|
return (
|
|
25
25
|
<Suspense fallback={<LockedAttachmentFallback />}>
|
|
26
26
|
<VisitorCardLazy {...props} />
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import type { PaymentStatus } from '../../stream-custom-data'
|
|
2
2
|
|
|
3
3
|
export interface LockedAttachmentBaseProps {
|
|
4
|
+
mimeType: string
|
|
4
5
|
title?: string
|
|
5
|
-
|
|
6
|
-
thumbnail?: string
|
|
7
|
-
source?: string
|
|
6
|
+
thumbnailUrl?: string
|
|
8
7
|
detail?: string
|
|
9
8
|
amountText?: string
|
|
10
9
|
paymentStatus?: PaymentStatus
|
|
11
10
|
}
|
|
12
11
|
|
|
12
|
+
export interface LockedAttachmentSource {
|
|
13
|
+
/** Proxied URL used by the media player for in-app playback. */
|
|
14
|
+
sourceUrl: string
|
|
15
|
+
/** URL opened when the visitor clicks Download — may be a file or a web destination. */
|
|
16
|
+
redeemUrl?: string
|
|
17
|
+
}
|
|
18
|
+
|
|
13
19
|
export type { PaymentStatus }
|
|
14
|
-
export type { LockedAttachmentSource } from '../../types'
|
|
@@ -42,8 +42,9 @@ export const MessagingShell: React.FC<MessagingShellProps> = ({
|
|
|
42
42
|
customProfileContent,
|
|
43
43
|
customChannelActions,
|
|
44
44
|
renderMessage,
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
onAttachmentUnlockClick,
|
|
46
|
+
onAttachmentDownloadClick,
|
|
47
|
+
onAttachmentUnlocked,
|
|
47
48
|
}) => {
|
|
48
49
|
const {
|
|
49
50
|
service,
|
|
@@ -507,8 +508,9 @@ export const MessagingShell: React.FC<MessagingShellProps> = ({
|
|
|
507
508
|
customProfileContent={customProfileContent}
|
|
508
509
|
customChannelActions={customChannelActions}
|
|
509
510
|
renderMessage={renderMessage}
|
|
510
|
-
|
|
511
|
-
|
|
511
|
+
onAttachmentUnlockClick={onAttachmentUnlockClick}
|
|
512
|
+
onAttachmentDownloadClick={onAttachmentDownloadClick}
|
|
513
|
+
onAttachmentUnlocked={onAttachmentUnlocked}
|
|
512
514
|
/>
|
|
513
515
|
</div>
|
|
514
516
|
) : initialParticipantFilter ? (
|
package/src/types.ts
CHANGED
|
@@ -14,8 +14,11 @@ import type {
|
|
|
14
14
|
EmptyStateIndicatorProps,
|
|
15
15
|
} from 'stream-chat-react'
|
|
16
16
|
|
|
17
|
+
import type { LockedAttachmentSource } from './components/LockedAttachment'
|
|
17
18
|
import type { MessageMetadata } from './stream-custom-data'
|
|
18
19
|
|
|
20
|
+
export type { LockedAttachmentSource } from './components/LockedAttachment'
|
|
21
|
+
|
|
19
22
|
/**
|
|
20
23
|
* Generic participant interface for different host environments
|
|
21
24
|
*/
|
|
@@ -117,10 +120,6 @@ export interface ChannelListProps {
|
|
|
117
120
|
) => React.ReactNode
|
|
118
121
|
}
|
|
119
122
|
|
|
120
|
-
export interface LockedAttachmentSource {
|
|
121
|
-
source: string
|
|
122
|
-
}
|
|
123
|
-
|
|
124
123
|
/**
|
|
125
124
|
* ChannelView component props
|
|
126
125
|
*/
|
|
@@ -237,17 +236,22 @@ export interface ChannelViewProps {
|
|
|
237
236
|
) => React.ReactNode
|
|
238
237
|
|
|
239
238
|
/**
|
|
240
|
-
* Called when the visitor clicks Unlock on a locked attachment
|
|
241
|
-
*
|
|
242
|
-
|
|
243
|
-
|
|
239
|
+
* Called when the visitor clicks Unlock on a locked attachment card.
|
|
240
|
+
* Fire-and-forget; host is responsible for opening checkout and tracking unlock state.
|
|
241
|
+
*/
|
|
242
|
+
onAttachmentUnlockClick?: (message: LocalMessage, channel: Channel) => void
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Called when the visitor clicks Download on an unlocked attachment card.
|
|
244
246
|
*/
|
|
245
|
-
|
|
247
|
+
onAttachmentDownloadClick?: (message: LocalMessage, channel: Channel) => void
|
|
246
248
|
|
|
247
249
|
/**
|
|
248
|
-
*
|
|
250
|
+
* Returns the current unlock state for a given message ID.
|
|
251
|
+
* Called by CustomMessage on each render to drive controlled props on LockedAttachment.
|
|
252
|
+
* Host owns sourceUrl / redeemUrl state.
|
|
249
253
|
*/
|
|
250
|
-
|
|
254
|
+
onAttachmentUnlocked?: (message: LocalMessage, channel: Channel) => LockedAttachmentSource
|
|
251
255
|
}
|
|
252
256
|
|
|
253
257
|
/**
|
|
@@ -271,8 +275,9 @@ export type ChannelViewPassthroughProps = Pick<
|
|
|
271
275
|
| 'customProfileContent'
|
|
272
276
|
| 'customChannelActions'
|
|
273
277
|
| 'renderMessage'
|
|
274
|
-
| '
|
|
275
|
-
| '
|
|
278
|
+
| 'onAttachmentUnlockClick'
|
|
279
|
+
| 'onAttachmentDownloadClick'
|
|
280
|
+
| 'onAttachmentUnlocked'
|
|
276
281
|
>
|
|
277
282
|
|
|
278
283
|
/**
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Creator-77XnrIxc.js","sources":["../src/components/LockedAttachment/components/Creator.tsx"],"sourcesContent":["import {\n CheckCircleIcon,\n EyeIcon,\n EyeSlashIcon,\n LockIcon,\n LockOpenIcon,\n PauseIcon,\n PlayIcon,\n XIcon,\n} from '@phosphor-icons/react'\nimport classNames from 'classnames'\nimport React, { useCallback, useEffect, useRef, useState } from 'react'\n\nimport type { LockedAttachmentBaseProps } from '../types'\nimport { renderTypeIcon } from '../utils/icons'\nimport { getSourceType } from '../utils/mimeType'\n\nimport MediaPlayer from './MediaPlayer'\n\nexport interface CreatorCardProps extends LockedAttachmentBaseProps {\n isPreview?: boolean\n placeholderTitle?: string\n placeholderAmountText?: string\n onDismiss?: () => void\n}\n\ninterface CloseButtonProps {\n onClose: () => void\n}\n\nconst CloseButton: React.FC<CloseButtonProps> = (props) => {\n const { onClose } = props\n return (\n <button\n type=\"button\"\n onClick={onClose}\n className=\"absolute left-3 top-3 z-40 flex size-8 items-center justify-center rounded-full bg-black/60 text-white\"\n aria-label=\"Close preview\"\n >\n <EyeIcon className=\"size-4\" weight=\"fill\" />\n </button>\n )\n}\n\ninterface CollapsedThumbnailProps {\n thumbnail?: string\n mimeType: string\n overlayIcon?: React.ElementType\n darkOverlay?: boolean\n onClick?: () => void\n}\n\nconst CollapsedThumbnail: React.FC<CollapsedThumbnailProps> = (props) => {\n const { thumbnail, mimeType, overlayIcon: OverlayIcon, darkOverlay, onClick } = props\n return (\n <button\n type=\"button\"\n disabled={!onClick}\n className={classNames(\n 'relative aspect-video block w-full overflow-hidden border-0 bg-black/5 p-0 text-left appearance-none',\n { 'cursor-pointer': !!onClick, 'cursor-default': !onClick }\n )}\n onClick={onClick}\n aria-label={OverlayIcon ? 'Toggle preview' : undefined}\n >\n {thumbnail ? (\n <img\n src={thumbnail}\n alt=\"\"\n className=\"absolute inset-0 h-full w-full object-cover\"\n />\n ) : (\n <div className=\"absolute inset-0 flex items-center justify-center\">\n {renderTypeIcon(mimeType, {\n className: 'size-12 text-black/20',\n weight: 'regular',\n })}\n </div>\n )}\n {darkOverlay && (\n <div className=\"pointer-events-none absolute inset-0 bg-black/30\" />\n )}\n {OverlayIcon && (\n <div className=\"pointer-events-none absolute left-3 top-3 flex size-8 items-center justify-center rounded-full bg-black/60 text-white\">\n <OverlayIcon className=\"size-4\" weight=\"fill\" />\n </div>\n )}\n </button>\n )\n}\n\n\ninterface AudioPreviewProps {\n source?: string\n thumbnail?: string\n mimeType: string\n}\n\nconst AudioPreview: React.FC<AudioPreviewProps> = (props) => {\n const { source, thumbnail, mimeType } = props\n const [playing, setPlaying] = useState(false)\n const [played, setPlayed] = useState(0)\n const [seeking, setSeeking] = useState(false)\n const audioRef = useRef<HTMLAudioElement>(null)\n const trackRef = useRef<HTMLDivElement>(null)\n const rafRef = useRef<number | null>(null)\n\n useEffect(() => {\n const el = audioRef.current\n if (!el) return\n if (playing) {\n void el.play().catch(() => setPlaying(false))\n } else {\n el.pause()\n }\n }, [playing])\n\n useEffect(() => {\n if (!playing) {\n if (rafRef.current !== null) cancelAnimationFrame(rafRef.current)\n return\n }\n const tick = () => {\n const el = audioRef.current\n if (el && el.duration && !seeking) setPlayed(el.currentTime / el.duration)\n rafRef.current = requestAnimationFrame(tick)\n }\n rafRef.current = requestAnimationFrame(tick)\n return () => {\n if (rafRef.current !== null) cancelAnimationFrame(rafRef.current)\n }\n }, [playing, seeking])\n\n const [audioReady, setAudioReady] = useState(false)\n\n useEffect(() => {\n setPlaying(false)\n setPlayed(0)\n setAudioReady(false)\n }, [source])\n\n const getFraction = useCallback(\n (e: MouseEvent | TouchEvent | React.MouseEvent | React.TouchEvent) => {\n const track = trackRef.current\n if (!track) return 0\n const clientX =\n 'touches' in e\n ? (e.touches[0]?.clientX ?? e.changedTouches[0]?.clientX ?? 0)\n : e.clientX\n const rect = track.getBoundingClientRect()\n return Math.max(0, Math.min(1, (clientX - rect.left) / rect.width))\n },\n []\n )\n\n const seekTo = useCallback((fraction: number) => {\n const el = audioRef.current\n if (el && el.duration) el.currentTime = fraction * el.duration\n }, [])\n\n useEffect(() => {\n if (!seeking) return\n const onMove = (e: MouseEvent | TouchEvent) => {\n const f = getFraction(e)\n setPlayed(f)\n seekTo(f)\n }\n const onUp = (e: MouseEvent | TouchEvent) => {\n setSeeking(false)\n seekTo(getFraction(e))\n }\n window.addEventListener('mousemove', onMove)\n window.addEventListener('mouseup', onUp)\n window.addEventListener('touchmove', onMove, { passive: true })\n window.addEventListener('touchend', onUp)\n return () => {\n window.removeEventListener('mousemove', onMove)\n window.removeEventListener('mouseup', onUp)\n window.removeEventListener('touchmove', onMove)\n window.removeEventListener('touchend', onUp)\n }\n }, [seeking, getFraction, seekTo])\n\n const toggle = useCallback(() => setPlaying((p) => !p), [])\n\n return (\n <div className=\"relative\">\n {source && (\n <audio\n ref={audioRef}\n src={source}\n loop\n onCanPlay={() => setAudioReady(true)}\n onEnded={() => {\n setPlaying(false)\n setPlayed(0)\n }}\n >\n <track kind=\"captions\" />\n </audio>\n )}\n <CollapsedThumbnail\n thumbnail={thumbnail}\n mimeType={mimeType}\n overlayIcon={source && audioReady ? (playing ? PauseIcon : PlayIcon) : undefined}\n onClick={source && audioReady ? toggle : undefined}\n />\n {source && audioReady && (\n <div className=\"absolute inset-x-0 bottom-0 px-3 pb-2.5 pt-6 bg-gradient-to-t from-black/40 to-transparent\">\n <div\n ref={trackRef}\n role=\"slider\"\n aria-label=\"Playback position\"\n aria-valuenow={Math.round(played * 100)}\n aria-valuemin={0}\n aria-valuemax={100}\n tabIndex={0}\n className=\"relative flex h-4 w-full cursor-pointer items-center\"\n onMouseDown={(e) => {\n e.stopPropagation()\n setSeeking(true)\n const f = getFraction(e)\n setPlayed(f)\n seekTo(f)\n }}\n onTouchStart={(e) => {\n e.stopPropagation()\n setSeeking(true)\n const f = getFraction(e)\n setPlayed(f)\n seekTo(f)\n }}\n onClick={(e) => e.stopPropagation()}\n onKeyDown={(e) => {\n if (e.key === 'ArrowRight') seekTo(Math.min(1, played + 0.05))\n if (e.key === 'ArrowLeft') seekTo(Math.max(0, played - 0.05))\n }}\n >\n <div className=\"w-full overflow-hidden rounded-full bg-white/30 h-1\">\n <div\n className=\"h-full rounded-full bg-white\"\n style={{ width: `${Math.round(played * 100)}%` }}\n />\n </div>\n </div>\n </div>\n )}\n </div>\n )\n}\n\ninterface VideoPreviewProps {\n source?: string\n thumbnail?: string\n mimeType: string\n}\n\nconst VideoPreview: React.FC<VideoPreviewProps> = (props) => {\n const { source, thumbnail, mimeType } = props\n const [expanded, setExpanded] = useState(false)\n const collapse = () => setExpanded(false)\n\n useEffect(() => {\n setExpanded(false)\n }, [source])\n\n if (!source) {\n return <CollapsedThumbnail thumbnail={thumbnail} mimeType={mimeType} />\n }\n\n return (\n <div\n className={classNames('relative overflow-hidden', {\n 'aspect-video': !expanded,\n })}\n >\n <MediaPlayer\n source={source}\n mimeType={mimeType}\n poster={thumbnail}\n playing={expanded}\n loop\n controls={false}\n showProgress\n onContainerClick={collapse}\n muted\n />\n {!expanded && (\n <button\n type=\"button\"\n className=\"absolute inset-0 block cursor-pointer border-0 p-0 text-left appearance-none\"\n onClick={() => setExpanded(true)}\n aria-label=\"Expand video preview\"\n >\n {thumbnail ? (\n <img\n src={thumbnail}\n alt=\"\"\n className=\"absolute inset-0 h-full w-full object-cover\"\n />\n ) : (\n <div className=\"absolute inset-0 flex items-center justify-center\">\n {renderTypeIcon(mimeType, {\n className: 'size-12 text-black/20',\n weight: 'regular',\n })}\n </div>\n )}\n <div className=\"pointer-events-none absolute left-3 top-3 flex size-8 items-center justify-center rounded-full bg-black/60 text-white\">\n <EyeSlashIcon className=\"size-4\" weight=\"fill\" />\n </div>\n </button>\n )}\n {expanded && <CloseButton onClose={collapse} />}\n </div>\n )\n}\n\ninterface ImagePreviewProps {\n source?: string\n thumbnail?: string\n mimeType: string\n title?: string\n}\n\nconst ImagePreview: React.FC<ImagePreviewProps> = (props) => {\n const { source, thumbnail, mimeType, title } = props\n const [expanded, setExpanded] = useState(false)\n const collapse = () => setExpanded(false)\n\n useEffect(() => {\n setExpanded(false)\n }, [source])\n\n if (expanded && source) {\n return (\n <div className=\"relative\">\n <button\n type=\"button\"\n className=\"block w-full cursor-pointer border-0 p-0 text-left appearance-none\"\n onClick={collapse}\n aria-label=\"Close preview\"\n >\n <img src={source} alt={title ?? ''} className=\"block w-full\" />\n </button>\n <CloseButton onClose={collapse} />\n </div>\n )\n }\n\n return (\n <CollapsedThumbnail\n thumbnail={thumbnail}\n mimeType={mimeType}\n overlayIcon={source ? EyeSlashIcon : undefined}\n onClick={source ? () => setExpanded(true) : undefined}\n />\n )\n}\n\n\nconst CreatorCard: React.FC<CreatorCardProps> = (props) => {\n const {\n title,\n mimeType = 'application/octet-stream',\n thumbnail,\n source,\n detail,\n amountText,\n placeholderTitle = 'Attachment title',\n placeholderAmountText,\n paymentStatus,\n onDismiss,\n isPreview = false,\n } = props\n const sourceType = getSourceType(mimeType)\n const displayAmountText = amountText ?? placeholderAmountText\n const isPlaceholderAmount = !amountText && !!placeholderAmountText\n\n let mediaPreview: React.ReactNode\n if (isPreview && sourceType === 'audio') {\n mediaPreview = (\n <AudioPreview source={source} thumbnail={thumbnail} mimeType={mimeType} />\n )\n } else if (isPreview && sourceType === 'video') {\n mediaPreview = (\n <VideoPreview source={source} thumbnail={thumbnail} mimeType={mimeType} />\n )\n } else if (isPreview && sourceType === 'image') {\n mediaPreview = (\n <ImagePreview\n source={source}\n thumbnail={thumbnail}\n mimeType={mimeType}\n title={title}\n />\n )\n } else {\n const lockedOverlayIcon = onDismiss\n ? undefined\n : paymentStatus === 'paid'\n ? LockOpenIcon\n : LockIcon\n mediaPreview = (\n <CollapsedThumbnail\n thumbnail={thumbnail}\n mimeType={mimeType}\n overlayIcon={lockedOverlayIcon}\n darkOverlay\n />\n )\n }\n\n return (\n <div className=\"relative w-[280px] select-none overflow-hidden rounded-[24px] bg-white shadow-card\">\n {onDismiss && (\n <button\n type=\"button\"\n onClick={onDismiss}\n className=\"absolute right-3 top-3 z-50 flex size-8 items-center justify-center rounded-full bg-black/60 text-white\"\n aria-label=\"Dismiss attachment\"\n >\n <XIcon className=\"size-4\" weight=\"bold\" />\n </button>\n )}\n {mediaPreview}\n <div className=\"px-4 pb-3 pt-3\">\n <p\n className={classNames('mb-1.5 truncate text-base font-medium', {\n 'text-black/30': !title,\n 'text-black': !!title,\n })}\n >\n {title || placeholderTitle}\n </p>\n <div className=\"flex items-center gap-1\">\n {renderTypeIcon(mimeType, {\n className: 'size-5 shrink-0 text-black/55',\n weight: 'regular',\n })}\n {detail && (\n <span className=\"text-xs font-medium text-black/55\">{detail}</span>\n )}\n {paymentStatus === 'paid' ? (\n <>\n <span className=\"text-xs font-medium text-black/55\">•</span>\n <span className=\"text-xs font-medium text-[#008236]\">\n Purchased\n </span>\n <CheckCircleIcon\n className=\"size-4 text-[#008236]\"\n weight=\"bold\"\n />\n </>\n ) : (\n displayAmountText && (\n <>\n <span\n className={classNames('text-xs font-medium', {\n 'text-black/30': isPlaceholderAmount,\n 'text-black/55': !isPlaceholderAmount,\n })}\n >\n •\n </span>\n <span\n className={classNames('text-xs font-medium', {\n 'text-black/30': isPlaceholderAmount,\n 'text-black/55': !isPlaceholderAmount,\n })}\n >\n {displayAmountText}\n </span>\n </>\n )\n )}\n </div>\n </div>\n </div>\n )\n}\n\nexport default CreatorCard\n"],"names":["CloseButton","props","onClose","jsx","EyeIcon","CollapsedThumbnail","thumbnail","mimeType","OverlayIcon","darkOverlay","onClick","jsxs","classNames","AudioPreview","source","playing","setPlaying","useState","played","setPlayed","seeking","setSeeking","audioRef","useRef","trackRef","rafRef","useEffect","el","tick","audioReady","setAudioReady","getFraction","useCallback","e","track","clientX","_a","_b","rect","seekTo","fraction","onMove","f","onUp","toggle","p","PauseIcon","PlayIcon","VideoPreview","expanded","setExpanded","collapse","MediaPlayer","EyeSlashIcon","ImagePreview","title","CreatorCard","detail","amountText","placeholderTitle","placeholderAmountText","paymentStatus","onDismiss","isPreview","sourceType","getSourceType","displayAmountText","isPlaceholderAmount","mediaPreview","LockOpenIcon","LockIcon","XIcon","renderTypeIcon","Fragment","CheckCircleIcon"],"mappings":";;;;;AA8BA,MAAMA,IAA0C,CAACC,MAAU;AACzD,QAAM,EAAE,SAAAC,MAAYD;AACpB,SACE,gBAAAE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAK;A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AAAA,MAAA,EAAA,CAGN;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GACF;AAEJ;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MediaPlayer-Bf-xPB8Z.js","sources":["../src/components/LockedAttachment/utils/mimeType.ts","../src/components/LockedAttachment/utils/icons.ts","../src/components/LockedAttachment/components/MediaPlayer.tsx"],"sourcesContent":["export type AttachmentSourceType = 'image' | 'audio' | 'video' | 'document'\n\nexport type DocumentIconType =\n | 'pdf'\n | 'doc'\n | 'xls'\n | 'csv'\n | 'ppt'\n | 'zip'\n | 'text'\n | 'markdown'\n | 'generic'\n\nconst DOCUMENT_ICON_PATTERNS: Array<[RegExp, DocumentIconType]> = [\n [/pdf/, 'pdf'],\n [/wordprocessingml|msword|\\.doc/, 'doc'],\n [/spreadsheetml|ms-excel|\\.xls/, 'xls'],\n [/csv/, 'csv'],\n [/presentationml|ms-powerpoint|\\.ppt/, 'ppt'],\n [/zip|x-rar|x-7z|x-tar|x-gzip/, 'zip'],\n [/plain|rtf/, 'text'],\n [/markdown/, 'markdown'],\n]\n\nexport function getSourceType(mimeType: string): AttachmentSourceType {\n if (mimeType.startsWith('video/')) return 'video'\n if (mimeType.startsWith('audio/')) return 'audio'\n if (mimeType.startsWith('image/')) return 'image'\n return 'document'\n}\n\nexport function getDocumentIconType(mimeType: string): DocumentIconType {\n const match = DOCUMENT_ICON_PATTERNS.find(([pattern]) =>\n pattern.test(mimeType)\n )\n return match ? match[1] : 'generic'\n}\n","import {\n FileIcon,\n FileCsvIcon,\n FileDocIcon,\n FileMdIcon,\n FilePdfIcon,\n FilePptIcon,\n FileTextIcon,\n FileXlsIcon,\n FileZipIcon,\n ImageIcon,\n SpeakerHighIcon,\n VideoCameraIcon,\n IconProps,\n} from '@phosphor-icons/react'\nimport React from 'react'\n\nimport { getDocumentIconType, getSourceType } from './mimeType'\nimport type { AttachmentSourceType } from './mimeType'\n\nexport const MEDIA_TYPE_ICON: Record<AttachmentSourceType, React.ElementType> =\n {\n video: VideoCameraIcon,\n audio: SpeakerHighIcon,\n image: ImageIcon,\n document: FileIcon,\n }\n\nconst DOCUMENT_ICON_COMPONENT = {\n pdf: FilePdfIcon,\n doc: FileDocIcon,\n xls: FileXlsIcon,\n csv: FileCsvIcon,\n ppt: FilePptIcon,\n zip: FileZipIcon,\n text: FileTextIcon,\n markdown: FileMdIcon,\n generic: FileIcon,\n} as const\n\nexport function getTypeIcon(mimeType: string): React.ElementType {\n const sourceType = getSourceType(mimeType)\n if (sourceType !== 'document') return MEDIA_TYPE_ICON[sourceType]\n return DOCUMENT_ICON_COMPONENT[getDocumentIconType(mimeType)]\n}\n\n/** Use instead of `<TypeIcon />` where TypeIcon = getTypeIcon(mime) to satisfy react-hooks/static-components. */\nexport function renderTypeIcon(\n mimeType: string,\n props: IconProps\n): React.ReactElement {\n return React.createElement(getTypeIcon(mimeType), props)\n}\n","import { CircleNotchIcon, PauseIcon, PlayIcon } from '@phosphor-icons/react'\nimport React, { useCallback, useEffect, useRef, useState } from 'react'\n\nimport { isDevBuild } from '../../../utils/isDevBuild'\nimport { renderTypeIcon } from '../utils/icons'\nimport { getSourceType, type AttachmentSourceType } from '../utils/mimeType'\n\nconst getPlayerBg = (sourceType: AttachmentSourceType, poster?: string) =>\n sourceType === 'audio' && !poster ? 'bg-black/5' : 'bg-black'\n\nfunction getClientXFromEvent(\n e: MouseEvent | TouchEvent | React.MouseEvent | React.TouchEvent\n): number {\n if ('touches' in e) {\n return e.touches[0]?.clientX ?? e.changedTouches[0]?.clientX ?? 0\n }\n return e.clientX\n}\n\nexport interface MediaPlayerProps {\n source: string\n mimeType: string\n poster?: string\n autoPlay?: boolean\n /** Controlled playing state. When provided, syncs to internal play/pause. */\n playing?: boolean\n loop?: boolean\n controls?: boolean\n showProgress?: boolean\n onContainerClick?: () => void\n /** When true, requests muted playback (helps autoplay policies on video). */\n muted?: boolean\n}\n\nconst MediaPlayer: React.FC<MediaPlayerProps> = ({\n source,\n mimeType,\n poster,\n autoPlay = false,\n playing: playingProp,\n loop = false,\n controls = true,\n showProgress = false,\n onContainerClick,\n muted = false,\n}) => {\n const sourceType = getSourceType(mimeType)\n const [playing, setPlaying] = useState(autoPlay)\n\n // Sync controlled playing prop to internal state\n const prevPlayingPropRef = useRef(playingProp)\n useEffect(() => {\n if (\n playingProp !== undefined &&\n playingProp !== prevPlayingPropRef.current\n ) {\n prevPlayingPropRef.current = playingProp\n setPlaying(playingProp)\n }\n }, [playingProp])\n const [played, setPlayed] = useState(0)\n const [seeking, setSeeking] = useState(false)\n const [scrubberHovered, setScrubberHovered] = useState(false)\n const [videoAspect, setVideoAspect] = useState<number | null>(null)\n const [buffering, setBuffering] = useState(false)\n /** True until the first canPlay fires for the current source — hides controls/spinner behind poster. */\n const [initialLoad, setInitialLoad] = useState(true)\n /** Set when autoplay/play() was rejected so user can start via gesture (no controls UI). */\n const [manualPlayRequired, setManualPlayRequired] = useState(false)\n const playerRef = useRef<HTMLMediaElement>(null)\n const trackRef = useRef<HTMLDivElement>(null)\n const rafRef = useRef<number | null>(null)\n\n useEffect(() => {\n setManualPlayRequired(false)\n setInitialLoad(true)\n }, [source])\n\n useEffect(() => {\n if (!playing) {\n if (rafRef.current !== null) {\n cancelAnimationFrame(rafRef.current)\n rafRef.current = null\n }\n return\n }\n const tick = () => {\n const el = playerRef.current\n if (el && el.duration && !seeking) setPlayed(el.currentTime / el.duration)\n rafRef.current = requestAnimationFrame(tick)\n }\n rafRef.current = requestAnimationFrame(tick)\n return () => {\n if (rafRef.current !== null) cancelAnimationFrame(rafRef.current)\n }\n }, [playing, seeking])\n\n // ReactPlayer v3 uses native HTML media elements and does not support a\n // declarative `playing` prop — playback must be driven imperatively.\n useEffect(() => {\n const el = playerRef.current\n if (!el) return\n if (playing) {\n void el.play().catch((err) => {\n setPlaying(false)\n setManualPlayRequired(true)\n if (isDevBuild()) {\n console.debug('[MediaPlayer] play() failed', err)\n }\n })\n } else {\n el.pause()\n }\n }, [playing])\n\n const startPlaybackFromGesture = useCallback(() => {\n setManualPlayRequired(false)\n setPlaying(true)\n }, [])\n\n const getFraction = useCallback(\n (e: MouseEvent | TouchEvent | React.MouseEvent | React.TouchEvent) => {\n const track = trackRef.current\n if (!track) return 0\n const rect = track.getBoundingClientRect()\n return Math.max(\n 0,\n Math.min(1, (getClientXFromEvent(e) - rect.left) / rect.width)\n )\n },\n []\n )\n\n const seekTo = useCallback((fraction: number) => {\n const el = playerRef.current\n if (el && el.duration) el.currentTime = fraction * el.duration\n }, [])\n\n const handleTrackPointerDown = (\n e: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>\n ) => {\n e.stopPropagation()\n setSeeking(true)\n const fraction = getFraction(e)\n setPlayed(fraction)\n seekTo(fraction)\n }\n\n useEffect(() => {\n if (!seeking) return\n const onMove = (e: MouseEvent | TouchEvent) => setPlayed(getFraction(e))\n const onUp = (e: MouseEvent | TouchEvent) => {\n setSeeking(false)\n seekTo(getFraction(e))\n }\n window.addEventListener('mousemove', onMove)\n window.addEventListener('mouseup', onUp)\n window.addEventListener('touchmove', onMove, { passive: true })\n window.addEventListener('touchend', onUp)\n return () => {\n window.removeEventListener('mousemove', onMove)\n window.removeEventListener('mouseup', onUp)\n window.removeEventListener('touchmove', onMove)\n window.removeEventListener('touchend', onUp)\n }\n }, [seeking, getFraction, seekTo])\n\n // Use natural aspect ratio once metadata loads, fall back to 16:9 before then.\n const aspectStyle = videoAspect\n ? { aspectRatio: String(videoAspect) }\n : undefined\n const aspectClass = !videoAspect ? ' aspect-video' : ''\n const scrubberPercent = Math.round(played * 100)\n\n return (\n <div\n role=\"button\"\n tabIndex={0}\n className={`relative cursor-pointer overflow-hidden ${getPlayerBg(sourceType, poster)}${aspectClass}`}\n style={aspectStyle}\n onClick={() => {\n if (manualPlayRequired) return\n if (onContainerClick) {\n onContainerClick()\n return\n }\n if (controls) setPlaying((p) => !p)\n }}\n onKeyDown={(e) => {\n if (e.key !== 'Enter' && e.key !== ' ') return\n e.preventDefault()\n if (manualPlayRequired) return\n if (onContainerClick) {\n onContainerClick()\n return\n }\n if (controls) setPlaying((p) => !p)\n }}\n >\n {poster && (\n <img\n src={poster}\n alt=\"\"\n className=\"absolute inset-0 h-full w-full object-cover\"\n />\n )}\n {!poster && (\n <div className=\"absolute inset-0 flex items-center justify-center\">\n {renderTypeIcon(mimeType, {\n className: 'size-12 text-black/20',\n weight: 'regular',\n })}\n </div>\n )}\n {initialLoad && poster && (\n <div className=\"absolute inset-0 z-20\">\n <img src={poster} alt=\"\" className=\"h-full w-full object-cover\" />\n </div>\n )}\n <div className=\"absolute inset-0\">\n {sourceType === 'audio' ? (\n <audio\n ref={playerRef as React.RefObject<HTMLAudioElement>}\n src={source}\n loop={loop}\n muted={muted}\n style={{ width: '100%', height: '100%' }}\n onLoadStart={() => setBuffering(true)}\n onCanPlay={() => { setBuffering(false); setInitialLoad(false) }}\n onWaiting={() => setBuffering(true)}\n onPlay={() => setManualPlayRequired(false)}\n onEnded={() => {\n if (!loop) {\n setPlaying(false)\n setPlayed(0)\n }\n }}\n >\n <track kind=\"captions\" />\n </audio>\n ) : (\n <video\n ref={playerRef as React.RefObject<HTMLVideoElement>}\n src={source}\n poster={poster}\n loop={loop}\n muted={muted}\n playsInline\n style={{ width: '100%', height: '100%' }}\n onLoadStart={() => setBuffering(true)}\n onCanPlay={() => { setBuffering(false); setInitialLoad(false) }}\n onWaiting={() => setBuffering(true)}\n onPlay={() => setManualPlayRequired(false)}\n onLoadedMetadata={() => {\n const el = playerRef.current\n if (el instanceof HTMLVideoElement && el.videoWidth && el.videoHeight) {\n setVideoAspect(el.videoWidth / el.videoHeight)\n }\n }}\n onEnded={() => {\n if (!loop) {\n setPlaying(false)\n setPlayed(0)\n }\n }}\n >\n <track kind=\"captions\" />\n </video>\n )}\n </div>\n\n {buffering && !manualPlayRequired && (\n <div className=\"absolute inset-0 z-10 flex items-center justify-center\">\n <CircleNotchIcon\n className=\"size-8 animate-spin text-white/80\"\n weight=\"bold\"\n />\n </div>\n )}\n\n {manualPlayRequired && !controls && (\n <div\n className=\"absolute inset-0 z-30 flex cursor-pointer items-center justify-center bg-black/35\"\n role=\"button\"\n tabIndex={0}\n aria-label=\"Play preview\"\n onClick={(e) => {\n e.stopPropagation()\n startPlaybackFromGesture()\n }}\n onKeyDown={(e) => {\n if (e.key !== 'Enter' && e.key !== ' ') return\n e.preventDefault()\n e.stopPropagation()\n startPlaybackFromGesture()\n }}\n >\n <span className=\"flex size-16 items-center justify-center rounded-full bg-white/20 text-white backdrop-blur-sm\">\n <PlayIcon className=\"size-9 translate-x-0.5\" weight=\"fill\" />\n </span>\n </div>\n )}\n\n {showProgress && !controls && (\n <div className=\"absolute inset-x-0 bottom-0 px-3 pb-2.5 pt-6 bg-gradient-to-t from-black/40 to-transparent\">\n <div\n role=\"slider\"\n aria-label=\"Playback position\"\n aria-valuenow={scrubberPercent}\n aria-valuemin={0}\n aria-valuemax={100}\n tabIndex={0}\n ref={trackRef}\n className=\"relative flex h-4 w-full cursor-pointer items-center\"\n onMouseDown={handleTrackPointerDown}\n onTouchStart={handleTrackPointerDown}\n onClick={(e) => e.stopPropagation()}\n onKeyDown={(e) => {\n if (e.key === 'ArrowRight') seekTo(Math.min(1, played + 0.05))\n if (e.key === 'ArrowLeft') seekTo(Math.max(0, played - 0.05))\n }}\n >\n <div className=\"w-full overflow-hidden rounded-full bg-white/30 h-1\">\n <div\n className=\"h-full rounded-full bg-white\"\n style={{ width: `${scrubberPercent}%` }}\n />\n </div>\n </div>\n </div>\n )}\n\n {controls && (\n <div className=\"absolute inset-x-0 bottom-0 flex items-center gap-2 bg-gradient-to-t from-black/60 to-transparent px-3 pb-2.5 pt-6 transition-all duration-200\">\n <button\n type=\"button\"\n onClick={(e) => {\n e.stopPropagation()\n setPlaying((p) => !p)\n }}\n className=\"shrink-0 text-white\"\n aria-label={playing ? 'Pause' : 'Play'}\n >\n {playing ? (\n <PauseIcon className=\"size-5\" weight=\"fill\" />\n ) : (\n <PlayIcon className=\"size-5 translate-x-px\" weight=\"fill\" />\n )}\n </button>\n\n <div\n role=\"slider\"\n aria-label=\"Playback position\"\n aria-valuenow={scrubberPercent}\n aria-valuemin={0}\n aria-valuemax={100}\n tabIndex={0}\n ref={trackRef}\n className=\"relative flex h-4 w-full cursor-pointer items-center\"\n onMouseDown={handleTrackPointerDown}\n onTouchStart={handleTrackPointerDown}\n onClick={(e) => e.stopPropagation()}\n onMouseEnter={() => setScrubberHovered(true)}\n onMouseLeave={() => setScrubberHovered(false)}\n onKeyDown={(e) => {\n if (e.key === 'ArrowRight') seekTo(Math.min(1, played + 0.05))\n if (e.key === 'ArrowLeft') seekTo(Math.max(0, played - 0.05))\n }}\n >\n <div\n className={`w-full overflow-hidden rounded-full bg-white/30 transition-all duration-200 ${scrubberHovered || seeking ? 'h-1.5' : 'h-1'}`}\n >\n <div\n className=\"h-full rounded-full bg-white\"\n style={{ width: `${scrubberPercent}%` }}\n />\n </div>\n <div\n className={`absolute size-3 -translate-x-1/2 rounded-full bg-white shadow transition-[opacity,transform] duration-200 ${scrubberHovered || seeking ? 'scale-100 opacity-100' : 'scale-0 opacity-0'}`}\n style={{ left: `${scrubberPercent}%` }}\n />\n </div>\n </div>\n )}\n </div>\n )\n}\n\nexport default MediaPlayer\n"],"names":["DOCUMENT_ICON_PATTERNS","getSourceType","mimeType","getDocumentIconType","match","pattern","MEDIA_TYPE_ICON","VideoCameraIcon","SpeakerHighIcon","ImageIcon","FileIcon","DOCUMENT_ICON_COMPONENT","FilePdfIcon","FileDocIcon","FileXlsIcon","FileCsvIcon","FilePptIcon","FileZipIcon","FileTextIcon","FileMdIcon","getTypeIcon","sourceType","renderTypeIcon","props","React","getPlayerBg","poster","getClientXFromEvent","e","_a","_b","MediaPlayer","source","autoPlay","playingProp","loop","controls","showProgress","onContainerClick","muted","playing","setPlaying","useState","prevPlayingPropRef","useRef","useEffect","played","setPlayed","seeking","setSeeking","scrubberHovered","setScrubberHovered","videoAspect","setVideoAspect","buffering","setBuffering","initialLoad","setInitialLoad","manualPlayRequired","setManualPlayRequired","playerRef","trackRef","rafRef","tick","el","err","startPlaybackFromGesture","useCallback","getFraction","track","rect","seekTo","fraction","handleTrackPointerDown","onMove","onUp","aspectStyle","aspectClass","scrubberPercent","jsxs","p","jsx","CircleNotchIcon","PlayIcon","PauseIcon"],"mappings":";;;AAaA,MAAMA,KAA4D;AAAA,EAChE,CAAC,OAAO,KAAK;AAAA,EACb,CAAC,iCAAiC,KAAK;AAAA,EACvC,CAAC,gCAAgC,KAAK;AAAA,EACtC,CAAC,OAAO,KAAK;AAAA,EACb,CAAC,sCAAsC,KAAK;AAAA,EAC5C,CAAC,+BAA+B,KAAK;AAAA,EACrC,CAAC,aAAa,MAAM;AAAA,EACpB,CAAC,YAAY,UAAU;AACzB;AAEO,SAASC,EAAcC,GAAwC;AACpE,SAAIA,EAAS,WAAW,QAAQ,IAAU,UACtCA,EAAS,WAAW,QAAQ,IAAU,UACtCA,EAAS,WAAW,QAAQ,IAAU,UACnC;AACT;AAEO,SAASC,GAAoBD,GAAoC;AACtE,QAAME,IAAQJ,GAAuB;AAAA,IAAK,CAAC,CAACK,CAAO,MACjDA,EAAQ,KAAKH,CAAQ;AAAA,EAAA;AAEvB,SAAOE,IAAQA,EAAM,CAAC,IAAI;AAC5B;AChBO,MAAME,KACX;AAAA,EACE,OAAOC;AAAA,EACP,OAAOC;AAAA,EACP,OAAOC;AAAA,EACP,UAAUC;AACZ,GAEIC,KAA0B;AAAA,EAC9B,KAAKC;AAAA,EACL,KAAKC;AAAA,EACL,KAAKC;AAAA,EACL,KAAKC;AAAA,EACL,KAAKC;AAAA,EACL,KAAKC;AAAA,EACL,MAAMC;AAAA,EACN,UAAUC;AAAA,EACV,SAAST;AACX;AAEO,SAASU,GAAYlB,GAAqC;AAC/D,QAAMmB,IAAapB,EAAcC,CAAQ;AACzC,SAAImB,MAAe,aAAmBf,GAAgBe,CAAU,IACzDV,GAAwBR,GAAoBD,CAAQ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