@contractspec/example.crm-pipeline 3.7.7 → 3.7.12
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/.turbo/turbo-build.log +45 -42
- package/CHANGELOG.md +72 -0
- package/README.md +2 -1
- package/dist/browser/docs/crm-pipeline.docblock.js +1 -1
- package/dist/browser/docs/index.js +1 -1
- package/dist/browser/handlers/crm.handlers.js +13 -2
- package/dist/browser/handlers/index.js +13 -2
- package/dist/browser/index.js +392 -159
- package/dist/browser/ui/CrmDashboard.js +366 -144
- package/dist/browser/ui/hooks/index.js +19 -8
- package/dist/browser/ui/hooks/useDealList.js +19 -8
- package/dist/browser/ui/index.js +391 -158
- package/dist/browser/ui/renderers/index.js +32 -10
- package/dist/browser/ui/renderers/pipeline.markdown.js +13 -2
- package/dist/browser/ui/renderers/pipeline.renderer.js +19 -8
- package/dist/browser/ui/tables/DealListTab.js +390 -0
- package/dist/docs/crm-pipeline.docblock.js +1 -1
- package/dist/docs/index.js +1 -1
- package/dist/handlers/crm.handlers.d.ts +2 -0
- package/dist/handlers/crm.handlers.js +13 -2
- package/dist/handlers/index.js +13 -2
- package/dist/index.js +392 -159
- package/dist/node/docs/crm-pipeline.docblock.js +1 -1
- package/dist/node/docs/index.js +1 -1
- package/dist/node/handlers/crm.handlers.js +13 -2
- package/dist/node/handlers/index.js +13 -2
- package/dist/node/index.js +392 -159
- package/dist/node/ui/CrmDashboard.js +366 -144
- package/dist/node/ui/hooks/index.js +19 -8
- package/dist/node/ui/hooks/useDealList.js +19 -8
- package/dist/node/ui/index.js +391 -158
- package/dist/node/ui/renderers/index.js +32 -10
- package/dist/node/ui/renderers/pipeline.markdown.js +13 -2
- package/dist/node/ui/renderers/pipeline.renderer.js +19 -8
- package/dist/node/ui/tables/DealListTab.js +390 -0
- package/dist/ui/CrmDashboard.js +366 -144
- package/dist/ui/hooks/index.js +19 -8
- package/dist/ui/hooks/useDealList.d.ts +8 -2
- package/dist/ui/hooks/useDealList.js +19 -8
- package/dist/ui/index.js +391 -158
- package/dist/ui/renderers/index.js +32 -10
- package/dist/ui/renderers/pipeline.markdown.d.ts +1 -1
- package/dist/ui/renderers/pipeline.markdown.js +13 -2
- package/dist/ui/renderers/pipeline.renderer.d.ts +1 -1
- package/dist/ui/renderers/pipeline.renderer.js +19 -8
- package/dist/ui/tables/DealListTab.d.ts +20 -0
- package/dist/ui/tables/DealListTab.js +391 -0
- package/dist/ui/tables/DealListTab.smoke.test.d.ts +1 -0
- package/package.json +29 -13
- package/src/docs/crm-pipeline.docblock.ts +1 -1
- package/src/handlers/crm.handlers.ts +18 -1
- package/src/ui/CrmDashboard.tsx +2 -71
- package/src/ui/hooks/useDealList.ts +36 -8
- package/src/ui/renderers/pipeline.markdown.ts +1 -1
- package/src/ui/renderers/pipeline.renderer.tsx +1 -1
- package/src/ui/tables/DealListTab.smoke.test.tsx +149 -0
- package/src/ui/tables/DealListTab.tsx +276 -0
|
@@ -81,7 +81,7 @@ var crmPipelineDocBlocks = [
|
|
|
81
81
|
- deal.created, stage.moved, task.completed, contact.updated.
|
|
82
82
|
|
|
83
83
|
## Presentations
|
|
84
|
-
- Pipelines/kanban, deal detail, contact/company profiles, task lists.
|
|
84
|
+
- Pipelines/kanban, deal detail, contact/company profiles, task lists, and a server-mode shared table for the deal list.
|
|
85
85
|
|
|
86
86
|
## Notes
|
|
87
87
|
- Stage definitions should be declarative; enforce via spec and regeneration.
|
package/dist/node/docs/index.js
CHANGED
|
@@ -81,7 +81,7 @@ var crmPipelineDocBlocks = [
|
|
|
81
81
|
- deal.created, stage.moved, task.completed, contact.updated.
|
|
82
82
|
|
|
83
83
|
## Presentations
|
|
84
|
-
- Pipelines/kanban, deal detail, contact/company profiles, task lists.
|
|
84
|
+
- Pipelines/kanban, deal detail, contact/company profiles, task lists, and a server-mode shared table for the deal list.
|
|
85
85
|
|
|
86
86
|
## Notes
|
|
87
87
|
- Stage definitions should be declarative; enforce via spec and regeneration.
|
|
@@ -22,6 +22,13 @@ function rowToDeal(row) {
|
|
|
22
22
|
updatedAt: new Date(row.updatedAt)
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
+
var DEAL_SORT_COLUMNS = {
|
|
26
|
+
name: "name",
|
|
27
|
+
value: "value",
|
|
28
|
+
status: "status",
|
|
29
|
+
expectedCloseDate: "expectedCloseDate",
|
|
30
|
+
updatedAt: "updatedAt"
|
|
31
|
+
};
|
|
25
32
|
function createCrmHandlers(db) {
|
|
26
33
|
async function listDeals(input) {
|
|
27
34
|
const {
|
|
@@ -32,7 +39,9 @@ function createCrmHandlers(db) {
|
|
|
32
39
|
ownerId,
|
|
33
40
|
search,
|
|
34
41
|
limit = 20,
|
|
35
|
-
offset = 0
|
|
42
|
+
offset = 0,
|
|
43
|
+
sortBy = "value",
|
|
44
|
+
sortDirection = "desc"
|
|
36
45
|
} = input;
|
|
37
46
|
let whereClause = "WHERE projectId = ?";
|
|
38
47
|
const params = [projectId];
|
|
@@ -60,7 +69,9 @@ function createCrmHandlers(db) {
|
|
|
60
69
|
const total = countResult[0]?.count ?? 0;
|
|
61
70
|
const valueResult = (await db.query(`SELECT COALESCE(SUM(value), 0) as total FROM crm_deal ${whereClause}`, params)).rows;
|
|
62
71
|
const totalValue = valueResult[0]?.total ?? 0;
|
|
63
|
-
const
|
|
72
|
+
const orderByColumn = DEAL_SORT_COLUMNS[sortBy] ?? DEAL_SORT_COLUMNS.value;
|
|
73
|
+
const orderByDirection = sortDirection === "asc" ? "ASC" : "DESC";
|
|
74
|
+
const dealRows = (await db.query(`SELECT * FROM crm_deal ${whereClause} ORDER BY ${orderByColumn} ${orderByDirection} LIMIT ? OFFSET ?`, [...params, limit, offset])).rows;
|
|
64
75
|
return {
|
|
65
76
|
deals: dealRows.map(rowToDeal),
|
|
66
77
|
total,
|
|
@@ -22,6 +22,13 @@ function rowToDeal(row) {
|
|
|
22
22
|
updatedAt: new Date(row.updatedAt)
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
+
var DEAL_SORT_COLUMNS = {
|
|
26
|
+
name: "name",
|
|
27
|
+
value: "value",
|
|
28
|
+
status: "status",
|
|
29
|
+
expectedCloseDate: "expectedCloseDate",
|
|
30
|
+
updatedAt: "updatedAt"
|
|
31
|
+
};
|
|
25
32
|
function createCrmHandlers(db) {
|
|
26
33
|
async function listDeals(input) {
|
|
27
34
|
const {
|
|
@@ -32,7 +39,9 @@ function createCrmHandlers(db) {
|
|
|
32
39
|
ownerId,
|
|
33
40
|
search,
|
|
34
41
|
limit = 20,
|
|
35
|
-
offset = 0
|
|
42
|
+
offset = 0,
|
|
43
|
+
sortBy = "value",
|
|
44
|
+
sortDirection = "desc"
|
|
36
45
|
} = input;
|
|
37
46
|
let whereClause = "WHERE projectId = ?";
|
|
38
47
|
const params = [projectId];
|
|
@@ -60,7 +69,9 @@ function createCrmHandlers(db) {
|
|
|
60
69
|
const total = countResult[0]?.count ?? 0;
|
|
61
70
|
const valueResult = (await db.query(`SELECT COALESCE(SUM(value), 0) as total FROM crm_deal ${whereClause}`, params)).rows;
|
|
62
71
|
const totalValue = valueResult[0]?.total ?? 0;
|
|
63
|
-
const
|
|
72
|
+
const orderByColumn = DEAL_SORT_COLUMNS[sortBy] ?? DEAL_SORT_COLUMNS.value;
|
|
73
|
+
const orderByDirection = sortDirection === "asc" ? "ASC" : "DESC";
|
|
74
|
+
const dealRows = (await db.query(`SELECT * FROM crm_deal ${whereClause} ORDER BY ${orderByColumn} ${orderByDirection} LIMIT ? OFFSET ?`, [...params, limit, offset])).rows;
|
|
64
75
|
return {
|
|
65
76
|
deals: dealRows.map(rowToDeal),
|
|
66
77
|
total,
|