|
4 | 4 | * Defines the event contracts for cross-package communication. |
5 | 5 | * Other plugins can subscribe to these events to react to CRM domain changes. |
6 | 6 | */ |
| 7 | +import { EventTypeDefinitionSchema } from '@objectstack/spec/kernel'; |
7 | 8 |
|
8 | 9 | export const CRMEvents = { |
9 | | - accountCreated: { |
| 10 | + accountCreated: EventTypeDefinitionSchema.parse({ |
10 | 11 | name: 'crm.account.created', |
11 | | - type: 'domain' as const, |
12 | 12 | description: 'Fired when a new account is created', |
13 | | - }, |
14 | | - accountUpdated: { |
| 13 | + }), |
| 14 | + accountUpdated: EventTypeDefinitionSchema.parse({ |
15 | 15 | name: 'crm.account.updated', |
16 | | - type: 'domain' as const, |
17 | 16 | description: 'Fired when an account record is updated', |
18 | | - }, |
19 | | - contactCreated: { |
| 17 | + }), |
| 18 | + contactCreated: EventTypeDefinitionSchema.parse({ |
20 | 19 | name: 'crm.contact.created', |
21 | | - type: 'domain' as const, |
22 | 20 | description: 'Fired when a new contact is created', |
23 | | - }, |
24 | | - leadConverted: { |
| 21 | + }), |
| 22 | + leadConverted: EventTypeDefinitionSchema.parse({ |
25 | 23 | name: 'crm.lead.converted', |
26 | | - type: 'domain' as const, |
27 | 24 | description: 'Fired when a lead is converted to account/contact/opportunity', |
28 | | - }, |
29 | | - leadScored: { |
| 25 | + }), |
| 26 | + leadScored: EventTypeDefinitionSchema.parse({ |
30 | 27 | name: 'crm.lead.scored', |
31 | | - type: 'domain' as const, |
32 | 28 | description: 'Fired when a lead score is recalculated', |
33 | | - }, |
34 | | - opportunityStageChanged: { |
| 29 | + }), |
| 30 | + opportunityStageChanged: EventTypeDefinitionSchema.parse({ |
35 | 31 | name: 'crm.opportunity.stage_changed', |
36 | | - type: 'domain' as const, |
37 | 32 | description: 'Fired when an opportunity moves to a new stage', |
38 | | - }, |
39 | | - opportunityWon: { |
| 33 | + }), |
| 34 | + opportunityWon: EventTypeDefinitionSchema.parse({ |
40 | 35 | name: 'crm.opportunity.won', |
41 | | - type: 'domain' as const, |
42 | 36 | description: 'Fired when an opportunity is closed-won', |
43 | | - }, |
44 | | - opportunityLost: { |
| 37 | + }), |
| 38 | + opportunityLost: EventTypeDefinitionSchema.parse({ |
45 | 39 | name: 'crm.opportunity.lost', |
46 | | - type: 'domain' as const, |
47 | 40 | description: 'Fired when an opportunity is closed-lost', |
48 | | - }, |
49 | | - activityCompleted: { |
| 41 | + }), |
| 42 | + activityCompleted: EventTypeDefinitionSchema.parse({ |
50 | 43 | name: 'crm.activity.completed', |
51 | | - type: 'domain' as const, |
52 | 44 | description: 'Fired when an activity or task is marked as completed', |
53 | | - }, |
| 45 | + }), |
54 | 46 | }; |
0 commit comments