Skip to content

Commit dad91e4

Browse files
authored
Merge pull request #789 from objectstack-ai/copilot/fix-build-errors-in-crm
2 parents f0b5a1f + 195afbc commit dad91e4

15 files changed

+43
-44
lines changed

examples/crm/src/__tests__/crm-metadata.test.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@ describe('CRM Metadata Spec Compliance', () => {
100100
}
101101
});
102102

103-
it('form section columns are numbers, not strings', () => {
103+
it('form section columns are valid string enum values', () => {
104104
for (const view of allViews) {
105105
for (const section of view.form.sections) {
106106
if (section.columns !== undefined) {
107-
expect(typeof section.columns).toBe('number');
107+
expect(['1', '2', '3', '4']).toContain(section.columns);
108108
}
109109
}
110110
}
@@ -133,18 +133,17 @@ describe('CRM Metadata Spec Compliance', () => {
133133
}
134134
});
135135

136-
it('no action uses variant: "danger" (must use "destructive")', () => {
136+
it('action variants use @objectstack/spec allowed values', () => {
137137
for (const action of allActions) {
138138
if ('variant' in action) {
139-
expect(action.variant).not.toBe('danger');
140-
expect(['default', 'primary', 'secondary', 'destructive', 'outline', 'ghost']).toContain(action.variant);
139+
expect(['primary', 'secondary', 'danger', 'ghost', 'link']).toContain(action.variant);
141140
}
142141
}
143142
});
144143

145-
it('destructive actions have confirmText', () => {
144+
it('danger actions have confirmText', () => {
146145
for (const action of allActions) {
147-
if ('variant' in action && action.variant === 'destructive') {
146+
if ('variant' in action && action.variant === 'danger') {
148147
expect(action).toHaveProperty('confirmText');
149148
}
150149
}

examples/crm/src/actions/account.actions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export const AccountActions = [
3131
type: 'api' as const,
3232
locations: ['record_more' as const],
3333
confirmText: 'Are you sure you want to merge these accounts? This action cannot be undone.',
34-
variant: 'destructive' as const,
34+
variant: 'danger' as const,
3535
refreshAfter: true,
3636
},
3737
];

examples/crm/src/actions/event.actions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const EventActions = [
2626
icon: 'x-circle',
2727
type: 'api' as const,
2828
locations: ['record_more' as const],
29-
variant: 'destructive' as const,
29+
variant: 'danger' as const,
3030
params: [
3131
{ name: 'cancel_reason', label: 'Cancellation Reason', type: 'text' as const },
3232
{ name: 'notify_participants', label: 'Notify Participants', type: 'boolean' as const },

examples/crm/src/actions/opportunity.actions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const OpportunityActions = [
3838
icon: 'x-circle',
3939
type: 'api' as const,
4040
locations: ['record_more' as const],
41-
variant: 'destructive' as const,
41+
variant: 'danger' as const,
4242
params: [
4343
{ name: 'loss_reason', label: 'Reason for Loss', type: 'text' as const, required: true },
4444
],

examples/crm/src/actions/user.actions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const UserActions = [
1414
icon: 'user-x',
1515
type: 'api' as const,
1616
locations: ['record_more' as const],
17-
variant: 'destructive' as const,
17+
variant: 'danger' as const,
1818
confirmText: 'Are you sure you want to deactivate this user?',
1919
refreshAfter: true,
2020
successMessage: 'User deactivated',

examples/crm/src/views/account.view.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,22 @@ export const AccountView = {
2323
sections: [
2424
{
2525
label: 'Basic Information',
26-
columns: 2,
26+
columns: '2' as const,
2727
fields: ['name', 'industry', 'type', 'rating', 'website', 'phone', 'employees', 'owner'],
2828
},
2929
{
3030
label: 'Financial',
31-
columns: 2,
31+
columns: '2' as const,
3232
fields: ['annual_revenue', 'tags'],
3333
},
3434
{
3535
label: 'Address',
36-
columns: 2,
36+
columns: '2' as const,
3737
fields: ['billing_address', 'shipping_address', 'latitude', 'longitude'],
3838
},
3939
{
4040
label: 'Additional Details',
41-
columns: 1,
41+
columns: '1' as const,
4242
collapsible: true,
4343
fields: ['linkedin_url', 'founded_date', 'description', 'created_at'],
4444
},

examples/crm/src/views/contact.view.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,22 @@ export const ContactView = {
2222
sections: [
2323
{
2424
label: 'Personal Information',
25-
columns: 2,
25+
columns: '2' as const,
2626
fields: ['avatar', 'name', 'email', 'phone', 'title', 'department', 'company'],
2727
},
2828
{
2929
label: 'Account & Status',
30-
columns: 2,
30+
columns: '2' as const,
3131
fields: ['account', 'status', 'priority', 'lead_source', 'is_active', 'do_not_call'],
3232
},
3333
{
3434
label: 'Address & Social',
35-
columns: 2,
35+
columns: '2' as const,
3636
fields: ['address', 'linkedin', 'birthdate', 'latitude', 'longitude'],
3737
},
3838
{
3939
label: 'Notes',
40-
columns: 1,
40+
columns: '1' as const,
4141
collapsible: true,
4242
fields: ['notes'],
4343
},

examples/crm/src/views/event.view.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,22 @@ export const EventView = {
3535
sections: [
3636
{
3737
label: 'Event Details',
38-
columns: 2,
38+
columns: '2' as const,
3939
fields: ['subject', 'type', 'status', 'location', 'is_all_day', 'is_private'],
4040
},
4141
{
4242
label: 'Schedule',
43-
columns: 2,
43+
columns: '2' as const,
4444
fields: ['start', 'end', 'reminder'],
4545
},
4646
{
4747
label: 'Participants',
48-
columns: 2,
48+
columns: '2' as const,
4949
fields: ['organizer', 'participants'],
5050
},
5151
{
5252
label: 'Description',
53-
columns: 1,
53+
columns: '1' as const,
5454
collapsible: true,
5555
fields: ['description'],
5656
},

examples/crm/src/views/opportunity.view.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,22 @@ export const OpportunityView = {
3333
sections: [
3434
{
3535
label: 'Deal Information',
36-
columns: 2,
36+
columns: '2' as const,
3737
fields: ['name', 'account', 'contacts', 'type', 'lead_source', 'campaign_source'],
3838
},
3939
{
4040
label: 'Financials & Stage',
41-
columns: 2,
41+
columns: '2' as const,
4242
fields: ['amount', 'expected_revenue', 'probability', 'stage', 'forecast_category'],
4343
},
4444
{
4545
label: 'Timeline',
46-
columns: 2,
46+
columns: '2' as const,
4747
fields: ['close_date', 'next_step'],
4848
},
4949
{
5050
label: 'Description',
51-
columns: 1,
51+
columns: '1' as const,
5252
collapsible: true,
5353
fields: ['description'],
5454
},

examples/crm/src/views/opportunity_contact.view.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const OpportunityContactView = {
1414
sections: [
1515
{
1616
label: 'Relationship',
17-
columns: 2,
17+
columns: '2' as const,
1818
fields: ['name', 'opportunity', 'contact', 'role', 'is_primary'],
1919
},
2020
],

0 commit comments

Comments
 (0)