fix: handle profile page after step 9 phone verify

This commit is contained in:
EmptyDust
2026-05-04 14:02:52 +08:00
parent 4410fea3d1
commit 67c5ab8830
5 changed files with 405 additions and 2 deletions
+25 -1
View File
@@ -6,6 +6,8 @@
addLog,
ensureStep8SignupPageReady,
fetchImpl = (...args) => fetch(...args),
generateRandomBirthday,
generateRandomName,
getOAuthFlowStepTimeoutMs,
getState,
sendToContentScript,
@@ -3295,13 +3297,35 @@
}
async function submitPhoneVerificationCode(tabId, code) {
const signupProfile = (
typeof generateRandomName === 'function'
&& typeof generateRandomBirthday === 'function'
)
? (() => {
const name = generateRandomName();
const birthday = generateRandomBirthday();
if (!name?.firstName || !name?.lastName || !birthday) {
return null;
}
return {
firstName: name.firstName,
lastName: name.lastName,
year: birthday.year,
month: birthday.month,
day: birthday.day,
};
})()
: null;
const timeoutMs = typeof getOAuthFlowStepTimeoutMs === 'function'
? await getOAuthFlowStepTimeoutMs(45000, { step: 9, actionLabel: 'submit phone verification code' })
: 45000;
const result = await sendToContentScriptResilient('signup-page', {
type: 'SUBMIT_PHONE_VERIFICATION_CODE',
source: 'background',
payload: { code },
payload: {
code,
...(signupProfile ? { signupProfile } : {}),
},
}, {
timeoutMs,
responseTimeoutMs: timeoutMs,