@fayz-ai/plugin-crm 0.2.3 → 0.3.0

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":"registries.d.ts","sourceRoot":"","sources":["../src/registries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AA2CtD,eAAO,MAAM,aAAa,EAAE,iBAAiB,EA4C5C,CAAA"}
1
+ {"version":3,"file":"registries.d.ts","sourceRoot":"","sources":["../src/registries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAoEtD,eAAO,MAAM,aAAa,EAAE,iBAAiB,EA2D5C,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fayz-ai/plugin-crm",
3
- "version": "0.2.3",
3
+ "version": "0.3.0",
4
4
  "description": "Fayz SDK — plugin-crm plugin",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -32,10 +32,10 @@
32
32
  "lucide-react": "^0.400.0",
33
33
  "zustand": "^4.5.0",
34
34
  "@tanstack/react-table": "^8.20.0",
35
- "@fayz-ai/saas": "^0.6.0",
36
- "@fayz-ai/ui": "^0.6.0",
37
- "@fayz-ai/db": "^0.1.2",
38
- "@fayz-ai/core": "^0.6.0"
35
+ "@fayz-ai/core": "^0.6.6",
36
+ "@fayz-ai/saas": "^0.6.6",
37
+ "@fayz-ai/ui": "^0.6.6",
38
+ "@fayz-ai/db": "^0.1.2"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/react": "^18.3.0",
@@ -51,9 +51,6 @@
51
51
  "fayz-plugin",
52
52
  "fayz-sdk"
53
53
  ],
54
- "publishConfig": {
55
- "access": "public"
56
- },
57
54
  "scripts": {
58
55
  "build": "tsup && tsc --emitDeclarationOnly --declaration --declarationMap --noEmit false",
59
56
  "dev": "tsup --watch",
package/src/CrmPage.tsx CHANGED
@@ -8,7 +8,6 @@ import type { CrmUIState } from './store'
8
8
  import type { PluginRegistryDef, PluginQuickAction } from '@fayz-ai/core'
9
9
  import { useModuleNavigation, ModuleActionBar, createViewRouter } from '@fayz-ai/saas'
10
10
  import { CrmGeneralSettings } from './components/CrmGeneralSettings'
11
- import { PipelineSettings } from './components/PipelineSettings'
12
11
  import { CrmOnboarding } from './components/CrmOnboarding'
13
12
  import { DashboardView } from './views/DashboardView'
14
13
  import { PipelineView } from './views/PipelineView'
@@ -104,7 +103,6 @@ export function CrmPage({ config, provider, store, registries }: {
104
103
  </p>
105
104
  </div>
106
105
  <CrmGeneralSettings />
107
- <PipelineSettings />
108
106
  </div>
109
107
  </PageTransition>
110
108
  </CrmContextProvider>
package/src/index.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import React from 'react'
2
2
  import type { PluginManifest, PluginScope, VerticalId } from '@fayz-ai/core'
3
- import type { EntityLookupMap } from '@fayz-ai/saas'
3
+ import { PluginSettingsPanel, type EntityLookupMap } from '@fayz-ai/saas'
4
4
  import { CrmPage } from './CrmPage'
5
5
  import { createCrmDashboardWidgets } from './views/dashboardWidgets'
6
6
  import { CrmContextProvider, type ResolvedCrmConfig } from './CrmContext'
@@ -12,7 +12,6 @@ import { createCrmStore } from './store'
12
12
  import { crmRegistries } from './registries'
13
13
  import { crmLocales } from './locales'
14
14
  import { CrmGeneralSettings } from './components/CrmGeneralSettings'
15
- import { PipelineSettings } from './components/PipelineSettings'
16
15
 
17
16
  // ---------------------------------------------------------------------------
18
17
  // Public types
@@ -218,12 +217,14 @@ export function createCrmPlugin(options?: CrmPluginOptions): PluginManifest {
218
217
  component: (() => {
219
218
  const Tab: React.FC = () =>
220
219
  React.createElement(CrmContextProvider, { config, provider, store },
221
- React.createElement(
222
- 'div',
223
- { style: { display: 'flex', flexDirection: 'column', gap: '20px' } },
224
- React.createElement(CrmGeneralSettings),
225
- React.createElement(PipelineSettings),
226
- ),
220
+ React.createElement(PluginSettingsPanel, {
221
+ title: 'Sales & CRM',
222
+ subtitle: 'Pipeline, lead management, and CRM properties',
223
+ generalSettings: React.createElement(CrmGeneralSettings),
224
+ registries: crmRegistries,
225
+ hostPluginId: 'crm',
226
+ routeBase: '/settings/crm',
227
+ }),
227
228
  )
228
229
  Tab.displayName = 'CrmSettingsTab'
229
230
  return Tab
package/src/registries.ts CHANGED
@@ -22,12 +22,37 @@ const tagEntity: EntityDef = {
22
22
  defaultSort: 'name',
23
23
  fields: [
24
24
  { key: 'name', label: 'Name', type: 'text', required: true, showInTable: true },
25
- { key: 'color', label: 'Color', type: 'text', showInTable: true, defaultValue: '#6366f1' },
25
+ { key: 'color', label: 'Color', type: 'color', showInTable: true, defaultValue: '#6366f1' },
26
26
  { key: 'isActive', label: 'Active', type: 'boolean', showInTable: true, defaultValue: true },
27
27
  ],
28
28
  data: { table: 'crm_tags', tenantScoped: true },
29
29
  }
30
30
 
31
+ const pipelineStageEntity: EntityDef = {
32
+ name: 'Stage',
33
+ namePlural: 'Stages',
34
+ icon: 'Workflow',
35
+ displayField: 'name',
36
+ defaultSort: 'order',
37
+ fields: [
38
+ { key: 'name', label: 'Name', type: 'text', required: true, showInTable: true, searchable: true },
39
+ {
40
+ key: 'pipelineId',
41
+ label: 'Pipeline',
42
+ type: 'relation',
43
+ relation: { table: 'pipelines', labelField: 'name' },
44
+ required: true,
45
+ showInTable: true,
46
+ },
47
+ { key: 'order', label: 'Order', type: 'number', required: true, showInTable: true, defaultValue: 0 },
48
+ { key: 'color', label: 'Color', type: 'color', showInTable: true, defaultValue: '#6366f1' },
49
+ { key: 'probability', label: 'Probability %', type: 'number', min: 0, max: 100, showInTable: true, defaultValue: 0 },
50
+ { key: 'isWon', label: 'Won Stage', type: 'boolean', showInTable: true, defaultValue: false },
51
+ { key: 'isLost', label: 'Lost Stage', type: 'boolean', showInTable: true, defaultValue: false },
52
+ ],
53
+ data: { table: 'pipeline_stages', tenantScoped: true },
54
+ }
55
+
31
56
  const activityTypeEntity: EntityDef = {
32
57
  name: 'Activity Type',
33
58
  namePlural: 'Activity Types',
@@ -42,6 +67,21 @@ const activityTypeEntity: EntityDef = {
42
67
  }
43
68
 
44
69
  export const crmRegistries: PluginRegistryDef[] = [
70
+ {
71
+ id: 'stages',
72
+ entity: pipelineStageEntity,
73
+ icon: 'Workflow',
74
+ description: 'Pipeline stages used by CRM deals',
75
+ display: 'table',
76
+ seedData: [
77
+ { id: 'stage-new', pipelineId: 'pipe-default', name: 'New Lead', order: 1, color: '#64748b', probability: 10, isWon: false, isLost: false },
78
+ { id: 'stage-qualified', pipelineId: 'pipe-default', name: 'Qualified', order: 2, color: '#3b82f6', probability: 30, isWon: false, isLost: false },
79
+ { id: 'stage-proposal', pipelineId: 'pipe-default', name: 'Proposal', order: 3, color: '#8b5cf6', probability: 60, isWon: false, isLost: false },
80
+ { id: 'stage-negotiation', pipelineId: 'pipe-default', name: 'Negotiation', order: 4, color: '#f59e0b', probability: 80, isWon: false, isLost: false },
81
+ { id: 'stage-won', pipelineId: 'pipe-default', name: 'Won', order: 5, color: '#10b981', probability: 100, isWon: true, isLost: false },
82
+ { id: 'stage-lost', pipelineId: 'pipe-default', name: 'Lost', order: 6, color: '#ef4444', probability: 0, isWon: false, isLost: true },
83
+ ],
84
+ },
45
85
  {
46
86
  id: 'lead-sources',
47
87
  entity: leadSourceEntity,