@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Visitor-DyJTWB2_.js","sources":["../src/components/LockedAttachment/components/Visitor.tsx"],"sourcesContent":["import {\n CheckCircleIcon,\n DownloadSimpleIcon,\n LockOpenIcon,\n LockSimpleIcon,\n} from '@phosphor-icons/react'\nimport React, { useCallback, useEffect, useState } from 'react'\n\nimport type { LockedAttachmentBaseProps, LockedAttachmentSource, PaymentStatus } from '../types'\nimport { renderTypeIcon } from '../utils/icons'\nimport { getSourceType } from '../utils/mimeType'\n\nimport MediaPlayer from './MediaPlayer'\n\nexport interface VisitorCardProps extends LockedAttachmentBaseProps {\n /** \n * Called when the visitor clicks Unlock. Omit to hide the Unlock button. \n */\n onUnlockClick?: () => void\n /** \n * Called when the visitor clicks Download on an unlocked card. \n * Omit to hide the Download button.\n */\n onDownloadClick?: () => void\n /**\n * Returns current unlock state — sourceUrl (for playback) and redeemUrl (for download).\n * Bound to the message by the host before being passed down,\n * so this component receives no Stream Chat types.\n */\n onUnlocked?: () => LockedAttachmentSource\n}\n\nconst getLockIcon = (paymentStatus?: PaymentStatus): React.ElementType => {\n return paymentStatus === 'paid' ? LockOpenIcon : LockSimpleIcon\n}\n\ninterface LockOverlayProps {\n icon: React.ElementType\n}\n\nconst LockOverlay: React.FC<LockOverlayProps> = (props) => {\n const { icon: Icon } = props\n return (\n <div className=\"absolute inset-0 bg-black/30\">\n <div className=\"absolute left-3 top-3 flex size-8 items-center justify-center rounded-full bg-black/60\">\n <Icon className=\"size-4 text-white\" weight=\"fill\" />\n </div>\n </div>\n )\n}\n\ninterface LockedPreviewProps {\n thumbnailUrl?: string\n mimeType: string\n LockIcon: React.ElementType\n}\n\nconst LockedPreview: React.FC<LockedPreviewProps> = (props) => {\n const { thumbnailUrl, mimeType, LockIcon } = props\n return (\n <div className=\"relative aspect-video overflow-hidden bg-black/5\">\n {thumbnailUrl ? (\n <img\n src={thumbnailUrl}\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 <LockOverlay icon={LockIcon} />\n </div>\n )\n}\n\ninterface ImagePreviewProps {\n sourceUrl?: string\n thumbnailUrl?: string\n mimeType: string\n title?: string\n paymentStatus?: PaymentStatus\n isLocked: boolean\n}\n\nconst ImagePreview: React.FC<ImagePreviewProps> = (props) => {\n const { sourceUrl, thumbnailUrl, mimeType, title, paymentStatus, isLocked } = props\n const [sourceReady, setSourceReady] = useState(false)\n\n if (isLocked) {\n return (\n <LockedPreview\n thumbnailUrl={thumbnailUrl}\n mimeType={mimeType}\n LockIcon={getLockIcon(paymentStatus)}\n />\n )\n }\n\n return (\n <div className=\"relative overflow-hidden bg-black/5\">\n <img\n src={sourceUrl}\n alt={title}\n className={`block w-full transition-opacity duration-300 ${sourceReady ? 'opacity-100' : 'opacity-0'}`}\n onLoad={() => setSourceReady(true)}\n />\n </div>\n )\n}\n\ninterface DocumentPreviewProps {\n thumbnailUrl?: string\n mimeType: string\n paymentStatus?: PaymentStatus\n isLocked: boolean\n}\n\nconst DocumentPreview: React.FC<DocumentPreviewProps> = (props) => {\n const { thumbnailUrl, mimeType, paymentStatus, isLocked } = props\n return (\n <div className=\"relative aspect-video overflow-hidden bg-black/5\">\n {thumbnailUrl ? (\n <img\n src={thumbnailUrl}\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 {isLocked && <LockOverlay icon={getLockIcon(paymentStatus)} />}\n </div>\n )\n}\n\ninterface MediaPreviewProps {\n sourceUrl?: string\n thumbnailUrl?: string\n mimeType: string\n paymentStatus?: PaymentStatus\n isLocked: boolean\n}\n\nconst MediaPreview: React.FC<MediaPreviewProps> = (props) => {\n const { sourceUrl, thumbnailUrl, mimeType, paymentStatus, isLocked } = props\n if (isLocked) {\n return (\n <LockedPreview\n thumbnailUrl={thumbnailUrl}\n mimeType={mimeType}\n LockIcon={getLockIcon(paymentStatus)}\n />\n )\n }\n return (\n <MediaPlayer\n source={sourceUrl!}\n mimeType={mimeType}\n poster={thumbnailUrl}\n />\n )\n}\n\nconst LoadingDots = () => (\n <span className=\"flex items-center gap-1\">\n <span className=\"size-1 rounded-full bg-white animate-bounce [animation-delay:-0.3s]\" />\n <span className=\"size-1 rounded-full bg-white animate-bounce [animation-delay:-0.15s]\" />\n <span className=\"size-1 rounded-full bg-white animate-bounce\" />\n </span>\n)\n\ninterface CardActionsProps {\n isLocked: boolean\n isUnlocking?: boolean\n sourceUrl?: string\n redeemUrl?: string\n onUnlockClicked?: () => void\n onDownloadClicked?: () => void\n}\n\nconst CardActions: React.FC<CardActionsProps> = (props) => {\n const {\n isLocked,\n isUnlocking,\n sourceUrl,\n redeemUrl,\n onUnlockClicked,\n onDownloadClicked,\n } = props\n\n if (isLocked && onUnlockClicked) {\n return (\n <button\n type=\"button\"\n onClick={onUnlockClicked}\n disabled={isUnlocking}\n 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\"\n >\n {isUnlocking ? (\n <LoadingDots />\n ) : (\n <>\n <LockSimpleIcon className=\"size-4\" weight=\"fill\" />\n Unlock\n </>\n )}\n </button>\n )\n }\n\n if (!isLocked && onDownloadClicked && sourceUrl) {\n return (\n <a\n href={redeemUrl ?? sourceUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n onClick={onDownloadClicked}\n 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]\"\n >\n <DownloadSimpleIcon className=\"size-4\" weight=\"bold\" />\n Download\n </a>\n )\n }\n\n return null\n}\n\nconst VisitorCard: React.FC<VisitorCardProps> = (props) => {\n const {\n title,\n amountText,\n thumbnailUrl,\n mimeType = 'application/octet-stream',\n detail,\n onUnlocked,\n onUnlockClick,\n onDownloadClick,\n paymentStatus,\n } = props\n\n const { sourceUrl, redeemUrl } = onUnlocked?.() ?? {}\n const [isUnlocking, setUnlocking] = useState(false)\n\n const isLocked = sourceUrl === undefined\n const sourceType = getSourceType(mimeType)\n\n useEffect(() => {\n if (sourceUrl !== undefined) {\n setUnlocking(false)\n }\n }, [sourceUrl])\n\n const onUnlockClicked = useCallback(() => {\n if (onUnlockClick) {\n setUnlocking(true)\n onUnlockClick()\n }\n }, [onUnlockClick])\n\n let mediaPreview: React.ReactNode\n if (sourceType === 'image') {\n mediaPreview = (\n <ImagePreview\n key={sourceUrl}\n sourceUrl={sourceUrl}\n thumbnailUrl={thumbnailUrl}\n mimeType={mimeType}\n title={title}\n paymentStatus={paymentStatus}\n isLocked={isLocked}\n />\n )\n } else if (sourceType === 'document') {\n mediaPreview = (\n <DocumentPreview\n thumbnailUrl={thumbnailUrl}\n mimeType={mimeType}\n paymentStatus={paymentStatus}\n isLocked={isLocked}\n />\n )\n } else {\n mediaPreview = (\n <MediaPreview\n key={sourceUrl}\n sourceUrl={sourceUrl}\n thumbnailUrl={thumbnailUrl}\n mimeType={mimeType}\n paymentStatus={paymentStatus}\n isLocked={isLocked}\n />\n )\n }\n\n return (\n <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)]\">\n {mediaPreview}\n <div className=\"px-4 pb-3 pt-3\">\n <p className=\"mb-1.5 truncate text-base font-medium text-black\">\n {title}\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 <React.Fragment>\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 </React.Fragment>\n ) : (\n amountText && (\n <React.Fragment>\n <span className=\"text-xs font-medium text-black/55\">•</span>\n <span className=\"text-xs font-medium text-black/55\">\n {amountText}\n </span>\n </React.Fragment>\n )\n )}\n </div>\n <CardActions\n isLocked={isLocked}\n isUnlocking={isUnlocking}\n sourceUrl={sourceUrl}\n redeemUrl={redeemUrl}\n onUnlockClicked={onUnlockClicked}\n onDownloadClicked={onDownloadClick}\n />\n </div>\n </div>\n )\n}\n\nexport default VisitorCard\n"],"names":["getLockIcon","paymentStatus","LockOpenIcon","LockSimpleIcon","LockOverlay","props","Icon","jsx","LockedPreview","thumbnailUrl","mimeType","LockIcon","jsxs","ImagePreview","sourceUrl","title","isLocked","sourceReady","setSourceReady","useState","DocumentPreview","MediaPreview","MediaPlayer","LoadingDots","CardActions","isUnlocking","redeemUrl","onUnlockClicked","onDownloadClicked","Fragment","DownloadSimpleIcon","VisitorCard","amountText","detail","onUnlocked","onUnlockClick","onDownloadClick","setUnlocking","sourceType","getSourceType","useEffect","useCallback","mediaPreview","renderTypeIcon","React","CheckCircleIcon"],"mappings":";;;;AAgCA,MAAMA,IAAc,CAACC,MACZA,MAAkB,SAASC,IAAeC,GAO7CC,IAA0C,CAACC,MAAU;AACzD,QAAM,EAAE,MAAMC,EAAA,IAASD;AACvB,SACE,gBAAAE,EAAC,OAAA,EAAI,WAAU,gCACb,4BAAC,OAAA,EAAI,WAAU,0FACb,UAAA,gBAAAA,EAACD,KAAK,WAAU,qBAAoB,QAAO,OAAA,CAAO,GACpD,GACF;AAEJ,GAQME,IAA8C,CAACH,MAAU;AAC7D,QAAM,EAAE,cAAAI,GAAc,UAAAC,GAAU,UAAAC,EAAA,IAAaN;AAC7C,SACE,gBAAAO,EAAC,OAAA,EAAI,WAAU,oDACZ,UAAA;AAAA,IAAAH,IACC,gBAAAF;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAKE;AAAA,QACL,KAAI;AAAA,QACJ,WAAU;AAAA,MAAA;AAAA,IAAA,IAGZ,gBAAAF,EAAC,OAAA,EAAI,WAAU,qDACZ,YAAeG,GAAU;AAAA,MACxB,WAAW;AAAA,MACX,QAAQ;AAAA,IAAA,CACT,GACH;AAAA,IAEF,gBA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F;AAAA,EAAA,GACF;AAEJ;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -111,7 +111,7 @@ export declare const ChannelView: default_2.NamedExoticComponent<ChannelViewProp
|
|
|
111
111
|
* Props that MessagingShell passes through to ChannelView.
|
|
112
112
|
* ChannelViewProps is the source of truth for these props.
|
|
113
113
|
*/
|
|
114
|
-
declare type ChannelViewPassthroughProps = Pick<ChannelViewProps, 'renderMessageInputActions' | 'renderConversationFooter' | 'CustomChannelEmptyState' | 'onDeleteConversationClick' | 'onBlockParticipantClick' | 'onReportParticipantClick' | 'dmAgentEnabled' | 'messageMetadata' | 'onMessageSent' | 'showStarButton' | 'chatbotVotingEnabled' | 'renderChannelBanner' | 'customProfileContent' | 'customChannelActions' | 'renderMessage' | '
|
|
114
|
+
declare type ChannelViewPassthroughProps = Pick<ChannelViewProps, 'renderMessageInputActions' | 'renderConversationFooter' | 'CustomChannelEmptyState' | 'onDeleteConversationClick' | 'onBlockParticipantClick' | 'onReportParticipantClick' | 'dmAgentEnabled' | 'messageMetadata' | 'onMessageSent' | 'showStarButton' | 'chatbotVotingEnabled' | 'renderChannelBanner' | 'customProfileContent' | 'customChannelActions' | 'renderMessage' | 'onAttachmentUnlockClick' | 'onAttachmentDownloadClick' | 'onAttachmentUnlocked'>;
|
|
115
115
|
|
|
116
116
|
/**
|
|
117
117
|
* ChannelView component props
|
|
@@ -217,22 +217,27 @@ export declare interface ChannelViewProps {
|
|
|
217
217
|
*/
|
|
218
218
|
renderMessage?: (messageNode: React.ReactElement, message: LocalMessage) => React.ReactNode;
|
|
219
219
|
/**
|
|
220
|
-
* Called when the visitor clicks Unlock on a locked attachment
|
|
221
|
-
*
|
|
222
|
-
* the unlocked URL. `attachment_source` must NOT be stored on the Stream message metadata.
|
|
223
|
-
* The card shows a loading state for the full duration of the promise.
|
|
220
|
+
* Called when the visitor clicks Unlock on a locked attachment card.
|
|
221
|
+
* Fire-and-forget; host is responsible for opening checkout and tracking unlock state.
|
|
224
222
|
*/
|
|
225
|
-
|
|
223
|
+
onAttachmentUnlockClick?: (message: LocalMessage, channel: Channel) => void;
|
|
226
224
|
/**
|
|
227
|
-
* Called when the visitor clicks Download on an unlocked attachment
|
|
225
|
+
* Called when the visitor clicks Download on an unlocked attachment card.
|
|
228
226
|
*/
|
|
229
|
-
|
|
227
|
+
onAttachmentDownloadClick?: (message: LocalMessage, channel: Channel) => void;
|
|
228
|
+
/**
|
|
229
|
+
* Returns the current unlock state for a given message ID.
|
|
230
|
+
* Called by CustomMessage on each render to drive controlled props on LockedAttachment.
|
|
231
|
+
* Host owns sourceUrl / redeemUrl state.
|
|
232
|
+
*/
|
|
233
|
+
onAttachmentUnlocked?: (message: LocalMessage, channel: Channel) => LockedAttachmentSource;
|
|
230
234
|
}
|
|
231
235
|
|
|
232
236
|
declare interface CreatorCardProps extends LockedAttachmentBaseProps {
|
|
233
237
|
isPreview?: boolean;
|
|
234
238
|
placeholderTitle?: string;
|
|
235
239
|
placeholderAmountText?: string;
|
|
240
|
+
sourceUrl?: string;
|
|
236
241
|
onDismiss?: () => void;
|
|
237
242
|
}
|
|
238
243
|
|
|
@@ -276,19 +281,21 @@ export declare const formatRelativeTime: (date: Date) => string;
|
|
|
276
281
|
export declare const LockedAttachment: (props: LockedAttachmentProps) => JSX_2.Element;
|
|
277
282
|
|
|
278
283
|
declare interface LockedAttachmentBaseProps {
|
|
284
|
+
mimeType: string;
|
|
279
285
|
title?: string;
|
|
280
|
-
|
|
281
|
-
thumbnail?: string;
|
|
282
|
-
source?: string;
|
|
286
|
+
thumbnailUrl?: string;
|
|
283
287
|
detail?: string;
|
|
284
288
|
amountText?: string;
|
|
285
289
|
paymentStatus?: PaymentStatus;
|
|
286
290
|
}
|
|
287
291
|
|
|
288
|
-
export declare type LockedAttachmentProps = (CreatorCardProps & Never<VisitorCardProps, '
|
|
292
|
+
export declare type LockedAttachmentProps = (CreatorCardProps & Never<VisitorCardProps, 'onUnlockClick' | 'onDownloadClick' | 'onUnlocked'>) | (VisitorCardProps & Never<CreatorCardProps, 'isPreview' | 'placeholderTitle' | 'placeholderAmountText' | 'sourceUrl' | 'onDismiss'>);
|
|
289
293
|
|
|
290
294
|
export declare interface LockedAttachmentSource {
|
|
291
|
-
|
|
295
|
+
/** Proxied URL used by the media player for in-app playback. */
|
|
296
|
+
sourceUrl: string;
|
|
297
|
+
/** URL opened when the visitor clicks Download — may be a file or a web destination. */
|
|
298
|
+
redeemUrl?: string;
|
|
292
299
|
}
|
|
293
300
|
|
|
294
301
|
declare type MessageCustomType = 'MESSAGE_TIP' | 'MESSAGE_PAID' | 'MESSAGE_CHATBOT' | 'MESSAGE_ATTACHMENT' | AgeSafetySystemType | DmAgentSystemType;
|
|
@@ -519,13 +526,20 @@ export declare const useParticipants: (participantSource: ParticipantSource, opt
|
|
|
519
526
|
|
|
520
527
|
declare interface VisitorCardProps extends LockedAttachmentBaseProps {
|
|
521
528
|
/**
|
|
522
|
-
* Called when the visitor clicks Unlock.
|
|
523
|
-
|
|
524
|
-
|
|
529
|
+
* Called when the visitor clicks Unlock. Omit to hide the Unlock button.
|
|
530
|
+
*/
|
|
531
|
+
onUnlockClick?: () => void;
|
|
532
|
+
/**
|
|
533
|
+
* Called when the visitor clicks Download on an unlocked card.
|
|
534
|
+
* Omit to hide the Download button.
|
|
535
|
+
*/
|
|
536
|
+
onDownloadClick?: () => void;
|
|
537
|
+
/**
|
|
538
|
+
* Returns current unlock state — sourceUrl (for playback) and redeemUrl (for download).
|
|
539
|
+
* Bound to the message by the host before being passed down,
|
|
540
|
+
* so this component receives no Stream Chat types.
|
|
525
541
|
*/
|
|
526
|
-
|
|
527
|
-
/** Called when the visitor clicks Download on an unlocked card. */
|
|
528
|
-
onDownload?: () => void;
|
|
542
|
+
onUnlocked?: () => LockedAttachmentSource;
|
|
529
543
|
}
|
|
530
544
|
|
|
531
545
|
export declare type VoteSelection = 'up' | 'down' | null;
|