@fayz-ai/plugin-crm 0.20.0 → 0.21.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/components/BoardFilters.d.ts.map +1 -1
- package/dist/index.js +55 -111
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BoardFilters.d.ts","sourceRoot":"","sources":["../../src/components/BoardFilters.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"BoardFilters.d.ts","sourceRoot":"","sources":["../../src/components/BoardFilters.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAA;AAKtC,OAAO,KAAK,EAAe,WAAW,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAqBhE,2DAA2D;AAC3D,wBAAgB,aAAa,CAC3B,MAAM,EAAE,WAAW,EACnB,UAAU,CAAC,EAAE,MAAM,EACnB,QAAQ,CAAC,EAAE,MAAM,GAChB;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAe9C;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,WAAW,CAAA;IACnB,cAAc,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAA;IAC7C,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;IAClD,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,CAAA;IACtC,+BAA+B;IAC/B,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC5B,iEAAiE;IACjE,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EAAE,cAAc,EACtB,UAAU,EAAE,QAAQ,EAAE,cAAc,EACpC,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,aAAa,EACtB,SAAS,GACV,EAAE,iBAAiB,qBA0EnB"}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { useState, useEffect, useMemo, useCallback, useRef } from 'react';
|
|
2
2
|
import { tl, useTranslation, getSupabaseClientOptional, registerTranslations, registerMessageDefaults, createSafeDataProvider, getActiveTenantId, countByTenant, usePluginRuntimeOptional, useActiveTenantId, exportCSV, loadMessageOverrides, resolveMessages, useActiveUnitId } from '@fayz-ai/core';
|
|
3
3
|
import { createPluginContext, useUnitBootstrap, useUnitStore, createCrudPage, PluginSettingsPanel, registerTimelineSource, dedup, useModuleNavigation, createViewRouter, ModuleActionBar, usePermissionOptional, PageActions, useTenantPluginSettings, SettingsGroup, ToggleRow, adminNavigateTo, useLimitGuard, OrderFormSkeleton, OrderFormBlock, OrderFormView, OrderFormItemsCard, OrderFormItemRow, OrderFormAddItemStep, formatCurrency, OrderDetailSkeleton, OrderDetailBlock, OrderDetailView, PersonLink, RightRailPage, KanbanBoard, invalidateLimit, useAccessOptional, useOrganizationStore, getRailPage, ContactPicker } from '@fayz-ai/admin';
|
|
4
|
-
import { Archive, FileX2, FileCheck2, Send, FilePlus2, XCircle, Trophy, PhoneCall, MoveRight, Target, ArrowRightLeft, UserPlus, MapPin, MessageCircle, CheckSquare, FileText, Users, Mail, Phone, ArrowUp, ArrowDown, X, Plus, Filter, Lock, Pencil, Trash2, Globe, Check, ChevronRight, Settings, Tag, User, Building2, Download, Inbox, Play, Clock, Sparkles, Calendar, ArrowRight, ChevronDown, Printer, CircleCheckBig, Ban, Receipt, Package, CalendarClock, Loader2, Network, Fingerprint, Link2, Star, MessageSquareQuote, Search, SignalHigh, CalendarRange, ChevronLeft, TrendingDown, ThumbsDown, UserCheck, AlertTriangle, Settings2, Repeat, Zap, Snowflake, Sun, Flame, Merge, Paperclip, ImageOff, CircleAlert, CircleDashed, CheckCircle2, Clipboard, DollarSign, ThumbsUp } from 'lucide-react';
|
|
5
|
-
import { Badge, Checkbox, toast, defineKpiWidget, defineChartWidget, defineCustomWidget, defineTableWidget, PageTransition, ModulePage, SubpageHeader, Button, TooltipProvider, Tooltip, TooltipTrigger, TooltipContent, Switch, ConfirmDialog, useIsWide, SegmentedControl, PageHeaderActions, FilterChip, MultiSelect, ListView, Modal, ModalContent, ModalHeader, ModalTitle, ModalBody, Input, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, ModalFooter, useSaveBar, SearchSelect, DatePicker, DataTable, Breadcrumb, PhoneLink, SheetBody, SheetFooter, DashboardCanvas, ModalDescription, Card, CurrencyInput, HeaderTabs, Dropdown, DropdownTrigger, DropdownContent, DropdownLabel, DropdownSeparator, DropdownItem,
|
|
4
|
+
import { Archive, FileX2, FileCheck2, Send, FilePlus2, XCircle, Trophy, PhoneCall, MoveRight, Target, ArrowRightLeft, UserPlus, MapPin, MessageCircle, CheckSquare, FileText, Users, Mail, Phone, ArrowUp, ArrowDown, X, Plus, Filter, Lock, Pencil, Trash2, Globe, Check, ChevronRight, Settings, Tag, User, Building2, Download, Inbox, Play, Clock, Sparkles, Calendar, ArrowRight, ChevronDown, Printer, CircleCheckBig, Ban, Receipt, Package, CalendarClock, Loader2, Network, Fingerprint, Link2, Star, MessageSquareQuote, Search, SignalHigh, CalendarRange, ChevronLeft, TrendingDown, ThumbsDown, UserCheck, AlertTriangle, Settings2, Repeat, Zap, Snowflake, Sun, Flame, Merge, Paperclip, ImageOff, CircleAlert, CircleDashed, CheckCircle2, CalendarDays, Clipboard, DollarSign, ThumbsUp } from 'lucide-react';
|
|
5
|
+
import { Badge, Checkbox, toast, defineKpiWidget, defineChartWidget, defineCustomWidget, defineTableWidget, PageTransition, ModulePage, SubpageHeader, Button, TooltipProvider, Tooltip, TooltipTrigger, TooltipContent, Switch, ConfirmDialog, useIsWide, SegmentedControl, PageHeaderActions, FilterChip, MultiSelect, ListView, Modal, ModalContent, ModalHeader, ModalTitle, ModalBody, Input, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, ModalFooter, useSaveBar, SearchSelect, DatePicker, DataTable, Breadcrumb, PhoneLink, SheetBody, SheetFooter, DashboardCanvas, ModalDescription, Card, CurrencyInput, HeaderTabs, Dropdown, DropdownTrigger, DropdownContent, DropdownLabel, DropdownSeparator, DropdownItem, Popover, PopoverTrigger, PopoverContent, getLucideIcon, DictateButton, normalizePhone, KpiCard, ChartWidget, CardHeader, CardTitle, CardContent, TableWidget } from '@fayz-ai/ui';
|
|
6
6
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
7
7
|
import { createPortal } from 'react-dom';
|
|
8
8
|
import { createStore as createStore$1 } from 'zustand/vanilla';
|
|
@@ -827,125 +827,69 @@ function BoardFilters({
|
|
|
827
827
|
className
|
|
828
828
|
}) {
|
|
829
829
|
const t2 = useTranslation();
|
|
830
|
-
const [tagsOpen, setTagsOpen] = useState(false);
|
|
831
|
-
const tagsRef = useRef(null);
|
|
832
|
-
useEffect(() => {
|
|
833
|
-
if (!tagsOpen) return;
|
|
834
|
-
const onDown = (e) => {
|
|
835
|
-
if (!tagsRef.current?.contains(e.target)) setTagsOpen(false);
|
|
836
|
-
};
|
|
837
|
-
document.addEventListener("mousedown", onDown);
|
|
838
|
-
return () => document.removeEventListener("mousedown", onDown);
|
|
839
|
-
}, [tagsOpen]);
|
|
840
830
|
const options = useMemo(() => {
|
|
841
831
|
const all = /* @__PURE__ */ new Set([...availableTags, ...selectedTags]);
|
|
842
832
|
return [...all].sort(
|
|
843
833
|
(a, b) => (tagDefs.get(a)?.name ?? humanizeTag(a)).localeCompare(tagDefs.get(b)?.name ?? humanizeTag(b))
|
|
844
834
|
);
|
|
845
835
|
}, [availableTags, selectedTags, tagDefs]);
|
|
846
|
-
const
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
)
|
|
836
|
+
const periodoLabel = {
|
|
837
|
+
all: t2("crm.filters.periodAll"),
|
|
838
|
+
"24h": t2("crm.filters.period24h"),
|
|
839
|
+
"7d": t2("crm.filters.period7d"),
|
|
840
|
+
custom: t2("crm.filters.periodCustom")
|
|
850
841
|
};
|
|
851
|
-
return /* @__PURE__ */ jsx(
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
842
|
+
return /* @__PURE__ */ jsx("div", { className, children: /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
843
|
+
/* @__PURE__ */ jsx(
|
|
844
|
+
FilterChip,
|
|
845
|
+
{
|
|
846
|
+
label: t2("crm.filters.period"),
|
|
847
|
+
icon: CalendarDays,
|
|
848
|
+
allLabel: periodoLabel.all,
|
|
849
|
+
options: [
|
|
850
|
+
{ value: "24h", label: periodoLabel["24h"] },
|
|
851
|
+
{ value: "7d", label: periodoLabel["7d"] },
|
|
852
|
+
{ value: "custom", label: periodoLabel.custom }
|
|
853
|
+
],
|
|
854
|
+
value: period === "all" ? void 0 : period,
|
|
855
|
+
onChange: (v) => onPeriodChange(v ?? "all")
|
|
856
|
+
}
|
|
857
|
+
),
|
|
858
|
+
period === "custom" && /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
859
|
+
/* @__PURE__ */ jsx(
|
|
860
|
+
DatePicker,
|
|
857
861
|
{
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
{ value: "7d", label: t2("crm.filters.period7d") },
|
|
862
|
-
{ value: "custom", label: t2("crm.filters.periodCustom") }
|
|
863
|
-
],
|
|
864
|
-
value: period,
|
|
865
|
-
onChange: (v) => onPeriodChange(v),
|
|
866
|
-
children: period === "custom" && /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
867
|
-
/* @__PURE__ */ jsx(
|
|
868
|
-
DatePicker,
|
|
869
|
-
{
|
|
870
|
-
variant: "toolbar",
|
|
871
|
-
value: customFrom,
|
|
872
|
-
onChange: (v) => onCustomChange(v, v > customTo ? v : customTo)
|
|
873
|
-
}
|
|
874
|
-
),
|
|
875
|
-
/* @__PURE__ */ jsx(ArrowRight, { className: "h-3 w-3 shrink-0 text-muted-foreground", "aria-hidden": true }),
|
|
876
|
-
/* @__PURE__ */ jsx(
|
|
877
|
-
DatePicker,
|
|
878
|
-
{
|
|
879
|
-
variant: "toolbar",
|
|
880
|
-
value: customTo,
|
|
881
|
-
onChange: (v) => onCustomChange(v < customFrom ? v : customFrom, v)
|
|
882
|
-
}
|
|
883
|
-
)
|
|
884
|
-
] })
|
|
862
|
+
variant: "toolbar",
|
|
863
|
+
value: customFrom,
|
|
864
|
+
onChange: (v) => onCustomChange(v, v > customTo ? v : customTo)
|
|
885
865
|
}
|
|
886
866
|
),
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
}
|
|
914
|
-
),
|
|
915
|
-
def?.color && /* @__PURE__ */ jsx("span", { className: "h-2 w-2 shrink-0 rounded-full", style: { backgroundColor: def.color } }),
|
|
916
|
-
/* @__PURE__ */ jsx("span", { className: "truncate", children: def?.name ?? humanizeTag(slug) })
|
|
917
|
-
]
|
|
918
|
-
},
|
|
919
|
-
slug
|
|
920
|
-
);
|
|
921
|
-
}) })
|
|
922
|
-
] }),
|
|
923
|
-
chips: selectedTags.map((slug) => {
|
|
924
|
-
const def = tagDefs.get(slug);
|
|
925
|
-
return /* @__PURE__ */ jsxs(
|
|
926
|
-
"span",
|
|
927
|
-
{
|
|
928
|
-
className: "inline-flex h-[26px] shrink-0 items-center gap-1 rounded-full border border-primary/30 bg-primary/10 py-1 pl-2.5 pr-1 text-xs font-medium text-primary",
|
|
929
|
-
children: [
|
|
930
|
-
def?.color && /* @__PURE__ */ jsx("span", { className: "h-2 w-2 shrink-0 rounded-full", style: { backgroundColor: def.color } }),
|
|
931
|
-
/* @__PURE__ */ jsx("span", { className: "max-w-[10rem] truncate", children: def?.name ?? humanizeTag(slug) }),
|
|
932
|
-
/* @__PURE__ */ jsx(
|
|
933
|
-
"button",
|
|
934
|
-
{
|
|
935
|
-
type: "button",
|
|
936
|
-
onClick: () => onTagsChange(selectedTags.filter((s) => s !== slug)),
|
|
937
|
-
"aria-label": `${t2("crm.filters.clearTags")}: ${def?.name ?? slug}`,
|
|
938
|
-
className: "rounded-full p-0.5 transition-colors hover:bg-primary/20",
|
|
939
|
-
children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" })
|
|
940
|
-
}
|
|
941
|
-
)
|
|
942
|
-
]
|
|
943
|
-
},
|
|
944
|
-
slug
|
|
945
|
-
);
|
|
946
|
-
})
|
|
947
|
-
}
|
|
948
|
-
);
|
|
867
|
+
/* @__PURE__ */ jsx(ArrowRight, { className: "h-3 w-3 shrink-0 text-muted-foreground", "aria-hidden": true }),
|
|
868
|
+
/* @__PURE__ */ jsx(
|
|
869
|
+
DatePicker,
|
|
870
|
+
{
|
|
871
|
+
variant: "toolbar",
|
|
872
|
+
value: customTo,
|
|
873
|
+
onChange: (v) => onCustomChange(v < customFrom ? v : customFrom, v)
|
|
874
|
+
}
|
|
875
|
+
)
|
|
876
|
+
] }),
|
|
877
|
+
options.length > 0 && /* @__PURE__ */ jsx(
|
|
878
|
+
MultiSelect,
|
|
879
|
+
{
|
|
880
|
+
variant: "chip",
|
|
881
|
+
icon: Tag,
|
|
882
|
+
options: options.map((slug) => ({
|
|
883
|
+
value: slug,
|
|
884
|
+
label: tagDefs.get(slug)?.name ?? humanizeTag(slug),
|
|
885
|
+
color: tagDefs.get(slug)?.color
|
|
886
|
+
})),
|
|
887
|
+
value: selectedTags,
|
|
888
|
+
onChange: onTagsChange,
|
|
889
|
+
allLabel: t2("crm.filters.tags")
|
|
890
|
+
}
|
|
891
|
+
)
|
|
892
|
+
] }) });
|
|
949
893
|
}
|
|
950
894
|
|
|
951
895
|
// src/lib/relative-time.ts
|