This commit is contained in:
Your Name
2026-09-01 11:26:47 +08:00
parent 5bd5eae62d
commit 398f9f3726
357 changed files with 733 additions and 343 deletions
@@ -3,6 +3,8 @@ import fs from 'node:fs'
import ts from '../../admin/node_modules/typescript/lib/typescript.js'
const source = fs.readFileSync(new URL('../../admin/src/views/first_visit/wecom_promotion/components/promotion-automation.ts', import.meta.url), 'utf8')
const formSource = fs.readFileSync(new URL('../../admin/src/views/first_visit/wecom_promotion/components/PromotionAutomationForm.vue', import.meta.url), 'utf8')
const pageSource = fs.readFileSync(new URL('../../admin/src/views/first_visit/wecom_promotion/index.vue', import.meta.url), 'utf8')
const compiled = ts.transpileModule(source, { compilerOptions: { target: ts.ScriptTarget.ES2022, module: ts.ModuleKind.ESNext } }).outputText
const { defaultAutomationConfig, cloneAutomationConfig, serializeAutomationConfig, validateAutomationConfig, validateCustomTagName, validateWelcomeMessage, welcomeScheduleOverlap, previewTemplate } = await import(`data:text/javascript;base64,${Buffer.from(compiled).toString('base64')}`)
@@ -58,4 +60,7 @@ assert.equal(welcomeScheduleOverlap([
]), false)
assert.match(previewTemplate('{customer_name}-{employee_name}-{add_time}', '小陈'), /^张女士-小陈-\d{4}-\d{2}-\d{2}$/)
assert.equal(Array.from(previewTemplate('王'.repeat(30), '小陈', 20)).length, 20)
assert.match(formSource, /不会写入企微获客链接详情中的“欢迎语\/客户标签”配置/)
assert.match(formSource, /客户添加回调中立即发送渠道欢迎语并添加标签/)
assert.match(pageSource, /result\?\.automation_saved !== true/)
console.log('WECOM_PROMOTION_AUTOMATION_UI_OK')