@linktr.ee/messaging-react 1.26.1 → 1.28.0-rc-1776225927
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-D38dWn2X.js +318 -0
- package/dist/Creator-D38dWn2X.js.map +1 -0
- package/dist/MediaPlayer-DE9MC6k6.js +599 -0
- package/dist/MediaPlayer-DE9MC6k6.js.map +1 -0
- package/dist/Preview-DqAv16NS.js +87 -0
- package/dist/Preview-DqAv16NS.js.map +1 -0
- package/dist/Visitor-BG-9-3HU.js +199 -0
- package/dist/Visitor-BG-9-3HU.js.map +1 -0
- package/dist/dash.all.min-Duv4lvGS.js +18858 -0
- package/dist/dash.all.min-Duv4lvGS.js.map +1 -0
- package/dist/hls-Bogc7CBn.js +21710 -0
- package/dist/hls-Bogc7CBn.js.map +1 -0
- package/dist/index-Da-xN4Yq.js +16142 -0
- package/dist/index-Da-xN4Yq.js.map +1 -0
- package/dist/index-Dj9rqWcU.js +69 -0
- package/dist/index-Dj9rqWcU.js.map +1 -0
- package/dist/index.d.ts +74 -10
- package/dist/index.js +979 -934
- package/dist/index.js.map +1 -1
- package/dist/mixin-B6jYfIcp.js +808 -0
- package/dist/mixin-B6jYfIcp.js.map +1 -0
- package/dist/react-BxlQMOfz.js +419 -0
- package/dist/react-BxlQMOfz.js.map +1 -0
- package/dist/react-COAP-MIW.js +377 -0
- package/dist/react-COAP-MIW.js.map +1 -0
- package/dist/react-Cn4WlMcl.js +3108 -0
- package/dist/react-Cn4WlMcl.js.map +1 -0
- package/dist/react-CwTJArKY.js +459 -0
- package/dist/react-CwTJArKY.js.map +1 -0
- package/dist/react-DkfS_atT.js +373 -0
- package/dist/react-DkfS_atT.js.map +1 -0
- package/dist/react-Pea5fum1.js +286 -0
- package/dist/react-Pea5fum1.js.map +1 -0
- package/dist/react-RiBbsUDd.js +534 -0
- package/dist/react-RiBbsUDd.js.map +1 -0
- package/dist/react-dS1WBxxz.js +238 -0
- package/dist/react-dS1WBxxz.js.map +1 -0
- package/package.json +2 -1
- package/src/components/ChannelView.tsx +12 -2
- package/src/components/CustomMessage/CustomMessage.stories.tsx +173 -41
- package/src/components/CustomMessage/MessageTag.tsx +5 -0
- package/src/components/CustomMessage/index.tsx +43 -4
- package/src/components/LockedAttachment/LockedAttachment.stories.tsx +343 -0
- package/src/components/LockedAttachment/components/Creator.tsx +469 -0
- package/src/components/LockedAttachment/components/MediaPlayer.tsx +359 -0
- package/src/components/LockedAttachment/components/Visitor.tsx +356 -0
- package/src/components/LockedAttachment/index.tsx +39 -0
- package/src/components/LockedAttachment/types.ts +17 -0
- package/src/components/LockedAttachment/utils/icons.ts +53 -0
- package/src/components/LockedAttachment/utils/mimeType.test.ts +119 -0
- package/src/components/LockedAttachment/utils/mimeType.ts +37 -0
- package/src/components/ParticipantPicker/index.tsx +8 -1
- package/src/hooks/useParticipants.ts +3 -2
- package/src/index.ts +4 -0
- package/src/stories/decorators/storyUser.tsx +37 -0
- package/src/stream-custom-data.ts +9 -3
- package/src/types.ts +20 -1
- package/src/utils/isDevBuild.ts +10 -0
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
import type { Meta, StoryFn } from '@storybook/react'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
import LockedAttachment, { type VisitorCardProps } from '.'
|
|
5
|
+
|
|
6
|
+
const VIDEO_THUMBNAIL_BLURRED = '/video-thumbnail-blurred.jpg'
|
|
7
|
+
const VIDEO_SOURCE = '/video-source.mp4'
|
|
8
|
+
|
|
9
|
+
const IMAGE_THUMBNAIL_BLURRED = '/image-thumbnail-blurred.jpg'
|
|
10
|
+
const IMAGE_SOURCE = '/image-source.jpg'
|
|
11
|
+
|
|
12
|
+
const DOCUMENT_THUMBNAIL = '/document-thumbnail.jpg'
|
|
13
|
+
const DOCUMENT_SOURCE = '/document-source.pdf'
|
|
14
|
+
|
|
15
|
+
const AUDIO_THUMBNAIL = '/audio-thumbnail.jpg'
|
|
16
|
+
const AUDIO_SOURCE = '/audio-source.mp3'
|
|
17
|
+
|
|
18
|
+
const meta: Meta = {
|
|
19
|
+
title: 'Components/LockedAttachment',
|
|
20
|
+
component: LockedAttachment,
|
|
21
|
+
parameters: { layout: 'centered' },
|
|
22
|
+
}
|
|
23
|
+
export default meta
|
|
24
|
+
|
|
25
|
+
type InteractiveProps = Omit<VisitorCardProps, 'onUnlock' | 'onDownload'> & {
|
|
26
|
+
unlockedSource: string
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const Interactive = ({ unlockedSource, ...props }: InteractiveProps) => (
|
|
30
|
+
<LockedAttachment
|
|
31
|
+
{...props}
|
|
32
|
+
onUnlock={async () => {
|
|
33
|
+
await new Promise((resolve) => setTimeout(resolve, 1000))
|
|
34
|
+
const res = await fetch(unlockedSource)
|
|
35
|
+
const blob = await res.blob()
|
|
36
|
+
return { source: URL.createObjectURL(blob) }
|
|
37
|
+
}}
|
|
38
|
+
onDownload={() => {}}
|
|
39
|
+
/>
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
const VARIANTS = [
|
|
43
|
+
{
|
|
44
|
+
label: 'Video',
|
|
45
|
+
title: "Alicia's Workout Plan",
|
|
46
|
+
mimeType: 'video/mp4',
|
|
47
|
+
detail: '1:20',
|
|
48
|
+
thumbnail: VIDEO_THUMBNAIL_BLURRED,
|
|
49
|
+
source: VIDEO_SOURCE,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
label: 'Audio',
|
|
53
|
+
title: 'Morning Meditation',
|
|
54
|
+
mimeType: 'audio/mpeg',
|
|
55
|
+
detail: '4:35',
|
|
56
|
+
thumbnail: AUDIO_THUMBNAIL,
|
|
57
|
+
source: AUDIO_SOURCE,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
label: 'Image',
|
|
61
|
+
title: 'Picture of my cat',
|
|
62
|
+
mimeType: 'image/jpeg',
|
|
63
|
+
detail: '3.2 MB',
|
|
64
|
+
thumbnail: IMAGE_THUMBNAIL_BLURRED,
|
|
65
|
+
source: IMAGE_SOURCE,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
label: 'Document',
|
|
69
|
+
title: 'Strength Training Guide',
|
|
70
|
+
mimeType: 'application/zip',
|
|
71
|
+
detail: '14 files',
|
|
72
|
+
thumbnail: DOCUMENT_THUMBNAIL,
|
|
73
|
+
source: DOCUMENT_SOURCE,
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
label: 'Unknown',
|
|
77
|
+
title: 'Unknown Attachment',
|
|
78
|
+
mimeType: 'application/octet-stream',
|
|
79
|
+
detail: undefined,
|
|
80
|
+
thumbnail: undefined,
|
|
81
|
+
source: DOCUMENT_SOURCE,
|
|
82
|
+
},
|
|
83
|
+
]
|
|
84
|
+
|
|
85
|
+
const NO_THUMBNAIL_VARIANTS = [
|
|
86
|
+
{
|
|
87
|
+
label: 'Video',
|
|
88
|
+
title: "Alicia's Workout Plan",
|
|
89
|
+
mimeType: 'video/mp4',
|
|
90
|
+
detail: '1:20',
|
|
91
|
+
source: VIDEO_SOURCE,
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
label: 'Audio',
|
|
95
|
+
title: 'Morning Meditation',
|
|
96
|
+
mimeType: 'audio/mpeg',
|
|
97
|
+
detail: '4:35',
|
|
98
|
+
source: AUDIO_SOURCE,
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
label: 'Image',
|
|
102
|
+
title: 'Picture of my cat',
|
|
103
|
+
mimeType: 'image/jpeg',
|
|
104
|
+
detail: '3.2 MB',
|
|
105
|
+
source: IMAGE_SOURCE,
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
label: 'Document',
|
|
109
|
+
title: 'Strength Training Guide',
|
|
110
|
+
mimeType: 'application/zip',
|
|
111
|
+
detail: '14 files',
|
|
112
|
+
source: DOCUMENT_SOURCE,
|
|
113
|
+
},
|
|
114
|
+
]
|
|
115
|
+
|
|
116
|
+
const Table = ({ children }: { children: React.ReactNode }) => (
|
|
117
|
+
<div className="p-12">
|
|
118
|
+
<table className="border-separate border-spacing-4">{children}</table>
|
|
119
|
+
</div>
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
const TableHead = ({
|
|
123
|
+
variants,
|
|
124
|
+
}: {
|
|
125
|
+
variants: { label: string; mimeType: string }[]
|
|
126
|
+
}) => (
|
|
127
|
+
<thead>
|
|
128
|
+
<tr>
|
|
129
|
+
<th className="text-left text-xs font-medium text-black/40 pb-2" />
|
|
130
|
+
{variants.map(({ label, mimeType }) => (
|
|
131
|
+
<th
|
|
132
|
+
key={mimeType}
|
|
133
|
+
className="text-left text-xs font-medium text-black/40 pb-2"
|
|
134
|
+
>
|
|
135
|
+
{label}
|
|
136
|
+
</th>
|
|
137
|
+
))}
|
|
138
|
+
</tr>
|
|
139
|
+
</thead>
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
export const Visitor: StoryFn = () => (
|
|
143
|
+
<Table>
|
|
144
|
+
<TableHead variants={VARIANTS} />
|
|
145
|
+
<tbody>
|
|
146
|
+
<tr>
|
|
147
|
+
<td className="text-xs font-medium text-black/40 pr-4 align-top pt-2">
|
|
148
|
+
Locked
|
|
149
|
+
</td>
|
|
150
|
+
{VARIANTS.map(({ title, mimeType, detail, thumbnail, source }) => (
|
|
151
|
+
<td key={mimeType} className="align-top">
|
|
152
|
+
<Interactive
|
|
153
|
+
title={title}
|
|
154
|
+
amountText="AU$9.99"
|
|
155
|
+
thumbnail={thumbnail}
|
|
156
|
+
mimeType={mimeType}
|
|
157
|
+
detail={detail}
|
|
158
|
+
unlockedSource={source}
|
|
159
|
+
/>
|
|
160
|
+
</td>
|
|
161
|
+
))}
|
|
162
|
+
</tr>
|
|
163
|
+
<tr>
|
|
164
|
+
<td className="text-xs font-medium text-black/40 pr-4 align-top pt-2">
|
|
165
|
+
Purchased
|
|
166
|
+
</td>
|
|
167
|
+
{VARIANTS.map(({ title, mimeType, detail, thumbnail, source }) => (
|
|
168
|
+
<td key={mimeType} className="align-top">
|
|
169
|
+
<Interactive
|
|
170
|
+
title={title}
|
|
171
|
+
amountText="AU$9.99"
|
|
172
|
+
thumbnail={thumbnail}
|
|
173
|
+
mimeType={mimeType}
|
|
174
|
+
detail={detail}
|
|
175
|
+
unlockedSource={source}
|
|
176
|
+
paymentStatus="paid"
|
|
177
|
+
/>
|
|
178
|
+
</td>
|
|
179
|
+
))}
|
|
180
|
+
</tr>
|
|
181
|
+
<tr>
|
|
182
|
+
<td className="text-xs font-medium text-black/40 pr-4 align-top pt-2">
|
|
183
|
+
Unlocked
|
|
184
|
+
</td>
|
|
185
|
+
{VARIANTS.map(({ title, mimeType, detail, thumbnail, source }) => (
|
|
186
|
+
<td key={mimeType} className="align-top">
|
|
187
|
+
<LockedAttachment
|
|
188
|
+
title={title}
|
|
189
|
+
thumbnail={thumbnail}
|
|
190
|
+
source={source}
|
|
191
|
+
mimeType={mimeType}
|
|
192
|
+
detail={detail}
|
|
193
|
+
amountText="AU$9.99"
|
|
194
|
+
paymentStatus="paid"
|
|
195
|
+
onDownload={() => {}}
|
|
196
|
+
/>
|
|
197
|
+
</td>
|
|
198
|
+
))}
|
|
199
|
+
</tr>
|
|
200
|
+
</tbody>
|
|
201
|
+
</Table>
|
|
202
|
+
)
|
|
203
|
+
|
|
204
|
+
export const Creator: StoryFn = () => (
|
|
205
|
+
<Table>
|
|
206
|
+
<TableHead variants={VARIANTS} />
|
|
207
|
+
<tbody>
|
|
208
|
+
<tr>
|
|
209
|
+
<td className="text-xs font-medium text-black/40 pr-4 align-top pt-2">
|
|
210
|
+
Preview
|
|
211
|
+
</td>
|
|
212
|
+
{VARIANTS.map(({ mimeType, detail, thumbnail, source }) => (
|
|
213
|
+
<td key={mimeType} className="align-top">
|
|
214
|
+
<LockedAttachment
|
|
215
|
+
isCreator
|
|
216
|
+
isPreview
|
|
217
|
+
thumbnail={thumbnail}
|
|
218
|
+
source={source}
|
|
219
|
+
mimeType={mimeType}
|
|
220
|
+
detail={detail}
|
|
221
|
+
placeholderAmountText="A$0.00"
|
|
222
|
+
/>
|
|
223
|
+
</td>
|
|
224
|
+
))}
|
|
225
|
+
</tr>
|
|
226
|
+
<tr>
|
|
227
|
+
<td className="text-xs font-medium text-black/40 pr-4 align-top pt-2">
|
|
228
|
+
Pending
|
|
229
|
+
</td>
|
|
230
|
+
{VARIANTS.map(({ title, mimeType, detail, thumbnail, source }) => (
|
|
231
|
+
<td key={mimeType} className="align-top">
|
|
232
|
+
<LockedAttachment
|
|
233
|
+
isCreator
|
|
234
|
+
title={title}
|
|
235
|
+
thumbnail={thumbnail}
|
|
236
|
+
source={source}
|
|
237
|
+
mimeType={mimeType}
|
|
238
|
+
detail={detail}
|
|
239
|
+
amountText="AU$9.99"
|
|
240
|
+
onDismiss={() => alert('Dismissed')}
|
|
241
|
+
/>
|
|
242
|
+
</td>
|
|
243
|
+
))}
|
|
244
|
+
</tr>
|
|
245
|
+
<tr>
|
|
246
|
+
<td className="text-xs font-medium text-black/40 pr-4 align-top pt-2">
|
|
247
|
+
Sent
|
|
248
|
+
</td>
|
|
249
|
+
{VARIANTS.map(({ title, mimeType, detail, thumbnail, source }) => (
|
|
250
|
+
<td key={mimeType} className="align-top">
|
|
251
|
+
<LockedAttachment
|
|
252
|
+
isCreator
|
|
253
|
+
title={title}
|
|
254
|
+
thumbnail={thumbnail}
|
|
255
|
+
source={source}
|
|
256
|
+
mimeType={mimeType}
|
|
257
|
+
detail={detail}
|
|
258
|
+
amountText="AU$9.99"
|
|
259
|
+
/>
|
|
260
|
+
</td>
|
|
261
|
+
))}
|
|
262
|
+
</tr>
|
|
263
|
+
<tr>
|
|
264
|
+
<td className="text-xs font-medium text-black/40 pr-4 align-top pt-2">
|
|
265
|
+
Sold
|
|
266
|
+
</td>
|
|
267
|
+
{VARIANTS.map(({ title, mimeType, detail, thumbnail, source }) => (
|
|
268
|
+
<td key={mimeType} className="align-top">
|
|
269
|
+
<LockedAttachment
|
|
270
|
+
isCreator
|
|
271
|
+
title={title}
|
|
272
|
+
thumbnail={thumbnail}
|
|
273
|
+
source={source}
|
|
274
|
+
mimeType={mimeType}
|
|
275
|
+
detail={detail}
|
|
276
|
+
amountText="AU$9.99"
|
|
277
|
+
paymentStatus="paid"
|
|
278
|
+
/>
|
|
279
|
+
</td>
|
|
280
|
+
))}
|
|
281
|
+
</tr>
|
|
282
|
+
</tbody>
|
|
283
|
+
</Table>
|
|
284
|
+
)
|
|
285
|
+
|
|
286
|
+
export const NoThumbnail: StoryFn = () => (
|
|
287
|
+
<Table>
|
|
288
|
+
<TableHead variants={NO_THUMBNAIL_VARIANTS} />
|
|
289
|
+
<tbody>
|
|
290
|
+
<tr>
|
|
291
|
+
<td className="text-xs font-medium text-black/40 pr-4 align-top pt-2">
|
|
292
|
+
Creator
|
|
293
|
+
</td>
|
|
294
|
+
{NO_THUMBNAIL_VARIANTS.map(({ title, mimeType, detail, source }) => (
|
|
295
|
+
<td key={mimeType} className="align-top">
|
|
296
|
+
<LockedAttachment
|
|
297
|
+
isCreator
|
|
298
|
+
title={title}
|
|
299
|
+
source={source}
|
|
300
|
+
mimeType={mimeType}
|
|
301
|
+
detail={detail}
|
|
302
|
+
amountText="AU$9.99"
|
|
303
|
+
/>
|
|
304
|
+
</td>
|
|
305
|
+
))}
|
|
306
|
+
</tr>
|
|
307
|
+
<tr>
|
|
308
|
+
<td className="text-xs font-medium text-black/40 pr-4 align-top pt-2">
|
|
309
|
+
Locked
|
|
310
|
+
</td>
|
|
311
|
+
{NO_THUMBNAIL_VARIANTS.map(({ title, mimeType, detail, source }) => (
|
|
312
|
+
<td key={mimeType} className="align-top">
|
|
313
|
+
<Interactive
|
|
314
|
+
title={title}
|
|
315
|
+
amountText="AU$9.99"
|
|
316
|
+
mimeType={mimeType}
|
|
317
|
+
detail={detail}
|
|
318
|
+
unlockedSource={source}
|
|
319
|
+
/>
|
|
320
|
+
</td>
|
|
321
|
+
))}
|
|
322
|
+
</tr>
|
|
323
|
+
<tr>
|
|
324
|
+
<td className="text-xs font-medium text-black/40 pr-4 align-top pt-2">
|
|
325
|
+
Unlocked
|
|
326
|
+
</td>
|
|
327
|
+
{NO_THUMBNAIL_VARIANTS.map(({ title, mimeType, detail, source }) => (
|
|
328
|
+
<td key={mimeType} className="align-top">
|
|
329
|
+
<LockedAttachment
|
|
330
|
+
title={title}
|
|
331
|
+
source={source}
|
|
332
|
+
mimeType={mimeType}
|
|
333
|
+
detail={detail}
|
|
334
|
+
amountText="AU$9.99"
|
|
335
|
+
paymentStatus="paid"
|
|
336
|
+
onDownload={() => {}}
|
|
337
|
+
/>
|
|
338
|
+
</td>
|
|
339
|
+
))}
|
|
340
|
+
</tr>
|
|
341
|
+
</tbody>
|
|
342
|
+
</Table>
|
|
343
|
+
)
|