@linktr.ee/messaging-react 3.10.0-rc-1783660962 → 3.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Card-B-L2MST4.js +107 -0
- package/dist/Card-B-L2MST4.js.map +1 -0
- package/dist/Card-B56QxJW3.cjs +2 -0
- package/dist/Card-B56QxJW3.cjs.map +1 -0
- package/dist/Card-Bqh-BQaX.js +132 -0
- package/dist/Card-Bqh-BQaX.js.map +1 -0
- package/dist/Card-ZCE6Lhfc.cjs +2 -0
- package/dist/Card-ZCE6Lhfc.cjs.map +1 -0
- package/dist/Card-g4JD-2ES.js +163 -0
- package/dist/Card-g4JD-2ES.js.map +1 -0
- package/dist/Card-wac6AMNc.cjs +2 -0
- package/dist/Card-wac6AMNc.cjs.map +1 -0
- package/dist/LockedThumbnail-BAQmoIff.js +220 -0
- package/dist/LockedThumbnail-BAQmoIff.js.map +1 -0
- package/dist/LockedThumbnail-Cr0Gqs3Y.cjs +2 -0
- package/dist/LockedThumbnail-Cr0Gqs3Y.cjs.map +1 -0
- package/dist/assets/index.css +1 -1
- package/dist/index-BPhZyaxT.cjs +2 -0
- package/dist/index-BPhZyaxT.cjs.map +1 -0
- package/dist/{index-DFZrAiLB.js → index-BxzzWK4K.js} +1249 -1276
- package/dist/index-BxzzWK4K.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +101 -164
- package/dist/index.js +1 -1
- package/dist/testing.d.ts +0 -1
- package/package.json +2 -2
- package/src/components/ChannelList/CustomChannelPreview.test.tsx +0 -95
- package/src/components/ChannelList/CustomChannelPreview.tsx +9 -21
- package/src/components/CustomMessage/CustomMessage.stories.tsx +1 -54
- package/src/components/CustomMessage/MessageTag.tsx +0 -8
- package/src/components/CustomMessage/context.tsx +1 -1
- package/src/components/CustomMessage/index.tsx +42 -76
- package/src/components/CustomMessageInput/CustomMessageInput.stories.tsx +3 -5
- package/src/components/LockedAttachment/LockedAttachment.stories.tsx +450 -0
- package/src/components/LockedAttachment/components/Composer/Card.tsx +221 -0
- package/src/components/LockedAttachment/components/Composer/index.ts +2 -0
- package/src/components/LockedAttachment/components/Received/Card.tsx +191 -0
- package/src/components/{CustomMessage/LockedAttachment/components/Media → LockedAttachment/components/Received}/CardActions.tsx +2 -9
- package/src/components/LockedAttachment/components/Received/index.ts +2 -0
- package/src/components/LockedAttachment/components/Sent/Card.tsx +177 -0
- package/src/components/LockedAttachment/components/Sent/index.ts +2 -0
- package/src/components/{CustomMessage/LockedAttachment → LockedAttachment}/components/_shared/CardBody.tsx +7 -8
- package/src/components/{CustomMessage/LockedAttachment → LockedAttachment}/components/_shared/GalleryThumbnail.tsx +39 -31
- package/src/components/LockedAttachment/components/_shared/LockBadge.tsx +39 -0
- package/src/components/{CustomMessage/LockedAttachment/components/_shared/MediaShell.tsx → LockedAttachment/components/_shared/LockedCardShell.tsx} +8 -8
- package/src/components/{CustomMessage/LockedAttachment/components/_shared/SingleThumbnail.tsx → LockedAttachment/components/_shared/LockedThumbnail.tsx} +7 -11
- package/src/components/LockedAttachment/index.tsx +63 -0
- package/src/components/LockedAttachment/types.ts +51 -0
- package/src/index.ts +8 -3
- package/src/stream-custom-data.ts +0 -1
- package/src/styles.css +0 -12
- package/src/types.ts +1 -1
- package/dist/Card-415OfRhw.cjs +0 -2
- package/dist/Card-415OfRhw.cjs.map +0 -1
- package/dist/Card-CyWdUMCB.cjs +0 -2
- package/dist/Card-CyWdUMCB.cjs.map +0 -1
- package/dist/Card-V5d6qhDT.js +0 -694
- package/dist/Card-V5d6qhDT.js.map +0 -1
- package/dist/Card-qS17qnN0.js +0 -103
- package/dist/Card-qS17qnN0.js.map +0 -1
- package/dist/LoadingDots-Ct3WmVlT.js +0 -59
- package/dist/LoadingDots-Ct3WmVlT.js.map +0 -1
- package/dist/LoadingDots-D9GGphgM.cjs +0 -2
- package/dist/LoadingDots-D9GGphgM.cjs.map +0 -1
- package/dist/index-Bx_zjNMR.cjs +0 -2
- package/dist/index-Bx_zjNMR.cjs.map +0 -1
- package/dist/index-DFZrAiLB.js.map +0 -1
- package/src/components/CustomMessage/LockedAttachment/LockedAttachment.stories.tsx +0 -541
- package/src/components/CustomMessage/LockedAttachment/LockedAttachment.test.tsx +0 -117
- package/src/components/CustomMessage/LockedAttachment/components/Media/Card.tsx +0 -358
- package/src/components/CustomMessage/LockedAttachment/components/Media/types.ts +0 -79
- package/src/components/CustomMessage/LockedAttachment/components/Text/Card.tsx +0 -153
- package/src/components/CustomMessage/LockedAttachment/components/Text/types.ts +0 -58
- package/src/components/CustomMessage/LockedAttachment/components/_shared/CardThumbnail.tsx +0 -92
- package/src/components/CustomMessage/LockedAttachment/components/_shared/LoadingDots.tsx +0 -36
- package/src/components/CustomMessage/LockedAttachment/components/_shared/LockBadge.tsx +0 -63
- package/src/components/CustomMessage/LockedAttachment/components/_shared/PreviewToggle.tsx +0 -58
- package/src/components/CustomMessage/LockedAttachment/components/_shared/PriceLockRow.tsx +0 -21
- package/src/components/CustomMessage/LockedAttachment/components/_shared/PurchaseStatusBadge.tsx +0 -74
- package/src/components/CustomMessage/LockedAttachment/components/_shared/SkeletonTextLines.tsx +0 -29
- package/src/components/CustomMessage/LockedAttachment/components/_shared/TextShell.tsx +0 -28
- package/src/components/CustomMessage/LockedAttachment/components/_shared/usePreviewToggle.test.ts +0 -67
- package/src/components/CustomMessage/LockedAttachment/components/_shared/usePreviewToggle.ts +0 -89
- package/src/components/CustomMessage/LockedAttachment/components/_shared/useReceivedSource.ts +0 -83
- package/src/components/CustomMessage/LockedAttachment/index.tsx +0 -105
- package/src/components/CustomMessage/LockedAttachment/types.ts +0 -44
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import React, { Suspense } from 'react'
|
|
2
|
-
|
|
3
|
-
import type {
|
|
4
|
-
MediaCardDraftProps,
|
|
5
|
-
MediaCardOtherProps,
|
|
6
|
-
MediaCardOwnProps,
|
|
7
|
-
MediaCardPreviewProps,
|
|
8
|
-
} from './components/Media/types'
|
|
9
|
-
import type {
|
|
10
|
-
TextCardOtherProps,
|
|
11
|
-
TextCardOwnProps,
|
|
12
|
-
} from './components/Text/types'
|
|
13
|
-
|
|
14
|
-
const TextCardLazy = React.lazy(() => import('./components/Text/Card'))
|
|
15
|
-
const MediaCardLazy = React.lazy(() => import('./components/Media/Card'))
|
|
16
|
-
|
|
17
|
-
const LockedAttachmentFallback = () => (
|
|
18
|
-
<div
|
|
19
|
-
className="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
|
-
aria-hidden
|
|
21
|
-
/>
|
|
22
|
-
)
|
|
23
|
-
|
|
24
|
-
export type DraftProps = MediaCardDraftProps & {
|
|
25
|
-
/** Drafting is always the sender — doesn't apply here. */
|
|
26
|
-
isMine?: never
|
|
27
|
-
/**
|
|
28
|
-
* "text" renders as a chat bubble showing the real draft `text` instead of
|
|
29
|
-
* a media thumbnail card. Media-only fields below are ignored in text mode.
|
|
30
|
-
* Defaults to `"media"`.
|
|
31
|
-
*/
|
|
32
|
-
contentType?: 'text' | 'media'
|
|
33
|
-
/** The message's own text, shown as-is (not redacted yet). Only used when `contentType` is `"text"`. */
|
|
34
|
-
renderedText?: React.ReactNode
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export type PreviewProps = MediaCardPreviewProps & {
|
|
38
|
-
/** Drafting is always the sender — doesn't apply here. */
|
|
39
|
-
isMine?: never
|
|
40
|
-
/**
|
|
41
|
-
* "text" renders as a chat bubble instead of a media thumbnail card.
|
|
42
|
-
* Media-only fields below are ignored in text mode. Defaults to `"media"`.
|
|
43
|
-
*/
|
|
44
|
-
contentType?: 'text' | 'media'
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export type SentTextOwnProps = TextCardOwnProps & {
|
|
48
|
-
contentType: 'text'
|
|
49
|
-
/** Sender's view has no unlock flow — doesn't apply here. */
|
|
50
|
-
onUnlockClick?: never
|
|
51
|
-
isUnlocking?: never
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export type SentTextOtherProps = TextCardOtherProps & {
|
|
55
|
-
contentType: 'text'
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export type SentMediaOwnProps = MediaCardOwnProps & {
|
|
59
|
-
contentType?: 'media'
|
|
60
|
-
/** Sender's view has no unlock/download flow — doesn't apply here. */
|
|
61
|
-
onUnlockClick?: never
|
|
62
|
-
isUnlocking?: never
|
|
63
|
-
onDownloadClick?: never
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export type SentMediaOtherProps = MediaCardOtherProps & {
|
|
67
|
-
contentType?: 'media'
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* The card for a paid attachment — a still-drafting `isDraft` card, a static
|
|
72
|
-
* receiver-facing `isPreview` mockup, or a sent text/media card discriminated
|
|
73
|
-
* by `isMine` + `contentType`. Internally lazy-loads only the one underlying
|
|
74
|
-
* implementation the resolved branch needs.
|
|
75
|
-
*/
|
|
76
|
-
export type LockedAttachmentProps =
|
|
77
|
-
| DraftProps
|
|
78
|
-
| PreviewProps
|
|
79
|
-
| SentTextOwnProps
|
|
80
|
-
| SentTextOtherProps
|
|
81
|
-
| SentMediaOwnProps
|
|
82
|
-
| SentMediaOtherProps
|
|
83
|
-
|
|
84
|
-
const LockedAttachment: React.FC<LockedAttachmentProps> = (props) => {
|
|
85
|
-
return (
|
|
86
|
-
<Suspense fallback={<LockedAttachmentFallback />}>
|
|
87
|
-
{props.contentType === 'text' ? (
|
|
88
|
-
<TextCardLazy {...props} />
|
|
89
|
-
) : (
|
|
90
|
-
<MediaCardLazy {...props} />
|
|
91
|
-
)}
|
|
92
|
-
</Suspense>
|
|
93
|
-
)
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export default LockedAttachment
|
|
97
|
-
export { default as PurchaseStatusBadge } from './components/_shared/PurchaseStatusBadge'
|
|
98
|
-
export type { PurchaseStatusBadgeProps } from './components/_shared/PurchaseStatusBadge'
|
|
99
|
-
export type {
|
|
100
|
-
PaymentStatus,
|
|
101
|
-
FetchSourceHandler,
|
|
102
|
-
LockedAttachmentSource,
|
|
103
|
-
LockedAttachmentGalleryItem,
|
|
104
|
-
LockedAttachmentContextValue,
|
|
105
|
-
} from './types'
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import type { Channel, LocalMessage } from 'stream-chat'
|
|
2
|
-
|
|
3
|
-
import type { PaymentStatus } from '../../../stream-custom-data'
|
|
4
|
-
|
|
5
|
-
export interface LockedAttachmentGalleryItem {
|
|
6
|
-
/** Drives the per-item play/lock affordance. */
|
|
7
|
-
mimeType: string
|
|
8
|
-
/** Poster image, locked or unlocked. */
|
|
9
|
-
thumbnailUrl?: string
|
|
10
|
-
/** Media source, shown only when unlocked. */
|
|
11
|
-
sourceUrl?: string
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface LockedAttachmentSource {
|
|
15
|
-
/** Proxied URL for in-app playback. */
|
|
16
|
-
sourceUrl: string
|
|
17
|
-
/** Opened when the visitor clicks Download. */
|
|
18
|
-
redeemUrl?: string
|
|
19
|
-
/** Overrides the metadata thumbnail when present. */
|
|
20
|
-
thumbnailUrl?: string
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export type { PaymentStatus }
|
|
24
|
-
|
|
25
|
-
/** Fetches the underlying source; `void` return means none available. */
|
|
26
|
-
export type FetchSourceHandler = () => Promise<LockedAttachmentSource | void>
|
|
27
|
-
|
|
28
|
-
export interface LockedAttachmentContextValue {
|
|
29
|
-
/** Whether the given message is mid-checkout. */
|
|
30
|
-
isUnlocking: (id: string) => boolean
|
|
31
|
-
/** Opens the checkout flow for a message. */
|
|
32
|
-
onUnlockClick?: (message: LocalMessage, channel: Channel) => void
|
|
33
|
-
/** Handles a Download click for a message. */
|
|
34
|
-
onDownloadClick?: (message: LocalMessage, channel: Channel) => void
|
|
35
|
-
/** Reveals the locked media's source. Unused for text — payment writes `message.text` directly. */
|
|
36
|
-
onFetchSource?: (
|
|
37
|
-
message: LocalMessage,
|
|
38
|
-
channel: Channel
|
|
39
|
-
) => Promise<LockedAttachmentSource | void>
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export const defaultLockedAttachmentContextValue: LockedAttachmentContextValue = {
|
|
43
|
-
isUnlocking: () => false,
|
|
44
|
-
}
|