diff --git a/app/javascript/dashboard/i18n/locale/en/automation.json b/app/javascript/dashboard/i18n/locale/en/automation.json index 41441b1bd..6fdc55314 100644 --- a/app/javascript/dashboard/i18n/locale/en/automation.json +++ b/app/javascript/dashboard/i18n/locale/en/automation.json @@ -37,7 +37,14 @@ "DAYS": "Days" }, "ERROR": "Wait must be between 10 minutes and 30 days", - "HELP_TEXT": "The rule waits, then runs only if its conditions still hold — and applies to conversations with activity after the rule is created." + "ENDS_IF_LABEL": "Ends the wait if", + "ENDS_IF": { + "STATUS": "the conversation's status changes, or its conditions no longer match.", + "CUSTOMER_REPLY": "the customer replies, or the conditions no longer match.", + "AGENT_REPLY": "an agent replies, or the conditions no longer match.", + "GENERIC": "there is a new reply on the conversation, or the conditions no longer match." + }, + "HELP_TEXT": "Only applies to conversations with activity after the rule is created." }, "CONDITIONS": { "LABEL": "Conditions" diff --git a/app/javascript/dashboard/routes/dashboard/settings/automation/AutomationRuleForm.vue b/app/javascript/dashboard/routes/dashboard/settings/automation/AutomationRuleForm.vue index 22a887a24..d59aaf62e 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/automation/AutomationRuleForm.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/automation/AutomationRuleForm.vue @@ -237,6 +237,24 @@ const delayRestrictionReason = computed(() => { const isDelaySupported = computed(() => delayRestrictionReason.value === null); +// What ends the wait, mirroring the backend episode that arms the rule. Shown to the user so +// they can predict when the rule runs. Conversation rules key on status; message rules key on +// the reply that ends the wait (customer reply for outgoing, agent reply for incoming). +const waitEndsKey = computed(() => { + if (eventName.value !== 'message_created') return 'STATUS'; + const messageType = (automation.value?.conditions || []).find( + condition => condition.attribute_key === 'message_type' + ); + const raw = Array.isArray(messageType?.values) + ? messageType.values[0] + : messageType?.values; + // Raw create-mode values are strings ('outgoing'); edit-mode values are option objects. + const value = raw && typeof raw === 'object' ? raw.id : raw; + if (value === 'outgoing') return 'CUSTOMER_REPLY'; + if (value === 'incoming') return 'AGENT_REPLY'; + return 'GENERIC'; +}); + const delayValue = ref(4); const delayUnit = ref('HOURS'); @@ -488,9 +506,17 @@ defineExpose({ open, close }); > {{ $t('AUTOMATION.ADD.FORM.EXECUTE.ERROR') }} -
- {{ $t('AUTOMATION.ADD.FORM.EXECUTE.HELP_TEXT') }} -
+ ++ + {{ $t('AUTOMATION.ADD.FORM.EXECUTE.ENDS_IF_LABEL') }} + + {{ $t(`AUTOMATION.ADD.FORM.EXECUTE.ENDS_IF.${waitEndsKey}`) }} +
++ {{ $t('AUTOMATION.ADD.FORM.EXECUTE.HELP_TEXT') }} +
+