@fayz-ai/plugin-crm 0.1.1 → 0.1.3

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Faya Labs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,53 @@
1
+ # @fayz-ai/plugin-crm
2
+
3
+ > Leads, deals, quotes, and pipeline — the sales spine for any Fayz SaaS.
4
+
5
+ [![npm](https://img.shields.io/npm/v/@fayz-ai/plugin-crm.svg)](https://www.npmjs.com/package/@fayz-ai/plugin-crm)
6
+ [![license](https://img.shields.io/npm/l/@fayz-ai/plugin-crm.svg)](https://github.com/FayaLabs/fayz-sdk/blob/main/LICENSE)
7
+
8
+ Every business that sells anything needs a way to track who's interested, what's in motion, and what's about to close. Most verticals end up rebuilding the same CRM badly. `plugin-crm` is the one sales engine — leads, a drag-style pipeline, deals, quotes, and activities — that snaps into a `defineSaas` app and adapts to the vertical underneath it.
9
+
10
+ A salon tracks "customers", a clinic tracks "patients", an agency tracks "clients" — same engine, different labels and stages. The plugin ships a full UI today, a vertical-aware label/stage/source config, AI tools your assistant can call, and a data-provider seam that runs on a mock or a Supabase backend. When a lead is approved it can convert a person into a real client record in your domain schema. This is what "compose a real SaaS from plugins" means in practice.
11
+
12
+ ## What's inside
13
+ - A `/sales` workspace: dashboard, pipeline, leads (list + detail + form), deals, quotes (list + detail + form), and activities — toggle modules on or off
14
+ - Configurable lead sources, deal stages (name/color/probability), activity types, and item types
15
+ - Currency-aware quotes (defaults to BRL/pt-BR) with cross-plugin entity lookups for products/services and contacts
16
+ - Lead → client conversion that updates `persons.kind` and writes your extension table (e.g. `clients`)
17
+ - Dashboard widgets contributed to the app's overview
18
+ - AI tools: `countCustomers`, `listLeads` — with vertical-flavored suggested prompts
19
+ - A central Settings tab (general + pipeline) and full i18n
20
+ - Pluggable data: mock provider out of the box, Supabase provider when a client is registered
21
+
22
+ ## Install
23
+ ```bash
24
+ npm install @fayz-ai/plugin-crm
25
+ ```
26
+ Peer deps: `@fayz-ai/core`, `@fayz-ai/ui`, `@fayz-ai/saas`, plus `react` / `react-dom`.
27
+
28
+ ## Usage
29
+ ```tsx
30
+ import { defineSaas } from '@fayz-ai/saas'
31
+ import { createCrmPlugin } from '@fayz-ai/plugin-crm'
32
+
33
+ export const app = defineSaas({
34
+ // ...
35
+ plugins: [
36
+ createCrmPlugin({
37
+ labels: { pageTitle: 'Sales', leads: 'Leads' },
38
+ currency: { code: 'BRL', locale: 'pt-BR', symbol: 'R$' },
39
+ dealStages: [
40
+ { name: 'New', color: '#64748b', probability: 10 },
41
+ { name: 'Won', color: '#16a34a', probability: 100 },
42
+ ],
43
+ clientConversion: { archetypeKind: 'customer', extensionTable: 'clients', fkColumn: 'person_id' },
44
+ }),
45
+ ],
46
+ })
47
+ ```
48
+
49
+ ## Part of the Fayz SDK
50
+ The sales core of the engine. Pairs naturally with `plugin-marketing` (where the leads come from), `plugin-conversations` (where you talk to them), and `plugin-reputation` (what they say afterward).
51
+
52
+ ## Roadmap & contributing
53
+ Built and evolving in the open. See the [Fayz SDK roadmap](../../docs/ROADMAP.md#plugin-crm) for current gaps, missing features, and good first issues.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOmC,CAAA;AAEzD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAczB,CAAA;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMoC,CAAA;AAE5D,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOoC,CAAA;AAExD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOoC,CAAA;AAExD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAezB,CAAA;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMqC,CAAA;AAElE,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoBxB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fayz-ai/plugin-crm",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Fayz SDK — plugin-crm plugin",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -26,16 +26,18 @@
26
26
  "lucide-react": "^0.400.0",
27
27
  "zustand": "^4.5.0",
28
28
  "@tanstack/react-table": "^8.20.0",
29
- "@fayz-ai/ui": "^0.1.6",
30
- "@fayz-ai/saas": "^0.1.6",
31
- "@fayz-ai/core": "^0.1.6"
29
+ "@fayz-ai/core": "^0.2.0",
30
+ "@fayz-ai/ui": "^0.2.0",
31
+ "@fayz-ai/saas": "^0.2.0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/react": "^18.3.0",
35
35
  "react": "^18.3.0",
36
36
  "tsup": "^8.2.0",
37
37
  "typescript": "^5.5.0",
38
- "@types/react-dom": "^18.3.0"
38
+ "@types/react-dom": "^18.3.0",
39
+ "drizzle-orm": "^0.36.4",
40
+ "@fayz-ai/db": "^0.1.2"
39
41
  },
40
42
  "license": "MIT",
41
43
  "keywords": [
@@ -1,7 +1,9 @@
1
+ // Builders come from @fayz-ai/db (single drizzle-orm instance) — never import
2
+ // pgTable/uuid directly from drizzle-orm/pg-core. See MIGRATION-ARCHITECTURE §6.
1
3
  import {
2
4
  pgTable, uuid, text, boolean, integer, numeric, date, timestamp, index,
3
- } from 'drizzle-orm/pg-core'
4
- import { tenantId, timestamps, createdAt, persons, orders } from '@fayz-ai/db'
5
+ tenantId, timestamps, createdAt, persons, orders,
6
+ } from '@fayz-ai/db'
5
7
 
6
8
  // ---------------------------------------------------------------------------
7
9
  // CRM plugin — Ring-1 schema (schema-as-code).