Betaimport {
Command,
LimeObjectAction,
LimeObjectCommand,
LimeObjectContext,
} from '@limetech/lime-web-components';
@Command({ id: 'send-email' })
class SendEmailCommand implements LimeObjectCommand {
public context: LimeObjectContext;
}
@Command({ id: 'schedule-meeting' })
class ScheduleMeetingCommand implements LimeObjectCommand {
public context: LimeObjectContext;
}
@Command({ id: 'add-to-campaign' })
class AddToCampaignCommand implements LimeObjectCommand {
public context: LimeObjectContext;
}
const contactContext: LimeObjectContext = { limetype: 'contact', id: 42 };
const sendEmailCommand = new SendEmailCommand();
sendEmailCommand.context = contactContext;
const scheduleMeetingCommand = new ScheduleMeetingCommand();
scheduleMeetingCommand.context = contactContext;
const addToCampaignCommand = new AddToCampaignCommand();
addToCampaignCommand.context = contactContext;
const actions: LimeObjectAction[] = [
{
label: 'Send Email',
icon: 'envelope',
command: sendEmailCommand,
},
{
label: 'Schedule Meeting',
icon: 'calendar',
command: scheduleMeetingCommand,
},
{
label: 'Add to Campaign',
icon: 'bullhorn',
command: addToCampaignCommand,
},
];
import {
Command,
LimeObjectAction,
LimeObjectCommand,
LimeObjectCondition,
LimeObjectContext,
} from '@limetech/lime-web-components';
@Command({ id: 'close-deal' })
class CloseDealCommand implements LimeObjectCommand {
public context: LimeObjectContext;
}
const isDealOpen: LimeObjectCondition = {
id: 'deal.is-open',
type: 'limeobject',
evaluate: (deal) => {
const status = deal.getValue('dealstatus');
return status !== 'won' && status !== 'lost';
},
};
const closeDealCommand = new CloseDealCommand();
closeDealCommand.context = { limetype: 'deal', id: 1234 };
const closeDealAction: LimeObjectAction = {
label: 'Close Deal',
icon: 'check-circle',
description: 'Mark this deal as won or lost',
command: closeDealCommand,
condition: isDealOpen,
};
Specialized action type for operations on a single LimeObject.
LimeObject actions are used in contexts where the user interacts with a single business object instance (deal, contact, company, etc.).
The command associated with this action type is LimeObjectCommand, which provides type-safe access to object-specific payload properties.