@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.
Files changed (86) hide show
  1. package/dist/Card-B-L2MST4.js +107 -0
  2. package/dist/Card-B-L2MST4.js.map +1 -0
  3. package/dist/Card-B56QxJW3.cjs +2 -0
  4. package/dist/Card-B56QxJW3.cjs.map +1 -0
  5. package/dist/Card-Bqh-BQaX.js +132 -0
  6. package/dist/Card-Bqh-BQaX.js.map +1 -0
  7. package/dist/Card-ZCE6Lhfc.cjs +2 -0
  8. package/dist/Card-ZCE6Lhfc.cjs.map +1 -0
  9. package/dist/Card-g4JD-2ES.js +163 -0
  10. package/dist/Card-g4JD-2ES.js.map +1 -0
  11. package/dist/Card-wac6AMNc.cjs +2 -0
  12. package/dist/Card-wac6AMNc.cjs.map +1 -0
  13. package/dist/LockedThumbnail-BAQmoIff.js +220 -0
  14. package/dist/LockedThumbnail-BAQmoIff.js.map +1 -0
  15. package/dist/LockedThumbnail-Cr0Gqs3Y.cjs +2 -0
  16. package/dist/LockedThumbnail-Cr0Gqs3Y.cjs.map +1 -0
  17. package/dist/assets/index.css +1 -1
  18. package/dist/index-BPhZyaxT.cjs +2 -0
  19. package/dist/index-BPhZyaxT.cjs.map +1 -0
  20. package/dist/{index-DFZrAiLB.js → index-BxzzWK4K.js} +1249 -1276
  21. package/dist/index-BxzzWK4K.js.map +1 -0
  22. package/dist/index.cjs +1 -1
  23. package/dist/index.d.ts +101 -164
  24. package/dist/index.js +1 -1
  25. package/dist/testing.d.ts +0 -1
  26. package/package.json +2 -2
  27. package/src/components/ChannelList/CustomChannelPreview.test.tsx +0 -95
  28. package/src/components/ChannelList/CustomChannelPreview.tsx +9 -21
  29. package/src/components/CustomMessage/CustomMessage.stories.tsx +1 -54
  30. package/src/components/CustomMessage/MessageTag.tsx +0 -8
  31. package/src/components/CustomMessage/context.tsx +1 -1
  32. package/src/components/CustomMessage/index.tsx +42 -76
  33. package/src/components/CustomMessageInput/CustomMessageInput.stories.tsx +3 -5
  34. package/src/components/LockedAttachment/LockedAttachment.stories.tsx +450 -0
  35. package/src/components/LockedAttachment/components/Composer/Card.tsx +221 -0
  36. package/src/components/LockedAttachment/components/Composer/index.ts +2 -0
  37. package/src/components/LockedAttachment/components/Received/Card.tsx +191 -0
  38. package/src/components/{CustomMessage/LockedAttachment/components/Media → LockedAttachment/components/Received}/CardActions.tsx +2 -9
  39. package/src/components/LockedAttachment/components/Received/index.ts +2 -0
  40. package/src/components/LockedAttachment/components/Sent/Card.tsx +177 -0
  41. package/src/components/LockedAttachment/components/Sent/index.ts +2 -0
  42. package/src/components/{CustomMessage/LockedAttachment → LockedAttachment}/components/_shared/CardBody.tsx +7 -8
  43. package/src/components/{CustomMessage/LockedAttachment → LockedAttachment}/components/_shared/GalleryThumbnail.tsx +39 -31
  44. package/src/components/LockedAttachment/components/_shared/LockBadge.tsx +39 -0
  45. package/src/components/{CustomMessage/LockedAttachment/components/_shared/MediaShell.tsx → LockedAttachment/components/_shared/LockedCardShell.tsx} +8 -8
  46. package/src/components/{CustomMessage/LockedAttachment/components/_shared/SingleThumbnail.tsx → LockedAttachment/components/_shared/LockedThumbnail.tsx} +7 -11
  47. package/src/components/LockedAttachment/index.tsx +63 -0
  48. package/src/components/LockedAttachment/types.ts +51 -0
  49. package/src/index.ts +8 -3
  50. package/src/stream-custom-data.ts +0 -1
  51. package/src/styles.css +0 -12
  52. package/src/types.ts +1 -1
  53. package/dist/Card-415OfRhw.cjs +0 -2
  54. package/dist/Card-415OfRhw.cjs.map +0 -1
  55. package/dist/Card-CyWdUMCB.cjs +0 -2
  56. package/dist/Card-CyWdUMCB.cjs.map +0 -1
  57. package/dist/Card-V5d6qhDT.js +0 -694
  58. package/dist/Card-V5d6qhDT.js.map +0 -1
  59. package/dist/Card-qS17qnN0.js +0 -103
  60. package/dist/Card-qS17qnN0.js.map +0 -1
  61. package/dist/LoadingDots-Ct3WmVlT.js +0 -59
  62. package/dist/LoadingDots-Ct3WmVlT.js.map +0 -1
  63. package/dist/LoadingDots-D9GGphgM.cjs +0 -2
  64. package/dist/LoadingDots-D9GGphgM.cjs.map +0 -1
  65. package/dist/index-Bx_zjNMR.cjs +0 -2
  66. package/dist/index-Bx_zjNMR.cjs.map +0 -1
  67. package/dist/index-DFZrAiLB.js.map +0 -1
  68. package/src/components/CustomMessage/LockedAttachment/LockedAttachment.stories.tsx +0 -541
  69. package/src/components/CustomMessage/LockedAttachment/LockedAttachment.test.tsx +0 -117
  70. package/src/components/CustomMessage/LockedAttachment/components/Media/Card.tsx +0 -358
  71. package/src/components/CustomMessage/LockedAttachment/components/Media/types.ts +0 -79
  72. package/src/components/CustomMessage/LockedAttachment/components/Text/Card.tsx +0 -153
  73. package/src/components/CustomMessage/LockedAttachment/components/Text/types.ts +0 -58
  74. package/src/components/CustomMessage/LockedAttachment/components/_shared/CardThumbnail.tsx +0 -92
  75. package/src/components/CustomMessage/LockedAttachment/components/_shared/LoadingDots.tsx +0 -36
  76. package/src/components/CustomMessage/LockedAttachment/components/_shared/LockBadge.tsx +0 -63
  77. package/src/components/CustomMessage/LockedAttachment/components/_shared/PreviewToggle.tsx +0 -58
  78. package/src/components/CustomMessage/LockedAttachment/components/_shared/PriceLockRow.tsx +0 -21
  79. package/src/components/CustomMessage/LockedAttachment/components/_shared/PurchaseStatusBadge.tsx +0 -74
  80. package/src/components/CustomMessage/LockedAttachment/components/_shared/SkeletonTextLines.tsx +0 -29
  81. package/src/components/CustomMessage/LockedAttachment/components/_shared/TextShell.tsx +0 -28
  82. package/src/components/CustomMessage/LockedAttachment/components/_shared/usePreviewToggle.test.ts +0 -67
  83. package/src/components/CustomMessage/LockedAttachment/components/_shared/usePreviewToggle.ts +0 -89
  84. package/src/components/CustomMessage/LockedAttachment/components/_shared/useReceivedSource.ts +0 -83
  85. package/src/components/CustomMessage/LockedAttachment/index.tsx +0 -105
  86. 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
- }