fix: add fresh attempt identity reset patch and corresponding tests

This commit is contained in:
QLHazyCoder
2026-05-30 02:41:00 +08:00
parent 3c0bc41794
commit 3b751e8ba3
2 changed files with 89 additions and 0 deletions
+26
View File
@@ -74,6 +74,31 @@
});
const DONE_NODE_STATUSES = new Set(['completed', 'manual_completed', 'skipped']);
function buildFreshAttemptIdentityResetPatch() {
return {
currentPhoneActivation: null,
phoneNumber: '',
accountIdentifierType: null,
accountIdentifier: '',
signupPhoneNumber: '',
signupPhoneActivation: null,
signupPhoneCompletedActivation: null,
signupPhoneVerificationRequestedAt: null,
signupPhoneVerificationPurpose: '',
currentPhoneVerificationCode: '',
currentPhoneVerificationCountdownEndsAt: 0,
currentPhoneVerificationCountdownWindowIndex: 0,
currentPhoneVerificationCountdownWindowTotal: 0,
email: null,
registrationEmailState: { ...EMPTY_REGISTRATION_EMAIL_STATE },
step8VerificationTargetEmail: '',
lastEmailTimestamp: null,
lastSignupCode: '',
lastLoginCode: '',
bindEmailSubmitted: false,
};
}
function isPhoneSignupFlow(state = {}) {
const resolvedSignupMethod = String(state?.resolvedSignupMethod || '').trim().toLowerCase();
if (resolvedSignupMethod === 'phone' || resolvedSignupMethod === 'email') {
@@ -703,6 +728,7 @@
attemptRun,
sessionId,
}),
...buildFreshAttemptIdentityResetPatch(),
currentNodeId: '',
nodeStatuses: buildFreshAttemptNodeStatuses(prevState),
autoRunRoundSummaries: serializeAutoRunRoundSummaries(totalRuns, roundSummaries),