Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const AppendAfterErrorScreen = ({ attestationOptions }: { attestationOptions: st
void handleErrorSoft(situationCode, true, true, error);
break;
case AppendSituationCode.ClientExcludeCredentialsMatch:
void handleCredentialExistsError(error);
void handleCredentialExistsError(attestationOptions, error);
break;
case AppendSituationCode.ExplicitSkipByUser:
void handleSkip(situationCode, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ const AppendInitScreen = () => {
setAppendLoading(false);
break;
case AppendSituationCode.ClientExcludeCredentialsMatch:
void handleCredentialExistsError(error);
void handleCredentialExistsError(attestationOptions, error);
setAppendLoading(false);
break;
case AppendSituationCode.DeniedByPartialRollout:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,11 @@ const PasskeyListScreen = () => {
}

if (res.val.type === ConnectErrorType.ExcludeCredentialsMatch) {
return handleSituation(PasskeyListSituationCode.ClientExcludeCredentialsMatch, res.val);
return handleSituation(
PasskeyListSituationCode.ClientExcludeCredentialsMatch,
res.val,
startAppendRes.val.attestationOptions,
);
}

return handleSituation(PasskeyListSituationCode.CboApiNotAvailablePostAuthenticator, res.val);
Expand Down Expand Up @@ -171,15 +175,22 @@ const PasskeyListScreen = () => {
statefulLoader.current.finish();
};

const handleSituation = (situationCode: PasskeyListSituationCode, error?: ConnectError) => {
const handleSituation = (
situationCode: PasskeyListSituationCode,
error?: ConnectError,
attestationOptions?: string,
) => {
const messageCode = `situation: ${situationCode}`;
log.debug(messageCode);

const message = getPasskeyListErrorMessage(situationCode);
switch (situationCode) {
case PasskeyListSituationCode.ClientExcludeCredentialsMatch:
setAppendLoading(false);
void getConnectService().recordEventAppendCredentialExistsError(`${messageCode} ${error?.track()}`);
void getConnectService().recordEventAppendCredentialExistsError(
attestationOptions ?? '',
`${messageCode} ${error?.track()}`,
);
show(<AlreadyExistingModal hide={hide} />);
break;
case PasskeyListSituationCode.CboApiPasskeysNotSupportedLight:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface AppendProcessContextProps {
error?: ConnectError,
) => Promise<void>;
handleErrorHard: (situation: AppendSituationCode, expected: boolean, error?: ConnectError) => Promise<void>;
handleCredentialExistsError: (error?: ConnectError) => Promise<void>;
handleCredentialExistsError: (attestationOptions: string, error?: ConnectError) => Promise<void>;
handleSkip: (situation: AppendSituationCode, explicit?: boolean) => Promise<void>;
onReadMoreClick: () => Promise<void>;
flags: Flags | undefined;
Expand Down
4 changes: 2 additions & 2 deletions packages/connect-react/src/contexts/AppendProcessProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ export const AppendProcessProvider: FC<PropsWithChildren<Props>> = ({ children,
}, [getConnectService, config]);

const handleCredentialExistsError = useCallback(
async (error?: ConnectError) => {
async (attestationOptions: string, error?: ConnectError) => {
log.debug('error (credential-exists)');

await getConnectService().recordEventAppendCredentialExistsError(error?.track() ?? '');
await getConnectService().recordEventAppendCredentialExistsError(error?.track() ?? '', attestationOptions);
void config.onComplete('complete-noop', getConnectService().encodeClientState());
},
[getConnectService, config],
Expand Down
9 changes: 7 additions & 2 deletions packages/web-core/src/services/ConnectService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -644,8 +644,13 @@ export class ConnectService {
return this.#recordEvent(PasskeyEventType.UserAppendAfterLoginErrorBlacklisted);
}

recordEventAppendCredentialExistsError(messageCode: string) {
return this.#recordEvent(PasskeyEventType.AppendCredentialExists, messageCode);
recordEventAppendCredentialExistsError(messageCode: string, attestationOptions: string) {
let challenge;
if (attestationOptions) {
challenge = WebAuthnService.challengeFromAttestationOptions(attestationOptions);
}

return this.#recordEvent(PasskeyEventType.AppendCredentialExists, messageCode, challenge);
}

recordEventAppendError() {
Expand Down
Loading