From 5e644315e4baa580c985c28000571edb17b9798b Mon Sep 17 00:00:00 2001 From: JzoNg Date: Mon, 19 Jan 2026 16:40:54 +0800 Subject: [PATCH] add tip modal for email type --- .../rag-pipeline/hooks/use-configs-map.ts | 2 +- .../delivery-method/email-configure-modal.tsx | 2 +- .../components/delivery-method/index.tsx | 20 ++++- .../delivery-method/method-item.tsx | 2 +- .../delivery-method/method-selector.tsx | 17 +++-- .../delivery-method/upgrade-modal.tsx | 76 +++++++++++++++++++ web/eslint-suppressions.json | 5 -- web/i18n/en-US/workflow.json | 3 + web/i18n/zh-Hans/workflow.json | 3 + 9 files changed, 113 insertions(+), 17 deletions(-) create mode 100644 web/app/components/workflow/nodes/human-input/components/delivery-method/upgrade-modal.tsx diff --git a/web/app/components/rag-pipeline/hooks/use-configs-map.ts b/web/app/components/rag-pipeline/hooks/use-configs-map.ts index aa76dbf6ca..99c4292349 100644 --- a/web/app/components/rag-pipeline/hooks/use-configs-map.ts +++ b/web/app/components/rag-pipeline/hooks/use-configs-map.ts @@ -20,5 +20,5 @@ export const useConfigsMap = () => { fileUploadConfig, }, } - }, [pipelineId]) + }, [fileUploadConfig, pipelineId]) } diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/email-configure-modal.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/email-configure-modal.tsx index 95e25855ac..d85de6233f 100644 --- a/web/app/components/workflow/nodes/human-input/components/delivery-method/email-configure-modal.tsx +++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/email-configure-modal.tsx @@ -18,7 +18,7 @@ const i18nPrefix = 'nodes.humanInput' type EmailConfigureModalProps = { isShow: boolean onClose: () => void - onConfirm: (data: any) => void + onConfirm: (data: EmailConfig) => void config?: EmailConfig } diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/index.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/index.tsx index 3ce723bb07..17e7fe20dd 100644 --- a/web/app/components/workflow/nodes/human-input/components/delivery-method/index.tsx +++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/index.tsx @@ -9,6 +9,7 @@ import { useTranslation } from 'react-i18next' import Tooltip from '@/app/components/base/tooltip' import MethodItem from './method-item' import MethodSelector from './method-selector' +import UpgradeModal from './upgrade-modal' const i18nPrefix = 'nodes.humanInput' @@ -52,6 +53,14 @@ const DeliveryMethodForm: React.FC = ({ onChange(newMethods) } + const [showUpgradeModal, setShowUpgradeModal] = React.useState(false) + const handleShowUpgradeModal = () => { + setShowUpgradeModal(true) + } + const handleCloseUpgradeModal = () => { + setShowUpgradeModal(false) + } + return (
@@ -66,6 +75,7 @@ const DeliveryMethodForm: React.FC = ({
)} @@ -75,11 +85,11 @@ const DeliveryMethodForm: React.FC = ({ )} {value.length > 0 && (
- {value.map((method, index) => ( + {value.map(method => ( = ({ ))}
)} + {showUpgradeModal && ( + + )}
) } diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/method-item.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/method-item.tsx index 1416fe4619..31199df67c 100644 --- a/web/app/components/workflow/nodes/human-input/components/delivery-method/method-item.tsx +++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/method-item.tsx @@ -61,7 +61,7 @@ const DeliveryMethodItem: FC = ({ }) } - const handleConfigChange = (config: any) => { + const handleConfigChange = (config: EmailConfig) => { onChange({ ...method, config, diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/method-selector.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/method-selector.tsx index 2511ebdb49..2827b972c9 100644 --- a/web/app/components/workflow/nodes/human-input/components/delivery-method/method-selector.tsx +++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/method-selector.tsx @@ -29,11 +29,13 @@ const i18nPrefix = 'nodes.humanInput' type MethodSelectorProps = { data: DeliveryMethod[] onAdd: (method: DeliveryMethod) => void + onShowUpgradeTip: () => void } const MethodSelector: FC = ({ data, onAdd, + onShowUpgradeTip, }) => { const { t } = useTranslation() const [open, doSetOpen] = useState(false) @@ -102,10 +104,14 @@ const MethodSelector: FC = ({
{ - if (emailDeliveryInfo.noPermission || emailDeliveryInfo.added) + if (emailDeliveryInfo.noPermission) { + onShowUpgradeTip() + return + } + if (emailDeliveryInfo.added) return onAdd({ id: uuid4(), @@ -117,21 +123,18 @@ const MethodSelector: FC = ({
-
+
{t(`${i18nPrefix}.deliveryMethod.types.email.title`, { ns: 'workflow' })}
{t(`${i18nPrefix}.deliveryMethod.types.email.description`, { ns: 'workflow' })}
{emailDeliveryInfo.added && (
{t(`${i18nPrefix}.deliveryMethod.added`, { ns: 'workflow' })}
)} - {emailDeliveryInfo.noPermission && ( -
Upgrade
- )}
{/* Slack */}
void +} + +const UpgradeModal: React.FC = ({ + isShow, + onClose, +}) => { + const { t } = useTranslation() + const setShowPricingModal = useModalContextSelector(s => s.setShowPricingModal) + + return ( + +
+
+ +
+

+ {t('nodes.humanInput.deliveryMethod.upgradeTip', { ns: 'workflow' })} +

+

+ {t('nodes.humanInput.deliveryMethod.upgradeTipContent', { ns: 'workflow' })} +

+
+
+ + { + setShowPricingModal() + }} + > + +
+ + {t('upgradeBtn.encourageShort', { ns: 'billing' })} + +
+
+
+
+ ) +} + +export default UpgradeModal diff --git a/web/eslint-suppressions.json b/web/eslint-suppressions.json index 3f32aba169..315ac472d0 100644 --- a/web/eslint-suppressions.json +++ b/web/eslint-suppressions.json @@ -2566,11 +2566,6 @@ "count": 1 } }, - "app/components/rag-pipeline/hooks/use-configs-map.ts": { - "react-hooks/preserve-manual-memoization": { - "count": 1 - } - }, "app/components/rag-pipeline/hooks/use-input-fields.ts": { "ts/no-explicit-any": { "count": 2 diff --git a/web/i18n/en-US/workflow.json b/web/i18n/en-US/workflow.json index 421267a484..20fc638c11 100644 --- a/web/i18n/en-US/workflow.json +++ b/web/i18n/en-US/workflow.json @@ -557,6 +557,9 @@ "nodes.humanInput.deliveryMethod.types.teams.title": "Teams", "nodes.humanInput.deliveryMethod.types.webapp.description": "Display to end-user in webapp", "nodes.humanInput.deliveryMethod.types.webapp.title": "Webapp", + "nodes.humanInput.deliveryMethod.upgradeTip": "Unlock Email delivery for Human Input", + "nodes.humanInput.deliveryMethod.upgradeTipContent": "Send confirmation requests via email before agents take action — useful for publishing and approval workflows.", + "nodes.humanInput.deliveryMethod.upgradeTipHide": "Dismiss", "nodes.humanInput.editor.previewTip": "In preview mode, action buttons are not functional.", "nodes.humanInput.errorMsg.duplicateActionId": "Duplicate action ID found in user actions", "nodes.humanInput.errorMsg.emptyActionId": "Action ID cannot be empty", diff --git a/web/i18n/zh-Hans/workflow.json b/web/i18n/zh-Hans/workflow.json index c6069701e1..aa556f3e7a 100644 --- a/web/i18n/zh-Hans/workflow.json +++ b/web/i18n/zh-Hans/workflow.json @@ -557,6 +557,9 @@ "nodes.humanInput.deliveryMethod.types.teams.title": "Teams", "nodes.humanInput.deliveryMethod.types.webapp.description": "在 Web 应用中显示给最终用户", "nodes.humanInput.deliveryMethod.types.webapp.title": "Webapp", + "nodes.humanInput.deliveryMethod.upgradeTip": "解锁人类输入的电子邮件发送功能", + "nodes.humanInput.deliveryMethod.upgradeTipContent": "在 Agent 采取行动之前,通过电子邮件发送确认请求——适用于发布和审批工作流。", + "nodes.humanInput.deliveryMethod.upgradeTipHide": "关闭", "nodes.humanInput.editor.previewTip": "在预览模式下,操作按钮无法使用。", "nodes.humanInput.errorMsg.duplicateActionId": "用户操作中存在重复的操作 ID", "nodes.humanInput.errorMsg.emptyActionId": "操作 ID 不能为空",