@linktr.ee/messaging-react 3.9.0-rc-1783568295 → 3.9.0-rc-1783575293

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 (87) hide show
  1. package/dist/Card-B7ccxsKf.cjs +2 -0
  2. package/dist/Card-B7ccxsKf.cjs.map +1 -0
  3. package/dist/Card-CXRSSrCh.cjs +2 -0
  4. package/dist/Card-CXRSSrCh.cjs.map +1 -0
  5. package/dist/Card-DaUKmwtb.js +105 -0
  6. package/dist/Card-DaUKmwtb.js.map +1 -0
  7. package/dist/Card-Q1Ee_UCB.js +693 -0
  8. package/dist/Card-Q1Ee_UCB.js.map +1 -0
  9. package/dist/LoadingDots-Ct3WmVlT.js +59 -0
  10. package/dist/LoadingDots-Ct3WmVlT.js.map +1 -0
  11. package/dist/LoadingDots-D9GGphgM.cjs +2 -0
  12. package/dist/LoadingDots-D9GGphgM.cjs.map +1 -0
  13. package/dist/assets/index.css +1 -1
  14. package/dist/{index-Bv79lb0u.js → index-BiBvPADG.js} +1194 -1168
  15. package/dist/index-BiBvPADG.js.map +1 -0
  16. package/dist/index-DuPa2mUh.cjs +2 -0
  17. package/dist/index-DuPa2mUh.cjs.map +1 -0
  18. package/dist/index.cjs +1 -1
  19. package/dist/index.d.ts +161 -98
  20. package/dist/index.js +1 -1
  21. package/dist/testing.d.ts +1 -0
  22. package/package.json +2 -2
  23. package/src/components/ChannelList/CustomChannelPreview.test.tsx +95 -0
  24. package/src/components/ChannelList/CustomChannelPreview.tsx +21 -9
  25. package/src/components/CustomMessage/CustomMessage.stories.tsx +54 -1
  26. package/src/components/CustomMessage/LockedAttachment/LockedAttachment.stories.tsx +541 -0
  27. package/src/components/CustomMessage/LockedAttachment/LockedAttachment.test.tsx +117 -0
  28. package/src/components/CustomMessage/LockedAttachment/components/Media/Card.tsx +358 -0
  29. package/src/components/{LockedAttachment/components/Received → CustomMessage/LockedAttachment/components/Media}/CardActions.tsx +8 -1
  30. package/src/components/CustomMessage/LockedAttachment/components/Media/types.ts +79 -0
  31. package/src/components/CustomMessage/LockedAttachment/components/Text/Card.tsx +155 -0
  32. package/src/components/CustomMessage/LockedAttachment/components/Text/types.ts +58 -0
  33. package/src/components/{LockedAttachment → CustomMessage/LockedAttachment}/components/_shared/CardBody.tsx +8 -7
  34. package/src/components/CustomMessage/LockedAttachment/components/_shared/CardThumbnail.tsx +92 -0
  35. package/src/components/{LockedAttachment → CustomMessage/LockedAttachment}/components/_shared/GalleryThumbnail.tsx +31 -39
  36. package/src/components/CustomMessage/LockedAttachment/components/_shared/LoadingDots.tsx +36 -0
  37. package/src/components/CustomMessage/LockedAttachment/components/_shared/LockBadge.tsx +63 -0
  38. package/src/components/{LockedAttachment/components/_shared/LockedCardShell.tsx → CustomMessage/LockedAttachment/components/_shared/MediaShell.tsx} +6 -7
  39. package/src/components/CustomMessage/LockedAttachment/components/_shared/PreviewToggle.tsx +58 -0
  40. package/src/components/CustomMessage/LockedAttachment/components/_shared/PriceLockRow.tsx +21 -0
  41. package/src/components/CustomMessage/LockedAttachment/components/_shared/PurchaseStatusBadge.tsx +74 -0
  42. package/src/components/{LockedAttachment/components/_shared/LockedThumbnail.tsx → CustomMessage/LockedAttachment/components/_shared/SingleThumbnail.tsx} +11 -7
  43. package/src/components/CustomMessage/LockedAttachment/components/_shared/SkeletonTextLines.tsx +29 -0
  44. package/src/components/CustomMessage/LockedAttachment/components/_shared/TextShell.tsx +30 -0
  45. package/src/components/CustomMessage/LockedAttachment/components/_shared/usePreviewToggle.test.ts +67 -0
  46. package/src/components/CustomMessage/LockedAttachment/components/_shared/usePreviewToggle.ts +89 -0
  47. package/src/components/CustomMessage/LockedAttachment/components/_shared/useReceivedSource.ts +83 -0
  48. package/src/components/CustomMessage/LockedAttachment/index.tsx +105 -0
  49. package/src/components/CustomMessage/LockedAttachment/types.ts +44 -0
  50. package/src/components/CustomMessage/MessageTag.tsx +8 -0
  51. package/src/components/CustomMessage/context.tsx +1 -1
  52. package/src/components/CustomMessage/index.tsx +76 -42
  53. package/src/components/CustomMessageInput/CustomMessageInput.stories.tsx +5 -3
  54. package/src/components/CustomMessageInput/index.tsx +0 -3
  55. package/src/index.ts +3 -8
  56. package/src/stream-custom-data.ts +1 -0
  57. package/src/styles.css +12 -0
  58. package/src/types.ts +1 -1
  59. package/dist/Card-B8Zz3GRL.js +0 -132
  60. package/dist/Card-B8Zz3GRL.js.map +0 -1
  61. package/dist/Card-BmYSOINp.cjs +0 -2
  62. package/dist/Card-BmYSOINp.cjs.map +0 -1
  63. package/dist/Card-BnJLBTl6.js +0 -163
  64. package/dist/Card-BnJLBTl6.js.map +0 -1
  65. package/dist/Card-DWT-IkeK.cjs +0 -2
  66. package/dist/Card-DWT-IkeK.cjs.map +0 -1
  67. package/dist/Card-Gapf9yEL.js +0 -107
  68. package/dist/Card-Gapf9yEL.js.map +0 -1
  69. package/dist/Card-WoQGTJ5n.cjs +0 -2
  70. package/dist/Card-WoQGTJ5n.cjs.map +0 -1
  71. package/dist/LockedThumbnail-Cu3qwKAd.js +0 -220
  72. package/dist/LockedThumbnail-Cu3qwKAd.js.map +0 -1
  73. package/dist/LockedThumbnail-DFByBLYS.cjs +0 -2
  74. package/dist/LockedThumbnail-DFByBLYS.cjs.map +0 -1
  75. package/dist/index-Bv79lb0u.js.map +0 -1
  76. package/dist/index-C1Zaiccm.cjs +0 -2
  77. package/dist/index-C1Zaiccm.cjs.map +0 -1
  78. package/src/components/LockedAttachment/LockedAttachment.stories.tsx +0 -450
  79. package/src/components/LockedAttachment/components/Composer/Card.tsx +0 -221
  80. package/src/components/LockedAttachment/components/Composer/index.ts +0 -2
  81. package/src/components/LockedAttachment/components/Received/Card.tsx +0 -191
  82. package/src/components/LockedAttachment/components/Received/index.ts +0 -2
  83. package/src/components/LockedAttachment/components/Sent/Card.tsx +0 -177
  84. package/src/components/LockedAttachment/components/Sent/index.ts +0 -2
  85. package/src/components/LockedAttachment/components/_shared/LockBadge.tsx +0 -39
  86. package/src/components/LockedAttachment/index.tsx +0 -63
  87. package/src/components/LockedAttachment/types.ts +0 -51
@@ -0,0 +1,693 @@
1
+ import { jsxs as h, jsx as e } from "react/jsx-runtime";
2
+ import { PlayIcon as B, LockOpenIcon as q, LockSimpleIcon as V, CaretLeftIcon as F, CaretRightIcon as H, ImagesIcon as J, DownloadSimpleIcon as R, XIcon as Q, PencilSimpleIcon as W } from "@phosphor-icons/react";
3
+ import y, { useState as k, useRef as I, useCallback as L, useEffect as Y } from "react";
4
+ import v from "classnames";
5
+ import { r as A, g as T, A as G } from "./index-BiBvPADG.js";
6
+ import { L as Z, P as O } from "./LoadingDots-Ct3WmVlT.js";
7
+ const z = ({
8
+ variant: t,
9
+ title: a,
10
+ placeholderTitle: n = "Attachment title",
11
+ mimeType: r,
12
+ detail: i,
13
+ statusBadge: s,
14
+ action: c,
15
+ icon: u,
16
+ trailingAction: d
17
+ }) => {
18
+ const l = t === "dark", o = a || n, f = !a, m = u ?? A(r, {
19
+ className: v(
20
+ "size-5 shrink-0",
21
+ l ? "text-white/55" : "text-black/55"
22
+ ),
23
+ weight: "regular"
24
+ });
25
+ return /* @__PURE__ */ h("div", { className: "px-4 py-3", children: [
26
+ /* @__PURE__ */ h("div", { className: "flex items-end gap-3", children: [
27
+ /* @__PURE__ */ h("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
28
+ o.trim() !== "" && /* @__PURE__ */ e(
29
+ "p",
30
+ {
31
+ className: v("truncate text-base font-medium leading-6", {
32
+ "text-black/90": !l && !f,
33
+ "text-black/30": !l && f,
34
+ "text-white/30": l && f,
35
+ "text-white": l && !f
36
+ }),
37
+ children: o
38
+ }
39
+ ),
40
+ /* @__PURE__ */ h("div", { className: "flex flex-wrap items-center gap-1", children: [
41
+ m,
42
+ i != null && i !== "" && /* @__PURE__ */ e(
43
+ "span",
44
+ {
45
+ className: v(
46
+ "text-xs font-medium",
47
+ l ? "text-white/55" : "text-black/55"
48
+ ),
49
+ children: i
50
+ }
51
+ ),
52
+ s
53
+ ] })
54
+ ] }),
55
+ d && /* @__PURE__ */ e("div", { className: "shrink-0", children: d })
56
+ ] }),
57
+ c
58
+ ] });
59
+ }, E = ({
60
+ paymentStatus: t,
61
+ mimeType: a,
62
+ isPlayable: n,
63
+ isLocked: r
64
+ }) => {
65
+ const i = a ? T(a) : void 0, c = (n ?? (i === "video" || i === "audio")) && !r ? B : t === "paid" ? q : V;
66
+ return /* @__PURE__ */ e("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ e(
67
+ "div",
68
+ {
69
+ className: v(
70
+ "flex size-12 items-center justify-center rounded-full bg-black/30 text-white",
71
+ c === B && "group-hover:bg-black/40"
72
+ ),
73
+ children: /* @__PURE__ */ e(c, { className: "size-6", weight: "fill" })
74
+ }
75
+ ) });
76
+ };
77
+ function ee(t) {
78
+ const a = T(t.mimeType);
79
+ return a === "video" || a === "audio";
80
+ }
81
+ const te = ({
82
+ variant: t,
83
+ gallery: a,
84
+ title: n,
85
+ showLocked: r,
86
+ paymentStatus: i,
87
+ topRight: s
88
+ }) => {
89
+ const [c, u] = k(0), d = a.length, l = Math.min(c, d - 1), o = a[l], f = ee(o), m = (g) => {
90
+ g.stopPropagation(), u((p) => Math.max(0, p - 1));
91
+ }, w = (g) => {
92
+ g.stopPropagation(), u((p) => Math.min(d - 1, p + 1));
93
+ }, x = l === 0, b = l === d - 1, N = t === "dark";
94
+ return /* @__PURE__ */ h(
95
+ "div",
96
+ {
97
+ className: v(
98
+ "group relative overflow-hidden rounded-t-md",
99
+ r ? "aspect-[337/386]" : void 0
100
+ ),
101
+ children: [
102
+ r ? /* @__PURE__ */ e(
103
+ "div",
104
+ {
105
+ className: v(
106
+ "absolute inset-0",
107
+ N ? "bg-white/10" : "bg-black/5"
108
+ ),
109
+ children: o.thumbnailUrl && /* @__PURE__ */ e(
110
+ "img",
111
+ {
112
+ src: o.thumbnailUrl,
113
+ alt: "",
114
+ "aria-hidden": !0,
115
+ draggable: !1,
116
+ className: "absolute inset-0 h-full w-full scale-110 object-cover blur-[40px]"
117
+ }
118
+ )
119
+ }
120
+ ) : /* @__PURE__ */ e(
121
+ G,
122
+ {
123
+ mimeType: o.mimeType,
124
+ sourceUrl: o.sourceUrl,
125
+ thumbnailUrl: o.thumbnailUrl,
126
+ title: n,
127
+ variant: t,
128
+ mediaPlayerProps: { autoPlay: !0 }
129
+ },
130
+ l
131
+ ),
132
+ r && /* @__PURE__ */ e(
133
+ E,
134
+ {
135
+ paymentStatus: i,
136
+ isPlayable: f,
137
+ isLocked: r
138
+ }
139
+ ),
140
+ d > 1 && /* @__PURE__ */ h(y.Fragment, { children: [
141
+ /* @__PURE__ */ e(
142
+ "button",
143
+ {
144
+ type: "button",
145
+ onClick: m,
146
+ disabled: x,
147
+ "aria-label": "Previous item",
148
+ className: v(
149
+ "absolute left-3 top-1/2 -translate-y-1/2 flex size-7 items-center justify-center rounded-full bg-black/30 text-white transition-opacity",
150
+ x ? "opacity-40" : "hover:bg-black/40"
151
+ ),
152
+ children: /* @__PURE__ */ e(F, { className: "size-5", weight: "bold" })
153
+ }
154
+ ),
155
+ /* @__PURE__ */ e(
156
+ "button",
157
+ {
158
+ type: "button",
159
+ onClick: w,
160
+ disabled: b,
161
+ "aria-label": "Next item",
162
+ className: v(
163
+ "absolute right-3 top-1/2 -translate-y-1/2 flex size-7 items-center justify-center rounded-full bg-black/30 text-white transition-opacity",
164
+ b ? "opacity-40" : "hover:bg-black/40"
165
+ ),
166
+ children: /* @__PURE__ */ e(H, { className: "size-5", weight: "bold" })
167
+ }
168
+ ),
169
+ /* @__PURE__ */ e("div", { className: "pointer-events-none absolute bottom-10 left-1/2 flex size-8 -translate-x-1/2 items-center justify-center rounded-full bg-black/30", children: /* @__PURE__ */ h("span", { className: "text-xs font-medium leading-none text-white", children: [
170
+ l + 1,
171
+ "/",
172
+ d
173
+ ] }) })
174
+ ] }),
175
+ s && /* @__PURE__ */ e("div", { className: "pointer-events-auto absolute right-3 top-3 z-10", children: s })
176
+ ]
177
+ }
178
+ );
179
+ }, ae = ({
180
+ variant: t,
181
+ mimeType: a,
182
+ thumbnailUrl: n,
183
+ title: r,
184
+ source: i,
185
+ showLocked: s,
186
+ paymentStatus: c,
187
+ topRight: u,
188
+ containedImage: d = !1
189
+ }) => {
190
+ const l = s || i == null ? void 0 : i.sourceUrl, o = s ? n : (i == null ? void 0 : i.thumbnailUrl) ?? n, f = t === "dark";
191
+ return /* @__PURE__ */ h("div", { className: "relative overflow-hidden rounded-t-md", children: [
192
+ s ? /* @__PURE__ */ h(
193
+ "div",
194
+ {
195
+ className: v(
196
+ "relative aspect-video overflow-hidden",
197
+ f ? "bg-white/10" : "bg-black/5"
198
+ ),
199
+ children: [
200
+ o ? /* @__PURE__ */ e(
201
+ "img",
202
+ {
203
+ src: o,
204
+ alt: "",
205
+ "aria-hidden": !0,
206
+ draggable: !1,
207
+ className: "absolute inset-0 h-full w-full scale-110 object-cover blur-[40px]"
208
+ }
209
+ ) : /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center", children: A(a, {
210
+ className: f ? "size-12 text-white/20" : "size-12 text-black/20",
211
+ weight: "regular"
212
+ }) }),
213
+ /* @__PURE__ */ e(
214
+ E,
215
+ {
216
+ paymentStatus: c,
217
+ mimeType: a,
218
+ isLocked: s
219
+ }
220
+ )
221
+ ]
222
+ }
223
+ ) : /* @__PURE__ */ e(
224
+ G,
225
+ {
226
+ mimeType: a,
227
+ sourceUrl: l,
228
+ thumbnailUrl: o,
229
+ title: r,
230
+ variant: t,
231
+ containedImage: d,
232
+ mediaPlayerProps: l ? { autoPlay: !0, loop: !0, controls: !0, muted: !1 } : void 0
233
+ }
234
+ ),
235
+ u && /* @__PURE__ */ e("div", { className: "pointer-events-auto absolute right-3 top-3 z-10", children: u })
236
+ ] });
237
+ }, P = (t) => t.length >= 2, U = (t) => /* @__PURE__ */ e(
238
+ J,
239
+ {
240
+ className: t === "dark" ? "size-5 shrink-0 text-white/55" : "size-5 shrink-0 text-black/55"
241
+ }
242
+ ), j = ({
243
+ variant: t,
244
+ gallery: a,
245
+ title: n,
246
+ showLocked: r,
247
+ paymentStatus: i,
248
+ mimeType: s,
249
+ thumbnailUrl: c,
250
+ source: u,
251
+ containedImage: d,
252
+ topRight: l
253
+ }) => P(a) ? /* @__PURE__ */ e(
254
+ te,
255
+ {
256
+ variant: t,
257
+ gallery: a,
258
+ title: n,
259
+ showLocked: r,
260
+ paymentStatus: i,
261
+ topRight: l
262
+ }
263
+ ) : /* @__PURE__ */ e(
264
+ ae,
265
+ {
266
+ variant: t,
267
+ mimeType: s,
268
+ thumbnailUrl: c,
269
+ title: n,
270
+ source: u,
271
+ showLocked: r,
272
+ paymentStatus: i,
273
+ topRight: l,
274
+ containedImage: d
275
+ }
276
+ ), D = ({
277
+ variant: t,
278
+ children: a,
279
+ rootRef: n,
280
+ "data-testid": r
281
+ }) => /* @__PURE__ */ e(
282
+ "div",
283
+ {
284
+ ref: n,
285
+ "data-testid": r,
286
+ className: v(
287
+ "relative w-[280px] select-none overflow-hidden rounded-md",
288
+ t === "dark" ? "bg-[#1e2330]" : "bg-white"
289
+ ),
290
+ children: a
291
+ }
292
+ ), S = ({
293
+ onToggle: t,
294
+ isBusy: a,
295
+ isPreviewVisible: n,
296
+ children: r
297
+ }) => t ? /* @__PURE__ */ e(
298
+ "div",
299
+ {
300
+ role: "button",
301
+ tabIndex: a ? -1 : 0,
302
+ "aria-label": "Toggle preview",
303
+ "aria-busy": a,
304
+ "aria-pressed": n,
305
+ "aria-disabled": a || void 0,
306
+ onClick: a ? void 0 : t,
307
+ onKeyDown: (i) => {
308
+ a || i.target === i.currentTarget && (i.key === "Enter" || i.key === " ") && (i.preventDefault(), t());
309
+ },
310
+ className: a ? "block w-full text-left" : "block w-full cursor-pointer text-left",
311
+ children: r
312
+ }
313
+ ) : /* @__PURE__ */ e(y.Fragment, { children: r });
314
+ function K({
315
+ isGallery: t,
316
+ onFetchSource: a,
317
+ onPreviewClick: n
318
+ }) {
319
+ const [r, i] = k(), [s, c] = k(!1), [u, d] = k(!1), l = I(!1), o = L(async () => {
320
+ if (n == null || n(), s) {
321
+ c(!1);
322
+ return;
323
+ }
324
+ if (t) {
325
+ c(!0);
326
+ return;
327
+ }
328
+ if (r) {
329
+ c(!0);
330
+ return;
331
+ }
332
+ if (a && !l.current) {
333
+ l.current = !0, d(!0);
334
+ try {
335
+ const m = await a();
336
+ m && (i(m), c(!0));
337
+ } finally {
338
+ l.current = !1, d(!1);
339
+ }
340
+ }
341
+ }, [s, t, r, n, a]), f = t || a != null || n != null ? o : void 0;
342
+ return {
343
+ source: r,
344
+ isPreviewVisible: s,
345
+ isLoadingPreview: u,
346
+ handleToggle: o,
347
+ togglePreview: f
348
+ };
349
+ }
350
+ function ie({
351
+ paymentStatus: t,
352
+ onFetchSource: a,
353
+ onUnlockClick: n
354
+ }) {
355
+ const [r, i] = k(), s = I(null), c = I(!1), u = I(a);
356
+ u.current = a;
357
+ const d = L(async () => {
358
+ var o;
359
+ if (!c.current) {
360
+ c.current = !0;
361
+ try {
362
+ const f = await ((o = u.current) == null ? void 0 : o.call(u));
363
+ f && i(f);
364
+ } finally {
365
+ c.current = !1;
366
+ }
367
+ }
368
+ }, []), l = L(() => {
369
+ t === "paid" ? d() : n == null || n();
370
+ }, [t, d, n]);
371
+ return Y(() => {
372
+ if (!s.current || t !== "paid" || r !== void 0) return;
373
+ const o = new IntersectionObserver(
374
+ ([f]) => {
375
+ f.isIntersecting && (d(), o.disconnect());
376
+ },
377
+ { threshold: 1 }
378
+ );
379
+ return o.observe(s.current), () => o.disconnect();
380
+ }, [t, r, d]), { source: r, cardRef: s, handleUnlockClick: l };
381
+ }
382
+ const C = "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", re = ({
383
+ isLocked: t,
384
+ sourceUrl: a,
385
+ redeemUrl: n,
386
+ onUnlockClicked: r,
387
+ onDownloadClicked: i,
388
+ isUnlocking: s = !1
389
+ }) => {
390
+ if (t && r != null)
391
+ return /* @__PURE__ */ e(
392
+ "button",
393
+ {
394
+ type: "button",
395
+ onClick: r,
396
+ disabled: s,
397
+ "aria-label": s ? "Unlocking" : "Unlock",
398
+ "aria-busy": s,
399
+ title: s ? "Unlocking" : "Unlock",
400
+ className: C,
401
+ children: s ? /* @__PURE__ */ e(Z, {}) : /* @__PURE__ */ h(y.Fragment, { children: [
402
+ /* @__PURE__ */ e(V, { className: "size-4", weight: "fill" }),
403
+ "Unlock"
404
+ ] })
405
+ }
406
+ );
407
+ if (!t && i != null) {
408
+ const c = n ?? a;
409
+ return c != null ? /* @__PURE__ */ h(
410
+ "a",
411
+ {
412
+ href: c,
413
+ "aria-label": "Download",
414
+ target: "_blank",
415
+ rel: "noopener noreferrer",
416
+ onClick: i,
417
+ className: `${C} !text-white`,
418
+ children: [
419
+ /* @__PURE__ */ e(R, { className: "size-4", weight: "bold" }),
420
+ "Download"
421
+ ]
422
+ }
423
+ ) : /* @__PURE__ */ h(
424
+ "button",
425
+ {
426
+ type: "button",
427
+ onClick: i,
428
+ "aria-label": "Download",
429
+ className: C,
430
+ children: [
431
+ /* @__PURE__ */ e(R, { className: "size-4", weight: "bold" }),
432
+ "Download"
433
+ ]
434
+ }
435
+ );
436
+ }
437
+ return null;
438
+ }, ne = ({
439
+ title: t,
440
+ mimeType: a = "application/octet-stream",
441
+ thumbnailUrl: n,
442
+ detail: r,
443
+ amountText: i,
444
+ placeholderTitle: s,
445
+ placeholderAmountText: c,
446
+ gallery: u = [],
447
+ onDismiss: d,
448
+ onPreviewClick: l,
449
+ onFetchSource: o,
450
+ onEditClick: f
451
+ }) => {
452
+ const m = P(u), { source: w, isPreviewVisible: x, isLoadingPreview: b, togglePreview: N } = K({ isGallery: m, onFetchSource: o, onPreviewClick: l }), g = !x, p = b, M = /* @__PURE__ */ h(y.Fragment, { children: [
453
+ /* @__PURE__ */ e("span", { className: "text-xs font-medium text-white/55", children: "•" }),
454
+ /* @__PURE__ */ e(
455
+ "span",
456
+ {
457
+ className: i ? "text-xs font-medium text-white/55" : "text-xs font-medium text-white/30",
458
+ children: i || c
459
+ }
460
+ )
461
+ ] }), X = d ? /* @__PURE__ */ e(
462
+ "button",
463
+ {
464
+ type: "button",
465
+ onClick: ($) => {
466
+ $.stopPropagation(), d();
467
+ },
468
+ className: "flex size-6 items-center justify-center rounded-full bg-[#121110] text-white",
469
+ "aria-label": "Dismiss attachment",
470
+ children: /* @__PURE__ */ e(Q, { className: "size-3", weight: "bold" })
471
+ }
472
+ ) : void 0, _ = f ? /* @__PURE__ */ e(
473
+ "button",
474
+ {
475
+ type: "button",
476
+ onClick: f,
477
+ "aria-label": "Edit attachment",
478
+ className: "flex size-10 items-center justify-center rounded-full bg-white/10 text-white hover:bg-white/15",
479
+ children: /* @__PURE__ */ e(W, { className: "size-5", weight: "regular" })
480
+ }
481
+ ) : void 0;
482
+ return /* @__PURE__ */ h(D, { variant: "dark", children: [
483
+ /* @__PURE__ */ e(
484
+ S,
485
+ {
486
+ onToggle: N,
487
+ isBusy: p,
488
+ isPreviewVisible: !g,
489
+ children: /* @__PURE__ */ e(
490
+ j,
491
+ {
492
+ variant: "dark",
493
+ gallery: u,
494
+ title: t,
495
+ showLocked: g,
496
+ mimeType: a,
497
+ thumbnailUrl: n,
498
+ source: w,
499
+ topRight: X
500
+ }
501
+ )
502
+ }
503
+ ),
504
+ /* @__PURE__ */ e(
505
+ z,
506
+ {
507
+ variant: "dark",
508
+ title: t,
509
+ placeholderTitle: s,
510
+ mimeType: a,
511
+ detail: r,
512
+ statusBadge: M,
513
+ icon: m ? U("dark") : void 0,
514
+ trailingAction: _
515
+ }
516
+ )
517
+ ] });
518
+ }, se = ({
519
+ title: t,
520
+ mimeType: a = "application/octet-stream",
521
+ thumbnailUrl: n,
522
+ detail: r,
523
+ amountText: i,
524
+ placeholderTitle: s,
525
+ placeholderAmountText: c,
526
+ gallery: u = []
527
+ }) => {
528
+ const d = P(u), l = /* @__PURE__ */ h(y.Fragment, { children: [
529
+ /* @__PURE__ */ e("span", { className: "text-xs font-medium text-black/55", children: "•" }),
530
+ /* @__PURE__ */ e(
531
+ "span",
532
+ {
533
+ className: i ? "text-xs font-medium text-black/55" : "text-xs font-medium text-black/30",
534
+ children: i || c
535
+ }
536
+ )
537
+ ] });
538
+ return /* @__PURE__ */ h(D, { variant: "light", children: [
539
+ /* @__PURE__ */ e(
540
+ j,
541
+ {
542
+ variant: "light",
543
+ gallery: u,
544
+ title: t,
545
+ showLocked: !0,
546
+ mimeType: a,
547
+ thumbnailUrl: n
548
+ }
549
+ ),
550
+ /* @__PURE__ */ e(
551
+ z,
552
+ {
553
+ variant: "light",
554
+ title: t,
555
+ placeholderTitle: s,
556
+ mimeType: a,
557
+ detail: r,
558
+ statusBadge: l,
559
+ icon: d ? U("light") : void 0
560
+ }
561
+ )
562
+ ] });
563
+ }, le = ({
564
+ title: t,
565
+ mimeType: a = "application/octet-stream",
566
+ thumbnailUrl: n,
567
+ detail: r,
568
+ amountText: i,
569
+ placeholderTitle: s,
570
+ paymentStatus: c = "pending",
571
+ gallery: u = [],
572
+ onPreviewClick: d,
573
+ onFetchSource: l
574
+ }) => {
575
+ const o = P(u), { source: f, isPreviewVisible: m, isLoadingPreview: w, togglePreview: x } = K({ isGallery: o, onFetchSource: l, onPreviewClick: d }), b = !m;
576
+ return /* @__PURE__ */ h(D, { variant: "dark", children: [
577
+ /* @__PURE__ */ e(
578
+ S,
579
+ {
580
+ onToggle: x,
581
+ isBusy: w,
582
+ isPreviewVisible: !b,
583
+ children: /* @__PURE__ */ e(
584
+ j,
585
+ {
586
+ variant: "dark",
587
+ gallery: u,
588
+ title: t,
589
+ showLocked: b,
590
+ paymentStatus: c,
591
+ mimeType: a,
592
+ thumbnailUrl: n,
593
+ source: f
594
+ }
595
+ )
596
+ }
597
+ ),
598
+ /* @__PURE__ */ e(
599
+ z,
600
+ {
601
+ variant: "dark",
602
+ title: t,
603
+ placeholderTitle: s,
604
+ mimeType: a,
605
+ detail: r,
606
+ statusBadge: /* @__PURE__ */ e(
607
+ O,
608
+ {
609
+ isMine: !0,
610
+ paymentStatus: c,
611
+ amountText: i
612
+ }
613
+ ),
614
+ icon: o ? U("dark") : void 0
615
+ }
616
+ )
617
+ ] });
618
+ }, ce = ({
619
+ title: t,
620
+ amountText: a,
621
+ thumbnailUrl: n,
622
+ mimeType: r = "application/octet-stream",
623
+ detail: i,
624
+ gallery: s = [],
625
+ onUnlockClick: c,
626
+ onFetchSource: u,
627
+ onDownloadClick: d,
628
+ paymentStatus: l,
629
+ isUnlocking: o = !1
630
+ }) => {
631
+ const f = P(s), { source: m, cardRef: w, handleUnlockClick: x } = ie({
632
+ paymentStatus: l,
633
+ onFetchSource: u,
634
+ onUnlockClick: c
635
+ }), b = m == null ? void 0 : m.sourceUrl, N = m == null ? void 0 : m.redeemUrl, g = f ? l !== "paid" : b === void 0, p = T(r), M = f ? void 0 : b;
636
+ return /* @__PURE__ */ h(
637
+ D,
638
+ {
639
+ variant: "light",
640
+ rootRef: w,
641
+ "data-testid": "locked-attachment",
642
+ children: [
643
+ /* @__PURE__ */ e(
644
+ j,
645
+ {
646
+ variant: "light",
647
+ gallery: s,
648
+ title: t,
649
+ showLocked: g,
650
+ paymentStatus: l,
651
+ mimeType: r,
652
+ thumbnailUrl: n,
653
+ source: m,
654
+ containedImage: !g && p === "document"
655
+ }
656
+ ),
657
+ /* @__PURE__ */ e(
658
+ z,
659
+ {
660
+ variant: "light",
661
+ title: t,
662
+ mimeType: r,
663
+ detail: i,
664
+ statusBadge: /* @__PURE__ */ e(
665
+ O,
666
+ {
667
+ isMine: !1,
668
+ paymentStatus: l,
669
+ amountText: a
670
+ }
671
+ ),
672
+ icon: f ? U("light") : void 0,
673
+ action: /* @__PURE__ */ e(
674
+ re,
675
+ {
676
+ isLocked: g,
677
+ isUnlocking: o,
678
+ sourceUrl: M,
679
+ redeemUrl: N,
680
+ onUnlockClicked: x,
681
+ onDownloadClicked: d
682
+ }
683
+ )
684
+ }
685
+ )
686
+ ]
687
+ }
688
+ );
689
+ }, be = (t) => t.isDraft ? /* @__PURE__ */ e(ne, { ...t }) : t.isPreview ? /* @__PURE__ */ e(se, { ...t }) : t.isMine ? /* @__PURE__ */ e(le, { ...t }) : /* @__PURE__ */ e(ce, { ...t });
690
+ export {
691
+ be as default
692
+ };
693
+ //# sourceMappingURL=Card-Q1Ee_UCB.js.map