@linktr.ee/messaging-react 1.30.0 → 1.30.1-rc-1776660256

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.
@@ -1,13 +1,13 @@
1
- import { jsxs as l, jsx as e, Fragment as p } from "react/jsx-runtime";
2
- import { CheckCircleIcon as T, LockSimpleIcon as y, DownloadSimpleIcon as P, LockOpenIcon as C } from "@phosphor-icons/react";
3
- import { useState as b, useEffect as L } from "react";
4
- import { g as D, r as g, M as U } from "./MediaPlayer-Bf-xPB8Z.js";
5
- const x = (s) => s === "paid" ? C : y, z = (s) => {
1
+ import { jsxs as c, jsx as e, Fragment as g } from "react/jsx-runtime";
2
+ import { CheckCircleIcon as P, LockSimpleIcon as U, DownloadSimpleIcon as _, LockOpenIcon as C } from "@phosphor-icons/react";
3
+ import { useState as h, useEffect as L } from "react";
4
+ import { g as D, r as x, M } from "./MediaPlayer-dT6eJALR.js";
5
+ const k = (s) => s === "paid" ? C : U, z = (s) => {
6
6
  const { icon: t } = s;
7
7
  return /* @__PURE__ */ e("div", { className: "absolute inset-0 bg-black/30", children: /* @__PURE__ */ e("div", { className: "absolute left-3 top-3 flex size-8 items-center justify-center rounded-full bg-black/60", children: /* @__PURE__ */ e(t, { className: "size-4 text-white", weight: "fill" }) }) });
8
8
  }, I = (s) => {
9
- const { thumbnail: t, mimeType: n, LockIcon: a } = s;
10
- return /* @__PURE__ */ l("div", { className: "relative aspect-video overflow-hidden bg-black/5", children: [
9
+ const { thumbnailUrl: t, mimeType: l, LockIcon: a } = s;
10
+ return /* @__PURE__ */ c("div", { className: "relative aspect-video overflow-hidden bg-black/5", children: [
11
11
  t ? /* @__PURE__ */ e(
12
12
  "img",
13
13
  {
@@ -15,35 +15,35 @@ const x = (s) => s === "paid" ? C : y, z = (s) => {
15
15
  alt: "",
16
16
  className: "absolute inset-0 h-full w-full object-cover"
17
17
  }
18
- ) : /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center", children: g(n, {
18
+ ) : /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center", children: x(l, {
19
19
  className: "size-12 text-black/20",
20
20
  weight: "regular"
21
21
  }) }),
22
22
  /* @__PURE__ */ e(z, { icon: a })
23
23
  ] });
24
- }, M = (s) => {
25
- const { source: t, thumbnail: n, mimeType: a, title: c, paymentStatus: i, isLocked: r } = s, [o, d] = b(!1);
24
+ }, R = (s) => {
25
+ const { sourceUrl: t, thumbnailUrl: l, mimeType: a, title: n, paymentStatus: i, isLocked: o } = s, [r, d] = h(!1);
26
26
  return L(() => {
27
27
  d(!1);
28
- }, [t]), r ? /* @__PURE__ */ e(
28
+ }, [t]), o ? /* @__PURE__ */ e(
29
29
  I,
30
30
  {
31
- thumbnail: n,
31
+ thumbnailUrl: l,
32
32
  mimeType: a,
33
- LockIcon: x(i)
33
+ LockIcon: k(i)
34
34
  }
35
35
  ) : /* @__PURE__ */ e("div", { className: "relative overflow-hidden bg-black/5", children: /* @__PURE__ */ e(
36
36
  "img",
37
37
  {
38
38
  src: t,
39
- alt: c,
40
- className: `block w-full transition-opacity duration-300 ${o ? "opacity-100" : "opacity-0"}`,
39
+ alt: n,
40
+ className: `block w-full transition-opacity duration-300 ${r ? "opacity-100" : "opacity-0"}`,
41
41
  onLoad: () => d(!0)
42
42
  }
43
43
  ) });
44
44
  }, O = (s) => {
45
- const { thumbnail: t, mimeType: n, paymentStatus: a, isLocked: c } = s;
46
- return /* @__PURE__ */ l("div", { className: "relative aspect-video overflow-hidden bg-black/5", children: [
45
+ const { thumbnailUrl: t, mimeType: l, paymentStatus: a, isLocked: n } = s;
46
+ return /* @__PURE__ */ c("div", { className: "relative aspect-video overflow-hidden bg-black/5", children: [
47
47
  t ? /* @__PURE__ */ e(
48
48
  "img",
49
49
  {
@@ -51,139 +51,142 @@ const x = (s) => s === "paid" ? C : y, z = (s) => {
51
51
  alt: "",
52
52
  className: "absolute inset-0 h-full w-full object-cover"
53
53
  }
54
- ) : /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center", children: g(n, {
54
+ ) : /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center", children: x(l, {
55
55
  className: "size-12 text-black/20",
56
56
  weight: "regular"
57
57
  }) }),
58
- c && /* @__PURE__ */ e(z, { icon: x(a) })
58
+ n && /* @__PURE__ */ e(z, { icon: k(a) })
59
59
  ] });
60
- }, R = (s) => {
61
- const { source: t, thumbnail: n, mimeType: a, paymentStatus: c, isLocked: i } = s;
60
+ }, A = (s) => {
61
+ const { sourceUrl: t, thumbnailUrl: l, mimeType: a, paymentStatus: n, isLocked: i } = s;
62
62
  return i ? /* @__PURE__ */ e(
63
63
  I,
64
64
  {
65
- thumbnail: n,
65
+ thumbnailUrl: l,
66
66
  mimeType: a,
67
- LockIcon: x(c)
67
+ LockIcon: k(n)
68
68
  }
69
- ) : /* @__PURE__ */ e(U, { source: t, mimeType: a, poster: n });
70
- }, A = () => /* @__PURE__ */ l("span", { className: "flex items-center gap-1", children: [
69
+ ) : /* @__PURE__ */ e(M, { source: t, mimeType: a, poster: l });
70
+ }, E = () => /* @__PURE__ */ c("span", { className: "flex items-center gap-1", children: [
71
71
  /* @__PURE__ */ e("span", { className: "size-1 rounded-full bg-white animate-bounce [animation-delay:-0.3s]" }),
72
72
  /* @__PURE__ */ e("span", { className: "size-1 rounded-full bg-white animate-bounce [animation-delay:-0.15s]" }),
73
73
  /* @__PURE__ */ e("span", { className: "size-1 rounded-full bg-white animate-bounce" })
74
- ] }), E = (s) => {
75
- const { isLocked: t, unlockLoading: n, source: a, onUnlock: c, onDownload: i } = s;
76
- return t && c ? /* @__PURE__ */ e(
74
+ ] }), F = (s) => {
75
+ const { isLocked: t, unlockLoading: l, sourceUrl: a, redeemUrl: n, onUnlock: i, onDownload: o } = s;
76
+ return t && i ? /* @__PURE__ */ e(
77
77
  "button",
78
78
  {
79
79
  type: "button",
80
- onClick: c,
81
- disabled: n,
80
+ onClick: i,
81
+ disabled: l,
82
82
  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",
83
- children: n ? /* @__PURE__ */ e(A, {}) : /* @__PURE__ */ l(p, { children: [
84
- /* @__PURE__ */ e(y, { className: "size-4", weight: "fill" }),
83
+ children: l ? /* @__PURE__ */ e(E, {}) : /* @__PURE__ */ c(g, { children: [
84
+ /* @__PURE__ */ e(U, { className: "size-4", weight: "fill" }),
85
85
  "Unlock"
86
86
  ] })
87
87
  }
88
- ) : !t && i && a ? /* @__PURE__ */ l(
88
+ ) : !t && o && a ? /* @__PURE__ */ c(
89
89
  "a",
90
90
  {
91
- href: a,
92
- onClick: i,
91
+ href: n ?? a,
92
+ target: "_blank",
93
+ rel: "noopener noreferrer",
94
+ onClick: o,
93
95
  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]",
94
96
  children: [
95
- /* @__PURE__ */ e(P, { className: "size-4", weight: "bold" }),
97
+ /* @__PURE__ */ e(_, { className: "size-4", weight: "bold" }),
96
98
  "Download"
97
99
  ]
98
100
  }
99
101
  ) : null;
100
- }, B = (s) => {
102
+ }, G = (s) => {
101
103
  const {
102
104
  title: t,
103
- amountText: n,
104
- thumbnail: a,
105
- source: c,
105
+ amountText: l,
106
+ thumbnailUrl: a,
107
+ sourceUrl: n,
106
108
  mimeType: i = "application/octet-stream",
107
- detail: r,
108
- onUnlock: o,
109
+ detail: o,
110
+ onUnlock: r,
109
111
  onDownload: d,
110
112
  paymentStatus: m
111
- } = s, [u, k] = b(c), [S, w] = b(!1);
113
+ } = s, [u, w] = h(n), [S, v] = h(void 0), [j, N] = h(!1);
112
114
  L(() => {
113
- c !== void 0 && k(c);
114
- }, [c]);
115
- const f = u === void 0, v = D(i), j = async () => {
116
- if (o) {
117
- w(!0);
115
+ n !== void 0 && (w(n), v(void 0));
116
+ }, [n]);
117
+ const f = u === void 0, y = D(i), T = async () => {
118
+ if (r) {
119
+ N(!0);
118
120
  try {
119
- const N = await o();
120
- k(N.source);
121
+ const b = await r();
122
+ w(b.sourceUrl), v(b.redeemUrl);
121
123
  } catch {
122
124
  } finally {
123
- w(!1);
125
+ N(!1);
124
126
  }
125
127
  }
126
128
  };
127
- let h;
128
- return v === "image" ? h = /* @__PURE__ */ e(
129
- M,
129
+ let p;
130
+ return y === "image" ? p = /* @__PURE__ */ e(
131
+ R,
130
132
  {
131
- source: u,
132
- thumbnail: a,
133
+ sourceUrl: u,
134
+ thumbnailUrl: a,
133
135
  mimeType: i,
134
136
  title: t,
135
137
  paymentStatus: m,
136
138
  isLocked: f
137
139
  }
138
- ) : v === "document" ? h = /* @__PURE__ */ e(
140
+ ) : y === "document" ? p = /* @__PURE__ */ e(
139
141
  O,
140
142
  {
141
- thumbnail: a,
143
+ thumbnailUrl: a,
142
144
  mimeType: i,
143
145
  paymentStatus: m,
144
146
  isLocked: f
145
147
  }
146
- ) : h = /* @__PURE__ */ e(
147
- R,
148
+ ) : p = /* @__PURE__ */ e(
149
+ A,
148
150
  {
149
- source: u,
150
- thumbnail: a,
151
+ sourceUrl: u,
152
+ thumbnailUrl: a,
151
153
  mimeType: i,
152
154
  paymentStatus: m,
153
155
  isLocked: f
154
156
  }
155
- ), /* @__PURE__ */ l("div", { className: "w-[280px] select-none overflow-hidden rounded-[24px] bg-white shadow-card", children: [
156
- h,
157
- /* @__PURE__ */ l("div", { className: "px-4 pb-3 pt-3", children: [
157
+ ), /* @__PURE__ */ c("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)]", children: [
158
+ p,
159
+ /* @__PURE__ */ c("div", { className: "px-4 pb-3 pt-3", children: [
158
160
  /* @__PURE__ */ e("p", { className: "mb-1.5 truncate text-base font-medium text-black", children: t }),
159
- /* @__PURE__ */ l("div", { className: "flex items-center gap-1", children: [
160
- g(i, {
161
+ /* @__PURE__ */ c("div", { className: "flex items-center gap-1", children: [
162
+ x(i, {
161
163
  className: "size-5 shrink-0 text-black/55",
162
164
  weight: "regular"
163
165
  }),
164
- r && /* @__PURE__ */ e("span", { className: "text-xs font-medium text-black/55", children: r }),
165
- m === "paid" ? /* @__PURE__ */ l(p, { children: [
166
+ o && /* @__PURE__ */ e("span", { className: "text-xs font-medium text-black/55", children: o }),
167
+ m === "paid" ? /* @__PURE__ */ c(g, { children: [
166
168
  /* @__PURE__ */ e("span", { className: "text-xs font-medium text-black/55", children: "•" }),
167
169
  /* @__PURE__ */ e("span", { className: "text-xs font-medium text-[#008236]", children: "Purchased" }),
168
170
  /* @__PURE__ */ e(
169
- T,
171
+ P,
170
172
  {
171
173
  className: "size-4 text-[#008236]",
172
174
  weight: "bold"
173
175
  }
174
176
  )
175
- ] }) : n && /* @__PURE__ */ l(p, { children: [
177
+ ] }) : l && /* @__PURE__ */ c(g, { children: [
176
178
  /* @__PURE__ */ e("span", { className: "text-xs font-medium text-black/55", children: "•" }),
177
- /* @__PURE__ */ e("span", { className: "text-xs font-medium text-black/55", children: n })
179
+ /* @__PURE__ */ e("span", { className: "text-xs font-medium text-black/55", children: l })
178
180
  ] })
179
181
  ] }),
180
182
  /* @__PURE__ */ e(
181
- E,
183
+ F,
182
184
  {
183
185
  isLocked: f,
184
- unlockLoading: S,
185
- source: u,
186
- onUnlock: o ? j : void 0,
186
+ unlockLoading: j,
187
+ sourceUrl: u,
188
+ redeemUrl: S,
189
+ onUnlock: r ? T : void 0,
187
190
  onDownload: d
188
191
  }
189
192
  )
@@ -191,6 +194,6 @@ const x = (s) => s === "paid" ? C : y, z = (s) => {
191
194
  ] });
192
195
  };
193
196
  export {
194
- B as default
197
+ G as default
195
198
  };
196
- //# sourceMappingURL=Visitor-C9HSYm3D.js.map
199
+ //# sourceMappingURL=Visitor-BACiehsg.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Visitor-BACiehsg.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, { useEffect, useState } from 'react'\n\nimport { isDevBuild } from '../../../utils/isDevBuild'\nimport type {\n LockedAttachmentBaseProps,\n LockedAttachmentSource,\n PaymentStatus,\n} 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. Return the resolved source URL.\n * The component manages loading state and sets source internally on resolution.\n * Omit to hide the Unlock button.\n */\n onUnlock?: () => Promise<LockedAttachmentSource>\n /** Called when the visitor clicks Download on an unlocked card. */\n onDownload?: () => void\n}\n\nconst getLockIcon = (paymentStatus?: PaymentStatus): React.ElementType => {\n return paymentStatus === 'paid' ? LockOpenIcon : LockSimpleIcon\n}\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\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 useEffect(() => {\n setSourceReady(false)\n }, [sourceUrl])\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 <MediaPlayer source={sourceUrl!} mimeType={mimeType} poster={thumbnailUrl} />\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 unlockLoading: boolean\n sourceUrl?: string\n redeemUrl?: string\n onUnlock?: () => void\n onDownload?: () => void\n}\n\nconst CardActions: React.FC<CardActionsProps> = (props) => {\n const { isLocked, unlockLoading, sourceUrl, redeemUrl, onUnlock, onDownload } = props\n\n if (isLocked && onUnlock) {\n return (\n <button\n type=\"button\"\n onClick={onUnlock}\n disabled={unlockLoading}\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 {unlockLoading ? (\n <LoadingDots />\n ) : (\n <>\n <LockSimpleIcon className=\"size-4\" weight=\"fill\" />\n Unlock\n </>\n )}\n </button>\n )\n }\n\n if (!isLocked && onDownload && sourceUrl) {\n return (\n <a\n href={redeemUrl ?? sourceUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n onClick={onDownload}\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\n\nconst VisitorCard: React.FC<VisitorCardProps> = (props) => {\n const {\n title,\n amountText,\n thumbnailUrl,\n sourceUrl: sourceProp,\n mimeType = 'application/octet-stream',\n detail,\n onUnlock,\n onDownload,\n paymentStatus,\n } = props\n const [sourceUrl, setSourceUrl] = useState(sourceProp)\n const [redeemUrl, setRedeemUrl] = useState<string | undefined>(undefined)\n const [unlockLoading, setUnlockLoading] = useState(false)\n\n useEffect(() => {\n if (sourceProp !== undefined) {\n setSourceUrl(sourceProp)\n setRedeemUrl(undefined)\n }\n }, [sourceProp])\n\n const isLocked = sourceUrl === undefined\n const sourceType = getSourceType(mimeType)\n\n const handleUnlock = async () => {\n if (!onUnlock) return\n setUnlockLoading(true)\n try {\n const result = await onUnlock()\n setSourceUrl(result.sourceUrl)\n setRedeemUrl(result.redeemUrl)\n } catch (err) {\n if (isDevBuild()) console.debug('[LockedAttachment] onUnlock failed', err)\n } finally {\n setUnlockLoading(false)\n }\n }\n\n let mediaPreview: React.ReactNode\n if (sourceType === 'image') {\n mediaPreview = (\n <ImagePreview\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 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 <>\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 </>\n ) : (\n amountText && (\n <>\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 </>\n )\n )}\n </div>\n <CardActions\n isLocked={isLocked}\n unlockLoading={unlockLoading}\n sourceUrl={sourceUrl}\n redeemUrl={redeemUrl}\n onUnlock={onUnlock ? handleUnlock : undefined}\n onDownload={onDownload}\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","useEffect","DocumentPreview","MediaPreview","MediaPlayer","LoadingDots","CardActions","unlockLoading","redeemUrl","onUnlock","onDownload","Fragment","DownloadSimpleIcon","VisitorCard","amountText","sourceProp","detail","setSourceUrl","setRedeemUrl","setUnlockLoading","sourceType","getSourceType","handleUnlock","result","mediaPreview","renderTypeIcon","CheckCircleIcon"],"mappings":";;;;AA8BA,MAAMA,IAAc,CAACC,MACZA,MAAkB,SAASC,IAAeC,GAQ7CC,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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,KACE,gBAAArB,EAAAkB,GAAA,EACE,UAAA;AAAA,UAAA,gBAAAvB,EAAC,QAAA,EAAK,WAAU,qCAAoC,UAAA,KAAC;AAAA,UACrD,gBAAAA,EAAC,QAAA,EAAK,WAAU,qCACb,UAAA0B,EAAA,CACH;AAAA,QAAA,EAAA,CACF;AAAA,MAAA,GAGN;AAAA,MACA,gBAAA1B;AAAA,QAACkB;AAAA,QAAA;AAAA,UACC,UAAAT;AAAA,UACA,eAAAU;AAAA,UACA,WAAAZ;AAAA,UACA,WAAAa;AAAA,UACA,UAAUC,IAAWa,IAAe;AAAA,UACpC,YAAAZ;AAAA,QAAA;AAAA,MAAA;AAAA,IACF,EAAA,CACF;AAAA,EAAA,GACF;AAEJ;"}
package/dist/index.d.ts CHANGED
@@ -278,8 +278,8 @@ export declare const LockedAttachment: (props: LockedAttachmentProps) => JSX_2.E
278
278
  declare interface LockedAttachmentBaseProps {
279
279
  title?: string;
280
280
  mimeType?: string;
281
- thumbnail?: string;
282
- source?: string;
281
+ thumbnailUrl?: string;
282
+ sourceUrl?: string;
283
283
  detail?: string;
284
284
  amountText?: string;
285
285
  paymentStatus?: PaymentStatus;
@@ -288,7 +288,10 @@ declare interface LockedAttachmentBaseProps {
288
288
  export declare type LockedAttachmentProps = (CreatorCardProps & Never<VisitorCardProps, 'onUnlock' | 'onDownload'>) | (VisitorCardProps & Never<CreatorCardProps, 'isPreview' | 'placeholderTitle' | 'placeholderAmountText' | 'onDismiss'>);
289
289
 
290
290
  export declare interface LockedAttachmentSource {
291
- source: string;
291
+ /** Proxied URL used by the media player for in-app playback. */
292
+ sourceUrl: string;
293
+ /** URL opened when the visitor clicks Download — may be a file or a web destination. */
294
+ redeemUrl?: string;
292
295
  }
293
296
 
294
297
  declare type MessageCustomType = 'MESSAGE_TIP' | 'MESSAGE_PAID' | 'MESSAGE_CHATBOT' | 'MESSAGE_ATTACHMENT' | AgeSafetySystemType | DmAgentSystemType;
package/dist/index.js CHANGED
@@ -835,10 +835,10 @@ function ws(t) {
835
835
  }, [s, n == null ? void 0 : n.userID, t.id, o]);
836
836
  return { selected: o, voteUp: l, voteDown: d };
837
837
  }
838
- const _s = F.lazy(() => import("./Creator-77XnrIxc.js")), Es = F.lazy(() => import("./Visitor-C9HSYm3D.js")), Je = () => /* @__PURE__ */ e(
838
+ const _s = F.lazy(() => import("./Creator-C8EwYYcW.js")), Es = F.lazy(() => import("./Visitor-BACiehsg.js")), Je = () => /* @__PURE__ */ e(
839
839
  "div",
840
840
  {
841
- className: "w-[280px] min-h-[200px] animate-pulse rounded-[24px] bg-black/[0.06] shadow-[0px_0px_0px_1px_rgba(0,0,0,0.04),0px_1px_2px_0px_rgba(0,0,0,0.04)]",
841
+ className: "w-[280px] min-h-[200px] animate-pulse rounded-[24px] bg-black/[0.06] shadow-[0_0_0_1px_rgba(0,0,0,0.04),0_4px_8px_rgba(0,0,0,0.06)]",
842
842
  "aria-hidden": !0
843
843
  }
844
844
  ), Ss = (t) => t.onUnlock != null || t.onDownload != null ? /* @__PURE__ */ e($e, { fallback: /* @__PURE__ */ e(Je, {}), children: /* @__PURE__ */ e(Es, { ...t }) }) : /* @__PURE__ */ e($e, { fallback: /* @__PURE__ */ e(Je, {}), children: /* @__PURE__ */ e(_s, { ...t }) }), Is = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ e(
@@ -1003,7 +1003,7 @@ const _s = F.lazy(() => import("./Creator-77XnrIxc.js")), Es = F.lazy(() => impo
1003
1003
  {
1004
1004
  title: (be = r.metadata) == null ? void 0 : be.attachment_title,
1005
1005
  mimeType: (le = r.metadata) == null ? void 0 : le.attachment_mime_type,
1006
- thumbnail: (K = r.metadata) == null ? void 0 : K.attachment_thumbnail,
1006
+ thumbnailUrl: (K = r.metadata) == null ? void 0 : K.attachment_thumbnail,
1007
1007
  amountText: (Ce = r.metadata) == null ? void 0 : Ce.amount_text,
1008
1008
  detail: (Ne = r.metadata) == null ? void 0 : Ne.attachment_detail,
1009
1009
  paymentStatus: (pe = r.metadata) == null ? void 0 : pe.payment_status,