@fayz-ai/plugin-crm 0.9.2 → 0.9.4

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 +1 @@
1
- {"version":3,"file":"BoardFilters.d.ts","sourceRoot":"","sources":["../../src/components/BoardFilters.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAA;AAKnE,OAAO,KAAK,EAAe,WAAW,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAchE,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,qBA+HnB"}
1
+ {"version":3,"file":"BoardFilters.d.ts","sourceRoot":"","sources":["../../src/components/BoardFilters.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAA;AAKnE,OAAO,KAAK,EAAe,WAAW,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAgBhE,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,qBAkInB"}
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import React16, { useState, useEffect, useMemo, useRef } from 'react';
2
2
  import { registerTranslations, registerMessageDefaults, createSafeDataProvider, getSupabaseClientOptional, usePluginRuntimeOptional, useTranslation, useActiveTenantId, getActiveTenantId, loadMessageOverrides, resolveMessages } from '@fayz-ai/core';
3
3
  import { createPluginContext, PluginSettingsPanel, registerTimelineSource, dedup, useModuleNavigation, createViewRouter, ModuleActionBar, useTenantPluginSettings, SettingsGroup, ToggleRow, adminNavigateTo, useLimitGuard, OrderFormSkeleton, OrderFormBlock, OrderFormView, OrderFormItemsCard, OrderFormItemRow, OrderFormAddItemStep, formatCurrency, OrderDetailSkeleton, OrderDetailBlock, OrderDetailView, PersonLink, useAccessOptional, invalidateLimit, useOrganizationStore } from '@fayz-ai/admin';
4
- import { toast, defineKpiWidget, defineChartWidget, defineCustomWidget, defineTableWidget, PageTransition, ModulePage, Button, SubpageHeader, ListView, useSaveBar, SearchSelect, DatePicker, DataTable, Breadcrumb, PhoneLink, DashboardCanvas, SegmentedControl, Sheet, SheetContent, SheetHeader, SheetTitle, SheetDescription, SheetBody, SheetFooter, Dropdown, DropdownTrigger, DropdownContent, DropdownLabel, DropdownSeparator, DropdownItem, ConfirmDialog, normalizePhone, KpiCard, ChartWidget, Card, CardHeader, CardTitle, CardContent, TableWidget } from '@fayz-ai/ui';
4
+ import { toast, defineKpiWidget, defineChartWidget, defineCustomWidget, defineTableWidget, PageTransition, ModulePage, Button, SubpageHeader, ListView, useSaveBar, SearchSelect, DatePicker, DataTable, Breadcrumb, PhoneLink, DashboardCanvas, PageToolbar, ToolbarButton, RangeControl, Sheet, SheetContent, SheetHeader, SheetTitle, SheetDescription, SheetBody, SheetFooter, Dropdown, DropdownTrigger, DropdownContent, DropdownLabel, DropdownSeparator, DropdownItem, ConfirmDialog, SegmentedControl, normalizePhone, KpiCard, ChartWidget, Card, CardHeader, CardTitle, CardContent, TableWidget } from '@fayz-ai/ui';
5
5
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
6
6
  import { Archive, FileX2, FileCheck2, Send, FilePlus2, XCircle, Trophy, MoveRight, Target, ArrowRightLeft, UserPlus, MessageCircle, CheckSquare, FileText, Users, Mail, Phone, Filter, Globe, Check, ChevronRight, Sparkles, Clock, Calendar, ArrowRight, ChevronDown, Printer, X, Pencil, CircleCheckBig, Ban, Receipt, Package, CalendarClock, Tag, Plus, Zap, Paperclip, ImageOff, CircleAlert, CircleDashed, Loader2, DollarSign, User } from 'lucide-react';
7
7
  import { createPortal } from 'react-dom';
@@ -1057,92 +1057,104 @@ function BoardFilters({
1057
1057
  selectedTags.includes(slug) ? selectedTags.filter((s) => s !== slug) : [...selectedTags, slug]
1058
1058
  );
1059
1059
  };
1060
- return /* @__PURE__ */ jsxs("div", { className: `flex flex-wrap items-center gap-2 ${className ?? ""}`, children: [
1061
- /* @__PURE__ */ jsx(
1062
- SegmentedControl,
1063
- {
1064
- options: [
1065
- { value: "all", label: t2("crm.filters.periodAll") },
1066
- { value: "24h", label: t2("crm.filters.period24h") },
1067
- { value: "7d", label: t2("crm.filters.period7d") },
1068
- { value: "custom", label: t2("crm.filters.periodCustom") }
1069
- ],
1070
- value: period,
1071
- onChange: onPeriodChange,
1072
- "aria-label": t2("crm.filters.period")
1073
- }
1074
- ),
1075
- period === "custom" && // As duas pontas usam a MESMA chrome do segmentado ao lado (variant
1076
- // toolbar), com a seta ligando uma à outra — antes eram dois campos de
1077
- // formulário em altura cheia no meio de uma barra de pills.
1078
- /* @__PURE__ */ jsxs("div", { className: "inline-flex items-center gap-1.5", children: [
1079
- /* @__PURE__ */ jsx(
1080
- DatePicker,
1081
- {
1082
- variant: "toolbar",
1083
- value: customFrom,
1084
- onChange: (v) => onCustomChange(v, v > customTo ? v : customTo)
1085
- }
1086
- ),
1087
- /* @__PURE__ */ jsx(ArrowRight, { className: "h-3 w-3 shrink-0 text-muted-foreground", "aria-hidden": true }),
1088
- /* @__PURE__ */ jsx(
1089
- DatePicker,
1090
- {
1091
- variant: "toolbar",
1092
- value: customTo,
1093
- onChange: (v) => onCustomChange(v < customFrom ? v : customFrom, v)
1094
- }
1095
- )
1096
- ] }),
1097
- options.length > 0 && /* @__PURE__ */ jsxs("div", { className: "relative", ref: tagsRef, children: [
1098
- /* @__PURE__ */ jsxs(
1099
- "button",
1060
+ return /* @__PURE__ */ jsx(
1061
+ PageToolbar,
1062
+ {
1063
+ className,
1064
+ range: /* @__PURE__ */ jsx(
1065
+ RangeControl,
1100
1066
  {
1101
- type: "button",
1102
- onClick: () => setTagsOpen((o) => !o),
1103
- className: `inline-flex h-[26px] items-center gap-1.5 rounded-button border px-2.5 text-xs font-medium shadow-button transition-colors ${selectedTags.length ? "border-primary/40 bg-primary/10 text-primary" : "border-border bg-card text-muted-foreground hover:bg-muted/60"}`,
1104
- children: [
1105
- /* @__PURE__ */ jsx(Tag, { className: "h-3 w-3" }),
1106
- selectedTags.length ? t2("crm.filters.tagsSelected", { count: selectedTags.length }) : t2("crm.filters.tags")
1107
- ]
1067
+ options: [
1068
+ { value: "all", label: t2("crm.filters.periodAll") },
1069
+ { value: "24h", label: t2("crm.filters.period24h") },
1070
+ { value: "7d", label: t2("crm.filters.period7d") },
1071
+ { value: "custom", label: t2("crm.filters.periodCustom") }
1072
+ ],
1073
+ value: period,
1074
+ onChange: (v) => onPeriodChange(v),
1075
+ children: period === "custom" && /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1.5", children: [
1076
+ /* @__PURE__ */ jsx(
1077
+ DatePicker,
1078
+ {
1079
+ variant: "toolbar",
1080
+ value: customFrom,
1081
+ onChange: (v) => onCustomChange(v, v > customTo ? v : customTo)
1082
+ }
1083
+ ),
1084
+ /* @__PURE__ */ jsx(ArrowRight, { className: "h-3 w-3 shrink-0 text-muted-foreground", "aria-hidden": true }),
1085
+ /* @__PURE__ */ jsx(
1086
+ DatePicker,
1087
+ {
1088
+ variant: "toolbar",
1089
+ value: customTo,
1090
+ onChange: (v) => onCustomChange(v < customFrom ? v : customFrom, v)
1091
+ }
1092
+ )
1093
+ ] })
1108
1094
  }
1109
1095
  ),
1110
- tagsOpen && /* @__PURE__ */ jsx("div", { className: "absolute left-0 z-50 mt-1 max-h-72 w-56 overflow-y-auto rounded-lg border bg-popover p-1 shadow-md", children: options.map((slug) => {
1096
+ filters: options.length > 0 && /* @__PURE__ */ jsxs("span", { className: "relative", ref: tagsRef, children: [
1097
+ /* @__PURE__ */ jsx(
1098
+ ToolbarButton,
1099
+ {
1100
+ icon: Tag,
1101
+ caret: true,
1102
+ onClick: () => setTagsOpen((o) => !o),
1103
+ className: selectedTags.length ? "text-primary" : void 0,
1104
+ children: selectedTags.length ? t2("crm.filters.tagsSelected", { count: selectedTags.length }) : t2("crm.filters.tags")
1105
+ }
1106
+ ),
1107
+ tagsOpen && /* @__PURE__ */ jsx("div", { className: "absolute left-0 z-50 mt-1 max-h-72 w-56 overflow-y-auto rounded-lg border bg-popover p-1 shadow-md", children: options.map((slug) => {
1108
+ const def = tagDefs.get(slug);
1109
+ const checked = selectedTags.includes(slug);
1110
+ return /* @__PURE__ */ jsxs(
1111
+ "button",
1112
+ {
1113
+ type: "button",
1114
+ onClick: () => toggle(slug),
1115
+ className: "flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-xs hover:bg-muted",
1116
+ children: [
1117
+ /* @__PURE__ */ jsx(
1118
+ "span",
1119
+ {
1120
+ className: `flex h-3.5 w-3.5 shrink-0 items-center justify-center rounded border ${checked ? "border-primary bg-primary text-primary-foreground" : "border-border"}`,
1121
+ children: checked && /* @__PURE__ */ jsx("span", { className: "text-[9px] leading-none", children: "\u2713" })
1122
+ }
1123
+ ),
1124
+ def?.color && /* @__PURE__ */ jsx("span", { className: "h-2 w-2 shrink-0 rounded-full", style: { backgroundColor: def.color } }),
1125
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: def?.name ?? humanizeTag(slug) })
1126
+ ]
1127
+ },
1128
+ slug
1129
+ );
1130
+ }) })
1131
+ ] }),
1132
+ chips: selectedTags.map((slug) => {
1111
1133
  const def = tagDefs.get(slug);
1112
- const checked = selectedTags.includes(slug);
1113
1134
  return /* @__PURE__ */ jsxs(
1114
- "button",
1135
+ "span",
1115
1136
  {
1116
- type: "button",
1117
- onClick: () => toggle(slug),
1118
- className: "flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-xs hover:bg-muted",
1137
+ 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",
1119
1138
  children: [
1139
+ def?.color && /* @__PURE__ */ jsx("span", { className: "h-2 w-2 shrink-0 rounded-full", style: { backgroundColor: def.color } }),
1140
+ /* @__PURE__ */ jsx("span", { className: "max-w-[10rem] truncate", children: def?.name ?? humanizeTag(slug) }),
1120
1141
  /* @__PURE__ */ jsx(
1121
- "span",
1142
+ "button",
1122
1143
  {
1123
- className: `flex h-3.5 w-3.5 shrink-0 items-center justify-center rounded border ${checked ? "border-primary bg-primary text-primary-foreground" : "border-border"}`,
1124
- children: checked && /* @__PURE__ */ jsx("span", { className: "text-[9px] leading-none", children: "\u2713" })
1144
+ type: "button",
1145
+ onClick: () => onTagsChange(selectedTags.filter((s) => s !== slug)),
1146
+ "aria-label": `${t2("crm.filters.clearTags")}: ${def?.name ?? slug}`,
1147
+ className: "rounded-full p-0.5 transition-colors hover:bg-primary/20",
1148
+ children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" })
1125
1149
  }
1126
- ),
1127
- def?.color && /* @__PURE__ */ jsx("span", { className: "h-2 w-2 shrink-0 rounded-full", style: { backgroundColor: def.color } }),
1128
- /* @__PURE__ */ jsx("span", { className: "truncate", children: def?.name ?? humanizeTag(slug) })
1150
+ )
1129
1151
  ]
1130
1152
  },
1131
1153
  slug
1132
1154
  );
1133
- }) })
1134
- ] }),
1135
- selectedTags.length > 0 && /* @__PURE__ */ jsx(
1136
- "button",
1137
- {
1138
- type: "button",
1139
- onClick: () => onTagsChange([]),
1140
- className: "inline-flex h-[26px] items-center gap-1 rounded-md px-1.5 text-xs text-muted-foreground hover:text-foreground",
1141
- title: t2("crm.filters.clearTags"),
1142
- children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" })
1143
- }
1144
- )
1145
- ] });
1155
+ })
1156
+ }
1157
+ );
1146
1158
  }
1147
1159
  function localDate(offsetDays = 0) {
1148
1160
  const d = /* @__PURE__ */ new Date();