feat(wechat): send rich subscribe welcome with clickable intro and bind links
Memind CI / Test, build, and release guards (push) Has been cancelled
Memind CI / Test, build, and release guards (push) Has been cancelled
New followers receive capability overview plus WeChat anchor links for the deep intro page and account binding instead of exposing raw URLs. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,5 +1,42 @@
|
||||
import { resolveWechatAddressName } from '../user/display-name.mjs';
|
||||
|
||||
export const DEFAULT_SUBSCRIBE_INTRO_URL =
|
||||
'https://m.tkmind.cn/MindSpace/a70ff537-8908-486e-9b6c-042e07cc25db/public/tkmind-deep-intro.html';
|
||||
|
||||
/** 103 生产默认绑定入口:{H5_PUBLIC_BASE_URL}/auth/wechat/authorize?intent=login */
|
||||
export const DEFAULT_PRODUCTION_BIND_URL =
|
||||
'https://m.tkmind.cn/auth/wechat/authorize?intent=login';
|
||||
|
||||
export function buildWechatTextLink(href, label) {
|
||||
const normalizedHref = String(href ?? '').trim();
|
||||
const normalizedLabel = String(label ?? '').trim();
|
||||
if (!normalizedHref) return normalizedLabel;
|
||||
if (!normalizedLabel) return normalizedHref;
|
||||
return `<a href="${normalizedHref}">${normalizedLabel}</a>`;
|
||||
}
|
||||
|
||||
export function buildSubscribeWelcomeText({ bindUrl, introUrl = DEFAULT_SUBSCRIBE_INTRO_URL } = {}) {
|
||||
const normalizedBindUrl = String(bindUrl ?? '').trim();
|
||||
const normalizedIntroUrl = String(introUrl ?? '').trim();
|
||||
const lines = [
|
||||
'欢迎关注 TKMind 智趣 👋',
|
||||
'',
|
||||
'在微信里直接发消息即可:',
|
||||
'· 问答、写作、翻译',
|
||||
'· 生成精美网页并给链接',
|
||||
'· 发图解读报告/截图',
|
||||
'· 设置定时提醒与每日推送',
|
||||
];
|
||||
if (normalizedIntroUrl) {
|
||||
lines.push('', '📖 了解更多:', buildWechatTextLink(normalizedIntroUrl, '点击链接'));
|
||||
}
|
||||
if (normalizedBindUrl) {
|
||||
lines.push('', '👉 先完成绑定再开始对话:', buildWechatTextLink(normalizedBindUrl, '点我绑定'));
|
||||
}
|
||||
lines.push('', '绑定后回复「你好」,或试试:', '「帮我做一个读书笔记页面」');
|
||||
return lines.join('\n');
|
||||
}
|
||||
|
||||
export function buildGreetingText(user) {
|
||||
const name = resolveWechatAddressName(user);
|
||||
return name ? `你好,${name}!我在呢,有什么需要?` : '你好!我在呢,有什么需要?';
|
||||
|
||||
Reference in New Issue
Block a user