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