feat: 更新手机号验证设置UI,优化显示逻辑并添加相关测试

This commit is contained in:
QLHazyCoder
2026-05-04 19:09:37 +08:00
parent b595f5366a
commit f2e6a1ed3e
14 changed files with 1230 additions and 89 deletions
+10 -4
View File
@@ -4079,15 +4079,21 @@
if (!normalizedActivation) {
throw new Error('步骤 2:接码平台返回的手机号订单无效。');
}
const countryConfig = resolveCountryConfigFromActivation(normalizedActivation, state);
const signupActivation = normalizeActivation({
...normalizedActivation,
countryId: countryConfig?.id ?? normalizedActivation.countryId,
countryLabel: normalizedActivation.countryLabel || countryConfig?.label || '',
}) || normalizedActivation;
await persistSignupPhoneRuntimeState({
signupPhoneNumber: normalizedActivation.phoneNumber,
signupPhoneActivation: normalizedActivation,
signupPhoneNumber: signupActivation.phoneNumber,
signupPhoneActivation: signupActivation,
signupPhoneVerificationRequestedAt: null,
signupPhoneVerificationPurpose: 'signup',
accountIdentifierType: 'phone',
accountIdentifier: normalizedActivation.phoneNumber,
accountIdentifier: signupActivation.phoneNumber,
});
return normalizedActivation;
return signupActivation;
});
}
+17
View File
@@ -24,6 +24,7 @@
setEmailState,
SIGNUP_ENTRY_URL,
SIGNUP_PAGE_INJECT_FILES,
waitForTabStableComplete = null,
waitForTabUrlMatch,
} = deps;
@@ -139,6 +140,22 @@
throw new Error(`注册身份提交后未能识别当前页面,既不是密码页、验证码页,也不是资料页。URL: ${landingUrl || 'unknown'}`);
}
if (landingState !== 'password_page' && typeof waitForTabStableComplete === 'function') {
const stableTab = await waitForTabStableComplete(tabId, {
timeoutMs: 45000,
retryDelayMs: 300,
stableMs: 800,
initialDelayMs: 300,
});
if (stableTab?.url) {
const stableState = resolveSignupPostIdentityState(stableTab.url);
if (stableState) {
landingUrl = stableTab.url;
landingState = stableState;
}
}
}
await ensureContentScriptReadyOnTab('signup-page', tabId, {
inject: SIGNUP_PAGE_INJECT_FILES,
injectSource: 'signup-page',
+11
View File
@@ -27,6 +27,7 @@
shouldUseCustomRegistrationEmail,
STANDARD_MAIL_VERIFICATION_RESEND_INTERVAL_MS,
throwIfStopped,
waitForTabStableComplete = null,
phoneVerificationHelpers = null,
resolveSignupMethod = () => 'email',
} = deps;
@@ -119,6 +120,16 @@
await chrome.tabs.update(signupTabId, { active: true });
throwIfStopped();
if (typeof waitForTabStableComplete === 'function') {
await addLog('步骤 4:等待注册验证码页面完成加载后再继续...', 'info');
await waitForTabStableComplete(signupTabId, {
timeoutMs: 45000,
retryDelayMs: 300,
stableMs: 800,
initialDelayMs: 300,
});
}
throwIfStopped();
await addLog('步骤 4:正在确认注册验证码页面是否就绪,必要时自动恢复密码页超时报错...');
const prepareRequest = {