feat: lay groundwork for multi-flow registries

This commit is contained in:
QLHazyCoder
2026-05-13 04:46:56 +08:00
parent 04f89620be
commit a85ed0ce89
28 changed files with 2775 additions and 92 deletions
@@ -95,6 +95,51 @@ return {
assert.equal(api.logs.some((entry) => /固定为邮箱注册/.test(entry.message)), true);
});
test('signup method resolution respects the shared flow capability registry when available', () => {
const api = new Function(`
const self = {
MultiPageFlowCapabilities: {
createFlowCapabilityRegistry() {
return {
resolveSidepanelCapabilities({ state = {}, signupMethod = 'email' } = {}) {
const phoneAllowed = String(state?.activeFlowId || '').trim().toLowerCase() === 'openai';
return {
canUsePhoneSignup: phoneAllowed,
effectiveSignupMethod: signupMethod === 'phone' && phoneAllowed ? 'phone' : 'email',
};
},
};
},
},
};
const SIGNUP_METHOD_EMAIL = 'email';
const SIGNUP_METHOD_PHONE = 'phone';
${extractFunction('normalizeSignupMethod')}
${extractFunction('canUsePhoneSignup')}
${extractFunction('resolveSignupMethod')}
return {
canUsePhoneSignup,
resolveSignupMethod,
};
`)();
assert.equal(api.canUsePhoneSignup({
activeFlowId: 'site-a',
phoneVerificationEnabled: true,
signupMethod: 'phone',
}), false);
assert.equal(api.resolveSignupMethod({
activeFlowId: 'site-a',
phoneVerificationEnabled: true,
signupMethod: 'phone',
}), 'email');
assert.equal(api.resolveSignupMethod({
activeFlowId: 'openai',
phoneVerificationEnabled: true,
signupMethod: 'phone',
}), 'phone');
});
test('background step definitions resolve titles from the frozen signup method', () => {
const api = new Function(`
const captured = [];