@fayz-ai/plugin-crm 0.8.3 → 0.8.5

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.
Files changed (84) hide show
  1. package/dist/cascade.d.ts.map +1 -1
  2. package/dist/components/BoardFilters.d.ts +23 -0
  3. package/dist/components/BoardFilters.d.ts.map +1 -0
  4. package/dist/components/QuoteStatusDropdown.d.ts.map +1 -1
  5. package/dist/components/TagChips.d.ts +16 -0
  6. package/dist/components/TagChips.d.ts.map +1 -0
  7. package/dist/data/mock.d.ts +5 -0
  8. package/dist/data/mock.d.ts.map +1 -1
  9. package/dist/data/supabase.d.ts +6 -0
  10. package/dist/data/supabase.d.ts.map +1 -1
  11. package/dist/data/types.d.ts +12 -2
  12. package/dist/data/types.d.ts.map +1 -1
  13. package/dist/index.d.ts +3 -0
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +1136 -164
  16. package/dist/index.js.map +1 -1
  17. package/dist/lib/access.d.ts +8 -0
  18. package/dist/lib/access.d.ts.map +1 -0
  19. package/dist/locales/en.d.ts.map +1 -1
  20. package/dist/locales/pt-BR.d.ts.map +1 -1
  21. package/dist/migrations/index.d.ts +9 -1
  22. package/dist/migrations/index.d.ts.map +1 -1
  23. package/dist/public/context.d.ts +3 -3
  24. package/dist/public/context.d.ts.map +1 -1
  25. package/dist/public/createPublicFormsPlugin.d.ts +18 -2
  26. package/dist/public/createPublicFormsPlugin.d.ts.map +1 -1
  27. package/dist/public/data.supabase.d.ts.map +1 -1
  28. package/dist/public/index.js +31 -7
  29. package/dist/public/index.js.map +1 -1
  30. package/dist/public/types.d.ts +27 -0
  31. package/dist/public/types.d.ts.map +1 -1
  32. package/dist/registries.d.ts +11 -0
  33. package/dist/registries.d.ts.map +1 -1
  34. package/dist/store.d.ts +12 -2
  35. package/dist/store.d.ts.map +1 -1
  36. package/dist/types.d.ts +51 -2
  37. package/dist/types.d.ts.map +1 -1
  38. package/dist/views/ActivityListView.d.ts +6 -1
  39. package/dist/views/ActivityListView.d.ts.map +1 -1
  40. package/dist/views/DealSidebar.d.ts.map +1 -1
  41. package/dist/views/LeadDetailView.d.ts.map +1 -1
  42. package/dist/views/PipelineView.d.ts.map +1 -1
  43. package/dist/views/QuoteDetailView.d.ts.map +1 -1
  44. package/dist/views/QuoteListView.d.ts.map +1 -1
  45. package/package.json +15 -14
  46. package/src/CrmPage.tsx +1 -1
  47. package/src/cascade.ts +2 -0
  48. package/src/components/BoardFilters.tsx +190 -0
  49. package/src/components/QuoteStatusDropdown.tsx +15 -3
  50. package/src/components/TagChips.tsx +80 -0
  51. package/src/data/mock.ts +140 -7
  52. package/src/data/supabase.ts +256 -11
  53. package/src/data/types.ts +14 -3
  54. package/src/index.ts +179 -3
  55. package/src/lib/access.ts +11 -0
  56. package/src/locales/en.ts +13 -0
  57. package/src/locales/pt-BR.ts +18 -5
  58. package/src/migrations/003_crm_views_rls.sql +10 -2
  59. package/src/migrations/007_activity_log.sql +55 -0
  60. package/src/migrations/008_view_field_aliases.sql +43 -0
  61. package/src/migrations/009_deal_archived_status.sql +30 -0
  62. package/src/migrations/010_quote_archived_status.sql +40 -0
  63. package/src/migrations/011_agent_rpc_update_lead.sql +153 -0
  64. package/src/migrations/012_agent_rpc_create_lead.sql +128 -0
  65. package/src/migrations/013_tag_slugs.sql +177 -0
  66. package/src/migrations/014_public_lead_tags.sql +172 -0
  67. package/src/migrations/index.ts +833 -3
  68. package/src/public/context.tsx +4 -4
  69. package/src/public/createPublicFormsPlugin.ts +72 -2
  70. package/src/public/data.supabase.ts +3 -2
  71. package/src/public/types.ts +28 -0
  72. package/src/registries.ts +44 -11
  73. package/src/store.ts +135 -38
  74. package/src/types.ts +59 -2
  75. package/src/views/ActivityListView.tsx +79 -11
  76. package/src/views/DealSidebar.tsx +48 -39
  77. package/src/views/LeadDetailView.tsx +29 -10
  78. package/src/views/PipelineView.tsx +112 -11
  79. package/src/views/QuoteDetailView.tsx +7 -3
  80. package/src/views/QuoteListView.tsx +26 -12
  81. package/dist/index.cjs +0 -4759
  82. package/dist/index.cjs.map +0 -1
  83. package/dist/public/index.cjs +0 -306
  84. package/dist/public/index.cjs.map +0 -1
@@ -1,10 +1,11 @@
1
1
  import React, { useEffect } from 'react'
2
- import { FileText, Pencil } from 'lucide-react'
2
+ import { FileText, Pencil, Archive } from 'lucide-react'
3
3
  import type { ColumnDef } from '@tanstack/react-table'
4
4
  import { DataTable } from '@fayz-ai/ui'
5
5
  import { useCrmStore, useCrmConfig, formatCurrency } from '../CrmContext'
6
6
  import { useTranslation } from '@fayz-ai/core'
7
7
  import { SubpageHeader } from '@fayz-ai/ui'
8
+ import { useCanArchive } from '../lib/access'
8
9
  import type { Quote } from '../types'
9
10
 
10
11
  const STATUS_COLORS: Record<string, string> = {
@@ -20,7 +21,7 @@ const STATUS_COLORS: Record<string, string> = {
20
21
  cancelled: 'bg-muted text-muted-foreground',
21
22
  }
22
23
 
23
- function useQuoteColumns(currency: { code: string; locale: string; symbol: string }, onEditQuote?: (id: string) => void): ColumnDef<Quote, any>[] {
24
+ function useQuoteColumns(currency: { code: string; locale: string; symbol: string }, onEditQuote?: (id: string) => void, onArchive?: (id: string) => void): ColumnDef<Quote, any>[] {
24
25
  const t = useTranslation()
25
26
  const cols: ColumnDef<Quote, any>[] = [
26
27
  { accessorKey: 'quoteNumber', header: '#', cell: ({ getValue }) => <span className="text-xs text-muted-foreground">{getValue() as string}</span> },
@@ -39,18 +40,29 @@ function useQuoteColumns(currency: { code: string; locale: string; symbol: strin
39
40
  },
40
41
  ]
41
42
 
42
- if (onEditQuote) {
43
+ if (onEditQuote || onArchive) {
43
44
  cols.push({
44
45
  id: 'actions', header: '',
45
46
  cell: ({ row }) => (
46
- <div className="text-right">
47
- <button
48
- onClick={(e) => { e.stopPropagation(); onEditQuote(row.original.id) }}
49
- className="inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground transition-colors"
50
- title="Edit quote"
51
- >
52
- <Pencil className="h-3.5 w-3.5" />
53
- </button>
47
+ <div className="flex items-center justify-end gap-0.5">
48
+ {onEditQuote && (
49
+ <button
50
+ onClick={(e) => { e.stopPropagation(); onEditQuote(row.original.id) }}
51
+ className="inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground transition-colors"
52
+ title="Edit quote"
53
+ >
54
+ <Pencil className="h-3.5 w-3.5" />
55
+ </button>
56
+ )}
57
+ {onArchive && (
58
+ <button
59
+ onClick={(e) => { e.stopPropagation(); onArchive(row.original.id) }}
60
+ className="inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground transition-colors"
61
+ title={t('crm.quotes.archive')}
62
+ >
63
+ <Archive className="h-3.5 w-3.5" />
64
+ </button>
65
+ )}
54
66
  </div>
55
67
  ),
56
68
  })
@@ -65,10 +77,12 @@ export function QuoteListView({ onNew, onEdit, onEditQuote }: { onNew?: () => vo
65
77
  const quotes = useCrmStore((s) => s.quotes)
66
78
  const quotesLoading = useCrmStore((s) => s.quotesLoading)
67
79
  const fetchQuotes = useCrmStore((s) => s.fetchQuotes)
80
+ const archiveQuote = useCrmStore((s) => s.archiveQuote)
81
+ const canArchive = useCanArchive()
68
82
 
69
83
  useEffect(() => { fetchQuotes({}) }, [])
70
84
 
71
- const columns = useQuoteColumns(currency, onEditQuote)
85
+ const columns = useQuoteColumns(currency, onEditQuote, canArchive ? (id) => { void archiveQuote(id) } : undefined)
72
86
 
73
87
  return (
74
88
  <div className="space-y-4">