@fayz-ai/plugin-marketing 0.13.18 → 0.13.19
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/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React12, { useState, useEffect, useMemo, useCallback } from 'react';
|
|
2
2
|
import { connectionSettings, connectionStatus, settingsStatus, createConnectionStore, getActiveTenantId, registerTranslations, createSafeDataProvider, getSupabaseClientOptional, countByTenant, useTranslation, useDataChanged, getCurrentLocale, resolveDataProvider } from '@fayz-ai/core';
|
|
3
3
|
import { createPluginContext, fayzConnectorOAuth, PluginSettingsPanel, useModuleNavigation, createViewRouter, ModuleActionBar, SettingsGroup, SelectRow, ToggleRow, askAI, PageActions, useLimitGuard, useOrganizationStore, CrudFormPage, RightRailPage, invalidateLimit, CrudListView } from '@fayz-ai/admin';
|
|
4
|
-
import { defineKpiWidget, defineCustomWidget, defineTableWidget, ModulePage, PageToolbar, DataTable, SubpageHeader, RowActions, PageHeaderActions, Button, Skeleton, ConfirmDialog, ComingSoon, DashboardCanvas, RangeControl, cn, Modal, ModalContent, ModalHeader, ModalTitle, ModalBody, SegmentedControl, Input, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, ModalFooter, SheetBody, Badge, SheetFooter, SelectSeparator, Checkbox, MarkdownEditor, toast, KpiCard as KpiCard$1, Card, CardHeader, CardTitle, CardContent, TableWidget } from '@fayz-ai/ui';
|
|
4
|
+
import { defineKpiWidget, defineCustomWidget, defineTableWidget, ModulePage, PageToolbar, DataTable, SubpageHeader, RowActions, PageHeaderActions, Button, Skeleton, ConfirmDialog, ComingSoon, DashboardCanvas, RangeControl, cn, Modal, ModalContent, ModalHeader, ModalTitle, ModalBody, SegmentedControl, Input, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, ModalFooter, SheetBody, Textarea, Badge, SheetFooter, SelectSeparator, Checkbox, MarkdownEditor, toast, KpiCard as KpiCard$1, Card, CardHeader, CardTitle, CardContent, TableWidget } from '@fayz-ai/ui';
|
|
5
5
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
6
6
|
import { History, CheckCircle2, AlertCircle, ChevronRight, Users, Target, Percent, DollarSign, Trash2, WandSparkles, SlidersHorizontal, Workflow, ExternalLink, Sparkles, Pencil, Plus, Layers, MousePointerClick, NotebookPen, ArrowUpRight, ArrowDownRight, Send, Megaphone, Settings2, Columns3, CalendarDays, List, ChevronLeft, X, Bike, Utensils, DoorOpen, MessageCircle, Instagram, Mail, Globe, Search, Link2, AtSign, Pin, Twitter, Linkedin, Facebook, Youtube, Music2, GripVertical, Loader2, ImagePlus, Repeat2, Heart, BarChart2, Share2, ThumbsUp, MoreHorizontal, Bookmark, Image, Trophy } from 'lucide-react';
|
|
7
7
|
import { createStore } from 'zustand/vanilla';
|
|
@@ -731,8 +731,10 @@ function LandingPageComposer({
|
|
|
731
731
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
732
732
|
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-foreground", children: t("marketing.landing.prompt") }),
|
|
733
733
|
site?.editorUrl ? /* @__PURE__ */ jsxs(
|
|
734
|
-
|
|
734
|
+
Button,
|
|
735
735
|
{
|
|
736
|
+
variant: "bare",
|
|
737
|
+
size: "bare",
|
|
736
738
|
type: "button",
|
|
737
739
|
onClick: () => window.open(site.editorUrl, "_blank", "noopener,noreferrer"),
|
|
738
740
|
className: "inline-flex items-center gap-1 text-xs font-medium text-primary hover:underline",
|
|
@@ -745,13 +747,13 @@ function LandingPageComposer({
|
|
|
745
747
|
) : null
|
|
746
748
|
] }),
|
|
747
749
|
/* @__PURE__ */ jsx(
|
|
748
|
-
|
|
750
|
+
Textarea,
|
|
749
751
|
{
|
|
750
752
|
value: prompt,
|
|
751
753
|
onChange: (e) => setPrompt(e.target.value),
|
|
752
754
|
rows: 3,
|
|
753
755
|
placeholder: t("marketing.landing.promptPlaceholder"),
|
|
754
|
-
className: "
|
|
756
|
+
className: "rounded-md border-border bg-background shadow-none focus-visible:ring-offset-0"
|
|
755
757
|
}
|
|
756
758
|
)
|
|
757
759
|
] }) : null,
|
|
@@ -771,8 +773,8 @@ function LandingPageComposer({
|
|
|
771
773
|
opt.slug
|
|
772
774
|
);
|
|
773
775
|
}),
|
|
774
|
-
/* @__PURE__ */ jsx(
|
|
775
|
-
|
|
776
|
+
/* @__PURE__ */ jsx("div", { className: "min-w-[8rem] flex-1", children: /* @__PURE__ */ jsx(
|
|
777
|
+
Input,
|
|
776
778
|
{
|
|
777
779
|
value: newTag,
|
|
778
780
|
onChange: (e) => setNewTag(e.target.value),
|
|
@@ -784,9 +786,9 @@ function LandingPageComposer({
|
|
|
784
786
|
},
|
|
785
787
|
onBlur: addTag,
|
|
786
788
|
placeholder: t("marketing.landing.leadTagPlaceholder"),
|
|
787
|
-
className: "
|
|
789
|
+
className: "h-auto rounded-none border-0 bg-transparent px-1 py-0 text-xs shadow-none focus-visible:ring-0 focus-visible:ring-offset-0"
|
|
788
790
|
}
|
|
789
|
-
)
|
|
791
|
+
) })
|
|
790
792
|
] }),
|
|
791
793
|
/* @__PURE__ */ jsx("span", { className: "block text-xs text-muted-foreground", children: t("marketing.landing.leadTagHint") })
|
|
792
794
|
] }),
|
|
@@ -812,10 +814,12 @@ function LandingPageComposer({
|
|
|
812
814
|
/* @__PURE__ */ jsx("div", { className: "mt-2 flex flex-wrap gap-1.5", children: CAPTURE_FIELDS.map((f) => {
|
|
813
815
|
const on = required.includes(f);
|
|
814
816
|
return /* @__PURE__ */ jsx(
|
|
815
|
-
|
|
817
|
+
Button,
|
|
816
818
|
{
|
|
819
|
+
variant: "bare",
|
|
820
|
+
size: "bare",
|
|
817
821
|
type: "button",
|
|
818
|
-
className: `rounded-full border px-2.5 py-1 text-xs ${on ? "border-primary bg-primary/10 text-primary" : "text-muted-foreground"}`,
|
|
822
|
+
className: `font-normal rounded-full border px-2.5 py-1 text-xs ${on ? "border-primary bg-primary/10 text-primary" : "text-muted-foreground"}`,
|
|
819
823
|
onClick: () => setRequired((prev) => on ? prev.filter((x) => x !== f) : [...prev, f]),
|
|
820
824
|
children: t(`marketing.landing.field.${f}`)
|
|
821
825
|
},
|
|
@@ -1059,8 +1063,10 @@ function PlatformPicker({ value, onChange }) {
|
|
|
1059
1063
|
return /* @__PURE__ */ jsx("div", { className: "flex flex-wrap items-center gap-1.5", children: PLATFORMS.map((platform) => {
|
|
1060
1064
|
const selected = value.includes(platform);
|
|
1061
1065
|
return /* @__PURE__ */ jsxs(
|
|
1062
|
-
|
|
1066
|
+
Button,
|
|
1063
1067
|
{
|
|
1068
|
+
variant: "bare",
|
|
1069
|
+
size: "bare",
|
|
1064
1070
|
type: "button",
|
|
1065
1071
|
"aria-pressed": selected,
|
|
1066
1072
|
onClick: () => onChange(selected ? value.filter((p) => p !== platform) : [...value, platform]),
|
|
@@ -1190,8 +1196,10 @@ function BriefFields({ draft, patch }) {
|
|
|
1190
1196
|
children: [
|
|
1191
1197
|
pillar,
|
|
1192
1198
|
/* @__PURE__ */ jsx(
|
|
1193
|
-
|
|
1199
|
+
Button,
|
|
1194
1200
|
{
|
|
1201
|
+
variant: "bare",
|
|
1202
|
+
size: "bare",
|
|
1195
1203
|
type: "button",
|
|
1196
1204
|
onClick: () => patch({ pillars: draft.pillars.filter((p) => p !== pillar) }),
|
|
1197
1205
|
className: "text-muted-foreground hover:text-foreground",
|
|
@@ -1333,8 +1341,10 @@ function RecordingChecklist({ post }) {
|
|
|
1333
1341
|
items.length
|
|
1334
1342
|
] }),
|
|
1335
1343
|
hasTakes && /* @__PURE__ */ jsxs(
|
|
1336
|
-
|
|
1344
|
+
Button,
|
|
1337
1345
|
{
|
|
1346
|
+
variant: "bare",
|
|
1347
|
+
size: "bare",
|
|
1338
1348
|
type: "button",
|
|
1339
1349
|
onClick: generateFromScript,
|
|
1340
1350
|
className: "flex items-center gap-1 font-medium text-muted-foreground transition-colors hover:text-foreground",
|
|
@@ -1375,8 +1385,10 @@ function RecordingChecklist({ post }) {
|
|
|
1375
1385
|
)
|
|
1376
1386
|
] }),
|
|
1377
1387
|
/* @__PURE__ */ jsx(
|
|
1378
|
-
|
|
1388
|
+
Button,
|
|
1379
1389
|
{
|
|
1390
|
+
variant: "bare",
|
|
1391
|
+
size: "bare",
|
|
1380
1392
|
type: "button",
|
|
1381
1393
|
"aria-label": t("marketing.content.cancel"),
|
|
1382
1394
|
onClick: () => remove(item.id),
|
|
@@ -1547,8 +1559,10 @@ function PostSocialPreview(props) {
|
|
|
1547
1559
|
const Frame = FRAMES[active] ?? InstagramFrame;
|
|
1548
1560
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-3 rounded-md border border-border bg-muted/20 p-4", children: [
|
|
1549
1561
|
platforms.length > 1 && /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center gap-1", children: platforms.map((platform) => /* @__PURE__ */ jsxs(
|
|
1550
|
-
|
|
1562
|
+
Button,
|
|
1551
1563
|
{
|
|
1564
|
+
variant: "bare",
|
|
1565
|
+
size: "bare",
|
|
1552
1566
|
type: "button",
|
|
1553
1567
|
onClick: () => setSelected(platform),
|
|
1554
1568
|
"aria-pressed": active === platform,
|
|
@@ -1770,12 +1784,14 @@ function MediaAsset({ post, onChanged }) {
|
|
|
1770
1784
|
] })
|
|
1771
1785
|
] })
|
|
1772
1786
|
] }) : /* @__PURE__ */ jsxs(
|
|
1773
|
-
|
|
1787
|
+
Button,
|
|
1774
1788
|
{
|
|
1789
|
+
variant: "bare",
|
|
1790
|
+
size: "bare",
|
|
1775
1791
|
type: "button",
|
|
1776
1792
|
onClick: pick,
|
|
1777
1793
|
disabled: busy,
|
|
1778
|
-
className: "flex w-full flex-col items-center justify-center gap-2 rounded-card border border-dashed border-border p-6 text-muted-foreground transition-colors hover:bg-muted/30 hover:text-foreground",
|
|
1794
|
+
className: "flex w-full flex-col items-center justify-center gap-2 rounded-card border border-dashed border-border p-6 text-muted-foreground transition-colors hover:bg-muted/30 hover:text-foreground font-normal disabled:opacity-100",
|
|
1779
1795
|
children: [
|
|
1780
1796
|
busy ? /* @__PURE__ */ jsx(Loader2, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ jsx(ImagePlus, { className: "h-5 w-5" }),
|
|
1781
1797
|
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: t("marketing.content.mediaUpload") }),
|
|
@@ -2023,8 +2039,10 @@ function PostCard({ post, onOpen, onDelete }) {
|
|
|
2023
2039
|
}
|
|
2024
2040
|
),
|
|
2025
2041
|
onDelete && /* @__PURE__ */ jsx(
|
|
2026
|
-
|
|
2042
|
+
Button,
|
|
2027
2043
|
{
|
|
2044
|
+
variant: "bare",
|
|
2045
|
+
size: "bare",
|
|
2028
2046
|
type: "button",
|
|
2029
2047
|
"aria-label": t("marketing.content.deletePost"),
|
|
2030
2048
|
onClick: (e) => {
|
|
@@ -2089,8 +2107,10 @@ function WeekColumn({ week, rangeLabel, posts, onOpenPost, onNewPost, onDeletePo
|
|
|
2089
2107
|
post.id
|
|
2090
2108
|
)),
|
|
2091
2109
|
/* @__PURE__ */ jsxs(
|
|
2092
|
-
|
|
2110
|
+
Button,
|
|
2093
2111
|
{
|
|
2112
|
+
variant: "bare",
|
|
2113
|
+
size: "bare",
|
|
2094
2114
|
type: "button",
|
|
2095
2115
|
onClick: () => onNewPost(week),
|
|
2096
2116
|
disabled,
|
|
@@ -2251,8 +2271,10 @@ function AccountSelector() {
|
|
|
2251
2271
|
/* @__PURE__ */ jsx(PlatformBadges, { platforms: acc.platforms })
|
|
2252
2272
|
] }) }),
|
|
2253
2273
|
/* @__PURE__ */ jsx(
|
|
2254
|
-
|
|
2274
|
+
Button,
|
|
2255
2275
|
{
|
|
2276
|
+
variant: "bare",
|
|
2277
|
+
size: "bare",
|
|
2256
2278
|
type: "button",
|
|
2257
2279
|
"aria-label": t("marketing.content.accountSettings"),
|
|
2258
2280
|
onPointerDown: (e) => {
|
|
@@ -2430,8 +2452,10 @@ function CalendarView({ posts, onOpenPost, onNewPostAt, disabled }) {
|
|
|
2430
2452
|
unscheduled.length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2 rounded-card border border-dashed border-border bg-muted/20 p-2.5", children: [
|
|
2431
2453
|
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: t("marketing.content.unscheduled") }),
|
|
2432
2454
|
unscheduled.map((post) => /* @__PURE__ */ jsxs(
|
|
2433
|
-
|
|
2455
|
+
Button,
|
|
2434
2456
|
{
|
|
2457
|
+
variant: "bare",
|
|
2458
|
+
size: "bare",
|
|
2435
2459
|
type: "button",
|
|
2436
2460
|
onClick: () => onOpenPost(post.id),
|
|
2437
2461
|
className: "inline-flex items-center gap-1.5 rounded-full border border-border bg-card px-2.5 py-1 text-xs font-medium text-foreground transition-colors hover:bg-muted/40",
|
|
@@ -2470,8 +2494,10 @@ function CalendarView({ posts, onOpenPost, onNewPostAt, disabled }) {
|
|
|
2470
2494
|
}
|
|
2471
2495
|
),
|
|
2472
2496
|
!disabled && /* @__PURE__ */ jsx(
|
|
2473
|
-
|
|
2497
|
+
Button,
|
|
2474
2498
|
{
|
|
2499
|
+
variant: "bare",
|
|
2500
|
+
size: "bare",
|
|
2475
2501
|
type: "button",
|
|
2476
2502
|
onClick: () => onNewPostAt(iso),
|
|
2477
2503
|
className: "rounded p-0.5 text-muted-foreground opacity-0 transition-opacity hover:bg-muted/60 hover:text-foreground group-hover:opacity-100",
|
|
@@ -2482,18 +2508,22 @@ function CalendarView({ posts, onOpenPost, onNewPostAt, disabled }) {
|
|
|
2482
2508
|
] }),
|
|
2483
2509
|
/* @__PURE__ */ jsxs("div", { className: "mt-1 space-y-1", children: [
|
|
2484
2510
|
(expandedDay === iso ? dayPosts : dayPosts.slice(0, MAX_VISIBLE)).map((post) => /* @__PURE__ */ jsx(
|
|
2485
|
-
|
|
2511
|
+
Button,
|
|
2486
2512
|
{
|
|
2513
|
+
variant: "bare",
|
|
2514
|
+
size: "bare",
|
|
2487
2515
|
type: "button",
|
|
2488
2516
|
onClick: () => onOpenPost(post.id),
|
|
2489
|
-
className: "block w-full truncate rounded border border-border bg-card px-1.5 py-1 text-left text-xs text-foreground transition-colors hover:bg-muted/40",
|
|
2517
|
+
className: "block w-full truncate rounded border border-border bg-card px-1.5 py-1 text-left text-xs text-foreground transition-colors hover:bg-muted/40 font-normal",
|
|
2490
2518
|
children: post.title || t("marketing.content.untitled")
|
|
2491
2519
|
},
|
|
2492
2520
|
post.id
|
|
2493
2521
|
)),
|
|
2494
2522
|
dayPosts.length > MAX_VISIBLE && /* @__PURE__ */ jsx(
|
|
2495
|
-
|
|
2523
|
+
Button,
|
|
2496
2524
|
{
|
|
2525
|
+
variant: "bare",
|
|
2526
|
+
size: "bare",
|
|
2497
2527
|
type: "button",
|
|
2498
2528
|
onClick: () => setExpandedDay(expandedDay === iso ? null : iso),
|
|
2499
2529
|
className: "block w-full px-1.5 py-0.5 text-left text-xs font-medium text-muted-foreground transition-colors hover:text-foreground",
|
|
@@ -2511,36 +2541,27 @@ function CalendarView({ posts, onOpenPost, onNewPostAt, disabled }) {
|
|
|
2511
2541
|
}
|
|
2512
2542
|
function ListView({ posts, onOpenPost }) {
|
|
2513
2543
|
const t = useTranslation();
|
|
2544
|
+
const columns = React12.useMemo(() => {
|
|
2545
|
+
const head = (key) => () => /* @__PURE__ */ jsx("span", { className: "text-xs uppercase tracking-wide", children: t(key) });
|
|
2546
|
+
return [
|
|
2547
|
+
{ id: "week", header: head("marketing.content.listWeek"), cell: ({ row }) => /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: row.original.weekNumber }) },
|
|
2548
|
+
{
|
|
2549
|
+
id: "title",
|
|
2550
|
+
header: head("marketing.content.listTitle"),
|
|
2551
|
+
cell: ({ row: { original: post } }) => /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2 font-medium text-foreground", children: [
|
|
2552
|
+
post.title || t("marketing.content.untitled"),
|
|
2553
|
+
/* @__PURE__ */ jsx(PlatformBadges, { platforms: post.platforms })
|
|
2554
|
+
] })
|
|
2555
|
+
},
|
|
2556
|
+
{ id: "format", header: head("marketing.content.listFormat"), cell: ({ row }) => /* @__PURE__ */ jsx(FormatBadge, { format: row.original.format }) },
|
|
2557
|
+
{ id: "status", header: head("marketing.content.listStatus"), cell: ({ row }) => /* @__PURE__ */ jsx(PostStatusBadge, { status: row.original.status }) },
|
|
2558
|
+
{ id: "date", header: head("marketing.content.listDate"), cell: ({ row }) => /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: row.original.scheduledDate ?? "\u2014" }) }
|
|
2559
|
+
];
|
|
2560
|
+
}, [t]);
|
|
2514
2561
|
if (posts.length === 0) {
|
|
2515
2562
|
return /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t("marketing.content.noPosts") });
|
|
2516
2563
|
}
|
|
2517
|
-
return /* @__PURE__ */ jsx("div", { className: "overflow-hidden rounded-card border border-border", children: /* @__PURE__ */
|
|
2518
|
-
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { className: "border-b border-border bg-muted/30 text-left text-xs font-medium uppercase tracking-wide text-muted-foreground", children: [
|
|
2519
|
-
/* @__PURE__ */ jsx("th", { className: "px-3 py-2", children: t("marketing.content.listWeek") }),
|
|
2520
|
-
/* @__PURE__ */ jsx("th", { className: "px-3 py-2", children: t("marketing.content.listTitle") }),
|
|
2521
|
-
/* @__PURE__ */ jsx("th", { className: "px-3 py-2", children: t("marketing.content.listFormat") }),
|
|
2522
|
-
/* @__PURE__ */ jsx("th", { className: "px-3 py-2", children: t("marketing.content.listStatus") }),
|
|
2523
|
-
/* @__PURE__ */ jsx("th", { className: "px-3 py-2", children: t("marketing.content.listDate") })
|
|
2524
|
-
] }) }),
|
|
2525
|
-
/* @__PURE__ */ jsx("tbody", { children: posts.map((post) => /* @__PURE__ */ jsxs(
|
|
2526
|
-
"tr",
|
|
2527
|
-
{
|
|
2528
|
-
onClick: () => onOpenPost(post.id),
|
|
2529
|
-
className: "cursor-pointer border-b border-border last:border-b-0 transition-colors hover:bg-muted/30",
|
|
2530
|
-
children: [
|
|
2531
|
-
/* @__PURE__ */ jsx("td", { className: "px-3 py-2 text-muted-foreground", children: post.weekNumber }),
|
|
2532
|
-
/* @__PURE__ */ jsx("td", { className: "px-3 py-2 font-medium text-foreground", children: /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
2533
|
-
post.title || t("marketing.content.untitled"),
|
|
2534
|
-
/* @__PURE__ */ jsx(PlatformBadges, { platforms: post.platforms })
|
|
2535
|
-
] }) }),
|
|
2536
|
-
/* @__PURE__ */ jsx("td", { className: "px-3 py-2", children: /* @__PURE__ */ jsx(FormatBadge, { format: post.format }) }),
|
|
2537
|
-
/* @__PURE__ */ jsx("td", { className: "px-3 py-2", children: /* @__PURE__ */ jsx(PostStatusBadge, { status: post.status }) }),
|
|
2538
|
-
/* @__PURE__ */ jsx("td", { className: "px-3 py-2 text-muted-foreground", children: post.scheduledDate ? shortDay(/* @__PURE__ */ new Date(`${post.scheduledDate}T00:00:00`)) : "\u2014" })
|
|
2539
|
-
]
|
|
2540
|
-
},
|
|
2541
|
-
post.id
|
|
2542
|
-
)) })
|
|
2543
|
-
] }) });
|
|
2564
|
+
return /* @__PURE__ */ jsx("div", { className: "overflow-hidden rounded-card border border-border", children: /* @__PURE__ */ jsx(DataTable, { variant: "bare", columns, data: posts, onRowClick: (post) => onOpenPost(post.id) }) });
|
|
2544
2565
|
}
|
|
2545
2566
|
function ContentView({ initialPostId = null }) {
|
|
2546
2567
|
const t = useTranslation();
|