@fayz-ai/plugin-linkinbio 0.9.0 → 0.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/public/BioPageRenderer.d.ts.map +1 -1
- package/dist/public/blocks/ProfileHeader.d.ts.map +1 -1
- package/dist/public/components/MediaKit.d.ts +6 -0
- package/dist/public/components/MediaKit.d.ts.map +1 -0
- package/dist/public/index.js +238 -4
- package/dist/public/index.js.map +1 -1
- package/dist/types.d.ts +13 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +11 -10
- package/src/public/BioPageRenderer.tsx +2 -0
- package/src/public/blocks/ProfileHeader.tsx +16 -18
- package/src/public/components/MediaKit.tsx +249 -0
- package/src/types.ts +9 -0
- package/dist/index.cjs +0 -33
- package/dist/index.cjs.map +0 -1
- package/dist/public/index.cjs +0 -1750
- package/dist/public/index.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BioPageRenderer.d.ts","sourceRoot":"","sources":["../../src/public/BioPageRenderer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAY,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"BioPageRenderer.d.ts","sourceRoot":"","sources":["../../src/public/BioPageRenderer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAY,MAAM,UAAU,CAAC;AAqBlD,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,OAAO,CAAC;IACd,0EAA0E;IAC1E,SAAS,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;CAC5C;AAKD,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,oBAAoB,+BA0NhF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileHeader.d.ts","sourceRoot":"","sources":["../../../src/public/blocks/ProfileHeader.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAIjE,UAAU,KAAK;IACb,OAAO,EAAE,oBAAoB,CAAC;IAC9B,IAAI,EAAE,OAAO,CAAC;CACf;AAED,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,KAAK,+
|
|
1
|
+
{"version":3,"file":"ProfileHeader.d.ts","sourceRoot":"","sources":["../../../src/public/blocks/ProfileHeader.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAIjE,UAAU,KAAK;IACb,OAAO,EAAE,oBAAoB,CAAC;IAC9B,IAAI,EAAE,OAAO,CAAC;CACf;AAED,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,KAAK,+BAkK7D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MediaKit.d.ts","sourceRoot":"","sources":["../../../src/public/components/MediaKit.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAgB,MAAM,aAAa,CAAC;AA4CzD,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAkB,EAAE,EAAE;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAA;CAAE,sCAyMnG"}
|
package/dist/public/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { createContext, useContext, useRef, useState, useEffect, createElement } from 'react';
|
|
1
|
+
import { createContext, useContext, useRef, useState, useEffect, createElement, useMemo } from 'react';
|
|
2
2
|
import { getSupabaseClientOptional, createSafeDataProvider } from '@fayz-ai/core';
|
|
3
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
4
|
import { useParams } from 'react-router-dom';
|
|
5
|
-
import { Globe, Music, Facebook, Twitter, Mail, Phone, Youtube, Instagram, ChevronLeft, ChevronRight, ChevronUp, MessageCircle,
|
|
5
|
+
import { Globe, Music, Facebook, Twitter, Mail, Phone, Youtube, Instagram, ChevronLeft, ChevronRight, ChevronUp, MessageCircle, Download, X, ExternalLink, Check, Copy, FileText, ArrowUpRight, ChevronDown, MapPin, Play } from 'lucide-react';
|
|
6
|
+
import { createPortal } from 'react-dom';
|
|
6
7
|
import { SiGoogledrive, SiMixcloud, SiBeatport, SiTelegram, SiX, SiFacebook, SiBandcamp, SiApplemusic, SiWhatsapp, SiSpotify, SiTiktok, SiSoundcloud, SiYoutube, SiInstagram } from 'react-icons/si';
|
|
7
8
|
|
|
8
9
|
// src/public/createPublicLinkInBioPlugin.ts
|
|
@@ -182,6 +183,238 @@ function Reveal({
|
|
|
182
183
|
}
|
|
183
184
|
);
|
|
184
185
|
}
|
|
186
|
+
function derive(page) {
|
|
187
|
+
const seen = /* @__PURE__ */ new Set();
|
|
188
|
+
const images = [];
|
|
189
|
+
const pushImg = (label, url, kind = "image") => {
|
|
190
|
+
if (!url || seen.has(url) || !url.startsWith("/")) return;
|
|
191
|
+
seen.add(url);
|
|
192
|
+
images.push({ label, url, kind });
|
|
193
|
+
};
|
|
194
|
+
if (page.branding.logoUrl) pushImg("Logo", page.branding.logoUrl, "logo");
|
|
195
|
+
let bioText = "";
|
|
196
|
+
for (const s of page.sections) {
|
|
197
|
+
if (s.type === "profile-header" && s.imageUrl) pushImg("Foto de capa", s.imageUrl);
|
|
198
|
+
if (s.type === "hero" && s.backgroundImageUrl) pushImg("Foto de capa", s.backgroundImageUrl);
|
|
199
|
+
if (s.type === "gallery") s.media.forEach((m, i) => m.type === "image" && pushImg(`Foto ${i + 1}`, m.url));
|
|
200
|
+
if (s.type === "bio" || s.type === "text") {
|
|
201
|
+
if (s.content) bioText += `${s.title ? `## ${s.title}
|
|
202
|
+
|
|
203
|
+
` : ""}${s.content}
|
|
204
|
+
|
|
205
|
+
`;
|
|
206
|
+
if (s.type === "bio" && s.imageUrl) pushImg("Foto", s.imageUrl);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
const extras = (page.mediaKit?.assets ?? []).map(
|
|
210
|
+
(a) => ({ label: a.label, url: a.url, kind: a.kind ?? "link" })
|
|
211
|
+
);
|
|
212
|
+
return { images, bioText: bioText.trim(), extras, driveUrl: page.mediaKit?.driveUrl };
|
|
213
|
+
}
|
|
214
|
+
function fileName(url, fallback) {
|
|
215
|
+
const base = url.split("/").pop()?.split("?")[0];
|
|
216
|
+
return base && base.includes(".") ? base : fallback;
|
|
217
|
+
}
|
|
218
|
+
function MediaKit({ page, variant = "inline" }) {
|
|
219
|
+
const [open, setOpen] = useState(false);
|
|
220
|
+
const [copied, setCopied] = useState(false);
|
|
221
|
+
const { images, bioText, extras, driveUrl } = useMemo(() => derive(page), [page]);
|
|
222
|
+
if (!images.length && !bioText && !extras.length && !driveUrl) return null;
|
|
223
|
+
const copyBio = async () => {
|
|
224
|
+
try {
|
|
225
|
+
await navigator.clipboard.writeText(bioText);
|
|
226
|
+
setCopied(true);
|
|
227
|
+
setTimeout(() => setCopied(false), 1800);
|
|
228
|
+
} catch {
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
const downloadBio = () => {
|
|
232
|
+
const blob = new Blob([bioText], { type: "text/plain;charset=utf-8" });
|
|
233
|
+
const url = URL.createObjectURL(blob);
|
|
234
|
+
const a = document.createElement("a");
|
|
235
|
+
a.href = url;
|
|
236
|
+
a.download = `${page.identity.slug || "bio"}-bio.txt`;
|
|
237
|
+
a.click();
|
|
238
|
+
setTimeout(() => URL.revokeObjectURL(url), 1e3);
|
|
239
|
+
};
|
|
240
|
+
const modal = /* @__PURE__ */ jsx(
|
|
241
|
+
"div",
|
|
242
|
+
{
|
|
243
|
+
className: "fixed inset-0 z-[100] flex items-end sm:items-center justify-center p-0 sm:p-4",
|
|
244
|
+
style: {
|
|
245
|
+
...getBrandingVars(page.branding),
|
|
246
|
+
background: "rgba(0,0,0,0.6)",
|
|
247
|
+
backdropFilter: "blur(4px)",
|
|
248
|
+
fontFamily: "var(--pk-font-body)"
|
|
249
|
+
},
|
|
250
|
+
onClick: () => setOpen(false),
|
|
251
|
+
children: /* @__PURE__ */ jsxs(
|
|
252
|
+
"div",
|
|
253
|
+
{
|
|
254
|
+
className: "w-full sm:max-w-lg max-h-[88vh] overflow-y-auto rounded-t-3xl sm:rounded-3xl",
|
|
255
|
+
style: { backgroundColor: "var(--pk-bg)", border: "1px solid rgba(255,255,255,0.1)" },
|
|
256
|
+
onClick: (e) => e.stopPropagation(),
|
|
257
|
+
children: [
|
|
258
|
+
/* @__PURE__ */ jsxs(
|
|
259
|
+
"div",
|
|
260
|
+
{
|
|
261
|
+
className: "sticky top-0 flex items-center justify-between px-5 py-4 z-10",
|
|
262
|
+
style: { backgroundColor: "var(--pk-bg)", borderBottom: "1px solid rgba(255,255,255,0.08)" },
|
|
263
|
+
children: [
|
|
264
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
265
|
+
/* @__PURE__ */ jsx(Download, { size: 18, style: { color: "var(--pk-primary)" } }),
|
|
266
|
+
/* @__PURE__ */ jsx("h3", { className: "text-base font-bold", style: { color: "var(--pk-text)", fontFamily: "var(--pk-font-heading)" }, children: "M\xEDdia Kit" })
|
|
267
|
+
] }),
|
|
268
|
+
/* @__PURE__ */ jsx(
|
|
269
|
+
"button",
|
|
270
|
+
{
|
|
271
|
+
type: "button",
|
|
272
|
+
"aria-label": "Fechar",
|
|
273
|
+
onClick: () => setOpen(false),
|
|
274
|
+
className: "flex items-center justify-center w-8 h-8 rounded-full",
|
|
275
|
+
style: { backgroundColor: "rgba(255,255,255,0.08)", color: "var(--pk-text)" },
|
|
276
|
+
children: /* @__PURE__ */ jsx(X, { size: 16 })
|
|
277
|
+
}
|
|
278
|
+
)
|
|
279
|
+
]
|
|
280
|
+
}
|
|
281
|
+
),
|
|
282
|
+
/* @__PURE__ */ jsxs("div", { className: "px-5 py-5 space-y-6", children: [
|
|
283
|
+
driveUrl && /* @__PURE__ */ jsxs(
|
|
284
|
+
"a",
|
|
285
|
+
{
|
|
286
|
+
href: driveUrl,
|
|
287
|
+
target: "_blank",
|
|
288
|
+
rel: "noopener noreferrer",
|
|
289
|
+
className: "flex items-center gap-3 p-3 rounded-xl transition-transform hover:scale-[1.01]",
|
|
290
|
+
style: { backgroundColor: "var(--pk-primary)", color: "var(--pk-bg)" },
|
|
291
|
+
children: [
|
|
292
|
+
/* @__PURE__ */ jsx(ExternalLink, { size: 18 }),
|
|
293
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-semibold", children: "Abrir kit completo (Drive)" })
|
|
294
|
+
]
|
|
295
|
+
}
|
|
296
|
+
),
|
|
297
|
+
bioText && /* @__PURE__ */ jsxs("section", { children: [
|
|
298
|
+
/* @__PURE__ */ jsx("h4", { className: "text-xs font-bold uppercase tracking-wider mb-2 opacity-60", style: { color: "var(--pk-muted)" }, children: "Bio / Release" }),
|
|
299
|
+
/* @__PURE__ */ jsx(
|
|
300
|
+
"p",
|
|
301
|
+
{
|
|
302
|
+
className: "text-sm leading-relaxed max-h-32 overflow-y-auto p-3 rounded-xl",
|
|
303
|
+
style: { color: "var(--pk-muted)", backgroundColor: "rgba(255,255,255,0.04)" },
|
|
304
|
+
children: bioText.replace(/[*#]/g, "")
|
|
305
|
+
}
|
|
306
|
+
),
|
|
307
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-2 mt-2", children: [
|
|
308
|
+
/* @__PURE__ */ jsxs(
|
|
309
|
+
"button",
|
|
310
|
+
{
|
|
311
|
+
type: "button",
|
|
312
|
+
onClick: copyBio,
|
|
313
|
+
className: "flex items-center gap-1.5 px-3 py-1.5 text-xs font-semibold rounded-full",
|
|
314
|
+
style: { backgroundColor: "rgba(255,255,255,0.08)", color: "var(--pk-text)" },
|
|
315
|
+
children: [
|
|
316
|
+
copied ? /* @__PURE__ */ jsx(Check, { size: 13 }) : /* @__PURE__ */ jsx(Copy, { size: 13 }),
|
|
317
|
+
" ",
|
|
318
|
+
copied ? "Copiado" : "Copiar"
|
|
319
|
+
]
|
|
320
|
+
}
|
|
321
|
+
),
|
|
322
|
+
/* @__PURE__ */ jsxs(
|
|
323
|
+
"button",
|
|
324
|
+
{
|
|
325
|
+
type: "button",
|
|
326
|
+
onClick: downloadBio,
|
|
327
|
+
className: "flex items-center gap-1.5 px-3 py-1.5 text-xs font-semibold rounded-full",
|
|
328
|
+
style: { backgroundColor: "rgba(255,255,255,0.08)", color: "var(--pk-text)" },
|
|
329
|
+
children: [
|
|
330
|
+
/* @__PURE__ */ jsx(FileText, { size: 13 }),
|
|
331
|
+
" .txt"
|
|
332
|
+
]
|
|
333
|
+
}
|
|
334
|
+
)
|
|
335
|
+
] })
|
|
336
|
+
] }),
|
|
337
|
+
images.length > 0 && /* @__PURE__ */ jsxs("section", { children: [
|
|
338
|
+
/* @__PURE__ */ jsx("h4", { className: "text-xs font-bold uppercase tracking-wider mb-2 opacity-60", style: { color: "var(--pk-muted)" }, children: "Fotos & Logo" }),
|
|
339
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-3 gap-2", children: images.map((img) => /* @__PURE__ */ jsxs(
|
|
340
|
+
"a",
|
|
341
|
+
{
|
|
342
|
+
href: img.url,
|
|
343
|
+
download: fileName(img.url, `${page.identity.slug}-${img.label}`),
|
|
344
|
+
className: "group relative aspect-square overflow-hidden rounded-xl",
|
|
345
|
+
style: { backgroundColor: "rgba(255,255,255,0.06)" },
|
|
346
|
+
title: `Baixar ${img.label}`,
|
|
347
|
+
children: [
|
|
348
|
+
/* @__PURE__ */ jsx(
|
|
349
|
+
"img",
|
|
350
|
+
{
|
|
351
|
+
src: img.url,
|
|
352
|
+
alt: img.label,
|
|
353
|
+
className: `w-full h-full ${img.kind === "logo" ? "object-contain p-3" : "object-cover"}`,
|
|
354
|
+
loading: "lazy"
|
|
355
|
+
}
|
|
356
|
+
),
|
|
357
|
+
/* @__PURE__ */ jsx(
|
|
358
|
+
"div",
|
|
359
|
+
{
|
|
360
|
+
className: "absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",
|
|
361
|
+
style: { background: "rgba(0,0,0,0.45)" },
|
|
362
|
+
children: /* @__PURE__ */ jsx(Download, { size: 20, style: { color: "#fff" } })
|
|
363
|
+
}
|
|
364
|
+
)
|
|
365
|
+
]
|
|
366
|
+
},
|
|
367
|
+
img.url
|
|
368
|
+
)) })
|
|
369
|
+
] }),
|
|
370
|
+
extras.length > 0 && /* @__PURE__ */ jsxs("section", { children: [
|
|
371
|
+
/* @__PURE__ */ jsx("h4", { className: "text-xs font-bold uppercase tracking-wider mb-2 opacity-60", style: { color: "var(--pk-muted)" }, children: "Recursos" }),
|
|
372
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: extras.map((a) => /* @__PURE__ */ jsxs(
|
|
373
|
+
"a",
|
|
374
|
+
{
|
|
375
|
+
href: a.url,
|
|
376
|
+
target: "_blank",
|
|
377
|
+
rel: "noopener noreferrer",
|
|
378
|
+
download: a.kind !== "link" ? fileName(a.url, a.label) : void 0,
|
|
379
|
+
className: "flex items-center gap-3 p-3 rounded-xl",
|
|
380
|
+
style: { backgroundColor: "rgba(255,255,255,0.05)", color: "var(--pk-text)" },
|
|
381
|
+
children: [
|
|
382
|
+
a.kind === "link" ? /* @__PURE__ */ jsx(ExternalLink, { size: 16 }) : /* @__PURE__ */ jsx(FileText, { size: 16 }),
|
|
383
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: a.label }),
|
|
384
|
+
/* @__PURE__ */ jsx(Download, { size: 15, className: "ml-auto opacity-50" })
|
|
385
|
+
]
|
|
386
|
+
},
|
|
387
|
+
a.url
|
|
388
|
+
)) })
|
|
389
|
+
] })
|
|
390
|
+
] })
|
|
391
|
+
]
|
|
392
|
+
}
|
|
393
|
+
)
|
|
394
|
+
}
|
|
395
|
+
);
|
|
396
|
+
const isFab = variant === "fab";
|
|
397
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
398
|
+
/* @__PURE__ */ jsx(
|
|
399
|
+
"button",
|
|
400
|
+
{
|
|
401
|
+
type: "button",
|
|
402
|
+
onClick: () => setOpen(true),
|
|
403
|
+
"aria-label": "Baixar m\xEDdia kit",
|
|
404
|
+
title: "M\xEDdia Kit",
|
|
405
|
+
className: `flex items-center justify-center rounded-full transition-transform hover:scale-110 ${isFab ? "w-12 h-12" : "w-11 h-11"}`,
|
|
406
|
+
style: isFab ? {
|
|
407
|
+
color: "var(--pk-primary)",
|
|
408
|
+
border: "1.5px solid var(--pk-primary)",
|
|
409
|
+
backgroundColor: "color-mix(in srgb, var(--pk-bg) 70%, transparent)",
|
|
410
|
+
backdropFilter: "blur(6px)"
|
|
411
|
+
} : { backgroundColor: "rgba(255,255,255,0.07)", color: "var(--pk-text)" },
|
|
412
|
+
children: /* @__PURE__ */ jsx(Download, { size: isFab ? 20 : 19 })
|
|
413
|
+
}
|
|
414
|
+
),
|
|
415
|
+
open && typeof document !== "undefined" && createPortal(modal, document.body)
|
|
416
|
+
] });
|
|
417
|
+
}
|
|
185
418
|
function HeroSection({ section, identity, branding }) {
|
|
186
419
|
const hasLogo = section.showLogo && branding.logoUrl;
|
|
187
420
|
return /* @__PURE__ */ jsxs(
|
|
@@ -1041,7 +1274,7 @@ function ProfileHeader({ section, page }) {
|
|
|
1041
1274
|
identity.tagline && /* @__PURE__ */ jsx("p", { className: "text-base font-medium", style: { color: "var(--pk-text)" }, children: identity.tagline }),
|
|
1042
1275
|
section.showLocation && identity.location && /* @__PURE__ */ jsx("p", { className: "text-xs mt-1 opacity-60", style: { color: "var(--pk-muted)" }, children: identity.location })
|
|
1043
1276
|
] }),
|
|
1044
|
-
|
|
1277
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap items-center justify-center gap-3 mt-4 px-4", children: socials.map((link) => /* @__PURE__ */ jsx(
|
|
1045
1278
|
"a",
|
|
1046
1279
|
{
|
|
1047
1280
|
href: link.url,
|
|
@@ -1563,6 +1796,7 @@ function BioPageRenderer({ page, poweredBy }) {
|
|
|
1563
1796
|
children: /* @__PURE__ */ jsx(ChevronUp, { size: 20 })
|
|
1564
1797
|
}
|
|
1565
1798
|
),
|
|
1799
|
+
/* @__PURE__ */ jsx(MediaKit, { page, variant: "fab" }),
|
|
1566
1800
|
floatingCta && /* @__PURE__ */ jsx(
|
|
1567
1801
|
"a",
|
|
1568
1802
|
{
|