Let automations fire on more CRM events and open the studio from the main nav.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -61,14 +61,15 @@ function makeStep(action: AutomationAction): AutomationStep {
|
||||
}
|
||||
|
||||
function makeCondition(): AutomationStep {
|
||||
const field =
|
||||
trigger.value === 'deal_won' ? 'deal_amount' : 'ticket_priority';
|
||||
const field = conditionFieldsForTrigger(trigger.value)[0] ?? 'has_person';
|
||||
return {
|
||||
id: `s-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`,
|
||||
kind: 'condition',
|
||||
conditionField: field,
|
||||
conditionOp: field === 'deal_amount' ? 'gte' : 'eq',
|
||||
conditionValue: field === 'deal_amount' ? 0 : 'normal',
|
||||
conditionOp:
|
||||
field === 'deal_amount' ? 'gte' : field === 'ticket_priority' ? 'eq' : 'is_set',
|
||||
conditionValue:
|
||||
field === 'deal_amount' ? 0 : field === 'ticket_priority' ? 'normal' : undefined,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -256,12 +257,23 @@ onMounted(async () => {
|
||||
|
||||
watch(trigger, (next) => {
|
||||
const allowed = conditionFieldsForTrigger(next);
|
||||
const fallback = allowed[0] ?? 'has_person';
|
||||
for (const step of steps.value) {
|
||||
if (!isAutomationCondition(step)) continue;
|
||||
if (step.conditionField && allowed.includes(step.conditionField)) continue;
|
||||
step.conditionField = next === 'deal_won' ? 'deal_amount' : 'ticket_priority';
|
||||
step.conditionOp = next === 'deal_won' ? 'gte' : 'eq';
|
||||
step.conditionValue = next === 'deal_won' ? 0 : 'normal';
|
||||
step.conditionField = fallback;
|
||||
step.conditionOp =
|
||||
fallback === 'deal_amount'
|
||||
? 'gte'
|
||||
: fallback === 'ticket_priority'
|
||||
? 'eq'
|
||||
: 'is_set';
|
||||
step.conditionValue =
|
||||
fallback === 'deal_amount'
|
||||
? 0
|
||||
: fallback === 'ticket_priority'
|
||||
? 'normal'
|
||||
: undefined;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -398,6 +410,7 @@ h1 {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 0.9rem;
|
||||
align-items: start;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.rules,
|
||||
@@ -524,11 +537,16 @@ h2 {
|
||||
|
||||
.stage {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
gap: 0.75rem;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.stage :deep(.canvas) {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
@@ -573,11 +591,38 @@ h2 {
|
||||
|
||||
@media (min-width: 1280px) {
|
||||
.workspace {
|
||||
grid-template-columns: minmax(15rem, 17.5rem) minmax(0, 1fr);
|
||||
grid-template-columns: minmax(15rem, 20rem) minmax(0, 1fr);
|
||||
grid-template-areas:
|
||||
'rules toolbar'
|
||||
'stage stage';
|
||||
}
|
||||
|
||||
.rules {
|
||||
grid-area: rules;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.studio {
|
||||
display: contents;
|
||||
border: 0;
|
||||
padding: 0;
|
||||
box-shadow: none;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.toolbar {
|
||||
grid-area: toolbar;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 18px;
|
||||
background: #fff;
|
||||
box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
|
||||
padding: 0.85rem 1rem;
|
||||
align-items: end;
|
||||
}
|
||||
|
||||
.stage {
|
||||
grid-template-columns: minmax(0, 1fr) minmax(16rem, 19rem);
|
||||
grid-area: stage;
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user