@fayz-ai/plugin-crm 0.38.0 → 0.38.2

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,13 +1,13 @@
1
1
  import { AssigneeName, formatDocument, DEFAULT_ACTIVITY_TYPES, localPhoneKey, normalizeDocument, isValidDocument } from './chunk-PZMJUORG.js';
2
2
  import { CrmGeneralSettings } from './chunk-CA24LK57.js';
3
3
  import { useCrmUnitFilter, UnitPicker } from './chunk-VFLS65NL.js';
4
- import { loadTeamOrNull, loadMyUserId, DotChip, humanizeTag, TagChips, resolveSourceView } from './chunk-EHGAPCZF.js';
5
- import { CrmContextProvider, useCrmProvider, useCrmStore, useCrmConfig, formatCurrency } from './chunk-7V46TYYX.js';
4
+ import { DotChip, TagChips, loadTeamOrNull, loadMyUserId, humanizeTag, resolveSourceView } from './chunk-EHGAPCZF.js';
5
+ import { formatCurrency, CrmContextProvider, useCrmProvider, useCrmStore, useCrmConfig } from './chunk-7V46TYYX.js';
6
6
  import React2, { useCallback, useMemo, useState, useEffect, useRef } from 'react';
7
- import { Archive, FileX2, FileCheck2, Send, FilePlus2, XCircle, Trophy, PhoneCall, MoveRight, Target, ArrowRightLeft, UserPlus, MapPin, MessageCircle, CheckSquare, FileText, Users, Mail, Phone, Filter, Globe, Check, ChevronRight, Plus, Settings, Tag, Briefcase, CircleDot, User, Download, CircleDashed, Search, Inbox, X, Play, Clock, Sparkles, Calendar, ArrowRight, MoreHorizontal, ChevronDown, Printer, Pencil, CircleCheckBig, Ban, Receipt, Package, CalendarClock, Loader2, Network, Building2, CheckCircle2, AlertTriangle, Star, Trash2, MessageSquareQuote, UserRound, CalendarDays, ThumbsDown, SignalHigh, CalendarRange, TrendingDown, UserCheck, Settings2, Repeat, Zap, Snowflake, Sun, Flame, Merge, Fingerprint, Paperclip, ImageOff, CircleAlert, Link2, RefreshCw, ExternalLink, Clipboard, DollarSign, ThumbsUp, SlidersHorizontal, ChevronLeft, UserRoundPlus } from 'lucide-react';
8
- import { PageTransition, ModulePage, Button, useIsWide, PageHeaderActions, usePageSize, toast, FilterChip, MultiSelect, FilterMenu, FilterMenuRow, PersonAvatar, SubpageHeader, ListView, ConfirmDialog, Modal, ModalContent, ModalHeader, ModalTitle, ModalBody, Input, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, Textarea, ModalFooter, useSaveBar, SearchSelect, DatePicker, useFilterDraft, FilterPanel, FilterPanelField, RequiredFilter, Card, DataTable, Dropdown, DropdownTrigger, DropdownContent, DropdownItem, PhoneLink, ComingSoon, StatTiles, Switch, TooltipProvider, Tooltip, TooltipTrigger, TooltipContent, DashboardCanvas, Pagination, PersonPicker, cn, HeaderTabs, SheetBody, SheetFooter, Popover, PopoverTrigger, PopoverContent, getLucideIcon, DictateButton, DropdownLabel, DropdownSeparator, ModalDescription, normalizePhone } from '@fayz-ai/ui';
9
- import { usePluginRuntimeOptional, useTranslation, currentAppPath, navigateApp, useActiveTenantId, exportCSV, getCurrentLocale, appHref, getSupabaseClientOptional, loadMessageOverrides, resolveMessages, useActiveUnitId } from '@fayz-ai/core';
10
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
7
+ import { Archive, FileX2, FileCheck2, Send, FilePlus2, XCircle, Trophy, PhoneCall, MoveRight, Target, ArrowRightLeft, UserPlus, MapPin, MessageCircle, CheckSquare, FileText, Users, Mail, Phone, Loader2, Snowflake, Sun, Flame, ThumbsDown, UserRoundPlus, UserRound, Check, Filter, Globe, ChevronRight, Plus, Settings, Tag, Briefcase, CircleDot, User, Download, CircleDashed, Search, Inbox, X, Play, Clock, Sparkles, Calendar, ArrowRight, MoreHorizontal, ChevronDown, Printer, Pencil, CircleCheckBig, Ban, Receipt, Package, CalendarClock, Network, Building2, CheckCircle2, AlertTriangle, Star, Trash2, MessageSquareQuote, CalendarDays, SignalHigh, CalendarRange, TrendingDown, UserCheck, Settings2, Repeat, Zap, Merge, Fingerprint, Paperclip, ImageOff, CircleAlert, Link2, RefreshCw, ExternalLink, Clipboard, DollarSign, ThumbsUp, SlidersHorizontal, ChevronLeft } from 'lucide-react';
8
+ import { Dropdown, DropdownTrigger, Button, PersonAvatar, DropdownContent, PageTransition, ModulePage, useIsWide, PageHeaderActions, usePageSize, toast, FilterChip, MultiSelect, FilterMenu, FilterMenuRow, SubpageHeader, ListView, ConfirmDialog, Modal, ModalContent, ModalHeader, ModalTitle, ModalBody, Input, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, Textarea, ModalFooter, useSaveBar, SearchSelect, DatePicker, useFilterDraft, FilterPanel, FilterPanelField, RequiredFilter, Card, DataTable, DropdownItem, PhoneLink, ComingSoon, StatTiles, Switch, TooltipProvider, Tooltip, TooltipTrigger, TooltipContent, DashboardCanvas, Pagination, PersonPicker, cn, HeaderTabs, SheetBody, SheetFooter, Popover, PopoverTrigger, PopoverContent, getLucideIcon, DictateButton, DropdownLabel, DropdownSeparator, ModalDescription, normalizePhone } from '@fayz-ai/ui';
9
+ import { useTranslation, usePluginRuntimeOptional, currentAppPath, navigateApp, useActiveTenantId, exportCSV, getCurrentLocale, appHref, getSupabaseClientOptional, loadMessageOverrides, resolveMessages, useActiveUnitId } from '@fayz-ai/core';
10
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
11
11
  import { useModuleNavigation, usePluginOnboardingGate, useUnitStore, PluginOnboardingGateSkeleton, createViewRouter, ModuleActionBar, adminNavigateTo, PageActions, usePermissionOptional, usePersistedState, useScrollMemory, useLimitGuard, useCatalogedItemTypes, OrderFormSkeleton, OrderFormBlock, OrderFormView, OrderFormItemsCard, OrderFormItemRow, OrderFormAddItemStep, createArchetypeLookup, useRecordVisit, AddressesTab, OrderDetailSkeleton, OrderDetailBlock, OrderDetailView, PersonLink, CrudFormSkeleton, CrudFormPage, CrudDetailSkeleton, CrudDetailPage, AskAIButton, KanbanBoard, InlineField, invalidateLimit, useAccessOptional, useOrganizationStore, getRailPage, RightRailPage, ContactPicker, useAgentSurface } from '@fayz-ai/admin';
12
12
  import { createPortal } from 'react-dom';
13
13
  import { HelpdeskStatusPanel } from '@fayz-ai/plugin-support';
@@ -1394,7 +1394,7 @@ function DealCard({ deal, saving, currency, tagDefs, temperature, risk, display,
1394
1394
  onDragEnd,
1395
1395
  onClick,
1396
1396
  onContextMenu,
1397
- className: `group rounded-card border bg-card p-3 transition-shadow ${saving ? "opacity-70" : "hover:shadow-sm cursor-grab active:cursor-grabbing active:opacity-70"}`,
1397
+ className: `group rounded-card border bg-card p-3 transition-shadow [contain-intrinsic-size:auto_132px] [content-visibility:auto] ${saving ? "opacity-70" : "hover:shadow-sm cursor-grab active:cursor-grabbing active:opacity-70"}`,
1398
1398
  children: [
1399
1399
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
1400
1400
  /* @__PURE__ */ jsx("p", { className: "truncate text-sm font-medium", children: dealHeadline(deal) }),
@@ -1466,6 +1466,7 @@ function DealCard({ deal, saving, currency, tagDefs, temperature, risk, display,
1466
1466
  }
1467
1467
  );
1468
1468
  }
1469
+ var MemoDealCard = React2.memo(DealCard, (a, b) => a.deal === b.deal && a.saving === b.saving && a.risk === b.risk && a.temperature === b.temperature && a.display === b.display && a.team === b.team && a.tagDefs === b.tagDefs && a.currency.code === b.currency.code && a.currency.locale === b.currency.locale);
1469
1470
  function BoardMenu({ menu, team, stages, canArchive, onClose, onOpenDeal, onAssign, onMove, onArchive, setMode }) {
1470
1471
  const t = useTranslation();
1471
1472
  const { deal } = menu;
@@ -1593,9 +1594,11 @@ function BoardMenu({ menu, team, stages, canArchive, onClose, onOpenDeal, onAssi
1593
1594
  );
1594
1595
  }
1595
1596
  function StageCards({ stageId, deals, total, onLoadMore, loadMoreLabel, savingDealIds, currency, tagDefs, temps, isRisk, display, team, onAssign, onDealClick, onOpenMenu, onDragStart, onDragEnd }) {
1597
+ const latest = React2.useRef({ onAssign, onDealClick, onOpenMenu, onDragStart, onDragEnd });
1598
+ latest.current = { onAssign, onDealClick, onOpenMenu, onDragStart, onDragEnd };
1596
1599
  return /* @__PURE__ */ jsxs(Fragment, { children: [
1597
1600
  deals.map((deal) => /* @__PURE__ */ jsx(
1598
- DealCard,
1601
+ MemoDealCard,
1599
1602
  {
1600
1603
  deal,
1601
1604
  saving: savingDealIds.has(deal.id),
@@ -1605,17 +1608,17 @@ function StageCards({ stageId, deals, total, onLoadMore, loadMoreLabel, savingDe
1605
1608
  risk: isRisk(deal),
1606
1609
  display,
1607
1610
  team,
1608
- onAssign: (userId) => onAssign(deal, userId),
1609
- onClick: () => onDealClick?.(deal.id),
1611
+ onAssign: (userId) => latest.current.onAssign(deal, userId),
1612
+ onClick: () => latest.current.onDealClick?.(deal.id),
1610
1613
  onContextMenu: (e) => {
1611
1614
  e.preventDefault();
1612
- onOpenMenu(deal, e, "actions");
1615
+ latest.current.onOpenMenu(deal, e, "actions");
1613
1616
  },
1614
1617
  onDragStart: (e) => {
1615
1618
  e.dataTransfer.effectAllowed = "move";
1616
- onDragStart(deal.id, stageId);
1619
+ latest.current.onDragStart(deal.id, stageId);
1617
1620
  },
1618
- onDragEnd
1621
+ onDragEnd: () => latest.current.onDragEnd()
1619
1622
  },
1620
1623
  deal.id
1621
1624
  )),
@@ -3387,7 +3390,7 @@ function TalkToPerson({ personId, name, phone, variant = "button", className })
3387
3390
  title: label2,
3388
3391
  "aria-label": label2,
3389
3392
  className: className ?? (waHref ? "inline-flex h-7 w-7 items-center justify-center rounded-full text-white shadow-sm transition-opacity hover:opacity-85" : "inline-flex h-7 w-7 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"),
3390
- style: waHref ? { backgroundColor: "#25D366" } : void 0,
3393
+ style: waHref || className ? { backgroundColor: "#25D366" } : void 0,
3391
3394
  children: /* @__PURE__ */ jsx(WhatsAppGlyph, { className: "h-4 w-4" })
3392
3395
  }
3393
3396
  );
@@ -4175,11 +4178,7 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
4175
4178
  }
4176
4179
  ) }),
4177
4180
  /* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center gap-2 pr-8", children: [
4178
- deal?.status === "open" ? /* @__PURE__ */ jsxs(Button, { size: "sm", variant: "ghost", disabled: closing, onClick: () => setAskingLost(true), children: [
4179
- /* @__PURE__ */ jsx(ThumbsDown, { className: "h-3 w-3" }),
4180
- " ",
4181
- t("crm.card.markLost")
4182
- ] }) : deal?.status === "won" ? /* @__PURE__ */ jsxs(
4181
+ deal?.status === "won" ? /* @__PURE__ */ jsxs(
4183
4182
  "span",
4184
4183
  {
4185
4184
  className: "inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-medium " + (deal.status === "won" ? "bg-success-soft text-success-soft-foreground" : "bg-destructive-soft text-destructive-soft-foreground"),
@@ -4194,7 +4193,7 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
4194
4193
  ]
4195
4194
  }
4196
4195
  ) : null,
4197
- deal && (onCreateQuote || onViewLead || canArchive) && /* @__PURE__ */ jsxs(Dropdown, { children: [
4196
+ deal && (deal.status === "open" || onCreateQuote || onViewLead || canArchive) && /* @__PURE__ */ jsxs(Dropdown, { children: [
4198
4197
  /* @__PURE__ */ jsx(DropdownTrigger, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "sm", variant: "ghost", "aria-label": t("crm.card.moreActions"), className: "h-8 w-8 p-0", children: /* @__PURE__ */ jsx(MoreHorizontal, { className: "h-4 w-4" }) }) }),
4199
4198
  /* @__PURE__ */ jsxs(DropdownContent, { align: "end", children: [
4200
4199
  onCreateQuote && lead && /* @__PURE__ */ jsxs(DropdownItem, { onSelect: () => onCreateQuote(lead.id), children: [
@@ -4207,6 +4206,11 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
4207
4206
  " ",
4208
4207
  t("crm.dealSidebar.viewLeadProfile")
4209
4208
  ] }),
4209
+ deal.status === "open" && /* @__PURE__ */ jsxs(DropdownItem, { disabled: closing, onSelect: () => setAskingLost(true), children: [
4210
+ /* @__PURE__ */ jsx(ThumbsDown, { className: "h-3.5 w-3.5" }),
4211
+ " ",
4212
+ t("crm.card.markLost")
4213
+ ] }),
4210
4214
  canArchive && /* @__PURE__ */ jsxs(DropdownItem, { onSelect: () => {
4211
4215
  void archiveDeal(deal.id).then(onClose);
4212
4216
  }, children: [
@@ -10580,5 +10584,5 @@ function CrmPage({ config, provider, store, registries }) {
10580
10584
  }
10581
10585
 
10582
10586
  export { CrmPage };
10583
- //# sourceMappingURL=CrmPage-EAJCZ47X.js.map
10584
- //# sourceMappingURL=CrmPage-EAJCZ47X.js.map
10587
+ //# sourceMappingURL=CrmPage-TNQ5BYCU.js.map
10588
+ //# sourceMappingURL=CrmPage-TNQ5BYCU.js.map